本文整理汇总了C#中Kirikiri.Tjs2.Variant.CopyRef方法的典型用法代码示例。如果您正苦于以下问题:C# Variant.CopyRef方法的具体用法?C# Variant.CopyRef怎么用?C# Variant.CopyRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kirikiri.Tjs2.Variant
的用法示例。
在下文中一共展示了Variant.CopyRef方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
protected internal override int Process(Variant result, Variant[] param, Dispatch2
objthis)
{
Variant val = new Variant(string.Empty);
if ((param.Length > 0) ? param[0].IsVoid() != true : false)
{
val.CopyRef(param[0]);
}
string message_name = "message";
objthis.PropSet(Interface.MEMBERENSURE, message_name, val, objthis);
if ((param.Length > 1) ? param[1].IsVoid() != true : false)
{
val.CopyRef(param[1]);
}
else
{
val.Set(string.Empty);
}
string trace_name = "trace";
objthis.PropSet(Interface.MEMBERENSURE, trace_name, val, objthis);
return Error.S_OK;
}
示例2: Operation
// operation with member
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
public virtual int Operation(int flag, string memberName, Variant result, Variant
param, Dispatch2 objThis)
{
int op = flag & OP_MASK;
if (op != OP_INC && op != OP_DEC && param == null)
{
return Error.E_INVALIDPARAM;
}
if (op < OP_MIN || op > OP_MAX)
{
return Error.E_INVALIDPARAM;
}
Variant tmp = new Variant();
int hr = PropGet(0, memberName, tmp, objThis);
if (hr < 0)
{
return hr;
}
// #define TJS_FAILED(x) ((x)<0)
DoVariantOperation(op, tmp, param);
hr = PropSet(0, memberName, tmp, objThis);
if (hr < 0)
{
return hr;
}
if (result != null)
{
result.CopyRef(tmp);
}
return Error.S_OK;
}
示例3: Operation
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
public override int Operation(int flag, string membername, Variant result, Variant
param, Dispatch2 objthis)
{
if (!GetValidity())
{
return Error.E_INVALIDOBJECT;
}
// operation about the member
// processing line is the same as above function
if (membername == null)
{
return Error.E_INVALIDTYPE;
}
int op = flag & OP_MASK;
if (op != OP_INC && op != OP_DEC && param == null)
{
return Error.E_INVALIDPARAM;
}
if (op < OP_MIN || op > OP_MAX)
{
return Error.E_INVALIDPARAM;
}
SymbolData data = Find(membername);
if (data == null)
{
if (mCallMissing)
{
// call default operation
return base.Operation(flag, membername, result, param, objthis);
}
}
if (data == null)
{
return Error.E_MEMBERNOTFOUND;
}
// not found
if (data.mValue.IsObject())
{
int hr;
VariantClosure tvclosure;
tvclosure = data.mValue.AsObjectClosure();
if (tvclosure.mObject != null)
{
Dispatch2 ot = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
Variant tmp = new Variant();
hr = tvclosure.mObject.PropGet(0, null, tmp, ot);
if (hr >= 0)
{
DoVariantOperation(op, tmp, param);
hr = tvclosure.mObject.PropSet(0, null, tmp, ot);
if (hr < 0)
{
return hr;
}
if (result != null)
{
result.CopyRef(tmp);
}
return Error.S_OK;
}
else
{
if (hr != Error.E_NOTIMPL && hr != Error.E_INVALIDTYPE && hr != Error.E_INVALIDOBJECT)
{
return hr;
}
}
}
}
//checkObjectClosureRemove( data.mValue );
Variant tmp_1 = data.mValue;
try
{
DoVariantOperation(op, tmp_1, param);
}
finally
{
}
//checkObjectClosureAdd( data.mValue );
if (result != null)
{
result.CopyRef(tmp_1);
}
return Error.S_OK;
}
示例4: EnumCallback
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
private static bool EnumCallback(int flags, EnumMembersCallback callback, Variant
value, Dispatch2 objthis, SymbolData data)
{
int newflags = 0;
if ((data.mSymFlags & SYMBOL_HIDDEN) != 0)
{
newflags |= Interface.HIDDENMEMBER;
}
if ((data.mSymFlags & SYMBOL_STATIC) != 0)
{
newflags |= Interface.STATICMEMBER;
}
value.Clear();
if ((flags & Interface.ENUM_NO_VALUE) == 0)
{
bool getvalues = false;
if ((flags & Interface.IGNOREPROP) == 0)
{
Variant targ = data.mValue;
if (targ.IsObject())
{
VariantClosure tvclosure = targ.AsObjectClosure();
int hr = Error.E_NOTIMPL;
if (tvclosure.mObject != null)
{
Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
hr = tvclosure.mObject.PropGet(0, null, value, disp);
}
if (hr >= 0)
{
getvalues = true;
}
else
{
if (hr != Error.E_NOTIMPL && hr != Error.E_INVALIDTYPE && hr != Error.E_INVALIDOBJECT)
{
return false;
}
}
}
}
if (getvalues == false)
{
value.CopyRef(data.mValue);
}
}
return callback.Callback(data.mName, newflags, value);
}
示例5: DefaultPropSet
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
protected internal static int DefaultPropSet(int flag, Variant targ, Variant param
, Dispatch2 objthis)
{
if ((flag & Interface.IGNOREPROP) == 0)
{
if (targ.IsObject())
{
// roughly the same as TJSDefaultPropGet
VariantClosure tvclosure = targ.AsObjectClosure();
int hr = Error.E_NOTIMPL;
if (tvclosure.mObject != null)
{
Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
hr = tvclosure.mObject.PropSet(0, null, param, disp);
}
if (hr >= 0)
{
return hr;
}
if (hr != Error.E_NOTIMPL && hr != Error.E_INVALIDTYPE && hr != Error.E_INVALIDOBJECT)
{
return hr;
}
}
}
// normal substitution
if (param == null)
{
return Error.E_INVALIDPARAM;
}
targ.CopyRef(param);
return Error.S_OK;
}
示例6: DefaultPropGet
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
protected internal static int DefaultPropGet(int flag, Variant targ, Variant result
, Dispatch2 objthis)
{
if ((flag & Interface.IGNOREPROP) == 0)
{
// if IGNOREPROP is not specified
// if member's type is tvtObject, call the object's PropGet with "member=NULL"
// ( default member invocation ). if it is succeeded, return its return value.
// if the PropGet's return value is TJS_E_ACCESSDENYED,
// return as an error, otherwise return the member itself.
if (targ.IsObject())
{
VariantClosure tvclosure = targ.AsObjectClosure();
int hr = Error.E_NOTIMPL;
if (tvclosure.mObject != null)
{
Dispatch2 disp = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
hr = tvclosure.mObject.PropGet(0, null, result, disp);
}
if (hr >= 0)
{
return hr;
}
if (hr != Error.E_NOTIMPL && hr != Error.E_INVALIDTYPE && hr != Error.E_INVALIDOBJECT)
{
return hr;
}
}
}
// return the member itself
if (result == null)
{
return Error.E_INVALIDPARAM;
}
result.CopyRef(targ);
return Error.S_OK;
}
示例7: DefaultOperation
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
protected internal static int DefaultOperation(int flag, Variant targ, Variant result
, Variant param, Dispatch2 objthis)
{
int op = flag & OP_MASK;
if (op != OP_INC && op != OP_DEC && param == null)
{
return Error.E_INVALIDPARAM;
}
if (op < OP_MIN || op > OP_MAX)
{
return Error.E_INVALIDPARAM;
}
if (targ.IsObject())
{
// the member may be a property handler if the member's type is "tvtObject"
// so here try to access the object.
int hr;
VariantClosure tvclosure = targ.AsObjectClosure();
if (tvclosure.mObject != null)
{
Dispatch2 ot = tvclosure.mObjThis != null ? tvclosure.mObjThis : objthis;
Variant tmp = new Variant();
hr = tvclosure.mObject.PropGet(0, null, tmp, ot);
if (hr >= 0)
{
DoVariantOperation(op, tmp, param);
hr = tvclosure.mObject.PropSet(0, null, tmp, ot);
if (hr < 0)
{
return hr;
}
if (result != null)
{
result.CopyRef(tmp);
}
return Error.S_OK;
}
else
{
if (hr != Error.E_NOTIMPL && hr != Error.E_INVALIDTYPE && hr != Error.E_INVALIDOBJECT)
{
return hr;
}
}
}
}
// normal operation is proceeded if "PropGet" is failed.
DoVariantOperation(op, targ, param);
if (result != null)
{
result.CopyRef(targ);
}
return Error.S_OK;
}
示例8: ExecuteCode
//.........这里部分代码省略.........
case VM_GETP:
{
GetProperty(ra, ra_offset, code);
code += 3;
break;
}
case VM_SETP:
{
SetProperty(ra, ra_offset, code);
code += 3;
break;
}
case VM_DELD:
{
DeleteMemberDirect(ra, ra_offset, code);
code += 4;
break;
}
case VM_DELI:
{
DeleteMemberIndirect(ra, ra_offset, code);
code += 4;
break;
}
case VM_SRV:
{
if (result != null)
{
result.CopyRef(ra[ra_offset + ca[code + 1]]);
}
code += 2;
break;
}
case VM_RET:
{
return code + 1;
}
case VM_ENTRY:
{
// TJS_FROM_VM_REG_ADDR(x) ((tjs_int)(x) / (tjs_int)sizeof(tTJSVariant))
// TJS_FROM_VM_CODE_ADDR(x) ((tjs_int)(x) / (tjs_int)sizeof(tjs_uint32))
code = ExecuteCodeInTryBlock(ra, ra_offset, code + 3, args, result, ca[code + 1]
+ code, ca[code + 2]);
break;
}
case VM_EXTRY:
{
return code + 1;
}
case VM_THROW:
{
// same as ret
ThrowScriptException(ra[ra_offset + ca[code + 1]], mBlock, CodePosToSrcPos(code));
code += 2;
// actually here not proceed...
break;
}