From 25cc3877b25dc1690fb3475af80fc07457294a14 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Tue, 23 Dec 2025 02:05:29 +0900 Subject: [PATCH] rename from xmllib to xemil --- Makefile | 8 ++++---- example.c | 4 ++-- include/{xmllib.h => xemil.h} | 22 +++++++++++----------- src/array.c | 2 +- src/core.c | 10 +++++----- src/file.c | 10 +++++----- src/unicode.c | 2 +- src/util.c | 2 +- 8 files changed, 30 insertions(+), 30 deletions(-) rename include/{xmllib.h => xemil.h} (77%) diff --git a/Makefile b/Makefile index 62e3154..933aa5c 100644 --- a/Makefile +++ b/Makefile @@ -10,15 +10,15 @@ SO = .so .PHONY: all format clean .SUFFIXES: .c .o -all: libxmllib$(SO) +all: libxemil$(SO) format: clang-format --verbose -i `find src include -name "*.c" -or -name "*.h"` example.c -example: example.c libxmllib$(SO) - $(CC) -o $@ example.c -I include -Wl,-R. -L. -lxmllib +example: example.c libxemil$(SO) + $(CC) -o $@ example.c -I include -Wl,-R. -L. -lxemil -libxmllib$(SO): $(OBJS) +libxemil$(SO): $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) .c.o: diff --git a/example.c b/example.c index 80a33ea..9a43448 100644 --- a/example.c +++ b/example.c @@ -1,4 +1,4 @@ -#include +#include #define INDENT 2 @@ -46,7 +46,7 @@ int main(int argc, char** argv) { int i; for(i = 1; i < argc; i++) { - xmllib_t* h = xl_open_file(argv[i]); + xemil_t* h = xl_open_file(argv[i]); if(h != NULL) { printf("%s:\n", argv[i]); if(xl_parse(h)) { diff --git a/include/xmllib.h b/include/xemil.h similarity index 77% rename from include/xmllib.h rename to include/xemil.h index 0a20d0f..46c5a13 100644 --- a/include/xmllib.h +++ b/include/xemil.h @@ -1,5 +1,5 @@ -#ifndef __XMLLIB_H__ -#define __XMLLIB_H__ +#ifndef __XEMIL_H__ +#define __XEMIL_H__ #include #include @@ -9,16 +9,16 @@ #define XLDECL extern typedef struct xl_driver xl_driver_t; -typedef struct xmllib xmllib_t; +typedef struct xemil xemil_t; typedef struct xl_node xl_node_t; typedef struct xl_attribute xl_attribute_t; #define XL_SKIPPABLE(x) (((x) == ' ') || ((x) == '\t') || ((x) == '\n') || ((x) == '\r')) struct xl_driver { - int (*open)(xmllib_t* handle); - int (*read)(xmllib_t* handle, void* data, int size); - void (*close)(xmllib_t* handle); + int (*open)(xemil_t* handle); + int (*read)(xemil_t* handle, void* data, int size); + void (*close)(xemil_t* handle); }; enum XL_NODE_TYPE { @@ -50,7 +50,7 @@ struct xl_node { xl_node_t* next; }; -struct xmllib { +struct xemil { xl_driver_t* driver; void* drv_opaque; void* drv_arg; @@ -62,16 +62,16 @@ extern "C" { #endif /* core.c */ -XLDECL xmllib_t* xl_open(xl_driver_t* driver, void* arg); +XLDECL xemil_t* xl_open(xl_driver_t* driver, void* arg); -XLDECL int xl_parse(xmllib_t* handle); +XLDECL int xl_parse(xemil_t* handle); -XLDECL void xl_close(xmllib_t* handle); +XLDECL void xl_close(xemil_t* handle); /* file.c */ XLDECL xl_driver_t* xl_driver_file; -XLDECL xmllib_t* xl_open_file(const char* filename); +XLDECL xemil_t* xl_open_file(const char* filename); /* util.c */ XLDECL char* xl_util_trim(const char* str); diff --git a/src/array.c b/src/array.c index f6962a6..85caf90 100644 --- a/src/array.c +++ b/src/array.c @@ -1,4 +1,4 @@ -#include +#include void xl_array_push(int** array, int value) { if((*array) == NULL) { diff --git a/src/core.c b/src/core.c index c9ea36d..d728fc0 100644 --- a/src/core.c +++ b/src/core.c @@ -1,7 +1,7 @@ -#include +#include -xmllib_t* xl_open(xl_driver_t* driver, void* arg) { - xmllib_t* handle = malloc(sizeof(*handle)); +xemil_t* xl_open(xl_driver_t* driver, void* arg) { + xemil_t* handle = malloc(sizeof(*handle)); memset(handle, 0, sizeof(*handle)); handle->driver = driver; @@ -132,7 +132,7 @@ static xl_attribute_t* xl_parse_attribute(const char* str) { return first; } -int xl_parse(xmllib_t* handle) { +int xl_parse(xemil_t* handle) { jmp_buf err; int* state = NULL; char* node = NULL; @@ -416,7 +416,7 @@ void recursive_free(xl_node_t* node) { free(node); } -void xl_close(xmllib_t* handle) { +void xl_close(xemil_t* handle) { if(handle->root != NULL) recursive_free(handle->root); handle->driver->close(handle); diff --git a/src/file.c b/src/file.c index 8ed994d..45e1d38 100644 --- a/src/file.c +++ b/src/file.c @@ -1,16 +1,16 @@ -#include +#include -static int xl_driver_file_open(xmllib_t* handle) { +static int xl_driver_file_open(xemil_t* handle) { if((handle->drv_opaque = fopen(handle->drv_arg, "rb")) == NULL) return 0; return 1; } -static int xl_driver_file_read(xmllib_t* handle, void* data, int size) { +static int xl_driver_file_read(xemil_t* handle, void* data, int size) { return fread(data, 1, size, handle->drv_opaque); } -static void xl_driver_file_close(xmllib_t* handle) { +static void xl_driver_file_close(xemil_t* handle) { fclose(handle->drv_opaque); } @@ -21,6 +21,6 @@ xl_driver_t xl_driver_file_rec = { }; xl_driver_t* xl_driver_file = &xl_driver_file_rec; -xmllib_t* xl_open_file(const char* filename) { +xemil_t* xl_open_file(const char* filename) { return xl_open(xl_driver_file, (void*)filename); } diff --git a/src/unicode.c b/src/unicode.c index 20b44db..2e5026b 100644 --- a/src/unicode.c +++ b/src/unicode.c @@ -1,4 +1,4 @@ -#include +#include #define CAST_I32(x) ((int)(x)) diff --git a/src/util.c b/src/util.c index 1a74871..6434a72 100644 --- a/src/util.c +++ b/src/util.c @@ -1,4 +1,4 @@ -#include +#include char* xl_util_trim(const char* str) { char* s = malloc(strlen(str) + 1);