/// <exception cref="TjsException"></exception> public virtual void LoadByteCode(Variant result, Dispatch2 context, string name, BinaryStream input) { var loader = new TjsByteCodeLoader(); ScriptBlock block = loader.ReadByteCode(this, name, input); block.ExecuteTopLevel(result, context); if (block.GetContextCount() == 0) { RemoveScriptBlock(block); } block = null; }
public static void FinalizeApplication() { mGlobalStringMap = null; mNativeClassNames?.Clear(); mNativeClassNames = null; mConsoleOutput = null; mMessageMapper = null; mStorage = null; mArrayClass = null; mDictionaryClass = null; mVAPool = null; NULL_ARG = null; ArrayObject.FinalizeApplication(); TjsByteCodeLoader.FinalizeApplication(); CustomObject.FinalizeApplication(); DictionaryObject.FinalizeApplication(); MathClass.FinalizeApplication(); Variant.FinalizeApplication(); LexicalAnalyzer.FinalizeApplication(); }
//private static final String TAG ="TJS"; // プリプロセッサでは未定义の时この值が入る // create a member if not exists //public static int mCompactVariantArrayMagic; //public static VariantArrayStack mVariantArrayStack; // static 关系はここで初期化 public static void Initialize() { // mStorage = null; // 事前に设定されるので、ここで初期化するのはまずい NULL_ARG = new Variant[0]; IsTarminating = false; mWarnOnNonGlobalEvalOperator = false; mUnaryAsteriskIgnoresPropAccess = false; mNativeClassNames = new AList <string>(); mGlobalStringMap = new GlobalStringMap(); //mCompactVariantArrayMagic = 0; //mVariantArrayStack = new VariantArrayStack(); mEvalOperatorIsOnGlobal = false; EnableDebugMode = true; mConsoleOutput = null; mMessageMapper = new MessageMapper(); RandomGeneratorNI.SetRandomBits128(null); //ArrayNI.register(); mVAPool = new VariantPool(); CompileState.mEnableDicFuncQuickHack = true; Variant.Initialize(); DictionaryObject.Initialize(); ArrayObject.Initialize(); TjsByteCodeLoader.Initialize(); CustomObject.Initialize(); MathClass.Initialize(); LexicalAnalyzer.Initialize(); try { mArrayClass = new ArrayClass(); mDictionaryClass = new DictionaryClass(); } catch (VariantException) { } catch (TjsException) { } }