Files
harbour-core/harbour/source/compiler/genc.c
Przemyslaw Czerpak c3e1436da0 2009-06-26 02:22 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbvm.h
  * harbour/include/hbrdddbf.h
  * harbour/include/hbapidbg.h
  * harbour/include/hbset.h
  * harbour/include/hbcomp.h
  * harbour/include/hbapirdd.h
  * harbour/include/hbstack.h
  * harbour/include/hbsxfunc.h
  * harbour/include/hbapilng.h
  * harbour/include/hbgtcore.h
  * harbour/include/hbapifs.h
  * harbour/include/hbdbsort.h
  * harbour/include/hbapigt.h
  * harbour/include/hbapi.h
  * harbour/include/hbapierr.h
  * harbour/include/hbapiitm.h
  * harbour/include/hbrddfpt.h
  * harbour/contrib/hbmysql/mysql.c
  * harbour/contrib/hbct/bitnum.c
  * harbour/contrib/hbct/token2.c
  * harbour/contrib/hbct/charsprd.c
  * harbour/contrib/hbct/ctnet.c
  * harbour/contrib/hbct/charonly.c
  * harbour/contrib/hbct/atadjust.c
  * harbour/contrib/hbct/ctwin.c
  * harbour/contrib/hbct/charsort.c
  * harbour/contrib/hbct/ctwin.h
  * harbour/contrib/hbct/charmix.c
  * harbour/contrib/hbct/charevod.c
  * harbour/contrib/hbct/maxline.c
  * harbour/contrib/hbct/wordrepl.c
  * harbour/contrib/hbct/charrepl.c
  * harbour/contrib/hbct/files.c
  * harbour/contrib/hbct/video.c
  * harbour/contrib/hbct/charswap.c
  * harbour/contrib/hbct/dattime3.c
  * harbour/contrib/hbct/charop.c
  * harbour/contrib/hbct/misc2.c
  * harbour/contrib/hbct/charone.c
  * harbour/contrib/hbct/ctstr.c
  * harbour/contrib/hbct/screen1.c
  * harbour/contrib/hbct/token1.c
  * harbour/contrib/hbct/ctstr.h
  * harbour/contrib/hbct/charmirr.c
  * harbour/contrib/hbct/relation.c
  * harbour/contrib/hbct/atnum.c
  * harbour/contrib/hbct/like.c
  * harbour/contrib/hbct/count.c
  * harbour/contrib/hbct/disk.c
  * harbour/contrib/hbct/ctstrfil.c
  * harbour/contrib/hbct/posdiff.c
  * harbour/contrib/hbct/addascii.c
  * harbour/contrib/hbct/tab.c
  * harbour/contrib/hbct/numline.c
  * harbour/contrib/hbct/dattime2.c
  * harbour/contrib/hbct/asciisum.c
  * harbour/contrib/hbct/expand.c
  * harbour/contrib/hbct/pos2.c
  * harbour/contrib/hbct/numat.c
  * harbour/contrib/hbct/atrepl.c
  * harbour/contrib/hbct/wordtoch.c
  * harbour/contrib/hbct/print.c
  * harbour/contrib/hbct/justify.c
  * harbour/contrib/xhb/hbxml.c
  * harbour/contrib/xhb/dbf2txt.c
  * harbour/contrib/xhb/xhbis.c
  * harbour/contrib/xhb/fparse.c
  * harbour/contrib/xhb/xstrdel.c
  * harbour/contrib/xhb/hbcomprs.c
  * harbour/contrib/xhb/datesxhb.c
  * harbour/contrib/xhb/xhbmsgs.c
  * harbour/contrib/xhb/freadlin.c
  * harbour/contrib/xhb/txtline.c
  * harbour/contrib/xhb/xhbtrim.c
  * harbour/contrib/xhb/xhbcopyf.c
  * harbour/contrib/xhb/cstructc.c
  * harbour/contrib/xhb/xhbfunc.c
  * harbour/contrib/hbtpathy/tplinux.c
  * harbour/contrib/hbgt/charmixg.c
  * harbour/contrib/hbgt/strexpan.c
  * harbour/contrib/hbgt/charodd.c
  * harbour/contrib/hbgt/strright.c
  * harbour/contrib/hbgt/asciisgt.c
  * harbour/contrib/hbgt/strdiffg.c
  * harbour/contrib/hbgt/chrtotal.c
  * harbour/contrib/hbgt/strcount.c
  * harbour/contrib/hbgt/strleft.c
  * harbour/contrib/hbgt/ascposgt.c
  * harbour/contrib/hbgt/chrfirst.c
  * harbour/contrib/hbgt/chrcount.c
  * harbour/contrib/hbgt/strpbrk.c
  * harbour/contrib/hbgt/chareven.c
  * harbour/contrib/hbgt/strcspn.c
  * harbour/contrib/hbgt/atdiff.c
  * harbour/contrib/hbsqlit3/hbsqlit3.c
  * harbour/contrib/hbmzip/hbmzip.c
  * harbour/contrib/hbnf/proper.c
  * harbour/contrib/hbnf/fttext.c
  * harbour/contrib/hbnf/chdir.c
  * harbour/contrib/hbnf/getver.c
  * harbour/contrib/hbnf/ftattr.c
  * harbour/contrib/hbnf/mkdir.c
  * harbour/contrib/hbnf/rmdir.c
  * harbour/contrib/Makefile
  * harbour/contrib/hbcurl/hbcurl.c
  * harbour/contrib/rddsql/sddmy/mysqldd.c
  * harbour/contrib/rddsql/sddpg/pgsqldd.c
  * harbour/contrib/rddsql/sddfb/fbirddd.c
  * harbour/contrib/rddsql/sddodbc/odbcdd.c
  * harbour/contrib/rddsql/sqlmix.c
  * harbour/contrib/hbhpdf/harupdf.c
  * harbour/contrib/rddads/adsx.c
  * harbour/contrib/rddads/adsfunc.c
  * harbour/contrib/rddads/rddads.h
  * harbour/contrib/rddads/ads1.c
  * harbour/contrib/hbmisc/hb_f.c
  * harbour/contrib/hbmisc/strfmt.c
  * harbour/contrib/hbmisc/stringsx.c
  * harbour/contrib/hbmisc/spd.c
  * harbour/contrib/hbtip/utils.c
  * harbour/contrib/hbwin/wapi_winbase.c
  * harbour/contrib/hbwin/win_misc.c
  * harbour/contrib/hbbtree/hb_btree.h
  * harbour/contrib/hbbtree/hb_btree.c
  * harbour/source/pp/hbpp.c
  * harbour/source/vm/runner.c
  * harbour/source/vm/estack.c
  * harbour/source/vm/itemapi.c
  * harbour/source/vm/hvm.c
  * harbour/source/vm/cmdarg.c
  * harbour/source/vm/memvars.c
  * harbour/source/vm/dynlibhb.c
  * harbour/source/vm/set.c
  * harbour/source/main/harbour.c
  * harbour/source/debug/dbgentry.c
  * harbour/source/common/hbfsapi.c
  * harbour/source/common/hbfopen.c
  * harbour/source/rtl/gtdos/gtdos.c
  * harbour/source/rtl/diskspac.c
  * harbour/source/rtl/console.c
  * harbour/source/rtl/chrasc.c
  * harbour/source/rtl/fscopy.c
  * harbour/source/rtl/run.c
  * harbour/source/rtl/spfiles.c
  * harbour/source/rtl/defpath.c
  * harbour/source/rtl/philes.c
  * harbour/source/rtl/oldbox.c
  * harbour/source/rtl/math.c
  * harbour/source/rtl/hbgtcore.c
  * harbour/source/rtl/cdpapi.c
  * harbour/source/rtl/gtcrs/gtcrs.c
  * harbour/source/rtl/dirdrive.c
  * harbour/source/rtl/hbi18n1.c
  * harbour/source/rtl/trim.c
  * harbour/source/rtl/hbzlibgz.c
  * harbour/source/rtl/philesx.c
  * harbour/source/rtl/mlcfunc.c
  * harbour/source/rtl/filehb.c
  * harbour/source/rtl/fstemp.c
  * harbour/source/rtl/is.c
  * harbour/source/rtl/hbrunfun.c
  * harbour/source/rtl/ampm.c
  * harbour/source/rtl/setcolor.c
  * harbour/source/rtl/oemansi.c
  * harbour/source/rtl/disksphb.c
  * harbour/source/rtl/hbzlib.c
  * harbour/source/rtl/strpeek.c
  * harbour/source/rtl/replic.c
  * harbour/source/rtl/stuff.c
  * harbour/source/rtl/hbstrfmt.c
  * harbour/source/rtl/transfrm.c
  * harbour/source/rtl/hbhex.c
  * harbour/source/rtl/trace.c
  * harbour/source/rtl/hbadler.c
  * harbour/source/rtl/samples.c
  * harbour/source/rtl/filebuf.c
  * harbour/source/rtl/hbcrc.c
  * harbour/source/rtl/gete.c
  * harbour/source/rtl/hbmd5.c
  * harbour/source/rtl/langapi.c
  * harbour/source/rtl/gtcgi/gtcgi.c
  * harbour/source/rtl/errapi.c
  * harbour/source/rtl/hbregexc.c
  * harbour/source/rtl/natmsg.c
  * harbour/source/rtl/fssize.c
  * harbour/source/rtl/hbinet.c
  * harbour/source/rtl/colorind.c
  * harbour/source/rtl/copyfile.c
  * harbour/source/rtl/mouseapi.c
  * harbour/source/rtl/soundex.c
  * harbour/source/rtl/memofile.c
  * harbour/source/rtl/hbffind.c
  * harbour/source/rtl/gtapi.c
  * harbour/source/rtl/direct.c
  * harbour/source/rtl/filesys.c
  * harbour/source/rtl/file.c
  * harbour/source/rtl/val.c
  * harbour/source/rtl/hbregex.c
  * harbour/source/rtl/rat.c
  * harbour/source/rtl/isprint.c
  * harbour/source/rdd/dbfntx/dbfntx1.c
  * harbour/source/rdd/dbsql.c
  * harbour/source/rdd/workarea.c
  * harbour/source/rdd/wacore.c
  * harbour/source/rdd/sdf1.c
  * harbour/source/rdd/dbdetach.c
  * harbour/source/rdd/dbcmdx.c
  * harbour/source/rdd/dbfnsx/dbfnsx1.c
  * harbour/source/rdd/dbcmd.c
  * harbour/source/rdd/dbfcdx/dbfcdx1.c
  * harbour/source/rdd/delim1.c
  * harbour/source/rdd/dbf1.c
  * harbour/source/rdd/hsx/hsx.c
  * harbour/source/rdd/dbcmd53.c
  * harbour/source/rdd/usrrdd/usrrdd.c
  * harbour/source/rdd/wafunc.c
  * harbour/source/rdd/dbffpt/dbffpt1.c
  * harbour/source/rdd/hbsix/sxsem.c
  * harbour/source/rdd/hbsix/sxord.c
  * harbour/source/rdd/hbsix/sxfname.c
  * harbour/source/rdd/hbsix/sxtable.c
  * harbour/source/rdd/hbsix/sxdate.c
  * harbour/source/rdd/hbsix/sxutil.c
  * harbour/source/rdd/hbsix/sxcompr.c
  * harbour/source/compiler/hbmain.c
  * harbour/source/compiler/cmdcheck.c
  * harbour/source/compiler/hbpcode.c
  * harbour/source/compiler/genc.c
  * harbour/source/compiler/gencc.c
  * harbour/source/compiler/hbcmplib.c
  * harbour/source/compiler/ppcomp.c
    * changed 'char *' and changed 'BYTE *' to 'const char *' in
      the following functions:
         const char * hb_vmFindModuleSymbolName( PHB_SYMB pSym );
         void  hb_vmInitSymbolGroup( void * hNewDynLib, int argc,
                                     const char * argv[] );
         void hb_dbgEntry( int nMode, int nLine, const char *szName,
                           int nIndex, PHB_ITEM pFrame );
         void hb_dbgAddBreak( void *handle, const char *cModule,
                              int nLine, const char *szFunction );
         void hb_dbgAddWatch( void *handle, const char *szExpr, BOOL bTrace );
         PHB_ITEM hb_dbgGetExpressionValue( void *handle,
                                            const char *expression );
         BOOL hb_dbgIsValidStopLine( void *handle, const char *szModule,
                                     int nLine );
         void hb_dbgSetToCursor( void *handle, const char *szModule,
                                 int nLine );
         void hb_dbgSetWatch( void *handle, int nWatch,
                              const char *szExpr, BOOL bTrace );
         const char * hb_setGetCPtr( HB_set_enum set_specifier );
         const char * hb_setGetAltFile( void );
         const char * hb_setGetDateFormat( void );
         const char * hb_setGetTimeFormat( void );
         const char * hb_setGetDefault( void );
         const char * hb_setGetDelimChars( void );
         const char * hb_setGetDevice( void );
         const char * hb_setGetExtraFile( void );
         const char * hb_setGetPath( void );
         const char * hb_setGetMFileExt( void );
         const char * hb_setGetPrintFile( void );
         const char * hb_setGetEOL( void );
         const char * hb_setGetHBOUTLOG( void );
         const char * hb_setGetHBOUTLOGINFO( void );
         const char * hb_setGetOSCODEPAGE( void );
         void hb_compInitPP( HB_COMP_DECL, int argc,
                             const char * const argv[] );
         void hb_compGenPCodeN( const BYTE * pBuffer, ULONG ulSize,
                                HB_COMP_DECL );
         int  hb_compMain( int argc, const char * const argv[],
                           BYTE ** pBufPtr, ULONG * pulSize,
                           const char * szSource );
         void hb_compChkCompilerSwitch( HB_COMP_DECL, int,
                                        const char * const args[] );
         void hb_compChkDefines( HB_COMP_DECL, int iArg,
                                 const char * const args[] );
         void hb_compGenCString( FILE * yyc, const BYTE * pText, ULONG ulLen );
         AREAP hb_rddRequestArea( const char * szAlias, PHB_ITEM pCargo,
                                  BOOL fNewArea, BOOL fWait );
         char * hb_stackDirBuffer( void );
         LONG hb_sxPtoD( const char * pDate );
         const char * hb_langID( void );
         const char * hb_langSelectID( const char * pszID );
         const char * hb_langDGetItem( int iIndex );
         const char * hb_langDGetErrorDesc( ULONG ulIndex );
         BOOL       hb_fsChDir( const char * pszDirName );
         HB_FHANDLE hb_fsCreate( const char * pszFileName, ULONG ulAttr );
         HB_FHANDLE hb_fsCreateEx( const char * pszFilename, ULONG ulAttr,
                                   USHORT uiFlags );
         HB_FHANDLE hb_fsCreateTemp( const char * pszDir,
                                     const char * pszPrefix,
                                     ULONG ulAttr, char * pszName );
         HB_FHANDLE hb_fsCreateTempEx( char * pszName, const char * pszDir,
                                       const char * pszPrefix,
                                       const char * pszExt, ULONG ulAttr );
         const char * hb_fsCurDir( USHORT uiDrive );
         USHORT     hb_fsCurDirBuff( USHORT uiDrive, char * pbyBuffer,
                                     ULONG ulLen );
         void       hb_fsBaseDirBuff( char * pbyBuffer );
         BOOL       hb_fsDelete( const char * pszFileName );
         BOOL       hb_fsFile( const char * pszFileName );
         BOOL       hb_fsIsDirectory( const char * pszFilename );
         HB_FOFFSET hb_fsFSize( const char * pszFileName, BOOL bUseDirEntry );
         HB_FHANDLE hb_fsExtOpen( const char * pszFileName,
                                  const char * pDefExt,
         char *     hb_fsExtName( const char * pFilename,
                                  const char * pDefExt, USHORT uiExFlags,
                                  const char * pPaths );
         BOOL       hb_fsMkDir( const char * pszDirName );
         HB_FHANDLE hb_fsOpen( const char * pszFileName, USHORT uiFlags );
         BOOL       hb_fsRmDir( const char * pszDirName );
         BOOL       hb_fsRename( const char * pszOldName,
                                 const char * pszNewName );
         BOOL       hb_fsGetFileTime( const char * pszFileName,
                                      LONG * plJulian, LONG * plMillisec );
         BOOL       hb_fsSetFileTime( const char * pszFileName,
                                      LONG lJulian, LONG lMillisec );
         BOOL       hb_fsGetAttr( const char * pszFileName, ULONG * pulAttr );
         BOOL       hb_fsSetAttr( const char * pszFileName, ULONG ulAttr );
         HB_FHANDLE hb_fsPOpen( const char * pFilename, const char * pMode );
         BOOL       hb_fsCopy( const char * pSource, const char * pDest );
         BOOL       hb_spFile( const char * pFilename, char * pRetPath );
         BOOL       hb_spFileExists( const char * pFilename, char * pRetPath );
         HB_FHANDLE hb_spOpen( const char * pFilename, USHORT uiFlags );
         HB_FHANDLE hb_spCreate( const char * pFilename, ULONG ulAttr );
         HB_FHANDLE hb_spCreateEx( const char * pFilename,
                                   ULONG ulAttr, USHORT uiFlags );
         PHB_FILE   hb_fileExtOpen( const char * pFilename,
                                    const char * pDefExt, USHORT uiExFlags,
                                    const char * pPaths, PHB_ITEM pError );
         PHB_FILE   hb_fileCreateTemp( const char * pszDir,
                                       const char * pszPrefix,
                                       ULONG ulAttr, char * pszName );
         PHB_FILE   hb_fileCreateTempEx( char * pszName, const char * pszDir,
                                         const char * pszPrefix,
                                         const char * pszExt, ULONG ulAttr );
         HB_ERRCODE hb_gtBox( SHORT uiTop, SHORT uiLeft, SHORT uiBottom,
                              SHORT uiRight, const BYTE * pbyFrame );
         HB_ERRCODE hb_gtDrawBox( SHORT uiTop, SHORT uiLeft, SHORT uiBottom,
                                  SHORT uiRight, const BYTE * pbyFrame,
                                  int iColor );
         HB_ERRCODE hb_gtWrite( const BYTE * pbyStr, ULONG ulLen );
         HB_ERRCODE hb_gtWriteAt( USHORT uiRow, USHORT uiCol,
                                  const BYTE * pbyStr, ULONG ulLen );
         HB_ERRCODE hb_gtWriteCon( const BYTE * pbyStr, ULONG ulLen );
         HB_ERRCODE hb_gtPutText( USHORT uiRow, USHORT uiCol,
                                  const BYTE * pStr, ULONG ulLength,
                                  int iColor );
         HB_ERRCODE hb_gtOutStd( const BYTE * pbyStr, ULONG ulLen );
         HB_ERRCODE hb_gtOutErr( const BYTE * pbyStr, ULONG ulLen );
         HB_ERRCODE hb_gtBoxEx( int iTop, int iLeft, int iBottom, int iRight,
                                const BYTE * pbyFrame, int iColor );
         void       hb_mouseRestoreState( const BYTE * pBuffer );
         const char * hb_strLTrim( const char * szText, ULONG * ulLen );
         const char * hb_conNewLine( void );
         const char * hb_conSetColor( const char * szColor );
         const char * hb_errGetDescription( PHB_ITEM pError );
         const char * hb_errGetFileName( PHB_ITEM pError );
         const char * hb_errGetOperation( PHB_ITEM pError );
         const char * hb_errGetSubSystem( PHB_ITEM pError );
         int hb_ctwAddWindowBox( int iWindow, const BYTE * szBox, int iColor );
         const char *ct_at_exact_forward
                              ( const char *pcString, size_t sStrLen,
                                const char *pcMatch, size_t sMatchLen,
                                size_t *psMatchStrLen );
         const char *ct_at_exact_backward
                              ( const char *pcString, size_t sStrLen,
                                const char *pcMatch, size_t sMatchLen,
                                size_t *psMatchStrLen );
         const char *ct_at_wildcard_forward
                              ( const char *pcString, size_t sStrLen,
                                const char *pcMatch, size_t sMatchLen,
                                char cWildCard, size_t *psMatchStrLen );
         const char *ct_at_wildcard_backward
                              ( const char *pcString, size_t sStrLen,
                                const char *pcMatch, size_t sMatchLen,
                                char cWildCard, size_t *psMatchStrLen );
         const char *ct_at_charset_forward
                              ( const char *pcString, size_t sStrLen,
                                const char *pcCharSet, size_t sCharSetLen,
                                size_t *psMatchedCharPos );
         const char *ct_at_charset_backward
                              ( const char *pcString, size_t sStrLen,
                                const char *pcCharSet, size_t sCharSetLen,
                                size_t *psMatchedCharPos );
         char * hb_adsOemToAnsi( const char * pcString, ULONG ulLen );
         char * hb_adsAnsiToOem( const char * pcString, ULONG ulLen );
         struct hb_BTree * hb_BTreeNew( const char *FileName,
                                        USHORT usPageSize, USHORT usKeySize,
                                        ULONG ulFlags, USHORT usBuffers );
         struct hb_BTree * hb_BTreeOpen( const char *FileName, ULONG lFlags,
                                         USHORT usBuffers );
         BOOL hb_BTreeInsert( struct hb_BTree * pBTree, const char * szKey,
                              PHB_ITEM pData );
         BOOL hb_BTreeDelete( struct hb_BTree * pBTree, const char * szKey,
                              LONG lData );
         BOOL hb_BTreeSeek( struct hb_BTree * pBTree, const char * szKey,
                            LONG lData, BOOL bSoftSeek );
         const char * hb_BTreeKey( struct hb_BTree * pBTree );

    * modified RDD methods:
         HB_ERRCODE PUTVALUEFILE( AREAP, USHORT, const char *, USHORT );
         HB_ERRCODE GETVALUEFILE( AREAP, USHORT, const char *, USHORT );
    * modified GT methods:
         void REST( HB_GT_PTR, int, int, int, int, const BYTE * );
         void PUTTEXT( HB_GT_PTR, int, int, BYTE, const BYTE *, ULONG );
         void WRITEAT( HB_GT_PTR, int, int, const BYTE *, ULONG );
         void WRITE( HB_GT_PTR, const BYTE *, ULONG );
         void WRITECON( HB_GT_PTR, const BYTE *, ULONG );
         void BOX( HB_GT_PTR, int, int, int, int, const BYTE *, BYTE );
         void BOXD( HB_GT_PTR, int, int, int, int, const BYTE *, BYTE );
         void BOXS( HB_GT_PTR, int, int, int, int, const BYTE *, BYTE );
         void OUTSTD( HB_GT_PTR, BYTE *, ULONG );
         void OUTERR( HB_GT_PTR, BYTE *, ULONG );
         void MOUSERESTORESTATE( HB_GT_PTR, const BYTE * );
    * modified RDD structers:
         DBFIELDINFO, DBOPENINFO, DBORDERCONDINFO, DBCONSTRAINTINFO,
         DBORDERCREATEINFO
    + modified parameters and behevior:
         const char * hb_fsNameConv( const char * szFileName, char ** pszFree );
         const char * hb_osEncode( const char * szFileName, char ** pszFree );
         const char * hb_osDecode( const char * szFileName, char ** pszFree );
      Please look at implementation and current usage of these functions.
    + added new function:
         BOOL hb_itemGetWriteCL( PHB_ITEM pItem,
                                 char ** pszValue, ULONG * pulLen );
      which converts item string buffer to writable state to use with
      functions like FREAD() instead of hb_itemUnShare*()
    * updatd other code to respect above modifications
    ! fixed bugs (also GPF traps) located by above modifications

   TODO: please make build tests. Especially in OS2 - not tested at all.
2009-06-26 00:33:38 +00:00

2748 lines
76 KiB
C

/*
* $Id$
*/
/*
* Harbour Project source code:
* Compiler C source generation
*
* Copyright 1999 Antonio Linares <alinares@fivetech.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#include "hbcomp.h"
#include "hbdate.h"
#include "hbassert.h"
static void hb_compGenCReadable( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc );
static void hb_compGenCCompact( PFUNCTION pFunc, FILE * yyc );
static void hb_compGenCFunc( FILE *yyc, const char *cDecor, const char *szName, BOOL fStrip );
static void hb_writeEndInit( HB_COMP_DECL, FILE* yyc, const char * szModulname, const char * szSourceFile );
/* helper structure to pass information */
typedef struct HB_stru_genc_info
{
HB_COMP_DECL;
FILE * yyc;
BOOL bVerbose;
ULONG ulEndBlockPos;
} HB_GENC_INFO, * HB_GENC_INFO_PTR;
#define HB_GENC_FUNC( func ) HB_PCODE_FUNC( func, HB_GENC_INFO_PTR )
typedef HB_GENC_FUNC( HB_GENC_FUNC_ );
typedef HB_GENC_FUNC_ * HB_GENC_FUNC_PTR;
static void hb_compDumpFindCFunc( HB_COMP_DECL )
{
PINLINE pInline;
pInline = HB_COMP_PARAM->inlines.pFirst;
while( pInline )
{
if( pInline->pCode && !pInline->szName )
{
const char * pszCCode = ( const char * ) pInline->pCode;
char ch;
int len;
while( ( ch = *pszCCode++ ) != 0 )
{
if( HB_ISFIRSTIDCHAR( ch ) )
{
if( ch == 'H' && strncmp( pszCCode, "B_FUNC_STATIC", 13 ) == 0 )
{
pszCCode += 13;
while( HB_ISSPACE( *pszCCode ) )
++pszCCode;
if( *pszCCode == '(' )
{
++pszCCode;
while( HB_ISSPACE( *pszCCode ) )
++pszCCode;
if( HB_ISFIRSTIDCHAR( *pszCCode ) )
{
char * name = ( char * ) pszCCode++;
while( HB_ISNEXTIDCHAR( *pszCCode ) )
++pszCCode;
len = ( int ) ( pszCCode - name );
while( HB_ISSPACE( *pszCCode ) )
++pszCCode;
if( *pszCCode == ')' )
{
name = hb_strndup( name, len );
hb_compFunctionMarkStatic( HB_COMP_PARAM, name );
hb_xfree( name );
}
}
}
}
while( HB_ISNEXTIDCHAR( *pszCCode ) )
++pszCCode;
}
else if( ch == '/' && *pszCCode == '*' )
{
pszCCode++;
while( *pszCCode )
{
if( *pszCCode++ == '*' )
{
if( *pszCCode++ == '/' )
break;
}
}
}
else if( ch == '/' && *pszCCode == '/' )
{
do { ++pszCCode; } while( *pszCCode && *pszCCode != '\n' );
}
else if( ch == '"' || ch == '\'' )
{
while( *pszCCode )
{
if( *pszCCode == '\\' )
{
pszCCode++;
if( *pszCCode )
pszCCode++;
}
else if( *pszCCode++ == ch )
break;
}
}
}
}
pInline = pInline->pNext;
}
}
void hb_compGenCCode( HB_COMP_DECL, PHB_FNAME pFileName ) /* generates the C language output */
{
char szFileName[ HB_PATH_MAX ];
char szModulname[ HB_PATH_MAX ];
PCOMSYMBOL pSym;
PFUNCTION pFunc;
PINLINE pInline;
PFUNCALL pFuncall;
FILE * yyc; /* file handle for C output */
BOOL bIsInlineFunction = FALSE;
BOOL bIsInitStatics;
BOOL bIsLineNumberInfo;
BOOL bIsInitFunction;
BOOL bIsExitFunction;
BOOL bIsStaticFunction;
hb_fsFNameMerge( szFileName, pFileName );
if( ! pFileName->szExtension )
pFileName->szExtension = ".c";
hb_fsFNameMerge( szFileName, pFileName );
yyc = hb_fopen( szFileName, "wb" );
if( ! yyc )
{
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL );
return;
}
if( ! HB_COMP_PARAM->fQuiet )
{
char buffer[ 80 + HB_PATH_MAX - 1 ];
hb_snprintf( buffer, sizeof( buffer ),
"Generating C source output to \'%s\'... ", szFileName );
hb_compOutStd( HB_COMP_PARAM, buffer );
}
{
char *szCmp = hb_verCompiler();
char *szHrb = hb_verHarbour();
fprintf( yyc, "/*\n * %s\n", szHrb );
fprintf( yyc, " * %s\n", szCmp );
fprintf( yyc, " * Generated C source from \"%s\"\n */\n\n", HB_COMP_PARAM->szFile );
hb_xfree( szCmp );
hb_xfree( szHrb );
}
pFunc = HB_COMP_PARAM->functions.pFirst;
while( pFunc &&
( ( pFunc->funFlags & FUN_FILE_DECL ) != 0 ||
pFunc == HB_COMP_PARAM->pInitFunc ||
pFunc == HB_COMP_PARAM->pLineFunc ) )
pFunc = pFunc->pNext;
if( pFunc )
{
hb_compDumpFindCFunc( HB_COMP_PARAM );
fprintf( yyc, "#include \"hbvmpub.h\"\n" );
if( HB_COMP_PARAM->iGenCOutput != HB_COMPGENC_COMPACT )
fprintf( yyc, "#include \"hbpcode.h\"\n" );
fprintf( yyc, "#include \"hbinit.h\"\n" );
if( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_REALCODE )
fprintf( yyc, "#include \"hbxvm.h\"\n" );
fprintf( yyc, "\n\n" );
/* write functions prototypes for PRG defined functions */
pFunc = HB_COMP_PARAM->functions.pFirst;
if( ( pFunc->funFlags & FUN_FILE_DECL ) != 0 )
pFunc = pFunc->pNext;
while( pFunc )
{
bIsInitStatics = ( pFunc == HB_COMP_PARAM->pInitFunc );
bIsLineNumberInfo = ( pFunc == HB_COMP_PARAM->pLineFunc );
bIsInitFunction = ( pFunc->cScope & HB_FS_INIT ) != 0;
bIsExitFunction = ( pFunc->cScope & HB_FS_EXIT ) != 0;
bIsStaticFunction = ( pFunc->cScope & HB_FS_STATIC ) != 0;
/* Is it _STATICS$ - static initialization function */
if( bIsInitStatics )
fprintf( yyc, "HB_FUNC_INITSTATICS();\n" );
/* Is it an (_INITLINES) function */
else if( bIsLineNumberInfo )
fprintf( yyc, "HB_FUNC_INITLINES();\n" );
/* Is it an INIT FUNCTION/PROCEDURE */
else if( bIsInitFunction )
hb_compGenCFunc( yyc, "HB_FUNC_INIT( %s );\n", pFunc->szName, TRUE );
/* Is it an EXIT FUNCTION/PROCEDURE */
else if( bIsExitFunction )
hb_compGenCFunc( yyc, "HB_FUNC_EXIT( %s );\n", pFunc->szName, TRUE );
/* Is it a STATIC FUNCTION/PROCEDURE */
else if( bIsStaticFunction )
hb_compGenCFunc( yyc, "HB_FUNC_STATIC( %s );\n", pFunc->szName, FALSE );
else /* Then it must be PUBLIC FUNCTION/PROCEDURE */
hb_compGenCFunc( yyc, "HB_FUNC( %s );\n", pFunc->szName, FALSE );
pFunc = pFunc->pNext;
}
/* write functions prototypes for inline blocks */
pInline = HB_COMP_PARAM->inlines.pFirst;
while( pInline )
{
if( pInline->szName )
{
bIsInlineFunction = TRUE;
hb_compGenCFunc( yyc, "HB_FUNC_STATIC( %s );\n", pInline->szName, FALSE );
}
pInline = pInline->pNext;
}
/* write functions prototypes for called functions outside this PRG */
pFuncall = HB_COMP_PARAM->funcalls.pFirst;
while( pFuncall )
{
if( ( pFuncall->cScope & ( HB_FS_DEFERRED | HB_FS_LOCAL ) ) == 0 &&
hb_compFunctionFind( HB_COMP_PARAM, pFuncall->szName ) == NULL &&
hb_compInlineFind( HB_COMP_PARAM, pFuncall->szName ) == NULL )
hb_compGenCFunc( yyc, ( pFuncall->cScope & HB_FS_STATIC ) ?
"HB_FUNC_STATIC( %s );\n" :
"HB_FUNC_EXTERN( %s );\n", pFuncall->szName, FALSE );
pFuncall = pFuncall->pNext;
}
/* writes the symbol table */
/* Generate the wrapper that will initialize local symbol table
*/
hb_strncpyUpper( szModulname, pFileName->szName, sizeof( szModulname ) - 1 );
/* replace non ID characters in name of local symbol table by '_' */
{
int iLen = strlen( szModulname ), i;
for( i = 0; i < iLen; i++ )
{
char c = szModulname[ i ];
if( !HB_ISNEXTIDCHAR( c ) )
szModulname[ i ] = '_';
}
}
fprintf( yyc, "\n\nHB_INIT_SYMBOLS_BEGIN( hb_vm_SymbolInit_%s%s )\n", HB_COMP_PARAM->szPrefix, szModulname );
pSym = HB_COMP_PARAM->symbols.pFirst;
while( pSym )
{
if( pSym->szName[ 0 ] == '(' )
{
/* Since the normal function cannot be INIT and EXIT at the same time
* we are using these two bits to mark the special function used to
* initialize static variables or debugging info about valid stop lines
*/
fprintf( yyc, "{ \"%s\", {HB_FS_INITEXIT | HB_FS_LOCAL}, {hb_%s}, NULL }",
pSym->szName, !memcmp( pSym->szName, "(_INITLINES", 11 ) ?
"INITLINES" : "INITSTATICS" ); /* NOTE: "hb_" intentionally in lower case */
}
else
{
fprintf( yyc, "{ \"%s\", {", pSym->szName );
if( pSym->cScope & HB_FS_STATIC )
fprintf( yyc, "HB_FS_STATIC" );
else if( pSym->cScope & HB_FS_INIT )
fprintf( yyc, "HB_FS_INIT" );
else if( pSym->cScope & HB_FS_EXIT )
fprintf( yyc, "HB_FS_EXIT" );
else
fprintf( yyc, "HB_FS_PUBLIC" );
if( pSym->cScope & VS_MEMVAR )
fprintf( yyc, " | HB_FS_MEMVAR" );
if( pSym->cScope & HB_FS_MESSAGE )
fprintf( yyc, " | HB_FS_MESSAGE" );
if( ( pSym->cScope & HB_FS_FIRST ) && ( ! HB_COMP_PARAM->fNoStartUp ) )
fprintf( yyc, " | HB_FS_FIRST" );
/* specify the function address if it is a defined function or an
external called function */
if( pSym->cScope & HB_FS_LOCAL ) /* is it a function defined in this module */
{
fprintf( yyc, " | HB_FS_LOCAL" );
if( pSym->cScope & HB_FS_INIT )
hb_compGenCFunc( yyc, "}, {HB_INIT_FUNCNAME( %s )}, NULL }", pSym->szName, TRUE );
else if( pSym->cScope & HB_FS_EXIT )
hb_compGenCFunc( yyc, "}, {HB_EXIT_FUNCNAME( %s )}, NULL }", pSym->szName, TRUE );
else
hb_compGenCFunc( yyc, "}, {HB_FUNCNAME( %s )}, NULL }", pSym->szName, FALSE );
}
else if( pSym->cScope & HB_FS_DEFERRED ) /* is it a function declared as dynamic */
fprintf( yyc, " | HB_FS_DEFERRED}, {NULL}, NULL }" );
else if( pSym->bFunc && hb_compFunCallFind( HB_COMP_PARAM, pSym->szName ) ) /* is it a function called from this module */
hb_compGenCFunc( yyc, "}, {HB_FUNCNAME( %s )}, NULL }", pSym->szName, FALSE );
else
fprintf( yyc, "}, {NULL}, NULL }" ); /* memvar | alias | message */
}
if( pSym != HB_COMP_PARAM->symbols.pLast )
fprintf( yyc, ",\n" );
pSym = pSym->pNext;
}
hb_writeEndInit( HB_COMP_PARAM, yyc, szModulname, HB_COMP_PARAM->szFile );
/* Generate functions data
*/
pFunc = HB_COMP_PARAM->functions.pFirst;
if( ( pFunc->funFlags & FUN_FILE_DECL ) != 0 )
pFunc = pFunc->pNext;
while( pFunc )
{
bIsInitStatics = ( pFunc == HB_COMP_PARAM->pInitFunc );
bIsLineNumberInfo = ( pFunc == HB_COMP_PARAM->pLineFunc );
bIsInitFunction = ( pFunc->cScope & HB_FS_INIT ) != 0;
bIsExitFunction = ( pFunc->cScope & HB_FS_EXIT ) != 0;
bIsStaticFunction = ( pFunc->cScope & HB_FS_STATIC ) != 0;
/* Is it _STATICS$ - static initialization function */
if( bIsInitStatics )
fprintf( yyc, "HB_FUNC_INITSTATICS()" );
/* Is it an (_INITLINES) function */
else if( bIsLineNumberInfo )
fprintf( yyc, "HB_FUNC_INITLINES()" );
/* Is it an INIT FUNCTION/PROCEDURE */
else if( bIsInitFunction )
hb_compGenCFunc( yyc, "HB_FUNC_INIT( %s )", pFunc->szName, TRUE );
/* Is it an EXIT FUNCTION/PROCEDURE */
else if( bIsExitFunction )
hb_compGenCFunc( yyc, "HB_FUNC_EXIT( %s )", pFunc->szName, TRUE );
/* Is it a STATIC FUNCTION/PROCEDURE */
else if( bIsStaticFunction )
hb_compGenCFunc( yyc, "HB_FUNC_STATIC( %s )", pFunc->szName, FALSE );
else /* Then it must be PUBLIC FUNCTION/PROCEDURE */
hb_compGenCFunc( yyc, "HB_FUNC( %s )", pFunc->szName, FALSE );
fprintf( yyc, "\n" );
if( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_REALCODE )
{
hb_compGenCRealCode( HB_COMP_PARAM, pFunc, yyc );
}
else
{
if( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_COMPACT )
hb_compGenCCompact( pFunc, yyc );
else
hb_compGenCReadable( HB_COMP_PARAM, pFunc, yyc );
}
fprintf( yyc, "\n" );
pFunc = pFunc->pNext;
}
/* Generate C inline functions
*/
if( bIsInlineFunction )
{
fprintf( yyc, "#include \"hbapi.h\"\n" );
fprintf( yyc, "#include \"hbstack.h\"\n" );
fprintf( yyc, "#include \"hbapierr.h\"\n" );
fprintf( yyc, "#include \"hbapiitm.h\"\n" );
fprintf( yyc, "#include \"hbvm.h\"\n" );
fprintf( yyc, "#include \"hbapicls.h\"\n" );
fprintf( yyc, "#include \"hboo.ch\"\n" );
}
pInline = HB_COMP_PARAM->inlines.pFirst;
while( pInline )
{
if( pInline->pCode )
{
fprintf( yyc, "#line %i ", pInline->iLine );
hb_compGenCString( yyc, ( BYTE * ) pInline->szFileName,
strlen( pInline->szFileName ) );
fprintf( yyc, "\n" );
if( pInline->szName )
hb_compGenCFunc( yyc, "HB_FUNC_STATIC( %s )\n", pInline->szName, FALSE );
fprintf( yyc, "%s", pInline->pCode );
}
pInline = pInline->pNext;
}
}
else
{
pInline = HB_COMP_PARAM->inlines.pFirst;
while( pInline )
{
if( pInline->pCode )
{
if( !bIsInlineFunction )
{
fprintf( yyc, "#include \"hbvmpub.h\"\n" );
if( HB_COMP_PARAM->iGenCOutput != HB_COMPGENC_COMPACT )
fprintf( yyc, "#include \"hbpcode.h\"\n" );
fprintf( yyc, "#include \"hbinit.h\"\n" );
if( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_REALCODE )
fprintf( yyc, "#include \"hbxvm.h\"\n" );
bIsInlineFunction = TRUE;
}
fprintf( yyc, "#line %i ", pInline->iLine );
hb_compGenCString( yyc, ( BYTE * ) pInline->szFileName,
strlen( pInline->szFileName ) );
fprintf( yyc, "\n" );
if( pInline->szName )
hb_compGenCFunc( yyc, "HB_FUNC_STATIC( %s )\n", pInline->szName, FALSE );
fprintf( yyc, "%s", pInline->pCode );
}
pInline = pInline->pNext;
}
if( !bIsInlineFunction )
fprintf( yyc, "\n/* Empty source file */\n" );
}
fclose( yyc );
if( ! HB_COMP_PARAM->fQuiet )
hb_compOutStd( HB_COMP_PARAM, "Done.\n" );
}
static void hb_writeEndInit( HB_COMP_DECL, FILE* yyc, const char * szModulname, const char * szSourceFile )
{
/*
HB_SYMBOL_UNUSED( szSourceFile );
fprintf( yyc, "\nHB_INIT_SYMBOLS_END( hb_vm_SymbolInit_%s%s )\n\n",
HB_COMP_PARAM->szPrefix, szModulname );
*/
fprintf( yyc, "\nHB_INIT_SYMBOLS_EX_END( hb_vm_SymbolInit_%s%s, ",
HB_COMP_PARAM->szPrefix, szModulname );
hb_compGenCString( yyc, ( BYTE * ) szSourceFile, strlen( szSourceFile ) );
fprintf( yyc, ", 0x%lx, 0x%04x )\n\n", 0L, HB_PCODE_VER );
fprintf( yyc, "#if defined( HB_PRAGMA_STARTUP )\n"
" #pragma startup hb_vm_SymbolInit_%s%s\n"
"#elif defined( HB_MSC_STARTUP )\n"
" #if defined( HB_OS_WIN_64 )\n"
" #pragma section( HB_MSC_START_SEGMENT, long, read )\n"
" #endif\n"
" #pragma data_seg( HB_MSC_START_SEGMENT )\n"
" static HB_$INITSYM hb_vm_auto_SymbolInit_%s%s = hb_vm_SymbolInit_%s%s;\n"
" #pragma data_seg()\n"
"#endif\n\n",
HB_COMP_PARAM->szPrefix, szModulname,
HB_COMP_PARAM->szPrefix, szModulname,
HB_COMP_PARAM->szPrefix, szModulname );
}
static void hb_compGenCFunc( FILE * yyc, const char *cDecor, const char *szName, BOOL fStrip )
{
int i = 0;
while( cDecor[ i ] )
{
if( cDecor[ i ] == '%' && cDecor[ i + 1 ] == 's' )
{
const char * tmp = szName;
char c;
while( ( c = *tmp++ ) != 0 )
{
if( HB_ISNEXTIDCHAR( c ) )
fputc( ( UCHAR ) c, yyc );
else if( !fStrip || c != '$' || *tmp != 0 )
{
/* 'x' is used to force unique name and eliminate possible
* collisions with other function names.
*/
fprintf( yyc, "x%02x", ( UCHAR ) c );
}
}
i += 2;
}
else
{
fputc( ( UCHAR ) cDecor[ i ], yyc );
i++;
}
}
}
static void hb_compGenCByteStr( FILE * yyc, const BYTE * pText, ULONG ulLen )
{
ULONG ulPos;
for( ulPos = 0; ulPos < ulLen; ulPos++ )
{
BYTE uchr = ( BYTE ) pText[ ulPos ];
/*
* NOTE: After optimization some CHR(n) can be converted
* into a string containing nonprintable characters.
*
* TODO: add switch to use hexadecimal format "%#04x"
*/
fprintf( yyc, ( uchr < ( BYTE ) ' ' || uchr >= 127 || uchr == '\\' ||
uchr == '\'' ) ? "%i, " : "\'%c\', ", uchr );
}
}
static void hb_compGenCLocalName( PFUNCTION pFunc, int iLocal, ULONG lPCodePos, HB_GENC_INFO_PTR cargo )
{
/* Variable with negative order are local variables
* referenced in a codeblock -handle it with care
*/
if( cargo->ulEndBlockPos > lPCodePos )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( iLocal < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -iLocal );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", iLocal );
}
else
{
const char *szName = hb_compLocalVariableName( pFunc, ( USHORT ) iLocal );
if( szName )
fprintf( cargo->yyc, "\t/* %s */", szName );
else
fprintf( cargo->yyc, "\t/* localvar%i */", iLocal );
}
}
static void hb_compGenCStaticName( USHORT uiStatic, HB_GENC_INFO_PTR cargo )
{
const char *szName = hb_compStaticVariableName( cargo->HB_COMP_PARAM, uiStatic );
if( szName )
fprintf( cargo->yyc, "\t/* %s */", szName );
else
fprintf( cargo->yyc, "\t/* staticvar%hu */", uiStatic );
}
static HB_GENC_FUNC( hb_p_and )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_AND,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_arraypush )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_ARRAYPUSH,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_arraypushref )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_ARRAYPUSHREF,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_arraypop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_ARRAYPOP,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_dec )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_DEC,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_arraydim )
{
fprintf( cargo->yyc, "\tHB_P_ARRAYDIM, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_divide )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_DIVIDE,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_do )
{
fprintf( cargo->yyc, "\tHB_P_DO, %i, %i,\n",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
return 3;
}
static HB_GENC_FUNC( hb_p_doshort )
{
fprintf( cargo->yyc, "\tHB_P_DOSHORT, %i,\n", pFunc->pCode[ lPCodePos + 1 ] );
return 2;
}
static HB_GENC_FUNC( hb_p_duplicate )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_DUPLICATE,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_duplunref )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_DUPLUNREF,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_pushunref )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_PUSHUNREF,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_swap )
{
fprintf( cargo->yyc, "\tHB_P_SWAP, %i,\n", pFunc->pCode[ lPCodePos + 1 ] );
return 2;
}
static HB_GENC_FUNC( hb_p_equal )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_EQUAL,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_exactlyequal )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_EXACTLYEQUAL,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_endblock )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_ENDBLOCK,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_endproc )
{
if( lPCodePos + 1 == pFunc->lPCodePos )
fprintf( cargo->yyc, "\tHB_P_ENDPROC\n" );
else
fprintf( cargo->yyc, "\tHB_P_ENDPROC,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_false )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_FALSE,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_fortest )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_FORTEST,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_frame )
{
fprintf( cargo->yyc, "\tHB_P_FRAME, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* locals, params */" );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_funcptr )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_FUNCPTR,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_function )
{
fprintf( cargo->yyc, "\tHB_P_FUNCTION, %i, %i,\n",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
return 3;
}
static HB_GENC_FUNC( hb_p_functionshort )
{
fprintf( cargo->yyc, "\tHB_P_FUNCTIONSHORT, %i,\n", pFunc->pCode[ lPCodePos + 1 ] );
return 2;
}
static HB_GENC_FUNC( hb_p_arraygen )
{
fprintf( cargo->yyc, "\tHB_P_ARRAYGEN, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_hashgen )
{
fprintf( cargo->yyc, "\tHB_P_HASHGEN, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_greater )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_GREATER,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_greaterequal )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_GREATEREQUAL,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_inc )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_INC,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_instring )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_INSTRING,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_jumpnear )
{
fprintf( cargo->yyc, "\tHB_P_JUMPNEAR, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( signed char ) ( pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
return 2;
}
static HB_GENC_FUNC( hb_p_jump )
{
fprintf( cargo->yyc, "\tHB_P_JUMP, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_jumpfar )
{
fprintf( cargo->yyc, "\tHB_P_JUMPFAR, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
return 4;
}
static HB_GENC_FUNC( hb_p_jumpfalsenear )
{
fprintf( cargo->yyc, "\tHB_P_JUMPFALSENEAR, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( signed char ) ( pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
return 2;
}
static HB_GENC_FUNC( hb_p_jumpfalse )
{
fprintf( cargo->yyc, "\tHB_P_JUMPFALSE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_jumpfalsefar )
{
fprintf( cargo->yyc, "\tHB_P_JUMPFALSEFAR, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
return 4;
}
static HB_GENC_FUNC( hb_p_jumptruenear )
{
fprintf( cargo->yyc, "\tHB_P_JUMPTRUENEAR, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( signed char ) ( pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
return 2;
}
static HB_GENC_FUNC( hb_p_jumptrue )
{
fprintf( cargo->yyc, "\tHB_P_JUMPTRUE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_jumptruefar )
{
fprintf( cargo->yyc, "\tHB_P_JUMPTRUEFAR, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
return 4;
}
static HB_GENC_FUNC( hb_p_less )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_LESS,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_lessequal )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_LESSEQUAL,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_line )
{
if( cargo->bVerbose )
fprintf( cargo->yyc, "/* %05li */ ", lPCodePos );
else
fprintf( cargo->yyc, "\t" );
fprintf( cargo->yyc, "HB_P_LINE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_localname )
{
ULONG ulStart = lPCodePos;
fprintf( cargo->yyc, "\tHB_P_LOCALNAME, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", ( char * ) pFunc->pCode + lPCodePos + 3 );
fprintf( cargo->yyc, "\n" );
lPCodePos += 3;
while( pFunc->pCode[ lPCodePos ] )
{
char chr = pFunc->pCode[ lPCodePos++ ];
if( chr == '\'' || chr == '\\')
fprintf( cargo->yyc, " \'\\%c\',", chr );
else
fprintf( cargo->yyc, " \'%c\',", chr );
}
fprintf( cargo->yyc, " 0,\n" );
return ( lPCodePos - ulStart + 1 );
}
static HB_GENC_FUNC( hb_p_macropop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROPOP, %i,\n", pFunc->pCode[ lPCodePos + 1 ] );
return 2;
}
static HB_GENC_FUNC( hb_p_macropopaliased )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROPOPALIASED, %i,\n", pFunc->pCode[ lPCodePos + 1 ] );
return 2;
}
static HB_GENC_FUNC( hb_p_macropush )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROPUSH, %i,\n", pFunc->pCode[ lPCodePos + 1 ] );
return 2;
}
static HB_GENC_FUNC( hb_p_macropushref )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROPUSHREF,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_macrodo )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACRODO, %i, %i,\n",
pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] );
return 3;
}
static HB_GENC_FUNC( hb_p_macrofunc )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROFUNC, %i, %i,\n",
pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] );
return 3;
}
static HB_GENC_FUNC( hb_p_macrosend )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROSEND, %i, %i,\n",
pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] );
return 3;
}
static HB_GENC_FUNC( hb_p_macroarraygen )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROARRAYGEN, %i, %i,\n",
pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] );
return 3;
}
static HB_GENC_FUNC( hb_p_macropushlist )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROPUSHLIST, %i,\n", pFunc->pCode[ lPCodePos + 1 ] );
return 2;
}
static HB_GENC_FUNC( hb_p_macropushindex )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROPUSHINDEX,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_macropushpare )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROPUSHPARE, %i,\n", pFunc->pCode[ lPCodePos + 1 ] );
return 2;
}
static HB_GENC_FUNC( hb_p_macropushaliased )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROPUSHALIASED, %i,\n", pFunc->pCode[ lPCodePos + 1 ] );
return 2;
}
static HB_GENC_FUNC( hb_p_macrosymbol )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROSYMBOL,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_macrotext )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MACROTEXT,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_message )
{
fprintf( cargo->yyc, "\tHB_P_MESSAGE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_minus )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MINUS,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_modulename )
{
ULONG ulStart = lPCodePos;
fprintf( cargo->yyc, "\tHB_P_MODULENAME," );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %s */", ( char * ) pFunc->pCode + lPCodePos + 1 );
fprintf( cargo->yyc, "\n" );
lPCodePos++;
while( pFunc->pCode[ lPCodePos ] )
{
char chr = pFunc->pCode[ lPCodePos++ ];
if( chr == '\'' || chr == '\\')
fprintf( cargo->yyc, " \'\\%c\',", chr );
else
fprintf( cargo->yyc, " \'%c\',", chr );
}
fprintf( cargo->yyc, " 0,\n" );
return ( lPCodePos - ulStart + 1 );
}
static HB_GENC_FUNC( hb_p_modulus )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MODULUS,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_mult )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MULT,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_negate )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_NEGATE,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_not )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_NOT,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_notequal )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_NOTEQUAL,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_or )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_OR,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_parameter )
{
fprintf( cargo->yyc, "\tHB_P_PARAMETER, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 4;
}
static HB_GENC_FUNC( hb_p_plus )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_PLUS,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_pop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_POP,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_popalias )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_POPALIAS,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_popaliasedfield )
{
fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_popaliasedfieldnear )
{
fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELDNEAR, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 2;
}
static HB_GENC_FUNC( hb_p_popaliasedvar )
{
fprintf( cargo->yyc, "\tHB_P_POPALIASEDVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_popfield )
{
fprintf( cargo->yyc, "\tHB_P_POPFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_poplocal )
{
fprintf( cargo->yyc, "\tHB_P_POPLOCAL, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
int iVar = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_poplocalnear )
{
fprintf( cargo->yyc, "\tHB_P_POPLOCALNEAR, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
{
int iVar = ( signed char ) pFunc->pCode[ lPCodePos + 1 ];
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 2;
}
static HB_GENC_FUNC( hb_p_popmemvar )
{
fprintf( cargo->yyc, "\tHB_P_POPMEMVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_popstatic )
{
fprintf( cargo->yyc, "\tHB_P_POPSTATIC, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
hb_compGenCStaticName( HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ), cargo );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_popvariable )
{
fprintf( cargo->yyc, "\tHB_P_POPVARIABLE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_power )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_POWER,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_pushalias )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_PUSHALIAS,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_pushaliasedfield )
{
fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushaliasedfieldnear )
{
fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELDNEAR, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 2;
}
static HB_GENC_FUNC( hb_p_pushaliasedvar )
{
fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushblockshort )
{
fprintf( cargo->yyc, "\tHB_P_PUSHBLOCKSHORT, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %i */",
pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\n" );
if( cargo->ulEndBlockPos < lPCodePos )
cargo->ulEndBlockPos = lPCodePos + pFunc->pCode[ lPCodePos + 1 ] - 1;
return 2;
}
static HB_GENC_FUNC( hb_p_pushblock )
{
USHORT wVar, w;
ULONG ulStart = lPCodePos;
fprintf( cargo->yyc, "\tHB_P_PUSHBLOCK, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %i */",
HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
w = HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 3 ] );
fprintf( cargo->yyc, "\t%i, %i,",
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* number of local parameters (%i) */", w );
fprintf( cargo->yyc, "\n" );
wVar = HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 5 ] );
fprintf( cargo->yyc, "\t%i, %i,",
pFunc->pCode[ lPCodePos + 5 ],
pFunc->pCode[ lPCodePos + 6 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* number of local variables (%i) */", wVar );
fprintf( cargo->yyc, "\n" );
lPCodePos += 7; /* codeblock size + number of parameters + number of local variables */
/* create the table of referenced local variables */
while( wVar-- )
{
fprintf( cargo->yyc, "\t%i, %i,",
pFunc->pCode[ lPCodePos ],
pFunc->pCode[ lPCodePos + 1 ] );
/* NOTE:
* When a codeblock is used to initialize a static variable
* the names of local variables cannot be determined
* because at the time of C code generation we don't know
* in which function was defined this local variable
*/
if( cargo->bVerbose && ( pFunc->cScope & HB_FS_INITEXIT ) != HB_FS_INITEXIT )
{
w = HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos ] );
hb_compGenCLocalName( pFunc, w, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
lPCodePos += 2;
}
if( cargo->ulEndBlockPos < ulStart )
cargo->ulEndBlockPos = ulStart + HB_PCODE_MKUSHORT( &pFunc->pCode[ ulStart + 1 ] ) - 1;
return (lPCodePos - ulStart);
}
static HB_GENC_FUNC( hb_p_pushblocklarge )
{
USHORT wVar, w;
ULONG ulStart = lPCodePos;
fprintf( cargo->yyc, "\tHB_P_PUSHBLOCKLARGE, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %lu */",
HB_PCODE_MKUINT24( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
w = HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 4 ] );
fprintf( cargo->yyc, "\t%i, %i,",
pFunc->pCode[ lPCodePos + 4 ],
pFunc->pCode[ lPCodePos + 5 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* number of local parameters (%i) */", w );
fprintf( cargo->yyc, "\n" );
wVar = HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 6 ] );
fprintf( cargo->yyc, "\t%i, %i,",
pFunc->pCode[ lPCodePos + 6 ],
pFunc->pCode[ lPCodePos + 7 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* number of local variables (%i) */", wVar );
fprintf( cargo->yyc, "\n" );
lPCodePos += 8; /* codeblock size + number of parameters + number of local variables */
/* create the table of referenced local variables */
while( wVar-- )
{
fprintf( cargo->yyc, "\t%i, %i,",
pFunc->pCode[ lPCodePos ],
pFunc->pCode[ lPCodePos + 1 ] );
/* NOTE:
* When a codeblock is used to initialize a static variable
* the names of local variables cannot be determined
* because at the time of C code generation we don't know
* in which function was defined this local variable
*/
if( cargo->bVerbose && ( pFunc->cScope & HB_FS_INITEXIT ) != HB_FS_INITEXIT )
{
w = HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos ] );
hb_compGenCLocalName( pFunc, w, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
lPCodePos += 2;
}
if( cargo->ulEndBlockPos < ulStart )
cargo->ulEndBlockPos = ulStart + HB_PCODE_MKUINT24( &pFunc->pCode[ ulStart + 1 ] ) - 1;
return (lPCodePos - ulStart);
}
static HB_GENC_FUNC( hb_p_pushdouble )
{
int i;
fprintf( cargo->yyc, "\tHB_P_PUSHDOUBLE," );
++lPCodePos;
for( i = 0; i < ( int ) ( sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ) ); ++i )
{
fprintf( cargo->yyc, " %i,", ( UCHAR ) pFunc->pCode[ lPCodePos + i ] );
}
if( cargo->bVerbose )
{
fprintf( cargo->yyc, "\t/* %.*f, %d, %d */",
( UCHAR ) pFunc->pCode[ lPCodePos + sizeof( double ) + sizeof( BYTE ) ],
HB_PCODE_MKDOUBLE( &pFunc->pCode[ lPCodePos ] ),
( UCHAR ) pFunc->pCode[ lPCodePos + sizeof( double ) ],
( UCHAR ) pFunc->pCode[ lPCodePos + sizeof( double ) + sizeof( BYTE ) ] );
}
fprintf( cargo->yyc, "\n" );
return sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ) + 1;
}
static HB_GENC_FUNC( hb_p_pushfield )
{
fprintf( cargo->yyc, "\tHB_P_PUSHFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushbyte )
{
fprintf( cargo->yyc, "\tHB_P_PUSHBYTE, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", ( signed char ) pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\n" );
return 2;
}
static HB_GENC_FUNC( hb_p_pushint )
{
fprintf( cargo->yyc, "\tHB_P_PUSHINT, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushlocal )
{
fprintf( cargo->yyc, "\tHB_P_PUSHLOCAL, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
int iVar = (int) HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushlocalnear )
{
fprintf( cargo->yyc, "\tHB_P_PUSHLOCALNEAR, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
{
int iVar = ( signed char ) pFunc->pCode[ lPCodePos + 1 ];
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 2;
}
static HB_GENC_FUNC( hb_p_pushlocalref )
{
fprintf( cargo->yyc, "\tHB_P_PUSHLOCALREF, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
int iVar = (int) HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushlong )
{
fprintf( cargo->yyc, "\tHB_P_PUSHLONG, %i, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %li */", HB_PCODE_MKLONG( &pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 5;
}
static HB_GENC_FUNC( hb_p_pushlonglong )
{
fprintf( cargo->yyc, "\tHB_P_PUSHLONGLONG, %i, %i, %i, %i, %i, %i, %i, %i, ",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ],
pFunc->pCode[ lPCodePos + 5 ],
pFunc->pCode[ lPCodePos + 6 ],
pFunc->pCode[ lPCodePos + 7 ],
pFunc->pCode[ lPCodePos + 8 ] );
if( cargo->bVerbose )
{
#ifdef HB_LONG_LONG_OFF
fprintf( cargo->yyc, "\t/* %lf */", HB_PCODE_MKLONGLONG( &pFunc->pCode[ lPCodePos + 1 ] ) );
#else
char szBuf[ 24 ];
fprintf( cargo->yyc, "\t/* %s */", hb_numToStr( szBuf, sizeof( szBuf ),
HB_PCODE_MKLONGLONG( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
#endif
}
fprintf( cargo->yyc, "\n" );
return 9;
}
static HB_GENC_FUNC( hb_p_pushmemvar )
{
fprintf( cargo->yyc, "\tHB_P_PUSHMEMVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushmemvarref )
{
fprintf( cargo->yyc, "\tHB_P_PUSHMEMVARREF, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushnil )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_PUSHNIL,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_pushself )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_PUSHSELF,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_pushstatic )
{
fprintf( cargo->yyc, "\tHB_P_PUSHSTATIC, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
hb_compGenCStaticName( HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ), cargo );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushstaticref )
{
fprintf( cargo->yyc, "\tHB_P_PUSHSTATICREF, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
hb_compGenCStaticName( HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ), cargo );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushstrshort )
{
USHORT wLen = pFunc->pCode[ lPCodePos + 1 ];
fprintf( cargo->yyc, "\tHB_P_PUSHSTRSHORT, %i,", pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %i */", wLen );
if( wLen > 0 )
{
fprintf( cargo->yyc, "\n\t" );
hb_compGenCByteStr( cargo->yyc, &pFunc->pCode[ lPCodePos + 2 ], wLen );
}
fprintf( cargo->yyc, "\n" );
return wLen + 2;
}
static HB_GENC_FUNC( hb_p_pushstr )
{
USHORT wLen = HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\tHB_P_PUSHSTR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %i */", wLen );
if( wLen > 0 )
{
fprintf( cargo->yyc, "\n\t" );
hb_compGenCByteStr( cargo->yyc, &pFunc->pCode[ lPCodePos + 3 ], wLen );
}
fprintf( cargo->yyc, "\n" );
return wLen + 3;
}
static HB_GENC_FUNC( hb_p_pushstrlarge )
{
ULONG ulLen = HB_PCODE_MKUINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\tHB_P_PUSHSTRLARGE, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %lu */", ulLen );
if( ulLen > 0 )
{
fprintf( cargo->yyc, "\n\t" );
hb_compGenCByteStr( cargo->yyc, &pFunc->pCode[ lPCodePos + 4 ], ulLen );
}
fprintf( cargo->yyc, "\n" );
return ulLen + 4;
}
static HB_GENC_FUNC( hb_p_pushstrhidden )
{
USHORT wLen = HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 2 ] );
fprintf( cargo->yyc, "\tHB_P_PUSHSTRHIDDEN, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %i */", wLen );
if( wLen > 0 )
{
fprintf( cargo->yyc, "\n\t" );
hb_compGenCByteStr( cargo->yyc, &pFunc->pCode[ lPCodePos + 4 ], wLen );
}
fprintf( cargo->yyc, "\n" );
return wLen + 4;
}
static HB_GENC_FUNC( hb_p_pushsym )
{
fprintf( cargo->yyc, "\tHB_P_PUSHSYM, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushsymnear )
{
fprintf( cargo->yyc, "\tHB_P_PUSHSYMNEAR, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\n" );
return 2;
}
static HB_GENC_FUNC( hb_p_pushfuncsym )
{
fprintf( cargo->yyc, "\tHB_P_PUSHFUNCSYM, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushvariable )
{
fprintf( cargo->yyc, "\tHB_P_PUSHVARIABLE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_retvalue )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_RETVALUE,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_send )
{
fprintf( cargo->yyc, "\tHB_P_SEND, %i, %i,\n",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
return 3;
}
static HB_GENC_FUNC( hb_p_sendshort )
{
fprintf( cargo->yyc, "\tHB_P_SENDSHORT, %i,\n", pFunc->pCode[ lPCodePos + 1 ] );
return 2;
}
static HB_GENC_FUNC( hb_p_pushovarref )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_PUSHOVARREF,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_seqblock )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_SEQBLOCK,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_seqbegin )
{
fprintf( cargo->yyc, "\tHB_P_SEQBEGIN, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, lPCodePos + lOffset );
}
fprintf( cargo->yyc, "\n" );
return 4;
}
static HB_GENC_FUNC( hb_p_seqend )
{
if( cargo->bVerbose ) fprintf( cargo->yyc, "/* %05li */ ", lPCodePos );
else fprintf( cargo->yyc, "\t" );
fprintf( cargo->yyc, "HB_P_SEQEND, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, lPCodePos + lOffset );
}
fprintf( cargo->yyc, "\n" );
return 4;
}
static HB_GENC_FUNC( hb_p_seqrecover )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_SEQRECOVER,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_seqalways )
{
fprintf( cargo->yyc, "\tHB_P_SEQALWAYS, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, lPCodePos + lOffset );
}
fprintf( cargo->yyc, "\n" );
return 4;
}
static HB_GENC_FUNC( hb_p_alwaysbegin )
{
HB_SYMBOL_UNUSED( pFunc );
if( cargo->bVerbose ) fprintf( cargo->yyc, "/* %05li */ ", lPCodePos );
else fprintf( cargo->yyc, "\t" );
fprintf( cargo->yyc, "HB_P_ALWAYSBEGIN, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = HB_PCODE_MKINT24( &pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, lPCodePos + lOffset );
}
fprintf( cargo->yyc, "\n" );
return 4;
}
static HB_GENC_FUNC( hb_p_alwaysend )
{
HB_SYMBOL_UNUSED( pFunc );
if( cargo->bVerbose ) fprintf( cargo->yyc, "/* %05li */ ", lPCodePos );
else fprintf( cargo->yyc, "\t" );
fprintf( cargo->yyc, "HB_P_ALWAYSEND,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_sframe )
{
fprintf( cargo->yyc, "\tHB_P_SFRAME, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* symbol (_INITSTATICS) */" );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_statics )
{
fprintf( cargo->yyc, "\tHB_P_STATICS, %i, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* symbol (_INITSTATICS), %i statics */", HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 3 ] ) );
fprintf( cargo->yyc, "\n" );
return 5;
}
static HB_GENC_FUNC( hb_p_staticname )
{
ULONG ulStart = lPCodePos;
fprintf( cargo->yyc, "\tHB_P_STATICNAME, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", ( char * ) pFunc->pCode + lPCodePos + 4 );
fprintf( cargo->yyc, "\n" );
lPCodePos += 4;
while( pFunc->pCode[ lPCodePos ] )
{
char chr = pFunc->pCode[ lPCodePos++ ];
if( chr == '\'' || chr == '\\')
fprintf( cargo->yyc, " \'\\%c\',", chr );
else
fprintf( cargo->yyc, " \'%c\',", chr );
}
fprintf( cargo->yyc, " 0,\n" );
return ( lPCodePos - ulStart + 1 );
}
static HB_GENC_FUNC( hb_p_threadstatics )
{
USHORT w = HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ), u;
fprintf( cargo->yyc, "\tHB_P_THREADSTATICS, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* number of thread static variables: %i */", w );
fprintf( cargo->yyc, "\n" );
lPCodePos += 3;
for( u = 0; u < w; ++u )
{
fprintf( cargo->yyc, "\t%i, %i,",
pFunc->pCode[ lPCodePos ],
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
hb_compGenCStaticName( HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos ] ), cargo );
fprintf( cargo->yyc, "\n" );
lPCodePos +=2;
}
return ( ( ULONG ) w << 1 ) + 3;
}
static HB_GENC_FUNC( hb_p_swapalias )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_SWAPALIAS,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_true )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_TRUE,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_one )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_ONE,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_zero )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_ZERO,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_noop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_NOOP,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_dummy )
{
HB_SYMBOL_UNUSED( cargo );
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
return 1;
}
static HB_GENC_FUNC( hb_p_enumstart )
{
fprintf( cargo->yyc, "\tHB_P_ENUMSTART, %i, %i,\n",
pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] );
return 3;
}
static HB_GENC_FUNC( hb_p_enumnext )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_ENUMNEXT,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_enumprev )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_ENUMPREV,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_enumend )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_ENUMEND,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_switch )
{
if( cargo->bVerbose )
fprintf( cargo->yyc, "/* %05li */ ", lPCodePos );
else
fprintf( cargo->yyc, "\t" );
fprintf( cargo->yyc, "HB_P_SWITCH, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
fprintf( cargo->yyc, "\t/* %i*/", HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) );
}
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pushdate )
{
fprintf( cargo->yyc, "\tHB_P_PUSHDATE, %i, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ] );
if( cargo->bVerbose )
{
int year, month, day;
char date[9];
hb_dateDecode( HB_PCODE_MKLONG( &pFunc->pCode[ lPCodePos + 1 ] ), &year, &month, &day );
hb_dateStrPut( date, year, month, day );
date[8] = '\0';
fprintf( cargo->yyc, "\t/* %s */", date );
}
fprintf( cargo->yyc, "\n" );
return 5;
}
static HB_GENC_FUNC( hb_p_pushtimestamp )
{
fprintf( cargo->yyc, "\tHB_P_PUSHTIMESTAMP, %i, %i, %i, %i, %i, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ],
pFunc->pCode[ lPCodePos + 5 ],
pFunc->pCode[ lPCodePos + 6 ],
pFunc->pCode[ lPCodePos + 7 ],
pFunc->pCode[ lPCodePos + 8 ] );
if( cargo->bVerbose )
{
char timestamp[24];
hb_timeStampStr( timestamp,
HB_PCODE_MKLONG( &pFunc->pCode[ lPCodePos + 1 ] ),
HB_PCODE_MKLONG( &pFunc->pCode[ lPCodePos + 5 ] ) );
fprintf( cargo->yyc, "\t/* %s */", timestamp );
}
fprintf( cargo->yyc, "\n" );
return 9;
}
static HB_GENC_FUNC( hb_p_localnearaddint )
{
fprintf( cargo->yyc, "\tHB_P_LOCALNEARADDINT, %i, %i, %i,", pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
int iVar = ( signed char ) pFunc->pCode[ lPCodePos + 1 ];
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
fprintf( cargo->yyc, "/* %i */", HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 2 ] ) );
}
fprintf( cargo->yyc, "\n" );
return 4;
}
static HB_GENC_FUNC( hb_p_localaddint )
{
fprintf( cargo->yyc, "\tHB_P_LOCALADDINT, %i, %i, %i, %i,", pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ] );
if( cargo->bVerbose )
{
int iVar = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
fprintf( cargo->yyc, "/* %i */", HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 3 ] ) );
}
fprintf( cargo->yyc, "\n" );
return 5;
}
static HB_GENC_FUNC( hb_p_localinc )
{
fprintf( cargo->yyc, "\tHB_P_LOCALINC, %i, %i,", pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
int iVar = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_localdec )
{
fprintf( cargo->yyc, "\tHB_P_LOCALDEC, %i, %i,", pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
int iVar = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_localincpush )
{
fprintf( cargo->yyc, "\tHB_P_LOCALINCPUSH, %i, %i,", pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
int iVar = HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] );
hb_compGenCLocalName( pFunc, iVar, lPCodePos, cargo );
}
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_pluseqpop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_PLUSEQPOP,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_minuseqpop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MINUSEQPOP,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_multeqpop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MULTEQPOP,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_diveqpop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_DIVEQPOP,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_modeqpop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MODEQPOP,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_expeqpop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_EXPEQPOP,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_inceqpop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_INCEQPOP,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_deceqpop )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_DECEQPOP,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_pluseq )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_PLUSEQ,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_minuseq )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MINUSEQ,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_multeq )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MULTEQ,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_diveq )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_DIVEQ,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_modeq )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_MODEQ,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_expeq )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_EXPEQ,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_inceq )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_INCEQ,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_deceq )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_DECEQ,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_withobjectstart )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_WITHOBJECTSTART,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_withobjectmessage )
{
fprintf( cargo->yyc, "\tHB_P_WITHOBJECTMESSAGE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_withobjectend )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_WITHOBJECTEND,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_vframe )
{
fprintf( cargo->yyc, "\tHB_P_VFRAME, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* locals, params */" );
fprintf( cargo->yyc, "\n" );
return 3;
}
static HB_GENC_FUNC( hb_p_largeframe )
{
fprintf( cargo->yyc, "\tHB_P_LARGEFRAME, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* locals, params */" );
fprintf( cargo->yyc, "\n" );
return 4;
}
static HB_GENC_FUNC( hb_p_largevframe )
{
fprintf( cargo->yyc, "\tHB_P_LARGEVFRAME, %i, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* locals, params */" );
fprintf( cargo->yyc, "\n" );
return 4;
}
static HB_GENC_FUNC( hb_p_pushvparams )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_PUSHVPARAMS,\n" );
return 1;
}
/* NOTE: The order of functions have to match the order of opcodes
* mnemonics
*/
static const HB_GENC_FUNC_PTR s_verbose_table[] = {
hb_p_and,
hb_p_arraypush,
hb_p_arraypop,
hb_p_arraydim,
hb_p_arraygen,
hb_p_equal,
hb_p_endblock,
hb_p_endproc,
hb_p_exactlyequal,
hb_p_false,
hb_p_fortest,
hb_p_function,
hb_p_functionshort,
hb_p_frame,
hb_p_funcptr,
hb_p_greater,
hb_p_greaterequal,
hb_p_dec,
hb_p_divide,
hb_p_do,
hb_p_doshort,
hb_p_duplicate,
hb_p_pushtimestamp,
hb_p_inc,
hb_p_instring,
hb_p_jumpnear,
hb_p_jump,
hb_p_jumpfar,
hb_p_jumpfalsenear,
hb_p_jumpfalse,
hb_p_jumpfalsefar,
hb_p_jumptruenear,
hb_p_jumptrue,
hb_p_jumptruefar,
hb_p_lessequal,
hb_p_less,
hb_p_line,
hb_p_localname,
hb_p_macropop,
hb_p_macropopaliased,
hb_p_macropush,
hb_p_macroarraygen,
hb_p_macropushlist,
hb_p_macropushindex,
hb_p_macropushpare,
hb_p_macropushaliased,
hb_p_macrosymbol,
hb_p_macrotext,
hb_p_message,
hb_p_minus,
hb_p_modulus,
hb_p_modulename,
/* start: pcodes generated by macro compiler */
hb_p_dummy,
hb_p_dummy,
hb_p_dummy,
hb_p_dummy,
hb_p_dummy,
hb_p_dummy,
hb_p_dummy,
hb_p_dummy,
hb_p_dummy,
hb_p_dummy,
hb_p_dummy,
hb_p_dummy,
hb_p_dummy,
/* end: */
hb_p_mult,
hb_p_negate,
hb_p_noop,
hb_p_not,
hb_p_notequal,
hb_p_or,
hb_p_parameter,
hb_p_plus,
hb_p_pop,
hb_p_popalias,
hb_p_popaliasedfield,
hb_p_popaliasedfieldnear,
hb_p_popaliasedvar,
hb_p_popfield,
hb_p_poplocal,
hb_p_poplocalnear,
hb_p_popmemvar,
hb_p_popstatic,
hb_p_popvariable,
hb_p_power,
hb_p_pushalias,
hb_p_pushaliasedfield,
hb_p_pushaliasedfieldnear,
hb_p_pushaliasedvar,
hb_p_pushblock,
hb_p_pushblockshort,
hb_p_pushfield,
hb_p_pushbyte,
hb_p_pushint,
hb_p_pushlocal,
hb_p_pushlocalnear,
hb_p_pushlocalref,
hb_p_pushlong,
hb_p_pushmemvar,
hb_p_pushmemvarref,
hb_p_pushnil,
hb_p_pushdouble,
hb_p_pushself,
hb_p_pushstatic,
hb_p_pushstaticref,
hb_p_pushstr,
hb_p_pushstrshort,
hb_p_pushsym,
hb_p_pushsymnear,
hb_p_pushvariable,
hb_p_retvalue,
hb_p_send,
hb_p_sendshort,
hb_p_seqbegin,
hb_p_seqend,
hb_p_seqrecover,
hb_p_sframe,
hb_p_statics,
hb_p_staticname,
hb_p_swapalias,
hb_p_true,
hb_p_zero,
hb_p_one,
hb_p_macrofunc,
hb_p_macrodo,
/* start: more pcodes generated by macro compiler */
hb_p_dummy,
/* end: */
hb_p_localnearaddint,
hb_p_macropushref,
hb_p_pushlonglong,
hb_p_enumstart,
hb_p_enumnext,
hb_p_enumprev,
hb_p_enumend,
hb_p_switch,
hb_p_pushdate,
/* optimalization of inlined math operations (+=, -= */
hb_p_pluseqpop,
hb_p_minuseqpop,
hb_p_multeqpop,
hb_p_diveqpop,
hb_p_pluseq,
hb_p_minuseq,
hb_p_multeq,
hb_p_diveq,
hb_p_withobjectstart,
hb_p_withobjectmessage,
hb_p_withobjectend,
hb_p_macrosend,
hb_p_pushovarref,
hb_p_arraypushref,
hb_p_vframe,
hb_p_largeframe,
hb_p_largevframe,
hb_p_pushstrhidden,
hb_p_localaddint,
hb_p_modeqpop,
hb_p_expeqpop,
hb_p_modeq,
hb_p_expeq,
hb_p_duplunref,
hb_p_dummy,
hb_p_dummy,
hb_p_pushblocklarge,
hb_p_pushstrlarge,
hb_p_swap,
hb_p_pushvparams,
hb_p_pushunref,
hb_p_seqalways,
hb_p_alwaysbegin,
hb_p_alwaysend,
hb_p_deceqpop,
hb_p_inceqpop,
hb_p_deceq,
hb_p_inceq,
hb_p_localdec,
hb_p_localinc,
hb_p_localincpush,
hb_p_pushfuncsym,
hb_p_hashgen,
hb_p_seqblock,
hb_p_threadstatics
};
static void hb_compGenCReadable( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc )
{
const HB_GENC_FUNC_PTR * pFuncTable = s_verbose_table;
HB_GENC_INFO genc_info;
/* Make sure that table is correct */
assert( HB_P_LAST_PCODE == sizeof( s_verbose_table ) / sizeof( HB_GENC_FUNC_PTR ) );
genc_info.HB_COMP_PARAM = HB_COMP_PARAM;
genc_info.ulEndBlockPos = 0;
genc_info.bVerbose = ( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_VERBOSE );
genc_info.yyc = yyc;
fprintf( yyc, "{\n static const BYTE pcode[] =\n {\n" );
hb_compPCodeEval( pFunc, ( HB_PCODE_FUNC_PTR * ) pFuncTable, ( void * ) &genc_info );
if( genc_info.bVerbose )
fprintf( yyc, "/* %05li */\n", pFunc->lPCodePos );
fprintf( yyc, " };\n\n" );
fprintf( yyc, " hb_vmExecute( pcode, symbols );\n}\n" );
}
static void hb_compGenCCompact( PFUNCTION pFunc, FILE * yyc )
{
ULONG lPCodePos = 0;
int nChar;
fprintf( yyc, "{\n\tstatic const BYTE pcode[] =\n\t{\n\t\t" );
nChar = 0;
while( lPCodePos < pFunc->lPCodePos )
{
++nChar;
if( nChar > 1 )
fprintf( yyc, "," );
if( nChar == 15 )
{
fprintf( yyc, "\n\t\t" );
nChar = 1;
}
/* Displaying as decimal is more compact than hex */
fprintf( yyc, "%d", ( int ) pFunc->pCode[ lPCodePos++ ] );
}
if( nChar != 0)
fprintf( yyc, "\n" );
fprintf( yyc, "\t};\n\n" );
fprintf( yyc, "\thb_vmExecute( pcode, symbols );\n}\n" );
}