チェンジセット 1733

差分発生行の前後
無視リスト:
コミット日時:
2008/10/28 20:08:01 (3 年前)
コミッタ:
mzp
ログメッセージ:

code完成

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • ocaml/abc2xml/code.ml

    r1720 r1733  
    88  attr name @@ List.map (fun (x,y) -> (x,Int32.to_string y)) attrs 
    99 
     10let op_i name attrs = 
     11  attr name @@ List.map (fun (x,y) -> (x,string_of_int y)) attrs 
     12 
    1013let to_xml = function 
    1114    `Add -> 
     
    1518  | `AsType index -> 
    1619      op_a "OpAsType" ["name",index] 
    17   | `AsTypeLate index -> 
    18       op_a "OpAsTypeLate" ["name",index] 
     20  | `AsTypeLate -> 
     21      op "OpAsTypeLate" 
    1922  | `BitAnd -> 
    2023      op "OpBitAnd" 
     
    3942  | `CallSuper (name,argc) -> 
    4043      op_a "OpCallSuper" ["name",name; "argc",argc] 
     44  | `CallSuperVoid (name,argc) -> 
     45      op_a "OpCallSuperVoid" ["name",name; "argc",argc] 
    4146  | `CheckFilter -> 
    42       op "CheckFilter" 
     47      op "OpCheckFilter" 
    4348  | `Coerce name -> 
    4449      op_a "OpCoerce" ["name",name] 
     
    6873      attr "OpDebug" ["unknown", string_of_int unknown; 
    6974                      "name"   , Int32.to_string name; 
    70                       "reg"    , Int32.to_string reg; 
     75                      "reg"    , string_of_int reg; 
    7176                      "line"   , Int32.to_string line] 
    7277  | `DebugFile file -> 
     
    8893  | `Dup -> 
    8994      op "OpDup" 
    90   | `Dxns -> 
    91       op "OpDXNs" 
     95  | `Dxns name -> 
     96      op_a "OpDXNs" ["name",name] 
    9297  | `DxnsLate -> 
    9398      op "OpDXNsLate" 
     
    123128      op_a "OpGetProperty" ["name",name] 
    124129  | `GetScopeObject scope_index -> 
    125       attr "OpGetScopeObject" ["scopeIndex",scope_index] 
     130      attr "OpGetScopeObject" ["scopeIndex",string_of_int scope_index] 
    126131  | `GetSlot slot_id -> 
    127132      op_a "OpGetSlot" ["slotID",slot_id] 
     
    136141  | `HasNext2 (object_reg,index_reg) -> 
    137142      op_a "OpHasNext2" ["object",object_reg;"index",index_reg] 
    138        
    139  
    140  
     143  | `IfEq target -> 
     144      op_i "OpIfEq" ["target",target] 
     145  | `IfFalse target -> 
     146      op_i "OpIfFalse" ["target",target] 
     147  | `IfGt target -> 
     148      op_i "OpIfGt" ["target",target] 
     149  | `IfLe target -> 
     150      op_i "OpIfLe" ["target",target] 
     151  | `IfLt target -> 
     152      op_i "OpIfLt" ["target",target] 
     153  | `IfNge target -> 
     154      op_i "OpIfNge" ["target",target] 
     155  | `IfNgt target -> 
     156      op_i "OpIfNgt" ["target",target] 
     157  | `IfNle target -> 
     158      op_i "OpIfNle" ["target",target] 
     159  | `IfNlt target -> 
     160      op_i "OpIfNgt" ["target",target] 
     161  | `IfNe target -> 
     162      op_i "OpIfNe"  ["target",target] 
     163  | `IfStrictEq target -> 
     164      op_i "OpIfStrictEq" ["target",target] 
     165  | `IfStrictNe target -> 
     166      op_i "OpIfStrictNe" ["target",target] 
     167  | `IfTrue target -> 
     168      op_i "OpIfTrue" ["target",target] 
     169  | `In -> 
     170      op "OpIn" 
     171  | `IncLocal address -> 
     172      op_a "OpIncLocal" ["address",address] 
     173  | `IncLocal_i address -> 
     174      op_a "OpIncLocalI" ["address",address] 
     175  | `Increment -> 
     176      op "OpIncrement" 
     177  | `Increment_i -> 
     178      op "OpIncrementI" 
     179  | `InitProperty name -> 
     180      op_a "OpInitProperty" ["name",name] 
     181  | `InstanceOf -> 
     182      op "OpInstanceOf" 
     183  | `IsType name -> 
     184      op_a "OpIsType" ["name",name] 
     185  | `IsTypeLate -> 
     186      op "OpIsTypeLate" 
     187  | `Jump target -> 
     188      op_i "OpJump" ["target",target] 
     189  | `Kill address -> 
     190      op_a "OpKill" ["address",address] 
     191  | `Label -> 
     192      op "OpLabel" 
     193  | `LessEquals -> 
     194      op "OpLessEquals" 
     195  | `LessThan -> 
     196      op "OpLessThan" 
     197  | `LookupSwitch (default_target,target_table) -> 
     198      element "OpLookupSwitch" ["defaultTarget",string_of_int default_target; 
     199                                "caseCount"    ,string_of_int @@ List.length target_table] 
     200        [elem "targetTable" @@ List.map (fun v -> attr "U30" ["value",string_of_int v]) target_table] 
     201  | `LShift -> 
     202      op "OpLShift" 
     203  | `Modulo -> 
     204      op "OpModulo" 
     205  | `Multiply -> 
     206      op "OpMultiply" 
     207  | `Multiply_i -> 
     208      op "OpMultiplyI" 
     209  | `Negate -> 
     210      op "OpNegate" 
     211  | `Negate_i -> 
     212      op "OpNegateI" 
     213  | `NewActivation -> 
     214      op "OpNewActivation" 
     215  | `NewArray argc -> 
     216      op_a "OpNewArray" ["argc",argc] 
     217  | `NewCatch exceptionIndex -> 
     218      op_a "OpNewCatch" ["exceptionIndex",exceptionIndex] 
     219  | `NewClass classIndex -> 
     220      op_a "OpNewClass" ["classIndex",classIndex] 
     221  | `NewFunction index -> 
     222      op_a "OpNewFunction" ["index",index] 
     223  | `NewObject argc -> 
     224      op_a "OpNewObject" ["argc",argc] 
     225  | `NextName -> 
     226      op "OpNextName" 
     227  | `NextValue -> 
     228      op "OpNextValue" 
     229  | `Nop -> 
     230      op "OpNop" 
     231  | `Not -> 
     232      op "OpNot" 
     233  | `Pop -> 
     234      op "OpPop" 
     235  | `PopScope -> 
     236      op "OpPopScope" 
     237  | `PushByte byte -> 
     238      attr "OpPushByte" ["value",string_of_int byte] 
     239  | `PushDouble index -> 
     240      op_a "OpPushDouble" ["index",index] 
     241  | `PushFalse -> 
     242      op "OpPushFalse" 
     243  | `PushInt index -> 
     244      op_a "OpPushInt" ["index",index] 
     245  | `PushNamespace index -> 
     246      op_a "OpPushNamespace" ["index",index] 
     247  | `PushNan -> 
     248      op "OpPushNan" 
     249  | `PushNull -> 
     250      op "OpPushNull" 
     251  | `PushScope -> 
     252      op "OpPushScope" 
     253  | `PushShort value -> 
     254      op_a "OpPushShort" ["value",value] 
     255  | `PushString index -> 
     256      op_a "OpPushString" ["index",index] 
     257  | `PushTrue -> 
     258      op "OpPushTrue" 
     259  | `PushUInt index -> 
     260      op_a "OpPushUInt" ["index",index] 
     261  | `PushUndefined -> 
     262      op "OpPushUndefined" 
     263  | `PushWith -> 
     264      op "OpPushWith" 
     265  | `ReturnValue -> 
     266      op "OpReturnValue" 
     267  | `ReturnVoid -> 
     268      op "OpReturnVoid" 
     269  | `RShift -> 
     270      op "OpRShift" 
     271  | `SetLocal address -> 
     272      op_a "OpSetLocal" ["address",address] 
     273  | `SetLocal_0 -> 
     274      op "OpSetLocal0" 
     275  | `SetLocal_1 -> 
     276      op "OpSetLocal1" 
     277  | `SetLocal_2 -> 
     278      op "OpSetLocal2" 
     279  | `SetLocal_3 -> 
     280      op "OpSetLocal3" 
     281  | `SetGlobalSlot slot_id -> 
     282      op_a "OpSetGlobalSlot" ["slotID",slot_id] 
     283  | `SetProperty name -> 
     284      op_a "OpSetProperty" ["name",name] 
     285  | `SetSlot slot_id -> 
     286      op_a "OpSetSlot" ["slotID",slot_id] 
     287  | `SetSuper name -> 
     288      op_a "OpSetSuper" ["name",name] 
     289  | `StrictEquals -> 
     290      op "OpStrictEquals" 
     291  | `Subtract -> 
     292      op "OpSubtract" 
     293  | `Subtract_i -> 
     294      op "OpSubtractI" 
     295  | `SubtractI -> 
     296      op "OpSubtractI" 
     297  | `Swap -> 
     298      op "OpSwap" 
     299  | `Throw -> 
     300      op "OpThrow" 
     301  | `TypeOf -> 
     302      op "OpTypeOf" 
     303  | `URShift -> 
     304      op "OpURShift" 
     305         
  • ocaml/abc2xml/disasm.ml

    r1720 r1733  
    4242        `CallSuperVoid (index,arg_count) 
    4343    | [< _ = op 0x78 >] -> 
    44         `Checkfilter 
     44        `CheckFilter 
    4545    | [< _ = op 0x80; index = u30 >] -> 
    4646        `Coerce index 
     
    240240    | [< _ = op 0x27 >] -> 
    241241        `PushFalse 
    242     | [< _ = op 0x2d >] -> 
    243         `PushInt 
     242    | [< _ = op 0x2d; index = u30 >] -> 
     243        `PushInt index 
    244244    | [< _ = op 0x31; index = u30 >] -> 
    245245        `PushNamespace index 
  • ocaml/abc2xml/swfmill.ml

    r1706 r1733  
    163163         [elem "traits" @@ List.map of_trait c#traits]) xs 
    164164 
    165 let of_code _ = elem "NotYet" [] 
    166165let of_exception e =  
    167166  index_attr "Exception" [ 
     
    181180                             "methodInfo"    ,Int32.to_string m#methodi; 
    182181                             "scopeDepth"    ,Int32.to_string m#init_scope_depth] 
    183          [elem_with "code"       of_code      m#code; 
     182         [elem_with "code"       Code.to_xml      m#code; 
    184183          elem_with "exceptions" of_exception m#exceptions; 
    185184          elem_with "traits"     of_trait     m#traits ]) xs 
  • ocaml/abc2xml/test/swfmillTest.ml

    r1710 r1733  
    8787                                  "maxStack"      ,"2"; 
    8888                                  "maxRegs"       ,"1"; 
    89                                   "scopeDepth"    ,"1"; 
     89                                  "scopeDepth"    ,"0"; 
    9090                                  "maxScope"      ,"1"; 
    9191                                  "exceptionCount","0"] 
     
    9797                  attr "OpCallPropLex" ["name","2";"argc","1"]; 
    9898                  attr "OpPop" []; 
    99                   attr "OpReturnVoid" []; ]; ]; 
    100             elem "exceptions" []; 
    101             elem "traits" [
     99                  attr "OpReturnVoid" []; ];  
     100               elem "exceptions" []; 
     101               elem "traits" []
    102102          ]); 
    103103   ])  +> run_test_tt