Jump to content
IGNORED

Any way to put REM in DATA?


Random Terrain

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

 

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...