Skip to content

Commit fcd8a79

Browse files
author
schlichting.kai
committed
adding missing files for jsdoc-toolkit
git-svn-id: http://oryx-editor.googlecode.com/svn/trunk@2005 d672c736-503d-0410-a38a-9366997c882b
1 parent 531786a commit fcd8a79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+8079
-1
lines changed

editor/build.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<property name="editor-build-root" value="${build-dir}/editor" />
1313

1414
<!-- Targets for oryx javascript documentation ****************************************************** -->
15-
<taskdef name="jsdoctoolkit" classname="uk.co.darrenhurley.ant.tasks.JsDocToolkit" classpath="jsdoc-toolkit/jsdoctoolkit-ant-task-1.0.jar;jsdoc-toolkit/jsrun.jar"/>
15+
<taskdef name="jsdoctoolkit" classname="uk.co.darrenhurley.ant.tasks.JsDocToolkit" classpath="jsdoc-toolkit/jsdoctoolkit-ant-task-1.0.jar;jsdoc-toolkit/jsrun.jar;editor/lib/js.jar"/>
1616
<target name="jsdoc-editor">
1717
<jsdoctoolkit jsdochome="jsdoc-toolkit/" template="jsdoc" outputdir="jsdoc/editor" inputdir="editor/client/scripts" depth="2">
1818
</jsdoctoolkit>

jsdoc-toolkit/app/frame.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
IO.include("frame/Opt.js");
2+
IO.include("frame/Chain.js");
3+
IO.include("frame/Link.js");
4+
IO.include("frame/String.js");
5+
IO.include("frame/Hash.js");
6+
IO.include("frame/Namespace.js");
7+
//IO.include("frame/Reflection.js");
8+
9+
/** A few helper functions to make life a little easier. */
10+
11+
function defined(o) {
12+
return (o !== undefined);
13+
}
14+
15+
function copy(o) { // todo check for circular refs
16+
if (o == null || typeof(o) != 'object') return o;
17+
var c = new o.constructor();
18+
for(var p in o) c[p] = copy(o[p]);
19+
return c;
20+
}
21+
22+
function isUnique(arr) {
23+
var l = arr.length;
24+
for(var i = 0; i < l; i++ ) {
25+
if (arr.lastIndexOf(arr[i]) > i) return false;
26+
}
27+
return true;
28+
}
29+
30+
/** Returns the given string with all regex meta characters backslashed. */
31+
RegExp.escapeMeta = function(str) {
32+
return str.replace(/([$^\\\/()|?+*\[\]{}.-])/g, "\\$1");
33+
}

jsdoc-toolkit/app/frame/Chain.js

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/**@constructor*/
2+
function ChainNode(object, link) {
3+
this.value = object;
4+
this.link = link; // describes this node's relationship to the previous node
5+
}
6+
7+
/**@constructor*/
8+
function Chain(valueLinks) {
9+
this.nodes = [];
10+
this.cursor = -1;
11+
12+
if (valueLinks && valueLinks.length > 0) {
13+
this.push(valueLinks[0], "//");
14+
for (var i = 1, l = valueLinks.length; i < l; i+=2) {
15+
this.push(valueLinks[i+1], valueLinks[i]);
16+
}
17+
}
18+
}
19+
20+
Chain.prototype.push = function(o, link) {
21+
if (this.nodes.length > 0 && link) this.nodes.push(new ChainNode(o, link));
22+
else this.nodes.push(new ChainNode(o));
23+
}
24+
25+
Chain.prototype.unshift = function(o, link) {
26+
if (this.nodes.length > 0 && link) this.nodes[0].link = link;
27+
this.nodes.unshift(new ChainNode(o));
28+
this.cursor++;
29+
}
30+
31+
Chain.prototype.get = function() {
32+
if (this.cursor < 0 || this.cursor > this.nodes.length-1) return null;
33+
return this.nodes[this.cursor];
34+
}
35+
36+
Chain.prototype.first = function() {
37+
this.cursor = 0;
38+
return this.get();
39+
}
40+
41+
Chain.prototype.last = function() {
42+
this.cursor = this.nodes.length-1;
43+
return this.get();
44+
}
45+
46+
Chain.prototype.next = function() {
47+
this.cursor++;
48+
return this.get();
49+
}
50+
51+
Chain.prototype.prev = function() {
52+
this.cursor--;
53+
return this.get();
54+
}
55+
56+
Chain.prototype.toString = function() {
57+
var string = "";
58+
for (var i = 0, l = this.nodes.length; i < l; i++) {
59+
if (this.nodes[i].link) string += " -("+this.nodes[i].link+")-> ";
60+
string += this.nodes[i].value.toString();
61+
}
62+
return string;
63+
}
64+
65+
Chain.prototype.joinLeft = function() {
66+
var result = "";
67+
for (var i = 0, l = this.cursor; i < l; i++) {
68+
if (result && this.nodes[i].link) result += this.nodes[i].link;
69+
result += this.nodes[i].value.toString();
70+
}
71+
return result;
72+
}
73+
74+
75+
/* USAGE:
76+
77+
var path = "one/two/three.four/five-six";
78+
var pathChain = new Chain(path.split(/([\/.-])/));
79+
print(pathChain);
80+
81+
var lineage = new Chain();
82+
lineage.push("Port");
83+
lineage.push("Les", "son");
84+
lineage.push("Dawn", "daughter");
85+
lineage.unshift("Purdie", "son");
86+
87+
print(lineage);
88+
89+
// walk left
90+
for (var node = lineage.last(); node !== null; node = lineage.prev()) {
91+
print("< "+node.value);
92+
}
93+
94+
// walk right
95+
var node = lineage.first()
96+
while (node !== null) {
97+
print(node.value);
98+
node = lineage.next();
99+
if (node && node.link) print("had a "+node.link+" named");
100+
}
101+
102+
*/

jsdoc-toolkit/app/frame/Dumper.js

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/**
2+
* @class
3+
<pre>
4+
This is a lightly modified version of Kevin Jones' JavaScript
5+
library Data.Dump. To download the original visit:
6+
<a href="http://openjsan.org/doc/k/ke/kevinj/Data/Dump/">http://openjsan.org/doc/k/ke/kevinj/Data/Dump/</a>
7+
8+
AUTHORS
9+
10+
The Data.Dump JavaScript module is written by Kevin Jones
11+
([email protected]), based on Data::Dump by Gisle Aas ([email protected]),
12+
based on Data::Dumper by Gurusamy Sarathy ([email protected]).
13+
14+
COPYRIGHT
15+
16+
Copyright 2007 Kevin Jones. Copyright 1998-2000,2003-2004 Gisle Aas.
17+
Copyright 1996-1998 Gurusamy Sarathy.
18+
19+
This program is free software; you can redistribute it and/or modify
20+
it under the terms of the Perl Artistic License
21+
22+
See http://www.perl.com/perl/misc/Artistic.html
23+
</pre>
24+
* @static
25+
*/
26+
Dumper = {
27+
/** @param [...] The objects to dump. */
28+
dump: function () {
29+
if (arguments.length > 1)
30+
return this._dump(arguments);
31+
else if (arguments.length == 1)
32+
return this._dump(arguments[0]);
33+
else
34+
return "()";
35+
},
36+
37+
_dump: function (obj) {
38+
if (typeof obj == 'undefined') return 'undefined';
39+
var out;
40+
if (obj.serialize) { return obj.serialize(); }
41+
var type = this._typeof(obj);
42+
if (obj.circularReference) obj.circularReference++;
43+
switch (type) {
44+
case 'circular':
45+
out = "{ //circularReference\n}";
46+
break;
47+
case 'object':
48+
var pairs = new Array;
49+
50+
for (var prop in obj) {
51+
if (prop != "circularReference" && obj.hasOwnProperty(prop)) { //hide inherited properties
52+
pairs.push(prop + ': ' + this._dump(obj[prop]));
53+
}
54+
}
55+
56+
out = '{' + this._format_list(pairs) + '}';
57+
break;
58+
59+
case 'string':
60+
for (var prop in Dumper.ESC) {
61+
if (Dumper.ESC.hasOwnProperty(prop)) {
62+
obj = obj.replace(prop, Dumper.ESC[prop]);
63+
}
64+
}
65+
66+
// Escape UTF-8 Strings
67+
if (obj.match(/^[\x00-\x7f]*$/)) {
68+
out = '"' + obj.replace(/\"/g, "\\\"").replace(/([\n\r]+)/g, "\\$1") + '"';
69+
}
70+
else {
71+
out = "unescape('"+escape(obj)+"')";
72+
}
73+
break;
74+
75+
case 'array':
76+
var elems = new Array;
77+
78+
for (var i=0; i<obj.length; i++) {
79+
elems.push( this._dump(obj[i]) );
80+
}
81+
82+
out = '[' + this._format_list(elems) + ']';
83+
break;
84+
85+
case 'date':
86+
// firefox returns GMT strings from toUTCString()...
87+
var utc_string = obj.toUTCString().replace(/GMT/,'UTC');
88+
out = 'new Date("' + utc_string + '")';
89+
break;
90+
91+
case 'element':
92+
// DOM element
93+
out = this._dump_dom(obj);
94+
break;
95+
96+
default:
97+
out = obj;
98+
}
99+
100+
out = String(out).replace(/\n/g, '\n ');
101+
out = out.replace(/\n (.*)$/,"\n$1");
102+
103+
return out;
104+
},
105+
106+
_format_list: function (list) {
107+
if (!list.length) return '';
108+
var nl = list.toString().length > 60 ? '\n' : ' ';
109+
return nl + list.join(',' + nl) + nl;
110+
},
111+
112+
_typeof: function (obj) {
113+
if (obj && obj.circularReference && obj.circularReference > 1) return 'circular';
114+
if (Array.prototype.isPrototypeOf(obj)) return 'array';
115+
if (Date.prototype.isPrototypeOf(obj)) return 'date';
116+
if (typeof obj.nodeType != 'undefined') return 'element';
117+
return typeof(obj);
118+
},
119+
120+
_dump_dom: function (obj) {
121+
return '"' + Dumper.nodeTypes[obj.nodeType] + '"';
122+
}
123+
};
124+
125+
Dumper.ESC = {
126+
"\t": "\\t",
127+
"\n": "\\n",
128+
"\f": "\\f"
129+
};
130+
131+
Dumper.nodeTypes = {
132+
1: "ELEMENT_NODE",
133+
2: "ATTRIBUTE_NODE",
134+
3: "TEXT_NODE",
135+
4: "CDATA_SECTION_NODE",
136+
5: "ENTITY_REFERENCE_NODE",
137+
6: "ENTITY_NODE",
138+
7: "PROCESSING_INSTRUCTION_NODE",
139+
8: "COMMENT_NODE",
140+
9: "DOCUMENT_NODE",
141+
10: "DOCUMENT_TYPE_NODE",
142+
11: "DOCUMENT_FRAGMENT_NODE",
143+
12: "NOTATION_NODE"
144+
};

jsdoc-toolkit/app/frame/Hash.js

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/**
2+
@constructor
3+
@example
4+
var _index = new Hash();
5+
_index.set("a", "apple");
6+
_index.set("b", "blue");
7+
_index.set("c", "coffee");
8+
9+
for (var p = _index.first(); p; p = _index.next()) {
10+
print(p.key+" is for "+p.value);
11+
}
12+
13+
*/
14+
var Hash = function() {
15+
this._map = {};
16+
this._keys = [];
17+
this._vals = [];
18+
this.reset();
19+
}
20+
21+
Hash.prototype.set = function(k, v) {
22+
if (k != "") {
23+
this._keys.push(k);
24+
this._map["="+k] = this._vals.length;
25+
this._vals.push(v);
26+
}
27+
}
28+
29+
Hash.prototype.replace = function(k, k2, v) {
30+
if (k == k2) return;
31+
32+
var offset = this._map["="+k];
33+
this._keys[offset] = k2;
34+
if (typeof v != "undefined") this._vals[offset] = v;
35+
this._map["="+k2] = offset;
36+
delete(this._map["="+k]);
37+
}
38+
39+
Hash.prototype.drop = function(k) {
40+
if (k != "") {
41+
var offset = this._map["="+k];
42+
this._keys.splice(offset, 1);
43+
this._vals.splice(offset, 1);
44+
delete(this._map["="+k]);
45+
for (var p in this._map) {
46+
if (this._map[p] >= offset) this._map[p]--;
47+
}
48+
if (this._cursor >= offset && this._cursor > 0) this._cursor--;
49+
}
50+
}
51+
52+
Hash.prototype.get = function(k) {
53+
if (k != "") {
54+
return this._vals[this._map["="+k]];
55+
}
56+
}
57+
58+
Hash.prototype.keys = function() {
59+
return this._keys;
60+
}
61+
62+
Hash.prototype.hasKey = function(k) {
63+
if (k != "") {
64+
return (typeof this._map["="+k] != "undefined");
65+
}
66+
}
67+
68+
Hash.prototype.values = function() {
69+
return this._vals;
70+
}
71+
72+
Hash.prototype.reset = function() {
73+
this._cursor = 0;
74+
}
75+
76+
Hash.prototype.first = function() {
77+
this.reset();
78+
return this.next();
79+
}
80+
81+
Hash.prototype.next = function() {
82+
if (this._cursor++ < this._keys.length)
83+
return {key: this._keys[this._cursor-1], value: this._vals[this._cursor-1]};
84+
}

0 commit comments

Comments
 (0)