#ifndef QUINT_H #define QUINT_H #include /* for strncpy */ #include "limits.h" #define COMMENT_LENGTH 70 /* comment associated with each quintuple */ #define MAX_HEADER 2048 /* comment applied to the entire quintuple list */ #define QNAME_LENGTH 30 /* length of quintuple list name */ struct quint { struct quint *nextptr; STATE current_state; SYMBOL current_symbol; SYMBOL next_symbol; STATE next_state; char move; unsigned brk :1; unsigned rep:2; /* 0 == normal, 1 == original, 2 == replicant */ char *comment; /* comment local to this quint*/ int num_used; /* number of times this quint was executed */ }; /* Values for replic field */ enum QuintReplicTag { QR_NORM, /* Single quint */ QR_ORIGINAL, /* Contains appreviations, original form */ QR_REPLICANT, /* replicated from an abbreviation */ QR_COMMENT /* Placeholder for Comment, not a real quint */ }; /* A qlist is a linked list of quintuples. */ struct qlist { int num_quint; /* number of quints on the list */ char *list_name; /* name of this quintuple list */ char *header; /* storage for global comments */ struct quint *root; /* pointer to first quintuple on the list */ int show_iter; int show_comment; struct qlist *nextqlist; }; /************ FUNCTION PROTOTYPES *************/ /* see quint.c for more details*/ struct quint *find_quint(struct qlist *qlst, char a, char b, int *status); /* return a pointer to a quint starting with first two characters a and b on quintuple list 'qlst', else return NULL. */ struct quint *new_quint(struct qlist *qlst, char *qstring, char *comment, int *status); /* insert a new quintuple, 'qstring', on quint list 'qlst'. Include the optional comment 'comment'. Return a pointer to the new quintuple. */ void quint_comment(struct quint *qptr, char *comment); /* add the comment 'comment' to quintuple 'qptr'. */ void print_quint(struct quint *qptr, struct qlist *qlst); /* print the quintuple 'qptr' from quintuple list 'qlst'. Do the appropriate thing if qlst->show-iter or qlst->show_comment are 'true' */ void list_quints(struct qlist *qlst, int *status); /* List all the quintuples in 'qlst' */ void del_quint(struct qlist *qlst, char state, char symbol, int *status); /* remove the quintuple whose first two symbols are 'state' and 'symbol' from the quintuple list 'qlist' */ void del_all_quint(struct qlist *qlst, int *status); /* Remove all the quintuples from list 'qlst' */ void del_list_quint(struct qlist *qlst, int *status); /* Remove a quintuple list, 'qlst' */ void zero_quint_iter(struct qlist *qlst); /* Set the iteration count of all quintuples to zero. */ struct qlist *new_qlist(int *status); /* Create a quintuple list. */ void del_qlist(struct qlist *qlst, int *status); /* Remove entire quintuple list including the base structure. */ #endif /* QUINT_H */