src/share/vm/adlc/filebuff.cpp

changeset 850
4d9884b01ba6
parent 435
a61af66fc99e
child 905
ad8c8ca4ab0f
equal deleted inserted replaced
842:ebfd4ae89bf6 850:4d9884b01ba6
39 if (_err) { 39 if (_err) {
40 file_error(SEMERR, 0, "File seek error reading input file\n"); 40 file_error(SEMERR, 0, "File seek error reading input file\n");
41 exit(1); // Exit on seek error 41 exit(1); // Exit on seek error
42 } 42 }
43 _filepos = ftell(_fp->_fp); // Reset current file position 43 _filepos = ftell(_fp->_fp); // Reset current file position
44 _linenum = 0;
44 45
45 _bigbuf = new char[_bufferSize]; // Create buffer to hold text for parser 46 _bigbuf = new char[_bufferSize]; // Create buffer to hold text for parser
46 if( !_bigbuf ) { 47 if( !_bigbuf ) {
47 file_error(SEMERR, 0, "Buffer allocation failed\n"); 48 file_error(SEMERR, 0, "Buffer allocation failed\n");
48 exit(1); // Exit on allocation failure 49 exit(1); // Exit on allocation failure
74 char *retval; 75 char *retval;
75 76
76 // Check for end of file & return NULL 77 // Check for end of file & return NULL
77 if (_bufeol >= _bufmax) return NULL; 78 if (_bufeol >= _bufmax) return NULL;
78 79
80 _linenum++;
79 retval = ++_bufeol; // return character following end of previous line 81 retval = ++_bufeol; // return character following end of previous line
80 if (*retval == '\0') return NULL; // Check for EOF sentinal 82 if (*retval == '\0') return NULL; // Check for EOF sentinal
81 // Search for newline character which must end each line 83 // Search for newline character which must end each line
82 for(_filepos++; *_bufeol != '\n'; _bufeol++) 84 for(_filepos++; *_bufeol != '\n'; _bufeol++)
83 _filepos++; // keep filepos in sync with _bufeol 85 _filepos++; // keep filepos in sync with _bufeol

mercurial