- Notifications
You must be signed in to change notification settings - Fork8
The tbox online documentation site
NotificationsYou must be signed in to change notification settings
tboox/tbox-docs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
TBOX is a glib-like cross-platform C library that is simple to use yet powerful in nature.
The project focuses on making C development easier and provides many modules (.e.g stream, coroutine, regex, container, algorithm ...),so that any developer can quickly pick it up and enjoy the productivity boost when developing in C language.
It supports the following platforms:
- Windows
- Macosx
- Linux
- Android
- iOS
And it provides many compiling options usingxmake:
- Release: Disable debug information, assertion, memory checking and enable optimization.
- Debug: Enable debug information, assertion, memory checking and disable optimization.
- Small: Disable all extensional modules and enable space optimization.
- Micro: compiling micro library (~64K) for the embed system.
If you want to know more, please refer to:
- Supports file, data, http and socket source
- Supports the stream filter for gzip, charset and...
- Implements stream transfer
- Implements the static buffer stream for parsing data
- Supports coroutine and implements asynchronous operation
- Provides high-performance coroutine switch(refer toreports)
- Supports arm, arm64, x86, x86_64 ..
- Provides channel interfaces
- Provides semaphore and lock interfaces
- Supports io socket and stream operation in coroutine
- Provides some io servers (http ..) using coroutine
- Provides stackfull and stackless coroutines
- Support epoll, kqueue, poll, select and IOCP
- Supports mysql and sqlite3 database and enumerates data using the iterator mode
- Supports DOM and SAX mode and Supports xpath
- Supports xml, json, bplist, xplist, binary formats
- Implements some memory pools for optimizing memory
- Supports fast memory error detecting. it can detect the following types of bugs for the debug mode:
- out-of-bounds accesses to heap and globals
- use-after-free
- double-free, invalid free
- memory leaks
- Implements hash table, single list, double list, vector, stack, queueand min/max heap. Supports iterator mode for algorithm
- Uses the iterator mode
- Implements find, binary find and reverse find algorithm
- Implements sort, bubble sort, quick sort, heap sort and insert sort algorithm
- Implements count, walk items, reverse walk items, for_all and rfor_all
- Implements dns(cached)
- Implements ssl(openssl, polarssl, mbedtls)
- Implements http
- Implements cookies
- Supports ipv4, ipv6
- Supports coroutine
- Implements timer, fast and low precision timer
- Implements atomic and atomic64 operation
- Implements spinlock, mutex, event, semaphore, thread and thread pool
- Implements file, socket operation
- Implements poller using epoll, poll, select, kqueue ...
- Implements switch context interfaces for coroutine
- Supports utf8, utf16, gbk, gb2312, uc2 and uc4
- Supports big endian and little endian mode
- Supports gzip, zlibraw, zlib formats using the zlib library if exists
- Implements lzsw, lz77 and rlc algorithm
- Implements base32, base64 encoder and decoder
- Implements assert and trace output for the debug mode
- Implements bits operation for parsing u8, u16, u32, u64 data
- Implements random generator
- Implements fast fixed-point calculation, Supports 6-bits, 16-bits, 30-bits fixed-point number
- Implements lightweight libc library interfaces, the interface name contains
tb_xxx
prefix for avoiding conflict - Implements strixxx strrxxx wcsixxx wcsrxxx interface extension
- Optimizes some frequently-used interface, .e.g. memset, memcpy, strcpy ...
- Implements
memset_u16
,memset_u32
,memset_u64
extension interfaces
- Implements lightweight libm library interfaces, the interface name contains
tb_xxx
prefix for avoiding conflict - Supports float and double type
- Supports match and replace
- Supports global/multiline/caseless mode
- Uses pcre, pcre2 and posix regex modules
- Implements crc32, adler32, md5 and sha1 hash algorithm
- Implements some string hash algorithms (.e.g bkdr, fnv32, fnv64, sdbm, djb2, rshash, aphash ...)
- Implements uuid generator
Some projects using tbox:
Please install xmake first:xmake
#buildfor the host platform$cd ./tbox$xmake#buildfor the mingw platform$cd ./tbox$xmake f -p mingw --sdk=/home/mingwsdk$xmake#buildfor the iphoneos platform$cd ./tbox$xmake f -p iphoneos$xmake#buildfor the android platform$cd ./tbox$xmake f -p android --ndk=xxxxx$xmake#buildfor the linux cross-platform$cd ./tbox$xmake f -p linux --sdk=/home/sdk# --bin=/home/sdk/bin$xmake
#include"tbox/tbox.h"intmain(intargc,char**argv){// init tboxif (!tb_init(tb_null,tb_null))return0;// tracetb_trace_i("hello tbox");// init vectortb_vector_ref_tvector=tb_vector_init(0,tb_element_cstr(tb_true));if (vector) {// insert itemtb_vector_insert_tail(vector,"hello");tb_vector_insert_tail(vector,"tbox");// dump all itemstb_for_all (tb_char_tconst*,cstr,vector) {// tracetb_trace_i("%s",cstr); }// exit vectortb_vector_exit(vector); }// init streamtb_stream_ref_tstream=tb_stream_init_from_url("http://www.xxx.com/file.txt");if (stream) {// open streamif (tb_stream_open(stream)) {// read linetb_long_tsize=0;tb_char_tline[TB_STREAM_BLOCK_MAXN];while ((size=tb_stream_bread_line(stream,line,sizeof(line))) >=0) {// tracetb_trace_i("line: %s",line); } }// exit streamtb_stream_exit(stream); }// waittb_getchar();// exit tboxtb_exit();return0;}
- Email:waruqi@gmail.com
- Homepage:tboox.org
- Community:/r/tboox on reddit
- QQ Group: 343118190
- Wechat Public: tboox-os