nice-commit Mailing List for The Nice Programming Language (Page 59)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bo...@us...> - 2004-02-11 13:20:36
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11351/src/bossa/syntax Modified Files: InlinedMethod.java Log Message: Better print wrapped exceptions. Index: InlinedMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/InlinedMethod.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** InlinedMethod.java 28 Nov 2003 17:40:45 -0000 1.16 --- InlinedMethod.java 11 Feb 2004 13:16:26 -0000 1.17 *************** *** 85,91 **** } catch(InvocationTargetException e){ User.error(inlineProcedure, "Inlined method " + inlineProcedure + ! ": " + e.getMessage()); } catch(IllegalAccessException e){ --- 85,92 ---- } catch(InvocationTargetException e){ + Throwable realEx = e.getTargetException(); User.error(inlineProcedure, "Inlined method " + inlineProcedure + ! ": " + realEx); } catch(IllegalAccessException e){ |
From: <bo...@us...> - 2004-02-11 12:50:48
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5377/src/nice/tools/code Modified Files: Types.java TupleType.java SpecialArray.java LiteralArrayProc.java Log Message: Use more typing information from the context when deciding what bytecode types to use for literal arrays and tuples, especially when they are nested inside other literal arrays or tuples. This allows to generate more efficient code, and fixes several runtime errors (fixes #761629 and #892625). Index: Types.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Types.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** Types.java 3 Dec 2003 21:50:41 -0000 1.54 --- Types.java 11 Feb 2004 12:46:39 -0000 1.55 *************** *** 260,263 **** --- 260,290 ---- } + public static Type lowestUpperBound(Expression[] exps) + { + if (exps.length == 0) + return Type.pointer_type; + + // Start with the minimal type. + Type res = Type.neverReturnsType; + + for (int i = 0; i < exps.length; i++) + { + res = Type.lowestCommonSuperType(res, exps[i].getType()); + + if (res == null) + return Type.pointer_type; + } + + return res; + } + + public static Type componentType(ArrayType type, int rank) + { + if (type instanceof TupleType) + return ((TupleType) type).componentTypes[rank]; + + return type.getComponentType(); + } + /**************************************************************** * Converting a bytecode type (coming from reflection for instance) *************** *** 700,703 **** --- 727,756 ---- } + /** @return the <code>rank</code>th type parameter of this type, or null. */ + public static Monotype getTypeParameter(Polytype type, int rank) + { + // This can only help + type.simplify(); + + return getTypeParameter(type.getMonotype(), rank); + } + + /** @return the <code>rank</code>th type parameter of this type, or null. */ + public static Monotype getTypeParameter(Monotype type, int rank) + { + // get rid of the nullness part + type = nice.tools.code.Types.rawType(type); + + if (! (type instanceof MonotypeConstructor)) + return null; + + Monotype[] parameters = ((MonotypeConstructor) type).getTP(); + + if (parameters.length <= rank) + return null; + else + return parameters[rank]; + } + /** Transforms \forall T:K.U into \forall T:K.sure<U> Index: TupleType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/TupleType.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TupleType.java 25 Nov 2003 19:22:58 -0000 1.2 --- TupleType.java 11 Feb 2004 12:46:39 -0000 1.3 *************** *** 37,40 **** --- 37,46 ---- public Type[] componentTypes; + public String toString() + { + return "tuple[" + getComponentType() + "](" + + bossa.util.Util.map("", ",", ")", componentTypes); + } + public static gnu.expr.Expression createExp (Type arrayType, Type[] componentTypes, *************** *** 43,47 **** return new gnu.expr.ApplyExp (new nice.tools.code.LiteralArrayProc ! (new TupleType(arrayType, componentTypes), components.length), components); } --- 49,53 ---- return new gnu.expr.ApplyExp (new nice.tools.code.LiteralArrayProc ! (new TupleType(arrayType, componentTypes), components.length, false), components); } Index: SpecialArray.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/SpecialArray.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SpecialArray.java 28 Jan 2004 13:10:11 -0000 1.16 --- SpecialArray.java 11 Feb 2004 12:46:39 -0000 1.17 *************** *** 264,267 **** --- 264,272 ---- public void emitCoerceToObject (CodeAttr code) { + emitCoerceToCollection(code); + } + + public static void emitCoerceToCollection (CodeAttr code) + { code.emitInvokeStatic(makeMethod); } Index: LiteralArrayProc.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/LiteralArrayProc.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LiteralArrayProc.java 10 Feb 2004 13:27:33 -0000 1.6 --- LiteralArrayProc.java 11 Feb 2004 12:46:39 -0000 1.7 *************** *** 31,42 **** of the procedure. */ ! public LiteralArrayProc(ArrayType arrayType, int nbElements) { this.arrayType = arrayType; this.nbElements = nbElements; } private ArrayType arrayType; private int nbElements; public void compile (ApplyExp exp, Compilation comp, Target target) --- 31,45 ---- of the procedure. */ ! public LiteralArrayProc(ArrayType arrayType, int nbElements, ! boolean wrapAsCollection) { this.arrayType = arrayType; this.nbElements = nbElements; + this.wrapAsCollection = wrapAsCollection; } private ArrayType arrayType; private int nbElements; + private boolean wrapAsCollection; public void compile (ApplyExp exp, Compilation comp, Target target) *************** *** 47,56 **** CodeAttr code = comp.getCode(); code.emitPushInt(nbElements); ! code.emitNewArray(arrayType.getComponentType()); // Set a special type, not the legacy array type. code.popType(); ! code.pushType(arrayType); --- 50,61 ---- CodeAttr code = comp.getCode(); + Type componentType = getComponentType(args); + code.emitPushInt(nbElements); ! code.emitNewArray(componentType); // Set a special type, not the legacy array type. code.popType(); ! code.pushType(SpecialTypes.array(componentType)); *************** *** 80,94 **** code.emitDup(); code.emitPushInt(i); ! args[i].compile(comp, arrayType.elements); ! code.emitArrayStore(arrayType.elements); } ! target.compileFromStack(comp, arrayType); } ! public Type getReturnType(Expression[] args) { ! return arrayType; } --- 85,133 ---- code.emitDup(); + // Get the specific type for this rank of the array (useful for tuples) + Type specificType = Types.componentType(arrayType, i); + // Only use it if it is more specific than the expected type. + // For instance don't use int if we store it in an Object[] anyway. + if (! specificType.isAssignableTo(componentType)) + specificType = componentType; + code.emitPushInt(i); ! args[i].compile(comp, specificType); ! code.emitArrayStore(componentType); } ! if (wrapAsCollection) ! SpecialArray.emitCoerceToCollection(code); ! else ! target.compileFromStack(comp, code.topType()); } ! ! private Type getComponentType (Expression[] args) ! { ! Type type = Types.lowestUpperBound(args); ! ! if (type.isSubtype(arrayType.getComponentType())) ! { ! // We could precise that type of the array, but this is not ! // necessary given the context, and it would even be bas for primitive ! // types (byte[] will need conversion if int[] is expected). ! // Just keep the original type. ! type = arrayType.getComponentType(); ! } ! ! if (type == Type.nullType) ! // All we know is that this array will contain only null, and will be ! // used generically. Let's make that Object. ! type = Type.pointer_type; ! ! return type; ! } ! public Type getReturnType(Expression[] args) { ! if (wrapAsCollection) ! return ClassType.make("java.util.List"); ! ! return SpecialTypes.array(getComponentType(args)); } |
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5377/src/bossa/syntax Modified Files: TupleExp.java PrimitiveType.java LiteralArrayExp.java Expression.java ClassDefinition.java CallExp.java Log Message: Use more typing information from the context when deciding what bytecode types to use for literal arrays and tuples, especially when they are nested inside other literal arrays or tuples. This allows to generate more efficient code, and fixes several runtime errors (fixes #761629 and #892625). Index: TupleExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TupleExp.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** TupleExp.java 24 Oct 2003 10:35:50 -0000 1.21 --- TupleExp.java 11 Feb 2004 12:46:39 -0000 1.22 *************** *** 70,82 **** expectedType.simplify(); ! Monotype m = expectedType.getMonotype(); ! // get rid of the nullness part ! m = Types.rawType((MonotypeConstructor) m); // Get the expected component types if (m instanceof TupleType) ! expectedComponents = ((TupleType) m).getComponents(); ! return this; } --- 70,92 ---- expectedType.simplify(); ! adjustToExpectedType(expectedType.getMonotype()); ! ! return this; ! } ! ! void adjustToExpectedType(Monotype expectedType) ! { ! Monotype m = Types.equivalent(expectedType); // Get the expected component types if (m instanceof TupleType) ! { ! expectedComponents = ((TupleType) m).getComponents(); ! // Do the same for the elements of the tuple, since they might be ! // tuples themselves, literal arrays, ... ! bossa.syntax.Expression.adjustToExpectedType ! (expressions, expectedComponents); ! } } *************** *** 122,126 **** return nice.tools.code.TupleType.createExp (Types.lowestCommonSupertype(expectedComponents), ! Types.javaType(components), bossa.syntax.Expression.compile(expressions)); } --- 132,136 ---- return nice.tools.code.TupleType.createExp (Types.lowestCommonSupertype(expectedComponents), ! Types.javaType(expectedComponents), bossa.syntax.Expression.compile(expressions)); } Index: PrimitiveType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/PrimitiveType.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PrimitiveType.java 8 Dec 2003 19:42:37 -0000 1.9 --- PrimitiveType.java 11 Feb 2004 12:46:39 -0000 1.10 *************** *** 188,191 **** --- 188,192 ---- static TypeConstructor typeTC; + static TypeConstructor collectionTC; static TypeConstructor throwableTC; static TypeConstructor throwableTC() *************** *** 193,197 **** return throwableTC; } ! private static Polytype throwableType; static Polytype throwableType() --- 194,198 ---- return throwableTC; } ! private static Polytype throwableType; static Polytype throwableType() Index: LiteralArrayExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/LiteralArrayExp.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** LiteralArrayExp.java 8 Dec 2003 19:42:37 -0000 1.16 --- LiteralArrayExp.java 11 Feb 2004 12:46:39 -0000 1.17 *************** *** 21,24 **** --- 21,26 ---- import mlsub.typing.MonotypeConstructor; import mlsub.typing.Polytype; + import mlsub.typing.TypeConstructor; + import nice.tools.code.Types; /** *************** *** 49,54 **** if (! type.trySimplify()) type = array(PrimitiveType.objectPolytype()); - - nice.tools.code.Types.setBytecodeType(type); } --- 51,54 ---- *************** *** 63,66 **** --- 63,111 ---- } + /** + Adjust the array type according to the context. + + This is usefull because arrays are non-variant. + For instance, different code must be generated + for [ 1, 2 ] in the contexts: + List<int[]> i = [[ 1, 2 ]] + and + List<List<byte[]>> b = [[ 1, 2 ]] + */ + bossa.syntax.Expression resolveOverloading(Polytype expectedType) + { + Monotype elementType = Types.getTypeParameter(expectedType, 0); + + if (elementType != null) + for (int i = 0; i < elements.length; i++) + elements[i].adjustToExpectedType(elementType); + + return this; + } + + void adjustToExpectedType(Monotype expectedType) + { + TypeConstructor tc = Types.equivalent(expectedType).head(); + + // Remember that we will need to wrap the array to make it a collection. + // This cannot be found easily during code generation for nested arrays + // since the bytecode type of both List<List<T>> and List<T[]> is + // simply List. + if (tc != PrimitiveType.arrayTC && + tc != null && tc.isRigid() && + mlsub.typing.Typing.testRigidLeq(tc, PrimitiveType.collectionTC)) + { + wrapAsCollection = true; + } + + // Adjust nested elements. + Monotype elementType = Types.getTypeParameter(expectedType, 0); + if (elementType != null) + for (int i = 0; i < elements.length; i++) + elements[i].adjustToExpectedType(elementType); + } + + private boolean wrapAsCollection; + /**************************************************************** * Code generation *************** *** 69,78 **** public gnu.expr.Expression compile() { ! Type t = nice.tools.code.Types.javaType(getType()); ! return new gnu.expr.ApplyExp ! (new nice.tools.code.LiteralArrayProc((ArrayType) t, ! elements.length), ! Expression.compile(elements)); } --- 114,124 ---- public gnu.expr.Expression compile() { ! gnu.expr.Expression[] args = Expression.compile(elements); ! ArrayType t = (ArrayType) nice.tools.code.SpecialTypes.array(Types.lowestUpperBound(args)); ! return new gnu.expr.ApplyExp ! (new nice.tools.code.LiteralArrayProc ! (t, elements.length, wrapAsCollection), ! args); } Index: Expression.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Expression.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** Expression.java 9 Dec 2003 15:21:05 -0000 1.53 --- Expression.java 11 Feb 2004 12:46:39 -0000 1.54 *************** *** 17,20 **** --- 17,21 ---- import mlsub.typing.Polytype; + import mlsub.typing.Monotype; /** *************** *** 131,135 **** return this; } ! /** computes the static type of the expression */ abstract void computeType(); --- 132,156 ---- return this; } ! ! /** ! Called with the type that this expression is expected to have. ! This information can be used to generate better code. ! */ ! void adjustToExpectedType(Monotype expectedType) ! { ! // Default: do nothing. ! } ! ! static void adjustToExpectedType (Expression[] expressions, Monotype[] types) ! { ! // The domain of a function can be null in rare circumstances, like ! // for a function of type <T> T ! if (types == null) ! return; ! ! for (int i = 0; i < types.length; i++) ! expressions[i].adjustToExpectedType(types[i]); ! } ! /** computes the static type of the expression */ abstract void computeType(); Index: ClassDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ClassDefinition.java,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** ClassDefinition.java 19 Dec 2003 18:08:33 -0000 1.102 --- ClassDefinition.java 11 Feb 2004 12:46:39 -0000 1.103 *************** *** 427,430 **** --- 427,432 ---- if (name.equals("nice.lang.Throwable")) PrimitiveType.throwableTC = tc; + else if (name.equals("nice.lang.Collection")) + PrimitiveType.collectionTC = tc; } Index: CallExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CallExp.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** CallExp.java 3 Feb 2004 01:28:10 -0000 1.89 --- CallExp.java 11 Feb 2004 12:46:39 -0000 1.90 *************** *** 249,252 **** --- 249,259 ---- function.checkSpecialRequirements(arguments.computedExpressions); + + // make sure computedExpressions is valid. + getType(); + // Allow expressions to know in what context they are used. + // Important for litteral arrays and tuples. + Expression.adjustToExpectedType(arguments.computedExpressions, + Types.domain(function.getType())); } |
From: <bo...@us...> - 2004-02-11 12:50:47
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5377/testsuite/compiler/expressions/arrays Modified Files: literal.testsuite compilation.testsuite Log Message: Use more typing information from the context when deciding what bytecode types to use for literal arrays and tuples, especially when they are nested inside other literal arrays or tuples. This allows to generate more efficient code, and fixes several runtime errors (fixes #761629 and #892625). Index: literal.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays/literal.testsuite,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** literal.testsuite 9 Feb 2004 12:25:58 -0000 1.10 --- literal.testsuite 11 Feb 2004 12:46:38 -0000 1.11 *************** *** 41,42 **** --- 41,55 ---- /// Toplevel var String[][][] s = [[["A"]]]; + + /// PASS + Object[][][] s = [[["A"]]]; + s[0] = [[ new Object() ]]; + + /// PASS + sizes([[1,2,3],[4,5,6]]); + /// TOPLEVEL + <T> void sizes (List<List<T>> lists) + { + int i; + lists.foreach(List<T> list => i = list.size); + } Index: compilation.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays/compilation.testsuite,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** compilation.testsuite 10 Feb 2004 15:05:18 -0000 1.9 --- compilation.testsuite 11 Feb 2004 12:46:39 -0000 1.10 *************** *** 86,98 **** assert x.equals("xyz") && arr[0].equals("xyz") && arr[1].equals("pqr"); ! /// PASS bug List<List<int>> x = [[1,2,3]]; int i = x[0][1]; ! /// PASS bug (List<int>, String) x = ([1,2,3], "abc"); (List<int> arr, String str) = x; ! /// PASS bug (int[], int[]) t1 = ([1, 2], [3, 4]); (List<int>, List<int>) t2 = t1; --- 86,108 ---- assert x.equals("xyz") && arr[0].equals("xyz") && arr[1].equals("pqr"); ! /// PASS List<List<int>> x = [[1,2,3]]; int i = x[0][1]; ! /// PASS ! let List<(List<byte>, String)> a = [([1,2,3], "Hello")]; ! (List<byte> l1, String s1) = a[0]; ! ! /// PASS (List<int>, String) x = ([1,2,3], "abc"); (List<int> arr, String str) = x; ! /// PASS ! List<String>[] x0 = [["A","B","C"]]; ! List<List<String>> x = x0; ! List<String> l = x0[0]; ! String s = l[1]; ! ! /// PASS (int[], int[]) t1 = ([1, 2], [3, 4]); (List<int>, List<int>) t2 = t1; *************** *** 103,109 **** /// PASS bug ((int[], String) , String) t1 = (([1, 2], "abc"), "xyz"); ! ((List<int>, String), String) t2 = t1; ! ((List<int>, String) t3, String s1) = t2; ! (List<int> la, String s2) = t3; ! assert la[0] == 1; ! assert la[1] == 2; --- 113,119 ---- /// PASS bug ((int[], String) , String) t1 = (([1, 2], "abc"), "xyz"); ! ((List<int>, String), String) t2 = t1; ! ((List<int>, String) t3, String s1) = t2; ! (List<int> la, String s2) = t3; ! assert la[0] == 1; ! assert la[1] == 2; |
From: <bo...@us...> - 2004-02-11 12:50:47
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5377/stdlib/nice/lang Modified Files: rawArray.java Log Message: Use more typing information from the context when deciding what bytecode types to use for literal arrays and tuples, especially when they are nested inside other literal arrays or tuples. This allows to generate more efficient code, and fixes several runtime errors (fixes #761629 and #892625). Index: rawArray.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/rawArray.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** rawArray.java 9 Feb 2004 12:25:58 -0000 1.13 --- rawArray.java 11 Feb 2004 12:46:39 -0000 1.14 *************** *** 370,374 **** boolean primitiveArray = componentClass.charAt(0) == '[' && ! componentClass.charAt(1) != 'L'; for (int i = len; --i >= 0;) { --- 370,379 ---- boolean primitiveArray = componentClass.charAt(0) == '[' && ! componentClass.charAt(1) != 'L' && ! componentClass.charAt(1) != '['; ! ! boolean collection = ! componentClass.equals("java.util.Collection") || ! componentClass.equals("java.util.List"); for (int i = len; --i >= 0;) { *************** *** 377,380 **** --- 382,387 ---- if (primitiveArray) value = convertPrimitive(value, componentClass.substring(1)); + else if (collection) + value = rawArray.make(value); Array.set(res, i, value); |
From: <ar...@us...> - 2004-02-10 21:42:28
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32590/F:/nice/stdlib/nice/lang Modified Files: source-lines.nice Log Message: Make source lines fixup more robust. Index: source-lines.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/source-lines.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** source-lines.nice 9 Feb 2004 19:23:28 -0000 1.1 --- source-lines.nice 10 Feb 2004 21:38:50 -0000 1.2 *************** *** 89,94 **** { let resourceName = className.replace('.', '/') + ".class"; ! let stream = new DataInputStream ! (java.lang.ClassLoader.getSystemResourceAsStream(resourceName)); stream.skipBytes(8); --- 89,97 ---- { let resourceName = className.replace('.', '/') + ".class"; ! let ?InputStream inputStream = java.lang.ClassLoader.getSystemResourceAsStream(resourceName); ! if (inputStream == null) ! return null; ! ! let stream = new DataInputStream(inputStream); stream.skipBytes(8); |
From: <ar...@us...> - 2004-02-10 15:08:44
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2164/F:/nice/testsuite/compiler/expressions/arrays Modified Files: compilation.testsuite Log Message: Added 2 testcases for coercion of arrays in nested arrays/tuples. Index: compilation.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays/compilation.testsuite,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** compilation.testsuite 9 Feb 2004 12:50:51 -0000 1.8 --- compilation.testsuite 10 Feb 2004 15:05:18 -0000 1.9 *************** *** 93,94 **** --- 93,109 ---- (List<int>, String) x = ([1,2,3], "abc"); (List<int> arr, String str) = x; + + /// PASS bug + (int[], int[]) t1 = ([1, 2], [3, 4]); + (List<int>, List<int>) t2 = t1; + (List<int> la, List<int> lb) = t2; + assert la[0] == 1; + assert la[1] == 2; + + /// PASS bug + ((int[], String) , String) t1 = (([1, 2], "abc"), "xyz"); + ((List<int>, String), String) t2 = t1; + ((List<int>, String) t3, String s1) = t2; + (List<int> la, String s2) = t3; + assert la[0] == 1; + assert la[1] == 2; |
From: <bo...@us...> - 2004-02-10 13:30:56
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13056/src/nice/tools/code Modified Files: LiteralArrayProc.java Log Message: Simplified the bytecode generation of literal arrays (with the same output). Index: LiteralArrayProc.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/LiteralArrayProc.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LiteralArrayProc.java 14 Jan 2003 21:42:57 -0000 1.5 --- LiteralArrayProc.java 10 Feb 2004 13:27:33 -0000 1.6 *************** *** 73,87 **** for (int i = 0; i < nbElements; i++) { ! if (i < nbElements - 2) ! { code.emitDup(2); ! ! code.emitPushInt(i); ! args[i].compile(comp, arrayType.elements); ! code.emitArrayStore(arrayType.elements); ! i++; ! } ! else if (i == nbElements - 2) ! code.emitDup(); code.emitPushInt(i); --- 73,82 ---- for (int i = 0; i < nbElements; i++) { ! // Duplicate the reference to the array, according to our future needs. ! if (i % 2 == 0) ! if (i < nbElements - 2) code.emitDup(2); ! else if (i == nbElements - 2) ! code.emitDup(); code.emitPushInt(i); |
From: <ar...@us...> - 2004-02-10 02:27:57
|
Update of /cvsroot/nice/Nice/src/nice/tools/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19812/F:/nice/src/nice/tools/util Removed Files: source-lines.nice Log Message: Moved source line fixup to nice.lang. --- source-lines.nice DELETED --- |
From: <ar...@us...> - 2004-02-10 02:21:44
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19812/F:/nice/src/nice/tools/compiler Modified Files: interface.nice Log Message: Moved source line fixup to nice.lang. Index: interface.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/interface.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** interface.nice 23 Jan 2004 13:00:24 -0000 1.7 --- interface.nice 9 Feb 2004 19:23:20 -0000 1.8 *************** *** 21,25 **** import bossa.modules; - import nice.tools.util; void compile(Compilation compilation, String mainPackage, --- 21,24 ---- |
From: <bo...@us...> - 2004-02-10 01:00:55
|
Update of /cvsroot/nice/Nice/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28872/bin Modified Files: nicec.bat Log Message: Restore DOS-style end of lines, and the Emacs setup section. Index: nicec.bat =================================================================== RCS file: /cvsroot/nice/Nice/bin/nicec.bat,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** nicec.bat 8 Feb 2004 02:36:50 -0000 1.13 --- nicec.bat 9 Feb 2004 13:05:34 -0000 1.14 *************** *** 1,55 **** ! @echo off ! rem --------------------------------------------------------------------------- ! rem nicec.bat - a nice compiler batch file ! rem ! rem Environment Variariable Prerequisites: ! rem ! rem NICE - the root directory where nice is installed ! rem --------------------------------------------------------------------------- ! ! ! rem -- do we have a nice environment variable? ! for %%x in (%NICE%) do goto gotNiceEnvVar ! ! rem -- try some standard places ! ! set NICEPATH=c:\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH="c:\Program Files\nice" ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH=c:\programs\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH=d:\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH="d:\Program Files\nice" ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH=d:\programs\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! goto error ! ! :envError ! echo Could not find the file: %NICE%\nice.jar ! echo The NICE environment variable is not pointing to the right directory! ! ! :error ! echo You must set the NICE environment variable to point to the directory you've installed nice in e.g. ! echo set NICE=C:\programs\nice echo (note: do not add a ';' at the end) ! echo You can do it by modifying Autoexec.bat or in the system settings. ! goto end ! ! :gotNiceEnvVar ! if not exist %NICE%\nice.jar goto envError ! set NICEPATH=%NICE% ! ! :gotNice ! java -classpath %NICEPATH%\nice.jar;%CLASSPATH% nice.tools.compiler.console.fun --runtime=%NICEPATH%\nice.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 ! ! :end ! rem -- clean up a bit ! set NICEPATH= \ No newline at end of file --- 1,61 ---- ! @echo off ! rem --------------------------------------------------------------------------- ! rem nicec.bat - a nice compiler batch file ! rem ! rem Environment Variariable Prerequisites: ! rem ! rem NICE - the root directory where nice is installed ! rem --------------------------------------------------------------------------- ! ! ! rem -- do we have a nice environment variable? ! for %%x in (%NICE%) do goto gotNiceEnvVar ! ! rem -- try some standard places ! ! set NICEPATH=c:\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH="c:\Program Files\nice" ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH=c:\programs\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH=d:\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH="d:\Program Files\nice" ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH=d:\programs\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! goto error ! ! :envError ! echo Could not find the file: %NICE%\nice.jar ! echo The NICE environment variable is not pointing to the right directory! ! ! :error ! echo You must set the NICE environment variable to point to the directory you've installed nice in e.g. ! echo set NICE=C:\programs\nice echo (note: do not add a ';' at the end) ! echo You can do it by modifying Autoexec.bat or in the system settings. ! goto end ! ! :gotNiceEnvVar ! if not exist %NICE%\nice.jar goto envError ! set NICEPATH=%NICE% ! ! :gotNice ! java -classpath %NICEPATH%\nice.jar;%CLASSPATH% nice.tools.compiler.console.fun --runtime=%NICEPATH%\nice.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 ! ! :end ! rem -- clean up a bit ! set NICEPATH= ! ! rem Setting for Emacs so that it will treat the file as a DOS file whatever ! rem OS it is running on. Please keep this. ! rem Local variables: ! rem coding:dos ! rem End: |
From: <bo...@us...> - 2004-02-10 00:58:40
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26265/testsuite/compiler/expressions/arrays Modified Files: compilation.testsuite Log Message: More thorough testing of generic array to primitive array conversions. Index: compilation.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays/compilation.testsuite,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** compilation.testsuite 3 Dec 2003 21:50:41 -0000 1.7 --- compilation.testsuite 9 Feb 2004 12:50:51 -0000 1.8 *************** *** 1,6 **** /// PASS byte[] b = f(new byte[2]); /// Toplevel ! <int T> T[] f(T[] t) = t; /// PASS --- 1,10 ---- /// PASS byte[] b = f(new byte[2]); + short[] s = f(new short[2]); + int[] i = f(new int[2]); + long[] l = f(new long[2]); + float[] f = f(new float[2]); /// Toplevel ! <double T> T[] f(T[] t) = t; /// PASS |
From: <ar...@us...> - 2004-02-10 00:56:04
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19812/F:/nice/stdlib/nice/lang Added Files: source-lines.nice Log Message: Moved source line fixup to nice.lang. --- NEW FILE: source-lines.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package nice.lang; /** Support for source information in compiled classes. @author Daniel Bonniot (bo...@us...) */ import java.io.*; public <!T, R> R call__(T obj, String methodName) { let method = obj.getClass().getMethod(methodName, null); return cast( method.invoke(obj, null) ); } public void printStackTraceWithSourceInfo(Throwable t) = printStackTraceWithSourceInfo(t, java.lang.System.err); public void printStackTraceWithSourceInfo(Throwable t, PrintStream s) = printStackTraceWithSourceInfo(t, new PrintWriter(s)); public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w) { w.println("Exception in thread \"" Thread.currentThread().getName "\" " t); try { let getSTMethod = t.getClass().getMethod("getStackTrace", null); let Object[] elements = cast(getSTMethod.invoke(t, null)); elements.foreach(Object e => { (?String file, int line) = getSourceLocation__(e.call__("getClassName"), e.call__("getLineNumber")) || (e.call__("getFileName"), e.call__("getLineNumber")); let location = file == null ? (e.call__("isNativeMethod") ? "Native Method" : "Unknown Source") : line < 0 ? file : (file + ":" + line); w.println("\tat " e.call__("getClassName") "." e.call__("getMethodName") "(" location ")"); }); } catch (NoSuchMethodError e) { // Fallback in case method Throwable.getStackTrace() is not available. t.printStackTrace(w); w.println(""" Warning: the above stack trace has wrong line numbers for Nice methods. Use a JVM version 1.4 or later to get the correct line numbers."""); } } /* Return the index of SourceDebugExtension, or null if it does not appear. */ private ?int readConstantPool__(DataInputStream dstr) { var ?int result = null; let count = dstr.readUnsignedShort() - 1; for (int i = 1; i <= count; i++) { byte tag = dstr.readByte(); if (tag == 1/*UTF8*/) { let value = dstr.readUTF(); if (value.equals("SourceDebugExtension")) result = i; } else if (tag == 5/*LONG*/ || tag == 6/*DOUBLE*/) { dstr.readLong(); i++; } else if (tag == 7/*CLASS*/ || tag == 8/*STRING*/) dstr.readUnsignedShort(); else // In all other cases, 4 bytes need to be read. dstr.readInt(); } return result; } /** Fetch the SourceDebugExtension attribute from a compiled class. */ ?String sourceDebugExtension__(String className) { let resourceName = className.replace('.', '/') + ".class"; let stream = new DataInputStream (java.lang.ClassLoader.getSystemResourceAsStream(resourceName)); stream.skipBytes(8); let sourceDebugExtensionIndex = readConstantPool__(stream); if (sourceDebugExtensionIndex == null) return null; // Class info stream.skipBytes(6); let interfaces_count = stream.readUnsignedShort(); stream.skipBytes(2 * interfaces_count); let fields_count = stream.readUnsignedShort(); for (int i = 0; i < fields_count; i++) { stream.skipBytes(6); let attributes_count = stream.readUnsignedShort(); for (int j = 0; j < attributes_count; j++) { stream.skipBytes(2); let attribute_length = stream.readInt(); stream.skipBytes(attribute_length); } } let methods_count = stream.readUnsignedShort(); for (int i = 0; i < methods_count; i++) { stream.skipBytes(6); let attributes_count = stream.readUnsignedShort(); for (int j = 0; j < attributes_count; j++) { stream.skipBytes(2); let attribute_length = stream.readInt(); stream.skipBytes(attribute_length); } } let attributes_count = stream.readUnsignedShort(); for (int j = 0; j < attributes_count; j++) { let index = stream.readUnsignedShort(); if (index == sourceDebugExtensionIndex) { let length = stream.readInt(); let value = new byte[length]; stream.readFully(value); return new String(value, "UTF-8"); // Skip the two higher-order bytes. Problematic for large source maps? //let dummy = stream.readUnsignedShort(); //return stream.readUTF(); } let attribute_length = stream.readInt(); stream.skipBytes(attribute_length); } return null; } private (int,int,int,int,int) parseLine__(String line, int defaultId) { /* Format: InputStartLine #LineFileID ,RepeatCount :OutputStartLine ,OutputLineIncrement */ let tokenizer = new StringTokenizer(line, "#,: "); int start = Integer.parseInt(tokenizer.nextToken()); int id, repeat, outStart, outInc; int pos = line.indexOf('#'); if (pos == -1) id = defaultId; else { int end = line.indexOf(':'); int end2 = line.indexOf(','); if (end2 != -1) end = end2; id = Integer.parseInt(line.substring(pos + 1, end)); } pos = line.indexOf(','); if (pos == -1) repeat = 1; else { int end = line.indexOf(':'); repeat = Integer.parseInt(line.substring(pos + 1, end)); } pos = line.indexOf(':'); int end = line.indexOf(',', pos); if (end != -1) { outStart = Integer.parseInt(line.substring(pos + 1, end)); outInc = Integer.parseInt(line.substring(end + 1)); } else { outStart = Integer.parseInt(line.substring(pos + 1)); outInc = 1; } return (start, id, repeat, outStart, outInc); } ?(String,int) getSourceLocation__(String className, int lineNumber) { let map = sourceDebugExtension__(className); if (map == null) return null; var resultLine = 0; var resultId = 1; let r = new BufferedReader(new StringReader(map)); if (! (r.readLine().equals("SMAP"))) return null; r.readLine(); let defaultStratum = r.readLine(); while (! (r.readLine().equals("*S " defaultStratum))) // Not the stratum we want, skip. {} List<?String> files = new ArrayList(); var section = r.readLine(); do { if (section.equals("*F")) { for (;;) { section = r.readLine(); if (section == null || section.startsWith("*")) break; let tokenizer = new StringTokenizer(section); var token = tokenizer.nextToken(); if (token.equals("+")) { let index = Integer.parseInt(tokenizer.nextToken()); let file = tokenizer.nextToken(); r.readLine(); while (files.size() < index) files.add(null); if (files.size() == index) files.add(file); else files.set(index, file); } else { let index = Integer.parseInt(token); let file = tokenizer.nextToken(); while (files.size() < index) files.add(null); if (files.size() == index) files.add(file); else files.set(index, file); } } } else if (section.equals("*L")) for (;;) { var id = 1; section = r.readLine(); if (section == null || section.startsWith("*")) break; (int start, id, int repeat, int outStart, int outInc) = parseLine__(section, id); if (lineNumber >= outStart && lineNumber < outStart + repeat * outInc) { // Found it! resultLine = start + (lineNumber - outStart)/outInc; resultId = id; if (files.get(id) != null) return (notNull(files.get(id)), resultLine); } } else if (section.equals("*E") || section.equals("*S")) // We get to the end, or to a different stratum which we don't care about break; else // Skip until we find something interesting section = r.readLine(); } while (true); return (notNull(files.get(resultId)), resultLine); } |
From: <bo...@us...> - 2004-02-09 12:29:13
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20771/testsuite/compiler/expressions/arrays Modified Files: literal.testsuite Log Message: Fix conversion of long arrays inside arrays. Index: literal.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays/literal.testsuite,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** literal.testsuite 15 Jan 2004 21:39:19 -0000 1.9 --- literal.testsuite 9 Feb 2004 12:25:58 -0000 1.10 *************** *** 19,25 **** /// PASS ! byte[][] s = single([ 0 ]); /// Toplevel ! <int T> T[][] single(T[] t) = [ t ]; /// PASS --- 19,29 ---- /// PASS ! byte[][] sb = single([ 0 ]); ! short[][] ss = single([ 0 ]); ! int[][] si = single([ 0 ]); ! long[][] sl = single([ 0 ]); ! float[][] sf = single([ 0 ]); /// Toplevel ! <double T> T[][] single(T[] t) = [ t ]; /// PASS |
From: <bo...@us...> - 2004-02-09 12:29:12
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20771/stdlib/nice/lang Modified Files: rawArray.java Log Message: Fix conversion of long arrays inside arrays. Index: rawArray.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/rawArray.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** rawArray.java 17 Jan 2004 16:32:45 -0000 1.12 --- rawArray.java 9 Feb 2004 12:25:58 -0000 1.13 *************** *** 396,400 **** case 'S': return gconvert_short(array); case 'I': return gconvert_int(array); ! case 'L': return gconvert_long(array); case 'F': return gconvert_float(array); case 'D': return gconvert_double(array); --- 396,400 ---- case 'S': return gconvert_short(array); case 'I': return gconvert_int(array); ! case 'J': return gconvert_long(array); case 'F': return gconvert_float(array); case 'D': return gconvert_double(array); |
From: <bo...@us...> - 2004-02-09 11:46:13
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12290 Modified Files: NEWS Log Message: Typo, and moved 'using' next to the new block syntax. Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** NEWS 30 Jan 2004 03:00:30 -0000 1.19 --- NEWS 9 Feb 2004 11:42:57 -0000 1.20 *************** *** 5,16 **** enum Coin(int value) implements Currency {penny(1), nickel(5), dime(10), quarter(25)} ! * Alternative syntax for calling methods that takes an closure with no arguments. For example 'loop(5) { doSomeThing(); }' is shorthand for 'loop(5, () => { doSomeThing(); });' * Stricter parsing of expression used as statement. * Improved performance of arrays used as lists. * New methods (in package nice.functional) for working with iterators and generators. - * "using" statement, as in C#. * Fixed the file locations in the RPM package, and added automatic registration of the emacs mode for the SuSE Linux distribution. --- 5,17 ---- enum Coin(int value) implements Currency {penny(1), nickel(5), dime(10), quarter(25)} ! * Alternative syntax for calling methods that takes a closure with no arguments. For example 'loop(5) { doSomeThing(); }' is shorthand for 'loop(5, () => { doSomeThing(); });' + * "using" statement, as in C#, defined in nice.lang using (!) the above + syntax. * Stricter parsing of expression used as statement. * Improved performance of arrays used as lists. * New methods (in package nice.functional) for working with iterators and generators. * Fixed the file locations in the RPM package, and added automatic registration of the emacs mode for the SuSE Linux distribution. |
From: <ar...@us...> - 2004-02-08 02:39:48
|
Update of /cvsroot/nice/Nice/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2159/F:/nice/bin Modified Files: nicec.bat Log Message: Use magnus fix to handle white spaces in directory name correctly. Index: nicec.bat =================================================================== RCS file: /cvsroot/nice/Nice/bin/nicec.bat,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** nicec.bat 8 Feb 2004 00:00:28 -0000 1.12 --- nicec.bat 8 Feb 2004 02:36:50 -0000 1.13 *************** *** 1,47 **** ! @echo off ! rem --------------------------------------------------------------------------- ! rem nicec.bat - a nice compiler batch file ! rem ! rem Environment Variariable Prerequisites: ! rem ! rem NICE - the root directory where nice is installed ! rem --------------------------------------------------------------------------- ! ! rem -- do we have a nice environment variable? ! if not "%NICE%" == "" goto gotNice ! ! rem -- try some standard places ! ! set NICE=c:\nice ! if exist %NICE%\nice.jar goto gotNice ! ! set NICE="c:\Program Files\nice" ! if exist %NICE%\nice.jar goto gotNice ! ! set NICE=c:\programs\nice ! if exist %NICE%\nice.jar goto gotNice ! ! set NICE=d:\nice ! if exist %NICE%\nice.jar goto gotNice ! ! set NICE="d:\Program Files\nice" ! if exist %NICE%\nice.jar goto gotNice ! ! set NICE=d:\programs\nice ! if exist %NICE%\nice.jar goto gotNice ! ! ! echo You must set the NICE environment variable to point to the directory you've installed nice in e.g. ! echo set NICE=C:\programs\nice ! echo (note: do not add a ';' at the end) ! echo You can do it by modifying Autoexec.bat or in the system settings. ! goto end ! ! :gotNice ! java -classpath %NICE%\nice.jar;%CLASSPATH% nice.tools.compiler.console.fun --runtime=%NICE%\nice.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 ! ! :end ! ! rem Local variables: ! rem coding:dos ! rem End: --- 1,55 ---- ! @echo off ! rem --------------------------------------------------------------------------- ! rem nicec.bat - a nice compiler batch file ! rem ! rem Environment Variariable Prerequisites: ! rem ! rem NICE - the root directory where nice is installed ! rem --------------------------------------------------------------------------- ! ! ! rem -- do we have a nice environment variable? ! for %%x in (%NICE%) do goto gotNiceEnvVar ! ! rem -- try some standard places ! ! set NICEPATH=c:\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH="c:\Program Files\nice" ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH=c:\programs\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH=d:\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH="d:\Program Files\nice" ! if exist %NICEPATH%\nice.jar goto gotNice ! ! set NICEPATH=d:\programs\nice ! if exist %NICEPATH%\nice.jar goto gotNice ! ! goto error ! ! :envError ! echo Could not find the file: %NICE%\nice.jar ! echo The NICE environment variable is not pointing to the right directory! ! ! :error ! echo You must set the NICE environment variable to point to the directory you've installed nice in e.g. ! echo set NICE=C:\programs\nice echo (note: do not add a ';' at the end) ! echo You can do it by modifying Autoexec.bat or in the system settings. ! goto end ! ! :gotNiceEnvVar ! if not exist %NICE%\nice.jar goto envError ! set NICEPATH=%NICE% ! ! :gotNice ! java -classpath %NICEPATH%\nice.jar;%CLASSPATH% nice.tools.compiler.console.fun --runtime=%NICEPATH%\nice.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 ! ! :end ! rem -- clean up a bit ! set NICEPATH= \ No newline at end of file |
From: <bo...@us...> - 2004-02-08 00:03:27
|
Update of /cvsroot/nice/Nice/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7628/bin Modified Files: nicec.bat Log Message: Fixed directories with spaces in them, thanks to magnus. Index: nicec.bat =================================================================== RCS file: /cvsroot/nice/Nice/bin/nicec.bat,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** nicec.bat 30 Jun 2003 15:22:07 -0000 1.11 --- nicec.bat 8 Feb 2004 00:00:28 -0000 1.12 *************** *** 16,20 **** if exist %NICE%\nice.jar goto gotNice ! set NICE=c:\Program Files\nice if exist %NICE%\nice.jar goto gotNice --- 16,20 ---- if exist %NICE%\nice.jar goto gotNice ! set NICE="c:\Program Files\nice" if exist %NICE%\nice.jar goto gotNice *************** *** 25,29 **** if exist %NICE%\nice.jar goto gotNice ! set NICE=d:\Program Files\nice if exist %NICE%\nice.jar goto gotNice --- 25,29 ---- if exist %NICE%\nice.jar goto gotNice ! set NICE="d:\Program Files\nice" if exist %NICE%\nice.jar goto gotNice |
From: <bo...@us...> - 2004-02-07 15:10:21
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23528/web Modified Files: manual.xml Log Message: Typos. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** manual.xml 3 Feb 2004 19:11:07 -0000 1.35 --- manual.xml 7 Feb 2004 13:42:42 -0000 1.36 *************** *** 319,323 **** not contain data fields, only methods. Unlike in Java, they may also contain default implementations of the methods, making ! iterfaces more convenient and useful than Java interfaces. </para> <para> --- 319,323 ---- not contain data fields, only methods. Unlike in Java, they may also contain default implementations of the methods, making ! interfaces more convenient and useful than Java interfaces. </para> <para> *************** *** 385,389 **** </example> and in fact, it's fine to mix the two styles, declaring ! some of the methods inside the <literal>iterface</literal> block, and some outside. One good practice might be to declare those methods which have no default implementation --- 385,389 ---- </example> and in fact, it's fine to mix the two styles, declaring ! some of the methods inside the <literal>interface</literal> block, and some outside. One good practice might be to declare those methods which have no default implementation |
From: <bo...@us...> - 2004-02-06 19:08:32
|
Update of /cvsroot/nice/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15738 Modified Files: project.xml Log Message: Added link to the wiki documentation. Index: project.xml =================================================================== RCS file: /cvsroot/nice/swing/project.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** project.xml 5 Feb 2004 15:20:45 -0000 1.2 --- project.xml 6 Feb 2004 19:05:35 -0000 1.3 *************** *** 15,23 **** <shortDescription>Extension of the Swing toolkit to make use of Nice advanced features</shortDescription> ! <description> This library allows you to write a Swing user interface in Nice programs. It allows a more elegant programming style than Swing programs written in Java by using Nice's features like anonymous functions and named and optional method parameters. </description> --- 15,30 ---- <shortDescription>Extension of the Swing toolkit to make use of Nice advanced features</shortDescription> ! <description><![CDATA[ ! <p> This library allows you to write a Swing user interface in Nice programs. It allows a more elegant programming style than Swing programs written in Java by using Nice's features like anonymous functions and named and optional method parameters. + </p><p> + See the + <a href="http://nice.sourceforge.net/cgi-bin/twiki/view/Doc/NiceSwing"> + documentation</a> of the library. + </p> + ]]> </description> |
From: <bo...@us...> - 2004-02-05 23:57:55
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7404/src/bossa/syntax Modified Files: FormalParameters.java Log Message: Make sure that overloading of default values has been resolved before printing them. Also fail more clearly in case a similar bug with parameters bytecode attribute happens again in the future. Index: FormalParameters.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FormalParameters.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** FormalParameters.java 2 Feb 2004 19:21:12 -0000 1.36 --- FormalParameters.java 5 Feb 2004 23:55:16 -0000 1.37 *************** *** 256,259 **** --- 256,260 ---- public String toString() { + defaultValue = defaultValue.noOverloading(); return type + " " + name + " = " + defaultValue; } *************** *** 575,579 **** } catch (bossa.parser.ParseException ex) { ! return null; } } --- 576,583 ---- } catch (bossa.parser.ParseException ex) { ! throw Internal.error ! ("Could not parse '" + attr.getName() + "' bytecode attribute:\n" + ! "In method: " + attr.getContainer() + "\n" + ! "Value : " + value); } } |
From: <bo...@us...> - 2004-02-05 23:57:55
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7404/testsuite/compiler/classes Modified Files: fields.testsuite Log Message: Make sure that overloading of default values has been resolved before printing them. Also fail more clearly in case a similar bug with parameters bytecode attribute happens again in the future. Index: fields.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/fields.testsuite,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** fields.testsuite 28 Jan 2004 13:10:11 -0000 1.16 --- fields.testsuite 5 Feb 2004 23:55:15 -0000 1.17 *************** *** 145,146 **** --- 145,160 ---- zero(){} } + + /// PASS + /// package a + /// TOPLEVEL + class Visibilitymodifier {} + let Visibilitymodifier PUBLIC = new Visibilitymodifier(); + + //variable entity aka variables + class A { + // visibility + Visibilitymodifier visibility = PUBLIC; + } + /// package b import a + {} |
From: <ar...@us...> - 2004-02-05 23:03:16
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27004/F:/nice/src/bossa/syntax Modified Files: analyse.nice SuperExp.java Log Message: Type(constructors) can be passed to an SuperExp to resolve ambigiuties. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** analyse.nice 2 Feb 2004 23:21:44 -0000 1.98 --- analyse.nice 5 Feb 2004 22:59:52 -0000 1.99 *************** *** 635,638 **** --- 635,644 ---- } + + analyse(e@SuperExp, info) + { + e.resolveTC(info.outerTypeScope); + return e; + } /**************************************************************** * Statements Index: SuperExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/SuperExp.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** SuperExp.java 12 Dec 2003 18:51:31 -0000 1.15 --- SuperExp.java 5 Feb 2004 22:59:53 -0000 1.16 *************** *** 37,40 **** --- 37,46 ---- public class SuperExp extends Expression { + + public SuperExp(List types) + { + this.types = types; + } + void setCurrentMethod(MethodBodyDefinition m) { *************** *** 42,45 **** --- 48,54 ---- MethodDeclaration decl = currentMethod.getDeclaration(); + if (tc != null && tc.size() != decl.getArity()) + User.error(this, "Number of types doesn't match the number of arguments"); + superAlternative = getSuper(decl); } *************** *** 49,52 **** --- 58,73 ---- Method superMethod = null; + private Pattern[] minimumPatterns() + { + if (tc == null) + return null; + + Pattern[] res = new Pattern[tc.size()]; + for (int i = 0; i < tc.size(); i++) + res[i] = new Pattern((TypeConstructor)tc.get(i), false); + + return res; + } + private Alternative getSuper(MethodDeclaration decl) { *************** *** 55,58 **** --- 76,80 ---- java.util.Iterator alternatives = Alternative.sortedAlternatives(decl).iterator(); + Pattern[] mPatterns = minimumPatterns(); // Look for the first alternative more general than the current one. *************** *** 61,64 **** --- 83,101 ---- Alternative a = (Alternative) alternatives.next(); if (a == current) continue; + + if (mPatterns != null) + { + boolean match = true; + Pattern[] aPatterns = a.getPatterns(); + for (int i = 0; i < mPatterns.length; i++) + if (! aPatterns[i].leq(mPatterns[i])) + { + match = false; + break; + } + + if (!match) + continue; + } if (Alternative.leq(current, a)) *************** *** 110,113 **** --- 147,160 ---- } + public void resolveTC(TypeScope scope) + { + if (types != null) + { + tc = new ArrayList(); + for (Iterator it = types.iterator(); it.hasNext();) + tc.add(((TypeIdent)it.next()).resolveToTC(scope)); + } + } + /**************************************************************** * Typing *************** *** 218,222 **** public String toString() { ! return "super"; } } --- 265,272 ---- public String toString() { ! return "super" + (types != null ? "" : Util.map("(", ", ", ")", types)); } + + List/*TypeIdent*/ types; + List/*TypeConstructor*/ tc = null; } |
From: <ar...@us...> - 2004-02-05 23:02:42
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27004/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Type(constructors) can be passed to an SuperExp to resolve ambigiuties. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.236 retrieving revision 1.237 diff -C2 -d -r1.236 -r1.237 *** Parser.jj 3 Feb 2004 00:49:23 -0000 1.236 --- Parser.jj 5 Feb 2004 22:59:54 -0000 1.237 *************** *** 1643,1646 **** --- 1643,1658 ---- } + Expression SuperExp() : + { TypeIdent typeId; List types = null; } + { + "super" + [ LOOKAHEAD("(") "(" + typeId=typeIdent() { types=new ArrayList(); types.add(typeId); } + ( "," typeId=typeIdent() { types.add(typeId); } )* + ")" + ] + { return new SuperExp(types); } + } + Expression newExp(): { *************** *** 2149,2155 **** ( res=Literal() ! | ! "super" ! { res = new SuperExp(); } | // This includes the case "(" Expression() ")" to avoid lookahead --- 2161,2166 ---- ( res=Literal() ! | ! res = SuperExp() | // This includes the case "(" Expression() ")" to avoid lookahead *************** *** 2533,2538 **** e1=Pre_crementExpression() ";" | ! ( LOOKAHEAD( "super" ) ! "super" ";" { e1 = new SuperExp(); } | e1=PrimaryPrefix() --- 2544,2549 ---- e1=Pre_crementExpression() ";" | ! ( LOOKAHEAD("super") ! e1=SuperExp() ";" | e1=PrimaryPrefix() *************** *** 2565,2570 **** e1=Pre_crementExpression() | ! ( LOOKAHEAD( "super" ) ! "super" { e1 = new SuperExp(); } | e1=PrimaryPrefix() --- 2576,2581 ---- e1=Pre_crementExpression() | ! ( LOOKAHEAD("super") ! e1=SuperExp() | e1=PrimaryPrefix() |
From: <ar...@us...> - 2004-02-05 23:02:41
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27004/F:/nice/testsuite/compiler/methods Modified Files: super.testsuite Log Message: Type(constructors) can be passed to an SuperExp to resolve ambigiuties. Index: super.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/super.testsuite,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** super.testsuite 25 Oct 2003 20:34:37 -0000 1.12 --- super.testsuite 5 Feb 2004 23:00:04 -0000 1.13 *************** *** 248,249 **** --- 248,267 ---- f(a) = 1; } + + /// PASS + assert foo(new Bottom()); + /// Toplevel + interface Top {} + interface Left extends Top {} + interface Right extends Top {} + class Bottom implements Left, Right {} + boolean foo(Top x); + foo(Left x) = false; + foo(Right x) = true; + foo(Bottom x) = super(Right); + + /// FAIL + /// Toplevel + void m(A); + m(A x) {} + m(B x) { /*///FAIL HERE */super(A,A); } |