#include #include #include #include #include #include #include #define MAX_TAG_SIZE 1024 /* macro that states whether a char is a ``blank'' */ #define IS_BLANK(c) ( (c == 0x09) || (c == '\n') || (c == 0x0b) || (c == 0x0c) || (c == ' ') ) /* macro that states whether a char is a ``valid tag'' one */ #define VALID_TAG_CHAR(c) ( ( (c >= 'A') && (c <= 'Z')) || ( (c >= 'a') && (c <= 'z')) || ( (c >= '0') && (c <= '9')) || (c == '-') || (c == '_') ) ... tag_insert (...); #define FSM_START 0 #define FSM_GETTAG_EMPTY 1 #define FSM_GETTAG 2 #define FSM_WAITFOREND 3 int main (int argc, char **argv) { char *filename; FILE *fp; char c; int fsm_state; int line_number; /* parse the arguments */ if (argc == 1) { filename = NULL; } else if (argc == 2) { filename = argv[1]; } else { fprintf (stderr, "Error: Too many parameters\n"); exit(1); } if ( filename == NULL ) { fp = stdin; } else { fp = fopen(filename, "r"); if (fp == NULL) { printf ("Error while opening file %s - %s\n", filename, strerror(errno)); exit (1); } } fsm_state = FSM_START; line_number = 1; while (! feof(fp) ) { c = tolower(fgetc(fp)); /* your code here */ } /* your code here */ return 0; } /* your code here */