export.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. var RTL$ = {
  2. extend: function extend(methods){
  3. function Type(){
  4. for(var m in methods)
  5. this[m] = methods[m];
  6. }
  7. Type.prototype = this.prototype;
  8. var result = methods.init;
  9. result.prototype = new Type(); // inherit this.prototype
  10. result.prototype.constructor = result; // to see constructor name in diagnostic
  11. result.extend = extend;
  12. return result;
  13. },
  14. makeArray: function (/*dimensions, initializer*/){
  15. var forward = Array.prototype.slice.call(arguments);
  16. var result = new Array(forward.shift());
  17. var i;
  18. if (forward.length == 1){
  19. var init = forward[0];
  20. if (typeof init == "function")
  21. for(i = 0; i < result.length; ++i)
  22. result[i] = init();
  23. else
  24. for(i = 0; i < result.length; ++i)
  25. result[i] = init;
  26. }
  27. else
  28. for(i = 0; i < result.length; ++i)
  29. result[i] = this.makeArray.apply(this, forward);
  30. return result;
  31. }
  32. };
  33. var m = function (){
  34. var ci = 123;
  35. var T1 = RTL$.extend({
  36. init: function T1(){
  37. }
  38. });
  39. var pr1 = null;
  40. var p2 = null;
  41. var vi = 0;
  42. function p1(){
  43. }
  44. return {
  45. ci: ci,
  46. T1: T1,
  47. pr1: function(){return pr1;},
  48. p2: function(){return p2;},
  49. vi: function(){return vi;},
  50. p1: p1
  51. }
  52. }();