From 03cce8d1fba8739d70561e0039557918172f0c3b Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Thu, 17 May 2018 15:33:38 -0700 Subject: [PATCH] Clean up some comments. --- include/basetype.h | 1 + include/custom.h | 6 +----- include/function_list.h | 23 +++++++++++++++++++++++ include/interpreter.h | 20 ++++++++++++++++++++ include/parser.h | 9 +++++++++ 5 files changed, 54 insertions(+), 5 deletions(-) diff --git a/include/basetype.h b/include/basetype.h index 6cccb0c..fe3418b 100644 --- a/include/basetype.h +++ b/include/basetype.h @@ -52,6 +52,7 @@ typedef struct libab_basetype_s libab_basetype; * Initializes a base type, including all the parameters that it needs * to take. * @param basetype the type that is being initialized. + * @param free_function to function used to free the data in this basetype. * @param n the number of type parameters it has. * @param params the parameters this basetype accepts. */ diff --git a/include/custom.h b/include/custom.h index 1a989b2..3bab1c9 100644 --- a/include/custom.h +++ b/include/custom.h @@ -32,7 +32,7 @@ enum libab_behavior_variant_e { BIMPL_INTERNAL, BIMPL_TREE }; */ struct libab_behavior_s { /** - * The variant of this implementation. + * The variant of this behavior. */ enum libab_behavior_variant_e variant; union { @@ -98,7 +98,6 @@ typedef struct libab_function_s libab_function; /** * Initializes a behavior that uses an internal function. * @param behavior the behavior to initialize. - * @param type the type of the behavior. * @param func the function that this behavior calls. */ void libab_behavior_init_internal(libab_behavior* behavior, @@ -107,7 +106,6 @@ void libab_behavior_init_internal(libab_behavior* behavior, * Initializes a behavior that uses a tree that has been * parsed from the user. * @param behavior the behavior to initialize. - * @param type the type of the behavior. * @param tree the tree that this behavior uses. */ void libab_behavior_init_tree(libab_behavior* behavior, libab_tree* tree); @@ -137,7 +135,6 @@ void libab_operator_free(libab_operator* op); /** * Initializes a function with the given internal behavior. * @param function the function to initialize. - * @param type the type of the function. * @param fun the function implementation. * @return the result of the initialization. */ @@ -146,7 +143,6 @@ libab_result libab_function_init_internal(libab_function* function, /** * Initializes a function with the given tree behavior. * @param function the function to initialize. - * @param type the type of the function. * @param tree the tree that represents the function's behavior. * @return the result of the initialization. */ diff --git a/include/function_list.h b/include/function_list.h index 8e4b291..852b11c 100644 --- a/include/function_list.h +++ b/include/function_list.h @@ -3,15 +3,38 @@ #include "ref_vec.h" +/** + * A list of function values, + * returned if a name of an overloaded + * function is used. + */ struct libab_function_list_s { + /** + * The function list. + */ libab_ref_vec functions; }; typedef struct libab_function_list_s libab_function_list; +/** + * Initializes a function list. + * @param list the list to intialize. + * @return the result of the initialization. + */ libab_result libab_function_list_init(libab_function_list* list); +/** + * Inserts a new function value into the list. + * @param list the list to insert into. + * @param function_value the function value to insert. + * @return the result of the insertion. + */ libab_result libab_function_list_insert(libab_function_list* list, libab_ref* function_value); +/** + * Frees the given function list. + * @param list the list to free. + */ void libab_function_list_free(libab_function_list* list); #endif diff --git a/include/interpreter.h b/include/interpreter.h index 1749bdf..f75e6bf 100644 --- a/include/interpreter.h +++ b/include/interpreter.h @@ -8,15 +8,35 @@ struct libab_s; +/** + * The interpreter struct used to encapsulate + * any interpreter-specific data. + */ struct libab_interpreter_s { struct libab_s* ab; }; typedef struct libab_interpreter_s libab_interpreter; +/** + * Initializes an interpreter instance. + * @param intr the interpreter to initialize. + * @param ab the libabacus instance this interpreter belongs to. + */ void libab_interpreter_init(libab_interpreter* intr, struct libab_s* ab); +/** + * Uses the interpreter to run the given parse tree. + * @param intr the interpreter to use to run the code. + * @param tree the tree to run. + * @param into the reference into which the result of the execution will be stored. + * @return the result of the execution. + */ libab_result libab_interpreter_run(libab_interpreter* intr, libab_tree* tree, libab_ref* into); +/** + * Frees the given interpreter. + * @param intr the interpreter to free. + */ void libab_interpreter_free(libab_interpreter* intr); #endif diff --git a/include/parser.h b/include/parser.h index 2a804af..7f7de19 100644 --- a/include/parser.h +++ b/include/parser.h @@ -31,9 +31,18 @@ void libab_parser_init(libab_parser* parser, struct libab_s* ab); * @param tokens the tokens to use for parsing. * @param string the string to use for determining token values. * @param store_into tree pointer to store the new data into. + * @return the result of parsing the tree. */ libab_result libab_parser_parse(libab_parser* parser, ll* tokens, const char* string, libab_tree** store_into); +/** + * Parses a type into the given reference. + * @param parser the parser to use for parsing text. + * @param tokens the tokens to use for parsing. + * @param string the string from which the tokens came from. + * @param store_into the reference into which to place the type. + * @return the result of parsing the type. + */ libab_result libab_parser_parse_type(libab_parser* parser, ll* tokens, const char* string, libab_ref* store_into); /**