PSI_DECL(double atof, [(char *str)])
PSI_DECL(int atoi, [(char *str)])
PSI_DECL(long atol, [(char *str)])
+ PSI_DECL(void *calloc, [(size_t nmemb, size_t size)])
PSI_DECL(div_t div, [(int numerator, int denominator)])
PSI_DECL(double drand48, [()])
PSI_DECL(double erand48, [(unsigned short xsubi@<:@3@:>@)])
PSI_DECL(ldiv_t ldiv, [(long numerator, long denominator)])
PSI_DECL(lldiv_t lldiv, [(long long numerator, long long denominator)])
PSI_DECL(long lrand48, [()])
+ PSI_DECL(void *malloc, [(size_t size)])
PSI_DECL(int mblen, [(const char *s, size_t n)])
PSI_DECL(size_t mbstowcs, [(wchar_t *dest, char *src, size_t n)])
PSI_DECL(int mbtowc, [(wchar_t *pwc, char *s, size_t n)])
PSI_DECL(int rand, [()])
PSI_DECL(int rand_r, [(unsigned *seed_p)])
PSI_DECL(long random, [()])
+ PSI_DECL(void *realloc, [(void *ptr, size_t size)])
PSI_DECL(char *realpath, [(char *path, char *resolved)])
PSI_DECL(unsigned short *seed48, [(unsigned short seed16v@<:@3@:>@)])
PSI_DECL(int setenv, [(char *var, char *val, int overwrite)])
let ptr = objval($memory);
return void(free);
}
+
+function psi\malloc(int $size) : object {
+ let size = intval($size);
+ pre_assert size >= 0;
+ return to_object(malloc);
+}
+
+function psi\calloc(int $nmemb, int $size) : object {
+ let nmemb = intval($nmemb);
+ let size = intval($size);
+ pre_assert size >= 0;
+ return to_object(calloc);
+}
+
+function psi\realloc(object $obj, int $size) : object {
+ let ptr = objval($obj);
+ let size = intval($size);
+ pre_assert size >= 0;
+ return to_object(realloc);
+}