git.annexia.org
/
wrappi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add enums.
[wrappi.git]
/
generator-lib
/
wrappi_accumulator.ml
diff --git
a/generator-lib/wrappi_accumulator.ml
b/generator-lib/wrappi_accumulator.ml
index
1254979
..
3713d35
100644
(file)
--- a/
generator-lib/wrappi_accumulator.ml
+++ b/
generator-lib/wrappi_accumulator.ml
@@
-26,12
+26,12
@@
open Printf
let check_not_defined name new_ map thing get_loc =
try
let old = StringMap.find name map in
let check_not_defined name new_ map thing get_loc =
try
let old = StringMap.find name map in
- eprintf "generator: %s %s redefined\n" thing name;
+ eprintf "generator:
error:
%s %s redefined\n" thing name;
let old_loc = get_loc old in
let new_loc = get_loc new_ in
let old_loc = get_loc old in
let new_loc = get_loc new_ in
- eprintf " first definition at %s
:
%d\n"
+ eprintf " first definition at %s
line
%d\n"
(Loc.file_name old_loc) (Loc.start_line old_loc);
(Loc.file_name old_loc) (Loc.start_line old_loc);
- eprintf " second definition at %s
:
%d\n"
+ eprintf " second definition at %s
line
%d\n"
(Loc.file_name new_loc) (Loc.start_line new_loc);
exit 1
with
(Loc.file_name new_loc) (Loc.start_line new_loc);
exit 1
with
@@
-86,15
+86,23
@@
let rec resolve_typedefs thing name loc = function
| TNullable t -> TNullable (resolve_typedefs thing name loc t)
| TTypedef tname ->
| TNullable t -> TNullable (resolve_typedefs thing name loc t)
| TTypedef tname ->
- try (StringMap.find tname !tds).td_type
+ try
+ let td = StringMap.find tname !tds in
+ let t = td.td_type in
+ (* The typedef may be a typedef, so we need to recursively
+ * resolve the type.
+ *)
+ resolve_typedefs "typedef" td.td_name td.td_loc t
with Not_found ->
with Not_found ->
- eprintf "generator: could not resolve typedef %s\n" tname;
- eprintf " in definition of %s %s at %s:%d\n"
+ eprintf "generator: error: could not resolve typedef %s to a basic type\n"
+ tname;
+ eprintf " in definition of %s %s at %s line %d\n"
thing name (Loc.file_name loc) (Loc.start_line loc);
exit 1
let resolve_typedefs_in_ret thing name loc = function
thing name (Loc.file_name loc) (Loc.start_line loc);
exit 1
let resolve_typedefs_in_ret thing name loc = function
- | RErr as t -> t
+ | (RVoid
+ | RStaticString) as t -> t
| Return t -> Return (resolve_typedefs thing name loc t)
let get_api () =
| Return t -> Return (resolve_typedefs thing name loc t)
let get_api () =