1 #include "f2c.h" 2 #undef abs 3 #undef min 4 #undef max 5 #include "stdio.h" 6 7 static integer memfailure = 3; 8 9 #ifdef KR_headers 10 extern char *malloc(); 11 extern void exit_(); 12 13 char * F77_aloc(Len,whence)14F77_aloc(Len, whence) integer Len; char *whence; 15 #else 16 #include "stdlib.h" 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 extern void exit_(integer*); 24 #ifdef __cplusplus 25 } 26 #endif 27 28 char * 29 F77_aloc(integer Len, const char *whence) 30 #endif 31 { 32 char *rv; 33 unsigned int uLen = (unsigned int) Len; /* for K&R C */ 34 35 if (!(rv = (char*)malloc(uLen))) { 36 fprintf(stderr, "malloc(%u) failure in %s\n", 37 uLen, whence); 38 exit_(&memfailure); 39 } 40 return rv; 41 } 42 #ifdef __cplusplus 43 } 44 #endif 45