Files
corelang/lang.h
Krzosa Karol 3a9b748fed New AST
2022-04-30 12:28:34 +02:00

66 lines
1.2 KiB
C

#pragma once
#define global static
#define function static
#define assert(x) do{if(!(x)) __debugbreak();}while(0)
#define assert_msg(x,msg) assert(x)
#define not_implemented assert_msg(0, "Not implemented")
#define invalid_codepath assert_msg(0, "Invalid codepath")
#define buff_cap(x) (sizeof(x)/sizeof((x)[0]))
#define lit(x) ((String){(U8*)x,buff_cap(x)-1})
#define meta(x)
#include <stdint.h>
typedef int8_t S8;
typedef int16_t S16;
typedef int32_t S32;
typedef int64_t S64;
typedef uint8_t U8;
typedef uint16_t U16;
typedef uint32_t U32;
typedef uint64_t U64;
typedef S8 B8;
typedef S16 B16;
typedef S32 B32;
typedef S64 B64;
typedef uint64_t SizeU;
typedef int64_t SizeI;
typedef float F32;
typedef double F64;
const B32 true = 1;
const B32 false = 0;
#define kib(x) ((x)*1024llu)
#define mib(x) (kib(x)*1024llu)
#define gib(x) (mib(x)*1024llu)
typedef struct String{
U8 *str;
S64 len;
}String;
#define SLLQueuePush(f,l,n) do{\
if((f)==0){\
(f)=(l)=(n);\
}\
else{\
(l)=(l)->next=(n);\
} \
}while(0)
#define SLLStackPush(l,n) do{\
(n)->next = (l);\
(l) = (n);\
}while(0)
#define SLLStackPop(l,n) do{\
if(l){\
(n) = (l);\
(l) = (l)->next;\
(n)->next = 0;\
}\
}while(0)