/* file TAPE.H A tape is a linked list of cells. Each cell contains a symbol. */ #ifndef TAPE_H #include "limits.h" struct cell { /* SYMBOL *symbol; */ /* the symbol contained in this cell */ SYMBOL Csymbol; /* the symbol contained in this cell */ struct cell *lptr; /* pointer to a cell on the left */ struct cell *rptr; /* pointer to a cell on the right */ }; struct tape { struct cell *root; /* pointer to the tape-- the linked list root */ struct cell *head; /* the tape head location */ struct cell *leftend; /* left end of the tape */ int tape_len; /* length of the tape */ }; #endif /* prototypes..... */ struct cell *new_cell(int *status); /* Create a new cell, initialize it to a blank. */ void delete_tape(struct tape *tptr); /* Delete all the cells on a tape. */ struct cell *init_tape(struct tape *tptr); /* Create a new tape. */ struct cell *make_rcell(struct tape *tptr); /* If head goes off the right end, create a new blank cell. */ struct cell *make_lcell(struct tape *tptr); /* If head goes off the left end, create a new blank cell. */ struct cell *move_head(struct tape *tptr, char ch); /* Move the head left or right, depending on whether 'ch' is either 'L' or 'R' */ void show_tape(struct tape *tptr, int *status); /* Print the tape. Indicate the tape head location with a '^', and show the machine state. */ void get_new_tape(struct tape *tptr, int *status); /* Get a new tape from standard input. Delete the old tape if it exists. */ #define TAPE_H