/+junk/codegen

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/codegen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#pragma once

#include "version.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>

#ifdef __cplusplus
#define CG_BEGIN_DEFS extern "C" {
#define CG_END_DEFS   }
#else
#define CG_BEGIN_DEFS 
#define CG_END_DEFS
#endif


CG_BEGIN_DEFS


#ifndef UNUSED
# if __STDC_VERSION__ > 201710L // We are using C2X
#   define  UNUSED  [[maybe_unused]]
# else
#   define  UNUSED  __attribute__((unused))
# endif
#endif


#ifndef DEPRECATED
# if __STDC_VERSION__ > 201710L // We are using C2X
#   define  DEPRECATED  [[deprecated]]
# else
#   define  DEPRECATED  __attribute__((deprecated))
# endif
#endif

#ifndef ALIGNED
# define ALIGNED(N) __attribute__((aligned (N)))
#endif

#ifndef FORMAT_STR
# define F_FORMAT_STR(start, end) __attribute__((format (printf, start, end)))
#endif

#ifndef CLEANUP
# define CLEANUP(func) __attribute__((cleanup (func)))
#endif

#ifndef NOT_IMPLEMENTED
# define NOT_IMPLEMENTED {\
  err_print ("[%s:%i] Function %s is not implemented yet.", __FILE__, __LINE__ , __func__); \
  abort (); \
}
#endif


#ifndef IN
# define IN
#endif
#ifndef OUT
# define OUT
#endif


typedef enum SEEK_OFFSET {
  /** Beginning of file */
  SEEK_OFFSET_SET = SEEK_SET,

  /** Current position of the pointer */
  SEEK_OFFSET_CUR = SEEK_CUR,

  /** End of file */
  SEEK_OFFSET_END = SEEK_END,
} SEEK_OFFSET;




typedef char* str_t;

typedef void* ptr_t;

typedef int8_t byte;

#define auto __auto_type

CG_END_DEFS