aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/gluegen/cgram/PreprocessorInfoChannel.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-10-24 19:21:03 +0000
committerKenneth Russel <[email protected]>2005-10-24 19:21:03 +0000
commitd6f9dbc493df725d3d574403549de142c5e1222a (patch)
tree8eb152b0627f8d1897a27c5204d6ce2efb4963e4 /src/classes/com/sun/gluegen/cgram/PreprocessorInfoChannel.java
parent42843c3290d64c41c9c8a18b93f5ad3c00d35ddc (diff)
Merged JSR-231 branch on to the main JOGL trunk. The main trunk now
contains the evolving JSR-231 Reference Implementation and the JSR-231 branch is permanently closed. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@401 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/gluegen/cgram/PreprocessorInfoChannel.java')
-rw-r--r--src/classes/com/sun/gluegen/cgram/PreprocessorInfoChannel.java73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/classes/com/sun/gluegen/cgram/PreprocessorInfoChannel.java b/src/classes/com/sun/gluegen/cgram/PreprocessorInfoChannel.java
new file mode 100644
index 000000000..431af91d3
--- /dev/null
+++ b/src/classes/com/sun/gluegen/cgram/PreprocessorInfoChannel.java
@@ -0,0 +1,73 @@
+package com.sun.gluegen.cgram;
+
+import java.util.*;
+
+public class PreprocessorInfoChannel
+{
+ Hashtable lineLists = new Hashtable(); // indexed by Token number
+ int firstValidTokenNumber = 0;
+ int maxTokenNumber = 0;
+
+ public void addLineForTokenNumber( Object line, Integer toknum )
+ {
+ if ( lineLists.containsKey( toknum ) ) {
+ Vector lines = (Vector) lineLists.get( toknum );
+ lines.addElement(line);
+ }
+ else {
+ Vector lines = new Vector();
+ lines.addElement(line);
+ lineLists.put(toknum, lines);
+ if ( maxTokenNumber < toknum.intValue() ) {
+ maxTokenNumber = toknum.intValue();
+ }
+ }
+ }
+
+ public int getMaxTokenNumber()
+ {
+ return maxTokenNumber;
+ }
+
+ public Vector extractLinesPrecedingTokenNumber( Integer toknum )
+ {
+ Vector lines = new Vector();
+ if (toknum == null) return lines;
+ for (int i = firstValidTokenNumber; i < toknum.intValue(); i++){
+ Integer inti = new Integer(i);
+ if ( lineLists.containsKey( inti ) ) {
+ Vector tokenLineVector = (Vector) lineLists.get( inti );
+ if ( tokenLineVector != null) {
+ Enumeration tokenLines = tokenLineVector.elements();
+ while ( tokenLines.hasMoreElements() ) {
+ lines.addElement( tokenLines.nextElement() );
+ }
+ lineLists.remove(inti);
+ }
+ }
+ }
+ firstValidTokenNumber = toknum.intValue();
+ return lines;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer("PreprocessorInfoChannel:\n");
+ for (int i = 0; i <= maxTokenNumber + 1; i++){
+ Integer inti = new Integer(i);
+ if ( lineLists.containsKey( inti ) ) {
+ Vector tokenLineVector = (Vector) lineLists.get( inti );
+ if ( tokenLineVector != null) {
+ Enumeration tokenLines = tokenLineVector.elements();
+ while ( tokenLines.hasMoreElements() ) {
+ sb.append(inti + ":" + tokenLines.nextElement() + '\n');
+ }
+ }
+ }
+ }
+ return sb.toString();
+ }
+}
+
+
+