Solved! Is it possible to change the value of a constant during compile time?
Posted: Mon Jul 29, 2024 9:13 pm
For controlling the compile process by code I'm searching for a Methode to change the value of constants!
I'm able to create the constant once. But I can't change the value!
Do anyone of you know a trick how to change the value of a constant.
What I want to do with it is:
Switching On/Off a Macro what does a PointerException Check!
if have such Macros what are controlling the PointerExceptionCheck
It can be switched On/Off by PbFwCfg_Module_CheckPointerException or global Off by PbFwCfg_Global_CheckPointerException
The PbFwCfg_Module_CheckPointerException I have to change between #False and #True some times during the compile time.
I'm able to create the constant once. But I can't change the value!
Do anyone of you know a trick how to change the value of a constant.
Code: Select all
Macro macHashTag
#
EndMacro
Macro SetConstant(ConstantName, Value)
CompilerIf Defined(ConstantName, #PB_Constant)
; redefine constant with new value???
CompilerElse ; Constant not defined
macHashTag#ConstantName = Value
CompilerEndIf
EndMacro
SetConstant(MyConstant, 2)
SetConstant(MyConstant, 3)
Debug #MyConstantSwitching On/Off a Macro what does a PointerException Check!
if have such Macros what are controlling the PointerExceptionCheck
It can be switched On/Off by PbFwCfg_Module_CheckPointerException or global Off by PbFwCfg_Global_CheckPointerException
The PbFwCfg_Module_CheckPointerException I have to change between #False and #True some times during the compile time.
Code: Select all
Macro mac_CheckPointer2(ptr1, ptr2, ProcRet=0)
CompilerIf #PbFwCfg_Module_CheckPointerException And PbFw::#PbFwCfg_Global_CheckPointerException
If (Not ptr1) Or (Not ptr2)
DBG::Exception(#PB_Compiler_Module, #PB_Compiler_Procedure, DBG::#PbFw_DBG_Err_PointerIsNull)
ProcedureReturn ProcRet
EndIf
CompilerEndIf
EndMacro