Go to Post Be careful what you wish for, you just might be asked to be on the committee! - Rosiebotboss [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Spotlight this post!  
Unread 01-02-2002, 03:18
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Thumbs up It's Here!

Finally, I have posted the preprocessor in the white papers area.

Sorry it took so long. My computer crashed just before the new year, and I had to reconstruct a lot of what I had done -- losing a lot of momentum in the process.

Here is the description I posted along with the program:

PRECIS:

A BASIC Stamp Preprocessor which simplifies coding for the BASIC Stamp 2 SX/E/P by providing an include file capability, and enabling structured programming constructs.



INTRODUCTION:
Here is the preprocessor I promised way back when. Sorry it took so long. (My computer crashed back at the end of December, and I had to reconstruct a lot of my work.)

I wrote this program to make programming our robot easier. It started when we first got the robot controller with the BASIC Stamp2 SX, and I needed to define the program data area identically in all the project programs. The original incarnation was limited to inserting an include file, and had a command line interface.

Last year, I added the graphical user interface, and this year, the structured programming capabilities.



INSTALLATION:

Copy the program to your hard disk. (That's all!)



USE:
Run the program. It brings up a Windows Explorer like interface. From there, navigate to where your robot programs are stored (or where you want them to be.)

Assuming you already have a program file, find the file you want to edit (or preprocess) in the file list, and press Ctrl-P to preprocess the file or Ctrl-E to launch the BASIC Stamp Editor to edit the file.

To create and edit a new file from the GUI, type the name of the file you want created into the file name edit box, and press Ctrl-E.

The GUI also allows you to rename (Ctrl-N) and delete (Ctrl-D) files.



DIRECTIVE SYNTAX:

All directives appear within curly braces.

All directives are case insensitive. (i.e. $Include and $INCLUDE are equivalent.)

The $Stamp directive is required by the Stamp editor to be within a comment (i.e. preceded by an apostrophe.) All other directives MAY be preceded by apostrophes, although it is not recommended because of the fact that if you forget to preprocess your program, StampW will accept it as syntactically correct, but the program will not run correctly when downloaded to your robot.

The left brace introducing a preprocessor directive must be the first non-blank character on the line (other than an optional label and the optional apostrophe), and the directive (along with its parameters, if any) must be alone inside the braces. Comments may follow the closing brace.



PREPROCESSOR DIRECTIVES:

{$Stamp processor, file2, file3, ..., file8}
Tells the BASIC Stamp editor the version of the Stamp processor the program will run on, and the program files that belong to the project. (The processor parameter is ignored by the preprocessor. Consult the StampW documentation for the $STAMP directive syntax.) The preprocessor uses the file list to determine which files to preprocess.


{$Include file_name}
Inserts file_name (after preprocessing it) into the program file being processed.


{$StampPPDate}
Causes the preprocessor to insert a DATA statement containing the date and time the file was preprocessed (StampPPDate DATA 24, "Mon Mar 19 21:16:40 2001")
When your program starts up, you can display the date the project was preprocessed with the following commands:
stringLength VAR byte
theIndex VAR byte
TheChar VAR byte
debug CLS 'Clear the debug screen
'Print out the source file timestamp:
read StampPPDate, stringLength
for theIndex=1 to stringLength
read StampPPDate+theIndex, theChar
debug theChar
next
debug CR


{$StampProjectPrefix prefix_string}
Specifies to the preprocessor the output file name prefix. By default, the preprocessor prefixes the output file names with the date in the format yyyy.mm.dd. Output files may be directed to another directory by including a directory path in the prefix string.


{$If if_condition}
if_block
{$ElseIf else_condition}
elseif_block
{$Else}
else_block
{$EndIf}
Causes the preprocessor to generate PBASIC code which, when run, will execute if_block if if_condition is true, elseif_block if else_condition is true, and else_block if none of the above are true. (Both the $ElseIf and $Else directives with their accompanying blocks are optional.)


{$While while_condition}
while_block
{$EndWhile}
Causes the preprocessor to generate PBASIC code that will repeatedly execute while_block as long as while_condition is true.


{$Repeat }
repeat_block
{$Until until_condition}
Causes the preprocessor to generate PBASIC code which will repeatedly execute repeat_block until until_condition is true.



Notes:
The preprocessor requires labels in order to generate code for many of the directives. If labels are not provided, the preprocessor will generate them. The generated labels are of the format SPPLnnnn. You may find the generated code more readable if you provide meaningful labels for these directives.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PBASIC ARCTAN function Greg Ross Programming 14 11-05-2003 12:28
Obscure PBASIC for RoboEmu rbayer Programming 1 28-03-2003 23:57
PBasic 2.5 vs. 2.0 Anthony Kesich Programming 6 09-02-2003 22:06
emulationFIRST (aka PBasic emulator) Matt Leese Programming 5 30-06-2002 12:06
PBASIC Loop Speed? archiver 2001 3 23-06-2002 23:46


All times are GMT -5. The time now is 11:08.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi