HUG's impact on Bacon programs is file size and protability. Which isBaCon is an acronym for BAsic CONverter. The BaCon BASIC converter
is a tool to convert programs written in BASIC syntax to C. The
resulting C program should be compilable with GCC or CC.
...
The Highlevel Universal GUI abstraction layer (HUG) is a simple set of
functions to allow BaCon to set up graphical user interfaces in a fast and
efficient manner.
somewhat inversely proportional and vice versa.
Probably the way to create the smallest Bacon program is to include the
shebang at the top of the program. "#!/dir/to/bacon -b". Just like a bash
script, the interpretation and execution will take place. The program size
is simply the size of the (text) script. The trade off being that the
Bacon interpretor and gcc are required on the system the script is run on;
and there is a brief delay before program execution.
There are several ways to incorporate HUG into a Bacon program. I'll use
a GUI example that creates one small window. What will change is how HUG
is accessed.
First is the shotgun approach. It's easy and if your agenda is to create
the largest possible executable (binary) program, then this is what you're
looking for. The compiled binary is 181k.
Code: Select all
INCLUDE "/usr/share/BaCon/hug.bac"
INIT
Mainwin_ = WINDOW( "HUG TEST", 200, 200 )
DISPLAY
"commands". The above example loads all 57. Our sample program only uses
three of the commands. So here we're instructing the program to only
include the code for those three. (INIT, WINDOW, DISPLAY). The compiled
binary is 135k. This 45k smaller. Also this program can run on systems without
Bacon installed. It should be noted that the big plus to this method is that the
executable binary will run regardless of future changes to Bacon, Hug and
hug_imports.bac.
Code: Select all
INCLUDE "/usr/share/BaCon/hug.bac", INIT, WINDOW, DISPLAY
INIT
Mainwin_ = WINDOW( "HUG TEST", 200, 200 )
DISPLAY
hug.so is included in the current Puppy releases. It is also about 100k smaller
than the first two options. It's binary is 52k.
Code: Select all
INCLUDE "/usr/share/BaCon/hug_imports.bac"
INIT
Mainwin_ = WINDOW( "HUG TEST", 200, 200 )
DISPLAY
commands from the compiled hug.so file. The fact that they are compiled is
what leads to the smaller binary file size. However, it is still loading all
57 of the HUG commands.
The first three methods are the common approaches. Here is another option that I
haven't seen mentioned yet. It produces a binary that is 34k, that's 147k smaller
than the shotgun approach.
Code: Select all
CONST HUG_lib$ = "/usr/lib/hug.63.so"
IMPORT "DISPLAY" FROM HUG_lib$ TYPE void
IMPORT "INIT" FROM HUG_lib$ TYPE void
IMPORT "WINDOW(char*,int,int)" FROM HUG_lib$ TYPE long
INIT
Mainwin_ = WINDOW( "HUG TEST", 200, 200 )
DISPLAY
what the economy of scale will be, but it looks to be promising.
If you want your app to be more portable amongst linux's, use one of the first
two methods. I you're writting an app for Puppians, one of the last two methods will
produce the smallest executable.
qed <><
rod