dc_interpret()

This forum is for eXpress++ general support.
Post Reply
Message
Author
c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

dc_interpret()

#1 Post by c-tec »

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


Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: dc_interpret()

#2 Post by c-tec »

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

Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: dc_interpret()

#3 Post by c-tec »

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} )

Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dc_interpret()

#4 Post by rdonnay »

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.

Post Reply