home *** CD-ROM | disk | FTP | other *** search
/ ring.yamanashi.ac.jp/pub/pc/freem/action/ / action.zip / henkyaku1.0.exe / henkyaku / Program / Kernel / Object.tonyu < prev    next >
Text File  |  2007-12-06  |  5KB  |  266 lines

  1. // basic 
  2. native print ; 
  3. native getkey ;
  4. native pset ; 
  5. native sub ;
  6. native suspend ;
  7. native currentProcess;
  8. native native_gc_mark;
  9. native _n_objhandle;
  10. native _n_refcount;
  11. native breakExec;
  12. native _fork;
  13. function newProc(s) {
  14.    $procs.add(new Process(this,s,0));  
  15. }
  16.  
  17. constructor Object(){
  18. }
  19.  
  20. function onSubProcess() {}
  21. function subProcess(a1,a2,a3,a4) {
  22.   appear(new SubProcExec(this,a1,a2,a3,a4));
  23. }
  24.  
  25. native _n_errorValue;
  26. function _errorHook() {
  27.    return _n_errorValue(0);
  28. }
  29.  
  30. //####### reflect
  31. native _getClassName;
  32. function getClassName() {
  33.   return _getClassName();
  34. }
  35.  
  36. native _getParentClassName;
  37. function getParentClassName() {
  38.   return _getParentClassName();
  39. }
  40.  
  41.  
  42. native _newInstance;
  43. function newInstance(name) {
  44.   return _newInstance(name);
  45. }
  46.  
  47. native _n_clearAllValues; 
  48. function clearAllValues(){
  49.   _n_clearAllValues();
  50.  
  51. native TObject;
  52.  
  53. native currentFunc;
  54.  
  55. native _n_getValueByIndex;
  56. function getValueByIndex(idx) {return _n_getValueByIndex(idx);}
  57. native _n_setValueByIndex;
  58. function setValueByIndex(idx,v) {_n_setValueByIndex(idx,v);}
  59. native _n_getValueCount;
  60. function getValueCount() {return _n_getValueCount();}
  61. function getVariableCount() {return _n_getValueCount();}
  62. native _n_getValueName;
  63. function getValueName(idx) {return _n_getValueName(idx);}
  64. function getVariableName(idx) {return _n_getValueName(idx);}
  65. native _n_getValueIndex;
  66. function getValueIndex(varName) {return _n_getValueIndex(varName);}
  67. function getVriableIndex(varName) {return _n_getValueIndex(varName);} // Depreciated
  68. function getVariableIndex(varName) {return _n_getValueIndex(varName);}
  69.  
  70. native isInt;
  71. native isFloat;
  72.  
  73. //######### math
  74. native getTime;
  75. native _n_randomize;
  76. native rnd;
  77. native sin;
  78. native cos;
  79. native sqrt;
  80. native angle;
  81. native dist;
  82. native trunc;
  83. native floor;
  84. native valueOf;
  85.  
  86. function randomize(s) {
  87.    if (s==null) _n_randomize(getTime());
  88.    else _n_randomize(s);
  89. }
  90.  
  91. function angleDiff(a,b) {
  92.   // èpôxa,bé╠ì╖é≡-180 ü` 179 é╠ö═ê═é┼ò╘é╡é▄é╖üB 
  93.   var c;
  94.   a=floor(a);
  95.   b=floor(b);
  96.   if (a>=b) {
  97.     c=(a-b) % 360;
  98.     if (c>=180) c-=360;
  99.   } else {
  100.     c=-((b-a) % 360);
  101.     if (c<-180) c+=360;
  102.   }
  103.   return c;
  104. }
  105. function abs(v) {
  106. //ÉΓæ╬Ælé≡ò╘é╡é▄é╖üB
  107.    if (v<0) v=-v;
  108.    return v;
  109. }
  110. function amod(a,b) {
  111.   a=trunc(a);
  112.   if (a>=0) return a % b;
  113.   return (a % b + b) % b;
  114. }
  115.  
  116. //######## other
  117.  
  118. native fileExists;
  119. native moveFile;
  120. native deleteFile;
  121.  
  122. function timeStop() {
  123.   var t;
  124.   t=new TimeStopper(this);
  125.   suspend();
  126.   return t;
  127. }
  128.  
  129. function appear(o) {
  130.   $chars.add(o);
  131.   return $procs.appear(o);
  132. }
  133.  
  134. function getRed(c) {
  135.   return c%256;
  136. }
  137. function getGreen(c) {
  138.   return trunc(c/256)%256;
  139. }
  140. function getBlue(c) {
  141.   return trunc(c/65536)%256;
  142. }
  143. function color(r,g,b){
  144.  return b*65536+g*256+r;
  145. }
  146. function colorHSL(iroai,azayakasa,akarusa) {
  147.   var r,g,b,nul,a;
  148.   //ÉFìçéóé┼ÉFé≡îêé▀éΘ
  149.   r = abs(120-((trunc(iroai+0.5)   % 240) % 240))*6-240;
  150.   g = abs(120-((trunc(iroai+160.5) % 240) % 240))*6-240;
  151.   b = abs(120-((trunc(iroai+80.5)  % 240) % 240))*6-240;
  152.   r = trunc(r*1.0625+0.5);
  153.   g = trunc(g*1.0625+0.5);
  154.   b = trunc(b*1.0625+0.5);
  155.   if (r>255) r = 255;
  156.   if (g>255) g = 255;
  157.   if (b>255) b = 255;
  158.   if (r<0) r = 0;
  159.   if (g<0) g = 0;
  160.   if (b<0) b = 0;
  161.   if (azayakasa==nul) return color(r,g,b);
  162.   
  163.   //æNéΓé⌐é│é┼ÉFé≡îêé▀éΘ
  164.   r = trunc(127.5+(r-127)/240*azayakasa);
  165.   g = trunc(127.5+(g-127)/240*azayakasa);
  166.   b = trunc(127.5+(b-127)/240*azayakasa);
  167.   if (akarusa==nul)return color(r,g,b);
  168.   
  169.   //û╛éΘé│é┼ÉFé≡îêé▀éΘ
  170.   if (akarusa<120) {
  171.     r = trunc(0.5+r/120*akarusa);
  172.     g = trunc(0.5+g/120*akarusa);
  173.     b = trunc(0.5+b/120*akarusa);
  174.   }
  175.   if (akarusa>120) {
  176.     r+= trunc(0.5+(255-r)/120*(akarusa-120));
  177.     g+= trunc(0.5+(255-g)/120*(akarusa-120));
  178.     b+= trunc(0.5+(255-b)/120*(akarusa-120));
  179.   }
  180.   if (r>255) r = 255;
  181.   if (g>255) g = 255;
  182.   if (b>255) b = 255;
  183.   if (r<0) r = 0;
  184.   if (g<0) g = 0;
  185.   if (b<0) b = 0;
  186.   return color(r,g,b);
  187. }
  188.  
  189.  
  190. function strcat(a,b) {
  191.   var t;
  192.   t=""; t=t.add(a);
  193.   return t.add(b);
  194. }
  195.  
  196. function designMode() {
  197.   return $_design_mode;
  198. }
  199.  
  200. native _n_refresh;
  201.  
  202. //######### generate
  203. function getGenerator() {
  204.   return 0;
  205. }
  206. function setGenerator(g) {
  207.   return 0;
  208. }
  209. function onGenerate() {
  210.   return 1;
  211. }
  212. function onSaveToGen() {
  213. }
  214.  
  215. native _n_setGenAttr;
  216. function setGenInstAttr(a,s) {
  217.    if (!getGenerator()) return 0;
  218.    return _n_setGenAttr (getGenerator(),a,s);
  219. }
  220.  
  221. native getPageHashCode;
  222.  
  223. //native _n_getGenAttr;
  224. //function getGenAttr(a) {
  225. //   if (!getGenerator()) return 0;
  226. //   return _n_getGenAttr (getGenerator(),a);
  227. //}
  228.  
  229. native _inspect;
  230. native _dynamicInspect;
  231. function inspect() {
  232. }
  233.  
  234. function dynamicinspect() {
  235.   _dynamicInspect();  
  236. }
  237.  
  238.  
  239. //######### resource
  240. native _n_getResource;
  241. function getResource(s) {
  242.   return _n_getResource(s);
  243. }
  244.  
  245. native _n_initResource;
  246. function initResource(s) {
  247.   return _n_initResource(s);
  248. }
  249.  
  250. native setGlobal;
  251. native getGlobal;
  252. native _n_moduleCommand;
  253.  
  254. native setAdjust;
  255.  
  256. //######### obsolated?
  257. native setMapPat;
  258. function _is(x){
  259.  return native_is(x);
  260. }
  261. native native_is;
  262. function _test_print(p) {
  263.  print(p);
  264. }
  265.