/+junk/codegen

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/codegen
1 by Gustav Hartvigsson
Beep Boop, nothin yet.
1
#pragma once
2
3
#include "version.h"
4
5
#include <stdio.h>
6
#include <stdlib.h>
7
#include <string.h>
8
#include <errno.h>
9
#include <assert.h>
10
#include <stdarg.h>
11
#include <stdbool.h>
12
13
#ifdef __cplusplus
14
#define CG_BEGIN_DEFS extern "C" {
15
#define CG_END_DEFS   }
16
#else
17
#define CG_BEGIN_DEFS 
18
#define CG_END_DEFS
19
#endif
20
21
22
CG_BEGIN_DEFS
23
24
25
#ifndef UNUSED
26
# if __STDC_VERSION__ > 201710L // We are using C2X
27
#   define  UNUSED  [[maybe_unused]]
28
# else
29
#   define  UNUSED  __attribute__((unused))
30
# endif
31
#endif
32
33
34
#ifndef DEPRECATED
35
# if __STDC_VERSION__ > 201710L // We are using C2X
36
#   define  DEPRECATED  [[deprecated]]
37
# else
38
#   define  DEPRECATED  __attribute__((deprecated))
39
# endif
40
#endif
41
42
#ifndef ALIGNED
43
# define ALIGNED(N) __attribute__((aligned (N)))
44
#endif
45
46
#ifndef FORMAT_STR
47
# define F_FORMAT_STR(start, end) __attribute__((format (printf, start, end)))
48
#endif
49
50
#ifndef CLEANUP
51
# define CLEANUP(func) __attribute__((cleanup (func)))
52
#endif
53
54
#ifndef NOT_IMPLEMENTED
55
# define NOT_IMPLEMENTED {\
56
  err_print ("[%s:%i] Function %s is not implemented yet.", __FILE__, __LINE__ , __func__); \
57
  abort (); \
58
}
59
#endif
60
61
62
#ifndef IN
63
# define IN
64
#endif
65
#ifndef OUT
66
# define OUT
67
#endif
68
69
70
typedef enum SEEK_OFFSET {
71
  /** Beginning of file */
72
  SEEK_OFFSET_SET = SEEK_SET,
73
74
  /** Current position of the pointer */
75
  SEEK_OFFSET_CUR = SEEK_CUR,
76
77
  /** End of file */
78
  SEEK_OFFSET_END = SEEK_END,
79
} SEEK_OFFSET;
80
81
82
83
84
typedef char* str_t;
85
86
typedef void* ptr_t;
87
88
typedef int8_t byte;
89
90
#define auto __auto_type
91
92
CG_END_DEFS