Page 2 of 27

Re: signals and callbacks

Posted: Sun 05 Sep 2010, 22:53
by mechanic
vovchik wrote:Dear Doyle,

Please have a look at the attached archive. Peter put together a glade.bac file that is used as an include. It has all the necessary and useful imports and libs defined. I'll re-read your message and hope to post something sensible soon regarding signals.

With thanks and kind regards,
vovchik
Thanks but I have a copy of the glade.bac file here. I may need to add all of the IMPORTs in there but for now, it seems I have all needed.

Here is the latest source that I have. I am still working on automatically adding the close signal and connecting it correctly so that is not finished yet.

I am not adding the signals *IF* the user doesn't add them to the glade file in the Glade GUI designer. I don't want to second guess the user. They might not want the callbacks generated (can't see why but if they want them, they'll have to add them in the designer.)

Please share your thoughts on the code. What else is needed? What would be good to have added?

Latest glade converter for BaCON

Posted: Mon 06 Sep 2010, 05:16
by mechanic
Hi all, I completely rewrote the code making it simpler. Please test and let me know of any bugs. Seems to work on all of my test code here.

Posted: Mon 06 Sep 2010, 07:02
by vovchik
Dear Doyle,

GREAT work. I would do as you suggest - if no signal connect, just load the Glade file and add them. mkglade now picks up and makes the SUBs for my glade widgets. The only think that might be added as "standard" is a gtk_exit SUB by default.

I am now testing with various Glade files and will report back.

Thanks.

With kind regards,
vovchik

PS. I think
IMPORT "gtk_exit(int)" FROM "libgtk-x11-2.0.so" TYPE void
and the callback for closing a prog
' ---------------
SUB exit_prog()
' ---------------
gtk_exit(0)
END SUB

might be useful in nearly all cases.

nice compile

Posted: Mon 06 Sep 2010, 09:02
by vovchik
Dear Doyle,

Try compiling the attached. Works nicely.

With kind regards,
vovchik

parsing error

Posted: Mon 06 Sep 2010, 10:26
by vovchik
Dear Doyle,

The attached glade file gives a parsing error when compiling the binary. I think mkglade is missing something or getting confused. Have a look at the generated source. Bacon will point you to the line numbers.

With kind regards,
vovchik

Re: parsing error

Posted: Mon 06 Sep 2010, 16:38
by mechanic
vovchik wrote:Dear Doyle,

The attached glade file gives a parsing error when compiling the binary. I think mkglade is missing something or getting confused. Have a look at the generated source. Bacon will point you to the line numbers.
Ok, multiple signals defined in this glade file. None of the examples that I have here are like that. I hope I have it fixed. Please test and let me know.

This little program is looking good to me! :-D

EDIT: The egdesigner glade file won't compile as is. I had to increase the array limits in mkglade to the following and recompile mkglade.bac:

Code: Select all


RECORD glade[1000]
    LOCAL class$    TYPE STRING
    LOCAL id$          TYPE STRING
    LOCAL signal$[100]    TYPE STRING
    LOCAL handler$[100] TYPE STRING
    LOCAL wtype     TYPE NUMBER
END RECORD

I also added your suggested code:

Code: Select all


IMPORT "gtk_exit(int)" FROM "libgtk-x11-2.0.so" TYPE void

' ---------------
SUB exit_prog()
' ---------------
gtk_exit(0)
END SUB 


weird ascii codes and mixup in sub sames

Posted: Mon 06 Sep 2010, 17:04
by vovchik
Dear Doyle,

Just tested mkglade2 and have weird sub names and other either low ascii (ACK, BS) or high ascii char appearing in sub names and bvits and pieces of the glade file (e.g. <widget>).

Please see attached file.

With kind regards,
vovchik

Re: weird ascii codes and mixup in sub sames

Posted: Mon 06 Sep 2010, 17:25
by mechanic
vovchik wrote:Dear Doyle,

Just tested mkglade2 and have weird sub names and other either low ascii (ACK, BS) or high ascii char appearing in sub names and bvits and pieces of the glade file (e.g. <widget>).

Please see attached file.
Weird! I looked at the *.bac file and it was messed up. I then ran mkglade3 on it and it did fine. I *think* some of the test files are not created correctly by whoever did the designing. For instance, if the glade file has a "delete_event" instead of a "destroy" the app won't close correctly. I don't know enough about he glade file format to know if this is right or not.

BTW, a LOT of problems in the glade file can be fixed by opening the file in Glade 3.6.7, checking version and deprecations and resaving it.

Let me know if mkglade3 is ok for you.

glade version

Posted: Mon 06 Sep 2010, 19:06
by vovchik
Dear Doyle,

I can't really run glade 3.6.7 on my usual development machine,because I still have puppy 3.01 and it uses gtk 2.10. Glade 3.6.7 requires gtk 2.14. I had been using glade 3.0.0 but just compiled 3.2.2 using Barry's ./configure line, which worked fine. I am still getting confused SUBs (bits and pieces of the glade file being used for the SUB name - i.e. weird stuff in the generated *.bac file - and the subsequently compilation bombing). I don't know what is causing that, but I will now look at the code in mkglade-3 to see whether I can figure it out. I am intrigued, because it looks like a processing or parsing error and not necessarily glade. Old mkglade (I think from 1 am last night) works fine with those glade files.

With thanks and kind regards,
vovchik

Re: glade version

Posted: Mon 06 Sep 2010, 19:30
by mechanic
vovchik wrote:Dear Doyle,

I can't really run glade 3.6.7 on my usual development machine,because I still have puppy 3.01 and it uses gtk 2.10. Glade 3.6.7 requires gtk 2.14. I had been using glade 3.0.0 but just compiled 3.2.2 using Barry's ./configure line, which worked fine. I am still getting confused SUBs (bits and pieces of the glade file being used for the SUB name - i.e. weird stuff in the generated *.bac file - and the subsequently compilation bombing). I don't know what is causing that, but I will now look at the code in mkglade-3 to see whether I can figure it out. I am intrigued, because it looks like a processing or parsing error and not necessarily glade. Old mkglade (I think from 1 am last night) works fine with those glade files.
Sorry, I didn't think about that. I'm running lucid puppy 5.01 (5.1?). I started with version 4, got all of the dev stuff on it and then when lupu came out I set it up for my bacon/bcx programming envirionment.

I want to create a *.SFS file with all of my programming stuff in it so I don't have to manually add it when upgrading puppy. So far I've not had the time to figure that all out. I'm thinking of making something along those lines using bacon.

What version of Bacon are you using? Bash? I think Bash ver. >= 4.0 is required for the latest bacon version I have.

If you want, you can send me the glade files that don't work and I'll try them here. The last one in the attachment (PupWebTV) worked fine with mkglade3 here.

All of the other, smaller glade files seem to be ok too.


Send to:

mekanixx at gmail dot com

Bash and Bacon versions

Posted: Mon 06 Sep 2010, 19:40
by vovchik
Dear Doyle,

I am using the latest BaCon - released last night BaCon (version 1.0 build 18 beta). It is in the /beta dir on Peter's site. My bash is 3.2.29(2)-release (i486-slackware-linux-gnu). It is a version that is recent enough to work with BaCon (and still in the 3.x series). So bash and BaCon aren't causing the problem. I usually update BaCon every few days. So I am still scratching my head.

With kind regards,
vovchik

I fixed it!

Posted: Tue 07 Sep 2010, 13:27
by vovchik
Dear Doyle,

I finally found out what was wrong. When assigning values to a RECORD element, you have to use the "WITH/END WITH" construction. My fix is attached. No more garbage SUBs.:)

With kind regards,
vovchik

Re: I fixed it!

Posted: Tue 07 Sep 2010, 23:47
by mechanic
vovchik wrote:Dear Doyle,

I finally found out what was wrong. When assigning values to a RECORD element, you have to use the "WITH/END WITH" construction. My fix is attached. No more garbage SUBs.:)

With kind regards,
vovchik
Great! Now I can concentrate on some other buggy items. I need to figure out how to ignore some of the widget classes that don't use signals - like "GtkVBox", etc. Right now the parser grabs all of the classes.

Now if only I had a handy list... :)

Re: I fixed it!

Posted: Sun 12 Sep 2010, 20:51
by mechanic
mechanic wrote: Now if only I had a handy list... :)
Well, I hate to quote myself but I made a list of the available widgets which use signals and added it to the source in the form of DATA statements. Now mkglade don't add the widget class unless it is one that uses signals. This should make it a little faster parsing a glade file.

I hope that I didn't miss any widgets, if so please let me know.

Posted: Sat 06 Nov 2010, 16:53
by Lobster
Some new Bacon 1 build 19 was released on 31 October.
http://www.basic-converter.org/

I need a tutorial - starting with 'Hello world'

I have the devx running
It compiles c code - then I think I get stuck
trying to compile it . . .

is that right?

Code: Select all

gcc -c t.bac.c
gosh I should know this . . .

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.