author | pliden |
Mon, 14 May 2018 15:42:59 +0200 | |
changeset 50102 | 454fa295105c |
parent 47216 | 71c04702a3d5 |
child 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
24336
1507192c67e6
8041620: Solaris Studio 12.4 C++ 5.13 change in behavior for placing friend declarations within surrounding scope.
lfoltan
parents:
13971
diff
changeset
|
2 |
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2786
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2786
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2786
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_ADLC_FILEBUFF_HPP |
26 |
#define SHARE_VM_ADLC_FILEBUFF_HPP |
|
27 |
||
1 | 28 |
// FILEBUFF.HPP - Definitions for parser file buffering routines |
2129
e810a33b5c67
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
1675
diff
changeset
|
29 |
|
1 | 30 |
// STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES |
13971 | 31 |
|
32 |
class BufferedFile { |
|
33 |
public: |
|
1 | 34 |
const char *_name; |
35 |
FILE *_fp; |
|
13971 | 36 |
inline BufferedFile() { _name = NULL; _fp = NULL; }; |
37 |
inline ~BufferedFile() {}; |
|
38 |
}; |
|
1 | 39 |
|
40 |
class ArchDesc; |
|
41 |
||
42 |
//------------------------------FileBuff-------------------------------------- |
|
43 |
// This class defines a nicely behaved buffer of text. Entire file of text |
|
2131 | 44 |
// is read into buffer at creation, with sentinels at start and end. |
1 | 45 |
class FileBuff { |
46 |
private: |
|
47 |
long _bufferSize; // Size of text holding buffer. |
|
48 |
long _offset; // Expected filepointer offset. |
|
49 |
long _bufoff; // Start of buffer file offset |
|
50 |
||
51 |
char *_buf; // The buffer itself. |
|
2131 | 52 |
char *_bigbuf; // The buffer plus sentinels; actual heap area |
53 |
char *_bufmax; // A pointer to the buffer end sentinel |
|
1 | 54 |
char *_bufeol; // A pointer to the last complete line end |
55 |
||
56 |
int _err; // Error flag for file seek/read operations |
|
57 |
long _filepos; // Current offset from start of file |
|
1495
128fe18951ed
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
775
diff
changeset
|
58 |
int _linenum; |
1 | 59 |
|
60 |
ArchDesc& _AD; // Reference to Architecture Description |
|
61 |
||
62 |
// Error reporting function |
|
63 |
void file_error(int flag, int linenum, const char *fmt, ...); |
|
64 |
||
65 |
public: |
|
66 |
const BufferedFile *_fp; // File to be buffered |
|
67 |
||
68 |
FileBuff(BufferedFile *fp, ArchDesc& archDesc); // Constructor |
|
69 |
~FileBuff(); // Destructor |
|
70 |
||
71 |
// This returns a pointer to the start of the current line in the buffer, |
|
72 |
// and increments bufeol and filepos to point at the end of that line. |
|
73 |
char *get_line(void); |
|
1495
128fe18951ed
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
775
diff
changeset
|
74 |
int linenum() const { return _linenum; } |
1662
76a93a5fb765
6771309: debugging AD files is difficult without #line directives in generated code
jrose
parents:
1495
diff
changeset
|
75 |
void set_linenum(int line) { _linenum = line; } |
1 | 76 |
|
77 |
// This converts a pointer into the buffer to a file offset. It only works |
|
78 |
// when the pointer is valid (i.e. just obtained from getline()). |
|
2786 | 79 |
long getoff(const char* s) { return _bufoff + (long)(s - _buf); } |
1 | 80 |
}; |
7397 | 81 |
#endif // SHARE_VM_ADLC_FILEBUFF_HPP |