#include "limits.h" #include "tape.h" /* Cover possibly undefined structures */ #include "quint.h" /* Cover possibly undefined structures */ #include "macro.h" /* Cover possibly undefined structures */ extern char filename[PATHSIZE]; /* name of the file that was just read */ extern char ans[ANS_LENGTH]; /* buffer for tokens that are input by user*/ /******* declared in tm.c */ extern char tm_state; /* the turing machine state */ extern int tm_num_exe; /* number of executions of quints*/ extern int trace; /* flag whether or not to show the tape at each step*/ extern int debug; /* turn debug on or off */ extern int max_step; /* maximum steps to take with 'go' */ /*** 'WATCH' variables****/ extern char watch_state[]; /* buffer for states to watch */ extern int nwatchstate; extern char watch_symbol[]; /* buffer for symbols to watch */ extern int nwatchsymbol; /************************************************************************* STATUS VALUES **************************************************************************/ #define OK 1 /* successful completion-- no message */ #define COM_TOO_LONG -1 /* quintuple comment is too long */ #define END_IN_LR -2 /* quintuple fails to end in 'l' or 'r' */ #define QEXISTS -3 /* quintuple already exists */ #define NEEDS_5 -4 /* quintuple must have five characters */ #define NO_MLIST -5 /* no macro list exists */ #define HALTED -6 /* machine has halted. */ #define HALTED_FINAL -7 /* machine has halted in a final state */ #define MEM_ERROR -8 /* memory allocation error-- out of memory(?) */ #define OUT_OF_MEMORY MEM_ERROR /* Out of Memory */ #define NO_SUCH_Q -9 /* no such quintuple exists */ #define NO_QLIST -10 /* there is no quintuple list */ #define EMPTY_QLIST -11 /* the quintuple list is empty */ #define NO_READ_OPEN -12 /* can't open a file to read */ #define EMPTY_QFILE -13 /* the .tm file has no quintuples */ #define EMPTY_MFILE -14 /* the .mac file has no macro words */ #define NO_STR_END -15 /* the end of string wasn't found on a file line*/ #define NO_MACRO -16 /* there is no macro list */ #define EMPTY_MACRO -17 /* the macro list is empty */ #define NO_WRITE_OPEN -18 /* a file can't be opened for write */ #define WORD_TOO_LONG -19 /* a word was too long */ #define CANT_INSERT -20 /* can't insert a macro word at this location */ #define SHOW_TAPE -22 /* tells the program to show the tape */ #define NO_SHOW_TAPE -23 /* tells the program not to show the tape */ #define NON_HAVE_STATE -24 /* no quintuple has the requested col 1 state */ #define STATE_BUT_NO_SYM -25 /* quint has the col 1 state, but not the sym*/ #define WORD_NOT_FOUND -26 /* couldn't find the input macro word on the list*/ #define NO_TAPE -27 /* there is no tape. */ #define CANT_RUN_RUN -28 /* can't put 'run' in a macro... recursive call */ #define AT_BREAK_POINT -29 /* one_step has encountered a break point */ #define AT_STATE_WATCH -30 /* one_step has found state watch point */ #define AT_SYMBOL_WATCH -31 /* one_step has found symbol watch point */ /******************************* Some function prototypes ********************************/ extern void message(char*, int); extern char getline(FILE*, char*, int);