BaCon - Bash-based Basic-to-C converter/compiler
Hey guys, I got a working exec. with the File and Message dialogs, and help.
The file/folder dialog is all 4 types and auto sets the winTitle for each type.
The message dialog needs all options: Type, Buttons, Width, Height, Message.
It returns both the end of the GTK response variable name, and it`s negative number.
I think add a font dialog ( maybe like my Visual Basic one ), and color?
There`s a few other dialogs, but they`re not nearly as important as these 4.
Any suggestions are welcome, it`s just the first draft...
# I`d like to give credit to GatorDog, vovchik, and pjot if they want it...
TEST: "hug.bac" makes a exec. file 76 KB larger than "hug_imports.bac" does.
Not much, but my stdDlgs exec. compiles to only 56 KB with "hug_imports.bac".
More damn Qs...
# Can HUG use common icons ( not Stock ) for most dlgs.? PROPERTY ?
# What`s the deal with: INTL$ ? It auto. builds foreign language files?
I`ve noticed the Bacon and HUG docs. are misleading and even wrong.
Maybe I understand it differently, but I`m sure they could be better written.
# stdDlgs.bac is posted below.
The file/folder dialog is all 4 types and auto sets the winTitle for each type.
The message dialog needs all options: Type, Buttons, Width, Height, Message.
It returns both the end of the GTK response variable name, and it`s negative number.
I think add a font dialog ( maybe like my Visual Basic one ), and color?
There`s a few other dialogs, but they`re not nearly as important as these 4.
Any suggestions are welcome, it`s just the first draft...
# I`d like to give credit to GatorDog, vovchik, and pjot if they want it...
TEST: "hug.bac" makes a exec. file 76 KB larger than "hug_imports.bac" does.
Not much, but my stdDlgs exec. compiles to only 56 KB with "hug_imports.bac".
More damn Qs...
# Can HUG use common icons ( not Stock ) for most dlgs.? PROPERTY ?
# What`s the deal with: INTL$ ? It auto. builds foreign language files?
I`ve noticed the Bacon and HUG docs. are misleading and even wrong.
Maybe I understand it differently, but I`m sure they could be better written.
# stdDlgs.bac is posted below.
- Attachments
-
- stdDlgs.bac.gz
- For Help, after compiling, in rxvt type: stdDlgs
- (1.25 KiB) Downloaded 506 times
Last edited by sunburnt on Sun 25 Sep 2011, 05:03, edited 4 times in total.
Dear sunburnt,
NUMBER is a long int (c type) and int is a c type plain int.... Hope that helps.
Here is an explanation:
http://www.lix.polytechnique.fr/~libert ... types.html
With kind regards,
vovchik
NUMBER is a long int (c type) and int is a c type plain int.... Hope that helps.
Here is an explanation:
http://www.lix.polytechnique.fr/~libert ... types.html
With kind regards,
vovchik
Many thanks vovchik; I kinda figured it might be a longer integer type.
But I was also thinking it might be a special variable type for passing handles.
### A handle is only an integer, correct? ... So the NUMBER is over-kill?
My girl friend tells me that vovchik is a Russian name or expression.
And what town in the Ukraine do you live in?
Just curiosity questions, I`m always interested in where folks are from.
But I was also thinking it might be a special variable type for passing handles.
### A handle is only an integer, correct? ... So the NUMBER is over-kill?
My girl friend tells me that vovchik is a Russian name or expression.
And what town in the Ukraine do you live in?
Just curiosity questions, I`m always interested in where folks are from.
Last edited by sunburnt on Sun 25 Sep 2011, 05:48, edited 1 time in total.
Got up today and it started doing GatorDog`s Segmentation fault error.
Turned out to be the ARGUMENT parsing loop.
It really doesn`t like it if the array isn`t filled all the way...
Anyway... It`s working normally again. Sure hope it stays that way.
# I`ve re-posted the re-fixed stdDlgs above.
# I`ll post my Qs again further down. - T.
Turned out to be the ARGUMENT parsing loop.
It really doesn`t like it if the array isn`t filled all the way...
Anyway... It`s working normally again. Sure hope it stays that way.
# I`ve re-posted the re-fixed stdDlgs above.
# I`ll post my Qs again further down. - T.
Last edited by sunburnt on Sun 25 Sep 2011, 05:52, edited 1 time in total.
updated so you can compile most apps from inside the geany GUI
updated Nov-5-2011 for HUG highlighting and upx compression
this is a "hack" going for geany syntax highlighting with BaCon!
geany fix with rxvt_hold
http://www.puppy2.org/slaxer/geany_bacon-2-1_SLXR.tgz
upx compression
http://www.puppy2.org/slaxer/upx-3.07-i ... 1_SLXR.tgz
note in geany I had to recycle the build button
so after you compile the app you click on build
which build now uses upx to compress your already compiled bin
then open geany with any *.bac and select
Document -->Set Filetype-->Programming Languages-->FreeBasic source file
just install the package
and upx
and you get the BaCon commands highlighted !
I cant use gtksourceview with my gtk version so this is how to get
another GUI going
*since FreeBasic was compiled in the GUI as an option that was used
later when all the commands are added and tested Bacon would be used and compiled into geany the right way
if we keep at we could get an official bacon filetype someday it can be done
----------------------------------------------------------------------------
as a side note
*you can also call the rxvt_hold script for other apps too
like this
you could change the "ls -1" for any command you want to run
it works for keeping rxvt or urxvt open after the command is executed
updated Nov-5-2011 for HUG highlighting and upx compression
this is a "hack" going for geany syntax highlighting with BaCon!
geany fix with rxvt_hold
http://www.puppy2.org/slaxer/geany_bacon-2-1_SLXR.tgz
upx compression
http://www.puppy2.org/slaxer/upx-3.07-i ... 1_SLXR.tgz
note in geany I had to recycle the build button
so after you compile the app you click on build
which build now uses upx to compress your already compiled bin
then open geany with any *.bac and select
Document -->Set Filetype-->Programming Languages-->FreeBasic source file
just install the package
and upx
and you get the BaCon commands highlighted !
I cant use gtksourceview with my gtk version so this is how to get
another GUI going
*since FreeBasic was compiled in the GUI as an option that was used
later when all the commands are added and tested Bacon would be used and compiled into geany the right way
if we keep at we could get an official bacon filetype someday it can be done
----------------------------------------------------------------------------
as a side note
*you can also call the rxvt_hold script for other apps too
like this
Code: Select all
rxvt_hold ls -1
you could change the "ls -1" for any command you want to run
it works for keeping rxvt or urxvt open after the command is executed
- Attachments
-
- geany-compile-bacon.png
- (66.05 KiB) Downloaded 1234 times
Last edited by big_bass on Sun 06 Nov 2011, 20:09, edited 21 times in total.
Hey sunburnt
thanks for confirming that
I had that in my first post viewtopic.php?t=48901&sort=author&start=73
but thought it wasnt needed with the new changes I made
I'll update the above post
it opens automatically with geany
*its nice to know that parts of geany are scriptable without having to
hack it and recompile it to test if it works or not
thanks
Joe
thanks for confirming that
I had that in my first post viewtopic.php?t=48901&sort=author&start=73
but thought it wasnt needed with the new changes I made
I'll update the above post
thats for when you click on any source program with the *.bacI was surprised I didn`t have to add ".bac;" to the file: filetype_extensions.conf
it opens automatically with geany
*its nice to know that parts of geany are scriptable without having to
hack it and recompile it to test if it works or not
thanks
Joe
Hey vovchik
thanks for the comments
I updated the post above to fix it so it now compiles
files that have INCLUDES
I also added a little terminal so the user can see the
progress while it compiles in geany
there is a script called rxvt_hold
that goes in /usr/sbin the ( app depends on it)
*you can also call that script for other apps too
as a side note like this
you could change the "ls -1" for any command you want to run
it works for keeping rxvt or urxvt open after the command is executed
Joe
thanks for the comments
I updated the post above to fix it so it now compiles
files that have INCLUDES
I also added a little terminal so the user can see the
progress while it compiles in geany
there is a script called rxvt_hold
that goes in /usr/sbin the ( app depends on it)
*you can also call that script for other apps too
as a side note like this
Code: Select all
rxvt_hold ls -1
it works for keeping rxvt or urxvt open after the command is executed
Joe
big_bass; Now you need to add HUG highlighting and it`ll be complete!
I still think API libraries should be made of all this stuff, there`s lots of it !
I wrote shell libraries for dealing with files, file systems, lists, gtkDialog, etc.
But written in Bacon and compiled they can become far more useful.
Especially to Bacon as it`s so limited by the standard Basic language.
I still think API libraries should be made of all this stuff, there`s lots of it !
I wrote shell libraries for dealing with files, file systems, lists, gtkDialog, etc.
But written in Bacon and compiled they can become far more useful.
Especially to Bacon as it`s so limited by the standard Basic language.
Problem with an associative array: SEGMENTATION FAULT array out of bounds?
Array gives out correct data, clicking a button and calling a sub gets error.
But the button`s ID array is a std. array, not the associative array.
Sub called has widget_ passed to it: SUB btnCLK(int widget_)
Put the files in: "/tmp/apps.sq"
Compile: "sqApps.mnu.bac" and run in rxvt.
Click Menu button and menu Item and it errors calling sub.
It never even makes it to the SYSTEM command, line #65.
Print command shows the associative array is properly filled.
If it finally runs properly, it`ll error because there`s no Squash App. file.
Array gives out correct data, clicking a button and calling a sub gets error.
But the button`s ID array is a std. array, not the associative array.
Sub called has widget_ passed to it: SUB btnCLK(int widget_)
Put the files in: "/tmp/apps.sq"
Compile: "sqApps.mnu.bac" and run in rxvt.
Click Menu button and menu Item and it errors calling sub.
It never even makes it to the SYSTEM command, line #65.
Print command shows the associative array is properly filled.
If it finally runs properly, it`ll error because there`s no Squash App. file.
- Attachments
-
- AssociativeArrayError.zip
- Make dir.: /tmp/apps.sq , copy file to it and unzip it.
- (1.34 KiB) Downloaded 512 times
Terry,
Nix the quotes
(interesting code, by the way )
rod
(IMHO)There doesn't seem to be an exact correlation between button geometry and window geometry in HUG.
Most of the time it doesn't mater, but you're trying to keep this widget compact.
Did this to fit all the buttons vertically in the widget, with a slight visual
spacing between buttons. It may need more fudging when more buttons
are present; but it's a good start.
...
Code: Select all
CALLBACK(btnIDs_[i], "btnCLK")
Code: Select all
CALLBACK(btnIDs_[i], btnCLK)
rod
(IMHO)There doesn't seem to be an exact correlation between button geometry and window geometry in HUG.
Most of the time it doesn't mater, but you're trying to keep this widget compact.
Did this to fit all the buttons vertically in the widget, with a slight visual
spacing between buttons. It may need more fudging when more buttons
are present; but it's a good start.
Code: Select all
'added to variable presets
btnSpc = 2
btnY = btnH + btnSpc
...
'mod'ed these two lines
btnY = btnY + btnH + btnSpc
winH = winH_0 + ( (btnH + (btnSpc * 2)) * btnCNT ) + btnSpc
EXEC keeps giving me grief no matter how I try to use it.
What`s wrong with this? ......... Get options from args.
"echo ....." works from the shell, but not here. Empty output lines.
Tried CONCAT$ also, looks like EXEC$ only sees "echo".
I spent hours trying to get INSTRREV to work, it will not with MID$ !
I got INSTR to work, but decided to take my own advice and do it in the shell.
What`s wrong with this? ......... Get options from args.
Code: Select all
FOR i = 2 TO 5
Opt$ = CHOP$(EXEC$("echo", ARGUMENT$, "|cut -d'-' -f", i))
' IF Opt$ = "" THEN BREAK
PRINT Opt$
NEXT
Tried CONCAT$ also, looks like EXEC$ only sees "echo".
I spent hours trying to get INSTRREV to work, it will not with MID$ !
I got INSTR to work, but decided to take my own advice and do it in the shell.
Code: Select all
Opt$ = CHOP$(EXEC$("echo", ARGUMENT$, "|cut -d'-' -f", i))
EXEC$ is seeing 3 strings and a number. 3 strikes you're out.
Code: Select all
Cmd$ = CONCAT$("echo ", ARGUMENT$, "|cut -d'-' -f", STR$(i))
Opt$ = CHOP$(EXEC$(Cmd$))
However, this may serve you better
Code: Select all
SPLIT ARGUMENT$ BY " -" TO Arg$ SIZE Arg_count
Arg$[0] is the command/program name
Arg_count gives the number of arguments
Then you can pick them off one-by-one Arg$[1] Arg$[2] ....Arg$[Arg_count]
Note that I used a "space dash" ( " -" ) in the SPLIT as the seperator.
That should preclude a trailing space on the Arg$[] variables.
The Arg$[] number is affected by the use of OPTION BASE 1; adjust accordingly.
rod
By the way, I didn't actually test any of that. Ye pays yer money and ye takes yer chances! RRR...