boilerplate hopefully down
This commit is contained in:
41
src/type.h
Normal file
41
src/type.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef __GRAVITY__TYPE_H
|
||||
#define __GRAVITY__TYPE_H
|
||||
|
||||
#include "list.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct GravityOpaqueType* GravityType;
|
||||
|
||||
typedef enum {
|
||||
GravityIntTypeKind = 0,
|
||||
GravityFloatTypeKind,
|
||||
GravityPointerTypeKind,
|
||||
GravityFunctionTypeKind,
|
||||
} GravityTypeKind;
|
||||
|
||||
typedef struct {
|
||||
GravityType* argTypes;
|
||||
size_t numArgs;
|
||||
GravityType returnType;
|
||||
} GravityFunctionType;
|
||||
|
||||
typedef struct {
|
||||
uint8_t width;
|
||||
bool isSigned;
|
||||
} GravityIntType;
|
||||
|
||||
struct GravityOpaqueType {
|
||||
GravityTypeKind typeKind;
|
||||
union {
|
||||
GravityFunctionType function;
|
||||
GravityIntType integer;
|
||||
};
|
||||
};
|
||||
|
||||
GravityType gravityCreateFunctionType(int numArgs, GravityType* argTypes, GravityType returnType);
|
||||
GravityType gravityCreateIntegerType(uint8_t width, bool isSigned);
|
||||
GravityType gravityCreateType(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user