10 console.log("INIZIO EXT");
12 var multi = function(sub, super, is_last)
14 var proto = super.prototype;
16 for (var f in proto) {
17 if (f == "xynt_sup" || f == "xynt_sup_cl")
20 console.log("LOOP: "+f);
21 if( f != "constructor" && typeof(proto[f]) == "function" && !is_last){
22 console.log("M_FU: "+proto['name']+" F: "+f);
25 console.log("INFU PR: " + proto['name'] + " FUNC: "+f+" THIS: " + this);
26 return proto[f].apply(this,arguments);
30 console.log("M_PR: "+proto.name+" A: "+f+" FUN: "+proto[f]);
36 for( var i=1; i < arguments.length ; i++){
37 multi(inh, arguments[i], false);
38 inh.xynt_sup.push(arguments[i].prototype);
39 inh.xynt_sup_cl.push(arguments[i]);
42 multi(inh, sub, true);
45 inh.callSuper = function(fnc){
46 var len = this.xynt_sup_cl.length;
47 for ( var i=0 ; i<len ; i++) {
48 var super = this.xynt_sup_cl[i];
49 if( (fnc in super.prototype) && (typeof super.prototype[fnc] == "function") ){
50 return super.prototype[fnc].apply(this,[].splice.call(arguments,1));
57 inh.superrr = function(cl, method) {
58 console.log("xyx "+cl);
59 // console.log("xx"+arguments[0]);
60 // return this.xynt_sup_cl[cl].method.apply(this,arguments.slice(2));
65 console.log(sub.prototype.xynt_sup);
66 console.log(sub.prototype.xynt_sup_cl);
69 function ExtendsInst(sub)
73 console.log("INIZIO EXT INST");
75 var multi = function(sub, super, is_last)
77 var proto = super.prototype;
79 if (typeof(sub.xynt_sup) == 'undefined')
80 sub.xynt_sup = new Array();
81 if (typeof(sub.xynt_sup_cl) == 'undefined')
82 sub.xynt_sup_cl = new Array();
84 for (var f in proto) {
85 /* NOTE: this allow potentially TO BREAK by the extending class
86 if we disable it we don't have a reason to keep the callSuper function,
87 I need to meditate on it */
88 if (f == "xynt_sup" || f == "xynt_sup_cl")
91 console.log("ExtensInst::multi: "+f+" type: "+typeof(sub[f]));
92 if (typeof(sub[f]) != 'undefined') {
93 if (typeof(sub[f]) == typeof(proto[f]))
95 console.log("MULTI: false1");
99 console.log("LOOP: "+f);
100 if( f != "constructor" && typeof(proto[f]) == "function" && !is_last){
101 console.log("M_FU: "+proto['name']+" F: "+f);
103 console.log("INFU PR: " + proto[f] + " FUNC: "+f+" THIS: " + this);
104 return proto[f].apply(this, arguments);
108 console.log("M_PR: "+proto.name+" A: "+f+" FUN: "+proto[f]);
115 console.log("POST FUNC");
117 for( var i=1; i < arguments.length ; i++){
118 console.log("POST FUNC IN LOOP");
120 if (i+1 < arguments.length && typeof(arguments[i+1]) != 'function') {
124 if (multi(sub, cl, false) == false) {
125 console.log("POST FUNC FALSE 1");
129 console.log("POST FUNC PRE APPLY");
131 console.log("POST FUNC POST APPLY");
133 sub.xynt_sup.push(cl.prototype);
134 sub.xynt_sup_cl.push(cl);
137 sub.callSuper = function(fnc){
138 var len = this.xynt_sup_cl.length;
139 for ( var i=0 ; i<len ; i++) {
140 var super = this.xynt_sup_cl[i];
141 if( (fnc in super.prototype) && (typeof super.prototype[fnc] == "function") ){
142 return super.prototype[fnc].apply(this,[].splice.call(arguments,1));
148 console.log("FINE EXT INST");
152 function show_class(cl) {
153 console.log("Attributes Class of "+cl);
154 for (f in cl.prototype) {
155 console.log(f+": ["+cl.prototype[f]+"]");
160 function show_inst(inst) {
161 console.log("Attributes Instance of "+inst);
163 console.log("["+f+"]: ["+inst[f]+"]");