Remark Blocks

Previous topic - Next topic

bigsofty

Can we change the way that remaking a block applies its remark can be very frustrating sometimes...

Code (glbasic) Select
GETSCREENSIZE screenwidth,screenheight
sx=screenwidth*.2;sy=screenheight*.5   //start point
//ex=screenwidth*.8;ey=screenheight*.5   //end point
bx=screenwidth*.5;by=screenheight*.5   //curve towards point
//animTime=5000   //animation time of 2 seconds
Block remarked, becomes...

Code (glbasic) Select
//GETSCREENSIZE screenwidth,screenheight
//sx=screenwidth*.2;sy=screenheight*.5   //start point
ex=screenwidth*.8;ey=screenheight*.5   //end point
//bx=screenwidth*.5;by=screenheight*.5   //curve towards point
animTime=5000   //animation time of 2 seconds
What I wanted was...

Code (glbasic) Select
//GETSCREENSIZE screenwidth,screenheight
////sx=screenwidth*.2;sy=screenheight*.5   //start point
//ex=screenwidth*.8;ey=screenheight*.5   //end point
////bx=screenwidth*.5;by=screenheight*.5   //curve towards point
//animTime=5000   //animation time of 2 seconds
and if I reapply block remark...

Code (glbasic) Select
GETSCREENSIZE screenwidth,screenheight
sx=screenwidth*.2;sy=screenheight*.5   //start point
//ex=screenwidth*.8;ey=screenheight*.5   //end point
bx=screenwidth*.5;by=screenheight*.5   //curve towards point
//animTime=5000   //animation time of 2 seconds
Now this allows for large blocks of code to be remarked out, without having to worry if the code has already gotten remarks, 'unremarked' and then causing compilation errors...

How is this done?

This is how it could be applied in pseudo code...

IF first_two_block_chars$ = '//' THEN
BEGIN
   REPEAT
     READBLOCKLINE(Current_line$)
     IF First_Two_Chars_Of_Current_Line$ = '//' THEN
        DELETE First_Two_Chars_Of_Current_Line$
     WRITEBLOCKLINE(Current_line$)
   UNTIL End_Of_Block
END
ELSE
BEGIN
   REPEAT
     READBLOCKLINE(Current_line$)
        Current_line$ =  '//' + Current_Line$
     WRITEBLOCKLINE(Current_line$)
   UNTIL End_Of_Block
END

This is how most languages apply block code remarking. It allows large blocks of code to be remarked in and out without having to worry if the block already contains remarks.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Moru

Temporary solution: I usually put an IF block around larger codeblocks so I don't have to worry about it.

Code (glbasic) Select
IF 1 = 0
     Code you want commented out
ENDIF

Kitty Hello

That's what I do, too :D
Anyway - It's a "unexpected feature". I'll fix it.

bigsofty

Quote from: MoruTemporary solution: I usually put an IF block around larger codeblocks so I don't have to worry about it.

Code (glbasic) Select
IF 1 = 0
     Code you want commented out
ENDIF
No use for complete Functions I'm afraid. Funny enough commenting out large blocks of code has become a integral part of my debugging... a bit like a doctor removing body parts till he finds the infected limb! :P
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

Quote from: bigsoftya bit like a doctor removing body parts till he finds the infected limb! :P
...I'd start with the brain.

Moru

For commenting out whole functions you just rename them and create a new dummy one or put the if statemen inside the whole function :-)

PeeJay

or just comment out the call to the function .....
www.peejays-remakes.co.uk
For games, remakes, and GL Basic Tutorials
Artificial Intelligence is no match for Natural Stupidity

bigsofty

Quote from: GernotFrisch
Quote from: bigsoftya bit like a doctor removing body parts till he finds the infected limb! :P
...I'd start with the brain.
What brain? :D
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)