This forum is for eXpress++ general support.
c-tec
Posts: 379 Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:
#1
Post
by c-tec » Mon Jan 16, 2012 2:22 am
Hello Roger,
how to use dc_interpet() correct ? It seems I am missing something in my code, for next loops are causing an error for example. Have I to call dc_translate() for using include files ? Do I have to define some standard include files like dcdialog.ch in my source ?
Best
Rudolf
Code: Select all
function itest()
local cSource := memoread("test.prg")
local aTmp := dc_progarray(cSource)
dcqdebug dc_interpret(aTmp)
return .t.
test.prg:
for x := 1 to 10
dcqdebug x
next x
c-tec
Posts: 379 Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:
#2
Post
by c-tec » Mon Jan 16, 2012 8:47 am
Hello Roger,
it seems that dc_translate() also does not work correct in my program, in your demo it translates my code correct.
regards
Rudolf
Code: Select all
function test()
******************************************************************
local cSource := memoread("test.prg")
cSource := conv2int(cSource)
dcqdebug dc_interpret(cSource)
*aTmp := dc_progarray(cSource)
*dcqdebug dc_interpret(aTmp)
return .t.
FUNCTION conv2int(cStatements)
******************************************************************
LOCAL nFunction, aTokens, j, cFunctions := '', aFunctions
altd()
aFunctions := DC_Translate(cStatements)
FOR nFunction := 1 TO Len(aFunctions)
aTokens := DC_TokenArray(aFunctions[nFunction], CRLF)
FOR j := 1 TO Len(aTokens)
IF !Empty(aTokens[j]) .AND. Left(aTokens[j],1) # '#'
cFunctions += aTokens[j] + CRLF
ENDIF
NEXT j
NEXT nFunction
RETURN cFunctions
c-tec
Posts: 379 Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:
#3
Post
by c-tec » Tue Jan 17, 2012 6:01 am
Hello,
also the translated code does not work, raise an error for line 3
regards
Rudolf
Code: Select all
FORNEXT x 1 10
DC_DotQOUT( {"test"} )
NEXT
DC_DotQOUT( {B_DOUBLE,B_SINGLE,HANDLE} )
rdonnay
Site Admin
Posts: 4813 Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:
#4
Post
by rdonnay » Tue Jan 17, 2012 9:22 am
Rudolf -
The interpreter uses the macro compiler, so it can only do what the macro compiler can do.
You cannot create a function in interpreted code.
Roger
The eXpress train is coming - and it has more cars.