adjustments based on odin bindings drafting

This commit is contained in:
Edward R. Gonzalez 2025-02-03 11:26:03 -05:00
parent d08efcb5ef
commit 0d8f30b25c
3 changed files with 17 additions and 4 deletions

View File

@ -53,7 +53,8 @@ GEN_API CodeParams end_CodeParams (CodeParams params);
GEN_API CodeParams next_CodeParams (CodeParams params, CodeParams entry_iter);
GEN_API bool specifiers_append (CodeSpecifiers specifiers, Specifier spec);
GEN_API s32 specifiers_has (CodeSpecifiers specifiers, Specifier spec);
GEN_API bool specifiers_has (CodeSpecifiers specifiers, Specifier spec);
GEN_API s32 specifiers_index_of (CodeSpecifiers specifiers, Specifier spec);
GEN_API s32 specifiers_remove (CodeSpecifiers specifiers, Specifier to_remove );
GEN_API StrBuilder specifiers_to_strbuilder (CodeSpecifiers specifiers);
GEN_API void specifiers_to_strbuilder_ref(CodeSpecifiers specifiers, StrBuilder* result);
@ -150,6 +151,8 @@ GEN_API void using_to_strbuilder_ns (CodeUsing op_cast, StrBuilder* result
GEN_API StrBuilder var_to_strbuilder (CodeVar self);
GEN_API void var_to_strbuilder_ref(CodeVar self, StrBuilder* result);
// TODO(Ed): Move C-Interface inlines here...
#pragma endregion Code Type C-Interface
#if GEN_COMPILER_CPP

View File

@ -296,7 +296,17 @@ bool specifiers_append(CodeSpecifiers self, Specifier spec )
return true;
}
inline
s32 specifiers_has(CodeSpecifiers self, Specifier spec)
bool specifiers_has(CodeSpecifiers self, Specifier spec)
{
GEN_ASSERT(self != nullptr);
for ( s32 idx = 0; idx < self->NumEntries; idx++ ) {
if ( self->ArrSpecs[ idx ] == spec )
return true;
}
return false;
}
inline
s32 specifiers_index_of(CodeSpecifiers self, Specifier spec)
{
GEN_ASSERT(self != nullptr);
for ( s32 idx = 0; idx < self->NumEntries; idx++ ) {

View File

@ -280,7 +280,7 @@ struct Opts_def_variable
GEN_API CodeVar def_variable( CodeTypename type, Str name, Opts_def_variable opts GEN_PARAM_DEFAULT );
// Constructs an empty body. Use AST::validate_body() to check if the body is was has valid entries.
GEN_API CodeBody def_body( CodeType type );
CodeBody def_body( CodeType type );
// There are two options for defining a struct body, either varadically provided with the args macro to auto-deduce the arg num,
/// or provide as an array of Code objects.
@ -388,7 +388,7 @@ GEN_API CodeVar parse_variable ( Str var_def );
GEN_API ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va );
//! Do not use directly. Use the token_fmt macro instead.
GEN_API Str token_fmt_impl( ssize, ... );
Str token_fmt_impl( ssize, ... );
GEN_API Code untyped_str( Str content);
GEN_API Code untyped_fmt ( char const* fmt, ... );