Can I spilt my program up ?

srnet

Senior Member
Just a general question about large programs, using a 28X2.

The program is getting a bit unwieldy, 120 lines of symbols and EEPROM data already. About 20 seperate sub routines so far.

Is there anyway I can split it up so that bringing it all together as a complete program is more manageble ?

I have been testing the sub routines individually and saving them as seperate bas files.

What would help a lot is if the symbol definitions could be elsewhere (makes reusing the limited variable storage easier)
 

BeanieBots

Moderator
The PE does not support #include files like many other compilers but it does have the ability to hide code on collapsable blocks.
You can surround chunks of code with {} and then expand/collapse after you have enabled the option under "options -> editor".
 

srnet

Senior Member
Thanks

Guess I am guilty there of RTFM sin.

But no way of having a 'universal' symbols file\area is a shame.
 

David Crocombe

New Member
Still Waiting for #Include.

Name:#include
Syntax:#INCLUDE “filename”
Description:NOTE: Reserved for future use. Not currently implemented.

It's now May 2013 and I'm still waiting for the #Include.
It could be so useful in reusing core code.
 

srnet

Senior Member
Yes, its May 2013, and lots of us are waiting too.

I have a program that gets to line 440 before the code starts, a #Include would be useful.

However my program works just fine, which is the important thing.
 
Last edited:

geoff07

Senior Member
I have often considered, but never actually tried, seeing if I could use a C compiler (which has a proper pre-processor with the necessary include function - free versions are available e.g. GCC) to construct a Picaxe basic file from a library of symbols and subroutines. I have always expected a new version of PE anytime soon so not put in the effort. But given how long PE is taking, and the complete absence of any info as to what it will do, perhaps it is time to take another look? Or has someone done this?
 

Technical

Technical Support
Staff member
PE6 has a full new preprocessor that allows use of #include files and more advanced #define (e.g. string substitution / macros) etc.
This feature will be new in PE6, it will not be added to PE5.
 

DamonHD

Senior Member
FWIW, I used "ant" and use of the existing #define mechanism to build the equivalent of a #include/library for my PICAXE stuff. (Basically concatenating all my library modules to the main program, but surrounding each in a #ifdef USE_MODULE_XXX, so that I could enable just those modules that the main program requested with a #define USE_MODULE_XXX.)

I can supply more details if anyone is interested. It should remain compatible with a new #include mechanism.

Rgds

Damon
 

premelec

Senior Member
FROM WIKPEDIA:
"Apache Ant is a software tool for automating software build processes.
It is similar to Make but is implemented using the Java language, requires
the Java platform, and is best suited to building Java projects.

The most immediately noticeable difference between Ant and Make is
that Ant uses XML to describe the build process and its dependencies,
whereas Make uses Makefile format. By default the XML file is named build.xml."

OK I'd be interested in just how easy it is to use...
I'm not facile with obscure commands [or Java or C] :)
Do all the files have to exist within a BASIC file or can they
be called externally and reduced to a smaller BAS file?

Thanks...
 

DamonHD

Senior Member
Here's the Ant build.xml file, called from my Eclipse IDE but it could be from the command line:

https://sourceforge.net/p/opentrv/code-0/HEAD/tree/trunk/PICAXE/DHD201302L0/build.xml

The important thing (and you could do this with a Windows or *nix/Linux batch files), is that it slaps all the .inc.bas files from the lib directory on the end of a copy of your main module. You select which to actually use with #define USE_MODULE_... directives at the top of your main module.

Rgds

Damon
 
Top