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 Tue 29 Jul 2014, 15:11
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 3 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, 4, 5, ..., 34, 35, 36 Next
Author Message
mechanic

Joined: 12 Apr 2009
Posts: 29

PostPosted: Sun 05 Sep 2010, 18:53    Post subject: Re: signals and callbacks  

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?
mkglade.tar.gz
Description 
gz

 Download 
Filename  mkglade.tar.gz 
Filesize  3.62 KB 
Downloaded  592 Time(s) 

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

Joined: 12 Apr 2009
Posts: 29

PostPosted: Mon 06 Sep 2010, 01:16    Post subject: Latest glade converter for BaCON
Subject description: Simplified the code
 

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.
mkglade-1.tar.gz
Description 
gz

 Download 
Filename  mkglade-1.tar.gz 
Filesize  2.85 KB 
Downloaded  620 Time(s) 

_________________
regards,
mechanic
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 06 Sep 2010, 03:02    Post subject:  

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


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 06 Sep 2010, 05:02    Post subject: nice compile  

Dear Doyle,

Try compiling the attached. Works nicely.

With kind regards,
vovchik
egdesigner.glade.tar.gz
Description 
gz

 Download 
Filename  egdesigner.glade.tar.gz 
Filesize  5.86 KB 
Downloaded  619 Time(s) 
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 06 Sep 2010, 06:26    Post subject: parsing error  

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
PupWebTV.glade.tar.gz
Description 
gz

 Download 
Filename  PupWebTV.glade.tar.gz 
Filesize  941 Bytes 
Downloaded  602 Time(s) 
Back to top
View user's profile Send private message 
mechanic

Joined: 12 Apr 2009
Posts: 29

PostPosted: Mon 06 Sep 2010, 12:38    Post subject: Re: parsing error  

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

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:


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:


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

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

mkglade-3.tar.gz
Description 
gz

 Download 
Filename  mkglade-3.tar.gz 
Filesize  3.01 KB 
Downloaded  601 Time(s) 

_________________
regards,
mechanic

Last edited by mechanic on Mon 06 Sep 2010, 13:11; edited 1 time in total
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 06 Sep 2010, 13:04    Post subject: weird ascii codes and mixup in sub sames  

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

 Download 
Filename  glade2bac-src.tar.gz 
Filesize  4.2 KB 
Downloaded  610 Time(s) 
Back to top
View user's profile Send private message 
mechanic

Joined: 12 Apr 2009
Posts: 29

PostPosted: Mon 06 Sep 2010, 13:25    Post subject: Re: weird ascii codes and mixup in sub sames  

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.

_________________
regards,
mechanic
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 06 Sep 2010, 15:06    Post subject: glade version  

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

Joined: 12 Apr 2009
Posts: 29

PostPosted: Mon 06 Sep 2010, 15:30    Post subject: Re: glade version  

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

_________________
regards,
mechanic
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 06 Sep 2010, 15:40    Post subject: Bash and Bacon versions  

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


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Tue 07 Sep 2010, 09:27    Post subject: I fixed it!  

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.Smile

With kind regards,
vovchik
mkglade-4c.tar.gz
Description 
gz

 Download 
Filename  mkglade-4c.tar.gz 
Filesize  18.37 KB 
Downloaded  612 Time(s) 
Back to top
View user's profile Send private message 
mechanic

Joined: 12 Apr 2009
Posts: 29

PostPosted: Tue 07 Sep 2010, 19:47    Post subject: Re: I fixed it!  

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.Smile

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... Smile

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

Joined: 12 Apr 2009
Posts: 29

PostPosted: Sun 12 Sep 2010, 16:51    Post subject: Re: I fixed it!  

mechanic wrote:

Now if only I had a handy list... Smile


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.
mkglade-4d.tar.gz
Description 
gz

 Download 
Filename  mkglade-4d.tar.gz 
Filesize  3.66 KB 
Downloaded  651 Time(s) 

_________________
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: Sat 06 Nov 2010, 12:53    Post subject:  

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:
gcc -c t.bac.c


gosh I should know this . . .

_________________
Puppy WIKI
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 3 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, 4, 5, ..., 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.0977s ][ Queries: 13 (0.0117s) ][ GZIP on ]