function definitions now remember the Lip_Object symbols and keys

not only the strings.. wtf was I thinkingh before?
This commit is contained in:
Felix Brendel
2019-07-17 16:44:01 +02:00
parent 688cc02a54
commit 02063bf6fb
8 changed files with 80 additions and 84 deletions
+8 -8
View File
@@ -26,23 +26,23 @@ proc Lisp_Object_Type_to_string(Lisp_Object_Type type) -> const char* {
proc create_positional_argument_list(int initial_capacity) -> Positional_Arguments* {
Positional_Arguments* ret = new(Positional_Arguments);
ret->identifiers = (String**)malloc(initial_capacity * sizeof(String*));
ret->symbols = (Lisp_Object**)malloc(initial_capacity * sizeof(Lisp_Object*));
ret->next_index = 0;
ret->length = initial_capacity;
return ret;
}
proc append_to_positional_argument_list(Positional_Arguments* args, String* identifier) -> void {
proc append_to_positional_argument_list(Positional_Arguments* args, Lisp_Object* sym) -> void {
if (args->next_index == args->length) {
args->length *= 2;
args->identifiers = (String**)realloc(args->identifiers, args->length * sizeof(String*));
args->symbols = (Lisp_Object**)realloc(args->symbols, args->length * sizeof(Lisp_Object*));
}
args->identifiers[args->next_index++] = identifier;
args->symbols[args->next_index++] = sym;
}
proc create_keyword_argument_list(int initial_capacity) -> Keyword_Arguments* {
Keyword_Arguments* ret = new(Keyword_Arguments);
ret->identifiers = (String**)malloc(initial_capacity * sizeof(String*));
ret->keywords = (Lisp_Object**)malloc(initial_capacity * sizeof(Lisp_Object*));
ret->values = create_Lisp_Object_array_list(initial_capacity);
ret->next_index = 0;
ret->length = initial_capacity;
@@ -50,14 +50,14 @@ proc create_keyword_argument_list(int initial_capacity) -> Keyword_Arguments* {
}
proc append_to_keyword_argument_list(Keyword_Arguments* args,
String* identifier,
Lisp_Object* keyword,
Lisp_Object* default_value) -> void
{
if (args->next_index == args->length) {
args->length *= 2;
args->identifiers = (String**)realloc(args->identifiers, args->length * sizeof(String*));
args->keywords = (Lisp_Object**)realloc(args->keywords, args->length * sizeof(Lisp_Object*));
}
args->identifiers[args->next_index++] = identifier;
args->keywords[args->next_index++] = keyword;
append_to_array_list(args->values, default_value);
}