feat: remove stb_c_lexer
This commit is contained in:
14
README.md
14
README.md
@@ -3,24 +3,21 @@
|
||||
> [!WARNING]
|
||||
> Work in progress. This is not finished at all, I'm just experimenting.
|
||||
|
||||
Meta Programming Header Only Library for C
|
||||
Single Heaer Meta Programming Header Library for C. The same header for both codegen and runtime.
|
||||
|
||||
## Current limitations
|
||||
|
||||
- Only parses `typedef struct { ... } type_name;`
|
||||
- Will generate colliding definitions in case of types with the same name
|
||||
- Requires `stb_c_lexer`
|
||||
|
||||
## Quick start
|
||||
|
||||
Current implementation depends on `stb_c_lexer`, in future I'll use my own lexer. Because of the current setup, cmeta is not easy to use, remember, it's not finished!
|
||||
|
||||
1. Create `main.c`
|
||||
|
||||
```c
|
||||
typedef struct {
|
||||
int int_field;
|
||||
const char *char_ptr_field;
|
||||
const char *const_char_star_field;
|
||||
} My_Struct;
|
||||
|
||||
int main(void) {
|
||||
@@ -38,17 +35,14 @@ You only have to call `process_file` with a file to generate type infos etc in `
|
||||
|
||||
int main(void) {
|
||||
if (!process_file("./main.c")) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
3. Build and cmeta
|
||||
|
||||
As mentionned before, `stb_c_lexer` is currently required, it will be removed in the future.
|
||||
|
||||
```console
|
||||
$ gcc cmeta.c -I./third_party/ -o cmeta
|
||||
$ gcc cmeta.c -o cmeta
|
||||
$ ./cmeta
|
||||
```
|
||||
|
||||
@@ -61,7 +55,7 @@ You can now inspect your types!
|
||||
|
||||
typedef struct {
|
||||
int int_field;
|
||||
const char* char_field;
|
||||
const char* const_char_star_field;
|
||||
} My_Struct;
|
||||
|
||||
int main(void) {
|
||||
|
||||
Reference in New Issue
Block a user