本文整理汇总了C#中Microsoft.JScript.Vsa.VsaEngine类的典型用法代码示例。如果您正苦于以下问题:C# VsaEngine类的具体用法?C# VsaEngine怎么用?C# VsaEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VsaEngine类属于Microsoft.JScript.Vsa命名空间,在下文中一共展示了VsaEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VsaItem
internal VsaItem(VsaEngine engine, string name, VsaItemType type, VsaItemFlag flag)
{
this.engine = engine;
this.name = name;
this.type = type;
this.flag = flag;
}
示例2: CallValue2
// Perform a late binding call, with reversed arguments.
public static Object CallValue2(Object val, Object thisob,
Object[] arguments, bool construct,
bool brackets, VsaEngine engine)
{
// TODO
return null;
}
示例3: FunctionObject
internal FunctionObject(Type t, string name, string method_name, string[] formal_parameters, JSLocalField[] fields, bool must_save_stack_locals, bool hasArgumentsObject, string text, VsaEngine engine) : base(engine.Globals.globalObject.originalFunction.originalPrototype, name, formal_parameters.Length)
{
base.engine = engine;
this.formal_parameters = formal_parameters;
this.argumentsSlotNumber = 0;
this.body = null;
this.method = TypeReflector.GetTypeReflectorFor(Globals.TypeRefs.ToReferenceContext(t)).GetMethod(method_name, BindingFlags.Public | BindingFlags.Static);
this.parameterInfos = this.method.GetParameters();
if (!Microsoft.JScript.CustomAttribute.IsDefined(this.method, typeof(JSFunctionAttribute), false))
{
this.isMethod = true;
}
else
{
JSFunctionAttributeEnum attributeValue = ((JSFunctionAttribute) Microsoft.JScript.CustomAttribute.GetCustomAttributes(this.method, typeof(JSFunctionAttribute), false)[0]).attributeValue;
this.isExpandoMethod = (attributeValue & JSFunctionAttributeEnum.IsExpandoMethod) != JSFunctionAttributeEnum.None;
}
this.funcContext = null;
this.own_scope = null;
this.fields = fields;
this.must_save_stack_locals = must_save_stack_locals;
this.hasArgumentsObject = hasArgumentsObject;
this.text = text;
this.attributes = MethodAttributes.Public;
this.globals = engine.Globals;
this.superConstructor = null;
this.superConstructorCall = null;
this.enclosing_scope = this.globals.ScopeStack.Peek();
base.noExpando = false;
this.clsCompliance = CLSComplianceSpec.NotAttributed;
}
示例4: concat
public static ArrayObject concat(object thisob, VsaEngine engine, params object[] args)
{
ArrayObject obj2 = engine.GetOriginalArrayConstructor().Construct();
if (thisob is ArrayObject)
{
obj2.Concat((ArrayObject) thisob);
}
else
{
obj2.Concat(thisob);
}
for (int i = 0; i < args.Length; i++)
{
object obj3 = args[i];
if (obj3 is ArrayObject)
{
obj2.Concat((ArrayObject) obj3);
}
else
{
obj2.Concat(obj3);
}
}
return obj2;
}
示例5: OnEngineClosed
public void OnEngineClosed ()
{
VsaEngine engine = new VsaEngine ();
IVsaItems items;
IVsaItem item;
engine = new VsaEngine ();
engine.RootMoniker = "com.foo://path/to/nowhere";
engine.Site = new Site ();
engine.InitNew ();
items = engine.Items;
engine.Close ();
int size;
try {
size = items.Count;
} catch (VsaException e) {
Assert.AreEqual (VsaError.EngineClosed, e.ErrorCode, "#1");
}
try {
item = items.CreateItem ("itemx", VsaItemType.Code,
VsaItemFlag.Class);
} catch (VsaException e) {
Assert.AreEqual (VsaError.EngineClosed, e.ErrorCode, "#2");
}
}
示例6: CallValue
public static object CallValue(object thisObj, object val, object [] arguments,
bool construct, bool brackets, VsaEngine engine)
{
if (construct) {
if (brackets) {
}
if (val is Closure)
return ((Closure) val).func.CreateInstance (arguments);
else if (val is FunctionObject)
return ((FunctionObject) val).CreateInstance (arguments);
} else if (brackets) {
object first_arg = arguments.Length > 0 ? arguments [0] : null;
return GetObjectProperty ((ScriptObject) Convert.ToObject (val, engine), Convert.ToString (first_arg));
} else {
if (val is Closure)
return ((Closure) val).func.Invoke (thisObj, arguments);
else if (val is FunctionObject)
return ((FunctionObject) val).Invoke (thisObj, arguments);
else if (val is RegExpObject) {
object first_arg = arguments.Length > 0 ? arguments [0] : null;
return RegExpPrototype.exec (val, first_arg);
} else
return null;
}
Console.WriteLine ("CallValue: construct = {0}, brackets = {1}, this = {2}, val = {3} ({4}), arg[0] = {5}",
construct, brackets, thisObj.GetType (), val, val.GetType (), arguments [0]);
throw new NotImplementedException ();
}
示例7: AddDefinition
private void AddDefinition(string def, Hashtable definitions, VsaEngine engine){
int equalsIndex = def.IndexOf("=");
string key;
string strValue;
object value = null;
if (equalsIndex == -1){
key = def.Trim();
value = true;
}else{
key = def.Substring(0, equalsIndex).Trim();
strValue = def.Substring(equalsIndex + 1).Trim();
if (String.Compare(strValue, "true", StringComparison.OrdinalIgnoreCase) == 0)
value = true;
else if (String.Compare(strValue, "false", StringComparison.OrdinalIgnoreCase) == 0)
value = false;
else{
try{
value = Int32.Parse(strValue, CultureInfo.InvariantCulture);
}catch{
throw new CmdLineException(CmdLineError.InvalidDefinition, key, engine.ErrorCultureInfo);
}
}
}
if (key.Length == 0)
throw new CmdLineException(CmdLineError.MissingDefineArgument, engine.ErrorCultureInfo);
definitions[key] = value;
}
示例8: Construct
internal ScriptFunction Construct(object[] args, VsaEngine engine)
{
ScriptFunction function;
StringBuilder builder = new StringBuilder("function anonymous(");
int index = 0;
int num2 = args.Length - 2;
while (index < num2)
{
builder.Append(Microsoft.JScript.Convert.ToString(args[index]));
builder.Append(", ");
index++;
}
if (args.Length > 1)
{
builder.Append(Microsoft.JScript.Convert.ToString(args[args.Length - 2]));
}
builder.Append(") {\n");
if (args.Length > 0)
{
builder.Append(Microsoft.JScript.Convert.ToString(args[args.Length - 1]));
}
builder.Append("\n}");
Context context = new Context(new DocumentContext("anonymous", engine), builder.ToString());
JSParser parser = new JSParser(context);
engine.PushScriptObject(((IActivationObject) engine.ScriptObjectStackTop()).GetGlobalScope());
try
{
function = (ScriptFunction) parser.ParseFunctionExpression().PartiallyEvaluate().Evaluate();
}
finally
{
engine.PopScriptObject();
}
return function;
}
示例9: GlobalScope
internal GlobalScope(GlobalScope parent, VsaEngine engine, bool isComponentScope) : base(parent)
{
this.componentScopes = null;
this.recursive = false;
this.isComponentScope = isComponentScope;
if (parent == null)
{
this.globalObject = engine.Globals.globalObject;
this.globalObjectTR = TypeReflector.GetTypeReflectorFor(Globals.TypeRefs.ToReferenceContext(this.globalObject.GetType()));
base.fast = !(this.globalObject is LenientGlobalObject);
}
else
{
this.globalObject = null;
this.globalObjectTR = null;
base.fast = parent.fast;
if (isComponentScope)
{
((GlobalScope) base.parent).AddComponentScope(this);
}
}
base.engine = engine;
base.isKnownAtCompileTime = base.fast;
this.evilScript = true;
this.thisObject = this;
this.typeReflector = TypeReflector.GetTypeReflectorFor(Globals.TypeRefs.ToReferenceContext(base.GetType()));
if (isComponentScope)
{
engine.Scopes.Add(this);
}
}
示例10: AddSourceFile
private void AddSourceFile(VsaEngine engine, string filename)
{
string name = "$SourceFile_" + this.codeItemCounter++;
IJSVsaCodeItem item = (IJSVsaCodeItem) engine.Items.CreateItem(name, JSVsaItemType.Code, JSVsaItemFlag.None);
item.SetOption("codebase", filename);
item.SourceText = this.ReadFile(filename, engine);
}
示例11: concat
public static ArrayObject concat(object thisObj, VsaEngine engine,
params object [] args)
{
uint i = 0;
ArrayObject result = new ArrayObject ();
int arg_idx = -1;
int arg_count = args.Length;
// TODO: Shouldn't this be generic!?
SemanticAnalyser.assert_type (thisObj, typeof (ArrayObject));
object cur_obj = thisObj;
ArrayObject cur_ary;
while (cur_obj != null) {
if (cur_obj is ArrayObject) {
cur_ary = (ArrayObject) cur_obj;
uint n = (uint) cur_ary.length;
for (uint j = 0; j < n; j++, i++)
result.elems [i] = cur_ary.elems [j];
} else
result.elems [i++] = cur_obj;
arg_idx++;
cur_obj = arg_idx < arg_count ? args [arg_idx] : null;
}
result.length = i;
return result;
}
示例12: EngineInstance
// Constructor.
public EngineInstance(VsaEngine engine)
{
// Initialize the local state.
this.engine = engine;
this.outStream = null;
this.errorStream = null;
}
示例13: VsaScriptScope
internal VsaScriptScope(VsaEngine engine, string itemName, VsaScriptScope parent)
: base(engine, itemName, (VsaItemType)(int)VSAITEMTYPE2.SCRIPTSCOPE, VsaItemFlag.None){
this.parent = parent;
this.scope = null;
this.items = new ArrayList(8);
this.isCompiled = false;
this.isClosed = false;
}
示例14: VsaScriptScope
internal VsaScriptScope(VsaEngine engine, string itemName, VsaScriptScope parent) : base(engine, itemName, (JSVsaItemType) 0x13, JSVsaItemFlag.None)
{
this.parent = parent;
this.scope = null;
this.items = new ArrayList(8);
this.isCompiled = false;
this.isClosed = false;
}
示例15: VsaItem
internal VsaItem(VsaEngine engine, string itemName, VsaItemType type, VsaItemFlag flag){
this.engine = engine;
this.type = type;
this.name = itemName;
this.flag = flag;
this.codebase = null;
this.isDirty = true;
}