Răsfoiți Sursa

Changes for v1.3.13 candidate.
GPCP now implicitly imports java_lang or mscorlib_System, according to default and any explicit -target setting.
In TypeDesc.cp Record::isBaseOf is protected against NIL incoming arguments.
Significant rewrite of J2CPS to ensure that imports are not missed if only external reference to a module is via a pointer or array element type in a field or formal parameter.

k_john_gough_cp 13 ani în urmă
părinte
comite
c3f3588a7f

+ 7 - 6
J2CPS/ArrayDesc.java

@@ -5,7 +5,8 @@
 /**********************************************************************/
 /**********************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.io.*;
+import java.io.DataOutputStream;
+import java.io.IOException;
 
 
 public class ArrayDesc extends TypeDesc {
 public class ArrayDesc extends TypeDesc {
   
   
@@ -82,17 +83,17 @@ public class ArrayDesc extends TypeDesc {
     if (numArrayTypes == arrayTypes.length) {
     if (numArrayTypes == arrayTypes.length) {
       ArrayDesc[] temp = arrayTypes;
       ArrayDesc[] temp = arrayTypes;
       arrayTypes = new ArrayDesc[numArrayTypes * 2];
       arrayTypes = new ArrayDesc[numArrayTypes * 2];
-      for (int i=0; i < numArrayTypes; i++) {
-        arrayTypes[i] = temp[i];
-      } 
+      System.arraycopy(temp, 0, arrayTypes, 0, numArrayTypes);
     }
     }
     return arrayTypes[numArrayTypes-1];
     return arrayTypes[numArrayTypes-1];
   }
   }
 
 
-  public String getTypeMneumonic() {
-    return 'a' + elemType.getTypeMneumonic();
+  @Override
+  public String getTypeMnemonic() {
+    return 'a' + elemType.getTypeMnemonic();
   }
   }
 
 
+  @Override
   public void writeType(DataOutputStream out, PackageDesc thisPack) 
   public void writeType(DataOutputStream out, PackageDesc thisPack) 
                                                           throws IOException {
                                                           throws IOException {
     // Array = TypeHeader arrSy TypeOrd (Byte | Number | ) endAr.
     // Array = TypeHeader arrSy TypeOrd (Byte | Number | ) endAr.

+ 1 - 1
J2CPS/CPWords.java

@@ -5,7 +5,7 @@
 /**********************************************************************/
 /**********************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.util.*;
+import java.util.HashMap;
 
 
 public class CPWords {
 public class CPWords {
 
 

+ 51 - 38
J2CPS/ClassDesc.java

@@ -6,7 +6,9 @@
 package J2CPS;
 package J2CPS;
 
 
 import java.io.*;
 import java.io.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
 
 
 public class ClassDesc extends TypeDesc  {
 public class ClassDesc extends TypeDesc  {
 
 
@@ -48,21 +50,36 @@ public class ClassDesc extends TypeDesc  {
     typeOrd = TypeDesc.classT;
     typeOrd = TypeDesc.classT;
   }
   }
 
 
-  public ClassDesc(String thisName, PackageDesc pack) {
+    public static ClassDesc GetClassDesc(String name, PackageDesc pack) {
+    if (name.indexOf(jSepCh) != -1) { name = name.replace(jSepCh,qSepCh); }
+    ClassDesc aClass = (ClassDesc)classList.get(name);
+    if (aClass == null) 
+        aClass = ClassDesc.MakeNewClassDesc(name,pack); 
+    return aClass;
+  }
+
+  public static ClassDesc MakeNewClassDesc(String name, PackageDesc pack) {
+      ClassDesc desc = new ClassDesc(name, pack);
+      desc.MakeJavaName();
+      classList.put(desc.qualName, desc);
+      return desc;
+  }
+  
+  private ClassDesc(String thisName, PackageDesc pack) {
     typeOrd = TypeDesc.classT;
     typeOrd = TypeDesc.classT;
     qualName = thisName;
     qualName = thisName;
-    MakeJavaName();
-    classList.put(qualName,this);
-    if (pack == null) {
-      packageDesc = PackageDesc.getClassPackage(qualName);
-    } else { packageDesc = pack; }
+    if (pack == null)
+        packageDesc = PackageDesc.getClassPackage(qualName);
+    else 
+        packageDesc = pack; 
   }
   }
 
 
   public ClassDesc(int inNum) {
   public ClassDesc(int inNum) {
     inBaseTypeNum = inNum; 
     inBaseTypeNum = inNum; 
   }
   }
 
 
-  public String getTypeMneumonic() {
+    @Override
+  public String getTypeMnemonic() {
     if (javaName.equals(jlString)) {
     if (javaName.equals(jlString)) {
       return "S";
       return "S";
     } else if (javaName.equals(jlObject)) {
     } else if (javaName.equals(jlObject)) {
@@ -84,19 +101,19 @@ public class ClassDesc extends TypeDesc  {
     }
     }
     /* read and check the minor and major version numbers  */
     /* read and check the minor and major version numbers  */
     int minorVersion = stream.readUnsignedShort();
     int minorVersion = stream.readUnsignedShort();
-   /* if (minorVersion > MINOR_VERSION) {
-	System.out.println("Unsupported Java minor version " +
-				String.valueOf(minorVersion));
-	System.exit(0);
-    }
-*/
+//   /* if (minorVersion > MINOR_VERSION) {
+//	System.out.println("Unsupported Java minor version " +
+//				String.valueOf(minorVersion));
+//	System.exit(0);
+//    }
+//*/
     int majorVersion = stream.readUnsignedShort();
     int majorVersion = stream.readUnsignedShort();
- /*   if (majorVersion != MAJOR_VERSION) {
-      System.out.println("Unsupported Java major version " + 
-			 String.valueOf(majorVersion));
-      System.exit(0);
-    }
-*/
+// /*   if (majorVersion != MAJOR_VERSION) {
+//      System.out.println("Unsupported Java major version " + 
+//			 String.valueOf(majorVersion));
+//      System.exit(0);
+//    }
+//*/
     cp = new ConstantPool(stream);
     cp = new ConstantPool(stream);
     access = stream.readUnsignedShort(); 
     access = stream.readUnsignedShort(); 
     ClassRef thisClass = (ClassRef) cp.Get(stream.readUnsignedShort());
     ClassRef thisClass = (ClassRef) cp.Get(stream.readUnsignedShort());
@@ -114,10 +131,10 @@ public class ClassDesc extends TypeDesc  {
       } 
       } 
       classList.remove(qualName);
       classList.remove(qualName);
       qualName = clName;
       qualName = clName;
-      MakeJavaName();
+      this.MakeJavaName();
       classList.put(qualName,this);
       classList.put(qualName,this);
     }
     }
-    isInterface = cp.isInterface(access);
+    isInterface = ConstantPool.isInterface(access);
     int superIx = stream.readUnsignedShort();
     int superIx = stream.readUnsignedShort();
     if (superIx > 0) {
     if (superIx > 0) {
       tmp = (ClassRef) cp.Get(superIx);
       tmp = (ClassRef) cp.Get(superIx);
@@ -152,6 +169,16 @@ public class ClassDesc extends TypeDesc  {
     cp = null;
     cp = null;
     return true;
     return true;
   }
   }
+  
+  public void TryImport(TypeDesc type){
+      if (type instanceof ClassDesc)
+          this.AddImport((ClassDesc)type);
+      else if (type instanceof ArrayDesc)
+          this.TryImport(((ArrayDesc)type).elemType);
+      else if (type instanceof PtrDesc)
+          ((PtrDesc)type).AddImport(this);
+      
+  }
 
 
   public void AddImport(ClassDesc aClass) {
   public void AddImport(ClassDesc aClass) {
    if ((aClass != this) && (aClass.packageDesc != this.packageDesc) &&
    if ((aClass != this) && (aClass.packageDesc != this.packageDesc) &&
@@ -160,14 +187,6 @@ public class ClassDesc extends TypeDesc  {
     }
     }
   }
   }
 
 
-/*
- *public boolean ReadClassFile(File cFile) throws IOException {
- *  DataInputStream in = new DataInputStream(new FileInputStream(cFile));
- *  if (verbose) { System.out.println("Reading Class File <"+qualName+">"); }
- *  return ReadClassFileDetails(in);
- *}
- */
-
   public boolean ReadClassFile(File cFile) throws IOException {
   public boolean ReadClassFile(File cFile) throws IOException {
     boolean result;
     boolean result;
     DataInputStream in = new DataInputStream(new FileInputStream(cFile));
     DataInputStream in = new DataInputStream(new FileInputStream(cFile));
@@ -178,13 +197,6 @@ public class ClassDesc extends TypeDesc  {
     return result;
     return result;
   }
   }
 
 
-  public static ClassDesc GetClassDesc(String name, PackageDesc pack) {
-    if (name.indexOf(jSepCh) != -1) { name = name.replace(jSepCh,qSepCh); }
-    ClassDesc aClass = (ClassDesc)classList.get(name);
-    if (aClass == null) { aClass = new ClassDesc(name,pack); }
-    return aClass;
-  }
-
   public void PrintClassFile() {
   public void PrintClassFile() {
     int i;
     int i;
     System.out.println("ClassFile for " + qualName);
     System.out.println("ClassFile for " + qualName);
@@ -255,7 +267,7 @@ public class ClassDesc extends TypeDesc  {
     if (overloadedNames) { return; }
     if (overloadedNames) { return; }
     if (meth.parTypes.length > 0) { meth.userName += "_"; }
     if (meth.parTypes.length > 0) { meth.userName += "_"; }
     for (int i=0; i < meth.parTypes.length; i++) {
     for (int i=0; i < meth.parTypes.length; i++) {
-      String next = meth.parTypes[i].getTypeMneumonic();
+      String next = meth.parTypes[i].getTypeMnemonic();
       if (next.endsWith("o")) { needHash = true; }
       if (next.endsWith("o")) { needHash = true; }
       meth.userName += next;
       meth.userName += next;
     }
     }
@@ -411,6 +423,7 @@ public class ClassDesc extends TypeDesc  {
     }
     }
   }
   }
 
 
+    @Override
   public void writeType(DataOutputStream out,PackageDesc thisPack) 
   public void writeType(DataOutputStream out,PackageDesc thisPack) 
                                                            throws IOException {
                                                            throws IOException {
     if (objName == null)  { this.MakeJavaName(); }
     if (objName == null)  { this.MakeJavaName(); }

+ 1 - 3
J2CPS/ClassRef.java

@@ -5,8 +5,6 @@
 /*************************************************************************/
 /*************************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.io.*;
-
 public class ClassRef {
 public class ClassRef {
 
 
   ConstantPool cp;  /* the constant pool containing this class ref */
   ConstantPool cp;  /* the constant pool containing this class ref */
@@ -41,11 +39,11 @@ public class ClassRef {
     if (name == null) { this.name = (String) this.cp.Get(nameIndex); }
     if (name == null) { this.name = (String) this.cp.Get(nameIndex); }
   }
   }
 
 
+    @Override
   public String toString() {
   public String toString() {
     this.Resolve();
     this.Resolve();
     return ("<ClassReference> " + nameIndex + " " + name);
     return ("<ClassReference> " + nameIndex + " " + name);
   }
   }
-
 }
 }
 
 
 
 

+ 6 - 6
J2CPS/ConstantPool.java

@@ -5,7 +5,8 @@
 /**********************************************************************/
 /**********************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.io.*;
+import java.io.DataInputStream;
+import java.io.IOException;
 
 
 /* The constant pool from the ClassFile */
 /* The constant pool from the ClassFile */
 
 
@@ -47,7 +48,7 @@ public class ConstantPool {
     /* read in the constant pool */ 
     /* read in the constant pool */ 
     pool = new Object[count];
     pool = new Object[count];
     for (int i = 1; i < count; i++) {
     for (int i = 1; i < count; i++) {
-      Object c = ReadConstant(stream, i);
+      Object c = ReadConstant(stream);
       pool[i] = c;
       pool[i] = c;
       /* note that Long and Double constant occupies two entries */
       /* note that Long and Double constant occupies two entries */
       if (c instanceof Long || c instanceof Double) { i++; }
       if (c instanceof Long || c instanceof Double) { i++; }
@@ -68,12 +69,12 @@ public class ConstantPool {
     pool = null;
     pool = null;
   }
   }
 
 
-  private Object ReadConstant(DataInputStream stream, int index) 
+  private Object ReadConstant(DataInputStream stream) 
                                                             throws IOException {
                                                             throws IOException {
     int tag = stream.readUnsignedByte();
     int tag = stream.readUnsignedByte();
     switch (tag) {
     switch (tag) {
     case CONSTANT_Utf8:
     case CONSTANT_Utf8:
-      return new String(stream.readUTF());
+      return stream.readUTF();
     case CONSTANT_Integer: 
     case CONSTANT_Integer: 
       return new Integer(stream.readInt());
       return new Integer(stream.readInt());
     case CONSTANT_Float: 
     case CONSTANT_Float: 
@@ -137,7 +138,7 @@ public class ConstantPool {
 
 
   /** Constructs a string from a set of access flags */
   /** Constructs a string from a set of access flags */
   public static String GetAccessString(int flags) {
   public static String GetAccessString(int flags) {
-    StringBuffer result = new StringBuffer();
+    StringBuilder result = new StringBuilder();
     if ((flags & ACC_PUBLIC) != 0) result.append("public ");
     if ((flags & ACC_PUBLIC) != 0) result.append("public ");
     if ((flags & ACC_PRIVATE) != 0) result.append("private ");
     if ((flags & ACC_PRIVATE) != 0) result.append("private ");
     if ((flags & ACC_PROTECTED) != 0) result.append("protected ");
     if ((flags & ACC_PROTECTED) != 0) result.append("protected ");
@@ -206,5 +207,4 @@ public class ConstantPool {
   public static boolean isTransient(int flags) {
   public static boolean isTransient(int flags) {
     return (flags & ACC_TRANSIENT) != 0;
     return (flags & ACC_TRANSIENT) != 0;
   }
   }
-
 }
 }

+ 9 - 6
J2CPS/FieldInfo.java

@@ -5,8 +5,9 @@
 /**********************************************************************/
 /**********************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.io.*;
-import java.util.*;
+import java.io.DataInputStream;
+import java.io.IOException;
+
 
 
 public class FieldInfo extends MemberInfo {
 public class FieldInfo extends MemberInfo {
   
   
@@ -19,7 +20,7 @@ public class FieldInfo extends MemberInfo {
     
     
     super(cp,stream,thisClass);
     super(cp,stream,thisClass);
     type = TypeDesc.GetType(signature,0);
     type = TypeDesc.GetType(signature,0);
-    if (type instanceof ClassDesc) { thisClass.AddImport((ClassDesc)type); }
+    thisClass.TryImport(type);
   }
   }
 
 
   public FieldInfo(ClassDesc cl,int acc,String nam,TypeDesc typ,Object cVal) {
   public FieldInfo(ClassDesc cl,int acc,String nam,TypeDesc typ,Object cVal) {
@@ -28,9 +29,10 @@ public class FieldInfo extends MemberInfo {
     constVal = cVal;
     constVal = cVal;
   }
   }
 
 
-  public void AddImport(ClassDesc thisClass) {
-    if (type instanceof ClassDesc) { thisClass.AddImport((ClassDesc)type); }
-  }
+//  @Override
+//  public void AddImport(ClassDesc thisClass) {
+//    if (type instanceof ClassDesc) { thisClass.AddImport((ClassDesc)type); }
+//  }
 
 
   public void GetConstValueAttribute (ConstantPool cp, DataInputStream stream) 
   public void GetConstValueAttribute (ConstantPool cp, DataInputStream stream) 
                                                             throws IOException {
                                                             throws IOException {
@@ -52,6 +54,7 @@ public class FieldInfo extends MemberInfo {
              ConstantPool.isProtected(accessFlags)));
              ConstantPool.isProtected(accessFlags)));
   }
   }
 
 
+  @Override
   public String toString() {
   public String toString() {
     if (constVal == null) {
     if (constVal == null) {
       return ConstantPool.GetAccessString(accessFlags) + " " + 
       return ConstantPool.GetAccessString(accessFlags) + " " + 

+ 1 - 0
J2CPS/FieldRef.java

@@ -10,6 +10,7 @@ public class FieldRef extends Reference {
     return (classRef.GetName() + "." + name);
     return (classRef.GetName() + "." + name);
   }
   }
 
 
+    @Override
   public String toString() {
   public String toString() {
     this.Resolve();
     this.Resolve();
     return ("<FieldReference> " + classIndex + " " + nameAndTypeIndex + " " +
     return ("<FieldReference> " + classIndex + " " + nameAndTypeIndex + " " +

+ 1 - 0
J2CPS/InterfaceMethodRef.java

@@ -15,6 +15,7 @@ public class InterfaceMethodRef extends Reference {
     return (classRef.GetName() + "." + name + type);
     return (classRef.GetName() + "." + name + type);
   }
   }
 
 
+    @Override
   public String toString() {
   public String toString() {
     this.Resolve();
     this.Resolve();
     return ("<InterfaceMethReference>  Class " + classIndex + 
     return ("<InterfaceMethReference>  Class " + classIndex + 

+ 4 - 7
J2CPS/J2CPS.java

@@ -5,14 +5,13 @@
 /**********************************************************************/
 /**********************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.util.*;
-import java.io.*;
+import java.io.IOException;
 
 
 public class J2CPS {
 public class J2CPS {
 
 
   /**
   /**
    * Main program. Takes a package name as a parameter, produces the 
    * Main program. Takes a package name as a parameter, produces the 
-   * component pascal symbol file.
+   * Component Pascal symbol file.
    */
    */
   public static void main(String args[]) { 
   public static void main(String args[]) { 
     int argLen = args.length;
     int argLen = args.length;
@@ -61,7 +60,7 @@ public class J2CPS {
       }
       }
     }
     }
     try {
     try {
-      PackageDesc thisPackage = new PackageDesc(filename, anonPack);
+      PackageDesc thisPackage = PackageDesc.MakeNewPackageDesc(filename, anonPack);
       PackageDesc.ReadPackages();
       PackageDesc.ReadPackages();
       PackageDesc.WriteSymbolFiles();
       PackageDesc.WriteSymbolFiles();
     }
     }
@@ -70,9 +69,7 @@ public class J2CPS {
 	System.err.println("Aborting...");
 	System.err.println("Aborting...");
 	System.exit(1);
 	System.exit(1);
     }
     }
-  } 
-
-
+  }
 }
 }
 
 
 
 

+ 0 - 1
J2CPS/J2CPSFiles.java

@@ -191,7 +191,6 @@ public class J2CPSFiles implements FilenameFilter {
     return new DataOutputStream(new FileOutputStream(
     return new DataOutputStream(new FileOutputStream(
                                 new File(dirName,fileName + symExt)));
                                 new File(dirName,fileName + symExt)));
   }
   }
-
 }
 }
 
 
 
 

+ 3 - 5
J2CPS/MemberInfo.java

@@ -5,8 +5,8 @@
 /**********************************************************************/
 /**********************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.io.*;
-import java.util.*;
+import java.io.DataInputStream;
+import java.io.IOException;
 
 
 public class MemberInfo {
 public class MemberInfo {
 
 
@@ -79,9 +79,7 @@ public class MemberInfo {
     return ConstantPool.isFinal(accessFlags); 
     return ConstantPool.isFinal(accessFlags); 
   }
   }
 
 
-  public void AddImport(ClassDesc thisClass) {
-  }
-
+    @Override
   public String toString() { return ""; };
   public String toString() { return ""; };
 
 
   
   

+ 12 - 15
J2CPS/MethodInfo.java

@@ -5,8 +5,8 @@
 /**********************************************************************/
 /**********************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.io.*;
-// import java.util.*;
+import java.io.DataInputStream;
+import java.io.IOException;
 
 
 public class MethodInfo extends MemberInfo {
 public class MethodInfo extends MemberInfo {
 
 
@@ -42,7 +42,10 @@ public class MethodInfo extends MemberInfo {
     if (ClassDesc.verbose) { 
     if (ClassDesc.verbose) { 
       System.out.println("Method has " + parTypes.length + " parameters");
       System.out.println("Method has " + parTypes.length + " parameters");
     }
     }
-    AddImport(thisClass);
+    //AddImport(thisClass);
+    for (int i=0; i < parTypes.length; i++)
+        thisClass.TryImport(parTypes[i]);
+    thisClass.TryImport(retType);
   }
   }
 
 
   public MethodInfo(ClassDesc thisClass,String name,String jName,int acc) {
   public MethodInfo(ClassDesc thisClass,String name,String jName,int acc) {
@@ -54,19 +57,13 @@ public class MethodInfo extends MemberInfo {
     }
     }
   }
   }
 
 
-  public void AddImport(ClassDesc thisClass) {
-    for (int i=0; i < parTypes.length; i++) {
-      if (parTypes[i] instanceof ClassDesc) { 
-        thisClass.AddImport((ClassDesc)parTypes[i]);
-      }
-    }
-    if (retType instanceof ClassDesc) { 
-      thisClass.AddImport((ClassDesc)retType); 
-    } else if (retType instanceof PtrDesc) {
-      ((PtrDesc)retType).AddImport(thisClass); 
-    }
-  }
+//  public void AddImport(ClassDesc thisClass) {
+//    for (int i=0; i < parTypes.length; i++)
+//        thisClass.TryImport(parTypes[i]);
+//    thisClass.TryImport(retType);
+//  }
 
 
+    @Override
   public String toString() {
   public String toString() {
     return ConstantPool.GetAccessString(accessFlags) + " " + name + " " + 
     return ConstantPool.GetAccessString(accessFlags) + " " + name + " " + 
            signature;
            signature;

+ 1 - 0
J2CPS/MethodRef.java

@@ -15,6 +15,7 @@ public class MethodRef extends Reference {
     return (classRef.GetName() + "." + name + type);
     return (classRef.GetName() + "." + name + type);
   }
   }
 
 
+    @Override
   public String toString() {
   public String toString() {
     this.Resolve();
     this.Resolve();
     return ("<MethodReference> " + classIndex + " " + nameAndTypeIndex + " " +
     return ("<MethodReference> " + classIndex + " " + nameAndTypeIndex + " " +

+ 1 - 0
J2CPS/NameAndType.java

@@ -34,6 +34,7 @@ public class NameAndType {
     if (this.type == null) { this.type = (String) this.cp.Get(typeIndex); }
     if (this.type == null) { this.type = (String) this.cp.Get(typeIndex); }
   }
   }
 
 
+    @Override
   public String toString() {
   public String toString() {
     this.Resolve();
     this.Resolve();
     return "<NameAndType> " + nameIndex + " " + this.name + 
     return "<NameAndType> " + nameIndex + " " + this.name + 

+ 17 - 11
J2CPS/PackageDesc.java

@@ -5,8 +5,11 @@
 /**********************************************************************/
 /**********************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.io.*;
-import java.util.*;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
 
 
 public class PackageDesc {
 public class PackageDesc {
 
 
@@ -26,17 +29,23 @@ public class PackageDesc {
   public int impNum = -1;
   public int impNum = -1;
   public boolean anonPackage = false;
   public boolean anonPackage = false;
 
 
-  public PackageDesc(String pName, boolean anon) {
+  public static PackageDesc MakeNewPackageDesc(String pName, boolean anon) {
+      PackageDesc desc = new PackageDesc(pName, anon);
+      if (!anon)
+          packageList.put(desc.name, desc);
+      toDo.add(desc);
+      return desc;
+  }
+  
+  private PackageDesc(String pName, boolean anon) {
     if (anon) {
     if (anon) {
       name = pName;
       name = pName;
       cpName = pName;
       cpName = pName;
       javaName = pName;
       javaName = pName;
       anonPackage = true;
       anonPackage = true;
     } else {
     } else {
-      MakeName(pName);
-      packageList.put(name,this); 
+      MakeName(pName); 
     }
     }
-    boolean ok = toDo.add(this); 
   }
   }
 
 
   private void MakeName(String pName) {
   private void MakeName(String pName) {
@@ -54,7 +63,7 @@ public class PackageDesc {
   public static PackageDesc getPackage(String packName) {
   public static PackageDesc getPackage(String packName) {
     packName = packName.replace(jSepCh,qSepCh); 
     packName = packName.replace(jSepCh,qSepCh); 
     PackageDesc pack = (PackageDesc)packageList.get(packName);
     PackageDesc pack = (PackageDesc)packageList.get(packName);
-    if (pack == null) { pack = new PackageDesc(packName,false); }
+    if (pack == null) { pack = PackageDesc.MakeNewPackageDesc(packName,false); }
     return pack;
     return pack;
   }
   }
 
 
@@ -62,7 +71,7 @@ public class PackageDesc {
     className = className.replace(jSepCh,qSepCh); 
     className = className.replace(jSepCh,qSepCh); 
     String pName = className.substring(0,className.lastIndexOf(qSepCh));
     String pName = className.substring(0,className.lastIndexOf(qSepCh));
     PackageDesc pack = (PackageDesc)packageList.get(pName);
     PackageDesc pack = (PackageDesc)packageList.get(pName);
-    if (pack == null) { pack = new PackageDesc(pName,false); }
+    if (pack == null) { pack = PackageDesc.MakeNewPackageDesc(pName,false); }
     return pack;
     return pack;
   }
   }
 
 
@@ -172,7 +181,4 @@ public class PackageDesc {
       SymbolFile.WriteSymbolFile(nextPack);
       SymbolFile.WriteSymbolFile(nextPack);
     }
     }
   }
   }
-
-
-
 }
 }

+ 6 - 3
J2CPS/PtrDesc.java

@@ -5,8 +5,8 @@
 /**********************************************************************/
 /**********************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.io.*;
-import java.util.*;
+import java.io.DataOutputStream;
+import java.io.IOException;
 
 
 public class PtrDesc extends TypeDesc {
 public class PtrDesc extends TypeDesc {
 
 
@@ -15,7 +15,9 @@ public class PtrDesc extends TypeDesc {
   public PtrDesc(TypeDesc baseType) {
   public PtrDesc(TypeDesc baseType) {
     typeOrd = TypeDesc.arrPtr;
     typeOrd = TypeDesc.arrPtr;
     boundType = baseType;
     boundType = baseType;
-    if (boundType != null) { setName(); }
+    if (boundType != null) { 
+        name = "POINTER TO " + boundType.name; 
+    }
   }
   }
 
 
   public PtrDesc(int inNum, int baseNum) {
   public PtrDesc(int inNum, int baseNum) {
@@ -41,6 +43,7 @@ public class PtrDesc extends TypeDesc {
     name = "POINTER TO " + boundType.name;
     name = "POINTER TO " + boundType.name;
   }
   }
 
 
+    @Override
   public void writeType(DataOutputStream out, PackageDesc thisPack) 
   public void writeType(DataOutputStream out, PackageDesc thisPack) 
                                                            throws IOException {
                                                            throws IOException {
     out.writeByte(SymbolFile.ptrSy);
     out.writeByte(SymbolFile.ptrSy);

+ 1 - 0
J2CPS/Reference.java

@@ -35,6 +35,7 @@ public class Reference {
     this.type = nAndt.GetType();
     this.type = nAndt.GetType();
   }
   }
 
 
+    @Override
   public String toString() {
   public String toString() {
     this.Resolve();
     this.Resolve();
     return ("Class " + classIndex + "  NameAndType " + nameAndTypeIndex);
     return ("Class " + classIndex + "  NameAndType " + nameAndTypeIndex);

+ 1 - 2
J2CPS/StringRef.java

@@ -5,8 +5,6 @@
 /**********************************************************************/
 /**********************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.io.*;
-
 public class StringRef {
 public class StringRef {
 
 
   ConstantPool cp;  /* the constant pool containing this string ref */
   ConstantPool cp;  /* the constant pool containing this string ref */
@@ -27,6 +25,7 @@ public class StringRef {
     this.str = (String) this.cp.Get(strIndex);
     this.str = (String) this.cp.Get(strIndex);
   }
   }
 
 
+    @Override
   public String toString() {
   public String toString() {
     this.Resolve();
     this.Resolve();
     return ("<StringRef>  " + this.strIndex + " " + str);
     return ("<StringRef>  " + this.strIndex + " " + str);

+ 1 - 11
J2CPS/SymbolFile.java

@@ -6,7 +6,7 @@
 package J2CPS;
 package J2CPS;
 
 
 import java.io.*;
 import java.io.*;
-import java.util.*;
+import java.util.ArrayList;
 
 
 class SymbolFile {
 class SymbolFile {
  
  
@@ -324,25 +324,18 @@ class SymbolFile {
     switch (sSym) {
     switch (sSym) {
       case namSy : acc = in.readByte();         // fall through 
       case namSy : acc = in.readByte();         // fall through 
       case strSy : name = in.readUTF(); break;
       case strSy : name = in.readUTF(); break;
-
       case arrSy :
       case arrSy :
       case ptrSy :
       case ptrSy :
       case retSy : 
       case retSy : 
       case fromS : 
       case fromS : 
       case tDefS : 
       case tDefS : 
       case basSy : tOrd = readOrd(); break;
       case basSy : tOrd = readOrd(); break;
-
       case bytSy : iVal = in.readByte(); break;
       case bytSy : iVal = in.readByte(); break;
-
       case keySy : 
       case keySy : 
       case setSy : iVal = in.readInt(); break;
       case setSy : iVal = in.readInt(); break;
-
       case numSy : lVal = in.readLong(); break;
       case numSy : lVal = in.readLong(); break;
-
       case fltSy : dVal = in.readDouble(); break;
       case fltSy : dVal = in.readDouble(); break;
-
       case chrSy : cVal = in.readChar(); break;
       case chrSy : cVal = in.readChar(); break;
-
       case modSy : 
       case modSy : 
       case impSy : 
       case impSy : 
       case conSy : 
       case conSy : 
@@ -364,7 +357,6 @@ class SymbolFile {
       case iFcSy :
       case iFcSy :
       case evtSy :
       case evtSy :
       case pTpSy : break;
       case pTpSy : break;
-  
       default:  char ch = (char) sSym;
       default:  char ch = (char) sSym;
                 System.out.println("Bad symbol file format." +ch+"  "+sSym);
                 System.out.println("Bad symbol file format." +ch+"  "+sSym);
                 System.exit(1);
                 System.exit(1);
@@ -887,8 +879,6 @@ class SymbolFile {
       }
       }
     }
     }
   }
   }
-
-
 }
 }
 
 
 
 

+ 5 - 5
J2CPS/TypeDesc.java

@@ -5,8 +5,9 @@
 /**********************************************************************/
 /**********************************************************************/
 package J2CPS;
 package J2CPS;
 
 
-import java.io.*;
-import java.util.*;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
 
 
 public class TypeDesc {
 public class TypeDesc {
 
 
@@ -58,7 +59,7 @@ public class TypeDesc {
     typeOrd = ix;
     typeOrd = ix;
   }
   }
 
 
-  public String getTypeMneumonic() {
+  public String getTypeMnemonic() {
     return typeStrArr[typeOrd];
     return typeStrArr[typeOrd];
   }
   }
 
 
@@ -136,7 +137,7 @@ public class TypeDesc {
     return typeArr; 
     return typeArr; 
   }
   }
 
 
-  public static final void InitTypes() {
+  public static void InitTypes() {
     for (int i=0; i < specT; i++) {
     for (int i=0; i < specT; i++) {
       basicTypes[i] = new TypeDesc(i);
       basicTypes[i] = new TypeDesc(i);
       basicTypes[i].name = "BasicType" + i;
       basicTypes[i].name = "BasicType" + i;
@@ -149,6 +150,5 @@ public class TypeDesc {
     System.err.println("TRYING TO WRITE A TYPEDESC! with ord " + typeOrd);
     System.err.println("TRYING TO WRITE A TYPEDESC! with ord " + typeOrd);
     System.exit(1);
     System.exit(1);
   }
   }
-
 }
 }
 
 

+ 82 - 20
gpcp/Browse.cp

@@ -579,29 +579,91 @@ MODULE Browse;
 (* ========		Symbol File Reader		======= *)
 (* ========		Symbol File Reader		======= *)
 (* ============================================================ *)
 (* ============================================================ *)
 
 
+  PROCEDURE DiagnoseSymbol();
+    VAR arg : ARRAY 24 OF CHAR;
+  BEGIN
+    CASE sSym OF
+    | ORD('H') : Console.WriteString("MODULE "); RETURN;
+    | ORD('0') : Console.WriteString("FALSE");
+    | ORD('1') : Console.WriteString("TRUE");
+    | ORD('I') : Console.WriteString("IMPORT "); RETURN;
+    | ORD('C') : Console.WriteString("CONST");
+    | ORD('T') : Console.WriteString("TYPE "); RETURN;
+    | ORD('P') : Console.WriteString("PROCEDURE "); RETURN;
+    | ORD('M') : Console.WriteString("MethodSymbol");
+    | ORD('V') : Console.WriteString("VAR "); RETURN;
+    | ORD('p') : Console.WriteString("ParamSymbol");
+    | ORD('&') : Console.WriteString("StartSymbol");
+    | ORD('!') : Console.WriteString("CloseSymbol");
+    | ORD('{') : Console.WriteString("StartRecord");
+    | ORD('}') : Console.WriteString("EndRecord");
+    | ORD('(') : Console.WriteString("StartFormals");
+    | ORD('@') : Console.WriteString("FROM "); RETURN;
+    | ORD(')') : Console.WriteString("EndFormals");
+    | ORD('[') : Console.WriteString("StartArray");
+    | ORD(']') : Console.WriteString("EndArray");
+    | ORD('%') : Console.WriteString("ProcType");
+    | ORD('^') : Console.WriteString("POINTER");
+    | ORD('e') : Console.WriteString("EnumType");
+    | ORD('~') : Console.WriteString("InterfaceType");
+    | ORD('v') : Console.WriteString("EventType");
+    | ORD('*') : Console.WriteString("VectorType");
+    | ORD('\') : Console.WriteString("BYTE "); Console.WriteInt(iAtt,1);
+    | ORD('c') : Console.WriteString("CHAR "); Console.Write(cAtt);
+    | ORD('S') : Console.WriteString("SetSymbol 0x"); Console.WriteHex(iAtt,1);
+    | ORD('K') : Console.WriteString("KeySymbol 0x"); Console.WriteHex(iAtt,1);
+    | ORD('t') : Console.WriteString("TypeDef t#"); Console.WriteInt(iAtt,1);
+    | ORD('+') : Console.WriteString("BaseType t#"); Console.WriteInt(iAtt,1);
+    | ORD('R') : Console.WriteString("RETURN t#"); Console.WriteInt(iAtt,1);
+    | ORD('#') :
+	    RTS.LongToStr(lAtt, arg); 
+	    Console.WriteString("Number "); 
+		Console.WriteString(arg$);
+    | ORD('$') : 
+        Console.WriteString("NameSymbol #");
+        Console.WriteInt(iAtt,1); 
+        Console.Write(' ');
+        Console.WriteString(sAtt);
+    | ORD('s') : 
+        Console.WriteString("String '");
+        Console.WriteString(sAtt);
+        Console.Write("'");
+    | ORD('r') : 
+        RTS.RealToStrInvar(rAtt, arg);
+        Console.WriteString("Real "); 
+        Console.WriteString(arg$);
+    ELSE 
+	    Console.WriteString("Bad Symbol ");
+		Console.WriteInt(sSym, 1);
+	    Console.WriteString(" in File");
+    END;
+    Console.WriteLn;
+  END DiagnoseSymbol;
+
   PROCEDURE GetSym();
   PROCEDURE GetSym();
   BEGIN
   BEGIN
     sSym := read();
     sSym := read();
     CASE sSym OF
     CASE sSym OF
     | namSy : 
     | namSy : 
-	iAtt := read(); 
+        iAtt := read(); 
         sAtt := readUTF();
         sAtt := readUTF();
     | strSy : 
     | strSy : 
         sAtt := readUTF();
         sAtt := readUTF();
     | retSy, fromS, tDefS, basSy :
     | retSy, fromS, tDefS, basSy :
-	iAtt := readOrd();
+        iAtt := readOrd();
     | bytSy :
     | bytSy :
-	iAtt := read();
+        iAtt := read();
     | keySy, setSy :
     | keySy, setSy :
-	iAtt := readInt();
+        iAtt := readInt();
     | numSy :
     | numSy :
-	lAtt := readLong();
+        lAtt := readLong();
     | fltSy :
     | fltSy :
-	rAtt := readReal();
+        rAtt := readReal();
     | chrSy :
     | chrSy :
-	cAtt := readChar();
+        cAtt := readChar();
     ELSE (* nothing to do *)
     ELSE (* nothing to do *)
     END;
     END;
+    (* DiagnoseSymbol(); *)
   END GetSym;
   END GetSym;
 
 
 (* ======================================= *)
 (* ======================================= *)
@@ -650,8 +712,8 @@ MODULE Browse;
   //	-- optional phrase is return type for proper procedures
   //	-- optional phrase is return type for proper procedures
   *)
   *)
     VAR 
     VAR 
- 	par : Par;
-	byte : INTEGER;
+         par : Par;
+        byte : INTEGER;
   BEGIN
   BEGIN
     p.noModes := TRUE;
     p.noModes := TRUE;
     IF sSym = retSy THEN 
     IF sSym = retSy THEN 
@@ -917,10 +979,10 @@ MODULE Browse;
       *  The fromS symbol appears if the type is imported.
       *  The fromS symbol appears if the type is imported.
       *)
       *)
       IF sSym = fromS THEN
       IF sSym = fromS THEN
-	modOrd := iAtt;
-	GetSym();
+        modOrd := iAtt;
+        GetSym();
         impName := sAtt;
         impName := sAtt;
-	ReadPast(namSy);
+        ReadPast(namSy);
       END;
       END;
      (* Get type info. *)
      (* Get type info. *)
       CASE sSym OF 
       CASE sSym OF 
@@ -932,7 +994,7 @@ MODULE Browse;
       | pTpSy : typ := procedureType();
       | pTpSy : typ := procedureType();
       | eTpSy : typ := enumType();
       | eTpSy : typ := enumType();
       ELSE 
       ELSE 
-	NEW(namedType);
+        NEW(namedType);
 	typ := namedType;
 	typ := namedType;
       END;
       END;
       IF typ # NIL THEN
       IF typ # NIL THEN
@@ -993,14 +1055,14 @@ MODULE Browse;
         IF (ch0 = "@") OR (ch0 = "$") THEN typ.declarer := NIL END;
         IF (ch0 = "@") OR (ch0 = "$") THEN typ.declarer := NIL END;
       END;
       END;
       IF typ IS Record THEN 
       IF typ IS Record THEN 
-	r := typ(Record);
-	FOR j := 0 TO r.intrFaces.tide - 1 DO
-	  k := r.intrFaces.list[j](TypeDesc).typeNum;
-	  r.intrFaces.list[j](TypeDesc).type := typeList[k];
-	END;
-	IF typ.declarer = NIL THEN (* anon record *)
+        r := typ(Record);
+        FOR j := 0 TO r.intrFaces.tide - 1 DO
+          k := r.intrFaces.list[j](TypeDesc).typeNum;
+          r.intrFaces.list[j](TypeDesc).type := typeList[k];
+        END;
+        IF typ.declarer = NIL THEN (* anon record *)
           typ(Record).isAnonRec := TRUE;
           typ(Record).isAnonRec := TRUE;
-	END;
+        END;
       ELSIF (typ IS Pointer) & (typ(Pointer).baseType IS Record) THEN
       ELSIF (typ IS Pointer) & (typ(Pointer).baseType IS Record) THEN
         IF (typ.declarer = NIL) & (typ.importedFrom = NIL) THEN 
         IF (typ.declarer = NIL) & (typ.importedFrom = NIL) THEN 
           typ(Pointer).isAnonPointer := TRUE; 
           typ(Pointer).isAnonPointer := TRUE; 

+ 7 - 1
gpcp/CompState.cp

@@ -101,7 +101,8 @@ MODULE CompState;
     hashSize-  : INTEGER;
     hashSize-  : INTEGER;
 
 
     thisMod-   : IdDesc.BlkId;           (* Desc. of compiling module.  *)
     thisMod-   : IdDesc.BlkId;           (* Desc. of compiling module.  *)
-    sysMod-    : IdDesc.BlkId;           (* Desc. of compiling module.  *)
+    sysMod-    : IdDesc.BlkId;           (* Desc. of SYSTEM module.     *)
+    sysLib-    : IdDesc.BlkId;           (* mscorlib OR java.lang BlkId *)
 
 
     impSeq*    : Symbols.ScpSeq;
     impSeq*    : Symbols.ScpSeq;
 
 
@@ -127,6 +128,11 @@ MODULE CompState;
 (*				Utilities				*)
 (*				Utilities				*)
 (* ==================================================================== *)
 (* ==================================================================== *)
 
 
+    PROCEDURE SetSysLib*(lib : IdDesc.BlkId);
+	BEGIN
+	  sysLib := lib;
+	END SetSysLib;
+
     PROCEDURE SetQuiet*(); 
     PROCEDURE SetQuiet*(); 
     BEGIN
     BEGIN
       CPascalErrors.nowarn := TRUE;
       CPascalErrors.nowarn := TRUE;

+ 2 - 1
gpcp/GPCPcopyright.cp

@@ -43,7 +43,8 @@ MODULE GPCPcopyright;
      (* VERSION    = "1.3.8 of 18 November 2007"; *)
      (* VERSION    = "1.3.8 of 18 November 2007"; *)
      (* VERSION    = "1.3.9 of 15 January 2008"; *)
      (* VERSION    = "1.3.9 of 15 January 2008"; *)
      (* VERSION    = "1.3.10 of 15 November 2010"; *)
      (* VERSION    = "1.3.10 of 15 November 2010"; *)
-        VERSION    = "1.3.12 of 17 November 2011"; 
+     (* VERSION    = "1.3.12 of 17 November 2011"; *)
+        VERSION    = "1.3.13 of 24 July 2012"; 
 	verStr*    = " version " + VERSION;
 	verStr*    = " version " + VERSION;
 
 
   CONST	prefix     = "#gpcp: ";
   CONST	prefix     = "#gpcp: ";

+ 1 - 0
gpcp/JavaMaker.cp

@@ -207,6 +207,7 @@ MODULE JavaMaker;
     *  Create import descriptor for java.lang
     *  Create import descriptor for java.lang
     *)
     *)
     Builtin.MkDummyImport("java_lang", "java.lang", blk);
     Builtin.MkDummyImport("java_lang", "java.lang", blk);
+	CompState.SetSysLib(blk);
    (*
    (*
     *  Create various classes.
     *  Create various classes.
     *)
     *)

+ 1 - 0
gpcp/MsilMaker.cp

@@ -135,6 +135,7 @@ MODULE MsilMaker;
     *  Create import descriptor for [mscorlib]System
     *  Create import descriptor for [mscorlib]System
     *)
     *)
     Builtin.MkDummyImport("mscorlib_System", "[mscorlib]System", blk);
     Builtin.MkDummyImport("mscorlib_System", "[mscorlib]System", blk);
+	CSt.SetSysLib(blk);
    (*
    (*
     *  Create various classes.
     *  Create various classes.
     *)
     *)

+ 6 - 5
gpcp/NewSymFileRW.cp

@@ -1486,9 +1486,9 @@ MODULE NewSymFileRW;
       f.GetSym();
       f.GetSym();
     END;
     END;
    (* 
    (* 
-    *  Do not override extrnNm values set
-    *  by *Maker.Init for Native* types.
-    *)
+	*  Do not override extrnNm values set
+	*  by *Maker.Init for Native* types.
+	*)
     IF (f.impS.scopeNm # NIL) & (rslt.extrnNm = NIL) THEN
     IF (f.impS.scopeNm # NIL) & (rslt.extrnNm = NIL) THEN
       rslt.extrnNm := f.impS.scopeNm; 
       rslt.extrnNm := f.impS.scopeNm; 
     END;
     END;
@@ -1498,10 +1498,10 @@ MODULE NewSymFileRW;
       *  Do not override baseTp values set
       *  Do not override baseTp values set
       *  by *Maker.Init for Native* types.
       *  by *Maker.Init for Native* types.
       *)
       *)
-      IF rslt.baseTp = NIL THEN
+	  IF rslt.baseTp = NIL THEN
         rslt.baseTp := f.typeOf(f.iAtt);
         rslt.baseTp := f.typeOf(f.iAtt);
         IF f.iAtt # Ty.anyRec THEN INCL(rslt.xAttr, D.clsTp) END;
         IF f.iAtt # Ty.anyRec THEN INCL(rslt.xAttr, D.clsTp) END;
-      END;
+	  END;
       f.GetSym();
       f.GetSym();
     END;
     END;
     IF f.sSym = iFcSy THEN
     IF f.sSym = iFcSy THEN
@@ -2124,6 +2124,7 @@ MODULE NewSymFileRW;
         fScp : ImpResScope;
         fScp : ImpResScope;
         rAll : ResolveAll;
         rAll : ResolveAll;
   BEGIN
   BEGIN
+    D.AppendScope(imps, CSt.sysLib);
    (*
    (*
     *  The list of scopes has been constructed by
     *  The list of scopes has been constructed by
     *  the parser, while reading the import list.
     *  the parser, while reading the import list.

+ 1 - 1
gpcp/RTS.cp

@@ -21,7 +21,7 @@ SYSTEM MODULE RTS;
 
 
   TYPE  CharOpen*       = POINTER TO ARRAY OF CHAR;
   TYPE  CharOpen*       = POINTER TO ARRAY OF CHAR;
 
 
-  TYPE  NativeType*	   = POINTER TO ABSTRACT RECORD END;
+  TYPE  NativeType*	= POINTER TO ABSTRACT RECORD END;
         NativeObject*   = POINTER TO ABSTRACT RECORD END;  
         NativeObject*   = POINTER TO ABSTRACT RECORD END;  
         NativeString*   = POINTER TO RECORD END;
         NativeString*   = POINTER TO RECORD END;
         NativeException*= POINTER TO EXTENSIBLE RECORD END;
         NativeException*= POINTER TO EXTENSIBLE RECORD END;

+ 31 - 2
gpcp/Symbols.cp

@@ -57,7 +57,7 @@ MODULE Symbols;
 (* ============================================================ *)
 (* ============================================================ *)
 
 
   TYPE
   TYPE
-    Idnt*   = POINTER TO ABSTRACT RECORD
+    Idnt*   = POINTER TO ABSTRACT RECORD (RTS.NativeObject)
                 kind-  : INTEGER;   (* tag for unions *)
                 kind-  : INTEGER;   (* tag for unions *)
                 token* : S.Token;   (* scanner token  *)
                 token* : S.Token;   (* scanner token  *)
                 type*  : Type;      (* typ-desc | NIL *)
                 type*  : Type;      (* typ-desc | NIL *)
@@ -236,7 +236,36 @@ MODULE Symbols;
   BEGIN
   BEGIN
     t.namStr := MKSTR(NameHash.charOpenOfHash(hash)^);
     t.namStr := MKSTR(NameHash.charOpenOfHash(hash)^);
   END SetNameFromHash;
   END SetNameFromHash;
-  
+
+(* ============================================================ *)
+(*  This diagnostic method is placed here to use when GPCP-CLR  *)
+(*  itself is being debugged. If ToString is present then       *)
+(*  > gpcp /target=jvm Symbol.cp fails with error 105 :-        *)
+(*  "This method is not a redefinition, you must use NEW"       *)
+(* ============================================================ *
+  PROCEDURE (t : Idnt)ToString*() : RTS.NativeString;
+  BEGIN
+    IF t.namStr # NIL THEN RETURN t.namStr;
+	ELSE RETURN MKSTR(NameHash.charOpenOfHash(t.hash)^);
+	END;
+  END ToString;
+ * ============================================================ *)  
+(* ============================================================ *)
+(*  This diagnostic method is placed here to use when GPCP-JVM  *)
+(*  itself is being debugged. If toString is present then       *)
+(*  > gpcp /target=net Symbol.cp fails with error 105 :-        *)
+(*  "This method is not a redefinition, you must use NEW"       *)
+(* ============================================================ *
+  PROCEDURE (t : Idnt)toString*() : RTS.NativeString;
+  BEGIN
+    IF t.namStr # NIL THEN RETURN t.namStr;
+	ELSE RETURN MKSTR(NameHash.charOpenOfHash(t.hash)^);
+	END;
+  END toString;
+ * ============================================================ *) 
+(* ============================================================ *)
+
+ 
 (* ============================================================ *)
 (* ============================================================ *)
 (*             Base Class text-span method                      *)
 (*             Base Class text-span method                      *)
 (* ============================================================ *)
 (* ============================================================ *)

+ 12 - 2
gpcp/TypeDesc.cp

@@ -22,7 +22,8 @@ MODULE TypeDesc;
         Sy  := Symbols,
         Sy  := Symbols,
         Lv  := LitValue,
         Lv  := LitValue,
         S   := CPascalS,
         S   := CPascalS,
-        H   := DiagHelper;
+        H   := DiagHelper,
+		RTS;
 
 
 (* ============================================================ *)
 (* ============================================================ *)
 
 
@@ -575,7 +576,7 @@ MODULE TypeDesc;
     VAR ext : Record;
     VAR ext : Record;
         i   : INTEGER;
         i   : INTEGER;
   BEGIN
   BEGIN
-    e := e.boundRecTp(); 
+    IF e # NIL THEN e := e.boundRecTp() END;
 
 
     IF (e = NIL) OR (e.kind # recTp) THEN RETURN FALSE;
     IF (e = NIL) OR (e.kind # recTp) THEN RETURN FALSE;
     ELSIF e = b THEN RETURN TRUE;               (* Trivially! *)
     ELSIF e = b THEN RETURN TRUE;               (* Trivially! *)
@@ -1613,6 +1614,7 @@ MODULE TypeDesc;
         intTp : Sy.Type;
         intTp : Sy.Type;
         recId : Sy.Idnt;
         recId : Sy.Idnt;
         dBlk  : Id.BlkId;
         dBlk  : Id.BlkId;
+		ntvNm : RTS.NativeString;
         e137,e145 : BOOLEAN;
         e137,e145 : BOOLEAN;
    (* ----------------------------------------- *)
    (* ----------------------------------------- *)
     PROCEDURE refInNET(t : Sy.Type) : BOOLEAN;
     PROCEDURE refInNET(t : Sy.Type) : BOOLEAN;
@@ -1639,6 +1641,14 @@ MODULE TypeDesc;
    (* ----------------------------------------- *)
    (* ----------------------------------------- *)
   BEGIN (* resolve *)
   BEGIN (* resolve *)
     IF i.depth = initialMark THEN
     IF i.depth = initialMark THEN
+
+	  IF CSt.verbose THEN
+  	    IF i.idnt # NIL THEN
+	      ntvNm := Sy.getName.NtStr(i.idnt);
+        ELSIF (i.bindTp # NIL) & (i.bindTp.idnt # NIL) THEN
+	      ntvNm := Sy.getName.NtStr(i.bindTp.idnt);
+        END;
+      END;
       i.depth := d;
       i.depth := d;
       e145 := FALSE;
       e145 := FALSE;
       e137 := FALSE;
       e137 := FALSE;