2006-05-05 11:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/hb-func.sh
* changed the exit code for .hrb file compilation by xhbcmp
* harbour/include/hbcomp.h
* harbour/source/compiler/gencc.c
* harbour/source/compiler/hblbl.c
* removed some variables which are not necessary in Harbour
* harbour/source/compiler/hbfix.c
+ added unconditional and conditional jump joining optimization
* harbour/source/vm/classes.c
* indenting and some minor modifications
* harbour/source/rdd/dbfcdx/dbfcdx1.c
! clear the logical key position buffer for pending relations
or hot record buffer updating
* harbour/source/rdd/dbffpt/dbffpt1.c
* harbour/source/vm/hvm.c
* casting
* harbour/source/vm/macro.c
* xharbour/include/hbvmpub.h
* removed HB_FS_ALLOCATED
* xharbour/source/vm/dynsym.c
* changed the code for hb_symbolNew() to avoid possible memory leak
alerts and keep the list of all dynamic symbols accessible.
It also reduced a little bit the memory fragmentation and total
size of memory allocated for dynamic symbols.
This commit is contained in:
@@ -8,6 +8,40 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
* harbour/source/vm/itemapi.c
|
||||
* return "S" for HB_IT_SYMBOL by hb_itemType()
|
||||
* formatting
|
||||
|
||||
2006-05-14 09:36 UTC+0300 Chen Kedem <niki@actcom.co.il>
|
||||
* doc/dirstruc.txt
|
||||
+ Add oneliner description for: source\rtl\gtalleg, source\rtl\gtwvt,
|
||||
source\rtl\gtxwc, source\vm\mainstd
|
||||
|
||||
* doc/howtocvs.txt
|
||||
* Update CVS location to reflect recent changes in SourceForge.
|
||||
|
||||
2006-05-05 11:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/bin/hb-func.sh
|
||||
* changed the exit code for .hrb file compilation by xhbcmp
|
||||
|
||||
* harbour/include/hbcomp.h
|
||||
* harbour/source/compiler/gencc.c
|
||||
* harbour/source/compiler/hblbl.c
|
||||
* removed some variables which are not necessary in Harbour
|
||||
|
||||
* harbour/source/compiler/hbfix.c
|
||||
+ added unconditional and conditional jump joining optimization
|
||||
|
||||
* harbour/source/vm/classes.c
|
||||
* xharbour/include/hbvmpub.h
|
||||
|
||||
* harbour/source/rdd/dbfcdx/dbfcdx1.c
|
||||
* xharbour/source/vm/dynsym.c
|
||||
or hot record buffer updating
|
||||
|
||||
* harbour/source/rdd/dbffpt/dbffpt1.c
|
||||
* harbour/source/vm/hvm.c
|
||||
* casting
|
||||
|
||||
* harbour/source/vm/macro.c
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ HB_XBGTK=""
|
||||
HB_HWGUI=""
|
||||
HB_USRLIBS=""
|
||||
HB_USRLPATH=""
|
||||
HB_GENC=""
|
||||
HB_GEN=""
|
||||
[ -n "\$TMPDIR" ] || TMPDIR="\$TMP"
|
||||
[ -n "\$TMPDIR" ] || TMPDIR="\$TEMP"
|
||||
[ -n "\$TMPDIR" ] || TMPDIR="/tmp"
|
||||
@@ -253,7 +253,8 @@ while [ \$n -lt \${#P[@]} ]; do
|
||||
-l[^-]*) HB_USRLIBS="\${HB_USRLIBS} \${v}" ;;
|
||||
-L[^-]*) HB_USRLPATH="\${HB_USRLPATH} \${v}" ;;
|
||||
-main=*) HB_MAIN_FUNC="\${v#*=}" ;;
|
||||
-gc|-gc[0-9]) HB_GENC="yes"; p="\${v}" ;;
|
||||
-gc|-gc[0-9]) HB_GEN="C"; p="\${v}" ;;
|
||||
-gh) HB_GEN="H"; p="\${v}" ;;
|
||||
-*) p="\${v}" ;;
|
||||
*) [ -z \${FILEOUT} ] && FILEOUT="\${v##*/}"; p="\${v}" ;;
|
||||
esac
|
||||
@@ -411,9 +412,11 @@ hb_cc()
|
||||
|
||||
hb_cmp()
|
||||
{
|
||||
${hb_cmpname} "\$@" \${HB_OPT} \${HB_PATHS} && [ -f "\${FOUTC}" ] && \\
|
||||
${hb_cmpname} "\$@" \${HB_OPT} \${HB_PATHS} && \\
|
||||
( [ "\${HB_GEN}" = "H" ] || \\
|
||||
( [ -f "\${FOUTC}" ] && \\
|
||||
hb_cc -c "\${FOUTC}" -o "\${FOUTO}" && \\
|
||||
( [ "\${HB_GENC}" = "yes" ] || rm -f "\${FOUTC}" )
|
||||
( [ "\${HB_GEN}" = "C" ] || rm -f "\${FOUTC}" ) ) )
|
||||
}
|
||||
|
||||
hb_link()
|
||||
|
||||
@@ -255,13 +255,11 @@ typedef struct _AUTOOPEN
|
||||
|
||||
typedef struct _HB_LABEL_INFO
|
||||
{
|
||||
FILE * yyc;
|
||||
FILE * yyc;
|
||||
BOOL fVerbose;
|
||||
BOOL fSetSeqBegin;
|
||||
BOOL fCondJump;
|
||||
BOOL fForEach;
|
||||
BOOL fSequence;
|
||||
BOOL fEndProc;
|
||||
ULONG * pulLabels;
|
||||
} HB_LABEL_INFO, * PHB_LABEL_INFO;
|
||||
|
||||
|
||||
@@ -232,10 +232,7 @@ static HB_GENC_FUNC( hb_p_endproc )
|
||||
fprintf( cargo->yyc, "\t/* *** END PROC *** */\n" );
|
||||
if( lPCodePos < pFunc->lPCodePos - 1 )
|
||||
{
|
||||
if( cargo->fEndProc && cargo->fSequence )
|
||||
fprintf( cargo->yyc, "\tgoto labEND;\n" );
|
||||
else
|
||||
fprintf( cargo->yyc, "\tbreak;\n" );
|
||||
fprintf( cargo->yyc, "\tbreak;\n" );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -1601,8 +1598,7 @@ void hb_compGenCRealCode( PFUNCTION pFunc, FILE * yyc )
|
||||
label_info.yyc = yyc;
|
||||
label_info.fVerbose = ( hb_comp_iGenCOutput == HB_COMPGENC_VERBOSE );
|
||||
label_info.fSetSeqBegin = FALSE;
|
||||
label_info.fCondJump = label_info.fForEach = label_info.fSequence =
|
||||
label_info.fEndProc = FALSE;
|
||||
label_info.fCondJump = label_info.fForEach = FALSE;
|
||||
if( pFunc->lPCodePos == 0 )
|
||||
label_info.pulLabels = NULL;
|
||||
else
|
||||
@@ -1623,8 +1619,6 @@ void hb_compGenCRealCode( PFUNCTION pFunc, FILE * yyc )
|
||||
hb_compPCodeEval( pFunc, ( HB_PCODE_FUNC_PTR * ) s_verbose_table, ( void * ) &label_info );
|
||||
|
||||
fprintf( yyc, " } while ( 0 );\n" );
|
||||
if( label_info.fEndProc && label_info.fSequence )
|
||||
fprintf( yyc, "labEND:\n" );
|
||||
if( label_info.fForEach )
|
||||
fprintf( yyc, " while( lForEachBase )\n {\n\thb_stackRemove( lForEachBase );\n\thb_xvmEnumEnd( &lForEachBase );\n }\n" );
|
||||
fprintf( yyc, " hb_xvmExitPorc( ulPrivateBase );\n" );
|
||||
|
||||
@@ -422,6 +422,24 @@ static HB_FIX_FUNC( hb_p_jumpfar )
|
||||
lOffset += HB_PCODE_MKINT24( &pFunc->pCode[ ulNewPos + 1 ] );
|
||||
HB_PUT_LE_UINT24( pAddr, lOffset );
|
||||
break;
|
||||
|
||||
case HB_P_JUMPFALSEFAR:
|
||||
ulNewPos += HB_PCODE_MKINT24( &pFunc->pCode[ ulNewPos + 1 ] );
|
||||
if( ulNewPos == lPCodePos + 4 )
|
||||
{
|
||||
pFunc->pCode[ lPCodePos ] = HB_P_JUMPTRUEFAR;
|
||||
HB_PUT_LE_UINT24( pAddr, lOffset + 4 );
|
||||
}
|
||||
break;
|
||||
|
||||
case HB_P_JUMPTRUEFAR:
|
||||
ulNewPos += HB_PCODE_MKINT24( &pFunc->pCode[ ulNewPos + 1 ] );
|
||||
if( ulNewPos == lPCodePos + 4 )
|
||||
{
|
||||
pFunc->pCode[ lPCodePos ] = HB_P_JUMPFALSEFAR;
|
||||
HB_PUT_LE_UINT24( pAddr, lOffset + 4 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 4;
|
||||
|
||||
@@ -150,7 +150,6 @@ static HB_LABEL_FUNC( hb_p_seqbegin )
|
||||
BYTE * pAddr = &pFunc->pCode[ lPCodePos + 1 ];
|
||||
ULONG ulRecoverPos = lPCodePos + HB_PCODE_MKINT24( pAddr );
|
||||
|
||||
cargo->fSequence = TRUE;
|
||||
if( cargo->fSetSeqBegin )
|
||||
cargo->pulLabels[ ulRecoverPos ]++;
|
||||
return 4;
|
||||
@@ -176,13 +175,6 @@ static HB_LABEL_FUNC( hb_p_enumstart )
|
||||
return 3;
|
||||
}
|
||||
|
||||
static HB_LABEL_FUNC( hb_p_endproc )
|
||||
{
|
||||
if( lPCodePos < pFunc->lPCodePos - 1 )
|
||||
cargo->fEndProc = TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* NOTE: The order of functions have to match the order of opcodes
|
||||
* mnemonics
|
||||
*/
|
||||
@@ -195,7 +187,7 @@ static PHB_LABEL_FUNC s_GenLabelFuncTable[ HB_P_LAST_PCODE ] =
|
||||
NULL, /* HB_P_ARRAYGEN, */
|
||||
NULL, /* HB_P_EQUAL, */
|
||||
NULL, /* HB_P_ENDBLOCK, */
|
||||
hb_p_endproc, /* HB_P_ENDPROC, */
|
||||
NULL, /* HB_P_ENDPROC, */
|
||||
NULL, /* HB_P_EXACTLYEQUAL, */
|
||||
NULL, /* HB_P_FALSE, */
|
||||
NULL, /* HB_P_FORTEST, */
|
||||
|
||||
@@ -6471,18 +6471,35 @@ static ERRCODE hb_cdxSeek( CDXAREAP pArea, BOOL fSoftSeek, PHB_ITEM pKeyItm, BOO
|
||||
static ERRCODE hb_cdxSkip( CDXAREAP pArea, LONG lToSkip )
|
||||
{
|
||||
LPCDXTAG pTag;
|
||||
ULONG ulPos;
|
||||
ULONG ulPos, ulRec;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_cdxSkip(%p, %ld)", pArea, lToSkip));
|
||||
|
||||
if( pArea->lpdbPendingRel )
|
||||
SELF_FORCEREL( ( AREAP ) pArea );
|
||||
|
||||
pTag = lToSkip == 0 ? NULL : hb_cdxGetActiveTag( pArea );
|
||||
ulPos = ( pTag && pArea->fPositioned && CURKEY_LOGPOS( pTag ) ) ? pTag->logKeyPos : 0;
|
||||
if( pTag && pArea->fPositioned && CURKEY_LOGPOS( pTag ) )
|
||||
{
|
||||
ulPos = pTag->logKeyPos;
|
||||
ulRec = pTag->logKeyRec;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulPos = ulRec = 0;
|
||||
}
|
||||
|
||||
if ( SUPER_SKIP( ( AREAP ) pArea, lToSkip ) == FAILURE )
|
||||
return FAILURE;
|
||||
|
||||
if ( pTag )
|
||||
{
|
||||
if ( ulPos && ( pTag->logKeyPos != ulPos || pTag->logKeyRec != ulRec ||
|
||||
( pTag->curKeyState & CDX_CURKEY_LOGPOS ) == 0 ) )
|
||||
{
|
||||
ulPos = 0;
|
||||
}
|
||||
|
||||
if ( lToSkip > 0 )
|
||||
{
|
||||
if ( pArea->fEof )
|
||||
|
||||
@@ -872,7 +872,7 @@ static ERRCODE hb_fptReadGCdata( FPTAREAP pArea, LPMEMOGCTABLE pGCtable )
|
||||
pGCtable->ulCounter = HB_GET_LE_UINT32( pGCtable->fptHeader.counter );
|
||||
if ( pGCtable->ulDirPage )
|
||||
{
|
||||
hb_fsSeek( pArea->hMemoFile, pGCtable->ulDirPage, FS_SET );
|
||||
hb_fsSeekLarge( pArea->hMemoFile, pGCtable->ulDirPage, FS_SET );
|
||||
if ( hb_fsRead( pArea->hMemoFile, ( BYTE * ) &fptBlock,
|
||||
sizeof( FPTBLOCK ) ) != sizeof( FPTBLOCK ) ||
|
||||
HB_GET_BE_UINT32( fptBlock.type ) != FPTIT_FLEX_GC )
|
||||
@@ -997,7 +997,7 @@ static ERRCODE hb_fptWriteGCdata( FPTAREAP pArea, LPMEMOGCTABLE pGCtable )
|
||||
HB_PUT_LE_UINT32( &bPageBuf[ ( i - j ) * 8 + 6 ],
|
||||
pGCtable->pGCitems[i].ulSize * pArea->uiMemoBlockSize );
|
||||
}
|
||||
hb_fsSeek( pArea->hMemoFile, pGCtable->ulDirPage, FS_SET );
|
||||
hb_fsSeekLarge( pArea->hMemoFile, pGCtable->ulDirPage, FS_SET );
|
||||
if ( hb_fsWrite( pArea->hMemoFile, ( BYTE * ) &fptBlock,
|
||||
sizeof( FPTBLOCK ) ) != sizeof( FPTBLOCK ) ||
|
||||
hb_fsWrite( pArea->hMemoFile, bPageBuf,
|
||||
@@ -1014,7 +1014,7 @@ static ERRCODE hb_fptWriteGCdata( FPTAREAP pArea, LPMEMOGCTABLE pGCtable )
|
||||
HB_PUT_LE_UINT32( &bPageBuf[ ( i - j ) * 8 + 6 ],
|
||||
pGCtable->pGCitems[i].ulOffset * pArea->uiMemoBlockSize );
|
||||
}
|
||||
hb_fsSeek( pArea->hMemoFile, pGCtable->ulRevPage, FS_SET );
|
||||
hb_fsSeekLarge( pArea->hMemoFile, pGCtable->ulRevPage, FS_SET );
|
||||
if ( hb_fsWrite( pArea->hMemoFile, ( BYTE * ) &fptBlock,
|
||||
sizeof( FPTBLOCK ) ) != sizeof( FPTBLOCK ) ||
|
||||
hb_fsWrite( pArea->hMemoFile, bPageBuf,
|
||||
@@ -3389,7 +3389,7 @@ static ULONG hb_fptPutVarFile( FPTAREAP pArea, ULONG ulBlock, BYTE * szFile )
|
||||
{
|
||||
ULONG ulSize;
|
||||
HB_FOFFSET size = hb_fsSeekLarge( hFile, 0, FS_END );
|
||||
hb_fsSeekLarge( hFile, 0, FS_SET );
|
||||
hb_fsSeek( hFile, 0, FS_SET );
|
||||
if( ( HB_FOFFSET ) ( size & 0xFFFFFFFFUL ) == size )
|
||||
ulSize = HB_MIN( ( ULONG ) size, 0xFFFFFFFFUL - sizeof( FPTBLOCK ) );
|
||||
else
|
||||
@@ -4125,10 +4125,10 @@ static ERRCODE hb_fptPutValueFile( FPTAREAP pArea, USHORT uiIndex, BYTE * szFile
|
||||
ULONG ulSize;
|
||||
HB_FOFFSET size = hb_fsSeekLarge( hFile, 0, FS_END );
|
||||
|
||||
hb_fsSeekLarge( hFile, 0, FS_SET );
|
||||
ulSize = HB_MIN( size, HB_VF_CHAR );
|
||||
hb_fsSeek( hFile, 0, FS_SET );
|
||||
ulSize = ( ULONG ) HB_MIN( size, HB_VF_CHAR );
|
||||
pAlloc = ( BYTE * ) hb_xgrab( ulSize + 1 );
|
||||
if( hb_fsRead( hFile, pAlloc, ulSize ) != ulSize )
|
||||
if( hb_fsRead( hFile, pAlloc, ulSize ) != ( USHORT ) ulSize )
|
||||
{
|
||||
uiError = EDBF_READ;
|
||||
hb_xfree( pAlloc );
|
||||
@@ -4151,7 +4151,7 @@ static ERRCODE hb_fptPutValueFile( FPTAREAP pArea, USHORT uiIndex, BYTE * szFile
|
||||
ULONG ulSize, ulBlock, ulType, ulOldSize, ulOldType;
|
||||
HB_FOFFSET size = hb_fsSeekLarge( hFile, 0, FS_END );
|
||||
|
||||
hb_fsSeekLarge( hFile, 0, FS_SET );
|
||||
hb_fsSeek( hFile, 0, FS_SET );
|
||||
if( ( HB_FOFFSET ) ( size & 0xFFFFFFFFUL ) == size )
|
||||
{
|
||||
ulSize = HB_MIN( ( ULONG ) size, 0xFFFFFFFFUL - sizeof( FPTBLOCK ) );
|
||||
|
||||
@@ -588,26 +588,25 @@ ULONG hb_cls_MsgToNum( PHB_DYNS pMsg )
|
||||
|
||||
BOOL hb_clsIsParent( USHORT uiClass, char * szParentName )
|
||||
{
|
||||
USHORT uiAt, uiLimit;
|
||||
USHORT uiAt, uiLimit;
|
||||
|
||||
if( uiClass && uiClass <= s_uiClasses )
|
||||
if( uiClass && uiClass <= s_uiClasses )
|
||||
{
|
||||
PCLASS pClass = s_pClasses + ( uiClass - 1 );
|
||||
PCLASS pClass = s_pClasses + ( uiClass - 1 );
|
||||
|
||||
uiLimit = ( USHORT ) ( pClass->uiHashKey * BUCKET );
|
||||
uiLimit = ( USHORT ) ( pClass->uiHashKey * BUCKET );
|
||||
|
||||
if( strcmp( pClass->szName, szParentName ) == 0 )
|
||||
return TRUE;
|
||||
|
||||
for( uiAt = 0; uiAt < uiLimit; uiAt++)
|
||||
{
|
||||
if( ( pClass->pMethods[ uiAt ].uiScope & HB_OO_CLSTP_CLASS ) == HB_OO_CLSTP_CLASS )
|
||||
{
|
||||
if( strcmp( pClass->pMethods[ uiAt ].pMessage->pSymbol->szName, szParentName ) == 0 )
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if( strcmp( pClass->szName, szParentName ) == 0 )
|
||||
return TRUE;
|
||||
|
||||
for( uiAt = 0; uiAt < uiLimit; uiAt++)
|
||||
{
|
||||
if( ( pClass->pMethods[ uiAt ].uiScope & HB_OO_CLSTP_CLASS ) == HB_OO_CLSTP_CLASS )
|
||||
{
|
||||
if( strcmp( pClass->pMethods[ uiAt ].pMessage->pSymbol->szName, szParentName ) == 0 )
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -717,59 +716,58 @@ char * hb_objGetRealClsName( PHB_ITEM pObject, char * szName )
|
||||
|
||||
/* default value to current class object */
|
||||
if (pObject->item.asArray.value->puiClsTree && pObject->item.asArray.value->puiClsTree[0])
|
||||
{
|
||||
uiClsTree = pObject->item.asArray.value->puiClsTree[0] ;
|
||||
uiCurCls = pObject->item.asArray.value->puiClsTree[uiClsTree] ;
|
||||
}
|
||||
{
|
||||
uiClsTree = pObject->item.asArray.value->puiClsTree[0] ;
|
||||
uiCurCls = pObject->item.asArray.value->puiClsTree[uiClsTree] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
uiClsTree = 1; /* Flag value */
|
||||
uiCurCls = uiClass;
|
||||
}
|
||||
{
|
||||
uiClsTree = 1; /* Flag value */
|
||||
uiCurCls = uiClass;
|
||||
}
|
||||
|
||||
while (uiClsTree)
|
||||
{
|
||||
if( uiCurCls && uiCurCls <= s_uiClasses )
|
||||
{
|
||||
if( uiCurCls && uiCurCls <= s_uiClasses )
|
||||
{
|
||||
PCLASS pClass = s_pClasses + ( uiCurCls - 1 );
|
||||
USHORT uiAt = ( USHORT ) ( ( ( hb_cls_MsgToNum( pMsg ) ) % pClass->uiHashKey ) * BUCKET );
|
||||
USHORT uiMask = ( USHORT ) ( pClass->uiHashKey * BUCKET );
|
||||
USHORT uiLimit = ( USHORT ) ( uiAt ? ( uiAt - 1 ) : ( uiMask - 1 ) );
|
||||
PCLASS pClass = s_pClasses + ( uiCurCls - 1 );
|
||||
USHORT uiAt = ( USHORT ) ( ( ( hb_cls_MsgToNum( pMsg ) ) % pClass->uiHashKey ) * BUCKET );
|
||||
USHORT uiMask = ( USHORT ) ( pClass->uiHashKey * BUCKET );
|
||||
USHORT uiLimit = ( USHORT ) ( uiAt ? ( uiAt - 1 ) : ( uiMask - 1 ) );
|
||||
|
||||
while( uiAt != uiLimit )
|
||||
{
|
||||
if( pClass->pMethods[ uiAt ].pMessage == pMsg )
|
||||
{
|
||||
uiClass = (pClass->pMethods + uiAt)->uiSprClass;
|
||||
uiClsTree=1; /* Flag Value */
|
||||
break;
|
||||
}
|
||||
while( uiAt != uiLimit )
|
||||
{
|
||||
if( pClass->pMethods[ uiAt ].pMessage == pMsg )
|
||||
{
|
||||
uiClass = (pClass->pMethods + uiAt)->uiSprClass;
|
||||
uiClsTree=1; /* Flag Value */
|
||||
break;
|
||||
}
|
||||
|
||||
uiAt++;
|
||||
uiAt++;
|
||||
|
||||
if( uiAt == uiMask )
|
||||
{
|
||||
uiAt = 0;
|
||||
}
|
||||
}
|
||||
if( uiAt == uiMask )
|
||||
{
|
||||
uiAt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-- uiClsTree)
|
||||
{
|
||||
uiCurCls = pObject->item.asArray.value->puiClsTree[uiClsTree] ;
|
||||
}
|
||||
if (-- uiClsTree)
|
||||
{
|
||||
uiCurCls = pObject->item.asArray.value->puiClsTree[uiClsTree] ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if( uiClass && uiClass <= s_uiClasses )
|
||||
{
|
||||
szClassName = ( s_pClasses + uiClass - 1 )->szName;
|
||||
szClassName = ( s_pClasses + uiClass - 1 )->szName;
|
||||
}
|
||||
else
|
||||
{
|
||||
szClassName = "UNKNOWN";
|
||||
szClassName = "UNKNOWN";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else /* built in types */
|
||||
@@ -781,6 +779,7 @@ char * hb_objGetRealClsName( PHB_ITEM pObject, char * szName )
|
||||
break;
|
||||
|
||||
case HB_IT_STRING:
|
||||
case HB_IT_MEMO:
|
||||
szClassName = "CHARACTER";
|
||||
break;
|
||||
|
||||
@@ -964,13 +963,13 @@ BOOL hb_objHasMsg( PHB_ITEM pObject, char *szString )
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_objHasMsg(%p, %s)", pObject, szString));
|
||||
|
||||
if( pDynSym )
|
||||
{
|
||||
{
|
||||
return hb_objGetMthd( pObject, pDynSym->pSymbol, FALSE ) != NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1235,14 +1234,15 @@ HB_FUNC( __CLSADDMSG )
|
||||
|
||||
|
||||
/*
|
||||
* <hClass> := __clsNew( <cClassName>, <nDatas>, [ahSuper,aoSuper] )
|
||||
* <hClass> := __clsNew( <cClassName>, <nDatas>, [ahSuper|aoSuper] )
|
||||
*
|
||||
* Create a new class
|
||||
*
|
||||
* <cClassName> Name of the class
|
||||
* <nDatas> Number of DATAs in the class
|
||||
* <ahSuper> Optional handle(s) of superclass(es)
|
||||
* <ahSuper> Optional superclass(es) Object instance
|
||||
* <aoSuper> Optional superclass(es) Object instance -
|
||||
* seems it's not implemented
|
||||
*/
|
||||
HB_FUNC( __CLSNEW )
|
||||
{
|
||||
@@ -1267,11 +1267,7 @@ HB_FUNC( __CLSNEW )
|
||||
s_pClasses = ( PCLASS ) hb_xgrab( sizeof( CLASS ) );
|
||||
|
||||
pNewCls = s_pClasses + s_uiClasses;
|
||||
pNewCls->szName = ( char * ) hb_xgrab( hb_parclen( 1 ) + 1 );
|
||||
|
||||
memset(pNewCls->szName, 0, hb_parclen( 1 ) + 1);
|
||||
|
||||
strcpy( pNewCls->szName, hb_parc( 1 ) );
|
||||
pNewCls->szName = hb_strdup( hb_parc( 1 ) );
|
||||
pNewCls->uiDataFirst = 0;
|
||||
pNewCls->uiDatas = 0;
|
||||
pNewCls->uiMethods = 0;
|
||||
@@ -1725,14 +1721,14 @@ HB_FUNC( __OBJHASMSG )
|
||||
PHB_ITEM pString = hb_param( 2, HB_IT_STRING );
|
||||
|
||||
if( pObject && pString )
|
||||
{
|
||||
{
|
||||
hb_retl( hb_objHasMsg( pObject, pString->item.asString.value ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
/*hb_errRT_BASE( EG_ARG, 3000, NULL, "__OBJHASMSG", 0 );*/
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, "__ObjHasMsg", 2, hb_paramError( 1 ), hb_paramError( 2 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -55,8 +55,6 @@
|
||||
#include "hbapiitm.h"
|
||||
#include "hbstack.h"
|
||||
|
||||
#define SYM_ALLOCATED ( ( HB_SYMBOLSCOPE ) -1 )
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PHB_DYNS pDynSym; /* Pointer to dynamic symbol */
|
||||
@@ -65,6 +63,17 @@ typedef struct
|
||||
static PDYNHB_ITEM s_pDynItems = NULL; /* Pointer to dynamic items */
|
||||
static USHORT s_uiDynSymbols = 0; /* Number of symbols present */
|
||||
|
||||
typedef struct _HB_SYM_HOLDER
|
||||
{
|
||||
HB_SYMB symbol;
|
||||
struct _HB_SYM_HOLDER * pNext;
|
||||
char szName[ 1 ];
|
||||
}
|
||||
HB_SYM_HOLDER, * PHB_SYM_HOLDER;
|
||||
|
||||
static PHB_SYM_HOLDER s_pAllocSyms = NULL;
|
||||
|
||||
|
||||
/* Closest symbol for match. hb_dynsymFind() will search for the name. */
|
||||
/* If it cannot find the name, it positions itself to the */
|
||||
/* closest symbol. */
|
||||
@@ -82,18 +91,23 @@ void hb_dynsymLog( void )
|
||||
|
||||
HB_EXPORT PHB_SYMB hb_symbolNew( char * szName ) /* Create a new symbol */
|
||||
{
|
||||
PHB_SYMB pSymbol;
|
||||
PHB_SYM_HOLDER pHolder;
|
||||
int iLen;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_symbolNew(%s)", szName));
|
||||
|
||||
pSymbol = ( PHB_SYMB ) hb_xgrab( sizeof( HB_SYMB ) );
|
||||
pSymbol->szName = ( char * ) hb_xgrab( strlen( szName ) + 1 );
|
||||
strcpy( pSymbol->szName, szName );
|
||||
pSymbol->scope.value = SYM_ALLOCATED; /* to know what symbols to release when exiting the app */
|
||||
pSymbol->value.pFunPtr = NULL;
|
||||
pSymbol->pDynSym = NULL;
|
||||
iLen = strlen( szName );
|
||||
pHolder = ( PHB_SYM_HOLDER ) hb_xgrab( sizeof( HB_SYM_HOLDER ) + iLen );
|
||||
memcpy( pHolder->szName, szName, iLen + 1 );
|
||||
pHolder->pNext = s_pAllocSyms;
|
||||
s_pAllocSyms = pHolder;
|
||||
|
||||
return pSymbol;
|
||||
pHolder->symbol.szName = pHolder->szName;
|
||||
pHolder->symbol.scope.value = 0;
|
||||
pHolder->symbol.value.pFunPtr = NULL;
|
||||
pHolder->symbol.pDynSym = NULL;
|
||||
|
||||
return &pHolder->symbol;
|
||||
}
|
||||
|
||||
HB_EXPORT PHB_DYNS hb_dynsymNew( PHB_SYMB pSymbol ) /* creates a new dynamic symbol */
|
||||
@@ -268,9 +282,7 @@ HB_EXPORT PHB_DYNS hb_dynsymFind( char * szName )
|
||||
s_pDynItems = ( PDYNHB_ITEM ) hb_xgrab( sizeof( DYNHB_ITEM ) ); /* Grab array */
|
||||
s_pDynItems->pDynSym = ( PHB_DYNS ) hb_xgrab( sizeof( HB_DYNS ) );
|
||||
/* Always grab a first symbol. Never an empty bucket. *<1>* */
|
||||
s_pDynItems->pDynSym->hMemvar = 0;
|
||||
s_pDynItems->pDynSym->pSymbol = NULL;
|
||||
s_pDynItems->pDynSym->pFunPtr = NULL;
|
||||
memset( s_pDynItems->pDynSym, 0, sizeof( HB_DYNS ) );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -392,23 +404,25 @@ void hb_dynsymEval( PHB_DYNS_FUNC pFunction, void * Cargo )
|
||||
|
||||
void hb_dynsymRelease( void )
|
||||
{
|
||||
PHB_SYM_HOLDER pHolder;
|
||||
USHORT uiPos;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dynsymRelease()"));
|
||||
|
||||
for( uiPos = 0; uiPos < s_uiDynSymbols; uiPos++ )
|
||||
{
|
||||
/* it is a allocated symbol ? */
|
||||
if( ( s_pDynItems + uiPos )->pDynSym->pSymbol->scope.value == SYM_ALLOCATED )
|
||||
{
|
||||
hb_xfree( ( s_pDynItems + uiPos )->pDynSym->pSymbol->szName );
|
||||
hb_xfree( ( s_pDynItems + uiPos )->pDynSym->pSymbol );
|
||||
}
|
||||
|
||||
hb_xfree( ( s_pDynItems + uiPos )->pDynSym );
|
||||
}
|
||||
|
||||
hb_xfree( s_pDynItems );
|
||||
s_pDynItems = NULL;
|
||||
s_uiDynSymbols = 0;
|
||||
|
||||
while( s_pAllocSyms )
|
||||
{
|
||||
pHolder = s_pAllocSyms;
|
||||
s_pAllocSyms = s_pAllocSyms->pNext;
|
||||
hb_xfree( pHolder );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HB_EXTENSION
|
||||
|
||||
@@ -3696,7 +3696,7 @@ static void hb_vmArrayGen( ULONG ulElements ) /* generates an ulElements Array a
|
||||
hb_stackItemFromTop( ( int ) ( ulPos - ulElements - 1 ) ) );
|
||||
|
||||
/* move the new array to position of first parameter */
|
||||
hb_itemMove( hb_stackItemFromTop( ( int ) ( -ulElements - 1 ) ), pArray );
|
||||
hb_itemMove( hb_stackItemFromTop( ( int ) ( -1 - ulElements ) ), pArray );
|
||||
|
||||
/* decrease the stack counter - all items are NIL */
|
||||
hb_stackDecrease( ulElements );
|
||||
@@ -5715,6 +5715,52 @@ HB_EXPORT void hb_vmProcessSymbols( PHB_SYMB pModuleSymbols, USHORT uiModuleSymb
|
||||
}
|
||||
}
|
||||
|
||||
/* hvm support for pcode DLLs */
|
||||
HB_EXPORT void hb_vmProcessDllSymbols( PHB_SYMB pModuleSymbols, USHORT uiModuleSymbols )
|
||||
{
|
||||
PSYMBOLS pNewSymbols;
|
||||
USHORT ui;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_vmProcessDllSymbols(%p, %hu)", pModuleSymbols, uiModuleSymbols));
|
||||
|
||||
pNewSymbols = ( PSYMBOLS ) hb_xgrab( sizeof( SYMBOLS ) );
|
||||
pNewSymbols->pModuleSymbols = pModuleSymbols;
|
||||
pNewSymbols->uiModuleSymbols = uiModuleSymbols;
|
||||
pNewSymbols->pNext = NULL;
|
||||
pNewSymbols->hScope = 0;
|
||||
|
||||
if( s_pSymbols == NULL )
|
||||
s_pSymbols = pNewSymbols;
|
||||
else
|
||||
{
|
||||
PSYMBOLS pLastSymbols;
|
||||
|
||||
pLastSymbols = s_pSymbols;
|
||||
while( pLastSymbols->pNext ) /* locates the latest processed group of symbols */
|
||||
pLastSymbols = pLastSymbols->pNext;
|
||||
|
||||
pLastSymbols->pNext = pNewSymbols;
|
||||
}
|
||||
|
||||
for( ui = 0; ui < uiModuleSymbols; ui++ ) /* register each public symbol on the dynamic symbol table */
|
||||
{
|
||||
HB_SYMBOLSCOPE hSymScope;
|
||||
|
||||
hSymScope = ( pModuleSymbols + ui )->scope.value;
|
||||
pNewSymbols->hScope |= hSymScope;
|
||||
|
||||
if( ( hSymScope == HB_FS_PUBLIC ) || ( hSymScope & ( HB_FS_MESSAGE | HB_FS_MEMVAR | HB_FS_FIRST ) ) )
|
||||
{
|
||||
PHB_DYNS pDynSym = hb_dynsymFind( ( pModuleSymbols + ui )->szName );
|
||||
|
||||
if( pDynSym && pDynSym->pFunPtr && ( pModuleSymbols + ui )->value.pFunPtr )
|
||||
( pModuleSymbols + ui )->value.pFunPtr = pDynSym->pFunPtr;
|
||||
else
|
||||
hb_dynsymNew( ( pModuleSymbols + ui ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void hb_vmReleaseLocalSymbols( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_vmReleaseLocalSymbols()"));
|
||||
@@ -7329,53 +7375,6 @@ HB_FUNC( __TRACEPRGCALLS )
|
||||
hb_retl( bOldValue );
|
||||
}
|
||||
|
||||
/* hvm support for pcode DLLs */
|
||||
|
||||
HB_EXPORT void hb_vmProcessDllSymbols( PHB_SYMB pModuleSymbols, USHORT uiModuleSymbols )
|
||||
{
|
||||
PSYMBOLS pNewSymbols;
|
||||
USHORT ui;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_vmProcessDllSymbols(%p, %hu)", pModuleSymbols, uiModuleSymbols));
|
||||
|
||||
pNewSymbols = ( PSYMBOLS ) hb_xgrab( sizeof( SYMBOLS ) );
|
||||
pNewSymbols->pModuleSymbols = pModuleSymbols;
|
||||
pNewSymbols->uiModuleSymbols = uiModuleSymbols;
|
||||
pNewSymbols->pNext = NULL;
|
||||
pNewSymbols->hScope = 0;
|
||||
|
||||
if( s_pSymbols == NULL )
|
||||
s_pSymbols = pNewSymbols;
|
||||
else
|
||||
{
|
||||
PSYMBOLS pLastSymbols;
|
||||
|
||||
pLastSymbols = s_pSymbols;
|
||||
while( pLastSymbols->pNext ) /* locates the latest processed group of symbols */
|
||||
pLastSymbols = pLastSymbols->pNext;
|
||||
|
||||
pLastSymbols->pNext = pNewSymbols;
|
||||
}
|
||||
|
||||
for( ui = 0; ui < uiModuleSymbols; ui++ ) /* register each public symbol on the dynamic symbol table */
|
||||
{
|
||||
HB_SYMBOLSCOPE hSymScope;
|
||||
|
||||
hSymScope = ( pModuleSymbols + ui )->scope.value;
|
||||
pNewSymbols->hScope |= hSymScope;
|
||||
|
||||
if( ( hSymScope == HB_FS_PUBLIC ) || ( hSymScope & ( HB_FS_MESSAGE | HB_FS_MEMVAR | HB_FS_FIRST ) ) )
|
||||
{
|
||||
PHB_DYNS pDynSym = hb_dynsymFind( ( pModuleSymbols + ui )->szName );
|
||||
|
||||
if( pDynSym && pDynSym->pFunPtr && ( pModuleSymbols + ui )->value.pFunPtr )
|
||||
( pModuleSymbols + ui )->value.pFunPtr = pDynSym->pFunPtr;
|
||||
else
|
||||
hb_dynsymNew( ( pModuleSymbols + ui ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HB_FUNC( __OPCOUNT ) /* it returns the total amount of opcodes */
|
||||
{
|
||||
hb_retnl( HB_P_LAST_PCODE - 1 );
|
||||
|
||||
@@ -1228,7 +1228,7 @@ void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_
|
||||
}
|
||||
else if( bFunction )
|
||||
{
|
||||
if( pSym && pSym->pFunPtr==NULL )
|
||||
if( pSym->pFunPtr==NULL )
|
||||
{
|
||||
/* static functions are not allowed in macro */
|
||||
HB_MACRO_DATA->status |= HB_MACRO_UNKN_SYM;
|
||||
|
||||
Reference in New Issue
Block a user