/* MESSAGE.C Simple routine for writing a message to the user. */ #include #include #include "tm.h" void message(char *about, int status) { char buf[5]; switch (status) { case COM_TOO_LONG: printf("quintuple comment is too long.\n"); break; case END_IN_LR: printf("quintuple '%s' must end in 'l' or 'r'.\n",about); break; case QEXISTS: strncpy(buf,about,2); buf[2] = '\0'; printf("a quintuple already exists beginning with '%s'.\n",buf); break; case NEEDS_5: printf("quintuple '%s' must have five characters.\n",about); break; case NO_MLIST: printf("there is no macro.\n"); break; case HALTED: printf("Halted. State is %s\n",about); break; case HALTED_FINAL: printf("Halted in final state %s\n",about); break; case MEM_ERROR: printf("memory allocation error.\n"); break; case NO_SUCH_Q: printf("no such quintuple on the list.\n"); break; case NO_QLIST: printf("there is no quintuple list.\n"); break; case EMPTY_QLIST: printf("the quintuple list is empty.\n"); break; case NO_READ_OPEN: printf("can't open file '%s' for read.\n",about); break; case EMPTY_QFILE: printf("no quintuples in file '%s'.\n",about); break; case EMPTY_MFILE: printf("no macro words in file '%s'.\n",about); break; case NO_STR_END: printf("string end not found on line.\n"); break; case NO_MACRO: printf("there is no macro list.\n"); break; case EMPTY_MACRO: printf("there are no words in the macro.\n"); break; case CANT_RUN_RUN: printf("You can't enter 'run' in a macro !!!\n"); break; case NO_WRITE_OPEN: printf("file can't be opened.\n"); break; case WORD_TOO_LONG: printf("word is too long.\n"); break; case CANT_INSERT: printf("can't insert here.\n"); break; case WORD_NOT_FOUND: printf("macro word not found.\n"); break; case NON_HAVE_STATE: printf("no quintuple has that initial state.\n"); break; case STATE_BUT_NO_SYM: printf("no quintuple with that initial state has that initial \ symbol.\n"); break; case NO_TAPE: printf("You need to 'set' a tape first.\n"); break; case AT_BREAK_POINT: printf("halted at break point.\n"); break; case AT_SYMBOL_WATCH: printf("halted at symbol watch point.\n"); break; case AT_STATE_WATCH: printf("halted at state watch point.\n"); break; } }