DEADSOFTWARE

Remove batch
[gpcp-linux.git] / J2CPS / PtrDesc.java
1 /**********************************************************************/
2 /* Pointer Descriptor class for J2CPS */
3 /* */
4 /* (c) copyright QUT */
5 /**********************************************************************/
6 package J2CPS;
8 import java.io.DataOutputStream;
9 import java.io.IOException;
11 public class PtrDesc extends TypeDesc {
13 TypeDesc boundType;
15 public PtrDesc(TypeDesc baseType) {
16 typeOrd = TypeDesc.arrPtr;
17 boundType = baseType;
18 if (boundType != null) {
19 name = "POINTER TO " + boundType.name;
20 }
21 }
23 public PtrDesc(int inNum, int baseNum) {
24 typeOrd = TypeDesc.arrPtr;
25 inTypeNum = inNum;
26 inBaseTypeNum = baseNum;
27 }
29 public void Init(TypeDesc baseType) {
30 boundType = baseType;
31 if (boundType != null) { setName(); }
32 }
34 public void AddImport(ClassDesc thisClass) {
35 if (boundType instanceof ClassDesc) {
36 thisClass.AddImport((ClassDesc)boundType);
37 } else if (boundType instanceof ArrayDesc) {
38 ((ArrayDesc)boundType).AddImport(thisClass);
39 }
40 }
42 public void setName() {
43 name = "POINTER TO " + boundType.name;
44 }
46 @Override
47 public void writeType(DataOutputStream out, PackageDesc thisPack)
48 throws IOException {
49 out.writeByte(SymbolFile.ptrSy);
50 SymbolFile.writeTypeOrd(out,boundType);
51 }
54 }