summaryrefslogtreecommitdiff
path: root/src/manual
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2006-06-12 14:18:13 +0000
committermichelou <michelou@epfl.ch>2006-06-12 14:18:13 +0000
commit1c43cfe216a0d759568a964a16345ea773f32211 (patch)
treecc9c93e37b6817c14e1334d910b9012e408c85b8 /src/manual
parentde843e4a74769be951e28d7f744dc812e3eed83e (diff)
downloadscala-1c43cfe216a0d759568a964a16345ea773f32211.tar.gz
scala-1c43cfe216a0d759568a964a16345ea773f32211.tar.bz2
scala-1c43cfe216a0d759568a964a16345ea773f32211.zip
moved docs/man/src to src/manual and updated bu...
moved docs/man/src to src/manual and updated build.xml
Diffstat (limited to 'src/manual')
-rw-r--r--src/manual/scala/man1/Command.scala57
-rw-r--r--src/manual/scala/man1/sbaz.scala181
-rw-r--r--src/manual/scala/man1/scala.scala148
-rw-r--r--src/manual/scala/man1/scalac.scala315
-rw-r--r--src/manual/scala/man1/scaladoc.scala110
-rw-r--r--src/manual/scala/man1/scalaint.scala80
-rw-r--r--src/manual/scala/man1/scalap.scala110
-rw-r--r--src/manual/scala/man1/scalascript.scala102
-rw-r--r--src/manual/scala/tools/docutil/EmitHtml.scala349
-rw-r--r--src/manual/scala/tools/docutil/EmitManPage.scala165
-rw-r--r--src/manual/scala/tools/docutil/ManPage.scala68
-rw-r--r--src/manual/scala/tools/docutil/resources/css/style.css66
-rw-r--r--src/manual/scala/tools/docutil/resources/images/external.gifbin0 -> 289 bytes
-rw-r--r--src/manual/scala/tools/docutil/resources/images/scala_logo.pngbin0 -> 4751 bytes
-rw-r--r--src/manual/scala/tools/docutil/resources/index.html211
15 files changed, 1962 insertions, 0 deletions
diff --git a/src/manual/scala/man1/Command.scala b/src/manual/scala/man1/Command.scala
new file mode 100644
index 0000000000..23f951354d
--- /dev/null
+++ b/src/manual/scala/man1/Command.scala
@@ -0,0 +1,57 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2006 LAMP/EPFL
+ * @author Stephane Micheloud
+ */
+//$Id: $
+
+package scala.man1
+
+trait Command {
+ import _root_.scala.tools.docutil.ManPage._
+
+ protected def cn: String
+ def command = cn.substring(cn.lastIndexOf(".") + 1, cn.length() - 1)
+
+ protected def MBold(contents: AbstractText) = Mono(Bold(contents))
+ protected def MItalic(contents: AbstractText) = Mono(Italic(contents))
+
+ protected def CmdLine(opts: AbstractText) =
+ MBold(command) & Mono(" " & opts)
+
+ protected def CmdOption(opt: String, params: AbstractText) =
+ Mono(Bold(NDash & opt) & " " & params & " ")
+
+ protected def CmdOption(opt: String): AbstractText =
+ Mono(Bold(NDash & opt) & " ")
+
+ protected def CmdOptionLong(opt: String, params: AbstractText) =
+ Mono(Bold(NDash & NDash & opt) & " " & params & " ")
+
+ protected def CmdOptionLong(opt: String): AbstractText =
+ Mono(Bold(NDash & NDash & opt) & " ")
+
+ protected def Argument(arg: String): AbstractText =
+ "<" & Italic(arg) & ">"
+
+ def authors = Section("AUTHOR",
+
+ "Written by Martin Odersky and other members of the " &
+ Link("Scala team", "http://scala.epfl.ch/community/") & ".")
+
+ def copyright = Section("COPYRIGHT",
+
+ "This is free software; see the distribution for copying conditions. " &
+ "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A " &
+ "PARTICULAR PURPOSE.")
+
+ def bugs = Section("REPORTING BUGS",
+
+ "Report bugs to " & Mono("<scala@listes.epfl.ch>") & ".")
+
+ //private val df = new java.text.SimpleDateFormat("MMM d, yyyy")
+ //private val rightNow = new java.util.Date()
+
+ def lastModified: String = "June 8, 2006" // df.format(rightNow)
+
+ def manpage: Document
+}
diff --git a/src/manual/scala/man1/sbaz.scala b/src/manual/scala/man1/sbaz.scala
new file mode 100644
index 0000000000..f9d12ecc97
--- /dev/null
+++ b/src/manual/scala/man1/sbaz.scala
@@ -0,0 +1,181 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2006 LAMP/EPFL
+ * @author Stephane Micheloud
+ */
+//$Id: $
+
+package scala.man1
+
+object sbaz extends Command {
+ import _root_.scala.tools.docutil.ManPage._
+
+ protected val cn = new Error().getStackTrace()(0).getClassName()
+
+ val name = Section("NAME",
+
+ MBold(command) & " " & NDash & " Scala package sharing tool for the " &
+ Link("Scala 2", "http://scala.epfl.ch/") & " language")
+
+ val synopsis = Section("SYNOPSIS",
+
+ CmdLine(" [ " & Argument("global_options") & " ] " & Argument("command") &
+ " [ " & Argument("command_options") & "]"))
+
+ val parameters = Section("PARAMETERS",
+
+ DefinitionList(
+ Definition(
+ Mono(Argument("global_options")),
+ "Command line options. See " & Link(Bold("OPTIONS"), "#options") &
+ " below."),
+ Definition(
+ Mono(Argument("command")),
+ "Internal " & MBold(command) & " command."),
+ Definition(
+ Mono(Argument("command_options")),
+ MBold(command) & " command options.")))
+
+ val description = Section("DESCRIPTION",
+
+ "The " & MBold(command) & " tool is a system used by Scala enthusiasts " &
+ "to share computer files with each other. In particular, it makes it " &
+ "easy to share libraries and applications.")
+
+ val options = Section("OPTIONS",
+
+ "The " & MBold(command) & " tool has a set of standard options that are " &
+ "supported on the current development environment and will be supported " &
+ "in future releases.",
+
+ Section("Global Options",
+ DefinitionList(
+ Definition(
+ CmdOption("d", Argument("dir")),
+ "Operate on dir as the local managed directory."),
+ Definition(
+ CmdOption("n"),
+ "Do not actually do anything. Only print out what " +
+ "tool would normally do with the following arguments."))),
+
+ Section("Available Commands",
+ DefinitionList(
+ Definition(
+ MBold("available"),
+ "List the available packages for installation; only display the " +
+ "three most recent versions of each package."),
+ Definition(
+ MBold("available") & " " & CmdOption("a"),
+ "List the available packages for installation; display all shared " +
+ "versions of each package."),
+ Definition(
+ MBold("compact"),
+ "Clear the download cache to save space."),
+ Definition(
+ MBold("help"),
+ "Display a help message."),
+ Definition(
+ MBold("install"),
+ "Install a package."),
+ Definition(
+ MBold("installed"),
+ "List the packages that are installed."),
+ Definition(
+ MBold("keycreate"),
+ "Request that a new key be created."),
+ Definition(
+ MBold("keyforget"),
+ "Forget the specified key."),
+ Definition(
+ MBold("keyknown"),
+ "List all known keys."),
+ Definition(
+ MBold("keyremember"),
+ "Remember the specified key for future use."),
+ Definition(
+ MBold("keyremoteknown"),
+ "List all keys known to the bazaar server."),
+ Definition(
+ MBold("keyrevoke"),
+ "Request that a specified key be revoked."),
+ Definition(
+ MBold("remove"),
+ "Remove a package."),
+ Definition(
+ MBold("retract"),
+ "Retract a previously shared package."),
+ Definition(
+ MBold("setuniverse"),
+ "Set the universe for a directory."),
+ Definition(
+ MBold("setup"),
+ "Initialize a directory to be managed."),
+ Definition(
+ MBold("share") & " filename",
+ "Share a package advertisement on a bazaar."),
+ Definition(
+ MBold("share") & " " & CmdOption("i", Argument("descriptor")),
+ "The package advertisement is usually specified in a file, " &
+ "but it may also be specified on the command line with the " &
+ CmdOption("i") & " option."),
+ Definition(
+ MBold("share") & " " & CmdOptionLong("template"),
+ "If " & CmdOptionLong("template") & " is specified, then instead " &
+ "of uploading a description, the command prints out a template " &
+ "of a package advertisement."),
+ Definition(
+ MBold("show"),
+ "Show information about one package."),
+ Definition(
+ MBold("update"),
+ "Update the list of available packages."),
+ Definition(
+ MBold("upgrade"),
+ "Upgrade all possible packages."))))
+
+ val examples = Section("EXAMPLES",
+
+ DefinitionList(
+ Definition(
+ "Update the list of available packages.",
+ CmdLine(MBold("update"))),
+ Definition(
+ "Upload package description for " & Mono("scala-devel-2.1.5") &
+ " to the universe",
+ CmdLine(MBold("share") & " scala-devel-2.1.5.advert"))))
+
+ val exitStatus = Section("EXIT STATUS",
+
+ MBold(command) & " returns a zero exist status if it succeeds to process " &
+ "the specified input files. Non zero is returned in case of failure.")
+
+ override val authors = Section("AUTHOR",
+
+ "Written by Lex Spoon.")
+
+ val seeAlso = Section("SEE ALSO",
+
+ Link(Bold("scala") & "(1)", "scala.html") & ", " &
+ Link(Bold("scalac") & "(1)", "scalac.html") & ", " &
+ Link(Bold("scaladoc") & "(1)", "scaladoc.html") & ", " &
+ Link(Bold("scalaint") & "(1)", "scalaint.html") & ", " &
+ Link(Bold("scalascript") & "(1)", "scalascript.html"))
+
+ def manpage = new Document {
+ title = command
+ date = "June 8, 2006"
+ author = "Stephane Micheloud"
+ version = "0.2"
+ sections = List(
+ name,
+ synopsis,
+ parameters,
+ description,
+ options,
+ examples,
+ exitStatus,
+ authors,
+ bugs,
+ copyright,
+ seeAlso)
+ }
+}
diff --git a/src/manual/scala/man1/scala.scala b/src/manual/scala/man1/scala.scala
new file mode 100644
index 0000000000..827bd09cb2
--- /dev/null
+++ b/src/manual/scala/man1/scala.scala
@@ -0,0 +1,148 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2006 LAMP/EPFL
+ * @author Stephane Micheloud
+ */
+//$Id: $
+
+package scala.man1
+
+object scala extends Command {
+ import _root_.scala.tools.docutil.ManPage._
+
+ protected def cn = new Error().getStackTrace()(0).getClassName()
+
+ val name = Section("NAME",
+
+ MBold(command) & " " & NDash & " Launcher for the " &
+ Link("Scala 2", "http://scala.epfl.ch/") & " language")
+
+ val synopsis = Section("SYNOPSIS",
+
+ CmdLine(" [ " & Argument("options") & " ] " &
+ Argument("class file") & " [ " & Argument("args") & " ]"))
+
+ val parameters = Section("PARAMETERS",
+
+ DefinitionList(
+ Definition(
+ Mono(Argument("options")),
+ "Command line options. See " & Link(Bold("OPTIONS"), "#options") &
+ " below."),
+ Definition(
+ Mono(Argument("class file")),
+ "Name of the class to be invoked."),
+ Definition(
+ Mono(Argument("args")),
+ "Program arguments passed to the main function.")))
+
+ val description = Section("DESCRIPTION",
+
+ "The " & MBold(command) & " utility launches a Scala application. " &
+ "It does this by starting a Java runtime environment, loading a " &
+ "specified class, and invoking that class's " & Bold("main") &
+ " method. The method must have the following signature:",
+
+ BlockQuote(Mono(Bold("def") & " main(args: Array[String]): Unit")),
+
+ "The method must return a " & Bold("Unit") & " value, and it must " &
+ "accept a " & Bold("String") & " array as a parameter. By default, " &
+ "the first non-option argument is the name of the class to be invoked. "&
+ "A fully-qualified class name should be used.",
+
+ "The Scala runtime searches for the startup class, and other classes " &
+ "used, in three sets of locations: the bootstrap class path, the " &
+ "installed extensions, and the user class path.")
+
+ val options = Section("OPTIONS",
+
+ "The launcher has a set of standard options that are supported on the " &
+ "current runtime environment and will be supported in future releases. " &
+ "An additional set of non-standard options are specific to the current " &
+ "virtual machine implementation and are subject to change in the future. " &
+ "Non-standard options begin with " & CmdOption("X") & ".",
+
+ Section("Standard Options",
+ DefinitionList(
+ Definition(
+ CmdOption("cp") & "| " & CmdOption("classpath", Argument("path")),
+ "Specify where to find user class files (on Unix-based systems " &
+ "a colon-separated list of paths, on Windows-based systems, a " &
+ "semicolon-separate list of paths)."),
+ Definition(
+ CmdOption("D", Argument("name") & "=" & Argument("value")),
+ "Set a system property."),
+ Definition(
+ CmdOption("verbose", "[:class|gc|jni]"),
+ "Enable verbose output."),
+ Definition(
+ CmdOption("showversion"),
+ "Print product version and continue."),
+ Definition(
+ CmdOption("version"),
+ "Print product version and exit."),
+ Definition(
+ CmdOption("help"),
+ "Print this help message."))),
+
+ Section("Non-Standard Options",
+ "Same options as the " & MBold("java") & " command."))
+
+ val environment = Section("ENVIRONMENT",
+
+ DefinitionList(
+ Definition(
+ MBold("JAVACMD"),
+ "Specify the " & MBold("java") & " command to be used " &
+ "for running the Scala commands")))
+
+ val examples = Section("EXAMPLES",
+
+ DefinitionList(
+ Definition(
+ "Execute a Scala program generated in the current directory",
+ CmdLine("hello.HelloWorld")),
+ Definition(
+ "Execute a Scala program generated in a user-defined " &
+ "directory " & Bold("classes"),
+ CmdLine(CmdOption("classpath", "classes") & "hello.HelloWorld")),
+ Definition(
+ "Execute a Scala program using a user-defined " & MBold("java") & " " &
+ "command",
+ MBold("env JAVACMD") & Mono("=/usr/local/bin/cacao ") &
+ CmdLine(CmdOption("classpath", "classes") & "hello.HelloWorld"))))
+
+ val exitStatus = Section("EXIT STATUS",
+
+ MBold(command) & " returns a zero exit status if it succeeds. " &
+ "Non zero is returned in case of failure.")
+
+ val seeAlso = Section("SEE ALSO",
+
+ Link(Bold("sbaz") & "(1)", "sbaz.html") & ", " &
+ Link(Bold("scalac") & "(1)", "scalac.html") & ", " &
+ Link(Bold("scaladoc") & "(1)", "scaladoc.html") & ", " &
+ Link(Bold("scalaint") & "(1)", "scalaint.html") & ", " &
+ Link(Bold("scalap") & "(1)", "scalap.html") & ", " &
+ Link(Bold("scalascript") & "(1)", "scalascript.html"))
+
+ def manpage = new Document {
+ title = command
+ date = lastModified
+ author = "Stephane Micheloud"
+ version = "0.2"
+ sections = List(
+ name,
+ synopsis,
+ parameters,
+ description,
+ options,
+ environment,
+ examples,
+ exitStatus,
+ authors,
+ bugs,
+ copyright,
+ seeAlso)
+ }
+}
+
diff --git a/src/manual/scala/man1/scalac.scala b/src/manual/scala/man1/scalac.scala
new file mode 100644
index 0000000000..7931b18d21
--- /dev/null
+++ b/src/manual/scala/man1/scalac.scala
@@ -0,0 +1,315 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2006 LAMP/EPFL
+ * @author Stephane Micheloud
+ */
+//$Id: $
+
+package scala.man1
+
+object scalac extends Command {
+ import _root_.scala.tools.docutil.ManPage._
+
+ protected def cn = new Error().getStackTrace()(0).getClassName()
+
+ val name = Section("NAME",
+
+ MBold(command) & " " & NDash & " Compiler for the " &
+ Link("Scala 2", "http://scala.epfl.ch/") & " language")
+
+ val synopsis = Section("SYNOPSIS",
+
+ CmdLine(" [ " & Argument("options") & " ] " &
+ Argument("source files")))
+
+ val parameters = Section("PARAMETERS",
+
+ DefinitionList(
+ Definition(
+ Mono(Argument("options")),
+ "Command line options. See " & Link(Bold("OPTIONS"), "#options") &
+ " below."),
+ Definition(
+ Mono(Argument("source files")),
+ "One or more source files to be compiled (such as " &
+ Mono("MyClass.scala") & ").")))
+
+ val description = Section("DESCRIPTION",
+
+ "The " & MBold(command) & " tool reads class and object definitions, " &
+ "written in the Scala programming language, and compiles them into " &
+ "bytecode class files.",
+
+ "By default, the compiler puts each class file in the same directory " &
+ "as its source file. You can specify a separate destination directory " &
+ "with -d (see " & Link(Bold("OPTIONS"), "#options") & ", below).")
+
+ val options = Section("OPTIONS",
+
+ "The compiler has a set of standard options that are supported on the " &
+ "current development environment and will be supported in future " &
+ "releases. An additional set of non-standard options are specific to " &
+ "the current virtual machine implementation and are subject to change " &
+ "in the future. Non-standard options begin with " & Bold("-X") & ".",
+
+ Section("Standard Options",
+ DefinitionList(
+ Definition(
+ CmdOption("g"),
+ "Generate debugging info"),
+ Definition(
+ CmdOption("nowarn"),
+ "Generate no warnings"),
+ Definition(
+ CmdOption("verbose"),
+ "Output messages about what the compiler is doing"),
+ Definition(
+ CmdOption("classpath", Argument("path")),
+ "Specify where to find user class files (on Unix-based systems " &
+ "a colon-separated list of paths, on Windows-based systems, a " &
+ "semicolon-separate list of paths). This does not override the " &
+ "built-in (" & Mono("\"boot\"") & ") search path."),
+ Definition(
+ CmdOption("sourcepath", Argument("path")),
+ "Specify where to find input source files."),
+ Definition(
+ CmdOption("bootclasspath", Argument("path")),
+ "Override location of bootstrap class files (where to find the " &
+ "standard built-in classes, such as \"" & Mono("scala.List") & "\")."),
+ Definition(
+ CmdOption("extdirs", Argument("dirs")),
+ "Override location of installed extensions."),
+ Definition(
+ CmdOption("d", Argument("directory")),
+ "Specify where to place generated class files."),
+ Definition(
+ CmdOption("encoding", Argument("encoding")),
+ "Specify character encoding used by source files."),
+ Definition(
+ CmdOption("target:", Argument("target")),
+ "Specify which backend to use (" & Mono(Italic("jvm-1.5") & ", " &
+ Italic("jvm-1.4") & ", " & Italic("msil") & ", " & Italic("cldc")) &
+ ")."),
+ Definition(
+ CmdOption("migrate"),
+ "Assist in migrating from Scala version 1.0."),
+ Definition(
+ CmdOption("statistics"),
+ "Print compiler statistics."),
+ Definition(
+ CmdOption("resident"),
+ "Compiler stays resident, files to compile are read from standard " &
+ "input."),
+ Definition(
+ CmdOption("version"),
+ "Print product version and exit."),
+ Definition(
+ CmdOption("?") & "| " & CmdOption("help"),
+ "Print a synopsis of standard options."))),
+
+ Section("Non-Standard Options",
+ DefinitionList(
+ Definition(
+ CmdOption("Xinline"),
+ "Perform inlining when possible."),
+ Definition(
+ CmdOption("Xcloselim"),
+ "Perform closure elimination."),
+ Definition(
+ CmdOption("Xshowcls", Argument("class")),
+ "Show class info."),
+ Definition(
+ CmdOption("Xshowobj", Argument("object")),
+ "Show object info."),
+ Definition(
+ CmdOption("Xshowicode"),
+ "Print the generated ICode."),
+ Definition(
+ CmdOption("Xgadt"),
+ "Enable gadt for classes."),
+ Definition(
+ CmdOption("Xlinearizer", Argument("Xlinearizer")),
+ "Linearizer to use (" & Mono("normal,dfs,rpo") & ")."),
+ Definition(
+ CmdOption("Xgenerics"),
+ "Use generic Java types."))),
+
+ Section("Debug Options",
+ DefinitionList(
+ Definition(
+ CmdOption("debug"),
+ "Output debugging messages."),
+ Definition(
+ CmdOption("explaintypes"),
+ "Explain type errors in more detail."),
+ Definition(
+ CmdOption("uniqid"),
+ "Print identifiers with unique names (debugging option)."),
+ Definition(
+ CmdOption("printtypes"),
+ "Print tree types (debugging option)."),
+ Definition(
+ CmdOption("prompt"),
+ "Display a prompt after each error (debugging option)."),
+ Definition(
+ CmdOption("noimports"),
+ "Compile without any implicit imports."),
+ Definition(
+ CmdOption("nopredefs"),
+ "Compile without any implicit predefined values."),
+ Definition(
+ CmdOption("skip:", Argument("phases")),
+ "Skip " & Argument("phases") & " (see below)."),
+ Definition(
+ CmdOption("check:", Argument("phases")),
+ "Check the tree after " & Argument("phases") & " (see below)."),
+ Definition(
+ CmdOption("print:", Argument("phases")),
+ "Print out program after " & Argument("phases") & " (see below)."),
+ Definition(
+ CmdOption("printer:", Argument("printer")),
+ "Printer to use."),
+ Definition(
+ CmdOption("print-file", Argument("file")),
+ "Specify file in which to print trees."),
+ Definition(
+ CmdOption("graph:", Argument("phases")),
+ "Graph the program after " & Argument("phases") & " (see below)."),
+ Definition(
+ CmdOption("stop:", Argument("phases")),
+ "Stop after first phase in " & Argument("phases") & " (see below)."),
+ Definition(
+ CmdOption("log:", Argument("phases")),
+ "Log operations in " & Argument("phases") & " (see below)."))),
+
+ Section("Compilation Phases",
+ DefinitionList(
+ Definition(
+ MItalic("initial"),
+ "initializing compiler"),
+ Definition(
+ MItalic("parse"),
+ "parse source files"),
+ Definition(
+ MItalic("namer"),
+ "create symbols"),
+ Definition(
+ MItalic("analyze"),
+ "name and type analysis"),
+ Definition(
+ MItalic("refcheck"),
+ "reference checking"),
+ Definition(
+ MItalic("uncurry"),
+ "uncurry function types and applications"),
+ Definition(
+ MItalic("transmatch"),
+ "translate match expressions"),
+ Definition(
+ MItalic("lambdalift"),
+ "lambda lifter"),
+ Definition(
+ MItalic("typesasvalues"),
+ "represent types as values"),
+ Definition(
+ MItalic("addaccessors"),
+ "add accessors for constructor arguments"),
+ Definition(
+ MItalic("explicitouterclasses"),
+ "make links from inner classes to enclosing one explicit"),
+ Definition(
+ MItalic("addconstructors"),
+ "add explicit constructor for each class"),
+ Definition(
+ MItalic("tailcall"),
+ "add tail-calls"),
+ Definition(
+ MItalic("wholeprog"),
+ "perform whole program analysis"),
+ Definition(
+ MItalic("addinterfaces"),
+ "add one interface per class"),
+ Definition(
+ MItalic("expandmixins"),
+ "expand mixins by code copying"),
+ Definition(
+ MItalic("boxing"),
+ "makes boxing explicit"),
+ Definition(
+ MItalic("erasure"),
+ "type eraser"),
+ Definition(
+ MItalic("icode"),
+ "generate icode"),
+ Definition(
+ MItalic("codegen"),
+ "enable code generation"),
+ Definition(
+ MItalic("terminal"),
+ "compilation terminated"),
+ Definition(
+ MItalic("all"),
+ "matches all phases"))))
+
+ val environment = Section("ENVIRONMENT",
+
+ DefinitionList(
+ Definition(
+ MBold("JAVACMD"),
+ "Specify the " & MBold("java") & " command to be used " &
+ "for running the Scala commands")))
+
+ val examples = Section("EXAMPLES",
+
+ DefinitionList(
+ Definition(
+ "Compile a Scala program to the current directory",
+ CmdLine("HelloWorld")),
+ Definition(
+ "Compile a Scala program to the destination directory " &
+ MBold("classes"),
+ CmdLine(CmdOption("d", "classes") & "HelloWorld.scala")),
+ Definition(
+ "Compile a Scala program using a user-defined " & MBold("java") & " " &
+ "command",
+ MBold("env JAVACMD") & Mono("=/usr/local/bin/cacao ") &
+ CmdLine(CmdOption("d", "classes") & "HelloWorld.scala")),
+ Definition(
+ "Compile all Scala files found in the source directory " &
+ MBold("src") & " to the destination directory " &
+ MBold("classes"),
+ CmdLine(CmdOption("d", "classes") & "src/*.scala"))))
+
+ val exitStatus = Section("EXIT STATUS",
+
+ MBold(command) & " returns a zero exist status if it succeeds to " &
+ "compile the specified input files. Non zero is returned in case " &
+ "of failure.")
+
+ val seeAlso = Section("SEE ALSO",
+
+ Link(Bold("sbaz") & "(1)", "sbaz.html") & ", " &
+ Link(Bold("scala") & "(1)", "scala.html") & ", " &
+ Link(Bold("scaladoc") & "(1)", "scaladoc.html") & ", " &
+ Link(Bold("scalaint") & "(1)", "scalaint.html") & ", " &
+ Link(Bold("scalap") & "(1)", "scalap.html") & ", " &
+ Link(Bold("scalascript") & "(1)", "scalascript.html"))
+
+ def manpage = new Document {
+ title = command
+ date = lastModified // e.g. "June 8, 2006"
+ author = "Stephane Micheloud"
+ version = "0.2"
+ sections = List(
+ name,
+ synopsis,
+ parameters,
+ options,
+ environment,
+ examples,
+ exitStatus,
+ authors,
+ bugs,
+ copyright,
+ seeAlso)
+ }
+}
diff --git a/src/manual/scala/man1/scaladoc.scala b/src/manual/scala/man1/scaladoc.scala
new file mode 100644
index 0000000000..c0454b06fc
--- /dev/null
+++ b/src/manual/scala/man1/scaladoc.scala
@@ -0,0 +1,110 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2006 LAMP/EPFL
+ * @author Stephane Micheloud
+ */
+//$Id: $
+
+package scala.man1
+
+object scaladoc extends Command {
+ import _root_.scala.tools.docutil.ManPage._
+
+ protected def cn = new Error().getStackTrace()(0).getClassName()
+
+ val name = Section("NAME",
+
+ MBold(command) & " " & NDash & " Documentation generator for the " &
+ Link("Scala 2", "http://scala.epfl.ch/") & " language")
+
+ val synopsis = Section("SYNOPSIS",
+
+ CmdLine(" [ " & Argument("options") & " ] " & Argument("source files")))
+
+ val parameters = Section("PARAMETERS",
+
+ DefinitionList(
+ Definition(
+ Mono(Argument("options")),
+ "Command line options. See " & Link(Bold("OPTIONS"), "#options") &
+ " below."),
+ Definition(
+ Mono(Argument("source files")),
+ "One or more source files to be compiled (such as " &
+ Mono("MyClass.scala") & ").")))
+
+ val description = Section("DESCRIPTION",
+
+ "The " & MBold(command) & " tool reads class and object definitions, " &
+ "written in the Scala programming language, and generates their API as " &
+ "HTML files.",
+
+ "By default, the generator puts each HTML file in the same directory as " &
+ "its source file. You can specify a separate destination directory with " &
+ CmdOption("d") & "(see " & Link(Bold("OPTIONS"), "#options") & ", below).")
+
+ val options = Section("OPTIONS",
+
+ "The generator has a set of standard options that are supported on the " &
+ "current development environment and will be supported in future releases.",
+
+ Section("Standard Options",
+ DefinitionList(
+ Definition(
+ CmdOption("d", Argument("directory")),
+ "Specify where to place generated class files."),
+ Definition(
+ CmdOption("version"),
+ "Print product version and exit."),
+ Definition(
+ CmdOption("?") & "| " & CmdOption("help"),
+ "Print a synopsis of standard options."))))
+
+ val examples = Section("EXAMPLES",
+
+ DefinitionList(
+ Definition(
+ "Generate documentation for a Scala program",
+ CmdLine("HelloWorld.scala")),
+ Definition(
+ "Generation documentation for a Scala program to the destination " &
+ "directory " & Bold("classes"),
+ CmdLine(CmdOption("d", "api") & "HelloWorld.scala")),
+ Definition(
+ "Generate documentation for all Scala files found in the source " &
+ "directory " & Bold("src") & " to the destination directory " &
+ Bold("api"),
+ CmdLine(CmdOption("d", "api") & "src/*.scala"))))
+
+ val exitStatus = Section("EXIT STATUS",
+
+ MBold(command) & " returns a zero exist status if it succeeds to process " &
+ "the specified input files. Non zero is returned in case of failure.")
+
+ val seeAlso = Section("SEE ALSO",
+
+ Link(Bold("sbaz") & "(1)", "sbaz.html") & ", " &
+ Link(Bold("scala") & "(1)", "scala.html") & ", " &
+ Link(Bold("scalac") & "(1)", "scalac.html") & ", " &
+ Link(Bold("scalaint") & "(1)", "scalaint.html") & ", " &
+ Link(Bold("scalap") & "(1)", "scalap.html") & ", " &
+ Link(Bold("scalascript") & "(1)", "scalascript.html"))
+
+ def manpage = new Document {
+ title = command
+ date = "June 8, 2006"
+ author = "Stephane Micheloud"
+ version = "0.2"
+ sections = List(
+ name,
+ synopsis,
+ parameters,
+ description,
+ options,
+ examples,
+ exitStatus,
+ authors,
+ bugs,
+ copyright,
+ seeAlso)
+ }
+}
diff --git a/src/manual/scala/man1/scalaint.scala b/src/manual/scala/man1/scalaint.scala
new file mode 100644
index 0000000000..08dcfe6c9b
--- /dev/null
+++ b/src/manual/scala/man1/scalaint.scala
@@ -0,0 +1,80 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2006 LAMP/EPFL
+ * @author Stephane Micheloud
+ */
+//$Id: $
+
+package scala.man1
+
+object scalaint extends Command {
+ import _root_.scala.tools.docutil.ManPage._
+
+ protected def cn = new Error().getStackTrace()(0).getClassName()
+
+ val name = Section("NAME",
+
+ MBold(command) & " " & NDash & " Interpreter for the " &
+ Link("Scala 2", "http://scala.epfl.ch/") & " language")
+
+ val synopsis = Section("SYNOPSIS",
+
+ CmdLine(" [ " & Argument("source file") & " ]"))
+
+ val parameters = Section("PARAMETERS",
+
+ DefinitionList(
+ Definition(
+ Mono(Argument("source file")),
+ "One source file to be interpreted (such as " &
+ Mono("MyClass.scala") & ").")))
+
+ val description = Section("DESCRIPTION",
+
+ "The " & MBold(command) & " tool reads class and object definitions, " &
+ "written in the Scala programming language, and interprets them in an " &
+ "interactive shell environment.",
+
+ "The shell environment provides the following internal commands:",
+
+ CodeSample("This is an interpreter for Scala.\n" +
+ "Type in expressions to have them evaluated.\n" +
+ "Type :quit to exit the interpreter.\n" +
+ "Type :compile followed by a filename to compile a complete Scala file.\n" +
+ "Type :load followed by a filename to load a sequence of interpreter commands.\n" +
+ "Type :replay to reset execution and replay all previous commands.\n" +
+ "Type :help to repeat this message later.\n\n" +
+ "scala>"))
+
+ val examples = Section("EXAMPLES",
+
+ DefinitionList(
+ Definition(
+ "Interpret a Scala program",
+ CmdLine("HelloWorld"))))
+
+ val seeAlso = Section("SEE ALSO",
+
+ Link(Bold("sbaz") & "(1)", "sbaz.html") & ", " &
+ Link(Bold("scala") & "(1)", "scala.html") & ", " &
+ Link(Bold("scalac") & "(1)", "scalac.html") & ", " &
+ Link(Bold("scaladoc") & "(1)", "scaladoc.html") & ", " &
+ Link(Bold("scalap") & "(1)", "scalap.html") & ", " &
+ Link(Bold("scalascript") & "(1)", "scalascript.html"))
+
+ def manpage = new Document {
+ title = command
+ date = "June 8, 2006"
+ author = "Stephane Micheloud"
+ version = "0.2"
+ sections = List(
+ name,
+ synopsis,
+ parameters,
+ description,
+ examples,
+ authors,
+ bugs,
+ copyright,
+ seeAlso)
+ }
+}
diff --git a/src/manual/scala/man1/scalap.scala b/src/manual/scala/man1/scalap.scala
new file mode 100644
index 0000000000..d14ed2a352
--- /dev/null
+++ b/src/manual/scala/man1/scalap.scala
@@ -0,0 +1,110 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2006 LAMP/EPFL
+ * @author Stephane Micheloud
+ */
+//$Id: $
+
+package scala.man1
+
+object scalap extends Command {
+ import _root_.scala.tools.docutil.ManPage._
+
+ protected def cn = new Error().getStackTrace()(0).getClassName()
+
+ val name = Section("NAME",
+
+ MBold(command) & " " & NDash & " Scala class file decoder for the " &
+ Link("Scala 2", "http://scala.epfl.ch/") & " language")
+
+ val synopsis = Section("SYNOPSIS",
+
+ CmdLine(" [ " & Argument("options") & " ] " & Argument("source file")))
+
+ val parameters = Section("PARAMETERS",
+
+ DefinitionList(
+ Definition(
+ Mono(Argument("options")),
+ "Command line options. See " & Link(Bold("OPTIONS"), "#options") &
+ " below."),
+ Definition(
+ Mono(Argument("source file")),
+ "One class file to be decoded (such as " &
+ Mono("hello.HelloWorld") & ").")))
+
+ val description = Section("DESCRIPTION",
+
+ "The " & MBold(command) & " tool reads a class file generated by the" &
+ "Scala compiler, and displays object and class definitions.",
+
+ "By default, " & MBold(command) & " looks for the given class file " &
+ "in the current directory. You can specify a separate classpath with " &
+ CmdOption("classpath") & "(see " & Link(Bold("OPTIONS"), "#options") & ", below).")
+
+ val options = Section("OPTIONS",
+
+ "The decoder has a set of standard options that are supported on the " &
+ "current development environment and will be supported in future releases.",
+
+ Section("Standard Options",
+ DefinitionList(
+ Definition(
+ CmdOption("help"),
+ "Display this usage message."),
+ Definition(
+ CmdOption("private"),
+ "Print private definitions."),
+ Definition(
+ CmdOption("verbose"),
+ "Print out additional information."),
+ Definition(
+ CmdOption("version"),
+ "Print product version and exit."),
+ Definition(
+ CmdOption("cp") & "| " & CmdOption("classpath"),
+ "Specify where to find user class files."))))
+
+ val examples = Section("EXAMPLES",
+
+ DefinitionList(
+ Definition(
+ "Display definitions for a generated class file",
+ CmdLine("hello.HelloWorld"))))
+
+ val exitStatus = Section("EXIT STATUS",
+
+ MBold(command) & " returns a zero exist status if it succeeds to process " &
+ "the specified input files. Non zero is returned in case of failure.")
+
+ override val authors = Section("AUTHOR",
+
+ "Written by Matthias Zenger.")
+
+ val seeAlso = Section("SEE ALSO",
+
+ Link(Bold("sbaz") & "(1)", "sbaz.html") & ", " &
+ Link(Bold("scala") & "(1)", "scala.html") & ", " &
+ Link(Bold("scalac") & "(1)", "scalac.html") & ", " &
+ Link(Bold("scaladoc") & "(1)", "scaladoc.html") & ", " &
+ Link(Bold("scalaint") & "(1)", "scalaint.html") & ", " &
+ Link(Bold("scalascript") & "(1)", "scalascript.html"))
+
+ def manpage = new Document {
+ title = command
+ date = "June 8, 2006"
+ author = "Stephane Micheloud"
+ version = "0.2"
+ sections = List(
+ name,
+ synopsis,
+ parameters,
+ description,
+ options,
+ examples,
+ exitStatus,
+ authors,
+ bugs,
+ copyright,
+ seeAlso)
+ }
+}
diff --git a/src/manual/scala/man1/scalascript.scala b/src/manual/scala/man1/scalascript.scala
new file mode 100644
index 0000000000..e67078c177
--- /dev/null
+++ b/src/manual/scala/man1/scalascript.scala
@@ -0,0 +1,102 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2006 LAMP/EPFL
+ * @author Stephane Micheloud
+ */
+//$Id: $
+
+package scala.man1
+
+object scalascript extends Command {
+ import _root_.scala.tools.docutil.ManPage._
+
+ protected def cn = new Error().getStackTrace()(0).getClassName()
+
+ val name = Section("NAME",
+
+ MBold(command) & " " & NDash & " Script runner for the " &
+ Link("Scala 2", "http://scala.epfl.ch/") & " language")
+
+ val synopsis = Section("SYNOPSIS",
+
+ CmdLine(" [ " & Argument("compiler args...") & " - ] " &
+ Argument("scriptfile") & " [ " & Argument("script args...") & " ]"))
+
+ val parameters = Section("PARAMETERS",
+
+ DefinitionList(
+ Definition(
+ Mono(Argument("compiler args")),
+ "Compiler arguments, exactly as for " & MBold("scalac") & ". " &
+ "The compiler arguments, if present, must be terminated by a " &
+ "bare hyphen."),
+ Definition(
+ Mono(Argument("scriptfile")),
+ "One source file to be interpreted."),
+ Definition(
+ Mono(Argument("script args")),
+ "Arguments to be passed to the script. They will be available " &
+ "via the " & Mono("argv") & " variable.")))
+
+ val description = Section("DESCRIPTION",
+
+ "The " & MBold(command) & " tool supports writing script files " &
+ "in Scala. To write a Scala script on Unix, start the file with the " &
+ "following header:",
+
+ CodeSample(
+ "#!/bin/sh\n" +
+ "exec scalascript \"$0\" \"$@\"\n" +
+ "!#"),
+
+ "To write a Scala script as a Microsoft Windows batch file, start " &
+ "the " & Mono(".bat") & " file with the following header:",
+
+ CodeSample(
+ "::#!\n" +
+ "@echo off\n" +
+ "call scalascript %0 %*\n" +
+ "goto :eof\n" +
+ "::!#"))
+
+ val examples = Section("EXAMPLES",
+
+ "Here is a complete Scala script for Unix that prints out a " &
+ "friendly greeting followed by all of the script's arguments:",
+
+ CodeSample(
+ "#!/bin/sh\n" +
+ "exec scalascript \"$0\" \"$@\"\n" +
+ "!#\n" +
+ "Console.println(\"Hello, world!\")\n" +
+ "argv.toList foreach Console.println"))
+
+ override val authors = Section("AUTHOR",
+
+ "Written by Lex Spoon.")
+
+ val seeAlso = Section("SEE ALSO",
+
+ Link(Bold("sbaz") & "(1)", "sbaz.html") & ", " &
+ Link(Bold("scala") & "(1)", "scala.html") & ", " &
+ Link(Bold("scalac") & "(1)", "scalac.html") & ", " &
+ Link(Bold("scaladoc") & "(1)", "scaladoc.html") & ", " &
+ Link(Bold("scalaint") & "(1)", "scalaint.html") & ", " &
+ Link(Bold("scalap") & "(1)", "scalap.html"))
+
+ def manpage = new Document {
+ title = command
+ date = "June 8, 2006"
+ author = "Stephane Micheloud"
+ version = "0.2"
+ sections = List(
+ name,
+ synopsis,
+ parameters,
+ description,
+ examples,
+ authors,
+ bugs,
+ copyright,
+ seeAlso)
+ }
+}
diff --git a/src/manual/scala/tools/docutil/EmitHtml.scala b/src/manual/scala/tools/docutil/EmitHtml.scala
new file mode 100644
index 0000000000..a7c10fd24a
--- /dev/null
+++ b/src/manual/scala/tools/docutil/EmitHtml.scala
@@ -0,0 +1,349 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2006 LAMP/EPFL
+ * @author Stephane Micheloud
+ * Adapted from Lex Spoon's sbaz manual
+ */
+//$Id: $
+
+package scala.tools.docutil
+
+object EmitHtml {
+ import scala.xml.{Node, NodeBuffer, NodeSeq, XML}
+ import ManPage._
+
+ val out = Console
+
+ def escape(text: String) =
+ text.replaceAll("&", "&amp;")
+ .replaceAll("<", "&lt;")
+ .replaceAll(">", "&gt;")
+
+/* */
+ def emitSection(section: Section, depth: int): Unit = {
+ def emitText(text: AbstractText): Unit =
+ text match {
+ case seq:SeqText =>
+ seq.components.foreach(emitText)
+
+ case Text(text) =>
+ out.print(escape(text))
+
+ case MDash =>
+ out.print("&#8212;")
+
+ case NDash =>
+ out.print("&#8211;")
+
+ case Bold(text) =>
+ out.print("<b>")
+ emitText(text)
+ out.print("</b>")
+
+ case Italic(text) =>
+ out.print("<i>")
+ emitText(text)
+ out.print("</i>")
+
+ case Emph(text) =>
+ out.print("<em>")
+ emitText(text)
+ out.print("</em>")
+
+ case Mono(text) =>
+ out.print("<code>")
+ emitText(text)
+ out.print("</code>")
+
+ case Quote(text) =>
+ out.print("\"")
+ emitText(text)
+ out.print("\"")
+
+ case DefinitionList(definitions @ _*) =>
+ out.println("<ins><dl>")
+ for (val d <- definitions) {
+ out.println("<dt>")
+ emitText(d.term)
+ out.println("\n</dt>")
+ out.println("<dd>")
+ emitText(d.description)
+ out.println("</dd>")
+ }
+ out.println("</dl></ins>")
+
+ case Link(label, url) =>
+ out.print("<a href=\"" + url + "\">")
+ emitText(label)
+ out.print("</a>")
+
+ case _ =>
+ error("unknown text node " + text)
+ }
+
+ def emitParagraph(para: Paragraph): Unit =
+ para match {
+ case TextParagraph(text) =>
+ out.println("<p>")
+ emitText(text)
+ out.println("</p>")
+
+ case BlockQuote(text) =>
+ out.println("<blockquote><p>")
+ emitText(text)
+ out.println("</p></blockquote>")
+
+ case CodeSample(text) =>
+ out.print("<pre>")
+ out.print(escape(text))
+ out.println("</pre>")
+
+ case lst:BulletList =>
+ out.println("<ul>")
+ for (val item <- lst.items) {
+ out.print("<li>")
+ emitText(item)
+ out.println("</li>")
+ }
+ out.println("</ul>")
+
+ case lst:NumberedList =>
+ out.println("<ol>")
+ for(val item <- lst.items) {
+ out.print("<li>")
+ emitText(item)
+ }
+ out.println("</ol>")
+
+ case TitledPara(title, text) =>
+ out.println("<p><strong>" + escape(title) + "</strong></p>")
+ emitText(text)
+
+ case EmbeddedSection(sect) =>
+ emitSection(sect, depth + 1)
+
+ case _ =>
+ error("unknown paragraph node " + para)
+ }
+
+ val name = section.title.replaceAll("\\p{Space}", "_").toLowerCase()
+ out.println("\n<h" + depth + " id=\"" + name + "\">" +
+ section.title +
+ "</h" + depth + ">")
+ section.paragraphs.foreach(emitParagraph)
+ }
+
+ private def emit3columns(col1: String, col2: String, col3: String) = {
+ out.println("<div style=\"float:left;\">")
+ out.println(col1)
+ out.println("</div>")
+ out.println("<div style=\"float:right;\">")
+ out.println(col3)
+ out.println("</div>")
+ out.println("<div style=\"text-align:center;\">")
+ out.println(col2)
+ out.println("</div>")
+ }
+
+ private def emitHeader(col1: String, col2: String, col3: String) = {
+ out.println("<!-- header -->")
+ out.println("<div style=\"margin: 0 0 2em 0;\">")
+ emit3columns(col1, col2, col3)
+ out.println("</div>")
+ }
+
+ private def emitFooter(col1: String, col2: String, col3: String) = {
+ out.println("<!-- footer -->")
+ out.println("<div style=\"margin: 2em 0 0 0;\">")
+ emit3columns(col1, col2, col3)
+ out.println("</div>")
+ }
+
+ def emitDocument(document: Document, addDocType: Boolean) = {
+ if (addDocType) {
+ out.println("<?xml version=\"1.1\" encoding=\"" + document.encoding + "\"?>")
+ out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">")
+ }
+ out.println("<html xml:lang=\"en\">")
+
+ out.println("<head>")
+ out.println("<title>" + document.title + " man page</title>")
+ out.println("<meta http-equiv=\"Content-Language\" content=\"en\"/>")
+ out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" +
+ document.encoding + "\"/>")
+ out.println("<meta name=\"Author\" content=\"" + document.author + "\"/>")
+ out.println("<style type=\"text/css\">")
+ out.println(" <!--")
+ out.println(" blockquote, pre { margin:1em 4em 1em 4em; }")
+ out.println(" p { margin:0 2em 0 2em; text-align:justify; }")
+ out.println(" //-->")
+ out.println("</style>")
+ out.println("</head>")
+
+ out.println("<body>")
+ val name = document.title + "(" + document.category.id + ")"
+ emitHeader(name, "" + document.category, name)
+
+ document.sections.foreach(s => emitSection(s, 3))
+
+ emitFooter("version " + document.version, document.date, name)
+
+ out.println("</body>")
+ out.println("</html>")
+ }
+/* */
+/*
+ private def group(ns: Iterable[NodeSeq]): NodeSeq = {
+ val zs = new NodeBuffer
+ for (val z <- ns) { zs &+ z }
+ zs
+ }
+
+ def emitSection(section: Section, depth: int): NodeSeq = {
+ def emitText(text: AbstractText): NodeSeq = text match {
+ case seq:SeqText =>
+ group(seq.components.toList.map(item => emitText(item)))
+
+ case Text(text) =>
+ scala.xml.Text(escape(text))
+
+ case MDash =>
+ scala.xml.Text("&#8212;")
+
+ case NDash =>
+ scala.xml.Text("&#8211;")
+
+ case Bold(text) =>
+ <b>{emitText(text)}</b>
+
+ case Italic(text) =>
+ <i>{emitText(text)}</i>
+
+ case Emph(text) =>
+ <em>{emitText(text)}</em>
+
+ case Mono(text) =>
+ <code>{emitText(text)}</code>
+
+ case Quote(text) =>
+ emitText("\"" & text & "\"")
+
+ case DefinitionList(definitions @ _*) =>
+ <ins><dl>
+ {definitions.toList.map(d =>
+ <dt>{emitText(d.term)}</dt>
+ <dd>{emitText(d.description)}</dd>
+ )}
+ </dl></ins>
+
+ case Link(label, url) =>
+ <a href={url}>{emitText(label)}</a>
+
+ case _ =>
+ error("unknown text node " + text)
+ }
+
+ def emitParagraph(para: Paragraph): NodeSeq = para match {
+ case TextParagraph(text) =>
+ <p>{emitText(text)}</p>
+
+ case BlockQuote(text) =>
+ <blockquote>{emitText(text)}</blockquote>
+
+ case CodeSample(text) =>
+ <blockquote><pre>{escape(text)}</pre></blockquote>
+
+ case lst:BulletList =>
+ <ul>
+ {lst.items.toList.map(item => <li>{emitText(item)}</li>)}
+ </ul>
+
+ case lst:NumberedList =>
+ <ol>
+ {lst.items.toList.map(item => <li>{emitText(item)}</li>)}
+ </ol>
+
+ case TitledPara(title, text) =>
+ <p><strong>{escape(title)}</strong></p>
+ {emitText(text)}
+
+ case EmbeddedSection(sect) =>
+ {emitSection(sect, depth + 1)}
+
+ case _ =>
+ error("unknown paragraph node " + para)
+ }
+
+ val name = section.title.replaceAll("\\p{Space}", "_").toLowerCase()
+ <h3 id={name}>{section.title}</h3>.concat(
+ group(section.paragraphs.toList.map(p => emitParagraph(p))))
+ }
+
+ private def emit3columns(col1: String, col2: String, col3: String): NodeSeq =
+ <div style="float:left;">{col1}</div>
+ <div style="float:right;">{col3}</div>
+ <div style="text-align:center;">{col2}</div>
+ <div style="clear:both;"></div>
+
+ private def emitHeader(col1: String, col2: String, col3: String): NodeSeq =
+ <div style="margin: 0 0 2em 0;">
+ {emit3columns(col1, col2, col3)}
+ </div>
+
+ private def emitFooter(col1: String, col2: String, col3: String): NodeSeq = {
+ scala.xml.Comment("footer")
+ <div style="margin: 2em 0 0 0;">
+ {emit3columns(col1, col2, col3)}
+ </div>
+ }
+
+ def emitDocument(document: Document, addDocType: Boolean) = {
+ val name = document.title + "(" + document.category.id + ")"
+ val doc =
+ <html xml:lang="en">
+ <head>
+ <title>{document.title}</title>
+ <meta http-equiv="Content-Language" content="en"/>
+ <meta http-equiv="Content-Type" content={"text/html; charset=" + document.encoding}/>
+ <meta name="Author" content={document.author}/>
+ <style type="text/css">
+ {" blockquote, pre { margin:1em 4em 1em 4em; }\n" +
+ " p { margin:1em 2em 1em 2em; text-align:justify; }\n"}
+ </style>
+ </head>
+ <body>
+ {emitHeader(name, "" + document.category, name)}
+ {document.sections.map(s => emitSection(s, 2))}
+ {emitFooter("version " + document.version, document.date, name)}
+ </body>
+ </html>
+ out.println(doc)
+/*
+ val w = new java.io.StringWriter
+ val id = scala.xml.dtd.PublicID("PUBLIC", null)
+ val dtd = null //scala.xml.dtd.DEFAULT(true, "")
+ val doctype = scala.xml.dtd.DocType("html", id, null) //List(dtd))
+ XML.write(w, doc, document.encoding, true/ *xmlDecl* /, doctype)
+ out.println(w.toString())
+*/
+ }
+*/
+ def main(args: Array[String]) = {
+ if (args.length < 1) {
+ System.err.println("usage: EmitHtml <classname> [ -short ]")
+ exit(1)
+ }
+ try {
+ val cl = ClassLoader.getSystemClassLoader()
+ val clasz = cl.loadClass(args(0))
+ val meth = clasz.getDeclaredMethod("manpage", Predef.Array[Class]())
+ val doc = meth.invoke(null, Predef.Array[Object]()).asInstanceOf[Document]
+ val addDocType = (args.length > 1 && "-doctype".equals(args(1)))
+ emitDocument(doc, addDocType)
+ } catch {
+ case ex: Exception =>
+ ex.printStackTrace()
+ System.err.println("Error in EmitHtml")
+ exit(1)
+ }
+ }
+}
diff --git a/src/manual/scala/tools/docutil/EmitManPage.scala b/src/manual/scala/tools/docutil/EmitManPage.scala
new file mode 100644
index 0000000000..888a4cac5a
--- /dev/null
+++ b/src/manual/scala/tools/docutil/EmitManPage.scala
@@ -0,0 +1,165 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2006 LAMP/EPFL
+ * @author Stephane Micheloud
+ * Adapted from Lex Spoon's sbaz manual
+ */
+//$Id: $
+
+package scala.tools.docutil
+
+// For help on man pages see:
+// - http://www.linuxfocus.org/English/November2003/article309.shtml
+// - http://www.schweikhardt.net/man_page_howto.html
+
+object EmitManPage {
+ import ManPage._
+
+ val out = Console
+
+ def escape(text: String) =
+ text.replaceAll("-", "\\-")
+
+ def emitSection(section: Section, depth: int): Unit = {
+ def emitText(text: AbstractText): Unit =
+ text match {
+ case seq:SeqText =>
+ seq.components.foreach(emitText)
+
+ case Text(text) =>
+ out.print(escape(text))
+
+ case NDash | MDash =>
+ out.print("\\-")
+
+ case Bold(text) =>
+ out.print("\\fB")
+ emitText(text)
+ out.print("\\fR")
+
+ case Italic(text) =>
+ out.print("\\fI")
+ emitText(text)
+ out.print("\\fR")
+
+ case Emph(text) =>
+ out.print("\\fI")
+ emitText(text)
+ out.print("\\fI")
+
+ case Mono(text) =>
+ out.print("")
+ emitText(text)
+ out.print("")
+
+ case Quote(text) =>
+ out.print("\"")
+ emitText(text)
+ out.print("\"")
+
+ case DefinitionList(definitions @ _*) =>
+ var n = definitions.length
+ for (val d <- definitions) {
+ out.println(".TP")
+ emitText(d.term)
+ out.println
+ emitText(d.description)
+ if (n > 1) { out.println; n = n - 1 }
+ }
+
+ case Link(label, url) =>
+ emitText(label)
+
+ case _ =>
+ error("unknown text node " + text)
+ }
+
+ def emitParagraph(para: Paragraph): Unit =
+ para match {
+ case TextParagraph(text) =>
+ out.println(".PP")
+ emitText(text)
+ out.println
+
+ case BlockQuote(text) =>
+ out.println(".TP")
+ emitText(text)
+ out.println
+
+ case CodeSample(text) =>
+ out.println("\n.nf")
+ out.print(text)
+ out.println("\n.fi")
+
+ case lst:BulletList =>
+ out.println("<ul>")
+ for(val item <- lst.items) {
+ out.print("<li>")
+ emitText(item)
+ }
+ out.println("</ul>")
+
+ case lst:NumberedList =>
+ out.println("<ol>")
+ for(val item <- lst.items) {
+ out.print("<li>")
+ emitText(item)
+ }
+ out.println("</ol>")
+
+ case TitledPara(title, text) =>
+ out.println("<p><strong>" + escape(title) + "</strong>")
+ emitText(text)
+
+ case EmbeddedSection(sect) =>
+ emitSection(sect, depth+1)
+
+ case _ =>
+ error("unknown paragraph node " + para)
+ }
+
+ out.println(".\\\"")
+ out.println(".\\\" ############################## " + section.title + " ###############################")
+ out.println(".\\\"")
+ val tag = if (depth > 1) ".SS" else ".SH"
+ val title =
+ if (section.title.indexOf(" ") > 0) "\"" + section.title + "\""
+ else section.title
+ out.println(tag + " " + title)
+
+ section.paragraphs.foreach(emitParagraph)
+ }
+
+ def emitDocument(doc: Document) = {
+ out.println(".\\\" ##########################################################################")
+ out.println(".\\\" # __ #")
+ out.println(".\\\" # ________ ___ / / ___ Scala 2 On-line Manual Pages #")
+ out.println(".\\\" # / __/ __// _ | / / / _ | (c) 2002-2006, LAMP/EPFL #")
+ out.println(".\\\" # __\\ \\/ /__/ __ |/ /__/ __ | #")
+ out.println(".\\\" # /____/\\___/_/ |_/____/_/ | | http://scala.epfl.ch/ #")
+ out.println(".\\\" # |/ #")
+ out.println(".\\\" ##########################################################################")
+ out.println(".\\\"")
+ out.println(".\\\" Process this file with nroff -man scala.1")
+ out.println(".\\\"")
+ out.println(".TH " + doc.title + " " + doc.category.id +
+ " \"" + doc.date + "\" \"version " + doc.version +
+ "\" \"" + doc.category + "\"")
+
+ doc.sections.foreach(s => emitSection(s, 1))
+ }
+
+ def main(args: Array[String]) =
+ try {
+ val cl = ClassLoader.getSystemClassLoader()
+ val clasz = cl.loadClass(args(0))
+ val meth = clasz.getDeclaredMethod("manpage", Predef.Array[Class]())
+ val doc = meth.invoke(null, Predef.Array[Object]()).asInstanceOf[Document]
+ emitDocument(doc)
+ } catch {
+ case ex: Exception =>
+ ex.printStackTrace()
+ System.err.println("Error in EmitManPage")
+ exit(1)
+ }
+
+}
diff --git a/src/manual/scala/tools/docutil/ManPage.scala b/src/manual/scala/tools/docutil/ManPage.scala
new file mode 100644
index 0000000000..3d23d69064
--- /dev/null
+++ b/src/manual/scala/tools/docutil/ManPage.scala
@@ -0,0 +1,68 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2006 LAMP/EPFL
+ * @author Stephane Micheloud
+ * Adapted from Lex Spoon's sbaz manual
+ */
+//$Id: $
+
+package scala.tools.docutil
+
+object ManPage {
+ abstract class AbstractText {
+ def &(more: AbstractText) = SeqText(this, more)
+ }
+
+ case class SeqText(components: AbstractText*) extends AbstractText
+ case class Text(text: String) extends AbstractText
+ case object MDash extends AbstractText
+ case object NDash extends AbstractText
+ case class Bold(contents: AbstractText) extends AbstractText
+ case class Italic(contents: AbstractText) extends AbstractText
+ case class Emph(contents: AbstractText) extends AbstractText
+ case class Mono(contents: AbstractText) extends AbstractText
+ case class Quote(contents: AbstractText) extends AbstractText
+ implicit def str2text(str: String) = Text(str)
+
+ case class Definition(term: AbstractText, description: AbstractText)
+ case class DefinitionList(definitions: Definition*) extends AbstractText
+ case class Link(label: AbstractText, url: String) extends AbstractText
+
+ case class DefnItem(header: String, text: AbstractText)
+
+ abstract class Paragraph
+ case class TextParagraph(text: AbstractText) extends Paragraph
+ case class CodeSample(text: String) extends Paragraph
+ case class BlockQuote(text: AbstractText) extends Paragraph
+ implicit def text2para(text: AbstractText): Paragraph = TextParagraph(text)
+ implicit def str2para(str: String) = text2para(str2text(str))
+
+ case class BulletList(items: AbstractText*) extends Paragraph
+ case class NumberedList(items: AbstractText*) extends Paragraph
+ case class TitledPara(title: String, text: AbstractText) extends Paragraph
+
+ case class EmbeddedSection(section: Section) extends Paragraph
+ implicit def section2Para(section: Section) = EmbeddedSection(section)
+
+ case class Section(title: String, paragraphs: Paragraph*)
+
+ object Category extends Enumeration {
+ val USER_COMMANDS = Value(1, "USER COMMANDS")
+ val SYSTEM_CALLS = Value(2, "SYSTEM CALLS")
+ val SUBROUTINES = Value(3, "SUBROUTINES")
+ val DEVICES = Value(4, "DEVICES")
+ val FILE_FORMATS = Value(5, "FILE FORMAT DESCRIPTIONS")
+ val GAMES = Value(6, "GAMES")
+ val MISCELLANEOUS = Value(7, "MISCELLANEOUS")
+ }
+
+ abstract class Document {
+ import Category._
+ var title: String = ""
+ var author: String = ""
+ var date: String = ""
+ var version: String = ""
+ var category: Value = USER_COMMANDS
+ var encoding: String = "iso-8859-1"
+ var sections: List[Section] = Nil
+ }
+}
diff --git a/src/manual/scala/tools/docutil/resources/css/style.css b/src/manual/scala/tools/docutil/resources/css/style.css
new file mode 100644
index 0000000000..3072be4012
--- /dev/null
+++ b/src/manual/scala/tools/docutil/resources/css/style.css
@@ -0,0 +1,66 @@
+.SansSerif {
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+.ContentList { font-size: 90%; style: margin-left: 3.4em; }
+
+.Note {
+ margin-left: 4em;
+ margin-right: 4em;
+ font-size: 90%;
+}
+
+/* see http://www.maxdesign.com.au/presentation/external/ */
+a.external span {
+ position: absolute;
+ left: -5000px;
+ width: 4000px;
+}
+
+a.external:link {
+ background: url(../images/external.gif) no-repeat 100% 0;
+ padding: 0px 20px 0px 0px;
+}
+
+a.external:visited {
+ color: purple;
+ background-color: white;
+ background: url(../images/external.gif) no-repeat 100% -100px;
+ padding: 0px 20px 0px 0px;
+}
+
+a.external:hover {
+ color: red;
+ background-color: white;
+ background: url(../images/external.gif) no-repeat 100% -200px;
+ padding: 0px 20px 0px 0px;
+}
+
+h2 { font-family: Arial, Helvetica, sans-serif; }
+
+h3 {
+ margin-left: 1.4em;
+ margin-bottom: .1em;
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+hr {
+ margin: 1em 0 1em 0;
+}
+
+img {
+ border:none;
+}
+
+li {
+ margin-left: 1.7em;
+}
+
+span.tool {
+ font-family: Courier, Sans-Serif;
+ font-weight: bold;
+}
+
+th {
+ white-space: nowrap;
+}
diff --git a/src/manual/scala/tools/docutil/resources/images/external.gif b/src/manual/scala/tools/docutil/resources/images/external.gif
new file mode 100644
index 0000000000..dc962b779d
--- /dev/null
+++ b/src/manual/scala/tools/docutil/resources/images/external.gif
Binary files differ
diff --git a/src/manual/scala/tools/docutil/resources/images/scala_logo.png b/src/manual/scala/tools/docutil/resources/images/scala_logo.png
new file mode 100644
index 0000000000..f89a81c1af
--- /dev/null
+++ b/src/manual/scala/tools/docutil/resources/images/scala_logo.png
Binary files differ
diff --git a/src/manual/scala/tools/docutil/resources/index.html b/src/manual/scala/tools/docutil/resources/index.html
new file mode 100644
index 0000000000..3a728604ca
--- /dev/null
+++ b/src/manual/scala/tools/docutil/resources/index.html
@@ -0,0 +1,211 @@
+<?xml version="1.1" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xml:lang="en">
+
+<head>
+ <title>Scala Development Tools</title>
+ <meta http-equiv="Content-Script-Type" content="text/javascript"/>
+ <meta http-equiv="Content-Style-Type" content="text/css"/>
+ <meta http-equiv="Content-Language" content="en"/>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+ <meta name="Copyright" content="(C) 2002-2006 LAMP/EPFL"/>
+ <meta name="Language" content="en"/>
+ <meta name="Description" content="The Scala Programming Language"/>
+ <meta name="Author" content="Stephane Micheloud"/>
+ <link rel="stylesheet" type="text/css" media="all" href="./css/style.css"/>
+</head>
+
+<body>
+<div style="float:left; width:20%;">
+ <a href="http://scala.epfl.ch/">
+ <img src="images/scala_logo.png" alt="Scala" width="80" height="55"/></a>
+</div>
+<div style="float:right; width:20%;">
+ &nbsp; <!-- Documentation Contents -->
+</div>
+<div style="text-align:center; margin:1em;">
+ <h2>Scala Tools and Utilities</h2>
+</div>
+<div style="clear:both;"/>
+
+<div style="background-color:#eeeeee; margin:1.6em; padding:0.4em;">
+
+<h3>General</h3>
+
+<ul class="ContentList">
+ <li>
+ <a href="#general"><b class="SansSerif">General Information</b></a>
+ <!--(file structure, classpath, how classes are found, changes)-->
+ (classpath, how classes are found)
+ </li>
+</ul>
+
+<h3>Standard Scala Tools and Utilities</h3>
+
+<ul class="ContentList">
+ <li>
+ <a href="#basic"><b class="SansSerif">Basic Tools</b></a> (<code>sbaz</code>,
+ <code>scala</code>, <code>scalac</code>, <code>scaladoc</code>,
+ <code>scalaint</code>, <code>scalap</code>, <code>scalascript</code>)
+ </li>
+</ul>
+</div>
+
+<p style="font-size: 90%; margin-left: 2em; margin-right: 2em;">
+ <b>NOTE</b> - Some tools have separate reference pages for Windows, Linux and Solaris
+ to accommodate minor differences in configuration and usage -- for example, the character
+ used to specify directory separators may be different.
+</p>
+
+<hr/>
+
+<h2 id="general">
+ General Information
+</h2>
+<p>
+ The following documents contain important information you will need to
+ know to get the most out of the SDK tools.
+</p>
+
+
+<table cellspacing="0" cellpadding="2">
+<!--
+<tr>
+ <td>
+ <b>JDK File Structure</B>
+ </td>
+ <td NOWRAP>
+ [<A href="solaris/jdkfiles.html">Solaris</A>]
+ [<A href="linux/jdkfiles.html">Linux</A>]
+ [<A href="windows/jdkfiles.html">Windows</A>]
+ </td>
+</tr>
+-->
+<tr>
+ <td>
+ <b>Setting the Classpath</B>
+ </td>
+ <td>
+ [<a class="external"
+ href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html">Solaris and Linux</a>]
+ [<a class="external"
+ href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html">Windows</a>]
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <b>How Classes are Found</B>
+ </td>
+ <td>
+ [<a class="external"
+ href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/findingclasses.html">Solaris, Linux and Windows</a>]
+ </td>
+</tr>
+</table>
+
+<hr>
+<h2 id="basic">
+ Basic Tools
+</h2>
+
+<p>
+ These tools are the foundation of the Scala SDK. They are the tools you
+ use to create and build applications.
+</p>
+
+<table cellspacing="0" cellpadding="2" style="width:100%;">
+ <tr>
+ <th>Tool Name</th>
+ <th>Brief Description</th>
+ <th>Links to Reference Pages</th>
+ </tr>
+ <tr>
+ <td width="13%" valign="top">
+ <span class="tool">sbaz</span>
+ </td>
+ <td width="70%" valign="top">
+ The Scala sharing tool.
+ </td>
+ <td width="17%" valign="top">
+ [<a href="sbaz.html">Solaris, Linux and Windows</a>]
+ </td>
+ </tr>
+ <tr>
+ <td width="13%" valign="top">
+ <span class="tool">scala</span>
+ </td>
+ <td width="70%" valign="top">
+ The launcher for Scala applications.
+ </td>
+ <td width="17%" valign="top">
+ [<a href="scala.html">Solaris, Linux and Windows</a>]
+ </td>
+ </tr>
+ <tr>
+ <td width="13%" valign="top">
+ <span class="tool">scalac</span>
+ </td>
+ <td width="70%" valign="top">
+ The compiler for the Scala programming language.
+ </td>
+ <td width="17%" valign="top">
+ [<a href="scalac.html">Solaris, Linux and Windows</a>]
+ </td>
+ </tr>
+ <tr>
+ <td width="13%" valign="top">
+ <span class="tool">scaladoc</span>
+ </td>
+ <td width="70%" valign="top">
+ The API document generator.
+ </td>
+ <td width="17%" valign="top">
+ [<a href="scaladoc.html">Solaris, Linux and Windows</a>]
+ </td>
+ </tr>
+ <tr>
+ <td width="13%" valign="top">
+ <span class="tool">scalaint</span>
+ </td>
+ <td width="70%" valign="top">
+ The interactive interpreter to the Scala programming language.
+ </td>
+ <td width="17%" valign="top">
+ [<a href="scalaint.html">Solaris, Linux and Windows</a>]
+ </td>
+ </tr>
+ <tr>
+ <td width="13%" valign="top">
+ <span class="tool">scalap</span>
+ </td>
+ <td width="70%" valign="top">
+ The Scala class file decoder.
+ </td>
+ <td width="17%" valign="top">
+ [<a href="scalap.html">Solaris, Linux and Windows</a>]
+ </td>
+ </tr>
+ <tr>
+ <td width="13%" valign="top">
+ <span class="tool">scalascript</span>
+ </td>
+ <td width="70%" valign="top">
+ The Scala scripting tool.
+ </td>
+ <td width="17%" valign="top">
+ [<a href="scalascript.html">Solaris, Linux and Windows</a>]
+ </td>
+ </tr>
+</table>
+
+ <hr/>
+
+ <div style="font-size:x-small;">
+ Copyright (c) 2002-2006 <a href="http://www.epfl.ch/">EPFL</a>,
+ Lausanne, unless specified otherwise.<br/>
+ All rights reserved.
+ </div>
+
+</body>
+</html>