Adie
13-05-2007, 14:01
Hi
I am porting my systems from xBase++ to C++ (BDS2006) but urgently require a repacement for the Clipper code blocks.
I need to process dynamic IF statements in a loop. (dynamically intepet the IF and execute the THEN
The current xBase++ code look like this
DO WHILE oDlg:lMixing .OR. oDlg:lBin2Run
FOR nP = 1 TO LEN( oDlg:aProcess )
IF EVAL( oDlg:aProcess[nP,1] )
EVAL( oDlg:aProcess[nP,,2] )
ENDIF
NEXT
Update_Screen( oDlg ) // ** Update Screen **
Update_Ports( oDlg ) // ** Update Valves **
ENDDO
***** end code ****
oDlg:aProcess[nP,1] is an array that were created during runtime with the list of 'criteria' from a data table.
Sample: "AgrA < AgrT and PSEQ() = 1"
oDlg:aProcess[nP,2] is the array of 'actions' to be executed.
"POPEN( oAGR ), PSEQ('N')" // comma seperated list of functions
In short I need to INTERPET the two EVAL functions.
I assume this would be simple if thinBasic could be loaded as a DLL. The interpeter will then parse the string and 'execute' the code.
The thinBasic script would be generated from the data table on startup to save processing time.
The c++ code would then look like this
while(true)
{
for(n = 0....)
{
thinEVAL( n );
}
Update_Screen( oDlg );
Sleep(50);
}
The thinBasic side can noe intrepet the script line based on the parameter.
Maybe the whole for loop could be the thinBasic script. ???
So after the long description I would like to know the following.
1. Can thinBasic be compiled as a DLL to be called from another App.
2. What will the overhead (cpu cycles) be on the system.
For the curious ones, I automate machines with a PC instead of PLC.
Regards
Adie
I am porting my systems from xBase++ to C++ (BDS2006) but urgently require a repacement for the Clipper code blocks.
I need to process dynamic IF statements in a loop. (dynamically intepet the IF and execute the THEN
The current xBase++ code look like this
DO WHILE oDlg:lMixing .OR. oDlg:lBin2Run
FOR nP = 1 TO LEN( oDlg:aProcess )
IF EVAL( oDlg:aProcess[nP,1] )
EVAL( oDlg:aProcess[nP,,2] )
ENDIF
NEXT
Update_Screen( oDlg ) // ** Update Screen **
Update_Ports( oDlg ) // ** Update Valves **
ENDDO
***** end code ****
oDlg:aProcess[nP,1] is an array that were created during runtime with the list of 'criteria' from a data table.
Sample: "AgrA < AgrT and PSEQ() = 1"
oDlg:aProcess[nP,2] is the array of 'actions' to be executed.
"POPEN( oAGR ), PSEQ('N')" // comma seperated list of functions
In short I need to INTERPET the two EVAL functions.
I assume this would be simple if thinBasic could be loaded as a DLL. The interpeter will then parse the string and 'execute' the code.
The thinBasic script would be generated from the data table on startup to save processing time.
The c++ code would then look like this
while(true)
{
for(n = 0....)
{
thinEVAL( n );
}
Update_Screen( oDlg );
Sleep(50);
}
The thinBasic side can noe intrepet the script line based on the parameter.
Maybe the whole for loop could be the thinBasic script. ???
So after the long description I would like to know the following.
1. Can thinBasic be compiled as a DLL to be called from another App.
2. What will the overhead (cpu cycles) be on the system.
For the curious ones, I automate machines with a PC instead of PLC.
Regards
Adie