module Pa_type_conv: sig
.. end
Pa_type_conv: Preprocessing Module for Registering Type Conversions
Generator registration
val set_conv_path_if_not_set : Camlp4.PreCast.Ast.Loc.t -> unit
set_conv_path_if_not_set loc
sets the path to the file/module being
converted for improved error messages.
val get_conv_path : unit -> string
get_conv_path ()
Returns the name to module containing a type
as required for error messages.
val add_generator : ?is_exn:bool ->
string -> (Camlp4.PreCast.Ast.ctyp -> Camlp4.PreCast.Ast.str_item) -> unit
add_generator ?is_exn name gen
adds the code generator gen
,
which maps type or exception declarations to structure items, where
is_exn
specifies whether the declaration is an exception. Note that
the original type/exception declarations get added automatically in
any case.
is_exn
: = false
val add_generator_with_arg : ?is_exn:bool ->
string ->
'a Camlp4.PreCast.Gram.Entry.t ->
('a option -> Camlp4.PreCast.Ast.ctyp -> Camlp4.PreCast.Ast.str_item) -> unit
add_generator_with_arg ?is_exn name entry generator
same as
add_generator
, but the generator may accept an argument, which is
parsed with entry
.
val rm_generator : ?is_exn:bool -> string -> unit
rm_generator ?is_exn name
removes the code generator named name
for types if is_exn
is false
, or exceptions otherwise.
is_exn
: = false
val add_sig_generator : ?is_exn:bool ->
string -> (Camlp4.PreCast.Ast.ctyp -> Camlp4.PreCast.Ast.sig_item) -> unit
add_sig_generator ?is_exn name gen
adds the code generator gen
,
which maps type or exception declarations to signature items, where
is_exn
specifies whether the declaration is an exception. Note that the
original type/exception declarations get added automatically in any case.
is_exn
: = false
val add_sig_generator_with_arg : ?is_exn:bool ->
string ->
'a Camlp4.PreCast.Gram.Entry.t ->
('a option -> Camlp4.PreCast.Ast.ctyp -> Camlp4.PreCast.Ast.sig_item) -> unit
add_sig_generator_with_arg ?is_exn name entry generator
same as
add_sig_generator
, but the generator may accept an argument,
which is parsed with entry
.
val rm_sig_generator : ?is_exn:bool -> string -> unit
rm_sig_generator ?is_exn name
removes the signature code generator named
name
for types if is_exn
is false
, or exceptions otherwise.
is_exn
: = false
type
record_field_generator = Camlp4.PreCast.Ast.Loc.t -> unit
Type of record field code generators
val add_record_field_generator : string -> record_field_generator -> unit
add_record_field_generator gen_name gen
adds the record field code
generator gen
with name gen_name
, which acts on the location
identifiying the record field.
val add_record_field_generator_with_arg : string ->
'a Camlp4.PreCast.Gram.Entry.t ->
('a option -> record_field_generator) -> unit
add_record_field_generator_with_arg name entry generator
same as
add_record_field_generator
, but the generator
takes an argument,
which is parsed with entry
. If None
is passed to the generator,
parsing of the argument failed, otherwise Some arg
will be passed,
where arg
is the successfully parsed argument.
val rm_record_field_generator : string -> unit
rm_record_field_generator name
removes the record field code generator
named name
.
Utility functions
val get_loc_err : Camlp4.PreCast.Ast.Loc.t -> string -> string
get_loc_err loc msg
generates a compile-time error message.
val hash_variant : string -> int
hash_variant str
Returns the integer encoding a variant tag with
name str
.
General purpose code generation module
module Gen: sig
.. end