From f19fd024e0b0d8e59589425babe5ec4656ebb867 Mon Sep 17 00:00:00 2001 From: Gilles Dubochet Date: Thu, 24 Sep 2009 14:32:08 +0000 Subject: Removed dead code, some useless Id tags removed. --- docs/TODO | 1 - docs/development/jvm.txt | 2 - docs/examples/jolib/Ref.scala | 1 - docs/examples/jolib/parallelOr.scala | 1 - .../epfl/lamp/compiler/msil/emit/EmitUtils.scala2 | 55 ---- .../lamp/compiler/msil/emit/EmptyVisitor.scala2 | 83 ------ .../epfl/lamp/compiler/msil/util/VJSAssembly.java2 | 294 --------------------- 7 files changed, 437 deletions(-) delete mode 100644 src/msil/ch/epfl/lamp/compiler/msil/emit/EmitUtils.scala2 delete mode 100644 src/msil/ch/epfl/lamp/compiler/msil/emit/EmptyVisitor.scala2 delete mode 100644 src/msil/ch/epfl/lamp/compiler/msil/util/VJSAssembly.java2 diff --git a/docs/TODO b/docs/TODO index cd36f7c518..094202f53e 100644 --- a/docs/TODO +++ b/docs/TODO @@ -1,7 +1,6 @@ //###########################################################-*-outline-*-#### // TODO list //############################################################################ -// $Id$ * Histories diff --git a/docs/development/jvm.txt b/docs/development/jvm.txt index 2078505799..2f8085a972 100644 --- a/docs/development/jvm.txt +++ b/docs/development/jvm.txt @@ -122,5 +122,3 @@ Garbage Collection [gc04] Garbage Collector Ergonomics http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html - -$Id$ diff --git a/docs/examples/jolib/Ref.scala b/docs/examples/jolib/Ref.scala index 73cc167307..39c0123f09 100644 --- a/docs/examples/jolib/Ref.scala +++ b/docs/examples/jolib/Ref.scala @@ -4,7 +4,6 @@ ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** -** $Id$ \* */ package examples.jolib; diff --git a/docs/examples/jolib/parallelOr.scala b/docs/examples/jolib/parallelOr.scala index bff4dcd87a..4c4a852c4a 100644 --- a/docs/examples/jolib/parallelOr.scala +++ b/docs/examples/jolib/parallelOr.scala @@ -4,7 +4,6 @@ ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** -** $Id$ \* */ package examples.jolib; diff --git a/src/msil/ch/epfl/lamp/compiler/msil/emit/EmitUtils.scala2 b/src/msil/ch/epfl/lamp/compiler/msil/emit/EmitUtils.scala2 deleted file mode 100644 index 71ccf9ed93..0000000000 --- a/src/msil/ch/epfl/lamp/compiler/msil/emit/EmitUtils.scala2 +++ /dev/null @@ -1,55 +0,0 @@ -/* - * System.Reflection.Emit-like API for writing .NET assemblies to MSIL - */ - -// $Id$ - -package ch.epfl.lamp.compiler.msil.emit - -import ch.epfl.lamp.compiler.msil.* - -/** - * This class holds some usefull methods or fields which are not in the - * Reflection or Reflection.Emit Namespace (see .NET documentation) - * - * @author Nikolay Mihaylov - * @version 1.0 - */ -object EmitUtils { - - //########################################################################## - - /** - * Defines a dynamic assembly with the specified name. - */ - def DefineDynamicAssembly(name: AssemblyName): AssemblyBuilder = new AssemblyBuilder(name) - - /** - * Helper functions that adds a space only after non-empty string - */ - def append(sb: StringBuffer, str: String): StringBuffer = { - if (sb.length() > 0) { - var last: Char = sb.charAt(sb.length() - 1) - if (last != ' ' && last != '\t' || last != '\n') - sb.append(" ") - } - //return sb.append(str) - return trim(sb.append(str)) - } - - /** - * Helper functions that adds a space only after non-empty string - */ - def append(str: StringBuffer, o: Object): String = append(str, "" + o) - - /** - * Helper function that removes the trailing spaces - */ - def trim(sb: StringBuffer): StringBuffer = { - while ((sb.length() > 0) && (sb.charAt(sb.length() - 1) == ' ')) - sb.deleteCharAt(sb.length() - 1) - return sb - } - - //########################################################################## -} diff --git a/src/msil/ch/epfl/lamp/compiler/msil/emit/EmptyVisitor.scala2 b/src/msil/ch/epfl/lamp/compiler/msil/emit/EmptyVisitor.scala2 deleted file mode 100644 index 8af4d67aef..0000000000 --- a/src/msil/ch/epfl/lamp/compiler/msil/emit/EmptyVisitor.scala2 +++ /dev/null @@ -1,83 +0,0 @@ -/* - * System.Reflection.Emit-like API for writing .NET assemblies to MSIL - */ - -// $Id$ - -package ch.epfl.lamp.compiler.msil.emit - -/** - * Supplies empty method bodies to be overridden by subclasses. - */ -class EmptyVisitor extends Visitor { - - //########################################################################## - - /** - * Visit an AssemblyBuilder - */ - def caseAssemblyBuilder(assemblyBuilder: AssemblyBuilder) { - } - - /** - * Visit a ModuleBuilder - */ - def caseModuleBuilder(moduleBuilder: ModuleBuilder) { - } - - /** - * Visit a TypeBuilder - */ - def caseTypeBuilder(typeBuilder: TypeBuilder) { - } - - /** - * Visit a FieldBuilder - */ - def caseFieldBuilder(fieldBuilder: FieldBuilder) { - } - - /** - * Visit a ConstructorBuilder - */ - def caseConstructorBuilder(constructorBuilder: ConstructorBuilder) { - } - - /** - * Visit a MethodBuilder - */ - def caseMethodBuilder(methodBuilder: MethodBuilder) { - } - - /** - * Visit a ParameterBuilder - */ - def caseParameterBuilder(parameterBuilder: ParameterBuilder) { - } - - /** - * Visit an ILGenerator - */ - def caseILGenerator(iLGenerator: ILGenerator) { - } - - /** - * visit an OpCode - */ - def caseOpCode(opCode: OpCode) { - } - - /** - * Visit a Label - */ - def caseLabel(label: Label) { - } - - /** - * Visit a LocalBuilder - */ - def caseLocalBuilder(localBuilder: LocalBuilder) { - } - - //########################################################################## -} diff --git a/src/msil/ch/epfl/lamp/compiler/msil/util/VJSAssembly.java2 b/src/msil/ch/epfl/lamp/compiler/msil/util/VJSAssembly.java2 deleted file mode 100644 index 54d229e56b..0000000000 --- a/src/msil/ch/epfl/lamp/compiler/msil/util/VJSAssembly.java2 +++ /dev/null @@ -1,294 +0,0 @@ -// $Id$ - -package ch.epfl.lamp.compiler.msil.util; - -import java.lang.reflect.*; -import java.util.HashMap; - -import ch.epfl.lamp.compiler.msil.*; - -/** - * Represents the Microsoft vjslib.dll assembly. - */ -public final class VJSAssembly extends Assembly { - - private VJSAssembly(AssemblyName an) { super(an); } - - protected void loadModules() { - VJSLIB_DLL.init(); - addModule("vjslib.dll", VJSLIB_DLL); - } - - public static final Assembly VJSLIB; - private static final VJSModule VJSLIB_DLL; - - static { - AssemblyName an = new AssemblyName(); - an.Name = "vjslib"; - an.Version = new Version(1, 0, 3300, 0); - an.SetPublicKeyToken(new byte [] {(byte)0xB0, 0x3F, 0x5F, 0x7F, - 0x11, (byte)0xD5, 0x0A, 0x3A}); - VJSLIB = new VJSAssembly(an); - VJSLIB_DLL = new VJSModule(VJSLIB); - } - - - //########################################################################## - - private static final class VJSModule extends Module { - - VJSModule(Assembly vjslib) { - super("vjslib", "vjslib.dll", "vjslib.dll", vjslib); - } - - void init() { - addType("void", Type.GetType("System.Void")); - addType("boolean", Type.GetType("System.Boolean")); - addType("char", Type.GetType("System.Char")); - addType("float", Type.GetType("System.Single")); - addType("double", Type.GetType("System.Double")); - addType("byte", Type.GetType("System.SByte")); - addType("short", Type.GetType("System.Int16")); - addType("int", Type.GetType("System.Int32")); - addType("long", Type.GetType("System.Int64")); - addType("java.lang.Object", Type.GetType("System.Object")); - addType("java.lang.String", Type.GetType("System.String")); - } - - public Type[] GetTypes() { - throw new RuntimeException("Operation not supported!"); - } - - public Type GetType(String name) { - // look it up in the typesMap - Type type = super.GetType(name); - if (type != null) - return type; - Class clazz = null; - try { - clazz = Class.forName(name); - } catch (ClassNotFoundException e) {} - return getType(clazz); - } - - Type getType(Class clazz) { - if (clazz == null) return null; - Type type = null; - if (clazz.isArray()) { - Type elemType = getType(clazz.getComponentType()); - type = super.GetType(elemType.FullName + "[]"); - if (type != null) - return type; - type = Type.mkArray(elemType, 1); - } else { - type = super.GetType(clazz.getName()); - if (type != null) - return type; - type = new JavaType(clazz); - } - return addType(type); - } - - Type[] getTypes(Class [] classes) { - if (classes.length == 0) return Type.EmptyTypes; - Type [] types = new Type[classes.length]; - for (int i = 0; i < classes.length; i++) - types[i] = getType(classes[i]); - return types; - } - - } // class VJSModule - - //########################################################################## - - private static final class JavaType extends Type { - - //###################################################################### - - private final Class clazz; - - JavaType(Class clazz, int attrs, String name, - Type baseType, Type[] interfaces, Type declType) - { - super(VJSLIB_DLL, attrs, name, baseType, interfaces, declType, 0); - this.clazz = clazz; - } - - JavaType(Class clazz, String name) { - super(VJSLIB_DLL, - translateTypeAttrs(clazz.getModifiers()), - name, - VJSLIB_DLL.getType(clazz.getSuperclass()), - null, - VJSLIB_DLL.getType(clazz.getDeclaringClass()), - 0); - this.clazz = clazz; - } - - JavaType(Class clazz) { - this(clazz, clazz.getName()); - } - - //###################################################################### - // lazy JavaType member loaders - - protected void loadInterfaces() { - this.interfaces = VJSLIB_DLL.getTypes(clazz.getInterfaces()); - } - - protected void loadNestedTypes() { - Class [] nested = clazz.getDeclaredClasses(); - this.nestedTypes = new Type[nested.length]; - for (int i = 0; i < nested.length; i++) { - String name = nested[i].getName(); - name = name.substring(name.lastIndexOf('$') + 1); - nestedTypes[i] = new JavaType(nested[i], name); - } - } - - protected void loadFields() { - Field [] jfields = clazz.getDeclaredFields(); - FieldInfo[] fields = new FieldInfo[jfields.length]; - for (int i = 0; i < jfields.length; i++) - fields[i] = new JavaFieldInfo(jfields[i]); - this.fields = fields; - } - - protected void loadMethods() { - Constructor[] jconstrs = clazz.getDeclaredConstructors(); - this.constructors = new ConstructorInfo[jconstrs.length]; - for (int i = 0; i < jconstrs.length; i++) - this.constructors[i] = new JavaConstructorInfo(jconstrs[i]); - - Method[] jmethods = clazz.getDeclaredMethods(); - this.methods = new MethodInfo[jmethods.length]; - for (int i = 0; i < jmethods.length; i++) - this.methods[i] = JavaMethodInfo.getMethod(jmethods[i]); - } - - //###################################################################### - // type resolution methods - - - static int translateTypeAttrs(int mods) { - int attr = 0; - - if (Modifier.isInterface(mods)) - attr |= TypeAttributes.Interface; - else - attr |= TypeAttributes.Class; - - if (Modifier.isAbstract(mods)) - attr |= TypeAttributes.Abstract; - - if (Modifier.isFinal(mods)) - attr |= TypeAttributes.Sealed; - - if (Modifier.isPublic(mods)) - attr |= TypeAttributes.Public; - else - attr |= TypeAttributes.NotPublic; - - return attr; - } - - //###################################################################### - } // class JavaType - - //########################################################################## - - private static final class JavaFieldInfo extends FieldInfo { - JavaFieldInfo(Field field) { - super(field.getName(), - VJSLIB_DLL.getType(field.getDeclaringClass()), - translateFieldAttrs(field.getModifiers()), - VJSLIB_DLL.getType(field.getType())); - } - - //translate java modifiers into corresponding .NET Field attributes - static short translateFieldAttrs(int mods) { - short attr = 0; - - if (Modifier.isFinal(mods)) - attr |= FieldAttributes.InitOnly; - - if (Modifier.isPublic(mods)) - attr |= FieldAttributes.Public; - else if (Modifier.isProtected(mods)) - attr |= FieldAttributes.FamORAssem; - else if (Modifier.isPrivate(mods)) - attr |= FieldAttributes.Private; - - if (Modifier.isStatic(mods)) - attr |= FieldAttributes.Static; - - return attr; - } - - } // class JavaFieldInfo - - //########################################################################## - - private static final class JavaConstructorInfo extends ConstructorInfo { - JavaConstructorInfo(Constructor constr) { - super(VJSLIB_DLL.getType(constr.getDeclaringClass()), - JavaMethodInfo.translateMethodAttrs(constr.getModifiers()), - VJSLIB_DLL.getTypes(constr.getParameterTypes())); - } - } - - //########################################################################## - - private static final class JavaMethodInfo extends MethodInfo { - - JavaMethodInfo(String name, Type declType, int attrs, - Type returnType, Type[] paramTypes) { - super(name, declType, declType, attrs, returnType, paramTypes); - } - - static MethodInfo getMethod(Method method) { - String name = method.getName(); - if (name.equals("toString")) - name = "ToString"; - else if(name.equals("equals")) - name = "Equals"; - else if (name.equals("hashCode")) - name = "GetHashCode"; - return new JavaMethodInfo - (name, VJSLIB_DLL.getType(method.getDeclaringClass()), - translateMethodAttrs(method.getModifiers()), - VJSLIB_DLL.getType(method.getReturnType()), - VJSLIB_DLL.getTypes(method.getParameterTypes())); - } - - static short translateMethodAttrs(int mods) { - short attr = 0; - - if (Modifier.isAbstract(mods)) - attr |= MethodAttributes.Abstract; - - if (Modifier.isFinal(mods)) - attr |= MethodAttributes.Final; - - if (Modifier.isPublic(mods)) - attr |= MethodAttributes.Public; - else if (Modifier.isProtected(mods)) - attr |= MethodAttributes.FamORAssem; - else if (Modifier.isPrivate(mods)) - attr |= MethodAttributes.Private; - - if (Modifier.isStatic(mods)) - attr |= MethodAttributes.Static; - else - attr |= MethodAttributes.Virtual; - - //if (Modifier.isSynchronized(mods)) - // attr |= MethodAttributes.Synchronized; - - return attr; - } - } // class JavaMethodInfo - - //########################################################################## - -} // class VJSAssembly -- cgit v1.2.3