diff --git a/Microsoft QuickC v2/include/ASSERT.H b/Microsoft QuickC v2/INCLUDE/ASSERT.H similarity index 100% rename from Microsoft QuickC v2/include/ASSERT.H rename to Microsoft QuickC v2/INCLUDE/ASSERT.H diff --git a/Microsoft QuickC v2/include/BIOS.H b/Microsoft QuickC v2/INCLUDE/BIOS.H similarity index 100% rename from Microsoft QuickC v2/include/BIOS.H rename to Microsoft QuickC v2/INCLUDE/BIOS.H diff --git a/Microsoft QuickC v2/include/CONIO.H b/Microsoft QuickC v2/INCLUDE/CONIO.H similarity index 100% rename from Microsoft QuickC v2/include/CONIO.H rename to Microsoft QuickC v2/INCLUDE/CONIO.H diff --git a/Microsoft QuickC v2/include/CTYPE.H b/Microsoft QuickC v2/INCLUDE/CTYPE.H similarity index 100% rename from Microsoft QuickC v2/include/CTYPE.H rename to Microsoft QuickC v2/INCLUDE/CTYPE.H diff --git a/Microsoft QuickC v2/include/DIRECT.H b/Microsoft QuickC v2/INCLUDE/DIRECT.H similarity index 100% rename from Microsoft QuickC v2/include/DIRECT.H rename to Microsoft QuickC v2/INCLUDE/DIRECT.H diff --git a/Microsoft QuickC v2/include/DOS.H b/Microsoft QuickC v2/INCLUDE/DOS.H similarity index 100% rename from Microsoft QuickC v2/include/DOS.H rename to Microsoft QuickC v2/INCLUDE/DOS.H diff --git a/Microsoft QuickC v2/include/ERRNO.H b/Microsoft QuickC v2/INCLUDE/ERRNO.H similarity index 100% rename from Microsoft QuickC v2/include/ERRNO.H rename to Microsoft QuickC v2/INCLUDE/ERRNO.H diff --git a/Microsoft QuickC v2/include/FCNTL.H b/Microsoft QuickC v2/INCLUDE/FCNTL.H similarity index 100% rename from Microsoft QuickC v2/include/FCNTL.H rename to Microsoft QuickC v2/INCLUDE/FCNTL.H diff --git a/Microsoft QuickC v2/include/FLOAT.H b/Microsoft QuickC v2/INCLUDE/FLOAT.H similarity index 100% rename from Microsoft QuickC v2/include/FLOAT.H rename to Microsoft QuickC v2/INCLUDE/FLOAT.H diff --git a/Microsoft QuickC v2/include/GRAPH.H b/Microsoft QuickC v2/INCLUDE/GRAPH.H similarity index 100% rename from Microsoft QuickC v2/include/GRAPH.H rename to Microsoft QuickC v2/INCLUDE/GRAPH.H diff --git a/Microsoft QuickC v2/include/IO.H b/Microsoft QuickC v2/INCLUDE/IO.H similarity index 100% rename from Microsoft QuickC v2/include/IO.H rename to Microsoft QuickC v2/INCLUDE/IO.H diff --git a/Microsoft QuickC v2/include/LIMITS.H b/Microsoft QuickC v2/INCLUDE/LIMITS.H similarity index 100% rename from Microsoft QuickC v2/include/LIMITS.H rename to Microsoft QuickC v2/INCLUDE/LIMITS.H diff --git a/Microsoft QuickC v2/include/MALLOC.H b/Microsoft QuickC v2/INCLUDE/MALLOC.H similarity index 100% rename from Microsoft QuickC v2/include/MALLOC.H rename to Microsoft QuickC v2/INCLUDE/MALLOC.H diff --git a/Microsoft QuickC v2/include/MATH.H b/Microsoft QuickC v2/INCLUDE/MATH.H similarity index 100% rename from Microsoft QuickC v2/include/MATH.H rename to Microsoft QuickC v2/INCLUDE/MATH.H diff --git a/Microsoft QuickC v2/include/MEMORY.H b/Microsoft QuickC v2/INCLUDE/MEMORY.H similarity index 100% rename from Microsoft QuickC v2/include/MEMORY.H rename to Microsoft QuickC v2/INCLUDE/MEMORY.H diff --git a/Microsoft QuickC v2/include/PGCHART.H b/Microsoft QuickC v2/INCLUDE/PGCHART.H similarity index 100% rename from Microsoft QuickC v2/include/PGCHART.H rename to Microsoft QuickC v2/INCLUDE/PGCHART.H diff --git a/Microsoft QuickC v2/include/PROCESS.H b/Microsoft QuickC v2/INCLUDE/PROCESS.H similarity index 100% rename from Microsoft QuickC v2/include/PROCESS.H rename to Microsoft QuickC v2/INCLUDE/PROCESS.H diff --git a/Microsoft QuickC v2/include/SEARCH.H b/Microsoft QuickC v2/INCLUDE/SEARCH.H similarity index 100% rename from Microsoft QuickC v2/include/SEARCH.H rename to Microsoft QuickC v2/INCLUDE/SEARCH.H diff --git a/Microsoft QuickC v2/include/SETJMP.H b/Microsoft QuickC v2/INCLUDE/SETJMP.H similarity index 100% rename from Microsoft QuickC v2/include/SETJMP.H rename to Microsoft QuickC v2/INCLUDE/SETJMP.H diff --git a/Microsoft QuickC v2/include/SHARE.H b/Microsoft QuickC v2/INCLUDE/SHARE.H similarity index 100% rename from Microsoft QuickC v2/include/SHARE.H rename to Microsoft QuickC v2/INCLUDE/SHARE.H diff --git a/Microsoft QuickC v2/include/SIGNAL.H b/Microsoft QuickC v2/INCLUDE/SIGNAL.H similarity index 100% rename from Microsoft QuickC v2/include/SIGNAL.H rename to Microsoft QuickC v2/INCLUDE/SIGNAL.H diff --git a/Microsoft QuickC v2/include/STDARG.H b/Microsoft QuickC v2/INCLUDE/STDARG.H similarity index 100% rename from Microsoft QuickC v2/include/STDARG.H rename to Microsoft QuickC v2/INCLUDE/STDARG.H diff --git a/Microsoft QuickC v2/include/STDDEF.H b/Microsoft QuickC v2/INCLUDE/STDDEF.H similarity index 100% rename from Microsoft QuickC v2/include/STDDEF.H rename to Microsoft QuickC v2/INCLUDE/STDDEF.H diff --git a/Microsoft QuickC v2/include/STDIO.H b/Microsoft QuickC v2/INCLUDE/STDIO.H similarity index 100% rename from Microsoft QuickC v2/include/STDIO.H rename to Microsoft QuickC v2/INCLUDE/STDIO.H diff --git a/Microsoft QuickC v2/include/STDLIB.H b/Microsoft QuickC v2/INCLUDE/STDLIB.H similarity index 100% rename from Microsoft QuickC v2/include/STDLIB.H rename to Microsoft QuickC v2/INCLUDE/STDLIB.H diff --git a/Microsoft QuickC v2/include/STRING.H b/Microsoft QuickC v2/INCLUDE/STRING.H similarity index 100% rename from Microsoft QuickC v2/include/STRING.H rename to Microsoft QuickC v2/INCLUDE/STRING.H diff --git a/Microsoft QuickC v2/include/SYS/LOCKING.H b/Microsoft QuickC v2/INCLUDE/SYS/LOCKING.H similarity index 100% rename from Microsoft QuickC v2/include/SYS/LOCKING.H rename to Microsoft QuickC v2/INCLUDE/SYS/LOCKING.H diff --git a/Microsoft QuickC v2/include/SYS/STAT.H b/Microsoft QuickC v2/INCLUDE/SYS/STAT.H similarity index 100% rename from Microsoft QuickC v2/include/SYS/STAT.H rename to Microsoft QuickC v2/INCLUDE/SYS/STAT.H diff --git a/Microsoft QuickC v2/include/SYS/TIMEB.H b/Microsoft QuickC v2/INCLUDE/SYS/TIMEB.H similarity index 100% rename from Microsoft QuickC v2/include/SYS/TIMEB.H rename to Microsoft QuickC v2/INCLUDE/SYS/TIMEB.H diff --git a/Microsoft QuickC v2/include/SYS/TYPES.H b/Microsoft QuickC v2/INCLUDE/SYS/TYPES.H similarity index 100% rename from Microsoft QuickC v2/include/SYS/TYPES.H rename to Microsoft QuickC v2/INCLUDE/SYS/TYPES.H diff --git a/Microsoft QuickC v2/include/SYS/UTIME.H b/Microsoft QuickC v2/INCLUDE/SYS/UTIME.H similarity index 100% rename from Microsoft QuickC v2/include/SYS/UTIME.H rename to Microsoft QuickC v2/INCLUDE/SYS/UTIME.H diff --git a/Microsoft QuickC v2/include/TIME.H b/Microsoft QuickC v2/INCLUDE/TIME.H similarity index 100% rename from Microsoft QuickC v2/include/TIME.H rename to Microsoft QuickC v2/INCLUDE/TIME.H diff --git a/Microsoft QuickC v2/include/VARARGS.H b/Microsoft QuickC v2/INCLUDE/VARARGS.H similarity index 100% rename from Microsoft QuickC v2/include/VARARGS.H rename to Microsoft QuickC v2/INCLUDE/VARARGS.H diff --git a/Microsoft QuickC v2/TM.C b/Microsoft QuickC v2/TM.C new file mode 100644 index 0000000..003a95c --- /dev/null +++ b/Microsoft QuickC v2/TM.C @@ -0,0 +1,165 @@ +#include + +#ifdef AZTEC86 +#include +#endif + +#ifdef HISOFTC +#include +#endif + +#ifdef WATCOM +#include +#include +#endif + + +#ifdef powerc +#define allocs 50 +#else +#ifdef HISOFTC +#define allocs 66 /* not enough RAM with hisoft to go higher */ +#else +/* most c runtimes work up to 69, but use 66 to have a consistent benchmark */ +#define allocs 66 +#endif +#endif + +int logging = 1; + +char * memset_x( p, v, c ) char * p; int v; int c; +{ + unsigned char * pc = (unsigned char *) p; + unsigned char val = (unsigned char) ( v & 0xff ); + int i; + + if ( 0 == p ) + { + printf( "request to memset a null pointer\n" ); + exit( 1 ); + } + + if ( logging ) +#ifdef CPMTIME + printf( " memset p %u, v %d, val %x, c %d\n", p, v, val, c ); +#else + +#ifdef HISOFTC + printf( " memset p %u, v %d, val %x, c %d\n", p, v, val, c ); +#else + printf( " memset p %p, v %d, val %x, c %d\n", p, v, val, c ); +#endif +#endif + + for ( i = 0; i < c; i++ ) + *pc++ = val; + return p; +} + +void chkmem( p, v, c ) char * p; int v; int c; +{ + unsigned char * pc = (unsigned char *) p; + unsigned char val = (unsigned char) ( v & 0xff ); + int i; + + if ( 0 == p ) + { + printf( "request to chkmem a null pointer\n" ); + exit( 1 ); + } + + for ( i = 0; i < c; i++ ) + { + if ( *pc != val ) + { +#ifdef CPMTIME + printf( "memory isn't as expected! p %u, v %d, c %d, *pc %d\n",p, v, c, *pc ); +#else + printf( "memory isn't as expected! p %p, v %d, c %d, *pc %d\n",p, v, c, *pc ); +#endif + exit( 1 ); + } + pc++; + } +} + +int main( argc, argv ) int argc; char * argv[]; +{ + int i, cb, c_cb, j; + char * pc; + char * ap[ allocs ]; + + logging = ( argc > 1 ); + pc = argv[ 0 ]; /* evade compiler warning */ + + for ( j = 0; j < 10; j++ ) + { + if ( logging ) + printf( "in alloc mode\n" ); + + for ( i = 0; i < allocs; i++ ) + { + cb = 8 + ( i * 10 ); + c_cb = cb + 5; + if ( logging ) + printf( " i, cb: %d %d\n", i, cb ); + + pc = (char *) calloc( c_cb, 1 ); + chkmem( pc, 0, c_cb ); + memset_x( pc, 0xcc, c_cb ); + + ap[ i ] = (char *) malloc( cb ); + memset_x( ap[ i ], 0xaa, cb ); + + chkmem( pc, 0xcc, c_cb ); + free( pc ); + } + + if ( logging ) + printf( "in free mode, even first\n" ); + + for ( i = 0; i < allocs; i += 2 ) + { + cb = 8 + ( i * 10 ); + c_cb = cb + 3; + if ( logging ) + printf( " i, cb: %d %d\n", i, cb ); + + pc = (char *) calloc( c_cb, 1 ); + chkmem( pc, 0, c_cb ); + memset_x( pc, 0xcc, c_cb ); + + chkmem( ap[ i ], 0xaa, cb ); + memset_x( ap[ i ], 0xff, cb ); + free( ap[ i ] ); + + chkmem( pc, 0xcc, c_cb ); + free( pc ); + } + + if ( logging ) + printf( "in free mode, now odd\n" ); + + for ( i = 1; i < allocs; i += 2 ) + { + cb = 8 + ( i * 10 ); + c_cb = cb + 7; + if ( logging ) + printf( " i, cb: %d %d\n", i, cb ); + + pc = (char *) calloc( c_cb, 1 ); + chkmem( pc, 0, c_cb ); + memset_x( pc, 0xcc, c_cb ); + + chkmem( ap[ i ], 0xaa, cb ); + memset_x( ap[ i ], 0xff, cb ); + free( ap[ i ] ); + + chkmem( pc, 0xcc, c_cb ); + free( pc ); + } + } + + printf( "success\n" ); + return 0; +} diff --git a/Microsoft QuickC v2/m.bat b/Microsoft QuickC v2/m.bat index 1431fb7..c920c18 100644 --- a/Microsoft QuickC v2/m.bat +++ b/Microsoft QuickC v2/m.bat @@ -1 +1 @@ -ntvdm -r:. -f -t /e:include=include,lib=lib qcl /Gs /Ox /DDOSTIME %1.c +ntvdm -r:. -f /e:include=include,lib=lib qcl /Gs /Ox /DDOSTIME %1.c diff --git a/Microsoft QuickC v2/m.sh b/Microsoft QuickC v2/m.sh new file mode 100644 index 0000000..004106e --- /dev/null +++ b/Microsoft QuickC v2/m.sh @@ -0,0 +1,10 @@ +str=$(tr '[a-z]' '[A-Z]' <<< $1) + +rm $str.EXE 2>/dev/null +rm $str.OBJ 2>/dev/null + +ntvdm -u -r:. -f -e:include=include,lib=lib qcl /Gs /Ox /DDOSTIME $str.c + +rm $str.OBJ 2>/dev/null + +ntvdm -u -r:. -c -p $str