--- /dev/null
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+Pango = imports.gi.Pango;
+GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
+GObject = imports.gi.GObject;
+GtkSource = imports.gi.GtkSource;
+WebKit = imports.gi.WebKit;
+Vte = imports.gi.Vte;
+console = imports.console;
+XObject = imports.XObject.XObject;
+Editor=new XObject({
+ xtype: Gtk.Window,
+ listeners : {
+ delete_event : function (self, event) {
+ if (!this.get('/Editor.RightEditor').save()) {
+ // no hiding with errors.
+ return true;
+ }
+ this.el.hide();
+ this.get('/Editor').activePath = false;
+ return true;
+ },
+ configure_event : function (self, object) {
+ this.pos = this.el.get_position();
+
+
+ return false;
+ },
+ show : function (self) {
+ if (this.pos) {
+ this.el.set_uposition(this.pos.root_x,this.pos.root_y);
+ }
+ }
+ },
+ height_request : 300,
+ id : "EditorWindow",
+ title : "Application Builder - Editor",
+ width_request : 500,
+ save : function (self, event) {
+ if (!this.get('/Editor.RightEditor').save()) {
+ // no hiding with errors.
+ return true;
+ }
+ this.get('/Editor').activePath = false;
+ this.el.hide();
+ return true;
+ },
+ init : function() {
+ XObject.prototype.init.call(this);
+ // this.show_all();
+ },
+ items : [
+ {
+ xtype: Gtk.VBox,
+ pack : "add",
+ items : [
+ {
+ xtype: Gtk.Toolbar,
+ pack : "pack_start,false,true",
+ items : [
+ {
+ xtype: Gtk.Button,
+ listeners : {
+ clicked : function (self) {
+
+ this.get('/Editor.RightEditor').save();
+ }
+ },
+ id : "save_button",
+ label : "Save"
+ }
+ ]
+ },
+ {
+ xtype: Gtk.ScrolledWindow,
+ id : "RightEditor",
+ pack : "add",
+ save : function() {
+ // make sure we have an active path..
+ if (!this.get('/Editor').activePath) {
+ return true;
+ }
+
+ var str = this.get('/Editor.buffer').toString();
+ if (!this.get('/Editor.buffer').checkSyntax()) {
+ this.get('/StandardErrorDialog').show("Fix errors in code and save..");
+ return false;
+ }
+
+ this.get('/LeftPanel.model').changed( str , false);
+ this.get('/Editor').dirty = false;
+ this.get('/Editor.save_button').el.sensitive = false;
+ return true;
+ },
+ items : [
+ {
+ xtype: GtkSource.View,
+ listeners : {
+ key_release_event : function (self, event) {
+
+ if (event.key.keyval == 115 && (event.key.state & Gdk.ModifierType.CONTROL_MASK ) ) {
+ print("SAVE: ctrl-S pressed");
+ this.save();
+ return false;
+ }
+ // print(event.key.keyval)
+
+ return false;
+ }
+ },
+ id : "view",
+ indent_width : 4,
+ pack : "add",
+ auto_indent : true,
+ init : function() {
+ XObject.prototype.init.call(this);
+ var description = Pango.Font.description_from_string("monospace")
+ description.set_size(8000);
+ this.el.modify_font(description);
+
+ },
+ insert_spaces_instead_of_tabs : true,
+ load : function(str) {
+
+ // show the help page for the active node..
+ //this.get('/Help').show();
+
+
+ // this.get('/BottomPane').el.set_current_page(0);
+ this.el.get_buffer().set_text(str, str.length);
+ var lm = GtkSource.LanguageManager.get_default();
+
+ this.el.get_buffer().set_language(lm.get_language('js'));
+ var buf = this.el.get_buffer();
+ var cursor = buf.get_mark("insert");
+ var iter= new Gtk.TextIter;
+ buf.get_iter_at_mark(iter, cursor);
+ iter.set_line(1);
+ iter.set_line_offset(4);
+ buf.move_mark(cursor, iter);
+
+
+ cursor = buf.get_mark("selection_bound");
+ iter= new Gtk.TextIter;
+ buf.get_iter_at_mark(iter, cursor);
+ iter.set_line(1);
+ iter.set_line_offset(4);
+ buf.move_mark(cursor, iter);
+ this.get('/Editor').dirty = false;
+ this.el.grab_focus();
+ this.get('/Editor.save_button').el.sensitive = false;
+ },
+ save : function() {
+
+ return this.get('/Editor.RightEditor').save();
+ },
+ show_line_numbers : true,
+ items : [
+ {
+ xtype: GtkSource.Buffer,
+ listeners : {
+ changed : function (self) {
+
+ if(this.checkSyntax()) {
+ this.get('/Editor.save_button').el.sensitive = true;
+ }
+ // print("EDITOR CHANGED");
+ this.get('/Editor').dirty = true;
+
+ // this.get('/LeftPanel.model').changed( str , false);
+ return false;
+ }
+ },
+ id : "buffer",
+ pack : "set_buffer",
+ checkSyntax : function() {
+ var str = this.toString();
+ var res = '';
+ try {
+ // print('var res = ' + str);
+ Seed.check_syntax('var res = ' + str);
+
+
+ } catch (e) {
+
+ this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
+ red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
+ }));
+ print("SYNTAX ERROR IN EDITOR");
+ print(e);
+ // print(str);
+ //console.dump(e);
+ return false;
+ }
+ this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
+ red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
+ }));
+
+ return true;
+ },
+ toString : function() {
+
+ var s = new Gtk.TextIter();
+ var e = new Gtk.TextIter();
+ this.el.get_start_iter(s);
+ this.el.get_end_iter(e);
+ var ret = this.el.get_text(s,e,true);
+ //print("TO STRING? " + ret);
+ return ret;
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+});
+Editor.init();
+XObject.cache['/Editor'] = Editor;
--- /dev/null
+//<Script type="text/javascript">
+
+Gio = imports.gi.Gio;
+GLib = imports.gi.GLib;
+
+XObject = imports.XObject.XObject;
+File = imports.File.File;
+
+//----------------------- our roo verison
+Base = imports.JsRender.Base.Base;
+
+var gid = 1;
+
+Gtk = XObject.define(
+
+
+ function(cfg) {
+
+ // id ,
+ //"name":"Edit Module Details",
+ // items :
+ //"btype":"FORM", // was to be components...
+ //"app":"Builder",
+ //"module":"Pman.Tab.BuilderTop2"
+ //console.dump(cfg);
+ cfg.parent = cfg.parent || '';
+ if (!cfg.name || !cfg.fullname ) {
+
+ // name is in theory filename without .bjs (or .js eventually...)
+ cfg.name = cfg.path.split('/').pop().replace(/\.(bjs|js)$/, '');
+
+ cfg.fullname = (cfg.parent.length ? (cfg.parent + '.') : '' ) + cfg.name;
+ }
+
+
+ this.items = false;
+ if (cfg.json) {
+ var jstr = JSON.parse(cfg.json);
+ this.items = [ jstr ];
+ //console.log(cfg.items.length);
+ delete cfg.json; // not needed!
+ }
+ this.cn = [];
+ /*
+ var p = cfg.items && cfg.items.length && cfg.items[0].parent ? cfg.items[0].parent : false;
+
+ // ensure real data is set...
+ Roo.apply(this, {
+ name : cfg.module,
+ parent : p,
+ title : cfg.name,
+ project : cfg.app
+
+ });
+
+ this.cn = [];
+ */
+ Gtk.superclass.constructor.call(this, cfg);
+
+
+ // super?!?!
+ this.id = 'file-gtk-' + gid++;
+ //console.dump(this);
+ // various loader methods..
+
+ },
+ Base,
+ {
+ xtype : 'Gtk',
+ setNSID : function(id)
+ {
+
+ this.items[0]['*class'] = id;
+
+
+ },
+ getType: function() {
+ return 'Gtk';
+ },
+
+ loadItems : function(cb)
+ {
+
+ print("load Items!");
+ if (this.items !== false) {
+ return false;
+ }
+ if (!cb) {
+ throw {
+ name: "ArgumentError",
+ message : "no callback for loadItems"
+ };
+ }
+ Seed.print("load: " + this.path);
+
+
+
+
+ var _this = this;
+ var src = File.read(this.path);
+
+ var cfg = JSON.parse(src);
+ print("loaded data");
+ //console.dump(cfg);
+
+ //_this.name = cfg.name; -- this should not happen - name should always match filename!!
+ _this.parent = cfg.parent;
+ _this.title = cfg.title;
+ _this.items = cfg.items || [];
+
+ cb();
+
+
+
+
+
+ },
+ /**
+ * convert xtype for munged output..
+ *
+ */
+ mungeXtype : function(xtype, els)
+ {
+ els.push('xtype: '+ xtype);
+ },
+
+ toSource : function()
+ {
+
+ if (!this.items[0]) {
+ return false;
+ }
+ var data = JSON.parse(JSON.stringify(this.items[0]));
+ // we should base this on the objects in the tree really..
+ var i = [ 'Gtk', 'Gdk', 'Pango', 'GLib', 'Gio', 'GObject',
+ 'GtkSource', 'WebKit', 'Vte' ]; //, 'GtkClutter' , 'Gdl'];
+ var src = "";
+ i.forEach(function(e) {
+ src += e+" = imports.gi." + e +";\n";
+ });
+
+ src += "console = imports.console;\n"; // path?!!?
+ src += "XObject = imports.XObject.XObject;\n"; // path?!!?
+
+
+ src += this.name + '=new XObject('+ this.mungeToString(data) + ");\n";
+ src += this.name + '.init();\n';
+ // register it in the cache
+ src += "XObject.cache['/" + this.name + "'] = " + this.name + ";\n";
+
+
+ return src;
+
+
+ },
+ save : function() {
+ Base.prototype.save.call(this);
+ this.saveJS();
+ },
+
+ /**
+ * saveJS
+ *
+ * save as a javascript file.
+ * why is this not save...???
+ *
+ *
+ */
+ saveJS: function()
+ {
+
+ var fn = GLib.path_get_dirname(this.path) + '/' + this.name + '.js';
+ print("WRITE : " + fn);
+ File.write(fn, this.toSource());
+
+ return fn;
+ },
+ /*
+ getTree : function( o ) {
+
+
+
+ }
+ */
+ getHelpUrl : function(cls)
+ {
+ return 'http://devel.akbkhome.com/seed/' + cls + '.html';
+ }
+
+ });
\ No newline at end of file
--- /dev/null
+//<Script type="text/javascript">
+
+Gio = imports.gi.Gio;
+GIRepository = imports.gi.GIRepository;
+xml = imports.libxml;
+console = imports.console;
+XObject = imports.XObject.XObject;
+
+Base = imports.Palete.Base.Base;
+File = imports.File.File;
+//----------------------- our roo verison
+
+
+
+
+Gtk = XObject.define(
+ function(cfg) {
+
+
+ // various loader methods..
+ this.map = [];
+ this.load();
+ this.proplist = {};
+ this.comments = { };
+ // no parent...
+
+
+ },
+ Base,
+ {
+ name : 'Gtk',
+
+ load: function () {
+
+
+
+ var data = File.read(__script_path__ +'/GtkUsage.txt');
+ // print(data);
+ data = data.split(/\n/g);
+ var state = 0;
+ var cfg = [];
+ var left = [];
+ var right = [];
+
+ data.forEach( function(d) {
+ if (!d.length || d.match(/^\s+$/) || d.match(/^\s*\//)) { //empty
+ return;
+ }
+ if (d.match(/^left:/)) {
+ state = 1;
+ if (left.length ){
+
+ cfg.push({
+ left : left,
+ right: right
+ });
+ }
+ left = [];
+ right = [];
+ return;
+ }
+ if (d.match(/^right:/)) {
+ state = 2;
+ return;
+ }
+ if (state == 1) {
+ left.push(d.replace(/\s+/g, ''));
+ return;
+ }
+ right.push(d.replace(/\s+/g, ''));
+ //Seed.quit();
+
+ });
+ if (left.length ){
+
+ cfg.push({
+ left : left,
+ right: right
+ });
+ }
+ this.map = cfg;
+
+ },
+
+
+ commentLoad : function(ns)
+ {
+
+ if (typeof(this.comments[ns]) != 'undefined') {
+ return;
+ }
+
+ console.log("LOAD DOCS: " + ns);
+ var gi = GIRepository.Repository.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.
+ function getAttribute(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 = GIRepository.Repository.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 (!File.exists(fn)) {
+ 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;
+ //console.dump(ret);
+
+ },
+
+
+ doc : function(what) {
+ var ns = what.split('.').shift();
+ this.commentLoad(ns);
+ return typeof(this.comments[ns][what]) == 'undefined' ? '' : this.comments[ns][what];
+ },
+
+ getPropertiesFor: function(ename, type)
+ {
+ print("Loading for " + ename);
+
+ if (typeof(this.proplist[ename]) != 'undefined') {
+ print("using cache");
+ return this.proplist[ename][type];
+ }
+ // use introspection to get lists..
+ var gi = GIRepository.Repository.get_default();
+ var es = ename.split('.');
+
+ imports.gi[es[0]];
+ var bi = gi.find_by_name(es[0], es[1]);
+
+ if (!bi) {
+ print("COULND NOT FIND BY NAME");
+ return [];
+ }
+ var etype = GIRepository.base_info_get_type(bi);
+ var meth = etype == GIRepository.InfoType.INTERFACE ?
+ [
+ 'interface_info_get_n_properties',
+ 'interface_info_get_property',
+ 'interface_info_get_n_signals',
+ 'interface_info_get_signal',
+ 'interface_info_get_n_methods',
+ 'interface_info_get_method'
+ ] : [
+ 'object_info_get_n_properties',
+ 'object_info_get_property',
+ 'object_info_get_n_signals',
+ 'object_info_get_signal',
+ 'object_info_get_n_methods',
+ 'object_info_get_method'
+ ];
+
+
+ this.proplist[ename] = {}
+ this.proplist[ename]['props'] = [];
+ this.proplist[ename]['events'] = [];
+ this.proplist[ename]['methods'] = [];
+ this.proplist[ename]['inherits']= [];
+
+ var plist = this.proplist[ename]['props'] ;
+ var elist = this.proplist[ename]['events'];
+ var mlist = this.proplist[ename]['methods'];
+ var ilist = this.proplist[ename]['inherits'];
+ /*
+ we need...
+ p.name
+ p.type
+ p.desc
+ p.sig */
+
+ // properties.. -- and parent ones...!!!
+ for (var i =0;i < GIRepository[meth[0]](bi); i++) {
+ var prop = GIRepository[meth[1]](bi,i);
+ var n_original = prop.get_name();
+
+ var flags = GIRepository.property_info_get_flags(prop); // check for readonly..
+
+
+ var ty = this.typeToName(GIRepository.property_info_get_type(prop));
+ print (n_original +":"+ ty);
+ if (ty === false) {
+ continue;
+ }
+ var add = {
+ name : n_original.replace(/\-/g, '_'),
+ type : ty,
+ desc : this.doc(ename + '.' + n_original),
+ sig : ''
+ }
+ plist.push(add)
+ }
+
+
+
+
+
+ // signals..
+
+ for (var i =0;i < GIRepository[meth[2]](bi); i++) {
+ var prop =GIRepository[meth[3]](bi,i);
+ var n_original = prop.get_name();
+ // print ('signal: ' + n_original);
+ var add = {
+ name : n_original.replace(/\-/g, '_'),
+ type : 'function', //???
+ desc : this.doc(ename + '.signal.' + n_original),
+ sig : this.genSkel(prop) // fixme..
+ }
+ elist.push(add);
+ }
+ // methods
+
+ for (var i =0;i < GIRepository[meth[4]](bi); i++) {
+ var prop = GIRepository[meth[5]](bi,i);
+ var n_original = prop.get_name();
+ print(ename +": ADD : " + n_original );
+ var flags = GIRepository.property_info_get_flags(prop);
+ if (flags & GIRepository.FunctionInfoFlags.IS_CONSTRUCTOR) {
+ continue;
+ }
+ if (!(flags & GIRepository.FunctionInfoFlags.IS_METHOD)) {
+ continue;
+ }
+ // print ('signal: ' + n_original);
+ var add = {
+ name : n_original.replace(/\-/g, '_'),
+ type : 'function', //???
+ desc : this.doc(ename + '.signal.' + n_original)
+ };
+ this.genParams(prop,add);
+ mlist.push(add);
+ }
+
+
+
+
+
+
+ if (etype == GIRepository.InfoType.INTERFACE ) {
+ // print("SKIPPING PARENT - it's an interface?!?!");
+ return;
+ }
+
+ // parent!!?!!?
+ var pi = GIRepository.object_info_get_parent(bi);
+
+ if (pi) {
+
+
+ var pname = pi.get_namespace() + '.' + pi.get_name();
+ this.getPropertiesFor(pname, 'props');
+
+
+ elist.push.apply(elist,this.proplist[pname]['events']);
+ plist.push.apply(plist,this.proplist[pname]['props']);
+ ilist.push(pname);
+ ilist.push.apply(ilist,this.proplist[pname]['inherits']);
+
+ this.overrides(mlist, this.proplist[pname]['methods']);
+
+
+ } else {
+ print("NO PARENT FOUND?");
+ }
+
+ // implements needs to be more carefull as it could add dupes..
+ // use the parent implements list to ensure no dupes..
+ for(var i =0; i < GIRepository.object_info_get_n_interfaces(bi); i++) {
+
+ var prop = GIRepository.object_info_get_interface(bi,i);
+ var iface = prop.get_namespace() +'.'+ prop.get_name();
+ if ( ilist.indexOf(iface) > -1) {
+ continue;
+ }
+ this.getPropertiesFor(iface, 'props'); // just load one of them..
+ ilist.push(iface);
+
+ elist.push.apply(elist,this.proplist[iface]['events']);
+ plist.push.apply(plist,this.proplist[iface]['props']);
+ this.overrides(mlist, this.proplist[pname]['methods']);
+ }
+ function sfunc(a,b) {
+ if (a.name == b.name) return 0;
+ return a.name > b.name ? 1 : -1
+ }
+ plist.sort(sfunc);
+ elist.sort(sfunc);
+ mlist.sort(sfunc);
+
+ return this.proplist[ename][type];
+
+ },
+ genParams: function(sig, meth)
+ {
+ var args = ['self'];
+ var ret = "\n";
+ meth.ret_type = this.typeToName(GIRepository.callable_info_get_return_type(sig));
+ // might be a numbeR??
+ meth.params = [];
+ for(var a_i =0; a_i < GIRepository.callable_info_get_n_args(sig); a_i++) {
+ var arg = GIRepository.callable_info_get_arg(sig, a_i);
+
+ meth.params.push({
+ name : arg.get_name(),
+ type : this.typeToName(arg.get_type(), true)
+ });
+ }
+
+
+
+
+ },
+ genSkel: function(sig) // should really use genParams...
+ {
+ var args = ['self'];
+ var ret = "\n";
+ var ret_type = this.typeToName(GIRepository.callable_info_get_return_type(sig));
+ // might be a numbeR??
+ if (ret_type == 'boolean') {
+ ret = " return false;\n";
+ }
+ for(var a_i =0; a_i < GIRepository.callable_info_get_n_args(sig); a_i++) {
+ var arg = GIRepository.callable_info_get_arg(sig, a_i);
+
+ args.push(arg.get_name());
+ }
+ return 'function (' + args.join(', ') + ") {\n" + ret + "}";
+
+
+
+ },
+ typeToName : function (type_info, allow_iface) // find type for properties or arguments.
+ {
+ var ty = GIRepository.type_tag_to_string( GIRepository.type_info_get_tag(type_info));
+
+ if ((ty == 'void') && GIRepository.type_info_is_pointer(type_info)) {
+ return false;
+ }
+ if (ty == 'array') {
+ return false; // unspported
+ }
+ if (ty != 'interface') {
+ return ty;
+ }
+ // we can accept enum types here..
+ var interface_info = GIRepository.type_info_get_interface(type_info);
+ var interface_type = GIRepository.base_info_get_type (interface_info);
+
+ if (!allow_iface && interface_type != GIRepository.InfoType.ENUM) {
+ return false;
+ }
+ return interface_info.get_namespace() + '.' + interface_info.get_name();
+
+ },
+ /**
+ * merge two proprety arrays' ignoring what's overrriden.
+ *
+ */
+
+
+ overrides : function (top, bottom)
+ {
+ function inTop(b)
+ {
+ return !top.every(function(t) {
+ if (t.name == b.name) {
+ return false;
+ }
+ return true;
+ });
+ }
+ bottom.forEach(function(e) {
+ if (!inTop(e)) {
+ top.push(e);
+ }
+ });
+
+ },
+
+ /**
+ * guess type..
+ *
+ */
+ findType : function (data, prop, value)
+ {
+ // specials??
+ if ((prop == '|xns') || (prop == 'xtype')) {
+ return 'string';
+ }
+
+ var qname = this.guessName(data);
+ if (prop[0] == '|') {
+ prop= prop.substring(1);
+ }
+
+ var prs = this.getPropertiesFor(qname, 'props');
+ var ret = false;
+ prs.forEach(function(e) {
+ if (ret !== false) {
+ return; // got it.
+ }
+ if (e.name == prop) {
+ ret = e;
+ }
+
+ });
+ if (!ret) {
+ return Base.prototype.findType(data, prop,value);
+ }
+
+ // got the type
+ return ret.type;
+ },
+
+ findOptions : function(ename)
+ {
+
+ var es = ename.split('.');
+ if (es.length !=2) {
+ return Base.prototype.findOptions(ename);
+ }
+ var gi = GIRepository.Repository.get_default();
+ var bi = gi.find_by_name(es[0], es[1]);
+ var etype = GIRepository.object_info_get_type(bi);
+ if (etype != GIRepository.InfoType.ENUM) {
+ console.log("Options not handled yet!!!");
+ return false;
+ }
+ var ret = [];
+ // got an enum.. let's return the values..
+ for(var i =0; i < bi.get_n_values(); i++) {
+
+ var prop = bi.get_value(i);
+
+
+ ret.push( ename + '.' + prop.get_name().toUpperCase() )
+ }
+ return ret;
+ },
+ /**
+ * determine the packing types..
+ */
+ getDefaultPack: function(pname, cname) {
+ var list = this.getPackingList(pname,cname);
+ // console.dump(list);
+
+
+ if (!list.every(function(e) { return e.name != 'add'; })) {
+ return 'add'; // add is in our list..?? what about args..?!?
+ }
+ function toRet(e) {
+ var ret = [e.name];
+ e.params.forEach(function(p,i) {
+ if (ret === false) { return; } // skip broken..
+ if (i==0) { return; } // skip first..
+ if (p.type == 'boolean') {
+ ret.push('false');
+ return;
+ }
+ if (p.type == 'number') {
+ ret.push('0');
+ return;
+ }
+ if (p.type == 'uint') {
+ ret.push('0');
+ return;
+ }
+ ret = false; // invalid!
+ });
+ return ret === false ? false : ret.join(',');
+ };
+ var packret = false;
+ list.every(function(e) {
+
+ packret = toRet(e);
+ //print("DEFAULT PACK TEST : " + e.name + " : " +packret);
+ if (packret !== false) {
+ return false;
+ }
+ return true; // continue
+ });
+ //print("DEFAULT PACK: " + packret);
+ // should we do best match..?
+ return packret;
+ },
+ /**
+ * get packing list..
+ */
+ getPackingList :function (pname, cname)
+ {
+ var funcs = this.getPropertiesFor(pname,'methods');
+ //print("getPackingList : ALL FUNCS");
+ //console.dump(funcs);
+ var ret = [];
+ var _this = this;
+ // let's assume top down...
+ var inherits = [ cname ];
+ inherits.push.apply(inherits, this.getPropertiesFor(cname,'inherits'));
+ funcs.forEach(function(m) {
+ if (m.params.length && (typeof(m.params[0].type) == 'string') &&
+ inherits.indexOf(m.params[0].type) > -1) {
+ ret.push(m);
+ }
+ });
+ return ret;
+ }
+
+
+ }
+);
+