Page 1 of 1

dc_progarray()

Posted: Tue Aug 16, 2011 1:33 am
by c-tec
Hello Roger,
have a strange problem. The attached source Testcode 1 does not work when calling the first time I start the program:

Code: Select all

aTmp := dc_progarray(cSource)
if !empty(aTmp)
     dc_interpret(aTmp,aVar)
endif
When I remove some parts like in Testcode 2 it works. After this changes also the first code does work if I interpret the original code. So both versions are working without problems. With dc_interpret(cSource,aVar) it generally does not work. When I restart the program, I get again the error in dc_progarray() "Program Stucture Error at Line: 11".
Any idea what's going wrong ?
Regards
Rudolf


Testsource 1

Code: Select all

cTest := "test"
for x :=1 to 10
	cTest += str(x)
next x
wmeld(cTest)
if len(cTest) # 0
	wmeld("ok")
else
	wmeld("not ok")
endif
Testcode2

Code: Select all

cTest := "test"
//for x :=1 to 10
//	cTest += str(x)
//next x
wmeld(cTest)
//if len(cTest) # 0
//	wmeld("ok")
//else
//	wmeld("not ok")
//endif

Re: dc_progarray()

Posted: Tue Aug 16, 2011 10:07 am
by c-tec
Hello,
forgot to mention: the same code works when I make a normal function from it
regards
Rudolf

Re: dc_progarray()

Posted: Tue Aug 16, 2011 11:51 am
by rdonnay
Try this:

Code: Select all

for x := 1 to 10
Instead of this:

Code: Select all

for x :=1 to 10

Re: dc_progarray()

Posted: Tue Aug 16, 2011 10:29 pm
by c-tec
Hello Roger,
does also not work, but after playing around I found that when I remove all if else endif, the code works. It seems that there is a problem with if endif or do case structures.
regards
Rudolf

Re: dc_progarray()

Posted: Tue Aug 16, 2011 10:49 pm
by c-tec
Hello Roger,
found it ! It is not allowed to use endif, with end it works.
Regards
Rudolf