aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-04 22:49:54 +0900
committernsfisis <nsfisis@gmail.com>2025-09-04 22:49:54 +0900
commite342992a135e68d10716d9da920cb3af62a7d750 (patch)
tree49a1a94a87204c672a9f57890ec9d9c23989e2f6
parent17809b0571a038ec9eba3fc3620ba77a38c98afd (diff)
downloadducc-e342992a135e68d10716d9da920cb3af62a7d750.tar.gz
ducc-e342992a135e68d10716d9da920cb3af62a7d750.tar.zst
ducc-e342992a135e68d10716d9da920cb3af62a7d750.zip
feat: use <stdio.h> in ducc sources
-rw-r--r--src/cli.c1
-rw-r--r--src/codegen.h1
-rw-r--r--src/common.c2
-rw-r--r--src/io.c1
-rw-r--r--src/json.c1
-rw-r--r--src/parse.c1
-rw-r--r--src/preprocess.c1
-rw-r--r--src/std.h18
-rw-r--r--src/sys.c4
-rw-r--r--src/token.c1
10 files changed, 13 insertions, 18 deletions
diff --git a/src/cli.c b/src/cli.c
index c5649f0..893c7f2 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1,4 +1,5 @@
#include "cli.h"
+#include <stdio.h>
#include "common.h"
#include "version.h"
diff --git a/src/codegen.h b/src/codegen.h
index 95ec069..6a75179 100644
--- a/src/codegen.h
+++ b/src/codegen.h
@@ -1,6 +1,7 @@
#ifndef DUCC_CODEGEN_H
#define DUCC_CODEGEN_H
+#include <stdio.h>
#include "ast.h"
void codegen(Program* prog, FILE* out);
diff --git a/src/common.c b/src/common.c
index ab71851..02bb712 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1,4 +1,6 @@
#include "common.h"
+#include <stdarg.h>
+#include <stdio.h>
void fatal_error(const char* msg, ...) {
va_list args;
diff --git a/src/io.c b/src/io.c
index c2a53de..1d03e62 100644
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,5 @@
#include "io.h"
+#include <stdio.h>
#include "common.h"
#include "json.h"
diff --git a/src/json.c b/src/json.c
index 8b6dc74..a1524aa 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1,4 +1,5 @@
#include "json.h"
+#include <stdio.h>
#include "common.h"
struct JsonBuilder {
diff --git a/src/parse.c b/src/parse.c
index 07259ad..6403925 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -1,4 +1,5 @@
#include "parse.h"
+#include <stdio.h>
#include "common.h"
#include "tokenize.h"
diff --git a/src/preprocess.c b/src/preprocess.c
index 725437e..1d5a42a 100644
--- a/src/preprocess.c
+++ b/src/preprocess.c
@@ -1,4 +1,5 @@
#include "preprocess.h"
+#include <stdio.h>
#include "common.h"
#include "parse.h"
#include "sys.h"
diff --git a/src/std.h b/src/std.h
index c2d7b26..5f31191 100644
--- a/src/std.h
+++ b/src/std.h
@@ -3,19 +3,9 @@
#include <stddef.h>
-typedef struct FILE FILE;
-
-extern FILE* stdin;
-extern FILE* stdout;
-extern FILE* stderr;
-
int atoi(const char*);
void* calloc(size_t, size_t);
void exit(int);
-int fclose(FILE*);
-int fprintf(FILE*, const char*, ...);
-char* fgets(char*, int, FILE*);
-FILE* fopen(const char*, const char*);
int getchar();
int isalnum(int);
int isalpha(int);
@@ -25,9 +15,7 @@ void* memcpy(void*, const void*, size_t);
void* memmove(void*, const void*, size_t);
void* memset(void*, int, size_t);
int mkstemps(char*, int);
-int printf(const char*, ...);
void* realloc(void*, size_t);
-int sprintf(char*, const char*, ...);
int strcmp(const char*, const char*);
size_t strlen(const char*);
int strncmp(const char*, const char*, size_t);
@@ -45,18 +33,12 @@ int system(const char*);
} \
} while (0)
-#include <stdarg.h>
-
-int vfprintf(FILE*, const char*, va_list);
-
#define F_OK 0
#define R_OK 4
int access(const char*, int);
#define PATH_MAX 4096
-typedef long ssize_t;
-ssize_t readlink(const char*, char*, size_t);
char* dirname(char*);
#endif
diff --git a/src/sys.c b/src/sys.c
index 453c973..a4a531c 100644
--- a/src/sys.c
+++ b/src/sys.c
@@ -1,6 +1,10 @@
#include "sys.h"
#include "std.h"
+// TODO: #inclue some header.
+typedef long ssize_t;
+ssize_t readlink(const char*, char*, size_t);
+
static char* get_self_path() {
char* buf = calloc(PATH_MAX, sizeof(char));
ssize_t len = readlink("/proc/self/exe", buf, PATH_MAX - 1);
diff --git a/src/token.c b/src/token.c
index 7b3efbc..45ef2cd 100644
--- a/src/token.c
+++ b/src/token.c
@@ -1,4 +1,5 @@
#include "token.h"
+#include <stdio.h>
#include "common.h"
#include "json.h"