Re: [Caml-list] Parsing cmi file

2012-03-19 Thread Richard W.M. Jones
On Wed, Mar 14, 2012 at 02:14:12PM -0400, Hongbo Zhang wrote:
> On 3/14/12 2:09 PM, Richard W.M. Jones wrote:
> >On Tue, Mar 13, 2012 at 05:52:37PM -0400, bob zhang wrote:
> >>Hi list,
> >>I noticed that Godi can pretty print cmi files, is there already
> >>libraries parsing cmi files?
> >cmigrep may be worth looking at.  It's also a nasty(-ish) hack since
> >it has to use the compiler sources.  I agree it would be nice to have
> >a formal API, but I can understand why the OCaml team wouldn't want to
> >have to maintain such a thing.
> >
> >Rich.
> >
> Thanks !
> I tried, it does not compile, but it would be not hard to fix, I guess.

Fedora carries some non-upstream patches (one taken from Debian) to
fix it:

http://pkgs.fedoraproject.org/gitweb/?p=ocaml-cmigrep.git;a=tree

There doesn't seem to be an active upstream at the moment.

Rich.

-- 
Richard Jones
Red Hat

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



Re: [Caml-list] Parsing cmi file

2012-03-14 Thread Mehdi Dogguy
On 03/14/2012 07:14 PM, Hongbo Zhang wrote:
> I tried, it does not compile, but it would be not hard to fix, I
> guess.
> 

In Debian, we apply the following patches to compile it:

http://patch-tracker.debian.org/package/cmigrep/1.5-9

FWIW, it compiles and runs perfectly well with any OCaml >= 3.10.

Regards,

-- 
Mehdi Dogguy مهدي الدڤي
http://dogguy.org/

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



Re: [Caml-list] Parsing cmi file

2012-03-14 Thread Hongbo Zhang

On 3/14/12 2:09 PM, Richard W.M. Jones wrote:

On Tue, Mar 13, 2012 at 05:52:37PM -0400, bob zhang wrote:

Hi list,
I noticed that Godi can pretty print cmi files, is there already
libraries parsing cmi files?

cmigrep may be worth looking at.  It's also a nasty(-ish) hack since
it has to use the compiler sources.  I agree it would be nice to have
a formal API, but I can understand why the OCaml team wouldn't want to
have to maintain such a thing.

Rich.


Thanks !
I tried, it does not compile, but it would be not hard to fix, I guess.

ocamlbrowser is unstable, it crashes every 2 hours(most times) on my 
computer


--
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



Re: [Caml-list] Parsing cmi file

2012-03-14 Thread Richard W.M. Jones
On Tue, Mar 13, 2012 at 05:52:37PM -0400, bob zhang wrote:
> Hi list,
>I noticed that Godi can pretty print cmi files, is there already
> libraries parsing cmi files?

cmigrep may be worth looking at.  It's also a nasty(-ish) hack since
it has to use the compiler sources.  I agree it would be nice to have
a formal API, but I can understand why the OCaml team wouldn't want to
have to maintain such a thing.

Rich.

-- 
Richard Jones
Red Hat

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



Re: [Caml-list] Parsing cmi file

2012-03-14 Thread David Brown

On Wed, Mar 14, 2012 at 01:25:49AM +0100, Gerd Stolpmann wrote:



Thanks.
I know the dirty tricks, is there some way not that dirty?
Godi did pretty printing this way?


Yes. But why do you consider it as dirty? There is nothing wrong with it,
isn't it? This uses a helper program with a well-defined interface.

I think you can also "use" ocamlc -i for it, maybe easier to wrap.


ocamlc -i will print out all of the types of the .ml file, not just
the interface.  It's useful, but not necessarily what is wanted.

The top trick doesn't work if the code isn't byte-compiled and has the
consequence of running the module.

It would be handy to be able to actually just dump out the .cmi file,
especially in cases, such as prebuilt packages that include the .cmi but
left out the .ml files.

David

--
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



Re: [Caml-list] Parsing cmi file

2012-03-13 Thread rixed
-[ Tue, Mar 13, 2012 at 05:52:37PM -0400, bob zhang ]
> Hi list,
>I noticed that Godi can pretty print cmi files, is there already
> libraries parsing cmi files?

Yes you can do this using the compiler libs (not installed by default
but debian have these in a separate package).
For an exemple of use see for instance the small tool displaying mli
signatures from this git repo:

git clone http://git.gitorious.org/ocalme/cmidump.git



-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



Re: [Caml-list] Parsing cmi file

2012-03-13 Thread Gerd Stolpmann

> Thanks.
> I know the dirty tricks, is there some way not that dirty?
> Godi did pretty printing this way?

Yes. But why do you consider it as dirty? There is nothing wrong with it,
isn't it? This uses a helper program with a well-defined interface.

I think you can also "use" ocamlc -i for it, maybe easier to wrap.

Gerd

> On Tue, Mar 13, 2012 at 6:36 PM, Gerd Stolpmann 
> wrote:
>>
>>> Hi list,
>>>    I noticed that Godi can pretty print cmi files, is there already
>>> libraries parsing cmi files?
>>
>> Yes, toplevellib.cma (i.e. the ocaml toploop). It's a silly trick. Run
>> the
>> toploop and do
>>
>> module M = ;;
>>
>> and the toploop responds.
>>
>> Gerd
>>
>>> Many thanks
>>> --
>>> -- Bob
>>>
>>> --
>>> Caml-list mailing list.  Subscription management and archives:
>>> https://sympa-roc.inria.fr/wws/info/caml-list
>>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>>>
>>>
>>>
>>
>>
>> --
>> Gerd Stolpmann, Darmstadt, Germany    g...@gerd-stolpmann.de
>> Creator of GODI and camlcity.org.
>> Contact details:        http://www.camlcity.org/contact.html
>> Company homepage:       http://www.gerd-stolpmann.de
>> *** Searching for new projects! Need consulting for system
>> *** programming in Ocaml? Gerd Stolpmann can help you.
>>
>
>
>
> --
> -- Bob
>
>


-- 
Gerd Stolpmann, Darmstadt, Germanyg...@gerd-stolpmann.de
Creator of GODI and camlcity.org.
Contact details:http://www.camlcity.org/contact.html
Company homepage:   http://www.gerd-stolpmann.de
*** Searching for new projects! Need consulting for system
*** programming in Ocaml? Gerd Stolpmann can help you.



-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



Re: [Caml-list] Parsing cmi file

2012-03-13 Thread bob zhang
Thanks.
I know the dirty tricks, is there some way not that dirty?
Godi did pretty printing this way?
On Tue, Mar 13, 2012 at 6:36 PM, Gerd Stolpmann  wrote:
>
>> Hi list,
>>    I noticed that Godi can pretty print cmi files, is there already
>> libraries parsing cmi files?
>
> Yes, toplevellib.cma (i.e. the ocaml toploop). It's a silly trick. Run the
> toploop and do
>
> module M = ;;
>
> and the toploop responds.
>
> Gerd
>
>> Many thanks
>> --
>> -- Bob
>>
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa-roc.inria.fr/wws/info/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>>
>>
>>
>
>
> --
> Gerd Stolpmann, Darmstadt, Germany    g...@gerd-stolpmann.de
> Creator of GODI and camlcity.org.
> Contact details:        http://www.camlcity.org/contact.html
> Company homepage:       http://www.gerd-stolpmann.de
> *** Searching for new projects! Need consulting for system
> *** programming in Ocaml? Gerd Stolpmann can help you.
>



-- 
-- Bob


-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



Re: [Caml-list] Parsing cmi file

2012-03-13 Thread Gerd Stolpmann

> Hi list,
>I noticed that Godi can pretty print cmi files, is there already
> libraries parsing cmi files?

Yes, toplevellib.cma (i.e. the ocaml toploop). It's a silly trick. Run the
toploop and do

module M = ;;

and the toploop responds.

Gerd

> Many thanks
> --
> -- Bob
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
>


-- 
Gerd Stolpmann, Darmstadt, Germanyg...@gerd-stolpmann.de
Creator of GODI and camlcity.org.
Contact details:http://www.camlcity.org/contact.html
Company homepage:   http://www.gerd-stolpmann.de
*** Searching for new projects! Need consulting for system
*** programming in Ocaml? Gerd Stolpmann can help you.



-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



[Caml-list] Parsing cmi file

2012-03-13 Thread bob zhang
Hi list,
   I noticed that Godi can pretty print cmi files, is there already
libraries parsing cmi files?
Many thanks
-- 
-- Bob

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs