Builder: Discarding segments
If you follow a segment name in the b1d file with the word DISCARD, any segments in the *.SPT source files with that name will be omitted from the build.
Example build file:
MEQUSEG CODESEG NV0SEG TESTSEG DISCARD #--- ;Separator - ESSENTIAL! Source1.SPT Source2.SPT Source3.SPT
This would force any test code in the individual Source files to be left out of the final build, so long as it is tagged as ;<TESTSEG>
.
This is an very powerful magic, and was the original inspiration for Builder. Here's why:
Imagine you are making a large complicated program, with thousands of lines of code making up maybe 10 or 20 major modules. With the DISCARD capability you can write each module and test it on its own using built in test code. The test code allows you to test the module without being dependent on any other modules. Then, when it is time to glue all the modules together you use DISCARD to leave out the test code, but you can leave it intact in the original source file. If any changes are made to the module it can be re-tested using the original test code.
Because segment names appear as comments to the SPLat/PC translator and simulator, it is quite easy to arrange matters so a module is tested on its own, without any Build process. Being able to leave the test code in the original source file makes it easier to re-test the module if it gets altered.