home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v2.zip / DDKX86 / DBCSDD / INC_DBCS / STRUC30.INC < prev    next >
Text File  |  1995-04-14  |  17KB  |  857 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  4. ;
  5. ;    The following IBM OS/2 WARP source code is provided to you solely for
  6. ;    the purpose of assisting you in your development of OS/2 WARP device
  7. ;    drivers. You may use this code in accordance with the IBM License
  8. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  9. ;    Copyright statement may not be removed.;
  10. ;*****************************************************************************/
  11. ;       SCCSID = @(#)struc30.inc    6.1 90/11/16
  12. ;;    SCCSID = @(#)struc30.inc    6.3 90/02/20
  13. ;;STRUC--Stucture Macro Library
  14. ;;Version 3.1  02/12/90
  15. ;;Written by Eric C. Rasmussen
  16. if1
  17. $NoConj        equ    0
  18. $And        equ    1
  19. $and        equ    $And
  20. $AND        equ    $And
  21. $Or        equ    2
  22. $or        equ    $Or
  23. $OR        equ    $Or
  24. $Short        equ    3
  25. $short        equ    $Short
  26. $SHORT        equ    $Short
  27. $Near        equ    4
  28. $near        equ    $Near
  29. $NEAR        equ    $Near
  30. $NearToShort    equ    5
  31. $ncxz        equ    6
  32. $NCXZ        equ    6
  33. $AndOr        =    0
  34. $Temp        =    0
  35. $Temp2        =    0
  36. $Dist        =    0
  37.  
  38. $NoType        equ    10
  39. $ConjIfType    equ    11
  40. $IfType        equ    12
  41. $ElseType    equ    13
  42. $WhileType    equ    14
  43. $ConjWhileType    equ    15
  44. $RepeatType    equ    16
  45. $ConjUntilType    equ    17
  46. $ForType    equ    18
  47. $ConjLeaveType    equ    19
  48. $SelectType    equ    20
  49. $WhenType    equ    21
  50. $ConjWhenType    equ    22
  51. $OtherwiseType    equ    $ElseType
  52.  
  53. $StrucError macro text
  54.                     Structure error -- text
  55. endm
  56.  
  57. J    macro
  58.     $StrucError <invalid condition>
  59. endm
  60. JN    macro
  61.     $StrucError <invalid condition>
  62. endm
  63.  
  64. $opj    equ    0e9h
  65. $opjo    equ    80h
  66. $opjno    equ    81h
  67. $opjb    equ    82h
  68. $opjc    equ    82h
  69. $opjnae equ    82h
  70. $opjae    equ    83h
  71. $opjnb    equ    83h
  72. $opjnc    equ    83h
  73. $opje    equ    84h
  74. $opjz    equ    84h
  75. $opjne    equ    85h
  76. $opjnz    equ    85h
  77. $opjbe    equ    86h
  78. $opjna    equ    86h
  79. $opja    equ    87h
  80. $opjnbe equ    87h
  81. $opjs    equ    88h
  82. $opjns    equ    89h
  83. $opjp    equ    8ah
  84. $opjpe    equ    8ah
  85. $opjpo    equ    8bh
  86. $opjnp    equ    8bh
  87. $opjl    equ    8ch
  88. $opjnge equ    8ch
  89. $opjge    equ    8dh
  90. $opjnl    equ    8dh
  91. $opjle    equ    8eh
  92. $opjng    equ    8eh
  93. $opjg    equ    8fh
  94. $opjnle equ    8fh
  95. $opjcxz equ    0
  96. $opjecxz equ    1
  97. $opjncxz equ    2
  98. $opjnecxz equ    3
  99.  
  100. endif
  101.  
  102. $BuildJump   macro   j1,j2
  103.     $op&j1    equ $op&j2
  104.     j1  macro   t1,t2
  105.         .xcref  j1
  106.                     j2 t1 t2
  107.     endm
  108. endm
  109.  
  110. irp    x,<<jeq,je>,<jlt,jl>,<jgt,jg>,<jneq,jne>,<jnlt,jnl>,<jngt,jng>,<jnpe,jpo>,<jnpo,jpe>>
  111.     $BuildJump x
  112. endm
  113. irp    x,<<jzero,jz>,<jnzero,jnz>,<jnonzero,jnz>,<jnnonzero,jz>,<jand,jnz>,<jnand,jz>,<jnnand,jnz>>
  114.     $BuildJump x
  115. endm
  116. irp    x,<a,ae,b,be,c,e,g,ge,l,le,o,p,s,z,cxz,ecxz>
  117.     $BuildJump jnn&x,j&x
  118. endm
  119.  
  120. if1
  121. jncxz    macro    t1,t2
  122.     if    $Dist eq $NearToShort
  123.                     jcxz $+5
  124.                     jmp t1 t2
  125.     else
  126.                     jcxz $+4
  127.                     jmp t1 t2
  128.     endif
  129. endm
  130.  
  131. purge    $BuildJump
  132.  
  133. $GetConj macro    p1,p2
  134.     $AndOr    = $NoConj
  135.     irp    parm,<p1,p2>
  136.         ifnb    <&parm>
  137.         irp    x,<and,AND,or,OR>
  138.             ifidn   <parm>,<x>
  139.              $AndOr = $&&&x
  140.              exitm
  141.             endif
  142.         endm
  143.         endif
  144.     endm
  145. endm
  146.  
  147. $GetDist macro    p1,p2
  148.     irp    parm,<p1,p2>
  149.         ifnb    <parm>
  150.         irp    x,<short,SHORT,near,NEAR>
  151.             ifidn   <parm>,<x>
  152.             $Dist    = $&&&x
  153.              exitm
  154.              endif
  155.         endm
  156.         endif
  157.     endm
  158. endm
  159.  
  160.  
  161. $Poke    macro    n,m
  162.     $st&n    = m
  163. .xcref    $st&n
  164. endm
  165.  
  166. $Peek    macro    x,n
  167.     x    = $st&n
  168. endm
  169.  
  170. $Push    macro    n
  171.     $st    = $st+1
  172.     $Poke    %$st,n
  173. endm
  174.  
  175. $Pop    macro    x
  176.     if    $st gt 0
  177.         $Peek   x,%$st
  178.         $st        = $st-1
  179.     else
  180.         $StrucError <open structure>
  181.     endif
  182. endm
  183.  
  184. $EquateLabel macro last,this
  185.     if    $LastLabelOrg eq $
  186.         $ll&last = this
  187.         .xcref  $ll&last
  188.     endif
  189. endm
  190.  
  191. $TraceLabel macro n,a,b
  192.     if    $ll&a eq $ll&b
  193.         $ll&n   = b
  194.         .xcref  $ll&n
  195.     else
  196.         $TraceLabel n,%$ll&a,%$ll&b
  197.     endif
  198. endm
  199.  
  200. $Label     macro     n
  201.     if1
  202.         $EquateLabel %$LastLabel,n
  203.         $ll&n   = n
  204.         .xcref  $ll&n
  205.         $LastLabel = n
  206.         $LastLabelOrg = $
  207. $l&n:
  208.     else
  209.         if        $ll&n eq n
  210. $l&n:
  211.         else
  212.         .xcref    $l&n
  213.         .xcref    $ll&n
  214.         endif
  215.     endif
  216. endm
  217.  
  218. $JCond    macro    opcode,tgt,rel32,mnemonic,semi
  219.     local    l1,l2,l3,l4,l5,l6
  220.     if    opcode eq $opjcxz
  221.         if1
  222.                     jcxz l1
  223.         else
  224.             if    (($ - tgt) le 126) and ((tgt - $) le 129)
  225.                     jcxz tgt
  226.             else
  227.                     jcxz l1
  228.             endif
  229.         endif
  230.                     jmp short l2
  231. l1:
  232.         $JCond    %$opj,tgt,rel32,jmp,!; 
  233. l2:
  234.         exitm
  235.     endif
  236.     if    opcode eq $opjecxz
  237.         if1
  238.                     jecxz l3
  239.         else
  240.             if    (($ - tgt) le 126) and ((tgt - $) le 129)
  241.                     jecxz tgt
  242.             else
  243.                     jecxz l3
  244.             endif
  245.         endif
  246.                     jmp short l4
  247. l3:
  248.         $JCond    %$opj,tgt,rel32,jmp,!; 
  249. l4:
  250.         exitm
  251.     endif
  252.     if    opcode    eq $opjncxz
  253.                     jcxz l5
  254.         $JCond    %$opj,tgt,rel32,jmp,!; 
  255. l5:
  256.         exitm
  257.     endif
  258.     if    opcode    eq $opjnecxz
  259.                     jecxz l6
  260.         $JCond    %$opj,tgt,rel32,jmp,!; 
  261. l6:
  262.         exitm
  263.     endif
  264.     if    opcode eq $opj
  265.                     db opcode semi mnemonic tgt
  266.     else
  267.                     db 0fh,opcode semi mnemonic tgt
  268.     endif
  269.     if1
  270.                     dw ?
  271.         if    rel32 eq 4
  272.                     dw ?
  273.         endif
  274.     else
  275.         if    rel32 eq 4
  276.                     dd tgt-$-4
  277.         else
  278.                     dw tgt-$-2
  279.         endif
  280.     endif
  281. endm
  282.  
  283. $CondJump macro l,tf,c
  284.     if1
  285.         ifb        <c>
  286.         $EquateLabel %$LastLabel,l
  287.         endif
  288.         ifndef  <$ll&l>
  289.         $ll&l    = l
  290.         .xcref    $ll&l
  291.         endif
  292.     else
  293.         $TraceLabel l,l,%$ll&l
  294.     endif
  295.     $CondJump2 %$ll&l,tf,c
  296. endm
  297.  
  298. $CondJump2 macro l,tf,c
  299.     if    $Dist eq $Short
  300.         ifb        <c>
  301.                     jmp short $l&l
  302.         else
  303.         ifidn <tf>,<f>
  304.                     jn&c short $l&l
  305.         else
  306.                     j&c short $l&l
  307.         endif
  308.         endif
  309.     else
  310.         ifdef   @Cpu
  311.         if    (@Cpu and 1000b)
  312.             ifb    <c>
  313.                 ifidn    <tf>,<NoFold>
  314.                     jmp $l&l
  315.                 else
  316.                     $JCond    %$opj,$l&l,@WordSize,jmp,!; 
  317.                 endif
  318.             else
  319.                 ifidn    <tf>,<f>
  320.                     $JCond    %$opjn&c,$l&l,@WordSize,jn&c,!; 
  321.                 else
  322.                     $JCond    %$opj&c,$l&l,@WordSize,j&c,!; 
  323.                 endif
  324.             endif
  325.             exitm
  326.         endif
  327.         endif
  328.         ifnb    <c>
  329.         ifdef    $l&l
  330.             if        (($ - $l&l) le 126) and (($l&l - $) le 129)
  331.             $Dist    = $NearToShort
  332.             $nops    = 3
  333.             ifidn <tf>,<f>
  334.                     jn&c $l&l
  335.                 ifdef   $n&c
  336.                 if    $n&c eq $ncxz
  337.                     $nops = 0
  338.                 endif
  339.                 endif
  340.                 ifdef   $&c
  341.                 if    $&c eq $ncxz
  342.                     $nops = 5
  343.                 endif
  344.                 endif
  345.             else
  346.                     j&c $l&l
  347.                 ifdef   $n&c
  348.                 if    $n&c eq $ncxz
  349.                     $nops = 5
  350.                 endif
  351.                 endif
  352.                 ifdef   $&c
  353.                 if    $&c eq $ncxz
  354.                     $nops = 0
  355.                 endif
  356.                 endif
  357.             endif
  358.                 rept $nops
  359.                 nop
  360.                 endm
  361.             else
  362.             ifidn <tf>,<f>
  363.                     j&c $+5
  364.             else
  365.                     jn&c $+5
  366.             endif
  367.                     jmp $l&l
  368.             endif
  369.         else
  370.             ifidn <tf>,<f>
  371.                     j&c $+5
  372.             else
  373.                     jn&c $+5
  374.             endif
  375.                     jmp $l&l
  376.         endif
  377.         else
  378.         ifdef    $l&l
  379.             ifidn   <tf>,<NoFold>
  380.                     jmp $l&l
  381.             else
  382.             if    (($ - $l&l) le 126) and (($l&l - $) le 129)
  383.                     jmp short $l&l
  384.                     nop
  385.             else
  386.                     jmp $l&l
  387.             endif
  388.             endif
  389.         else
  390.                     jmp $l&l
  391.         endif
  392.         endif
  393.     endif
  394. endm
  395.  
  396.  
  397. $CondLoop macro l,c
  398.                     loop&c $l&l
  399. endm
  400.  
  401. $Test    macro    tgt,a1,a2,a3,a4,x
  402.     ifb    <a1>
  403.         $StrucError <invalid condition>
  404.     else
  405.     ifb    <a2>
  406.         $CondJump %&tgt,a1
  407.     else
  408.     ifb    <a3>
  409.         ifdif   <a1>,<zero>
  410.         ifdif   <a1>,<nonzero>
  411.         ifdif   <a1>,<ZERO>
  412.         ifdif   <a1>,<NONZERO>
  413.         $StrucError <invalid condition>
  414.         exitm
  415.         endif
  416.         endif
  417.         endif
  418.         endif
  419.                     or a2,a2
  420.         $CondJump %&tgt,a1
  421.     else
  422.     ifb    <a4>
  423.                     cmp a1,a3
  424.         $CondJump %&tgt,a2
  425.     else
  426.     ifb    <x>
  427.         ifdif   <a1>,<bit>
  428.         ifdif   <a1>,<BIT>
  429.         $StrucError <invalid condition>
  430.         exitm
  431.         endif
  432.         endif
  433.                     test a2,a4
  434.         $CondJump %&tgt,a3
  435.     else
  436.         $StrucError <invalid condition>
  437.     endif
  438.     endif
  439.     endif
  440.     endif
  441.     endif
  442. endm
  443.  
  444. $TopTest macro    args,n,c,p4,p5
  445.     $GetConj p4,p5
  446.     $Dist    = $DefDist
  447.     $GetDist p4,p5
  448.     if    $AndOr eq $NoConj
  449.         $Test   <$sn-1,f>,args
  450.         $Pop    $Temp
  451.         if        $OrFound
  452.         $Label    %$Temp
  453.         endif
  454.         $Push   n
  455.     else
  456.         if        $AndOr eq $And
  457.         $Test    <$sn-1,f>,args
  458.         else
  459.         $OrFound = 1
  460.         $Test    <$sn,t>,args
  461.         endif
  462.         $Push   c
  463.     endif
  464. endm
  465. ;;*****************************************************************************
  466. .if    macro    t,p2,p3
  467.     $Peek    $Temp,%$st
  468.     if    $Temp eq $ConjIfType
  469.         $Pop    $Temp
  470.     else
  471.         $OrFound = 0
  472.         $sn        = $sn+1
  473.         $Push   $sn
  474.         $sn        = $sn+1
  475.         $Push   $sn
  476.         $sn        = $sn+1
  477.         $Push   $sn
  478.     endif
  479.     $TopTest <t>,$IfType,$ConjIfType,p2,p3
  480. endm
  481. ;;*****************************************************************************
  482. .then    macro
  483.     $Peek    $Temp,%$st
  484.     if    $Temp ne $IfType
  485.     if    $Temp ne $WhenType
  486.         $StrucError <then without if or when>
  487.     endif
  488.     endif
  489. endm
  490. ;;*****************************************************************************
  491. .elseif macro    t,p2,p3
  492.     $Pop    $Temp
  493.     if    $Temp ne $IfType
  494.         $StrucError <elseif without if>
  495.         exitm
  496.     endif
  497.     $OrFound = 0
  498.     $Pop    $Temp
  499.     $Peek    $Temp2,%$st
  500.     $Dist    = $Near
  501.     $CondJump %$Temp2
  502.     $Label    %$Temp
  503.     $sn    = $sn+1
  504.     $Push    $sn
  505.     $sn    = $sn+1
  506.     $Push    $sn
  507.     $TopTest <t>,$IfType,$ConjIfType,p2,p3
  508. endm
  509. ;;*****************************************************************************
  510. .else    macro    dist
  511.     $Pop    $Temp
  512.     if    $Temp ne $IfType
  513.     if    $Temp ne $WhenType
  514.     if    $Temp ne $SelectType
  515.         $StrucError <else without if, when or select>
  516.         exitm
  517.     endif
  518.     endif
  519.     endif
  520.     $sn    = $sn+1
  521.     if    $Temp eq $SelectType
  522.         $Push   $sn
  523.     else
  524.         $Dist   = $DefDist
  525.         $GetDist dist
  526.         $CondJump %$sn
  527.         $Pop    $Temp
  528.         $Label  %$Temp
  529.         $Push   $sn
  530.     endif
  531.     $Push    $ElseType
  532. endm
  533. ;;*****************************************************************************
  534. .endif    macro
  535.     $Pop    $Temp
  536.     if    $Temp ne $IfType
  537.         if        $Temp ne $ElseType
  538.         $StrucError <endif without if>
  539.         exitm
  540.         endif
  541.     endif
  542.     $Pop    $Temp
  543.     $Label    %$Temp
  544.     $Pop    $Temp
  545.     $Label    %$Temp
  546. endm
  547. ;;*****************************************************************************
  548. .select macro    x
  549.     $OrFound = 0
  550.     $sn    = $sn+1
  551.     $Push    $sn
  552.     $Push    $SelectType
  553. endm
  554. ;;*****************************************************************************
  555. .when    macro    tst,p2,p3
  556.     $Pop    $Temp
  557.     if    $Temp ne $SelectType
  558.     if    $Temp ne $WhenType
  559.     if    $Temp ne $ConjWhenType
  560.         $StrucError <when without select>
  561.         exitm
  562.     endif
  563.     endif
  564.     endif
  565.     if    $Temp ne $ConjWhenType
  566.         $Dist   = $Near
  567.         $OrFound = 0
  568.         if        $Temp eq $WhenType
  569.         $Pop    $Temp2
  570.         $Peek    $Temp,%$st
  571.         $CondJump %$Temp
  572.         $Label     %$Temp2
  573.         endif
  574.         $sn        = $sn+1
  575.         $Push   $sn
  576.         $sn        = $sn+1
  577.         $Push   $sn
  578.     endif
  579.     $TopTest <tst>,$WhenType,$ConjWhenType,p2,p3
  580. endm
  581. ;;*****************************************************************************
  582. .otherwise    macro    dist
  583.     $Pop    $Temp
  584.     if    $Temp ne $WhenType
  585.     if    $Temp ne $SelectType
  586.     if    $Temp ne $IfType
  587.         $StrucError <otherwise without if, when or select>
  588.         exitm
  589.     endif
  590.     endif
  591.     endif
  592.     $sn    = $sn+1
  593.     if    $Temp eq $SelectType
  594.         $Push   $sn
  595.     else
  596.         $Dist   = $DefDist
  597.         $GetDist dist
  598.         $CondJump %$sn
  599.         $Pop    $Temp
  600.         $Label  %$Temp
  601.         $Push   $sn
  602.     endif
  603.     $Push    $OtherwiseType
  604. endm
  605. ;;*****************************************************************************
  606. .endselect    macro
  607.     $Pop    $Temp
  608.     if    $Temp ne $WhenType
  609.     if    $Temp ne $OtherwiseType
  610.     if    $Temp ne $SelectType
  611.         $StrucError <endselect without select>
  612.         exitm
  613.     endif
  614.     endif
  615.     endif
  616.     $pop    $Temp2
  617.     if    $Temp ne $SelectType
  618.         $Label  %$Temp2
  619.         $Pop    $Temp2
  620.         $Label  %$Temp2
  621.     endif
  622. endm
  623. ;;*****************************************************************************
  624. .while    macro    t,p2,p3
  625.     $Peek    $Temp,%$st
  626.     if    $Temp eq $ConjWhileType
  627.         $Pop    $Temp
  628.     else
  629.         $Push   $LoopEnd
  630.         $OrFound = 0
  631.         $sn        = $sn + 1
  632.         $Push   $sn
  633.         $Label  %$sn
  634.         $sn        = $sn + 2
  635.         $Push   $sn
  636.         $LoopEnd = $sn - 1
  637.     endif
  638.     $TopTest <t>,$WhileType,$ConjWhileType,p2,p3
  639. endm
  640. ;;*****************************************************************************
  641. .endwhile macro p1
  642.     $Pop    $Temp
  643.     if    $Temp ne $WhileType
  644.         $StrucError <endwhile without while>
  645.         exitm
  646.     endif
  647.     $Dist    = $Near
  648.     $Pop    $Temp
  649.     $CondJump %$Temp,NoFold
  650.     $Label    %$Temp+1
  651.     $Pop    $LoopEnd
  652. endm
  653. ;;*****************************************************************************
  654. .repeat macro
  655.     $Push    $LoopEnd
  656.     $Push    $LeaveFound
  657.     $sn    = $sn+1
  658.     $Label    %$sn
  659.     $Push    $sn
  660.     $Push    $RepeatType
  661.     $sn    = $sn+1
  662.     $LoopEnd = $sn
  663.     $LeaveFound = 0
  664. endm
  665. ;;*****************************************************************************
  666. .until    macro    t,p2,p3
  667.     $until2 p2,p3,t
  668. endm
  669. $until2 macro    p2,p3,a1,a2,a3,a4,x
  670.     $Pop    $Temp
  671.     if    $Temp ne $RepeatType
  672.         if        $Temp ne $ConjUntilType
  673.         $StrucError <until without repeat>
  674.         exitm
  675.         endif
  676.     else
  677.         $OrFound = 0
  678.     endif
  679.     $Dist    = $DefDist
  680.     $GetDist p2,p3
  681.     $GetConj p2,p3
  682.  
  683.     if    $AndOr eq $NoConj
  684.         $Pop    $Temp
  685.         ifb        <a1>
  686.         $Dist    = $Near
  687.         $CondJump %$Temp,NoFold
  688.         else
  689.         $Test     <$Temp,f>,<a1>,<a2>,<a3>,<a4>,<x>
  690.         endif
  691.         if        $OrFound or $LeaveFound
  692.         $Label     %$Temp+1
  693.         endif
  694.         $Pop    $LeaveFound
  695.         $Pop    $LoopEnd
  696.     else
  697.         $Peek   $Temp,%$st
  698.         if        $AndOr eq $And
  699.         $Test     <$Temp,f>,<a1>,<a2>,<a3>,<a4>,<x>
  700.         else
  701.         $OrFound = 1
  702.         $Test     <$Temp+1,t>,<a1>,<a2>,<a3>,<a4>,<x>
  703.         endif
  704.         $Push   $ConjUntilType
  705.     endif
  706. endm
  707. ;;*****************************************************************************
  708. .loop    macro    cond
  709.     $Pop    $Temp
  710.     if    $Temp ne $RepeatType
  711.         $StrucError <loop without repeat>
  712.         exitm
  713.     endif
  714.     $Pop    $Temp
  715.     $CondLoop %$Temp,cond
  716.     if    $LeaveFound
  717.         $Label  %$Temp+1
  718.     endif
  719.     $Pop    $LeaveFound
  720.     $Pop    $LoopEnd
  721. endm
  722. ;;*****************************************************************************
  723. .for    macro    index,equals,start,to,stop,by,step,dist
  724.                     mov index,start
  725.     $Push    $LoopEnd
  726.     $sn    = $sn+1
  727.     $Push    $sn
  728.     $Label    %$sn
  729.     $sn    = $sn+1
  730.     $LoopEnd = $sn
  731.                     cmp index,stop
  732.     $Dist    = $DefDist
  733.     ifb    <step>
  734.         $Push   1
  735.         $GetDist by
  736.         $CondJump %$sn,t,gt
  737.     else
  738.         $GetDist dist
  739.         $Push   %(step)
  740.         if        step lt 0
  741.         $CondJump %$sn,t,lt
  742.         else
  743.         $CondJump %$sn,t,gt
  744.         endif
  745.     endif
  746.     $Push    $ForType
  747. endm
  748. ;;*****************************************************************************
  749. .next    macro    index,dist
  750.     $Pop    $Temp
  751.     if    $Temp ne $ForType
  752.         $StrucError <next without for>
  753.         exitm
  754.     endif
  755.     $Pop    $Temp
  756.     if    $Temp eq 1
  757.                     inc index
  758.     else
  759.         if        $Temp eq -1
  760.                     dec index
  761.         else
  762.                     add index,$Temp
  763.         endif
  764.     endif
  765.     $Pop    $Temp
  766.     $Dist    = $Near
  767.     $CondJump %$Temp,NoFold
  768.     $Label    %$Temp+1
  769.     $Pop    $LoopEnd
  770. endm
  771. ;;*****************************************************************************
  772. .leave    macro    t,p2,p3
  773.     $leave2 p2,p3,t
  774. endm
  775. $leave2 macro  p2,p3,a1,a2,a3,a4,x
  776.     ife    $LoopEnd
  777.         $StrucError <leave outside a loop>
  778.         exitm
  779.     endif
  780.     $LeaveFound = 1
  781.     $Peek    $Temp,%$st
  782.     if    $Temp eq $ConjLeaveType
  783.         $Pop    $Temp
  784.     else
  785.         $OrFound = 0
  786.         $sn        = $sn + 1
  787.     endif
  788.     $Dist    = 0
  789.     $GetDist <a1>
  790.     if    $Dist
  791.         $CondJump %$LoopEnd
  792.         if        $OrFound
  793.         $Label    %$sn
  794.         endif
  795.     else
  796.         $Dist   = $DefDist
  797.         $GetDist p2,p3
  798.         $GetConj p2,p3
  799.         if        $AndOr eq $NoConj
  800.         ifb    <a1>
  801.             $CondJump %$LoopEnd,t
  802.         else
  803.             $Test   <$LoopEnd,t>,<a1>,<a2>,<a3>,<a4>,<x>
  804.         endif
  805.         if    $OrFound
  806.             $Label  %$sn
  807.         endif
  808.         else
  809.         if    $AndOr eq $And
  810.             $OrFound = 1
  811.             $Test   <$sn,f>,<a1>,<a2>,<a3>,<a4>,<x>
  812.         else
  813.             $Test   <$LoopEnd,t>,<a1>,<a2>,<a3>,<a4>,<x>
  814.         endif
  815.         $Push    $ConjLeaveType
  816.         endif
  817.     endif
  818. endm
  819. ;;*****************************************************************************
  820. else
  821. $Pop    $Temp
  822. ;;if       $Temp ne $NoType
  823. if    $st ne 0
  824.      $StrucError <open structure(s)>
  825. endif
  826. .xcref $NoConj,$And,$Or,$Short,$Near,$NearToShort,$AndOr,$Temp,$Temp2,$Dist
  827. .xcref $NoType,$ConjIfType,$IfType,$ElseType,$WhileType,$ConjWhileType
  828. .xcref $RepeatType,$ConjUntilType,$ForType,$ConjLeaveType,jncxz
  829. .xcref $SelectType,$WhenType,$OtherwiseType,$ConjWhenType
  830. .xcref jeq,jgt,jlt,jneq,jngt,jnlt,jnna,jnnae,jnnb,jnnbe,jnnc,jnncxz,jnnecxz
  831. .xcref jnne,jnng,jnnge,jnnl,jnnle,jnno,jnnp,jnns,jnnz,jnpe,jnpo,$BuildJump
  832. .xcref $GetConj,$GetDist,$Poke,$Peek,$Push,$Pop,$Label,$CondJump,$CondLoop,$Test
  833. .xcref $TopTest,$leave2,$until2,$StrucError,jand,jnand,jnnand
  834. ;;j, jn
  835. .xcref jnnonzero,jnonzero,jnzero,jzero,$JCond
  836. .xcref $st,$sn,$OrFound,$LoopEnd,$LeaveFound,$DefDist
  837. .xcref $LastLabel,$LastLabelOrg,$EquateLabel,$TraceLabel,$CondJump2,$ncxz
  838. .xcref $opj,$opja,$opjae,$opjand,$opjb,$opjbe,$opjc,$opjcxz,$opje,$opjecxz
  839. .xcref $opjeq,$opjg,$opjge,$opjgt,$opjl,$opjle,$opjlt,$opjna,$opjnae,$opjnand
  840. .xcref $opjnb,$opjnbe,$opjnc,$opjncxz,$opjne,$opjnecxz,$opjneq,$opjng,$opjnge
  841. .xcref $opjngt,$opjnl,$opjnle,$opjnlt,$opjnna,$opjnnae,$opjnnand,$opjnnb
  842. .xcref $opjnnbe,$opjnnc,$opjnncxz,$opjnne,$opjnng,$opjnnge,$opjnnl,$opjnnle
  843. .xcref $opjnno,$opjnnonzero,$opjnnp,$opjnns,$opjnnz,$opjno,$opjnonzero,$opjnp
  844. .xcref $opjnpe,$opjnpo,$opjns,$opjnz,$opjnzero,$opjo,$opjp,$opjpe,$opjpo
  845. .xcref $opjs,$opjz,$opjzero,$opjnnecxz
  846.  
  847. endif
  848. $st    = 0
  849. $sn    = 0
  850. $OrFound = 0
  851. $LoopEnd = 0
  852. $LeaveFound = 0
  853. $LastLabel = -1
  854. $LastLabelOrg = $
  855. $DefDist= $Short
  856. $Push    %$NoType
  857.