41 lines
878 B
C
41 lines
878 B
C
|
|
#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
|