Shop OBEX P1 Docs P2 Docs Learn Events
Include BS2 files in a Master BS2 ? — Parallax Forums

Include BS2 files in a Master BS2 ?

John KauffmanJohn Kauffman Posts: 653
edited 2008-03-08 05:54 in BASIC Stamp
I've searched PBASIC help and the Parallax site without success...

I have several small utility BS2s whose subs I would like available in a larger master BS2.

In SX/B I can use LOAD to copy the utility files into the master file.

Is there anything similar in Pbasic?
·

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-03-08 05:12
    John -

    In one word, no. Is copy-and-paste a problem? The PBASIC IDE supports multiple programs, each with a tab.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Programming can't be all that difficult, it's nothing but 1's and 0's
  • John KauffmanJohn Kauffman Posts: 653
    edited 2008-03-08 05:21
    In one word, thanks.

    Copy&paste works but in other languages I like to have my utilities stored as a single copy so that updates to the utility can be done in one place rather than having to update dozens of master programs.

    Thanks.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-03-08 05:54
    What you want is difficult in PBASIC because all variables are global: i.e. a subroutine doesn't have a parameter list and can't declare its own local variables. Attempting to construct portable subroutine libraries under these circumstances will invariabley lead to global variable conflicts — unless you've managed to come up with a naming convention that's superior to anything I've ever tried. smile.gif

    But, assuming this is the case, what you could do is come up with a conditionally-compiled, omnibus boilerplate file that includes your entire library, and which gets pasted at the end of your main code. At the top, you can set those compile-time constants that allow only the needed subroutines to be compiled with your program.

    -Phil
Sign In or Register to comment.