/* #define VAXVMS 1 */ /* uncomment for VAX/VMS */ /* #define MSDOS 1 */ /* uncomment for MSDOS */ /* NOTE: other two supported systems, "unix" and "AMIGA" have these symbols */ /* built into the preprocessor. Redefining them may cause problems, or at */ /* least irritating warning messages. */ #if VAXVMS # define ESCCHAR `\\` /* ok to use backslash on VMS */ #endif #ifdef MSDOS # define ESCCHAR '`' /* since pathname char is backslash (yech) */ #endif #if unix || AMIGA # define ESCCHAR '\\' #endif #define EOS '\000' /* End of string character */ #define MACCHAR '$' /* macro-definition char */ #define COMCHAR '#' /* comment char */ #define DEFMAC "=" /* macro-definition token */ #define DEPEND ":" /* dependency-definition token */ #ifdef FUNNYLIBS # define BGNLIB "[" /* start library token */ # define ENDLIB "]" /* end library token */ #else # define ISLIB "|" /* Library definition token */ #endif #define BGNARC "(" /* start archive token */ #define ENDARC ")" /* end archive token */ #define DEBUG (0) #define STRSIZ (1024) /* Size of input buffer */ #define MAXMODS (50) /* Max number of targets on command line */ #define MAXCMDMACS (16) /* Max number of macro defs on command line */ #if DEBUG # define NOREALEXECUTE /* if set, don't really execute commands */ # define NOREALEXTRACT /* if set, don't really extract files */ # define NOREALDELETE /* if set, don't really delete files */ #endif #define SUCCEED (0) #define FAILURE (-1) /* file attributes */ #define REBUILT 0x01 /* file has been reconstructed */ #define ROOTP 0x02 /* file was named on left side of DEPEND */ #define LIBRARY 0x04 /* file is library; inherit parent's time */ #define ARCHIVE 0x08 /* file is archive; search through parent */ /* archive directory for time */ #define EXTRACT 0x10 /* extract from archive when rebuilding */ #define ERROR 0x20 /* error occurred while rebuilding */ #ifdef VAXVMS struct date_str { unsigned ds_low; unsigned ds_high; }; typedef struct date_str *DATE; #endif #ifdef MSDOS # ifndef FA_ARCH # include # endif typedef struct ftime *DATE; #endif #ifdef unix typedef long *DATE; #endif #ifdef AMIGA # include typedef struct DateStamp *DATE; #endif #ifdef DBUG # include #else # define DBUG_ENTER(a1) # define DBUG_RETURN(a1) return(a1) # define DBUG_VOID_RETURN return # define DBUG_EXECUTE(keyword,a1) # define DBUG_2(keyword,format) # define DBUG_3(keyword,format,a1) # define DBUG_4(keyword,format,a1,a2) # define DBUG_5(keyword,format,a1,a2,a3) # define DBUG_PUSH(a1) # define DBUG_POP() # define DBUG_PROCESS(a1) # define DBUG_FILE (stderr) # define DBUG_SETJMP setjmp # define DBUG_LONGJMP longjmp #endif struct node { struct filenode *nfile; /* this node's file */ struct node *nnext; /* the next node */ }; typedef struct node NODE; struct filenode { char *fname; /* the filename */ char *fmake; /* remake string for file */ DATE fdate; /* last modification date */ NODE *fnode; /* files this file depends on */ char fflag; /* magic flag bits */ struct filenode *parent; /* pointer to parent for archives,libraries */ struct filenode *fnext; /* the next file */ }; typedef struct filenode FILENODE; struct macro { char *mname; /* the macro's name */ char *mvalue; /* the macro's definition */ struct macro *mnext; /* the next macro */ }; typedef struct macro MACRO; extern long *Calloc (); /* Private gateway to system calloc() */ extern MACRO *mroot; extern FILENODE *froot; extern DATE bigbang; /* Far, far in the past */ extern DATE endoftime; /* Far, far in the future */ char *gmacro (); FILENODE *gfile (); FILENODE *filenode (); char *token (); #if unix || AMIGA # define _open open # define _close close # define _read read # define _write write #endif /* * On the Amiga, we must do an explicit check for an abort at various * places of interest. To avoid #ifdefs all through the code, define * some macros that just expand to null on other systems. * */ #ifdef AMIGA void Check_Abort (); extern int Enable_Abort; /* Enable abort on CNTL-C */ # define ENABLE_ABORT (Enable_Abort = 1) # define DISABLE_ABORT (Enable_Abort = 0) # define CHECK_ABORT Check_Abort(); #else # define CHECK_ABORT /* Null expansions */ # define ENABLE_ABORT # define DISABLE_ABORT #endif /* AMIGA */ /* * Some useful macros to make things slightly less error prone. */ #define STRSAME(a,b) (strcmp(a,b)==0) /* Strings are the same */