diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-04 22:49:54 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-04 22:49:54 +0900 |
| commit | e342992a135e68d10716d9da920cb3af62a7d750 (patch) | |
| tree | 49a1a94a87204c672a9f57890ec9d9c23989e2f6 | |
| parent | 17809b0571a038ec9eba3fc3620ba77a38c98afd (diff) | |
| download | ducc-e342992a135e68d10716d9da920cb3af62a7d750.tar.gz ducc-e342992a135e68d10716d9da920cb3af62a7d750.tar.zst ducc-e342992a135e68d10716d9da920cb3af62a7d750.zip | |
feat: use <stdio.h> in ducc sources
| -rw-r--r-- | src/cli.c | 1 | ||||
| -rw-r--r-- | src/codegen.h | 1 | ||||
| -rw-r--r-- | src/common.c | 2 | ||||
| -rw-r--r-- | src/io.c | 1 | ||||
| -rw-r--r-- | src/json.c | 1 | ||||
| -rw-r--r-- | src/parse.c | 1 | ||||
| -rw-r--r-- | src/preprocess.c | 1 | ||||
| -rw-r--r-- | src/std.h | 18 | ||||
| -rw-r--r-- | src/sys.c | 4 | ||||
| -rw-r--r-- | src/token.c | 1 |
10 files changed, 13 insertions, 18 deletions
@@ -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; @@ -1,4 +1,5 @@ #include "io.h" +#include <stdio.h> #include "common.h" #include "json.h" @@ -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" @@ -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 @@ -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" |
