From 61bfe2d70cae6be8c4086a210a5451135ccca9ea Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sat, 2 Aug 2008 08:21:29 +0000 Subject: added doc tool --- docs/tool/Config/Languages.txt | 286 ++ docs/tool/Config/Topics.txt | 382 ++ docs/tool/Help/customizinglanguages.html | 52 + docs/tool/Help/customizingtopics.html | 74 + docs/tool/Help/documenting.html | 58 + docs/tool/Help/documenting/reference.html | 146 + docs/tool/Help/documenting/walkthrough.html | 180 + docs/tool/Help/example/Default.css | 528 +++ docs/tool/Help/example/NaturalDocs.js | 204 ++ docs/tool/Help/examples.css | 90 + docs/tool/Help/images/header/background.png | Bin 0 -> 229 bytes docs/tool/Help/images/header/leftside.png | Bin 0 -> 1215 bytes docs/tool/Help/images/header/logo.png | Bin 0 -> 12146 bytes docs/tool/Help/images/header/overbody.png | Bin 0 -> 283 bytes docs/tool/Help/images/header/overbodybg.png | Bin 0 -> 141 bytes docs/tool/Help/images/header/overleftmargin.png | Bin 0 -> 188 bytes docs/tool/Help/images/header/overmenu.png | Bin 0 -> 244 bytes docs/tool/Help/images/header/overmenubg.png | Bin 0 -> 141 bytes docs/tool/Help/images/header/rightside.png | Bin 0 -> 1186 bytes docs/tool/Help/images/logo.gif | Bin 0 -> 8221 bytes docs/tool/Help/images/menu/about.png | Bin 0 -> 397 bytes docs/tool/Help/images/menu/background.png | Bin 0 -> 187 bytes docs/tool/Help/images/menu/bottomleft.png | Bin 0 -> 235 bytes docs/tool/Help/images/menu/bottomright.png | Bin 0 -> 234 bytes docs/tool/Help/images/menu/community.png | Bin 0 -> 507 bytes docs/tool/Help/images/menu/customizing.png | Bin 0 -> 575 bytes docs/tool/Help/images/menu/using.png | Bin 0 -> 390 bytes docs/tool/Help/index.html | 9 + docs/tool/Help/javascript/BrowserStyles.js | 77 + docs/tool/Help/javascript/PNGHandling.js | 72 + docs/tool/Help/keywords.html | 38 + docs/tool/Help/languages.html | 32 + docs/tool/Help/menu.html | 79 + docs/tool/Help/output.html | 84 + docs/tool/Help/running.html | 40 + docs/tool/Help/styles.css | 290 ++ docs/tool/Help/styles.html | 52 + docs/tool/Help/troubleshooting.html | 18 + docs/tool/Info/CSSGuide.txt | 947 +++++ docs/tool/Info/File Parsing.txt | 83 + docs/tool/Info/HTMLTestCases.pm | 269 ++ docs/tool/Info/Languages.txt | 107 + docs/tool/Info/NDMarkup.txt | 91 + docs/tool/Info/Symbol Management.txt | 59 + docs/tool/Info/images/Logo.png | Bin 0 -> 12405 bytes docs/tool/JavaScript/NaturalDocs.js | 836 +++++ docs/tool/License-GPL.txt | 341 ++ docs/tool/Modules/NaturalDocs/BinaryFile.pm | 294 ++ docs/tool/Modules/NaturalDocs/Builder.pm | 280 ++ docs/tool/Modules/NaturalDocs/Builder/Base.pm | 348 ++ .../tool/Modules/NaturalDocs/Builder/FramedHTML.pm | 345 ++ docs/tool/Modules/NaturalDocs/Builder/HTML.pm | 398 +++ docs/tool/Modules/NaturalDocs/Builder/HTMLBase.pm | 3693 ++++++++++++++++++++ docs/tool/Modules/NaturalDocs/ClassHierarchy.pm | 860 +++++ .../Modules/NaturalDocs/ClassHierarchy/Class.pm | 412 +++ .../Modules/NaturalDocs/ClassHierarchy/File.pm | 157 + docs/tool/Modules/NaturalDocs/ConfigFile.pm | 497 +++ docs/tool/Modules/NaturalDocs/Constants.pm | 165 + docs/tool/Modules/NaturalDocs/DefineMembers.pm | 100 + docs/tool/Modules/NaturalDocs/Error.pm | 305 ++ docs/tool/Modules/NaturalDocs/File.pm | 540 +++ .../Modules/NaturalDocs/ImageReferenceTable.pm | 383 ++ .../NaturalDocs/ImageReferenceTable/Reference.pm | 44 + .../NaturalDocs/ImageReferenceTable/String.pm | 110 + docs/tool/Modules/NaturalDocs/Languages.pm | 1475 ++++++++ .../Modules/NaturalDocs/Languages/ActionScript.pm | 1473 ++++++++ docs/tool/Modules/NaturalDocs/Languages/Ada.pm | 38 + .../tool/Modules/NaturalDocs/Languages/Advanced.pm | 828 +++++ .../NaturalDocs/Languages/Advanced/Scope.pm | 95 + .../NaturalDocs/Languages/Advanced/ScopeChange.pm | 70 + docs/tool/Modules/NaturalDocs/Languages/Base.pm | 832 +++++ docs/tool/Modules/NaturalDocs/Languages/CSharp.pm | 1484 ++++++++ docs/tool/Modules/NaturalDocs/Languages/PLSQL.pm | 319 ++ docs/tool/Modules/NaturalDocs/Languages/Pascal.pm | 143 + docs/tool/Modules/NaturalDocs/Languages/Perl.pm | 1370 ++++++++ .../Modules/NaturalDocs/Languages/Prototype.pm | 92 + .../NaturalDocs/Languages/Prototype/Parameter.pm | 87 + docs/tool/Modules/NaturalDocs/Languages/Simple.pm | 503 +++ docs/tool/Modules/NaturalDocs/Languages/Tcl.pm | 219 ++ docs/tool/Modules/NaturalDocs/Menu.pm | 3406 ++++++++++++++++++ docs/tool/Modules/NaturalDocs/Menu/Entry.pm | 201 ++ docs/tool/Modules/NaturalDocs/NDMarkup.pm | 76 + docs/tool/Modules/NaturalDocs/Parser.pm | 1331 +++++++ docs/tool/Modules/NaturalDocs/Parser/JavaDoc.pm | 464 +++ docs/tool/Modules/NaturalDocs/Parser/Native.pm | 1060 ++++++ .../tool/Modules/NaturalDocs/Parser/ParsedTopic.pm | 253 ++ docs/tool/Modules/NaturalDocs/Project.pm | 1402 ++++++++ docs/tool/Modules/NaturalDocs/Project/ImageFile.pm | 160 + .../tool/Modules/NaturalDocs/Project/SourceFile.pm | 113 + docs/tool/Modules/NaturalDocs/ReferenceString.pm | 334 ++ docs/tool/Modules/NaturalDocs/Settings.pm | 1418 ++++++++ .../Modules/NaturalDocs/Settings/BuildTarget.pm | 66 + docs/tool/Modules/NaturalDocs/SourceDB.pm | 678 ++++ .../tool/Modules/NaturalDocs/SourceDB/Extension.pm | 84 + docs/tool/Modules/NaturalDocs/SourceDB/File.pm | 129 + docs/tool/Modules/NaturalDocs/SourceDB/Item.pm | 201 ++ .../Modules/NaturalDocs/SourceDB/ItemDefinition.pm | 45 + .../NaturalDocs/SourceDB/WatchedFileDefinitions.pm | 159 + docs/tool/Modules/NaturalDocs/StatusMessage.pm | 102 + docs/tool/Modules/NaturalDocs/SymbolString.pm | 212 ++ docs/tool/Modules/NaturalDocs/SymbolTable.pm | 1984 +++++++++++ docs/tool/Modules/NaturalDocs/SymbolTable/File.pm | 186 + .../NaturalDocs/SymbolTable/IndexElement.pm | 522 +++ .../Modules/NaturalDocs/SymbolTable/Reference.pm | 273 ++ .../NaturalDocs/SymbolTable/ReferenceTarget.pm | 97 + .../tool/Modules/NaturalDocs/SymbolTable/Symbol.pm | 428 +++ .../NaturalDocs/SymbolTable/SymbolDefinition.pm | 96 + docs/tool/Modules/NaturalDocs/Topics.pm | 1319 +++++++ docs/tool/Modules/NaturalDocs/Topics/Type.pm | 151 + docs/tool/Modules/NaturalDocs/Version.pm | 384 ++ docs/tool/NaturalDocs | 400 +++ docs/tool/NaturalDocs.bat | 17 + docs/tool/Styles/Default.css | 767 ++++ docs/tool/Styles/Roman.css | 765 ++++ docs/tool/Styles/Small.css | 763 ++++ 115 files changed, 43529 insertions(+) create mode 100644 docs/tool/Config/Languages.txt create mode 100644 docs/tool/Config/Topics.txt create mode 100644 docs/tool/Help/customizinglanguages.html create mode 100644 docs/tool/Help/customizingtopics.html create mode 100644 docs/tool/Help/documenting.html create mode 100644 docs/tool/Help/documenting/reference.html create mode 100644 docs/tool/Help/documenting/walkthrough.html create mode 100644 docs/tool/Help/example/Default.css create mode 100644 docs/tool/Help/example/NaturalDocs.js create mode 100644 docs/tool/Help/examples.css create mode 100644 docs/tool/Help/images/header/background.png create mode 100644 docs/tool/Help/images/header/leftside.png create mode 100644 docs/tool/Help/images/header/logo.png create mode 100644 docs/tool/Help/images/header/overbody.png create mode 100644 docs/tool/Help/images/header/overbodybg.png create mode 100644 docs/tool/Help/images/header/overleftmargin.png create mode 100644 docs/tool/Help/images/header/overmenu.png create mode 100644 docs/tool/Help/images/header/overmenubg.png create mode 100644 docs/tool/Help/images/header/rightside.png create mode 100644 docs/tool/Help/images/logo.gif create mode 100644 docs/tool/Help/images/menu/about.png create mode 100644 docs/tool/Help/images/menu/background.png create mode 100644 docs/tool/Help/images/menu/bottomleft.png create mode 100644 docs/tool/Help/images/menu/bottomright.png create mode 100644 docs/tool/Help/images/menu/community.png create mode 100644 docs/tool/Help/images/menu/customizing.png create mode 100644 docs/tool/Help/images/menu/using.png create mode 100644 docs/tool/Help/index.html create mode 100644 docs/tool/Help/javascript/BrowserStyles.js create mode 100644 docs/tool/Help/javascript/PNGHandling.js create mode 100644 docs/tool/Help/keywords.html create mode 100644 docs/tool/Help/languages.html create mode 100644 docs/tool/Help/menu.html create mode 100644 docs/tool/Help/output.html create mode 100644 docs/tool/Help/running.html create mode 100644 docs/tool/Help/styles.css create mode 100644 docs/tool/Help/styles.html create mode 100644 docs/tool/Help/troubleshooting.html create mode 100644 docs/tool/Info/CSSGuide.txt create mode 100644 docs/tool/Info/File Parsing.txt create mode 100644 docs/tool/Info/HTMLTestCases.pm create mode 100644 docs/tool/Info/Languages.txt create mode 100644 docs/tool/Info/NDMarkup.txt create mode 100644 docs/tool/Info/Symbol Management.txt create mode 100644 docs/tool/Info/images/Logo.png create mode 100644 docs/tool/JavaScript/NaturalDocs.js create mode 100644 docs/tool/License-GPL.txt create mode 100644 docs/tool/Modules/NaturalDocs/BinaryFile.pm create mode 100644 docs/tool/Modules/NaturalDocs/Builder.pm create mode 100644 docs/tool/Modules/NaturalDocs/Builder/Base.pm create mode 100644 docs/tool/Modules/NaturalDocs/Builder/FramedHTML.pm create mode 100644 docs/tool/Modules/NaturalDocs/Builder/HTML.pm create mode 100644 docs/tool/Modules/NaturalDocs/Builder/HTMLBase.pm create mode 100644 docs/tool/Modules/NaturalDocs/ClassHierarchy.pm create mode 100644 docs/tool/Modules/NaturalDocs/ClassHierarchy/Class.pm create mode 100644 docs/tool/Modules/NaturalDocs/ClassHierarchy/File.pm create mode 100644 docs/tool/Modules/NaturalDocs/ConfigFile.pm create mode 100644 docs/tool/Modules/NaturalDocs/Constants.pm create mode 100644 docs/tool/Modules/NaturalDocs/DefineMembers.pm create mode 100644 docs/tool/Modules/NaturalDocs/Error.pm create mode 100644 docs/tool/Modules/NaturalDocs/File.pm create mode 100644 docs/tool/Modules/NaturalDocs/ImageReferenceTable.pm create mode 100644 docs/tool/Modules/NaturalDocs/ImageReferenceTable/Reference.pm create mode 100644 docs/tool/Modules/NaturalDocs/ImageReferenceTable/String.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/ActionScript.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/Ada.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/Advanced.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/Advanced/Scope.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/Base.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/CSharp.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/PLSQL.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/Pascal.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/Perl.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/Prototype.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/Prototype/Parameter.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/Simple.pm create mode 100644 docs/tool/Modules/NaturalDocs/Languages/Tcl.pm create mode 100644 docs/tool/Modules/NaturalDocs/Menu.pm create mode 100644 docs/tool/Modules/NaturalDocs/Menu/Entry.pm create mode 100644 docs/tool/Modules/NaturalDocs/NDMarkup.pm create mode 100644 docs/tool/Modules/NaturalDocs/Parser.pm create mode 100644 docs/tool/Modules/NaturalDocs/Parser/JavaDoc.pm create mode 100644 docs/tool/Modules/NaturalDocs/Parser/Native.pm create mode 100644 docs/tool/Modules/NaturalDocs/Parser/ParsedTopic.pm create mode 100644 docs/tool/Modules/NaturalDocs/Project.pm create mode 100644 docs/tool/Modules/NaturalDocs/Project/ImageFile.pm create mode 100644 docs/tool/Modules/NaturalDocs/Project/SourceFile.pm create mode 100644 docs/tool/Modules/NaturalDocs/ReferenceString.pm create mode 100644 docs/tool/Modules/NaturalDocs/Settings.pm create mode 100644 docs/tool/Modules/NaturalDocs/Settings/BuildTarget.pm create mode 100644 docs/tool/Modules/NaturalDocs/SourceDB.pm create mode 100644 docs/tool/Modules/NaturalDocs/SourceDB/Extension.pm create mode 100644 docs/tool/Modules/NaturalDocs/SourceDB/File.pm create mode 100644 docs/tool/Modules/NaturalDocs/SourceDB/Item.pm create mode 100644 docs/tool/Modules/NaturalDocs/SourceDB/ItemDefinition.pm create mode 100644 docs/tool/Modules/NaturalDocs/SourceDB/WatchedFileDefinitions.pm create mode 100644 docs/tool/Modules/NaturalDocs/StatusMessage.pm create mode 100644 docs/tool/Modules/NaturalDocs/SymbolString.pm create mode 100644 docs/tool/Modules/NaturalDocs/SymbolTable.pm create mode 100644 docs/tool/Modules/NaturalDocs/SymbolTable/File.pm create mode 100644 docs/tool/Modules/NaturalDocs/SymbolTable/IndexElement.pm create mode 100644 docs/tool/Modules/NaturalDocs/SymbolTable/Reference.pm create mode 100644 docs/tool/Modules/NaturalDocs/SymbolTable/ReferenceTarget.pm create mode 100644 docs/tool/Modules/NaturalDocs/SymbolTable/Symbol.pm create mode 100644 docs/tool/Modules/NaturalDocs/SymbolTable/SymbolDefinition.pm create mode 100644 docs/tool/Modules/NaturalDocs/Topics.pm create mode 100644 docs/tool/Modules/NaturalDocs/Topics/Type.pm create mode 100644 docs/tool/Modules/NaturalDocs/Version.pm create mode 100755 docs/tool/NaturalDocs create mode 100644 docs/tool/NaturalDocs.bat create mode 100644 docs/tool/Styles/Default.css create mode 100644 docs/tool/Styles/Roman.css create mode 100644 docs/tool/Styles/Small.css diff --git a/docs/tool/Config/Languages.txt b/docs/tool/Config/Languages.txt new file mode 100644 index 00000000..94909787 --- /dev/null +++ b/docs/tool/Config/Languages.txt @@ -0,0 +1,286 @@ +Format: 1.4 + +# This is the main Natural Docs languages file. If you change anything here, +# it will apply to EVERY PROJECT you use Natural Docs on. If you'd like to +# change something for just one project, edit the Languages.txt in its project +# directory instead. + + +#------------------------------------------------------------------------------- +# SYNTAX: +# +# Unlike other Natural Docs configuration files, in this file all comments +# MUST be alone on a line. Some languages deal with the # character, so you +# cannot put comments on the same line as content. +# +# Also, all lists are separated with spaces, not commas, again because some +# languages may need to use them. +# +# Language: [name] +# Defines a new language. Its name can use any characters. +# +# The language Shebang Script is special. It's entry is only used for +# extensions, and files with those extensions have their shebang (#!) lines +# read to determine the real language of the file. Extensionless files are +# always treated this way. +# +# The language Text File is also special. It's treated as one big comment +# so you can put Natural Docs content in them without special symbols. Also, +# if you don't specify a package separator, ignored prefixes, or enum value +# behavior, it will copy those settings from the language that is used most +# in the source tree. +# +# Extensions: [extension] [extension] ... +# Defines the file extensions of the language's source files. You can use * +# to mean any undefined extension. +# +# Shebang Strings: [string] [string] ... +# Defines a list of strings that can appear in the shebang (#!) line to +# designate that it's part of the language. +# +# Ignore Prefixes in Index: [prefix] [prefix] ... +# Ignore [Topic Type] Prefixes in Index: [prefix] [prefix] ... +# Specifies prefixes that should be ignored when sorting symbols in an +# index. Can be specified in general or for a specific topic type. +# +#------------------------------------------------------------------------------ +# For basic language support only: +# +# Line Comments: [symbol] [symbol] ... +# Defines a space-separated list of symbols that are used for line comments, +# if any. +# +# Block Comments: [opening sym] [closing sym] [opening sym] [closing sym] ... +# Defines a space-separated list of symbol pairs that are used for block +# comments, if any. +# +# Package Separator: [symbol] +# Defines the default package separator symbol. The default is a dot. +# +# [Topic Type] Prototype Enders: [symbol] [symbol] ... +# When defined, Natural Docs will attempt to get a prototype from the code +# immediately following the topic type. It stops when it reaches one of +# these symbols. Use \n for line breaks. +# +# Line Extender: [symbol] +# Defines the symbol that allows a prototype to span multiple lines if +# normally a line break would end it. +# +# Enum Values: [global|under type|under parent] +# Defines how enum values are referenced. The default is global. +# global - Values are always global, referenced as 'value'. +# under type - Values are under the enum type, referenced as +# 'package.enum.value'. +# under parent - Values are under the enum's parent, referenced as +# 'package.value'. +# +# Perl Package: [perl package] +# Specifies the Perl package used to fine-tune the language behavior in ways +# too complex to do in this file. +# +#------------------------------------------------------------------------------ +# For full language support only: +# +# Full Language Support: [perl package] +# Specifies the Perl package that has the parsing routines necessary for full +# language support. +# +#------------------------------------------------------------------------------- + +# The following languages MUST be defined in this file: +# +# Text File, Shebang Script + +# If you add a language that you think would be useful to other developers +# and should be included in Natural Docs by default, please e-mail it to +# languages [at] naturaldocs [dot] org. + + +Language: Text File + + Extension: txt + + +Language: Shebang Script + + Extension: cgi + + +Language: C/C++ + + Extensions: c cpp h hpp cxx hxx + Ignore Function Prefix in Index: ~ + Line Comment: // + Block Comment: /* */ + Package Separator: :: + Enum Values: Under parent + Class Prototype Enders: ; { + Function Prototype Enders: ; { + Variable Prototype Enders: ; = + + +Language: C# + + Extension: cs + Ignore Prefix in Index: @ + Full Language Support: NaturalDocs::Languages::CSharp + + +Language: Java + + Extension: java + Line Comment: // + Block Comment: /* */ + Enum Values: Under type + Function Prototype Ender: { + Variable Prototype Enders: ; = + + +Language: JavaScript + + Extension: js + Line Comment: // + Block Comment: /* */ + Enum Values: Under type + Function Prototype Ender: { + Variable Prototype Enders: ; = + + +Language: Perl + + Extensions: pl pm + Shebang String: perl + Ignore Variable Prefixes in Index: $ @ % * + Full Language Support: NaturalDocs::Languages::Perl + + +Language: Python + + Extension: py + Shebang String: python + Line Comment: # + Function Prototype Ender: : + Variable Prototype Ender: = + Line Extender: \ + + +Language: PHP + + Extensions: inc php php3 php4 phtml + Shebang String: php + Ignore Variable Prefix in Index: $ + Line Comments: // # + Block Comment: /* */ + Function Prototype Enders: ; { + Variable Prototype Enders: ; = + + +Language: SQL + + Extension: sql + Line Comment: -- + Block Comment: /* */ + Enum Values: Global + Function Prototype Enders: , ; ) as As AS is Is IS + Variable Prototype Enders: , ; ) := default Default DEFAULT + Database Index Prototype Enders: , ; ) + Database Trigger Prototype Enders: begin Begin BEGIN as As AS + Perl Package: NaturalDocs::Languages::PLSQL + + +Language: Visual Basic + + Extensions: vb vbs bas cls frm + Line Comment: ' + Enum Values: Under type + Function Prototype Ender: \n + Variable Prototype Enders: \n = + Line Extender: _ + + +Language: Pascal + + Extension: pas + Line Comment: // + Block Comments: { } (* *) + Function Prototype Ender: ; + Variable Prototype Enders: ; = + Perl Package: NaturalDocs::Languages::Pascal + + +Language: Assembly + + Extension: asm + Line Comment: ; + Variable Prototype Ender: \n + Line Extender: \ + + +Language: Ada + + Extensions: ada ads adb + Line Comment: -- + Function Prototype Enders: ; is Is IS + Variable Prototype Enders: ; := + Perl Package: NaturalDocs::Languages::Ada + + +Language: Tcl + + Extensions: tcl exp + Shebang Strings: tclsh wish expect + Line Comment: # + Package Separator: :: + Function Prototype Enders: ; { + Variable Prototype Enders: ; \n + Line Extender: \ + Perl Package: NaturalDocs::Languages::Tcl + + +Language: Ruby + + Extension: rb + Shebang String: ruby + Ignore Variable Prefixes in Index: $ @ @@ + Line Comment: # + Enum Values: Under parent + Function Prototype Enders: ; \n + Variable Prototype Enders: ; \n = + Line Extender: \ + + +Language: Makefile + + Extensions: mk mak make + Line Comment: # + + +Language: ActionScript + + Extensions: as mxml + Full Language Support: NaturalDocs::Languages::ActionScript + + +Language: ColdFusion + + Extensions: cfm cfml cfc + Line Comment: // + Block Comments: /* */ + Function Prototype Enders: { < + + +Language: R + + Extension: r + Line Comment: # + Function Prototype Enders: { ; + Variable Prototype Enders: <- = ; \n + + +Language: Fortran + + Extensions: f90 f95 f03 + Line Comment: ! + Function Prototype Ender: \n + Variable Prototype Enders: \n = => + Line Extender: & diff --git a/docs/tool/Config/Topics.txt b/docs/tool/Config/Topics.txt new file mode 100644 index 00000000..75724d85 --- /dev/null +++ b/docs/tool/Config/Topics.txt @@ -0,0 +1,382 @@ +Format: 1.4 + +# This is the main Natural Docs topics file. If you change anything here, it +# will apply to EVERY PROJECT you use Natural Docs on. If you'd like to +# change something for just one project, edit the Topics.txt in its project +# directory instead. + + +#------------------------------------------------------------------------------- +# SYNTAX: +# +# Topic Type: [name] +# Creates a new topic type. Each type gets its own index and behavior +# settings. Its name can have letters, numbers, spaces, and these +# charaters: - / . ' +# +# The Enumeration type is special. It's indexed with Types but its members +# are indexed with Constants according to the rules in Languages.txt. +# +# Plural: [name] +# Sets the plural name of the topic type, if different. +# +# Keywords: +# [keyword] +# [keyword], [plural keyword] +# ... +# Defines a list of keywords for the topic type. They may only contain +# letters, numbers, and spaces and are not case sensitive. Plural keywords +# are used for list topics. +# +# Index: [yes|no] +# Whether the topics get their own index. Defaults to yes. Everything is +# included in the general index regardless of this setting. +# +# Scope: [normal|start|end|always global] +# How the topics affects scope. Defaults to normal. +# normal - Topics stay within the current scope. +# start - Topics start a new scope for all the topics beneath it, +# like class topics. +# end - Topics reset the scope back to global for all the topics +# beneath it. +# always global - Topics are defined as global, but do not change the scope +# for any other topics. +# +# Class Hierarchy: [yes|no] +# Whether the topics are part of the class hierarchy. Defaults to no. +# +# Page Title If First: [yes|no] +# Whether the topic's title becomes the page title if it's the first one in +# a file. Defaults to no. +# +# Break Lists: [yes|no] +# Whether list topics should be broken into individual topics in the output. +# Defaults to no. +# +# Can Group With: [type], [type], ... +# Defines a list of topic types that this one can possibly be grouped with. +# Defaults to none. +#------------------------------------------------------------------------------- + +# The following topics MUST be defined in this file: +# +# Generic, Class, Interface, Section, File, Group, Function, Variable, +# Property, Type, Constant, Enumeration, Event, Delegate + +# If you add something that you think would be useful to other developers +# and should be included in Natural Docs by default, please e-mail it to +# topics [at] naturaldocs [dot] org. + + +Topic Type: Generic + + Index: No + Keywords: + topic, topics + about, list + + +Topic Type: Class + + Plural: Classes + Scope: Start + Class Hierarchy: Yes + Page Title If First: Yes + Can Group With: Interfaces + + Keywords: + class, classes + structure, structures + struct, structs + package, packages + namespace, namespaces + + +Topic Type: Interface + + Plural: Interfaces + Scope: Start + Class Hierarchy: Yes + Page Title If First: Yes + Can Group With: Classes + + Keywords: + interface, interfaces + + +Topic Type: Section + + Plural: Sections + Index: No + Scope: End + Page Title If First: Yes + + Keywords: + section + title + + +Topic Type: File + + Plural: Files + Scope: Always global + Page Title If First: Yes + + Keywords: + file, files + program, programs + script, scripts + document, documents + doc, docs + header, headers + + +Topic Type: Group + + Plural: Groups + Index: No + + Keywords: + group + + +Topic Type: Function + + Plural: Functions + Break Lists: Yes + Can Group With: Properties + + Keywords: + function, functions + func, funcs + procedure, procedures + proc, procs + routine, routines + subroutine, subroutines + sub, subs + method, methods + callback, callbacks + constructor, constructors + destructor, destructors + operator, operators + + +Topic Type: Variable + + Plural: Variables + Can Group With: Types, Constants, Macros, Enumerations + + Keywords: + variable, variables + var, vars + integer, integers + int, ints + uint, uints + long, longs + ulong, ulongs + short, shorts + ushort, ushorts + byte, bytes + ubyte, ubytes + sbyte, sbytes + float, floats + double, doubles + real, reals + decimal, decimals + scalar, scalars + array, arrays + arrayref, arrayrefs + hash, hashes + hashref, hashrefs + bool, bools + boolean, booleans + flag, flags + bit, bits + bitfield, bitfields + field, fields + pointer, pointers + ptr, ptrs + reference, references + ref, refs + object, objects + obj, objs + character, characters + wcharacter, wcharacters + char, chars + wchar, wchars + string, strings + wstring, wstrings + str, strs + wstr, wstrs + handle, handles + + +Topic Type: Property + + Plural: Properties + Can Group With: Functions + + Keywords: + property, properties + prop, props + + +Topic Type: Type + + Plural: Types + Can Group With: Variables, Constants, Macros, Enumerations + + Keywords: + type, types + typedef, typedefs + + +Topic Type: Constant + + Plural: Constants + Can Group With: Variables, Types, Macros, Enumerations + + Keywords: + constant, constants + const, consts + + +Topic Type: Enumeration + + Plural: Enumerations + Index: No + Can Group With: Variables, Types, Macros, Constants + + Keywords: + enum, enums + enumeration, enumerations + + +Topic Type: Event + + Plural: Events + Keywords: + event, events + + +Topic Type: Delegate + + Plural: Delegates + Keywords: + delegate, delegates + + +Topic Type: Macro + + Plural: Macros + Can Group With: Variables, Types, Constants + + Keywords: + define, defines + def, defs + macro, macros + + +Topic Type: Database + + Plural: Databases + Page Title If First: Yes + + Keywords: + database, databases + db, dbs + + +Topic Type: Database Table + + Plural: Database Tables + Scope: Start + Page Title If First: Yes + + Keywords: + table, tables + database table, database tables + databasetable, databasetables + db table, db tables + dbtable, dbtables + + +Topic Type: Database View + + Plural: Database Views + Scope: Start + Page Title If First: Yes + + Keywords: + view, views + database view, database views + databaseview, databaseviews + db view, db views + dbview, dbviews + + +Topic Type: Database Index + + Plural: Database Indexes + Keywords: + index, indexes + index, indices + database index, database indexes + database index, database indices + databaseindex, databaseindexes + databaseindex, databaseindices + db index, db indexes + db index, db indices + dbindex, dbindexes + dbindex, dbindices + key, keys + database key, database keys + databasekey, databasekeys + db key, db keys + dbkey, dbkeys + primary key, primary keys + primarykey, primarykeys + database primary key, database primary keys + databaseprimarykey, databaseprimarykeys + db primary key, db primary keys + dbprimarykey, dbprimarykeys + + +Topic Type: Database Cursor + + Plural: Database Cursors + Keywords: + cursor, cursors + database cursor, database cursors + databasecursor, databasecursors + db cursor, db cursors + dbcursor, dbcursors + + +Topic Type: Database Trigger + + Plural: Database Triggers + Keywords: + trigger, triggers + database trigger, database triggers + databasetrigger, databasetriggers + db trigger, db triggers + dbtrigger, dbtriggers + + +Topic Type: Cookie + + Plural: Cookies + Scope: Always global + + Keywords: + cookie, cookies + + +Topic Type: Build Target + + Plural: Build Targets + Keywords: + target, targets + build target, build targets + buildtarget, buildtargets diff --git a/docs/tool/Help/customizinglanguages.html b/docs/tool/Help/customizinglanguages.html new file mode 100644 index 00000000..593e77ab --- /dev/null +++ b/docs/tool/Help/customizinglanguages.html @@ -0,0 +1,52 @@ + + +Customizing Natural Docs Languages + + + +
Natural Docs
Customizing
Organizing the MenuCSS StylesTopics and KeywordsLanguages, Indexes,
and Prototypes
Customizing Languages
Languages.txt

Natural Docs has two files called Languages.txt: one in its Config directory, and one in your project directory.  These control the language, index prefix, and prototype features of Natural Docs.

You should edit the one in your project directory whenever possible.  It keeps your changes separate and easier to manage, plus you don’t have to reapply them whenever you upgrade.  Editing the one in Natural Docs’ Config directory would be better only if you’re using Natural Docs with a lot of projects and would like the changes to apply everywhere.

Note that unlike other Natural Docs configuration files, comments can only appear on their own lines.  They cannot appear after something else on a line because settings may need to use the # symbol.  Also, all lists are space-separated instead of comma-separated, again because some settings may need to use the comma symbol.

File Extensions

If Natural Docs doesn’t recognize a file extension you use for your code, it’s not a problem.  You can alter the language definition from your project file to add them.

Alter Language: [your language]
+   Add Extensions: cxx hxx

On the other hand, if it’s scanning some files you don’t want it to scan, you can exclude extensions as well.  Just add this to the top of your file:

Ignore Extensions: c cpp

In this example, Natural Docs will ignore C++ source files, thus only scanning the headers.

Adding Languages

You can add basic language support for any programming language just by editing these configuration files.  Here are the most important settings:

Language: Fictional
+
+   Extensions: fsrc fhdr
+   Shebang Strings: fictional
+   Line Comment: //
+   Block Comment: /* */
+   Package Separator: ::

This tells Natural Docs that any files with the .fsrc or .fhdr extensions are part of our fictional programming language.  Also, any .cgi or extensionless files that have “fictional” in the shebang (#!) line are part of it as well.  Line comments start with // and block comments appear between /* and */.  The default package separator is ::.  Not too hard, huh?

You can also add settings to ignore prefixes in the index and detect prototypes, but those are dealt with in their own sections on this page.

Prototypes

So you’ve added a new language and want to detect prototypes.  Or perhaps you added a custom topic type and want to detect prototypes for that as well.  Here’s an example of the properties you need:

Function Prototype Enders: ; {
+Variable Prototype Enders: ; =

The algorithm for finding prototypes is very simple, yet it works really well in practice.  All the code following the comment is grabbed until it reaches an ender symbol or another comment.  Ender symbols appearing inside parenthesis, brackets, braces, or angle brackets don’t count.  If it reaches an ender symbol and somewhere in that code is the topic title, the code is accepted as the prototype.

So in the example above, variables end at semicolons (the end of the declaration) or equal signs (the default value expression, which we don’t want to include.)  Since the Natural Docs comment for the variable should have appeared right before the definition, that leaves us with the name and type.  Functions are handled similarly: they end at a semicolon (the end of a predeclaration) or an opening brace (the beginning of the body) leaving us with the name, parameters, and return type.

You can do this with any topic type, including custom ones.  Any prototypes that look like they have parameters will be formatted as such automatically.

Line Breaks

For some languages, line breaks are significant.  To have them end a prototype, use \n.  If it has an extender symbol that allows the code to continue on the next line, you can specify that as well.

Function Prototype Ender: \n
+Variable Prototype Ender: \n =
+Line Extender: _
Colors

If you’re collecting prototypes for a custom topic type, they will not automatically get their own background color like the other types have.  You have to define it via CSS.

Index Prefixes

Natural Docs has the ability to ignore prefixes in the indexes.  This is necessary because in certain languages, variables are prefixed with $ or other symbols and we don’t want them to get all grouped together under the symbols heading.  Instead, they appear in the sidebar and are sorted as if they’re not there.

A
 AddProperty, SomeClass
$amount
 Average

However, we can take advantage of this simply to get around coding conventions.  Suppose you prefix all your class names with C.  They’d all form one gigantic group under C in the index.  If you want, you can have it ignored so CCat, CDog, and CMouse get filed under C, D, and M instead.  Just add this to your languages file:

Alter Language: [your language]
+   Add Ignored Class Prefix in Index: C

Now C is ignored in your indexes:

A
CAccount
CAccountHolder
 AddProperty, SomeClass
$amount
 Average

You can include any number of prefixes and can do this for any topic type.  So if you have a bunch of functions that start with COM_ and DB_, you can ignore them too:

Alter Language: [your language]
+   Add Ignored Class Prefix in Index: C
+   Add Ignored Function Prefixes in Index: COM_ DB_
Special Languages

There are two languages with special properties: Shebang Script and Text File.

Shebang Script allows you to define the file extensions where the language is really determined by the shebang (#!) line within it.  For example, .cgi files.  If Natural Docs finds a .cgi file, it sees that it’s a Shebang Script so it opens it up to parse it’s shebang line.  It then searches it for substrings defined by other languages’ Shebang String settings to find out what language it really is.  Files with no extension are always treated this way.

With Text File, the entire file is treated like a comment.  There are no comment symbols required, you can just put Natural Docs content there in plain text.  The most important setting is Extensions.

However, since it is possible to document classes, functions, etc. in text files, they also have their own Package Separator and Ignored [type] Prefixes in Index settings.  To make things easier on you, by default it copies these settings from whichever language has the most source files in your project.  You can override this by manually setting them, but you shouldn’t need to.

Syntax Reference

Unlike other Natural Docs configuration files, comments can only appear on their own lines.  They cannot appear after something else on a line because settings may need to use the # symbol.  Likewise, lists are separated with spaces instead of commas because commas themselves may need to appear on the list.

Singular and plural forms are generally both supported, so you can write Extension or Extensions.  It doesn’t matter if they match how many items are set.  Also, you can use either Ignore or Ignored.

Ignore Extensions: [extension] [extension] ...

Causes the listed file extensions to be ignored, even if they were previously defined to be part of a language.  The list is space-separated.  ex. “Ignore Extensions: cvs txt

Language: [name]
+Alter Language: [name]

Creates a new language or alters an existing one.  Names can use any characters.  Note the special behavior for languages named Shebang Script and Text File.

If you’re altering an existing language and a property has an [Add/Replace] form, you have to specify whether you’re adding to or replacing the list if that property has already been defined.

General Language Properties
Extensions: [extension] [extension] ...
+[Add/Replace] Extensions: [extension] [extension] ...

Defines file extensions for the language’s source files.  The list is space-separated.  ex. “Extensions: c cpp”.  You can use extensions that were previously used by another language to redefine them.  You can use * to specify all undefined extensions.

Shebang Strings: [string] [string] ...
+[Add/Replace] Shebang Strings: [string] [string] ...

Defines a list of strings that can appear in the shebang (#!) line to designate that it’s part of this language.  They can appear anywhere in the line, so php will work for “#!/user/bin/php4”.  You can use strings that were previously used by another language to redefine them.

Ignore Prefixes in Index: [prefix] [prefix] ...
+Ignore [type] Prefixes in Index: [prefix] [prefix] ...
+
+[Add/Replace] Ignored Prefixes in Index: [prefix] [prefix] ...
+[Add/Replace] Ignored [type] Prefixes in Index: [prefix] [prefix] ...

Specifies prefixes that should be ignored when sorting symbols for an index.  Can be specified in general or for a specific topic type.  The prefixes will still appear, the symbols will just be sorted as if they’re not there.  For example, specifying ADO_ for functions will mean that ADO_DoSomething will appear under D instead of A.

Basic Language Support Properties

These attributes are only available for languages with basic language support.

Line Comments: [symbol] [symbol] ...

Defines a space-separated list of symbols that are used for line comments, if any.  ex. “Line Comment: //”.

Block Comments: [opening symbol] [closing symbol] [o.s.] [c.s.] ...

Defines a space-separated list of symbol pairs that are used for block comments, if any.  ex. “Block Comment: /* */”.

Enum Values: [global|under type|under parent]

Defines the behavior of enum values.  The default is global.

GlobalEnum values are always global and will be referenced as “Value”.
Under TypeEnum values appear under the type and will be referenced as “Package.Enum.Value”.
Under ParentEnum values appear under the parent and will be referenced as “Package.Value”
[type] Prototype Enders: [symbol] [symbol] ...

When defined, Natural Docs will attempt to collect prototypes from the code following the specified topic type.  It grabs code until the first ender symbol or the next Natural Docs comment, and if it contains the topic name, it serves as its prototype.  Use \n to specify a line break.  ex. “Function Prototype Enders: { ;”, “Variable Prototype Enders: = ;”.

Line Extender: [symbol]

Defines the symbol that allows a prototype to span multiple lines if normally a line break would end it.

Perl Package: [perl package]

Specifies the Perl package used to fine-tune the language behavior in ways too complex to do in this file.

Full Language Support Properties

These attributes are only available for languages with full language support.

Full Language Support: [perl package]

Specifies the Perl package that has the parsing routines necessary for full language support.

Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/customizingtopics.html b/docs/tool/Help/customizingtopics.html new file mode 100644 index 00000000..89602aa5 --- /dev/null +++ b/docs/tool/Help/customizingtopics.html @@ -0,0 +1,74 @@ + + +Customizing Natural Docs Topics + + + +
Natural Docs
Customizing Topics
Topics.txt

Natural Docs has two files called Topics.txt: one in its Config directory, and one in your project directory.  These control the topic behavior and keywords Natural Docs uses.

You should edit the one in your project directory whenever possible.  It keeps your changes separate and easier to manage, plus you don’t have to reapply them whenever you upgrade.  Editing the one in Natural Docs’ Config directory would be better only if you’re using Natural Docs with a lot of projects and would like the changes to apply everywhere.

Topic Types vs. Keywords

It’s important to understand the difference between topic types and keywords.  Topic types have their own indexes and behavior settings.  You’ll reference them by name when dealing with indexes in the menu file or prototype detection in the language file, but not when documenting your code unless you make their names keywords as well.

You use keywords when documenting your code.  There can be many keywords per topic type, and they are completely interchangable.

Suppose you document a class with the Class keyword and a struct with Struct.  They are both keywords for the Class topic type by default, so they will appear in the same index.  If you wanted structs to have their own index, you would add a topic type for structs and change the Struct keyword to point to it.

Adding Topic Types

If you want to be able to document something in Natural Docs doesn’t handle by default, you want to create your own topic type for it.  Let’s say you’re working on a video game and you want to document all the sound effects because you want to keep track of what each one is for and have an index of them.  You’d add this to your topics file:

Topic Type: Sound Effect
+   Plural: Sound Effects
+   Keywords:
+      sound
+      sound effect
+

Sound effects can now be documented with the sound or sound effect keywords, and they’ll get their own index.  The Plural line just specifies the plural name of the topic type.  It isn’t required, but Natural Docs will use it in some places where the plural would sound more natural, like when grouping topics or naming indexes on the menu.

Here are a couple of other things you may want to add:

Topic Type: Sound Effect
+   Plural: Sound Effects
+   Scope: Always Global
+   Keywords:
+      sound, sounds
+      sound effect, sound effects
+

You can set the scope behavior of the topic type.  Your options are:

NormalTopics stay within the current scope.
StartTopics start a new scope for all the topics beneath it, like class topics.
EndTopics reset the scope back to global for all the topics beneath it.
Always GlobalTopics are defined as global, but do not change the scope for any other topics.

Here we set it to Always Global so that if we document one as part of a class, it will still be global yet will not break the class’ scope.  In other words, we can always link to it with just its name instead of needing something like <Class.Sound>.

The other thing we did was add plural keywords, which you do by using a comma after an existing keyword.  These keywords are used for list topics so we don’t have to document each one individually with the full syntax.

There are more options, these are just the most important ones.  See the full syntax reference for the rest.

Prototypes

If you’d like to collect prototypes for your new topic type, you have to do that by editing Languages.txt.

Changing Keywords
Adding and Changing

If you’re defining your own topic type or editing the main topics file, you simply add to the keywords list:

Topic Type: Sound Effect
+   Keywords:
+      sound, sounds
+      sound effect, sound effects
+

It doesn’t matter if the keyword was previously defined for a different topic type.  Just define it again and the definition will change.

If you want to add keywords to one of the main topic types from the project file, use Alter Topic Type instead:

Alter Topic Type: General
+   Keywords:
+      note
+      notes
+

Natural Docs will keep a list of the main file’s topic types in your project file so that you can do this easily.

Ignoring

Sometimes a keyword just gets in the way.  It’s too common in your comments and Natural Docs keeps accidentally picking them up as topics when that isn’t what you wanted.  You can get rid of keywords completely by either deleting them from the main file or putting this in your project file:

Ignore Keywords:
+   about
+   title
+

If you only have a few, you can use this syntax as well:

Ignore Keywords: note, notes, title
+
Altering Behavior

You can change the behavior of any topic type defined in the main file via your project file.  Just use Alter Topic Type and redefine any property.

Alter Topic Type: Constant
+   Scope: Always Global
+

Natural Docs will keep a list of the main file’s topic types in your project file so you can do this easily.  See the syntax reference below for a full list of your options.

Syntax Reference
Ignore Keywords: [keyword], [keyword] ...
+   [keyword]
+   [keyword], [keyword]
+   ...
+

Ignores the keywords so that they’re not recognized as Natural Docs topics anymore.  Can be specified as a list on the same line and/or following like a normal Keywords section.

Topic Type: [name]
+Alter Topic Type: [name]
+

Creates a new topic type or alters an existing one.  The name can only contain letters, numbers, spaces, and these characters: . - ‘ /.  It isn’t case sensitive, although the original case is remembered for presentation.

There are a number of default types that must be defined in the main file, but they will be listed there since it may change between versions.  The default types can have their keywords or behaviors changed, though, either by editing the default file or by overriding them in the user file.

Properties
Plural: [name]
+

Specifies the plural name of the topic type.  Defaults to the singular name.  Has the same restrictions as the topic type name.

Index: [yes|no]
+

Whether the topic type gets an index.  Defaults to yes.

Scope: [normal|start|end|always global]
+

How the topic affects scope.  Defaults to normal.

NormalTopics stay within the current scope.
StartTopics start a new scope for all the topics beneath it, like class topics.
EndTopics reset the scope back to global for all the topics beneath it.
Always GlobalTopics are defined as global, but do not change the scope for any other topics.
Class Hierarchy: [yes|no]
+

Whether the topic is part of the class hierarchy.  Defaults to no.

Page Title if First: [yes|no]
+

Whether the title of this topic becomes the page title if it is the first topic in a file.  Defaults to no.

Break Lists: [yes|no]
+

Whether list topics should be broken into individual topics in the output.  Defaults to no.

Can Group With: [topic type], [topic type], ...
+

Lists the topic types that can be grouped with this one in the output.  If two or more topic types often appear together, like Functions and Properties, this will allow them to be grouped together under one heading if it would cause too many groups otherwise.

Keywords:
+   [keyword]
+   [keyword], [plural keyword]
+   ...
+

A list of the topic type’s keywords.  Each line after the heading is the keyword and optionally its plural form.  This continues until the next line in “keyword: value” format.

  • Keywords can only have letters, numbers, and spaces.  No punctuation or symbols are allowed.
  • Keywords are not case sensitive.
  • Subsequent keyword sections add to the list.  They don’t replace it.
  • Keywords can be redefined by appearing in later keyword sections.
Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/documenting.html b/docs/tool/Help/documenting.html new file mode 100644 index 00000000..2999f431 --- /dev/null +++ b/docs/tool/Help/documenting.html @@ -0,0 +1,58 @@ + + +Documenting Your Code - Natural Docs + + + +
Natural Docs
Using
Documenting
Your Code
KeywordsRunningTroubleshooting
Documenting Your Code

Here’s a quick example of how to document your code for Natural Docs.  If you’re a new user, we have a walkthrough to get you started.  Otherwise, visit the reference for the full details.

/*
+   Function: Multiply
+
+   Multiplies two integers.
+
+   Parameters:
+
+      x - The first integer.
+      y - The second integer.
+
+   Returns:
+
+      The two integers multiplied together.
+
+   See Also:
+
+      <Divide>
+*/
+int Multiply (int x, int y)
+   {  return x * y;  };
Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/documenting/reference.html b/docs/tool/Help/documenting/reference.html new file mode 100644 index 00000000..269ede89 --- /dev/null +++ b/docs/tool/Help/documenting/reference.html @@ -0,0 +1,146 @@ + + +Documenting Your Code: Reference - Natural Docs + + + +
Natural Docs
Documenting Your Code
int Add (int x,
int y)
Adds two integers.
int Subtract (int x,
int y)
Subtracts two integers.
int Multiply (int x,
int y)
Multiplies two integers.
int Divide (int x,
int y)
Divides two integers.
bool IsEqual (int x,
int y)
Returns whether two integers are equal.
Comments

There is no special comment style for Natural Docs.  You just embed Natural Docs topics into regular comments, and it’s pretty tolerant as far as style goes.  You can use block comments or string together line comments.  The only requirement is that the comments are not on the same line as code.

/* Function: Multiply
+   Multiplies two integers and returns the result. */
+
+// Function: Multiply
+// Multiplies two integers and returns the result.
+

Note that when stringing line comments together, blank lines that you want to include in the documentation must start with the comment symbol as well.  If a line is completely blank, it’s considered the end of the comment and thus the end of the Natural Docs topic.

Boxes and Horizontal Lines

Natural Docs can also handle comment boxes and horizontal lines.  It doesn’t matter what symbols they use.  The boxes don’t need to be closed on the right side, and they can have different symbols for the edges and corners.

/*
+ * Function: Multiply
+ * Multiplies two integers and returns the result.
+ */
+
+/* +-------------------------------------------------+
+   | Function: Multiply                              |
+   | Multiplies two integers and returns the result. |
+   +-------------------------------------------------+ */
+
+//////////////////////////////////////////////////////////////
+//
+//  Function: Multiply
+//  ------------------
+//
+//  Multiplies two integers together and returns the result.
+//
+//////////////////////////////////////////////////////////////
+
Javadoc Style

If you have full language support, you can also use Javadoc-style comments to write Natural Docs documentation.  To do this you repeat the last symbol on the first line of the comment once.  The comment must appear directly above what it’s documenting, and you can omit the topic line if you want (the “Function: Multiply” part.)

/**
+ * Multiplies two integers and returns the result.
+ */
+
+///
+// Multiplies two integers together and returns the result.
+

If you omit the topic line and include any Javadoc tags in the comment, like @param, the entire comment will be treated as Javadoc and can only use Javadoc formatting.  Otherwise it’s treated as a Natural Docs comment and you can use all the formatting options described on this page.  You can have both styles in the same source file, but not in the same comment.

Perl POD

Perl users can also use POD to do block comments.

=begin nd
+
+Function: Multiply
+Multiplies two integers and returns the result.
+
+=cut
+

You can also use NaturalDocs or Natural Docs in place of ND.  None of them are case sensitive.  If for some reason you want to go back to POD documentation instead of using =cut, you can write =end nd.

There’s a second form of just =nd which is offered as a convenience.  However, it is not valid POD.  Perl will skip over it and execute fine, but POD parsers will give errors and possibly include the unformatted text in the output.  Use the longer, valid form unless you know for certain that no one will ever try to run POD on your code.

=nd
+
+Function: Multiply
+Multiplies two integers and returns the result.
+
+=cut
+
Text Files

Documentation can also be included in text files.  Any file with a .txt extension appearing in the source tree and starting with a topic line will included in the documentation.  It will be treated the same as a source file, meaning it will appear in the menu, its topics will be in the indexes, and its topics can be linked to from anywhere in the documentation.  The only difference is you don’t need comment symbols.

Remember that the topic line is required to be the first line of content.  If the first non-blank line is not in the “Function: Multiply” format the file will be ignored.  An easy way to do this is to use the Title keyword, although all of the other ones will work as well.

Title: License
+
+This project is licensed under the GPL.
+

This method is convenient for documenting file formats, configuration settings, the general program architecture, or anything else that isn’t directly tied to a source file.

Keywords, Topics, and Scope

A topic in Natural Docs starts with a topic line in the format “keyword: name”.  You can have multiple topics per comment as long as you separate them with a blank line.  The keywords aren’t case sensitive.

The list of keywords is pretty predictable: Function, Class, Variable, etc.  Just use what you’re documenting.  There are many synonyms as well, so you can use keywords like Func, Procedure, Proc, Method and Constructor.  Look at the full list of keywords to see everything that’s available.

The list of keywords is separated into topic types.  Each type gets its own index, and which specific keyword you use doesn’t matter.  Some also have scoping rules or other behavior as noted.

Scope

Like the code it’s documenting, Natural Docs topics have scope.  This mostly has to do with linking: if you’re in a class you can link to its members by their name alone, but if you’re not, you have to use a notation like class.member or class::member.

If you have full language support and are documenting something that appears in the code, the scope will be handled automatically.  If you’re using text files, have basic language support, or are including a topic that doesn’t correspond to something in the code, scoping follows these rules:

List Topics

If you looked at the list, you saw that most of the keywords have plural forms.  That’s for list topics, which let you document many small things without using the full syntax.  Anything that appears in definition lists within that topic will be treated as if it had its own topic.  It will appear in the indexes and be linkable, just like normal topics.

Function list topics will automatically break apart in the output as well, so it will look the same as if you documented each one individually.

Linking

Linking is the one place where Natural Docs has some negative effect on the readability of the comments.  The alternative would be to automatically guess where links should be, but systems that do that can sometimes pepper your sentences with unintentional links to functions called “is” or “on”.  However, the Natural Docs syntax is still as minimal as possible.  Simply surround any topic you want to link to with angle brackets.  Natural Docs will keep track off all the topics and where they are defined, so you don’t need to use HTML-like syntax or remember what file anything is in.  Also, if the link can’t be resolved to anything, Natural Docs leaves the angle brackets in the output so if something wasn’t intended to be a link (such as #include <somefile.h>) it won’t be mangled.

Let's link to function <Multiply>.
+

Let’s link to function Multiply.

Links and topic names are case sensitive, regardless of whether the language is or not.

When linking to functions, it doesn’t matter if you include empty parenthesis or not.  Both <Function> and <Function()> will work.  However, if you documented the function with parameters as part of the name, you will need to include those parameters whenever linking to it.  It is recommended that you only include parameters in the topic name if you need to distinguish between two functions with the same name.

If the topic has a summary sentence, hovering over the link will give it to you as a tooltip.  If the topic has a prototype, that will be included as well.  You can try it above.

Scope

If a topic is considered part of a class, they can be linked to using any of the three most common class/member notations:  class.member, class::member, and class->member.  Natural Docs will not be confused by <class->member>.  Like in the language itself, if the topic you’re writing is in that class’ scope you can link to it simply as <member>.

If you have multi-level classes and packages, links can be relative as well.  So if you’re in Project::UI::Window::Base and you want to link to Project::UI::Button::Base, just using <Button::Base> will work.

Plurals and Possessives

To make the documentation easier to write and easier to read in the source file, you can include plurals and possessives inside the angle brackets.  In other words, you don’t have to use awkward syntax like <Object>s, although that’s supported as well.  You can simply write <Objects> and it will link to the symbol Object just fine.  It can handle any plural and/or possessive form you can throw at it.  I’m not kidding: Foxes, Fox’s, Foxes’, Children, Mice, Alumni, Indices, Amoebae, Teeth, just try to trip it up.

URLs and E-Mail

You can also link to URLs and e-mail addresses.  It will detect them automatically, but you can also put them in angle brackets if you like.

Visit <http://www.website.com> or send messages to
+email@address.com.
+

E-mail addresses are protected in a way that should avoid spam crawlers.  Although the link above looks and acts like a regular link (try it) the HTML code actually looks like this:

<a href="#"
+ onClick="location.href='mai' + 'lto:' + 'em' + 'ail' + '@'
+          + 'addre' + 'ss.com'; return false;">
+    em<span style="display: none">.nosp@m.</span>ail
+    <span>@</span>
+    addre<span style="display: none">.nosp@m.</span>ss.com
+</a>
+
Formatting and Layout

You can apply additional formatting and layout to your Natural Docs content, all in ways that will appear very natural in the source code.

Paragraphs

You can break paragraphs by leaving blank lines between them.  So we have this in our content:

The first paragraph blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah.
+
+The second paragraph blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah.
+

and we get this in our output:

The first paragraph blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.

The second paragraph blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.

Bold and Underline

You can apply bold to a stretch of text by surrounding it with asterisks.  You can apply underlining by surrounding it with underscores instead.  With underlining, it doesn’t matter if you use an underscore for every space between words or not; they’ll be converted to spaces if you do.

Some *bold text* and some _underlined text_
+and yet _more_underlined_text_.
+

Some bold text and some underlined text and yet more underlined text.

Headings

You can add headings to your output just by ending a line with a colon and having a blank line above it.

Some text before the heading.
+
+Heading:
+Some text under the heading.
+

Some text before the heading.

Heading

Some text under the heading.

You must have a blank line above the heading or it will not work.  You can skip the blank after it but not before.

Bullet Lists

You can add bullet lists by starting a line with a dash, an asterisk, an o, or a plus.  Bullets can have blank lines between them if you want, and subsequent lines don’t have to be indented.  You end a list by skipping a line and doing something else.

- Bullet one.
+- Bullet two.
+  Bullet two continued.
+- Bullet three.
+
+Some text after the bullet list.
+
+o Spaced bullet one.
+
+o Spaced bullet two.
+Spaced bullet two continued.
+
+o Spaced bullet three.
+
+Some text after the spaced bullet list.
+
  • Bullet one.
  • Bullet two.  Bullet two continued.
  • Bullet three.

Some text after the bullet list.

  • Spaced bullet one.
  • Spaced bullet two.  Spaced bullet two continued.
  • Spaced bullet three.

Some text after the spaced bullet list.

Definition Lists

You can add a definition list by using the format below, specifically “text space dash space text”.  Like bullet lists, you can have blank lines between them if you want, subsequent lines don’t have to be indented, and you end the list by skipping a line and doing something else.

First  - This is the first item.
+Second - This is the second item.
+         This is more of the second item.
+Third  - This is the third item.
+This is more of the third item.
+
+Some text after the definition list.
+
FirstThis is the first item.
SecondThis is the second item.  This is more of the second item.
ThirdThis is the third item.  This is more of the third item.

Some text after the definition list.

Remember that with definition lists, if you’re using the plural form of the keywords each entry can be linked to as if it had its own topic.

Code and Text Diagrams

You can add example code or text diagrams by starting each line with >, |, or :.  If you have a vertical line or text box with the comment, you must separate these symbols from it with a space.

: a = b + c;
+
+>   +-----+     +-----+
+>   |  A  | --> |  B  |
+>   +-----+     +-----+
+>                  |
+>               +-----+
+>               |  C  |
+>               +-----+
+
a = b + c;
+-----+     +-----+
| A | --> | B |
+-----+ +-----+
|
+-----+
| C |
+-----+

For long stretches, this may be too tedious.  You can start a code section by placing (start code) or just (code) alone on a line.  You end it with either (end code) or just (end).  You can’t put any other content on these lines.

(start code)
+
+if (x == 0) {
+   DoSomething();
+}
+
+return x;
+
+(end)
+
if (x == 0) {
DoSomething();
}

return x;

You can also use example, diagram, or table instead of code.  Just use whatever’s appropriate.  Always flexible, it will accept begin for start and it will accept finish or done for end so you don’t have to remember the exact word.

Images

You can include images in your documentation by writing “(see filename)”.  If you put it alone on a line it will be embedded in place.

This is the first paragraph.
+
+(see logo.gif)
+
+This is the second paragraph.
+

This is the first paragraph.

This is the second paragraph.

If it’s not alone on a line the image will appear after the end of the paragraph, the text will become a link to it, and the file name will be used as a caption.

This is the first paragraph (see logo.gif)  This is
+more of the first paragraph.
+

This is the first paragraph (see logo)  This is more of the first paragraph.

logo

The image file names are relative to the source file the comment appears in or any directories specified with the -img command line option.  You can use relative paths like (see images/logo.gif) and (see ../images/logo.gif), but you cannot use absolute paths, URLs, or specify a file that’s not in a folder included by -i or -img.

Natural Docs supports gif, jpg, jpeg, png, and bmp files.

Page Titles

Natural Docs automatically determines the page title as follows:

  • If there’s only one topic in the file, that topic’s title becomes the page title.
  • Otherwise, if the first topic in the file is a class, section, or file, that topic’s title becomes the page title.
  • Otherwise, the file name becomes the page title.

This should be enough for most people.  However, if you don’t like the page title Natural Docs has chosen for you, add a “Title: [name]” comment to the top of the file to override it.  Title is a synonym of Section, so that will satisfy the second rule and make it the page title.

Summaries

Summaries are automatically generated for every file, class, and section.  You don’t have to do anything special to get them.

There are two things you may want to keep in mind when documenting your code so that the summaries are nicer.  The first is that they use the first sentence in the topic as the description, so long as it’s plain text and not something like a bullet list.  It will also appear in the tooltip whenever that topic is linked to.

The second is that you may want to manually add group topics to divide long lists and make the summaries easier to navigate.  Natural Docs will automatically group them by type if you do not, but sometimes you want to be more specific.  You don’t need to provide a description, just adding a “Group: [name]” comment is sufficient.  Note that once you manually add a group automatic grouping is completely turned off for that class.

Here’s an example summary.  Note that as before, when you hover over a link, you’ll get the prototype and summary line as a tooltip.

Summary
A example class that does arithmetic with functions for people scared of operators.
Adds two integers.
Subtracts two integers.
Multiplies two integers.
Divides two integers.
Returns whether two integers are equal.
Javadoc Compatibility

If you have full language support Natural Docs will also extract documentation from actual Javadoc comments, not just Natural Docs comments written with the Javadoc comment symbols.  This provides you with a good method of migrating to Natural Docs as you don’t have to convert all of your existing documentation.

/**
+ * Multiplies two integers.
+ *
+ * @param x The first integer.
+ * @param y The second integer.
+ * @return The two integers multiplied together.
+ * @see Divide
+ */
+

Multiply

int Multiply (int x,
int y)

Multiplies two integers.

Parameters

xThe first integer.
yThe second integer.

Returns

The two integers multiplied together.

See Also

Divide

While most Javadoc tags and simple HTML formatting are supported, Natural Docs is not a full Javadoc parser and may not support some advanced tags and HTML.  See this page for a list of what’s supported and what isn’t.

A source file can contain both Natural Docs and Javadoc comments.  However, you cannot mix the two within a single comment.  For example, you can’t use asterisks for bold in a @param line.  If a comment is written with the Javadoc comment symbols (repeat the last symbol of the first line once) doesn’t have a topic line (like “Function: Multiply”) and uses Javadoc tags (like @param) the comment is treated as Javadoc.  If any of those conditions aren’t true it’s treated as a Natural Docs comment.

Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/documenting/walkthrough.html b/docs/tool/Help/documenting/walkthrough.html new file mode 100644 index 00000000..7a638ed6 --- /dev/null +++ b/docs/tool/Help/documenting/walkthrough.html @@ -0,0 +1,180 @@ + + +Documenting Your Code - Walkthrough - Natural Docs + + + +
Natural Docs
Documenting Your Code
Our First Function

So you downloaded Natural Docs, you figured out the command line, and now it’s time to start documenting your code.  Natural Docs tries to make this very straightforward and painless, so let’s just dive right in:

/*
+   Function: Multiply
+   Multiplies two integers and returns the result.
+*/
+int Multiply (int x, int y)
+   {  return x * y;  };
+

That’s all you need.  Run Natural Docs and here’s what appears in your output:

Multiply

int Multiply (int x,
int y)

Multiplies two integers and returns the result.

Okay, so that’s all you need, but probably not all you want.  After all, you’ve got some real functions to document, not little one-liners.  Here’s something more elaborate:

/*
+   Function: Multiply
+
+   Multiplies two integers.
+
+   Parameters:
+
+      x - The first integer.
+      y - The second integer.
+
+   Returns:
+
+      The two integers multiplied together.
+
+   See Also:
+
+      <Divide>
+*/
+int Multiply (int x, int y)
+   {  return x * y;  };
+

Multiply

int Multiply (int x,
int y)

Multiplies two integers.

Parameters

xThe first integer.
yThe second integer.

Returns

The two integers multiplied together.

See Also

Divide

int Add (int x,
int y)
Adds two integers.
int Subtract (int x,
int y)
Subtracts two integers.
int Multiply (int x,
int y)
Multiplies two integers.
int Divide (int x,
int y)
Divides two integers.
bool IsEqual (int x,
int y)
Returns whether two integers are equal.

Still not too scary, huh?  Notice the comments are just as readable as the output.  No tags littered about, and the structure is very natural.  You probably get it just by looking at it, but let’s go through the details anyway.

Function: Multiply
+

Every one of these comments you write (called topics) are going to start with a topic line in the format “keyword: title”.  There are a lot of keywords, but they’re exactly what you’d expect: Function, Class, Variable, etc.  There are also a lot of synonyms so instead of Function you could use Func, Procedure, Proc, Method, Constructor, etc.  It’s designed so you can just use whatever it is you’re describing without memorizing anything.  You can glance over the keyword list but you shouldn’t have to consult it very often.

The other part of the topic line is the title.  It should match whatever it is you’re documenting, in this case the function name Multiply.  Natural Docs is case sensitive even if your programming language isn’t, so make sure you match it closely or you might not get the prototype in your output, which is the little gray box.  You don’t need to include the parameters in the title.  In fact, it’s better if you don’t.

Parameters:
+
+Returns:
+
+See Also:
+

You can also define headings by skipping a line and ending the text with a colon.  If you’re used to other documentation systems you may think there’s only a handful of headings to choose from, but any text formatted this way will become one.  If you want a heading called Dependencies you can go right ahead and add it.

x - The first integer.
+y - The second integer.
+

This is what’s called a definition list.  You can use more than one line to finish the definition, as it won’t stop until you skip a line.

x - The first integer.
+y - The second integer with a long description.
+    This is still part of the description.
+
+This is a new paragraph because we skipped a line.
+

Indentation doesn’t matter either, so even if the second description line wasn’t indented to match the first, it would still be considered part of it.

<Divide>
+

This is how we link in Natural Docs, with angle brackets.  There will be a lot more to say about this later, but for now I’ll just show you something cool.  Hover over it in the output below:

You get that everywhere in your generated documentation.

Classes and Scope

So that’s good for our one function of questionable usefulness, but what if we have a whole class of questionable usefulness?  We can document the class and it’s members the same way we documented the individual function, with a Natural Docs comment right above each element.  We’ll go back to short descriptions to keep the example manageable.

/*
+   Class: Counter
+   A class that manages an incrementing counter.
+*/
+class Counter
+   {
+   public:
+
+      /*
+         Constructor: Counter
+         Initializes the object.
+      */
+      Counter()
+         {  value = 0;  };
+
+      /*
+         Function: Value
+         Returns the value of the counter.
+      */
+      int Value()
+         {  return value;  };
+
+      /*
+         Function: Increment
+         Adds one to the counter.
+      */
+      void Increment()
+         {  value++;  };
+
+   protected:
+
+      /*
+         Variable: value
+         The counter's value.
+      */
+      int value;
+   };
+

Everything’s the same, we just substituted Class and Variable for the Function keyword when it was appropriate.  We also used Constructor, but we could have just as easily used Function there too.  They’re both keywords for the same thing so it doesn’t matter.

Scope

Like the source code itself, Natural Docs topics have scope.  Value and Increment are seen as part of class Counter, just like they are in the code.  Why is this important?  Linking.  Linking from one topic to another has similar rules to how one function can call another.  Since Value is in the same class as Increment, it’s topic can link to it with just <Increment>.  However, linking to Increment from a different class would require <Counter.Increment> instead.  You can actually use any of the three most common class/member notations: <Counter.Increment>, <Counter::Increment>, and <Counter->Increment>.

If your programming language has full language support, the scope is determined by the code and applied automatically.  However, if you only have basic language support it follows these rules:

  • Any topic that appears under a Class topic (or anything that says Starts Scope) is part of that class.
  • Any topic that appears under a Section topic (or anything that says Ends Scope) is global again.
  • Any File topic (or anything that says Always Global) is global no matter what and doesn’t affect any other topics.

Chances are you would have written the same thing even if you didn’t know this and it would have just worked.  You usually won’t need to think about them at all.  However, it’s still good to be aware of them in case something doesn’t behave the way you expected it to.

You actually know enough to go start documenting now.  I know Mr. ScrollBar says there’s more on this page you can learn, but if you want to skip out early, you can.  Really.  I don’t mind.

More Formatting

Okay then.  On we go.

Paragraphs, Bold, and Underline

The syntax for these three is exactly what you would expect it to be.

*Bold text*
+
+_Underlined text_
+
+Paragraphs are broken by skipping lines.  So the two
+lines above each have their own paragraph, but these
+three lines are all part of the same one.
+

Bold text

Underlined text

Paragraphs are broken by skipping lines.  So the two lines above each have their own paragraph, but these three lines are all part of the same one.

When underlining multiple words, you can use an underscore for each space or only put them at the edges like we did above.  Both ways will work.

Bullet Lists

You can add bullet lists by starting a line with a dash, an asterisk, an o, or a plus.  Like definition lists, bullets can span multiple lines and indentation doesn’t matter.  To end a bullet you have to skip a line before doing something else.

- Bullet one.
+- Bullet two.
+  Bullet two continued.
+- Bullet three.
+
+Some text after the bullet list.
+
  • Bullet one.
  • Bullet two.  Bullet two continued.
  • Bullet three.

Some text after the bullet list.

Code and Text Diagrams

You can add example code or text diagrams by starting each line with >, |, or :.

> a = b + c;
+> b++;
+
a = b + c;
b++;

If you have a long stretch, you can use (start code) and (end) instead.

(start code)
+
+if (x == 0) {
+   DoSomething();
+}
+
+return x;
+
+(end)
+
if (x == 0) {
DoSomething();
}

return x;

You can also use example, diagram, or table instead of code.  Just use whatever’s appropriate.

As I mentioned before, we don’t want you to worry about memorizing minor details, so in that spirit it will also accept begin for start and finish or done for end.  You can also write (end code) instead of just (end).

Images

You can include images in your documentation by writing “(see filename)”.  If you put it alone on a line it will be embedded in place, or if you put it in a paragraph it will appear after it using the file name as a caption.

This is the first paragraph.
+
+(see logo.gif)
+
+This is the second paragraph (see logo.gif)  This
+is more of the second paragraph.
+

This is the first paragraph.

This is the second paragraph (see logo)  This is more of the second paragraph.

logo

The image file names are relative to the source file the comment appears in, so if your file is C:\Project\SourceFile.cpp and your image is C:\Project\Images\Logo.gif, you would write (see Images/Logo.gif).  However, you can also specify image directories in the command line with -img, so if all your source files are in C:\Project\Source and all your images are in C:\Project\Images, you can put “-img C:\Project\Images” on the command line and just use (see logo.gif) again.

More on Linking

Yes, there’s still more to linking.  You can link to URLs and e-mail addresses, but in this case the angle brackets are optional.

Visit <http://www.website.com> or send messages to
+email@address.com.
+

E-mail addresses are protected from spam crawlers.  They look and act like regular links (try it above) but you can see the actual HTML that’s generated for them here.

As for regular links, to help them fit into sentences easily you can actually include plurals and possessives inside the angle brackets.  In other words, you don’t have to use awkward syntax like <Object>s, although that’s supported as well.  You can simply write <Objects> and it will link to the symbol Object just fine.  It can handle any plural and/or possessive form you can throw at it.  I’m not kidding: Foxes, Fox’s, Foxes’, Children, Mice, Alumni, Indices, Amoebae, Teeth, just try to trip it up.

Extra Documentation

Sometimes you want to include documentation that doesn’t correspond directly to a code element.  Maybe you want to include license information or architecture notes.  There are two ways to do this.

Freestanding Topics

Just because most of the things you write will directly correspond to an element of your source code doesn’t mean they have to.  You can pick any of the available keywords and create a freestanding comment with it.  For example:

/*
+   Class: Counter
+   A class that manages an incrementing counter.
+*/
+class Counter
+   {
+   public:
+
+      /*
+         About: License
+         This file is licensed under the GPL.
+      */
+
+      /*
+         Constructor: Counter
+         Initializes the object.
+      */
+      Counter()
+         {  value = 0;  };
+   ...
+

The extra license topic will be added to the output just like the functions.

License

This file is licensed under the GPL.

Remember that because of scope, the License topic will actually be considered part of Counter the way it’s listed above.  You’d link to it from outside Counter with <Counter.License>.  That idea may take some getting used to, but if an extra topic only applies to one class that’s actually the most appropriate way to do it.  In this case it’s a license, so if it applies to the entire project instead you could put the comment above the class to make it global, just like moving a function there would.

Text Files

You can also add additional documentation with text files.  If you put a file with a .txt extension in your source tree and start it with a topic line, it’s contents will be treated the same as if it were in a comment in your source code.  That means you can define multiple topics within it, you can link between them and topics in your source code, and you can use all available formatting options.

Title: License
+
+This file is licensed under the GPL.
+
+I can link to <Counter> and <Counter.Increment>, and
+the documentation in that class can even link back
+with <License>.
+
+
+About: Second Topic
+
+I can create a *second* topic in here too, complete
+with formatting.
+

The thing some people forget though is that you must start it with a topic line, like “Title: License” above.  This is how Natural Docs tells it apart from regular text files.

Abbreviated Syntax

Here’s another useful thing you may want to know about.  Suppose you have a lot of little things to document, like constants.  Writing a separate topic for each one can be very tedious, no matter how much you compress it:

// Constant: COUNTER_NORMAL
+// Causes the counter to increment normally.
+#define COUNTER_NORMAL 0
+
+// Constant: COUNTER_ODD
+// Causes the counter to only increment in odd numbers.
+#define COUNTER_ODD 1
+
+// Constant: COUNTER_EVEN
+// Causes the counter to only increment in even numbers.
+#define COUNTER_EVEN 2
+

One thing you may have noticed in the keyword list is that they almost all have plural forms.  These are used to create what are called list topics.  You define a topic using a plural keyword, and then anything appearing in a definition list within it creates a linkable symbol as if they each had their own topic.  For example:

/*
+   Constants: Counter Modes
+
+   COUNTER_NORMAL - Causes the counter to increment normally.
+   COUNTER_ODD    - Causes the counter to only increment in odd numbers.
+   COUNTER_EVEN   - Causes the counter to only increment in even numbers.
+*/
+#define COUNTER_NORMAL 0
+#define COUNTER_ODD 1
+#define COUNTER_EVEN 2
+

I would now be able to write <COUNTER_ODD> and have it work the same as it would with the first example.

Using the enum or enumeration keyword is special because it automatically behaves in a similar manner.  This allows both the enum and its values to be documented in the same place.

/*
+   Enum: CounterMode
+
+   NORMAL - Causes the counter to increment normally.
+   ODD    - Causes the counter to only increment in odd numbers.
+   EVEN   - Causes the counter to only increment in even numbers.
+*/
+enum CounterMode { NORMAL, ODD, EVEN };
+

That’s it, you’re done with this walkthrough.  You should know enough now to make very good use of Natural Docs.  If you still want to know more, you can look in the reference for some of the smaller details we may have skipped over.  Also, look at the Customizing pages on this web site for even more you can do.

Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/example/Default.css b/docs/tool/Help/example/Default.css new file mode 100644 index 00000000..7318fdcd --- /dev/null +++ b/docs/tool/Help/example/Default.css @@ -0,0 +1,528 @@ +/* + IMPORTANT: If you're editing this file in the output directory of one of + your projects, your changes will be overwritten the next time you run + Natural Docs. Instead, copy this file to your project directory, make your + changes, and you can use it with -s. Even better would be to make a CSS + file in your project directory with only your changes, which you can then + use with -s [original style] [your changes]. + + On the other hand, if you're editing this file in the Natural Docs styles + directory, the changes will automatically be applied to all your projects + that use this style the next time Natural Docs is run on them. + + This file is part of Natural Docs, which is Copyright © 2003-2004 Greg Valure + Natural Docs is licensed under the GPL +*/ + +body { + font-family: Verdana, Arial, sans-serif; + color: #000000; + margin: 0px; padding: 0px } + +body.UnframedPage { + background-color: #E8E8E8 } + + +a:link, +a:visited { color: #900000; text-decoration: none } +a:hover { color: #900000; text-decoration: underline } +a:active { color: #FF0000; text-decoration: underline } + +td { + vertical-align: top } + +/* + Comment out this line to use web-style paragraphs (blank line between + paragraphs, no indent) instead of print-style paragraphs (no blank line, + indented.) +*/ +p { + text-indent: 5ex; margin: 0 } + + +/* Can't use something like display: none or it won't break. */ +.HB { + font-size: 1px } + + + + +body.FramedMenuPage, +.MenuSection { + font-size: 9pt; + background-color: #E8E8E8; + padding: 10px 0 0 0 } + +.MenuSection { + width: 27ex } + + + .MTitle { + font-size: 16pt; font-weight: bold; font-variant: small-caps; + text-align: center; + padding: 5px 10px 15px 10px; + border-bottom: 1px dotted #000000; + margin-bottom: 15px } + + .MSubTitle { + font-size: 9pt; font-weight: normal; font-variant: normal; + margin-top: 1ex; margin-bottom: 5px } + + + .MEntry a:link, + .MEntry a:hover, + .MEntry a:visited { color: #606060; margin-right: 0 } + .MEntry a:active { color: #A00000; margin-right: 0 } + + + .MGroup { + font-variant: small-caps; font-weight: bold; + margin: 1em 0 1em 10px } + + /* Konqueror just can't do margins. */ + .KHTML .MGroup { + margin-bottom: 0; padding-bottom: 1em } + + .MGroupContent { + font-variant: normal; font-weight: normal } + + .MGroup a:link, + .MGroup a:hover, + .MGroup a:visited { color: #545454; margin-right: 10px } + .MGroup a:active { color: #A00000; margin-right: 10px } + + + .MFile, + .MText, + .MLink, + .MIndex { + padding: 1px 17px 2px 10px; + margin: .25em 0 .25em 0 } + + .MText { + font-size: 8pt; font-style: italic } + + .MLink { + font-style: italic } + + #MSelected { + color: #000000; background-color: #FFFFFF; + /* Replace padding with border. */ + padding: 0 10px 0 10px; + border-width: 1px 2px 2px 0; border-style: solid; border-color: #000000; + margin-right: 5px } + + /* Close off the left side when its in a group. */ + .MGroup #MSelected { + padding-left: 9px; border-left-width: 1px } + + /* A treat for Mozilla users. Blatantly non-standard. Will be replaced with CSS 3 attributes when finalized/supported. */ + .Gecko #MSelected { + -moz-border-radius-topright: 10px; + -moz-border-radius-bottomright: 10px } + .Gecko .MGroup #MSelected { + -moz-border-radius-topleft: 10px; + -moz-border-radius-bottomleft: 10px } + + + + +body.FramedContentPage, +.ContentSection { + background-color: #FFFFFF; + padding-bottom: 15px } + +.ContentSection { + border-width: 0 0 1px 1px; border-style: solid; border-color: #000000 } + + + .CTopic { + font-size: 10pt; + /* This should be a margin but Konq 3.1.1 sucks. */ + padding-bottom: 3em } + + + .CTitle { + font-size: 12pt; font-weight: bold; + border-width: 0 0 1px 0; border-style: solid; border-color: #A0A0A0; + margin: 0 15px .5em 15px } + + .CGroup .CTitle { + font-size: 16pt; font-variant: small-caps; + padding-left: 15px; padding-right: 15px; + border-width: 0 0 2px 0; border-color: #000000; + margin-left: 0; margin-right: 0 } + + .CClass .CTitle, + .CInterface .CTitle, + .CDatabase .CTitle, + .CDatabaseTable .CTitle, + .CSection .CTitle { + font-size: 18pt; + color: #FFFFFF; background-color: #A0A0A0; + padding: 10px 15px 10px 15px; + border-width: 2px 0; border-color: #000000; + margin-left: 0; margin-right: 0 } + + #MainTopic .CTitle { + font-size: 20pt; + color: #FFFFFF; background-color: #7070C0; + padding: 10px 15px 10px 15px; + border-width: 0 0 3px 0; border-color: #000000; + margin-left: 0; margin-right: 0 } + + .CBody { + margin-left: 15px; margin-right: 15px } + + + .CToolTip { + position: absolute; visibility: hidden; + left: 0; top: 0; max-width: 50%; + background-color: #FFFFE0; + padding: 5px; + border-width: 1px 2px 2px 1px; border-style: solid; border-color: #000000; + font-size: 8pt } + + /* Opera 6 gives it a huge height otherwise. */ + .Opera6 .CTooltip, .Opera5 .CTooltip { + max-width: 100% } + + .CHeading { + font-weight: bold; font-size: 10pt; + margin-top: 1.5em; margin-bottom: .5em } + + .CCode { + font: 10pt "Courier New", Courier, monospace; + overflow: auto; + } + + .CBulletList { + /* I don't know why CBody's margin doesn't apply, but it's consistent across browsers so whatever. + Reapply it here as padding. */ + padding-left: 15px; padding-right: 15px; + margin: .5em 5ex .5em 5ex; + } + + .CDescriptionList { + margin: .5em 5ex 0 5ex } + + /* IE 4 and Konqueror always makes it too long. */ + .IE4 .CDescriptionList, + .KHTML .CDescriptionList { + width: 85% } + + .CDLEntry { + font: 10pt "Courier New", Courier, monospace; color: #808080; + padding-bottom: .25em; + white-space: nowrap } + + .CDLDescription { + font-size: 10pt; /* For browsers that don't inherit correctly, like Opera 5. */ + padding-bottom: .5em; padding-left: 5ex } + + .CTopic img { + text-align: center; + display: block; + margin: 1em auto; + } + .CImageCaption { + font-variant: small-caps; + font-size: 8pt; + color: #808080; + text-align: center; + position: relative; + top: 1em; + } + + .CImageLink { + color: #808080; + font-style: italic; + } + a.CImageLink:link, + a.CImageLink:visited, + a.CImageLink:hover { color: #808080 } + + + +.Prototype { + font: 10pt "Courier New", Courier, monospace; + padding: 5px 3ex; + border-width: 1px; border-style: solid; + margin: 0 5ex 1.5em 5ex; + } + + .Prototype td { + font-size: 10pt; + } + + .PDefaultValue, + .PTypePrefix { + color: #8F8F8F; + } + .PTypePrefix { + text-align: right; + } + + .IE .Prototype table { + padding: 0; + } + + .CFunction .Prototype { + background-color: #F4F4F4; border-color: #D0D0D0 } + .CProperty .Prototype { + background-color: #F4F4FF; border-color: #C0C0E8 } + .CVariable .Prototype { + background-color: #FFFFF0; border-color: #E0E0A0 } + + .CDatabaseIndex .Prototype, + .CConstant .Prototype { + background-color: #D0D0D0; border-color: #000000 } + .CType .Prototype { + background-color: #FFF8F8; border-color: #E8C8C8 } + .CDatabaseTrigger .Prototype, + .CEvent .Prototype, + .CDelegate .Prototype { + background-color: #F0FCF0; border-color: #B8E4B8 } + + .CToolTip .Prototype { + margin: 0 0 .5em 0; + white-space: nowrap; + } + + + + + +.Summary { + margin: 1.5em 5ex 0 5ex } + + .STitle { + font-size: 12pt; font-weight: bold; + margin-bottom: .5em } + + + .SBorder { + background-color: #FFFFF0; + padding: 15px; + border: 1px solid #C0C060 } + + /* Let's observe the evolution of IE's brokeness, shall we? + IE 4 always makes them too long, there's no way around it. */ + .IE4 .SBorder { + width: 85% } + /* IE 5 will make them too long unless you set the width to 100%. Isn't this implied for a div? */ + .IE5 .SBorder { + width: 100% } + /* IE 6 behaves like 5 when it's in a frame, but without frames it will be correct without a width or slightly too long + (but not enough to scroll) with a width. This arbitrary weirdness simply astounds me. */ + body.FramedContentPage .IE6 .SBorder { + width: 100% } + + /* A treat for Mozilla users. Blatantly non-standard. Will be replaced with CSS 3 attributes when finalized/supported. */ + .Gecko .SBorder { + -moz-border-radius: 20px } + + + .STable { + font-size: 9pt; width: 100% } + + .SEntrySize { + width: 30% } + .SDescriptionSize { + width: 70% } + + + .SMarked { + background-color: #F8F8D8 } + + + .SEntry .SIndent1 { + margin-left: 1.5ex } + .SEntry .SIndent2 { + margin-left: 3ex } + .SEntry .SIndent3 { + margin-left: 4.5ex } + .SEntry .SIndent4 { + margin-left: 6ex } + .SEntry .SIndent5 { + margin-left: 7.5ex } + + .SDescription { + padding-left: 3ex } + + .SDescription a { color: #800000} + .SDescription a:active { color: #A00000 } + + + .SGroup { + margin-top: .5em; margin-bottom: .25em } + + .SGroup .SEntry { + font-weight: bold; font-variant: small-caps } + + .SGroup .SEntry a { color: #800000 } + .SGroup .SEntry a:active { color: #F00000 } + + + .SMain .SEntry, + .SClass .SEntry, + .SDatabase .SEntry, + .SDatabaseTable .SEntry, + .SSection .SEntry { + font-weight: bold; font-size: 10pt; + margin-bottom: .25em } + + .SClass, + .SDatabase, + .SDatabaseTable, + .SSection { + margin-top: 1em } + + .SMain .SEntry a, + .SClass .SEntry a, + .SDatabase .SEntry a, + .SDatabaseTable .SEntry a, + .SSection .SEntry a { color: #000000 } + + .SMain .SEntry a:active, + .SClass .SEntry a:active, + .SDatabase .SEntry a:active, + .SDatabaseTable .SEntry a:active, + .SSection .SEntry a:active { color: #A00000 } + + + + + +.ClassHierarchy { + margin: 0 15px 1em 15px } + + .CHEntry { + border-width: 1px 2px 2px 1px; border-style: solid; border-color: #A0A0A0; + margin-bottom: 3px; + padding: 2px 2ex; + font-size: 10pt; + background-color: #F4F4F4; color: #606060; + } + + .Gecko .CHEntry { + -moz-border-radius: 4px; + } + + .CHCurrent .CHEntry { + font-weight: bold; + border-color: #000000; + color: #000000; + } + + .CHChildNote .CHEntry { + font-style: italic; + font-size: 8pt; + } + + .CHIndent { + margin-left: 3ex; + } + + .CHEntry a:link, + .CHEntry a:visited, + .CHEntry a:hover { + color: #606060; + } + .CHEntry a:active { + color: #800000; + } + + + + + +body.FramedIndexPage, +.IndexSection { + background-color: #FFFFFF; + font-size: 10pt; + padding: 15px } + +.IndexSection { + border-width: 0 0 1px 1px; border-style: solid; border-color: #000000 } + + .IPageTitle { + font-size: 20pt; font-weight: bold; + color: #FFFFFF; background-color: #7070C0; + padding: 10px 15px 10px 15px; + border-width: 0 0 3px 0; border-color: #000000; border-style: solid; + margin: -15px -15px 0 -15px } + + .INavigationBar { + text-align: center; + background-color: #FFFFF0; + padding: 5px; + border-bottom: solid 1px black; + margin: 0 -15px 15px -15px } + + .INavigationBar a { + font-weight: bold } + + .IHeading { + font-size: 16pt; font-weight: bold; + padding: 2.5em 0 .5em 0; + text-align: center; + width: 3.5ex; + } + #IFirstHeading { + padding-top: 0; + } + + .IEntry { + padding-left: 1ex; } + + .ISubIndex { + padding-left: 3ex; padding-bottom: .5em } + + /* While it may cause some entries to look like links when they aren't, I found it's much easier to read the + index if everything's the same color. */ + .ISymbol { + font-weight: bold; color: #900000 } + + .ISymbolPrefix { + text-align: right; + color: #C47C7C; + background-color: #F8F8F8; + border-right: 3px solid #E0E0E0; + border-left: 1px solid #E0E0E0; + padding: 0 1px 0 2px; + } + #IFirstSymbolPrefix { + border-top: 1px solid #E0E0E0; + } + #ILastSymbolPrefix { + border-bottom: 1px solid #E0E0E0; + } + #IOnlySymbolPrefix { + border-top: 1px solid #E0E0E0; + border-bottom: 1px solid #E0E0E0; + } + + a.IParent, + a.IFile { + display: block; + } + + + + +.Footer { + font-size: 8pt; color: #909090 } + +body.UnframedPage .Footer { + text-align: right; + margin: 2px } + +body.FramedMenuPage .Footer { + text-align: center; + margin: 5em 10px 0 10px} + + .Footer a:link, + .Footer a:hover, + .Footer a:visited { color: #909090 } + .Footer a:active { color: #A00000 } diff --git a/docs/tool/Help/example/NaturalDocs.js b/docs/tool/Help/example/NaturalDocs.js new file mode 100644 index 00000000..2af84cf5 --- /dev/null +++ b/docs/tool/Help/example/NaturalDocs.js @@ -0,0 +1,204 @@ + +// +// Browser Styles +// ____________________________________________________________________________ + +var agt=navigator.userAgent.toLowerCase(); +var browserType; +var browserVer; + +if (agt.indexOf("opera") != -1) + { + browserType = "Opera"; + + if (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1) + { browserVer = "Opera5"; } + else if (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1) + { browserVer = "Opera6"; } + else if (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1) + { browserVer = "Opera7"; } + } + +else if (agt.indexOf("khtml") != -1 || agt.indexOf("konq") != -1 || agt.indexOf("safari") != -1) + { + browserType = "KHTML"; + } + +else if (agt.indexOf("msie") != -1) + { + browserType = "IE"; + + if (agt.indexOf("msie 4") != -1) + { browserVer = "IE4"; } + else if (agt.indexOf("msie 5") != -1) + { browserVer = "IE5"; } + else if (agt.indexOf("msie 6") != -1) + { browserVer = "IE6"; } + } + +else if (agt.indexOf("gecko") != -1) + { + browserType = "Gecko"; + } + +// Opera already taken care of. +else if (agt.indexOf("mozilla") != -1 && agt.indexOf("compatible") == -1 && agt.indexOf("spoofer") == -1 && + agt.indexOf("webtv") == -1 && agt.indexOf("hotjava") == -1) + { + browserType = "Netscape"; + + if (agt.indexOf("mozilla/4") != -1) + { browserVer = "Netscape4"; } + } + + +// +// Menu +// ____________________________________________________________________________ + + +function ToggleMenu(id) + { + if (!window.document.getElementById) + { return; }; + + var display = window.document.getElementById(id).style.display; + + if (display == "none") + { display = "block"; } + else + { display = "none"; } + + window.document.getElementById(id).style.display = display; + } + + +// +// Tooltips +// ____________________________________________________________________________ + + +var tooltipTimer = 0; + +function ShowTip(event, tooltipID, linkID) + { + if (tooltipTimer) + { clearTimeout(tooltipTimer); }; + + var docX = event.clientX + window.pageXOffset; + var docY = event.clientY + window.pageYOffset; + + var showCommand = "ReallyShowTip('" + tooltipID + "', '" + linkID + "', " + docX + ", " + docY + ")"; + + // KHTML cant handle showing on a timer right now. + + if (browserType != "KHTML") + { tooltipTimer = setTimeout(showCommand, 1000); } + else + { eval(showCommand); }; + } + +function ReallyShowTip(tooltipID, linkID, docX, docY) + { + tooltipTimer = 0; + + var tooltip; + var link; + + if (document.getElementById) + { + tooltip = document.getElementById(tooltipID); + link = document.getElementById(linkID); + } + else if (document.all) + { + tooltip = eval("document.all['" + tooltipID + "']"); + link = eval("document.all['" + linkID + "']"); + } + + if (tooltip) + { + var left = 0; + var top = 0; + + // Not everything supports offsetTop/Left/Width, and some, like Konqueror and Opera 5, think they do but do it badly. + + if (link && link.offsetWidth != null && browserType != "KHTML" && browserVer != "Opera5") + { + var item = link; + while (item != document.body) + { + left += item.offsetLeft; + item = item.offsetParent; + } + + item = link; + while (item != document.body) + { + top += item.offsetTop; + item = item.offsetParent; + } + top += link.offsetHeight; + } + + // The fallback method is to use the mouse X and Y relative to the document. We use a separate if and test if its a number + // in case some browser snuck through the above if statement but didn't support everything. + + if (!isFinite(top) || top == 0) + { + left = docX; + top = docY; + } + + // Some spacing to get it out from under the cursor. + + top += 10; + + // Make sure the tooltip doesnt get smushed by being too close to the edge, or in some browsers, go off the edge of the + // page. We do it here because Konqueror does get offsetWidth right even if it doesnt get the positioning right. + + if (tooltip.offsetWidth != null) + { + var width = tooltip.offsetWidth; + var docWidth = document.body.clientWidth; + + if (left + width > docWidth) + { left = docWidth - width - 1; } + } + + // Opera 5 chokes on the px extension, so it can use the Microsoft one instead. + + if (tooltip.style.left != null && browserVer != "Opera5") + { + tooltip.style.left = left + "px"; + tooltip.style.top = top + "px"; + } + else if (tooltip.style.pixelLeft != null) + { + tooltip.style.pixelLeft = left; + tooltip.style.pixelTop = top; + } + + tooltip.style.visibility = "visible"; + } + } + +function HideTip(tooltipID) + { + if (tooltipTimer) + { + clearTimeout(tooltipTimer); + tooltipTimer = 0; + } + + var tooltip; + + if (document.getElementById) + { tooltip = document.getElementById(tooltipID); } + else if (document.all) + { tooltip = eval("document.all['" + tooltipID + "']"); } + + if (tooltip) + { tooltip.style.visibility = "hidden"; } + } + diff --git a/docs/tool/Help/examples.css b/docs/tool/Help/examples.css new file mode 100644 index 00000000..f61d06b6 --- /dev/null +++ b/docs/tool/Help/examples.css @@ -0,0 +1,90 @@ +@import URL(example/Default.css); + + +.NDContent { + color: #000000; background-color: #FFFFFF; + padding: 15px 0; + border-style: solid; + border-width: 1px 3px 3px 1px; + border-color: #c0c0c0 #808080 #808080 #c0c0c0; + margin: 1em 5ex; + -moz-border-radius: 12px; + } + + .NDContent p, + .NDContent li, + .NDContent td, + .NDMenu td, + .NDSummary td, + .NDIndex td { + font-size: 10pt; + line-height: normal; + } + .NDContent .CTopic { + padding-bottom: 0; + } + .Prototype td { + font: 10pt Courier New, monospace; + } + .NDIndex .IHeading { + font-size: 16pt; + } + + +.NDMenu { + font: 9pt Verdana, Arial, sans-serif; + color: #000000; background-color: #E8E8E8; + width: 27ex; + padding: 10px 0; + border-style: solid; + border-width: 1px 3px 3px 1px; + border-color: #808080 #606060 #606060 #808080; + margin: 1em 0 1em 5ex; + -moz-border-radius: 12px; + } + + +.NDFooter { + font: 8pt Verdana, Arial, sans-serif; + color: #909090; background-color: #E8E8E8; + border-style: solid; + border-width: 1px 3px 3px 1px; + border-color: #808080 #606060 #606060 #808080; + margin: 1em 0 1em 5ex; + -moz-border-radius: 12px; + } +.NDFooter td { + font-size: 8pt; + padding: 0 2ex; + } + + .NDFooter a:link, + .NDFooter a:hover, + .NDFooter a:visited { color: #909090 } + .NDFooter a:active { color: #A00000 } + + +.NDSummary { + padding: 15px; + border-style: solid; + border-width: 1px 3px 3px 1px; + border-color: #c0c0c0 #808080 #808080 #c0c0c0; + margin: 1em 5ex; + -moz-border-radius: 12px; + } + + .NDSummary .Summary { + margin-top: 0; + } + + +.NDIndex { + color: #000000; background-color: #FFFFFF; + padding: 15px; + border-style: solid; + border-width: 1px 3px 3px 1px; + border-color: #c0c0c0 #808080 #808080 #c0c0c0; + margin: 1em 5ex; + -moz-border-radius: 12px; + } + diff --git a/docs/tool/Help/images/header/background.png b/docs/tool/Help/images/header/background.png new file mode 100644 index 00000000..09a2ea46 Binary files /dev/null and b/docs/tool/Help/images/header/background.png differ diff --git a/docs/tool/Help/images/header/leftside.png b/docs/tool/Help/images/header/leftside.png new file mode 100644 index 00000000..7d093865 Binary files /dev/null and b/docs/tool/Help/images/header/leftside.png differ diff --git a/docs/tool/Help/images/header/logo.png b/docs/tool/Help/images/header/logo.png new file mode 100644 index 00000000..9317a1b6 Binary files /dev/null and b/docs/tool/Help/images/header/logo.png differ diff --git a/docs/tool/Help/images/header/overbody.png b/docs/tool/Help/images/header/overbody.png new file mode 100644 index 00000000..6b86af15 Binary files /dev/null and b/docs/tool/Help/images/header/overbody.png differ diff --git a/docs/tool/Help/images/header/overbodybg.png b/docs/tool/Help/images/header/overbodybg.png new file mode 100644 index 00000000..b4284ec1 Binary files /dev/null and b/docs/tool/Help/images/header/overbodybg.png differ diff --git a/docs/tool/Help/images/header/overleftmargin.png b/docs/tool/Help/images/header/overleftmargin.png new file mode 100644 index 00000000..3d02af7f Binary files /dev/null and b/docs/tool/Help/images/header/overleftmargin.png differ diff --git a/docs/tool/Help/images/header/overmenu.png b/docs/tool/Help/images/header/overmenu.png new file mode 100644 index 00000000..d720d986 Binary files /dev/null and b/docs/tool/Help/images/header/overmenu.png differ diff --git a/docs/tool/Help/images/header/overmenubg.png b/docs/tool/Help/images/header/overmenubg.png new file mode 100644 index 00000000..69339d8c Binary files /dev/null and b/docs/tool/Help/images/header/overmenubg.png differ diff --git a/docs/tool/Help/images/header/rightside.png b/docs/tool/Help/images/header/rightside.png new file mode 100644 index 00000000..f8ef976a Binary files /dev/null and b/docs/tool/Help/images/header/rightside.png differ diff --git a/docs/tool/Help/images/logo.gif b/docs/tool/Help/images/logo.gif new file mode 100644 index 00000000..2fa571ee Binary files /dev/null and b/docs/tool/Help/images/logo.gif differ diff --git a/docs/tool/Help/images/menu/about.png b/docs/tool/Help/images/menu/about.png new file mode 100644 index 00000000..ca65ea4e Binary files /dev/null and b/docs/tool/Help/images/menu/about.png differ diff --git a/docs/tool/Help/images/menu/background.png b/docs/tool/Help/images/menu/background.png new file mode 100644 index 00000000..db8b557b Binary files /dev/null and b/docs/tool/Help/images/menu/background.png differ diff --git a/docs/tool/Help/images/menu/bottomleft.png b/docs/tool/Help/images/menu/bottomleft.png new file mode 100644 index 00000000..0f608c8b Binary files /dev/null and b/docs/tool/Help/images/menu/bottomleft.png differ diff --git a/docs/tool/Help/images/menu/bottomright.png b/docs/tool/Help/images/menu/bottomright.png new file mode 100644 index 00000000..10c9e029 Binary files /dev/null and b/docs/tool/Help/images/menu/bottomright.png differ diff --git a/docs/tool/Help/images/menu/community.png b/docs/tool/Help/images/menu/community.png new file mode 100644 index 00000000..0021013a Binary files /dev/null and b/docs/tool/Help/images/menu/community.png differ diff --git a/docs/tool/Help/images/menu/customizing.png b/docs/tool/Help/images/menu/customizing.png new file mode 100644 index 00000000..d56d25b3 Binary files /dev/null and b/docs/tool/Help/images/menu/customizing.png differ diff --git a/docs/tool/Help/images/menu/using.png b/docs/tool/Help/images/menu/using.png new file mode 100644 index 00000000..1de988d2 Binary files /dev/null and b/docs/tool/Help/images/menu/using.png differ diff --git a/docs/tool/Help/index.html b/docs/tool/Help/index.html new file mode 100644 index 00000000..8a5fe021 --- /dev/null +++ b/docs/tool/Help/index.html @@ -0,0 +1,9 @@ + + +Natural Docs + + + +
Natural Docs
Version 1.4

This is the Natural Docs help file, a subset of the documentation available at the web site.  Everything you need is on the menu to the left.

Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/javascript/BrowserStyles.js b/docs/tool/Help/javascript/BrowserStyles.js new file mode 100644 index 00000000..71666418 --- /dev/null +++ b/docs/tool/Help/javascript/BrowserStyles.js @@ -0,0 +1,77 @@ + +// +// Browser Styles +// ____________________________________________________________________________ + +var agt=navigator.userAgent.toLowerCase(); +var browserType; +var browserVer; + +if (agt.indexOf("opera") != -1) + { + browserType = "Opera"; + + if (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1) + { browserVer = "Opera5"; } + else if (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1) + { browserVer = "Opera6"; } + else if (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1) + { browserVer = "Opera7"; } + } + +else if (agt.indexOf("khtml") != -1 || agt.indexOf("konq") != -1 || agt.indexOf("safari") != -1) + { + browserType = "KHTML"; + } + +else if (agt.indexOf("msie") != -1) + { + browserType = "IE"; + + if (agt.indexOf("msie 4") != -1) + { browserVer = "IE4"; } + else if (agt.indexOf("msie 5") != -1) + { browserVer = "IE5"; } + else if (agt.indexOf("msie 6") != -1) + { browserVer = "IE6"; } + else if (agt.indexOf("msie 7") != -1) + { browserVer = "IE7"; } + } + +else if (agt.indexOf("gecko") != -1) + { + browserType = "Gecko"; + } + +// Opera already taken care of. +else if (agt.indexOf("mozilla") != -1 && agt.indexOf("compatible") == -1 && agt.indexOf("spoofer") == -1 && + agt.indexOf("webtv") == -1 && agt.indexOf("hotjava") == -1) + { + browserType = "Netscape"; + + if (agt.indexOf("mozilla/4") != -1) + { browserVer = "Netscape4"; } + } + + +function OpeningBrowserTags() + { + if (browserType) + { + document.write('
'); + + if (browserVer) + { document.write('
'); } + } + }; + +function ClosingBrowserTags() + { + if (browserType) + { + document.write('
'); + + if (browserVer) + { document.write('
'); } + } + }; diff --git a/docs/tool/Help/javascript/PNGHandling.js b/docs/tool/Help/javascript/PNGHandling.js new file mode 100644 index 00000000..ab47a538 --- /dev/null +++ b/docs/tool/Help/javascript/PNGHandling.js @@ -0,0 +1,72 @@ +// Parts derived from: +// Opacity Displayer, Version 1.0 +// Copyright Michael Lovitt, 6/2002. +// Distribute freely, but please leave this notice intact. +// http://www.alistapart.com/articles/pngopacity/ + +// Parts derived from: +// Natural Docs +// Copyright (C) 2003-2004 Greg Valure +// http://www.naturaldocs.org/ + + +var pngTransform; +var pngNormal; + +var agt=navigator.userAgent.toLowerCase(); + +if (agt.indexOf("opera") != -1) + { + if ( (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1) && + agt.indexOf("mac") != -1) + { + pngNormal = 1; + } + else if (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1 || + agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1) + { + pngNormal = 1; + } + } + +else if (agt.indexOf("msie") != -1) + { + if (agt.indexOf("msie 5.5") != -1 || agt.indexOf("msie 6") != -1) + { + if (agt.indexOf("mac") != -1) + { pngNormal = 1; } + else if (agt.indexOf("win") != -1) + { pngTransform = 1; }; + } + + else if (agt.indexOf("msie 5") != -1) + { + if (agt.indexOf("mac") != -1) + { pngNormal = 1; }; + } + + else if (agt.indexOf("msie 7") != -1) + { pngNormal = 1; } + } + +else if (agt.indexOf("gecko") != -1) + { + pngNormal = 1; + } + + +function PNGGIF(strPath, intWidth, intHeight, strAlt, strID) + { + if (pngTransform) + { + document.write('
'); + } + else if (pngNormal) + { + document.write(''+strAlt+''); + } + else + { + document.write(''+strAlt+''); + } + }; diff --git a/docs/tool/Help/keywords.html b/docs/tool/Help/keywords.html new file mode 100644 index 00000000..42c16c90 --- /dev/null +++ b/docs/tool/Help/keywords.html @@ -0,0 +1,38 @@ + + +Natural Docs Topics and Keywords + + + +
Natural Docs
Topics and Keywords

Keywords are not case sensitive and are interchangable within their topic type.  The plural forms denote list topics where every item in its definition lists are treated like they have their own topic.

General Topics
Generic
topictopics
aboutlist
Section
Ends Scope
section
title
Group
group
File
Always Global
filefiles
programprograms
scriptscripts
documentdocuments
docdocs
headerheaders
Code Topics
Class
Starts Scope
classclasses
structurestructures
structstructs
packagepackages
namespacenamespaces
Interface
Starts Scope
interfaceinterfaces
Type
typetypes
typedeftypedefs
Constant
constantconstants
constconsts
Enumeration
Topic indexed under Types
Members indexed under Constants
enumerationenumerations
enumenums
Function
List topics break apart
functionfunctions
funcfuncs
procedureprocedures
procprocs
routineroutines
subroutinesubroutines
subsubs
methodmethods
callbackcallbacks
constructorconstructors
destructordestructors
operatoroperators
Property
propertyproperties
propprops
Event
eventevents
Delegate
delegatedelegates
Macro
macromacros
definedefines
defdefs
Variable
variablevariables
varvars
integerintegers
intints
uintuints
longlongs
ulongulongs
shortshorts
ushortushorts
bytebytes
ubyteubytes
sbytesbytes
floatfloats
doubledoubles
realreals
decimaldecimals
scalarscalars
arrayarrays
arrayrefarrayrefs
hashhashes
hashrefhashrefs
boolbools
booleanbooleans
flagflags
bitbits
bitfieldbitfields
fieldfields
pointerpointers
ptrptrs
referencereferences
refrefs
objectobjects
objobjs
charactercharacters
wcharacterwcharacters
charchars
wcharwchars
stringstrings
wstringwstrings
strstrs
wstrwstrs
handlehandles
Database Topics
Database
databasedatabases
dbdbs
Database Table
Starts Scope
tabletables
database tabledatabase tables
db tabledb tables
Database View
Starts Scope
viewviews
database viewdatabase views
db viewdb views
Database Cursor
cursorcursors
database cursordatabase cursors
db cursordb cursors
Database Index
indexindexes
indices
database indexdatabase indexes
database indices
db indexdb indexes
db indices
keykeys
database keydatabase keys
db keydb keys
primary keyprimary keys
database primary keydatabase primary keys
db primary keydb primary keys
Database Trigger
triggertriggers
database triggerdatabase triggers
db triggerdb triggers
Miscellaneous Topics
Cookie
Always global
cookiecookies
Build Target
targettargets
build targetbuild targets
Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/languages.html b/docs/tool/Help/languages.html new file mode 100644 index 00000000..cab7e6fe --- /dev/null +++ b/docs/tool/Help/languages.html @@ -0,0 +1,32 @@ + + +Natural Docs Language Support + + + +
Natural Docs
About
Language SupportOutput Formats
Language Support
Full Language Support

The following languages have full language support, which means you get:

Full code documentation.  All functions, variables, and classes will appear in the output regardless of whether you wrote anything for them.  This can be turned off with the -do command line option.

Inheritance diagrams.  They will appear in the output wherever appropriate.

Javadoc compatibility.  Natural Docs can read most Javadoc comments and include them in the output.  You can also write Natural Docs documentation without topic lines by using the Javadoc comment symbols.

Auto-scoping.  The class a topic is part of is determined by the source code rather than class and section topics.

  • C# (1.1, some 2.0)
  • Perl
  • ActionScript (2 and 3)
Basic Language Support

The following languages have basic language support, which means you have:

Explicit documentation only.  Only things you write Natural Docs documentation for will appear in the output.

No inheritance diagrams.

Natural Docs comments only.  They also need to include a topic line.

Topic scoping.  The class a topic is part of is determined by the topic scoping rules.

  • C/C++
  • Java
  • PHP
  • Python
  • PL/SQL
  • Visual Basic
  • Pascal/Delphi
  • Ada
  • JavaScript
  • Ruby
  • Tcl
  • ColdFusion
  • Assembly
  • Fortran (free-format only)
  • R
  • Makefiles
  • Plain Text
  • Custom Languages
Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/menu.html b/docs/tool/Help/menu.html new file mode 100644 index 00000000..37c43654 --- /dev/null +++ b/docs/tool/Help/menu.html @@ -0,0 +1,79 @@ + + +Organizing the Menu - Natural Docs + + + +
Natural Docs
Organizing the Menu

Natural Docs creates a file called Menu.txt in your project directory that you can edit to organize the menu.  It normally takes care of this on its own, but you have the option of improving it manually if you want to.

Order and Titles

If you’ve never looked in it before, the menu file will have some comments explaining its syntax and a list like you see below.

File: ClassA  (ClassA.h)
+File: ClassB  (ClassB.h)
+File: Globals  (Globals.h)
+

The list gets turned into a menu that looks like this:

The lines are in the format “File: [title] ([filename])”.  When Natural Docs made the menu, it decided on its own what the title of each file should be and then put them in alphabetical order.  However, suppose we don’t want this.  We want Globals above the classes and we want spaces in the menu titles.  So we edit the file.

File: Globals  (Globals.h)
+File: Class A  (ClassA.h)
+File: Class B  (ClassB.h)
+

Run Natural Docs again and the menu is updated.

However, open the menu file again and you’ll see something interesting.

File: Globals  (Globals.h)
+File: Class A  (no auto-title, ClassA.h)
+File: Class B  (no auto-title, ClassB.h)
+

Natural Docs noticed that you changed a couple of the titles and added a no auto-title attribute to each one.  This tells it to never change them on it’s own in the future, so your changes won’t be lost.  You don’t have to worry about adding this, Natural Docs will always do it automatically.  However, to go back to automatic titles you’d have to manually remove it.

Grouping

This menu is good for our example, but in the real world they get much, much longer.  We can add groups to organize it further.  Natural Docs will create them automatically based on the each file’s directory, but once again you can improve it manually if that’s not good enough.

You can add groups as shown below.

File: Globals  (Globals.h)
+Group: Classes {
+   File: Class A  (no auto-title, ClassA.h)
+   File: Class B  (no auto-title, ClassB.h) }
+

You can also nest them inside each other.

File: Globals  (Globals.h)
+Group: Classes {
+   File: Class A  (no auto-title, ClassA.h)
+   Group: Nested Group {
+      File: Class B  (no auto-title, ClassB.h)  }
+   }
+

We’ll get rid of the nested group because it doesn’t make sense for our example.  Run Natural Docs, open up the menu file again and take a look.

File: Globals  (Globals.h)
+
+Group: Classes  {
+
+   File: Class A  (no auto-title, ClassA.h)
+   File: Class B  (no auto-title, ClassB.h)
+   }  # Group: Classes
+

Natural Docs reformatted it.  When you’re organizing the menu, you don’t have to worry about the indentation or otherwise keeping it neat.  The file is reformatted every time it changes, so you can make quick and dirty edits and Natural Docs will keep it readable.

Besides breaking up long lists, groups also serve another purpose.  Clicking on them will make it expand and collapse.  Go ahead and try it in the examples above.  When the menu gets too long its groups will start being collapsed by default, allowing easier navigation on large projects where it would just be impractical to show everything at once.

Indexes and Search

Natural Docs will automatically determine what indexes your project needs and add them to the menu.  Anything indexed will also be used for the search feature.  The entries will look like this:

Group: Index {
+
+   Index: Everything
+   Class Index: Classes
+   Function Index: Functions
+   }  # Group: Index
+

Like the file entries we saw before, you can rename them by editing the title and reorder them by cutting and pasting.  However, if you decide you don’t want a particular index to be generated, just delete its entry and it will go away.  Just like before, Natural Docs will detect this and add something new:

Don't Index: Functions
+

As with no auto-title, Natural Docs adds this automatically to make sure it doesn’t later undo your changes.

Automatic Changes

Natural Docs tries to manage the menu on its own as much as possible so you don’t have to worry about it.  This is just a peek into some of the things it does so you know what to expect.

You already saw that by default Natural Docs tries to guess what title should be for each file.  If you leave it this way, Natural Docs will always update the menu for you if the file’s content changes significantly enough to change its guess, such as if you rename the first class defined in it.  If you’d like to take advantage of this to define the menu title in each source file instead of in the menu itself, add a “Title: [title]” comment to the top of the file.

When you add and delete source files, Natural Docs will automatically add and remove them from the menu file.  When adding one it will look for the best group to put it in by directory.  If your grouping mirrors the source tree somewhat, this will be a lot more accurate.  Also, if the group it’s putting it in is alphabetized, Natural Docs will put it in the correct place to maintain that alphabetization.  In fact, even if an existing file’s automatic title changes, it will change it’s position to make sure a previously alphabetized group stays that way.

There are exceptions in alphabetization for the indexes.  If a group only contains indexes, it can be the last item on the menu or in its parent group without making it count as unsorted.  Also, within groups that only contain indexes, the general index can be first, also without making the group count as unsorted.

Finally, if Natural Docs adds some files to a group that causes it to become too long, it will attempt to sub-group it based on directory.  However, it will only do this when its adding files on its own, so you don’t have to worry about it constantly messing up your groups.  Since new files aren’t added to a project that often, if you change the menu manually it should stay that way for quite some time.

Extras

There’s more you can do with the menu than just renaming and reorganizing its entries.  Natural Docs has a few extras you can add to it as well.

Title and Subtitle

You can add a title and subtitle to your menu.

Title: My Project
+SubTitle: Something That Does Something
+
+File: Globals  (Globals.h)
+Group: Classes
+   File: Class A  (no auto-title, ClassA.h)
+   File: Class B  (no auto-title, ClassB.h)
+
My Project
Something That Does Something

In addition to adding the title to the menu, the Title tag will also change the HTML page titles from “Class A” to “Class A - My Project”, making bookmarks clearer.

Text and Web Links

You can also add arbitrary text and web links to your menu.

File: Globals  (Globals.h)
+Group: Classes  {
+   Text: I couldn't think of good names for these classes.
+   File: Class A  (no auto-title, ClassA.h)
+   File: Class B  (no auto-title, ClassB.h)
+   }
+Link: Built with Natural Docs  (http://www.naturaldocs.org)
+
Classes

Even though comments use the # character, adding an anchor to a link (such as “http://www.website.com/page.html#anchor”) will still work.

Footers

Finally, you can add a footer to all your pages, such as a copyright notice.  Natural Docs will change any (c)’s it finds into real copyright symbols.

Footer: Copyright (C) 2008 Me
+
Copyright © 2008 Me  ·  Generated by Natural Docs

You can also add a timestamp in any format you want.  The tokens you can use in building it are:

mOne or two digit month.January is “1”
mmAlways two digit month.January is “01”
monShort month word.January is “Jan”
monthLong month word.January is “January”
dOne or two digit day.1 is “1”
ddAlways two digit day.1 is “01”
dayDay with letter extension.1 is “1st”
yyTwo digit year.2008 is “08”
yyyyFour digit year.2008 is “2008”
yearFour digit year.2008 is “2008”

Everything else appears literally, so we can add:

Timestamp: Updated month day, year
+

and get:

Copyright © 2008 Me  ·  Updated January 1st, 2008  ·  Generated by Natural Docs
Errors

If there’s ever an error in the menu file, Natural Docs will tell you when it’s run.  It also adds a comment for each one in the menu file itself so that you can search for them in a text editor.

# There is an error in this file.  Search for ERROR to find it.
+
+File: Globals  (Globals.h)
+Group: Classes  {
+# ERROR: Txet is not a valid keyword.
+   Txet: I couldn't think of good names for these classes.
+   File: Class A  (no auto-title, ClassA.h)
+   File: Class B  (no auto-title, ClassB.h)
+   }
+

Remember that Natural Docs reformats the menu file whenever it’s run, so you only need to correct the error.  Natural Docs will remove the error comments on its own.

Portability and Versioning Systems

If you only use one input directory, all the files in the menu will have relative paths.  However, if you have more Natural Docs will use the absolute path instead.

This is not a problem.  The menu file can still be shared between machines even if they don’t keep the source tree in the exact same location.  As long as you have the same layout within the source tree and point to the same base directories in the command line, Natural Docs will be able to convert the paths automatically for the new machine.

However, if you’re putting the menu file in a versioning system like Subversion or SourceSafe, it might be very desirable to only have relative paths so anybody can check it in and only the real changes show.  In that case, instead of using multiple input directories, see if it’s possible to only have one input directory and use the -xi command line option to exclude the subdirectories you don’t want scanned.

That’s It!

And we’re done.  The syntax to do all of this is included in the menu file itself, so you don’t need to memorize everything.  You shouldn’t need to organize the menu very often, just after a lot of new files have been added and if you don’t like the default.

Note that if you’re using the non-framed HTML output format, changing the menu does require every output file to be updated.  However, Natural Docs has a special process just for this so it won’t take nearly as long as if it were rebuilding them all from scratch.  Still, if you’re working on a large project, it may be worth considering the framed HTML output format.

Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/output.html b/docs/tool/Help/output.html new file mode 100644 index 00000000..b2b6f354 --- /dev/null +++ b/docs/tool/Help/output.html @@ -0,0 +1,84 @@ + + +Output Formats - Natural Docs + + + +
Natural Docs
About
Language SupportOutput Formats
Output Formats

These are the output formats that are currently implemented in Natural Docs.

HTMLHTML output.  Each page is self-contained.  Linking to specific pages is easy, but every file has to be updated whenever the menu changes.
FramedHTMLHTML output based on frames.  The menu is updated quickly, but linking to individual pages is difficult and some people just plain hate frames.
HTML Compatibility

These are the browsers Natural Docs’ HTML output has been tested with.  All browsers will be able to view and navigate it, some of the older ones just may not be able to use advanced features like search correctly.

FireFoxTested with 1.0, 1.5, and 2.0.
Internet ExplorerTested with 6 and 7.
SafariTested with 2 and 3.  Search doesn’t work with unframed HTML in 2.
OperaTested with 7.0, 7.5, 8.0, 8.5, and 9.0.  Search doesn’t work with 7.0, and sometimes tooltips.
KonquerorTested with 3.5.5.  Search doesn’t work.
Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/running.html b/docs/tool/Help/running.html new file mode 100644 index 00000000..492bb3ae --- /dev/null +++ b/docs/tool/Help/running.html @@ -0,0 +1,40 @@ + + +Running Natural Docs + + + +
Natural Docs
Running Natural Docs
 
How and When

Probably the best way to run Natural Docs is as part of the build process.  This way every time you compile your code, your documentation is updated as well and you always have a current reference.  Natural Docs has a differential build process so it will not rebuild the entire set of documentation every time it’s run.

If you’d like to run it manually instead, you should determine the command line you need and save it as a shortcut, batch file, or script since you should be running it often and will rarely need to fiddle with the parameters.

Command Line
NaturalDocs -i [input (source) directory]
+            -o [output format] [output directory]
+            -p [project directory]
+            [options]
Required Parameters:
-i [dir]
--input [dir]
--source [dir]

The input (source) directory.  Natural Docs will build the documentation from the files in this directory and all its subdirectories.  You can specify it multiple times to include multiple directories.  See the list of supported programming languages.

-o [fmt] [dir]
--output [fmt] [dir]

The output format and directory.  This can also be specified multiple times, so you can build the documentation in multiple formats in a single run.  See the list of supported output formats.

-p [dir]
--project [dir]

The project directory.  Natural Docs needs a place to store configuration and data files for each project it’s run on, so this is where it will put them.  No two projects should share the same directory.

Optional Parameters:
-xi [dir]
--exclude-input [dir]
--exclude-source [dir]

Excludes a subdirectory from being scanned.  The output and project directories are automatically excluded.

-img [dir]
--images [dir]

Adds a directory to search for image files when using (see [file]).

-s [style] ([style] ...)
--style [style] ([style] ...)

Selects the CSS style for HTML output.  See the default list of styles.

You can use any CSS file in your project directory or Natural Docs’ Styles directory just by using its name without the .css extension.  If you include more than one, they will all be included in the HTML that order.

-r
--rebuild

Rebuilds everything from scratch.  All source files will be rescanned and all output files will be rebuilt

-ro
--rebuild-output

Rebuilds all output files from scratch.

-t [len]
--tab-length [len]

Sets the number of spaces tabs should be expanded to.  This only needs to be set if you use tabs in example code or text diagrams.  The default is 4.

-do
--documented-only

Tells Natural Docs to only include what you explicitly document in the output, and not to find undocumented classes, functions, and variables.  This option is only relevant if you have full language support.

-oft
--only-file-titles

Tells Natural Docs to only use the file name for its menu and page titles.  It won’t try to determine one from the contents of the file.

-nag
--no-auto-group

Tells Natural Docs to not automatically create group topics if you don’t add them yourself.

-cs [charset]
--charset [charset]
--character-set [charset]

Sets the character set property of the generated HTML, such as UTF-8 or Shift_JIS.  The default leaves it unspecified.

-q
--quiet

Suppresses all non-error output.

-?
-h
--help

Prints the syntax reference.

No Longer Supported:
These parameters were part of previous Natural Docs releases, but are no longer supported.
-ho
--headers-only

This used to check only the headers and not the source files in C and C++.  Edit Languages.txt instead and add the line “Ignore Extensions: c cpp cxx”.

-s Custom
--style Custom

This used to tell Natural Docs not to alter the CSS file in the output directory.  Copy your custom CSS file to your project directory and use it with -s instead.

-ag [level]
--auto-group [level]

This used to set the level of auto-grouping between Full, Basic, and None.  The algorithm was improved so there’s no need for separate levels anymore.  You can use -nag if you want to turn it off completely.

Examples
NaturalDocs -i C:\My Project\Source
+            -o FramedHTML C:\My Project\Docs
+            -p C:\My Project\Natural Docs
+
+NaturalDocs -i /project/src1
+            -i /project/src2
+            -o HTML /project/doc
+            -p /project/nd
+            -s Small -t 3
Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/styles.css b/docs/tool/Help/styles.css new file mode 100644 index 00000000..f9bc8d0a --- /dev/null +++ b/docs/tool/Help/styles.css @@ -0,0 +1,290 @@ + +body { + background: #FFFFFF; + margin: 18px 15px 25px 15px !important; + } + +body, +td, +li { + font: 9pt Verdana, sans-serif; + } +p, +td, +li { + line-height: 150%; + } + +p { + text-indent: 4ex; + margin: 0; + } + +td { + vertical-align: top; + } + +a:link, +a:visited { color: #900000; text-decoration: none } +a:hover { color: #900000; text-decoration: underline } +a:active { color: #FF0000; text-decoration: underline } + +.Opera wbr:after { + content: "\00200B"; + } + +.NoIndent p + { text-indent: 0; } + +img { + border: none; + } + +.First { + margin-top: 0 !important; + padding-top: 0 !important; + } +.Last { + margin-bottom: 0 !important; + padding-bottom: 0 !important; + } + +.Header { + background-image: URL("images/header/background.png"); + background-color: #7070C0; + } +.SideMenuTop { + background: URL("images/header/overmenubg.png"); + } +.SideMenuBottom { + vertical-align: bottom; + } +.BodyTop { + background: URL("images/header/overbodybg.png"); + text-align: right; + } +.BodyBottom { + vertical-align: bottom; + text-align: right; + font: italic 8pt Georgia, serif; + color: #C0C0C0; + padding-right: 10px; + } + +.Body { + padding: 15px 20px 0 25px; + } + +#SourceForgeLogo { + border: 1px solid #D8D8D8; + margin-top: 2em; + } + + + +pre, code, .Example { + font: 10pt Courier New, Courier, monospace; + color: #606060; + } +a code { + color: #C06060; + } +.Example { + overflow: auto; + } + +.PageTitle { + font: bold italic 21pt Trebuchet MS, sans-serif; letter-spacing: .5ex; text-transform: uppercase; + margin-bottom: .5em } +.IE .PageTitle { + letter-spacing: 1.25ex; + } + + +.Topic { + margin-bottom: 2em } + + +.TopicTitle { + font: 18pt Georgia, serif; + border-width: 0 0 1px 0; border-style: solid; border-color: #C0C0C0; + margin-bottom: .5em + } +#SubscribeTopicTitle { + margin-bottom: 0; + } +.Subscribe { + font-size: 8pt; + margin-bottom: 2em; + color: #909090; + } + +.Subscribe a:link, +.Subscribe a:hover, +.Subscribe a:visited { + color: #909090 } + + +.SubTopic { + font-weight: bold; font-size: 10pt; + padding-top: 1.5em; padding-bottom: .5em; + } + +.MiniTopic { + font-weight: bold; + padding-top: 1em; padding-bottom: 0em; + } + + +.TOC { + text-align: center; + font: 8pt Verdana, sans-serif; + text-transform: uppercase; + background-color: #F8F8F8; + border-width: 1px; border-style: solid; border-color: #C0C0C0; + margin-bottom: 1.5em; + padding: 2px 0; + -moz-border-radius: 14px; + } + + .TOC a { + margin: 0 0.75ex; } + + .TOC a:link, + .TOC a:hover, + .TOC a:visited { + color: #404040 } + + +.Example { + background-color: #FDFDFD; + padding: 15px; + border: 1px solid #C0C0C0; + border-width: 1px 1px 1px 6px; + border-style: dashed dashed dashed solid; + color: #707070; + margin: 15px 5ex; + } + + +.LastUpdated { + font: italic 10pt Georgia, serif; + color: #A0A0A0; + margin: 1em 0; + } + + + +.FAQSummary { + margin-bottom: 3em; + } +.FAQSummaryGroup { + font: bold 12pt Georgia, serif; + margin: 1em 0 .25em 0; + } +.FAQGroup { + font: 18pt Georgia, serif; + border-bottom: 1px solid #C0C0C0; + margin-bottom: .5em; + margin-top: 1.5em; + } +.FAQSummaryEntry:link, +.FAQSummaryEntry:visited, +.FAQSummaryEntry:hover, +.FAQSummaryEntry:active { + } + +.FAQEntry { + margin-bottom: 3em; + } +.FAQEntryTitle { + font: bold 12pt Georgia, serif; + margin-bottom: .5em; + } +.FAQEntry .SubTopic { + font: italic 9pt Verdana, sans-serif; + } + + + +.SideMenu { + width: 175px; /* 195 minus padding */ + text-align: center; + padding-top: 15px; + background-color: #F0F0F0; + } +.SideMenuBottom { + background-color: #F0F0F0; + } +.SideMenuBottomRight { + text-align: right; + } + +.SideMenuSection { + margin-bottom: 3em; + } + +.SideMenuTitle { + padding-bottom: 3px; + border-bottom: 1px solid #D0D0D0; + } + +.SideMenuBody { + padding-top: 1em; + background: URL("images/menu/background.png") repeat-x; + } + +.SideMenuEntry { + font: 8pt Verdana, sans-serif; + margin: 0 10px 1em 10px; + display: block; + } + +a.SideMenuEntry:link, +a.SideMenuEntry:visited { + color: #000000; + padding: 1px 10px 2px 9px; + } +a.SideMenuEntry:hover, +a.SideMenuEntry:active, +#SelectedSideMenuEntry { + border-style: solid; + border-width: 1px 2px 2px 1px; + padding: 0 8px; + text-decoration: none; + -moz-border-radius: 10px; + } +a.SideMenuEntry:hover, +a.SideMenuEntry:active { + color: #000000; + border-color: #C8C8C8; + background-color: #F8F8F8; + } +#SelectedSideMenuEntry { + color: #000000; + border-color: #606060; + background-color: #FFFFFF; + } + +.SideMenuSourceForge { + padding-top: 5px; + } + + + +/* Needed by the release notes for 1.3 */ + +.ExPrototype { + font: 10pt Courier New, Courier, monospace; + padding: 5px 3ex; + background-color: #F4F4F4; + border: 1px solid #D0D0D0; + margin: 1em 0; + } +.ExPrototype td { + font: 10pt Courier New, Courier, monospace; + } +.ExPrototype .Fade { + color: #8F8F8F; + } + diff --git a/docs/tool/Help/styles.html b/docs/tool/Help/styles.html new file mode 100644 index 00000000..ebd8abca --- /dev/null +++ b/docs/tool/Help/styles.html @@ -0,0 +1,52 @@ + + +CSS Styles - Natural Docs + + + +
Natural Docs
CSS Styles
Default Styles

These are the styles that come with Natural Docs.  They all follow the same color scheme and general layout; the choices are more so that you can choose the style of text you want.

You choose which style you want for your project by adding “-s [style name]” to the command line.

DefaultThis is the default style that Natural Docs uses.  Most of the text is 10pt Verdana.
SmallSmaller fonts than Default with most of the text using 8pt Verdana.  Some people like the small fonts because you can fit more on the screen at once.  However, some people hate them and find them hard to read.
RomanSerif fonts with most of the text using 12pt Roman.  Some people prefer Roman fonts, usually those that have decent anti-aliasing displays like Mac OS X or Windows XP with ClearType.
Customizing

There are two ways to customize the CSS files.  One is to build your own file from scratch, and the other is to make a touch-up file that gets applied after one of the default styles.  Either way you want to create your own CSS file in your project directory (the one you use with -p) or if you plan on sharing it between many projects, in Natural Docs’ Styles directory.

To use a custom file, no matter where you put it, you just use it with -s without the CSS extension.  So if you made Red.css, you use “-s Red”.  If you made a touch-up file instead, you use it after one of the default styles, such as with “-s Default Red”.  If you’re so inclined, you can string as many touch-up files together as you want or use one of your own as a base.

The CSS Guide documents the page structure and CSS styles of Natural Docs’ output.  Always remember to check its revisions section every time you upgrade Natural Docs because it may change between releases.

Common Customizations
Web-Style Paragraphs

Natural Docs defaults to print-style paragraphs like the one you are reading.  Each one is indented and there are no blank lines between them.  To switch to web-style paragraphs, which have blank lines and no indents, add this to your custom CSS file:

p {
+   text-indent: 0;
+   margin-bottom: 1em;
+   }
+
Prototype Colors

If you’ve added a custom topic type and have it finding prototypes for you, you may want to have them appear in a different color than the default black and white.  Add this to your custom CSS file:

.C[type] .Prototype {
+   background-color: [color];
+   border-color: [color];
+   }
+

Replace [type] with the name of your topic type, minus any symbols and spaces.  So if you added a type “Sound Effect”, you would apply the style to “.CSoundEffect .Prototype”.

Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Help/troubleshooting.html b/docs/tool/Help/troubleshooting.html new file mode 100644 index 00000000..f921606a --- /dev/null +++ b/docs/tool/Help/troubleshooting.html @@ -0,0 +1,18 @@ + + +Troubleshooting - Natural Docs + + + +
Natural Docs
Troubleshooting
Natural Docs Issues
I don’t get any documentation
Is it recognizing your source files?

If Natural Docs has never said “Parsing n files...” when you run it, or n was way too low a number, it is not finding your source files.

If it has, try this test.  Run Natural Docs once.  Edit one of your source files and save it.  Run Natural Docs again.  If it doesn’t say “Parsing 1 file...” it is not recognizing your file.

No, it’s not recognizing them

The most likely scenario is that Natural Docs doesn’t associate the file extension you’re using with your programming language.  Open Languages.txt in Natural Docs’ Config directory and find your language.  Underneath it you should see a line that says something like “Extensions: c cpp cxx h hpp hxx”.  Add the file extensions you use and try again.

If you use extensionless or .cgi files, do the same thing but instead look for a line that says something like “Shebang Strings: tclsh wish expect”.  If it is not there, you may need to add it yourself.  Edit it to include whatever appears in your shebang (#!) line that would say this file belongs to your language.

Otherwise just make sure you included the directory or one of its parents with -i on the command line.

Yes, it’s recognizing them

First note that unless you have full language support, Natural Docs will only include what you write for it.  It will not be able to scan your code and pick out all the classes and functions on its own.

If the problem is with text files, the most likely scenario is that you’re not including topic lines.  Like in comments, only things that appear under “keyword: name” lines count as Natural Docs content.

If this is happening in code, remember that comments must appear alone on a line.  You cannot put Natural Docs comments on the same line as code.  This includes having anything appear after a closing block comment symbol.

Some of my topics don’t show up
  • Check the list of keywords to see if the one you’re using is there and you spelled it correctly.  Note that the web page only has the default set of keywords.  You may need to check Topics.txt in Natural Docs’ Config directory and your project directory if you’ve edited them
  • If the topics appear in code, make sure that the comments are alone on a line.  You cannot put Natural Docs content on the same line as code.  This includes having anything appear after a closing block comment symbol.
  • Make sure that if you have more than one topic in a comment, there is a blank line above the topic line.
  • If you have text boxes or lines, make sure they are completely unbroken.  You can also try removing them completely.
  • If the topics appear in a text file, make sure you included topic lines.  Like in comments, only things that appear after “keyword: name” lines count as Natural Docs content.  You could just add a Title: line to the top of the file to fix this.
Some of my topics aren’t formatting correctly
  • Headings must have a blank line above them.
  • Lines directly after bullet or definition lines are part of the previous bullet or definition, even if it’s not indented.  Skip a line first to do something else
  • If you’re getting symbols scattered throughout your text, make sure any text boxes or lines are completely unbroken.  You can also try removing them altogether.
  • If your example source code is getting mangled, remember to use the example code syntax.
  • If a line’s becoming a heading but shouldn’t, either get rid of the colon at the end or break it into two lines so the colon appears on the second line
  • If a line’s becoming a definition but shouldn’t, either get rid of the space-dash-space (use two dashes or remove one of the spaces) or break it into two lines so that the space-dash-space is on the second line.

I realize the last two aren’t great.  If you have any ideas as to how to reliably detect these kinds of false positives, e-mail me.

I’m not getting prototypes
  • The topic must appear directly above the thing it’s documenting.
  • Topics documented in lists will not get prototypes, even if the list break apart in the output.
  • The topic name must be present in the prototype somewhere.  Make sure the topic title has the same case as in the prototype and that it’s not misspelled.  This applies even if your language isn’t case sensitive.
  • If you’re documenting something with a new topic type you added to Topics.txt, you must also edit Languages.txt to tell it how to detect prototypes for that type.
My links aren’t working

If your links appear in the output as “<text>” instead of being converted to links, do the following:

  • Make sure the target appears in the output.  The easiest way is to see if it appears in the Everything index.
  • Make sure the link is spelled correctly and has the same case as what you’re linking to.  This applies even if your language isn’t case sensitive.
  • If the topic your link appears in and the link target are not in the same class (or are not both global) make sure you include the class in the link with class.target, class::target, or class->target.  You can check which classes topics appear in with the Everything index.  If your topics are appearing in the wrong classes, fix the documentation remembering the topic scoping rules.
Windows Issues
I get the message “Bad command or file name” or “perl is not recognized”

What’s happening is that NaturalDocs.bat can’t find Perl.  You need Perl installed to run Natural Docs, so if you haven’t done so already, you can download and install ActiveState’s ActivePerl for free.

If you already have Perl, it’s bin directory is either not in your path or the path isn’t being used by whatever you’re running it from, which happens on some IDEs.  Edit NaturalDocs.bat and on the line that says “perl NaturalDocs %NaturalDocsParams%”, change perl to be the full path to perl.exe, such as “C:\perl\bin\perl.exe”.  You need to include the quotes if there are spaces in the path.

I get the message “Can’t open perl script NaturalDocs”

What’s happening is that Perl can’t find the Natural Docs script file.  This happens when the working directory or “start in” folder isn’t the directory Natural Docs was installed to.  If changing that doesn’t work, or if you don’t have the option to set that, edit NaturalDocs.bat and find the line that says “perl NaturalDocs %NaturalDocsParams%”.  Change NaturalDocs to include the full path Natural Docs was installed to, such as “C:\Program Files\Natural Docs\NaturalDocs”.  You need to include the quotes if there are spaces in the path.

Copyright © 2003-2008 Greg Valure
\ No newline at end of file diff --git a/docs/tool/Info/CSSGuide.txt b/docs/tool/Info/CSSGuide.txt new file mode 100644 index 00000000..2496b0bf --- /dev/null +++ b/docs/tool/Info/CSSGuide.txt @@ -0,0 +1,947 @@ + + Architecture: CSS Structure +_______________________________________________________________________________ + +It's important to understand the internal HTML file structure and styles in order to design your own CSS style for Natural Docs. If +you're content with the default styles, there's no need to read this document. + +Topic: Diagram Conventions + + The diagrams are designed for clarity. In the actual HTML, you'd obviously see "
" + instead of "
". + + - A tag with just a style, for example "CTitle", means an unspecified element with that class. Style with .CTitle. + - A tag that includes a #, for example "#Menu", means an unspecified element with that ID. Style with #Menu. + - A tag that includes a HTML element as well, for example "table CDescriptionList", means it will always be that element. You + can style with either .CDescriptionList or table.CDescriptionList. + - A tag that has multiple classes or has an "and" in it, for example "CType and CTopic", means that both styles will apply to the + same element. You can style it with .CType.CTopic, noting that the space between them must be omitted. + - A tag that has an "or" in it, for example "#Content or #Index", is just shorthand for either of those elements. The diagram + applies to both of them but only one will actually appear at a time in the output. + - A tag or style with a question mark means that tag or style will only be there in certain situations. + + +Topic: Page Structure +_______________________________________________________________________________ + + The body tag is used to distinguish between the types of pages. + + Unframed Content/Index Page: + + (start diagram) + + + [browser styles] + + <#Content or #Index> + Content or Index + + + <#Menu> + Menu + + + <#Footer> + Footer + + + [/browser styles] + + + (end diagram) + + + Unframed Search Results Popup Page: + + (start diagram) + + + [browser styles] + + <#Index> + Index + + + [browser styles] + + + (end diagram) + + + Framed Menu Page: + + (start diagram) + + + [browser styles] + + <#Menu> + Menu + + + <#Footer> + Footer + + + [browser styles] + + + (end diagram) + + + Framed Content/Index/SearchResults Page: + + (start diagram) + + + [browser styles] + + <#Content or #Index> + Content or Index + + + [browser styles] + + + (end diagram) + + +Styles: Page Styles + + ContentPage - An unframed content page. + IndexPage - An unframed index page. + PopupSearchResultsPage - A search results page for use in a popup iframe. + + FramedContentPage - A framed content page. + FramedIndexPage - A framed index page. + FramedSearchResultsPage - A framed search results page. + + #Footer - The page footer. Will be in a framed menu page or on its own in a non-framed page. + + See Also: + + - <#Content> + - <#Menu> + - <#Index> + - <#Footer> + + + + +Styles: Browser Styles +_______________________________________________________________________________ + + + Natural Docs pages include JavaScript to detect which browser the user is running and apply styles so that you can work + around browser quirks right in the CSS file. + + The browser type and version styles will be applied immediately after the body tag. However, neither are guaranteed to be + there; the user may have JavaScript turned off or be using a browser that isn't detected. These styles should only be used to + correct minor flaws and should not be heavily relied on. + + > + > ? + > ? + > + > Page Content + > + > ? + > ? + > + + For example, if a 's style is giving you problems in Internet Explorer 6, override it with .IE6 .CTopic. If a 's + style gives you a problem in Opera 7 but only in frames, override it with .Framed.Opera7 .MTitle. + + Browser Types: + + If the browser is not one of the types below, neither this nor the browser version will be present. There's the possibility that + some obscure browser will appear as one of the others by spoofing, but the most prominent of these, Opera, Konqueror, and + Safari, are taken care of. + + IE - Internet Explorer + Firefox - Firefox and anything else based on the Gecko rendering engine. + Opera - Opera + Safari - Safari + Konqueror - Konqueror and anything else based on the KHTML rendering engine except Safari. + + Browser Versions: + + If the browser is not one of the versions below, this style will not be present. The browser type still may be. + + IE6 - Internet Explorer 6.x. + IE7 - Internet Explorer 7.x. + + Firefox1 - Firefox 1.0.x and anything else based on Gecko 1.7.x. + Firefox15 - Firefox 1.5.x and anything else based on Gecko 1.8.0.x. + Firefox2 - Firefox 2.0.x and anything else based on Gecko 1.8.1.x. + + Opera7 - Opera 7.x. + Opera8 - Opera 8.x. + Opera9 - Opera 9.x. + + Safari2 - Safari 2.x. + Safari3 - Safari 3.x. + + Notes: + + Why not apply them to the body tag itself? The JavaScript is easy enough and everything supports multiple classes, right? + Because IE 6 doesn't support multiple selectors so I wouldn't be able to combine browser and page styles. + .Opera.ContentPage will apply to all ContentPages in IE because it treats it as if only the last class is there. + + + + +Topic: Content Structure +_______________________________________________________________________________ + + + All the topics of a given file is contained in a <#Content>. All other content styles are prefixed with a C. + + Surrounding each piece of content is a and its type; for example, CFunction for a function. Inside that are the + and if necessary, . Inside are analogues to all the top-level tags:

,

, etc. + + In addition to the top-level tags, you also have prototypes, class hierarchies, and summaries which are + described in their own sections. + + (start diagram) + + <#Content> + + + + + + Topic title + + + + + [Class Hierarchy] + + [Prototype] + + + Heading + + +

+ Paragraph +

+ +
+                        Code or text diagram
+                    
+ +
    +
  • + Bullet item +
  • +
+ + ? + Caption + ? + + + + text + + + + + + + +
+ Entry + + Description +
+ + [Summary] + + + + + + + + + (end diagram) + + Take advantange of the CSS inheritance model. For example, you can style all titles via .CTitle, and you can style + specific titles with .CType .CTitle. + + +Styles: Content Styles + + #Content - Parent element containing all topics. + + CTopic - An individual topic. + + CTitle - The title of a topic. + CBody - The body of a topic. May not exist. + CHeading - Surrounds a heading. + CImageCaption - Surrounds an image caption. + CImageLink - Surrounds a link to an image. + + CDescriptionList - A description list, which is the type of list you're reading right now. Is implemented with a table. + CDLEntry - A description list entry, which is the left side. + CDLDescription - A description list description, which is the right side. + + #MainTopic - The ID given to the main topic, which is the first in the file. It is applied to the . + + CType - A placeholder for all type-specific styles. The actual styles will be C followed by the alphanumeric-only topic type name. + So the CType of a "PL/SQL Function" topic will actually be CPLSQLFunction. + + + + +Topic: Menu Structure +_______________________________________________________________________________ + + + Everything is enclosed in a <#Menu>. All other menu styles are prefixed with an M. + + The title is an and will always be at the beginning of the menu if it exists. If a subtitle exists as well, it will appear + as an inside . Subtitles aren't allowed without titles. Most other entries in the menu are contained in + . Here's the diagram: + + (start diagram) + + <#Menu> + + + Menu title + + + Menu sub title + + + + + + + File + + + + + + File + + + + + + Text + + + + + + Link + + + + + + Group + + + (MEntries) + + + + + + <#MSearchPanel and MSearchPanelActive/Inactive> + + + + + + + (if in unframed HTML) + <#MSearchResultsWindow> + + + + + + + + (end) + + The or entry that's currently selected will have the <#MSelected> ID, so you can reference it in CSS via + .MFile#MSelected. + + The search panel is has its own ID, <#MSearchPanel>, but also has one of the classes or + depending on whether any of the controls are selected or the results window is open. + <#MSearchResultsWindow> is separate because it may be floating. + + +Styles: Menu Styles + + #Menu - Parent element containing the entire menu. + + MTitle - The title of the menu. + MSubTitle - The subtitle of the menu. Will appear within . + + MFile - A file entry. + MGroup - A group entry. + MGroupContent - A container for a content. + MText - A plain text entry. + MLink - An external link entry. + MIndex - An index entry. + + #MSelected - The ID of the currently selected or . + + MType - , , , , or . + + #MSearchPanel - Contains all the search controls. + MSearchPanelActive - Applied to <#MSearchPanel> when any of the controls are selected or the results window is open. + MSearchPanelInactive - Applied to <#MSearchPanel> when not in use. + + #MSearchField - The text input field of the search panel. + #MSearchType - The drop down type selector of the search panel. + #MSearchEverything - The <#MSearchType> option for the Everything index. + + #MSearchResultsWindow - Contains all the search results elements. + #MSearchResults - Contains the iframe that will hold the results. + #MSearchRseultsWindowClose - The link to manually close the search results window. + + + + +Topic: Class Hierarchy Structure +_______________________________________________________________________________ + + + Everything is contained in a single . Each entry is surrounded by its type, such as , and the + generic . Depending on the context, entries may be surrounded by one or more . + + (start diagram) + + + + ? + + + + + ? + Entry + + + + + + ? + + + + (end diagram) + + +Styles: Class Hierarchy Styles + + ClassHierarchy - The topmost style containing everything. + + CHEntry - A generic class entry. + + CHParent - The style for a parent class. + CHCurrent - The style for the current class, which is the one the hierarchy is generated for. + CHChild - The style for a child class. + CHChildNote - The style for when a child is added that just shows how many other children were omitted. + + CHIndent - A style used to indent a level. + + CHType - , , , or . + + + + +Topic: Summary Structure +_______________________________________________________________________________ + + + Everything is enclosed in a single . All the other summary styles are prefixed with an S. + + holds the actual word "Summary" and and hold the content. exists because different + browsers apply table padding attributes in different ways. exists as a class to separate the main table from any other + tables that may be necessary. Here's a diagram: + + > + > + > + > Title + > + > + > + > + > ... + >
+ >
+ > + >
+ + On to the table content. + + > + > + > + > Entry + > + > + > + > + > Description + > + > + > + + exist to allow indenting. They're necessary because implementing it as nested tables, while structurally cleaner, + won't allow the desciptions to line up on the right throughout the entire summary. will be applied on almost every + other row to allow for tinting to improve readability. + + Use the power of CSS's inheritance rules to specify styles. For example, to set the style of a group entry, apply it to + .SGroup .SEntry. However, you could also apply a style to both the group's entry and description by applying the + style to .SGroup td. Or, you could apply a style to all the entries by applying it to .SEntry. And so on. + + +Styles: Summary Styles + + Summary - The topmost style containing the entire summary. + + STitle - Contains the summary title, which is the part that actually says "Summary". + + SBorder - Surrounds , since some browsers can't do table padding right. A hack, I know. + STable - The actual summary table. This class separates it from other layout tables that may appear. + + SMarked - A class applied to rows that should have a slightly different color than the rest of the rows to make them easier to + read. + + SEntry - The entry (left) side of the table. + SDescription - The description (right) side of the table. + + SIndent# - Surrounding entries and descriptions that are part of a group and need to be indented. Actual styles will be + SIndent1, SIndent2, etc. + + SType - A placeholder for all topic-specific styles. The actual styles will be S followed by the alphanumeric-only topic type name. + So the SType of a "PL/SQL Function" topic will actually be SPLSQLFunction. + + + + +Topic: Prototype Structure +_______________________________________________________________________________ + + + Everything is enclosed in a . All other styles are prefixed with a P. + + Parameter Type First Style: + + For prototypes such as + > void Function (unsigned int* a, int b = 0) + where the types come first. + + (start diagram) + + + + + + + + + + + + + + + + + + (repeated as necessary) + + + +
+ "void Function (" + + "unsigned" + + "int" + + "*" + + "a", "b" + + "=" + + "0" + + ")" +
+ + (end diagram) + + + Parameter Name First Style: + + For prototypes such as + > function Function (a, b: int; c: int := 0) + where the parameters come first. + + (start diagram) + + + + + + + + + + + + + + (repeated as necessary) + + + +
+ "function Function (" + + "a,", "b:", "c:" + + "int" + + ":=" + + "0" + + ")" +
+ + (end diagram) + + + Note that any section may not exist. For example, there will be no cells generated if none of the parameters + have it. + + +Styles: Prototype Styles + + Prototype - The style encompassing the entire prototype. + + PBeforeParameters - The part of the prototype that comes before the parameters. + PAfterParameters - The part of the prototype that comes after the parameters. + + PType - The parameter type. + PTypePrefix - The prefix of a parameter type. + PParameter - The parameter name. + PParameterPrefix - The prefix of a parameter name. + PDefaultValue - The default value expression for a parameter. + PDefaultValuePrefix - The prefix of the default value expression. + + + + +Topic: Link Structure +_______________________________________________________________________________ + + + All links to symbols have a type style prefixed with L. The only exceptions are summary entries; summary descriptions use + them as well. + + > + > Link + > + + You can use this to make links to different symbols appear in different styles. For example, making .LClass bold will make all + links to classes bold, except when appearing in summary entries. You can combine this with other styles to be even more + specific. For example, you can apply a style to function links appearing in summary descriptions with .SDescription .LFunction. + +Styles: Link Styles + + LType - A placeholder for all topic-specific styles. The actual styles will be L followed by the alphanumeric-only topic type name. + So the LType of a "PL/SQL Function" topic will actually be LPLSQLFunction. + + + +Topic: Index Structure +_______________________________________________________________________________ + + + Everything is enclosed in an <#Index>. Combine with and to distinguish between output formats. All + other index styles are prefixed with an I. + + (start diagram) + + <#Index> + + + Page Title + + + + A - B - C ... + + + + + + Heading (A, B, etc.) + + + + + + + ... + +
+ Prefix, if any + + Entry +
+ + + + (end diagram) + + Every index entry, including headings, are rows in a table. The first column of a non-heading are so that + the non-prefix portions align correctly. The other column are , of which there are multiple formats, described below. + + (start diagram) + + + Symbol + , + + Class + + + + Symbol + + + + Class + + ... + + + + Symbol + + + + Class + + + + File + + ... + + ... + + + (end diagram) + + Each part of the entry is surrounded by its type, which may or may not be a link. If an entry has more than one defining class + or file, they're broken out into . + + It's called instead of because class entries are . are only used when the symbol + has a class. If the symbol _is_ a class, the symbol is global. + + +Styles: Index Styles + + #Index - Parent element for the entire index. + + IPageTitle - The page title. + INavigationBar - The navigation bar. + + IHeading - An index heading, such as the letter for the group. + + IEntry - An entry in the index. + ISymbolPrefix - The stripped prefix of the entry. + ISymbol - The entry symbol. + IParent - The entry parent class. If the entry _is_ a class, this isn't defined because classes are global and don't have parent + classes. This is why it's called IParent instead of IClass; hopefully it's less confusing. + IFile - The file the entry is defined in. + + ISubIndex - The surrounding block if an entry needs to be broken out into a sub-index. + + #IFirstHeading - The ID of the first to appear in the file. + + #IFirstSymbolPrefix - The ID for the first to appear under an . + #ILastSymbolPrefix - The ID for the last to appear under an . + #IOnlySymbolPrefix - The ID if there is only one for an . + + + +Topic: Search Results Structure +_______________________________________________________________________________ + + + The search results use virtually the same structure and styles as the indexes, except that <#SearchResults> replaces + <#Index>, there's a new style, and there are a few additional blocks. + + Visibility: + + Visibility is *very* important to making the search work correctly. JavaScript will handle most of it, but your CSS needs to + abide by these rules. + + - sections are visible by default. + - sections are *not* visible by default. They must use display: none. + - should be display: none when under <#SearchResults>. + + +Styles: Search Results Styles + + #SearchResults - Parent element for the entire page. + SRStatus - Status message. Must be visible by default. + SRResult - A result. All you need to do for this class is set it to display: none. Nothing else should be set on it. + + + + +Topic: Tool Tip Structure +_______________________________________________________________________________ + + + Tool tips may appear anywhere in the page, mainly because it's assumed that they will use position: absolute and + visibility: hidden. + + The entire tool tip is found in a style, with a CType style inside it. CTypes are normally outside their elements, but + that would cause it to be partially visible in this case. We need to be the outermost style so its visibility and + position can be manipulated in JavaScript. + + Inside there's a and/or the description text. The description text has no special surrounding tags. + + > + > + > + > Prototype + > + > + > Summary text + > + > + +Styles: Tool Tip Styles + + CToolTip - Surrounds the entire tool tip. This *must* have position: absolute and visibility: hidden for the tool tip mechanism + to work. + + See also . + + +Styles: Miscellaneous Styles + + blockquote - This HTML element should surround anything that needs to be scrolled if it's too wide, like prototypes and text + diagrams. It's not a style because this makes it much easier to do the JavaScript necessary to get this working + in IE. + + +Group: History + +Topic: Revisions +_______________________________________________________________________________ + + + How the page structure has changed throughout the various releases. + + 1.4: + + - Replaced UnframedPage with and . + - Added <#Menu>, <#Content>, <#Footer>, and <#Index>. They were previously shown in the diagrams as classes but did + not actually appear in the generated output. + - Removed MenuSection, ContentSection, and IndexSection. Use things like ".ContentPage #Menu" instead. + - Removed tables from the unframed . Use CSS to position the elements instead. + - <#MainTopic> is applied to instead of . + - IE4, IE5, Opera5, Opera6, Netscape, and Netscape4 browser styles have been removed. , , + and have been added. Gecko has been replaced by , , , and . + KHTML has been replaced by , , , and . + - Removed redundant CParagraph, CCode, and CBulletList classes. Use with p, pre, and ul instead. + - Added and . + - Added <#MSearchPanel>, <#MSearchResultsWindow>, and all related styles. + - Added , , and . + - Removed SEntrySize. Apply the width to and instead. + - , , and were moved from the td and divs into the tr. + - Removed HB style. Now using wbr tag. + + 1.33: + + - Added . + + 1.32: + + - now surround elements that should scroll if they're too wide for the page. + + 1.3: + + - Removed CPrototype. See the replacement and . + - Removed SInGroup, SInClass, and SInSection in favor of more general . + - , , and are now completely determined by configuration files. + - , , and no longer have separate list types. A CFunctionList is now just a CFunction. + - Indexes are now done with tables. + - ISection was removed. + - are only used for the entry cell, not for each entry in an . + - Added , related IDs, and <#IFirstHeading>. + - Merged and into the same element. Must now be styled with .CType.CTopic (no space) while all + sub-elements will still be .CType .CElement (with space.) + + 1.21: + + - Added and TOPIC_PROPERTY_LIST styles, so they get corresponding , , and + . + + 1.2: + + - Added since 1.2 added class hierarchies. + + 1.16: + + - Changed the first topic from having a CMain type to having a normal type with a <#MainTopic> ID. + + 1.1: + + - Added . + - Renamed HiddenBreak to . + - Added , TOPIC_CONSTANT_LIST, , and TOPIC_TYPE_LIST types, so they get + corresponding , , and . + + 1.0: + + - The tags now appear arround the tags instead of vice versa. + - Added a tag to surround non- elements. + - now appears in tr's instead of td's, where it belonged in the first place. + + 0.95: + + - Added . + - Redid , replacing generic styles like Menu with page type styles like UnframedPage/MenuSection and + FramedMenuPage. + + 0.91: + + - Added and link styles, since 0.91 added URL and e-mail links. + - Added style, which is better than floating on its own. + + 0.9: + + - Added , since 0.9 added indexes. + diff --git a/docs/tool/Info/File Parsing.txt b/docs/tool/Info/File Parsing.txt new file mode 100644 index 00000000..10bd0e91 --- /dev/null +++ b/docs/tool/Info/File Parsing.txt @@ -0,0 +1,83 @@ + + Architecture: File Parsing + +#################################################################################### + + This is the architecture and code path for general file parsing. We pick it up at Parse()> because we're not interested in how the files are gathered and their languages determined for the purposes of this document. We are just interested in the process each individual file goes through when it's decided that it should be parsed. + + + + Stage: Preparation and Differentiation + _______________________________________________________________________________________________________ + + Parse()> can be called from one of two places, ParseForInformation()> and ParseForBuild()>, which correspond to the parsing and building phases of Natural Docs. There is no noteworthy work done in either of them before they call Parse(). + + + Stage: Basic File Processing + _______________________________________________________________________________________________________ + + The nitty-gritty file handling is no longer done in itself due to the introduction of full language support in 1.3, as it required two completely different code paths for full and basic language support. Instead it's handled in NaturalDocs::Languages::Base->ParseFile(), which is really a virtual function that leads to ParseFile()> for basic language support or a version appearing in a package derived from for full language support. + + The mechinations of how these functions work is for another document, but their responsibility is to feed all comments Natural Docs should be interested in back to the parser via OnComment()>. + + + Stage: Comment Processing + _______________________________________________________________________________________________________ + + OnComment()> receives the comment sans comment symbols, since that's language specific. All comment symbols are replaced by spaces in the text instead of removed so any indentation is properly preserved. Also passed is whether it's a JavaDoc styled comment, as that varies by language as well. + + OnComment() runs what it receives through CleanComment()> which normalizes the text by removing comment boxes and horizontal lines, expanding tabs, etc. + + + Stage: Comment Type Determination + _______________________________________________________________________________________________________ + + OnComment() sends the comment to IsMine()> to test if it's definitely Natural Docs content, such as by starting with a recognized header line. If so, it sends it to ParseComment()>. + + If not, OnComment() sends the comment to IsMine()> to test if it's definitely JavaDoc content, such as by having JavaDoc tags. If so, it sends it to ParseComment()>. + + If not, the content is ambiguous. If it's a JavaDoc-styled comment it goes to ParseComment()> to be treated as a headerless Natural Docs comment. It is ignored otherwise, which lets normal comments slip through. Note that it's only ambiguous if neither parser claims it; there's no test to see if they both do. Instead Natural Docs always wins. + + We will not go into the JavaDoc code path for the purposes of this document. It simply converts the JavaDoc comment into as best it can, which will never be perfectly, and adds a to the list for that file. Each of those ParsedTopics will be headerless as indicated by having an undefined Title()>. + + + Stage: Native Comment Parsing + _______________________________________________________________________________________________________ + + At this point, parsing is handed off to ParseComment()>. It searches for header lines within the comment and divides the content into individual topics. It also detects (start code) and (end) sections so that anything that would normally be interpreted as a header line can appear there without breaking the topic. + + The content between the header lines is sent to FormatBody()> which handles all the block level formatting such as paragraphs, bullet lists, and code sections. That function in turn calls RichFormatTextBlock()> on certain snippets of the text to handle all inline formatting, such as bold, underline, and links, both explicit and automatic. + + ParseComment()> then has the body in so it makes a to add to the list. It keeps track of the scoping via topic scoping, regardless of whether we're using full or basic language support. Headerless topics are given normal scope regardless of whether they might be classes or other scoped types. + + + Group: Post Processing + _______________________________________________________________________________________________________ + + After all the comments have been parsed into ParsedTopics and execution has been returned to Parse()>, it's time for some after the fact cleanup. Some things are done like breaking topic lists, determining the menu title, and adding automatic group headings that we won't get into here. There are two processes that are very relevant though. + + + Stage: Repairing Packages + _______________________________________________________________________________________________________ + + If the file we parsed had full language support, the parser would have done more than just generate various OnComment() calls. It would also return a scope record, as represented by objects, and a second set of ParsedTopics it extracted purely from the code, which we'll refer to as autotopics. The scope record shows, purely from the source, what scope each line of code appears in. This is then combined with the topic scoping to update ParsedTopics that come from the comments in the function RepairPackages()>. + + If a comment topic changes the scope, that's honored until the next autotopic or scope change from the code. This allows someone to document a class that doesn't appear in the code purely with topic scoping without throwing off anything else. Any other comment topics have their scope changed to the current scope no matter how it's arrived at. This allows someone to manually document a function without manually documenting the class and still have it appear under that class. The scope record will change the scope to part of that class even if topic scoping did not. Essentially the previous topic scoping is thrown out, which I guess is something that can be improved. + + None of this affects the autotopics, as they are known to have the correct scoping since they are gleaned from the code with a dedicated parser. Wouldn't there be duplication of manually documented code elements, which would appear both in the autotopics and in the comment topics? Yes. That brings us to our next stage, which is... + + + Stage: Merging Auto Topics + _______________________________________________________________________________________________________ + + As mentioned above, ParseFile() also returns a set of ParsedTopics gleaned from the code called autotopics. The function MergeAutoTopics()> merges this list with the comment topics. + + The list is basically merged by line number. Since named topics should appear directly above the thing that they're documenting, topics are tested that way and combined into one if they match. The description and title of the comment topic is merged with the prototype of the autotopic. JavaDoc styled comments are also merged in this function, as they should appear directly above the code element they're documenting. Any headerless topics that don't, either by appearing past the last autotopic or above another comment topic, are discarded. + + + Stage: Conclusion + _______________________________________________________________________________________________________ + + Thus ends all processing by Parse()>. The file is now a single list of with all the body content in . If we were using ParseForBuild()>, that's pretty much it and it's ready to be converted into the output format. If we were using ParseForInformation()> though, the resulting file is scanned for all relevant information to feed into other packages such as . + + Note that no prototype processing was done in this process, only the possible tranferring of prototypes from one ParsedTopic to another when merging autotopics with comment topics. Obtaining prototypes and formatting them is handled by and derived packages. diff --git a/docs/tool/Info/HTMLTestCases.pm b/docs/tool/Info/HTMLTestCases.pm new file mode 100644 index 00000000..343b45a8 --- /dev/null +++ b/docs/tool/Info/HTMLTestCases.pm @@ -0,0 +1,269 @@ +############################################################################### +# +# File: Browser Testing +# +############################################################################### +# +# This file tests Natural Docs' generated output. Particularly useful when testing various browsers. +# +############################################################################### + +# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure +# Natural Docs is licensed under the GPL + +use strict; +use integer; + + +# +# About: Browsers +# +# The specific browser versions tested are below. Everything is tested on Windows Vista unless otherwise noted. +# +# Firefox 2.0.0.10 - 2.0 released October 2006. +# Firefox 1.5.0.8 - 1.5 released Novemer 2005. +# Firefox 1.0.8 - 1.0 released November 2004. Not critical to support. +# +# IE 7.0 - 7.0 released October 2006. +# IE 6.0 - 6.0 released August 2001. Tested on Windows XP SP2 via Virtual PC. +# +# Safari 3.0.4 - 3.0 released June 2007. Tested Windows version. +# Safari 2.0.4 - 2.0 released April 2005. Tested on Mac OS X 10.4 Tiger. +# +# Opera 9.02 - 9.0 released June 2006. +# Opera 8.54 - 8.5 released September 2005. +# Opera 8.02 - 8.0 released April 2005. +# Opera 7.51 - 7.5 released around August 2004 I think. Not critical to support. +# Opera 7.02 - 7.0 released January 2003. Not critical to support. +# +# Konqueror 3.5.5 - Tested on openSUSE 10.2 via VMware Player. +# + + +############################################################################### +# Group: Search + +# +# Topic: Unframed HTML Search +# +# Tests: +# +# - Make sure the search box appears and disappears correctly on hover. +# - Type to bring up results. Type further to narrow them. Narrow until there's no results. +# - Backspace to bring the results back. Backspacing to empty closes the results. +# - Type to bring up results with a different first letter. (Tests iframe content switch.) +# - Type *Z* to bring up empty page when there's nothing with that first letter. (Tests generic no results page.) +# - Type *Name* in Everything search to test expanding and collapsing, especially between two that differ only by case. +# - Change filter to *Functions* to test changing filter while results are open. Change to *Types* to switch to one with +# no results. +# - Test Close button on results. Should deactivate panel as well. +# - Clicking away should deactivate panel if the box is empty, not have an effect if there are results open. +# - Text should always change back to "Search" when deactivating. +# +# Results: +# +# Firefox 2.0 - OK +# Firefox 1.5 - OK +# Firefox 1.0 - OK +# +# IE 7.0 - OK +# IE 6.0 - Functionally OK. Search panel doesn't activate on hover. Works fine when clicked. +# +# Safari 3.0 - OK +# Safari 2.0 - *Broken.* Results panel doesn't show up. Border around deactivated search box. +# +# Opera 9.0 - OK +# Opera 8.5 - OK +# Opera 8.0 - OK +# Opera 7.5 - Functionally OK. Search panel has sunken border when deactivated, minor pixel shifting. +# Opera 7.0 - *Broken.* Completely. +# +# Konqueror 3.5 - *Broken.* Results panel doesn't show up. Seems to fail on "resultsFrame = window.frames.MSearchResults;" +# + +# +# Topic: Framed HTML Search +# +# Tests: +# +# - Make sure the search box appears and disappears correctly on hover. +# - Type to bring up results on right. Type further to narrow them. Narrow until there's no results. +# - Backspace to bring the results back. +# - Type to bring up results with a different first letter. (Tests frame content switch.) +# - Type *Z* to bring up empty page when there's nothing with that first letter. (Tests generic no results page.) +# - Type *Name* in Everything search to see that there's no collapsing in this mode. +# - Change filter to *Functions* to test changing filter while results are open. Change to *Types* to switch to one with +# no results. +# - Clicking away should deactivate panel. +# - Clicking a result should deactivate panel and show up in correct frame. +# - Text should always change back to "Search" when deactivating. +# +# Results: +# +# Firefox 2.0 - OK +# Firefox 1.5 - OK +# Firefox 1.0 - OK +# +# IE 7.0 - OK +# IE 6.0 - Functionally OK. Search panel doesn't activate on hover, is a little wide. Works fine when clicked. +# +# Safari 3.0 - OK +# Safari 2.0 - Functionally OK. Has a sunken border around the deactivated seach field. +# +# Opera 9.0 - OK +# Opera 8.5 - OK +# Opera 8.0 - OK +# Opera 7.5 - Functionally OK. Search panel has sunken border when deactivated, minor pixel shifting. +# Opera 7.0 - *Broken.* +# +# Konqueror 3.5 - Functionally OK. Panel doesn't reset and deactivate when clicking a result link. +# + + +############################################################################### +# Group: Other + +# +# Topic: Images +# +# Tests: +# +# - Here is an embedded image on its own line. +# +# (see images/logo.png) +# +# - Here is a reference in the middle of a sentence, in the middle of a bullet list: (see images/logo.png) It should have been +# converted to a link with the image appearing below the bullet list and the file name used as a caption. Make sure the +# caption positions correctly. +# - Here's a link to a non-existent image, which should appear literally: (see images/doesntexist.jpg) +# - Here is an embedded image that doesn't exist on it's own line. +# +# (see images/doesntexist.png) +# +# - Here is a link using the "(see)" syntax which shouldn't be interpreted as an image link because it doesn't end with an +# acceptable extension. Also, links should still resolve because of that. (see ) +# +# Results: +# +# Firefox 2.0 - OK +# Firefox 1.5 - OK +# Firefox 1.0 - OK +# +# IE 7.0 - OK +# IE 6.0 - OK +# +# Safari 3.0 - OK +# Safari 2.0 - OK +# +# Opera 9.0 - OK +# Opera 8.5 - OK +# Opera 8.0 - OK +# Opera 7.5 - OK +# Opera 7.0 - OK +# +# Konqueror 3.5 - OK + + +# +# Topic: Prototypes and Tooltips +# +# Hover over ParseComment()> and IsMine()> +# +# Tests: +# +# - A tooltip should appear about a second after you hover over the link above. +# - It should go away when you move the cursor away. +# - It shoud be positioned directly underneath with a slight gap. +# - The prototype should be formatted cleanly with each parameter on its own line and aligned in columns. +# - The asterisk should be in a separate column. +# - Test it with the link too close to the edge of the window so the pop-up has to shift left to fit. +# +# Results: +# +# Firefox 2.0 - OK +# Firefox 1.5 - OK +# Firefox 1.0 - OK +# +# IE 7.0 - OK +# IE 6.0 - OK +# +# Safari 3.0 - OK +# Safari 2.0 - OK +# +# Opera 9.0 - OK. Has its own tooltips turned on by default which can cover it up though. +# Opera 8.5 - OK. Has its own tooltips turned on by default which can cover it up though. +# Opera 8.0 - OK. Has its own tooltips turned on by default which can cover it up though. +# Opera 7.5 - OK. Has its own tooltips turned on by default which can cover it up though. +# Opera 7.0 - *Broken.* Usually works, if the window is too narrow may collapse completely. +# +# Konqueror 3.5 - OK +# + + +# +# Topic: Long code block scrolling +# +# Go to . +# +# Tests: +# +# - Shrink the browser window so that a line extends past the end of it. Only the line should have a scrollbar, not the +# entire page. +# - Expand the browser window. The scrollbar should disappear. +# +# Results: +# +# Firefox 2.0 - OK +# Firefox 1.5 - OK +# Firefox 1.0 - OK +# +# IE 7.0 - OK +# IE 6.0 - OK +# +# Safari 3.0 - OK +# Safari 2.0 - OK +# +# Opera 9.0 - OK +# Opera 8.5 - OK +# Opera 8.0 - OK +# Opera 7.5 - OK +# Opera 7.0 - OK +# +# Konqueror 3.5 - OK +# + + +# +# Topic: Menu and Class Hierarchies +# +# Go to . +# +# Tests: +# +# - Class hierarchy should look okay. +# - Make sure the menu hierarchy opens up on its own when the page is loaded. +# - You should be able to click on groups to open and close them. +# +# Results: +# +# Firefox 2.0 - OK +# Firefox 1.5 - OK +# Firefox 1.0 - OK +# +# IE 7.0 - OK +# IE 6.0 - OK +# +# Safari 3.0 - OK +# Safari 2.0 - OK +# +# Opera 9.0 - OK +# Opera 8.5 - OK +# Opera 8.0 - OK +# Opera 7.5 - OK +# Opera 7.0 - OK +# +# Konqueror 3.5 - OK +# + + +1; diff --git a/docs/tool/Info/Languages.txt b/docs/tool/Info/Languages.txt new file mode 100644 index 00000000..c564eb58 --- /dev/null +++ b/docs/tool/Info/Languages.txt @@ -0,0 +1,107 @@ + + Title: Language Notes +_______________________________________________________________________________ + + This is more for my personal reference than anything else. + + + ___________________________________________________________________________ + + Topic: Prototype Parameter Styles + ___________________________________________________________________________ + + Parameters via Commas, Typed via Spaces: + + > FunctionName ( type indentifier, type identifier = value, modifier type identifier ) + > FunctionName ( indentifier, identifier = value ) + + The general idea is that parameters are separated by commas. Identifiers cannot contain spaces. Types and modifiers, + if available, are separated from the identifiers with spaces. There may be an equals sign to set the default value. + + So parsing means splitting by commas, stripping everything past an equals sign for the default value, stripping everything + after the last space for the identifier, and the rest is the type. If there are no internal spaces after the default value is + stripped, it's all identifier. + + Note that internal parenthesis, brackets, braces, and angle brackets should be parsed out. They may be present in default + values or types and any commas and equal signs in them should not be included. + + Applies to C++, Java, C#, JavaScript, Python, PHP, Ruby. + + Applies to Perl as well, even though it doesn't have any real parameter declaration structure. Just adding it with comments + is fine. + + Parameters via Semicolons and Commas, Typed via Colons: + + > FunctionName ( identifier: type; identifier, identifier: type; identifier: type := value ) + + Parameters via semicolons, types via colons. However, there can be more than one parameter per type via commas. + Default values via colon-equals. + + Applies to Pascal, Ada. + + + SQL: + + > FunctionName ( identifier type, identifier modifier type, identifier type := value ) + + Parameters separated by commas. Identifiers come before the types and are separated by a space. Default values are + specified with colon-equals. + + > FunctionName @identifier type, @dentifier modifier type, @identifier type = value + + Microsoft's SQL uses equals instead of colon-equals, doesn't need parenthesis, and starts its parameter names with an @ + symbol. + + + Visual Basic: + + > FunctionName ( modifiers identifier as type, identifier = value ) + + Parameters separated by commas. Default values via equals. However, any number of modifiers may appear before the + identifier. Those modifiers are ByVal, ByRef, Optional, and ParamArray. + + + Tcl: + + > FunctionName { identifier identifier { whatever } } { code } + + Identifiers are specified in the first set of braces and have no commas. However, they can be broken out into sub-braces. + + + ___________________________________________________________________________ + + Topic: Syntax References + ___________________________________________________________________________ + + C++ - http://www.csci.csusb.edu/dick/c++std/syntax.html + + C# - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/CSharpSpecStart.asp. Open in IE. + + Java - http://cui.unige.ch/db-research/Enseignement/analyseinfo/ + Ada - http://cui.unige.ch/db-research/Enseignement/analyseinfo/ + + SQL - http://cui.unige.ch/db-research/Enseignement/analyseinfo/, + , or + (open in IE). + + JavaScript - http://academ.hvcc.edu/~kantopet/javascript/index.php + + Python - http://www.python.org/doc/2.3.4/ref/ref.html + + PHP - http://www.php.net/manual/en/langref.php + + Visual Basic - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbls7/html/vbspecstart.asp. Open in IE. + + Pascal - . Open in IE. + + Ruby - http://www.rubycentral.com/book/ + + ActionScript 2 - + ActionScript 3 - + E2X - http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-357.pdf + + R - Somewhere on http://www.r-project.org. + + ColdFusion - + + Eiffel - http://www.gobosoft.com/eiffel/syntax/ diff --git a/docs/tool/Info/NDMarkup.txt b/docs/tool/Info/NDMarkup.txt new file mode 100644 index 00000000..db1817af --- /dev/null +++ b/docs/tool/Info/NDMarkup.txt @@ -0,0 +1,91 @@ + + Architecture: NDMarkup +_______________________________________________________________________________ + +A markup format used by the parser, both internally and in objects. Text formatted in +NDMarkup will only have the tags documented below. + + +About: Top-Level Tags + + All content will be surrounded by one of the top-level tags. These tags will not appear within each other. + +

- Surrounds a paragraph. Paragraph breaks will replace double line breaks, and single line breaks will + be removed completely. + + - Surrounds code or text diagrams that should appear literally in the output. + + - Surrounds a heading. + +
    - Surrounds a bulleted (unordered) list. +
    - Surrounds a description list, which is what you are reading. + + - An inline image. Target contains the image target, and original contains the + original text in case it doesn't resolve. + + +About: List Item Tags + + These tags will only appear within their respective lists. + +
  • - Surrounds a bulleted list item. + - Surrounds a description list entry, which is the left side. It will always be followed by a description list + description. + - Surrounds a description list symbol. This is the same as a description list entry, except that the content + is also a referenceable symbol. This occurs when inside a list topic. This tag will always + be followed by a description list description. +
    - Surrounds a description list description, which is the right side. It will always be preceded by a description + list entry or symbol. + +About: Text Tags + + These tags will only appear in paragraphs, headings, or description list descriptions. + + - Bold + - Italics + - Underline + + - Surrounds a potential link to a symbol; potential because the target is not guaranteed to + exist. This tag merely designates an attempted link. Target is what is attempting to be + linked to, name is the text that should appear for a successful link, and original is the + original text in case the link doesn't resolve. + + - An external link. There's no need for an original attribute because it will always be + turned into an actual link. + - A link to an e-mail address. + + - An image link. Target contains the image target, and original contains the original + text in case it doesn't resolve. + + +About: Amp Chars + + These are the only amp chars supported, and will appear everywhere. Every other character will appear as is. + + & - The ampersand &. + " - The double quote ". + < - The less than sign <. + > - The greater than sign >. + +About: Tabs + + NDMarkup will not contain tab characters, only spaces. Any tab characters appearing in the source files will be + expanded/replaced as necessary. + + +About: General Tag Properties + + Since the tags are generated, they will always have the following properties, which will make pattern matching much + easier. + + - Tags and amp chars will always be in all lowercase. + - Properties will appear exactly as documented here. They will be in all lowercase, in the documented order, and will have no + extraneous whitespace. Anything appearing in the properties will have amp chars. + - All code is valid, meaning tags will always be closed,
  • s will only appear within
      s, etc. + + So, for example, you can match description list entries with /(.+?)<\/de>/ and $1 will be the text. No surprises or + gotchas. No need for sophisticated parsing routines. + + Remember that for symbol definitions, the text should appear as is, but internally (such as for the anchor) they need to + be passed through Defines()> so that the output file is just as tolerant as + . diff --git a/docs/tool/Info/Symbol Management.txt b/docs/tool/Info/Symbol Management.txt new file mode 100644 index 00000000..fb2bad23 --- /dev/null +++ b/docs/tool/Info/Symbol Management.txt @@ -0,0 +1,59 @@ + + Architecture: Symbol Management + +#################################################################################### + + This is the architecture and code path for symbol management. This is almost exclusively managed by , but it's complicated enough that I want a plain-English walk through of the code paths anyway. + + An important thing to remember is that each section below is simplified initially and then expanded upon in later sections as more facets of the code are introduced. You will not get the whole story of what a function does by reading just one section. + + + + Topic: Symbol Storage + _______________________________________________________________________________________________________ + + Symbols are indexed primarily by their , which is the normalized, pre-parsed series of identifiers that make it up. A symbol can have any number of definitions, including none, but can only have one definition per file. If a symbol is defined more than once in a file, only the first definition is counted. Stored for each definition is the , summary, and prototype. + + Each symbol that has a definition has one designated as the global definition. This is the one linked to by other files, unless that file happens to have its own definition which then takes precedence. Which definition is chosen is rather arbitrary at this point; probably the first one that got defined. Similarly, if the global definition is deleted, which one is chosen to replace it is completely arbitrary. + + Each symbol also stores a list of references to it. Note that references can be interpreted as multiple symbols, and each of those symbols will store a link back to the reference. In other words, every reference a symbol stores is one that _can_ be interpreted as that symbol, but that is not necessarily the interpretation the reference actually uses. A reference could have a better interpretation it uses instead. + + For example, suppose there are two functions, MyFunction() and MyClass.MyFunction(). The reference text "MyFunction()" appearing in MyClass can be interpreted as either MyClass.MyFunction(), or if that doesn't exist, the global MyFunction(). Both the symbols for MyFunction() and MyClass.MyFunction() will store that it's referenced by the link, even though the class scoped one serves as the actual definition. + + This is also the reason a symbol can exist that has no definitions: it has references. We want symbols to be created in the table for each reference interpretation, even if it doesn't exist. These are called potential symbols. The reason is so we know whether a new symbol definition fulfills an existing reference, since it may be a better interpretation for the reference than what is currently used. + + + + Topic: Reference Storage + _______________________________________________________________________________________________________ + + References are indexed primarily by their , which is actually an elaborate data structure packed into a string. It includes a of the text that appears in the link and a bunch of other data that determines the rules by which the link can be resolved. For example, it includes the scope it appears in and any "using" statements in effect, which are alternate possible scopes. It includes the type of link it is (text links, the ones you explicitly put in comments, aren't the only kind) and resolving flags which encode the language-specific rules of non-text links. But the bottom line is the encodes everything that influences how it may be resolved, so if two links come up with the same rules, they're considered two definitions of the same reference. This is the understanding of the word "reference" that will used in this document. + + Like symbols, each reference stores a list of definitions. However, it only stores the name as all the other relevant information is encoded in the itself. Unlike a symbol, which can be linked to the same no matter what kind of definitions it has, references that are in any way different might be interpreted differently and so need their own distinct entries in the symbol table. + + References also store a list of interpretations. Every possible interpretation of the reference is stored and given a numeric score. The higher the score, the better it suits the reference. In the MyFunction() example from before, MyClass.MyFunction() would have a higher score than just MyFunction() because the local scope should win. Each interpretation has a unique score, there are no duplicates. + + So the symbol and reference data structures are complimentary. Each symbol has a list of every reference that might be interpreted as it, and every reference has a list of each symbol that it could be interpreted as. Again, objects are created for potential symbols (those with references but no definitions) so that this structure always remains intact. + + The interpretation with the highest score which actually exists is deemed the current interpretation of the reference. Unlike symbols where the next global definition is arbitrary, the succession of reference interpretations is very controlled and predictable. + + + Topic: Change Detection + _______________________________________________________________________________________________________ + + Change management is handled a couple of ways. First, there is a secondary file index in that stores which symbols and references are stored in each file. It doesn't have any information other than a list of and since they can be used in the main structures to look up the details. If a file is deleted, the symbol table can then prune any definitions that should no longer be in the table. + + Another way deals with how the information parsing stage works. Files parsed for information just have their symbols and references added to the table regardless of whether this was the first time it was ever parsed or if it had been parsed before. If it had been parsed before, all the information from the previous parse should be in the symbol table and file indexes already. If a new symbol or reference is defined, that's fine, it's added to the table normally. However, if a symbol is redefined it's ignored because only the first definition matters. Also, this won't detect things that disappear. + + Enter watched files. tells to designate a file as watched before it starts parsing it, and then says to analyze the changes when it's done. The watched file is a second index of all the symbols and references that were defined since the watch started, including the specific details on the symbol definitions. When the analysis is done, it compares the list of symbols and references to the one in the main file index. Any that appear in the main file index but not the watched one are deleted because they didn't show up the second time around. Any symbol definitions that are different in the watched file than the main file are changed to the former, since the first definition that appeared the second time around was different than the original. + + + Topic: Change Management + _______________________________________________________________________________________________________ + + When a symbol's global definition changes, either because it switches to another file or because the details of the current file's definition changed (prototype, summary, etc.) it goes through all the references that can be interpreted as that symbol, finds the ones that use it as their current definition, and marks all the files that define them for rebuilding. The links in their output files have to be changed to the new definition or at least have their tooltips updated. + + When a symbol's last definition is deleted, it goes through all the references that can be interpreted as that symbol, finds the ones that use it as their current definition, and has them reinterpreted to the definition with the next highest score. The files that define them are also marked for rebuilding. + + When a potential symbol's first definition is found, it goes through all the references that can be interpreted as it and sees if it can serve as a higher scored interpretation than the current one. If so, the interpretations are changed and all the files that define them are marked for rebuilding. + diff --git a/docs/tool/Info/images/Logo.png b/docs/tool/Info/images/Logo.png new file mode 100644 index 00000000..87395ec5 Binary files /dev/null and b/docs/tool/Info/images/Logo.png differ diff --git a/docs/tool/JavaScript/NaturalDocs.js b/docs/tool/JavaScript/NaturalDocs.js new file mode 100644 index 00000000..efcdca96 --- /dev/null +++ b/docs/tool/JavaScript/NaturalDocs.js @@ -0,0 +1,836 @@ +// This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure +// Natural Docs is licensed under the GPL + + +// +// Browser Styles +// ____________________________________________________________________________ + +var agt=navigator.userAgent.toLowerCase(); +var browserType; +var browserVer; + +if (agt.indexOf("opera") != -1) + { + browserType = "Opera"; + + if (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1) + { browserVer = "Opera7"; } + else if (agt.indexOf("opera 8") != -1 || agt.indexOf("opera/8") != -1) + { browserVer = "Opera8"; } + else if (agt.indexOf("opera 9") != -1 || agt.indexOf("opera/9") != -1) + { browserVer = "Opera9"; } + } + +else if (agt.indexOf("applewebkit") != -1) + { + browserType = "Safari"; + + if (agt.indexOf("version/3") != -1) + { browserVer = "Safari3"; } + else if (agt.indexOf("safari/4") != -1) + { browserVer = "Safari2"; } + } + +else if (agt.indexOf("khtml") != -1) + { + browserType = "Konqueror"; + } + +else if (agt.indexOf("msie") != -1) + { + browserType = "IE"; + + if (agt.indexOf("msie 6") != -1) + { browserVer = "IE6"; } + else if (agt.indexOf("msie 7") != -1) + { browserVer = "IE7"; } + } + +else if (agt.indexOf("gecko") != -1) + { + browserType = "Firefox"; + + if (agt.indexOf("rv:1.7") != -1) + { browserVer = "Firefox1"; } + else if (agt.indexOf("rv:1.8)") != -1 || agt.indexOf("rv:1.8.0") != -1) + { browserVer = "Firefox15"; } + else if (agt.indexOf("rv:1.8.1") != -1) + { browserVer = "Firefox2"; } + } + + +// +// Support Functions +// ____________________________________________________________________________ + + +function GetXPosition(item) + { + var position = 0; + + if (item.offsetWidth != null) + { + while (item != document.body && item != null) + { + position += item.offsetLeft; + item = item.offsetParent; + }; + }; + + return position; + }; + + +function GetYPosition(item) + { + var position = 0; + + if (item.offsetWidth != null) + { + while (item != document.body && item != null) + { + position += item.offsetTop; + item = item.offsetParent; + }; + }; + + return position; + }; + + +function MoveToPosition(item, x, y) + { + // Opera 5 chokes on the px extension, so it can use the Microsoft one instead. + + if (item.style.left != null) + { + item.style.left = x + "px"; + item.style.top = y + "px"; + } + else if (item.style.pixelLeft != null) + { + item.style.pixelLeft = x; + item.style.pixelTop = y; + }; + }; + + +// +// Menu +// ____________________________________________________________________________ + + +function ToggleMenu(id) + { + if (!window.document.getElementById) + { return; }; + + var display = window.document.getElementById(id).style.display; + + if (display == "none") + { display = "block"; } + else + { display = "none"; } + + window.document.getElementById(id).style.display = display; + } + +function HideAllBut(ids, max) + { + if (document.getElementById) + { + ids.sort( function(a,b) { return a - b; } ); + var number = 1; + + while (number < max) + { + if (ids.length > 0 && number == ids[0]) + { ids.shift(); } + else + { + document.getElementById("MGroupContent" + number).style.display = "none"; + }; + + number++; + }; + }; + } + + +// +// Tooltips +// ____________________________________________________________________________ + + +var tooltipTimer = 0; + +function ShowTip(event, tooltipID, linkID) + { + if (tooltipTimer) + { clearTimeout(tooltipTimer); }; + + var docX = event.clientX + window.pageXOffset; + var docY = event.clientY + window.pageYOffset; + + var showCommand = "ReallyShowTip('" + tooltipID + "', '" + linkID + "', " + docX + ", " + docY + ")"; + + tooltipTimer = setTimeout(showCommand, 1000); + } + +function ReallyShowTip(tooltipID, linkID, docX, docY) + { + tooltipTimer = 0; + + var tooltip; + var link; + + if (document.getElementById) + { + tooltip = document.getElementById(tooltipID); + link = document.getElementById(linkID); + } +/* else if (document.all) + { + tooltip = eval("document.all['" + tooltipID + "']"); + link = eval("document.all['" + linkID + "']"); + } +*/ + if (tooltip) + { + var left = GetXPosition(link); + var top = GetYPosition(link); + top += link.offsetHeight; + + + // The fallback method is to use the mouse X and Y relative to the document. We use a separate if and test if its a number + // in case some browser snuck through the above if statement but didn't support everything. + + if (!isFinite(top) || top == 0) + { + left = docX; + top = docY; + } + + // Some spacing to get it out from under the cursor. + + top += 10; + + // Make sure the tooltip doesnt get smushed by being too close to the edge, or in some browsers, go off the edge of the + // page. We do it here because Konqueror does get offsetWidth right even if it doesnt get the positioning right. + + if (tooltip.offsetWidth != null) + { + var width = tooltip.offsetWidth; + var docWidth = document.body.clientWidth; + + if (left + width > docWidth) + { left = docWidth - width - 1; } + + // If there's a horizontal scroll bar we could go past zero because it's using the page width, not the window width. + if (left < 0) + { left = 0; }; + } + + MoveToPosition(tooltip, left, top); + tooltip.style.visibility = "visible"; + } + } + +function HideTip(tooltipID) + { + if (tooltipTimer) + { + clearTimeout(tooltipTimer); + tooltipTimer = 0; + } + + var tooltip; + + if (document.getElementById) + { tooltip = document.getElementById(tooltipID); } + else if (document.all) + { tooltip = eval("document.all['" + tooltipID + "']"); } + + if (tooltip) + { tooltip.style.visibility = "hidden"; } + } + + +// +// Blockquote fix for IE +// ____________________________________________________________________________ + + +function NDOnLoad() + { + if (browserVer == "IE6") + { + var scrollboxes = document.getElementsByTagName('blockquote'); + + if (scrollboxes.item(0)) + { + NDDoResize(); + window.onresize=NDOnResize; + }; + }; + }; + + +var resizeTimer = 0; + +function NDOnResize() + { + if (resizeTimer != 0) + { clearTimeout(resizeTimer); }; + + resizeTimer = setTimeout(NDDoResize, 250); + }; + + +function NDDoResize() + { + var scrollboxes = document.getElementsByTagName('blockquote'); + + var i; + var item; + + i = 0; + while (item = scrollboxes.item(i)) + { + item.style.width = 100; + i++; + }; + + i = 0; + while (item = scrollboxes.item(i)) + { + item.style.width = item.parentNode.offsetWidth; + i++; + }; + + clearTimeout(resizeTimer); + resizeTimer = 0; + } + + + +/* ________________________________________________________________________________________________________ + + Class: SearchPanel + ________________________________________________________________________________________________________ + + A class handling everything associated with the search panel. + + Parameters: + + name - The name of the global variable that will be storing this instance. Is needed to be able to set timeouts. + mode - The mode the search is going to work in. Pass CommandLineOption()>, so the + value will be something like "HTML" or "FramedHTML". + + ________________________________________________________________________________________________________ +*/ + + +function SearchPanel(name, mode, resultsPath) + { + if (!name || !mode || !resultsPath) + { alert("Incorrect parameters to SearchPanel."); }; + + + // Group: Variables + // ________________________________________________________________________ + + /* + var: name + The name of the global variable that will be storing this instance of the class. + */ + this.name = name; + + /* + var: mode + The mode the search is going to work in, such as "HTML" or "FramedHTML". + */ + this.mode = mode; + + /* + var: resultsPath + The relative path from the current HTML page to the results page directory. + */ + this.resultsPath = resultsPath; + + /* + var: keyTimeout + The timeout used between a keystroke and when a search is performed. + */ + this.keyTimeout = 0; + + /* + var: keyTimeoutLength + The length of in thousandths of a second. + */ + this.keyTimeoutLength = 500; + + /* + var: lastSearchValue + The last search string executed, or an empty string if none. + */ + this.lastSearchValue = ""; + + /* + var: lastResultsPage + The last results page. The value is only relevant if is set. + */ + this.lastResultsPage = ""; + + /* + var: deactivateTimeout + + The timeout used between when a control is deactivated and when the entire panel is deactivated. Is necessary + because a control may be deactivated in favor of another control in the same panel, in which case it should stay + active. + */ + this.deactivateTimout = 0; + + /* + var: deactivateTimeoutLength + The length of in thousandths of a second. + */ + this.deactivateTimeoutLength = 200; + + + + + // Group: DOM Elements + // ________________________________________________________________________ + + + // Function: DOMSearchField + this.DOMSearchField = function() + { return document.getElementById("MSearchField"); }; + + // Function: DOMSearchType + this.DOMSearchType = function() + { return document.getElementById("MSearchType"); }; + + // Function: DOMPopupSearchResults + this.DOMPopupSearchResults = function() + { return document.getElementById("MSearchResults"); }; + + // Function: DOMPopupSearchResultsWindow + this.DOMPopupSearchResultsWindow = function() + { return document.getElementById("MSearchResultsWindow"); }; + + // Function: DOMSearchPanel + this.DOMSearchPanel = function() + { return document.getElementById("MSearchPanel"); }; + + + + + // Group: Event Handlers + // ________________________________________________________________________ + + + /* + Function: OnSearchFieldFocus + Called when focus is added or removed from the search field. + */ + this.OnSearchFieldFocus = function(isActive) + { + this.Activate(isActive); + }; + + + /* + Function: OnSearchFieldChange + Called when the content of the search field is changed. + */ + this.OnSearchFieldChange = function() + { + if (this.keyTimeout) + { + clearTimeout(this.keyTimeout); + this.keyTimeout = 0; + }; + + var searchValue = this.DOMSearchField().value.replace(/ +/g, ""); + + if (searchValue != this.lastSearchValue) + { + if (searchValue != "") + { + this.keyTimeout = setTimeout(this.name + ".Search()", this.keyTimeoutLength); + } + else + { + if (this.mode == "HTML") + { this.DOMPopupSearchResultsWindow().style.display = "none"; }; + this.lastSearchValue = ""; + }; + }; + }; + + + /* + Function: OnSearchTypeFocus + Called when focus is added or removed from the search type. + */ + this.OnSearchTypeFocus = function(isActive) + { + this.Activate(isActive); + }; + + + /* + Function: OnSearchTypeChange + Called when the search type is changed. + */ + this.OnSearchTypeChange = function() + { + var searchValue = this.DOMSearchField().value.replace(/ +/g, ""); + + if (searchValue != "") + { + this.Search(); + }; + }; + + + + // Group: Action Functions + // ________________________________________________________________________ + + + /* + Function: CloseResultsWindow + Closes the results window. + */ + this.CloseResultsWindow = function() + { + this.DOMPopupSearchResultsWindow().style.display = "none"; + this.Activate(false, true); + }; + + + /* + Function: Search + Performs a search. + */ + this.Search = function() + { + this.keyTimeout = 0; + + var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + var searchTopic = this.DOMSearchType().value; + + var pageExtension = searchValue.substr(0,1); + + if (pageExtension.match(/^[a-z]/i)) + { pageExtension = pageExtension.toUpperCase(); } + else if (pageExtension.match(/^[0-9]/)) + { pageExtension = 'Numbers'; } + else + { pageExtension = "Symbols"; }; + + var resultsPage; + var resultsPageWithSearch; + var hasResultsPage; + + // indexSectionsWithContent is defined in searchdata.js + if (indexSectionsWithContent[searchTopic][pageExtension] == true) + { + resultsPage = this.resultsPath + '/' + searchTopic + pageExtension + '.html'; + resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + hasResultsPage = true; + } + else + { + resultsPage = this.resultsPath + '/NoResults.html'; + resultsPageWithSearch = resultsPage; + hasResultsPage = false; + }; + + var resultsFrame; + if (this.mode == "HTML") + { resultsFrame = window.frames.MSearchResults; } + else if (this.mode == "FramedHTML") + { resultsFrame = window.top.frames['Content']; }; + + + if (resultsPage != this.lastResultsPage || + + // Bug in IE. If everything becomes hidden in a run, none of them will be able to be reshown in the next for some + // reason. It counts the right number of results, and you can even read the display as "block" after setting it, but it + // just doesn't work in IE 6 or IE 7. So if we're on the right page but the previous search had no results, reload the + // page anyway to get around the bug. + (browserType == "IE" && hasResultsPage && + (!resultsFrame.searchResults || resultsFrame.searchResults.lastMatchCount == 0)) ) + + { + resultsFrame.location.href = resultsPageWithSearch; + } + + // So if the results page is right and there's no IE bug, reperform the search on the existing page. We have to check if there + // are results because NoResults.html doesn't have any JavaScript, and it would be useless to do anything on that page even + // if it did. + else if (hasResultsPage) + { + // We need to check if this exists in case the frame is present but didn't finish loading. + if (resultsFrame.searchResults) + { resultsFrame.searchResults.Search(searchValue); } + + // Otherwise just reload instead of waiting. + else + { resultsFrame.location.href = resultsPageWithSearch; }; + }; + + + var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + + if (this.mode == "HTML" && domPopupSearchResultsWindow.style.display != "block") + { + var domSearchType = this.DOMSearchType(); + + var left = GetXPosition(domSearchType); + var top = GetYPosition(domSearchType) + domSearchType.offsetHeight; + + MoveToPosition(domPopupSearchResultsWindow, left, top); + domPopupSearchResultsWindow.style.display = 'block'; + }; + + + this.lastSearchValue = searchValue; + this.lastResultsPage = resultsPage; + }; + + + + // Group: Activation Functions + // Functions that handle whether the entire panel is active or not. + // ________________________________________________________________________ + + + /* + Function: Activate + + Activates or deactivates the search panel, resetting things to their default values if necessary. You can call this on every + control's OnBlur() and it will handle not deactivating the entire panel when focus is just switching between them transparently. + + Parameters: + + isActive - Whether you're activating or deactivating the panel. + ignoreDeactivateDelay - Set if you're positive the action will deactivate the panel and thus want to skip the delay. + */ + this.Activate = function(isActive, ignoreDeactivateDelay) + { + // We want to ignore isActive being false while the results window is open. + if (isActive || (this.mode == "HTML" && this.DOMPopupSearchResultsWindow().style.display == "block")) + { + if (this.inactivateTimeout) + { + clearTimeout(this.inactivateTimeout); + this.inactivateTimeout = 0; + }; + + this.DOMSearchPanel().className = 'MSearchPanelActive'; + + var searchField = this.DOMSearchField(); + + if (searchField.value == 'Search') + { searchField.value = ""; } + } + else if (!ignoreDeactivateDelay) + { + this.inactivateTimeout = setTimeout(this.name + ".InactivateAfterTimeout()", this.inactivateTimeoutLength); + } + else + { + this.InactivateAfterTimeout(); + }; + }; + + + /* + Function: InactivateAfterTimeout + + Called by , which is set by . Inactivation occurs on a timeout because a control may + receive OnBlur() when focus is really transferring to another control in the search panel. In this case we don't want to + actually deactivate the panel because not only would that cause a visible flicker but it could also reset the search value. + So by doing it on a timeout instead, there's a short period where the second control's OnFocus() can cancel the deactivation. + */ + this.InactivateAfterTimeout = function() + { + this.inactivateTimeout = 0; + + this.DOMSearchPanel().className = 'MSearchPanelInactive'; + this.DOMSearchField().value = "Search"; + + this.lastSearchValue = ""; + this.lastResultsPage = ""; + }; + }; + + + + +/* ________________________________________________________________________________________________________ + + Class: SearchResults + _________________________________________________________________________________________________________ + + The class that handles everything on the search results page. + _________________________________________________________________________________________________________ +*/ + + +function SearchResults(name, mode) + { + /* + var: mode + The mode the search is going to work in, such as "HTML" or "FramedHTML". + */ + this.mode = mode; + + /* + var: lastMatchCount + The number of matches from the last run of . + */ + this.lastMatchCount = 0; + + + /* + Function: Toggle + Toggles the visibility of the passed element ID. + */ + this.Toggle = function(id) + { + if (this.mode == "FramedHTML") + { return; }; + + var parentElement = document.getElementById(id); + + var element = parentElement.firstChild; + + while (element && element != parentElement) + { + if (element.nodeName == 'DIV' && element.className == 'ISubIndex') + { + if (element.style.display == 'block') + { element.style.display = "none"; } + else + { element.style.display = 'block'; } + }; + + if (element.nodeName == 'DIV' && element.hasChildNodes()) + { element = element.firstChild; } + else if (element.nextSibling) + { element = element.nextSibling; } + else + { + do + { + element = element.parentNode; + } + while (element && element != parentElement && !element.nextSibling); + + if (element && element != parentElement) + { element = element.nextSibling; }; + }; + }; + }; + + + /* + Function: Search + + Searches for the passed string. If there is no parameter, it takes it from the URL query. + + Always returns true, since other documents may try to call it and that may or may not be possible. + */ + this.Search = function(search) + { + if (!search) + { + search = window.location.search; + search = search.substring(1); // Remove the leading ? + search = unescape(search); + }; + + search = search.replace(/^ +/, ""); + search = search.replace(/ +$/, ""); + search = search.toLowerCase(); + + if (search.match(/[^a-z0-9]/)) // Just a little speedup so it doesn't have to go through the below unnecessarily. + { + search = search.replace(/\_/g, "_und"); + search = search.replace(/\ +/gi, "_spc"); + search = search.replace(/\~/g, "_til"); + search = search.replace(/\!/g, "_exc"); + search = search.replace(/\@/g, "_att"); + search = search.replace(/\#/g, "_num"); + search = search.replace(/\$/g, "_dol"); + search = search.replace(/\%/g, "_pct"); + search = search.replace(/\^/g, "_car"); + search = search.replace(/\&/g, "_amp"); + search = search.replace(/\*/g, "_ast"); + search = search.replace(/\(/g, "_lpa"); + search = search.replace(/\)/g, "_rpa"); + search = search.replace(/\-/g, "_min"); + search = search.replace(/\+/g, "_plu"); + search = search.replace(/\=/g, "_equ"); + search = search.replace(/\{/g, "_lbc"); + search = search.replace(/\}/g, "_rbc"); + search = search.replace(/\[/g, "_lbk"); + search = search.replace(/\]/g, "_rbk"); + search = search.replace(/\:/g, "_col"); + search = search.replace(/\;/g, "_sco"); + search = search.replace(/\"/g, "_quo"); + search = search.replace(/\'/g, "_apo"); + search = search.replace(/\/g, "_ran"); + search = search.replace(/\,/g, "_com"); + search = search.replace(/\./g, "_per"); + search = search.replace(/\?/g, "_que"); + search = search.replace(/\//g, "_sla"); + search = search.replace(/[^a-z0-9\_]i/gi, "_zzz"); + }; + + var resultRows = document.getElementsByTagName("div"); + var matches = 0; + + var i = 0; + while (i < resultRows.length) + { + var row = resultRows.item(i); + + if (row.className == "SRResult") + { + var rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); + + if (search.length <= rowMatchName.length && rowMatchName.substr(0, search.length) == search) + { + row.style.display = "block"; + matches++; + } + else + { row.style.display = "none"; }; + }; + + i++; + }; + + document.getElementById("Searching").style.display="none"; + + if (matches == 0) + { document.getElementById("NoMatches").style.display="block"; } + else + { document.getElementById("NoMatches").style.display="none"; } + + this.lastMatchCount = matches; + + return true; + }; + }; + diff --git a/docs/tool/License-GPL.txt b/docs/tool/License-GPL.txt new file mode 100644 index 00000000..3ab877fa --- /dev/null +++ b/docs/tool/License-GPL.txt @@ -0,0 +1,341 @@ +File: GNU General Public Licence + +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + + +Topic: Preamble + +The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + +Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and +modification follow. + + +Topic: Terms and Conditions for Copying, Distribution, and Modification + +0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +a) You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any +part thereof, to be licensed as a whole at no charge to all third +parties under the terms of this License. + +c) If the modified program normally reads commands interactively +when run, you must cause it, when started running for such +interactive use in the most ordinary way, to print or display an +announcement including an appropriate copyright notice and a +notice that there is no warranty (or else, saying that you provide +a warranty) and that users may redistribute the program under +these conditions, and telling the user how to view a copy of this +License. (Exception: if the Program itself is interactive but +does not normally print such an announcement, your work based on +the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections +1 and 2 above on a medium customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three +years, to give any third party, for a charge no more than your +cost of physically performing source distribution, a complete +machine-readable copy of the corresponding source code, to be +distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +c) Accompany it with the information you received as to the offer +to distribute corresponding source code. (This alternative is +allowed only for noncommercial distribution and only if you +received the program in object code or executable form with such +an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + +5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + +10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +NO WARRANTY: + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + +Topic: How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in the program +`Gnomovision' (which makes passes at compilers) written by James Hacker. + +, 1 April 1989 +Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/docs/tool/Modules/NaturalDocs/BinaryFile.pm b/docs/tool/Modules/NaturalDocs/BinaryFile.pm new file mode 100644 index 00000000..5c1adb8d --- /dev/null +++ b/docs/tool/Modules/NaturalDocs/BinaryFile.pm @@ -0,0 +1,294 @@ +############################################################################### +# +# Package: NaturalDocs::BinaryFile +# +############################################################################### +# +# A package to manage Natural Docs' binary data files. +# +# Usage: +# +# - Only one data file can be managed with this package at a time. You must close the file before opening another +# one. +# +############################################################################### + +# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure +# Natural Docs is licensed under the GPL + +use strict; +use integer; + +package NaturalDocs::BinaryFile; + +use vars qw(@EXPORT @ISA); +require Exporter; +@ISA = qw(Exporter); + +@EXPORT = ('BINARY_FORMAT'); + + +############################################################################### +# Group: Format + +# +# Topic: Standard Header +# +# > [UInt8: BINARY_FORMAT] +# > [VersionInt: app version] +# +# The first byte is , which distinguishes binary configuration files from text ones, since Natural Docs +# used to use text data files with the same name. +# +# The next section is the version of Natural Docs that wrote the file, as defined by AppVersion> +# and written by ToBinaryFile()>. +# + +# +# Topic: Data Types +# +# All the integer data types are written most significant byte first, aka big endian. +# +# An AString16 is a UInt16 followed by that many 8-bit ASCII characters. It doesn't include a null character at the end. Undef +# strings are represented by a zero for the UInt16 and nothing following it. +# + +# +# Constant: BINARY_FORMAT +# +# An 8-bit constant that's used as the first byte of binary data files. This is used so that you can easily distinguish between +# binary and old-style text data files. It's not a character that would appear in plain text files. +# +use constant BINARY_FORMAT => pack('C', 0x06); +# Which is ACK or acknowledge in ASCII. Is the cool spade character in DOS displays. + + +############################################################################### +# Group: Variables + +# +# handle: FH_BINARYDATAFILE +# +# The file handle used for the data file. +# + + +# +# string: currentFile +# +# The for the current configuration file being parsed. +# +my $currentFile; + + + +############################################################################### +# Group: File Functions + + +# +# Function: OpenForReading +# +# Opens a binary file for reading. +# +# Parameters: +# +# minimumVersion - The minimum version of the file format that is acceptible. May be undef. +# +# Returns: +# +# The format or undef if it failed. It could fail for any of the following reasons. +# +# - The file doesn't exist. +# - The file couldn't be opened. +# - The file didn't have the proper header. +# - Either the application or the file was from a development release, and they're not the exact same development release. +# - The file's format was less than the minimum version, if one was defined. +# - The file was from a later application version than the current. +# +sub OpenForReading #(FileName file, optional VersionInt minimumVersion) => VersionInt + { + my ($self, $file, $minimumVersion) = @_; + + if (defined $currentFile) + { die "Tried to open binary file " . $file . " for reading when " . $currentFile . " was already open."; }; + + $currentFile = $file; + + if (open(FH_BINARYDATAFILE, '<' . $currentFile)) + { + # See if it's binary. + binmode(FH_BINARYDATAFILE); + + my $firstChar; + read(FH_BINARYDATAFILE, $firstChar, 1); + + if ($firstChar == ::BINARY_FORMAT()) + { + my $version = NaturalDocs::Version->FromBinaryFile(\*FH_BINARYDATAFILE); + + if (NaturalDocs::Version->CheckFileFormat($version, $minimumVersion)) + { return $version; }; + }; + + close(FH_BINARYDATAFILE); + }; + + $currentFile = undef; + return undef; + }; + + +# +# Function: OpenForWriting +# +# Opens a binary file for writing and writes the standard header. Dies if the file cannot be opened. +# +sub OpenForWriting #(FileName file) + { + my ($self, $file) = @_; + + if (defined $currentFile) + { die "Tried to open binary file " . $file . " for writing when " . $currentFile . " was already open."; }; + + $currentFile = $file; + + open (FH_BINARYDATAFILE, '>' . $currentFile) + or die "Couldn't save " . $file . ".\n"; + + binmode(FH_BINARYDATAFILE); + + print FH_BINARYDATAFILE '' . ::BINARY_FORMAT(); + NaturalDocs::Version->ToBinaryFile(\*FH_BINARYDATAFILE, NaturalDocs::Settings->AppVersion()); + }; + + +# +# Function: Close +# +# Closes the current configuration file. +# +sub Close + { + my $self = shift; + + if (!$currentFile) + { die "Tried to close a binary file when one wasn't open."; }; + + close(FH_BINARYDATAFILE); + $currentFile = undef; + }; + + + +############################################################################### +# Group: Reading Functions + + +# +# Function: GetUInt8 +# Reads and returns a UInt8 from the open file. +# +sub GetUInt8 # => UInt8 + { + my $raw; + read(FH_BINARYDATAFILE, $raw, 1); + + return unpack('C', $raw); + }; + +# +# Function: GetUInt16 +# Reads and returns a UInt16 from the open file. +# +sub GetUInt16 # => UInt16 + { + my $raw; + read(FH_BINARYDATAFILE, $raw, 2); + + return unpack('n', $raw); + }; + +# +# Function: GetUInt32 +# Reads and returns a UInt32 from the open file. +# +sub GetUInt32 # => UInt32 + { + my $raw; + read(FH_BINARYDATAFILE, $raw, 4); + + return unpack('N', $raw); + }; + +# +# Function: GetAString16 +# Reads and returns an AString16 from the open file. Supports undef strings. +# +sub GetAString16 # => string + { + my $rawLength; + read(FH_BINARYDATAFILE, $rawLength, 2); + my $length = unpack('n', $rawLength); + + if (!$length) + { return undef; }; + + my $string; + read(FH_BINARYDATAFILE, $string, $length); + + return $string; + }; + + + +############################################################################### +# Group: Writing Functions + + +# +# Function: WriteUInt8 +# Writes a UInt8 to the open file. +# +sub WriteUInt8 #(UInt8 value) + { + my ($self, $value) = @_; + print FH_BINARYDATAFILE pack('C', $value); + }; + +# +# Function: WriteUInt16 +# Writes a UInt32 to the open file. +# +sub WriteUInt16 #(UInt16 value) + { + my ($self, $value) = @_; + print FH_BINARYDATAFILE pack('n', $value); + }; + +# +# Function: WriteUInt32 +# Writes a UInt32 to the open file. +# +sub WriteUInt32 #(UInt32 value) + { + my ($self, $value) = @_; + print FH_BINARYDATAFILE pack('N', $value); + }; + +# +# Function: WriteAString16 +# Writes an AString16 to the open file. Supports undef strings. +# +sub WriteAString16 #(string value) + { + my ($self, $string) = @_; + + if (length($string)) + { print FH_BINARYDATAFILE pack('nA*', length($string), $string); } + else + { print FH_BINARYDATAFILE pack('n', 0); }; + }; + + +1; diff --git a/docs/tool/Modules/NaturalDocs/Builder.pm b/docs/tool/Modules/NaturalDocs/Builder.pm new file mode 100644 index 00000000..cdcdff72 --- /dev/null +++ b/docs/tool/Modules/NaturalDocs/Builder.pm @@ -0,0 +1,280 @@ +############################################################################### +# +# Package: NaturalDocs::Builder +# +############################################################################### +# +# A package that takes parsed source file and builds the output for it. +# +# Usage and Dependencies: +# +# - can be called immediately. +# - and can be called once all sub-packages have been registered via . +# Since this is normally done in their INIT functions, they should be available to all normal functions immediately. +# +# - Prior to calling , , , , and +# must be initialized. GenerateDirectoryNames()> must be called. +# and must be initialized and fully resolved. +# +############################################################################### + +# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure +# Natural Docs is licensed under the GPL + + +use strict; +use integer; + +use NaturalDocs::Builder::Base; +use NaturalDocs::Builder::HTML; +use NaturalDocs::Builder::FramedHTML; + +package NaturalDocs::Builder; + + +############################################################################### +# Group: Variables + +# +# Array: outputPackages +# +# An array of the output packages available for use. +# +my @outputPackages; + + +############################################################################### +# Group: Functions + + +# +# Function: OutputPackages +# +# Returns an arrayref of the output packages available for use. The arrayref is not a copy of the data, so don't change it. +# +# Add output packages to this list with the function. +# +sub OutputPackages + { return \@outputPackages; }; + + +# +# Function: OutputPackageOf +# +# Returns the output package corresponding to the passed command line option, or undef if none. +# +sub OutputPackageOf #(commandLineOption) + { + my ($self, $commandLineOption) = @_; + + $commandLineOption = lc($commandLineOption); + + foreach my $package (@outputPackages) + { + if (lc($package->CommandLineOption()) eq $commandLineOption) + { return $package; }; + }; + + return undef; + }; + + + +# +# Function: Add +# +# Adds an output package to those available for use. All output packages must call this function in order to be recognized. +# +# Parameters: +# +# package - The package name. +# +sub Add #(package) + { + my ($self, $package) = @_; + + # Output packages shouldn't register themselves more than once, so we don't need to check for it. + push @outputPackages, $package; + }; + + +# +# Function: Run +# +# Runs the build process. This must be called *every time* Natural Docs is run, regardless of whether any source files changed +# or not. Some output packages have dependencies on files outside of the source tree that need to be checked. +# +# Since there are multiple stages to the build process, this function will handle its own status messages. There's no need to print +# "Building files..." or something similar beforehand. +# +sub Run + { + my ($self) = @_; + + + # Determine what we're doing. + + my $buildTargets = NaturalDocs::Settings->BuildTargets(); + + my $filesToBuild = NaturalDocs::Project->FilesToBuild(); + my $numberOfFilesToBuild = (scalar keys %$filesToBuild) * (scalar @$buildTargets); + + my $filesToPurge = NaturalDocs::Project->FilesToPurge(); + my $numberOfFilesToPurge = (scalar keys %$filesToPurge) * (scalar @$buildTargets); + + my $imagesToUpdate = NaturalDocs::Project->ImageFilesToUpdate(); + my $numberOfImagesToUpdate = (scalar keys %$imagesToUpdate) * (scalar @$buildTargets); + + my $imagesToPurge = NaturalDocs::Project->ImageFilesToPurge(); + my $numberOfImagesToPurge = (scalar keys %$imagesToPurge) * (scalar @$buildTargets); + + my %indexesToBuild; + my %indexesToPurge; + + my $currentIndexes = NaturalDocs::Menu->Indexes(); + my $previousIndexes = NaturalDocs::Menu->PreviousIndexes(); + + foreach my $index (keys %$currentIndexes) + { + if (NaturalDocs::SymbolTable->IndexChanged($index) || !exists $previousIndexes->{$index}) + { + $indexesToBuild{$index} = 1; + }; + }; + + # All indexes that still exist should have been deleted. + foreach my $index (keys %$previousIndexes) + { + if (!exists $currentIndexes->{$index}) + { + $indexesToPurge{$index} = 1; + }; + }; + + my $numberOfIndexesToBuild = (scalar keys %indexesToBuild) * (scalar @$buildTargets); + my $numberOfIndexesToPurge = (scalar keys %indexesToPurge) * (scalar @$buildTargets); + + + # Start the build process + + foreach my $buildTarget (@$buildTargets) + { + $buildTarget->Builder()->BeginBuild( $numberOfFilesToBuild || $numberOfFilesToPurge || + $numberOfImagesToUpdate || $numberOfImagesToPurge || + $numberOfIndexesToBuild || $numberOfIndexesToPurge || + NaturalDocs::Menu->HasChanged() ); + }; + + if ($numberOfFilesToPurge) + { + NaturalDocs::StatusMessage->Start('Purging ' . $numberOfFilesToPurge + . ' file' . ($numberOfFilesToPurge > 1 ? 's' : '') . '...', + scalar @$buildTargets); + + foreach my $buildTarget (@$buildTargets) + { + $buildTarget->Builder()->PurgeFiles($filesToPurge); + NaturalDocs::StatusMessage->CompletedItem(); + }; + }; + + if ($numberOfIndexesToPurge) + { + NaturalDocs::StatusMessage->Start('Purging ' . $numberOfIndexesToPurge + . ' index' . ($numberOfIndexesToPurge > 1 ? 'es' : '') . '...', + scalar @$buildTargets); + + foreach my $buildTarget (@$buildTargets) + { + $buildTarget->Builder()->PurgeIndexes(\%indexesToPurge); + NaturalDocs::StatusMessage->CompletedItem(); + }; + }; + + if ($numberOfImagesToPurge) + { + NaturalDocs::StatusMessage->Start('Purging ' . $numberOfImagesToPurge + . ' image' . ($numberOfImagesToPurge > 1 ? 's' : '') . '...', + scalar @$buildTargets); + + foreach my $buildTarget (@$buildTargets) + { + $buildTarget->Builder()->PurgeImages($imagesToPurge); + NaturalDocs::StatusMessage->CompletedItem(); + }; + }; + + if ($numberOfFilesToBuild) + { + NaturalDocs::StatusMessage->Start('Building ' . $numberOfFilesToBuild + . ' file' . ($numberOfFilesToBuild > 1 ? 's' : '') . '...', + $numberOfFilesToBuild); + + foreach my $file (keys %$filesToBuild) + { + my $parsedFile = NaturalDocs::Parser->ParseForBuild($file); + + NaturalDocs::Error->OnStartBuilding($file); + + foreach my $buildTarget (@$buildTargets) + { + $buildTarget->Builder()->BuildFile($file, $parsedFile); + NaturalDocs::StatusMessage->CompletedItem(); + }; + + NaturalDocs::Error->OnEndBuilding($file); + }; + }; + + if ($numberOfIndexesToBuild) + { + NaturalDocs::StatusMessage->Start('Building ' . $numberOfIndexesToBuild + . ' index' . ($numberOfIndexesToBuild > 1 ? 'es' : '') . '...', + $numberOfIndexesToBuild); + + foreach my $index (keys %indexesToBuild) + { + foreach my $buildTarget (@$buildTargets) + { + $buildTarget->Builder()->BuildIndex($index); + NaturalDocs::StatusMessage->CompletedItem(); + }; + }; + }; + + if ($numberOfImagesToUpdate) + { + NaturalDocs::StatusMessage->Start('Updating ' . $numberOfImagesToUpdate + . ' image' . ($numberOfImagesToUpdate > 1 ? 's' : '') . '...', + $numberOfImagesToUpdate); + + foreach my $image (keys %$imagesToUpdate) + { + foreach my $buildTarget (@$buildTargets) + { + $buildTarget->Builder()->UpdateImage($image); + NaturalDocs::StatusMessage->CompletedItem(); + }; + }; + }; + + if (NaturalDocs::Menu->HasChanged()) + { + if (!NaturalDocs::Settings->IsQuiet()) + { print "Updating menu...\n"; }; + + foreach my $buildTarget (@$buildTargets) + { $buildTarget->Builder()->UpdateMenu(); }; + }; + + foreach my $buildTarget (@$buildTargets) + { + $buildTarget->Builder()->EndBuild($numberOfFilesToBuild || $numberOfFilesToPurge || + $numberOfIndexesToBuild || $numberOfIndexesToPurge || + $numberOfImagesToUpdate || $numberOfImagesToPurge || + NaturalDocs::Menu->HasChanged()); + }; + }; + + +1; diff --git a/docs/tool/Modules/NaturalDocs/Builder/Base.pm b/docs/tool/Modules/NaturalDocs/Builder/Base.pm new file mode 100644 index 00000000..0298264d --- /dev/null +++ b/docs/tool/Modules/NaturalDocs/Builder/Base.pm @@ -0,0 +1,348 @@ +############################################################################### +# +# Class: NaturalDocs::Builder::Base +# +############################################################################### +# +# A base class for all Builder output formats. +# +############################################################################### + +# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure +# Natural Docs is licensed under the GPL + +use strict; +use integer; + +package NaturalDocs::Builder::Base; + + +############################################################################### +# Group: Notes + + +# +# Topic: Implementation +# +# Builder packages are implemented as blessed arrayrefs, not hashrefs. This is done for all objects in Natural Docs for +# efficiency reasons. You create members by defining constants via and using them as +# indexes into the array. +# + +# +# Topic: Function Order +# +# The functions in the build process will always be called in the following order. +# +# - will always be called. +# - will be called next only if there's files that need to be purged. +# - will be called next only if there's indexes that need to be purged. +# - will e called next only if there's images that need to be purged. +# - will be called once for each file that needs to be built, if any. +# - will be called once for each index that changed and is part of the menu, if any. +# - will be called once for each image that needs to be updated, if any. +# - will be called next only if the menu changed. +# - will always be called. +# + +# +# Topic: How to Approach +# +# Here's an idea of how to approach making packages for different output types. +# +# +# Multiple Output Files, Embedded Menu: +# +# This example is for when you want to build one output file per source file, each with its own copy of the menu within it. +# This is how works. +# +# Make sure you create a function that generates just the menu for a particular source file. We'll need to generate menus for +# both building a file from scratch and for updating the menu on an existing output file, so it's better to give it its own function. +# You may want to surround it with something that can be easily detected in the output file to make replacing easier. +# +# isn't important. You don't need to implement it. +# +# Implement to delete the output files associated with the purged files. +# +# Implement to delete the output files associated with the purged indexes. +# +# Implement to create an output file for the parsed source file. Use the menu function described earlier. +# +# Implement to create an output file for each index. Use the menu function described earlier for each page. +# +# Implement to go through the list of unbuilt files and update their menus. You can get the list from +# UnbuiltFilesWithContent()>. You need to open their output files, replace the menu, and save it back +# to disk. Yes, it would be simpler from a programmer's point of view to just rebuild the file completely, but that would be +# _very_ inefficient since there could potentially be a _lot_ of files in this group. +# +# Also make sure goes through the unchanged indexes and updates them as well. +# +# isn't important. You don't need to implement it. +# +# +# Multiple Output Files, Menu in File: +# +# This example is for when you want to build one output file per source file, but keep the menu in its own separate file. This +# is how works. +# +# isn't important. You don't need to implement it. +# +# Implement to delete the output files associated with the purged files. +# +# Implement to delete the output files associated with the purged indexes. +# +# Implement to generate an output file from the parsed source file. +# +# Implement to generate an output file for each index. +# +# Implement to rebuild the menu file. +# +# isn't important. You don't need to implement it. +# +# +# Single Output File using Intermediate Files: +# +# This example is for when you want to build one output file, such as a PDF file, but use intermediate files to handle differential +# building. This would be much like how a compiler compiles each source file into a object file, and then a linker stitches them +# all together into the final executable file. +# +# isn't important. You don't need to implement it. +# +# Implement to delete the intermediate files associated with the purged files. +# +# Implement to delete the intermediate files associated with the purged indexes. +# +# Implement to generate an intermediate file from the parsed source file. +# +# Implement to generate an intermediate file for the specified index. +# +# Implement to generate the intermediate file for the menu. +# +# Implement so that if the project changed, it stitches the intermediate files together into the final +# output file. Make sure you check the parameter because the function will be called when nothing changes too. +# +# +# Single Output File using Direct Changes: +# +# This example is for when you want to build one output file, such as a PDF file, but engineering it in such a way that you don't +# need to use intermediate files. In other words, you're able to add, delete, and modify entries directly in the output file. +# +# Implement so that if the project changed, it opens the output file and does anything it needs to do +# to get ready for editing. +# +# Implement to remove the entries associated with the purged files. +# +# Implement to remove the entries associated with the purged indexes. +# +# Implement to add or replace a section of the output file with a new one generated from the parsed file. +# +# Implement to add or replace an index in the output file with a new one generated from the specified index. +# +# Implement so that if the project changed, it saves the output file to disk. +# +# How you handle the menu depends on how the output file references other sections of itself. If it can do so by name, then +# you can implement to update the menu section of the file and you're done. If it has to reference itself +# by address or offset, it gets trickier. You should skip and instead rebuild the menu in if +# the parameter is true. This lets you do it whenever anything changes in a file, rather than just when the menu +# visibly changes. How you keep track of the locations and how they change is your problem. +# + + +############################################################################### +# +# Group: Required Interface Functions +# +# All Builder classes *must* define these functions. +# + + +# +# Function: INIT +# +# Define this function to call Add()> so that knows about this package. +# Packages are defined this way so that new ones can be added without messing around in other code. +# + + +# +# Function: CommandLineOption +# +# Define this function to return the text that should be put in the command line after -o to use this package. It cannot have +# spaces and is not case sensitive. +# +# For example, returns 'html' so someone could use -o html [directory] to use that package. +# +sub CommandLineOption + { + NaturalDocs::Error->SoftDeath($_[0] . " didn't define CommandLineOption()."); + }; + + +# +# Function: BuildFile +# +# Define this function to convert a parsed file to this package's output format. This function will be called once for every source +# file that needs to be rebuilt. However, if a file hasn't changed since the last time Natural Docs was run, it will not be sent to +# this function. All packages must support differential build. +# +# Parameters: +# +# sourceFile - The name of the source file. +# parsedFile - The parsed source file, as an arrayref of objects. +# +sub BuildFile #(sourceFile, parsedFile) + { + NaturalDocs::Error->SoftDeath($_[0] . " didn't define BuildFile()."); + }; + + +############################################################################### +# +# Group: Optional Interface Functions +# +# These functions can be implemented but packages are not required to do so. +# + + +# +# Function: New +# +# Creates and returns a new object. +# +# Note that this is the only function where the first parameter will be the package name, not the object itself. +# +sub New + { + my $package = shift; + + my $object = [ ]; + bless $object, $package; + + return $object; + }; + + +# +# Function: BeginBuild +# +# Define this function if the package needs to do anything at the beginning of the build process. This function will be called +# every time Natural Docs is run, even if the project hasn't changed. This allows you to manage dependencies specific +# to the output format that may change independently from the source tree and menu. For example, +# needs to keep the CSS files in sync regardless of whether the source tree changed or not. +# +# Parameters: +# +# hasChanged - Whether the project has changed, such as source files or the menu file. If false, nothing else is going to be +# called except . +# +sub BeginBuild #(hasChanged) + { + }; + + +# +# Function: EndBuild +# +# Define this function if the package needs to do anything at the end of the build process. This function will be called every time +# Natural Docs is run, even if the project hasn't changed. This allows you to manage dependencies specific to the output +# format that may change independently from the source tree. For example, needs to keep the +# CSS files in sync regardless of whether the source tree changed or not. +# +# Parameters: +# +# hasChanged - Whether the project has changed, such as source files or the menu file. If false, the only other function that +# was called was . +# +sub EndBuild #(hasChanged) + { + }; + + +# +# Function: BuildIndex +# +# Define this function to create an index for the passed topic. You can get the index from +# Index()>. +# +# The reason it's not passed directly to this function is because indexes may be time-consuming to create. As such, they're +# generated on demand because some output packages may choose not to implement them. +# +# Parameters: +# +# topic - The to limit the index by. +# +sub BuildIndex #(topic) + { + }; + + +# +# Function: UpdateImage +# +# Define this function to add or update the passed image in the output. +# +# Parameters: +# +# file - The image +# +sub UpdateImage #(file) + { + }; + + +# +# Function: PurgeFiles +# +# Define this function to make the package remove all output related to the passed files. These files no longer have Natural Docs +# content. +# +# Parameters: +# +# files - An existence hashref of the files to purge. +# +sub PurgeFiles #(files) + { + }; + + +# +# Function: PurgeIndexes +# +# Define this function to make the package remove all output related to the passed indexes. These indexes are no longer part +# of the menu. +# +# Parameters: +# +# indexes - An existence hashref of the of the indexes to purge. +# +sub PurgeIndexes #(indexes) + { + }; + + +# +# Function: PurgeImages +# +# Define this function to make the package remove all output related to the passed image files. These files are no longer used +# by the documentation. +# +# Parameters: +# +# files - An existence hashref of the image to purge. +# +sub PurgeImages #(files) + { + }; + + +# +# Function: UpdateMenu +# +# Define this function to make the package update the menu. It will only be called if the menu changed. +# +sub UpdateMenu + { + }; + + +1; diff --git a/docs/tool/Modules/NaturalDocs/Builder/FramedHTML.pm b/docs/tool/Modules/NaturalDocs/Builder/FramedHTML.pm new file mode 100644 index 00000000..ab020aa6 --- /dev/null +++ b/docs/tool/Modules/NaturalDocs/Builder/FramedHTML.pm @@ -0,0 +1,345 @@ +############################################################################### +# +# Package: NaturalDocs::Builder::FramedHTML +# +############################################################################### +# +# A package that generates output in HTML with frames. +# +# All functions are called with Package->Function() notation. +# +############################################################################### + +# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure +# Natural Docs is licensed under the GPL + + +use strict; +use integer; + +package NaturalDocs::Builder::FramedHTML; + +use base 'NaturalDocs::Builder::HTMLBase'; + + +############################################################################### +# Group: Implemented Interface Functions + + +# +# Function: INIT +# +# Registers the package with . +# +sub INIT + { + NaturalDocs::Builder->Add(__PACKAGE__); + }; + + +# +# Function: CommandLineOption +# +# Returns the option to follow -o to use this package. In this case, "html". +# +sub CommandLineOption + { + return 'FramedHTML'; + }; + + +# +# Function: BuildFile +# +# Builds the output file from the parsed source file. +# +# Parameters: +# +# sourcefile - The of the source file. +# parsedFile - An arrayref of the source file as objects. +# +sub BuildFile #(sourceFile, parsedFile) + { + my ($self, $sourceFile, $parsedFile) = @_; + + my $outputFile = $self->OutputFileOf($sourceFile); + + + # 99.99% of the time the output directory will already exist, so this will actually be more efficient. It only won't exist + # if a new file was added in a new subdirectory and this is the first time that file was ever parsed. + if (!open(OUTPUTFILEHANDLE, '>' . $outputFile)) + { + NaturalDocs::File->CreatePath( NaturalDocs::File->NoFileName($outputFile) ); + + open(OUTPUTFILEHANDLE, '>' . $outputFile) + or die "Couldn't create output file " . $outputFile . "\n"; + }; + + print OUTPUTFILEHANDLE + + + + # IE 6 doesn't like any doctype here at all. Add one (strict or transitional doesn't matter) and it makes the page slightly too + # wide for the frame. Mozilla and Opera handle it like champs either way because they Don't Suck(tm). + + # '' . "\n\n" + + '' + + . (NaturalDocs::Settings->CharSet() ? + '' : '') + + . '' + . $self->BuildTitle($sourceFile) + . '' + + . '' + + . '' + + . '' + . $self->OpeningBrowserStyles() + + . $self->StandardComments() + + . "\n\n\n" + . $self->BuildContent($sourceFile, $parsedFile) + . "\n\n\n" + + . $self->BuildToolTips() + + . $self->ClosingBrowserStyles() + . ''; + + + close(OUTPUTFILEHANDLE); + }; + + +# +# Function: BuildIndex +# +# Builds an index for the passed type. +# +# Parameters: +# +# type - The to limit the index to, or undef if none. +# +sub BuildIndex #(type) + { + my ($self, $type) = @_; + + my $indexTitle = $self->IndexTitleOf($type); + my $indexFile = $self->IndexFileOf($type); + + my $startIndexPage = + + '' . "\n\n" + + . '' + + . (NaturalDocs::Settings->CharSet() ? + '' : '') + + . ''; + + if (defined NaturalDocs::Menu->Title()) + { $startIndexPage .= $self->StringToHTML(NaturalDocs::Menu->Title()) . ' - '; }; + + $startIndexPage .= + $indexTitle + . '' + + . '' + + . '' + + . '' + . $self->OpeningBrowserStyles() + + . "\n\n\n" + . $self->StandardComments() + . "\n\n\n" + . '
      ' + . '
      ' + . $indexTitle + . '
      '; + + + my $endIndexPage = + + '
      ' + . "\n\n\n" + + . $self->ClosingBrowserStyles() + + . ''; + + my $startSearchResultsPage = + + '' . "\n\n" + + . '' + + . (NaturalDocs::Settings->CharSet() ? + '' : '') + + . '' + + . '' + . '' + + . '' + . $self->OpeningBrowserStyles() + + . "\n\n\n" + . $self->StandardComments() + . "\n\n\n" + + . '
      ' + . '
      ' + . 'Search Results' + . '
      '; + + my $endSearchResultsPage = + + '
      ' + . "\n\n\n" + + . $self->ClosingBrowserStyles() + + . ''; + + my $indexContent = NaturalDocs::SymbolTable->Index($type); + my $pageCount = $self->BuildIndexPages($type, $indexContent, $startIndexPage, $endIndexPage, + $startSearchResultsPage, $endSearchResultsPage); + $self->PurgeIndexFiles($type, $indexContent, $pageCount + 1); + }; + + +# +# Function: UpdateMenu +# +# Builds the menu file. Also generates index.html. +# +sub UpdateMenu + { + my $self = shift; + + my $outputDirectory = NaturalDocs::Settings->OutputDirectoryOf($self); + my $outputFile = NaturalDocs::File->JoinPaths($outputDirectory, 'menu.html'); + + + open(OUTPUTFILEHANDLE, '>' . $outputFile) + or die "Couldn't create output file " . $outputFile . "\n"; + + my $title = 'Menu'; + if (defined $title) + { $title .= ' - ' . NaturalDocs::Menu->Title(); }; + + $title = $self->StringToHTML($title); + + + print OUTPUTFILEHANDLE + + + '' . "\n\n" + + . '' + + . (NaturalDocs::Settings->CharSet() ? + '' : '') + + . '' + . $title + . '' + + . '' + + . '' + + . '' + . '' + + . '' + . $self->OpeningBrowserStyles() + + . $self->StandardComments() + + . "\n\n\n" + . $self->BuildMenu(undef, undef) + . "\n\n\n" + . $self->BuildFooter(1) + . "\n\n\n" + + . $self->ClosingBrowserStyles() + . ''; + + + close(OUTPUTFILEHANDLE); + + + # Update index.html + + my $firstMenuEntry = $self->FindFirstFile(); + my $indexFile = NaturalDocs::File->JoinPaths( NaturalDocs::Settings->OutputDirectoryOf($self), 'index.html' ); + + # We have to check because it's possible that there may be no files with Natural Docs content and thus no files on the menu. + if (defined $firstMenuEntry) + { + open(INDEXFILEHANDLE, '>' . $indexFile) + or die "Couldn't create output file " . $indexFile . ".\n"; + + print INDEXFILEHANDLE + + '' + + . '' + + . '' + + . (NaturalDocs::Settings->CharSet() ? + '' : '') + + . '' + . $self->StringToHTML(NaturalDocs::Menu->Title()) + . '' + + . '' + + . $self->StandardComments() + + . '' + . '' + . '' + . '' + + . '' + . 'This documentation was designed for use with frames. However, you can still use it by ' + . '<a href="menu.html">starting from the menu page</a>.' + . "<script language=JavaScript><!--\n" + . 'location.href="menu.html";' + . "\n// --></script>" + . '' + + . ''; + + close INDEXFILEHANDLE; + } + + elsif (-e $indexFile) + { + unlink($indexFile); + }; + }; + + +1; diff --git a/docs/tool/Modules/NaturalDocs/Builder/HTML.pm b/docs/tool/Modules/NaturalDocs/Builder/HTML.pm new file mode 100644 index 00000000..95f31b5a --- /dev/null +++ b/docs/tool/Modules/NaturalDocs/Builder/HTML.pm @@ -0,0 +1,398 @@ +############################################################################### +# +# Package: NaturalDocs::Builder::HTML +# +############################################################################### +# +# A package that generates output in HTML. +# +# All functions are called with Package->Function() notation. +# +############################################################################### + +# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure +# Natural Docs is licensed under the GPL + + +use strict; +use integer; + +package NaturalDocs::Builder::HTML; + +use base 'NaturalDocs::Builder::HTMLBase'; + + +############################################################################### +# Group: Implemented Interface Functions + + +# +# Function: INIT +# +# Registers the package with . +# +sub INIT + { + NaturalDocs::Builder->Add(__PACKAGE__); + }; + + +# +# Function: CommandLineOption +# +# Returns the option to follow -o to use this package. In this case, "html". +# +sub CommandLineOption + { + return 'HTML'; + }; + + +# +# Function: BuildFile +# +# Builds the output file from the parsed source file. +# +# Parameters: +# +# sourcefile - The of the source file. +# parsedFile - An arrayref of the source file as objects. +# +sub BuildFile #(sourceFile, parsedFile) + { + my ($self, $sourceFile, $parsedFile) = @_; + + my $outputFile = $self->OutputFileOf($sourceFile); + + + # 99.99% of the time the output directory will already exist, so this will actually be more efficient. It only won't exist + # if a new file was added in a new subdirectory and this is the first time that file was ever parsed. + if (!open(OUTPUTFILEHANDLE, '>' . $outputFile)) + { + NaturalDocs::File->CreatePath( NaturalDocs::File->NoFileName($outputFile) ); + + open(OUTPUTFILEHANDLE, '>' . $outputFile) + or die "Couldn't create output file " . $outputFile . "\n"; + }; + + print OUTPUTFILEHANDLE + + + '' . "\n\n" + + . '' + + . (NaturalDocs::Settings->CharSet() ? + '' : '') + + . '' + . $self->BuildTitle($sourceFile) + . '' + + . '' + + . '' + . '' + + . '' + . $self->OpeningBrowserStyles() + + . $self->StandardComments() + + . "\n\n\n" + . $self->BuildContent($sourceFile, $parsedFile) + . "\n\n\n" + . $self->BuildFooter() + . "\n\n\n" + . $self->BuildMenu($sourceFile, undef) + . "\n\n\n" + . $self->BuildToolTips() + . "\n\n\n" + . '
      ' + . '' + . 'Close' + . '
      ' + . "\n\n\n" + + . $self->ClosingBrowserStyles() + . ''; + + + close(OUTPUTFILEHANDLE); + }; + + +# +# Function: BuildIndex +# +# Builds an index for the passed type. +# +# Parameters: +# +# type - The to limit the index to, or undef if none. +# +sub BuildIndex #(type) + { + my ($self, $type) = @_; + + my $indexTitle = $self->IndexTitleOf($type); + + my $startIndexPage = + + '' . "\n\n" + + . '' + + . (NaturalDocs::Settings->CharSet() ? + '' : '') + + . '' + . $indexTitle; + + if (defined NaturalDocs::Menu->Title()) + { $startIndexPage .= ' - ' . $self->StringToHTML(NaturalDocs::Menu->Title()); }; + + $startIndexPage .= + '' + + . '' + + . '' + . '' + + . '' + . $self->OpeningBrowserStyles() + + . $self->StandardComments() + + . "\n\n\n" + + . '
      ' + . '
      ' + . $indexTitle + . '
      '; + + my $endIndexPage = + '
      ' + + . "\n\n\n" + . $self->BuildFooter() + . "\n\n\n" + . $self->BuildMenu(undef, $type) + . "\n\n\n" + . '
      ' + . '' + . 'Close' + . '
      ' + . "\n\n\n" + + . $self->ClosingBrowserStyles() + . ''; + + + my $startSearchResultsPage = + + '' . "\n\n" + + . '' + + . (NaturalDocs::Settings->CharSet() ? + '' : '') + + . '' + + . '' + + . '' + . $self->OpeningBrowserStyles() + + . $self->StandardComments() + + . "\n\n\n" + + . '
      '; + + + my $endSearchResultsPage = + '
      ' + . $self->ClosingBrowserStyles() + . ''; + + my $indexContent = NaturalDocs::SymbolTable->Index($type); + my $pageCount = $self->BuildIndexPages($type, $indexContent, $startIndexPage, $endIndexPage, + $startSearchResultsPage, $endSearchResultsPage); + $self->PurgeIndexFiles($type, $indexContent, $pageCount + 1); + }; + + +# +# Function: UpdateMenu +# +# Updates the menu in all the output files that weren't rebuilt. Also generates index.html. +# +sub UpdateMenu + { + my $self = shift; + + + # Update the menu on unbuilt files. + + my $filesToUpdate = NaturalDocs::Project->UnbuiltFilesWithContent(); + + foreach my $sourceFile (keys %$filesToUpdate) + { + $self->UpdateFile($sourceFile); + }; + + + # Update the menu on unchanged index files. + + my $indexes = NaturalDocs::Menu->Indexes(); + + foreach my $index (keys %$indexes) + { + if (!NaturalDocs::SymbolTable->IndexChanged($index)) + { + $self->UpdateIndex($index); + }; + }; + + + # Update index.html + + my $firstMenuEntry = $self->FindFirstFile(); + my $indexFile = NaturalDocs::File->JoinPaths( NaturalDocs::Settings->OutputDirectoryOf($self), 'index.html' ); + + # We have to check because it's possible that there may be no files with Natural Docs content and thus no files on the menu. + if (defined $firstMenuEntry) + { + open(INDEXFILEHANDLE, '>' . $indexFile) + or die "Couldn't create output file " . $indexFile . ".\n"; + + print INDEXFILEHANDLE + '' + . '' + . ''; + + close INDEXFILEHANDLE; + } + + elsif (-e $indexFile) + { + unlink($indexFile); + }; + }; + + + +############################################################################### +# Group: Support Functions + + +# +# Function: UpdateFile +# +# Updates an output file. Replaces the menu, HTML title, and footer. It opens the output file, makes the changes, and saves it +# back to disk, which is much quicker than rebuilding the file from scratch if these were the only things that changed. +# +# Parameters: +# +# sourceFile - The source . +# +# Dependencies: +# +# - Requires to surround its content with the exact strings "". +# - Requires to surround its content with the exact strings "". +# +sub UpdateFile #(sourceFile) + { + my ($self, $sourceFile) = @_; + + my $outputFile = $self->OutputFileOf($sourceFile); + + if (open(OUTPUTFILEHANDLE, '<' . $outputFile)) + { + my $content; + + read(OUTPUTFILEHANDLE, $content, -s OUTPUTFILEHANDLE); + close(OUTPUTFILEHANDLE); + + + $content =~ s{[^<]*<\/title>}{'<title>' . $self->BuildTitle($sourceFile) . ''}e; + + $content =~ s/