From 3c9662b65bd4b3c83435ab62e7db537747e5804c Mon Sep 17 00:00:00 2001 From: Dmitry Simonenko Date: Tue, 8 Nov 2016 17:53:52 +0300 Subject: [PATCH] flint: rename project --- README.md | 2 +- example/benchmark.c | 4 +- example/echo.c | 4 +- example/makefile | 4 +- lib/flint.h | 51 +++++++++++++++++++++++ lib/{fluent_private.h => flint_private.h} | 2 +- lib/fluent.h | 51 ----------------------- lib/ft.c | 20 ++++----- lib/ft.h | 2 +- lib/ft_buf.h | 2 +- lib/ft_context.c | 4 +- lib/ft_context.h | 2 +- lib/ft_fiber.c | 4 +- lib/ft_fiber.h | 2 +- lib/ft_io.c | 12 +++--- lib/ft_io.h | 2 +- lib/ft_ioaccept.c | 8 ++-- lib/ft_iobind.c | 8 ++-- lib/ft_ioconnect.c | 12 +++--- lib/ft_ioread.c | 12 +++--- lib/ft_iowrite.c | 10 ++--- lib/ft_list.h | 2 +- lib/ft_macro.h | 2 +- lib/ft_scheduler.c | 4 +- lib/ft_scheduler.h | 2 +- lib/makefile | 4 +- 26 files changed, 116 insertions(+), 116 deletions(-) create mode 100644 lib/flint.h rename lib/{fluent_private.h => flint_private.h} (97%) delete mode 100644 lib/fluent.h diff --git a/README.md b/README.md index 62b85328..32cb4da9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -**fluent** +**flint** Fiber networked engine library on top of libuv. diff --git a/example/benchmark.c b/example/benchmark.c index fa051c31..46728609 100644 --- a/example/benchmark.c +++ b/example/benchmark.c @@ -1,6 +1,6 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ @@ -10,7 +10,7 @@ * performance done in one second. */ -#include +#include static int csw = 0; diff --git a/example/echo.c b/example/echo.c index bbfe8e9a..848f02d4 100644 --- a/example/echo.c +++ b/example/echo.c @@ -1,6 +1,6 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ @@ -12,7 +12,7 @@ * echo 0123456789 | nc -v 127.0.0.1 7778 # to test */ -#include +#include static void test_client(void *arg) diff --git a/example/makefile b/example/makefile index 87f3fe69..05a167db 100644 --- a/example/makefile +++ b/example/makefile @@ -1,14 +1,14 @@ CC = gcc RM = rm CFLAGS = -I. -Wall -g -O0 -I../lib -LFLAGS = ../lib/libfluent.a -luv +LFLAGS = ../lib/libflint.a -luv all: validate clean benchmark echo benchmark: benchmark.o $(CC) benchmark.o $(LFLAGS) -o benchmark echo: echo.o $(CC) echo.o $(LFLAGS) -o echo validate: - @if [ ! -f ../lib/libfluent.a ]; then \ + @if [ ! -f ../lib/libflint.a ]; then \ echo ""; \ echo "Please build the library first."; \ echo ""; \ diff --git a/lib/flint.h b/lib/flint.h new file mode 100644 index 00000000..3e3ea462 --- /dev/null +++ b/lib/flint.h @@ -0,0 +1,51 @@ +#ifndef FLINT_H_ +#define FLINT_H_ + +/* + * flint. + * + * Cooperative multitasking engine. +*/ + +#include +#include +#include + +#if __GNUC__ >= 4 +# define FLINT_API __attribute__((visibility("default"))) +#else +# define FLINT_API +#endif + +typedef void (*ftfunction_t)(void *arg); + +typedef void* ft_t; +typedef void* ftio_t; + +FLINT_API ft_t +ft_new(void); + +FLINT_API int ft_free(ft_t); +FLINT_API int ft_create(ft_t, ftfunction_t, void *arg); +FLINT_API int ft_is_online(ft_t); +FLINT_API void ft_start(ft_t); +FLINT_API void ft_stop(ft_t); +FLINT_API void ft_sleep(ft_t, uint64_t time_ms); + +FLINT_API ftio_t +ft_io_new(ft_t); + +FLINT_API void ft_close(ftio_t); +FLINT_API int ft_fd(ftio_t); +FLINT_API int ft_is_connected(ftio_t); +FLINT_API int ft_connect(ftio_t, char *addr, int port, uint64_t time_ms); +FLINT_API int ft_connect_is_timeout(ftio_t); +FLINT_API int ft_bind(ftio_t, char *addr, int port); +FLINT_API int ft_accept(ftio_t, ftio_t *client); +FLINT_API int ft_read(ftio_t, int size, uint64_t time_ms); +FLINT_API int ft_read_is_timeout(ftio_t); +FLINT_API char *ft_read_buf(ftio_t); +FLINT_API int ft_write(ftio_t, char *buf, int size, uint64_t time_ms); +FLINT_API int ft_write_is_timeout(ftio_t); + +#endif diff --git a/lib/fluent_private.h b/lib/flint_private.h similarity index 97% rename from lib/fluent_private.h rename to lib/flint_private.h index 07bbf973..5a4c82b6 100644 --- a/lib/fluent_private.h +++ b/lib/flint_private.h @@ -2,7 +2,7 @@ #define FT_PRIVATE_H_ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ diff --git a/lib/fluent.h b/lib/fluent.h deleted file mode 100644 index 269a5967..00000000 --- a/lib/fluent.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef FLUENT_H_ -#define FLUENT_H_ - -/* - * fluent. - * - * Cooperative multitasking engine. -*/ - -#include -#include -#include - -#if __GNUC__ >= 4 -# define FLUENT_API __attribute__((visibility("default"))) -#else -# define FLUENT_API -#endif - -typedef void (*ftfunction_t)(void *arg); - -typedef void* ft_t; -typedef void* ftio_t; - -FLUENT_API ft_t -ft_new(void); - -FLUENT_API int ft_free(ft_t); -FLUENT_API int ft_create(ft_t, ftfunction_t, void *arg); -FLUENT_API int ft_is_online(ft_t); -FLUENT_API void ft_start(ft_t); -FLUENT_API void ft_stop(ft_t); -FLUENT_API void ft_sleep(ft_t, uint64_t time_ms); - -FLUENT_API ftio_t -ft_io_new(ft_t); - -FLUENT_API void ft_close(ftio_t); -FLUENT_API int ft_fd(ftio_t); -FLUENT_API int ft_is_connected(ftio_t); -FLUENT_API int ft_connect(ftio_t, char *addr, int port, uint64_t time_ms); -FLUENT_API int ft_connect_is_timeout(ftio_t); -FLUENT_API int ft_bind(ftio_t, char *addr, int port); -FLUENT_API int ft_accept(ftio_t, ftio_t *client); -FLUENT_API int ft_read(ftio_t, int size, uint64_t time_ms); -FLUENT_API int ft_read_is_timeout(ftio_t); -FLUENT_API char *ft_read_buf(ftio_t); -FLUENT_API int ft_write(ftio_t, char *buf, int size, uint64_t time_ms); -FLUENT_API int ft_write_is_timeout(ftio_t); - -#endif diff --git a/lib/ft.c b/lib/ft.c index ae718d29..d6d83843 100644 --- a/lib/ft.c +++ b/lib/ft.c @@ -1,12 +1,12 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ -#include -#include +#include +#include static void ft_async_cb(uv_async_t *handle) @@ -35,7 +35,7 @@ ft_close_cb(uv_handle_t *handle, void *arg) uv_close(handle, NULL); } -FLUENT_API ft_t +FLINT_API ft_t ft_new(void) { ft *handle = malloc(sizeof(*handle)); @@ -51,7 +51,7 @@ ft_new(void) return (ft_t)handle; } -FLUENT_API int +FLINT_API int ft_free(ft_t envp) { ft *env = envp; @@ -69,7 +69,7 @@ ft_free(ft_t envp) return 0; } -FLUENT_API int +FLINT_API int ft_create(ft_t envp, ftfunction_t function, void *arg) { ft *env = envp; @@ -83,14 +83,14 @@ ft_create(ft_t envp, ftfunction_t function, void *arg) return 0; } -FLUENT_API int +FLINT_API int ft_is_online(ft_t envp) { ft *env = envp; return env->online; } -FLUENT_API void +FLINT_API void ft_start(ft_t envp) { ft *env = envp; @@ -106,14 +106,14 @@ ft_start(ft_t envp) } } -FLUENT_API void +FLINT_API void ft_stop(ft_t envp) { ft *env = envp; env->online = 0; } -FLUENT_API void +FLINT_API void ft_sleep(ft_t envp, uint64_t time_ms) { ft *env = envp; diff --git a/lib/ft.h b/lib/ft.h index 26913ac0..26c8b05c 100644 --- a/lib/ft.h +++ b/lib/ft.h @@ -2,7 +2,7 @@ #define FT_H_ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ diff --git a/lib/ft_buf.h b/lib/ft_buf.h index dacd35b3..88c2682b 100644 --- a/lib/ft_buf.h +++ b/lib/ft_buf.h @@ -2,7 +2,7 @@ #define FT_BUF_H_ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ diff --git a/lib/ft_context.c b/lib/ft_context.c index 9876fae9..8c90f586 100644 --- a/lib/ft_context.c +++ b/lib/ft_context.c @@ -1,11 +1,11 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ -#include +#include void ft_context_init_main(ftcontext *c) diff --git a/lib/ft_context.h b/lib/ft_context.h index e509133f..6ce3407d 100644 --- a/lib/ft_context.h +++ b/lib/ft_context.h @@ -2,7 +2,7 @@ #define FT_CONTEXT_H_ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ diff --git a/lib/ft_fiber.c b/lib/ft_fiber.c index 0b920d52..d3531732 100644 --- a/lib/ft_fiber.c +++ b/lib/ft_fiber.c @@ -1,11 +1,11 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ -#include +#include void ft_fiber_init(ftfiber *fiber) { diff --git a/lib/ft_fiber.h b/lib/ft_fiber.h index ee716997..abaea8d1 100644 --- a/lib/ft_fiber.h +++ b/lib/ft_fiber.h @@ -2,7 +2,7 @@ #define FT_FIBER_H_ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ diff --git a/lib/ft_io.c b/lib/ft_io.c index a8857bd7..ab17c195 100644 --- a/lib/ft_io.c +++ b/lib/ft_io.c @@ -1,14 +1,14 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ -#include -#include +#include +#include -FLUENT_API ftio_t +FLINT_API ftio_t ft_io_new(ft_t envp) { ft *env = envp; @@ -52,7 +52,7 @@ ft_io_new(ft_t envp) return io; } -FLUENT_API void +FLINT_API void ft_close(ftio_t iop) { ftio *io = iop; @@ -75,7 +75,7 @@ ft_close(ftio_t iop) free(io); } -FLUENT_API int +FLINT_API int ft_fd(ftio_t iop) { ftio *io = iop; diff --git a/lib/ft_io.h b/lib/ft_io.h index 8b6b9e2f..afe52fc4 100644 --- a/lib/ft_io.h +++ b/lib/ft_io.h @@ -2,7 +2,7 @@ #define FT_IO_H_ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ diff --git a/lib/ft_ioaccept.c b/lib/ft_ioaccept.c index e6018b6f..fb8c0cfc 100644 --- a/lib/ft_ioaccept.c +++ b/lib/ft_ioaccept.c @@ -1,12 +1,12 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ -#include -#include +#include +#include static void ft_io_accept_cb(uv_stream_t *handle, int status) @@ -37,7 +37,7 @@ ft_io_accept_client(ftio *io) return client; } -FLUENT_API int +FLINT_API int ft_accept(ftio_t iop, ftio_t *client) { ftio *io = iop; diff --git a/lib/ft_iobind.c b/lib/ft_iobind.c index 91245d39..f8c933d2 100644 --- a/lib/ft_iobind.c +++ b/lib/ft_iobind.c @@ -1,14 +1,14 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ -#include -#include +#include +#include -FLUENT_API int +FLINT_API int ft_bind(ftio_t iop, char *addr, int port) { ftio *io = iop; diff --git a/lib/ft_ioconnect.c b/lib/ft_ioconnect.c index 8e5ee4aa..5401b550 100644 --- a/lib/ft_ioconnect.c +++ b/lib/ft_ioconnect.c @@ -1,12 +1,12 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ -#include -#include +#include +#include static void ft_io_connect_timeout_cb(uv_timer_t *handle) @@ -32,14 +32,14 @@ wakeup: ft_wakeup(io->f, io->connect_fiber); } -FLUENT_API int +FLINT_API int ft_is_connected(ftio_t iop) { ftio *io = iop; return io->connected; } -FLUENT_API int +FLINT_API int ft_connect(ftio_t iop, char *addr, int port, uint64_t time_ms) { ftio *io = iop; @@ -93,7 +93,7 @@ ft_connect(ftio_t iop, char *addr, int port, uint64_t time_ms) return rc; } -FLUENT_API int +FLINT_API int ft_connect_is_timeout(ftio_t iop) { ftio *io = iop; diff --git a/lib/ft_ioread.c b/lib/ft_ioread.c index 848e2133..cecd21b3 100644 --- a/lib/ft_ioread.c +++ b/lib/ft_ioread.c @@ -1,12 +1,12 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ -#include -#include +#include +#include static void ft_io_read_timeout_cb(uv_timer_t *handle) @@ -60,7 +60,7 @@ ft_io_read_cb(uv_stream_t *handle, ssize_t size, const uv_buf_t *buf) ft_wakeup(io->f, io->read_fiber); } -FLUENT_API int +FLINT_API int ft_read(ftio_t iop, int size, uint64_t time_ms) { ftio *io = iop; @@ -88,14 +88,14 @@ ft_read(ftio_t iop, int size, uint64_t time_ms) return rc; } -FLUENT_API int +FLINT_API int ft_read_is_timeout(ftio_t iop) { ftio *io = iop; return io->read_timeout; } -FLUENT_API char* +FLINT_API char* ft_read_buf(ftio_t iop) { ftio *io = iop; diff --git a/lib/ft_iowrite.c b/lib/ft_iowrite.c index 5fd8eeae..cb58a917 100644 --- a/lib/ft_iowrite.c +++ b/lib/ft_iowrite.c @@ -1,12 +1,12 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ -#include -#include +#include +#include static void ft_io_write_timeout_cb(uv_timer_t *handle) @@ -30,7 +30,7 @@ wakeup: ft_wakeup(io->f, io->write_fiber); } -FLUENT_API int +FLINT_API int ft_write(ftio_t iop, char *buf, int size, uint64_t time_ms) { ftio *io = iop; @@ -56,7 +56,7 @@ ft_write(ftio_t iop, char *buf, int size, uint64_t time_ms) return rc; } -FLUENT_API int +FLINT_API int ft_write_is_timeout(ftio_t iop) { ftio *io = iop; diff --git a/lib/ft_list.h b/lib/ft_list.h index 405d82d5..9a6c48f7 100644 --- a/lib/ft_list.h +++ b/lib/ft_list.h @@ -2,7 +2,7 @@ #define FT_LIST_H_ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ diff --git a/lib/ft_macro.h b/lib/ft_macro.h index 8a642827..83528e63 100644 --- a/lib/ft_macro.h +++ b/lib/ft_macro.h @@ -2,7 +2,7 @@ #define FT_MACRO_H_ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ diff --git a/lib/ft_scheduler.c b/lib/ft_scheduler.c index 6a264e9d..ce4420b0 100644 --- a/lib/ft_scheduler.c +++ b/lib/ft_scheduler.c @@ -1,11 +1,11 @@ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ -#include +#include static void ft_scheduler_main(void *arg) diff --git a/lib/ft_scheduler.h b/lib/ft_scheduler.h index 67886c8a..012368f7 100644 --- a/lib/ft_scheduler.h +++ b/lib/ft_scheduler.h @@ -2,7 +2,7 @@ #define FT_SCHEDULER_H_ /* - * fluent. + * flint. * * Cooperative multitasking engine. */ diff --git a/lib/makefile b/lib/makefile index 5fcebf34..0f6fefb2 100644 --- a/lib/makefile +++ b/lib/makefile @@ -1,4 +1,4 @@ -# libfluent makefile. +# libflint makefile. # CC = gcc AR = ar @@ -15,7 +15,7 @@ OBJECTS = ft_context.o \ ft_ioread.o \ ft_iowrite.o -LIB = libfluent.a +LIB = libflint.a $(LIB): clean $(OBJECTS) $(AR) cr $(LIB) $(OBJECTS) .c.o: