Description:
A program that converts many files into one large bytecode file using macros. This program does extend your project with macros to load, change and manipulate files and the building process.
Included are some example libaries and an working example for turtles as an extra download at the bottom

Download:
The main file foud here is to build your Project.
In computercraft download via: 'pastebin get wLtuRVnw build'

Usage:
build <main filename> <out filename>
All source files, including the mainfile, have to be in the directory "src/".
The single output file will be in "out/".

Notes:
Before coming to the examples and other downloads here are some notes.
This project is created in a short amount of time and I hasnt enough time to completly test it, so it will may be unstable. Many new features will come soon and please report all bugs.

Tutorial and macro list:
List of all current avaible macros:
  • BEGINFUNCTION
  • ENDFUNCTION
  • FUNCTION
  • GLIBFUNC
  • IMPORT
  • IMPORTLIB
  • LIB
  • SOURCE
Explanations:
SpoilerALL macros have to be in uppercase and NEED two brackets at the end, also macros like LIB() or SOURCE(). Brackets often need parameters which are separated with "," and optional spaces. At last all file names have to conain the complete path except "src/"

BEGINFUNCTION():
Tells the compiler that here starts the function section of libary files.

ENDFUNCTION():
Tells the compiler that here stops the function section of libary files.

FUNCTION( sFunctionName ):
Tells the compiler which function follows after this macro.

GLIBFUNC( sLibaryFileName, sLibaryFunctionName ):
Puts the sLibaryFunctionName to the stack of sLibaryFileName. With this you can choose which functions you will use to minimize the size of the output bytecode.

IMPORT( sSourceFileName, sVarName ):
Set the the bytecode from the file sSourceFileName into sVarName. It has to be accessed using loadstring(sVarName)() or be writte to other spaces.

IMPORTLIB( sLibaryFileName, sVarName):
Is the a same as the IMPORT macro except it is used for libary files. It takes to stack of functionnames from sLibaryFileName and loads only the needed functions. If the stack is empty it will load all functions.

LIB():
This has to be at the top of all libary files to tell the compiler which type of file it is.

SOURCE():
Is the same as the LIB macro except it is used at the top of source files

Here are three example libaries:
Turtle - Easy to use turtle functions
NetLib - Libary to work with wireless modems
Selfdestroy - Used to destroy your computer

Example:
The three libaries above are used in this example and are saveed at "src/module".
Example
SpoilerThis example is created for turtles and loads all needed functions using the most macros then it setups a listner on 26345 and refuels the turtle with all avaible slots. After that it starts the destroy to delete all files and reboot on any key or mouse event. Then it starts a parallel to wait for any of 3 functions. The first lets the turtle do circles, the secoend waits for any message on port 26345 and if it gets anything it leaves the loop and the thrid is the function that has to be runned to start the listner. At the end it closes the listener, the open port and destroy itself.

As last here is the Compiled Example