nice-commit Mailing List for The Nice Programming Language (Page 57)
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-18 16:57:21
|
Update of /cvsroot/nice/Nice/src/nice/tools/ant In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13574/src/nice/tools/ant Added Files: TestListener.nice NiceUnit.java Log Message: Ant support for NiceUnit. --- NEW FILE: TestListener.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.tools.ant; import nice.tools.unit; import org.apache.tools.ant.*; /** Listener for NiceUnit that reports to Ant. @author Daniel Bonniot (bo...@us...) */ class TestListener implements nice.tools.unit.TestListener { org.apache.tools.ant.Task task; private int failures = 0; private int tests = 0; start(test) { task.log("Running " + test, Project.MSG_VERBOSE); } end(test) { tests++; task.log("Finished " + test, Project.MSG_DEBUG); } failure(test, cause) { failures++; task.log("Test failed:\n " + cause); let couldPrint = iterLocations (test, cause, (?String file, String method, int line) => println("Location: " + file + " method " + method + (line < 0 ? "" : " line " + line))); if (! couldPrint) cause.printStackTrace(); } void printSummary() { if (failures > 0) throw new BuildException(""failures" tests failed", task.getLocation); task.log("Unit testing done: "tests" tests successful", Project.MSG_INFO); } } --- NEW FILE: NiceUnit.java --- /**************************************************************************/ /* 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.tools.ant; import org.apache.tools.ant.*; import org.apache.tools.ant.types.*; import java.io.File; import java.util.Vector; import bossa.modules.Compilation; /** <h2><a name="java">NiceUnit</a></h2> <h3>Description</h3> <p>Runs unit tests for a Nice package.</p> All arguments to the NiceUnit task have to be placed as attributes in the niceunit xml-element. <h3>Parameters</h3> <table border="1" cellpadding="2" cellspacing="0"> <tr> <td valign="top"><b>Attribute</b></td> <td valign="top"><b>Description</b></td> <td align="center" valign="top"><b>Required</b></td> </tr> <tr> <td valign="top">package</td> <td valign="top">The Nice package to test.</td> <td align="center" valign="top">Yes</td> </tr> <tr> <td valign="top">classpath</td> <td valign="top">Search path for compiled packages and libraries.</td> <td align="center" valign="top">No</td> </tr> </table> <h4>classpath</h4> <p><code>NiceUnit</code>'s <i>classpath</i> attribute is a PATH like structure and can also be set via a nested <i>classpath</i> element. This is very reasonable if you want to make your build script's pathes platform independent. </p> <h5>Example</h5> <pre> <niceunit package="test" > <classpath> <pathelement location="\test.jar"/> <pathelement path="${java.class.path}"/> </classpath> </niceunit> </pre> <p>It is possible to use the <i>classpath</i> attribute together with the <i>classpath<i> nested tag. In this case the result is a concatenated path.</p> <p>It is highly recommended to use the nested version!<p> <h3>Examples</h3> <pre> <taskdef name="niceunit" classname="nice.tools.ant.NiceUnit"/> <target name="nice-tests"> <niceunit package="test" /> </target> </pre> * @author Daniel Bonniot */ public class NiceUnit extends Task { /** Search path for compiled packages and libraries. */ private String classpath = ""; public void setClasspath(String classpath) { this.classpath = classpath; } /** Location of nice.jar */ private String runtime = null; public void setRuntime(String runtime) { this.runtime = runtime; } /** The package to test. */ private String pack; public void setPackage(String pack) { this.pack = pack; } private Path nestedClasspath = null; /** * Creates a nested classpath element */ public Path createClasspath() { nestedClasspath = new Path(project); return nestedClasspath.createPath(); } /** Executes niceunit. */ public void execute() throws BuildException { String oldUserDir = System.getProperty("user.dir"); try { System.setProperty("user.dir", project.getBaseDir().getAbsolutePath()); TestListener listener = new TestListener(this); String classpath = this.classpath + (nestedClasspath != null ? File.pathSeparator+nestedClasspath : ""); if (! nice.tools.unit.fun.runTests(pack, listener, classpath)) throw new BuildException("Package " + pack + " was not found"); dispatch.printSummary(listener); } finally { System.setProperty("user.dir", oldUserDir); } } } // Setting for Emacs // Local variables: // tab-width:2 // indent-tabs-mode:t // End: |
From: <bo...@us...> - 2004-02-18 16:43:12
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10457 Modified Files: Makefile Log Message: Added NiceUnit. Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/Makefile,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** Makefile 17 Feb 2004 12:13:03 -0000 1.137 --- Makefile 18 Feb 2004 16:33:25 -0000 1.138 *************** *** 45,52 **** stable: clean bootstrap compiler1 testengine archiveOld ! complete: stable compiler2 nicedoc ant archive2 fixpoint: complete compiler3 archive3 world: fixpoint check test # The bootstrap at the end of the universe ;-) universe: --- 45,54 ---- stable: clean bootstrap compiler1 testengine archiveOld ! complete: stable compiler2 tools archive2 fixpoint: complete compiler3 archive3 world: fixpoint check test + tools: nicedoc unit ant + # The bootstrap at the end of the universe ;-) universe: *************** *** 164,167 **** --- 166,170 ---- bootstrap: parser mkdir -p classes classes-inline + ln -sf nicec bin/nicedoc; ln -sf nicec bin/niceunit -cd src/bossa/syntax && mv -f dispatch.java.bootstrap dispatch.java ${JAVAC} \ *************** *** 192,195 **** --- 195,199 ---- ant: @echo "Building the Ant task definition..." + $(NICEC1) --classpath "${ANT_CLASSPATH}" nice.tools.ant @${javac} -sourcepath src -classpath "${ANT_CLASSPATH}:./classes:./classes.old" -d classes src/nice/tools/ant/*.java ||\ echo -e "Compilation of the Ant task definition failed.\n NICE_ANTJAR or ANT_HOME should be set, Ant should be in the CLASSPATH or at least linked to by ./external/ant.jar" *************** *** 199,202 **** --- 203,210 ---- $(NICEC1) nice.tools.doc + unit: + @echo "Building niceunit..." + $(NICEC1) nice.tools.unit.console + testengine: @echo "Building the testsuite engine..." |
From: <bo...@us...> - 2004-02-18 16:43:12
|
Update of /cvsroot/nice/Nice/src/nice/tools/unit/console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10457/src/nice/tools/unit/console Added Files: main.nice Log Message: Added NiceUnit. --- NEW FILE: main.nice --- package nice.tools.unit.console; import nice.tools.unit; import nice.doc; void main(String[] args) { Program prg = new Program (name: "niceunit", longName: "The Nice unit test runner", shortDescription: "Runs unit tests written in the Nice programming language", author: "Daniel Bonniot <bo...@us...>", seeAlso: "http://nice.sourceforge.net the Nice Home Page\n", manualSection: "1", arguments: "package", options: cast(null)); ?String classpath = null; prg.options = [ option("classpath", "Search path for compiled packages to be tested\nPATH is a list of directories and .jar archives", "path", String path => { classpath = path; }) ]; List<String> rest = parse(prg, args); if (rest.size() == 0) prg.usage(); rest.foreach(String pkg => { if (! runTests(pkg, listener, classpath)) System.err.println("Package "pkg" was not found"); }); } let Listener listener = new Listener(); class Listener implements TestListener { start(test) = println(test); end(test) {} failure(test, cause) { println("Test failed:\n " + cause); if (!(iterLocations(test, cause, (?String file, String method, int line) => println("Location: " + file + " method " + method + (line < 0 ? "" : " line " + line))))) cause.printStackTrace(); } } |
From: <bo...@us...> - 2004-02-18 16:43:12
|
Update of /cvsroot/nice/Nice/src/nice/tools/unit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10457/src/nice/tools/unit Added Files: listener.nice api.nice Log Message: Added NiceUnit. --- NEW FILE: listener.nice --- package nice.tools.unit; interface TestListener { void start(String test); void end(String test); void failure(String test, Throwable cause); } --- NEW FILE: api.nice --- package nice.tools.unit; import java.lang.reflect.*; public boolean runTests(String packageName, TestListener listener, ?String classpath = null) { let classloader = classpath == null ? ClassLoader.getSystemClassLoader() : classloaderFromClasspath(notNull(classpath)); nice.tools.util.JDK.setDefaultAssertionStatus(classloader, true); var Class packageClass; try { packageClass = classloader.loadClass(packageName + ".fun"); } catch(ClassNotFoundException ex) { return false; } runTests(packageClass, listener); return true; } public void runTests(Class packageClass, TestListener listener) { Method[] methods = packageClass.getDeclaredMethods(); methods.filter(isTestMethod).foreach(Method m => runTestMethod(m, listener)); } public boolean iterLocations (String testName, Throwable t, (?String, String, int)->void handleLocation) { let stack = nice.tools.util.JDK.getStackTrace(t); if (stack == null) return false; for (Object stackTraceElement : stack) { String file = nice.tools.util.JDK.stackFileName(stackTraceElement); String method = nice.tools.util.JDK.stackMethodName(stackTraceElement); String className = nice.tools.util.JDK.stackClassName(stackTraceElement); int lineNumber = nice.tools.util.JDK.stackLineNumber(stackTraceElement); handleLocation(file, method, lineNumber); // We stop when we reach the start of the test. Going deeper // only shows the internals of the test engine, which are not // relevant. if ((className + "." + method).equals(testName)) return true; } return false; } boolean isTestMethod(Method m) = m.getName().startsWith("_test") && m.getParameterTypes().length == 0; void runTestMethod(Method m, TestListener listener) { let name = m.getDeclaringClass().getName() + "." + m.getName(); listener.start(name); try { m.invoke(null, null); } catch (InvocationTargetException e) { let cause = e.getTargetException(); listener.failure(name, cause); } finally { listener.end(name); } } String replaceLast(String source, char c, String by) { let index = source.lastIndexOf(c); if (index == -1) return source; StringBuffer res = new StringBuffer(source.length() + by.length() - 1); res.append(source.substring(0, index)); res.append(by); res.append(source.substring(index + 1)); return res.toString(); } ClassLoader classloaderFromClasspath(String classpath) { LinkedList<java.net.URL> components = new LinkedList(); int start = 0; // skip starting separators while (start<classpath.length() && classpath.charAt(start) == java.io.File.pathSeparatorChar) start++; while (start<classpath.length()) { int end = classpath.indexOf(java.io.File.pathSeparatorChar, start); if (end == -1) end = classpath.length(); String pathComponent = classpath.substring(start, end); if (pathComponent.length() > 0) try{ java.io.File f = new java.io.File(pathComponent); if (f.canRead()) components.add(f.getCanonicalFile().toURL()); else { if (!f.exists()) System.err.println("Classpath component " + pathComponent + " does not exist"); else System.err.println("Classpath component " + pathComponent + " is not readable"); } } catch(java.net.MalformedURLException e){ System.err.println("Classpath component " + pathComponent + " is invalid"); } catch(java.io.IOException e){ System.err.println("Classpath component " + pathComponent + " is invalid"); } start = end + 1; } return new java.net.URLClassLoader(components.toArray(), /* no parent */ null); } |
From: <bo...@us...> - 2004-02-18 16:43:09
|
Update of /cvsroot/nice/Nice/src/nice/tools/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10457/src/nice/tools/util Modified Files: JDK.java Log Message: Added NiceUnit. Index: JDK.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/util/JDK.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JDK.java 17 Feb 2004 12:13:02 -0000 1.1 --- JDK.java 18 Feb 2004 16:33:22 -0000 1.2 *************** *** 53,55 **** --- 53,133 ---- return res.toString(); } + + /** Replacement for ClassLoader.setDefaultAssertionStatus(boolean) */ + public static void setDefaultAssertionStatus + (java.lang.ClassLoader loader, boolean st) + throws java.lang.reflect.InvocationTargetException + { + try { + // JDK 1.4+ + java.lang.ClassLoader.class.getDeclaredMethod + ("setDefaultAssertionStatus", new Class[]{ Boolean.TYPE }). + invoke(loader, new Object[]{ new Boolean(st) }); + } + catch(NoSuchMethodException e) { + // Under earlier versions, Nice-generated assertions are controlled + // by the 'assertions' property. + java.lang.System.setProperty("assertions", new Boolean(st).toString()); + } + catch(IllegalAccessException e) { + throw new Error("ClassLoader.setDefaultAssertionStatus must be public"); + } + } + + /** Replacement for Throwable.getStackTrace() + @return null if that feature is not available. + */ + public static Object[] getStackTrace(Throwable t) + throws java.lang.reflect.InvocationTargetException + { + try { + return (Object[]) + Throwable.class.getMethod("getStackTrace", null).invoke(t, null); + } + catch (NoSuchMethodException e) { + return null; + } + catch(IllegalAccessException e) { + throw new Error("Throwable.getStackTrace must be public"); + } + } + + private static Object call(Object o, String method) + throws java.lang.reflect.InvocationTargetException + { + try { + return o.getClass().getDeclaredMethod(method, null).invoke(o, null); + } + catch (NoSuchMethodException e) { + return null; + } + catch(IllegalAccessException e) { + throw new Error("" + o.getClass() + "." + method + " must be public"); + } + } + + public static String stackFileName(Object stackTraceElement) + throws java.lang.reflect.InvocationTargetException + { + return (String) call(stackTraceElement, "getFileName"); + } + + public static String stackMethodName(Object stackTraceElement) + throws java.lang.reflect.InvocationTargetException + { + return (String) call(stackTraceElement, "getMethodName"); + } + + public static String stackClassName(Object stackTraceElement) + throws java.lang.reflect.InvocationTargetException + { + return (String) call(stackTraceElement, "getClassName"); + } + + public static int stackLineNumber(Object stackTraceElement) + throws java.lang.reflect.InvocationTargetException + { + return ((Integer) call(stackTraceElement, "getLineNumber")).intValue(); + } + } |
From: <bo...@us...> - 2004-02-18 16:03:58
|
Update of /cvsroot/nice/Nice/src/nice/tools/unit/console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2462/src/nice/tools/unit/console Log Message: Directory /cvsroot/nice/Nice/src/nice/tools/unit/console added to the repository |
From: <bo...@us...> - 2004-02-18 16:00:51
|
Update of /cvsroot/nice/Nice/src/nice/tools/unit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1834/src/nice/tools/unit Log Message: Directory /cvsroot/nice/Nice/src/nice/tools/unit added to the repository |
From: <bo...@us...> - 2004-02-18 15:40:54
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29799/testsuite/compiler/expressions Modified Files: expressionlocalvariable.testsuite Log Message: Allow expression-local variables without keywords but with a type specifier. Index: expressionlocalvariable.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/expressionlocalvariable.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** expressionlocalvariable.testsuite 3 Feb 2004 01:28:10 -0000 1.2 --- expressionlocalvariable.testsuite 18 Feb 2004 15:31:10 -0000 1.3 *************** *** 46,47 **** --- 46,52 ---- assert z == 40; } + + /// PASS + int foo(int a, int b, int c) = a + b + c; + + assert foo(int x = 1, int y = x + 1, y + 1) == 6; |
From: <bo...@us...> - 2004-02-18 15:40:54
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29799/src/bossa/parser Modified Files: Parser.jj Log Message: Allow expression-local variables without keywords but with a type specifier. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.237 retrieving revision 1.238 diff -C2 -d -r1.237 -r1.238 *** Parser.jj 5 Feb 2004 22:59:54 -0000 1.237 --- Parser.jj 18 Feb 2004 15:31:10 -0000 1.238 *************** *** 2270,2274 **** } { ! ( "var" | "let" {constant = true;} ) [LOOKAHEAD(monotype() ident()) type=monotype() ] name=ident() --- 2270,2274 ---- } { ! [ "var" | "let" {constant = true;} ] [LOOKAHEAD(monotype() ident()) type=monotype() ] name=ident() *************** *** 2285,2292 **** { ( [ LOOKAHEAD(ident() ":") id = ident() ":" ] e = Expression() - | - e = ExpLocalVariable() ) { return new Arguments.Argument(e, id); } --- 2285,2293 ---- { ( + LOOKAHEAD( "let" | "var" | (monotype() ident() "=") ) + e = ExpLocalVariable() + | [ LOOKAHEAD(ident() ":") id = ident() ":" ] e = Expression() ) { return new Arguments.Argument(e, id); } |
From: <bo...@us...> - 2004-02-18 12:00:30
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20126/bossa/syntax Modified Files: tools.nice dispatch.java.bootstrap Log Message: Uses consistent names for the printStackTraceWithSourceInfo during the two phases of bootstrap. Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tools.nice 16 Feb 2004 17:19:31 -0000 1.30 --- tools.nice 18 Feb 2004 11:50:54 -0000 1.31 *************** *** 137,141 **** // For bootstrap ! void bootstrapPrintStackTraceWithSourceInfo(Throwable t) = printStackTraceWithSourceInfo(t); --- 137,141 ---- // For bootstrap ! void _printStackTraceWithSourceInfo(Throwable t) = printStackTraceWithSourceInfo(t); Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dispatch.java.bootstrap 16 Feb 2004 17:19:32 -0000 1.11 --- dispatch.java.bootstrap 18 Feb 2004 11:50:54 -0000 1.12 *************** *** 36,40 **** { return null; } ! public static void printStackTraceWithSourceInfo(Throwable t) {} } --- 36,40 ---- { return null; } ! public static void _printStackTraceWithSourceInfo(Throwable t) {} } |
From: <bo...@us...> - 2004-02-18 12:00:30
|
Update of /cvsroot/nice/Nice/src/bossa/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20126/bossa/util Modified Files: Internal.java Log Message: Uses consistent names for the printStackTraceWithSourceInfo during the two phases of bootstrap. Index: Internal.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/util/Internal.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Internal.java 16 Feb 2004 17:19:27 -0000 1.27 --- Internal.java 18 Feb 2004 11:50:54 -0000 1.28 *************** *** 30,34 **** } catch(Exception e){ ! bossa.syntax.dispatch.printStackTraceWithSourceInfo(e); } } --- 30,34 ---- } catch(Exception e){ ! bossa.syntax.dispatch._printStackTraceWithSourceInfo(e); } } |
From: <bo...@us...> - 2004-02-17 12:21:53
|
Update of /cvsroot/nice/Nice/src/nice/tools/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5762/src/nice/tools/doc Modified Files: htmlwriter.nice Log Message: Implement String.replaceAll(String,String) so that we do not require JDK 1.4 to run nicedoc. Index: htmlwriter.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/doc/htmlwriter.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** htmlwriter.nice 13 Feb 2004 16:15:44 -0000 1.2 --- htmlwriter.nice 17 Feb 2004 12:13:02 -0000 1.3 *************** *** 206,210 **** */ String htmlSafe(String s) { ! return s.replaceAll("<", "<").replaceAll(">", ">"); } --- 206,212 ---- */ String htmlSafe(String s) { ! return ! nice.tools.util.JDK.replaceAll ! (nice.tools.util.JDK.replaceAll(s, "<", "<"), ">", ">"); } |
From: <bo...@us...> - 2004-02-17 12:21:53
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5762 Modified Files: Makefile Log Message: Implement String.replaceAll(String,String) so that we do not require JDK 1.4 to run nicedoc. Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/Makefile,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** Makefile 14 Feb 2004 01:59:05 -0000 1.136 --- Makefile 17 Feb 2004 12:13:03 -0000 1.137 *************** *** 170,175 **** src/bossa/modules/Package.java src/bossa/util/*.java \ src/gnu/expr/*.java src/gnu/mapping/*.java \ ! src/nice/tools/code/*.java src/mlsub/typing/*.java \ ! src/mlsub/typing/lowlevel/*.java src/bossa/syntax/dispatch.java $(JAVAC_GENERIC) -d classes-inline stdlib/nice/lang/inline/*.java cp -a classes-inline/* classes --- 170,176 ---- src/bossa/modules/Package.java src/bossa/util/*.java \ src/gnu/expr/*.java src/gnu/mapping/*.java \ ! src/nice/tools/{code/*.java,util/JDK.java} \ ! src/mlsub/typing/{*.java,lowlevel/*.java} \ ! src/bossa/syntax/dispatch.java $(JAVAC_GENERIC) -d classes-inline stdlib/nice/lang/inline/*.java cp -a classes-inline/* classes |
From: <bo...@us...> - 2004-02-17 12:21:52
|
Update of /cvsroot/nice/Nice/src/nice/tools/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5762/src/nice/tools/util Added Files: JDK.java Log Message: Implement String.replaceAll(String,String) so that we do not require JDK 1.4 to run nicedoc. --- NEW FILE: JDK.java --- /**************************************************************************/ /* 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.tools.util; /** Implementations of features that were introduced in recent JDKs (1.4 and later). We don't want to call them directly, as this would break compatibility with JDK 1.3, but we implement replacements here. If we decide to raise the requirements, we can simply delete these methods and replace them with the JDK implementation. @author Daniel Bonniot (bo...@us...) */ public class JDK { /* JDK 1.4 */ /** Replacement for String.replaceAll(String,String) */ public static String replaceAll(String source, String what, String with) { int index = source.indexOf(what); if (index == -1) return source; int len = what.length(); int last = 0; StringBuffer res = new StringBuffer(source.length() * 2); while (index != -1) { res.append(source.substring(last, index)); res.append(with); last = index + len; index = source.indexOf(what, last); } res.append(source.substring(last)); return res.toString(); } } |
From: <bo...@us...> - 2004-02-16 23:17:45
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29970 Modified Files: NEWS Log Message: Catch exceptions in main, and print the stack trace with the correct source-level information. Utility methods in nice.lang to print "Nice" stack traces. Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** NEWS 9 Feb 2004 11:42:57 -0000 1.20 --- NEWS 16 Feb 2004 23:09:15 -0000 1.21 *************** *** 14,17 **** --- 14,23 ---- * New methods (in package nice.functional) for working with iterators and generators. + * Applications that stop because of an uncaught exception will now + print a stack trace the include correct Nice source files and line numbers. + Applications that need to print a stack trace can do so by using + printStackTraceWithSourceInfo(e) (defined in nice.lang) instead of + e.printStackTrace(), and similarly for versions that specify a stream + or writer to print into. * Fixed the file locations in the RPM package, and added automatic registration of the emacs mode for the SuSE Linux distribution. |
From: <bo...@us...> - 2004-02-16 21:55:38
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12009/src/bossa/syntax Modified Files: NiceMethod.java Log Message: Catch exceptions in main, and print the stack trace with the correct source-level information. Index: NiceMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceMethod.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** NiceMethod.java 15 Nov 2003 17:25:47 -0000 1.26 --- NiceMethod.java 16 Feb 2004 21:47:11 -0000 1.27 *************** *** 140,143 **** --- 140,151 ---- } + public boolean isMain() + { + if (! (name.toString().equals("main") && arity == 1)) + return false; + + return getType().domain()[0].toString().equals("java.lang.String[]"); + } + /**************************************************************** * Code generation |
From: <bo...@us...> - 2004-02-16 21:55:38
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12009/src/bossa/modules Modified Files: Package.java Log Message: Catch exceptions in main, and print the stack trace with the correct source-level information. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** Package.java 15 Feb 2004 19:22:10 -0000 1.111 --- Package.java 16 Feb 2004 21:47:12 -0000 1.112 *************** *** 499,503 **** manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,"1.0"); manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, ! this.name + "." + packageClassName); return new JarOutputStream(new FileOutputStream(jarFile), manifest); } --- 499,503 ---- manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,"1.0"); manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, ! this.name + ".dispatch"); return new JarOutputStream(new FileOutputStream(jarFile), manifest); } |
From: <bo...@us...> - 2004-02-16 21:55:38
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12009/src/bossa/link Modified Files: Compilation.java Log Message: Catch exceptions in main, and print the stack trace with the correct source-level information. Index: Compilation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Compilation.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Compilation.java 28 Aug 2003 15:56:42 -0000 1.12 --- Compilation.java 16 Feb 2004 21:47:12 -0000 1.13 *************** *** 53,56 **** --- 53,60 ---- (sortedAlternatives.iterator(), m.javaReturnType(), m.javaReturnType().isVoid(), params); + + if (m.isMain()) + body = beautifyUncaughtExceptions(body); + Gen.setMethodBody(lexp, m.getContract().compile(body)); } *************** *** 101,104 **** --- 105,126 ---- } + private static Expression beautifyUncaughtExceptions(Expression body) + { + TryExp res = new TryExp(body, null); + + CatchClause c = new CatchClause("uncaughtException", Type.throwable_type); + res.setCatchClauses(c); + + gnu.bytecode.Method print = ClassType.make("nice.lang.dispatch"). + getDeclaredMethod("printStackTraceWithSourceInfo", 1); + + c.setBody + (new ApplyExp + (new PrimProcedure(print), + new Expression[]{ new ReferenceExp(c.getDeclaration()) })); + + return res; + } + /**************************************************************** * Java Methods |
From: <bo...@us...> - 2004-02-16 17:27:45
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18617/src/bossa/syntax Modified Files: tools.nice dispatch.java.bootstrap Log Message: Avoid having bossa.util depend on nice.lang for bootstrapping reasons. Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tools.nice 20 Nov 2003 01:16:49 -0000 1.29 --- tools.nice 16 Feb 2004 17:19:31 -0000 1.30 *************** *** 136,139 **** --- 136,143 ---- } + // For bootstrap + void bootstrapPrintStackTraceWithSourceInfo(Throwable t) = + printStackTraceWithSourceInfo(t); + /**************************************************************** * Temporary: this should be solved when AST classes are written Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dispatch.java.bootstrap 27 Nov 2002 17:56:08 -0000 1.10 --- dispatch.java.bootstrap 16 Feb 2004 17:19:32 -0000 1.11 *************** *** 35,38 **** --- 35,40 ---- Expression value) { return null; } + + public static void printStackTraceWithSourceInfo(Throwable t) {} } |
From: <bo...@us...> - 2004-02-16 17:27:44
|
Update of /cvsroot/nice/Nice/src/bossa/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18617/src/bossa/util Modified Files: Internal.java Log Message: Avoid having bossa.util depend on nice.lang for bootstrapping reasons. Index: Internal.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/util/Internal.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Internal.java 16 Feb 2004 15:48:30 -0000 1.26 --- Internal.java 16 Feb 2004 17:19:27 -0000 1.27 *************** *** 26,37 **** public static void printStackTrace() { ! try{ throw new Exception(); } catch(Exception e){ ! nice.lang.dispatch.printStackTraceWithSourceInfo(e); } } ! public static void warning(Located loc, String message) { --- 26,37 ---- public static void printStackTrace() { ! try{ throw new Exception(); } catch(Exception e){ ! bossa.syntax.dispatch.printStackTraceWithSourceInfo(e); } } ! public static void warning(Located loc, String message) { |
From: <bo...@us...> - 2004-02-16 16:02:38
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1470/stdlib/nice/lang Modified Files: source-lines.nice Log Message: Typo. Index: source-lines.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/source-lines.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** source-lines.nice 16 Feb 2004 15:42:13 -0000 1.3 --- source-lines.nice 16 Feb 2004 15:54:26 -0000 1.4 *************** *** 32,36 **** public void printStackTraceWithSourceInfo(Throwable t, PrintStream s) = ! printStackTraceWithSourceInfo(t, new PrintWriter(s, true));; public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w) --- 32,36 ---- public void printStackTraceWithSourceInfo(Throwable t, PrintStream s) = ! printStackTraceWithSourceInfo(t, new PrintWriter(s, true)); public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w) |
From: <bo...@us...> - 2004-02-16 15:56:39
|
Update of /cvsroot/nice/Nice/src/bossa/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv321/src/bossa/util Modified Files: Internal.java Log Message: Print stack traces with source level debug information. Index: Internal.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/util/Internal.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Internal.java 11 Jun 2003 22:24:07 -0000 1.25 --- Internal.java 16 Feb 2004 15:48:30 -0000 1.26 *************** *** 30,34 **** } catch(Exception e){ ! e.printStackTrace(); } } --- 30,34 ---- } catch(Exception e){ ! nice.lang.dispatch.printStackTraceWithSourceInfo(e); } } |
From: <bo...@us...> - 2004-02-16 15:50:25
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31623/stdlib/nice/lang Modified Files: source-lines.nice Log Message: Make sure the message get printed by setting autoflush to true. Index: source-lines.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/source-lines.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** source-lines.nice 10 Feb 2004 21:38:50 -0000 1.2 --- source-lines.nice 16 Feb 2004 15:42:13 -0000 1.3 *************** *** 32,36 **** public void printStackTraceWithSourceInfo(Throwable t, PrintStream s) = ! printStackTraceWithSourceInfo(t, new PrintWriter(s)); public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w) --- 32,36 ---- public void printStackTraceWithSourceInfo(Throwable t, PrintStream s) = ! printStackTraceWithSourceInfo(t, new PrintWriter(s, true));; public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w) |
From: <ar...@us...> - 2004-02-16 15:16:39
|
Update of /cvsroot/nice/Nice/src/nice/tools/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25113/F:/nice/src/nice/tools/doc Modified Files: main.nice Log Message: Set storeDocString to true. Index: main.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/doc/main.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.nice 14 Feb 2004 01:37:36 -0000 1.3 --- main.nice 16 Feb 2004 15:08:30 -0000 1.4 *************** *** 20,23 **** --- 20,24 ---- ConsoleOutput consOutput = new ConsoleOutput(); Compilation compilation = new Compilation(listener: consOutput); + compilation.storeDocStrings = true; Program prg = new Program |
From: <bo...@us...> - 2004-02-16 14:29:17
|
Update of /cvsroot/nice/Nice/distrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14591/distrib Modified Files: Makefile Log Message: Windows: added nicedoc.bat, and made sure that text files are always in DOS end-of-line mode, whatever they might be in the CVS repository. Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/distrib/Makefile,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Makefile 25 Jan 2004 03:23:39 -0000 1.13 --- Makefile 16 Feb 2004 14:21:10 -0000 1.14 *************** *** 71,74 **** --- 71,76 ---- + WIN_TEXT_FILES = ${BUILDDIR}/{bin/{nicec,nicedoc}.bat,web/Readme.txt} + .PHONY: zip zip ${ZIPFILE}: $(DEB) *************** *** 76,80 **** mkdir ${ZIP_ROOT} ../bin/nicec --man | groff -mandoc -Thtml - > ${ZIP_ROOT}/nicec.html ! ln -sf ${BUILDDIR}/bin/nicec.bat ${BUILDDIR}/share/java/nice.jar ${BUILDDIR}/web/Readme.txt ${ZIP_ROOT} mkdir -p ${ZIP_ROOT}/Emacs ln -sf ${BUILDDIR}/lib/emacs/*.el ${ZIP_ROOT}/Emacs --- 78,84 ---- mkdir ${ZIP_ROOT} ../bin/nicec --man | groff -mandoc -Thtml - > ${ZIP_ROOT}/nicec.html ! # Make sure that the files are in DOS mode ! unix2dos -p ${WIN_TEXT_FILES} ${ZIP_ROOT}/nicec.html ! ln -sf ${WIN_TEXT_FILES} ${BUILDDIR}/share/java/nice.jar ${ZIP_ROOT} mkdir -p ${ZIP_ROOT}/Emacs ln -sf ${BUILDDIR}/lib/emacs/*.el ${ZIP_ROOT}/Emacs |