nice-commit Mailing List for The Nice Programming Language (Page 102)
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: <ar...@us...> - 2003-06-13 21:54:33
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv30914/F:/nice/src/bossa/syntax Modified Files: typecheck.nice Log Message: Don't redefine local variables in existing nice code. Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** typecheck.nice 11 Jun 2003 17:39:33 -0000 1.72 --- typecheck.nice 13 Jun 2003 21:54:30 -0000 1.73 *************** *** 610,614 **** enterIf(); - ?Expression whileExp = l.whileExp; if (whileExp != null) if (l.isTestFirst) --- 610,613 ---- |
From: <ar...@us...> - 2003-06-13 21:54:33
|
Update of /cvsroot/nice/Nice/stdlib/nice/doc In directory sc8-pr-cvs1:/tmp/cvs-serv30914/F:/nice/stdlib/nice/doc Modified Files: man.nice Log Message: Don't redefine local variables in existing nice code. Index: man.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/doc/man.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** man.nice 19 Dec 2001 14:53:49 -0000 1.4 --- man.nice 13 Jun 2003 21:54:30 -0000 1.5 *************** *** 26,35 **** StringBuffer res = new StringBuffer(); ! void appendSection(String section, ?String text) { ! if (text == null) return; ! String text = notNull(text); res.append(".SH ").append(section).append('\n'); res.append(text); --- 26,35 ---- StringBuffer res = new StringBuffer(); ! void appendSection(String section, ?String txt) { ! if (txt == null) return; ! String text = notNull(txt); res.append(".SH ").append(section).append('\n'); res.append(text); |
From: <ar...@us...> - 2003-06-13 20:34:43
|
Update of /cvsroot/nice/Nice/stdlib/nice/getopt In directory sc8-pr-cvs1:/tmp/cvs-serv19036/F:/nice/stdlib/nice/getopt Modified Files: getopt.nice gnugetopt.nice options.nice Log Message: Reverse incorrect changes to getopt. Index: getopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/getopt.nice,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** getopt.nice 13 Jun 2003 18:15:35 -0000 1.17 --- getopt.nice 13 Jun 2003 20:34:41 -0000 1.18 *************** *** 36,39 **** --- 36,40 ---- l = new LongOpt(name:o.longName,has_arg:optType(o),val:o.shortName); l.initLongOpt(); + o.optval = l.getVal(); longOptions.add(l); *************** *** 52,58 **** // Parsing loop char c = g.getopt(); ! while (c != noOptionsLeft) { ! ?Option chosen = options.find(Option o => o.shortName == c); if (chosen != null) chosen.doAction(g); --- 53,59 ---- // Parsing loop char c = g.getopt(); ! while (c != '\1') { ! ?Option chosen = options.find(Option o => o.optval == c); if (chosen != null) chosen.doAction(g); Index: gnugetopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/gnugetopt.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gnugetopt.nice 13 Jun 2003 18:15:35 -0000 1.4 --- gnugetopt.nice 13 Jun 2003 20:34:41 -0000 1.5 *************** *** 25,31 **** import java.text.*; - let char noOptionsLeft = '\1'; - let char undefinedOption = '\0'; - public class Getopt { --- 25,28 ---- *************** *** 166,179 **** exact = false; longind = -1; ! nameend = notNull(nextchar).indexOf("="); if (nameend == -1) ! nameend = notNull(nextchar).length(); // Test all lnog options for either exact match or abbreviated matches for (int i = 0; i < long_options.length; i++) { ! if (long_options[i].getName().startsWith(notNull(nextchar).substring(0, nameend))) { ! if (long_options[i].getName().equals(notNull(nextchar).substring(0, nameend))) { // Exact match found --- 163,176 ---- exact = false; longind = -1; ! nameend = (nextchar || "").indexOf("="); if (nameend == -1) ! nameend = (nextchar || "").length(); // Test all lnog options for either exact match or abbreviated matches for (int i = 0; i < long_options.length; i++) { ! if (long_options[i].getName().startsWith((nextchar || "").substring(0, nameend))) { ! if (long_options[i].getName().equals((nextchar || "").substring(0, nameend))) { // Exact match found *************** *** 204,208 **** nextchar = ""; ! optopt = undefinedOption; ++optind; return '?'; --- 201,205 ---- nextchar = ""; ! optopt = '\0'; ++optind; return '?'; *************** *** 213,222 **** ++optind; ! if (nameend != notNull(nextchar).length()) { if (pfound.has_arg != NO_ARGUMENT) { ! if (notNull(nextchar).substring(nameend).length() > 1) ! optarg = notNull(nextchar).substring(nameend+1); else optarg = ""; --- 210,219 ---- ++optind; ! if (nameend != (nextchar || "").length()) { if (pfound.has_arg != NO_ARGUMENT) { ! if ((nextchar || "").substring(nameend).length() > 1) ! optarg = (nextchar || "").substring(nameend+1); else optarg = ""; *************** *** 263,267 **** sb.setLength(0); sb.append(pfound.val); ! return undefinedOption; } --- 260,264 ---- sb.setLength(0); sb.append(pfound.val); ! return '\0'; } *************** *** 271,275 **** longopt_handled = false; ! return undefinedOption; } --- 268,272 ---- longopt_handled = false; ! return '\0'; } *************** *** 279,283 **** if (endparse == true) ! return noOptionsLeft; if ((nextchar == null) || (nextchar.equals(""))) --- 276,280 ---- if (endparse == true) ! return '\1'; if ((nextchar == null) || (nextchar.equals(""))) *************** *** 336,340 **** optind = first_nonopt; ! return noOptionsLeft; } --- 333,337 ---- optind = first_nonopt; ! return '\1'; } *************** *** 345,349 **** { if (ordering == REQUIRE_ORDER) ! return noOptionsLeft; optarg = argv[optind++]; --- 342,346 ---- { if (ordering == REQUIRE_ORDER) ! return '\1'; optarg = argv[optind++]; *************** *** 387,391 **** // Otherwise interpret it as a short option. if (!long_only || argv[optind].startsWith("--") ! || (optstring.indexOf(notNull(nextchar).charAt(0)) == -1)) { if (opterr) --- 384,388 ---- // Otherwise interpret it as a short option. if (!long_only || argv[optind].startsWith("--") ! || (optstring.indexOf((nextchar || "").charAt(0)) == -1)) { if (opterr) *************** *** 399,403 **** nextchar = ""; ++optind; ! optopt = undefinedOption; return '?'; } --- 396,400 ---- nextchar = ""; ++optind; ! optopt = '\0'; return '?'; } *************** *** 405,411 **** // Look at and handle the next short option-character */ ! char c = notNull(nextchar).charAt(0); ! if (notNull(nextchar).length() > 1) ! nextchar = notNull(nextchar).substring(1); else nextchar = ""; --- 402,408 ---- // Look at and handle the next short option-character */ ! char c = notNull(nextchar).charAt(0); //**** Do we need to check for empty str? ! if ((nextchar || "").length() > 1) ! nextchar = (nextchar || "").substring(1); else nextchar = ""; Index: options.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/options.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** options.nice 13 Jun 2003 18:15:35 -0000 1.7 --- options.nice 13 Jun 2003 20:34:41 -0000 1.8 *************** *** 50,53 **** --- 50,54 ---- String longName; String purpose; + char optval = '\0'; boolean visible; |
From: <ar...@us...> - 2003-06-13 18:15:38
|
Update of /cvsroot/nice/Nice/stdlib/nice/getopt In directory sc8-pr-cvs1:/tmp/cvs-serv13765/F:/nice/stdlib/nice/getopt Modified Files: getopt.nice gnugetopt.nice options.nice Log Message: Minor cleanup of the getopt part. Index: getopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/getopt.nice,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** getopt.nice 11 Jun 2003 12:21:27 -0000 1.16 --- getopt.nice 13 Jun 2003 18:15:35 -0000 1.17 *************** *** 36,40 **** l = new LongOpt(name:o.longName,has_arg:optType(o),val:o.shortName); l.initLongOpt(); - o.optval = l.getVal(); longOptions.add(l); --- 36,39 ---- *************** *** 53,59 **** // Parsing loop char c = g.getopt(); ! while (c != '\1') { ! ?Option chosen = options.find(Option o => o.optval == c); if (chosen != null) chosen.doAction(g); --- 52,58 ---- // Parsing loop char c = g.getopt(); ! while (c != noOptionsLeft) { ! ?Option chosen = options.find(Option o => o.shortName == c); if (chosen != null) chosen.doAction(g); Index: gnugetopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/gnugetopt.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gnugetopt.nice 11 Jun 2003 12:21:27 -0000 1.3 --- gnugetopt.nice 13 Jun 2003 18:15:35 -0000 1.4 *************** *** 25,28 **** --- 25,31 ---- import java.text.*; + let char noOptionsLeft = '\1'; + let char undefinedOption = '\0'; + public class Getopt { *************** *** 163,176 **** exact = false; longind = -1; ! nameend = (nextchar || "").indexOf("="); if (nameend == -1) ! nameend = (nextchar || "").length(); // Test all lnog options for either exact match or abbreviated matches for (int i = 0; i < long_options.length; i++) { ! if (long_options[i].getName().startsWith((nextchar || "").substring(0, nameend))) { ! if (long_options[i].getName().equals((nextchar || "").substring(0, nameend))) { // Exact match found --- 166,179 ---- exact = false; longind = -1; ! nameend = notNull(nextchar).indexOf("="); if (nameend == -1) ! nameend = notNull(nextchar).length(); // Test all lnog options for either exact match or abbreviated matches for (int i = 0; i < long_options.length; i++) { ! if (long_options[i].getName().startsWith(notNull(nextchar).substring(0, nameend))) { ! if (long_options[i].getName().equals(notNull(nextchar).substring(0, nameend))) { // Exact match found *************** *** 201,205 **** nextchar = ""; ! optopt = '\0'; ++optind; return '?'; --- 204,208 ---- nextchar = ""; ! optopt = undefinedOption; ++optind; return '?'; *************** *** 210,219 **** ++optind; ! if (nameend != (nextchar || "").length()) { if (pfound.has_arg != NO_ARGUMENT) { ! if ((nextchar || "").substring(nameend).length() > 1) ! optarg = (nextchar || "").substring(nameend+1); else optarg = ""; --- 213,222 ---- ++optind; ! if (nameend != notNull(nextchar).length()) { if (pfound.has_arg != NO_ARGUMENT) { ! if (notNull(nextchar).substring(nameend).length() > 1) ! optarg = notNull(nextchar).substring(nameend+1); else optarg = ""; *************** *** 260,264 **** sb.setLength(0); sb.append(pfound.val); ! return '\0'; } --- 263,267 ---- sb.setLength(0); sb.append(pfound.val); ! return undefinedOption; } *************** *** 268,272 **** longopt_handled = false; ! return '\0'; } --- 271,275 ---- longopt_handled = false; ! return undefinedOption; } *************** *** 276,280 **** if (endparse == true) ! return '\1'; if ((nextchar == null) || (nextchar.equals(""))) --- 279,283 ---- if (endparse == true) ! return noOptionsLeft; if ((nextchar == null) || (nextchar.equals(""))) *************** *** 333,337 **** optind = first_nonopt; ! return '\1'; } --- 336,340 ---- optind = first_nonopt; ! return noOptionsLeft; } *************** *** 342,346 **** { if (ordering == REQUIRE_ORDER) ! return '\1'; optarg = argv[optind++]; --- 345,349 ---- { if (ordering == REQUIRE_ORDER) ! return noOptionsLeft; optarg = argv[optind++]; *************** *** 384,388 **** // Otherwise interpret it as a short option. if (!long_only || argv[optind].startsWith("--") ! || (optstring.indexOf((nextchar || "").charAt(0)) == -1)) { if (opterr) --- 387,391 ---- // Otherwise interpret it as a short option. if (!long_only || argv[optind].startsWith("--") ! || (optstring.indexOf(notNull(nextchar).charAt(0)) == -1)) { if (opterr) *************** *** 396,400 **** nextchar = ""; ++optind; ! optopt = '\0'; return '?'; } --- 399,403 ---- nextchar = ""; ++optind; ! optopt = undefinedOption; return '?'; } *************** *** 402,408 **** // Look at and handle the next short option-character */ ! char c = notNull(nextchar).charAt(0); //**** Do we need to check for empty str? ! if ((nextchar || "").length() > 1) ! nextchar = (nextchar || "").substring(1); else nextchar = ""; --- 405,411 ---- // Look at and handle the next short option-character */ ! char c = notNull(nextchar).charAt(0); ! if (notNull(nextchar).length() > 1) ! nextchar = notNull(nextchar).substring(1); else nextchar = ""; Index: options.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/options.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** options.nice 11 Jun 2003 12:21:27 -0000 1.6 --- options.nice 13 Jun 2003 18:15:35 -0000 1.7 *************** *** 50,54 **** String longName; String purpose; - char optval = '\0'; boolean visible; --- 50,53 ---- |
From: <bo...@us...> - 2003-06-13 14:58:05
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv15611/src/bossa/syntax Modified Files: LoopStmt.java ConstantExp.java Log Message: Optimize infinite loops by using an unconditional goto. This also allows to show the bytecode verifier that the loop indeed never terminates normally. Index: LoopStmt.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/LoopStmt.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** LoopStmt.java 12 Jun 2003 13:17:13 -0000 1.13 --- LoopStmt.java 13 Jun 2003 14:57:52 -0000 1.14 *************** *** 131,135 **** if (whileExp == null) ! test = new gnu.expr.QuoteExp(Boolean.TRUE); else test = whileExp.generateCode(); --- 131,135 ---- if (whileExp == null) ! test = gnu.expr.QuoteExp.trueExp; else test = whileExp.generateCode(); Index: ConstantExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ConstantExp.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ConstantExp.java 12 Jun 2003 21:04:40 -0000 1.42 --- ConstantExp.java 13 Jun 2003 14:57:53 -0000 1.43 *************** *** 16,19 **** --- 16,20 ---- import mlsub.typing.MonotypeConstructor; import mlsub.typing.Polytype; + import gnu.expr.QuoteExp; import bossa.util.*; *************** *** 48,51 **** --- 49,57 ---- } + ConstantExp(TypeConstructor tc, String representation, Location location) + { + this(tc, null, representation, location); + } + boolean isZero() { *************** *** 66,74 **** if(value == null) Internal.warning(this+"["+this.getClass()+" has no value"); - if (value instanceof VarSymbol) return ((VarSymbol)value).compile(); ! return new gnu.expr.QuoteExp(value, nice.tools.code.Types.javaType(type)); } --- 72,79 ---- if(value == null) Internal.warning(this+"["+this.getClass()+" has no value"); if (value instanceof VarSymbol) return ((VarSymbol)value).compile(); ! return new QuoteExp(value, nice.tools.code.Types.javaType(type)); } *************** *** 268,287 **** public static ConstantExp makeBoolean(boolean value, Location location) { ! if (value) ! return new ConstantExp(PrimitiveType.boolTC, Boolean.TRUE, ! "true", location); ! else ! return new ConstantExp(PrimitiveType.boolTC, Boolean.FALSE, ! "false", location); } ! boolean isFalse() { ! return value == Boolean.FALSE; ! } ! boolean isTrue() ! { ! return value == Boolean.TRUE; } --- 273,303 ---- public static ConstantExp makeBoolean(boolean value, Location location) { ! return new ConstantExp.Boolean(value, location); } ! private static class Boolean extends ConstantExp { ! Boolean(boolean value, Location location) ! { ! super(PrimitiveType.boolTC, value ? "true" : "false", location); ! compiledValue = value ? QuoteExp.trueExp : QuoteExp.falseExp; ! } ! boolean isFalse() ! { ! return compiledValue == QuoteExp.falseExp; ! } ! ! boolean isTrue() ! { ! return compiledValue == QuoteExp.trueExp; ! } ! ! protected gnu.expr.Expression compile() ! { ! return compiledValue; ! } ! ! private QuoteExp compiledValue; } |
From: <bo...@us...> - 2003-06-13 14:58:05
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1:/tmp/cvs-serv15611/src/gnu/expr Modified Files: LoopExp.java Log Message: Optimize infinite loops by using an unconditional goto. This also allows to show the bytecode verifier that the loop indeed never terminates normally. Index: LoopExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/LoopExp.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LoopExp.java 20 Mar 2003 14:58:24 -0000 1.8 --- LoopExp.java 13 Jun 2003 14:57:52 -0000 1.9 *************** *** 96,103 **** Branchable branchOp = ifExp.getBranchable(); if (branchOp != null) ! { ! branchOp.compileJump(comp, ((ApplyExp)ifExp).args, to); ! return; ! } // General case --- 96,109 ---- Branchable branchOp = ifExp.getBranchable(); if (branchOp != null) ! { ! branchOp.compileJump(comp, ((ApplyExp)ifExp).args, to); ! return; ! } ! ! if (whileExp == QuoteExp.trueExp) ! { ! comp.getCode().emitGoto(to); ! return; ! } // General case |
From: <bo...@us...> - 2003-06-13 14:57:55
|
Update of /cvsroot/nice/Nice/testsuite/compiler/functions In directory sc8-pr-cvs1:/tmp/cvs-serv15611/testsuite/compiler/functions Modified Files: return.testsuite Log Message: Optimize infinite loops by using an unconditional goto. This also allows to show the bytecode verifier that the loop indeed never terminates normally. Index: return.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/functions/return.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** return.testsuite 9 May 2003 11:31:40 -0000 1.2 --- return.testsuite 13 Jun 2003 14:57:51 -0000 1.3 *************** *** 1,6 **** ! /// PASS bug ///Toplevel String f(String b) { while (true) { try { return "f2(b)"; --- 1,19 ---- ! /// PASS ///Toplevel String f(String b) { while (true) { + try { + return "f2(b)"; + } catch(Exception e) { + // modify and try again + b = "adjust(b)"; + } + } + } + + /// PASS + ///Toplevel + String f(String b) { + for (;;) { try { return "f2(b)"; |
From: <bo...@us...> - 2003-06-12 21:29:59
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1:/tmp/cvs-serv24251/src/bossa/modules Modified Files: Package.java CompilationInterface.java Compilation.nice Log Message: The progress messages are now also sent to the compilation listener. The new development version is needed to bootstrap the compiler. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** Package.java 11 Jun 2003 22:24:08 -0000 1.89 --- Package.java 12 Jun 2003 21:29:54 -0000 1.90 *************** *** 119,124 **** Node.setModule(this); ! if (Debug.passes) ! Debug.println(this + ": parsing\n" + source); this.ast = new AST(this, source.getDefinitions(shouldReload)); --- 119,123 ---- Node.setModule(this); ! compilation.progress(this, "parsing"); this.ast = new AST(this, source.getDefinitions(shouldReload)); *************** *** 281,286 **** return; ! if (Debug.passes) ! Debug.println(this + ": typechecking"); ast.typechecking(); --- 280,284 ---- return; ! compilation.progress(this, "typechecking"); ast.typechecking(); *************** *** 295,300 **** if (compiling()) { ! if (Debug.passes) ! Debug.println(this + ": linking"); bossa.link.Dispatch.test(this); --- 293,297 ---- if (compiling()) { ! compilation.progress(this, "linking"); bossa.link.Dispatch.test(this); *************** *** 505,510 **** addedToArchive = true; ! if (Debug.passes) ! Debug.println(this + ": writing to archive"); String packagePrefix = getName().replace('.', '/') + "/"; --- 502,506 ---- addedToArchive = true; ! compilation.progress(this, "writing in archive"); String packagePrefix = getName().replace('.', '/') + "/"; *************** *** 646,651 **** private void generateCode() { ! if (compiling() && Debug.passes) ! Debug.println(this + ": generating code"); ast.compile(compiling()); --- 642,647 ---- private void generateCode() { ! if (compiling()) ! compilation.progress(this, "generating code"); ast.compile(compiling()); Index: CompilationInterface.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/CompilationInterface.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CompilationInterface.java 11 Jun 2003 22:24:08 -0000 1.1 --- CompilationInterface.java 12 Jun 2003 21:29:54 -0000 1.2 *************** *** 27,30 **** --- 27,32 ---- public abstract void warning(bossa.util.Location loc, String message); public abstract void exitIfErrors(); + + public abstract void progress(Package pkg, String phase); } Index: Compilation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Compilation.nice,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Compilation.nice 11 Jun 2003 22:24:08 -0000 1.21 --- Compilation.nice 12 Jun 2003 21:29:55 -0000 1.22 *************** *** 108,111 **** --- 108,116 ---- listener.warning(location, notNull(message)); } + + progress(pkg, phase) + { + listener.progress(notNull(pkg).getName(), notNull(phase)); + } } |
From: <bo...@us...> - 2003-06-12 21:29:59
|
Update of /cvsroot/nice/Nice/bin In directory sc8-pr-cvs1:/tmp/cvs-serv24251/bin Modified Files: nicec Log Message: The progress messages are now also sent to the compilation listener. The new development version is needed to bootstrap the compiler. Index: nicec =================================================================== RCS file: /cvsroot/nice/Nice/bin/nicec,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** nicec 11 Jun 2003 22:24:08 -0000 1.35 --- nicec 12 Jun 2003 21:29:55 -0000 1.36 *************** *** 79,85 **** fi - if [ "$nice_bootstrap" = true ]; then - exec ${java} nice.tools.compiler.fun ${system_args} "$@" - fi - exec ${java} nice.tools.compiler.console.fun ${system_args} "$@" --- 79,81 ---- |
From: <bo...@us...> - 2003-06-12 21:29:58
|
Update of /cvsroot/nice/Nice/src/mlsub/compilation In directory sc8-pr-cvs1:/tmp/cvs-serv24251/src/mlsub/compilation Modified Files: make.nice Log Message: The progress messages are now also sent to the compilation listener. The new development version is needed to bootstrap the compiler. Index: make.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/compilation/make.nice,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** make.nice 11 Jun 2003 22:24:07 -0000 1.21 --- make.nice 12 Jun 2003 21:29:53 -0000 1.22 *************** *** 24,31 **** boolean doLink) { - print("Compiling"); - modules.foreach(Module m => print(" "+m)); - println(""); - modules.foreach(Module m => m.scope()); modules.foreach(Module m => m.load()); --- 24,27 ---- |
From: <ar...@us...> - 2003-06-12 21:04:46
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv10643/F:/nice/src/bossa/syntax Modified Files: ConstantExp.java GlobalVarDeclaration.java NewExp.java Pattern.java Log Message: Implemented dispatch on global constants with a reference as value. Doesn't work yet with multiple packages!!! Index: ConstantExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ConstantExp.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** ConstantExp.java 5 Jun 2003 16:06:01 -0000 1.41 --- ConstantExp.java 12 Jun 2003 21:04:40 -0000 1.42 *************** *** 66,70 **** if(value == null) Internal.warning(this+"["+this.getClass()+" has no value"); ! return new gnu.expr.QuoteExp(value, nice.tools.code.Types.javaType(type)); } --- 66,73 ---- if(value == null) Internal.warning(this+"["+this.getClass()+" has no value"); ! ! if (value instanceof VarSymbol) ! return ((VarSymbol)value).compile(); ! return new gnu.expr.QuoteExp(value, nice.tools.code.Types.javaType(type)); } Index: GlobalVarDeclaration.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/GlobalVarDeclaration.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** GlobalVarDeclaration.java 12 Jun 2003 16:46:51 -0000 1.16 --- GlobalVarDeclaration.java 12 Jun 2003 21:04:40 -0000 1.17 *************** *** 78,81 **** --- 78,86 ---- return GlobalVarDeclaration.this.value; } + + Definition getDefinition() + { + return GlobalVarDeclaration.this; + } } Index: NewExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NewExp.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** NewExp.java 15 Nov 2002 13:49:51 -0000 1.34 --- NewExp.java 12 Jun 2003 21:04:40 -0000 1.35 *************** *** 85,88 **** private TypeIdent ti; ! private mlsub.typing.TypeConstructor tc; } --- 85,88 ---- private TypeIdent ti; ! mlsub.typing.TypeConstructor tc; } Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** Pattern.java 12 Jun 2003 16:46:52 -0000 1.53 --- Pattern.java 12 Jun 2003 21:04:41 -0000 1.54 *************** *** 127,131 **** } ! void resolveGlobalConstants(VarScope scope) { if (name != null && tc == null & typeConstructor == null) --- 127,131 ---- } ! void resolveGlobalConstants(VarScope scope, TypeScope typeScope) { if (name != null && tc == null & typeConstructor == null) *************** *** 139,157 **** } ! if (symbol != null && symbol.constant && ! symbol.getValue() instanceof ConstantExp) ! { ! ConstantExp val = (ConstantExp)symbol.getValue(); ! if (val.tc == PrimitiveType.floatTC) ! return; ! if (val instanceof StringConstantExp) ! this.typeConstructor = new TypeIdent( new LocatedString("java.lang.String", location)); ! this.tc = val.tc; ! name = null; ! atValue = val; } } --- 139,172 ---- } ! if (symbol != null && symbol.constant ) ! { ! if (symbol.getValue() instanceof ConstantExp) ! { ! ConstantExp val = (ConstantExp)symbol.getValue(); ! if (val.tc == PrimitiveType.floatTC) ! return; ! if (val instanceof StringConstantExp) ! typeConstructor = new TypeIdent( new LocatedString("java.lang.String", location)); ! tc = val.tc; ! name = null; ! atValue = val; ! } ! else if (symbol.getValue() instanceof NewExp) ! { ! NewExp val = (NewExp)symbol.getValue(); ! ! symbol.getDefinition().resolve(); ! if (val.tc != null) ! { ! tc = val.tc; ! atValue = new ConstantExp(null, tc, symbol, ! name.toString(), location); ! name = null; ! } ! } } } *************** *** 161,165 **** { for(int i = 0; i < patterns.length; i++) { ! patterns[i].resolveGlobalConstants(vscope); patterns[i].resolveTC(tscope); } --- 176,180 ---- { for(int i = 0; i < patterns.length; i++) { ! patterns[i].resolveGlobalConstants(vscope, tscope); patterns[i].resolveTC(tscope); } *************** *** 398,401 **** --- 413,419 ---- return "@" + (atValue.longValue() >= 0 ? "+" : "") + atValue; + if (atValue.value instanceof VarSymbol) + return "@=" + atValue; + return "@" + atValue; } *************** *** 450,453 **** --- 468,475 ---- return new Pattern(ConstantExp.makeString(new LocatedString( name.substring(1,name.length()-1), Location.nowhere()))); + + if (name.charAt(0) == '=') + return new Pattern(new LocatedString(name.substring(1), + Location.nowhere()), null); } *************** *** 500,503 **** --- 522,528 ---- return Gen.stringEquals((String)atValue.value, parameter); + if (atReference()) + return Gen.referenceEqualsExp(atValue.compile(), parameter); + gnu.bytecode.Type ct = Types.javaType(tc); if (exactlyAt) *************** *** 542,544 **** --- 567,573 ---- public boolean atFalse() { return atValue != null && atValue.isFalse(); } public boolean atString() { return atValue instanceof StringConstantExp; } + public boolean atReference() + { + return atValue != null && atValue.value instanceof VarSymbol; + } } |
From: <ar...@us...> - 2003-06-12 21:04:45
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv10643/F:/nice/testsuite/compiler/methods Modified Files: globalconstant.testsuite Log Message: Implemented dispatch on global constants with a reference as value. Doesn't work yet with multiple packages!!! Index: globalconstant.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/globalconstant.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** globalconstant.testsuite 12 Jun 2003 16:46:52 -0000 1.1 --- globalconstant.testsuite 12 Jun 2003 21:04:41 -0000 1.2 *************** *** 43,44 **** --- 43,77 ---- foo(s) = false; foo(abc) = true; + + /// PASS + assert(foo(xxx)); + /// Toplevel + class A {} + let A xxx = new A(); + let A yyy = new A(); + boolean foo(A); + foo(a) = false; + foo(xxx) = true; + foo(yyy) = false; + + /// PASS bug + /// package a + /// Toplevel + class A {} + let A xxx = new A(); + let A yyy = new A(); + boolean foo(A); + foo(a) = false; + foo(xxx) = true; + foo(yyy) = false; + /// package b import a + assert(foo(xxx)); + + /// FAIL + /// Toplevel + class A {} + let A xxx = new A(); + void foo(A); + foo(a) {} + foo(xxx) {} + foo(xxx) {} |
From: <ar...@us...> - 2003-06-12 21:04:45
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1:/tmp/cvs-serv10643/F:/nice/src/nice/tools/code Modified Files: Gen.java Log Message: Implemented dispatch on global constants with a reference as value. Doesn't work yet with multiple packages!!! Index: Gen.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Gen.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Gen.java 6 Jun 2003 11:26:30 -0000 1.14 --- Gen.java 12 Jun 2003 21:04:41 -0000 1.15 *************** *** 40,43 **** --- 40,50 ---- } + public static Expression referenceEqualsExp(Expression value1, + Expression value2) + { + return Inline.inline(nice.lang.inline.ReferenceOp.create("=="), value1, + value2); + } + public static Expression boolNotExp(Expression value) { |
From: <ar...@us...> - 2003-06-12 18:06:36
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1:/tmp/cvs-serv21924/F:/nice/src/bossa/link Modified Files: Dispatch.java Log Message: Limit the number of error's printed in one dispatch test. Index: Dispatch.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Dispatch.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** Dispatch.java 5 Jun 2003 16:06:05 -0000 1.54 --- Dispatch.java 12 Jun 2003 18:06:31 -0000 1.55 *************** *** 176,185 **** if (test(method, tags, sortedAlternatives, firstArg)) { ! if (++nb_errors > 9) break; } else if (hasValues && testValues(method, tags, values, isValue, sortedAlternatives) ) ! if (++nb_errors > 9) break; --- 176,185 ---- if (test(method, tags, sortedAlternatives, firstArg)) { ! if (++nb_errors > 3) break; } else if (hasValues && testValues(method, tags, values, isValue, sortedAlternatives) ) ! if (++nb_errors > 3) break; *************** *** 224,228 **** for(Iterator i = sortedAlternatives.iterator(); ! i.hasNext();) { Alternative a = (Alternative) i.next(); --- 224,228 ---- for(Iterator i = sortedAlternatives.iterator(); ! i.hasNext() && !failed;) { Alternative a = (Alternative) i.next(); *************** *** 290,294 **** Alternative first = null; ConstantExp[] values = (ConstantExp[]) valit.next(); ! for (Iterator i = sortedTypeMatches.iterator(); i.hasNext();) { Alternative a = (Alternative) i.next(); --- 290,294 ---- Alternative first = null; ConstantExp[] values = (ConstantExp[]) valit.next(); ! for (Iterator i = sortedTypeMatches.iterator(); i.hasNext() && !failed;) { Alternative a = (Alternative) i.next(); |
From: <ar...@us...> - 2003-06-12 17:23:06
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv4631/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Global constants and variables can have visibility modifiers. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.182 retrieving revision 1.183 diff -C2 -d -r1.182 -r1.183 *** Parser.jj 11 Jun 2003 14:52:24 -0000 1.182 --- Parser.jj 12 Jun 2003 17:22:56 -0000 1.183 *************** *** 1425,1428 **** --- 1425,1429 ---- } { + [ "public" | "private" ] ( "var" {constant = false;} *************** *** 1492,1495 **** --- 1493,1497 ---- { ( + LOOKAHEAD(2) res=globalVariable() | |
From: <ar...@us...> - 2003-06-12 16:46:55
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv21551/F:/nice/debian Modified Files: changelog Log Message: Implemented dispatch on global constants with a literal value. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.173 retrieving revision 1.174 diff -C2 -d -r1.173 -r1.174 *** changelog 11 Jun 2003 14:52:27 -0000 1.173 --- changelog 12 Jun 2003 16:46:52 -0000 1.174 *************** *** 15,20 **** * The 'char' type is no longer a subtype of int. The integer unicode representation of a character c can be obtained by int(c). ! * Bugfixes (Parsing of nested tuples, ...) ! -- --- 15,22 ---- * The 'char' type is no longer a subtype of int. The integer unicode representation of a character c can be obtained by int(c). ! * Added dispatch on global constants which value is a literal. ! * Bugfixes (Parsing of nested tuples, global constants of type char ...) ! * Improved some error messages. ! -- |
From: <ar...@us...> - 2003-06-12 16:46:55
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv21551/F:/nice/testsuite/compiler/methods Added Files: globalconstant.testsuite Log Message: Implemented dispatch on global constants with a literal value. --- NEW FILE: globalconstant.testsuite --- /// PASS /// Toplevel let int ONE = 1; let int TWO = 2; int fib(int n); fib(n@int) = fib(n-2) + fib(n-1); fib(ONE) = 1; fib(TWO) = 1; /// PASS assert(foo("abc")); /// Toplevel let String abc = "abc"; let String xyz = "xyz"; boolean foo(String); foo(s) = false; foo(abc) = true; foo(xyz) = false; /// FAIL /// Toplevel let int xxx = 10; void foo(int); foo(n) {} foo(xxx) {} foo(10) {} /// FAIL /// Toplevel var int xxx = 10; void foo(int); foo(n) {} foo(xxx) {} /// PASS assert(foo("abc")); /// Toplevel let String abc = "abc"; class A { String abc = ""; } boolean foo(String); foo(s) = false; foo(abc) = true; |
From: <ar...@us...> - 2003-06-12 16:46:55
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv21551/F:/nice/src/bossa/syntax Modified Files: GlobalVarDeclaration.java MethodBodyDefinition.java Pattern.java Log Message: Implemented dispatch on global constants with a literal value. Index: GlobalVarDeclaration.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/GlobalVarDeclaration.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** GlobalVarDeclaration.java 30 Apr 2003 19:39:03 -0000 1.15 --- GlobalVarDeclaration.java 12 Jun 2003 16:46:51 -0000 1.16 *************** *** 73,76 **** --- 73,81 ---- return res; } + + Expression getValue() + { + return GlobalVarDeclaration.this.value; + } } Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** MethodBodyDefinition.java 11 Jun 2003 22:24:07 -0000 1.125 --- MethodBodyDefinition.java 12 Jun 2003 16:46:51 -0000 1.126 *************** *** 257,261 **** //Resolution of the body is delayed to enable overloading ! Pattern.resolveTC(typeScope, formals); } --- 257,261 ---- //Resolution of the body is delayed to enable overloading ! Pattern.resolve(typeScope, getGlobalScope(), formals); } Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** Pattern.java 6 Jun 2003 10:16:04 -0000 1.52 --- Pattern.java 12 Jun 2003 16:46:52 -0000 1.53 *************** *** 126,134 **** patternType = new MonotypeConstructor(tc, def.getTypeParameters()); } ! ! static void resolveTC(TypeScope scope, Pattern[] patterns) { ! for(int i = 0; i < patterns.length; i++) ! patterns[i].resolveTC(scope); } --- 126,167 ---- patternType = new MonotypeConstructor(tc, def.getTypeParameters()); } ! ! void resolveGlobalConstants(VarScope scope) { ! if (name != null && tc == null & typeConstructor == null) ! { ! GlobalVarDeclaration.GlobalVarSymbol symbol = null; ! for (Iterator it = scope.lookup(name).iterator(); it.hasNext();) ! { ! Object sym = it.next(); ! if (sym instanceof GlobalVarDeclaration.GlobalVarSymbol) ! symbol = (GlobalVarDeclaration.GlobalVarSymbol)sym; ! } ! ! if (symbol != null && symbol.constant && ! symbol.getValue() instanceof ConstantExp) ! { ! ConstantExp val = (ConstantExp)symbol.getValue(); ! ! if (val.tc == PrimitiveType.floatTC) ! return; ! ! if (val instanceof StringConstantExp) ! this.typeConstructor = new TypeIdent( ! new LocatedString("java.lang.String", location)); ! ! this.tc = val.tc; ! name = null; ! atValue = val; ! } ! } ! } ! ! static void resolve(TypeScope tscope, VarScope vscope, Pattern[] patterns) ! { ! for(int i = 0; i < patterns.length; i++) { ! patterns[i].resolveGlobalConstants(vscope); ! patterns[i].resolveTC(tscope); ! } } |
From: <xo...@us...> - 2003-06-12 16:43:05
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv19747 Modified Files: manual.xml Log Message: Added a section on the new for(x y: z) {} syntax Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** manual.xml 11 Jun 2003 19:05:19 -0000 1.21 --- manual.xml 12 Jun 2003 16:43:01 -0000 1.22 *************** *** 767,770 **** --- 767,801 ---- </para> </section> + <section id="forStatements"><title>Extended <literal>for</literal> statement</title> + <para> + Nice supports the traditional <literal>for</literal> loop, with the same + syntax as in Java. In addition, it provides a form that allows iterating + over the items in a sequence like C#'s <literal>foreach</literal>. + Here is the syntax: + </para> + <para> + <literal>for ( + <replaceable>item-type</replaceable> + <replaceable>variable-name</replaceable> : + <replaceable>container</replaceable> ) { <replaceable>body</replaceable> } + </literal> + </para> + <para> + Currently, this version of the <literal>for</literal> statement can be + used to iterate over <literal>Collection</literal>s, arrays, + <literal>String</literal>s, and <literal>StringBuffer</literal>s. + </para> + <para> + <example><title>Extended <literal>for</literal> statement</title> + <programlisting lang="nice"> + let String[] strings = ["one", "two", "three"]; + for(String s : strings) + { + println(s); + } + </programlisting> + </example> + </para> + </section> <section id="localFunctions"><title>Local functions</title> <para> |
From: <ar...@us...> - 2003-06-12 13:17:17
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv7431/F:/nice/src/bossa/syntax Modified Files: LoopStmt.java Log Message: Changed internals of 'for in' statements so that normal iterators are used. Index: LoopStmt.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/LoopStmt.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** LoopStmt.java 9 May 2003 13:17:03 -0000 1.12 --- LoopStmt.java 12 Jun 2003 13:17:13 -0000 1.13 *************** *** 51,63 **** List tparams = new ArrayList(1); tparams.add(vartype); ! itertype = new MonotypeConstructor(new TypeIdent(new LocatedString("ForInIterator", loc)), new TypeParameters(tparams), loc); itertype.nullness = Monotype.sure; ! getiter = CallExp.create(new IdentExp(new LocatedString("forInIterator", loc)), container); iter = new LocatedString("for_in_iter", loc); init = new Block.LocalVariable(iter, itertype, true, getiter); iterexp = new IdentExp(iter); ! cond = CallExp.create(new IdentExp(new LocatedString("next", loc)), iterexp); ! getvar = CallExp.create(new IdentExp(new LocatedString("current", loc)), iterexp); assign = new Block.LocalVariable(var, vartype, false, getvar); List loopbody = new LinkedList(); --- 51,63 ---- List tparams = new ArrayList(1); tparams.add(vartype); ! itertype = new MonotypeConstructor(new TypeIdent(new LocatedString("Iterator", loc)), new TypeParameters(tparams), loc); itertype.nullness = Monotype.sure; ! getiter = CallExp.create(new IdentExp(new LocatedString("forIterator", loc)), container); iter = new LocatedString("for_in_iter", loc); init = new Block.LocalVariable(iter, itertype, true, getiter); iterexp = new IdentExp(iter); ! cond = CallExp.create(new IdentExp(new LocatedString("hasNext", loc)), iterexp); ! getvar = CallExp.create(new IdentExp(new LocatedString("next", loc)), iterexp); assign = new Block.LocalVariable(var, vartype, false, getvar); List loopbody = new LinkedList(); |
From: <ar...@us...> - 2003-06-12 13:17:17
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv7431/F:/nice/stdlib/nice/lang Modified Files: ForInIters.nice Log Message: Changed internals of 'for in' statements so that normal iterators are used. Index: ForInIters.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/ForInIters.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ForInIters.nice 28 May 2003 11:20:14 -0000 1.2 --- ForInIters.nice 12 Jun 2003 13:17:12 -0000 1.3 *************** *** 1,48 **** package nice.lang; ! //the interface used in for in ! public interface ForInIterator<E> { ! boolean next(); ! E current(); ! } ! ! //Methods that returns a ForInIterator interface for iteration over a particular class. ! //If a "for in" is wanted for another class is could easily be added. ! ! <E> ForInIterator<E> forInIterator(Collection<E> c) = new CollectionForInIter(iter: c.iterator()); ! <E> ForInIterator<E> forInIterator(E[] arr) = new ArrayForInIter(arr: arr); ! ForInIterator<char> forInIterator(String s) = new StringForInIter(str: s); ! ForInIterator<char> forInIterator(StringBuffer sb) = new StringBufferForInIter(strb: sb); ! ! //temporaly left out because of retyping ! //<K, V> Set<K> keySet(Map<K,V>) = native Set Map.keySet(); ! //<K,V> ForInIterator<K> forInIterator(Map<K ,V> m) = new CollectionForInIter(iter: m.keySet().iterator()); ! //The implementations of specific ForInIterators ! private class CollectionForInIter<E> implements ForInIterator<E>{ ! Iterator<E> iter; ! next() = iter.hasNext(); ! current() = iter.next(); ! } ! private class ArrayForInIter<E> implements ForInIterator<E>{ E[] arr; ! int pos = -1; ! next() = ++pos<arr.length; ! current() = arr[pos]; } ! private class StringForInIter<E | E <: char, char <: E> implements ForInIterator<E>{ String str; ! int pos = -1; ! next() = ++pos<str.length(); ! current() = str.charAt(pos); } ! private class StringBufferForInIter<E | E <: char, char <: E> implements ForInIterator<E>{ StringBuffer strb; ! int pos = -1; ! next() = ++pos<strb.length(); ! current() = strb.charAt(pos); } --- 1,35 ---- package nice.lang; ! //Methods that returns a Iterator interface. ! //If a "for in" is wanted for another class then they could be added easily. ! <E> Iterator<E> forIterator(Collection<E> c) = c.iterator(); ! <E> Iterator<E> forIterator(E[] arr) = new ArrayForIterator(arr: arr); ! Iterator<char> forIterator(String s) = new StringForIterator(str: s); ! Iterator<char> forIterator(StringBuffer sb) = new StringBufferForIterator(strb: sb); ! //The implementations of additional Iterators ! private class ArrayForIterator<E> implements Iterator<E> { E[] arr; ! int pos = 0; ! hasNext() = pos < arr.length; ! next() = arr[pos++]; ! remove() { throw new UnsupportedOperationException(); } } ! private class StringForIterator<E | E <: char, char <: E> implements Iterator<E> { String str; ! int pos = 0; ! hasNext() = pos < str.length(); ! next() = str.charAt(pos++); ! remove() { throw new UnsupportedOperationException(); } } ! private class StringBufferForIterator<E | E <: char, char <: E> implements Iterator<E> { StringBuffer strb; ! int pos = 0; ! hasNext() = pos < strb.length(); ! next() = strb.charAt(pos++); ! remove() { throw new UnsupportedOperationException(); } } |
From: <bo...@us...> - 2003-06-11 22:38:17
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv27371/src/nice/tools/compiler Modified Files: setBuildDate Log Message: Version number and build dates are constants. Index: setBuildDate =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/setBuildDate,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** setBuildDate 12 Mar 2003 15:50:04 -0000 1.7 --- setBuildDate 11 Jun 2003 22:38:14 -0000 1.8 *************** *** 9,12 **** echo > dateBuild.nice echo "package nice.tools.compiler;" >> dateBuild.nice ! echo "var String versionNumber = \"$version\";" >> dateBuild.nice ! echo "var String buildDate = \""`date -u +"%Y.%m.%d, %T %Z"`"\";" >> dateBuild.nice --- 9,12 ---- echo > dateBuild.nice echo "package nice.tools.compiler;" >> dateBuild.nice ! echo "let String versionNumber = \"$version\";" >> dateBuild.nice ! echo "let String buildDate = \""`date -u +"%Y.%m.%d, %T %Z"`"\";" >> dateBuild.nice |
From: <bo...@us...> - 2003-06-11 22:36:59
|
Update of /cvsroot/nice/Nice/src/nice/tools In directory sc8-pr-cvs1:/tmp/cvs-serv26860/src/nice/tools Modified Files: .cvsignore Log Message: Added the compilation listener interface. Console output is factored out in package nice.tools.compiler.console Index: .cvsignore =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 24 Sep 2001 17:38:01 -0000 1.1 --- .cvsignore 11 Jun 2003 22:36:56 -0000 1.2 *************** *** 1,2 **** - .compiler.jar - compiler.jar --- 0 ---- |
From: <bo...@us...> - 2003-06-11 22:36:59
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv26860/src/nice/tools/compiler Removed Files: main.nice OutputMessages.java Log Message: Added the compilation listener interface. Console output is factored out in package nice.tools.compiler.console --- main.nice DELETED --- --- OutputMessages.java DELETED --- |
From: <bo...@us...> - 2003-06-11 22:35:13
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv26066/src/nice/tools/compiler Modified Files: .cvsignore Log Message: Added the compilation listener interface. Console output is factored out in package nice.tools.compiler.console Index: .cvsignore =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 24 Sep 2001 17:38:06 -0000 1.1 --- .cvsignore 11 Jun 2003 22:35:08 -0000 1.2 *************** *** 1 **** --- 1,2 ---- + console.jar dateBuild.nice |