コード例 #1
0
ファイル: TJS.cs プロジェクト: fantasydr/krkr-cs
 /// <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);
 }
コード例 #2
0
ファイル: InterCodeObject.cs プロジェクト: fantasydr/krkr-cs
 // create new object
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public override int CreateNew(int flag, string membername, Holder<Dispatch2> result
     , Variant[] param, Dispatch2 objthis)
 {
     if (!GetValidity())
     {
         return Error.E_INVALIDOBJECT;
     }
     if (membername == null)
     {
         if (mContextType != ContextType.CLASS)
         {
             return Error.E_INVALIDTYPE;
         }
         Dispatch2 dsp = new CustomObject();
         ExecuteAsFunction(dsp, null, null, 0);
         FuncCall(0, mName, null, param, dsp);
         result.Set(dsp);
         return Error.S_OK;
     }
     int hr = base.CreateNew(flag, membername, result, param, objthis);
     if (membername != null && hr == Error.E_MEMBERNOTFOUND && mContextType == ContextType
         .CLASS && mSuperClassGetter != null)
     {
         // look up super class
         int[] pointer = mSuperClassGetter.mSuperClassGetterPointer;
         int count = pointer.Length;
         if (count != 0)
         {
             Variant res = new Variant();
             for (int i = count - 1; i >= 0; i--)
             {
                 mSuperClassGetter.ExecuteAsFunction(null, null, res, pointer[i]);
                 VariantClosure clo = res.AsObjectClosure();
                 hr = clo.CreateNew(flag, membername, result, param, objthis);
                 if (hr != Error.E_MEMBERNOTFOUND)
                 {
                     break;
                 }
             }
         }
     }
     return hr;
 }
コード例 #3
0
ファイル: DictionaryNI.cs プロジェクト: fantasydr/krkr-cs
 public AssignCallback(CustomObject owner)
 {
     mOwner = owner;
 }
コード例 #4
0
ファイル: TJS.cs プロジェクト: fantasydr/krkr-cs
 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;
     }
 }