chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Including binary data in eggs


From: Kon Lovett
Subject: Re: [Chicken-users] Including binary data in eggs
Date: Mon, 22 May 2006 17:12:17 -0700

On May 22, 2006, at 4:25 PM, Alejandro Forero Cuervo wrote:


Hi.

For my stream-flash and associated eggs (for generating Shockwave
Flash files) I want to make the contents of a relatively big binary
file available for the egg.  My file is called freeserif.fo (and
contains a tag for Flash that defines a font) and I want to be able to
access it at run-time.  What should I do?  I see the following
options:

1. Actually including the file somehow in my source code.  This would
be the worst option, since it would be the least maintainable.

2. Somehow opening and reading the file into a string at compile time.
How can I do this?  Should I use a macro?

Compile-time or run-time (load-time)? Using eval-when you can read the file at the phase of your choice.


3. When the egg is installed, make sure the freeserif.fo file gets
copied to the eggs' directory (I would, obviously, prepend it with the
name of my egg).  And then, at run time, open the file from that
directory.  This sounds to me like the best option, assuming some
framework to do this exists (and by "framework" I simply mean
something along the lines of having a variable refering to the eggs'
directory and a way to copy data files there during the installation
of eggs).

What would you advise me to do?

Copy the any data files to the chicken repository (from bloom- filter.setup):

(define-macro (copy-to-repository FN)
        `(copy-file
                (make-pathname "." (->string ,FN))
                (make-pathname (repository-path) (->string ,FN))))

(copy-to-repository "hash-primitives-info")

The srfi-19 egg has an example using sub-directories.

Felix had an answer to a similar question: http://lists.gnu.org/ archive/html/chicken-users/2004-02/msg00020.html

You probably would just use '(read-string #f <port>)' since this will read to eof.

HTH,
Kon


Thanks!

Alejo.
http://azul.freaks-unidos.net/

Ps: I have more details about my Flash egg and some sample files at:
<http://wiki.freaks-unidos.net/chicken%20eggs/stream-flash-round- tree>.


_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users





reply via email to

[Prev in Thread] Current Thread [Next in Thread]