bixbite 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README.markdown +49 -0
- data/VERSION +1 -0
- data/bin/bixbite +73 -0
- data/lib/bixbite.rb +13 -0
- data/lib/bixbite/command.rb +14 -0
- data/lib/bixbite/create.rb +76 -0
- data/template/Rakefile +25 -0
- data/template/assets/bixbite/Rakefile.rb +297 -0
- data/template/assets/naturaldocs/NaturalDocs/Config/Languages.txt +286 -0
- data/template/assets/naturaldocs/NaturalDocs/Config/Topics.txt +382 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/customizinglanguages.html +52 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/customizingtopics.html +74 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting.html +58 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting/reference.html +146 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting/walkthrough.html +180 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/example/Default.css +528 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/example/NaturalDocs.js +204 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/examples.css +90 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/background.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/leftside.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/logo.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbody.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbodybg.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overleftmargin.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenu.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenubg.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/rightside.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/logo.gif +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/about.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/background.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomleft.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomright.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/community.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/customizing.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/using.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/index.html +9 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/javascript/BrowserStyles.js +77 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/javascript/PNGHandling.js +72 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/keywords.html +38 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/languages.html +32 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/menu.html +79 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/output.html +84 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/running.html +40 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/styles.css +290 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/styles.html +52 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/troubleshooting.html +18 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/CSSGuide.txt +947 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/File Parsing.txt +83 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/HTMLTestCases.pm +269 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/Languages.txt +107 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/NDMarkup.txt +91 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/Symbol Management.txt +59 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/images/Logo.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/JavaScript/NaturalDocs.js +836 -0
- data/template/assets/naturaldocs/NaturalDocs/License-GPL.txt +341 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/BinaryFile.pm +294 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder.pm +280 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/Base.pm +348 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/FramedHTML.pm +345 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTML.pm +398 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTMLBase.pm +3693 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy.pm +860 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/Class.pm +412 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/File.pm +157 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ConfigFile.pm +497 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Constants.pm +165 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/DefineMembers.pm +100 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Error.pm +305 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/File.pm +540 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable.pm +383 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/Reference.pm +44 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/String.pm +110 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages.pm +1475 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/ActionScript.pm +1473 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Ada.pm +38 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced.pm +828 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/Scope.pm +95 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm +70 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Base.pm +832 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/CSharp.pm +1484 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/PLSQL.pm +319 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Pascal.pm +143 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Perl.pm +1370 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype.pm +92 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype/Parameter.pm +87 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Simple.pm +503 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Tcl.pm +219 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu.pm +3406 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu/Entry.pm +201 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/NDMarkup.pm +76 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser.pm +1331 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/JavaDoc.pm +464 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/Native.pm +1060 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/ParsedTopic.pm +253 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project.pm +1402 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/ImageFile.pm +160 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/SourceFile.pm +113 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ReferenceString.pm +334 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings.pm +1418 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings/BuildTarget.pm +66 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB.pm +678 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Extension.pm +84 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/File.pm +129 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Item.pm +201 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/ItemDefinition.pm +45 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/WatchedFileDefinitions.pm +159 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/StatusMessage.pm +102 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolString.pm +212 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable.pm +1984 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/File.pm +186 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/IndexElement.pm +522 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Reference.pm +273 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/ReferenceTarget.pm +97 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Symbol.pm +428 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/SymbolDefinition.pm +96 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics.pm +1319 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics/Type.pm +151 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Version.pm +384 -0
- data/template/assets/naturaldocs/NaturalDocs/NaturalDocs +400 -0
- data/template/assets/naturaldocs/NaturalDocs/NaturalDocs.bat +17 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Default.css +767 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Roman.css +765 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Small.css +763 -0
- data/template/assets/utilities/pngout +0 -0
- data/template/deploy/public_html/.htaccess +0 -0
- data/template/documentation/js/.htaccess +0 -0
- data/template/src/html/.htaccess +76 -0
- data/template/src/html/css/cmn/global.css +96 -0
- data/template/src/html/css/cmn/ie.css +15 -0
- data/template/src/html/css/cmn/ie6.css +15 -0
- data/template/src/html/images/cmn/.htaccess +0 -0
- data/template/src/html/images/tmp/.htaccess +0 -0
- data/template/src/html/includes/debug.inc +5 -0
- data/template/src/html/includes/footer.inc +52 -0
- data/template/src/html/includes/header.inc +61 -0
- data/template/src/html/includes/html.inc +3 -0
- data/template/src/html/includes/namespace.inc +19 -0
- data/template/src/html/includes/page.inc +151 -0
- data/template/src/html/index.html +35 -0
- data/template/src/html/js/cmn/bootstrap.js +74 -0
- data/template/src/html/js/cmn/global.js +142 -0
- data/template/src/html/js/cmn/lib/LAB.js +348 -0
- data/template/src/html/min/.htaccess +4 -0
- data/template/src/html/min/MinifyCLI.php +19 -0
- data/template/src/html/min/README.txt +132 -0
- data/template/src/html/min/builder/_index.js +242 -0
- data/template/src/html/min/builder/bm.js +36 -0
- data/template/src/html/min/builder/index.php +182 -0
- data/template/src/html/min/builder/ocCheck.php +36 -0
- data/template/src/html/min/builder/rewriteTest.js +1 -0
- data/template/src/html/min/config.php +187 -0
- data/template/src/html/min/groupsConfig.php +34 -0
- data/template/src/html/min/index.php +66 -0
- data/template/src/html/min/lib/FirePHP.php +1370 -0
- data/template/src/html/min/lib/HTTP/ConditionalGet.php +348 -0
- data/template/src/html/min/lib/HTTP/Encoder.php +326 -0
- data/template/src/html/min/lib/JSMin.php +314 -0
- data/template/src/html/min/lib/JSMinPlus.php +1872 -0
- data/template/src/html/min/lib/Minify.php +532 -0
- data/template/src/html/min/lib/Minify/Build.php +103 -0
- data/template/src/html/min/lib/Minify/CSS.php +83 -0
- data/template/src/html/min/lib/Minify/CSS/Compressor.php +250 -0
- data/template/src/html/min/lib/Minify/CSS/UriRewriter.php +270 -0
- data/template/src/html/min/lib/Minify/Cache/APC.php +130 -0
- data/template/src/html/min/lib/Minify/Cache/File.php +125 -0
- data/template/src/html/min/lib/Minify/Cache/Memcache.php +137 -0
- data/template/src/html/min/lib/Minify/ClosureCompiler.php +85 -0
- data/template/src/html/min/lib/Minify/CommentPreserver.php +90 -0
- data/template/src/html/min/lib/Minify/Controller/Base.php +202 -0
- data/template/src/html/min/lib/Minify/Controller/Files.php +78 -0
- data/template/src/html/min/lib/Minify/Controller/Groups.php +94 -0
- data/template/src/html/min/lib/Minify/Controller/MinApp.php +132 -0
- data/template/src/html/min/lib/Minify/Controller/Page.php +82 -0
- data/template/src/html/min/lib/Minify/Controller/Version1.php +118 -0
- data/template/src/html/min/lib/Minify/HTML.php +245 -0
- data/template/src/html/min/lib/Minify/ImportProcessor.php +157 -0
- data/template/src/html/min/lib/Minify/Lines.php +131 -0
- data/template/src/html/min/lib/Minify/Logger.php +45 -0
- data/template/src/html/min/lib/Minify/Packer.php +37 -0
- data/template/src/html/min/lib/Minify/Source.php +187 -0
- data/template/src/html/min/lib/Minify/YUICompressor.php +139 -0
- data/template/src/html/min/lib/Solar/Dir.php +199 -0
- data/template/src/html/min/lib/closure-compiler.jar +0 -0
- data/template/src/html/min/lib/yuicompressor-2.4.2.jar +0 -0
- data/template/src/html/min/utils.php +90 -0
- data/template/src/templates/css/template.css +7 -0
- data/template/src/templates/js/template.js +72 -0
- data/template/src/templates/template.html +18 -0
- data/template/src/yaml/config.yml +46 -0
- data/template/src/yaml/deploy.yml +35 -0
- data/test/bixbite_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +278 -0
data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/WatchedFileDefinitions.pm
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
###############################################################################
|
2
|
+
#
|
3
|
+
# Package: NaturalDocs::SourceDB::WatchedFileDefinitions
|
4
|
+
#
|
5
|
+
###############################################################################
|
6
|
+
#
|
7
|
+
# A class to track the definitions appearing in a watched file. This is only used for extensions that track definition info with
|
8
|
+
# <NaturalDocs::SourceDB::ItemDefinition>-derived objects. Do not use it for extensions that only track existence.
|
9
|
+
#
|
10
|
+
###############################################################################
|
11
|
+
|
12
|
+
# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
|
13
|
+
# Natural Docs is licensed under the GPL
|
14
|
+
|
15
|
+
use strict;
|
16
|
+
use integer;
|
17
|
+
|
18
|
+
|
19
|
+
package NaturalDocs::SourceDB::WatchedFileDefinitions;
|
20
|
+
|
21
|
+
|
22
|
+
#
|
23
|
+
# Variables: Members
|
24
|
+
#
|
25
|
+
# This object would only have one member, which is an array, so the object itself serves as that member.
|
26
|
+
#
|
27
|
+
# <ExtensionIDs> are used as indexes into this object. Each entry is a hashref that maps item strings to
|
28
|
+
# <NaturalDocs::SourceDB::ItemDefinition>-derived objects. This is only done for extensions that use those objects to track
|
29
|
+
# definitions, it's not needed for extensions that only track existence. If there are no definitions, the entry will be undef.
|
30
|
+
#
|
31
|
+
|
32
|
+
|
33
|
+
#
|
34
|
+
# Function: New
|
35
|
+
#
|
36
|
+
# Creates and returns a new object.
|
37
|
+
#
|
38
|
+
sub New
|
39
|
+
{
|
40
|
+
my $class = shift;
|
41
|
+
|
42
|
+
my $object = [ ];
|
43
|
+
bless $object, $class;
|
44
|
+
|
45
|
+
return $object;
|
46
|
+
};
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
###############################################################################
|
51
|
+
# Group: Definition Functions
|
52
|
+
#
|
53
|
+
|
54
|
+
|
55
|
+
#
|
56
|
+
# Function: AddDefinition
|
57
|
+
#
|
58
|
+
# Adds a definition for the passed item string. If it's already defined, the new definition will be ignored.
|
59
|
+
#
|
60
|
+
# Parameters:
|
61
|
+
#
|
62
|
+
# extension - The <ExtensionID>.
|
63
|
+
# itemString - The item string.
|
64
|
+
# definition - The definition, which must be an object derived from <NaturalDocs::SourceDB::ItemDefinition>.
|
65
|
+
#
|
66
|
+
# Returns:
|
67
|
+
#
|
68
|
+
# Whether the definition was added, which is to say, whether this was the first definition for the passed <FileName>.
|
69
|
+
#
|
70
|
+
sub AddDefinition #(ExtensionID extension, string itemString, NaturalDocs::SourceDB::ItemDefinition definition) => bool
|
71
|
+
{
|
72
|
+
my ($self, $extension, $itemString, $definition) = @_;
|
73
|
+
|
74
|
+
if (!defined $self->[$extension])
|
75
|
+
{ $self->[$extension] = { }; };
|
76
|
+
|
77
|
+
if (!exists $self->[$extension]->{$itemString})
|
78
|
+
{
|
79
|
+
$self->[$extension]->{$itemString} = $definition;
|
80
|
+
return 1;
|
81
|
+
}
|
82
|
+
else
|
83
|
+
{ return 0; };
|
84
|
+
};
|
85
|
+
|
86
|
+
|
87
|
+
#
|
88
|
+
# Function: GetDefinition
|
89
|
+
#
|
90
|
+
# Returns the <NaturalDocs::SourceDB::ItemDefinition>-derived object for the passed item string or undef if there is none.
|
91
|
+
#
|
92
|
+
sub GetDefinition #(ExtensionID extension, string itemString) => NaturalDocs::SourceDB::ItemDefinition
|
93
|
+
{
|
94
|
+
my ($self, $extension, $itemString) = @_;
|
95
|
+
|
96
|
+
if (defined $self->[$extension])
|
97
|
+
{ return $self->[$extension]->{$itemString}; }
|
98
|
+
else
|
99
|
+
{ return undef; };
|
100
|
+
};
|
101
|
+
|
102
|
+
|
103
|
+
#
|
104
|
+
# Function: DeleteDefinition
|
105
|
+
#
|
106
|
+
# Removes the definition for the passed item string. Returns whether it was successful, meaning whether a definition existed
|
107
|
+
# for that item.
|
108
|
+
#
|
109
|
+
sub DeleteDefinition #(ExtensionID extension, string itemString) => bool
|
110
|
+
{
|
111
|
+
my ($self, $extension, $itemString) = @_;
|
112
|
+
|
113
|
+
if (defined $self->[$extension])
|
114
|
+
{
|
115
|
+
if (exists $self->[$extension]->{$itemString})
|
116
|
+
{
|
117
|
+
delete $self->[$extension]->{$itemString};
|
118
|
+
|
119
|
+
if (!scalar keys %{$self->[$extension]})
|
120
|
+
{ $self->[$extension] = undef; };
|
121
|
+
|
122
|
+
return 1;
|
123
|
+
};
|
124
|
+
};
|
125
|
+
|
126
|
+
return 0;
|
127
|
+
};
|
128
|
+
|
129
|
+
|
130
|
+
#
|
131
|
+
# Function: HasDefinitions
|
132
|
+
#
|
133
|
+
# Returns whether there are any definitions for this item.
|
134
|
+
#
|
135
|
+
sub HasDefinitions #(ExtensionID extension) => bool
|
136
|
+
{
|
137
|
+
my ($self, $extension) = @_;
|
138
|
+
|
139
|
+
return (defined $self->[$extension]);
|
140
|
+
};
|
141
|
+
|
142
|
+
|
143
|
+
#
|
144
|
+
# Function: HasDefinition
|
145
|
+
#
|
146
|
+
# Returns whether there is a definition for the passed item string.
|
147
|
+
#
|
148
|
+
sub HasDefinition #(ExtensionID extension, string itemString) => bool
|
149
|
+
{
|
150
|
+
my ($self, $extension, $itemString) = @_;
|
151
|
+
|
152
|
+
if (defined $self->[$extension])
|
153
|
+
{ return (exists $self->[$extension]->{$itemString}); }
|
154
|
+
else
|
155
|
+
{ return 0; };
|
156
|
+
};
|
157
|
+
|
158
|
+
|
159
|
+
1;
|
@@ -0,0 +1,102 @@
|
|
1
|
+
###############################################################################
|
2
|
+
#
|
3
|
+
# Package: NaturalDocs::StatusMessage
|
4
|
+
#
|
5
|
+
###############################################################################
|
6
|
+
#
|
7
|
+
# A package to handle status message updates. Automatically handles <NaturalDocs::Settings->IsQuiet()>.
|
8
|
+
#
|
9
|
+
###############################################################################
|
10
|
+
|
11
|
+
# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
|
12
|
+
# Natural Docs is licensed under the GPL
|
13
|
+
|
14
|
+
use strict;
|
15
|
+
use integer;
|
16
|
+
|
17
|
+
package NaturalDocs::StatusMessage;
|
18
|
+
|
19
|
+
|
20
|
+
#
|
21
|
+
# var: message
|
22
|
+
# The message to display.
|
23
|
+
#
|
24
|
+
my $message;
|
25
|
+
|
26
|
+
#
|
27
|
+
# var: total
|
28
|
+
# The number of items to work through.
|
29
|
+
#
|
30
|
+
my $total;
|
31
|
+
|
32
|
+
#
|
33
|
+
# var: completed
|
34
|
+
# The number of items completed.
|
35
|
+
#
|
36
|
+
my $completed;
|
37
|
+
|
38
|
+
#
|
39
|
+
# var: lastMessageTime
|
40
|
+
# The time the last message was posted.
|
41
|
+
#
|
42
|
+
my $lastMessageTime;
|
43
|
+
|
44
|
+
|
45
|
+
#
|
46
|
+
# constant: TIME_BETWEEN_UPDATES
|
47
|
+
# The number of seconds that should occur between updates.
|
48
|
+
#
|
49
|
+
use constant TIME_BETWEEN_UPDATES => 10;
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
#
|
54
|
+
# Function: Start
|
55
|
+
#
|
56
|
+
# Starts the status message.
|
57
|
+
#
|
58
|
+
# Parameters:
|
59
|
+
#
|
60
|
+
# message - The message to post.
|
61
|
+
# total - The number of items that are going to be worked through.
|
62
|
+
#
|
63
|
+
sub Start #(message, total)
|
64
|
+
{
|
65
|
+
my $self = shift;
|
66
|
+
|
67
|
+
if (!NaturalDocs::Settings->IsQuiet())
|
68
|
+
{
|
69
|
+
($message, $total) = @_;
|
70
|
+
$completed = 0;
|
71
|
+
|
72
|
+
print $message . "\n";
|
73
|
+
|
74
|
+
$lastMessageTime = time();
|
75
|
+
};
|
76
|
+
};
|
77
|
+
|
78
|
+
|
79
|
+
#
|
80
|
+
# Function: CompletedItem
|
81
|
+
#
|
82
|
+
# Should be called every time an item is completed.
|
83
|
+
#
|
84
|
+
sub CompletedItem
|
85
|
+
{
|
86
|
+
my $self = shift;
|
87
|
+
|
88
|
+
if (!NaturalDocs::Settings->IsQuiet())
|
89
|
+
{
|
90
|
+
# We scale completed by 100 since we need to anyway to get the percentage.
|
91
|
+
|
92
|
+
$completed += 100;
|
93
|
+
|
94
|
+
if (time() >= $lastMessageTime + TIME_BETWEEN_UPDATES && $completed != $total * 100)
|
95
|
+
{
|
96
|
+
print $message . ' (' . ($completed / $total) . '%)' . "\n";
|
97
|
+
$lastMessageTime = time();
|
98
|
+
};
|
99
|
+
};
|
100
|
+
};
|
101
|
+
|
102
|
+
1;
|
@@ -0,0 +1,212 @@
|
|
1
|
+
###############################################################################
|
2
|
+
#
|
3
|
+
# Package: NaturalDocs::SymbolString
|
4
|
+
#
|
5
|
+
###############################################################################
|
6
|
+
#
|
7
|
+
# A package to manage <SymbolString> handling throughout the program.
|
8
|
+
#
|
9
|
+
###############################################################################
|
10
|
+
|
11
|
+
# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
|
12
|
+
# Natural Docs is licensed under the GPL
|
13
|
+
|
14
|
+
use strict;
|
15
|
+
use integer;
|
16
|
+
|
17
|
+
package NaturalDocs::SymbolString;
|
18
|
+
|
19
|
+
|
20
|
+
#
|
21
|
+
# Function: FromText
|
22
|
+
#
|
23
|
+
# Extracts and returns a <SymbolString> from plain text.
|
24
|
+
#
|
25
|
+
# This should be the only way to get a <SymbolString> from plain text, as the splitting and normalization must be consistent
|
26
|
+
# throughout the application.
|
27
|
+
#
|
28
|
+
sub FromText #(string textSymbol)
|
29
|
+
{
|
30
|
+
my ($self, $textSymbol) = @_;
|
31
|
+
|
32
|
+
# The internal format of a symbol is all the normalized identifiers separated by 0x1F characters.
|
33
|
+
|
34
|
+
# Convert whitespace and reserved characters to spaces, and condense multiple consecutive ones.
|
35
|
+
$textSymbol =~ tr/ \t\r\n\x1C\x1D\x1E\x1F/ /s;
|
36
|
+
|
37
|
+
# DEPENDENCY: ReferenceString->MakeFrom() assumes all 0x1E characters were removed.
|
38
|
+
# DEPENDENCY: ReferenceString->MakeFrom() assumes this encoding doesn't use 0x1E characters.
|
39
|
+
|
40
|
+
# Remove spaces unless they're separating two alphanumeric/underscore characters.
|
41
|
+
$textSymbol =~ s/^ //;
|
42
|
+
$textSymbol =~ s/ $//;
|
43
|
+
$textSymbol =~ s/(\W) /$1/g;
|
44
|
+
$textSymbol =~ s/ (\W)/$1/g;
|
45
|
+
|
46
|
+
# Remove trailing empty parenthesis, so Function and Function() are equivalent.
|
47
|
+
$textSymbol =~ s/\(\)$//;
|
48
|
+
|
49
|
+
# Split the string into pieces.
|
50
|
+
my @pieces = split(/(\.|::|->)/, $textSymbol);
|
51
|
+
my $symbolString;
|
52
|
+
|
53
|
+
my $lastWasSeparator = 1;
|
54
|
+
|
55
|
+
foreach my $piece (@pieces)
|
56
|
+
{
|
57
|
+
if ($piece =~ /^(?:\.|::|->)$/)
|
58
|
+
{
|
59
|
+
if (!$lastWasSeparator)
|
60
|
+
{
|
61
|
+
$symbolString .= "\x1F";
|
62
|
+
$lastWasSeparator = 1;
|
63
|
+
};
|
64
|
+
}
|
65
|
+
elsif (length $piece)
|
66
|
+
{
|
67
|
+
$symbolString .= $piece;
|
68
|
+
$lastWasSeparator = 0;
|
69
|
+
};
|
70
|
+
# Ignore empty pieces
|
71
|
+
};
|
72
|
+
|
73
|
+
$symbolString =~ s/\x1F$//;
|
74
|
+
|
75
|
+
return $symbolString;
|
76
|
+
};
|
77
|
+
|
78
|
+
|
79
|
+
#
|
80
|
+
# Function: ToText
|
81
|
+
#
|
82
|
+
# Converts a <SymbolString> to text, using the passed separator.
|
83
|
+
#
|
84
|
+
sub ToText #(SymbolString symbolString, string separator)
|
85
|
+
{
|
86
|
+
my ($self, $symbolString, $separator) = @_;
|
87
|
+
|
88
|
+
my @identifiers = $self->IdentifiersOf($symbolString);
|
89
|
+
return join($separator, @identifiers);
|
90
|
+
};
|
91
|
+
|
92
|
+
|
93
|
+
#
|
94
|
+
# Function: ToBinaryFile
|
95
|
+
#
|
96
|
+
# Writes a <SymbolString> to the passed filehandle. Can also encode an undef.
|
97
|
+
#
|
98
|
+
# Parameters:
|
99
|
+
#
|
100
|
+
# fileHandle - The filehandle to write to.
|
101
|
+
# symbol - The <SymbolString> to write, or undef.
|
102
|
+
#
|
103
|
+
# Format:
|
104
|
+
#
|
105
|
+
# > [UInt8: number of identifiers]
|
106
|
+
# > [AString16: identifier] [AString16: identifier] ...
|
107
|
+
#
|
108
|
+
# Undef is represented by a zero for the number of identifiers.
|
109
|
+
#
|
110
|
+
sub ToBinaryFile #(FileHandle fileHandle, SymbolString symbol)
|
111
|
+
{
|
112
|
+
my ($self, $fileHandle, $symbol) = @_;
|
113
|
+
|
114
|
+
my @identifiers;
|
115
|
+
if (defined $symbol)
|
116
|
+
{ @identifiers = $self->IdentifiersOf($symbol); };
|
117
|
+
|
118
|
+
print $fileHandle pack('C', scalar @identifiers);
|
119
|
+
|
120
|
+
foreach my $identifier (@identifiers)
|
121
|
+
{
|
122
|
+
print $fileHandle pack('nA*', length($identifier), $identifier);
|
123
|
+
};
|
124
|
+
};
|
125
|
+
|
126
|
+
|
127
|
+
#
|
128
|
+
# Function: FromBinaryFile
|
129
|
+
#
|
130
|
+
# Loads a <SymbolString> or undef from the filehandle and returns it.
|
131
|
+
#
|
132
|
+
# Parameters:
|
133
|
+
#
|
134
|
+
# fileHandle - The filehandle to read from.
|
135
|
+
#
|
136
|
+
# Returns:
|
137
|
+
#
|
138
|
+
# The <SymbolString> or undef.
|
139
|
+
#
|
140
|
+
# See also:
|
141
|
+
#
|
142
|
+
# See <ToBinaryFile()> for format and dependencies.
|
143
|
+
#
|
144
|
+
sub FromBinaryFile #(FileHandle fileHandle)
|
145
|
+
{
|
146
|
+
my ($self, $fileHandle) = @_;
|
147
|
+
|
148
|
+
my $raw;
|
149
|
+
|
150
|
+
# [UInt8: number of identifiers or 0 if none]
|
151
|
+
|
152
|
+
read($fileHandle, $raw, 1);
|
153
|
+
my $identifierCount = unpack('C', $raw);
|
154
|
+
|
155
|
+
my @identifiers;
|
156
|
+
|
157
|
+
while ($identifierCount)
|
158
|
+
{
|
159
|
+
# [AString16: identifier] [AString16: identifier] ...
|
160
|
+
|
161
|
+
read($fileHandle, $raw, 2);
|
162
|
+
my $identifierLength = unpack('n', $raw);
|
163
|
+
|
164
|
+
my $identifier;
|
165
|
+
read($fileHandle, $identifier, $identifierLength);
|
166
|
+
|
167
|
+
push @identifiers, $identifier;
|
168
|
+
|
169
|
+
$identifierCount--;
|
170
|
+
};
|
171
|
+
|
172
|
+
if (scalar @identifiers)
|
173
|
+
{ return $self->Join(@identifiers); }
|
174
|
+
else
|
175
|
+
{ return undef; };
|
176
|
+
};
|
177
|
+
|
178
|
+
|
179
|
+
#
|
180
|
+
# Function: IdentifiersOf
|
181
|
+
#
|
182
|
+
# Returns the <SymbolString> as an array of identifiers.
|
183
|
+
#
|
184
|
+
sub IdentifiersOf #(SymbolString symbol)
|
185
|
+
{
|
186
|
+
my ($self, $symbol) = @_;
|
187
|
+
return split(/\x1F/, $symbol);
|
188
|
+
};
|
189
|
+
|
190
|
+
|
191
|
+
#
|
192
|
+
# Function: Join
|
193
|
+
#
|
194
|
+
# Takes a list of identifiers and/or <SymbolStrings> and returns it as a new <SymbolString>.
|
195
|
+
#
|
196
|
+
sub Join #(string/SymbolString identifier/symbol, string/SymolString identifier/symbol, ...)
|
197
|
+
{
|
198
|
+
my ($self, @pieces) = @_;
|
199
|
+
|
200
|
+
# Can't have undefs screwing everything up.
|
201
|
+
while (scalar @pieces && !defined $pieces[0])
|
202
|
+
{ shift @pieces; };
|
203
|
+
|
204
|
+
# We need to test @pieces first because joining on an empty array returns an empty string rather than undef.
|
205
|
+
if (scalar @pieces)
|
206
|
+
{ return join("\x1F", @pieces); }
|
207
|
+
else
|
208
|
+
{ return undef; };
|
209
|
+
};
|
210
|
+
|
211
|
+
|
212
|
+
1;
|