#ifndef TYPE_H
#define TYPE_H

#include "ccc.h"

struct data_type {
    const char* name;
    integral_t sz;
    bool is_floating;
};

struct type {
    enum {
        TP_DATA,
        TP_PTR,
    } type;
    union {
        struct {
            const struct data_type* data_type;
            bool is_signed;
        } data;
        struct {
            const struct data_type* data_type;
            integral_t ptr_level;
        } pointer;
    };
};

extern const struct data_type void_type;
extern const struct data_type char_type;
extern const struct data_type short_type;
extern const struct data_type int_type;
extern const struct data_type long_type;
extern const struct data_type long_long_type;
extern const struct data_type float_type;
extern const struct data_type double_type;
extern const struct data_type* primitive_types[];

extern const struct type integral_type;
extern const struct type floating_type;
extern const struct type character_type;
extern const struct type string_type;

#endif
