wip: working on extern
- Ref: move extern header into common scope - Feat: add extern symbols descriptors - Feat: add `is_out` flag in declaration node
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
#ifndef FZL_EXTERN_H
|
||||
#define FZL_EXTERN_H
|
||||
|
||||
#include <common/fzl_types.h>
|
||||
#include <stddef.h>
|
||||
|
||||
// External library entry types
|
||||
typedef enum
|
||||
{
|
||||
FZL_EXTERN_KIND_PRIMITIVE,
|
||||
FZL_EXTERN_KIND_HANDLE,
|
||||
FZL_EXTERN_KIND_STRUCT,
|
||||
FZL_EXTERN_KIND_REF,
|
||||
FZL_EXTERN_KIND_ALIAS,
|
||||
} fzl_extern_kind_t;
|
||||
|
||||
// External library structure field descriptor
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
fzl_type_t type;
|
||||
} fzl_extern_struct_field_t;
|
||||
|
||||
// Extern symbol type descriptor
|
||||
typedef struct fzl_extern_type
|
||||
{
|
||||
size_t lib_slot;
|
||||
fzl_extern_kind_t kind;
|
||||
char *symbol_name;
|
||||
char *used_name;
|
||||
|
||||
union
|
||||
{
|
||||
// Structure data
|
||||
struct
|
||||
{
|
||||
fzl_extern_struct_field_t **fields;
|
||||
size_t fields_count;
|
||||
} structure;
|
||||
|
||||
// Reference
|
||||
struct fzl_extern_type *ref_of;
|
||||
|
||||
// Aliasing type
|
||||
fzl_type_t alias;
|
||||
|
||||
// Primitive type
|
||||
// NOTE: same type as `.alias` just for readable format
|
||||
fzl_type_t primitive;
|
||||
};
|
||||
} fzl_extern_type_t;
|
||||
|
||||
// Extern symbol function descriptor
|
||||
typedef struct
|
||||
{
|
||||
size_t lib_slot;
|
||||
char *symbol_name;
|
||||
char *used_name;
|
||||
|
||||
fzl_extern_type_t *ret_type;
|
||||
|
||||
fzl_extern_type_t **args;
|
||||
size_t args_count;
|
||||
} fzl_extern_fn_t;
|
||||
|
||||
// External library descriptor
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
} fzl_extern_lib_t;
|
||||
|
||||
#endif // FZL_EXTERN_H
|
||||
Reference in New Issue
Block a user