"ocaml_beginners"::[] Dumping files in a .cm[ox]

View: New views
4 Messages — Rating Filter:   Alert me  

Parent Message unknown "ocaml_beginners"::[] Dumping files in a .cm[ox]

by Guillaume Yziquel-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi.

I'm thinking about encapsulating some existing javascript libraries in
an Eliom module for the Ocsigen server. I'd therefore like to know if
there is an easy way to dump large files into an OCaml module as raw
strings.

For instance, concerning the ExtJS library, I'd like to know this in
order to build a module that would programmatically provide themes for
this library: you specify colors and trasparancy, and the .gif and .css
files are adapted, while providing all the other .js files as text.
Stuff like that.

So what would be the easiest way to dump files as string into a .cmo, in
your opinion?

--
      Guillaume Yziquel
http://yziquel.homelinux.org/

"ocaml_beginners"::[] Re: Dumping files in a .cm[ox]

by Sylvain Le Gall-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 05-10-2009, Guillaume Yziquel <guillaume.yziquel@...> wrote:

> Hi.
>
> I'm thinking about encapsulating some existing javascript libraries in
> an Eliom module for the Ocsigen server. I'd therefore like to know if
> there is an easy way to dump large files into an OCaml module as raw
> strings.
>
> For instance, concerning the ExtJS library, I'd like to know this in
> order to build a module that would programmatically provide themes for
> this library: you specify colors and trasparancy, and the .gif and .css
> files are adapted, while providing all the other .js files as text.
> Stuff like that.
>
> So what would be the easiest way to dump files as string into a .cmo, in
> your opinion?

Take a look at ocamlify:
https://forge.ocamlcore.org/projects/ocamlify/
http://darcs.ocamlcore.org/cgi-bin/darcsweb.cgi?r=ocamlify;a=summary

You can also have a look at myocamlbuild.ml of ocaml-autobuild that
contains a snippet to build .mlify files:
http://darcs.ocamlcore.org/cgi-bin/darcsweb.cgi?r=ocaml-autobuild;a=headblob;f=/myocamlbuild.ml
(starting at line 67)

Regards
Sylvain Le Gall


Re: "ocaml_beginners"::[] Dumping files in a .cm[ox]

by Dario Teixeira-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

> I'm thinking about encapsulating some existing javascript libraries in
> an Eliom module for the Ocsigen server. I'd therefore like to know if
> there is an easy way to dump large files into an OCaml module as raw
> strings.

The xstrp4 package has a syntax extension that adds the directive
"include_file", whose usage is similar to C's #include.  I also know
that Christophe Troestler has recently added a similar functionality
to one of the modules in the Delimited Overloading project.  Either
package should serve your purposes fine.

Another solution is to go old school and use the linker to transform
your binary blob into a .o file that you can then embed into your
executable and access via the C interface.  I tried this once just
for kicks, and while it works, it is slightly masochistic if compared
to xstrp4 and/or pa_do.

Cheers,
Dario Teixeira



     

Re: "ocaml_beginners"::[] Dumping files in a .cm[ox]

by Guillaume Yziquel-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dario Teixeira a écrit :
> Hi,
>
>> I'm thinking about encapsulating some existing javascript libraries in
>> an Eliom module for the Ocsigen server. I'd therefore like to know if
>> there is an easy way to dump large files into an OCaml module as raw
>> strings.
>
> The xstrp4 package has a syntax extension that adds the directive
> "include_file", whose usage is similar to C's #include.

Just had a look at

http://projects.camlcity.org/projects/dl/xstrp4-1.7/sample.ml

and I believe it fits my needs.

> Cheers,
> Dario Teixeira

Thanks.

--
      Guillaume Yziquel
http://yziquel.homelinux.org/