SEPARATOR : '/',
+ // fixme - this needs a bitter location..
+ // they where in a string class before, but overriding String methods is not a good normally a good idea..
+
+ rtrim : function (s,toTrim) {
+ if (s.substr(s.length - toTrim.length) == toTrim) {
+ return s.slice(0, s.length - toTrim.length);
+ }
+
+ return s;
+ },
+ trim : function (s,toTrim) {
+ var out = this.ltrim(s,toTrim);
+ out = this.rtrim(out,toTrim);
+ return out;
+ },
+
+ ltrim : function (s, toTrim) {
+ if (s.substr(0, toTrim.length) == toTrim) {
+ return s.slice(toTrim.length);
+ }
+
+ return s;
+ },
+
join : function () {
var out = "";
for (var i = 0; i < arguments.length; i++) {
if (i == 0) {
- out += arguments[i].rtrim(File.SEPARATOR);
+ out += this.rtrim(arguments[i], File.SEPARATOR);
}
else if (i == arguments.length - 1) {
- out += File.SEPARATOR + arguments[i].ltrim(File.SEPARATOR);
+ out += File.SEPARATOR + this.ltrim(arguments[i], File.SEPARATOR);
}
else {
- out += File.SEPARATOR + arguments[i].trim(File.SEPARATOR);
+ out += File.SEPARATOR + this.trim(arguments[i], File.SEPARATOR);
}
}
return out;
- },
-
+ },
read : function (path) {
var out = {};
GLib.file_get_contents(path, out, null, null);
this.desc = NameSpace.doc(this.alias );
- var gi = GI.IRepository.get_default();
+ var gi = GI.Repository.get_default();
var ver = gi.get_version(ns);
- var pth = GI.IRepository.get_search_path ();
+ var pth = GI.Repository.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,
{
getBI : function() {
- var gi = GI.IRepository.get_default();
+ var gi = GI.Repository.get_default();
return gi.find_by_name(this.ns, this.name);
},
// on, getwhat, simple list (name), variable to add to.
// 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) {
+ if (atype == GI.TypeTag.UINT8) {
return 'utf8';
}
}
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) {
+ if (interface_type == GI.InfoType.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);
+ ret.alias = interface_info.get_namespace() + '.' + interface_info.get_name();
return ret;
}
- return GI.base_info_get_namespace(interface_info) + '.' + GI.base_info_get_name(interface_info);
+ return interface_info.get_namespace() + '.' + interface_info.get_name();
},
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),
+ name : arg.get_name(),
+ ns : arg.get_namespace(),
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') || ''
+ desc : arg.get_attribute('doc') || ''
};
*/
XObject.extend(this,{
- name : GI.base_info_get_name(sig),
+ name : sig.get_name(),
params : params,
//memberOf : memberOf.alias,
exceptions : [],
Class = XObject.define(
function(ns, name) {
Base.call(this, ns, name);
+ print("Class ctr - parent called");
this.loadExtends();
this.loadImplements();
//console.log("CREATED(Class) " + this.alias);
var pi = GI.object_info_get_parent(bi);
this.extendsClasses = [];
- if (!pi) {
+ if (!pi || (pi.get_namespace() == this.ns && pi.get_name() == this.name )) {
return;
- }
+ }
this.parent = NameSpace.factory(
'Class',
- GI.base_info_get_namespace(pi),
- GI.base_info_get_name(pi)
+ pi.get_namespace(),
+ pi.get_name()
);
this.extendsClasses = [ this.parent ];
this.extendsClasses.push(p);
},this);
+ if (this.parent) {
+ this.parent.addChildClass(this.alias);
+ }
},
+
+ addChildClass : function (n) {
+ this.childClasses.push(n);
+ if (this.parent) {
+ this.parent.addChildClass(n);
+ }
+ },
+
+
loadImplements : function()
{
var bb = this.getBI();
var iface = NameSpace.factory(
'Interface',
- GI.base_info_get_namespace(prop) , GI.base_info_get_name(prop)
+ prop.get_namespace() , prop.get_name()
);
Constant = XObject.define(
function(prop, memberOf, saveto, keylist) {
- this.name = GI.base_info_get_name(prop);
+ this.name = prop.get_name();
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.values.push({
- name : GI.base_info_get_name(prop).toUpperCase() ,
+ name : prop.get_name().toUpperCase() ,
type : GI.type_tag_to_string(GI.enum_info_get_storage_type(bi)),
value: GI.value_info_get_value(prop) ,
memberOf : this.alias
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
+ this.name = prop.get_name() ;
+ 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);
this.propertyType = 'Method';
var flags = GI.function_info_get_flags (m);
- var n = GI.base_info_get_name(m);
+ var n = m.get_name();
var n_original = n + '';
// posibly add: sink,
if (n.match(/_(ref|unref)$/) || n.match(/^(ref|unref|weakref|weakunref)$/)) {
name : n,
params: args,
returns : retval,
- isConstructor : flags & GI.IFunctionInfoFlags.IS_CONSTRUCTOR,
- isStatic : !(flags & GI.IFunctionInfoFlags.IS_METHOD),
+ isConstructor : flags & GI.FunctionInfoFlags.IS_CONSTRUCTOR,
+ isStatic : !(flags & GI.FunctionInfoFlags.IS_METHOD),
memberOf : memberOf.alias,
exceptions : [],
desc : NameSpace.doc(memberOf.alias + '.' + n_original)
GI = imports.gi.GIRepository;
GLib = imports.gi.GLib;
xml = imports.libxml;
-
+File = imports.File.File;
XObject = imports.XObject.XObject;
console = imports.console.console;
-
+// BC/FC
+if (!GI.Repository) {
+ GI.Repository = GI.IRepository;
+ GI.FunctionInfoFlags = GI.IFunctionInfoFlags ;
+ GI.InfoType = GI.IInfoType;
+ GI.TypeTag= GI.ITypeTag;
+
+ GI.IBaseInfo.prototype.get_name = function(n) {
+ return GI.base_info_get_name(this, n);
+ }
+ GI.IBaseInfo.prototype.get_namespace = function(n) {
+ return GI.base_info_get_namespace(this, n);
+ }
+ GI.IBaseInfo.prototype.get_attribute = function( n) {
+ return GI.base_info_get_attribute(this, n);
+ }
+}
+
+
NameSpace = {
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;
+ File.list(dir).forEach(function(fn)
+ {
+ if (!fn.match(/\.typelib$/)) {
+ return;
}
var par = fn.split('-').shift();
//console.log('trying ' + par);
if (ret.indexOf(par) > -1) {
- continue;
+ return;
}
ret.push(par);
-
-
- }
+ });
}
- var gi = GI.IRepository.get_default();
- var pth = GI.IRepository.get_search_path ();
+
+ var gi = GI.Repository.get_default();
+ var pth = GI.Repository.get_search_path();
scanGir(pth[0]);
ret.sort();
ns: function(ns) {
- var gi = GI.IRepository.get_default();
+ var gi = GI.Repository.get_default();
ret = {
titleType: 'Namespace',
ns: ns,
for (var i=0; i < gi.get_n_infos (ns); i++ ) {
var info = gi.get_info (ns, i);
-
+ // print("NAME: " + info.get_name());
+ //continue;
var info_type = GI.base_info_get_type (info);
+ // print("Type: " + info_type);
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));
+ case GI.InfoType.OBJECT:
+ ret.objects.push(info.get_name());
+ this.clsGatherInterfaces(ns , info.get_name());
continue;
- case GI.IInfoType.INTERFACE:
- ret.interfaces.push(GI.base_info_get_name(info));
+ case GI.InfoType.INTERFACE:
+ ret.interfaces.push(info.get_name());
continue;
- case GI.IInfoType.FUNCTION:
+ case GI.InfoType.FUNCTION:
new imports.Method.Method(info, ret, 'functions', []);
continue;
- case GI.IInfoType.CALLBACK:
+ case GI.InfoType.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));
+ case GI.InfoType.ENUM:
+ case GI.InfoType.FLAGS:
+ ret.enums.push(info.get_name());
continue;
- case GI.IInfoType.STRUCT:
+ case GI.InfoType.STRUCT:
if (GI.struct_info_is_gtype_struct (info)) {
continue;
}
- ret.structs.push(GI.base_info_get_name(info));
+ ret.structs.push(info.get_name());
continue;
- case GI.IInfoType.UNION:
- ret.unions.push(GI.base_info_get_name(info));
+ case GI.InfoType.UNION:
+ ret.unions.push(info.get_name());
continue;
- case GI.IInfoType.CONSTANT:
+ case GI.InfoType.CONSTANT:
new imports.Constant.Constant(info, ret, 'values', []);
continue;
continue;
}
}
-
+ //print ("SCAN NAMESPACES ALL DONE");
- var gi = GI.IRepository.get_default();
+ var gi = GI.Repository.get_default();
var ver = gi.get_version(ns);
- var pth = GI.IRepository.get_search_path ();
+ var pth = GI.Repository.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';
},
-
+
// 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();
+ // print("clsGatherInterfaces: " + ns + ", " + cls);
+ var gi = GI.Repository.get_default();
var bb = gi.find_by_name(ns, cls);
var fullname = ns+'.'+cls;
this.ifaceList = this.ifaceList || { };
var prop = GI.object_info_get_interface(bb,i);
- var add = GI.base_info_get_namespace(prop) +'.' + GI.base_info_get_name(prop);
+ var add = prop.get_namespace() +'.' + prop.get_name();
this.ifaceList[add] = this.ifaceList[add] || [];
if (this.ifaceList[add].indexOf(fullname) < 0) {
this.ifaceList[add].push(fullname);
doc : function(what) {
+ //print ("DOC: + " +what);
var ns = what.split('.').shift();
+ return '';
this.commentLoad(ns);
return typeof(this.comments[ns][what]) == 'undefined' ? '' : this.comments[ns][what];
}
console.log("LOAD DOCS: " + ns);
- var gi = GI.IRepository.get_default();
+ var gi = GI.Repository.get_default();
var ver = gi.get_version(ns);
if (!ver) {
this.comments[ns] = {};
}
}
- var pth = GI.IRepository.get_search_path ();
+ var pth = GI.Repository.get_search_path ();
var gir_path = pth[0].replace(/lib\/girepository-1.0/, 'share\/gir-1.0');
Property = XObject.define(
function(prop, memberOf, saveto, keylist) {
this.propertyType = 'Property';
- var n_original = GI.base_info_get_name(prop);
+ var n_original = prop.get_name();
this.name = n_original.replace(/\-/g, '_') ,
this.type = this.typeToName(GI.property_info_get_type(prop)),
this.flags = GI.property_info_get_flags(prop),
be_null : false
});
- var n_original = GI.base_info_get_name(sig);
+ var n_original = sig.get_name();
XObject.extend(this,{
name : n_original.replace(/-/g,'_'),
throw "No Files";
}
-
+ var link = false;
+ if (cfg.autoBuild) {
+
+ function dateString(d){
+ function pad(n){return n<10 ? '0'+n : n}
+ return d.getFullYear() +
+ pad(d.getMonth()+1)+
+ pad(d.getDate())+'_'+
+ pad(d.getHours())+
+ pad(d.getMinutes())+
+ pad(d.getSeconds());
+ }
+
+
+
+ var version = 0;
+ this.files.forEach(function(f) {
+ version = Math.max(File.mtime(f), version);
+ });
+ var version = dateString(new Date(version));
+
+ var dirname = GLib.path_get_dirname(this.files[0]);
+ var outname = this.module ? this.module : GLib.path_get_basename(dirname);
+ this.target = dirname + '/compiled/' + outname + '-' + version + '.js';
+ if (File.exists(this.target)) {
+ print("Target file already exists: " + this.target);
+ Seed.quit();
+ }
+ this.prefix = dirname +'/';
+ this.translateJSON = dirname + '/compiled/_translation_.js';
+
+ }
+
+ print(this.translateJSON);
this.timer = new Date() * 1;
this.packAll();
+
+
}
Packer.prototype = {
ns_list = Seed.argv[3].split(',');
}
+
ns_list = ns_list.sort();
+// let's try and load them, so we find out early what will fail.
+print("loading library to make sure it works.");
+ns_list.forEach(function(ns_name)
+{
+ var core = imports.gi[ns_name];
+});
+
// which languages do we want to output for.
var reference_template = new Template(__script_path__ + '/templates/references.html');
*/
-
+print("Looping throught namespaces");
var ns_idx = [];
ns_list.forEach(function(ns_name)
{
'enums' : 'Enum'
};
+
for (var i in actions) {
// we flag GLib as a GObject lib...
idx[i]= ns_name == 'GLib' ? 1 : ns[i].length ;
+
ns[i].forEach( function(n) {
+
+ print('NameSpace.factory(' + actions[i] +','+ns_name+','+n);
var odata = XObject.extend(
NameSpace.factory(actions[i], ns_name, n),
{ 'left_bar' :ns['left_bar'] }
);
+
langs.forEach(function(lang) {
Gio.simple_write(outputdir + '/'+ lang.name + '/' + ns_name + '.' + n + '.html',
lang.cls_template.process(odata)
continue;
}
- refs = langs.reference_template.process(NameSpace.references[i]);
+ refs = lang.reference_template.process(NameSpace.references[i]);
// HTML to put refs into
html = File.read(html_file_path);
Gio.simple_write(outputdir + '/' + lang.name + '/index.html', ix_template.process(ns_idx));
File.silentRecursiveCopy(__script_path__ + '/templates/resources/',
outputdir + '/' + lang.name , Gio.FileCopyFlags.OVERWRITE);
-});
\ No newline at end of file
+});
}
return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];
+ },
+ vis : '',
+ toggle : function()
+ {
+ this.vis = this.vis == '' ? 'none' : '';
+ var vis = this.vis;
+ // new browsers only...
+ Array.prototype.slice.call(
+ document.getElementsByClassName('expandable')
+ ).forEach(function(e) {
+ if (!e.className.match(/notInherited/)) {
+ e.style.display= vis;
+ }
+ })
}
-
}
<title>JsDoc Reference - {+data.name+}</title>
<script type="text/javascript" src="page.js"></script>
-
+ c
<link rel="stylesheet" type="text/css" href="default.css" />
<link rel="stylesheet" type="text/css" href="library_gnome.css"></link>
<link media="print" rel="stylesheet" type="text/css" href="library_gnome_print.css"></link>
</if>
<tr>
<td class="label">GIR File:</td>
- <td class="hd-info"><a href="{+data.gir_filename+}">{+data.gir_filename+}</a></td>
+ <td class="hd-info"><a href="../{+data.gir_filename+}">{+data.gir_filename+}</a></td>
</tr>
<tr>
<td class="label">C documentation:</td>