Quote:
Originally posted by Joe Johnson
As to nesting if-elseif-else structures, please try to make this work. There are many situations where this is needed and it would be a bother to be able to us the new structures in one place but not in another. Isn't this a sort of natural recursion application?
|
You're right. This is a natural for recursion -- and that's what I had in mind. I think I should be able to do it without too much trouble, but you never know for sure until you get in there an get your fingernails dirty.
Quote:
To me, one of the biggest issues is generating goto labels that are easy enough to follow that folks that edit the resulting code directly see something that is editible.
How about this format $IF $IFLABEL (optional) $ELSEIF $ELSE $ENDIF
My thoughts would be that if you provided a label, then the label would be used as a basename for the various goto labels in Pbasic, if not, you get what you get.
|
I like your idea of allowing the user to provide labels, but $IFLABEL just doesn't have "sex appeal" for me.

How about if I just take a look at the next non-blank, non-comment line, and if it's a label, I will use it instead of generating a label? Something like:
Code:
'{$IF condition 1}
Label1:
statement block 1
'{$ELSEIF condition 2}
Label2:
statement block 2
...
'{$ELSE}
LabelN:
statement block n
'{$ENDIF}
EndIfLabel:
Quote:
|
As to what I mean by a common subroutine, I don't mean jumping to a new program slot and jumping back -- the way Pbasic handles jumps would add a lot of bother and overhead to any such systems. What I do mean is something like the header file, where I could define a subroutine one time and the pre-processor would add the code to the appropriate files for the approriate programming slots.
|
It sounds like the include file concept satisfies this requirement. Nicht Wahr?
Quote:
|
An input subroutine is a good example. I often end up calling the input subroutine from at least 2 programming slots and sometimes from 3. If I change the variables that the master CPU sends me (perhaps I want delta_t rather that packet_num), I need to change the subrountine in all 3 places or else I get the dreaded "PBasic Error LED of Death" to light up on the Operator Interface and I am dead in the water.
|

When you say "If I change the variables that the master CPU sends me", you don't mean that you have figured out a way to read different data at different times during a match, do you? That might be a nice feature, but the only way I can envision it being done is with a robot controller restart.
Quote:
|
Finally, what about text editing? How do you make your master file that the pre-processor processes? Has anybody made the leap to CodeWright? It is a very good program for C coding and other serious coding projects. One nice thing about CodeWrightt is that it knows the various keywords of the language you are using. It can be set up to show Constants in one color, variables in another, keywords in yet anther, etc. Has anybody taught CodeWright the Pbasic language? Do tell.
|
I've never used CodeWright, but it does sound nifty.

I use the StampW editor. Typically, I start out everything at the preprocessor's GUI. I launch StampW from there. After I have finished editing, I exit back to the preprocessor GUI, and have it preprocess the project. After the project has been preprocessed, it gives you the option of launching the editor so you can download the program or continue editing it.