summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/gluegen/cgram/LineObject.java
blob: 0ed470c92fc6be81e7a3b701aa0fc4131a5afd0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package com.sun.gluegen.cgram;

class LineObject {
  LineObject parent = null;
  String source = "";
  int line = 1;
  boolean enteringFile = false;
  boolean returningToFile = false;
  boolean systemHeader = false;
  boolean treatAsC = false;

  public LineObject() 
  {
    super();
  }

  public LineObject( LineObject lobj )
  {
    parent = lobj.getParent();
    source = lobj.getSource();
    line = lobj.getLine();
    enteringFile = lobj.getEnteringFile();
    returningToFile = lobj.getReturningToFile();
    systemHeader = lobj.getSystemHeader();
    treatAsC = lobj.getTreatAsC();
  }

  public LineObject( String src) 
  {
    source = src;
  }

  public void setSource(String src) 
  {
    source = src;
  }

  public String getSource() 
  {
    return source;
  }

  public void setParent(LineObject par) 
  {
    parent = par;
  }

  public LineObject getParent() 
  {
    return parent;
  }

  public void setLine(int l)
  {
    line = l;
  }

  public int getLine() 
  {
    return line;
  }

  public void newline()
  {
    line++;
  }

  public void setEnteringFile(boolean v) 
  {
    enteringFile = v;
  }

  public boolean getEnteringFile() 
  {
    return enteringFile;
  }

  public void setReturningToFile(boolean v) 
  {
    returningToFile = v;
  }

  public boolean getReturningToFile() 
  {
    return returningToFile;
  }

  public void setSystemHeader(boolean v) 
  {
    systemHeader = v;
  }

  public boolean getSystemHeader() 
  {
    return systemHeader;
  }

  public void setTreatAsC(boolean v) 
  {
    treatAsC = v;
  }

  public boolean getTreatAsC() 
  {
    return treatAsC;
  }

  public String toString() {
    StringBuffer ret;
    ret = new StringBuffer("# " + line + " \"" + source + "\"");
    if (enteringFile) {
        ret.append(" 1");
    }
    if (returningToFile) {
        ret.append(" 2");
    }
    if (systemHeader) {
        ret.append(" 3");
    }
    if (treatAsC) {
        ret.append(" 4");
    }
    return ret.toString();
  }
}