Jump to content

Any way to put REM in DATA?


16 replies to this topic

#1 ONLINE  

    Visual batari Basic User

  • 20,537 posts
  • Joined: 23-April 01
  • Controlled Randomness

    Replay Value

    Nonlinear
  • Location:North Carolina (USA)

Posted Fri Oct 23, 2009 11:37 PM

Is there any way to put remarks next to data? Here's an example that doesn't work:

  sdata musicData=x
  0,0,0
  0,0,0
  1
  0,0,0 : rem test 01
  0,0,0 : rem test 02
  1
  0,0,0
  0,0,0
  1
  255,255,255
  255,255,255
  1
end


#2  

    )66]U('=I;B$*

  • 6,193 posts
  • Joined: 20-September 04
  • begin 644 contest

Posted Fri Oct 23, 2009 11:56 PM

View PostRandom Terrain, on Fri Oct 23, 2009 11:37 PM, said:

Is there any way to put remarks next to data? Here's an example that doesn't work:

  sdata musicData=x
  0,0,0
  0,0,0
  1
  0,0,0 : rem test 01
  0,0,0 : rem test 02
  1
  0,0,0
  0,0,0
  1
  255,255,255
  255,255,255
  1
end
A semicolon should work for comments in data statements, player definitions, and maybe a few other things.

#3 ONLINE  

    Visual batari Basic User

  • 20,537 posts
  • Joined: 23-April 01
  • Controlled Randomness

    Replay Value

    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Oct 24, 2009 12:02 AM

View Postbatari, on Fri Oct 23, 2009 11:56 PM, said:

A semicolon should work for comments in data statements, player definitions, and maybe a few other things.
Is there a special way you need to use it? I can't make it work so far.

#4  

    Quadrunner

  • 5,133 posts
  • Joined: 14-February 06
  • Sherlock made it to 15 before he left us.
  • Location:Idaho

Posted Sat Oct 24, 2009 12:25 AM

View Postbatari, on Fri Oct 23, 2009 11:56 PM, said:

View PostRandom Terrain, on Fri Oct 23, 2009 11:37 PM, said:

Is there any way to put remarks next to data? Here's an example that doesn't work:

  sdata musicData=x
  0,0,0
  0,0,0
  1
  0,0,0 : rem test 01
  0,0,0 : rem test 02
  1
  0,0,0
  0,0,0
  1
  255,255,255
  255,255,255
  1
end
A semicolon should work for comments in data statements, player definitions, and maybe a few other things.
Did you try changing those colons to semicolons? (I assume you don't need the colons in there.)

  sdata musicData=x
  0,0,0
  0,0,0
  1
  0,0,0 ; rem test 01
  0,0,0 ; rem test 02
  1
  0,0,0
  0,0,0
  1
  255,255,255
  255,255,255
  1
end


#5 ONLINE  

    Visual batari Basic User

  • 20,537 posts
  • Joined: 23-April 01
  • Controlled Randomness

    Replay Value

    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Oct 24, 2009 12:47 AM

View Postaccousticguitar, on Sat Oct 24, 2009 12:25 AM, said:

Did you try changing those colons to semicolons? (I assume you don't need the colons in there.)
Yeah, that's what I did, except with a working example program. If a semicolon works, there must be a certain way you're supposed to use it that I'm not doing.

#6  

    )66]U('=I;B$*

  • 6,193 posts
  • Joined: 20-September 04
  • begin 644 contest

Posted Sat Oct 24, 2009 1:07 AM

It works in data statements, but apparently not sdata statements. Strange.

#7  

    Stargunner

  • 1,919 posts
  • Joined: 23-May 09
  • bit shoveler
  • Location:Canada

Posted Sat Oct 24, 2009 1:09 AM

[edit] nevermind... I see that it was sdata causing problems, not data [/edit]

Edited by RevEng, Sat Oct 24, 2009 1:10 AM.


#8 ONLINE  

    Visual batari Basic User

  • 20,537 posts
  • Joined: 23-April 01
  • Controlled Randomness

    Replay Value

    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Oct 24, 2009 7:55 AM

View Postbatari, on Sat Oct 24, 2009 1:07 AM, said:

It works in data statements, but apparently not sdata statements. Strange.
We'll, that sucks. Thanks for checking. Maybe you can fix that in an upcoming version of bB. It would be very helpful to have the ability to add comments because I get lost.

Until then, I'll see if I can switch back to regular data.

I just tried regular data and I see that we only need a semicolon before our comments. There's no need for REM. That's good.

#9  

    )66]U('=I;B$*

  • 6,193 posts
  • Joined: 20-September 04
  • begin 644 contest

Posted Sat Oct 24, 2009 9:53 AM

View PostRandom Terrain, on Sat Oct 24, 2009 7:55 AM, said:

View Postbatari, on Sat Oct 24, 2009 1:07 AM, said:

It works in data statements, but apparently not sdata statements. Strange.
We'll, that sucks. Thanks for checking. Maybe you can fix that in an upcoming version of bB. It would be very helpful to have the ability to add comments because I get lost.

Until then, I'll see if I can switch back to regular data.

I just tried regular data and I see that we only need a semicolon before our comments. There's no need for REM. That's good.
I see the problem. I have fixed the code, so whenever we make another release, this will be a part of it.

#10 ONLINE  

    Visual batari Basic User

  • 20,537 posts
  • Joined: 23-April 01
  • Controlled Randomness

    Replay Value

    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Oct 24, 2009 10:53 AM

View Postbatari, on Sat Oct 24, 2009 9:53 AM, said:

I see the problem. I have fixed the code, so whenever we make another release, this will be a part of it.
Thanks!

#11  

    River Patroller

  • 4,411 posts
  • Joined: 07-August 05
  • Location:Georgia, USA

Posted Sat Oct 24, 2009 2:13 PM

View Postbatari, on Fri Oct 23, 2009 11:56 PM, said:

View PostRandom Terrain, on Fri Oct 23, 2009 11:37 PM, said:

Is there any way to put remarks next to data? Here's an example that doesn't work:

  sdata musicData=x
  0,0,0
  0,0,0
  1
  0,0,0 : rem test 01
  0,0,0 : rem test 02
  1
  0,0,0
  0,0,0
  1
  255,255,255
  255,255,255
  1
end
A semicolon should work for comments in data statements, player definitions, and maybe a few other things.
This works for dim and def statements, too. That's good to know, because I've occasionally wanted to add a comment after a dim statement.

Michael

#12 ONLINE  

    Visual batari Basic User

  • 20,537 posts
  • Joined: 23-April 01
  • Controlled Randomness

    Replay Value

    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Oct 24, 2009 2:30 PM

View PostSeaGtGruff, on Sat Oct 24, 2009 2:13 PM, said:

This works for dim and def statements, too. That's good to know, because I've occasionally wanted to add a comment after a dim statement.
Just tried it in a dim and there are weird scrunched graphics near the top and there is a funny beeping noise.

#13  

    River Patroller

  • 4,411 posts
  • Joined: 07-August 05
  • Location:Georgia, USA

Posted Sat Oct 24, 2009 2:56 PM

View PostRandom Terrain, on Sat Oct 24, 2009 2:30 PM, said:

View PostSeaGtGruff, on Sat Oct 24, 2009 2:13 PM, said:

This works for dim and def statements, too. That's good to know, because I've occasionally wanted to add a comment after a dim statement.
Just tried it in a dim and there are weird scrunched graphics near the top and there is a funny beeping noise.
D'oh! You're right, it doesn't work. Sorry for the incorrect announcement. I had just added the code and compiled to see if I got any compile errors. Since I didn't, I assumed it worked. When I just tried to run it, it obviously *doesn't* work. I just looked at the code, and it's weird-- the compiler appears to stop processing the bB source code as soon as it hits a semicolon in a dim or def statement. I'm guessing this might be something batari could fix in the compiler.

Michael

#14 ONLINE  

    Visual batari Basic User

  • 20,537 posts
  • Joined: 23-April 01
  • Controlled Randomness

    Replay Value

    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Oct 24, 2009 3:26 PM

View PostSeaGtGruff, on Sat Oct 24, 2009 2:56 PM, said:

I'm guessing this might be something batari could fix in the compiler.
It sure would be nice to have comments right next to DIMs.

#15  

    Stargunner

  • 1,919 posts
  • Joined: 23-May 09
  • bit shoveler
  • Location:Canada

Posted Sat Oct 24, 2009 3:32 PM

I hacked my own preprocess.lex to allow for C++ style // comments. They can go in after a statement (dim or otherwise) or on their own line. In the assembly source they get thrown into the next line, which I think is a not too bad a compromise.

I'd love to see this, and C style /* */ multi-line comments be integrated into the official bB. The later is *way* handy for disabling large blocks of code when you're tracking down a bug.

#16  

    )66]U('=I;B$*

  • 6,193 posts
  • Joined: 20-September 04
  • begin 644 contest

Posted Sat Oct 24, 2009 3:37 PM

View PostRevEng, on Sat Oct 24, 2009 3:32 PM, said:

I hacked my own preprocess.lex to allow for C++ style // comments. They can go in after a statement (dim or otherwise) or on their own line. In the assembly source they get thrown into the next line, which I think is a not too bad a compromise.

I'd love to see this, and C style /* */ multi-line comments be integrated into the official bB. The later is *way* handy for disabling large blocks of code when you're tracking down a bug.
I think the solution would be to allow for ; comments anywhere and /* */ multiline comments.

Just a warning that // is a valid bB operator - it is for division with remainder/modulus returned in temp1.

As for comments in dim or sdata, bB should stop at the preprocessor and return an error. Maybe VbB is not configured to capture preprocessor errors?

Edited by batari, Sat Oct 24, 2009 3:39 PM.


#17  

    Stargunner

  • 1,919 posts
  • Joined: 23-May 09
  • bit shoveler
  • Location:Canada

Posted Sat Oct 24, 2009 3:52 PM

Ah, didn't realize that // was used for the remainder. I guess I haven't had a need for it yet!

; and /* */ comments in bB would be perfect.

View Postbatari, on Sat Oct 24, 2009 3:37 PM, said:

As for comments in dim or sdata, bB should stop at the preprocessor and return an error. Maybe VbB is not configured to capture preprocessor errors?
I don't use vbB. I use cygwin and a makefile.

My hack of the preprocessor changes everything after the // into a REM on the next line...

[ \t^]*"//".* {printf("\n rem %s",yytext);}

Ugly, but it works for dim and pretty much everything else, but not within data/sdata statements.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users