File | Date | Author | Commit |
---|---|---|---|
src | 2018-10-18 |
![]() |
[c75aec] fix compile errors for mingw |
.appveyor.yml | 2017-08-10 |
![]() |
[aa9f8e] fix appveyor |
.gitignore | 2017-10-11 |
![]() |
[70055f] ignore .vscode dir |
.travis.yml | 2018-09-13 |
![]() |
[9fd91b] remove coverage test |
CHANGELOG.md | 2018-08-01 |
![]() |
[caedd6] modify changelogs |
CODE_OF_CONDUCT.md | 2018-08-28 |
![]() |
[0ca01c] Fix CODE_OF_CONDUCT translations. |
CONTRIBUTING.md | 2018-08-13 |
![]() |
[5edbb9] modify contributing.md |
LICENSE.md | 2018-02-09 |
![]() |
[117059] modify copyright date |
NOTICE.md | 2018-02-09 |
![]() |
[117059] modify copyright date |
README.md | 2018-09-13 |
![]() |
[9fd91b] remove coverage test |
README_zh.md | 2018-09-13 |
![]() |
[9fd91b] remove coverage test |
makefile | 2018-05-08 |
![]() |
[e85500] modify makefile |
xmake.lua | 2018-10-20 |
![]() |
[0621b7] update xmakever |
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:
And it provides many compiling options using xmake:
If you want to know more, please refer to:
tb_xxx
prefix for avoiding conflictmemset_u16
, memset_u32
, memset_u64
extension interfacestb_xxx
prefix for avoiding conflictSome projects using tbox:
Please install xmake first: xmake
# build for the host platform
$ cd ./tbox
$ xmake
# build for the mingw platform
$ cd ./tbox
$ xmake f -p mingw --sdk=/home/mingwsdk
$ xmake
# build for the iphoneos platform
$ cd ./tbox
$ xmake f -p iphoneos
$ xmake
# build for the android platform
$ cd ./tbox
$ xmake f -p android --ndk=xxxxx
$ xmake
# build for the linux cross-platform
$ cd ./tbox
$ xmake f -p linux --sdk=/home/sdk # --bin=/home/sdk/bin
$ xmake
#include "tbox/tbox.h"
int main(int argc, char** argv)
{
// init tbox
if (!tb_init(tb_null, tb_null)) return 0;
// trace
tb_trace_i("hello tbox");
// init vector
tb_vector_ref_t vector = tb_vector_init(0, tb_element_cstr(tb_true));
if (vector)
{
// insert item
tb_vector_insert_tail(vector, "hello");
tb_vector_insert_tail(vector, "tbox");
// dump all items
tb_for_all (tb_char_t const*, cstr, vector)
{
// trace
tb_trace_i("%s", cstr);
}
// exit vector
tb_vector_exit(vector);
}
// init stream
tb_stream_ref_t stream = tb_stream_init_from_url("http://www.xxx.com/file.txt");
if (stream)
{
// open stream
if (tb_stream_open(stream))
{
// read line
tb_long_t size = 0;
tb_char_t line[TB_STREAM_BLOCK_MAXN];
while ((size = tb_stream_bread_line(stream, line, sizeof(line))) >= 0)
{
// trace
tb_trace_i("line: %s", line);
}
}
// exit stream
tb_stream_exit(stream);
}
// wait
getchar();
// exit tbox
tb_exit();
return 0;
}