--- gforth/engine/engine.c 1999/06/17 15:32:14 1.13 +++ gforth/engine/engine.c 2000/07/27 10:40:42 1.20 @@ -38,6 +38,12 @@ #include #include #include +#include +#ifdef HAVE_FNMATCH_H +#include +#else +#include "fnmatch.h" +#endif #else #include "systypes.h" #endif @@ -80,6 +86,11 @@ int emitcounter; #endif #define NULLC '\0' +#ifdef MEMCMP_AS_SUBROUTINE +extern int gforth_memcmp(const char * s1, const char * s2, size_t n); +#define memcmp(s1,s2,n) gforth_memcmp(s1,s2,n) +#endif + #ifdef HAS_FILE char *cstr(Char *from, UCell size, int clear) /* return a C-string corresponding to the Forth string ( FROM SIZE ). @@ -165,7 +176,7 @@ char *tilde_cstr(Char *from, UCell size, #endif #ifdef HAS_FILE -static char* fileattr[6]={"r","rb","r+","r+b","w","wb"}; +static char* fileattr[6]={"rb","rb","r+b","r+b","wb","wb"}; #ifndef O_BINARY #define O_BINARY 0 @@ -175,9 +186,9 @@ static char* fileattr[6]={"r","rb","r+", #endif static int ufileattr[6]= { - O_RDONLY|O_TEXT, O_RDONLY|O_BINARY, - O_RDWR |O_TEXT, O_RDWR |O_BINARY, - O_WRONLY|O_TEXT, O_WRONLY|O_BINARY }; + O_RDONLY|O_BINARY, O_RDONLY|O_BINARY, + O_RDWR |O_BINARY, O_RDWR |O_BINARY, + O_WRONLY|O_BINARY, O_WRONLY|O_BINARY }; #endif /* if machine.h has not defined explicit registers, define them as implicit */ @@ -295,12 +306,12 @@ Label *engine(Xt *ip0, Cell *sp0, Cell * if (i>=MAX_SYMBOLS) { fprintf(stderr,"gforth-ditc: more than %d primitives\n",MAX_SYMBOLS); exit(1); + } + symbols[i] = &routines[i]; } - symbols[i] = &routines[i]; - } #endif /* defined(DOUBLY_INDIRECT) */ - return symbols; -} + return symbols; + } IF_TOS(TOS = sp[0]); IF_FTOS(FTOS = fp[0]);