Author: gotcha
Date: Tue Dec 25 01:13:50 2007
New Revision: 50069

Modified:
   kukit/kukit.js/branch/finish-closures/kukit/TODO.txt
   kukit/kukit.js/branch/finish-closures/kukit/providerreg.js
Log:
unindent and initialize

Modified: kukit/kukit.js/branch/finish-closures/kukit/TODO.txt
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/TODO.txt        (original)
+++ kukit/kukit.js/branch/finish-closures/kukit/TODO.txt        Tue Dec 25 
01:13:50 2007
@@ -2,5 +2,4 @@
 
 eventreg.js
 kssparser.js
-providerreg.js
 tokenizer.js

Modified: kukit/kukit.js/branch/finish-closures/kukit/providerreg.js
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/providerreg.js  (original)
+++ kukit/kukit.js/branch/finish-closures/kukit/providerreg.js  Tue Dec 25 
01:13:50 2007
@@ -26,40 +26,42 @@
 * 
 *  The parameter providers need to be registered here.
 */
-
 pr.ValueProviderRegistry = function () {
-    this.content = {};
 
-    this.register = function(name, func) {
-        if (typeof(func) == 'undefined') {
-;;;         kukit.E = 'func argument is mandatory when registering a parameter'
-;;;         kukit.E += ' provider [ValueProviderRegistry.register].';
-            throw new Error(kukit.E);
-        }
-;;;     if (this.content[name]) {
-;;;        // Do not allow redefinition
-;;;        var msg = 'Error : parameter provider [' + name;
-;;;        msg += '] already registered.';
-;;;        kukit.logError(msg);
-;;;        return;
-;;;     }
-        this.content[name] = func;
-    };
-
-    this.exists = function(name) {
-        var entry = this.content[name];
-        return (typeof(entry) != 'undefined');
-    };
-
-    this.get = function(name) {
-        var func = this.content[name];
-        if (! func) {
-;;;         kukit.E = 'Error : undefined parameter provider [' + name + '].';
-            throw new Error(kukit.E);
-        }
-        return func;
-    };
+this.initialize = function() {
+    this.content = {};
+};
 
+this.register = function(name, func) {
+    if (typeof(func) == 'undefined') {
+;;;     kukit.E = 'func argument is mandatory when registering a parameter'
+;;;     kukit.E += ' provider [ValueProviderRegistry.register].';
+        throw new Error(kukit.E);
+    }
+;;; if (this.content[name]) {
+;;;    // Do not allow redefinition
+;;;    var msg = 'Error : parameter provider [' + name;
+;;;    msg += '] already registered.';
+;;;    kukit.logError(msg);
+;;;    return;
+;;; }
+    this.content[name] = func;
+};
+
+this.exists = function(name) {
+    var entry = this.content[name];
+    return (typeof(entry) != 'undefined');
+};
+
+this.get = function(name) {
+    var func = this.content[name];
+    if (! func) {
+;;;     kukit.E = 'Error : undefined parameter provider [' + name + '].';
+        throw new Error(kukit.E);
+    }
+    return func;
+};
+this.initialize.apply(this, arguments);
 };
 
 /*
@@ -89,77 +91,88 @@
 *  class _IdentityPP
 */
 var _IdentityPP = function() {
-    this.check = function(args) {
-        // check does not need to be used here actually.
-;;;     if (args.length != 1) {
-;;;         throw new Error('internal error, _IdentityPP needs 1 argument');
-;;;     }
-    };
-
-    this.eval = function(args, node) {
-        return args[0];
-    };
+
+this.check = function(args) {
+    // check does not need to be used here actually.
+;;; if (args.length != 1) {
+;;;     throw new Error('internal error, _IdentityPP needs 1 argument');
+;;; }
+};
+
+this.eval = function(args, node) {
+    return args[0];
+};
+
 };
 
 /*
 *  class _FormVarPP
 */
 var _FormVarPP = function() {
-    this.check = function(args) {
-;;;     if (args.length != 2) {
-;;;         throw new Error('formVar method needs 2 arguments [formname, 
varname]');
-;;;     }
-    };
-    this.eval = function(args, node) {
-        return kukit.fo.getFormVar(new kukit.fo.NamedFormLocator(args[0]), 
args[1]);
-    };
+
+this.check = function(args) {
+;;; if (args.length != 2) {
+;;;     throw new Error('formVar method needs 2 arguments [formname, 
varname]');
+;;; }
+};
+
+this.eval = function(args, node) {
+    return kukit.fo.getFormVar(new kukit.fo.NamedFormLocator(args[0]), 
args[1]);
+};
+
 };
 
 /*
 *  class _CurrentFormPP
 */
 var _CurrentFormVarPP = function() {
-    this.check = function(args) {
-;;;     if (args.length != 0 && args.length != 1) {
-;;;         throw new Error('currentFormVar method needs 0 or 1 argument 
[varname]');
-;;;     }
-    };
-    this.eval = function(args, node) {
-        if (args.length == 1) {
-            return kukit.fo.getFormVar(new kukit.fo.CurrentFormLocator(node),
-                args[0]);
-        } else {
-            // no form var name, just get the value of the node.
-            return kukit.fo.getValueOfFormElement(node);
-        }
-    };
+
+this.check = function(args) {
+;;; if (args.length != 0 && args.length != 1) {
+;;;     throw new Error('currentFormVar method needs 0 or 1 argument 
[varname]');
+;;; }
+};
+
+this.eval = function(args, node) {
+    if (args.length == 1) {
+        return kukit.fo.getFormVar(new kukit.fo.CurrentFormLocator(node),
+            args[0]);
+    } else {
+        // no form var name, just get the value of the node.
+        return kukit.fo.getValueOfFormElement(node);
+    }
+};
+
 };
 
 /*
 *  class _CurrentFormVarFromKssAttrPP
 */
 var _CurrentFormVarFromKssAttrPP = function() {
-    this.check = function(args) {
-;;;     if (args.length != 1 && args.length != 2) {
-;;;         kukit.E = 'currentFormVarFromKssAttr method needs 1 or 2 argument';
-;;;         kukit.E += ' [attrname, [recurseParents]]';
-;;;         throw new Error(kukit.E);
-;;;     }
-    };
-    this.eval = function(args, node) {
-        var argname =  args[0];
-        var recurseParents = false;
-        if (args.length == 2) {
-;;;         kukit.E = '2nd attribute of currentFormVarForKssAttr must be a';
-;;;         kukit.E += ' boolean';
-            kukit.ut.evalBool(args[1], kukit.E);
-            recurseParents = args[1];
-        }
-        var formvarname = kukit.dom.getRecursiveAttribute(node, argname,
-            recurseParents, kukit.dom.getKssAttribute);
-        return kukit.fo.getFormVar(new kukit.fo.CurrentFormLocator(node),
-            formvarname);
-    };
+
+this.check = function(args) {
+;;; if (args.length != 1 && args.length != 2) {
+;;;     kukit.E = 'currentFormVarFromKssAttr method needs 1 or 2 argument';
+;;;     kukit.E += ' [attrname, [recurseParents]]';
+;;;     throw new Error(kukit.E);
+;;; }
+};
+
+this.eval = function(args, node) {
+    var argname =  args[0];
+    var recurseParents = false;
+    if (args.length == 2) {
+;;;     kukit.E = '2nd attribute of currentFormVarForKssAttr must be a';
+;;;     kukit.E += ' boolean';
+        kukit.ut.evalBool(args[1], kukit.E);
+        recurseParents = args[1];
+    }
+    var formvarname = kukit.dom.getRecursiveAttribute(node, argname,
+        recurseParents, kukit.dom.getKssAttribute);
+    return kukit.fo.getFormVar(new kukit.fo.CurrentFormLocator(node),
+        formvarname);
+};
+
 };
 
 
@@ -168,18 +181,21 @@
 *  class _FormPP
 */
 var _FormPP = function() {
-    this.check = function(args) {
-;;;     if (args.length != 1) {
-;;;         throw new Error('form method needs 1 arguments [formname]');
-;;;     }
-;;;     var msg = 'Deprecated the [form(formname)] parameter provider,';
-;;;     msg += ' use [xxx-kssSubmitForm: form(formname)] instead !';
-;;;     kukit.logWarning(msg);
-    };
-    this.eval = function(args, node) {
-        return kukit.fo.getAllFormVars(new kukit.fo.NamedFormLocator(args[0]),
-            new kukit.ut.DictCollector());
-    };
+
+this.check = function(args) {
+;;; if (args.length != 1) {
+;;;     throw new Error('form method needs 1 arguments [formname]');
+;;; }
+;;; var msg = 'Deprecated the [form(formname)] parameter provider,';
+;;; msg += ' use [xxx-kssSubmitForm: form(formname)] instead !';
+;;; kukit.logWarning(msg);
+};
+
+this.eval = function(args, node) {
+    return kukit.fo.getAllFormVars(new kukit.fo.NamedFormLocator(args[0]),
+        new kukit.ut.DictCollector());
+};
+
 };
 
 /* BBB. To be deprecated at 2007-08-15 */
@@ -187,137 +203,155 @@
 *  class _CurrentFormPP
 */
 var _CurrentFormPP = function() {
-    this.check = function(args) {
-;;;     if (args.length != 0) {
-;;;         throw new Error('currentForm method needs no argument');
-;;;     }
-;;;     var msg = 'Deprecated the [currentForm()] parameter provider,';
-;;;     msg += ' use [xxx-kssSubmitForm: currentForm()] instead !';
-;;;     kukit.logWarning(msg);
-    };
-    this.eval = function(args, node) {
-        return kukit.fo.getAllFormVars(new kukit.fo.CurrentFormLocator(node),
-            new kukit.ut.DictCollector());
-    };
+
+this.check = function(args) {
+;;; if (args.length != 0) {
+;;;     throw new Error('currentForm method needs no argument');
+;;; }
+;;; var msg = 'Deprecated the [currentForm()] parameter provider,';
+;;; msg += ' use [xxx-kssSubmitForm: currentForm()] instead !';
+;;; kukit.logWarning(msg);
+};
+
+this.eval = function(args, node) {
+    return kukit.fo.getAllFormVars(new kukit.fo.CurrentFormLocator(node),
+        new kukit.ut.DictCollector());
+};
+
 };
 
 /*
 *  class _NodeAttrPP
 */
 var _NodeAttrPP = function() {
-    this.check = function(args) {
-;;;     if (args.length != 1 && args.length != 2) {
-;;;         kukit.E = 'nodeAttr method needs 1 or 2 argument (attrname,';
-;;;         kukit.E += ' [recurseParents]).';
-;;;         throw new Error(kukit.E);
-;;;     }
-;;;     if (args[0].toLowerCase() == 'style') {
-;;;         throw new Error('nodeAttr method does not accept [style] as 
attrname.');
-;;;     }
-;;;     if (args[0].match(/[ ]/)) {
-;;;         throw new Error('attrname parameter in nodeAttr method cannot 
contain space.');
-;;;     }
-    };
-    this.eval = function(args, node) {
-        var argname = args[0];
-        var recurseParents = false;
-        if (args.length == 2) {
-            recurseParents = args[1];
-;;;         kukit.E = '2nd attribute of nodeAttr must be a boolean.';
-            kukit.ut.evalBool(recurseParents, kukit.E);
-        }
-        return kukit.dom.getRecursiveAttribute(node, argname, recurseParents,
-            kukit.dom.getAttribute);
-    };
+
+this.check = function(args) {
+;;; if (args.length != 1 && args.length != 2) {
+;;;     kukit.E = 'nodeAttr method needs 1 or 2 argument (attrname,';
+;;;     kukit.E += ' [recurseParents]).';
+;;;     throw new Error(kukit.E);
+;;; }
+;;; if (args[0].toLowerCase() == 'style') {
+;;;     throw new Error('nodeAttr method does not accept [style] as 
attrname.');
+;;; }
+;;; if (args[0].match(/[ ]/)) {
+;;;     throw new Error('attrname parameter in nodeAttr method cannot contain 
space.');
+;;; }
+};
+
+this.eval = function(args, node) {
+    var argname = args[0];
+    var recurseParents = false;
+    if (args.length == 2) {
+        recurseParents = args[1];
+;;;     kukit.E = '2nd attribute of nodeAttr must be a boolean.';
+        kukit.ut.evalBool(recurseParents, kukit.E);
+    }
+    return kukit.dom.getRecursiveAttribute(node, argname, recurseParents,
+        kukit.dom.getAttribute);
+};
+
 };
 
 /*
 *  class _KssAttrPP
 */
 var _KssAttrPP = function() {
-    this.check = function(args) {
-;;;     if (args.length != 1 && args.length != 2) {
-;;;         kukit.E = 'kssAttr method needs 1 or 2 argument (attrname,';
-;;;         kukit.E += ' [recurseParents]).';
-;;;         throw new Error(kukit.E);
-;;;     }
-;;;     if (args[0].match(/[ -]/)) {
-;;;         kukit.E = 'attrname parameter in kssAttr method cannot contain';
-;;;         kukit.E += ' dashes or spaces.';
-;;;         throw new Error(kukit.E);
-;;;     }
-    };
-    this.eval = function(args, node) {
-        var argname =  args[0];
-        var recurseParents = false;
-        if (args.length == 2) {
-            recurseParents = args[1];
-;;;         kukit.E = '2nd attribute of kssAttr must be a boolean.';
-            kukit.ut.evalBool(recurseParents, kukit.E);
-        }
-        return kukit.dom.getRecursiveAttribute(node, argname, recurseParents,
-            kukit.dom.getKssAttribute);
-    };
+
+this.check = function(args) {
+;;; if (args.length != 1 && args.length != 2) {
+;;;     kukit.E = 'kssAttr method needs 1 or 2 argument (attrname,';
+;;;     kukit.E += ' [recurseParents]).';
+;;;     throw new Error(kukit.E);
+;;; }
+;;; if (args[0].match(/[ -]/)) {
+;;;     kukit.E = 'attrname parameter in kssAttr method cannot contain';
+;;;     kukit.E += ' dashes or spaces.';
+;;;     throw new Error(kukit.E);
+;;; }
+};
+
+this.eval = function(args, node) {
+    var argname =  args[0];
+    var recurseParents = false;
+    if (args.length == 2) {
+        recurseParents = args[1];
+;;;     kukit.E = '2nd attribute of kssAttr must be a boolean.';
+        kukit.ut.evalBool(recurseParents, kukit.E);
+    }
+    return kukit.dom.getRecursiveAttribute(node, argname, recurseParents,
+        kukit.dom.getKssAttribute);
+};
+
 };
 
 /*
 *  class _NodeContentPP
 */
 var _NodeContentPP = function() {
-    this.check = function(args) {
-;;;     if (args.length != 0 && args.length != 1) {
-;;;         throw new Error('nodeContent method needs 0 or 1 argument 
[recursive].');
-;;;     }
-    };
-    this.eval = function(args, node) {
-        var recursive = false;
-        if (args.length == 1) {
-            recursive = args[0];
-        }
-        return kukit.dom.textContent(node, recursive);
-    };
+
+this.check = function(args) {
+;;; if (args.length != 0 && args.length != 1) {
+;;;     throw new Error('nodeContent method needs 0 or 1 argument 
[recursive].');
+;;; }
+};
+
+this.eval = function(args, node) {
+    var recursive = false;
+    if (args.length == 1) {
+        recursive = args[0];
+    }
+    return kukit.dom.textContent(node, recursive);
+};
+
 };
 
 /*
 *  class _StateVarPP
 */
 var _StateVarPP = function() {
-    this.check = function(args) {
-;;;     if (args.length != 1) {
-;;;         throw new Error('stateVar method needs 1 argument [varname].');
-;;;     }
-    };
-    this.eval = function(args, node) {
-        var key = args[0];
-        var value = kukit.engine.stateVariables[key];
-        if (typeof(value) == 'undefined') {
-            // notfound arguments will get null
-;;;         kukit.E = 'Nonexistent statevar ['+ key +'].';
-            throw new Error(kukit.E);
-        }
-        return value;
-    };
+
+this.check = function(args) {
+;;; if (args.length != 1) {
+;;;     throw new Error('stateVar method needs 1 argument [varname].');
+;;; }
+};
+
+this.eval = function(args, node) {
+    var key = args[0];
+    var value = kukit.engine.stateVariables[key];
+    if (typeof(value) == 'undefined') {
+        // notfound arguments will get null
+;;;     kukit.E = 'Nonexistent statevar ['+ key +'].';
+        throw new Error(kukit.E);
+    }
+    return value;
+};
+
 };
 
 /*
 *  class _PassPP
 */
 var _PassPP = function() {
-    this.check = function(args) {
-;;;     if (args.length != 1) {
-;;;         throw new Error('pass method needs 1 argument [attrname].');
-;;;     }
-    };
-    this.eval = function(args, node, defaultParameters) {
-        var key = args[0];
-        var value = defaultParameters[key];
-        if (typeof(value) == 'undefined') {
-            // notfound arguments will get null
-;;;         kukit.E = 'Nonexistent default parm ['+ key +'].';
-            throw new Error(kukit.E);
-        }
-        return value;
-    };
+
+this.check = function(args) {
+;;; if (args.length != 1) {
+;;;     throw new Error('pass method needs 1 argument [attrname].');
+;;; }
+};
+
+this.eval = function(args, node, defaultParameters) {
+    var key = args[0];
+    var value = defaultParameters[key];
+    if (typeof(value) == 'undefined') {
+        // notfound arguments will get null
+;;;     kukit.E = 'Nonexistent default parm ['+ key +'].';
+        throw new Error(kukit.E);
+    }
+    return value;
+};
+
 };
 
 
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to