1. Resources and Euphoria (Opening a new thread)

Hi everybody!.
I'm trying to setup a single .EXE file to include everything needed for that
application, (bitmaps, text strings, parameter files, -even some data-).
On the Macintosh platform is  common the use of resources, that sit inside a
"resource fork" embedded in the executable.
I was wondering if it would be possible to use the same approach with
Euphoria. I know that with the current tools is possible to bind some
information (i.e. bitmap) at the end of the .EXE file, and thus using this
feature to embed a resource file at the end.
I also know that there are some resource managers/editors around, (i.e. with
Borland Pascal, etc.).
Does anybody know where can I find information on one of those resource
manager/editors (I mean the program plus the internal data layout) to be
able to interface it with Euphoria?.
Has someone done something like this?.
Thanks.
Jesus.

new topic     » topic index » view message » categorize

2. Re: Resources and Euphoria (Opening a new thread)

On Thu, 28 May 1998, JesusC - Jesus Consuegra wrote:

> Hi everybody!.
> I'm trying to setup a single .EXE file to include everything needed for that
> application, (bitmaps, text strings, parameter files, -even some data-).
[space save]
> Has someone done something like this?.
> Thanks.
> Jesus.

Closest I've come to anything similar is a message I posted to the list a
very long time ago.

I include it here in case anyone missed it:

On Wed, 24 Sep 1997, Stefan Meyer wrote:

> Assume, I have written an .ex program with some picturefiles, sounds etc.
> How can I put all that stuff into ONE .exe file?

It's possible to munge it all together with Euphoria, but I wouldn't
recommend that. I prefer to use a method I described a while ago for
Jiri's "Aliens" game.

1. Make a backup of your program, pictures and sounds in case something
goes wrong below.

2. Get hold of a copy of PKZip (you should be able to do this for any
self-extracting archiver, but the below is optimized for PK).

3a. You might like to bind a main executable at this stage, although you
don't have to...

3b. Zip all of the files (program etc.) into a zipfile (note the use of
the tilde '~', you might have to remove a character to fit it in):

        PKZIP ~[FileName] PROG.EX(E) EFILES.E WIBBLE.E (if you haven't
bound them already).

        e.g. PKZIP ~ALIENS ALIENS.EXE *.WAV
             -- I'd made sure the .WAVs were the only ones in my work
             -- directory

4. Make a SFX archive:

        ZIP2EXE ~[FileName]

  e.g.  ZIP2EXE ~ALIENS

5. Delete all files except the ~[FileName].EXE (This is why I told you to
make a backup of the files)

6. Create a batch file along the following lines (don't include the
bracketed comments):

-----------------------------------------------------------------------
REM [FileName].BAT (no tilde '~' here)
@ECHO OFF

MKDIR ~[FileName].TMP (create a temporary directory)
COPY ~[FileName].EXE ~[FileName].TMP (copy the SFX into the temp.dir.)

CD ~[FileName].TMP (move to the directory)
~[FileName] (extract the files)
[FileName]  (run the program)

ECHO Y | DEL *.* (we've done, remove files)
CD .. (move back to where we were)

RMDIR ~[FileName].TMP (get rid of the temp.dir.)

ECHO Done!
-----------------------------------------------------------------------

e.g. My "Aliens" batch file looked like this:

-----------------------------------------------------------------------
REM ALIENS.BAT
@ECHO OFF

MKDIR ~ALIENS.TMP
COPY ~ALIENS.EXE ~ALIENS.TMP

CD ~ALIENS.TMP
~ALIENS
ALIENS

ECHO Y | DEL *.*
CD ..

RMDIR ~ALIENS.TMP

ECHO Done!
-----------------------------------------------------------------------

And so all of the program and support files are stored within one .EXE

--
Carl R White
E-mail...: cyrek- at -bigfoot.com              / Remove the hyphens before
Finger...: crwhite- at -dcsun1.comp.brad.ac.uk \ mailing or fingering...
Url......: http://www.bigfoot.com/~cyrek/

new topic     » goto parent     » topic index » view message » categorize

3. Re: Resources and Euphoria (Opening a new thread)

>Closest I've come to anything similar is a message I posted to the list a
>very long time ago.
>
>I include it here in case anyone missed it:
>

I see, but I was trying to mean something different. I don't want to have
one hundred files around. I.e. my thermometer program is made up of 31
files, most of them bitmaps or includes.
I would like to have a single .EXE file that once run could dynamically load
those bitmaps from itself, without having any other dependent file.
Moreover, I would like to be able of changing the bitmaps without touching
the binded executable.
So I was proposing to have a single file with a dual contents. At the
beginning, the normal .EXE. After the .EXE, a kind of "resource" file that
would consist on an array (or sequence) of headers that would describe the
later contents. A header should have a couple of pointers -where the
resource begins and its length-, a name -to identify it-, a descriptor -to
know what kind of resource is-, etc.
Thus I could change a single bitmap by adding it at the end of the .EXE and
updating the pointer and lenght parameters... You can think even in using
text resources to localize your program to different languages. Adding a new
language would be a matter of changing pointers and adding resources.
And the global benefit is a single file to store everything. If you want to
discard it, just a single delete command. No .INI, no registry...

JesusC.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Resources and Euphoria (Opening a new thread)

At 04:48 PM 6/3/98 +0200, Jesus wrote:

>I see, but I was trying to mean something different. I don't want to have
>one hundred files around. I.e. my thermometer program is made up of 31
>files, most of them bitmaps or includes.
>I would like to have a single .EXE file that once run could dynamically load
>those bitmaps from itself, without having any other dependent file.

Yes, this would be very useful.

>Moreover, I would like to be able of changing the bitmaps without touching
>the binded executable.
>So I was proposing to have a single file with a dual contents. At the
>beginning, the normal .EXE. After the .EXE, a kind of "resource" file that
>would consist on an array (or sequence) of headers that would describe the
>later contents. A header should have a couple of pointers -where the
>resource begins and its length-, a name -to identify it-, a descriptor -to
>know what kind of resource is-, etc.
>Thus I could change a single bitmap by adding it at the end of the .EXE and
>updating the pointer and lenght parameters... You can think even in using
>text resources to localize your program to different languages. Adding a new
>language would be a matter of changing pointers and adding resources.

Good idea, as long as the implementation is not as awkward as
in Tubbo Pascal/C, where all resources must be loaded with
arcane incantations...

>And the global benefit is a single file to store everything. If you want to
>discard it, just a single delete command. No .INI, no registry...

Except the .INI; it is sometimes very necessary to use a text
editor on an ini to get a program running properly.

>
>JesusC.
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: Resources and Euphoria (Opening a new thread)

On Wed, 3 Jun 1998, JesusC - Jesus Consuegra wrote:

> Carl R. White wrote:
> > Closest I've come to anything similar is a message I posted to the
> > list a very long time ago.

I'll apologise now for the long message I tagged on here and the next
long message below... :(

> I would like to have a single .EXE file that once run could dynamically load
> those bitmaps from itself, without having any other dependent file.

I'll get to working on something like this for Euphoria for DOS. It'll be
in some kind of propietary format, so unfortunately there might not be a
depacker until I figure out how I've packed the thing! :)
Also, I'm not sure of the applications of this kind of thing.  Would the
files/bitmaps be extracted to disk at any time, or would they just stay in
the .EXE?

> Moreover, I would like to be able of changing the bitmaps without touching
> the binded executable.
[space save]
> Thus I could change a single bitmap by adding it at the end of the .EXE and
> updating the pointer and lenght parameters... You can think even in using

I'm not sure I like what you imply here. This would mean that the
executable would increase in size every time the bitmap was altered and
resaved. A useless bitmap would be left unlinked but still present in the
.EXE. Just resaving over the original shouldn't cause problems, provided
the bitmap didn't change in size...

[yet_another_space_save]
> And the global benefit is a single file to store everything. If you want to
> discard it, just a single delete command. No .INI, no registry...

The ZIP2EXE solution is still a *very* close approximation IMHO. You could
always have the main program recreate the .EXE using a ZIPSFXer!

Actually, after rereading your post, I think you might be talking about
doing this in Win32... The zip approach will work to an extent under '95,
'98(ick!) or NT, since Win .EXEs can be started from a command prompt.

However, to do what you ask *properly* in Win32, I suggest looking up how
to create .DLLs, and then include an executable portion at the top.

Happy coding,
Carl

PS <grammarcheck> binded -> bound </grammarcheck> :) If English is your
second language though, I wouldn't worry too much about it. Check this
mail for how many grammatical errors I've made. :)

--
Carl R White
E-mail...: cyrek- at -bigfoot.com              / Remove the hyphens before
Finger...: crwhite- at -dcsun1.comp.brad.ac.uk \ mailing or fingering...
Url......: http://www.bigfoot.com/~cyrek/

new topic     » goto parent     » topic index » view message » categorize

6. Re: Resources and Euphoria (Opening a new thread)

Jesus wrote:

>So I was proposing to have a single file with a dual contents. At the
>beginning, the normal .EXE. After the .EXE, a kind of "resource" file =
that
>would consist on an array (or sequence) of headers that would describe =
the
>later contents. A header should have a couple of pointers -where the
>resource begins and its length-, a name -to identify it-, a descriptor =
-to
>know what kind of resource is-, etc.

I think this would be a great thing for Robert to include in Euphoria. =
I've been wanting something like that for a while. Something along the =
lines of:

   datafile <handle> <filename>

or

   datafile <handle> =3D <path>

Like include files, it could have two different behaviors. When =
non-bound, it would seek out the data file at the given location. When =
bound, it would have attached the data file to the EXE. Reading the data =
file would be the same as reading a normal file: you would still have to =
open it with the standard declarations.

I'm not that big a fan of being able to edit the thing once it's =
created.

You might also have the option of instead creating an INI file, with the =
same name as the EXE.

It would not be that difficult to write a pre-processor that could do =
this for you. Something along the lines of DOT, that recursively scans =
all the include files, but then builds a single resulting file. All the =
references to datafiles would be replaced with a reference to the INI =
file with the correct offset. Of course, it would need to rename all the =
non-global functions, procedures and types in the bundled file so there =
wouldn't be local namespace collisions.

Anyone interested? If so, I'll try to put it together. But I'd still =
prefer Robert include it as a feature in Euphoria.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

7. Re: Resources and Euphoria (Opening a new thread)

-----Mensaje original-----
De: Carl R. White <C.R.White at SCM.BRAD.AC.UK>

>I'm not sure I like what you imply here. This would mean that the
>executable would increase in size every time the bitmap was altered and
>resaved. A useless bitmap would be left unlinked but still present in the
>.EXE. Just resaving over the original shouldn't cause problems, provided
>the bitmap didn't change in size...


Yes, you're right, we would need some kind of resource manager to be able to
trim those unwanted resources.


>Actually, after rereading your post, I think you might be talking about
>doing this in Win32... The zip approach will work to an extent under '95,
>'98(ick!) or NT, since Win .EXEs can be started from a command prompt.


Yes, I think in Win32, but the solution is valid for both platforms.


>However, to do what you ask *properly* in Win32, I suggest looking up how
>to create .DLLs, and then include an executable portion at the top.


Nice idea. I'll think about.

>
>PS <grammarcheck> binded -> bound </grammarcheck> :) If English is your
>second language though, I wouldn't worry too much about it. Check this
>mail for how many grammatical errors I've made. :)


Yes, you're right. Is my fourth. We use to speak catalan araound here, and
the official one is spanish... At school I learned some french, (that I
unfortunately do not practice at all since 1980) and after all that I had to
learn some english... So apologies for those attacks to your nice language.
(My spell checker is very good, checking spanish...).

JesusC.

new topic     » goto parent     » topic index » view message » categorize

8. Re: Resources and Euphoria (Opening a new thread)

-----Mensaje original-----
De: David Cuny <dcuny at DSS.CA.GOV>

>Anyone interested? If so, I'll try to put it together. But I'd still prefer
Robert include it as >a feature in Euphoria.
>-- David Cuny

Besides me, you mean?.

JesusC.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Resources and Euphoria (Opening a new thread)

> Jesus wrote:
>
> >So I was proposing to have a single file with a dual contents. At the
> >beginning, the normal .EXE. After the .EXE, a kind of "resource" file that
> >would consist on an array (or sequence) of headers that would describe the
> >later contents. A header should have a couple of pointers -where the
> >resource begins and its length-, a name -to identify it-, a descriptor -to
> >know what kind of resource is-, etc.
>

hrmmmm....
If I read this right, you want data appended to a bound program.
Since binding _already_ appends 'data' (ergo: include files) and since
there is _already_ a program that converts data (bmp's I believe) into
'includable' files...(can't remember the filename for the bmp->include
converter...anyone?)...why not modify that program for your other data
types as well? the waves and such can all be turned into ahem 'ascii'
(after all, isn't all data ascii anyway :) )

Here's the benefits/detrements.
1> if you want to change the image or sound, you needn't worry about
what size it will end up nor do you need worry about resource/garbage
cleanup/management problems.  You simply edit the wavefile, convert to
the include file format and re-bind the program.  Euphoria then takes
care of the rest of the headaches automagically. Poof, no offset
worries,
no potential for typos of those offsets...etc.  Euph simply does what it
does best, read a sequence constant from an include.

2> because it _is_ a sequence... fun things also automagically happen.
example: waves.  fast forward and rewind become _slicing_ ;)

3> if you want others to be able to receive your single exe file and
subsequently be able to use a second program
(packer/unpacker/hacker/editor)
to modify those resources....dunno if this method proposed can
accomodate
that need... unbinding a bound program defeats (IMHO) the true purpose
of binding in the first case...work around for this becomes more of a
PKZIP (as previously mentioned) needed solution type.

4> if enduser isn't supposed to be able to modify these resources,
instead
only you, binding is perfect, and this solution addresses that.

5???? others i haven't seen anyone?

mike

new topic     » goto parent     » topic index » view message » categorize

10. Re: Resources and Euphoria (Opening a new thread)

------=_NextPart_000_0021_01BD8F1F.C43C82A0
        charset="iso-8859-1"
Content-Transfer-Encoding: 8bit


-----Original Message-----
De: JesusC - Jesus Consuegra <jconsuegra at REDESTB.ES>
Para: EUPHORIA at cwisserver1.mcs.muohio.edu
<EUPHORIA at cwisserver1.mcs.muohio.edu>
Fecha: miércoles 3 de junio de 1998 14:45
Asunto: Re: Resources and Euphoria (Opening a new thread)


>>Anyone interested? If so, I'll try to put it together. But I'd still
prefer
>Robert include it as >a feature in Euphoria.
>>-- David Cuny
>
>Besides me, you mean?.


I coded several months ago InstallKit (1.0). The executable and
documentation is at my webpage http://www27.pair.com/daber/architek .
Attached is the source code... it implemets the technique I've posted
several times to "embedd" data to a bounded Euphoria program.

Regards,
    Daniel Berstein
    daber at pair.com


------=_NextPart_000_0021_01BD8F1F.C43C82A0
        name="IK10SRC.zip"

new topic     » goto parent     » topic index » view message » categorize

11. Re: Resources and Euphoria (Opening a new thread)

mountains at MINDSPRING.COM wrote:

> At 04:48 PM 6/3/98 +0200, Jesus wrote:
>
> >I see, but I was trying to mean something different. I don't want to have
> >one hundred files around. I.e. my thermometer program is made up of 31
> >files, most of them bitmaps or includes.
> >I would like to have a single .EXE file that once run could dynamically load
> >those bitmaps from itself, without having any other dependent file.
>
> Yes, this would be very useful.
>
> >Moreover, I would like to be able of changing the bitmaps without touching
> >the binded executable.
> >So I was proposing to have a single file with a dual contents. At the
> >beginning, the normal .EXE. After the .EXE, a kind of "resource" file that
> >would consist on an array (or sequence) of headers that would describe the
> >later contents. A header should have a couple of pointers -where the
> >resource begins and its length-, a name -to identify it-, a descriptor -to
> >know what kind of resource is-, etc.
> >Thus I could change a single bitmap by adding it at the end of the .EXE and
> >updating the pointer and lenght parameters... You can think even in using
> >text resources to localize your program to different languages. Adding a new
> >language would be a matter of changing pointers and adding resources.
>
> Good idea, as long as the implementation is not as awkward as
> in Tubbo Pascal/C, where all resources must be loaded with
> arcane incantations...
>
> >And the global benefit is a single file to store everything. If you want to
> >discard it, just a single delete command. No .INI, no registry...
>
> Except the .INI; it is sometimes very necessary to use a text
> editor on an ini to get a program running properly.
>
> >
> >JesusC.
> >

  Couldn't we include bitmaps into an .e file? that would save... time... (gotta
get rid of the ... habit!) wouldn't it?

- "LEVIATHAN"

new topic     » goto parent     » topic index » view message » categorize

12. Re: Resources and Euphoria (Opening a new thread)

Yes, it would.
But them would be embedded into the program.
If you have them appended, you could change the resources without modifying
the program. Kinda of independency...
Jesus

>   Couldn't we include bitmaps into an .e file? that would save... time...
(gotta
> get rid of the ... habit!) wouldn't it?
>
> - "LEVIATHAN"

new topic     » goto parent     » topic index » view message » categorize

13. Re: Resources and Euphoria (Opening a new thread)

At 09:13 PM 6/3/98 -0700, you wrote:
>---------------------- Information from the mail header -----------------------
>Sender:       Euphoria Programming for MS-DOS <EUPHORIA at LISTSERV.MUOHIO.EDU>
>Poster:       Hawke <mdeland at NWINFO.NET>
>Subject:      Re: Resources and Euphoria (Opening a new thread)
>-------------------------------------------------------------------------------
>
>> Jesus wrote:
>>
>> >So I was proposing to have a single file with a dual contents. At the
>> >beginning, the normal .EXE. After the .EXE, a kind of "resource" file that
>> >would consist on an array (or sequence) of headers that would describe the
>> >later contents. A header should have a couple of pointers -where the
>> >resource begins and its length-, a name -to identify it-, a descriptor -to
>> >know what kind of resource is-, etc.
>>
>
>hrmmmm....
>If I read this right, you want data appended to a bound program.
>Since binding _already_ appends 'data' (ergo: include files) and since
>there is _already_ a program that converts data (bmp's I believe) into
>'includable' files...(can't remember the filename for the bmp->include
>converter...anyone?)...why not modify that program for your other data
>types as well? the waves and such can all be turned into ahem 'ascii'
>(after all, isn't all data ascii anyway :) )
>
>Here's the benefits/detrements......

The include file is one of mine, its called incbm.e
It already contains a routine called incseq() for including
data sequences, it is definatly the easiest way to include
small to medium sized amounts of data with a bound file.

The system does, however have one major draw-back; it requires
all included data to be declared as constant (loaded into memory
and possibly swapped out) at program execution. The system
Jesus and David Cuny are talking about would allow rescources
to be loaded and freed at will (highly desirable).

Graeme

BTW: One post of incbm.e had a couple of bugs
in it (like a 64K limit on data sequences). If
anyone is interested in using it you can get the
final version here:





----------------------------------------------------

new topic     » goto parent     » topic index » view message » categorize

14. Re: Resources and Euphoria (Opening a new thread)

Until we have a resource system working, yours is much better... blink
I plan to use it to include the bitmaps...
Thanks for recalling it.
Jesus

Graeme said:

> >Here's the benefits/detrements......
>
> The include file is one of mine, its called incbm.e
> It already contains a routine called incseq() for including
> data sequences, it is definatly the easiest way to include
> small to medium sized amounts of data with a bound file.
>
> The system does, however have one major draw-back; it requires
> all included data to be declared as constant (loaded into memory
> and possibly swapped out) at program execution. The system
> Jesus and David Cuny are talking about would allow rescources
> to be loaded and freed at will (highly desirable).

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu