caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ocaml magic file ...
@ 2002-01-09 16:20 Sven
  2002-01-11  9:55 ` Daniel de Rauglaudre
  0 siblings, 1 reply; 2+ messages in thread
From: Sven @ 2002-01-09 16:20 UTC (permalink / raw)
  To: caml-list

Hello, ...

I have this small magic file (to put in /etc/magic) for file to recognize the
various .cm* file types.

here it is :

-------- cut here --------------
# Magic local data for file(1) command.
# Insert here your local magic data. Format is described in magic(5).
0	string	Caml1999	Objective Caml
>8      string  X		exec file
>8	string	I		interface file\ (*.cmi)
>8	string	O		object file\ (*.cmo)
>8	string	A		library file\ (*.cma)
>8	string	Y		native object file\ (*.cmx)
>8      string  Z		native library file\ (*.cmxa)
>8      string  M		'ast_impl' file
>8      string  N		'ast_intf' file
>9	string	>\0		(Version %3.3s).
-------- cut here --------------

It gives this kind of output for the various ocaml kind of files i know of.

 digest.cmi: Objective Caml interface file\ (*.cmi) (Version 008).
 profiling.cmo: Objective Caml object file\ (*.cmo) (Version 004).
 dynlink.cma: Objective Caml library file\ (*.cma) (Version 006).
 random.cmx: Objective Caml native object file\ (*.cmx) (Version 006).
 bigarray.cmxa: Objective Caml native library file\ (*.cmxa) (Version 008).

I don't really know what the ast_impl, the ast_intf and the exec
file type are all about, so these may not be the best strings around.

I plan to sent this to the maintainer of the debian package including the file
utility, and would like other people to review it, just to see if i did a very
big mistake somewhere.

Also, feel free to move it to your /etc/magic, or to use it for any other kind
of use.

Friendly,

Sven Luther
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] ocaml magic file ...
  2002-01-09 16:20 [Caml-list] ocaml magic file Sven
@ 2002-01-11  9:55 ` Daniel de Rauglaudre
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel de Rauglaudre @ 2002-01-11  9:55 UTC (permalink / raw)
  To: caml-list

Hi,

On Wed, Jan 09, 2002 at 05:20:37PM +0100, Sven wrote:

> I have this small magic file (to put in /etc/magic) for file to
> recognize the various .cm* file types.

Under my Linux, it is /usr/share/magic. It works.

> I don't really know what the ast_impl, the ast_intf and the exec
> file type are all about, so these may not be the best strings around.

They are files holding syntax trees generated by camlp4. E.g.:
      camlp4o myfile.ml -o foobar.ml

The file "foobar.ml" is an ast_impl file. It is binary but compilable:
      ocamlc -c foobar.ml

The compiler loads the binary tree, the syntactic analysis is skipped
and the possible error messages show the initial file (myfile.ml).

With your magic file:
      file foobar.ml
      foobar.ml: Objective Caml 'ast_impl' file (Version 008).

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-11  9:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-09 16:20 [Caml-list] ocaml magic file Sven
2002-01-11  9:55 ` Daniel de Rauglaudre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).