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 19 Sep 2014, 18:16
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 10 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, ..., 8, 9, 10, 11, 12, ..., 34, 35, 36 Next
Author Message
BarryK
Puppy Master


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

PostPosted: Fri 19 Nov 2010, 04:56    Post subject:  

2lss wrote:
PjotAwake wrote:
Hi 2lss,

Thanks for your contributions. In fact, I have plans for this editor - I would like to add the BaCon converter itself, as a whole, to the program, so it's all embedded in one. We would have a fourth incarnation of BaCon but completely graphical based on GTK.

For the conversion progress, this is something I would rewrite using a Progress Bar.

Furthermore I would add a configuration panel where it is possible to fill in which type of output terminal is being used: xterm, rxvt, Terminal, gnome-terminal. Also in which size it has to appear.

The 'hold' of the terminal, you could embed the execution of the resulting program in a script which simply finishes with a 'read' - this will wait for input from the keyboard.

Tabbing should be added as well.

Syntax completion would be nice but I could not get that to work.

Your additions are a valuable step to these ideas, thanks! So, lots to do, wish there was more time! Smile

Regards
Peter


Glad I could offer some help. I'll keep plugging away at it when I get time.

As far as the terminal "hold" I had a similar thought, but figured the extra script would confuse things. Unless the editor creates/downloads the script when run (similar to the syntax file).....

What do you think about a FIND/HIGHLIGHT option? I found some example C code that might work.


Puppy already has a script for xterm. All Woof-built puppies have /usr/bin/xterm which is a script, unless any particular developer has replaced it.

Wary, Quirky, and many older versions of Puppy have it, in fact if my memory serves me right, even Puppy 4.3.1 has it.

Here is the script:
Code:
#!/bin/sh
#rxvt does not understand the '-hold' option.

if [ "`echo -n ${*} | grep '\-hold '`" != "" ];then
 EXECCOMMAND="`echo -n ${*} | grep -o ' \-e .*' | sed -e 's/ \-e //'`"
 if [ "$EXECCOMMAND" != "" ];then
  echo '#!/bin/sh' > /tmp/xterm_simulate_hold.sh
  echo "$EXECCOMMAND"  >> /tmp/xterm_simulate_hold.sh
  echo 'echo' >> /tmp/xterm_simulate_hold.sh
  echo 'echo -n "FINISHED. PRESS ENTER KEY TO CLOSE THIS WINDOW: "' >> /tmp/xterm_simulate_hold.sh
  echo 'read simuldone' >> /tmp/xterm_simulate_hold.sh
  chmod +x /tmp/xterm_simulate_hold.sh
  exec rxvt -e /tmp/xterm_simulate_hold.sh
 fi
fi

exec rxvt "${@}"


...it tests for '-hold' on the commandline.
[/code]

_________________
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: Fri 19 Nov 2010, 06:41    Post subject:  

Dear Barry and Doyle,

Slightly more terse....

Code:

DECLARE prop$ ASSOC STRING

infile$ = "PUPSTATE"
OPEN infile$ FOR READING AS fh
WHILE NOT(ENDFILE(fh)) DO
   READLN txt$ FROM fh
   txt$ = CHOP$(txt$)
   IF INSTR(txt$, "#") EQ 1 THEN CONTINUE
   l$ = LEFT$(txt$,INSTR(txt$, "=") - 1)
   prop$(l$) = CHOP$(MID$(txt$, INSTR(txt$, "=") + 1), "'")
WEND
PRINT prop$("DEV1FS")
PRINT prop$("ZDRV")
PRINT prop$("PUPSAVE")


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

Joined: 31 May 2008
Posts: 3220

PostPosted: Fri 19 Nov 2010, 07:29    Post subject:  

Version of previously posted apps loader using arrays:

http://jpeters.net/apps/MyPrograms.bac.txt
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sun 21 Nov 2010, 13:40    Post subject: picscale v. 0.1a - image converter/rescaler in BaCon  

Dear puppians,

Here is revised picture rescaler/converter written in BaCon that makes use of gdk_pixbuf to work its magic. It is pretty small (38k compiled). Since it is a command-line prog, you can use it in bash scripts for the batch processing of image directories etc.

The help screen looks like this:

Code:

picscale image resizer/converter - v.0.1a by vovchik, Puppy Linux Forum, Nov 2010

Input formats supported: pnm, pbm, pgm, ppm, tga, xpm, tiff, pcx, gif,
xbm, wmf, icns, bmp, png, jpg and ico.

Output formats supported: png, jpg, bmp, tiff and ico.

Input parameters: oldfilename newfilename height width quality/compression/depth

Example: picscale old.png new.png 128 128 9

Quality/compression/depth settings:

        bmp (N/A):               0 - 100
        jpeg (quality):          0 - 100
        png (compression):       0 - 9
        tiff (compression type): 1 - 8
        ico (depth):             16, 24 or 32

Check out BaCon at www.basic-converter.org


If you have any suggestions or code mods, please tell me or post them here. The source is in the archive and a working binary in the pet file (installs in /usr/local/bin).

With kind regards,
vovchik
picscale.bac.tar.gz
Description 
gz

 Download 
Filename  picscale.bac.tar.gz 
Filesize  2.49 KB 
Downloaded  433 Time(s) 
picscale-0.1a.pet
Description 
pet

 Download 
Filename  picscale-0.1a.pet 
Filesize  13.37 KB 
Downloaded  498 Time(s) 
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sun 21 Nov 2010, 17:04    Post subject:  

Hey vovchik

fast and small
what more can you want and
compiled it in bacon Cool


I can see many good apps to follow from you

thanks for posting the app and the source

Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Sun 21 Nov 2010, 19:00    Post subject:  

big_bass wrote:
Hey vovchik

fast and small
what more can you want and
compiled it in bacon Cool


I can see many good apps to follow from you

thanks for posting the app and the source

Joe


Great example, although similar cli scaling can be done with about 3 lines using something like exactimage:

example: 'scale old.png new.png 16'

note: econvert also has --quality, which could be the fourth argument

Code:

#!/bin/sh

OldSize=`edentify $1 | cut -d"x" -f1 | cut -d" " -f3`
size=`dc $3 $OldSize / p` 
econvert -i $1 --scale $size -o $2

Last edited by jpeps on Sun 21 Nov 2010, 19:14; 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: Sun 21 Nov 2010, 19:10    Post subject: Thanks  

Dear Joe,

Thanks. I am trying to understand gdk_pixbuf_composite, and once I do satisfactorily, I will change pikona to use only gtk/gdk calls. That means a binary of about 70k without any ImageMagick dependencies that will run on any standard Puppy. Of course, the various background, object and overlay files will still be needed, but the main bulk for the user is now IM and that will be gone. And the transformations will be faster, since they will be made in RAM. And input pics will be able to be in any of the formats that can be read by gtk_pixbuf. Have to get onto this....

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


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sun 21 Nov 2010, 19:20    Post subject: image conversion  

Dear jpeps,

No it can't do that in three lines, unless you install either IM (a good 6 MB binary with libs) or ExactImage (a good 3+ MB binary with libs). Of course econvert and IM's convert can do the job, but I think you may have missed my point above about ugly and huge dependencies. Puppy is supposed to be small and capable, and exploiting gdk_pixbuf (included in the GFK libs in every Puppy by default) is, I think, a good idea.

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

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sun 21 Nov 2010, 20:40    Post subject:  

Quote:
I will change pikona to use only gtk/gdk calls. That means a binary of about 70k without any ImageMagick dependencies



there are a few small apps that do image resize

but there is a little history here that just took place over a long period of time
its hard to follow all the threads so here is a short recap

pikona a great icon making app (compiled in bacon)
uses image magic to do the resize

there is a great small cli c code app MU wrote and compiled

but for some reason the alpha channel had a small error
during the conversion with png that was fixed

then converted from c code to bacon basic
and expanded on adding the IMPORTS

a lot of work went to getting all that to work
so vovchik savor the moment friend

what I like about bacon the most is having
apps that work on all linux distros not
special apps that only work for one special version (like the gtkdialog3 if you plan to share work with the linux
community

Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sat 27 Nov 2010, 09:16    Post subject:  

Dear Puppians,

I think I have finally understood gdk_pixbuf_composite. Here is a little demo (archive includes src, binary and images). Now I can change Pikona Smile

With kind regards,
vovchik
new_img.png
 Description   
 Filesize   28.91 KB
 Viewed   1463 Time(s)

new_img.png

image2.png
 Description   
 Filesize   26.22 KB
 Viewed   1475 Time(s)

image2.png

image1.png
 Description   
 Filesize   18.48 KB
 Viewed   1456 Time(s)

image1.png

composite-test.tar.gz
Description 
gz

 Download 
Filename  composite-test.tar.gz 
Filesize  57.78 KB 
Downloaded  409 Time(s) 
Back to top
View user's profile Send private message 
PjotAwake


Joined: 03 Nov 2010
Posts: 34
Location: The Hague, The Netherlands

PostPosted: Sun 28 Nov 2010, 16:38    Post subject:  

Gents,

Updated the Source Code Editor a bit more.

Tabbing: done.
Quote:

What do you think about a FIND/HIGHLIGHT option?

Done.

Furthermore did some preparations to integrate with the complete BaCon source. So I am working on it, also looking at contributions from 2lss and mechanic.

For now, code of version 1.4 is here. More to come...

Regards,
Peter
Back to top
View user's profile Send private message Visit poster's website 
ICQ Number 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sun 28 Nov 2010, 17:24    Post subject:  

Dear PjotAwake,

We are grateful to you for your brains, effort and conscientiousness. I think the IDE will be a VERY useful addition. If we have this, Doyle's glade2bac plus a few utilities that can scan BaCon code and find the (i) undefined function calls to external shared libs (that is, ultimately, compiler errors) and (ii) then do something like an nm -D on the probable libs to automatically produce the imports with proper type defs, life will be a breeze. In a way, one could, for instance, load the entire GTK/GDK stuff, then do a diff on the code to grab only those functions as IMPORTs that are really called, and produce the import list on the basis of matches. I am giving that some thought...

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


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 29 Nov 2010, 06:59    Post subject: pnotify revisited  

Dear puppians,

I revised my notification prog and have attached it here. I eliminated the global HUG dependencies, doing the IMPORTs by hand, and, in so doing, reduced the size of the binary by 50% - now 42k. It is similar to the gnome notify prog, but no icons yet and no command-line argument for duration of the popup, but with complete use of markup. Shall I do the icon and duration bits (we could make it into a 1:1 clone of notify, but without the gnome deps)? It's not a bad way of giving users information about an event that has transpired - i.e. successful inet connection or the completion of some long process such as indexing or backup. Please have a look. The archive contains the source, binary and a bash demo launcher (which shows how to do the markup).

With kind regards,
vovchik
pnotify-0.1a.tar.gz
Description 
gz

 Download 
Filename  pnotify-0.1a.tar.gz 
Filesize  18.19 KB 
Downloaded  406 Time(s) 
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Mon 29 Nov 2010, 13:42    Post subject:  

vovchik,

Thanks for working on this.

I get this -
Code:
./pnotify
ERROR: signal for SEGMENTATION FAULT received - memory invalid or array out of bounds? Try to compile the program with TRAP LOCAL to find the cause.


Could it be a bash 3 problem?

I also wondered if the BaCon larger font size rendering problem has seen any resolution.

Best Regards,
s
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 29 Nov 2010, 17:12    Post subject:  

Dear Seaside,

Yep, I spoke to Peter about this and our suspicion is that it is bash3 -related. Although Peter recommends bash4 for BaCon (for good reason), I have used GNU bash, version 3.2.48(1)-release (i686-pc-linux-gnu) successfully. Shall I post that binary here? I think Joe has posted a useful bash4 somewhere, and Barry has one posted too. The binary should work in any case -- I hope Smile

With kind regards,
vovchik
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 10 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, ..., 8, 9, 10, 11, 12, ..., 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.1065s ][ Queries: 12 (0.0120s) ][ GZIP on ]