unsafe
This commit is contained in:
parent
e0277a8807
commit
a222b3807e
7 changed files with 355 additions and 110 deletions
|
|
@ -23,7 +23,28 @@ static void* suic_alloc_struct(const TypeInfo* type, size_t size, void* init_dat
|
|||
}
|
||||
|
||||
|
||||
struct Color {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
};
|
||||
struct Shader {
|
||||
int id;
|
||||
};
|
||||
|
||||
static const uint8_t sui_bitmap_Color[] = { 0, 0, 0, 0 };
|
||||
static const TypeInfo sui_typeinfo_Color = {
|
||||
.field_count = 4,
|
||||
.pointer_count = 0,
|
||||
.pointer_bitmap = sui_bitmap_Color
|
||||
};
|
||||
static const uint8_t sui_bitmap_Shader[] = { 0 };
|
||||
static const TypeInfo sui_typeinfo_Shader = {
|
||||
.field_count = 1,
|
||||
.pointer_count = 0,
|
||||
.pointer_bitmap = sui_bitmap_Shader
|
||||
};
|
||||
|
||||
int suic_main(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,28 @@ static void* suic_alloc_struct(const TypeInfo* type, size_t size, void* init_dat
|
|||
}
|
||||
|
||||
|
||||
struct Color {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
};
|
||||
struct Shader {
|
||||
int id;
|
||||
};
|
||||
|
||||
static const uint8_t sui_bitmap_Color[] = { 0, 0, 0, 0 };
|
||||
static const TypeInfo sui_typeinfo_Color = {
|
||||
.field_count = 4,
|
||||
.pointer_count = 0,
|
||||
.pointer_bitmap = sui_bitmap_Color
|
||||
};
|
||||
static const uint8_t sui_bitmap_Shader[] = { 0 };
|
||||
static const TypeInfo sui_typeinfo_Shader = {
|
||||
.field_count = 1,
|
||||
.pointer_count = 0,
|
||||
.pointer_bitmap = sui_bitmap_Shader
|
||||
};
|
||||
|
||||
int suic_main(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../libsuicmez/libsuicmez.h"
|
||||
#include "libsuicmez/libsuicmez.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
|
@ -23,13 +23,38 @@ static void* suic_alloc_struct(const TypeInfo* type, size_t size, void* init_dat
|
|||
}
|
||||
|
||||
|
||||
struct Color {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
};
|
||||
struct Shader {
|
||||
int id;
|
||||
};
|
||||
|
||||
static const uint8_t sui_bitmap_Color[] = { 0, 0, 0, 0 };
|
||||
static const TypeInfo sui_typeinfo_Color = {
|
||||
.field_count = 4,
|
||||
.pointer_count = 0,
|
||||
.pointer_bitmap = sui_bitmap_Color
|
||||
};
|
||||
static const uint8_t sui_bitmap_Shader[] = { 0 };
|
||||
static const TypeInfo sui_typeinfo_Shader = {
|
||||
.field_count = 1,
|
||||
.pointer_count = 0,
|
||||
.pointer_bitmap = sui_bitmap_Shader
|
||||
};
|
||||
|
||||
int suic_main(void);
|
||||
|
||||
|
||||
int suic_main(void) {
|
||||
(true ? 1 : 0);
|
||||
if (true) {
|
||||
1;
|
||||
} else {
|
||||
0;
|
||||
}
|
||||
int i = 0;
|
||||
while ((i < 5)) {
|
||||
i = (i + 1);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../libsuicmez/libsuicmez.h"
|
||||
#include "libsuicmez/libsuicmez.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
|
@ -23,7 +23,28 @@ static void* suic_alloc_struct(const TypeInfo* type, size_t size, void* init_dat
|
|||
}
|
||||
|
||||
|
||||
struct Color {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
};
|
||||
struct Shader {
|
||||
int id;
|
||||
};
|
||||
|
||||
static const uint8_t sui_bitmap_Color[] = { 0, 0, 0, 0 };
|
||||
static const TypeInfo sui_typeinfo_Color = {
|
||||
.field_count = 4,
|
||||
.pointer_count = 0,
|
||||
.pointer_bitmap = sui_bitmap_Color
|
||||
};
|
||||
static const uint8_t sui_bitmap_Shader[] = { 0 };
|
||||
static const TypeInfo sui_typeinfo_Shader = {
|
||||
.field_count = 1,
|
||||
.pointer_count = 0,
|
||||
.pointer_bitmap = sui_bitmap_Shader
|
||||
};
|
||||
|
||||
int add(int x, int y);
|
||||
int suic_main(void);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,15 @@ struct Person {
|
|||
char* name;
|
||||
int age;
|
||||
};
|
||||
struct Color {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
};
|
||||
struct Shader {
|
||||
int id;
|
||||
};
|
||||
|
||||
static const uint8_t sui_bitmap_Point[] = { 0, 0 };
|
||||
static const TypeInfo sui_typeinfo_Point = {
|
||||
|
|
@ -44,13 +53,25 @@ static const TypeInfo sui_typeinfo_Person = {
|
|||
.pointer_count = 1,
|
||||
.pointer_bitmap = sui_bitmap_Person
|
||||
};
|
||||
static const uint8_t sui_bitmap_Color[] = { 0, 0, 0, 0 };
|
||||
static const TypeInfo sui_typeinfo_Color = {
|
||||
.field_count = 4,
|
||||
.pointer_count = 0,
|
||||
.pointer_bitmap = sui_bitmap_Color
|
||||
};
|
||||
static const uint8_t sui_bitmap_Shader[] = { 0 };
|
||||
static const TypeInfo sui_typeinfo_Shader = {
|
||||
.field_count = 1,
|
||||
.pointer_count = 0,
|
||||
.pointer_bitmap = sui_bitmap_Shader
|
||||
};
|
||||
|
||||
int suic_main(void);
|
||||
|
||||
|
||||
int suic_main(void) {
|
||||
struct Point* p = suic_alloc_struct(&sui_typeinfo_Point, sizeof(struct Point), &(struct Point){ .x = 5, .y = 10 });
|
||||
struct Person* person = suic_alloc_struct(&sui_typeinfo_Person, sizeof(struct Person), &(struct Person){ .name = suic_alloc_array(NULL, sizeof(char), 6, "Alice"), .age = 30 });
|
||||
struct Point* p = (struct Point){ .x = 5, .y = 10 };
|
||||
struct Person* person = (struct Person){ .name = suic_alloc_array(NULL, sizeof(char), 6, "Alice"), .age = 30 };
|
||||
int _ = ((*p).x + (*person).age);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue