Go to Post You are certainly welcome to demonstrate your geekiness on a regular basis! :) - Cynette [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 01-02-2002, 10:24
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
How about a slot directive?

It might be nice to have a slot directive that allows you to start the code for a different programming slot in the same file.

Typical directives:
To start a new slot (slot number assigned by the preprossor -- we refernence them by name):
{$SlotStart slotname}

To end a slot (perhaps not required, either the file ends or a new slot begins:
{$SlotEnd}

To run another slot (preprocessor resolves the slotname to the required number)
{Run slotname}



Along with this I would say it would be nice to have "global" include directives and "local" include directives.

This would let us have some code (say the declarations of variables, constants, etc.) included in all programming slots and then but then we could include special code in specific programming slots.


I know I am asking a lot, but you asked for feedback.

Joe J.
  #17   Spotlight this post!  
Unread 01-02-2002, 11:36
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
Label Example

Quote:
Originally posted by GreenDice
Greg,

Could you give some examples on how to use labels?

Thanks.
Sure. Sorry for the oversight.

Code:
AppleTest:      {$if X = Apple}
                  debug "X is an apple", cr
OrangeTest:     {$elseif X = Orange}
                  debug "X is an orange", cr
MangoTest:      {$elseif X = Mango}
                  debug "X is an mango", cr
NoneOfTheAbove: {$else}
                  debug "X must be a banana", cr
EndFruitTest:   {$endif}
__________________
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

Last edited by Greg Ross : 01-02-2002 at 14:30.
  #18   Spotlight this post!  
Unread 01-02-2002, 11:50
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: How about a slot directive?

Quote:
Originally posted by Joe Johnson
It might be nice to have a slot directive that allows you to start the code for a different programming slot in the same file.

Typical directives:
To start a new slot (slot number assigned by the preprossor -- we refernence them by name):
{$SlotStart slotname}

To end a slot (perhaps not required, either the file ends or a new slot begins:
{$SlotEnd}

To run another slot (preprocessor resolves the slotname to the required number)
{Run slotname}
I think I like it. Let me stew on it a bit.



Quote:
Along with this I would say it would be nice to have "global" include directives and "local" include directives.

This would let us have some code (say the declarations of variables, constants, etc.) included in all programming slots and then but then we could include special code in specific programming slots.
If I'm understanding what you need, then you can already do this with multiple include files. You're not restricted to a single $Include directive per file. Simply $Include the global data file in all your project files, and $Include the special code files only where you need them.


Quote:
I know I am asking a lot, but you asked for feedback.

Joe J.
Yes, I did, and I appreciate it all.
__________________
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

Last edited by Greg Ross : 01-02-2002 at 14:32.
  #19   Spotlight this post!  
Unread 12-02-2002, 14:53
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
How about another preprocessor directive?

I'm thinking about adding another directive similar to the $Slot directive suggested by Dr. Joe.

$Slot demarks a section of a preprocessor source file to be output as a separate BASIC Stamp program which is loaded into one of the suplemental program slots.

The new directive would identify a portion of a file which can be $Included in any of your $Slot output files.

I'm proposing $IncludeSource for the directive name. The syntax would be {$IncludeSource symbolic_name}. The source file lines between the $IncludeSource and a subsequent $EndIncludeSource directive can then be $Included using symbolic_name.

Example:
Code:
{$Stamp bs2sx}

{$IncludeSource dataIncludes}
' Your data definitions go here
.
.
.
{$EndIncludeSource}

{$Include dataIncludes} ' Insert the data definitions from above

'Your program initialization goes here
.
.
.
'Now run the main control loop
{$Run MainLoop}



{$Slot MainLoop}
{$Include dataIncludes} ' Insert the data definitions from above

' Read inputs and process them
.
.
.
'When you run out of program space, split your program, and 
'continue in the next program slot.
{$Run NextSlot}



{$Slot NextSlot}

{$Include dataIncludes} ' Insert the data definitions from above
'Do some more processing...

'Finally, output your data via the serout command, and go back to 
'the beginning of the control loop.

serout ...

{$Run MainLoop}
__________________
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
  #20   Spotlight this post!  
Unread 16-02-2002, 22:14
GhettoTech GhettoTech is offline
Registered User
#0300 (Ghetto Techs)
 
Join Date: Feb 2002
Location: Philadelphia
Posts: 21
GhettoTech is an unknown quantity at this point
Send a message via AIM to GhettoTech
From my understanding of the original posted question, you want to avoid typing multiple "IF" statements.

http://parallaxinc.com/downloads/Doc...ual%20v2.0.pdf

That's a link to the manual for the Basic Stamp, look up the "Branch" code. (Pages 85 & 86)

~Excerpt from Basic Stamp Manual~
[b]Explanation:[\B]
The BRANCH instruction is useful when you want to write something like this:
IF value = 0 THEN case_0 ' value =0: go to label "case_0"
IF value = 1 THEN case_1 ' value =1: go to label "case_1"
IF value = 2 THEN case_2 ' value =2: go to label "case_2"

You can use BRANCH to organize this into a single statement:
BRANCH value, [case_0, case_1, case_2]
Closed Thread


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 15:42.

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