View Javadoc

1   package com.tapina.robe.swi.clib.stdio;
2   
3   import com.tapina.robe.runtime.Environment;
4   import com.tapina.robe.swi.clib.CLibrary;
5   import com.tapina.robe.swi.clib.Stub;
6   
7   import java.io.IOException;
8   
9   /***
10   * This functions tests to see if the end of the specified file stream has been reached.
11   * Returns: Zero if not at end-of-file.
12   */
13  public class FEof extends Stub {
14      public void executeStub(Environment environment) {
15          final int[] R = environment.getCpu().R;
16          FilePointer filePointer = FilePointer.find(environment.getMemoryMap().getWord(R[0]));
17          try {
18              R[0] = filePointer.eof()? CLibrary.EOF : 0;
19          } catch (IOException e) {
20              log.warning("Error in feof(): " + e.getMessage());
21              R[0] = CLibrary.EOF;
22          }
23      }
24  }