--- /dev/null
+function Extends(sub)
+{
+ var proto;
+ thinF = function(){};
+ inh = new thinF();
+ inh.xynt_sup = [];
+ inh.xynt_sup_cl = [];
+
+ console.log("INIZIO EXT");
+
+ var multi = function(sub, super, is_last)
+ {
+ var proto = super.prototype;
+
+ for (var f in proto) {
+ if (f == "xynt_sup" || f == "xynt_sup_cl")
+ continue;
+
+ console.log("LOOP: "+f);
+ if( f != "constructor" && typeof(proto[f]) == "function" && !is_last){
+ console.log("M_FU: "+proto['name']+" F: "+f);
+ // sub[f] = proto[f];
+ sub[f] = function(){
+ console.log("INFU PR: " + proto['name'] + " FUNC: "+f+" THIS: " + this);
+ return proto[f].apply(this,arguments);
+ }
+ }
+ else {
+ console.log("M_PR: "+proto.name+" A: "+f+" FUN: "+proto[f]);
+ sub[f] = proto[f];
+ }
+ }
+ }
+
+ for( var i=1; i < arguments.length ; i++){
+ multi(inh, arguments[i], false);
+ inh.xynt_sup.push(arguments[i].prototype);
+ inh.xynt_sup_cl.push(arguments[i]);
+ }
+
+ multi(inh, sub, true);
+ inh.super = function(cl, method) {
+ return this.xynt_sup_cl[cl].method.apply(this,arguments);
+ }
+ sub.prototype = inh;
+
+ console.log(sub.prototype.xynt_sup);
+ console.log(sub.prototype.xynt_sup_cl);
+}