Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 29 Aug 2014, 06:19
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
BaCon - Bash-based Basic-to-C converter/compiler
Post new topic   Reply to topic View previous topic :: View next topic
Page 4 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, ..., 34, 35, 36 Next
Author Message
smokey01


Joined: 30 Dec 2006
Posts: 1805
Location: South Australia

PostPosted: Sat 06 Nov 2010, 17:14    Post subject:  

Lobster, would the space between the dot and the c be the problem?
_________________
Puppy Software <-> Distros <-> Puppy Linux Tips
Back to top
View user's profile Send private message Visit poster's website 
mechanic

Joined: 12 Apr 2009
Posts: 29

PostPosted: Sun 07 Nov 2010, 10:17    Post subject: BaCon 101
Subject description: or how to get started with BaCon
 

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:


./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:


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

_________________
regards,
mechanic
Back to top
View user's profile Send private message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Sun 07 Nov 2010, 10:59    Post subject:  

Thanks guys. You may have saved my bacon.

Oink Oink

_________________
Puppy WIKI
Back to top
View user's profile Send private message Visit poster's website 
amigo

Joined: 02 Apr 2007
Posts: 2236

PostPosted: Sun 07 Nov 2010, 12:52    Post subject:  

Be sure and bring some of that bacon home.
Back to top
View user's profile Send private message 
Mobeus


Joined: 26 Aug 2010
Posts: 94

PostPosted: Sun 07 Nov 2010, 13:20    Post subject:  

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.
bacon-1.19.tar.gz
Description 
gz

 Download 
Filename  bacon-1.19.tar.gz 
Filesize  90.78 KB 
Downloaded  319 Time(s) 

_________________
/root for the home team
Back to top
View user's profile Send private message 
Mobeus


Joined: 26 Aug 2010
Posts: 94

PostPosted: Sun 07 Nov 2010, 15:58    Post subject:  

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:
 # 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:
# 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)
 

Cool

_________________
/root for the home team
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Sun 07 Nov 2010, 17:32    Post subject:  

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
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Sun 07 Nov 2010, 18:01    Post subject:  

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

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sun 07 Nov 2010, 18:05    Post subject: a little notify demo  

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.
bac-notify-src.tar.gz
Description 
gz

 Download 
Filename  bac-notify-src.tar.gz 
Filesize  32.51 KB 
Downloaded  342 Time(s) 
Back to top
View user's profile Send private message 
Mobeus


Joined: 26 Aug 2010
Posts: 94

PostPosted: Sun 07 Nov 2010, 18:37    Post subject:  

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 Very Happy

_________________
/root for the home team
Back to top
View user's profile Send private message 
2lss

Joined: 20 Sep 2009
Posts: 225

PostPosted: Sun 07 Nov 2010, 19:08    Post subject:  

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.
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sun 07 Nov 2010, 19:21    Post subject: geany config file for bacon  

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
filetypes.freebasic.tar.gz
Description 
gz

 Download 
Filename  filetypes.freebasic.tar.gz 
Filesize  2.48 KB 
Downloaded  302 Time(s) 
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 08 Nov 2010, 07:12    Post subject: better bac-notify example  

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:
#!/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

Last edited by vovchik on Mon 08 Nov 2010, 09:41; edited 1 time in total
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Mon 08 Nov 2010, 09:27    Post subject:  

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.

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
2lss

Joined: 20 Sep 2009
Posts: 225

PostPosted: Mon 08 Nov 2010, 18:56    Post subject:  

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:
(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
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 4 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, ..., 34, 35, 36 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1114s ][ Queries: 12 (0.0094s) ][ GZIP on ]