+Boolean
+seek_to_begin(void)
+{
+ if(GlobalState.start_position <= 0) {
+ return TRUE;
+ }
+ if(fseek(yyin, GlobalState.start_position, SEEK_SET) != 0) {
+ fprintf(GlobalState.logfile,"Cannot seek to position %ld in %s\n",
+ GlobalState.start_position,
+ GlobalState.current_input_file);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+Boolean
+at_end_of_input(void)
+{
+ long pos;
+ if(GlobalState.end_position >= LONG_MAX) {
+ return FALSE;
+ }
+ pos = ftell(yyin);
+ if(pos == -1) {
+ fprintf(GlobalState.logfile,"Cannot find position in %s\n",
+ GlobalState.current_input_file);
+ return TRUE;
+ }
+ return pos >= GlobalState.end_position;
+}
+