Go to Post FIRST: Making women's hair grow, and mens hair fall out. - Ashley Christine [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
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
  #16   Spotlight this post!  
Unread 01-11-2001, 21:26
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
Re: BASIC Stamp Preprocessor

Quote:
Originally posted by Joe Johnson

...There are a few "macros" that if someone wrote, I would be very grateful for:
1) the ability to have a single "header" file for all modules with all variable, alias & constantant definitions. As it stands, when I use several programing slots, I have to have the same declaration in many files. This can lead to subtle errors if I fix something in one file and forget to fix it in another.
2) an IF-THEN-ELSEIF-ELSE structure
3) something like the "macro" function in C (or C++)
4) way of having common subroutine definitions that would allow a singe definition of a subrountine that is shared by multiple programming slots (subroutines with names like "GetData" & "PutData" come to mind).

<snip>

Joe J.


I wrote a program last year (in Delphi, appropriately enough) which is quite similar to what Joe J. suggested. It preprocesses each program of a BASIC Stamp project and inserts a header file into it.

In its current form, it recognizes the standard '{$STAMP ...} directive as well as two new directives: '{$INCLUDE ...} and '{$StampPPDate}.

The '{$STAMP ...} directive is used to determine which program files belong to the project so that it can preprocess all of them in one swell foop.

'{$INCLUDE ...} causes the specified include file to be inserted into a program file.

'{$StampPPDate} causes the date and time the project was preprocessed to be inserted into the source. I added this directive so that I could print it out at startup and get warm fuzzies about the version of the program currently loaded into the robot.

Currently, the preprocessor renames the input files (appending .bak to the files names) and creates new files. I am planning on reopening the code and coming up with a safer scheme -- like maybe generating a set of files with a common prefix so that all the files in a project appear together in a sorted directory listing. The prefix might be the date and time or a version string. I'm open to suggestions.

I will probably try implementing $IF, $ELSEIF, $ELSE, $ENDIF directives ($THEN is kind of superfluous isn't it?) and I will think about a $DEFINE macro capability.

As for the "common subroutines", Joe, are you thinking about generating code which will make a call to a subroutine in another program slot and then return when it's finished? I tried something like that before, and decided it wasn't worth the effort. Or were you thinking of a "common" routine which actually exists in each of the program slots, and would be called locally? That certainly seems doable. As a matter of fact, it could probably be done with the program as it currently stands: Just $INCLUDE a file which contains the desired subroutine in each of your programs.

If anyone is interested in getting a copy of what I currently have and/or whatever I come up with, just e-mail me. I offered it last year, and only had one or two takers.

Greg Ross

Last edited by Greg Ross : 02-11-2001 at 12:39.
 


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
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
PBasic Question Melissa H. Programming 28 17-11-2002 18:53
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 14:47.

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