Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] get the name of the current module in a plugin

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] get the name of the current module in a plugin


Chronological Thread 
  • From: Alan Schmitt <alan.schmitt AT polytechnique.org>
  • To: Pierre-Marie Pédrot <pierre-marie.pedrot AT inria.fr>
  • Cc: Coq <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] get the name of the current module in a plugin
  • Date: Mon, 25 Jun 2012 14:55:05 +0200

On 25 juin 2012, at 12:19, Pierre-Marie Pédrot wrote:

> Hello,
>
> On 22/06/2012 09:59, Alan Schmitt wrote:
>> I'm writing a plugin where at some point I need to find the
>> module_path of the current module. Is there function to do this?
>
> I think what you're looking for is the Lib.cwd function.

Thanks, that helped me. So to fetch all the constants of the current module,
I do the following:

let curpath = Lib.cwd () in
let pe = Environ.pre_env (Global.env ()) in
let consts = pe.Pre_env.env_globals.Pre_env.env_constants in
let local_consts = Cmap_env.filter (fun c _ -> con_modpath c = MPfile
curpath) consts in


Thanks again,

Alan


Archive powered by MHonArc 2.6.18.

Top of Page