BaCon - Bash-based Basic-to-C converter/compiler
Folks,
The 'indent' only will be invoked if you use the '-p' option.
If you encounter 'broken' files then please note that there are plain 'bac' files on the website of BaCon also. So for each program listed simply remove the '.html' extension and download the original source.
For example:
Regards
Peter
The 'c' is not needed - if you run 'bacon' without any arguments you'll see the correct usage.~/Downloads/bacon/cli-demos $ sudo bacon c mastermind.bac
Starting conversion... done.
Applying indentation... sh: indent: command not found
Unable to delete file: No such file or directory
The 'indent' only will be invoked if you use the '-p' option.
If you encounter 'broken' files then please note that there are plain 'bac' files on the website of BaCon also. So for each program listed simply remove the '.html' extension and download the original source.
For example:
- * http://www.basic-converter.org/glade.bac.html -> http://www.basic-converter.org/glade.bac
* http://www.basic-converter.org/source.bac.html -> http://www.basic-converter.org/source.bac
* http://www.basic-converter.org/calc.bac.html -> http://www.basic-converter.org/calc.bac
* http://www.basic-converter.org/stars.bac.html -> http://www.basic-converter.org/stars.bac
....<more files>....
I am not able to reproduce this. Did you correctly download the .bac files (see above)?working now, although "calc.bac" has strange way of adding: 20 + 35 = 2035
Regards
Peter
Hi Peter,PjotAwake wrote:Folks,
The 'c' is not needed - if you run 'bacon' without any arguments you'll see the correct usage.~/Downloads/bacon/cli-demos $ sudo bacon c mastermind.bac
Starting conversion... done.
Applying indentation... sh: indent: command not found
Unable to delete file: No such file or directory
The 'indent' only will be invoked if you use the '-p' option.
If you encounter 'broken' files then please note that there are plain 'bac' files on the website of BaCon also. So for each program listed simply remove the '.html' extension and download the original source.
For example:
- * http://www.basic-converter.org/glade.bac.html -> http://www.basic-converter.org/glade.bac
* http://www.basic-converter.org/source.bac.html -> http://www.basic-converter.org/source.bac
* http://www.basic-converter.org/calc.bac.html -> http://www.basic-converter.org/calc.bac
* http://www.basic-converter.org/stars.bac.html -> http://www.basic-converter.org/stars.bac
....<more files>....I am not able to reproduce this. Did you correctly download the .bac files (see above)?working now, although "calc.bac" has strange way of adding: 20 + 35 = 2035
Regards
Peter
Seemed to need 'indent' either way.
Code: Select all
~/Downloads/bacon/cli-demos $ sudo bacon calc.bac
Starting conversion... done.
Applying indentation... sh: indent: command not found
Code: Select all
REM Addition
IF key EQ 49 THEN
PRINT "Enter first number: ";
INPUT f
PRINT "Enter second number: ";
INPUT g
PRINT "\nResult is: ";
PRINT f+g
PRINT
-
- Posts: 186
- Joined: Sun 17 Jun 2007, 18:25
Looks like part of my problem is no opengl installed.
I installed the pets for mesa-7.8.1-s131, because that looked like the latest ones (except for some that look like for a newer version of x-server).
So now I get the dreaded
Xlib: extension "GLX" missing on display ":0.0".
Error: couldn't get an RGB, Double-buffered visual
I made sure to change the Disable to:
Load "glx" #LOADGLX
in xorg.conf.
That's an awful lot of forum searching and fiddling around, and still no luck.
It would be a boon to mankind if someone who had gotten a recent build of Puppy working with all this stuff would release a remastered ISO. <Moaning snipped, I could go to a bloated distro if I didn't want Puppy so bad.>
I installed the pets for mesa-7.8.1-s131, because that looked like the latest ones (except for some that look like for a newer version of x-server).
So now I get the dreaded
Xlib: extension "GLX" missing on display ":0.0".
Error: couldn't get an RGB, Double-buffered visual
I made sure to change the Disable to:
Load "glx" #LOADGLX
in xorg.conf.
That's an awful lot of forum searching and fiddling around, and still no luck.
It would be a boon to mankind if someone who had gotten a recent build of Puppy working with all this stuff would release a remastered ISO. <Moaning snipped, I could go to a bloated distro if I didn't want Puppy so bad.>
Hi jpeps,
Can you tell me which version of BaCon you are using? Hope it is build 19. Furthermore, are you using the BASH version, or the binary version?
Note that if you use the BASH version of BaCon, you *must* use BASH 4.x or higher. In case of the binary, it should have been compiled within a BASH 4.x or higher.
If the Kornshell version was used, all Kornshell versions are woking fine.
The calculator (shell version) works fine for me:
Peter
Can you tell me which version of BaCon you are using? Hope it is build 19. Furthermore, are you using the BASH version, or the binary version?
Note that if you use the BASH version of BaCon, you *must* use BASH 4.x or higher. In case of the binary, it should have been compiled within a BASH 4.x or higher.
If the Kornshell version was used, all Kornshell versions are woking fine.
The calculator (shell version) works fine for me:
Please let me know,peter@laptop:~/programming/bacon$ bash --version
GNU bash, version 4.0.33(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
peter@laptop:~/programming/bacon$
peter@laptop:~/programming/bacon$ ./bacon.bash calculator
Starting conversion... done.
Starting compilation... done.
Program 'calculator' ready.
peter@laptop:~/programming/bacon$ ./calculator
-= BACON Calculator =-
1) Perform addition
2) Perform substraction
3) Perform multiplication
4) Perform division
5) Quit
Enter your choice...
Enter first number: 20
Enter second number: 35
Result is: 55
1) Perform addition
2) Perform substraction
3) Perform multiplication
4) Perform division
5) Quit
Enter your choice...
Thanks for using this calculator!
Peter
Hi Peter,PjotAwake wrote:Hi jpeps,
Can you tell me which version of BaCon you are using? Hope it is build 19. Furthermore, are you using the BASH version, or the binary version?
Note that if you use the BASH version of BaCon, you *must* use BASH 4.x or higher. In case of the binary, it should have been compiled within a BASH 4.x or higher.
If the Kornshell version was used, all Kornshell versions are woking fine.
The calculator (shell version) works fine for me:
Please let me know,peter@laptop:~/programming/bacon$ bash --version
GNU bash, version 4.0.33(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
peter@laptop:~/programming/bacon$
peter@laptop:~/programming/bacon$ ./bacon.bash calculator
Starting conversion... done.
Starting compilation... done.
Program 'calculator' ready.
peter@laptop:~/programming/bacon$ ./calculator
-= BACON Calculator =-
1) Perform addition
2) Perform substraction
3) Perform multiplication
4) Perform division
5) Quit
Enter your choice...
Enter first number: 20
Enter second number: 35
Result is: 55
1) Perform addition
2) Perform substraction
3) Perform multiplication
4) Perform division
5) Quit
Enter your choice...
Thanks for using this calculator!
Peter
I'm using version 0.110 from the bacon.tar.gz download at the front of the postings. Sounds like updated versions don't require "indent", and maybe the math func works differently. I compiled bash 4.1.0(1) with Lucid 2.3.5, so could give it a try.
Edit. Yes...I just tried bacon.bash, and calc works as is, and no need for indent.
gtkabout1.bac compiles and works nicely with bacon 0.110, but with bacon.bash:
~/Downloads/bacon/gtk-demos $ ./gtkabout1
ERROR: signal for SEGMENTATION FAULT received - memory invalid or array out of bounds? Try to compile the program with TRAP LOCAL to find the cause.
Note: error occurs when clicking for child window. Same after compiling new 'bacon' from bacon.bash "BaCon version 1.0 build 19"
~/Downloads/bacon/gtk-demos $ ./gtkabout1
ERROR: signal for SEGMENTATION FAULT received - memory invalid or array out of bounds? Try to compile the program with TRAP LOCAL to find the cause.
Note: error occurs when clicking for child window. Same after compiling new 'bacon' from bacon.bash "BaCon version 1.0 build 19"
Hi jpeps,
What is this program 'gtkabout1'? This one does not appear on the BaCon website.
Note that you were using 0.110 which is really old - it is a beta release of more than a year ago, and only after 1.0 build 1 the BaCon commands and functions were frozen. Programs which could be compiled with beta versions are likely to crash now, for example when they are using a function in a way which is not supported anymore.
Can you dump the code here so I can check it?
Thanks,
Peter
What is this program 'gtkabout1'? This one does not appear on the BaCon website.
Note that you were using 0.110 which is really old - it is a beta release of more than a year ago, and only after 1.0 build 1 the BaCon commands and functions were frozen. Programs which could be compiled with beta versions are likely to crash now, for example when they are using a function in a way which is not supported anymore.
Can you dump the code here so I can check it?
Thanks,
Peter
It's in bacon.tar.gz / gtk-demos. I'm getting similar errors withPjotAwake wrote:
What is this program 'gtkabout1'? This one does not appear on the BaCon website.
other gtk demos, such as GTK-server demo from website...for both
versions of bacon (old and new). Non gtk demos seem to work fine.
Code: Select all
$ ./gtk-server
ERROR: signal for SEGMENTATION FAULT received - memory invalid or array out of bounds? Try to compile the program with TRAP LOCAL to find the cause.
~ $
Jpeps,
It makes sense as the programs in that 'bacon.tar.gz' package are also more than a year old.
So forget about them!
Please use the programs shipped by Puppy Linux, or the current programs hosted on the BaCon website.
For fun I have adjusted the 'gtkabout1.bac' program so it compiles and runs with BaCon 1.0 build 19. Compare with the orignal one and you'll see the differences.
Here is the code:
Regards
Peter
It makes sense as the programs in that 'bacon.tar.gz' package are also more than a year old.
So forget about them!
Please use the programs shipped by Puppy Linux, or the current programs hosted on the BaCon website.
For fun I have adjusted the 'gtkabout1.bac' program so it compiles and runs with BaCon 1.0 build 19. Compare with the orignal one and you'll see the differences.
Here is the code:
Code: Select all
' *************************************************
' Program: gtkabout1
' Purpose: Demo of GTK about function
' Author: Jan Bodnar
' Modded: Vovchik (Puppy forum)
' Added: added new png, text box, quit routine
' Date: 13 Nov 2009
'
' Modified for BaCon 1.0 build 19 by PvE - Nov. 2010
'
' *************************************************
TRAP LOCAL
GLOBAL NUL TYPE STRING
' ***********
' INIT VARS
' ***********
CONST GTK_WINDOW_TOPLEVEL = 0
CONST GTK_WIN_POS_CENTER = 1
CONST GDK_BUTTON_PRESS_MASK = 256
' ***********
' ***********
' LIB IMPORTS
' ***********
IMPORT "gtk_init(int*,void*)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_window_new(int)" FROM "libgtk-x11-2.0.so" TYPE long
IMPORT "gtk_widget_show_all(long)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_main" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_main_quit" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "g_signal_connect_data(long,char*,void*,long,long,int)" FROM "libgobject-2.0.so" TYPE void
IMPORT "g_object_unref(long)" FROM "libgobject-2.0.so.0" TYPE void
IMPORT "gdk_pixbuf_new_from_file(char*,void*)" FROM "libgdk_pixbuf_xlib-2.0.so" TYPE long
IMPORT "g_object_set(long,char*,...)" FROM "libgobject-2.0.so" TYPE void
IMPORT "gtk_show_about_dialog(long,char*,...)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_check_version(int,int,int)" FROM "libgtk-x11-2.0.so" TYPE char*
' *********** added by vovchik
IMPORT "gtk_container_add(long,long)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_label_new(char*)" FROM "libgtk-x11-2.0.so" TYPE long
IMPORT "gtk_table_new(int,int,int)" FROM "libgtk-x11-2.0.so" TYPE long
IMPORT "gtk_table_attach_defaults(long,long,int,int,int,int)" FROM "libgtk-x11-2.0.so" TYPE void
IMPORT "gtk_button_new_from_stock(char*)" FROM "libgtk-x11-2.0.so" TYPE long
IMPORT "gtk_exit(int)" FROM "libgtk-x11-2.0.so" TYPE void
' *********** end added by vovchik
' ***********
' SUBROUTINES
' ***********
' ***********
' Callback for
' closing window
' ***********
' ***********
SUB exit_prog
' ***********
gtk_exit(0)
' ***********
ENDSUB
' ***********
' ***********
SUB show_about(long widget, long event, long dialog)
' ***********
LOCAL pixbuf
LOCAL v$
IF gtk_check_version(2,12,0) EQ 0 THEN v$="program-name"
ELSE v$="name"
pixbuf = gdk_pixbuf_new_from_file("battery.png", NUL)
gtk_show_about_dialog(dialog,v$,"Battery","version","0.9a","copyright","(c) Jan Bodnar\nmodded by vovchik","comments","Battery is a simple tool for battery checking.","website","http://www.basic-converter.org","logo",pixbuf,NUL)
g_object_unref(pixbuf)
' ***********
END SUB
' ***********
' ***********
' FUNCTIONS
' ***********
' ***********
SUB BacMain()
' ***********
LOCAL window, table, label, button
gtk_init(0, 0)
window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
g_object_set(window,"window-position",GTK_WIN_POS_CENTER,"title","Battery","default-width",220,"default-height",150,"events",GDK_BUTTON_PRESS_MASK,"border-width",15,NUL)
' *********** added by vochik
table = gtk_table_new(15, 15, 1)
gtk_container_add(window, table)
label = gtk_label_new("Click here for child window,\nplease! Pretty please!")
gtk_table_attach_defaults(table, label, 1, 8, 3, 7)
button = gtk_button_new_from_stock("gtk-cancel")
gtk_table_attach_defaults(table, button, 10, 14, 12, 14)
' *********** end added by vovchik
g_signal_connect_data(window,"button_press_event", show_about, window, 0, 0)
g_signal_connect_data(window,"destroy", gtk_main_quit, 0, 0, 0)
' *********** added by vochik
g_signal_connect_data(button, "clicked", exit_prog, 0, 0, 0)
' *********** end added by vovchik
gtk_widget_show_all(window)
gtk_main
' ***********
END SUB
' ***********
' ***********
' MAIN
' ***********
BacMain
' ***********
' END MAIN
' ***********
Peter
Hi Peter,PjotAwake wrote:Jpeps,
It makes sense as the programs in that 'bacon.tar.gz' package are also more than a year old.
So forget about them!
Please use the programs shipped by Puppy Linux, or the current programs hosted on the BaCon website.
As noted, the gtk demo from website also gave the error:
Code: Select all
~ $ bacon -v
BaCon version 1.0 build 19 - (c) Peter van Eerten - GPL v3.
~ $ sudo bacon ./gtk-server-new.bac
Starting conversion... done.
Starting compilation... done.
Program './gtk-server-new' ready.
~ $ ./gtk-server-new
ERROR: signal for SEGMENTATION FAULT received - memory invalid or array out of bounds? Try to compile the program with TRAP LOCAL to find the cause.
Works better, but doesn't get the battery object like the old demo:For fun I have adjusted the 'gtkabout1.bac' program so it compiles and runs with BaCon 1.0 build 19. Compare with the orignal one and you'll see the differences.
Here is the code:
(see attachment)
Code: Select all
~ $ sudo ./gtkabout2
(<unknown>:7908): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
Code: Select all
< DECLARE window, about, battery, image, rv TYPE long
< gtk_init(0, 0)
< window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
Code: Select all
< IMPORT "gtk_init" FROM "libgtk-x11-2.0.so" TYPE void
< IMPORT "gtk_init" FROM "libgtk-x11-2.0.so" TYPE void
< IMPORT "gtk_window_new" FROM "libgtk-x11-2.0.so" TYPE long
< IMPORT "gtk_widget_show_all" FROM "libgtk-x11-2.0.so" TYPE void
---
> IMPORT "gtk_init(int*,void*)" FROM "libgtk-x11-2.0.so" TYPE void
> IMPORT "gtk_window_new(int)" FROM "libgtk-x11-2.0.so" TYPE long
> IMPORT "gtk_widget_show_all(long)" FROM "libgtk-x11-2.0.so" TYPE void
While the topic is hot, I thought I'd ask about this one..
Program BOTD (aka BaCon On This Day) here http://www.basic-converter.org/botd.tar.gz
It compiles with new BaCon build nicely, but hangs here when run at this point
I really want to find out what happened then??
Cheers,
s
Program BOTD (aka BaCon On This Day) here http://www.basic-converter.org/botd.tar.gz
It compiles with new BaCon build nicely, but hangs here when run at this point
No error - just stops at this point.# ./botd 2 4
---------------------------------------------
On this day in history: 2 April
---------------------------------------------
The following events occurred:
---------------
I really want to find out what happened then??
Cheers,
s
auto download, compile and install BaCon and
download ,compile and test the 18 basic examples to get started easily and a means to update easily when new versions come out
this will take awhile but it does get you started correctly
*you must have bash 4 or later installed before running this script
it pre installed in TXZ_pup 450
@thanks mechanic for the speed tip bacon test1.bac
updated code to add Xdialog yes or no and broke the program up in two parts
maybe you want to kill all the wget downloads there's a bunch
Joe
UPDATED CODE 11-18-2010 to add syntax highlighting to make it more compact and easy to add more bac files
by using a list added bash version test
download ,compile and test the 18 basic examples to get started easily and a means to update easily when new versions come out
this will take awhile but it does get you started correctly
*you must have bash 4 or later installed before running this script
it pre installed in TXZ_pup 450
@thanks mechanic for the speed tip bacon test1.bac
updated code to add Xdialog yes or no and broke the program up in two parts
maybe you want to kill all the wget downloads there's a bunch
Code: Select all
pid=`ps aux| grep wget | awk '{print $2}'`&&kill -9 $pid
UPDATED CODE 11-18-2010 to add syntax highlighting to make it more compact and easy to add more bac files
by using a list added bash version test
Code: Select all
#!/bin/bash
# Joe Arose big_bass 11-18-2010
# call this auto-build-compile-bacon
# auto download compile install and test Bacon and the 18 basic examples
# so you can easily update when needed
# thanks "mechanic" for the speed tip using bacon instead of bacon.bash for compiling
# thanks seaside for the bash version test
# added syntax highlighting
BASHV=$(bash --version | head -1)
VN=$(echo $BASHV | cut -f1 -d. | sed 's/^.*\(.\)$/\1/')
[ $VN -lt 4 ] && Xdialog --title "bash version test " \
--infobox "\nBash Version Problem $BASHV installed
---------------> Bash must be version 4 or above for BaCon <-------------------" "\n" 0 0
# =====================================
# downoad ,compile and install BaCon
# =====================================
Xdialog --wrap --title "bacon instlaller" \
--yesno "Do you want to install bacon " 0 0
case $? in
0)
echo "Yes chosen."
rm -f bacon.bash*
rm -f bacon.bac*
rm -f bacon
xterm -geometry 40x30+150+40 -e wget http://www.basic-converter.org/bacon.bash
chmod a+x bacon.bash
xterm -geometry 40x30+150+40 -e wget http://www.basic-converter.org/bacon.bac
chmod a+x bacon.bac
xterm -geometry 40x30+150+40 -e ./bacon.bash bacon.bac
# copy bacon bin into the path
cp bacon /usr/sbin
Xdialog --title "Complete" \
--infobox "\nInstalling bacon has finished.\n" 0 0 3000
;;
1)
echo "No chosen."
exit
;;
255)
echo "Box closed."
exit
;;
esac
# =====================================
# syntax highlighting
# =====================================
#(0) download the file http://www.basic-converter.org/bacon.lang
xterm -geometry 40x30+150+40 -e wget http://www.basic-converter.org/bacon.lang
#(1) Create language directory for GtkSourceView:
mkdir -p ~/.local/share/gtksourceview-2.0/language-specs/
#(2) Copy this file to the new directory:
cp bacon.lang ~/.local/share/gtksourceview-2.0/language-specs/
#Now start gedit, Anjuta, Scribes etc and the BaCon sourcecode has
# syntax highlighting!
Xdialog --title "syntax highlighting" \
--infobox "\nsyntax highlighting has installed.\n" 0 0 3000
# =====================================
# download compile and test the 18 test files
# =====================================
Xdialog --wrap --title "test bac downloader" \
--yesno "Do you want to download the bac examples " 0 0
case $? in
0)
echo "Yes chosen."
###########################################
clean up old projects
rm -f /root/bacon-examples/test*
cat << 'EOF' >/tmp/basic-examples
test1.bac
test2.bac
test3.bac
test4.bac
test5.bac
test6.bac
test7.bac
test8.bac
test9.bac
test10.bac
test11.bac
test12.bac
test13.bac
test14.bac
test15.bac
test16.bac
test17.bac
test18.bac
EOF
mkdir -p /root/bacon-examples
cd /root/bacon-examples #note if not done it goes to root directory
MYURL="http://www.basic-converter.org/"
for i in `cat /tmp/basic-examples`
do xterm -geometry 40x30+150+40 -e wget -c $MYURL$i
xterm -geometry 40x30+150+40 -e bacon /root/bacon-examples/$i
Xdialog --title "testing compiler " \
--infobox "\n$i compiled with bacon .\n" 0 0 3000
BAC_BIN=`basename "$i" .bac`
xterm -hold -geometry 40x30+150+40 -e /root/bacon-examples/$BAC_BIN
done
;;
1)
echo "No chosen."
exit
;;
255)
echo "Box closed."
exit
;;
esac
Last edited by big_bass on Thu 18 Nov 2010, 14:17, edited 12 times in total.
BOTD
seaside wrote:While the topic is hot, I thought I'd ask about this one..
Program BOTD (aka BaCon On This Day) here http://www.basic-converter.org/botd.tar.gz
It compiles with new BaCon build nicely, but hangs here when run at this pointNo error - just stops at this point.# ./botd 2 4
---------------------------------------------
On this day in history: 2 April
---------------------------------------------
The following events occurred:
---------------
I really want to find out what happened then??
Cheers,
s
Replace the function CAT(STRING FileName$):
With:
Code: Select all
' --------------------
FUNCTION CAT(STRING FILENAME$)
' --------------------
LOCAL fileline$, txt$ TYPE STRING
IF FILEEXISTS(FILENAME$) THEN
OPEN FILENAME$ FOR READING AS catfile
WHILE NOT(ENDFILE(catfile)) DO
READLN fileline$ FROM catfile
txt$ = CONCAT$(txt$, fileline$, NL$)
WEND
CLOSE FILE catfile
END IF
RETURN CHOP$(txt$)
END FUNCTION
---------------------------------------------
On this day in history: 2 April
---------------------------------------------
The following events occurred:
---------------
2097
1792 : US Mint established
1952 : Bernard Ferdinand Lyot, French astronomer (coronagraph), dies
1958 : 18 km south of Taree, NSW, sealing of Pacific Highway between Sydney and Brisbane completed
---------------
The following persons were born:
---------------
2382
1725 : Giacomo Casanova, Italian writer (+1798)
1805 : Hans Christian Andersen, Danish writer (+1875)
1840 : Emile Zola, French author (+1902)
1914 : Sir Alec Guinness, actor
1926 : Sir Jack Brabham, Australian racing car driver
---------------------------------------------
All in all, a very interesting day.
regards,
mechanic
mechanic
BaCon binary is much faster than the BaCon script
Hi Joe, just a suggestion here. After you compile and install the bacon binary use it to compile the examples for a big speed increase.
The binary is MUCH faster than the bacon.bash file.
At this point the binary is installed and ready so use it for the tests.big_bass wrote:
xterm -geometry 40x30+150+40 -e ./bacon.bash bacon.bac
# copy bacon bin into the path
cp bacon /usr/sbin
Xdialog --title "Complete" \
--infobox "\nInstalling bacon has finished.\n" 0 0 3000
Code: Select all
bacon test1.bac
...
regards,
mechanic
mechanic
Hi jpeps,
Did you actually install GTK-server prior to running the BaCon program? Because for me this demo works fine.
Note that you will find actual GTK demo programs a little bit down below on the BaCon website.
BTW why are you using 'sudo'?
Regards
Peter
It seems you are referring to the GTK-server program? This is not a GTK demo, but a demo with the GTK-server.As noted, the gtk demo from website also gave the error:
~ $ sudo bacon ./gtk-server-new.bac
Starting conversion... done.
Starting compilation... done.
Program './gtk-server-new' ready.
~ $ ./gtk-server-new
ERROR: signal for SEGMENTATION FAULT received - memory invalid or array out of bounds? Try to compile the program with TRAP LOCAL to find the cause.
Did you actually install GTK-server prior to running the BaCon program? Because for me this demo works fine.
Note that you will find actual GTK demo programs a little bit down below on the BaCon website.
BTW why are you using 'sudo'?
Regards
Peter
ah...initially saw it in the gtk-demos dir of bacon.tar.gz, so thought it was independent.PjotAwake wrote:
It seems you are referring to the GTK-server program? This is not a GTK demo, but a demo with the GTK-server.
..just tried a few, everything working fine.Note that you will find actual GTK demo programs a little bit down below on the BaCon website.
As Barry says, it's like religion. I don't run in root. Thanks for the great work!BTW why are you using 'sudo'?
Hey mechanic
I took your suggestion and used it for the speed increase (to compile faster)
and updated the bacon auto install script a bit more
updated again to make code much more compact to read a list
this way adding the bac files you need in a snap
thanks
Joe
@Thank you Peter van Eerten
get started on the right foot
one of the little gotchas is just getting the .bac file without the html so this is
only the .bac file it will save as text hope its handy for some one
-------Demonstration programs---------------------------------------------
Base64 decoder http://www.basic-converter.org/b64dec.bac
The Zeller algorithm http://www.basic-converter.org/zeller.bac
UTF8 encoder http://www.basic-converter.org/utf8.bac
Simple calculator programhttp://www.basic-converter.org/calculator.bac
CGI demonstration http://www.basic-converter.org/cgi.bac
GTK-server demo http://www.basic-converter.org/gtk-server.bac
Brainfuck interpreter http://www.basic-converter.org/bf.bac
Respace files http://www.basic-converter.org/respace.bac
ROT13 encoder/decoder http://www.basic-converter.org/rot13.bac
Mastermind gamehttp://www.basic-converter.org/mastermind.bac
My favorite one liner http://www.basic-converter.org/hex.bac
Recursive http://www.basic-converter.org/fibonacci.bac and http://www.basic-converter.org/factorial.bac
Walk through a directory tree http://www.basic-converter.org/tree.bac
Generate prime numbers http://www.basic-converter.org/prime.bac
Generate m3u files http://www.basic-converter.org/m3u.bac
Convert decimal to Roman http://www.basic-converter.org/roman.bac
A Quine program http://www.basic-converter.org/quine.bac, an even smaller Quine http://www.basic-converter.org/quine2.bac, even smaller http://www.basic-converter.org/quine3.bac
DPI calculator http://www.basic-converter.org/dpicalc.bac created by Vovchik
A simple GOPHER client http://www.basic-converter.org/gopher.bac
System boot time http://www.basic-converter.org/bootime.bac
Binary file dumper http://www.basic-converter.org/bindump.bac
BaCon Bullshit Bingo http://www.basic-converter.org/bbb.tar.gz created by Vovchik
Password generator http://www.basic-converter.org/bpwgen.bac created by Vovchik
Testing randomness program http://www.basic-converter.org/prob.bac created by Vovchik
The Soundex algorithm http://www.basic-converter.org/soundex.bac created by Vovchik
The Metaphone algorithm http://www.basic-converter.org/metaphone.bac created by Vovchik
The Double Metaphone algorithm http://www.basic-converter.org/dbl-metaphone.bac created by Vovchik
BaCon On This Day http://www.basic-converter.org/botd.tar.gz created by Vovchik
Calculate netmask http://www.basic-converter.org/netmask.bac
Console sinus waves http://www.basic-converter.org/sinus.bac
Check remote site http://www.basic-converter.org/network.bac modified version http://www.basic-converter.org/bing.bac by Vovchik
Get the weather http://www.basic-converter.org/bweather.bac created by Vovchik
Benchmark program for http://www.basic-converter.org/benchmark.bac
Binary downloads http://www.basic-converter.org/download.bac
Simple BaCon Shell http://www.basic-converter.org/shell.bac
Some goniometric functions http://www.basic-converter.org/trig.bac created by Vovchik
User contributions
STRCMP function http://www.basic-converter.org/strcmp.bac
I took your suggestion and used it for the speed increase (to compile faster)
and updated the bacon auto install script a bit more
updated again to make code much more compact to read a list
this way adding the bac files you need in a snap
thanks
Joe
@Thank you Peter van Eerten
get started on the right foot
one of the little gotchas is just getting the .bac file without the html so this is
only the .bac file it will save as text hope its handy for some one
-------Demonstration programs---------------------------------------------
Base64 decoder http://www.basic-converter.org/b64dec.bac
The Zeller algorithm http://www.basic-converter.org/zeller.bac
UTF8 encoder http://www.basic-converter.org/utf8.bac
Simple calculator programhttp://www.basic-converter.org/calculator.bac
CGI demonstration http://www.basic-converter.org/cgi.bac
GTK-server demo http://www.basic-converter.org/gtk-server.bac
Brainfuck interpreter http://www.basic-converter.org/bf.bac
Respace files http://www.basic-converter.org/respace.bac
ROT13 encoder/decoder http://www.basic-converter.org/rot13.bac
Mastermind gamehttp://www.basic-converter.org/mastermind.bac
My favorite one liner http://www.basic-converter.org/hex.bac
Recursive http://www.basic-converter.org/fibonacci.bac and http://www.basic-converter.org/factorial.bac
Walk through a directory tree http://www.basic-converter.org/tree.bac
Generate prime numbers http://www.basic-converter.org/prime.bac
Generate m3u files http://www.basic-converter.org/m3u.bac
Convert decimal to Roman http://www.basic-converter.org/roman.bac
A Quine program http://www.basic-converter.org/quine.bac, an even smaller Quine http://www.basic-converter.org/quine2.bac, even smaller http://www.basic-converter.org/quine3.bac
DPI calculator http://www.basic-converter.org/dpicalc.bac created by Vovchik
A simple GOPHER client http://www.basic-converter.org/gopher.bac
System boot time http://www.basic-converter.org/bootime.bac
Binary file dumper http://www.basic-converter.org/bindump.bac
BaCon Bullshit Bingo http://www.basic-converter.org/bbb.tar.gz created by Vovchik
Password generator http://www.basic-converter.org/bpwgen.bac created by Vovchik
Testing randomness program http://www.basic-converter.org/prob.bac created by Vovchik
The Soundex algorithm http://www.basic-converter.org/soundex.bac created by Vovchik
The Metaphone algorithm http://www.basic-converter.org/metaphone.bac created by Vovchik
The Double Metaphone algorithm http://www.basic-converter.org/dbl-metaphone.bac created by Vovchik
BaCon On This Day http://www.basic-converter.org/botd.tar.gz created by Vovchik
Calculate netmask http://www.basic-converter.org/netmask.bac
Console sinus waves http://www.basic-converter.org/sinus.bac
Check remote site http://www.basic-converter.org/network.bac modified version http://www.basic-converter.org/bing.bac by Vovchik
Get the weather http://www.basic-converter.org/bweather.bac created by Vovchik
Benchmark program for http://www.basic-converter.org/benchmark.bac
Binary downloads http://www.basic-converter.org/download.bac
Simple BaCon Shell http://www.basic-converter.org/shell.bac
Some goniometric functions http://www.basic-converter.org/trig.bac created by Vovchik
User contributions
STRCMP function http://www.basic-converter.org/strcmp.bac
Last edited by big_bass on Wed 17 Nov 2010, 14:39, edited 3 times in total.
Screen size
Dear Puppians,
I banged this together to demonstrate how you you can use GDK/GTK libs in a CLI program in BaCon to obtain, for instance, the size of the display.
With kind regards,
vovchik
PS. Nice work, Joe.
PPS. Source and binary are in the attached archive.
I banged this together to demonstrate how you you can use GDK/GTK libs in a CLI program in BaCon to obtain, for instance, the size of the display.
Code: Select all
' *************************************************************
' PROGRAM: screensize.bac
' PURPOSE: get X screen size in pixels from default display
' AUTHOR: vovchik (Puppy Linux forum)
' COMMENTS: GPL
' DEPENDS: bacon 1.0 build 0.19, gtk, gdk libs
' PLATFORM: Linux (actually, any *nix)
' DATE: 03-10-2010
' VERSION: 0.1a
' *************************************************************
' *********************
' DEF ERROR HANDER
' *********************
TRAP LOCAL
CATCH GOTO PRINT_ERROR
' *********************
' END DEF ERROR HANDER
' *********************
' *********************
' CONSTANTS
' *********************
CONST Gtk$ = "libgtk-x11-2.0.so.0"
CONST Gdk$ = "libgdk-x11-2.0.so.0"
' *********************
' END CONSTANTS
' ********************
' *********************
' DECLARATIONS
' *********************
DECLARE MyScreen$ TYPE STRING
' *********************
' END DECLARATIONS
' *********************
' *********************
' IMPORTS
' *********************
IMPORT "gtk_init(int*,void*)" FROM Gtk$ TYPE void
IMPORT "gtk_exit(int)" FROM Gtk$ TYPE void
IMPORT "gtk_window_get_size(long,int*,int*)" FROM Gtk$ TYPE void
IMPORT "gdk_screen_get_default" FROM Gdk$ TYPE long
IMPORT "gdk_screen_get_width(long)" FROM Gdk$ TYPE int
IMPORT "gdk_screen_height(long)" FROM Gdk$ TYPE int
' *********************
' END IMPORTS
' *********************
' *********************
' FUNCTIONS
' *********************
' ------------------
FUNCTION SCREENSIZE(NUMBER mode)
' ------------------
' mode = 0 returns x (width)
' mode = 1 returns y (height)
' mode = 2 returns space-delimited x (width) and y (height)
' otherwise function returns error message
LOCAL x, y TYPE int
LOCAL myresult$ TYPE STRING
y = gdk_screen_height(gdk_screen_get_default())
x = gdk_screen_get_width(gdk_screen_get_default())
SELECT mode
CASE 0
myresult$ = STR$(x)
CASE 1
myresult$ = STR$(y)
CASE 2
myresult$ = CONCAT$(STR$(x), " ", STR$(y))
DEFAULT
myresult$ = CONCAT$("Error: SCREENSIZE(", STR$(mode), ") mode is bad: 0 = w, 1 = h and 2 = h and w.")
END SELECT
RETURN CHOP$(myresult$)
END FUNCTION
' *********************
' END FUNCTIONS
' *********************
' *********************
' MAIN
' *********************
gtk_init(0, 0)
MyScreen$ = SCREENSIZE(0)
PRINT MyScreen$
MyScreen$ = SCREENSIZE(1)
PRINT MyScreen$
MyScreen$ = SCREENSIZE(2)
PRINT MyScreen$
MyScreen$ = SCREENSIZE(3)
PRINT MyScreen$
gtk_exit(0)
END
' *********************
' END MAIN
' *********************
' *********************
' ERROR HANDLER
' *********************
LABEL PRINT_ERROR
PRINT "GTK library ", Gtk$, " is not available on this platform!"
END
' *********************
' END ERROR HANDLER
' *********************
vovchik
PS. Nice work, Joe.
PPS. Source and binary are in the attached archive.
- Attachments
-
- screensize-src.tar.gz
- (10.88 KiB) Downloaded 449 times