ngrc version works?

This commit is contained in:
2024-04-03 20:55:49 -07:00
parent fab5a230f1
commit 5f2fc7cb34
8 changed files with 119 additions and 9 deletions

View File

@@ -1,7 +1,13 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#define HEAP_SIZE (1024 * 1024)
void *__global_allocation_pointer__ = NULL;
void print(char *_ignore, char *variable_name, int64_t vtype, int64_t value) {
switch(vtype) {
case /* U8 = */ 10:
@@ -39,6 +45,18 @@ void print(char *_ignore, char *variable_name, int64_t vtype, int64_t value) {
extern void gogogo();
int main(int argc, char **argv) {
__global_allocation_pointer__ = malloc(HEAP_SIZE);
if(__global_allocation_pointer__ == NULL) {
printf("ERROR: Couldn't allocation heap space.");
return 1;
}
if(memset(__global_allocation_pointer__, 0, HEAP_SIZE) != __global_allocation_pointer__) {
printf("ERROR: Weird return trying to zero out heap.");
return 2;
}
gogogo();
return 0;
}