Skip to content

Commit

Permalink
2024-02-16 18:23 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
Browse files Browse the repository at this point in the history
  * 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 <windows.h> 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 <funcName>

  * src/rdd/dbf1.c
    * declare internal function hb_dbfTransCheckCounters() as static one

  * src/harbour.def
    ! added missing exported Harbour functions
  • Loading branch information
druzus committed Feb 16, 2024
1 parent 936bef2 commit 050666d
Show file tree
Hide file tree
Showing 16 changed files with 166 additions and 52 deletions.
55 changes: 55 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <windows.h> 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 <funcName>

* 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
Expand Down
35 changes: 23 additions & 12 deletions contrib/hbexpat/3rd/expat/expat.diff
Original file line number Diff line number Diff line change
@@ -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 <windows.h>
+#if defined(UNICODE) && !defined(_UNICODE)
+#define _UNICODE
+#endif
#include <windows.h>
+#include "winconfi.h"
#include <tchar.h>


@@ -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) */
Expand All @@ -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 @@
-/*
- __ __ _
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions contrib/hbexpat/3rd/expat/loadlibr.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#if defined(UNICODE) && !defined(_UNICODE)
#define _UNICODE
#endif
#include <windows.h>
#include "winconfi.h"
#include <tchar.h>


Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions contrib/hbhpdf/3rd/libhpdf/hpdfstre.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#ifndef UNDER_CE
#include <errno.h>
#else
#include <windows.h>
#endif
#ifndef HPDF_UNUSED
#define HPDF_UNUSED(a) ((void)(a))
Expand Down
42 changes: 27 additions & 15 deletions contrib/hbhpdf/3rd/libhpdf/libhpdf.diff
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand All @@ -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);

Expand All @@ -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 <errno.h>
+#else
+#include <windows.h>
#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
Expand All @@ -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$ */
Expand Down
2 changes: 1 addition & 1 deletion include/hbapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 := &macro() */
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 */
Expand Down
1 change: 1 addition & 0 deletions include/hbvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion src/3rd/jpeg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/common/hbver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
16 changes: 16 additions & 0 deletions src/harbour.def
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2387,6 +2388,7 @@ hb_dbg_vmVarGCount
hb_dbg_vmVarGGet
hb_dbg_vmVarLGet
hb_dbg_vmVarSGet
hb_dblToStr
hb_dynCall
hb_dynsymAreaHandle
hb_dynsymEval
Expand Down Expand Up @@ -2497,6 +2499,7 @@ hb_fileLockTest
hb_fileMove
hb_filePOpen
hb_fileParam
hb_fileParamGet
hb_fileRead
hb_fileReadAt
hb_fileRegisterFull
Expand All @@ -2521,6 +2524,7 @@ hb_fsBaseDirBuff
hb_fsChDir
hb_fsChDrv
hb_fsClose
hb_fsCloseRaw
hb_fsCommit
hb_fsCopy
hb_fsCreate
Expand Down Expand Up @@ -2692,6 +2696,7 @@ hb_gtSetKeyCP
hb_gtSetMode
hb_gtSetPos
hb_gtSetSnowFlag
hb_gtSleep
hb_gtStartupInit
hb_gtSuspend
hb_gtSwap
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2927,6 +2939,7 @@ hb_lppSendLen
hb_lppSetLimit
hb_macroGetType
hb_macroGetValue
hb_macroTextValue
hb_mathGetErrMode
hb_mathGetError
hb_mathGetHandler
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -3540,6 +3555,7 @@ hb_vmAtExit
hb_vmAtInit
hb_vmAtQuit
hb_vmCDP
hb_vmCompileMacro
hb_vmDestroyBlockOrMacro
hb_vmDo
hb_vmEvalBlock
Expand Down
2 changes: 1 addition & 1 deletion src/rdd/dbf1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/rdd/hsx/hsx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit 050666d

Please sign in to comment.