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 25 Jul 2014, 23:15
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 34 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, ..., 32, 33, 34, 35, 36 Next
Author Message
e_mattis


Joined: 20 Dec 2012
Posts: 114
Location: Williamston, SC

PostPosted: Mon 04 Mar 2013, 01:11    Post subject:  

Thanks Mobeus,

Yea, I finally figured that part out Embarassed my sloppy coding Rolling Eyes Laughing

I think I have it working now, however, I need the program to wait, halt, or stop until the MSGDIALOG decision is made (ie. wait until either the 'yes' or the 'no' button are pushed; or the window is closed indicating not to delete the record)

At present, it continues execution while the MSGDIALOG is present, continuing on to the 'END SUB'. Here is what I have atm (kmv is now being returned Very Happy ):

Code:

  killmsg$=CONCAT$(Are yo usure you want to delete ",kilme$," ?")
  kilme_dlg=MSGDIALOG(killmsg$,300,110,1,4)
  SHOW(kilme_dlg)
  CALLBACK(kilme_dlg,killme_btn)
  IF kmv = 1 THEN
      GOTO findrec
  END IF
  GOTO nokill
LABEL findrec
  PRINT "at finding record"
LABEL nokill
PRINT "ending"
END SUB


'ending' is being printed while the MSGDIALOG is being shown. I click the 'yes' button,GUI hides, then nothing happens. I re-click the button on the gui to go into the delete SUB and then the 'at finding record' prints followed by the 'ending' message while the new MSGDIALOG is being shown. Confused

I'm familiar with the 'WAIT' command, but how and where do you set it up to pause the program until the MSGDIALOG buttons are pressed? Confused Question

I am thinking of trying this:
Code:

  dmv = 3
  REPEAT
      SHOW(kilme_dlg)
      CALLBACK(kilme_dlg,killme_btn)
       dmv=WAIT(killme_btn, 30)
  UNTIL dmv < 3


OR

Code:

  dmv = 3
  WHILE dmv >= 3
      SHOW(kilme_dlg)
      CALLBACK(kilme_dlg,killme_btn)
  WEND


It is late here, so I will try them and post what happens in the next few minutes or so. Then Ima going to bed!

Thanks!

E

.

[UPDATE]

Both failed Crying or Very sad

Using the WHILE/WEND method caused the MSGDIALOG window to pop up with nothing inside it and locked the system up. Strike one Sad

Using the REPEAT/UNTIL with 'dmv=WAIT(kilme_dlg,30)' would not compile due to a segmentation fault. Strike Two Evil or Very Mad

Using REPEAT/UNTIL with 'dmv=WAIT(killme_btn,30)' would not compile due to an integer from pointer error. Strike three- I'm out! Twisted Evil

Well, off to bed...I'll see what happens with it tomorrow. Meanwhile, any solutions , feel free to post them for me Very Happy

Thanks all!


E

.
Back to top
View user's profile Send private message Visit poster's website 
e_mattis


Joined: 20 Dec 2012
Posts: 114
Location: Williamston, SC

PostPosted: Tue 05 Mar 2013, 12:11    Post subject: pausing to get MSGDIALOG input (solved?)
Subject description: how I got the message dialog button input to register
 

Hey all,

Well, after a couple of days working at it, I finally got the result I was looking for. Very Happy Here is how I got the program to 'pause' until the MSGDIALOG button was pressed:

Code:

  killmsg$=CONCAT$("Are yo sure you want to delete record ",kilme$," ?")
  kill_dlg=MSGDIALOG(killmsg$,300,100,1,4)
  SHOW(kill_dlg)
  CALLBACK(kill_dlg,killit)
END SUB


SUB killit (NUMBER kill_dlg, int button)
  HIDE(kill_dlg)
  IF button = GTK_RESPONSE_YES THEN
      CALL kilrec
  END IF
END SUB


SUB kilrec
  PRINT "killing record"
END SUB


I want to thank all those who helped me understand how this works. All the responses and inputs were very helpful!

Thanks!

E

.
Back to top
View user's profile Send private message Visit poster's website 
e_mattis


Joined: 20 Dec 2012
Posts: 114
Location: Williamston, SC

PostPosted: Wed 06 Mar 2013, 12:49    Post subject: manufacturer db completed
Subject description: small flat-file db for manufacturer contacts
 

Hey guys,

Finally completed my first BaCon prog! Very Happy Wo0h0o!

@L18L

Thought you might want to give it a look over with the international finished on it (I hope Rolling Eyes ). So here's the whole thing, the prog, the code, and the '.pot' file. Hope you like it! Fair warning, the code is going to be repdative and at times jumpy - but like I said, my first in Bacon Smile

Thanks!

E

.
manuf_prog_bacon.tar.gz
Description  small flat-file manufacturer contact list/db
gz

 Download 
Filename  manuf_prog_bacon.tar.gz 
Filesize  147.36 KB 
Downloaded  231 Time(s) 
Back to top
View user's profile Send private message Visit poster's website 
e_mattis


Joined: 20 Dec 2012
Posts: 114
Location: Williamston, SC

PostPosted: Wed 06 Mar 2013, 12:49    Post subject: manufacturer db completed
Subject description: small flat-file db for manufacturer contacts
 

Hey guys,

Finally completed my first BaCon prog! Very Happy Wo0h0o!

@L18L

Thought you might want to give it a look over with the international finished on it (I hope Rolling Eyes ). So here's the whole thing, the prog, the code, and the '.pot' file. Hope you like it! Fair warning, the code is going to be repeatative and at times jumpy - but like I said, my first in Bacon Smile

Thanks!

E

.
manuf_prog_bacon.tar.gz
Description  small flat-file manufacturers contact list/ database
gz

 Download 
Filename  manuf_prog_bacon.tar.gz 
Filesize  147.36 KB 
Downloaded  231 Time(s) 
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 17 Mar 2013, 12:01    Post subject:  

Dear all,

I have been doing a bit of label and svg coding recently and most of the examples are at http://basic-converter.proboards.com/index.cgi?board=doc&action=display&thread=314&page=3.

I was impressed with SFR's recent DYCP script and did a BaCon port/mod. Here is the source and a Lucid 32-bit binary.

With kind regards,
vovchik
bmw-demo.tar.gz
Description 
gz

 Download 
Filename  bmw-demo.tar.gz 
Filesize  22.71 KB 
Downloaded  224 Time(s) 
bmw1.png
 Description   
 Filesize   16.07 KB
 Viewed   426 Time(s)

bmw1.png

Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2504
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Sun 17 Mar 2013, 13:41    Post subject: Re: manufacturer db completed
Subject description: small flat-file db for manufacturer contacts
 

e_mattis wrote:
...look over with the international finished on it (I hope Rolling Eyes ). So here's the whole thing, the prog, the code, and the '.pot' file....

Good news first:
Internationalization is working
(translation of NY, NC, ... does not make sense )

Bad news:
prog and code do not match:
Code:
# bacon manuf.bac
Converting 'manuf.bac'... done.
Compiling 'manuf.bac'... Compiler emits messages!

Problem:
    file 'manuf.bac' line 9: GLOBAL valu$,manunam$,contpsn$,street$,city$,state$,zip$ TYPE STR
Cause:
    expected '=', ',', ';', 'asm' or '__attribute__' before 'valu$'

#


REM INCLUDE "/usr/share/BaCon/hug.bac"
INCLUDE "/usr/share/BaCon/hug_imports.bac"
is converting faster
Back to top
View user's profile Send private message 
e_mattis


Joined: 20 Dec 2012
Posts: 114
Location: Williamston, SC

PostPosted: Sun 17 Mar 2013, 16:36    Post subject:  

Hey L18L

Thanks for the review.
Quote:
Bad news:
prog and code do not match:


hmm, not sure why 'valu$' is there. I don't remember using it anywhere. May be a typo that can be removed? Compiles and runs on my system either way.

Thanks!

E

.
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2504
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Mon 18 Mar 2013, 06:33    Post subject: manuf
Subject description: puppy version
 

e_mattis wrote:
... Compiles and runs on my system either way....

So your system is not racy 5.5.1 Laughing

If have changed to slacko and there it compiles and runs. Very Happy

Translations tend to need more length than english.
Idea for the buttons:
frame named Entry
and default gtk stock buttons for add remove edit save (and quit)
manuf.png
 Description   
 Filesize   27.65 KB
 Viewed   393 Time(s)

manuf.png

Back to top
View user's profile Send private message 
Mobeus


Joined: 26 Aug 2010
Posts: 94

PostPosted: Mon 18 Mar 2013, 13:23    Post subject:  

Hi E,

I'm a little surprised that it builds on slacko. Using the latest bacon beta and hug.bac here I get the same compile error as L18L, and it should.
There is no TYPE STR in bacon, it's TYPE STRING. Smile
After changing those it builds fine.

Regards,
Mobeus

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


Joined: 20 Dec 2012
Posts: 114
Location: Williamston, SC

PostPosted: Mon 18 Mar 2013, 17:17    Post subject:  

Hey guys,

no, it's not Racy, it's Precise Smile

As you can tell, i'm not accustomed to making "international" programs...didn't think about the wording and the different lengths, my bad Sad

I guess i'm telling my age as the saying goes...the 'TYPE STR' comes from a basic long ago Shocked Rather surprised it compiled using just that. Thanks for the heads-up!

I have noticed one 'bug' issue - and i'm sure it's in my coding somehow. When you add multi-records (more than two or three) and then try to remove one, it either crashes or removes the entire database Crying or Very sad Am working on that now, but can not seem to remember/figure out how to remove a certain record and re-assign the remaining ones. ( i.e remove record #3 of a 5 record list). Hopefully I will have it figured out soon (thinking of doing it in another 'while,wend' statement), but, meanwhile, any input would be appreciated Very Happy

Thanks again for the inputs !

E

.
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2504
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Tue 19 Mar 2013, 06:46    Post subject:  

Mobeus wrote:
Hi E,

I'm a little surprised that it builds on slacko. Using the latest bacon beta and hug.bac here I get the same compile error as L18L, and it should.
There is no TYPE STR in bacon, it's TYPE STRING. Smile
After changing those it builds fine.

Regards,
Mobeus

good catch!
looking in my source I see now:
I had removed TYPE STR because all those variables had a trailing [b]$[/b].

Sorry, nobody is perfect Wink
Back to top
View user's profile Send private message 
PaulR

Joined: 04 May 2005
Posts: 242
Location: UK

PostPosted: Wed 10 Apr 2013, 14:03    Post subject:  

Can anyone suggest a fix for this please? I'm executing a shell command to search for a named file starting from "/".

If I execute the following line in a terminal it works as expected:

find / -name icon.xpm -and -not -path /proc

but if filename$="icon.xpm" and I do the following in a BaCon program, the find command still looks in /proc (and returns no such file/directory errors)

command$ = "find / -name " & filename$ & " -and -not -path /proc"
result$=EXEC$(command$)

I've also tried putting /proc in quotes (both by escaping double quotes and using CHR$) and using "proc" and even "/proc/*" both with and without quotes.

I've looked into -prune as an alternative but I'm struggling to understand it at present!

Cheers

Paul
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Wed 10 Apr 2013, 14:21    Post subject:  

Dear Paul,

This code, which is yours, compiles fine and runs OK, i.e. no errors:

Code:
filename$ = "icon.xpm"
command$ = "find / -name " & filename$ & " -and -not -path /proc"
result$=EXEC$(command$)
PRINT result$


I don't have any problems with it.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
PaulR

Joined: 04 May 2005
Posts: 242
Location: UK

PostPosted: Wed 10 Apr 2013, 14:38    Post subject:  

vovchik

If I run the code many times with different filenames I start to get errors like this:

find: `/proc/24007': No such file or directory
find: `/proc/24008': No such file or directory
find: `/proc/24009': No such file or directory

Just in case you haven't noticed, the program/problem is explained in these two threads..

http://murga-linux.com/puppy/viewtopic.php?t=85526
http://murga-linux.com/puppy/viewtopic.php?t=85563

Basically I'm extracting menu entries from .jwmrc and writing them out to a file in Fluxbox format. The new file is created properly (including the icon filenames) but these errors are annoying!

Many thanks,

Paul
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5009
Location: Arizona, U.S.A.

PostPosted: Wed 10 Apr 2013, 15:32    Post subject:  

If I`m not mistaken, isn`t CONCAT$ required to combine literal and variable strings in Bacon?
Like this:
Code:
filename$ = "icon.xpm"
command$ = CONCAT$("find / -type f -name ", filename$)
result$=EXEC$(command$)
PRINT result$

# PaulR; If you reduce the "find" to /usr or whatever you`re looking for, it be quicker.

Also, I think you`ll find that shell scripts are much better at doing strings.
And you end up needed the shell to interface with the O.S. and file systems anyway.
.

Last edited by sunburnt on Wed 10 Apr 2013, 15:36; edited 1 time in total
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 34 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, ..., 32, 33, 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.1133s ][ Queries: 13 (0.0155s) ][ GZIP on ]