コード例 #1
0
ファイル: hbfix.c プロジェクト: JamesLinus/core
static HB_FIX_FUNC( hb_p_pushblocklarge )
{
   HB_BYTE * pLocal = &pFunc->pCode[ nPCodePos + 8 ];
   HB_USHORT wVar;

   HB_SYMBOL_UNUSED( cargo );

   /* opcode + codeblock size + number of parameters + number of local variables */
   wVar = HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 6 ] );

   /* fix local variable's reference */
   while( wVar-- )
   {
      HB_USHORT wLocal = HB_PCODE_MKUSHORT( pLocal ) + pFunc->wParamCount;
      pLocal[ 0 ] = HB_LOBYTE( wLocal );
      pLocal[ 1 ] = HB_HIBYTE( wLocal );
      pLocal += 2;
   }

   /* only local variables used outside of a codeblock need fixing
    * skip the codeblock body
    */
   return HB_PCODE_MKUINT24( &pFunc->pCode[ nPCodePos + 1 ] );
}
コード例 #2
0
ファイル: hbdead.c プロジェクト: cwanderlei/hbtest3
static HB_CODETRACE_FUNC( hb_p_switch )
{
   HB_USHORT usCases = HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ), us;
   HB_SIZE nStart = nPCodePos, nNewPos;

   nPCodePos += 3;
   for( us = 0; us < usCases; ++us )
   {
      switch( pFunc->pCode[ nPCodePos ] )
      {
         case HB_P_PUSHBYTE:
            nPCodePos += 2;
            break;
         case HB_P_PUSHINT:
            nPCodePos += 3;
            break;
         case HB_P_PUSHLONG:
         case HB_P_PUSHDATE:
            nPCodePos += 5;
            break;
         case HB_P_PUSHLONGLONG:
            nPCodePos += 9;
            break;
         case HB_P_PUSHSTRSHORT:
            nPCodePos += 2 + pFunc->pCode[ nPCodePos + 1 ];
            break;
         case HB_P_PUSHSTR:
            nPCodePos += 3 + HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] );
            break;
         case HB_P_PUSHSTRLARGE:
            nPCodePos += 4 + HB_PCODE_MKUINT24( &pFunc->pCode[ nPCodePos + 1 ] );
            break;
         case HB_P_PUSHNIL:
            /* default clause */
            us = usCases;
            nPCodePos++;
            break;
      }
      switch( pFunc->pCode[ nPCodePos ] )
      {
         case HB_P_JUMPNEAR:
            nNewPos = nPCodePos + ( signed char ) pFunc->pCode[ nPCodePos + 1 ];
            nPCodePos += 2;
            break;
         case HB_P_JUMP:
            nNewPos = nPCodePos + HB_PCODE_MKSHORT( &pFunc->pCode[ nPCodePos + 1 ] );
            nPCodePos += 3;
            break;
         /*case HB_P_JUMPFAR:*/
         default:
            nNewPos = nPCodePos + HB_PCODE_MKINT24( &pFunc->pCode[ nPCodePos + 1 ] );
            nPCodePos += 4;
            break;
      }
      hb_compCodeTraceAddJump( cargo, nNewPos );
   }
   hb_compCodeTraceMark( cargo, nStart, nPCodePos - nStart );

   return hb_compCodeTraceNextPos( cargo, us > usCases ?
                                   cargo->nPCodeSize : nPCodePos );
}
コード例 #3
0
ファイル: hbpcode.c プロジェクト: ggargano/hbtest2
static HB_PSIZE_FUNC( hb_p_pushblocklarge )
{
   HB_SYMBOL_UNUSED( cargo );
   return HB_PCODE_MKUINT24( &pFunc->pCode[ nPCodePos + 1 ] );
}