55 #undef __STRICT_ANSI__
80 #define CHECK(PARAM1,PARAM2,BODY) \
81 if( strcmp(*argv,PARAM1)==0 || strcmp(*argv,PARAM2)==0 ) \
148 option_texts[j][i] =
USE(
CAR(t));
176 PRINT(
" %10s %8s %8s %8s %8s\n",
"Atom type",
"Max",
"Allocs",
"Deallocs",
"Balance");
177 PRINT(
" %10s %8s %8s %8s %8s\n",
"----------",
"--------",
"--------",
"--------",
"--------");
181 if( stats[i].allocs )
183 PRINT(
" %10s %8d %8d %8d %8d\n",
188 stats[i].allocs-stats[i].deallocs );
191 PRINT(
" %39s\n",
"----------------");
192 PRINT(
" %30s %8d\n",
"Used",stats_used);
194 PRINT(
" %39s\n",
"----------------");
211 for( j = 0; j<4; j++ )
213 DEUSE(option_texts[j][i]);
216 DEUSE( standalone_arguments );
236 stats_used += stats[i].allocs-stats[i].deallocs;
261 outter(
TEXT(
" [" VERSION_STR
", " OS_NAME
"-" PROCESSOR_NAME
"(" LANG_STR "), " __DATE__
"]\n\n"), -1 );
281 len =
LENGTH(option_texts[0][i]);
283 dump( option_texts[0][i] );
284 for( ; len<6; len++ )
outter(
TEXT(
" "), -1 );
287 len =
LENGTH(option_texts[2][i]);
290 dump( option_texts[2][i] );
294 len =
LENGTH(option_texts[1][i]);
295 dump( option_texts[1][i] );
297 for( ; len<30; len++ )
outter(
TEXT(
" "), -1 );
300 dumpln( option_texts[3][i] );
342 if( !err )
goto ready;
346 envpath = strdup( getenv(
"PATH") );
353 strcpy( filename, path );
358 err = stat( filename, &buffer );
412 for( argc--,argv++; argc--; argv++ )
415 append( word, &standalone_arguments, &last );
420 for( argc--,argv++; argc--; argv++ )
425 append ( word, &standalone_arguments, &last );
438 if( len==
LENGTH(option_texts[j][i]) )
457 if( found )
continue;
504 void*
alloc(
int size,
const char* func,
const char* file,
const int line )
506 void* buffer = malloc( size );
507 printf(
"<HEAP> +[%08x] %d bytes %s(%s:%d)\n",(
int)buffer,size,func,file,line );
515 void*
reallocate(
void * mem,
int size,
const char* func,
const char* file,
const int line )
520 void* buffer = realloc (mem, size);
522 printf(
"<HEAP> +[%08x] extended with %d bytes %s(%s:%d)\n", (
int)buffer, size, func, file, line);
528 void*
xalloc(
int size,
const char* func,
const char* file,
const int line )
530 #if defined(WINDOWS) || defined(APPLE)
531 void* buffer = malloc( size );
533 void* buffer = valloc( size );
534 if( buffer ) {mprotect( buffer, size, PROT_READ | PROT_WRITE | PROT_EXEC );}
537 printf(
"<HEAP> +[%08x] %d bytes %s(%s:%d)\n",(
int)buffer,size,func,file,line );
545 void dealloc(
void* ptr,
const char* func,
const char* file,
const int line )
547 printf(
"<HEAP> -[%08x] %s(%s:%d)\n",(
int)ptr,func,file,line );
554 void*
alloc(
int size )
556 void* buffer = malloc( size );
569 void* buffer = realloc(mem, size);
576 #if defined(WINDOWS) || defined(APPLE)
577 void* buffer = malloc( size );
579 void* buffer = valloc( size );
580 mprotect( buffer, size, PROT_READ | PROT_WRITE | PROT_EXEC );