diff --git a/ChangeLog.txt b/ChangeLog.txt index a19fb300e9..3b0e468c96 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,61 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2024-02-16 18:23 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/hbexpat/3rd/expat/expat.diff + * contrib/hbexpat/3rd/expat/loadlibr.c + ! use HB_WINAPI_GETPROCADDRESS() instead of GetProcAddress() + in WinCE builds + + * contrib/hbhpdf/3rd/libhpdf/hpdfstre.c + * contrib/hbhpdf/3rd/libhpdf/libhpdf.diff + ! include in WinCE builds, it's necessary for GetLastError() + + * src/3rd/jpeg/Makefile + ! do not use getenv() in all WinCE builds + + * src/common/hbver.c + * cast revision number to HB_ULONG to pacify warning + + * src/vm/extrap.c + ! do not compile unused in WinCE builds hb_winExceptionHandler() + + * include/hbapi.h + * added HB_EXPORT attribute to hb_macroTextValue() function + + * include/hbvm.h + * src/vm/hvm.c + + added C function: + PHB_ITEM hb_vmCompileMacro( const char * szExpr, PHB_ITEM pDest ); + It returns Harbour item or NULL at error (wrong macro text). + The result should be used with hb_vmEvalBlockOrMacro() and then freed + by hb_vmDestroyBlockOrMacro(). It hides low level macro representation + so we can change it in the future. Now it's still simple pointer item + without autodestructor. + + * src/rdd/hsx/hsx.c + * src/rdd/workarea.c + * use hb_vmCompileMacro() instead of hb_macroCompile() + + * src/vm/runner.c + * changed 6101 error message for "Unknown or unregistered symbol" + to "Unknown or unregistered function symbol". + * report above error when HRB module is loaded and its external function + is not registered or not marked as DYNAMIC by earlier registered modules + in HVM symbol table. + Warning. This modification may exploit problems in code loading HRB files + with cross references which has worked so far. In such case user should + pass to hb_hrbLoad()/hb_hrbRun() as first parameters flags containing + HB_HRB_BIND_LAZY or declare the problematic function in his main code + as dynamic, i.e.: + DYNAMIC + + * src/rdd/dbf1.c + * declare internal function hb_dbfTransCheckCounters() as static one + + * src/harbour.def + ! added missing exported Harbour functions + 2024-02-13 05:49 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * debian/compat * set 10 as compatibility level diff --git a/contrib/hbexpat/3rd/expat/expat.diff b/contrib/hbexpat/3rd/expat/expat.diff index b484f0e9e8..eec001980d 100644 --- a/contrib/hbexpat/3rd/expat/expat.diff +++ b/contrib/hbexpat/3rd/expat/expat.diff @@ -1,16 +1,27 @@ diff --strip-trailing-cr -urN expat.orig/loadlibr.c expat/loadlibr.c ---- expat.orig/loadlibr.c 2017-09-11 15:16:52.000000000 +0000 -+++ expat/loadlibr.c 2017-12-20 11:25:28.652000000 +0000 -@@ -32,6 +32,9 @@ +--- expat.orig/loadlibr.c 2024-02-13 06:16:03.142931679 +0100 ++++ expat/loadlibr.c 2024-02-13 06:49:13.103221128 +0100 +@@ -32,7 +32,10 @@ #if defined(_WIN32) +-#include +#if defined(UNICODE) && !defined(_UNICODE) +#define _UNICODE +#endif - #include ++#include "winconfi.h" #include + +@@ -103,7 +106,7 @@ + /* Detect if KB2533623 is installed, as LOAD_LIBARY_SEARCH_SYSTEM32 is only + supported on Windows Vista, Windows Server 2008, Windows 7 and Windows + Server 2008 R2 with this patch or natively on Windows 8 and above */ +- else if(pLoadLibraryEx && GetProcAddress(hKernel32, "AddDllDirectory")) { ++ else if(pLoadLibraryEx && HB_WINAPI_GETPROCADDRESS(hKernel32, "AddDllDirectory")) { + /* Load the DLL from the Windows system directory */ + hModule = pLoadLibraryEx(filename, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); + } @@ -114,7 +117,7 @@ /* Allocate space for the full DLL path (Room for the null terminator is included in systemdirlen) */ @@ -21,8 +32,8 @@ diff --strip-trailing-cr -urN expat.orig/loadlibr.c expat/loadlibr.c /* Calculate the full DLL path */ _tcscpy(path + _tcslen(path), TEXT("\\")); diff --strip-trailing-cr -urN expat.orig/winconfi.h expat/winconfi.h ---- expat.orig/winconfi.h 2017-09-03 14:47:40.000000000 +0000 -+++ expat/winconfi.h 2017-12-19 20:29:14.992000000 +0000 +--- expat.orig/winconfi.h 2024-02-13 06:16:03.142931679 +0100 ++++ expat/winconfi.h 2017-12-20 11:37:33.337587069 +0100 @@ -1,63 +1 @@ -/* - __ __ _ @@ -89,8 +100,8 @@ diff --strip-trailing-cr -urN expat.orig/winconfi.h expat/winconfi.h -#endif /* ndef WINCONFIG_H */ +#include "_hbconf.h" diff --strip-trailing-cr -urN expat.orig/xmlparse.c expat/xmlparse.c ---- expat.orig/xmlparse.c 2017-10-31 16:20:31.000000000 +0000 -+++ expat/xmlparse.c 2017-12-20 11:26:49.912000000 +0000 +--- expat.orig/xmlparse.c 2024-02-13 06:16:03.142931679 +0100 ++++ expat/xmlparse.c 2017-12-20 12:31:54.994032713 +0100 @@ -43,6 +43,12 @@ #ifdef _WIN32 @@ -167,8 +178,8 @@ diff --strip-trailing-cr -urN expat.orig/xmlparse.c expat/xmlparse.c return NULL; /* Copy the original into place */ diff --strip-trailing-cr -urN expat.orig/xmlrole.c expat/xmlrole.c ---- expat.orig/xmlrole.c 2017-09-03 14:47:40.000000000 +0000 -+++ expat/xmlrole.c 2017-12-19 20:29:15.000000000 +0000 +--- expat.orig/xmlrole.c 2024-02-13 06:16:03.142931679 +0100 ++++ expat/xmlrole.c 2017-12-20 11:37:33.337587069 +0100 @@ -36,7 +36,7 @@ #include "winconfi.h" #else @@ -179,8 +190,8 @@ diff --strip-trailing-cr -urN expat.orig/xmlrole.c expat/xmlrole.c #endif /* ndef _WIN32 */ diff --strip-trailing-cr -urN expat.orig/xmltok.c expat/xmltok.c ---- expat.orig/xmltok.c 2017-09-11 17:31:49.000000000 +0000 -+++ expat/xmltok.c 2017-12-19 20:29:15.000000000 +0000 +--- expat.orig/xmltok.c 2024-02-13 06:16:03.142931679 +0100 ++++ expat/xmltok.c 2018-09-20 12:45:24.874163719 +0200 @@ -47,7 +47,7 @@ #include "winconfi.h" #else diff --git a/contrib/hbexpat/3rd/expat/loadlibr.c b/contrib/hbexpat/3rd/expat/loadlibr.c index 40cb982a52..153869b029 100644 --- a/contrib/hbexpat/3rd/expat/loadlibr.c +++ b/contrib/hbexpat/3rd/expat/loadlibr.c @@ -35,7 +35,7 @@ #if defined(UNICODE) && !defined(_UNICODE) #define _UNICODE #endif -#include +#include "winconfi.h" #include @@ -106,7 +106,7 @@ HMODULE _Expat_LoadLibrary(LPCTSTR filename) /* Detect if KB2533623 is installed, as LOAD_LIBARY_SEARCH_SYSTEM32 is only supported on Windows Vista, Windows Server 2008, Windows 7 and Windows Server 2008 R2 with this patch or natively on Windows 8 and above */ - else if(pLoadLibraryEx && GetProcAddress(hKernel32, "AddDllDirectory")) { + else if(pLoadLibraryEx && HB_WINAPI_GETPROCADDRESS(hKernel32, "AddDllDirectory")) { /* Load the DLL from the Windows system directory */ hModule = pLoadLibraryEx(filename, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); } diff --git a/contrib/hbhpdf/3rd/libhpdf/hpdfstre.c b/contrib/hbhpdf/3rd/libhpdf/hpdfstre.c index 54ab452a36..9bed69a05d 100644 --- a/contrib/hbhpdf/3rd/libhpdf/hpdfstre.c +++ b/contrib/hbhpdf/3rd/libhpdf/hpdfstre.c @@ -20,6 +20,8 @@ #ifndef UNDER_CE #include +#else +#include #endif #ifndef HPDF_UNUSED #define HPDF_UNUSED(a) ((void)(a)) diff --git a/contrib/hbhpdf/3rd/libhpdf/libhpdf.diff b/contrib/hbhpdf/3rd/libhpdf/libhpdf.diff index 3dd0b97018..95170df80c 100644 --- a/contrib/hbhpdf/3rd/libhpdf/libhpdf.diff +++ b/contrib/hbhpdf/3rd/libhpdf/libhpdf.diff @@ -1,6 +1,6 @@ -diff -urN libhpdf.orig/hpdf.h libhpdf/hpdf.h ---- libhpdf.orig/hpdf.h 2015-09-09 21:22:05.772098624 +0200 -+++ libhpdf/hpdf.h 2015-09-09 21:22:05.772098624 +0200 +diff -ruN libhpdf.orig/hpdf.h libhpdf/hpdf.h +--- libhpdf.orig/hpdf.h 2024-02-13 06:29:01.044028718 +0100 ++++ libhpdf/hpdf.h 2017-02-02 16:09:36.813987868 +0100 @@ -17,7 +17,7 @@ #ifndef _HPDF_H #define _HPDF_H @@ -19,9 +19,9 @@ diff -urN libhpdf.orig/hpdf.h libhpdf/hpdf.h HPDF_Page_CreateTextMarkupAnnot (HPDF_Page page, HPDF_Rect rect, const char *text, -diff -urN libhpdf.orig/hpdfimac.c libhpdf/hpdfimac.c ---- libhpdf.orig/hpdfimac.c 2015-09-09 21:22:05.688098623 +0200 -+++ libhpdf/hpdfimac.c 2015-09-09 21:22:05.688098623 +0200 +diff -ruN libhpdf.orig/hpdfimac.c libhpdf/hpdfimac.c +--- libhpdf.orig/hpdfimac.c 2024-02-13 06:29:01.044028718 +0100 ++++ libhpdf/hpdfimac.c 2017-02-02 16:09:36.829987215 +0100 @@ -18,7 +18,7 @@ #include "hpdfconf.h" #include "hpdfutil.h" @@ -40,9 +40,9 @@ diff -urN libhpdf.orig/hpdfimac.c libhpdf/hpdfimac.c /* NB: the uint32 casts are to silence certain ANSI-C compilers */ #define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y))) -diff -urN libhpdf.orig/hpdfpago.c libhpdf/hpdfpago.c ---- libhpdf.orig/hpdfpago.c 2015-09-09 21:22:05.724098623 +0200 -+++ libhpdf/hpdfpago.c 2015-09-09 21:22:05.724098623 +0200 +diff -ruN libhpdf.orig/hpdfpago.c libhpdf/hpdfpago.c +--- libhpdf.orig/hpdfpago.c 2024-02-13 06:29:01.048028597 +0100 ++++ libhpdf/hpdfpago.c 2017-02-02 16:09:36.829987215 +0100 @@ -1155,7 +1155,7 @@ return HPDF_RaiseError (page->error, HPDF_PAGE_INVALID_FONT, 0); @@ -52,9 +52,21 @@ diff -urN libhpdf.orig/hpdfpago.c libhpdf/hpdfpago.c if (page->mmgr != font->mmgr) return HPDF_RaiseError (page->error, HPDF_PAGE_INVALID_FONT, 0); -diff -urN libhpdf.orig/hpdfutil.h libhpdf/hpdfutil.h ---- libhpdf.orig/hpdfutil.h 2015-09-09 21:22:05.816098625 +0200 -+++ libhpdf/hpdfutil.h 2015-09-09 21:22:05.816098625 +0200 +diff -ruN libhpdf.orig/hpdfstre.c libhpdf/hpdfstre.c +--- libhpdf.orig/hpdfstre.c 2024-02-13 06:29:19.787627623 +0100 ++++ libhpdf/hpdfstre.c 2024-02-13 06:28:08.935229442 +0100 +@@ -20,6 +20,8 @@ + + #ifndef UNDER_CE + #include ++#else ++#include + #endif + #ifndef HPDF_UNUSED + #define HPDF_UNUSED(a) ((void)(a)) +diff -ruN libhpdf.orig/hpdfutil.h libhpdf/hpdfutil.h +--- libhpdf.orig/hpdfutil.h 2024-02-13 06:29:01.048028597 +0100 ++++ libhpdf/hpdfutil.h 2017-02-02 16:09:36.829987215 +0100 @@ -18,7 +18,7 @@ #ifndef _HPDF_UTILS_H #define _HPDF_UTILS_H @@ -64,9 +76,9 @@ diff -urN libhpdf.orig/hpdfutil.h libhpdf/hpdfutil.h #include "hpdftype.h" #ifdef __cplusplus -diff -urN libhpdf.orig/t4.h libhpdf/t4.h ---- libhpdf.orig/t4.h 2015-09-09 21:22:05.764098624 +0200 -+++ libhpdf/t4.h 2015-09-09 21:22:05.764098624 +0200 +diff -ruN libhpdf.orig/t4.h libhpdf/t4.h +--- libhpdf.orig/t4.h 2024-02-13 06:29:01.048028597 +0100 ++++ libhpdf/t4.h 2017-02-02 16:09:36.833987051 +0100 @@ -1,4 +1,4 @@ -/* $Id: t4.h,v 1.20 2007/11/10 18:40:44 drolon Exp $ */ +/* $Id$ */ diff --git a/include/hbapi.h b/include/hbapi.h index 63b45e69e6..34fcf421d8 100644 --- a/include/hbapi.h +++ b/include/hbapi.h @@ -1135,7 +1135,7 @@ typedef void * PHB_MACRO; extern HB_EXPORT void hb_macroGetValue( PHB_ITEM pItem, int iContext, int flags ); /* retrieve results of a macro expansion */ extern void hb_macroSetValue( PHB_ITEM pItem, int flags ); /* assign a value to a macro-expression item */ extern void hb_macroPushReference( PHB_ITEM pItem ); /* push reference to given expression */ -extern void hb_macroTextValue( PHB_ITEM pItem ); /* macro text substitution */ +extern HB_EXPORT void hb_macroTextValue( PHB_ITEM pItem ); /* macro text substitution */ extern void hb_macroPushSymbol( PHB_ITEM pItem ); /* handle a macro function calls, e.g. var := ¯o() */ extern void hb_macroRun( PHB_MACRO pMacro ); /* executes pcode compiled by macro compiler */ extern PHB_MACRO hb_macroCompile( const char * szString ); /* compile a string and return a pcode buffer */ diff --git a/include/hbvm.h b/include/hbvm.h index e71003a33c..f5c6ccae55 100644 --- a/include/hbvm.h +++ b/include/hbvm.h @@ -152,6 +152,7 @@ extern HB_EXPORT PHB_ITEM hb_vmEvalBlock( PHB_ITEM pBlockItem ); /* executes pas extern HB_EXPORT PHB_ITEM hb_vmEvalBlockV( PHB_ITEM pBlockItem, HB_ULONG ulArgCount, ... ); extern HB_EXPORT PHB_ITEM hb_vmEvalBlockOrMacro( PHB_ITEM pItem ); /* executes codeblock or macro pointed by given item */ extern HB_EXPORT void hb_vmDestroyBlockOrMacro( PHB_ITEM pItem ); /* destroy codeblock or macro in given item */ +extern HB_EXPORT PHB_ITEM hb_vmCompileMacro( const char * szExpr, PHB_ITEM pDest ); /* compile given expression and return macro pointer item or NULL */ /* Push */ extern HB_EXPORT void hb_vmPush( PHB_ITEM pItem ); /* pushes a generic item onto the stack */ diff --git a/src/3rd/jpeg/Makefile b/src/3rd/jpeg/Makefile index 8b83140bf2..8acac398ce 100644 --- a/src/3rd/jpeg/Makefile +++ b/src/3rd/jpeg/Makefile @@ -85,7 +85,7 @@ ifeq ($(filter $(HB_COMPILER),<>),) include $(TOP)$(ROOT)config/detfun.mk ifneq ($(HB_HAS_JPEG_LOCAL),) - ifeq ($(HB_COMPILER),poccarm) + ifeq ($(HB_PLATFORM),wce) HB_CFLAGS += -DNO_GETENV endif diff --git a/src/common/hbver.c b/src/common/hbver.c index 9f5bc71172..ccffb6d326 100644 --- a/src/common/hbver.c +++ b/src/common/hbver.c @@ -1338,9 +1338,9 @@ char * hb_verHarbour( void ) HB_TRACE( HB_TR_DEBUG, ( "hb_verHarbour()" ) ); pszVersion = ( char * ) hb_xgrab( 80 ); - hb_snprintf( pszVersion, 80, "Harbour %d.%d.%d%s (r%" PFHL "u)", + hb_snprintf( pszVersion, 80, "Harbour %d.%d.%d%s (r%lu)", HB_VER_MAJOR, HB_VER_MINOR, HB_VER_RELEASE, HB_VER_STATUS, - hb_verRevision() ); + ( HB_ULONG ) hb_verRevision() ); return pszVersion; } diff --git a/src/harbour.def b/src/harbour.def index 409360ea8e..d24918225a 100644 --- a/src/harbour.def +++ b/src/harbour.def @@ -909,6 +909,7 @@ HB_FUN_HB_MUTEXSUBSCRIBENOW HB_FUN_HB_MUTEXUNLOCK HB_FUN_HB_MVRESTORE HB_FUN_HB_MVSAVE +HB_FUN_HB_NTOC HB_FUN_HB_NTOCOLOR HB_FUN_HB_NTOHOUR HB_FUN_HB_NTOMIN @@ -2387,6 +2388,7 @@ hb_dbg_vmVarGCount hb_dbg_vmVarGGet hb_dbg_vmVarLGet hb_dbg_vmVarSGet +hb_dblToStr hb_dynCall hb_dynsymAreaHandle hb_dynsymEval @@ -2497,6 +2499,7 @@ hb_fileLockTest hb_fileMove hb_filePOpen hb_fileParam +hb_fileParamGet hb_fileRead hb_fileReadAt hb_fileRegisterFull @@ -2521,6 +2524,7 @@ hb_fsBaseDirBuff hb_fsChDir hb_fsChDrv hb_fsClose +hb_fsCloseRaw hb_fsCommit hb_fsCopy hb_fsCreate @@ -2692,6 +2696,7 @@ hb_gtSetKeyCP hb_gtSetMode hb_gtSetPos hb_gtSetSnowFlag +hb_gtSleep hb_gtStartupInit hb_gtSuspend hb_gtSwap @@ -2703,7 +2708,12 @@ hb_gtWriteAt hb_gtWriteCon hb_gt_Base hb_gt_BaseFree +hb_gt_BaseLock +hb_gt_BaseUnlock hb_gt_ItemBase +hb_gt_dos_keyCodeTranslate +hb_gt_getClipboard +hb_gt_setClipboard hb_gt_winapi_getClipboard hb_gt_winapi_getKbdState hb_gt_winapi_setClipboard @@ -2799,9 +2809,11 @@ hb_itemDo hb_itemDoC hb_itemEqual hb_itemFreeC +hb_itemFreeCRef hb_itemGetC hb_itemGetCLen hb_itemGetCPtr +hb_itemGetCRef hb_itemGetDL hb_itemGetDS hb_itemGetL @@ -2927,6 +2939,7 @@ hb_lppSendLen hb_lppSetLimit hb_macroGetType hb_macroGetValue +hb_macroTextValue hb_mathGetErrMode hb_mathGetError hb_mathGetHandler @@ -2981,10 +2994,12 @@ hb_osEncodeCP hb_osStrDecode hb_osStrDecode2 hb_osStrEncode +hb_osStrEncode2 hb_osStrEncodeN hb_osStrU16Decode hb_osStrU16Decode2 hb_osStrU16Encode +hb_osStrU16Encode2 hb_osStrU16EncodeN hb_osUseCP hb_param @@ -3540,6 +3555,7 @@ hb_vmAtExit hb_vmAtInit hb_vmAtQuit hb_vmCDP +hb_vmCompileMacro hb_vmDestroyBlockOrMacro hb_vmDo hb_vmEvalBlock diff --git a/src/rdd/dbf1.c b/src/rdd/dbf1.c index 78d79878ce..0c2d3dd0a8 100644 --- a/src/rdd/dbf1.c +++ b/src/rdd/dbf1.c @@ -277,7 +277,7 @@ static int hb_dbfNextValueStep( DBFAREAP pArea, HB_USHORT uiField, int iStep ) return iPrevStep; } -void hb_dbfTransCheckCounters( LPDBTRANSINFO lpdbTransInfo ) +static void hb_dbfTransCheckCounters( LPDBTRANSINFO lpdbTransInfo ) { HB_BOOL fCopyCtr = HB_TRUE; HB_USHORT uiCount, uiDest; diff --git a/src/rdd/hsx/hsx.c b/src/rdd/hsx/hsx.c index d92148c43c..c94201c790 100644 --- a/src/rdd/hsx/hsx.c +++ b/src/rdd/hsx/hsx.c @@ -579,10 +579,10 @@ static int hb_hsxCompile( const char * szExpr, PHB_ITEM * pExpr ) } else { - PHB_MACRO pMacro = hb_macroCompile( szExpr ); - if( ! pMacro ) + PHB_ITEM pItem = hb_vmCompileMacro( szExpr, NULL ); + if( ! pItem ) return HSX_BADPARMS; - *pExpr = hb_itemPutPtr( NULL, ( void * ) pMacro ); + *pExpr = pItem; } return HSX_SUCCESS; } diff --git a/src/rdd/workarea.c b/src/rdd/workarea.c index 7fe58629ab..4bc65fc4f7 100644 --- a/src/rdd/workarea.c +++ b/src/rdd/workarea.c @@ -1774,20 +1774,14 @@ static HB_ERRCODE hb_waSetLocate( AREAP pArea, LPDBSCOPEINFO pScopeInfo ) /* * Compile a character expression. */ -static HB_ERRCODE hb_waCompile( AREAP pArea, const char * pExpr ) +static HB_ERRCODE hb_waCompile( AREAP pArea, const char * szExpr ) { - PHB_MACRO pMacro; + HB_TRACE( HB_TR_DEBUG, ( "hb_waCompile(%p, %p)", ( void * ) pArea, ( const void * ) szExpr ) ); - HB_TRACE( HB_TR_DEBUG, ( "hb_waCompile(%p, %p)", ( void * ) pArea, ( const void * ) pExpr ) ); + if( ! pArea->valResult ) + pArea->valResult = hb_itemNew( NULL ); - pMacro = hb_macroCompile( pExpr ); - if( pMacro ) - { - pArea->valResult = hb_itemPutPtr( pArea->valResult, ( void * ) pMacro ); - return HB_SUCCESS; - } - else - return HB_FAILURE; + return hb_vmCompileMacro( szExpr, pArea->valResult ) ? HB_SUCCESS : HB_FAILURE; } /* diff --git a/src/vm/extrap.c b/src/vm/extrap.c index 55d4c807a8..b951fa4fe0 100644 --- a/src/vm/extrap.c +++ b/src/vm/extrap.c @@ -84,7 +84,7 @@ static HB_BYTE * s_signal_stack[ SIGSTKSZ ]; #endif -#if defined( HB_OS_WIN ) && ! defined( __TINYC__ ) +#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE ) && ! defined( __TINYC__ ) static LONG WINAPI hb_winExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInfo ) { diff --git a/src/vm/hvm.c b/src/vm/hvm.c index 7f41c85644..143ab47f43 100644 --- a/src/vm/hvm.c +++ b/src/vm/hvm.c @@ -6315,6 +6315,8 @@ PHB_ITEM hb_vmEvalBlockOrMacro( PHB_ITEM pItem ) */ void hb_vmDestroyBlockOrMacro( PHB_ITEM pItem ) { + HB_TRACE( HB_TR_DEBUG, ( "hb_vmDestroyBlockOrMacro(%p)", ( void * ) pItem ) ); + if( HB_IS_POINTER( pItem ) ) { PHB_MACRO pMacro = ( PHB_MACRO ) hb_itemGetPtr( pItem ); @@ -6324,6 +6326,24 @@ void hb_vmDestroyBlockOrMacro( PHB_ITEM pItem ) hb_itemRelease( pItem ); } +/* + * compile given expression and return macro pointer item or NULL + */ +PHB_ITEM hb_vmCompileMacro( const char * szExpr, PHB_ITEM pDest ) +{ + HB_TRACE( HB_TR_DEBUG, ( "hb_vmCompileMacro(%s,%p)", szExpr, pDest ) ); + + if( szExpr ) + { + PHB_MACRO pMacro = hb_macroCompile( szExpr ); + if( pMacro ) + return hb_itemPutPtr( pDest, ( void * ) pMacro ); + } + if( pDest ) + hb_itemClear( pDest ); + return NULL; +} + void hb_vmFunction( HB_USHORT uiParams ) diff --git a/src/vm/runner.c b/src/vm/runner.c index dff3b51a47..c9905f6ea3 100644 --- a/src/vm/runner.c +++ b/src/vm/runner.c @@ -473,10 +473,13 @@ static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE nBodySize, HB_USHOR pDynSym = hb_dynsymFind( pSymRead[ ul ].szName ); - if( pDynSym ) + if( pDynSym && ( HB_VM_ISFUNC( pDynSym->pSymbol ) || + ( pDynSym->pSymbol->scope.value & HB_FS_DEFERRED ) != 0 ) ) { pSymRead[ ul ].value.pFunPtr = pDynSym->pSymbol->value.pFunPtr; - if( pDynSym->pSymbol->scope.value & HB_FS_PCODEFUNC ) + if( pDynSym->pSymbol->scope.value & HB_FS_DEFERRED ) + pSymRead[ ul ].scope.value |= HB_FS_DEFERRED; + else if( pDynSym->pSymbol->scope.value & HB_FS_PCODEFUNC ) { pSymRead[ ul ].scope.value |= HB_FS_PCODEFUNC; } @@ -492,7 +495,7 @@ static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE nBodySize, HB_USHOR hb_strncpy( szName, pSymRead[ ul ].szName, sizeof( szName ) - 1 ); hb_xfree( pSymRead ); hb_hrbUnLoad( pHrbBody ); - hb_errRT_BASE( EG_ARG, 6101, "Unknown or unregistered symbol", szName, 0 ); + hb_errRT_BASE( EG_ARG, 6101, "Unknown or unregistered function symbol", szName, 0 ); return NULL; } }