Exemplo n.º 1
0
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public TJS()
 {
     // create script cache object
     mCache = new ScriptCache(this);
     mPPValues = new Dictionary<string, int>();
     SetPPValue("version", VERSION_HEX);
     SetPPValue("environment", ENV_JAVA_APPLICATION);
     // TODO 适切な值を入れる
     SetPPValue("compatibleSystem", 1);
     // 互换システム true
     mGlobal = new CustomObject(GLOBAL_HASH_BITS);
     mScriptBlocks = new AList<WeakReference<ScriptBlock>>();
     Dispatch2 dsp;
     Variant val;
     // Array
     //dsp = new ArrayClass();
     dsp = mArrayClass;
     val = new Variant(dsp, null);
     mGlobal.PropSet(MEMBERENSURE, "Array", val, mGlobal);
     // Dictionary
     //dsp = new DictionaryClass();
     dsp = mDictionayClass;
     val = new Variant(dsp, null);
     mGlobal.PropSet(MEMBERENSURE, "Dictionary", val, mGlobal);
     // Date //TODO: add date back
     //dsp = new DateClass();
     //val = new Variant(dsp, null);
     //mGlobal.PropSet(MEMBERENSURE, "Date", val, mGlobal);
     {
         // Math
         Dispatch2 math;
         dsp = math = new MathClass();
         val = new Variant(dsp, null);
         mGlobal.PropSet(MEMBERENSURE, "Math", val, mGlobal);
         // Math.RandomGenerator
         dsp = new RandomGeneratorClass();
         val = new Variant(dsp, null);
         math.PropSet(MEMBERENSURE, "RandomGenerator", val, math);
     }
     // Exception
     dsp = new ExceptionClass();
     val = new Variant(dsp, null);
     mGlobal.PropSet(MEMBERENSURE, "Exception", val, mGlobal);
     // RegExp
     dsp = new RegExpClass();
     val = new Variant(dsp, null);
     mGlobal.PropSet(MEMBERENSURE, "RegExp", val, mGlobal);
 }
Exemplo n.º 2
0
 public virtual void Shutdown()
 {
     //variantArrayStackCompactNow();
     if (mGlobal != null)
     {
         try
         {
             mGlobal.Invalidate(0, null, mGlobal);
         }
         catch (VariantException)
         {
         }
         catch (TJSException)
         {
         }
         mGlobal.Clear();
         mGlobal = null;
     }
     if (mCache != null)
     {
         mCache = null;
     }
 }