diff -rc Genesis-1.0p22/README Genesis-1.0p23/README *** Genesis-1.0p22/README Sat Dec 21 17:46:28 1996 --- Genesis-1.0p23/README Thu Jan 30 14:04:02 1997 *************** *** 3,9 **** http://www.cold.org/support/ ------------------------------------------------------------------------ ! INSTALL/COMPILATION To compile simply type 'make'. --- 3,9 ---- http://www.cold.org/support/ ------------------------------------------------------------------------ ! INSTALL/COMPILATION IN UNIX To compile simply type 'make'. *************** *** 12,17 **** --- 12,44 ---- your world directory (wherever it may be). The directory 'bin' contains a few useful scripts. + + NOTE: Because SunOS 4.1.x is not POSIX compliant nor even ANSI complaint + there are certain problems that will arise in running Genesis on + that type of system. Unfortunately, they are serious problems + which cause unstability in Genesis. We suggest upgrading to + a modern operating system. NetBSD will likely run on your same + hardware, and is free. + + ------------------------------------------------------------------------ + INSTALL/COMPILATION IN WIN32 + + You will need an ndbm implementation in Win32. You can get GNU's ndbm + implementation (gdbm) to cover this role. + + You must first have access to a unix system, with either bison or yacc. + Login to the unix system, untar the source, run configure, after it is + finished change directory to the 'src' directory and type 'make Win32'. + After this is finished tar (or zip) the resulting source tree and move + it to a Win32 platform. You will need to edit src/include/defs.h and + change it so the __Win32__ definition is ENABLED (__UNIX__ will be by + default). From there compile it within your favorite compiler. You + may need to setup a project. I'm not sure any Win32 make program will + have the same syntax as unix make, unless you have GNU make. + + Basically, the source is compilable in Win32. However, getting it to + a compiler and sequencing the compiler to link everything correctly is + up to you. ------------------------------------------------------------------------ RELEASE INFORMATION diff -rc Genesis-1.0p22/configure Genesis-1.0p23/configure *** Genesis-1.0p22/configure Fri Dec 20 14:15:23 1996 --- Genesis-1.0p23/configure Mon Feb 3 10:06:53 1997 *************** *** 1019,1028 **** fi ! for ac_hdr in fcntl.h sys/file.h sys/time.h unistd.h do ac_safe=`echo "$ac_hdr" | tr './\055' '___'` ! echo $ac_n " Checking for $ac_hdr""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else --- 1019,1028 ---- fi ! for ac_hdr in fcntl.h sys/file.h sys/time.h unistd.h vfork.h do ac_safe=`echo "$ac_hdr" | tr './\055' '___'` ! echo $ac_n " Checking for <$ac_hdr>""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 1055,1060 **** --- 1055,1103 ---- fi done + ac_safe=`echo "ndbm.h" | tr './\055' '___'` + echo $ac_n " Checking for ""... $ac_c" 1>&6 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + ac_err=`grep -v '^ *+' conftest.out` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF + #define HAVE_NDBM_H 1 + EOF + + else + cat <&6 if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 *************** *** 1334,1340 **** ! echo $ac_n " Checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else --- 1377,1383 ---- ! echo $ac_n " Checking whether struct tm is in or ""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 1465,1502 **** fi fi - ac_safe=`echo "vfork.h" | tr './\055' '___'` - echo $ac_n " Checking for vfork.h""... $ac_c" 1>&6 - if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 - else - cat > conftest.$ac_ext < - EOF - eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" - ac_err=`grep -v '^ *+' conftest.out` - if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" - else - echo "$ac_err" >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" - fi - rm -f conftest* - fi - if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF - #define HAVE_VFORK_H 1 - EOF - - else - echo "$ac_t""no" 1>&6 - fi - # lib -lnsl (Solaris) echo $ac_n " Checking for -lnsl""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_lib_nsl'+set}'`\" = set"; then --- 1508,1513 ---- *************** *** 1639,1644 **** --- 1650,1656 ---- ## check for a dbm library to use.. ## -lgdbm has priority over -lndbm # + have_dbm=no echo $ac_n " Checking for -lgdbm""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_lib_gdbm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 *************** *** 1669,1684 **** if eval "test \"`echo '$ac_cv_lib_'gdbm`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="-lgdbm $LIBS" ! else echo "$ac_t""no" 1>&6 ! echo $ac_n " Checking for -lndbm""... $ac_c" 1>&6 ! if eval "test \"`echo '$''{'ac_cv_lib_ndbm'+set}'`\" = set"; then ! echo $ac_n "(cached) $ac_c" 1>&6 ! else ! ac_save_LIBS="$LIBS" ! LIBS="-lndbm $LIBS" ! cat > conftest.$ac_ext <&6 LIBS="-lgdbm $LIBS" ! else echo "$ac_t""no" 1>&6 ! echo $ac_n " Checking for -lndbm""... $ac_c" 1>&6 ! if eval "test \"`echo '$''{'ac_cv_lib_ndbm'+set}'`\" = set"; then ! echo $ac_n "(cached) $ac_c" 1>&6 ! else ! ac_save_LIBS="$LIBS" ! LIBS="-lndbm $LIBS" ! cat > conftest.$ac_ext <&6 ! if [ $SYS = "hp-hpux" ]; then ! cat <&6 fi fi --- 1699,1730 ---- dbm_open() ; return 0; } EOF ! if eval $ac_link; then ! rm -rf conftest* ! eval "ac_cv_lib_ndbm=yes" ! else ! rm -rf conftest* ! eval "ac_cv_lib_ndbm=no" ! fi ! rm -f conftest* ! LIBS="$ac_save_LIBS" ! if eval "test \"`echo '$ac_cv_lib_'ndbm`\" = yes"; then ! echo "$ac_t""yes" 1>&6 ! if [ $SYS = "hp-hpux" ]; then ! cat <&6 fi fi fi *************** *** 2599,2607 **** s%@YACC@%$YACC%g s%@CPP@%$CPP%g s%@VERSION@%$VERSION%g ! s%@VMAJOR@%$VERSION_MAJOR%g ! s%@VMINOR@%$VERSION_MINOR%g ! s%@VPATCH@%$VERSION_PATCH%g CEOF EOF --- 2610,2618 ---- s%@YACC@%$YACC%g s%@CPP@%$CPP%g s%@VERSION@%$VERSION%g ! s%@VMAJOR@%$VMAJOR%g ! s%@VMINOR@%$VMINOR%g ! s%@VPATCH@%$VPATCH%g CEOF EOF *************** *** 2753,2759 **** echo "#define sys_${SYS}" >> conftest.h echo "#define vendor_${VENDOR}" >> conftest.h echo "#define cpu_${CPU}" >> conftest.h ! echo "#define HOSTNAME $hostname" >> conftest.h echo "#endif" >> conftest.h rm -f $ac_file mv conftest.h $ac_file --- 2764,2770 ---- echo "#define sys_${SYS}" >> conftest.h echo "#define vendor_${VENDOR}" >> conftest.h echo "#define cpu_${CPU}" >> conftest.h ! echo "#define HOSTNAME $HOSTNAME" >> conftest.h echo "#endif" >> conftest.h rm -f $ac_file mv conftest.h $ac_file diff -rc Genesis-1.0p22/doc/CHANGES Genesis-1.0p23/doc/CHANGES *** Genesis-1.0p22/doc/CHANGES Wed Jan 15 10:55:26 1997 --- Genesis-1.0p23/doc/CHANGES Tue Feb 4 09:32:02 1997 *************** *** 6,11 **** --- 6,19 ---- contributors to that version. ------------------------------------------------------------------------- + 1.0-23 [4-Feb-97] Miro, Brandon, Jon Lambert + * Wrapped up Win32 support in the source (Jon Lambert) + * Fixed bug in task cancelling (Miro) + * Fixed minor bug in split() (if last element was blank, and "b" + flag was given, it still wouldn't show up) (Brandon) + * Standardized arg ... [more]; format to follow scatter assignments, + will accept both formats but decompile as @more now. (Miro) + * fixed a bug in join() (Brandon) 1.0-22 [15-Jan-97] Brian, Miro, Brandon * fixed corruption bug in scatter assignments causing crashes (Miro) * fixed leak in scatter assignment (Miro) diff -rc Genesis-1.0p22/etc/version Genesis-1.0p23/etc/version *** Genesis-1.0p22/etc/version Wed Jan 15 11:05:13 1997 --- Genesis-1.0p23/etc/version Tue Jan 28 14:54:19 1997 *************** *** 1 **** ! 1.0p22 --- 1 ---- ! 1.0p23 diff -rc Genesis-1.0p22/src/Makefile.in Genesis-1.0p23/src/Makefile.in *** Genesis-1.0p22/src/Makefile.in Fri Sep 20 16:19:18 1996 --- Genesis-1.0p23/src/Makefile.in Thu Jan 30 13:58:17 1997 *************** *** 22,27 **** --- 22,30 ---- DATADIR=$(SRCDIR)/data VERSION=@VERSION@ + VMAJOR=@VMAJOR@ + VMINOR=@VMINOR@ + VPATCH=@VPATCH@ DATA_O = data/data.o data/buffer.o data/dict.o data/ident.o\ data/list.o data/object.o data/string.o *************** *** 54,65 **** all: $(GRAMMAR_O) include/parse.h Data Modules Ops $(EXES) - win32: - make scrub - $(YACC) $(YFLAGS) grammar.y - mv -f y.tab.c grammar.c - mv -f y.tab.h include/parse.h - Data: @echo "data objects..." @cd $(DATADIR); make --- 57,62 ---- *************** *** 148,151 **** --- 145,162 ---- reconfig: scrub config config: @cd ../; configure + + win32: Win32 + + Win32: + @echo "cleaning heirarchy..." + @make scrub 2>&1 > /dev/null + @echo "creating config file..." + @sed -e "s/#VMAJOR#/#define VERSION_MAJOR $(VMAJOR)/;\ + s/#VMINOR#/#define VERSION_MINOR $(VMINOR)/;\ + s/#VPATCH#/#define VERSION_PATCH $(VPATCH)/" include/config.h.win32 > include/config.h + @echo "generating parser source..." + @$(YACC) $(YFLAGS) grammar.y + @mv -f y.tab.c grammar.c + @mv -f y.tab.h include/parse.h diff -rc Genesis-1.0p22/src/binarydb.c Genesis-1.0p23/src/binarydb.c *** Genesis-1.0p22/src/binarydb.c Thu Oct 24 18:47:30 1996 --- Genesis-1.0p23/src/binarydb.c Wed Jan 29 17:53:52 1997 *************** *** 10,21 **** #include "defs.h" #include #include #include #include #include - #include #include "cdc_db.h" #include "util.h" --- 10,23 ---- #include "defs.h" + #ifdef __UNIX__ #include + #endif + #include #include #include #include #include "cdc_db.h" #include "util.h" *************** *** 102,110 **** struct stat statbuf; FILE * fp; char buf[LINE], ! v_major[WORD], ! v_minor[WORD], ! v_patch[WORD], magicmod[LINE], fdb_clean[LINE], fdb_objects[LINE], --- 104,112 ---- struct stat statbuf; FILE * fp; char buf[LINE], ! v_major[LINE], ! v_minor[LINE], ! v_patch[LINE], magicmod[LINE], fdb_clean[LINE], fdb_objects[LINE], *************** *** 129,137 **** fp = fopen(fdb_clean, "rb"); if (fp) { ! if (fgets(v_major, WORD, fp) && atoi(v_major)==VERSION_MAJOR) { ! if (fgets(v_minor, WORD, fp) && atoi(v_minor)==VERSION_MINOR) { ! if (fgets(v_patch, WORD, fp) && atoi(v_patch)==VERSION_PATCH) { if (fgets(magicmod, LINE, fp)&&atol(magicmod)==MAGIC_MODNUMBER) { fgets(buf, LINE, fp); cur_search = atoi(buf); --- 131,139 ---- fp = fopen(fdb_clean, "rb"); if (fp) { ! if (fgets(v_major, LINE, fp) && atoi(v_major)==VERSION_MAJOR) { ! if (fgets(v_minor, LINE, fp) && atoi(v_minor)==VERSION_MINOR) { ! if (fgets(v_patch, LINE, fp) && atoi(v_patch)==VERSION_PATCH) { if (fgets(magicmod, LINE, fp)&&atol(magicmod)==MAGIC_MODNUMBER) { fgets(buf, LINE, fp); cur_search = atoi(buf); *************** *** 184,190 **** DBFILE(fdb_index, "index"); open_db_directory(); ! open_db_objects("w+"); lookup_open(fdb_index, 1); init_bitmaps(); sync_index(); --- 186,192 ---- DBFILE(fdb_index, "index"); open_db_directory(); ! open_db_objects("wb+"); lookup_open(fdb_index, 1); init_bitmaps(); sync_index(); *************** *** 602,608 **** strcpy(buf, c_dir_binary); strcat(buf, ".bak/.clean"); ! fp = open_scratch_file(buf, "w"); if (!fp) panic("Cannot create file 'clean'."); fprintf(fp, "%d\n%d\n%d\n%li\n%li\n", --- 604,610 ---- strcpy(buf, c_dir_binary); strcat(buf, ".bak/.clean"); ! fp = open_scratch_file(buf, "wb"); if (!fp) panic("Cannot create file 'clean'."); fprintf(fp, "%d\n%d\n%d\n%li\n%li\n", *************** *** 619,625 **** return; /* Create 'clean' file. */ ! fp = open_scratch_file(c_clean_file, "w"); if (!fp) panic("Cannot create file 'clean'."); fprintf(fp, "%d\n%d\n%d\n%li\n%li\n", --- 621,627 ---- return; /* Create 'clean' file. */ ! fp = open_scratch_file(c_clean_file, "wb"); if (!fp) panic("Cannot create file 'clean'."); fprintf(fp, "%d\n%d\n%d\n%li\n%li\n", diff -rc Genesis-1.0p22/src/coldcc.c Genesis-1.0p23/src/coldcc.c *** Genesis-1.0p22/src/coldcc.c Fri Nov 29 21:40:35 1996 --- Genesis-1.0p23/src/coldcc.c Thu Jan 30 13:39:09 1997 *************** *** 39,45 **** INTERNAL FILE * find_text_db(void); INTERNAL void compile_db(Int type); ! INTERNAL void shutdown(void) { cache_sync(); db_close(); flush_output(); --- 39,45 ---- INTERNAL FILE * find_text_db(void); INTERNAL void compile_db(Int type); ! void shutdown_coldcc(void) { cache_sync(); db_close(); flush_output(); *************** *** 75,81 **** } fputs("Closing binary database...", stderr); ! shutdown(); /* make compilers happy; we never reach this */ return 0; --- 75,81 ---- } fputs("Closing binary database...", stderr); ! shutdown_coldcc(); /* make compilers happy; we never reach this */ return 0; diff -rc Genesis-1.0p22/src/crypt.c Genesis-1.0p23/src/crypt.c *** Genesis-1.0p22/src/crypt.c Mon Sep 23 18:59:53 1996 --- Genesis-1.0p23/src/crypt.c Tue Feb 4 09:36:45 1997 *************** *** 135,146 **** * */ ! void ! to64(s, v, n) ! char *s; ! unsigned long v; ! int n; ! { while (--n >= 0) { *s++ = ascii64[v&0x3f]; v >>= 6; --- 135,141 ---- * */ ! void to64(char *s, unsigned long v, int n) { while (--n >= 0) { *s++ = ascii64[v&0x3f]; v >>= 6; diff -rc Genesis-1.0p22/src/decode.c Genesis-1.0p23/src/decode.c *** Genesis-1.0p22/src/decode.c Fri Nov 29 09:48:58 1996 --- Genesis-1.0p23/src/decode.c Sat Jan 18 20:44:17 1997 *************** *** 437,446 **** str = string_add_chars(str, ", ", 2); } if (method->rest != -1) { ! str = string_addc(str, '['); s = ident_name(object_get_ident(object, method->rest)); str = string_add_chars(str, s, strlen(s)); - str = string_addc(str, ']'); } str = string_addc(str, ';'); output = add_and_discard_string(output, str); --- 437,445 ---- str = string_add_chars(str, ", ", 2); } if (method->rest != -1) { ! str = string_addc(str, '@'); s = ident_name(object_get_ident(object, method->rest)); str = string_add_chars(str, s, strlen(s)); } str = string_addc(str, ';'); output = add_and_discard_string(output, str); diff -rc Genesis-1.0p22/src/defs.c Genesis-1.0p23/src/defs.c *** Genesis-1.0p22/src/defs.c Mon Jan 13 10:20:50 1997 --- Genesis-1.0p23/src/defs.c Thu Jan 30 10:44:40 1997 *************** *** 2,8 **** // Full copyright information is available in the file ../doc/CREDITS */ ! #define _defs_ #include #include --- 2,8 ---- // Full copyright information is available in the file ../doc/CREDITS */ ! #define DEFS_C #include #include diff -rc Genesis-1.0p22/src/execute.c Genesis-1.0p23/src/execute.c *** Genesis-1.0p22/src/execute.c Thu Dec 26 10:52:06 1996 --- Genesis-1.0p23/src/execute.c Tue Feb 4 09:28:53 1997 *************** *** 41,46 **** --- 41,47 ---- #define DEBUG_VM DISABLED #define DEBUG_EXECUTE DISABLED + void clear_debug(void); cData debug; VMState *suspended = NULL, *preempted = NULL, *vmstore = NULL; *************** *** 165,172 **** // --------------------------------------------------------------- */ void task_delete(VMState *list, VMState *elem) { - if (list != suspended) - list = list->next; while (list && (list->next != elem)) list = list->next; if (list) --- 166,171 ---- *************** *** 377,382 **** --- 376,403 ---- init_execute(); cur_frame = NULL; } + + /* + // --------------------------------------------------------------- + // Nothing calls this function - it's here as a VM debug utility + */ + #if DISABLED + void show_queues(void) { + VMState * v; + + fputs("preempted:", errfile); + for (v=preempted; v; v=v->next) + fprintf(errfile, "%x ", v); + fputs("\nsuspended:", errfile); + for (v=suspended; v; v=v->next) + fprintf(errfile, "%x ", v); + fputs("\nvmstore:", errfile); + for (v=vmstore; v; v=v->next) + fprintf(errfile, "%x ", v); + fputs("\n\n", errfile); + fflush(errfile); + } + #endif /* // --------------------------------------------------------------- diff -rc Genesis-1.0p22/src/genesis.c Genesis-1.0p23/src/genesis.c *** Genesis-1.0p22/src/genesis.c Sun Dec 22 11:40:55 1996 --- Genesis-1.0p23/src/genesis.c Thu Jan 30 13:36:13 1997 *************** *** 10,16 **** --- 10,18 ---- #include #include + #ifdef __UNIX__ #include + #endif #include #include #include "cdc_pcode.h" *************** *** 275,293 **** errfile = stderr; } /* fork ? */ if (dofork) { ! #ifdef USE_VFORK ! pid = vfork(); ! #else ! pid = fork(); ! #endif if (pid != 0) { /* parent */ if (pid == -1) fprintf(stderr,"genesis: unable to fork: %s\n",strerror(GETERR())); exit(0); } } /* print the PID */ if ((fp = fopen(c_runfile, "wb")) != NULL) { --- 277,293 ---- errfile = stderr; } + #ifdef __UNIX__ /* fork ? */ if (dofork) { ! pid = FORK_PROCESS(); if (pid != 0) { /* parent */ if (pid == -1) fprintf(stderr,"genesis: unable to fork: %s\n",strerror(GETERR())); exit(0); } } + #endif /* print the PID */ if ((fp = fopen(c_runfile, "wb")) != NULL) { diff -rc Genesis-1.0p22/src/grammar.y Genesis-1.0p23/src/grammar.y *** Genesis-1.0p22/src/grammar.y Mon Dec 16 15:24:11 1996 --- Genesis-1.0p23/src/grammar.y Wed Jan 29 17:39:34 1997 *************** *** 179,184 **** --- 179,187 ---- | ARG idlist ';' { $$ = arguments($2, NULL); } | ARG idlist ',' '[' IDENT ']' ';' { $$ = arguments($2, $5); } + | ARG '@' IDENT ';' { $$ = arguments(NULL, $3); } + | ARG idlist ',' '@' IDENT ';' + { $$ = arguments($2, $5); } ; vars : /* nothing */ { $$ = NULL; } diff -rc Genesis-1.0p22/src/include/config.h.in Genesis-1.0p23/src/include/config.h.in *** Genesis-1.0p22/src/include/config.h.in Tue Dec 3 16:24:44 1996 --- Genesis-1.0p23/src/include/config.h.in Tue Feb 4 09:39:49 1997 *************** *** 134,136 **** --- 134,141 ---- #undef SYSTEM_TYPE #undef USE_OS_CRYPT + + #ifndef __UNIX__ + # define __UNIX__ + #endif + Only in Genesis-1.0p23/src/include: config.h.win32 diff -rc Genesis-1.0p22/src/include/defs.h Genesis-1.0p23/src/include/defs.h *** Genesis-1.0p22/src/include/defs.h Mon Jan 13 10:20:31 1997 --- Genesis-1.0p23/src/include/defs.h Tue Feb 4 09:40:12 1997 *************** *** 10,33 **** /* // --------------------------------------------------------------------- - // Compiling in Win32 (Windows 95 / NT) or UNIX (of any type) - // - // Set ENABLED/DISABLED appropriately - */ - #if DISABLED - # ifndef __Win32__ - # define __Win32__ - # endif - #endif - - #if ENABLED - # ifndef __UNIX__ - # define __UNIX__ - # endif - #endif - - /* - // --------------------------------------------------------------------- // This will reduce how much your database bloats, however it will // be slower as it searches the whole database for free blocks. // For now this is an option to reduce the amount of bloat occuring, --- 10,15 ---- *************** *** 129,134 **** --- 111,122 ---- /* // --------------------------------------------------------------------- + // Maximum depth of method calls. + */ + #define MAX_CALL_DEPTH 128 + + /* + // --------------------------------------------------------------------- // size of name cache, this number is total magic--although primes make // for better magic, lower for less memory usage but more lookups to // disk; raise for vise-versa, other primes: *************** *** 159,175 **** #include "config.h" #ifndef CAT ! # ifdef __BORLANDC__ ! # undef _CAT ! # define _CAT(x) x ! # define CAT(a,b) _CAT(a)_CAT(b) # else ! # ifdef __WATCOMC__ ! # define _CAT(a,b) a ## b ! # define CAT(a,b) _CAT(a,b) ! # else ! # define CAT(a,b) a ## b ! # endif # endif #endif --- 147,157 ---- #include "config.h" #ifndef CAT ! # ifdef __WATCOMC__ ! # define _CAT(a,b) a ## b ! # define CAT(a,b) _CAT(a,b) # else ! # define CAT(a,b) a ## b # endif #endif *************** *** 177,182 **** --- 159,170 ---- #define SYSTEM_OBJNUM 0 #define ROOT_OBJNUM 1 + #ifdef USE_VFORK + #define FORK_PROCESS vfork + #else + #define FORK_PROCESS fork + #endif + #ifndef HAVE_STRERROR extern char *sys_errlist[]; #define strerror(n) (sys_errlist[n]) *************** *** 304,310 **** #endif /* basic sizes */ - #define WORD 32 #define LINE 80 #define BUF 256 #define BLOCK 512 --- 292,297 ---- *************** *** 350,355 **** --- 337,347 ---- #define SERVER_NAME "Genesis (the ColdX driver)" + /* incase it doesn't exist */ + #ifndef O_BINARY + #define O_BINARY 0 + #endif + /* // -------------------------------------------------------------------- // standard includes *************** *** 359,365 **** #include #include ! #ifdef __UNIX__ #include #endif --- 351,357 ---- #include #include ! #ifdef HAVE_UNISTD_H #include #endif *************** *** 384,389 **** --- 376,382 ---- // -------------------------------------------------------------------- */ + #ifdef DEFS_C jmp_buf main_jmp; char * c_dir_binary; *************** *** 409,426 **** void init_defs(void); - /* - // --------------------------------------------------------------------- - // Maximum depth of method calls. - */ - #define MAX_CALL_DEPTH 128 - /* limits configurable with 'config()' */ Int limit_datasize; Int limit_fork; Int limit_calldepth; Int limit_recursion; Int limit_objswap; #endif --- 402,448 ---- void init_defs(void); /* limits configurable with 'config()' */ Int limit_datasize; Int limit_fork; Int limit_calldepth; Int limit_recursion; Int limit_objswap; + + #else + extern jmp_buf main_jmp; + + extern char * c_dir_binary; + extern char * c_dir_textdump; + extern char * c_dir_bin; + extern char * c_dir_root; + extern char * c_logfile; + extern char * c_errfile; + extern char * c_runfile; + + extern FILE * logfile; + extern FILE * errfile; + extern cStr * str_tzname; + extern cStr * str_hostname; + + extern Int c_interactive; + extern Bool running; + extern Bool atomic; + extern Int heartbeat_freq; + + extern Int cache_width; + extern Int cache_depth; + + extern void init_defs(void); + + /* limits configurable with 'config()' */ + extern Int limit_datasize; + extern Int limit_fork; + extern Int limit_calldepth; + extern Int limit_recursion; + extern Int limit_objswap; + + #endif #endif diff -rc Genesis-1.0p22/src/include/lookup.h Genesis-1.0p23/src/include/lookup.h *** Genesis-1.0p22/src/include/lookup.h Thu Jun 20 11:18:09 1996 --- Genesis-1.0p23/src/include/lookup.h Thu Jan 30 11:33:25 1997 *************** *** 5,11 **** #ifndef cdc_lookup_h #define cdc_lookup_h ! /* incase it doesnt do its own checking */ #ifndef did_sys_types #define did_sys_types #include --- 5,11 ---- #ifndef cdc_lookup_h #define cdc_lookup_h ! /* this just makes sure we don't include it twice */ #ifndef did_sys_types #define did_sys_types #include diff -rc Genesis-1.0p22/src/include/sig.h Genesis-1.0p23/src/include/sig.h *** Genesis-1.0p22/src/include/sig.h Fri Jun 14 16:52:59 1996 --- Genesis-1.0p23/src/include/sig.h Thu Jan 30 11:34:12 1997 *************** *** 7,13 **** --- 7,17 ---- void init_sig(void); + #ifdef SIG_C short caught_fpe; /* if we catch SIGFPE */ + #else + extern short caught_fpe; + #endif /* void catch_signal(int sig, int code, struct sigcontext *scp); */ void catch_signal(int sig); diff -rc Genesis-1.0p22/src/include/textdb.h Genesis-1.0p23/src/include/textdb.h *** Genesis-1.0p22/src/include/textdb.h Tue Dec 3 18:25:41 1996 --- Genesis-1.0p23/src/include/textdb.h Thu Jan 30 11:35:33 1997 *************** *** 8,14 **** --- 8,18 ---- #define FORCE_NATIVES 1 #define IGNORE_NATIVES 2 + #ifdef TEXTDB_C Int use_natives; + #else + extern Int use_natives; + #endif void compile_cdc_file(FILE * fp); Int text_dump(Bool objnames); diff -rc Genesis-1.0p22/src/lookup.c Genesis-1.0p23/src/lookup.c *** Genesis-1.0p22/src/lookup.c Thu Jun 20 11:17:44 1996 --- Genesis-1.0p23/src/lookup.c Thu Jan 30 12:03:27 1997 *************** *** 7,15 **** --- 7,21 ---- #include "defs.h" #include + #ifdef __UNIX__ #include + #endif #include + #ifdef __UNIX__ #include + #else + #include "ndbm.h" + #endif #include #include #include "cdc_db.h" *************** *** 45,53 **** Int i; if (cnew) ! dbp = dbm_open(name, O_TRUNC | O_RDWR | O_CREAT, READ_WRITE); else ! dbp = dbm_open(name, O_RDWR, READ_WRITE); if (!dbp) fail_to_start("Cannot open dbm database file."); --- 51,59 ---- Int i; if (cnew) ! dbp = dbm_open(name, O_TRUNC | O_RDWR | O_CREAT | O_BINARY, READ_WRITE); else ! dbp = dbm_open(name, O_RDWR | O_BINARY, READ_WRITE); if (!dbp) fail_to_start("Cannot open dbm database file."); *************** *** 68,74 **** /* Only way to do this with ndbm is close and re-open. */ sync_name_cache(); dbm_close(dbp); ! dbp = dbm_open(buf, O_RDWR | O_CREAT, READ_WRITE); if (!dbp) panic("Cannot reopen dbm database file."); } --- 74,80 ---- /* Only way to do this with ndbm is close and re-open. */ sync_name_cache(); dbm_close(dbp); ! dbp = dbm_open(buf, O_RDWR | O_CREAT | O_BINARY, READ_WRITE); if (!dbp) panic("Cannot reopen dbm database file."); } diff -rc Genesis-1.0p22/src/malloc.c Genesis-1.0p23/src/malloc.c *** Genesis-1.0p22/src/malloc.c Thu Jun 20 13:57:59 1996 --- Genesis-1.0p23/src/malloc.c Wed Jan 29 17:51:23 1997 *************** *** 48,54 **** #include #include - #include #include #include --- 48,53 ---- diff -rc Genesis-1.0p22/src/memory.c Genesis-1.0p23/src/memory.c *** Genesis-1.0p22/src/memory.c Mon Dec 9 10:02:45 1996 --- Genesis-1.0p23/src/memory.c Thu Jan 30 11:40:15 1997 *************** *** 76,81 **** --- 76,87 ---- ptr = malloc(size); if (!ptr) panic("emalloc(%lX) failed.", size); + + /* most unix systems already do this, no reason being redundant */ + #ifdef __Win32__ + memset(ptr, 0, size); + #endif + return ptr; } diff -rc Genesis-1.0p22/src/modules/cdc_misc.c Genesis-1.0p23/src/modules/cdc_misc.c *** Genesis-1.0p22/src/modules/cdc_misc.c Tue Dec 17 14:51:20 1996 --- Genesis-1.0p23/src/modules/cdc_misc.c Tue Feb 4 09:48:54 1997 *************** *** 8,18 **** --- 8,26 ---- #include "cdc_db.h" #include + #ifdef __UNIX__ #include /* for mtime(), getrusage() */ #include /* getrusage() 25-Jan-95 BJG */ + #endif #include "util.h" #include "net.h" + #ifdef __Win32__ + #define FTIME _lstrftime + #else + #define FTIME strftime + #endif + NATIVE_METHOD(strftime) { char s[LINE]; char * fmt; *************** *** 21,28 **** --- 29,48 ---- INIT_1_OR_2_ARGS(STRING, INTEGER); + #ifdef __BORLANDC__ + if (argc == 2) { + if (INT2 < 18000) { + THROW((type_id, + "Borland's time util is broken, and requires time values above 18000")) + } + tt = (time_t) INT2; + } else { + tt = time(NULL); + } + #else tt = ((argc == 2) ? (time_t) INT2 : time(NULL)); t = localtime(&tt); + #endif fmt = string_chars(STR1); *************** *** 31,37 **** if (fmt[strlen(fmt)] == '%') fmt[strlen(fmt)] = (char) NULL; ! if (strftime(s, LINE, fmt, t) == (size_t) 0) THROW((range_id,"Format results in a string longer than 80 characters.")) CLEAN_RETURN_STRING(string_from_chars(s, strlen(s))); --- 51,57 ---- if (fmt[strlen(fmt)] == '%') fmt[strlen(fmt)] = (char) NULL; ! if (FTIME(s, LINE, fmt, t) == (size_t) 0) THROW((range_id,"Format results in a string longer than 80 characters.")) CLEAN_RETURN_STRING(string_from_chars(s, strlen(s))); diff -rc Genesis-1.0p22/src/modules/moddef.h Genesis-1.0p23/src/modules/moddef.h *** Genesis-1.0p22/src/modules/moddef.h Wed Jan 15 11:13:50 1997 --- Genesis-1.0p23/src/modules/moddef.h Tue Feb 4 09:33:03 1997 *************** *** 96,102 **** #define NATIVE_MATH_TRANSPOSE 69 #define NATIVE_LAST 70 ! #define MAGIC_MODNUMBER 853352030 #ifdef _native_ --- 96,102 ---- #define NATIVE_MATH_TRANSPOSE 69 #define NATIVE_LAST 70 ! #define MAGIC_MODNUMBER 855073983 #ifdef _native_ diff -rc Genesis-1.0p22/src/modules/veil.c Genesis-1.0p23/src/modules/veil.c *** Genesis-1.0p22/src/modules/veil.c Mon Nov 11 15:04:15 1996 --- Genesis-1.0p23/src/modules/veil.c Thu Jan 30 11:47:25 1997 *************** *** 9,19 **** #define NATIVE_MODULE "$buffer" #include "veil.h" module_t veil_module = {init_veil, uninit_veil}; - - extern Ident pabort_id, pclose_id, popen_id; #define VEIL_P_PUSH 1 #define VEIL_P_ABORT 2 --- 9,19 ---- #define NATIVE_MODULE "$buffer" + #define VEIL_C + #include "veil.h" module_t veil_module = {init_veil, uninit_veil}; #define VEIL_P_PUSH 1 #define VEIL_P_ABORT 2 diff -rc Genesis-1.0p22/src/modules/veil.h Genesis-1.0p23/src/modules/veil.h *** Genesis-1.0p22/src/modules/veil.h Thu Jun 20 12:01:42 1996 --- Genesis-1.0p23/src/modules/veil.h Thu Jan 30 11:47:11 1997 *************** *** 4,10 **** --- 4,14 ---- #include "defs.h" #include "cdc_pcode.h" + #ifdef VEIL_C Ident pabort_id, pclose_id, popen_id; + #else + extern Ident pabort_id, pclose_id, popen_id; + #endif void init_veil(Int argc, char ** argv); void uninit_veil(void); diff -rc Genesis-1.0p22/src/net.c Genesis-1.0p23/src/net.c *** Genesis-1.0p22/src/net.c Sat Dec 7 16:15:24 1996 --- Genesis-1.0p23/src/net.c Thu Jan 30 11:49:16 1997 *************** *** 9,14 **** --- 9,15 ---- #include "defs.h" #include + #ifdef __UNIX__ #include #include #include *************** *** 16,21 **** --- 17,23 ---- #include #include #include + #endif #include #include "net.h" #include "util.h" *************** *** 28,41 **** Long server_failure_reason; void init_net(void) { ! #ifdef WIN32 WSADATA wsa; WSAStartup(0x0101, &wsa); #endif } void uninit_net(void) { ! #ifdef WIN32 WSACleanup(); #endif } --- 30,43 ---- Long server_failure_reason; void init_net(void) { ! #ifdef __Win32__ WSADATA wsa; WSAStartup(0x0101, &wsa); #endif } void uninit_net(void) { ! #ifdef __Win32__ WSACleanup(); #endif } *************** *** 332,338 **** return socket_id; /* Set the socket non-blocking. */ ! #ifdef WIN32 result = 1; ioctlsocket(fd, FIONBIO, &result); #else --- 334,340 ---- return socket_id; /* Set the socket non-blocking. */ ! #ifdef __Win32__ result = 1; ioctlsocket(fd, FIONBIO, &result); #else *************** *** 381,387 **** return socket_id; /* Set the socket non-blocking. */ ! #ifdef WIN32 result = 1; ioctlsocket(fd, FIONBIO, &result); #else --- 383,389 ---- return socket_id; /* Set the socket non-blocking. */ ! #ifdef __Win32__ result = 1; ioctlsocket(fd, FIONBIO, &result); #else *************** *** 452,459 **** register struct hostent *hp; addr = inet_addr(chaddr); ! #ifdef WIN32 ! if (addr == NADDR_NONE) { #else if (addr == F_FAILURE) { #endif --- 454,461 ---- register struct hostent *hp; addr = inet_addr(chaddr); ! #ifdef __Win32__ ! if (addr == INADDR_NONE) { #else if (addr == F_FAILURE) { #endif diff -rc Genesis-1.0p22/src/ops/file.c Genesis-1.0p23/src/ops/file.c *** Genesis-1.0p22/src/ops/file.c Mon Nov 25 14:20:46 1996 --- Genesis-1.0p23/src/ops/file.c Tue Feb 4 09:34:40 1997 *************** *** 16,25 **** --- 16,33 ---- #include "defs.h" + #ifdef __Win32__ + #define STDIN_FILENO (fileno(stdin)) + #define STDOUT_FILENO (fileno(stdout)) + #define STDERR_FILENO (fileno(stderr)) + #endif + #include #include #include + #ifdef __UNIX__ #include + #endif #include #include /* func_files() */ #include *************** *** 372,378 **** Int err; filec_t * file = NULL; ! INIT_1_OR_2_ARGS(ANY_TYPE, STRING); if (args[0].type != STRING) { GET_FILE_CONTROLLER(file) --- 380,386 ---- Int err; filec_t * file = NULL; ! INIT_2_ARGS(ANY_TYPE, STRING); if (args[0].type != STRING) { GET_FILE_CONTROLLER(file) *************** *** 402,408 **** return; } ! pop(argc); push_int(1); } --- 410,416 ---- return; } ! pop(2); push_int(1); } *************** *** 629,640 **** pop(num_args); ! /* Fork off a process. */ ! #ifdef USE_VFORK ! pid = vfork(); #else ! pid = fork(); #endif if (pid == 0) { /* Pipe stdin and stdout to /dev/null, keep stderr. */ fd = open("/dev/null", O_RDWR); --- 637,676 ---- pop(num_args); ! #ifdef __Win32__ ! ! #ifndef CREATE_PROCESS ! write_err("EXEC: No forking in Win32 (yet)"); ! /* for now this will not work - JAL */ ! status = -1; ! #else ! ! fSuccess = CreateProcess((LPTSTR)fname, (LPTSTR)argv, ! (LPSECURITY_ATTRIBUTES)NULL, (LPSECURITY_ATTRIBUTES)NULL, ! (BOOL)TRUE,(DWORD)0, NULL, NULL, (LPSTARTUPINFO)&SI, ! (LPPROCESS_INFORMATION)&pi); ! /* parent waits for child */ ! if (fSuccess) { ! hProcess = pi.hProcess; hThread = pi.hThread; ! dw = WaitForSingleObject(hProcess, INFINITE); ! /* if we saw success ... */ ! if (dw != 0xFFFFFFFF) { ! /* pick up an exit code for the process */ ! fExit = GetExitCodeProcess(hProcess, &dwExitCode); ! } ! /* close the child process and thread object handles */ ! CloseHandle(hThread); CloseHandle(hProcess); ! printf("COMPLETED!\n"); ! } else ! printf("Failed to CreateProcess\n"); ! #endif + + #else + + /* Fork off a process. */ + pid = FORK_PROCESS(); if (pid == 0) { /* Pipe stdin and stdout to /dev/null, keep stderr. */ fd = open("/dev/null", O_RDWR); *************** *** 658,663 **** --- 694,701 ---- write_err("EXEC: Failed to fork: %s.", strerror(GETERR())); status = -1; } + + #endif /* Free the argument list. */ for (i = 0; i < argc; i++) diff -rc Genesis-1.0p22/src/ops/list.c Genesis-1.0p23/src/ops/list.c *** Genesis-1.0p22/src/ops/list.c Sat Jul 6 18:53:48 1996 --- Genesis-1.0p23/src/ops/list.c Sun Jan 19 15:18:46 1997 *************** *** 222,228 **** string_discard(sep); } ! pop(2); push_string(str); string_discard(str); } --- 222,228 ---- string_discard(sep); } ! pop(argc); push_string(str); string_discard(str); } diff -rc Genesis-1.0p22/src/ops/misc.c Genesis-1.0p23/src/ops/misc.c *** Genesis-1.0p22/src/ops/misc.c Mon Dec 16 16:26:47 1996 --- Genesis-1.0p23/src/ops/misc.c Thu Jan 30 12:02:18 1997 *************** *** 6,12 **** --- 6,14 ---- #include #include + #ifdef __UNIX__ #include /* for mtime() */ + #endif #include "operators.h" #include "execute.h" diff -rc Genesis-1.0p22/src/ops/sys.c Genesis-1.0p23/src/ops/sys.c *** Genesis-1.0p22/src/ops/sys.c Sun Nov 24 18:23:55 1996 --- Genesis-1.0p23/src/ops/sys.c Thu Jan 30 12:04:27 1997 *************** *** 4,10 **** --- 4,12 ---- #include "defs.h" + #ifdef __UNIX__ #include + #endif #include #include #include *************** *** 59,69 **** strcat(dest, ".bak/"); strcat(dest, file); ! from_fd = open(source, O_RDONLY, 0); if (from_fd == F_FAILURE) x_THROW(source) ! to_fd = open(dest, (O_WRONLY|O_TRUNC|O_CREAT), (S_IRUSR|S_IWUSR)); if (to_fd == F_FAILURE) x_THROW(dest) --- 61,71 ---- strcat(dest, ".bak/"); strcat(dest, file); ! from_fd = open(source, O_RDONLY | O_BINARY, 0); if (from_fd == F_FAILURE) x_THROW(source) ! to_fd = open(dest, (O_WRONLY|O_TRUNC|O_CREAT|O_BINARY), (S_IRUSR|S_IWUSR)); if (to_fd == F_FAILURE) x_THROW(dest) diff -rc Genesis-1.0p22/src/regexp.c Genesis-1.0p23/src/regexp.c *** Genesis-1.0p22/src/regexp.c Mon Oct 21 10:44:22 1996 --- Genesis-1.0p23/src/regexp.c Tue Feb 4 09:36:07 1997 *************** *** 175,193 **** /* * Forward declarations for regcomp()'s friends. */ ! INTERNAL char *reg(); ! INTERNAL char *regbranch(); ! INTERNAL char *regpiece(); ! INTERNAL char *regatom(); ! INTERNAL char *regnode(); ! INTERNAL char *regnext(); ! INTERNAL void regc(); ! INTERNAL void reginsert(); ! INTERNAL void regtail(); ! INTERNAL void regoptail(); #ifdef STRCSPN ! INTERNAL int strcspn(); #endif /* --- 175,193 ---- /* * Forward declarations for regcomp()'s friends. */ ! INTERNAL char *reg(int , int *); ! INTERNAL char *regbranch(int *); ! INTERNAL char *regpiece(int *); ! INTERNAL char *regatom(int *); ! INTERNAL char *regnode(char); ! INTERNAL char *regnext(register char *); ! INTERNAL void regc(char); ! INTERNAL void reginsert(char , char *); ! INTERNAL void regtail(char *, char *); ! INTERNAL void regoptail(char *, char *); #ifdef STRCSPN ! INTERNAL int strcspn(char *s1, char *s2); #endif /* *************** *** 221,227 **** regnpar = 1; regsize = 0L; regcode = ®dummy; ! regc(MAGIC); if (reg(0, &flags) == NULL) return(NULL); --- 221,227 ---- regnpar = 1; regsize = 0L; regcode = ®dummy; ! regc((char) MAGIC); if (reg(0, &flags) == NULL) return(NULL); *************** *** 238,244 **** regparse = exp; regnpar = 1; regcode = r->program; ! regc(MAGIC); if (reg(0, &flags) == NULL) return(NULL); --- 238,244 ---- regparse = exp; regnpar = 1; regcode = r->program; ! regc((char)MAGIC); if (reg(0, &flags) == NULL) return(NULL); *************** *** 358,367 **** * * Implements the concatenation operator. */ ! INTERNAL char * ! regbranch(flagp) ! int *flagp; ! { register char *ret; register char *chain; register char *latest; --- 358,364 ---- * * Implements the concatenation operator. */ ! INTERNAL char * regbranch(int *flagp) { register char *ret; register char *chain; register char *latest; *************** *** 397,406 **** * It might seem that this node could be dispensed with entirely, but the * endmarker role is not redundant. */ ! INTERNAL char * ! regpiece(flagp) ! int *flagp; ! { register char *ret; register char op; register char *next; --- 394,400 ---- * It might seem that this node could be dispensed with entirely, but the * endmarker role is not redundant. */ ! INTERNAL char * regpiece(int *flagp) { register char *ret; register char op; register char *next; *************** *** 461,470 **** * faster to run. Backslashed characters are exceptions, each becoming a * separate node; the code is simpler that way and it's not worth fixing. */ ! INTERNAL char * ! regatom(flagp) ! int *flagp; ! { register char *ret; int flags; --- 455,461 ---- * faster to run. Backslashed characters are exceptions, each becoming a * separate node; the code is simpler that way and it's not worth fixing. */ ! INTERNAL char * regatom(int *flagp) { register char *ret; int flags; *************** *** 570,579 **** /* - regnode - emit a node */ ! INTERNAL char * /* Location. */ ! regnode(op) ! char op; ! { register char *ret; register char *ptr; --- 561,567 ---- /* - regnode - emit a node */ ! INTERNAL char * regnode(char op) { register char *ret; register char *ptr; *************** *** 595,604 **** /* - regc - emit (if appropriate) a byte of code */ ! INTERNAL void ! regc(b) ! char b; ! { if (regcode != ®dummy) *regcode++ = b; else --- 583,589 ---- /* - regc - emit (if appropriate) a byte of code */ ! INTERNAL void regc(char b) { if (regcode != ®dummy) *regcode++ = b; else *************** *** 610,620 **** * * Means relocating the operand. */ ! INTERNAL void ! reginsert(op, opnd) ! char op; ! char *opnd; ! { register char *src; register char *dst; register char *place; --- 595,601 ---- * * Means relocating the operand. */ ! INTERNAL void reginsert(char op, char *opnd) { register char *src; register char *dst; register char *place; *************** *** 639,649 **** /* - regtail - set the next-pointer at the end of a node chain */ ! INTERNAL void ! regtail(p, val) ! char *p; ! char *val; ! { register char *scan; register char *temp; register int offset; --- 620,626 ---- /* - regtail - set the next-pointer at the end of a node chain */ ! INTERNAL void regtail(char *p, char *val) { register char *scan; register char *temp; register int offset; *************** *** 671,681 **** /* - regoptail - regtail on operand of first argument; nop if operandless */ ! INTERNAL void ! regoptail(p, val) ! char *p; ! char *val; ! { /* "Operandless" and "op != BRANCH" are synonymous in practice. */ if (p == NULL || p == ®dummy || OP(p) != BRANCH) return; --- 648,654 ---- /* - regoptail - regtail on operand of first argument; nop if operandless */ ! INTERNAL void regoptail(char *p, char *val) { /* "Operandless" and "op != BRANCH" are synonymous in practice. */ if (p == NULL || p == ®dummy || OP(p) != BRANCH) return; *************** *** 697,705 **** /* * Forwards. */ ! INTERNAL int regtry(); INTERNAL int regmatch(); ! INTERNAL int regrepeat(); #ifdef DEBUG int regnarrate = 0; --- 670,678 ---- /* * Forwards. */ ! INTERNAL int regtry(regexp *, char *); INTERNAL int regmatch(); ! INTERNAL int regrepeat(char *); #ifdef DEBUG int regnarrate = 0; *************** *** 710,721 **** /* - regexec - match a regexp against a string */ ! int ! regexec(prog, string, case_flag) ! register regexp *prog; ! register char *string; ! int case_flag; ! { register char *s; case_matters = case_flag; --- 683,689 ---- /* - regexec - match a regexp against a string */ ! int regexec(register regexp *prog, register char *string, int case_flag) { register char *s; case_matters = case_flag; *************** *** 774,784 **** /* - regtry - try match at specific point */ ! INTERNAL int /* 0 failure, 1 success */ ! regtry(prog, string) ! regexp *prog; ! char *string; ! { register int i; register char **sp; register char **ep; --- 742,748 ---- /* - regtry - try match at specific point */ ! INTERNAL int regtry(regexp *prog, char *string) { register int i; register char **sp; register char **ep; *************** *** 811,818 **** * need to know whether the rest of the match failed) by a loop instead of * by recursion. */ ! INTERNAL int /* 0 failure, 1 success */ ! regmatch(char * prog) { register char * scan; /* Current node. */ char * next; /* Next node. */ /* extern char *strchr(); */ --- 775,781 ---- * need to know whether the rest of the match failed) by a loop instead of * by recursion. */ ! INTERNAL int regmatch(char * prog) { register char * scan; /* Current node. */ char * next; /* Next node. */ /* extern char *strchr(); */ *************** *** 997,1006 **** /* - regrepeat - repeatedly match something simple, report how many */ ! static int ! regrepeat(p) ! char *p; ! { register int count = 0; register char *scan; register char *opnd; --- 960,966 ---- /* - regrepeat - repeatedly match something simple, report how many */ ! INTERNAL int regrepeat(char *p) { register int count = 0; register char *scan; register char *opnd; *************** *** 1043,1052 **** /* - regnext - dig the "next" pointer out of a node */ ! static char * ! regnext(p) ! register char *p; ! { register int offset; if (p == ®dummy) --- 1003,1009 ---- /* - regnext - dig the "next" pointer out of a node */ ! INTERNAL char * regnext(register char *p) { register int offset; if (p == ®dummy) *************** *** 1069,1078 **** /* - regdump - dump a regexp onto stdout in vaguely comprehensible form */ ! void ! regdump(r) ! regexp *r; ! { register char *s; register char op = EXACTLY; /* Arbitrary non-END op. */ register char *next; --- 1026,1032 ---- /* - regdump - dump a regexp onto stdout in vaguely comprehensible form */ ! void regdump(regexp *r) { register char *s; register char op = EXACTLY; /* Arbitrary non-END op. */ register char *next; *************** *** 1113,1122 **** /* - regprop - printable representation of opcode */ ! static char * ! regprop(op) ! char *op; ! { register char *p; static char buf[50]; --- 1067,1073 ---- /* - regprop - printable representation of opcode */ ! static char * regprop(char *op) { register char *p; static char buf[50]; *************** *** 1205,1215 **** * of characters not from s2 */ ! static int ! strcspn(s1, s2) ! char *s1; ! char *s2; ! { register char *scan1; register char *scan2; register int count; --- 1156,1162 ---- * of characters not from s2 */ ! INTERNAL int strcspn(char *s1, char *s2) { register char *scan1; register char *scan2; register int count; diff -rc Genesis-1.0p22/src/sig.c Genesis-1.0p23/src/sig.c *** Genesis-1.0p22/src/sig.c Sun Jul 14 15:17:46 1996 --- Genesis-1.0p23/src/sig.c Thu Jan 30 12:15:08 1997 *************** *** 2,67 **** // Full copyright information is available in the file ../doc/CREDITS */ #include "defs.h" #include #include #include #include "execute.h" /* task() */ #include "sig.h" - void catch_SIGCHLD(int sig); void catch_SIGFPE(int sig); void catch_SIGPIPE(int sig); void uninit_sig(void) { signal(SIGFPE, SIG_DFL); signal(SIGILL, SIG_DFL); - signal(SIGQUIT, SIG_DFL); signal(SIGINT, SIG_DFL); - signal(SIGHUP, SIG_DFL); signal(SIGTERM, SIG_DFL); signal(SIGUSR1, SIG_DFL); signal(SIGUSR2, SIG_DFL); signal(SIGCHLD, SIG_DFL); signal(SIGPIPE, SIG_DFL); } void init_sig(void) { caught_fpe = 0; signal(SIGILL, catch_signal); - signal(SIGQUIT, catch_signal); signal(SIGINT, catch_signal); - signal(SIGHUP, catch_signal); signal(SIGTERM, catch_signal); signal(SIGUSR1, catch_signal); signal(SIGUSR2, catch_signal); signal(SIGFPE, catch_SIGFPE); signal(SIGPIPE, catch_SIGPIPE); signal(SIGCHLD, catch_SIGCHLD); } void catch_SIGPIPE(int sig) { signal(SIGPIPE, catch_SIGPIPE); } - void catch_SIGFPE(int sig) { - caught_fpe++; - signal(SIGFPE, catch_SIGFPE); - } - void catch_SIGCHLD(int sig) { waitpid(-1, NULL, WNOHANG); signal(SIGCHLD, catch_SIGCHLD); } char *sig_name(int sig) { switch(sig) { case SIGILL: return "ILL"; - case SIGQUIT: return "QUIT"; case SIGSEGV: return "SEGV"; case SIGINT: return "INT"; case SIGHUP: return "HUP"; case SIGTERM: return "TERM"; case SIGUSR1: return "USR1"; case SIGUSR2: return "USR2"; --- 2,81 ---- // Full copyright information is available in the file ../doc/CREDITS */ + #define SIG_C + #include "defs.h" #include #include + #ifdef __UNIX__ #include + #endif #include "execute.h" /* task() */ #include "sig.h" void catch_SIGFPE(int sig); + #ifdef __UNIX__ + void catch_SIGCHLD(int sig); void catch_SIGPIPE(int sig); + #endif void uninit_sig(void) { signal(SIGFPE, SIG_DFL); signal(SIGILL, SIG_DFL); signal(SIGINT, SIG_DFL); signal(SIGTERM, SIG_DFL); signal(SIGUSR1, SIG_DFL); signal(SIGUSR2, SIG_DFL); + #ifdef __UNIX__ + signal(SIGQUIT, SIG_DFL); + signal(SIGHUP, SIG_DFL); signal(SIGCHLD, SIG_DFL); signal(SIGPIPE, SIG_DFL); + #endif } void init_sig(void) { caught_fpe = 0; signal(SIGILL, catch_signal); signal(SIGINT, catch_signal); signal(SIGTERM, catch_signal); signal(SIGUSR1, catch_signal); signal(SIGUSR2, catch_signal); signal(SIGFPE, catch_SIGFPE); + #ifdef __UNIX__ + signal(SIGQUIT, catch_signal); + signal(SIGHUP, catch_signal); signal(SIGPIPE, catch_SIGPIPE); signal(SIGCHLD, catch_SIGCHLD); + #endif } + #ifdef __UNIX__ void catch_SIGPIPE(int sig) { signal(SIGPIPE, catch_SIGPIPE); } void catch_SIGCHLD(int sig) { waitpid(-1, NULL, WNOHANG); signal(SIGCHLD, catch_SIGCHLD); } + #endif + + void catch_SIGFPE(int sig) { + caught_fpe++; + signal(SIGFPE, catch_SIGFPE); + } char *sig_name(int sig) { switch(sig) { case SIGILL: return "ILL"; case SIGSEGV: return "SEGV"; case SIGINT: return "INT"; + #ifdef __UNIX__ + case SIGQUIT: return "QUIT"; case SIGHUP: return "HUP"; + #endif case SIGTERM: return "TERM"; case SIGUSR1: return "USR1"; case SIGUSR2: return "USR2"; *************** *** 86,95 **** --- 100,111 ---- /* figure out what to do */ switch(sig) { + #ifdef __UNIX__ case SIGHUP: atomic = NO; handle_connection_output(); flush_files(); + #endif case SIGUSR2: /* let the db do what it wants from here */ break; diff -rc Genesis-1.0p22/src/strutil.c Genesis-1.0p23/src/strutil.c *** Genesis-1.0p22/src/strutil.c Wed Dec 25 22:39:17 1996 --- Genesis-1.0p23/src/strutil.c Tue Jan 28 14:51:05 1997 *************** *** 1062,1068 **** x = rx->startp[0] - p; ! if (x || flags & RF_BLANKS) { d.u.str = string_from_chars(p, x); list = list_add(list, &d); string_discard(d.u.str); --- 1062,1068 ---- x = rx->startp[0] - p; ! if (x || (flags & RF_BLANKS)) { d.u.str = string_from_chars(p, x); list = list_add(list, &d); string_discard(d.u.str); *************** *** 1071,1077 **** p = rx->endp[0]; } while (p && regexec(rx, p, flags & RF_SENSITIVE)); ! if ((x = (s + len) - p)) { d.u.str = string_from_chars(p, x); list = list_add(list, &d); string_discard(d.u.str); --- 1071,1077 ---- p = rx->endp[0]; } while (p && regexec(rx, p, flags & RF_SENSITIVE)); ! if ((x = (s + len) - p) || (flags & RF_BLANKS)) { d.u.str = string_from_chars(p, x); list = list_add(list, &d); string_discard(d.u.str); diff -rc Genesis-1.0p22/src/textdb.c Genesis-1.0p23/src/textdb.c *** Genesis-1.0p22/src/textdb.c Tue Dec 3 18:28:03 1996 --- Genesis-1.0p23/src/textdb.c Thu Jan 30 13:39:04 1997 *************** *** 7,19 **** // in YACC */ #define DEBUG_TEXTDB 0 #include "defs.h" #include #include - #include #include "cdc_db.h" #include "cdc_pcode.h" #include "util.h" --- 7,19 ---- // in YACC */ + #define TEXTDB_C #define DEBUG_TEXTDB 0 #include "defs.h" #include #include #include "cdc_db.h" #include "cdc_pcode.h" #include "util.h" *************** *** 34,39 **** --- 34,40 ---- } idref_t; /* globals, because its easier this way */ + Int use_natives; Long line_count; Long method_start; Obj * cur_obj; *************** *** 56,69 **** #define DIE(__s) { \ printf("\rLine %ld: ERROR: %s\n", (long) line_count, __s); \ ! shutdown(); \ } #define DIEf(__fmt, __arg) { \ printf("\rLine %ld: ERROR: ", (long) line_count); \ printf(__fmt, __arg); \ fputc('\n', stdout); \ ! shutdown(); \ } /* Dancer: This is more portable than the pointer arithmetic --- 57,70 ---- #define DIE(__s) { \ printf("\rLine %ld: ERROR: %s\n", (long) line_count, __s); \ ! shutdown_coldcc(); \ } #define DIEf(__fmt, __arg) { \ printf("\rLine %ld: ERROR: ", (long) line_count); \ printf(__fmt, __arg); \ fputc('\n', stdout); \ ! shutdown_coldcc(); \ } /* Dancer: This is more portable than the pointer arithmetic *************** *** 111,119 **** // ------------------------------------------------------------------------ // make this do more eventually */ ! INTERNAL void shutdown(void) { exit(1); } typedef struct holder_s holder_t; --- 112,124 ---- // ------------------------------------------------------------------------ // make this do more eventually */ ! #if 0 ! INTERNAL void shutdown_coldcc(void) { exit(1); } + #endif + + extern void shutdown_coldcc(void); typedef struct holder_s holder_t; *************** *** 249,255 **** fformat(stdout, "\rLine %l: ERROR: %O.%s() overrides existing native definition.\n", line_count, nh->objnum, ident_name(nh->native)); ! shutdown(); } nh = (nh_t *) malloc(sizeof(nh_t)); --- 254,260 ---- fformat(stdout, "\rLine %l: ERROR: %O.%s() overrides existing native definition.\n", line_count, nh->objnum, ident_name(nh->native)); ! shutdown_coldcc(); } nh = (nh_t *) malloc(sizeof(nh_t)); *************** *** 1253,1259 **** } else if (strnccmp(s, "//", 2)) { WARN(("parse error, unknown directive.")); ERRf("\"%s\"\n", s); ! shutdown(); } string_discard(str); --- 1258,1264 ---- } else if (strnccmp(s, "//", 2)) { WARN(("parse error, unknown directive.")); ERRf("\"%s\"\n", s); ! shutdown_coldcc(); } string_discard(str); diff -rc Genesis-1.0p22/src/util.c Genesis-1.0p23/src/util.c *** Genesis-1.0p22/src/util.c Mon Dec 9 09:55:28 1996 --- Genesis-1.0p23/src/util.c Thu Jan 30 12:19:23 1997 *************** *** 11,17 **** #include #include #include - #include #include #include #include "util.h" --- 11,16 ---- *************** *** 296,302 **** char * timestamp (char * str) { time_t t; struct tm * tms; ! static char tstr[WORD]; char * s; char * months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; --- 295,301 ---- char * timestamp (char * str) { time_t t; struct tm * tms; ! static char tstr[LINE]; char * s; char * months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; *************** *** 471,477 **** --- 470,480 ---- } INTERNAL void claim_fd(Int i) { + #ifdef __Win32__ + reserve_fds[i] = open("null_file", O_WRONLY | O_CREAT); + #else reserve_fds[i] = open("/dev/null", O_WRONLY); + #endif if (reserve_fds[i] == -1) panic("Couldn't reset reserved fd."); }