I decided that bash and linux commands are much easier to get a
working test run going quickly and I think some cool tools will
result if we have it scriptable
since there isnt yet an official Bacon/HUG tool for this it would be great to use as an
example
the why I did this was because posting code in the forum
wont allow any automatic keyword coloring
this isnt a big problem but it is annoying
so why not make a tool to read a list of keywords and add color
and make it compatible with the forum's phpbb code
thats exactly what I did look at the example below
that would be a big pain to manually add
but easy with a script
REM
REM H.U.G. - Highlevel Universal GUI implementation for BaCon based on GTK
REM (c) Peter van Eerten - August 2009 / July 2011, GPL.
REM
REM ------------------------------------------------------------------------------------------------
REM MacOSX notes: the previous installer for GTK in Quartz puts the libraries in
REM
REM - /Library/Frameworks/Gtk.framework/Libraries/
REM - /Library/Frameworks/Glib.framework/Libraries/
REM
REM HUG expects the above generic directories also. The new GTK builder from
REM http://gtk-osx.sourceforge.net/ puts the libraries in some local directory.
REM
REM Please create the above directories as symlinks to this local directory if using this builder.
REM
REM --------------------------------------------------------------------------------------------------
REM Version 0.5 - MAJOR RELEASE
REM - implemented optional OpenGL canvas using GtkGlArea
REM - ported PIXEL , LINE , CIRCLE and SQUARE to OpenGL
REM - no scaling for canvas, more preparations for selective INCLUDE functionality
REM - changed internal housekeeping to associative arrays which saves almost 900 lines of code
REM Version 0.51 - implemented GtkGlExt as a backend for canvas
REM Version 0.52 - renamed variables in function arguments to avoid clash with CONST
REM Version 0.53 - improved DRAW and SYNC for OpenGL for non-HUG drawing
REM Version 0.54 - ported the OUT directive to OpenGL
REM Version 0.55 - improved heuristic library search, code shrunk about 150 lines more
REM Version 0.56 - ability to explicitly choose which GL library to use, bugfix in HUGLIB$
REM Version 0.57 - better GL drawing, option GL FREEZE/UNFREEZE to improve GL drawing performance
REM Version 0.58 - resizable canvas when using the TABLE layer
REM Version 0.59 - REGISTER to register external widgets into HUG, fixed bug with GRAB $
REM Version 0.60 - METHOD to register the default GRAB $/TEXT /GET /SET functions to external widgets
REM Version 0.61 - fixed titles for FILEDIALOG
REM Version 0.62 - TEXT can delete last added entry to COMBO
REM Version 0.63 - More bugfixes with COMBOBOX
REM --------------------------------------------------------------------------------------------------
' When used as an include file, always call Init
CALL INIT
REM --------------------------------------------------------------------------------------------------
FUNCTION hug_Get_Gtk$ : REM INCLUDE
LOCAL hug_lib$
LOCAL hug_sequence = -1
IF INSTR (OS$, "Darwin") THEN
hug_lib$ = "/opt/local/lib/libgtk-x11-2.0.0.dylib"
IF NOT (FILEEXISTS (hug_lib$)) THEN
hug_lib$ = "/Library/Frameworks/Gtk.framework/Libraries/libgtk-quartz-2.0.0.dylib"
END IF
END IF
CATCH GOTO Redo_Import
LABEL Redo_Import
INCR hug_sequence
IF hug_sequence = HUG_MAX_LIB_SEQ THEN GOTO Print_Error
IF NOT (INSTR (hug_lib$, "dylib")) THEN hug_lib$ = CONCAT $("libgtk-x11-2.0.so.", STR $(hug_sequence))
IMPORT "gtk_init(int*,void*)" FROM hug_lib$ TYPE void
RETURN hug_lib$
LABEL Print_Error
PRINT "Gtk library not found!"
END
END FUNCTION
REM --------------------------------------------------------------------------------------------------
FUNCTION hug_Get_Gdk$ : REM INCLUDE
LOCAL hug_lib$
LOCAL hug_sequence = -1
IF INSTR (OS$, "Darwin") THEN
hug_lib$ = "/opt/local/lib/libgdk-x11-2.0.0.dylib"
IF NOT (FILEEXISTS (hug_lib$)) THEN
hug_lib$ = "/Library/Frameworks/Gtk.framework/Libraries/libgdk-quartz-2.0.0.dylib"
END IF
END IF
CATCH GOTO Redo_Import
LABEL Redo_Import
INCR hug_sequence
IF hug_sequence = HUG_MAX_LIB_SEQ THEN GOTO Print_Error
IF NOT (INSTR (hug_lib$, "dylib")) THEN hug_lib$ = CONCAT $("libgdk-x11-2.0.so.", STR $(hug_sequence))
IMPORT "gdk_atom_intern(char*,int)" FROM hug_lib$ TYPE long
RETURN hug_lib$
LABEL Print_Error
PRINT "Gdk library not found!"
END
END FUNCTION
REM --------------------------------------------------------------------------------------------------
FUNCTION hug_Get_Glib$ : REM INCLUDE
LOCAL hug_lib$
LOCAL hug_sequence = -1
IF INSTR (OS$, "Darwin") THEN
hug_lib$ = "/opt/local/lib/libglib-2.0.0.dylib"
IF NOT (FILEEXISTS (hug_lib$)) THEN
hug_lib$ = "/Library/Frameworks/Glib.framework/Libraries/libglib-2.0.0.dylib"
END IF
END IF
CATCH GOTO Redo_Import
LABEL Redo_Import
INCR hug_sequence
IF hug_sequence = HUG_MAX_LIB_SEQ THEN GOTO Print_Error
IF NOT (INSTR (hug_lib$, "dylib")) THEN hug_lib$ = CONCAT $("libglib-2.0.so.", STR $(hug_sequence))
IMPORT "g_timeout_add(int,void*,long)" FROM hug_lib$ TYPE int
RETURN hug_lib$
LABEL Print_Error
PRINT "Glib library not found!"
END
END FUNCTION
REM --------------------------------------------------------------------------------------------------
FUNCTION hug_Get_Gobject$ : REM INCLUDE
LOCAL hug_lib$
LOCAL hug_sequence = -1
IF INSTR (OS$, "Darwin") THEN
hug_lib$ = "/opt/local/lib/libgobject-2.0.0.dylib"
IF NOT (FILEEXISTS (hug_lib$)) THEN
hug_lib$ = "/Library/Frameworks/Glib.framework/Libraries/libgobject-2.0.0.dylib"
END IF
END IF
CATCH GOTO Redo_Import
LABEL Redo_Import
INCR hug_sequence
IF hug_sequence = HUG_MAX_LIB_SEQ THEN GOTO Print_Error
IF NOT (INSTR (hug_lib$, "dylib")) THEN hug_lib$ = CONCAT $("libgobject-2.0.so.", STR $(hug_sequence))
IMPORT "g_object_unref(long)" FROM hug_lib$ TYPE void
RETURN hug_lib$
LABEL Print_Error
PRINT "Gobject library not found!"
END
END FUNCTION