#ifndef FUN_STDLIB_H
#define FUN_STDLIB_H

#include <math.h>

extern "C" {
#include <cord.h>
}

extern "C" double f2d(float const& f);
extern "C" float d2f(double const& d);

extern "C" int d2i(double const& i);
extern "C" int f2i(float const& i);

extern "C" double f2d(float const& f);
extern "C" float d2f(double const& d);

extern "C" double i2d(int const& i);
extern "C" float i2f(int const& i);

extern "C" CORD i2s(int const& i);
extern "C" int s2i(CORD const& s);

extern "C" CORD f2s(float const& i);
extern "C" float s2f(CORD const& s);

extern "C" char* s2cp(CORD const& s);

extern "C" CORD d2s(double const& i);
extern "C" double s2d(CORD const& s);

extern "C" void print(CORD const& s);
extern "C" void fprint(CORD const& f, CORD const& s);

extern "C" inline bool str_eq(CORD const& s, CORD const& t) { return CORD_cmp(s,t) == 0; }
extern "C" inline bool str_neq(CORD const& s, CORD const& t) { return CORD_cmp(s,t) != 0; }

extern "C" inline CORD str_cat(CORD const& x, CORD const& y) 
{ return CORD_cat(x, y); }


#if 0
template <>
inline char* __add<char*>(char* const& x, char* const& y) 
{ return CORD_cat(x, y); }
#endif

#if 0
bool ptr_eq(void*, void*);
bool ptr_neq(void*, void*);
#endif

#if 0
struct typeinfo {
  void* (*clone)(void*);
  void* (*copy)(void*,void*);
  void* (*alloc)();
};

extern struct typeinfo* __int_info;
extern struct typeinfo* __float_info;
extern struct typeinfo* __char_info;
extern struct typeinfo* __double_info;
#endif

#endif /* FUN_STDLIB_H */

