%{ #include "wisebase.h" %} %{ #include "inputfile.h" static FILE * watch_file = NULL; static linecount = 0; boolean open_watch_file(FILE * ifp) { if( watch_file != NULL ) { warn("Can't watch a new file, already set!"); return FALSE; } watch_file = ifp; linecount = 0; return TRUE; } boolean close_watch_file(void) { if( watch_file == NULL ) { warn("No watch file to close"); return FALSE; } watch_file = NULL; return TRUE; } char * get_watched_line(char * buffer,int max,FILE * ifp) { if( ifp != watch_file) { warn("Trying to get a watched line without watching the file!"); return fgets(buffer,max,ifp); } linecount++; return fgets(buffer,max,ifp); } int get_watched_linecount(void) { return linecount; } %}