summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/apimagic/apimagic.h121
1 files changed, 67 insertions, 54 deletions
diff --git a/include/apimagic/apimagic.h b/include/apimagic/apimagic.h
index 45403bc..57a24fa 100644
--- a/include/apimagic/apimagic.h
+++ b/include/apimagic/apimagic.h
@@ -78,6 +78,11 @@ enum amgc_output_action {
AMGC_LIST_FUNCTION,
};
+struct amgc_input {
+ void * addr;
+ size_t size;
+};
+
struct amgc_source_version {
int major;
int minor;
@@ -85,11 +90,6 @@ struct amgc_source_version {
const char * commit;
};
-struct amgc_input {
- void * addr;
- size_t size;
-};
-
struct amgc_action {
enum amgc_action_type type;
int action;
@@ -186,69 +186,82 @@ struct amgc_layout {
int tabwidth;
};
-/* package info */
-amgc_api const struct amgc_source_version * amgc_source_version(void);
-
/* driver api */
-amgc_api int amgc_get_driver_ctx (char ** argv, char ** envp, uint32_t flags, struct amgc_driver_ctx **);
-amgc_api void amgc_free_driver_ctx (struct amgc_driver_ctx *);
+amgc_api int amgc_get_driver_ctx (char **, char **, uint32_t,
+ struct amgc_driver_ctx **);
+
+amgc_api void amgc_free_driver_ctx (struct amgc_driver_ctx *);
-amgc_api int amgc_get_unit_ctx (const struct amgc_driver_ctx *, const char * path, struct amgc_unit_ctx **);
-amgc_api void amgc_free_unit_ctx (struct amgc_unit_ctx *);
+amgc_api int amgc_get_unit_ctx (const struct amgc_driver_ctx *,
+ const char *,
+ struct amgc_unit_ctx **);
-amgc_api int amgc_map_input (const struct amgc_driver_ctx *, int fd, const char * path, int prot, struct amgc_input *);
-amgc_api int amgc_unmap_input (struct amgc_input *);
+amgc_api void amgc_free_unit_ctx (struct amgc_unit_ctx *);
/* driver helper api */
-amgc_api int amgc_lang_std_from_string (const char * std);
+amgc_api int amgc_lang_std_from_string (const char *);
/* utility api */
-amgc_api int amgc_main (int, char **, char **);
-amgc_api int amgc_list_unit_defines (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_list_unit_enums (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_list_unit_typedefs (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_list_unit_structs (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_list_unit_unions (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_list_unit_functions (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
-
-amgc_api int amgc_output_unit_defines (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_output_unit_enums (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_output_unit_typedefs (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_output_unit_structs (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_output_unit_unions (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_main (int, char **, char **);
+amgc_api int amgc_list_unit_defines (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_list_unit_enums (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_list_unit_typedefs (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_list_unit_structs (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_list_unit_unions (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_list_unit_functions (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
+
+amgc_api int amgc_output_unit_defines (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_output_unit_enums (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_output_unit_typedefs (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_output_unit_structs (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_output_unit_unions (const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
amgc_api int amgc_output_unit_functions(const struct amgc_unit_ctx *, const struct amgc_layout *, FILE *);
/* utility helper api */
-amgc_api int amgc_perform_unit_action (const struct amgc_unit_ctx *, const struct amgc_action *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_output_unit_entities (const struct amgc_unit_ctx *, int kind, int subset, const struct amgc_layout *, FILE *);
-
-amgc_api int amgc_output_error_record (const struct amgc_driver_ctx *, const struct amgc_error_info *);
-amgc_api int amgc_output_error_vector (const struct amgc_driver_ctx *);
-
-amgc_api int amgc_get_entity_index (const struct amgc_entity[], const char *);
-amgc_api int amgc_get_define_index (const struct amgc_unit_ctx *, const char *);
-amgc_api int amgc_get_enum_index (const struct amgc_unit_ctx *, const char *);
-amgc_api int amgc_get_typedef_index (const struct amgc_unit_ctx *, const char *);
-amgc_api int amgc_get_struct_index (const struct amgc_unit_ctx *, const char *);
-amgc_api int amgc_get_union_index (const struct amgc_unit_ctx *, const char *);
-amgc_api int amgc_get_function_index (const struct amgc_unit_ctx *, const char *);
-
-amgc_api int amgc_output_pad_symbol (const char *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_output_unit_enum (const struct amgc_unit_ctx *, const union entity_t *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_output_custom_enum (const struct amgc_entity *, const struct amgc_entity[], const struct amgc_layout *, FILE *);
-amgc_api int amgc_output_typedef (const struct amgc_unit_ctx *, const struct amgc_entity *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_output_compound (const struct amgc_unit_ctx *, const struct amgc_entity *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_output_struct (const struct amgc_unit_ctx *, const struct amgc_entity *, const struct amgc_layout *, FILE *);
-amgc_api int amgc_output_union (const struct amgc_unit_ctx *, const struct amgc_entity *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_perform_unit_action (const struct amgc_unit_ctx *,
+ const struct amgc_action *,
+ const struct amgc_layout *,
+ FILE *);
+
+amgc_api int amgc_output_unit_entities (const struct amgc_unit_ctx *,
+ int, int, const struct amgc_layout *,
+ FILE *);
+
+amgc_api int amgc_get_entity_index (const struct amgc_entity[], const char *);
+amgc_api int amgc_get_define_index (const struct amgc_unit_ctx *, const char *);
+amgc_api int amgc_get_enum_index (const struct amgc_unit_ctx *, const char *);
+amgc_api int amgc_get_typedef_index (const struct amgc_unit_ctx *, const char *);
+amgc_api int amgc_get_struct_index (const struct amgc_unit_ctx *, const char *);
+amgc_api int amgc_get_union_index (const struct amgc_unit_ctx *, const char *);
+amgc_api int amgc_get_function_index (const struct amgc_unit_ctx *, const char *);
+
+amgc_api int amgc_output_pad_symbol (const char *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_output_unit_enum (const struct amgc_unit_ctx *, const union entity_t *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_output_custom_enum (const struct amgc_entity *, const struct amgc_entity[], const struct amgc_layout *, FILE *);
+amgc_api int amgc_output_typedef (const struct amgc_unit_ctx *, const struct amgc_entity *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_output_compound (const struct amgc_unit_ctx *, const struct amgc_entity *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_output_struct (const struct amgc_unit_ctx *, const struct amgc_entity *, const struct amgc_layout *, FILE *);
+amgc_api int amgc_output_union (const struct amgc_unit_ctx *, const struct amgc_entity *, const struct amgc_layout *, FILE *);
+
+/* error trace api */
+amgc_api int amgc_output_error_record (const struct amgc_driver_ctx *, const struct amgc_error_info *);
+amgc_api int amgc_output_error_vector (const struct amgc_driver_ctx *);
+
+/* raw input api */
+amgc_api int amgc_map_input (const struct amgc_driver_ctx *, int fd, const char * path, int prot, struct amgc_input *);
+amgc_api int amgc_unmap_input (struct amgc_input *);
/* low-level api */
-amgc_api int amgc_init_unit_meta (const struct amgc_unit_ctx *, struct amgc_unit_meta *);
+amgc_api int amgc_init_unit_meta (const struct amgc_unit_ctx *, struct amgc_unit_meta *);
-amgc_api int amgc_get_unit_entities (const struct amgc_unit_ctx *, struct amgc_unit_meta *, struct amgc_unit_entities **);
-amgc_api void amgc_free_unit_entities (struct amgc_unit_entities *);
+amgc_api int amgc_get_unit_entities (const struct amgc_unit_ctx *, struct amgc_unit_meta *, struct amgc_unit_entities **);
+amgc_api void amgc_free_unit_entities (struct amgc_unit_entities *);
-amgc_api int amgc_get_enum_members (const struct amgc_unit_ctx *, const union entity_t *, struct amgc_entity **);
-amgc_api void amgc_free_enum_members (struct amgc_entity *);
+amgc_api int amgc_get_enum_members (const struct amgc_unit_ctx *, const union entity_t *, struct amgc_entity **);
+amgc_api void amgc_free_enum_members (struct amgc_entity *);
+
+/* package info */
+amgc_api const struct amgc_source_version * amgc_source_version(void);
#ifdef __cplusplus
}