/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 protected internal static void OperatePropertyIndirect0(VariantClosure clo, Variant
     name, Variant result, Dispatch2 objthis, int ope)
 {
     if (name.IsInteger() != true)
     {
         string str = name.AsString();
         int hr = clo.Operation(ope, str, result, null, clo.mObjThis != null ? clo.mObjThis
              : objthis);
         if (hr < 0)
         {
             ThrowFrom_tjs_error(hr, str);
         }
     }
     else
     {
         int hr = clo.OperationByNum(ope, name.AsInteger(), result, null, clo.mObjThis !=
             null ? clo.mObjThis : objthis);
         if (hr < 0)
         {
             ThrowFrom_tjs_error_num(hr, name.AsInteger());
         }
     }
 }
Exemple #2
0
 // enumerate members
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public virtual int EnumMembers(int flag, VariantClosure callback, Dispatch2 objThis
     )
 {
     return Error.E_NOTIMPL;
 }
Exemple #3
0
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 protected internal override int Process(Variant result, Variant[] param, Dispatch2
     objthis)
 {
     RegExpNI _this = (RegExpNI)objthis.GetNativeInstance(Kirikiri.Tjs2.RegExpClass.mClassID
         );
     if (_this == null)
     {
         return Error.E_NATIVECLASSCRASH;
     }
     if (param.Length < 2)
     {
         return Error.E_BADPARAMCOUNT;
     }
     string target = param[0].AsString();
     string to = null;
     bool func;
     VariantClosure funcval = null;
     if (param[1].IsObject() != true)
     {
         to = param[1].AsString();
         func = false;
     }
     else
     {
         funcval = param[1].AsObjectClosure();
         if (funcval.mObjThis == null)
         {
             funcval.mObjThis = objthis;
         }
         func = true;
     }
     string ret = null;
     Matcher m = _this.RegEx.Matcher(target);
     if (func == false)
     {
         ret = m.ReplaceAll(to);
     }
     else
     {
         int hr;
         VariantClosure clo = new VariantClosure(null, null);
         Variant funcret = new Variant();
         Variant arrayval = new Variant(clo);
         Variant[] args = new Variant[1];
         args[0] = arrayval;
         int size = target.Length;
         ret = string.Empty;
         for (int i = 0; i < size; )
         {
             if (m.Find(i))
             {
                 ret += Sharpen.Runtime.Substring(target, i, m.Start());
                 Dispatch2 array = Kirikiri.Tjs2.RegExpClass.GetResultArray(true, _this, m);
                 clo.Set(array, array);
                 hr = funcval.FuncCall(0, null, funcret, args, null);
                 if (hr >= 0)
                 {
                     ret += funcret.AsString();
                 }
                 i = m.End();
             }
             else
             {
                 break;
             }
         }
     }
     if (result != null)
     {
         result.Set(ret);
     }
     return Error.S_OK;
 }
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 protected internal static void OperatePropertyDirect(VariantClosure clo, string name
     , Variant result, Variant param, Dispatch2 objthis, int ope)
 {
     Dispatch2 objThis = clo.mObjThis != null ? clo.mObjThis : objthis;
     int hr = clo.Operation(ope, name, result, param, objThis);
     if (hr < 0)
     {
         ThrowFrom_tjs_error(hr, name);
     }
 }
Exemple #5
0
 public static void FinalizeApplication()
 {
     NullVariantClosure = null;
 }
Exemple #6
0
 // オリジナルでは、强制的に int で返す(アドレスになるかもしれない)もののようだが……
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 private static int TryFuncCallViaPropGet(VariantClosure tvclosure, int flag, Variant
     result, Variant[] param, Dispatch2 objthis)
 {
     // retry using PropGet
     Variant tmp = new Variant();
     Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
     int er = tvclosure.mObject.PropGet(0, null, tmp, disp);
     if (er >= 0)
     {
         tvclosure = tmp.AsObjectClosure();
         disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
         er = tvclosure.mObject.FuncCall(flag, null, result, param, disp);
     }
     return er;
 }
Exemple #7
0
 public Variant(Dispatch2 dsp)
 {
     mObject = new VariantClosure(dsp, null);
 }
Exemple #8
0
 public void CopyRef(Kirikiri.Tjs2.Variant value)
 {
     if (value.mObject is VariantClosure)
     {
         VariantClosure clo = (VariantClosure)value.mObject;
         mObject = new VariantClosure(clo.mObject, clo.mObjThis);
     }
     else
     {
         if (mObject != value.mObject)
         {
             {
                 mObject = value.mObject;
             }
         }
     }
 }
Exemple #9
0
 public Variant(Dispatch2 dsp, Dispatch2 dsp2)
 {
     mObject = new VariantClosure(dsp, dsp2);
 }
Exemple #10
0
 public void SetObject(Dispatch2 @object, Dispatch2 objthis)
 {
     mObject = new VariantClosure(@object, objthis);
 }
Exemple #11
0
 public void SetObject(Dispatch2 @ref)
 {
     mObject = new VariantClosure(@ref, null);
 }
Exemple #12
0
 public void Set(Dispatch2 dsp)
 {
     mObject = new VariantClosure(dsp);
 }
Exemple #13
0
 public static void Initialize()
 {
     NullVariantClosure = new VariantClosure(null, null);
 }