move introspect
authorAlan Knowles <alan@akbkhome.com>
Mon, 28 Jun 2010 09:59:44 +0000 (17:59 +0800)
committerAlan Knowles <alan@akbkhome.com>
Mon, 28 Jun 2010 09:59:44 +0000 (17:59 +0800)
16 files changed:
Introspect/Base.js [new file with mode: 0644]
Introspect/Basic.js [new file with mode: 0644]
Introspect/Callback.js [new file with mode: 0644]
Introspect/Class.js [new file with mode: 0644]
Introspect/Constant.js [new file with mode: 0644]
Introspect/Enum.js [new file with mode: 0644]
Introspect/Field.js [new file with mode: 0644]
Introspect/Interface.js [new file with mode: 0644]
Introspect/Link.js [new file with mode: 0644]
Introspect/Method.js [new file with mode: 0644]
Introspect/NameSpace.js [new file with mode: 0644]
Introspect/Property.js [new file with mode: 0644]
Introspect/Signal.js [new file with mode: 0644]
Introspect/Struct.js [new file with mode: 0644]
Introspect/Union.js [new file with mode: 0644]
Introspect/extensions/xml.js [new file with mode: 0644]

diff --git a/Introspect/Base.js b/Introspect/Base.js
new file mode 100644 (file)
index 0000000..9876fb5
--- /dev/null
@@ -0,0 +1,172 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+GLib    = imports.gi.GLib;
+xml     = imports.libxml;
+//GObject = imports.gi.GObject;
+
+XObject = imports.XObject.XObject;
+console = imports.console.console;
+
+NameSpace = imports.NameSpace.NameSpace;
+Basic = imports.Basic.Basic;
+
+
+
+
+/**
+ * Base  types methods/interfaces/structs/unions etc.
+ */
+
+
+
+Base = XObject.define(
+   function(ns, name) {
+        // fake should not happen?
+        
+        
+        if (typeof(name) == 'undefined') {
+            var ar = ns.split('.');
+            ns = ar[0];
+            name = ar[1];
+        }
+        this.ns = ns;
+        this.name = name;
+        this.alias = ns + '.' + name;
+        //console.log("CREATE(Base) " + this.alias);
+        this._loaded = false;
+        
+        
+        // reset all of these..
+        this.signals = [];
+        this.methods = [];
+        this.constructors = [];
+        this.functions= [];
+       
+        this.values = []; // for enum;g;
+        this.constants = [];
+        
+        this.properties = [];
+        this.implementInterfaces = []; // obect - which interface it implements.
+        this.implementedBy = []; // interface - which object uses it.
+        this.extendsClasses = []; // what it extends...
+        this.childClasses = []; // what 
+         this.desc = NameSpace.doc(this.alias );
+        
+        
+        var gi = GI.IRepository.get_default();
+        var ver = gi.get_version(ns);
+        var pth = GI.IRepository.get_search_path ();
+        var gir_path = pth[0].replace(/lib\/girepository-1.0/, 'share\/gir-1.0');
+       //console.log(fn);
+        this.gir_file = gir_path + '/'+ ns + '-' + ver + '.gir';
+        this.gir_filename = ns + '-' + ver + '.gir';
+        
+        
+    }, 
+    Basic, 
+    {
+        titleType: 'Unknown',
+        name :  '',
+        ns : '',
+       
+        signals : [],
+        methods : [],
+        constructors : [],
+        functions: [],
+       
+        values : [], // for enum
+        constants : [],
+        
+        properties : [],
+        implementInterfaces : [], // obect - which interface it implements.
+        implementedBy : [], // interface - which object uses it.
+        extendsClasses : [], // what it extends...
+        childClasses : [], // what 
+        
+        
+        
+        
+        getBI : function()  {
+            
+            var gi = GI.IRepository.get_default();
+            return gi.find_by_name(this.ns, this.name);
+        },
+         // on, getwhat, simple list (name), variable to add to.
+        genericBuildList : function( onwhat, type, keylist, saveto)
+        {
+            
+            //console.log(this.alias +" - ADDING :" + type);
+            //if (this[saveto].length) {
+            //    Seed.print( "EROROR = it's alreayd loaded why?");
+                //throw "oops";
+            //   }
+            var bb = this.getBI();
+            var _this = this;
+           //console.log("ADD " + type[0].toUpperCase() + type.substring(1));
+            var clname = type[0].toUpperCase() + type.substring(1);
+            var cls = imports[clname][clname];
+            if (!cls) {
+                console.log("COULD NOT FIND Introspect: " + type[0].toUpperCase() + type.substring(1));
+               }
+                
+            var plural = type + 's';
+            plural = plural == 'propertys' ? 'properties' : plural;
+            
+            
+            for(var i =0; i < GI[onwhat + '_info_get_n_' + plural ](bb); i++) {            
+                var add= new cls(GI[onwhat + '_info_get_' + type ](bb,i), this, saveto, keylist);
+                //console.log("CLS :" + this.alias + " EL: " + add.name);
+            }
+             
+            
+        },
+        // loop through and add stuff from extends..
+        genericExtends :  function(  keylist,  saveto)   
+        {
+            // do not overlay gobject props or methods etc.
+            
+            if (!this.extendsClasses.length) {
+                return;
+            }
+            if (this.extendsClasses[0].alias == 'GObject.Object') {
+                return;
+            }
+                
+            
+            var _this = this;
+            
+            this.extendsClasses[0].load();
+            this.extendsClasses[0][saveto].map(function(prop) {
+                if (keylist.indexOf(prop.name) < 0) {
+                    _this[saveto].push(prop);
+                    keylist.push(prop.name);
+                }
+            },this);
+            
+        },
+        // loop through and add stuff from implements..
+        genericImplements :  function(  keylist,  saveto)   {
+        
+            var _this = this;
+            this.implementInterfaces.map(function(iface) {
+                
+                iface.load();
+                
+                iface[saveto].map( function(prop) {
+                    if (keylist.indexOf(prop.name) < 0) {
+                        _this[saveto].push(prop);
+                        keylist.push(prop.name);
+                    }
+                },this);
+                
+            }, this);
+            
+        },
+                
+            
+        
+});
+
+
diff --git a/Introspect/Basic.js b/Introspect/Basic.js
new file mode 100644 (file)
index 0000000..50f58b9
--- /dev/null
@@ -0,0 +1,148 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+GLib    = imports.gi.GLib;
+xml     = imports.libxml;
+//GObject = imports.gi.GObject;
+
+XObject = imports.XObject.XObject;
+console = imports.console.console;
+
+
+
+/**
+ * Base class for Properties, functions, methods etc.
+ */
+
+
+Basic = XObject.define(
+    function( ) {
+         // never called?
+    },
+    Object,
+    {
+        
+        typeToName : function (type_info) {
+            var ty = GI.type_tag_to_string( GI.type_info_get_tag(type_info));
+            
+            if ((ty == 'void') && GI.type_info_is_pointer(type_info)) {
+                return 'void*'; // it's a fake string?!?!!? - slightly naughty...
+            }
+            if (ty == 'array') {
+                // array of what!?!?
+                var param_type = GI.type_info_get_param_type (type_info, 0);
+                var atype = GI.type_info_get_tag(param_type);
+                if (atype == GI.ITypeTag.UINT8) {
+                    return 'utf8';
+                }
+                
+                            
+                return ty;
+            }
+            if (ty != 'interface') {
+                return ty;
+            }
+            var interface_info = GI.type_info_get_interface (type_info);       
+            var interface_type = GI.base_info_get_type (interface_info);
+            if (interface_type  == GI.IInfoType.CALLBACK) {
+                // callback.. 
+                var Callback = imports.Callback.Callback ;
+                var ret=  new Callback(interface_info, this, false, false);
+                ret.alias = GI.base_info_get_namespace(interface_info) + '.' + GI.base_info_get_name(interface_info);
+                return ret;
+                 
+                
+            }
+
+            return  GI.base_info_get_namespace(interface_info) + '.' + GI.base_info_get_name(interface_info);
+            
+        },
+        
+        directions : [ "in", "out"," inout"],
+        
+        argsToArrays : function(m,  returnArray) 
+        {
+            
+            var outIntoReturn = false;
+            if (returnArray && returnArray.length == 1 && returnArray[0].type == 'void') {
+                outIntoReturn = true;
+            }
+            
+            var outArg = {
+                name : 'out_values',
+                ns : '',
+                type : 'Object',
+                direction : 'out',
+                be_null :  true, // in theory..
+                desc : "Return Object, use an empty Object, and the properties will get set as follows",
+                properties : []
+            };
+            
+            var args = [];
+            var firstOut = -1;
+            for(var a_i  =0; a_i   < GI.callable_info_get_n_args(m); a_i++) {
+                var arg = GI.callable_info_get_arg(m, a_i);
+                
+                var direction = this.directions[GI.arg_info_get_direction(arg)];
+                
+                var add = {
+                    name : GI.base_info_get_name(arg),
+                    ns : GI.base_info_get_namespace(arg),
+                    type : this.typeToName(GI.arg_info_get_type(arg)),
+                    direction : direction,
+                    be_null :  GI.arg_info_may_be_null(arg) || GI.arg_info_is_optional(arg),
+                    desc : GI.base_info_get_attribute(arg, 'doc') || ''
+                };
+                
+                
+                add.alias = add.ns + '.' + add.name;
+                
+                if (direction == 'out') {
+                    firstOut = firstOut  > -1 ? firstOut : a_i;
+                    if (outIntoReturn) {
+                        returnArray.push(add);
+                    } else {
+                        outArg.properties.push(add);
+                    }
+                }
+                
+                
+                args.push(add);
+            }
+            
+            // drop all the 'out args from the end of args..
+            if (returnArray) {
+                    
+                while (true) {
+                    if (!args.length) {
+                        break;
+                    }
+                    var l = args.pop(); // drop!
+                    if (l.direction == 'out') {
+                        // got an out arg..
+                        continue;
+                    }
+                    args.push(l); // put it back in (it's not a out).
+                    break;
+                    
+                }
+            }
+            if (outArg.properties.length) {
+                // put the out arg in there...
+                if (firstOut >= args.length) {
+                    args.push(outArg);
+                } else {
+                    args[firstOut]  = outArg;
+                }
+            }
+            
+             
+            // remove void return....
+            
+            if (returnArray && returnArray.length > 1 && returnArray[0].type == 'void') {
+                returnArray.shift();
+            }
+            
+            return args;
+        }
+});
diff --git a/Introspect/Callback.js b/Introspect/Callback.js
new file mode 100644 (file)
index 0000000..d9a7318
--- /dev/null
@@ -0,0 +1,48 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+GLib    = imports.gi.GLib;
+xml     = imports.libxml;
+//GObject = imports.gi.GObject;
+
+XObject = imports.XObject.XObject;
+console = imports.console.console;
+
+
+NameSpace = imports.NameSpace.NameSpace;
+Basic = imports.Basic.Basic;
+
+
+
+Callback = XObject.define(
+    function(sig, memberOf, saveto, keylist) {
+
+        
+        var params = this.argsToArrays(sig);
+        // add a reference to self...
+        /*params.unshift({
+            name : 'self',
+            type : memberOf.alias,
+            direction : 'in',
+            be_null :  false
+                
+        });
+        */
+        
+        XObject.extend(this,{
+            name : GI.base_info_get_name(sig),
+            params : params,
+            //memberOf : memberOf.alias,
+            exceptions : [],
+            returns :   [ { type :  this.typeToName(GI.callable_info_get_return_type(sig)) } ]            
+            
+        });
+        this.desc =  NameSpace.doc(memberOf.alias + '.' + this.name);
+        //memberOf[saveto].push(this);
+        //keylist.push(this.name);
+        
+    },
+    Basic,
+    {}
+);
+
diff --git a/Introspect/Class.js b/Introspect/Class.js
new file mode 100644 (file)
index 0000000..dba5f90
--- /dev/null
@@ -0,0 +1,176 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+GLib    = imports.gi.GLib;
+xml     = imports.libxml;
+//GObject = imports.gi.GObject;
+XObject = imports.XObject.XObject;
+console = imports.console.console;
+NameSpace = imports.NameSpace.NameSpace;
+
+Base = imports.Base.Base;
+
+
+
+
+/**
+ * Class
+ */
+
+
+
+
+Class = XObject.define(
+    function(ns, name) {
+        Base.call(this, ns, name);
+        this.loadExtends();
+        this.loadImplements();
+        //console.log("CREATED(Class) " + this.alias);
+    },
+    Base, 
+    {
+        titleType : 'Class',
+        
+        loadExtends : function()
+        {
+            var bi = this.getBI();
+            
+            var pi = GI.object_info_get_parent(bi);
+            this.extendsClasses = [];
+            if (!pi) {
+                return;
+            }
+            this.parent = NameSpace.factory(
+                'Class',
+                GI.base_info_get_namespace(pi),
+                GI.base_info_get_name(pi)
+            );
+            
+            this.extendsClasses = [ this.parent ];
+            
+            
+            this.parent.extendsClasses.map(function(p) {
+                this.extendsClasses.push(p);
+            },this);
+            
+            
+            
+        },
+        loadImplements : function()
+        {
+            var bb = this.getBI();
+            this.implementInterfaces = [];
+            
+            var iflist = [];
+            for(var i =0; i < GI.object_info_get_n_interfaces(bb); i++) {
+               
+                var prop = GI.object_info_get_interface(bb,i);
+                 
+                
+                var iface = NameSpace.factory(
+                    'Interface', 
+                    GI.base_info_get_namespace(prop) , GI.base_info_get_name(prop)
+                );
+                
+                
+                if (iflist.indexOf(iface.alias) < 0) {
+                    //console.log("ADDING IFACE " + iface.alias);
+                    iflist.push(iface.alias);
+                    this.implementInterfaces.push(iface);
+                }
+            }
+            // ask the first of the parents.. - which will have it loaded already
+            if (this.extendsClasses.length) {
+                
+                //this.extendsClasses[0].loadImplements();
+                
+                this.extendsClasses[0].implementInterfaces.map( function(si) {
+                    
+                    if (iflist.indexOf(si.alias) < 0) {
+                        //console.log("From extends ("+ si.alias + ") IFACE " + si.alias);
+                        iflist.push(si.alias);
+                        this.implementInterfaces.push(si);
+                    }
+                },this);
+                
+            }
+            //console.dump(iflist);
+            if (this.alias == 'Atk.NoOpObject') {
+            //    throw "exut";
+               }
+           // console.dump(this.implementInterfaces);
+        },
+        
+        
+        
+        
+        load : function()
+        {
+            if (this._loaded) {
+                return; // already loaded..
+            }
+            
+            if (this.parent) { // load up parents first
+                this.parent.load();
+            }
+            this.implementInterfaces.map(function(iface) {
+                iface.load();
+            });
+            
+            
+            //console.log("load(Class) " + this.alias);
+            // my props..
+            var props = [];
+            this.genericBuildList('object', 'property', props, 'properties');
+            this.genericBuildList('object', 'field', props, 'properties');
+
+            this.genericExtends(  props, 'properties');    
+            this.genericImplements( props, 'properties');    
+           
+            var signals = [];
+            this.genericBuildList('object', 'signal', signals, 'signals');
+            this.genericExtends(  signals, 'signals');    
+            this.genericImplements( signals, 'signals');    
+            
+            
+            NameSpace.references[this.alias] = NameSpace.references[this.alias] || [];
+            if (this.alias == 'GObject.Object') {
+                this._loaded = true;
+                return;
+            }
+            
+            
+            this.constructors.push({
+                name : '', // not really...
+                params:   this.properties.length ?  [ { type :  'Object', be_null :  true,  name : 'properties' } ] : [],
+                returns :  [],
+                isConstructor : true,
+                isStatic : false,
+                memberOf : this.alias,
+                exceptions : [],
+                // in theory..
+                desc : ''
+            });
+            
+            
+            var methods = [];
+            this.genericBuildList('object', 'method', methods, 'methods');
+            // dont inherit functiosn or consturctors...
+            
+            this.genericExtends(  methods, 'methods');    
+            this.genericImplements( methods, 'methods');    
+            
+            
+            
+            //console.log("loaded(Class) " + this.alias);
+              
+            this._loaded  = true;
+        }
+         
+         
+        
+        
+        
+});
diff --git a/Introspect/Constant.js b/Introspect/Constant.js
new file mode 100644 (file)
index 0000000..bad3f6d
--- /dev/null
@@ -0,0 +1,54 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+GLib    = imports.gi.GLib;
+xml     = imports.libxml;
+
+
+XObject     = imports.XObject.XObject;
+console     = imports.console.console;
+NameSpace   = imports.NameSpace.NameSpace;
+
+Basic        = imports.Basic.Basic;
+
+
+/**
+ * Constant
+ */
+
+
+Constant = XObject.define(
+    function(prop, memberOf, saveto, keylist) {
+          
+        this.name  =  GI.base_info_get_name(prop);
+        var tif    = GI.constant_info_get_type(prop);
+        var ty = GI.type_tag_to_string( GI.type_info_get_tag(tif));
+        this.type  = this.typeToName(GI.constant_info_get_type(prop));
+        
+        ///this.flags =  GI.property_info_get_flags(prop),
+        
+        
+        this.value= 'UNKNOWN';
+        
+        
+        if (ty != 'interface') {
+            
+            var argm = new GI.Argument();
+            GI.constant_info_get_value ( prop ,argm);
+            if (ty != 'utf8') {
+                this.value = argm.v_long;
+            } else {
+                this.value = argm.v_string;
+            }
+        } 
+        
+        this.desc = NameSpace.doc(memberOf.alias + '.' + this.name)
+        
+        memberOf[saveto].push(this);
+        keylist.push(this.name);
+    },
+    Basic,
+    { }
+);
diff --git a/Introspect/Enum.js b/Introspect/Enum.js
new file mode 100644 (file)
index 0000000..1dddc21
--- /dev/null
@@ -0,0 +1,59 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+GLib    = imports.gi.GLib;
+xml     = imports.libxml;
+
+
+
+XObject     = imports.XObject.XObject;
+console     = imports.console.console;
+NameSpace   = imports.NameSpace.NameSpace;
+
+Base        = imports.Base.Base;
+
+  
+
+
+
+
+Enum = XObject.define(
+    function(ns, name) {
+        Base.call(this, ns, name);
+    },
+    Base, 
+    {
+        titleType: 'Enum',
+         _loaded : false,
+        load : function()
+        {
+            if (this._loaded) {
+                return; // already loaded..
+            }
+            
+            this.desc = NameSpace.doc(this.alias);
+            var bi = this.getBI();
+                 
+            for(var i =0; i < GI.enum_info_get_n_values(bi); i++) {
+               
+                var prop = GI.enum_info_get_value(bi,i);
+                 
+              
+                this.values.push({
+                    name :  GI.base_info_get_name(prop).toUpperCase() ,
+                    type :   GI.type_tag_to_string(GI.enum_info_get_storage_type(bi)),
+                    value:   GI.value_info_get_value(prop) ,
+                    memberOf : this.alias
+                });
+            }
+            
+            this._loaded = true;
+             
+             
+            
+            
+        }
+});
+
\ No newline at end of file
diff --git a/Introspect/Field.js b/Introspect/Field.js
new file mode 100644 (file)
index 0000000..ee59e3a
--- /dev/null
@@ -0,0 +1,35 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+GLib    = imports.gi.GLib;
+xml     = imports.libxml;
+
+
+
+XObject     = imports.XObject.XObject;
+console     = imports.console.console;
+NameSpace   = imports.NameSpace.NameSpace;
+
+Basic        = imports.Basic.Basic;
+
+
+/**
+ * Field
+ */
+
+Field = XObject.define(
+    function(prop, memberOf, saveto, keylist) {
+          
+       this.name  =  GI.base_info_get_name(prop) ,
+        this.type  = this.typeToName(GI.field_info_get_type(prop)),
+        this.flags =  GI.field_info_get_flags(prop),
+        this.memberOf = memberOf.alias
+        memberOf[saveto].push(this);
+        keylist.push(this.name);
+
+    },
+    Basic,
+    {}
+);
diff --git a/Introspect/Interface.js b/Introspect/Interface.js
new file mode 100644 (file)
index 0000000..a83a5ac
--- /dev/null
@@ -0,0 +1,54 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+XObject     = imports.XObject.XObject;
+console     = imports.console.console;
+NameSpace   = imports.NameSpace.NameSpace;
+
+Base        = imports.Base.Base;
+
+
+
+/**
+ * Interface
+ */
+
+Interface = XObject.define(
+    function(ns, name) {
+        Base.call(this, ns, name);
+       
+    },
+
+    Base, 
+    {
+         titleType: 'Interface',
+        _loaded : false,
+        load : function()
+        {
+            if (this._loaded) {
+                return; // already loaded..
+            }
+            // my props..
+            var props = [];
+            this.genericBuildList('interface', 'property', props, 'properties');
+           
+           
+            var signals = [];
+            this.genericBuildList('interface', 'signal', signals, 'signals');
+          
+            
+            var methods = [];
+            this.genericBuildList('interface', 'method', methods, 'methods');
+            
+            
+            NameSpace.ifaceList[this.alias] = NameSpace.ifaceList[this.alias] || [];
+            this.implementedBy = NameSpace.ifaceList[this.alias];
+            
+              
+           
+            this._loaded  = true;
+        },
+         
+
+});
diff --git a/Introspect/Link.js b/Introspect/Link.js
new file mode 100644 (file)
index 0000000..3793c22
--- /dev/null
@@ -0,0 +1,386 @@
+//<script type="text/javascript">
+
+console = imports.console.console;
+
+XObject = imports.XObject.XObject
+
+
+/** Handle the creation of HTML links to documented symbols.
+       @constructor
+    * 
+    *  
+    * 
+*/
+
+Link = XObject.define({
+    function() {
+        this.alias = "";
+        this.src = "";
+        this.file = "";
+        this.text = "";
+        this.innerName = "";
+        this.classLink = false;
+        this.targetName = "";
+        
+        // statics..
+        Link.symbolsDir = Link.symbolsDir || '';
+        Link.base = Link.base || '';
+        Link.ext= Link.ext || '';
+        Link.srcDir= Link.srcDir || '';
+            
+        
+    },
+    Object,  {
+        
+        alias : "",
+        src : "",
+        file : "",
+        text : "",
+        innerName : "",
+        classLink : false,
+        targetName : "",
+        
+        
+        
+        toString : function() {
+            var linkString;
+            var thisLink = this;
+            
+            if (this.none) {
+                return 'none';
+            }
+            if (this.alias) {
+                
+                if (typeof(this.builtins[this.alias]) != 'undefined') {
+                    this.text = this.alias;
+                    return thisLink._makeExternLink(this.builtins[this.alias]);
+                }
+                
+                
+                return thisLink._makeSymbolLink(this.alias);
+                
+                /*
+                
+                linkString = this.alias.replace(/(^|[^a-z$0-9_#.:-])([|a-z$0-9_#.:-]+)($|[^a-z$0-9_#.:-])/i,
+                    function(match, prematch, symbolName, postmatch) {
+                        var symbolNames = symbolName.split("|");
+                        var links = [];
+                        for (var i = 0, l = symbolNames.length; i < l; i++) {
+                            thisLink.alias = symbolNames[i];
+                            links.push(thisLink._makeSymbolLink(symbolNames[i]));
+                        }
+                        return prematch+links.join("|")+postmatch;
+                    }
+                );
+                */
+            }
+            else if (this.extern) {
+                linkString = thisLink._makeExternLink(this.extern);
+            }
+            else if (this.src) {
+                linkString = thisLink._makeSrcLink(this.src);
+            }
+            else if (this.file) {
+                linkString = thisLink._makeFileLink(this.file);
+            }
+
+            return linkString;
+        },
+        
+        builtins : {
+            'Object' : 'https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Object',
+            //'Object...' : 'http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object',
+            'Array' : 'https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array',
+            'Function' : 'https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Function',
+            'String' : 'https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/String',
+            'Number' : 'https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Number',
+            'Boolean' : 'https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Boolean',
+            'HTMLElement' : 'http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037'
+        },
+        
+        
+        toGnome: function(alias) 
+        {
+            this.file = "#";
+            var pr = alias.split('.');
+            var aa = alias;
+            var site = 'library.gnome.org';
+            var extra = '';
+            switch(pr[0]) {
+                case 'GIRepository':
+                   this.extern = 'http://live.gnome.org/GObjectIntrospection';
+                   aa = pr[0];
+                   break;
+                case 'Gio':   
+                case 'GLib':   
+                case 'GObject':   
+                    aa = pr.length > 1 ? 'G' + pr[1] : pr[0];
+                    break;
+                case 'GdkPixbuf':   
+                    aa = pr.length > 1 ? 'Gdk' + pr[1] : pr[0];
+                    break;
+                case 'GtkSource':   
+                    aa = pr.length > 1 ? pr[0] + pr[1] : 'GtkSourceView';
+                    break;
+                    
+                case 'Gst': 
+                    aa = pr.length > 1 ? pr[0] + pr[1] : 'GStreamer';
+                    break;
+                
+                case 'Pango':
+                    extra = ' GTK-Doc';
+                    break;
+                case 'GstController': 
+                case 'GstApp': 
+                case 'GstAudio': 
+                case 'GstBase': 
+                case 'GstCheck': 
+                case 'GstFft': 
+                case 'GstInterfaces': 
+                case 'GstNet': 
+                case 'GstNetbuffer': 
+                case 'GstPbutils': 
+                case 'GstRiff': 
+                case 'GstRtp': 
+                case 'GstRtsp': 
+                case 'GstSdp': 
+                case 'GstTag': 
+                case 'GstVideo': 
+                
+                    aa = pr.length > 1 ? 'Gst' + pr[1] : pr[0];
+                    break;
+                    
+                case 'Epiphany':     
+                    aa = pr.length > 1 ?  pr[1] : pr[0];
+                    break;
+                case 'WebKit':
+                    site = 'webkitgtk.org';
+                
+                default:
+                    
+                    aa = alias.replace('.', '');
+                    
+                    break;
+             
+            }
+            if (!this.extern) {
+                this.extern = 'http://www.google.com/search?hl=en&amp;' + 
+                        'q=site%3A' + site  + '+' + aa + extra +
+                        '&amp;btnI=I%27m+Feeling+Lucky&amp;meta=&amp;aq=f&amp;oq=';
+            }
+            
+            this.text =  aa;
+            return this;
+        },
+        
+        target : function(targetName) {
+            if (typeof(targetName) != 'undefined') this.targetName = targetName;
+            return this;
+        },
+        inner : function(inner) {
+            if (typeof(inner) != 'undefined') this.innerName = inner;
+            return this;
+        },
+        withText:  function(text) {
+            if (typeof(text) != 'undefined') this.text = text;
+            return this;
+        },
+        toSrc :function(filename) {
+            if (typeof(filename) != 'undefined') this.src = filename;
+            return this;
+        },
+        
+        toSymbolLong : function(alias)
+        {
+            this.show_full = true;
+            return this.toSymbol(alias)
+        },
+        toSymbol : function(alias) {
+            
+            
+            switch(alias) {
+                case 'boolean' : this.alias = 'Boolean'; return this;
+                case 'int' : this.alias = 'Number'; return this;
+                case 'uint' : this.alias = 'Number'; return this;
+                
+                case 'long' : this.alias = 'Number'; return this;
+                case 'ulong' : this.alias = 'Number'; return this;
+                
+                
+                case 'uint8' : this.alias = 'Number'; return this;
+                case 'int8' : this.alias = 'Number'; return this;
+                
+                case 'uint16' : this.alias = 'Number'; return this;
+                case 'uint16' : this.alias = 'Number'; return this;
+                
+                case 'int32' : this.alias = 'Number'; return this;
+                case 'uint32' : this.alias = 'Number'; return this;
+                
+                case 'uint64' : this.alias = 'Number'; return this;
+                case 'int64' : this.alias = 'Number'; return this;
+                
+                
+                case 'GType' : this.alias = 'Number'; return this;
+                case 'size' : this.alias = 'Number'; return this;
+                case 'ssize' : this.alias = 'Number'; return this;
+                
+                case 'float' : this.alias = 'Number'; return this;
+                case 'double' : this.alias = 'Number'; return this;
+                case 'time_t' : this.alias = 'Number'; return this;
+                // fixme - should find out more details..
+                case 'array' : this.alias = 'Array'; return this;
+                case 'gslist' : this.alias = 'Array'; return this;
+                case 'glist' : this.alias = 'Array'; return this; // homefully.
+                case 'ghash' : this.alias = 'Object'; return this; // homefully.
+                
+                
+                case 'error' : this.alias = 'Object'; return this; // homefully.
+                case 'filename' : this.alias = 'String'; return this; // hopefully..
+                case 'utf8' : this.alias = 'String'; return this;
+                
+                case 'void' : this.none = true; return this;
+                
+                
+            }
+            
+            
+            if (typeof(alias) != 'undefined') {
+                this.alias = new String(alias);
+            }
+            return this;
+        },
+        toClass : function(alias) {
+            this.classLink = true;
+            return this.toSymbol(alias);
+        },
+        toFile : function(file) {
+            if (typeof(file) != 'undefined') this.file = file;
+            return this;
+        },
+        
+        
+      
+
+        /** prefixed for hashes */
+
+
+        /** Appended to the front of relative link paths. */
+
+
+        symbolNameToLinkName : function(symbol) {
+            var linker = "";
+            if (symbol.isStatic) linker = ".";
+            else if (symbol.isInner) linker = "-";
+            
+            return linker+symbol.name;
+        },
+
+        
+
+
+        /** Create a link to a snother symbol. */
+        _makeSymbolLink :  function(alias) 
+        {
+            var target = '';
+            var txt = this.show_full ? alias : alias.split('.').pop();
+             return "<a href=\"./"+alias+".html\""+target+">"+txt+"</a>";    
+            
+            /*
+            // look for '/' in alias..
+            if (/\//.test(alias)) {
+                var bits = alias.split('/');
+                var ret = "";
+                for(var i=0; i < bits.length; i++) {
+                    if (i > 0) {
+                        ret +="/";
+                    }
+                    ret += this._makeSymbolLink(bits[i]);
+                }
+                return ret;
+                
+            }
+            
+            
+            */
+            
+            var linkBase = Link.base + Link.symbolsDir;
+            //var linkTo = Link.symbolSet.getSymbol(alias);
+            linkTo = "FIXME";
+            var linkPath;
+            var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
+            
+            // is it an internal link?
+            if (alias.charAt(0) == "#") {
+                linkPath = alias;
+                fullLinkPath = alias;
+            
+            // if there is no symbol by that name just return the name unaltered
+            } else if (!linkTo) {
+                
+                if (typeof(this.builtins[alias]) != 'undefined') {
+                    return "<a href=\""+ this.builtins[alias]+"\""+target+">"+alias+"</a>";
+                 }
+                
+                return this.text || alias;
+            
+            
+            // it's a symbol in another file
+            } else {
+
+                if (!linkTo.isConstructor && !linkTo.isNamespace) { // it's a method or property
+                    linkPath = escape(linkTo.memberOf) || "_global_";
+                    linkPath += Link.ext + "#" + this.symbolNameToLinkName(linkTo);
+                }
+                else {
+                    linkPath = escape(linkTo.alias);
+                    linkPath += Link.ext + (this.classLink? "":"#" +  "constructor");
+                }
+                //linkPath = linkBase + linkPath;
+                fullLinkPath = linkBase + linkPath;
+            }
+            
+            var linkText = this.text || alias;
+            
+            var link = {linkPath: linkPath, linkText: linkText, fullLinkPath: fullLinkPath};
+            
+            //if (typeof PluginManager != "undefined") {
+            //    JSDOC.PluginManager.run("onSymbolLink", link);
+            //}
+            
+            return "<a href=\""+link.fullLinkPath+"\""+target+">"+link.linkText+"</a>";
+        },
+
+
+        /** Create a link to a source file. */
+         _makeSrcLink : function(srcFilePath) {
+            var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
+                
+            // transform filepath into a filename
+            var srcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, "."); // was _
+            var lsrcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, ".");
+            var outFilePath = Link.base + Link.srcDir + srcFile.replace(/.js$/, '') + Link.ext;
+            
+            if (!this.text) this.text = FilePath.fileName(srcFilePath);
+            return "<a href=\""+outFilePath+"\""+target+">"+this.text+"</a>";
+        },
+
+        /** Create a link to a source file. */
+         _makeFileLink : function(filePath) {
+            var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
+                
+            var outFilePath =  Link.base + filePath;
+
+            if (!this.text) this.text = filePath;
+            return "<a href=\""+outFilePath+"\""+target+">"+this.text+"</a>";
+        },
+        
+        /** Create a link to a source file. */
+         _makeExternLink : function(filePath) {
+            var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
+                
+            if (!this.text) this.text = filePath;
+            return "<a href=\""+filePath+"\""+target+">"+this.text+"</a>";
+        }
+        
+});
\ No newline at end of file
diff --git a/Introspect/Method.js b/Introspect/Method.js
new file mode 100644 (file)
index 0000000..2c44879
--- /dev/null
@@ -0,0 +1,150 @@
+//<script type="text/javascript">
+
+GI      = imports.gi.GIRepository;
+
+
+XObject     = imports.XObject.XObject;
+console     = imports.console.console;
+NameSpace   = imports.NameSpace.NameSpace;
+
+Basic        = imports.Basic.Basic;
+
+  
+/**
+ * Methods, functions or consturctors
+ */
+
+
+
+
+Method = XObject.define(
+    function(m, memberOf, saveto, keylist) {
+        this.propertyType  = 'Method';
+        
+        var flags = GI.function_info_get_flags (m);
+        var n = GI.base_info_get_name(m);
+        var n_original = n + '';
+        // posibly add: sink, 
+        if (n.match(/_(ref|unref)$/) || n.match(/^(ref|unref|weakref|weakunref)$/)) {
+            return false; // skip these!
+        }
+        
+        if (n == 'new') {
+            n = 'c_new';
+        }
+
+        
+        var retval = [ { 
+                name : 0, 
+                type :  this.typeToName(GI.callable_info_get_return_type(m)),
+                desc : NameSpace.doc(memberOf.alias + '.' + n_original + '.return-value')
+        } ];
+        
+        
+        
+        var args = this.argsToArrays(m, retval);
+        
+        
+        if ((n == 'c_new') && !args.length && memberOf.constructors.length) {
+            
+            memberOf.constructors[0].doc = NameSpace.doc(memberOf.alias + '.' + n_original);
+            
+            return false; // skip.
+        }
+        
+
+        
+        
+        
+        //console.log(GI.base_info_get_name(m));
+       // console.dump(GI.base_info_get_attribute(m, 'doc') );
+       
+         // this is a bit messy, as we probably loose the doc's on new..
+       
+        
+        XObject.extend(this, {
+            name : n,
+            params: args,
+            returns :  retval,
+            isConstructor : flags & GI.IFunctionInfoFlags.IS_CONSTRUCTOR,
+            isStatic : !(flags & GI.IFunctionInfoFlags.IS_METHOD),
+            memberOf : memberOf.alias,
+            exceptions : [],
+            desc : NameSpace.doc(memberOf.alias + '.' + n_original)
+        });
+        // add descriptions to the arguments..
+        this.params.map(function(p) {
+            
+            
+            p.desc = NameSpace.doc(memberOf.alias + '.' + n_original + '.' + p.name);
+            //Seed.print(memberOf.alias + '.' + n_original + '.' + p.name + ':' +  p.desc);
+            
+        });
+        
+        
+            // collect references...
+        var addedto = [ memberOf.alias ]; // do not add to self...
+       
+         for(var i =0; i < args.length;i++) {
+            var ty = args[i].type;
+            if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
+                continue;
+            }
+            if (addedto.indexOf(ty) > -1) {
+                continue;
+            }
+            
+            
+            
+            NameSpace.references[ty] = NameSpace.references[ty] || [];
+            NameSpace.references[ty].push(this);
+            addedto.push(ty);
+        }
+        
+        
+         // decide what to add to...
+         
+        if (this.isConstructor) {
+            
+            if (this.name.match(/^new_/)) {
+                this.name = this.name.substring(4);
+            }
+            
+            
+            memberOf.constructors.push(this);
+            return;
+        }
+        // return values  = only applicable to non-constructors..
+        for(var i =0; i < retval.length;i++) {
+            var ty = retval[i].type;
+            if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
+                continue;
+            }
+            if (addedto.indexOf(ty) > -1) {
+                continue;
+            }
+            
+            
+            
+            NameSpace.references[ty] = NameSpace.references[ty] || [];
+            NameSpace.references[ty].push(this);
+            addedto.push(ty);
+        }
+        
+        
+        if (this.isStatic) {
+            
+            memberOf.functions.push(this);
+            return;
+        }
+            
+            
+        memberOf.methods.push(this);
+        keylist.push(this.name);
+            
+        
+            
+    },
+    Basic, 
+    { }
+);
\ No newline at end of file
diff --git a/Introspect/NameSpace.js b/Introspect/NameSpace.js
new file mode 100644 (file)
index 0000000..3158093
--- /dev/null
@@ -0,0 +1,294 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+GLib    = imports.gi.GLib;
+xml     = imports.libxml;
+
+
+XObject = imports.XObject.XObject;
+
+console = imports.console.console;
+
+
+NameSpace = {
+    
+   
+    references : { }, 
+    
+    namespaces : function(ns) 
+    {
+        // this should be a class of it's own...
+        this.references[ns] = []; // technically not needed - but fills in files..
+        // get this from GI... (it's the path..)
+        var ret = [];
+       
+        function scanGir(dir) 
+        {
+            if (!GLib.file_test(dir, GLib.FileTest.EXISTS)) {
+                return;
+            }
+            var gdir = GLib.dir_open(dir,0);
+            
+            while (true) {
+                
+                var fn = gdir.read_name ? gdir.read_name () : GLib.dir_read_name(gdir);
+           //      console.log('trying ' +  fn);
+                if (!fn) {
+                    gdir.close ? gdir.close() : GLib.dir_close(gdir);
+                    return;;
+                }
+                if (!fn.match(/.typelib$/)) {
+                    continue;
+                }
+                var par = fn.split('-').shift();
+                 //console.log('trying ' +  par);
+                if (ret.indexOf(par) > -1) {
+                     continue;
+                }
+                ret.push(par);
+                
+                
+            } 
+        }
+        var gi = GI.IRepository.get_default();
+        var pth = GI.IRepository.get_search_path ();
+        
+        scanGir(pth[0]);
+        ret.sort();
+        console.dump(ret);
+        return ret;
+        
+    },
+        
+        
+    ns:  function(ns) {
+        var gi = GI.IRepository.get_default();
+        ret = {
+            titleType: 'Namespace',
+            ns: ns,
+            name : ns,
+            alias : ns,
+            objects : [],
+            functions : [],
+            enums : [],
+            structs: [],
+            constants : [],
+            unions : [],
+            
+            // so ns looks like class..
+          
+            extendsClasses : [], // what it extends...
+            childClasses : [], // what uses it..
+            properties : [],
+            constructors : [],
+            methods : [],
+            values : [], /// really constants.
+            signals : [],
+            interfaces: [],
+        };
+     
+        for (var i=0; i <  gi.get_n_infos (ns); i++ ) {
+            var info = gi.get_info (ns, i);
+            
+            var info_type = GI.base_info_get_type (info);
+            switch(info_type) {
+                case  GI.IInfoType.OBJECT:
+                    ret.objects.push(GI.base_info_get_name(info));
+                    this.clsGatherInterfaces(ns , GI.base_info_get_name(info));
+                    continue;
+                 case  GI.IInfoType.INTERFACE:
+                    ret.interfaces.push(GI.base_info_get_name(info));
+                    continue;
+                case  GI.IInfoType.FUNCTION:
+                    new imports.Method.Method(info, ret, 'functions', []);    
+                    continue;
+                
+                case  GI.IInfoType.CALLBACK:
+                   // new Introspect.Callback(info, ret, 'callbacks', []);
+                    continue;
+                
+                case  GI.IInfoType.ENUM:
+                case  GI.IInfoType.FLAGS:
+                    ret.enums.push(GI.base_info_get_name(info));
+                    continue;
+                case  GI.IInfoType.STRUCT:
+                    if (GI.struct_info_is_gtype_struct (info)) {
+                        continue;
+                    }
+
+                    ret.structs.push(GI.base_info_get_name(info));
+                    continue;
+                case  GI.IInfoType.UNION:
+                    ret.unions.push(GI.base_info_get_name(info));
+                    continue;
+                case  GI.IInfoType.CONSTANT:
+                    new imports.Constant.Constant(info, ret, 'values', []);
+                    
+                    continue;
+                
+                
+                default:
+                    continue;
+            }
+        }
+        
+                
+        var gi = GI.IRepository.get_default();
+        var ver = gi.get_version(ns);
+        var pth = GI.IRepository.get_search_path ();
+        var gir_path = pth[0].replace(/lib\/girepository-1.0/, 'share\/gir-1.0');
+       //console.log(fn);
+        ret.gir_file = gir_path + '/'+ ns + '-' + ver + '.gir';
+        ret.gir_filename = ns + '-' + ver + '.gir';
+        
+        //console.dump(this.ifaceList);
+        return ret;
+
+    },
+    
+  
+    // store all the interfaces, so we can show a list of them later...
+    // called when you list the namespace
+    clsGatherInterfaces : function(ns, cls)
+    {
+        var gi = GI.IRepository.get_default();
+        var bb = gi.find_by_name(ns, cls);
+        var fullname = ns+'.'+cls;
+        this.ifaceList = this.ifaceList || { };
+         
+        
+        for(var i =0; i < GI.object_info_get_n_interfaces(bb); i++) {
+           
+            var prop = GI.object_info_get_interface(bb,i);
+           
+            var add =  GI.base_info_get_namespace(prop) +'.' + GI.base_info_get_name(prop);
+            this.ifaceList[add] = this.ifaceList[add] || [];
+            if (this.ifaceList[add].indexOf(fullname) < 0) {
+                this.ifaceList[add].push(fullname);
+            }
+             
+        }
+        
+       
+        
+    },
+    
+           
+        
+   
+    doc : function(what) {
+        var ns = what.split('.').shift();
+        this.commentLoad(ns);
+        return typeof(this.comments[ns][what]) == 'undefined' ?  '' : this.comments[ns][what];
+        
+    },
+    
+    
+    
+    comments : {},
+    
+    commentLoad : function(ns)
+    {
+        
+        if (typeof(this.comments[ns]) != 'undefined') {
+            return;
+        }
+        
+        console.log("LOAD DOCS: " + ns);
+        var gi = GI.IRepository.get_default();
+        var ver = gi.get_version(ns);
+        if (!ver) {
+            this.comments[ns] = {};
+            return;
+        }
+        var ret = { };
+        
+        // no idea why this is broken on my build system.
+        var  getAttribute = function(n, name){
+            var properties = n.properties;
+            while (properties){
+                if (properties.name == name)
+                    return properties.children.content;
+                properties = properties.next
+            }
+            return null;
+        }
+                
+        
+        function walk (element, path) {
+            
+            
+            if (!element) {
+                return;
+            }
+            
+            var n =  getAttribute(element, 'name') ;
+            //console.log("WALK" + n);
+            if (element.name == 'signal') {
+                path += '.signal';
+            }
+            
+            if (n) {
+                path += path.length ? '.' : '';
+                path += n;
+            }
+            if (element.name == 'return-value') {
+                path += '.return-value';
+            }
+            
+            var d =   getAttribute(element,'doc');
+            if (d) {
+             //   Seed.print(path + ':' + d);
+                ret[path] = d;
+            }
+            
+            var child = element.children;
+
+            while (child){
+                //console.log(child.tag);
+                if (child.type == "element"){
+                    walk (child, path);
+                }
+                child = child.next;
+            }
+        }
+        
+        var pth = GI.IRepository.get_search_path ();
+        
+        
+        var gir_path = pth[0].replace(/lib\/girepository-1.0/, 'share\/gir-1.0');
+       
+        
+        //console.log(fn);
+        var  fn = gir_path + '/'+ ns + '-' + ver + '.gir';
+       // console.log(fn);
+        
+        if (!GLib.file_test(fn, GLib.FileTest.EXISTS)) {
+            console.log('missing docc file ' + fn);
+            this.comments[ns] = {};
+            
+            return;
+        }
+        var doc = xml.parseFile(fn);
+        //console.log("xmldoc?" + doc);
+        walk (doc.root, '');
+        //console.dump(ret);
+        this.comments[ns] = ret;
+
+    },
+    registry : { },
+    factory : function(type, ns, name) {
+        if (typeof (this.registry[ns +'.' + name]) == 'undefined') {
+            this.registry[ns +'.' + name] = new imports[type][type](ns,name);
+            this.registry[ns +'.' + name].load();
+        }
+        
+        return this.registry[ns +'.' + name];
+    }
+        
+});
+
+
+
diff --git a/Introspect/Property.js b/Introspect/Property.js
new file mode 100644 (file)
index 0000000..832152f
--- /dev/null
@@ -0,0 +1,41 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+
+
+
+XObject     = imports.XObject.XObject;
+console     = imports.console.console;
+NameSpace   = imports.NameSpace.NameSpace;
+
+Basic        = imports.Basic.Basic;
+
+   
+
+
+/**
+ * Property
+ */
+
+Property = XObject.define(
+    function(prop, memberOf, saveto, keylist) {
+        this.propertyType = 'Property';
+        var n_original = GI.base_info_get_name(prop);
+        this.name  =  n_original.replace(/\-/g, '_') ,
+        this.type  = this.typeToName(GI.property_info_get_type(prop)),
+        this.flags =  GI.property_info_get_flags(prop),
+        this.memberOf = memberOf.alias
+        memberOf[saveto].push(this);
+        keylist.push(this.name);
+        this.desc = NameSpace.doc(this.memberOf + '.' + n_original);
+        
+
+        if (typeof(this.type) == 'string' && this.type.indexOf('.') > -1) {
+        
+            NameSpace.references[this.type] = NameSpace.references[this.type] || [];
+            NameSpace.references[this.type].push(this);
+        }
+        
+    },
+    Basic
+);
diff --git a/Introspect/Signal.js b/Introspect/Signal.js
new file mode 100644 (file)
index 0000000..9524512
--- /dev/null
@@ -0,0 +1,68 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+
+XObject     = imports.XObject.XObject;
+console     = imports.console.console;
+NameSpace   = imports.NameSpace.NameSpace;
+
+Basic        = imports.Basic.Basic;
+
+  
+
+Signal = XObject.define(
+    function(sig, memberOf, saveto, keylist) {
+
+        this.propertyType  = 'Signal';
+        
+        var params = this.argsToArrays(sig);
+        // add a reference to self...
+        params.unshift({
+            name : 'self',
+            type : memberOf.alias,
+            direction : 'in',
+            be_null :  false
+                
+        });
+        var n_original  = GI.base_info_get_name(sig);
+        
+        XObject.extend(this,{
+            name : n_original.replace(/-/g,'_'),
+            params : params,
+            memberOf : memberOf.alias,
+            exceptions : [],
+            returns :   [ { type :  this.typeToName(GI.callable_info_get_return_type(sig)) } ],
+            desc : NameSpace.doc(memberOf.alias + '.signal.' + n_original)
+        });
+        memberOf[saveto].push(this);
+        keylist.push(this.name);
+        
+        var addedto = [ memberOf.alias ]; // do not add to self...
+       
+        for(var i =1; i < params.length;i++) {
+            var ty = params[i].type;
+            if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
+                continue;
+            }
+            if (addedto.indexOf(ty) > -1) {
+                continue;
+            }
+            
+            
+            
+            NameSpace.references[ty] = NameSpace.references[ty] || [];
+            NameSpace.references[ty].push(this);
+            addedto.push(ty);
+        }
+        
+        
+        
+        
+        
+    },
+    Basic
+);
+
+
+
diff --git a/Introspect/Struct.js b/Introspect/Struct.js
new file mode 100644 (file)
index 0000000..a3a72dc
--- /dev/null
@@ -0,0 +1,64 @@
+//<script type="text/javascript">
+
+GI      = imports.gi.GIRepository;
+
+
+
+XObject     = imports.XObject.XObject;
+console     = imports.console.console;
+NameSpace   = imports.NameSpace.NameSpace;
+
+Base        = imports.Base.Base;
+
+/**
+ * Struct
+ */
+
+Struct = XObject.define(
+    function(ns, name) {
+        Base.call(this, ns, name);
+       
+    },
+
+    Base, 
+    {
+        titleType: 'Struct',
+        
+        _loaded : false,
+        load : function()
+        {
+            if (this._loaded) {
+                return; // already loaded..
+            }
+            // my props..
+            var props = [];
+            this.genericBuildList('struct', 'field', props, 'properties');
+            
+            var methods = [];
+            
+            
+            if (GI.struct_info_get_size (this.getBI()) > 0 ) {
+               
+            
+                
+                this.constructors.push({
+                    name : '',
+                    params: [],
+                    returns :  [],
+                    isConstructor : true,
+                    isStatic : false,
+                    memberOf : this.alias,
+                    exceptions : [],
+                    desc : ''
+                });
+            }
+            
+            this.genericBuildList('struct', 'method', methods, 'methods');
+              
+            this._loaded  = true;
+        },
+         
+
+});
\ No newline at end of file
diff --git a/Introspect/Union.js b/Introspect/Union.js
new file mode 100644 (file)
index 0000000..723a756
--- /dev/null
@@ -0,0 +1,58 @@
+//<script type="text/javascript">
+
+GI      = imports.gi.GIRepository;
+
+
+
+XObject     = imports.XObject.XObject;
+console     = imports.console.console;
+Base        = imports.Base.Base;
+
+  
+   
+
+/**
+ * Union
+ */
+Union = XObject.define(
+    function(ns, name) {
+        Base.call(this, ns, name);
+       
+    }, 
+    Base, 
+    {
+        titleType: 'Union',
+        _loaded : false,
+        load : function()
+        {
+            if (this._loaded) {
+                return; // already loaded..
+            }
+            // my props..
+            var props = [];
+            this.genericBuildList('union', 'field', props, 'properties');
+            
+            if (GI.union_info_get_size (this.getBI()) > 0 ) { 
+                
+                this.constructors.push({
+                    name : '',
+                    params: [],
+                    returns :  [],
+                    isConstructor : true,
+                    isStatic : false,
+                    memberOf : this.alias,
+                    exceptions : [],
+                    desc : ''
+                });
+            }
+            var methods = [];
+            this.genericBuildList('union', 'method', methods, 'methods');
+              
+            this._loaded  = true;
+        }
+         
+
+});
\ No newline at end of file
diff --git a/Introspect/extensions/xml.js b/Introspect/extensions/xml.js
new file mode 100644 (file)
index 0000000..f4249f2
--- /dev/null
@@ -0,0 +1,90 @@
+//<script type="text/javascript"> 
+/**
+* @class xml.XMLNode
+* Xml node 
+* @noconstructor
+* 
+* @cfg {String} name Name of Node ???
+* @cfg {XMLNode} children First child (use next property to iterate children
+* @cfg {XMLNode} parent Parent node of this one
+* @cfg {XMLNode} next Next sibling
+* @cfg {XMLNode} prev Previous sibling
+* @cfg {String} Text contents of Node
+* @cfg {XMLNode} last Last Sibling? or last child - FIXME
+* @cfg {String} type - Type of node : element, attribute, text
+* @cfg {XMLAttribute} properties First Attribute of node
+*/
+XMLNode = function() {}
+
+Roo.apply(XMLNode.prototype, {
+    
+});
+
+
+/**
+* @class xml.XMLDocument
+* Xml document 
+* @noconstructor
+* 
+* @cfg {String} name Name of Node ???
+* @cfg {XMLNode} children First child (use next property to iterate children
+* @cfg {XMLNode} parent Parent node of this one
+* @cfg {XMLNode} next Next sibling
+* @cfg {XMLNode} prev Previous sibling
+* @cfg {String} Text contents of Node
+* @cfg {XMLNode} last Last Sibling? or last child - FIXME
+* @cfg {String} type - Type of node : element, attribute, text
+* @cfg {XMLAttribute} properties First Attribute of node
+* @cfg {XMLNode} root Root node of document.
+*/
+
+
+XMLDocument  = function () { };
+
+Roo.extend(XMLDocument, XMLNode, {
+    root : { }, 
+});
+
+
+/**
+* Create a new xpath context ?
+* @param {Object} .....
+* @return {XMLNode} returns obj
+* @member XMLDocument xpathNewContext
+*/
+
+XMLDocument.xpathNewContext = function() { }
+
+
+
+
+   
+XMLAttribute  = function () { };
+   
+Roo.extend(XMLAttribute, XMLNode, {   
+
+});
+
+XMLXPathContext  = function() { };
+Roo.apply(XMLXPathContext.prototype, {
+    value : '',
+});
+
+XMLXPathContext.xpathEval = function () {} 
+XMLXPathContext.xpathRegisterNs = function () {} 
+
+
+XMLXPathObj = function() { };
+Roo.apply(XMLXPathObj.prototype, {
+    value : '',
+});
+
+
+
+parseFile = function () { }
+parseString = function () { }
+_nodeProto = { }
+   
+  
\ No newline at end of file