コード例 #1
0
 public PreprocessorExpressionParser(TJS tjs, string script)
     : base(script)
 {
     //	private int mResult;
     mIDs = new AList<string>();
     mTJS = tjs;
 }
コード例 #2
0
ファイル: ScriptBlock.cs プロジェクト: fantasydr/krkr-cs
 public ScriptBlock(TJS owner, string name, int lineoffset, string script, ScriptLineData
     linedata)
 {
     // a class for managing the script block
     // 以下の4つは实行时にいるかな、名前以外はエラー発生时に必要になるだけだろうけど。
     mOwner = owner;
     mName = name;
     mLineOffset = lineoffset;
     mScript = script;
     mLineData = linedata;
     mOwner.AddScriptBlock(this);
 }
コード例 #3
0
ファイル: TJS2App.cs プロジェクト: fantasydr/krkr-cs
        public static void Main(string[] args)
        {
            TJS.mStorage = null;
            TJS.Initialize();
            TJS mScriptEngine = new TJS();
            TJS.SetConsoleOutput(new DebugConsoleOutput());

            Dispatch2 dsp = mScriptEngine.GetGlobal();
            Variant ret = new Variant();
            mScriptEngine.ExecScript("Debug.message(\"Hello, world!\");", ret, dsp, null, 0);

            System.Console.Out.WriteLine("Hello World!");
        }
コード例 #4
0
ファイル: ScriptBlock.cs プロジェクト: fantasydr/krkr-cs
 public ScriptBlock(TJS owner)
 {
     mOwner = owner;
     // Java で初期值となる初期化は省略
     //mScript = null;
     //mName = null;
     //mInterCodeContext = null;
     //mTopLevelContext = null;
     //mLexicalAnalyzer = null;
     //mUsingPreProcessor = false;
     //mLineOffset = 0;
     //mCompileErrorCount = 0;
     //mNode = null;
     mOwner.AddScriptBlock(this);
 }
コード例 #5
0
ファイル: Compiler.cs プロジェクト: fantasydr/krkr-cs
 public Compiler(TJS owner)
 {
     mOwner = owner;
     // Java で初期值となる初期化は省略
     //mScript = null;
     //mName = null;
     //mInterCodeContext = null;
     //mTopLevelContext = null;
     //mLexicalAnalyzer = null;
     //mUsingPreProcessor = false;
     //mLineOffset = 0;
     //mCompileErrorCount = 0;
     //mNode = null;
     mGeneratorStack = new Stack<InterCodeGenerator>();
     mInterCodeGeneratorList = new AList<InterCodeGenerator>();
     mInterCodeObjectList = new AList<InterCodeObject>();
 }
コード例 #6
0
 public NativeConvertedClassBase(TJS owner)
 {
     mOwner = new WeakReference<TJS>(owner);
 }
コード例 #7
0
 public NativeConvertedFunction(TJS owner)
     : base(owner)
 {
 }
コード例 #8
0
ファイル: ByteCodeLoader.cs プロジェクト: fantasydr/krkr-cs
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public virtual ScriptBlock ReadByteCode(TJS owner, string name, BinaryStream input
     )
 {
     try
     {
         int size = (int)input.GetSize();
         if (mReadBuffer == null || mReadBuffer.Length < size)
         {
             int buflen = size < MIN_READ_BUFFER_SIZE ? MIN_READ_BUFFER_SIZE : size;
             mReadBuffer = new byte[buflen];
         }
         byte[] databuff = mReadBuffer;
         input.Read(databuff);
         input.Close();
         input = null;
         // TJS2
         int tag = (databuff[0] & unchecked((int)(0xff))) | (databuff[1] & unchecked((int)
             (0xff))) << 8 | (databuff[2] & unchecked((int)(0xff))) << 16 | (databuff[3] & unchecked(
             (int)(0xff))) << 24;
         if (tag != FILE_TAG_LE)
         {
             return null;
         }
         // 100'\0'
         int ver = (databuff[4] & unchecked((int)(0xff))) | (databuff[5] & unchecked((int)
             (0xff))) << 8 | (databuff[6] & unchecked((int)(0xff))) << 16 | (databuff[7] & unchecked(
             (int)(0xff))) << 24;
         if (ver != VER_TAG_LE)
         {
             return null;
         }
         int filesize = (databuff[8] & unchecked((int)(0xff))) | (databuff[9] & unchecked(
             (int)(0xff))) << 8 | (databuff[10] & unchecked((int)(0xff))) << 16 | (databuff[11
             ] & unchecked((int)(0xff))) << 24;
         if (filesize != size)
         {
             return null;
         }
         //// DATA
         tag = (databuff[12] & unchecked((int)(0xff))) | (databuff[13] & unchecked((int)(0xff
             ))) << 8 | (databuff[14] & unchecked((int)(0xff))) << 16 | (databuff[15] & unchecked(
             (int)(0xff))) << 24;
         if (tag != DATA_TAG_LE)
         {
             return null;
         }
         size = (databuff[16] & unchecked((int)(0xff))) | (databuff[17] & unchecked((int)(
             0xff))) << 8 | (databuff[18] & unchecked((int)(0xff))) << 16 | (databuff[19] & unchecked(
             (int)(0xff))) << 24;
         ReadDataArea(databuff, 20, size);
         int offset = 12 + size;
         // これがデータエリア后の位置
         // OBJS
         tag = (databuff[offset] & unchecked((int)(0xff))) | (databuff[offset + 1] & unchecked(
             (int)(0xff))) << 8 | (databuff[offset + 2] & unchecked((int)(0xff))) << 16 | (databuff
             [offset + 3] & unchecked((int)(0xff))) << 24;
         offset += 4;
         if (tag != OBJ_TAG_LE)
         {
             return null;
         }
         //int objsize = ibuff.get();
         int objsize = (databuff[offset] & unchecked((int)(0xff))) | (databuff[offset + 1]
              & unchecked((int)(0xff))) << 8 | (databuff[offset + 2] & unchecked((int)(0xff))
             ) << 16 | (databuff[offset + 3] & unchecked((int)(0xff))) << 24;
         offset += 4;
         ScriptBlock block = new ScriptBlock(owner, name, 0, null, null);
         ReadObjects(block, databuff, offset, objsize);
         return block;
     }
     finally
     {
         if (mDeleteBuffer)
         {
             mReadBuffer = null;
             mByteArray = null;
             mShortArray = null;
             mIntArray = null;
             mLongArray = null;
             mDoubleArray = null;
             mDoubleTmpArray = null;
             mStringArray = null;
             mByteBufferArray = null;
             mObjectsCache.Release();
             mVariantTypeData = null;
         }
     }
 }
コード例 #9
0
ファイル: ScriptCache.cs プロジェクト: fantasydr/krkr-cs
 public ScriptCache(TJS owner)
 {
     mOwner = owner;
     mCache = new Dictionary<ScriptCache.ScriptCacheData, ScriptBlock>(SCRIPT_CACHE_MAX
         );
 }
コード例 #10
0
ファイル: Error.cs プロジェクト: fantasydr/krkr-cs
 /// <summary>TJSGetExceptionObject : retrieves TJS 'Exception' object</summary>
 /// <exception cref="TJSException">TJSException</exception>
 /// <exception cref="VariantException">VariantException</exception>
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public static void GetExceptionObject(TJS tjs, Variant res, Variant msg, Variant 
     trace)
 {
     if (res == null)
     {
         return;
     }
     // not prcess
     // retrieve class "Exception" from global
     Dispatch2 global = tjs.GetGlobal();
     Variant val = new Variant();
     int hr = global.PropGet(0, EXCEPTION_NAME, val, global);
     if (hr < 0)
     {
         throw new TJSException(ExceptionNotFound);
     }
     // create an Exception object
     Holder<Dispatch2> excpobj = new Holder<Dispatch2>(null);
     VariantClosure clo = val.AsObjectClosure();
     Variant[] pmsg = new Variant[1];
     pmsg[0] = msg;
     hr = clo.CreateNew(0, null, excpobj, pmsg, clo.mObjThis);
     if (hr < 0)
     {
         throw new TJSException(ExceptionNotFound);
     }
     Dispatch2 disp = excpobj.mValue;
     if (trace != null)
     {
         string trace_name = "trace";
         disp.PropSet(Interface.MEMBERENSURE, trace_name, trace, disp);
     }
     res.Set(disp, disp);
     excpobj = null;
 }
コード例 #11
0
 public NativeConvertedClassProperty(TJS owner)
     : base(owner)
 {
 }
コード例 #12
0
 public NativeConvertedClassConstructor(TJS owner)
     : base(owner)
 {
 }
コード例 #13
0
 public NativeConvertedClassMethod(TJS owner)
     : base(owner)
 {
 }