src/share/vm/adlc/filebuff.hpp

changeset 1038
dbbe28fc66b5
parent 923
569b3b226089
child 1040
98cb887364d3
equal deleted inserted replaced
1037:ed6404fac86b 1038:dbbe28fc66b5
1 /* 1 /*
2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
24 24
25 // FILEBUFF.HPP - Definitions for parser file buffering routines 25 // FILEBUFF.HPP - Definitions for parser file buffering routines
26 #include <iostream> 26 #include <iostream>
27 27
28 using namespace std; 28 using namespace std;
29
29 // STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES 30 // STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES
30 typedef struct { 31 typedef struct {
31 const char *_name; 32 const char *_name;
32 FILE *_fp; 33 FILE *_fp;
33 } BufferedFile; 34 } BufferedFile;
70 int linenum() const { return _linenum; } 71 int linenum() const { return _linenum; }
71 void set_linenum(int line) { _linenum = line; } 72 void set_linenum(int line) { _linenum = line; }
72 73
73 // This converts a pointer into the buffer to a file offset. It only works 74 // This converts a pointer into the buffer to a file offset. It only works
74 // when the pointer is valid (i.e. just obtained from getline()). 75 // when the pointer is valid (i.e. just obtained from getline()).
75 int getoff(const char *s) { return _bufoff+(int)(s-_buf); } 76 long getoff(const char* s) { return _bufoff + (s - _buf); }
76 }; 77 };
77 78
78 //------------------------------FileBuffRegion--------------------------------- 79 //------------------------------FileBuffRegion---------------------------------
79 // A buffer region is really a region of some file, specified as a linked list 80 // A buffer region is really a region of some file, specified as a linked list
80 // of offsets and lengths. These regions can be merged; overlapping regions 81 // of offsets and lengths. These regions can be merged; overlapping regions
93 ~FileBuffRegion(); 94 ~FileBuffRegion();
94 95
95 FileBuffRegion *copy(); // Deep copy 96 FileBuffRegion *copy(); // Deep copy
96 FileBuffRegion *merge(FileBuffRegion*); // Merge 2 regions; delete input 97 FileBuffRegion *merge(FileBuffRegion*); // Merge 2 regions; delete input
97 98
98 // void print(std::ostream&);
99 // friend std::ostream& operator<< (std::ostream&, FileBuffRegion&);
100 void print(ostream&); 99 void print(ostream&);
101 friend ostream& operator<< (ostream&, FileBuffRegion&); 100 friend ostream& operator<< (ostream&, FileBuffRegion&);
102 }; 101 };

mercurial