From d1c7fcbff9151bc559399c60b85ac9a218a21024 Mon Sep 17 00:00:00 2001 From: nishi Date: Mon, 29 Jan 2024 00:24:52 +0000 Subject: [PATCH] tag parsing git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@127 d27a3e52-49c5-7645-884c-6793ebffc270 --- Example/w3b/w3b.c | 7 +++++++ Library/Makefile | 2 +- Library/Tag.c | 7 +++++++ Library/W3Tag.h | 9 +++++++++ W3Version.h.p | 2 +- 5 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 Library/Tag.c create mode 100644 Library/W3Tag.h diff --git a/Example/w3b/w3b.c b/Example/w3b/w3b.c index 6efda10..07f7c87 100644 --- a/Example/w3b/w3b.c +++ b/Example/w3b/w3b.c @@ -6,6 +6,7 @@ #include #include +#include #include #include /* It has some useful functions, you know */ @@ -93,7 +94,13 @@ void access_site(const char* url) { } } +void html_handler(char* tagname, char** attr){ +} + void render_site(){ + if(databuf != NULL){ + W3_Tag_Parse(databuf, datalen, html_handler); + } } int main(int argc, char** argv) { diff --git a/Library/Makefile b/Library/Makefile index 19b112b..0465473 100644 --- a/Library/Makefile +++ b/Library/Makefile @@ -1,7 +1,7 @@ # $Id$ .PHONY: clean install -OBJS = ./Core.o ./Util.o ./DNS.o ./HTTP.o ./Gopher.o ./POP3.o ./File.o ./URL.o +OBJS = ./Core.o ./Util.o ./DNS.o ./HTTP.o ./Gopher.o ./POP3.o ./File.o ./URL.o ./Tag.o ifeq ($(WINDOWS),YES) ./w3.dll: $(OBJS) diff --git a/Library/Tag.c b/Library/Tag.c new file mode 100644 index 0000000..948a2b6 --- /dev/null +++ b/Library/Tag.c @@ -0,0 +1,7 @@ +/* $Id$ */ +#include "W3Tag.h" + +#include + +void W3_Tag_Parse(char* data, size_t size, void(*func)(char* tagname, char** attr)){ +} diff --git a/Library/W3Tag.h b/Library/W3Tag.h new file mode 100644 index 0000000..61fb34d --- /dev/null +++ b/Library/W3Tag.h @@ -0,0 +1,9 @@ +/* $Id$ */ +#ifndef __W3TAG_H__ +#define __W3TAG_H__ + +#include + +void W3_Tag_Parse(char* data, size_t size, void(*func)(char* tagname, char** attr)); + +#endif diff --git a/W3Version.h.p b/W3Version.h.p index 3e628ac..8f9b50e 100644 --- a/W3Version.h.p +++ b/W3Version.h.p @@ -6,7 +6,7 @@ extern "C" { #endif -#define LIBW3_VERSION "2.0D" \ +#define LIBW3_VERSION "2.1" \ SUFFIX #ifdef __cplusplus -- 2.43.0