[Nice-commit] Nice/src/nice/tools/doc api.nice,NONE,1.1 main.nice,1.2,1.3
Brought to you by:
bonniot
From: <bo...@us...> - 2004-02-14 01:43:45
|
Update of /cvsroot/nice/Nice/src/nice/tools/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28279/src/nice/tools/doc Modified Files: main.nice Added Files: api.nice Log Message: Isolated an API for starting nicedoc, and use it in the command-line version. --- NEW FILE: api.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.doc; /** Interface to call nicedoc from Nice/Java programs. @author Daniel Bonniot (bo...@us...) */ //A global variable specifying the output directory var File outdir = new File("."); void generate(Compilation compilation, String mainPackage, ?File outDirectory) { if (outDirectory != null) outdir = outDirectory; // Make sure the meaning of outdir is fixed. outdir = outdir.getAbsoluteFile(); if (! outdir.exists() && ! outdir.mkdirs()) { throw new Error("Could not create the output directory " + outdir); } try { List<bossa.modules.Package> packages = load(compilation, mainPackage); // Here the real work begins Documenter d = new Documenter(); d.document(packages); packages.foreach(bossa.modules.Package p => d.document(p)); } catch (bossa.modules.Exit e) { // There was an error. Stop working. } } Index: main.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/doc/main.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.nice 13 Feb 2004 16:15:44 -0000 1.2 --- main.nice 14 Feb 2004 01:37:36 -0000 1.3 *************** *** 12,22 **** import bossa.modules.*; - //A global variable specifying the output directory - var File outdir = new File("."); - void main(String[] args) { String mainPackage; ?String classpath = null; ConsoleOutput consOutput = new ConsoleOutput(); --- 12,20 ---- import bossa.modules.*; void main(String[] args) { String mainPackage; ?String classpath = null; + File outdir = new File("."); ConsoleOutput consOutput = new ConsoleOutput(); *************** *** 70,80 **** mainPackage = rest[0]; - // Make sure the meaning of outdir is fixed. - outdir = outdir.getAbsoluteFile(); - - if (! outdir.exists() && ! outdir.mkdirs()) { - throw new Error("Could not create the output directory " + outdir); - } - /* For convenience of command-line tools (shells) with completions, --- 68,71 ---- *************** *** 84,98 **** mainPackage = mainPackage.deleteAtEnd("/").replace('/', "."); ! try { ! List<bossa.modules.Package> packages = load(compilation, mainPackage); ! ! // Here the real work begins ! //packages.foreach(bossa.modules.Package p => document(p.getDefinitions)); ! Documenter d = new Documenter(); ! d.document(packages); ! packages.foreach(bossa.modules.Package p => d.document(p)); ! } ! catch (bossa.modules.Exit e) { ! // There was an error. Stop working. ! } } --- 75,78 ---- mainPackage = mainPackage.deleteAtEnd("/").replace('/', "."); ! generate(compilation, mainPackage, outdir); } |