#define CHECK_FUNCT \
	if(cmd == 'o' || cmd == 'A'){\
\
	/* Illustration of copy */\
\
	if(!twofiles)\
	{\
		ifile1 = "../data/copy.data";\
		ifile2 = "../data/copy.results";\
	}\
	f1 = fopen(ifile1, "r");\
	f2 = fopen(ifile2, "w");\
		\
	fsm_read(f1, &fsm1);\
	fsm_copy(&fsm1, &fsm2);\
	fsm_print(f2, &fsm2);\
\
	fclose(f1);\
	fclose(f2);\
	fsm_delete(&fsm1);\
	fsm_delete(&fsm2);\
   \
	fprintf(f10, "Copy operation on input file :\n\t %s \n", ifile1);\
	fprintf(f10, "Copy output file:\n\t %s \n\n\n", ifile2);\
\
	}/*end o*/\
\
/* Illustration of lower level functions */\
\
	if(cmd == 'p' || cmd == 'A'){\
\
	/* Functions dealing with individual states */\
	\
	if(!twofiles)\
	{\
		ifile1 = "../data/states.data";\
		ifile2 = "../data/states.results";\
	}\
	f1 = fopen(ifile1, "r");\
	f2 = fopen(ifile2, "w");\
\
	fsm_read(f1, &fsm1);\
\
	/* to find out the number of states in a state machine */\
	no_of_states = get_NStates(&fsm1);\
	fprintf(f2, "This machine has %d states \n\n", no_of_states);\
\
	/* to search for a particular state of a state machine */\
	st_ptr = find_state(&fsm1, "q2");\
\
	/* to delete a state */\
	delete_state(&fsm1, st_ptr);\
\
	/* to insert a new state */\
	st_ptr = insert_state(&fsm1, "q4");\
	st_ptr->marked = MKD;\
\
	fsm_print(f2, &fsm1);\
\
	fclose(f1);\
	fclose(f2);\
	fsm_delete(&fsm1);\
\
\
	fprintf(f10, "Lower level operation on input file:\n\t %s \n", ifile1);\
	fprintf(f10, "Lower level operation output file:\n\t %s\n\n\n", ifile2);\
\
	}/*end p*/\
\
	if(cmd == 'q' || cmd == 'A'){\
   \
	/* Functions dealing with individual transitions */\
	\
	if(!twofiles)\
	{\
		ifile1 = "../data/trans.data";\
		ifile2 = "../data/trans.results";\
	}\
	f1 = fopen(ifile1, "r");\
	f2 = fopen(ifile2, "w");\
\
	fsm_read(f1, &fsm1);\
\
	/* first get a pointer to the initial state */\
	st_ptr = fsm1.states;\
\
	/* insert two new transitions in it */\
	insert_trans(&fsm1, st_ptr, "y", "q0");\
	insert_trans(&fsm1, st_ptr, "z", "q2");\
\
	/* locate one of the old transitions */\
	tr_ptr = find_trans(st_ptr, "a", "q0");\
\
	/* delete this transition */\
	delete_trans(st_ptr, tr_ptr);\
\
	/* now count the number of transitions in this state */\
	no_of_trans = get_NTrans(st_ptr);\
	fprintf(f2, "State q0 has %d transitions \n\n", no_of_trans);\
\
	/* print the modified machine */\
	fsm_print(f2, &fsm1);\
\
	fclose(f1);\
	fclose(f2);\
	fsm_delete(&fsm1);\
\
	fprintf(f10, "Transions operation on input file:\n\t %s \n", ifile1);\
	fprintf(f10, "Transitions operation output file:\n\t %s \n\n\n", ifile2);\
\
	}/*end q*/\
\
	if(cmd == 'G' || cmd == 'A'){ /*Greg Added*/\
   \
	/* Illustration of general functions */\
\
	if(!twofiles)\
	{\
		ifile1 = "../data/e1.data";\
		ifile2 = "../data/e2.results";\
	}\
	f1 = fopen(ifile1, "r");\
	f2 = fopen(ifile2, "w");\
\
	fsm_read(f1, &fsm1);\
	list_print(f2, &fsm1);\
	/*not fsm_print but different type of printing as a list*/\
\
	fclose(f1);\
	fclose(f2);\
	fsm_delete(&fsm1);\
	fsm_delete(&fsm2);\
\
	fprintf(f10, "Fsm alphabet determination in input file: \n\t");\
	fprintf(f10, "%s \n", ifile1);\
	fprintf(f10, "Fsm alphabet in output file: \n\t");\
	fprintf(f10, "%s \n\n\n", ifile2);\
\
	}/*end G*/\
\
	if(cmd == 'u' || cmd == 'A'){\
\
	/* Illustration of Labelling data.  As the case may be some select\
	events in a FSM may want to be renamed or labelled differently for\
	use in some operations like reachability analysis.  This routine\
	labels all such events as epsilon or "*" transitions */\
\
   	if(!threefiles)\
	{\
		ifile1 = "../data/label.data";\
		ifile2 = "../data/labevents.data";\
		ifile3 = "../data/label.results";\
	}\
	f1 = fopen(ifile1, "r");\
	f2 = fopen(ifile2, "r");\
	f3 = fopen(ifile3, "w");\
	\
	fsm_read(f1, &fsm1);\
	LabelEvents(&fsm1, f2);\
	fsm_print(f3, &fsm1);\
					 \
	fclose(f1);\
	fclose(f2);\
	fclose(f3);\
	fsm_delete(&fsm1);\
\
	fprintf(f10, "Labeling operation on input file:\n\t %s \n", ifile1);\
	fprintf(f10, "with events from input file: \n\t %s \n", ifile2);\
	fprintf(f10, "Labeling operation output file:\n\t %s \n\n\n", ifile3);\
\
	}/*end u*/\
\
\
	if(cmd == 'v' || cmd == 'A'){\
\
	/* Illustration of Relabelling of events in a state machine after\
	performing "LabelEvents" operation as above.  This  should revert\
	the state machine back to its original.*/\
\
   	if(!threefiles)\
	{\
		ifile1 = "../data/label.data";\
		ifile2 = "../data/label.results";\
		ifile3 = "../data/relabel.results";\
	}\
	f1 = fopen(ifile1, "r"); /* the original state machine is reqd */\
	f2 = fopen(ifile2, "r"); /* the result of LabelEvents */\
	f3 = fopen(ifile3, "w");\
	   \
	fsm_read(f1, &fsm1);\
	fsm_read(f2, &fsm2);\
				  \
	RelabelEvents(&fsm1, &fsm2, &fsm3);\
	fsm_print(f3, &fsm3);\
\
	fclose(f1);\
	fclose(f2);\
	fclose(f3);\
	fsm_delete(&fsm1);\
	fsm_delete(&fsm2);\
	fsm_delete(&fsm3);\
					\
	fprintf(f10, "Relabeling operation on input file:\n\t %s \n", ifile1);\
	fprintf(f10, "with events from input file: \n\t %s\n", ifile2);\
	fprintf(f10, "Relabeling operation output file:\n\t %s \n\n\n", ifile3);\
\
	}/*end v*/


