青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

隨筆-341  評論-2670  文章-0  trackbacks-0
    為了讓宿主程序可以更加清楚一份Kernel FP代碼的內容,我今天為Kernel FP添加了反射的API。

    Kernel FP的腳本引擎分為VL_KfpSymbol和VL_KfpMachine。其中VL_KfpSymbol負責編譯代碼和構造VL_KfpMachine。VL_KfpMachine的運行可以脫離VL_KfpSymbol,VL_KfpSymbol再次添加代碼并編譯的時候,構造的VL_KfpMachine并不受到影響。先前VL_KfpMachine已經有了小部分反射,主要用于枚舉各種對象的運行時ID。這次VL_KfpSymbol的反射則是用于查看已經添加的代碼的結構。

    反射API如下:
  1 /*********************************************************************************************************
  2 反射
  3 *********************************************************************************************************/
  4 
  5         class VL_KfpAsmDecl : public VL_Base
  6         {
  7         public:
  8             virtual VUnicodeString                GetName()=0;
  9             virtual VUnicodeString                GetOwnerUnitName()=0;
 10         };
 11 
 12         class VL_KfpAsmTypeDecl : public VL_KfpAsmDecl
 13         {
 14             friend class VL_KfpAsmUnit;
 15         protected:
 16             VL_KfpIdTypeDeclaration::Ptr    FInternalObject;
 17 
 18             VL_KfpAsmTypeDecl(VL_KfpIdTypeDeclaration::Ptr Object);
 19         public:
 20             VL_KfpAsmTypeDecl();
 21             ~VL_KfpAsmTypeDecl();
 22 
 23             VUnicodeString                        GetName();
 24             VUnicodeString                        GetOwnerUnitName();
 25             VInt                                GetTypeParameterCount();
 26             VUnicodeString                        GetTypeParameter(VInt Index);
 27             VL_KfpIdType::Ptr                    GetReferencedType();
 28         };
 29 
 30         class VL_KfpAsmCtorDecl : public VL_KfpAsmDecl
 31         {
 32             friend class VL_KfpAsmUnit;
 33         protected:
 34             VL_KfpIdCtorDeclaration::Ptr        FInternalObject;
 35 
 36             VL_KfpAsmCtorDecl(VL_KfpIdCtorDeclaration::Ptr Object);
 37         public:
 38             VL_KfpAsmCtorDecl();
 39             ~VL_KfpAsmCtorDecl();
 40 
 41             VUnicodeString                        GetName();
 42             VUnicodeString                        GetOwnerUnitName();
 43             VUnicodeString                        GetOwnerTypeName();
 44             VL_KfpIdType::Ptr                    GetType();
 45         };
 46 
 47         class VL_KfpAsmExpectedDecl : public VL_KfpAsmDecl
 48         {
 49             friend class VL_KfpAsmUnit;
 50         protected:
 51             VL_KfpIdExpectedDeclaration::Ptr    FInternalObject;
 52 
 53             VL_KfpAsmExpectedDecl(VL_KfpIdExpectedDeclaration::Ptr Object);
 54         public:
 55             VL_KfpAsmExpectedDecl();
 56             ~VL_KfpAsmExpectedDecl();
 57 
 58             VUnicodeString                        GetName();
 59             VUnicodeString                        GetOwnerUnitName();
 60             VInt                                GetTypeParameterCount();
 61             VUnicodeString                        GetTypeParameter(VInt Index);
 62             VL_KfpIdType::Ptr                    GetType();
 63         };
 64 
 65         class VL_KfpAsmFunctionDecl : public VL_KfpAsmDecl
 66         {
 67             friend class VL_KfpAsmUnit;
 68         protected:
 69             VL_KfpIdFunctionDeclaration::Ptr    FInternalObject;
 70 
 71             VL_KfpAsmFunctionDecl(VL_KfpIdFunctionDeclaration::Ptr Object);
 72         public:
 73             VL_KfpAsmFunctionDecl();
 74             ~VL_KfpAsmFunctionDecl();
 75 
 76             VUnicodeString                        GetName();
 77             VUnicodeString                        GetOwnerUnitName();
 78             VInt                                GetTypeParameterCount();
 79             VUnicodeString                        GetTypeParameter(VInt Index);
 80             VL_KfpIdType::Ptr                    GetType();
 81             VBool                                IsExternalFunction();
 82             VUnicodeString                        GetAlias();
 83         };
 84 
 85         class VL_KfpAsmUnit : public VL_Base
 86         {
 87             friend class VL_KfpAsmProgram;
 88         protected:
 89             VL_KfpIdTable::Ptr                    FTable;
 90 
 91             VL_KfpAsmUnit(VL_KfpIdTable::Ptr Table);
 92         public:
 93             VL_KfpAsmUnit();
 94             ~VL_KfpAsmUnit();
 95 
 96             VUnicodeString                        GetName();
 97             VInt                                GetImportCount();
 98             VUnicodeString                        GetImport(VInt Index);
 99             VInt                                GetTypeDeclarationCount();
100             VL_KfpAsmTypeDecl                    GetTypeDeclaration(VInt Index);
101             VInt                                GetCtorDeclarationCount();
102             VL_KfpAsmCtorDecl                    GetCtorDeclaration(VInt Index);
103             VInt                                GetExpectedDeclarationCount();
104             VL_KfpAsmExpectedDecl                GetExpectedDeclaration(VInt Index);
105             VInt                                GetFunctionDeclarationCount();
106             VL_KfpAsmFunctionDecl                GetFunctionDeclaration(VInt Index);
107         };
108 
109         class VL_KfpAsmProgram : public VL_Base
110         {
111             friend class VL_KfpSymbol;
112         protected:
113             typedef VL_AutoPtr<VL_KfpAsmProgram>                    Ptr;
114             VL_KfpCodeUnitAnalyser*                FAnalyser;
115 
116             VL_KfpAsmProgram(VL_KfpCodeUnitAnalyser* Analyser);
117         public:
118             VL_KfpAsmProgram();
119             ~VL_KfpAsmProgram();
120 
121             VInt                                GetUnitCount();
122             VL_KfpAsmUnit                        GetUnit(VInt Index);
123         };
124 
125 /*********************************************************************************************************
126 腳本引擎
127 *********************************************************************************************************/
128 
129         class VL_KfpSymbol : public VL_Base
130         {
131         protected:
132             VL_KfpCodeProvider                    FProvider;
133             VL_KfpCodeUnitAnalyser                FAnalyser;
134             VL_KfpCodeUnit::List                FCodeUnits;
135             VBool                                FErrorState;
136             VL_KfpAsmProgram::Ptr                FProgram;
137         public:
138             VL_KfpSymbol();
139             ~VL_KfpSymbol();
140 
141             VL_KfpCodeUnit::Ptr                    AddUnit(VUnicodeString Code , VL_KfpError::List& Errors);
142             void                                AddUnit(KfpUnit& Unit);
143             VBool                                PreCompile(VL_KfpError::List& Errors);
144             VBool                                IsErrorState();
145             VBool                                HasCodeUnit();
146             VL_KfpMachine::Ptr                    CreateMachine();
147             VUnicodeString                        GetReport();
148             VUnicodeString                        GetDebugInformation();
149             VL_KfpAsmProgram*                    GetProgramForReflection();
150         };

    以下為使用方法。這是一個函數,從VL_KfpSymbol對象開始反射并打印出所反射到的內容:
 1 void ReflectSymbol(VL_KfpSymbol* Symbol)
 2 {
 3     for(VInt i=0;i<Symbol->GetProgramForReflection()->GetUnitCount();i++)
 4     {
 5         VL_KfpAsmUnit Unit=Symbol->GetProgramForReflection()->GetUnit(i);
 6         GetConsole()->Write(L"Unit : "+Unit.GetName()+L"\r\n");
 7         for(VInt j=0;j<Unit.GetImportCount();j++)
 8         {
 9             GetConsole()->Write(L"  Import : "+Unit.GetImport(j)+L"\r\n");
10         }
11         for(VInt j=0;j<Unit.GetTypeDeclarationCount();j++)
12         {
13             VL_KfpAsmTypeDecl TypeDecl=Unit.GetTypeDeclaration(j);
14             GetConsole()->Write(L"    Type Declaration : "+TypeDecl.GetOwnerUnitName()+L"."+TypeDecl.GetName()+L"\r\n");
15             GetConsole()->Write(L"      Parameters : ");
16             for(VInt k=0;k<TypeDecl.GetTypeParameterCount();k++)
17             {
18                 GetConsole()->Write(TypeDecl.GetTypeParameter(k)+L" ");
19             }
20             GetConsole()->Write(L"\r\n");
21             GetConsole()->Write(L"      Type :"+TypeDecl.GetReferencedType()->GenerateCode(L"")+L"\r\n");
22         }
23         for(VInt j=0;j<Unit.GetCtorDeclarationCount();j++)
24         {
25             VL_KfpAsmCtorDecl CtorDecl=Unit.GetCtorDeclaration(j);
26             GetConsole()->Write(L"    Ctor Declaration : "+CtorDecl.GetOwnerUnitName()+L"."+CtorDecl.GetName()+L"\r\n");
27             GetConsole()->Write(L"      Source : "+CtorDecl.GetOwnerTypeName()+L"\r\n");
28             GetConsole()->Write(L"      Type :"+CtorDecl.GetType()->GenerateCode(L"")+L"\r\n");
29         }
30         for(VInt j=0;j<Unit.GetExpectedDeclarationCount();j++)
31         {
32             VL_KfpAsmExpectedDecl ExpectedDecl=Unit.GetExpectedDeclaration(j);
33             GetConsole()->Write(L"    Expected Declaration : "+ExpectedDecl.GetOwnerUnitName()+L"."+ExpectedDecl.GetName()+L"\r\n");
34             GetConsole()->Write(L"      Parameters : ");
35             for(VInt k=0;k<ExpectedDecl.GetTypeParameterCount();k++)
36             {
37                 GetConsole()->Write(ExpectedDecl.GetTypeParameter(k)+L" ");
38             }
39             GetConsole()->Write(L"\r\n");
40             GetConsole()->Write(L"      Type :"+ExpectedDecl.GetType()->GenerateCode(L"")+L"\r\n");
41         }
42         for(VInt j=0;j<Unit.GetFunctionDeclarationCount();j++)
43         {
44             VL_KfpAsmFunctionDecl FunctionDecl=Unit.GetFunctionDeclaration(j);
45             GetConsole()->Write(L"    Function Declaration : "+FunctionDecl.GetOwnerUnitName()+L"."+FunctionDecl.GetName()+L"\r\n");
46             GetConsole()->Write(L"      Parameters : ");
47             for(VInt k=0;k<FunctionDecl.GetTypeParameterCount();k++)
48             {
49                 GetConsole()->Write(FunctionDecl.GetTypeParameter(k)+L" ");
50             }
51             GetConsole()->Write(L"\r\n");
52             GetConsole()->Write(L"      Type :"+FunctionDecl.GetType()->GenerateCode(L"")+L"\r\n");
53             if(FunctionDecl.IsExternalFunction())
54             {
55             GetConsole()->Write(L"      Alias :"+FunctionDecl.GetAlias()+L"\r\n");
56             }
57         }
58         GetConsole()->Write(L"按[ENTER]繼續");
59         GetConsole()->WaitForEnter();
60     }
61 }

    對于宿主程序來說,反射主要用于檢查連接函數的類型,并根據不同的類型使用不同的求值方法進行求值。
posted on 2008-12-20 06:10 陳梓瀚(vczh) 閱讀(1432) 評論(0)  編輯 收藏 引用 所屬分類: 腳本技術
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            黄色亚洲在线| 激情久久久久久久久久久久久久久久| 国产精品国产三级国产aⅴ无密码| 一本色道久久综合亚洲精品按摩 | 一区二区三区黄色| 亚洲精品资源美女情侣酒店| 91久久国产综合久久蜜月精品| 亚洲国产专区| 欧美成人精品福利| 欧美视频精品一区| 国产精品欧美日韩久久| 国产一区二区久久精品| 伊人狠狠色丁香综合尤物| …久久精品99久久香蕉国产| 亚洲国产天堂久久综合网| 亚洲精品免费一二三区| 国产精品99久久久久久白浆小说| 亚洲自拍偷拍网址| 久久久九九九九| 欧美成人午夜77777| 亚洲国产一区二区精品专区| 亚洲福利视频网站| 在线综合视频| 欧美在线免费视频| 欧美国产日韩一区二区| 国产精品成人一区二区三区夜夜夜| 宅男噜噜噜66一区二区| 久久久亚洲高清| 欧美香蕉视频| 亚洲国产精品美女| 亚洲在线视频免费观看| 免费成人在线视频网站| 一本色道久久综合狠狠躁篇怎么玩| 欧美一区二区三区四区在线观看地址 | 亚洲综合视频1区| 久久蜜桃资源一区二区老牛| 欧美区一区二区三区| 国产在线高清精品| 亚洲精品一区在线| 久久综合久久综合久久综合| 亚洲精品日韩一| 91久久午夜| 亚洲欧美在线aaa| 欧美久色视频| 亚洲第一主播视频| 久久福利精品| 中文成人激情娱乐网| 男女视频一区二区| 好吊色欧美一区二区三区四区| 亚洲午夜激情网页| 亚洲高清一区二| 久久精品国产欧美激情| 国产精品入口| 亚洲欧美国产精品va在线观看| 欧美激情第二页| 欧美成人日本| 久久一区二区三区av| 国产精品毛片a∨一区二区三区| 亚洲免费观看高清在线观看| 久久免费视频网| 久久夜色精品国产| 午夜激情综合网| 国产欧美精品日韩精品| 亚洲欧美中文日韩在线| 99国产精品久久| 欧美三日本三级少妇三99| 最新亚洲一区| 亚洲高清不卡av| 欧美阿v一级看视频| 在线精品视频一区二区| 久久久亚洲午夜电影| 亚洲欧美国产日韩天堂区| 国产伦精品一区二区三区视频黑人 | 亚洲男人的天堂在线观看| 91久久久一线二线三线品牌| 久久久久久久激情视频| 尤物精品国产第一福利三区| 欧美jizzhd精品欧美巨大免费| 久久九九久久九九| 亚洲国产精品精华液2区45| 欧美激情麻豆| 欧美视频你懂的| 欧美一级大片在线免费观看| 午夜精品久久久久久久久| 好吊视频一区二区三区四区| 欧美激情免费观看| 欧美猛交免费看| 性欧美18~19sex高清播放| 亚洲欧美怡红院| 亚洲第一福利社区| 一道本一区二区| 国产情人节一区| 欧美成人四级电影| 国产精品v日韩精品| 久久精品免费看| 久久综合色天天久久综合图片| 亚洲精品一区二区在线观看| 一区二区激情小说| 国产主播一区二区| 亚洲精品免费在线播放| 欧美日韩在线一二三| 久久久噜噜噜| 欧美日韩在线三级| 久久xxxx| 欧美片第1页综合| 久久福利毛片| 欧美另类高清视频在线| 久久gogo国模啪啪人体图| 亚洲国产日韩在线| 美女诱惑一区| 亚洲男人第一网站| 鲁大师影院一区二区三区| 一区二区三区视频观看| 久久精彩视频| 欧美一区三区二区在线观看| 欧美成人精品一区| 久久―日本道色综合久久| 国产精品ⅴa在线观看h| 欧美电影美腿模特1979在线看| 国产精品一区久久久久| 亚洲精品欧美极品| 亚洲黄色毛片| 久久精品欧美日韩精品| 午夜国产不卡在线观看视频| 欧美国产日韩a欧美在线观看| 久久精品免费看| 国产日韩欧美视频在线| 亚洲伦理一区| 亚洲久久一区| 欧美大胆人体视频| 欧美jizzhd精品欧美喷水| 国产亚洲欧美日韩在线一区| 亚洲一区二区三区成人在线视频精品| 亚洲美女黄网| 欧美激情视频免费观看| 欧美激情女人20p| 亚洲国产欧美一区二区三区久久| 久久国产黑丝| 欧美成人官网二区| 激情av一区| 欧美一区二区三区视频免费播放| 欧美一区二区三区在线| 国产精品人人做人人爽| 亚洲天堂成人在线视频| 亚洲专区一区| 国产伦精品一区二区三区在线观看| 欧美黄色精品| 亚洲国产日韩欧美在线99| 久久久之久亚州精品露出| 久久亚洲捆绑美女| 亚洲精美视频| 欧美激情国产精品| 亚洲毛片在线观看| 亚洲欧美日韩一区在线| 国产精品高清在线观看| 亚洲一区中文字幕在线观看| 欧美一站二站| 国内自拍一区| 美国三级日本三级久久99| 亚洲欧洲一区二区三区在线观看| 中文精品视频| 国产精品一区久久| 蜜乳av另类精品一区二区| 日韩午夜免费| 久久精品久久综合| 亚洲日本va在线观看| 欧美日韩大片| 欧美一区二区三区免费观看视频 | 国产精品女主播在线观看| 午夜精品久久久久久久男人的天堂| 久久久夜精品| 亚洲视频在线看| 玉米视频成人免费看| 欧美日本亚洲| 久久se精品一区精品二区| 亚洲黄页视频免费观看| 狠狠色狠狠色综合日日91app| 久久综合久久综合九色| 一区二区三区免费网站| 久久综合综合久久综合| 一区二区三区四区五区精品视频| 国产午夜精品理论片a级大结局 | 国产精品v欧美精品∨日韩| 亚洲欧美另类久久久精品2019| 欧美va亚洲va香蕉在线| 亚洲欧美一区二区三区久久| 在线播放豆国产99亚洲| 国产精品xxxxx| 久久综合电影一区| 午夜精品福利一区二区三区av| 欧美va亚洲va香蕉在线| 久久福利一区| 亚洲亚洲精品在线观看 | 欧美日韩精品欧美日韩精品| 午夜精品福利一区二区三区av| 亚洲国产福利在线| 欧美一级理论性理论a| 亚洲精品一区二区在线观看| 国产一区999| 国产九色精品成人porny|