Page 1 of 1
How to return the pre-processed version of a command?
Posted: Thu May 02, 2024 10:42 pm
by HGAutomator
Hi,
Programmatically, how do I get back the functional (i.e. pre-processed) version of a command?
I tried using e.g.
Code: Select all
p_p := __pp_Init()
Command_s := "SET MARGIN TO"
Preprocessed_s := __pp_Process( p_p, Command_s )
, which I thought should return
, but it just returns the original command.
Maybe I'm setting it up wrong.
Re: How to return the pre-processed version of a command?
Posted: Fri May 03, 2024 8:36 am
by gfilatov
HGAutomator wrote: ↑Thu May 02, 2024 10:42 pm
Hi,
Programmatically, how do I get back the functional (i.e. pre-processed) version of a command?
...
Maybe I'm setting it up wrong.
Hi,
Please add the following line on top of your test program:
REQUEST __pp_StdRules
You can look at the following working example:
Code: Select all
REQUEST HB_GT_WIN_DEFAULT
REQUEST __pp_StdRules
PROCEDURE Main()
LOCAL cString
LOCAL pPP := __pp_Init()
CLS
? "Testing Harbour run-time preprocessing"
?
? cString := "@ 10, 10 SAY 'Hello!'"
? __pp_Process( pPP, cString )
?
? cString := "? 'Hello mom'"
? __pp_Process( pPP, cString )
?
? cString := "SET MARGIN TO Something"
? __pp_Process( pPP, cString )
?
WAIT
RETURN
Program output is below:

- capture.png (6.87 KiB) Viewed 1620 times
Hope this is helpful.

Re: How to return the pre-processed version of a command?
Posted: Fri May 03, 2024 1:12 pm
by HGAutomator
That did the trick, thanks Grigory.
Re: How to return the pre-processed version of a command?
Posted: Fri May 03, 2024 8:57 pm
by HGAutomator
Everything is working perfectly, much appreciated.
Do you know how we would preprocess non-standard custom commands defined in other .ch files?