BaCon - Bash-based Basic-to-C converter/compiler

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#421 Post by sunburnt »

Installed the latest Puppy528-3 so Firefox could have a working Flash player.

As usual, BaCon doesn`t work in the new install.
I need to write another setup script to get it running for every new Save file.

Error:

Code: Select all

Symbol not found in library /usr/share/BaCon/hug.so: undefined symbol: METHOD
hug.so has the METHOD function in it of course...

### Also I posted about getting mouse info. 2 posts above here.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#422 Post by vovchik »

Dear Terry,

I know it slows the compile/debug process, but I just use hug.bac as an INCLUDE for everything. Later I go and determine which functions I use from the HUG lib. That way I never run in to your type of problem - where the system may have an old hug.so or can't find the right one. And if you have a working BaCon or BaConGui, the program with the hug.bac INCLUDE will compile. Later you can make your hug.so and recompile, once you know that everything is working.

With kind regards,
vovchik

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#423 Post by sunburnt »

I replaced /usr/lib/hug.so with a link to the newer hug.so
Barry should make /usr/lib/hug.so a link to /root/my-applications/lib/hug.so

Puppy`s Save file is it`s biggest problem, it corrupts occasionally.
So I replaced the dirs. my-applications and my-documents with links to /apps and /docs dirs. on a partition so nothing`s lost.
Keep a backup Save file, to restore just copy it over the old one.

This should be a menu item, to make a gzip backup Save file, and have an option to restore it at the bootup menu.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

New HUG with sliders

#424 Post by vovchik »

Dear puppians,

Peter has just posted a new HUG (0.66) that now has support for vscale and hscale sliders. If you want to use these widgets, please download the latest HUG http://www.basic-converter.org/hug.bac. The documentation will be updated in due course.

With kind regards,
vovchik

User avatar
GatorDog
Posts: 138
Joined: Tue 12 Sep 2006, 16:43

#425 Post by GatorDog »

vovchik,

Thanks for update :D

gatordog
Image

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#426 Post by vovchik »

Dear puppians,

Here is a little demo to show how to use the new slider widgets, done some time ago by 2lss and modded by me a bit:

Code: Select all

' ************************
' INCLUDES
' ************************

' INCLUDE ../hug-slider.bac

INCLUDE "hug.bac", ATTACH, CALLBACK, \
	DISPLAY, ENTRY, GET, HUGOPTIONS, \
	INIT, SET, \
	TEXT, WINDOW, HUGLIB$, HSLIDE, VSLIDE

' ************************
' END INCLUDES
' ************************


' ************************
' SUBS & FUNCTIONS
' ************************

' -----------------
SUB update_hslide_entry()
' -----------------
    num = GET(hslide)
    TEXT(hentry, STR$(num))
END SUB

' -----------------
SUB update_vslide_entry()
' -----------------
    num = GET(vslide)
    TEXT(ventry, STR$(num))
END SUB

' -----------------
SUB make_gui()
' -----------------
	HUGOPTIONS("TABLE 20 20")
	win = WINDOW("Hug Slide Test", 300, 300)
	hslide = HSLIDE(12, 3, 1, 20, 1)
	ATTACH(win, hslide, 1, 1)
	SET(hslide, 5)
	vslide = VSLIDE(3, 12, 1, 30, 2)
	ATTACH(win, vslide, 15, 1)
	SET(vslide, 10)
	hentry = ENTRY(STR$(GET(hslide)), 2, 2)
	ATTACH(win, hentry, 4, 6)
	ventry = ENTRY(STR$(GET(vslide)), 2, 2)
	ATTACH(win, ventry, 15, 14)
	CALLBACK(hslide, update_hslide_entry)
	CALLBACK(vslide, update_vslide_entry)
END SUB

' ************************
' END SUBS & FUNCTIONS
' ************************


' ************************
' MAIN
' ************************

' Start hug
INIT
' Make gui
make_gui
' Show gui
DISPLAY

' ************************
' END MAIN
' ************************
With kind regards,
vovchik

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#427 Post by sunburnt »

I`m writing a function file to do file I/O for text and arrays.

Strange problem with writing an array to a file.

Code: Select all

SUB OUTARRAY(STRING Txt$[Size], int Size)
	OPEN File$ FOR WRITING AS file
	FOR i = 0 TO Size-1
		WRITELN Txt$[i] TO file
	NEXT
	CLOSE FILE file
END SUB
Error is: Cause: 'Size' undeclared here (not in a function)
It looks like the Size needs to be declared in the SUB.
If so, then passing an array to a SUB can`t be done.

The Bacon docs say the array dimension isn`t needed to pass it to a SUB.
But that errors saying:
ERROR: cannot pass string array without dimension at line 54 in file 'test_FileIO.bac'!
So you can pass a numerical array without a dimension, but not a string array?
If that`s the case, then the Bacon docs should mention that little detail...
.

User avatar
Mobeus
Posts: 94
Joined: Thu 26 Aug 2010, 15:49

#428 Post by Mobeus »

Some of you may find this interesting so I thought it deserves a post here.
I just had an educational experience over at the BaCon forum http://basic-converter.proboards.com/in ... thread=254

BaCon can use gtkbuilder with *.glade files in Puppy!
/root for the home team

User avatar
Mobeus
Posts: 94
Joined: Thu 26 Aug 2010, 15:49

#429 Post by Mobeus »

In Wary 5.3 you cannot use a compile command like

Code: Select all

bacon -o -export-dynamic -o `pkg-config --cflags --libs gtk+-2.0` test.bac 
You will get an error of

Code: Select all

/usr/lib/gcc/i486-t2-linux-gnu/4.3.4/../../../../i486-t2-linux-gnu/bin/ld: cannot find -lfontconfig
collect2: ld returned 1 exit status 
You can work around this by echoing the command and copying the output to a bash script, then use the script to compile with. This is what I am using.

Code: Select all

#! /bin/bash

bacon -o -export-dynamic -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/X11R7/include/pixman-1 -I/usr/X11R7/include -pthread -L/usr/X11R7/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lm -lcairo -lpng12 -lpango-1.0 -lfreetype -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 test.bac 
Everything after -export-dynamic up to the test.bac file name is the output from `pkg-config --cflags --libs gtk+-2.0` with the offending -lfontconfig removed. You could also remove some unnecessary linkage this way.

Regards
/root for the home team

User avatar
linuph
Posts: 128
Joined: Mon 04 Jun 2012, 02:29
Location: Philippines

#430 Post by linuph »

Running Dpup Exprimo 5.X.3.4.12

I'm a bit stuck with Bacon.... I wrote a screensaver (see http://www.murga-linux.com/puppy/viewto ... start=1275) more as an exercise than an useful project. But it got me underway. Thus motivated, I started on a more complex project concerning GPS.
I use a Bluetooth GPS module. I connect to it with 'rfcomm /dev/rfcomm 0 > pipe &' in BASH. Then I read the GPS data from the other end of the pipe.
In Bacon it should be, as I understand it 'SYSTEM "rfcomm /dev/rfcomm0 > pipe &". But it cannot connect ('host is down') while in BASH (terminal) all is OK.

I registered with the BACON forum 2-3 weeks ago but sofar no reply. I hope someone here can help and give me some pointers?

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#431 Post by vovchik »

Dear linuph,

I haven't seen any questions from you on the Bacon forum. Please try there and post your source code. People will advise or suggest things. Lots of helpful people there....like here.

With kind regards,
vovchik

User avatar
linuph
Posts: 128
Joined: Mon 04 Jun 2012, 02:29
Location: Philippines

#432 Post by linuph »

@vovchik

I registered on 31 October at Proboards but cannot access. It awaits confirmation by an administrator since then....

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#433 Post by vovchik »

Dear linuph,

I cannot understand why your registration failed. BaCon's author, Peter van Eerten, allows everybody except spammers, so I don't think he has blocked your registration. Try again. It is a good place to see code and to get advice from many people doing BaCon projects.

http://basic-converter.proboards.com/

With kind regards,
vovchik

PS. You may want to do this using another handle, since there may have been a previous "linuph", and not you.

User avatar
e_mattis
Posts: 114
Joined: Fri 21 Dec 2012, 02:24
Location: Williamston, SC
Contact:

BaCon Help!

#434 Post by e_mattis »

Hey all,

I decided to try out BaCon and see if I can write some programs that I need so I can run them on Puppy rather than the M$-crap. I started reading what I could to find out how to set it up and get it started on Precise 5.4.3. I followed the tutorial here http://bkhome.org/bacon/gettingstarted.htm.

Wrote the program in leafpad, downloaded the devx.sfs, opened the term, made sure I was in the correct directory, entered 'bacon demo.bac' and got an error - "could not parse line 1 in file 'demo.bac'"

Did I miss something? Do I need to "turn on" something? Totally lost as to why it would not parse.

Any help appreciated!

Thanks!

E

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#435 Post by sunburnt »

Hi e_mattis; What was line one in the file? Better yet, post the file here.

It seems like you have the needed BaCon and system files installed.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#436 Post by vovchik »

Dear e_mattis,

If you typed in Barry's example, I have a suspicion you included the line numbers. They should not be there. That is just a screenshot of Barry's editor, which is showing line numbers as a convenience to the programmer. BaCon does not use them!

With kind regards,
vovchik

User avatar
e_mattis
Posts: 114
Joined: Fri 21 Dec 2012, 02:24
Location: Williamston, SC
Contact:

#437 Post by e_mattis »

Hey guys, thanks for responding. :D

@ sunburnt

First line is a REM statement. Also removed it and tried to compile again, same error. The program is the demo from the 'getting started' tutorial. it follows:

Rem first test
Global c TYPE chat

a=125.6
e=345
b$="the big black dog"
print b$;
print a
print"a=",a," b=",b$ (as written in example instead of "a= ";a;" b= ";b$)

c='z'
print c,b$,a,e,Format :%c :s :%f %d\n"



@vovchik

It is Barry's example, didn't use the line numbers.

I have some basic programming skills - from before Q-B and with Libeerty Basic for Windoze. Some of the syntax shown in the demo is a little different than what I'm used to, but it still should parse past the 'REM' and GLOBAL decoration i would think. Any ideas?

Thanks!

E

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#438 Post by BarryK »

Global c TYPE chat
Try

Code: Select all

Global c TYPE char
Hmm, yes, I see on my web page, those line numbers could cause confusion. I need to remove them.
[url]https://bkhome.org/news/[/url]

User avatar
e_mattis
Posts: 114
Joined: Fri 21 Dec 2012, 02:24
Location: Williamston, SC
Contact:

#439 Post by e_mattis »

Het Barry!

yea -That was a typo on the post. The actual code does have 'GLOBAL c TYPE char' (my big fingers again :D ). As far as the line numbers, even I figured that one out, but a simple"*without line number*" statemnt should suffice I would think.

Thanks!

E

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#440 Post by BarryK »

e_mattis wrote:Het Barry!

yea -That was a typo on the post. The actual code does have 'GLOBAL c TYPE char' (my big fingers again :D ). As far as the line numbers, even I figured that one out, but a simple"*without line number*" statemnt should suffice I would think.

Thanks!

E
Hmm, perhaps I need a cup of coffee... yes, "GLOBAL", not "Global".

As there seems to be some kind of fundamental problem with your demo.bac, perhaps start with a one-line application, then add to it. For example, start demo.bac with one line only:

PRINT "Hello world"

Then

# bacon -d /tmp demo.bac

...that should work! Then start adding more lines to it, to test those variables and printing behaviour.

Alternatively, you could gzip your demo.bac and post it here.
[url]https://bkhome.org/news/[/url]

Post Reply