Page 3 of 27

Posted: Sat 06 Nov 2010, 21:14
by smokey01
Lobster, would the space between the dot and the c be the problem?

BaCon 101

Posted: Sun 07 Nov 2010, 14:17
by mechanic
BaCon 101

Download the source:

http://www.basic-converter.org/bacon.bac

If you don't have a compiled bacon executable, also download this:

http://www.basic-converter.org/bacon.bash

Open a terminal in the download folder and type:

Code: Select all


./bacon.bash bacon.bac

When it finishes you will have a bacon executable, place in the /usr/bin/ or /usr/local/bin/ folder.

Now to translate/compile a *.bac file just do:

Code: Select all


bacon yourfile.bac

See the docs here:

http://www.basic-converter.org/documentation.html

You should be good to go!

Anytime you download a new version, you'll have to do recompile the bacon source using the old bacon executable. Unless Peter adds something new that breaks the old version this will work. Otherwise you'll need to get the bacon.bash version and compile the new bacon executable with it. Peter always releases new versions of both at the same time so this should always work.

HTH

Posted: Sun 07 Nov 2010, 14:59
by Lobster
Thanks guys. You may have saved my bacon.

Oink Oink

Posted: Sun 07 Nov 2010, 16:52
by amigo
Be sure and bring some of that bacon home.

Posted: Sun 07 Nov 2010, 17:20
by Mobeus
Hi guys,

bacon-bash needs bash 4. Here is the bacon-1.19 binary that I use in lupu if anyone needs it. It goes in /usr/bin and does not need bash 4.

Posted: Sun 07 Nov 2010, 19:58
by Mobeus
I think BaCon is the Puppy Linux programming language I've been looking for years for. I rebuilt my GTK Firewall_Genie using BaCon instead of Genie/vala. Take a look at this these dependencies!

Bacon

Code: Select all

 # ldd ./Firewall_Genie
	linux-gate.so.1 =>  (0xffffe000)
	libm.so.6 => /lib/libm.so.6 (0xb7807000)
	libdl.so.2 => /lib/libdl.so.2 (0xb7803000)
	libc.so.6 => /lib/libc.so.6 (0xb76b9000)
	/lib/ld-linux.so.2 (0xb782f000) 
Genie

Code: Select all

# ldd ./Firewall_Genie
	linux-gate.so.1 =>  (0xffffe000)
	libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0xb74f1000)
	libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0xb74ca000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb7453000)
	libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb7423000)
	libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0xb7407000)
	libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0xb7371000)
	libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0xb7357000)
	libm.so.6 => /lib/libm.so.6 (0xb7330000)
	libgio-2.0.so.0 => /usr/lib/libgio-2.0.so.0 (0xb7292000)
	libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0xb7286000)
	libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0xb7243000)
	libcairo.so.2 => /usr/lib/libcairo.so.2 (0xb71c9000)
	libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb7189000)
	libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb7183000)
	libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb717e000)
	librt.so.1 => /lib/librt.so.1 (0xb7175000)
	libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0xb70ab000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb7092000)
	libc.so.6 => /lib/libc.so.6 (0xb6f49000)
	libX11.so.6 => /usr/lib/libX11.so.6 (0xb6e2c000)
	libXcomposite.so.1 => /usr/lib/libXcomposite.so.1 (0xb6e28000)
	libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0xb6e24000)
	libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0xb6e1e000)
	libz.so.1 => /lib/libz.so.1 (0xb6e08000)
	libexpat.so.1 => /lib/libexpat.so.1 (0xb6de1000)
	libXext.so.6 => /usr/lib/libXext.so.6 (0xb6dd1000)
	libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb6dc7000)
	libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0xb6dc3000)
	libXi.so.6 => /usr/lib/libXi.so.6 (0xb6db4000)
	libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0xb6dac000)
	libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0xb6da2000)
	/lib/ld-linux.so.2 (0xb78c8000)
	libdl.so.2 => /lib/libdl.so.2 (0xb6d9e000)
	libpcre.so.3 => /lib/libpcre.so.3 (0xb6d6d000)
	libresolv.so.2 => /lib/libresolv.so.2 (0xb6d58000)
	libselinux.so.1 => /lib/libselinux.so.1 (0xb6d3d000)
	libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0xb6ce3000)
	libdirectfb-1.2.so.0 => /usr/lib/libdirectfb-1.2.so.0 (0xb6c6c000)
	libfusion-1.2.so.0 => /usr/lib/libfusion-1.2.so.0 (0xb6c62000)
	libdirect-1.2.so.0 => /usr/lib/libdirect-1.2.so.0 (0xb6c4b000)
	libpng12.so.0 => /lib/libpng12.so.0 (0xb6c26000)
	libxcb-render-util.so.0 => /usr/lib/libxcb-render-util.so.0 (0xb6c21000)
	libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0xb6c19000)
	libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb6bff000)
	libXau.so.6 => /usr/lib/libXau.so.6 (0xb6bfa000)
	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb6bf4000)
 
8)

Posted: Sun 07 Nov 2010, 21:32
by seaside
Mobeus wrote:I think BaCon is the Puppy Linux programming language I've been looking for years for. I rebuilt my GTK Firewall_Genie using BaCon instead of Genie/vala. Take a look at this these dependencies!

Mobeus,

Wow, that is just amazing and let me be sure I understand the differences. The first binary was built with Genie/vala and the second was re-written in Basic and then converted with Bacon and compiled.

Any perceptible execution speed differences as well?

Cheers,
s

Posted: Sun 07 Nov 2010, 22:01
by BarryK
Guys,
I have it on my to-do list to play a bit with BaCon!

To that end, I put BaCon in the 'devx' sfs in Wary and Quirky. The BaCon compiler is a compiled binary, so does not need Bash4. But of course, to compile BaCon I had to install Bash4 -- and the Puppy Package Manager has a Bash4 PET package, in case you want it.

The latest Wary, 0.9.6, has BaCon 1.0.17.

The 'devx' sfs also has documentation:

/usr/share/BaCon/documentation.pdf.

Wary Puppy:
http://bkhome.org/blog/?viewCat=Wary

a little notify demo

Posted: Sun 07 Nov 2010, 22:05
by vovchik
Dear Puppians,

This is a little demo of a scrolling notify box with markup. I still have to remove a few HUG dependencies to reduce the binary size and to add geometry and duration to the passed argument list for more user control. Have a look. I, too, think BaCon is great and easy. Doyle is working on simplifying some of the GTK calls and Peter is improving BaCon regularly. The attached archive includes source and a binary.

With kind regards,
vovchik

PS. Mark's GTKbasic interpreter is also very good for scripting with guis. You just have to get used to it.

Posted: Sun 07 Nov 2010, 22:37
by Mobeus
seaside

Yes that’s pretty much it. The gui is a gtkbuilder glade file in Genie. In BaCon I changed the gtkbuilder glade file to be just glade, then ran it through Doyles mkglade utility to generate the application skeleton (which does away with the separate glade file) then just compiled it with BaCon after adding my other code. The final binary is about the same size and I see no loss of speed at all. I wonder if those dependencies are entirely accurate though, since it does require gtk2.

If this forum had a 'dancing with joy' emoticon you would see one here :D

Posted: Sun 07 Nov 2010, 23:08
by 2lss
Does anybody out there have bacon syntax highlighting configuration file for Geany? (the GtkSourceView file from the main site does not work).

If not I will take a stab at creating one.

geany config file for bacon

Posted: Sun 07 Nov 2010, 23:21
by vovchik
Dear 2lss,

I didn't actually create a separate BaCon one, but about half a year ago I included BaCon keywords in the FreeBasic file. Here it is. In the meantime, Peter has added some statements and functions, so, if you want to have a go, please do. My freebasic/bacon geany file is attached. If you download Peter's tiny Basic IDE and compile it and start it, it will update the GTKSourceview file automatically from Peter's site.

With kind regards,
vovchik

better bac-notify example

Posted: Mon 08 Nov 2010, 11:12
by vovchik
Dear Puppians,

Try out the code below with bac-notify. It shows what can be done more clearly than the example included in the archive.

Code: Select all

#!/bin/bash

# Note: when passing a span string containing double quotes,
# be sure to escape the quotes with a backslash (\). Also, use
# the pipe character (|) # for generating a newline.
# If you don't have a font specified in a span command
# installed on your system, GTK will use your default font
# (e.g. 1960s Hippie in the first $mytext below will display as DejaVu Sans). 

# grab start time
before=`date +%s`

# This is the first string to display via bac-notify

mytext="Hi there!|
<span weight=\"ultrabold\" color=\"red\" font-family=\"1960s Hippie\" size=\"xx-large\">
This is <u>BIG RED</u> text
</span>
|and <i>this</i> is <u>another</u> line...|
<span weight=\"ultrabold\" color=\"blue\">
passed to <big>bac-notify</big> via bash.
</span>"

# OK, let's display the first string

./bac-notify "$mytext" &
echo "bac-notify launched..."


# Wait a bit
sleep 5

# OK, now the second string

mytext="This is a second message!|
<span weight=\"ultrabold\" color=\"#2A8F15\" font-family=\"DejaVu Serif\" size=\"xx-large\">
The notifications will <u>be overlaid</u>
</span>
|and placed <i>on top of</i> one <u>another</u>...|
<span weight=\"ultrabold\" color=\"#A3120D\" size=\"xx-large\">
Blood Red is GROOVY, isn't it<big>!?</big>
</span>"

./bac-notify "$mytext" &
echo "bac-notify launched..."

# Wait a bit
sleep 5

# OK, now the third string

mytext="<small>
<span font-family=\"DejaVu Sans Mono\">
BaCon is a free BASIC to C converter for Unix-based systems.|
The following design goals were followed:|
    * Must run on each Unix/Linux/BSD platform, including MacOSX|
    * Converted sourcecode must be compilable with GCC|
    * Must resemble genuine BASIC with implicit variable delarations|
    * Spoken language constructs are preferred|
To use Bacon your system must have the Korn Shell or Bourne Shell.
</span></small>"

./bac-notify "$mytext" &
echo "bac-notify launched..."

# Wait a bit
sleep 5

# OK, now the fourth string

mytext="
<span font-family=\"DejaVu Sans\" weight=\"ultrabold\" color=\"red\" size=\"xx-large\">
       CONGRATULATIONS!|
</span>
<span style=\"oblique\" color=\"blue\">
You have just successfully downloaded the entire content|
of all websites indexed by Google to your USB stick :)
</span>"

./bac-notify "$mytext" &
echo "bac-notify launched..."

# Wait a bit
sleep 5

# grab end time
after=`date +%s`
elapsed_seconds=`expr $after - $before + 5`

# Finally, the fifth and last string

mytext="<span weight=\"ultrabold\" color=\"blue\" font-family=\"DejaVu Sans\" size=\"xx-large\">
  BYE-BYE</span>|
<b><big>from bac-notify...</big></b>|
Demo time: $elapsed_seconds seconds"


./bac-notify "$mytext" &
echo "bac-notify launched..."

exit 0
With kind regards,
vovchik

Posted: Mon 08 Nov 2010, 13:27
by BarryK
2lss wrote:Does anybody out there have bacon syntax highlighting configuration file for Geany? (the GtkSourceView file from the main site does not work).

If not I will take a stab at creating one.
Geany does not use Gtksourceview, but NicoEdit does. Many Puppies have NicoEdit built-in, or it is a PET that you can install with the package manager.

Wary and Quirky have NicoEdit, and the BaCon highlighter file.
Except, on latest Wary we have a problem with NicoEdit crashing.

Posted: Mon 08 Nov 2010, 22:56
by 2lss
Thanks vovchik and BarryK for your suggestions.

I gave nicoedit a try but for some reason the syntax highlighting does not want to work for bacon. (works ok for c, xml, etc)

I copied bacon.lang to /use/share/gtksourceview-2.0/language-specs and then ran "check.sh" on it, which said "bacon.lang validates."

I'm also getting a gtksourceview related error when I start Nicoedit (regardless of the extension)

Code: Select all

(nicoedit:18591): GtkSourceView-CRITICAL **: gtk_source_language_manager_get_language: assertion `id != NULL' failed
I don't think the problem is the bacon.lang file since it works for me in gEdit on Ubuntu. (using puppeee 4.3 now)


Anyway, I'm going to give vovchik's file a go and see what I can come up with

nicoedit and bacon

Posted: Mon 08 Nov 2010, 23:09
by vovchik
Dear 2lss,

I tried the same today - to get nicoedit to recognize the BaCon lang file and failed. I copied it to the location where nicoedit keeps its lang files and could not find any other nicoedit config file where lang files would be listed. I was also too lazy to look at the nicoedit source. So, I am back to geany.

With kind regards,
vovchik

PS. Peter's little bacon-IDE has great potential here. It would need tabs (and multiple buffers), command-line arguments, comment/uncomment code, indent/unindent and search/replace. Anybody willing to take on the task?

Better version of bac-notify

Posted: Mon 08 Nov 2010, 23:38
by vovchik
Dear Puppians,

Here is an improved version of bac-notify. It doesn't flicker and you can now kill a popup window immediately with a mouse click, thanks to Peter, who added a bit to the code.

With kind regards,
vovchik

Posted: Tue 09 Nov 2010, 12:50
by BarryK
2lss wrote:Thanks vovchik and BarryK for your suggestions.

I gave nicoedit a try but for some reason the syntax highlighting does not want to work for bacon. (works ok for c, xml, etc)

I copied bacon.lang to /use/share/gtksourceview-2.0/language-specs and then ran "check.sh" on it, which said "bacon.lang validates."

I'm also getting a gtksourceview related error when I start Nicoedit (regardless of the extension)

Code: Select all

(nicoedit:18591): GtkSourceView-CRITICAL **: gtk_source_language_manager_get_language: assertion `id != NULL' failed
I don't think the problem is the bacon.lang file since it works for me in gEdit on Ubuntu. (using puppeee 4.3 now)


Anyway, I'm going to give vovchik's file a go and see what I can come up with
I have just tried it in Wary. The file bacon.lang is already present.

Running direct from commandline:

# nicoedit demo.bac

...and it comes up syntax highlighted.

Start nicoedit, choose File -> Open to open demo.bac, I also get syntax highlighting.

However, looking in View -> Coloration mode, it lists as "Text". It seems that the source code of nicoedit needs to be modified to include BaCon in the list.

But apart from that, I do get syntax highlighting.

Posted: Tue 09 Nov 2010, 13:55
by ttuuxxx
If you go t o the link below it explains how to add bacon to gtksourceview

http://www.allbasic.info/mboard/index.p ... opic=888.0

ttuuxxx

Posted: Thu 11 Nov 2010, 13:59
by ttuuxxx
compiled the latest bacon bin for 2.14X and added the bacon TinyIde to the package
http://www.murga-linux.com/puppy/viewto ... 156#466156
:) until I get/workout the updates for geany
ttuuxxx