From 1c43cfe216a0d759568a964a16345ea773f32211 Mon Sep 17 00:00:00 2001 From: michelou Date: Mon, 12 Jun 2006 14:18:13 +0000 Subject: moved docs/man/src to src/manual and updated bu... moved docs/man/src to src/manual and updated build.xml --- src/manual/scala/man1/Command.scala | 57 ++++ src/manual/scala/man1/sbaz.scala | 181 +++++++++++ src/manual/scala/man1/scala.scala | 148 +++++++++ src/manual/scala/man1/scalac.scala | 315 +++++++++++++++++++ src/manual/scala/man1/scaladoc.scala | 110 +++++++ src/manual/scala/man1/scalaint.scala | 80 +++++ src/manual/scala/man1/scalap.scala | 110 +++++++ src/manual/scala/man1/scalascript.scala | 102 ++++++ src/manual/scala/tools/docutil/EmitHtml.scala | 349 +++++++++++++++++++++ src/manual/scala/tools/docutil/EmitManPage.scala | 165 ++++++++++ src/manual/scala/tools/docutil/ManPage.scala | 68 ++++ .../scala/tools/docutil/resources/css/style.css | 66 ++++ .../tools/docutil/resources/images/external.gif | Bin 0 -> 289 bytes .../tools/docutil/resources/images/scala_logo.png | Bin 0 -> 4751 bytes .../scala/tools/docutil/resources/index.html | 211 +++++++++++++ 15 files changed, 1962 insertions(+) create mode 100644 src/manual/scala/man1/Command.scala create mode 100644 src/manual/scala/man1/sbaz.scala create mode 100644 src/manual/scala/man1/scala.scala create mode 100644 src/manual/scala/man1/scalac.scala create mode 100644 src/manual/scala/man1/scaladoc.scala create mode 100644 src/manual/scala/man1/scalaint.scala create mode 100644 src/manual/scala/man1/scalap.scala create mode 100644 src/manual/scala/man1/scalascript.scala create mode 100644 src/manual/scala/tools/docutil/EmitHtml.scala create mode 100644 src/manual/scala/tools/docutil/EmitManPage.scala create mode 100644 src/manual/scala/tools/docutil/ManPage.scala create mode 100644 src/manual/scala/tools/docutil/resources/css/style.css create mode 100644 src/manual/scala/tools/docutil/resources/images/external.gif create mode 100644 src/manual/scala/tools/docutil/resources/images/scala_logo.png create mode 100644 src/manual/scala/tools/docutil/resources/index.html (limited to 'src/manual') 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("") & ".") + + //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("&", "&") + .replaceAll("<", "<") + .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 MDash => + out.print("—") + + case NDash => + out.print("–") + + case Bold(text) => + out.print("") + emitText(text) + out.print("") + + case Italic(text) => + out.print("") + emitText(text) + out.print("") + + case Emph(text) => + out.print("") + emitText(text) + out.print("") + + case Mono(text) => + out.print("") + emitText(text) + out.print("") + + case Quote(text) => + out.print("\"") + emitText(text) + out.print("\"") + + case DefinitionList(definitions @ _*) => + out.println("
") + for (val d <- definitions) { + out.println("
") + emitText(d.term) + out.println("\n
") + out.println("
") + emitText(d.description) + out.println("
") + } + out.println("
") + + case Link(label, url) => + out.print("") + emitText(label) + out.print("") + + case _ => + error("unknown text node " + text) + } + + def emitParagraph(para: Paragraph): Unit = + para match { + case TextParagraph(text) => + out.println("

") + emitText(text) + out.println("

") + + case BlockQuote(text) => + out.println("

") + emitText(text) + out.println("

") + + case CodeSample(text) => + out.print("
")
+          out.print(escape(text))
+          out.println("
") + + case lst:BulletList => + out.println("") + + case lst:NumberedList => + out.println("
    ") + for(val item <- lst.items) { + out.print("
  1. ") + emitText(item) + } + out.println("
") + + case TitledPara(title, text) => + out.println("

" + escape(title) + "

") + 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" + + section.title + + "") + section.paragraphs.foreach(emitParagraph) + } + + private def emit3columns(col1: String, col2: String, col3: String) = { + out.println("
") + out.println(col1) + out.println("
") + out.println("
") + out.println(col3) + out.println("
") + out.println("
") + out.println(col2) + out.println("
") + } + + private def emitHeader(col1: String, col2: String, col3: String) = { + out.println("") + out.println("
") + emit3columns(col1, col2, col3) + out.println("
") + } + + private def emitFooter(col1: String, col2: String, col3: String) = { + out.println("") + out.println("
") + emit3columns(col1, col2, col3) + out.println("
") + } + + def emitDocument(document: Document, addDocType: Boolean) = { + if (addDocType) { + out.println("") + out.println("") + } + out.println("") + + out.println("") + out.println("" + document.title + " man page") + out.println("") + out.println("") + out.println("") + out.println("") + out.println("") + + out.println("") + 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("") + out.println("") + } +/* */ +/* + 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("—") + + case NDash => + scala.xml.Text("–") + + case Bold(text) => + {emitText(text)} + + case Italic(text) => + {emitText(text)} + + case Emph(text) => + {emitText(text)} + + case Mono(text) => + {emitText(text)} + + case Quote(text) => + emitText("\"" & text & "\"") + + case DefinitionList(definitions @ _*) => +
+ {definitions.toList.map(d => +
{emitText(d.term)}
+
{emitText(d.description)}
+ )} +
+ + case Link(label, url) => + {emitText(label)} + + case _ => + error("unknown text node " + text) + } + + def emitParagraph(para: Paragraph): NodeSeq = para match { + case TextParagraph(text) => +

{emitText(text)}

+ + case BlockQuote(text) => +
{emitText(text)}
+ + case CodeSample(text) => +
{escape(text)}
+ + case lst:BulletList => + + + case lst:NumberedList => +
    + {lst.items.toList.map(item =>
  1. {emitText(item)}
  2. )} +
+ + case TitledPara(title, text) => +

{escape(title)}

+ {emitText(text)} + + case EmbeddedSection(sect) => + {emitSection(sect, depth + 1)} + + case _ => + error("unknown paragraph node " + para) + } + + val name = section.title.replaceAll("\\p{Space}", "_").toLowerCase() +

{section.title}

.concat( + group(section.paragraphs.toList.map(p => emitParagraph(p)))) + } + + private def emit3columns(col1: String, col2: String, col3: String): NodeSeq = +
{col1}
+
{col3}
+
{col2}
+
+ + private def emitHeader(col1: String, col2: String, col3: String): NodeSeq = +
+ {emit3columns(col1, col2, col3)} +
+ + private def emitFooter(col1: String, col2: String, col3: String): NodeSeq = { + scala.xml.Comment("footer") +
+ {emit3columns(col1, col2, col3)} +
+ } + + def emitDocument(document: Document, addDocType: Boolean) = { + val name = document.title + "(" + document.category.id + ")" + val doc = + + + {document.title} + + + + + + {emitHeader(name, "" + document.category, name)} + {document.sections.map(s => emitSection(s, 2))} + {emitFooter("version " + document.version, document.date, name)} + + + 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 [ -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("
    ") + for(val item <- lst.items) { + out.print("
  • ") + emitText(item) + } + out.println("
") + + case lst:NumberedList => + out.println("
    ") + for(val item <- lst.items) { + out.print("
  1. ") + emitText(item) + } + out.println("
") + + case TitledPara(title, text) => + out.println("

" + escape(title) + "") + 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 Binary files /dev/null and b/src/manual/scala/tools/docutil/resources/images/external.gif 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 Binary files /dev/null and b/src/manual/scala/tools/docutil/resources/images/scala_logo.png 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 @@ + + + + + + Scala Development Tools + + + + + + + + + + + + +

+ + Scala +
+
+   +
+
+

Scala Tools and Utilities

+
+
+ +
+ +

General

+ + + +

Standard Scala Tools and Utilities

+ +
    +
  • + Basic Tools (sbaz, + scala, scalac, scaladoc, + scalaint, scalap, scalascript) +
  • +
+
+ +

+ NOTE - 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. +

+ +
+ +

+ General Information +

+

+ The following documents contain important information you will need to + know to get the most out of the SDK tools. +

+ + + + + + + + + + + + + +
+ Setting the Classpath + + [Solaris and Linux] + [Windows] +
+ How Classes are Found + + [Solaris, Linux and Windows] +
+ +
+

+ Basic Tools +

+ +

+ These tools are the foundation of the Scala SDK. They are the tools you + use to create and build applications. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tool NameBrief DescriptionLinks to Reference Pages
+ sbaz + + The Scala sharing tool. + + [Solaris, Linux and Windows] +
+ scala + + The launcher for Scala applications. + + [Solaris, Linux and Windows] +
+ scalac + + The compiler for the Scala programming language. + + [Solaris, Linux and Windows] +
+ scaladoc + + The API document generator. + + [Solaris, Linux and Windows] +
+ scalaint + + The interactive interpreter to the Scala programming language. + + [Solaris, Linux and Windows] +
+ scalap + + The Scala class file decoder. + + [Solaris, Linux and Windows] +
+ scalascript + + The Scala scripting tool. + + [Solaris, Linux and Windows] +
+ +
+ +
+ Copyright (c) 2002-2006 EPFL, + Lausanne, unless specified otherwise.
+ All rights reserved. +
+ + + -- cgit v1.2.3