GLBasic forum

Main forum => Bug Reports => Topic started by: bigsofty on 2010-May-19

Title: Code Folding Error
Post by: bigsofty on 2010-May-19
When I fold certain functions I get the following error when I compile....

C:\DOCUME~1\Dad\LOCALS~1\Temp\glbasic\gpc_temp1.cpp:212: error: stray '\8' in program

Unfolding, then compiling, removes the error?
Title: Re: Code Folding Error
Post by: MrTAToad on 2010-May-20
Yes, you need to unfold all functions before compiling...
Title: Re: Code Folding Error
Post by: Kitty Hello on 2010-May-20
paste the function. Works for me when quickly testing.
Title: Re: Code Folding Error
Post by: bigsofty on 2010-May-20
I would have to post the whole program Gernot as the function uses custom types extensively.

There are no erroneous control characters etc, I checked the file with a hex editor.

This code...

Code: (glbasic) [Select]
tot% = tot% + rand% in GLBasic

...creates this code in "gpc_temp1.cpp"...

         tot = tot + rand;

EDIT: (I removed the code block as the CHR( 8 ) character shows without it within my browser)

There is a CHR( 8 ) added before the ";"?

This ONLY happens when this particular function is folded?


Title: Re: Code Folding Error
Post by: Kitty Hello on 2010-May-31
attach the file, please.
Title: Re: Code Folding Error
Post by: bigsofty on 2010-May-31
I just stopped using code folding for the present.

I can't post the whole program Gernot, its part of a commercial product so I will cut out the function and its types, then mail it to you Gernot.

Cheers,


Ian
Title: Re: Code Folding Error
Post by: Slydog on 2010-Jun-01
I notice when you fold code, it replaces all [CR][LF] pairs with [BS][FF]  (ascii 08 & 12).
Looks like a bug in the 'folding' / 'unfolding' code and is two characters off somewhere.
(does the line end with [CR][LF] when NOT folded?  may be saved in a different format somehow?)

Does the compile error happen if you have a comment at the end?  (ie. push the problem to the right more)
Is it the same error if you remove the % from rand?  (it may insert the [BS] character in another position then).

And why not use 'INC tot%, rand%'.  (not as pretty, I guess, but I assume it converts to 'tot += rand' in c++.)
(just nit-picking, ignore this!! ha)
Title: Re: Code Folding Error
Post by: matchy on 2010-Jun-02
Code folding issue discussed here: http://www.glbasic.com/forum/index.php?topic=4499.0 (http://www.glbasic.com/forum/index.php?topic=4499.0)
Title: Re: Code Folding Error
Post by: bigsofty on 2010-Jun-02
Gernot I PM'ed you the code regard this error.

Cheers,


Ian
Title: Re: Code Folding Error
Post by: Kitty Hello on 2010-Jun-02
OK, fixed next update. Thanks.