Commit 974589fd authored by Pietro Abate's avatar Pietro Abate

[r2005-03-04 15:26:27 by afrisch] #builtins directive

Original author: afrisch
Date: 2005-03-04 15:26:28+00:00
parent 6a2af5ae
......@@ -70,14 +70,15 @@ package: clean
#cvs_snapshot:
# $(MAKE) package VERSION=cvs`date +%Y%m%d`
MSTONE=2
cvs_snapshot:
(cd /tmp; \
rm -Rf cduce; \
cvs -z3 -d ":pserver:anonymous@cvs.cduce.org:/cvsroot" co cduce; \
tar czf cduce-cvs.tar.gz cduce; \
tar czf cduce-cvs$(MSTONE).tar.gz cduce; \
rm -Rf cduce; \
scp cduce-cvs.tar.gz cduce@iris.ens.fr:public_html/download; \
rm -f cduce-cvs.tar.gz)
scp cduce-cvs$(MSTONE).tar.gz cduce@iris.ens.fr:public_html/download; \
rm -f cduce-cvs$(MSTONE).tar.gz)
OCAML_STDLIBDIR := $(shell ocamlc -where)
.PHONY: .ocamlinit
......
......@@ -265,6 +265,11 @@ let directive ppf tenv cenv = function
silent := true
| `Verbose ->
silent := false
| `Builtins ->
let b = Librarian.get_builtins () in
Format.fprintf ppf "Embedded OCaml value: ";
List.iter (fun s -> Format.fprintf ppf "%s " s) b;
Format.fprintf ppf "@."
let print_id_opt ppf = function
| None -> Format.fprintf ppf "-"
......
......@@ -283,6 +283,10 @@ let static_externals = Hashtbl.create 17
let register_static_external n v =
Hashtbl.add static_externals n v
let get_builtins () =
List.sort Pervasives.compare
(Hashtbl.fold (fun n _ accu -> n::accu) static_externals [])
let () =
Typer.from_comp_unit := (fun cu -> (load cu).typing);
Typer.has_comp_unit := has_obj;
......
......@@ -29,4 +29,4 @@ val stub_ml : (string -> Typer.t -> Compile.env ->
stub_ml option * Types.t array) ref
val register_static_external: string -> Value.t -> unit
val get_builtins: unit -> string list
......@@ -35,6 +35,7 @@ and toplevel_directive =
| `Debug of debug_directive
| `Verbose
| `Silent
| `Builtins
]
......
......@@ -159,6 +159,7 @@ EXTEND
| "#"; IDENT "dump_value"; e = expr -> [ mk loc (Directive (`Dump e)) ]
| "#"; IDENT "reinit_ns" -> [ mk loc (Directive `Reinit_ns) ]
| "#"; IDENT "help" -> [ mk loc (Directive `Help) ]
| "#"; IDENT "builtins" -> [ mk loc (Directive `Builtins) ]
| "include"; s = STRING2 ->
let s =
if Filename.is_relative s
......
......@@ -374,6 +374,11 @@ the name of an OCaml unit (like <code>List</code>). Empty lines
and lines starting with a sharp character are ignored.
</p>
<p>
In a custom toplevel, the directive <code>#builtins</code> prints the name
of embedded OCaml values.
</p>
</box>
<box title="Examples" link="examples">
......
......@@ -250,6 +250,11 @@ values and types with namespaces (see <local href="namespaces"/>).
Schema</local> documents).
</p>
<p>
The toplevel directive <code>#builtins</code> prints the name
of embedded OCaml values (see <local href="manual_interfacewithocaml"/>).
</p>
<p>
The toplevel has no line editing facilities.
You can use an external wrapper such as
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment