From 6e349a09e24562e7b0a83745f103090e92c976d2 Mon Sep 17 00:00:00 2001 From: Aleksander Czajczynski Date: Mon, 15 Dec 2025 11:10:32 +0100 Subject: [PATCH] 2025-12-15 11:10 UTC+0100 Aleksander Czajczynski (hb fki.pl) * src/vm/runner.c ! fix indentation ! previous change was not backwards compatible with hb_hrbLoad() stealing character argument, that would be otherwise passed to INIT PROCEDURE's in .hrb file * src/include/hb_hrb.ch + add HB_HRB_ARG_PRGNAME definition use to pass "virtual" script.prg filename as third parameter hb_hrbLoad( HB_HRB_ARG_PRGNAME + , cPCode, cFileName ) --- ChangeLog.txt | 13 +++++++++++++ include/hbhrb.ch | 5 +++++ src/vm/runner.c | 13 +++++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 7c5e7cb317..3ed92661e9 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,19 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2025-12-15 11:10 UTC+0100 Aleksander Czajczynski (hb fki.pl) + * src/vm/runner.c + ! fix indentation + + ! previous change was not backwards compatible with hb_hrbLoad() + stealing character argument, that would be otherwise passed + to INIT PROCEDURE's in .hrb file + + * src/include/hb_hrb.ch + + add HB_HRB_ARG_PRGNAME definition + use to pass "virtual" script.prg filename as third parameter + hb_hrbLoad( HB_HRB_ARG_PRGNAME + , cPCode, cFileName ) + 2025-12-14 00:00 UTC-0300 Lailton Fernando Mariano (lailton/at/paysoft.com.br) * src/vm/runner.c * HB_HRBLOAD: support optional filename for in-memory HRB load diff --git a/include/hbhrb.ch b/include/hbhrb.ch index 109a2db99d..c97f623396 100644 --- a/include/hbhrb.ch +++ b/include/hbhrb.ch @@ -71,6 +71,11 @@ with unresolved or cross function references */ +#define HB_HRB_ARG_PRGNAME 0x10 /* first argument of + is "virtual" script.prg filename + hb_hrbLoad( [ , ] + + [, ] ) */ #define HB_HRB_FUNC_PUBLIC 0x1 /* locally defined public functions */ #define HB_HRB_FUNC_STATIC 0x2 /* locally defined static functions */ diff --git a/src/vm/runner.c b/src/vm/runner.c index fcc06f7f15..dc6b75c02c 100644 --- a/src/vm/runner.c +++ b/src/vm/runner.c @@ -732,6 +732,10 @@ HB_FUNC( HB_HRBLOAD ) if( HB_ISNUM( 1 ) ) { usMode = ( HB_USHORT ) hb_parni( 1 ); + + if( usMode == HB_HRB_ARG_PRGNAME ) + usMode += HB_HRB_BIND_DEFAULT; + nParam++; } @@ -744,12 +748,13 @@ HB_FUNC( HB_HRBLOAD ) if( hb_hrbCheckSig( fileOrBody, nLen ) != 0 ) { - const char * szFileName = NULL; - if( hb_pcount() > nParam && HB_ISCHAR( nParam + 1 ) ) - { + const char * szFileName = NULL; + if( ( usMode & HB_HRB_ARG_PRGNAME ) && + hb_pcount() > nParam && HB_ISCHAR( nParam + 1 ) ) + { szFileName = hb_parc( nParam + 1 ); nParam++; - } + } pHrbBody = hb_hrbLoad( fileOrBody, nLen, usMode, szFileName ); } else