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
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

BaCon proxy-setup

#286 Post by L18L »

Edited
no idea why this was double posted.
sorry.

Edited again Tue 29 Mar 2011, 10:25
I have seen it on page 19, too.
Now it is not on page 19.
Confused,
but anyhow there have been 4 downloads until now.
Changes are commented in source and readme file.

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

bsplash = bacon-based splash program

#287 Post by vovchik »

Dear Puppians,

Having seen the nice job that 01micko did with gtkdialog-splash, I decided to create a little splash program in bacon that can display animated gifs, jpgs and pngs, with a message in you choice of font and with window decorations or not. It also has a duration parameter, and the splash can be killed by clicking on the image. I have included a binary, test images, source, the latest HUG and a bash example program. Just unpack and click on the "bsp" script. It should work. For maximum compatibility, I compiled in Puppy 3.01. If you run bsplash without parameters in a terminal, you will get a help screen that explains all the flags and arguments. Also look at the bash script. If you look at the bacon source, you will see that I call two gdk functions to get the size of jpgs and pngs, but use the unix utility "file" for gifs. This is because the gdk routines do not deliver the right dimensions for a multi-image (i.e. animated) gif but "file" does. :(

With kind regards,
vovchik

UPDATE1: I updated the attachment and added the capability to display the following file types: bmp, jpg, jpeg, jpe, ico, png, icns, wmf, xpm, xbm, tiff, tif, ppm, pbm, pgm, pnm and pcx.

UPDATE2: I updated the attachment and added a placement parameter for the main window (i.e. -p "80,80"), so that the window will display at those x,y coordinates. I also hide the program from the taskbar when in non-decorated mode.

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

bsplash = bacon-based splash program

#288 Post by seaside »

vovchik ,

You've done again. This time making a big splash with animations and image variations. :)

Very nicely done.

Now for the following little item--

The pacing cat keeps nicely in it's window but the text does not -see below.

Everything else seems to purr along :) :)

Regards,
s
(This is at 1024x768 96dpi pup431)
Attachments
bsplash.png
(5.15 KiB) Downloaded 1714 times

User avatar
abushcrafter
Posts: 1418
Joined: Fri 30 Oct 2009, 16:57
Location: England
Contact:

bsplash

#289 Post by abushcrafter »

What about keyboard control?
[url=http://www.adobe.com/flashplatform/]adobe flash is rubbish![/url]
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/

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

bsplash

#290 Post by vovchik »

Dear seaside and abushcrafter,

Thanks. Seaside, just edit the bit in bsp and add a font and size. It defaults to DejaVu Sans Bold 14, and I am sitting at a big monitor now. But just change the bash stuff in the invocation!

Abushcrafter: Yeah, I will have to put in some keyboard controls. Give me a few suggestions....

With kind regards,
vovchik
Last edited by vovchik on Tue 05 Apr 2011, 21:54, edited 1 time in total.

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

bsplash

#291 Post by vovchik »

Sorry, connection was bad and it posted twice!

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

Re: bsplash

#292 Post by seaside »

vovchik wrote: Thanks. Seaside, just edit the bit in bsp and add a font and size. It defaults to DejaVu Sans Bold 14, and I am sitting at a big monitor now. But just change the bash stuff in the invocation!

With kind regards,
vovchik
vovchik,

I changed the x to 250 (from 230) and the impatient cat and text are now happily in the same room. :)

Thanks again,
s
(I'm curious as to what sort of keyboard controls might be used here?)

User avatar
abushcrafter
Posts: 1418
Joined: Fri 30 Oct 2009, 16:57
Location: England
Contact:

Keyboard Control Suggestions

#293 Post by abushcrafter »

  • Esc=Dismiss
  • Enter=Dismiss
  • M=Minimize into task-bar.
By default show in task list but give programmer option to disable? If OnTop is set?

A Tray Icon listing msgs with its own Win/Super/Hyper/Meta hotkey?

Give programmer option to disable "enter to dismiss" or a "Are you shore?" dialog box?
[url=http://www.adobe.com/flashplatform/]adobe flash is rubbish![/url]
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/

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

#294 Post by BarryK »

Have any of you guys used Dietlibc to compile BaCon programs?

I ask this because Dietlibc creates by far the smallest static applications, significantly smaller than uClibc.

I'm compiling the latest Dietlibc in T2. Well the official package is version 0.32 and dated 2009, but the T2 developers have added many patches and recently added a whole lot more:

http://t2-project.org/packages/dietlibc.html

So, I intend to create a PET of this latest dietlibc.
[url]https://bkhome.org/news/[/url]

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

dietlibc

#295 Post by vovchik »

Dear Barry,

I haven't tried with BaCon, but it could be interesting. I am also wondering whether there are any unnecessary symbols we might be able to strip out of the resulting binaries in order to get even smaller ones - of the kind we often get with plain C or C and GTK. We might want to ask Peter about this...

With kind regards,
vovchik

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

#296 Post by BarryK »

I have created the Dietlibc PET:

http://bkhome.org/blog/?viewDetailed=02206
[url]https://bkhome.org/news/[/url]

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

#297 Post by BarryK »

I have been a busy boy:

http://bkhome.org/blog/?viewDetailed=02213

If anyone wants to create a language translation file for 'welcome1stboot', please do!

And if you need to tweak the text widget dimensions to accomodate the non-English text, let me know about that too.
[url]https://bkhome.org/news/[/url]

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

Re: dietlibc

#298 Post by BarryK »

vovchik wrote:Dear Barry,

I haven't tried with BaCon, but it could be interesting. I am also wondering whether there are any unnecessary symbols we might be able to strip out of the resulting binaries in order to get even smaller ones - of the kind we often get with plain C or C and GTK. We might want to ask Peter about this...

With kind regards,
vovchik
technosaurus is an expert at creating the smallest possible binaries. He might be interested in taking a look at this. I'm getting stripped binaries written with HUG a minimum of about 45KB (with shared hug.so) -- quite likely there are things in there that could go.
[url]https://bkhome.org/news/[/url]

User avatar
maxerro
Posts: 53
Joined: Sun 10 Oct 2010, 16:11

nice job

#299 Post by maxerro »

Very nice work.
Getting the font from jwmrc-theme would probably be a nice tweak.
Small BaCon programs can be UPX-ed to less than 15KB.

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

Re: nice job

#300 Post by BarryK »

maxerro wrote:Very nice work.
Getting the font from jwmrc-theme would probably be a nice tweak.
Small BaCon programs can be UPX-ed to less than 15KB.
BaCon app defaults to using the theme font. I set a specific font to ensure that layout is correct.

There isn't any point in UPXing the program if the PET is builtin when Woof builds a Puppy, as the SFS file is already compressed. But yes, it is useful if the PET is installed afterward, in a running Puppy.

I am mostly concerned about the accumulated size of many BaCon apps in the SFS of a Puppy build. My recent 'welcome1stboot' is 46KB, compared with the gtkdialog script that does almost the same thing at only 7KB. Ignoring the overhead of the common factor (hug.so and gtkdialog), if we have 20 such apps, the total size would be about 1MB versus 140KB -- compressed in the SFS that would probably be about 0.3-0.4MB versus only 50-60KB -- a quite significant jump in size of the live-CD iso.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

welcome1stboot

#301 Post by L18L »

tweak the text widget dimensions to accomodate the non-English text, let me know about that too

Code: Select all

REM welcome window, first boot of Puppy.
REM (c) Copyright Barry Kauler 2011, bkhome.org
REM License GPL v3 (/usr/share/doc/legal)
REM 110412 first release.
REM 110413 tweak text widget dimensions and menu2.png to accomodate the non-English
Several changes had to be made

Image

Note, menu2.png is localized, location in po file.

Code: Select all

'image_tray=IMAGE("/usr/share/doc/menu2.png",150,90)
image_tray=IMAGE(INTL$("/usr/share/doc/menu2.png"),150,90)
ATTACH(mainwin,image_tray,10,325)
in de.po:

Code: Select all

#: welcome1stboot.bac.c:442
msgid "/usr/share/doc/menu2.png"
msgstr "/usr/share/doc/help/de/menu2.png"
This is the location used in quickset wary multilingual

complete welcome1boot-20110413 incl. German translation attached

Edit
Now I see at the image another change of dimensions is needed:

Code: Select all

'label_setup=MARK(INTL$("Setup your pup"),180,24)
label_setup=MARK(INTL$("Setup your pup"),280,24)
EDIT
Thanks for downloading...
please use next version 20110414 (3 posts down) :)
Last edited by L18L on Wed 13 Apr 2011, 20:11, edited 1 time in total.

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

getting smaller binaries

#302 Post by vovchik »

Dear Barry & Co.,

I do not always enjoy UPX'd binaries (I generally un-UPX them as a matter of habit), but I can see the logic in this in order to keep everything manageably small for Puppy. What I think would be great is an optimizing routine at compile/link time. I remember writing gtk apps, simple ones in C, and they were 4-6k! :) That is nice. If we could get that kind of binary terseness in Bacon, it would be fabulous, because the BaCon binaries would be the size of gtkdialog scripts but run very fast! The non-GTK BaCon progs are already pretty small, but some kind of optimization would also help there. I do not know whether it possible, but if it is, Peter will put his mind to it and pleasantly surprise us all!

With kind regards,
vovchik

PS. I recalled why UPX's binaries bothered me. You cannot see the dependencies with ldd!

rodin.s
Posts: 344
Joined: Wed 22 Sep 2010, 19:50
Location: Ukraine

dimensions for russian

#303 Post by rodin.s »

L18L's version wasn't good enough for russian. So my dimensions are (Barry's version):
line - dimensions
41 - 664,514
83 - 84,16
86 - 568,165
88 - 250,24
101 - 430,16
107 - 280,24
124 - 280.24
140 - 84,16
143 - 570,489
Attachments
welcome1stboot_ru.png
screenshot
(73.93 KiB) Downloaded 877 times
ru.po.gz
russian po-file
(2.88 KiB) Downloaded 728 times
welcome1stboot.bac.gz
dimensions changed for russian
(2.61 KiB) Downloaded 723 times

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

welcome1stboot

#304 Post by L18L »

label_ic_body : 3 lines in en, ru but 4 lines in de
label_help_body: 3 lines in en, de but 4 lines in ru

New: each has 4 lines (see REM in .bac)

Image
Image

rodin.s
Posts: 344
Joined: Wed 22 Sep 2010, 19:50
Location: Ukraine

welcome1stboot

#305 Post by rodin.s »

L18L, your script is almost OK, but I had to change some parameters:
line 44 - 664,534 - making whole window a little wider
line 92 - 568,165 - word 'Connect' a bit to the right
line 112 - 430,16 - line was cut off in the end
line 121 - 220,24 - 'Сохранение

Post Reply