diff options
| author | ruki <[email protected]> | 2015-12-15 10:29:33 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-12-15 10:29:33 +0800 |
| commit | 5152870f70f4cd527c619f28493d834319b519ca (patch) | |
| tree | fb2019e7cb45b9cdcc2eb447a82bc79e8e756160 | |
| parent | f4c063e409f86d663bd038e882412d369f94ac1e (diff) | |
update tbox
316 files changed, 811 insertions, 1283 deletions
diff --git a/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h b/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h index b91e4b526..06b3e3eeb 100755 --- a/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h +++ b/core/pkg/tbox.pkg/inc/mac/x64/tbox.config.h @@ -6,16 +6,17 @@ #define TB_CONFIG_VERSION_MAJOR 1 #define TB_CONFIG_VERSION_MINOR 5 #define TB_CONFIG_VERSION_ALTER 1 -#define TB_CONFIG_VERSION_BUILD 201511252203 +#define TB_CONFIG_VERSION_BUILD 201512151025 // defines #define TB_CONFIG_OS_MACOSX #define TB_CONFIG_INFO_HAVE_VERSION #define TB_CONFIG_TYPE_HAVE_FLOAT #define TB_CONFIG_MODULE_HAVE_XML -#define TB_CONFIG_MODULE_HAVE_ZIP #define TB_CONFIG_MODULE_HAVE_ASIO #define TB_CONFIG_MODULE_HAVE_OBJECT +#define TB_CONFIG_MODULE_HAVE_THREAD +#define TB_CONFIG_MODULE_HAVE_NETWORK #define TB_CONFIG_MODULE_HAVE_CHARSET #define TB_CONFIG_LIBC_HAVE_MEMCPY #define TB_CONFIG_LIBC_HAVE_MEMSET diff --git a/core/pkg/tbox.pkg/inc/msvc/x86/tbox.config.h b/core/pkg/tbox.pkg/inc/msvc/x86/tbox.config.h index f47cb8f55..bae8c5d13 100644 --- a/core/pkg/tbox.pkg/inc/msvc/x86/tbox.config.h +++ b/core/pkg/tbox.pkg/inc/msvc/x86/tbox.config.h @@ -6,16 +6,17 @@ #define TB_CONFIG_VERSION_MAJOR 1
#define TB_CONFIG_VERSION_MINOR 5
#define TB_CONFIG_VERSION_ALTER 1
-#define TB_CONFIG_VERSION_BUILD 201511252220
+#define TB_CONFIG_VERSION_BUILD 201512150943
// defines
#define TB_CONFIG_OS_WINDOWS
#define TB_CONFIG_INFO_HAVE_VERSION
#define TB_CONFIG_TYPE_HAVE_FLOAT
#define TB_CONFIG_MODULE_HAVE_XML
-#define TB_CONFIG_MODULE_HAVE_ZIP
#define TB_CONFIG_MODULE_HAVE_ASIO
#define TB_CONFIG_MODULE_HAVE_OBJECT
+#define TB_CONFIG_MODULE_HAVE_THREAD
+#define TB_CONFIG_MODULE_HAVE_NETWORK
#define TB_CONFIG_MODULE_HAVE_CHARSET
#define TB_CONFIG_LIBC_HAVE_MEMCPY
#define TB_CONFIG_LIBC_HAVE_MEMSET
diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/algorithm.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/algorithm.h index e8c3981ac..e8c3981ac 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/algorithm.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/algorithm.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/binary_find.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/binary_find.h index 6a6f0b5f5..6a6f0b5f5 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/binary_find.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/binary_find.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/binary_find_if.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/binary_find_if.h index 43d9f581c..43d9f581c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/binary_find_if.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/binary_find_if.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/bubble_sort.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/bubble_sort.h index 9d98c046e..9d98c046e 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/bubble_sort.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/bubble_sort.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/count.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/count.h index 58053cbef..58053cbef 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/count.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/count.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/count_if.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/count_if.h index 4800417b5..4800417b5 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/count_if.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/count_if.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/distance.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/distance.h index 268049483..268049483 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/distance.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/distance.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/find.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/find.h index be3ed6f3c..be3ed6f3c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/find.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/find.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/find_if.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/find_if.h index d5239aa5c..d5239aa5c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/find_if.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/find_if.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/for.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/for.h index 814607a3e..814607a3e 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/for.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/for.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/for_if.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/for_if.h index cd2270a25..cd2270a25 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/for_if.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/for_if.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/heap_sort.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/heap_sort.h index 092ba2387..092ba2387 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/heap_sort.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/heap_sort.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/insert_sort.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/insert_sort.h index 595be6a66..595be6a66 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/insert_sort.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/insert_sort.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/predicate.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/predicate.h index 3b9e13eb2..3b9e13eb2 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/predicate.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/predicate.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/prefix.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/prefix.h index c991dc554..c991dc554 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/quick_sort.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/quick_sort.h index 51aca3eae..51aca3eae 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/quick_sort.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/quick_sort.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/remove.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/remove.h index 55d688378..55d688378 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/remove.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/remove.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_first.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_first.h index a5524d6c4..a5524d6c4 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_first.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_first.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_first_if.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_first_if.h index 12a547e41..12a547e41 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_first_if.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_first_if.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_if.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_if.h index 382a94ffd..382a94ffd 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_if.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/remove_if.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/rfind.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/rfind.h index 5c9bf5368..5c9bf5368 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/rfind.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/rfind.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/rfind_if.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/rfind_if.h index 6608f39fa..6608f39fa 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/rfind_if.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/rfind_if.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/rfor.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/rfor.h index bbe553812..bbe553812 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/rfor.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/rfor.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/rfor_if.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/rfor_if.h index 41da291b1..41da291b1 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/rfor_if.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/rfor_if.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/rwalk.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/rwalk.h index f85b0f1a3..f85b0f1a3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/rwalk.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/rwalk.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/sort.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/sort.h index 8d76f7c03..8d76f7c03 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/sort.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/sort.h diff --git a/core/pkg/tbox.pkg/inc/tbox/algorithm/walk.h b/core/pkg/tbox.pkg/inc/tbox/algorithm/walk.h index b5fe70f03..b5fe70f03 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/algorithm/walk.h +++ b/core/pkg/tbox.pkg/inc/tbox/algorithm/walk.h diff --git a/core/pkg/tbox.pkg/inc/tbox/asio/aice.h b/core/pkg/tbox.pkg/inc/tbox/asio/aice.h index 5093b6b2f..5093b6b2f 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/asio/aice.h +++ b/core/pkg/tbox.pkg/inc/tbox/asio/aice.h diff --git a/core/pkg/tbox.pkg/inc/tbox/asio/aico.h b/core/pkg/tbox.pkg/inc/tbox/asio/aico.h index 9b808c738..9b808c738 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/asio/aico.h +++ b/core/pkg/tbox.pkg/inc/tbox/asio/aico.h diff --git a/core/pkg/tbox.pkg/inc/tbox/asio/aicp.h b/core/pkg/tbox.pkg/inc/tbox/asio/aicp.h index f8c0fbf62..f8c0fbf62 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/asio/aicp.h +++ b/core/pkg/tbox.pkg/inc/tbox/asio/aicp.h diff --git a/core/pkg/tbox.pkg/inc/tbox/asio/aioe.h b/core/pkg/tbox.pkg/inc/tbox/asio/aioe.h index e9c692a48..e9c692a48 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/asio/aioe.h +++ b/core/pkg/tbox.pkg/inc/tbox/asio/aioe.h diff --git a/core/pkg/tbox.pkg/inc/tbox/asio/aioo.h b/core/pkg/tbox.pkg/inc/tbox/asio/aioo.h index 372cbd86d..372cbd86d 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/asio/aioo.h +++ b/core/pkg/tbox.pkg/inc/tbox/asio/aioo.h diff --git a/core/pkg/tbox.pkg/inc/tbox/asio/aiop.h b/core/pkg/tbox.pkg/inc/tbox/asio/aiop.h index 4b5cc15e3..4b5cc15e3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/asio/aiop.h +++ b/core/pkg/tbox.pkg/inc/tbox/asio/aiop.h diff --git a/core/pkg/tbox.pkg/inc/tbox/asio/asio.h b/core/pkg/tbox.pkg/inc/tbox/asio/asio.h index 8d96712c2..8d96712c2 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/asio/asio.h +++ b/core/pkg/tbox.pkg/inc/tbox/asio/asio.h diff --git a/core/pkg/tbox.pkg/inc/tbox/asio/dns.h b/core/pkg/tbox.pkg/inc/tbox/asio/dns.h index 5039b4cec..5039b4cec 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/asio/dns.h +++ b/core/pkg/tbox.pkg/inc/tbox/asio/dns.h diff --git a/core/pkg/tbox.pkg/inc/tbox/asio/http.h b/core/pkg/tbox.pkg/inc/tbox/asio/http.h index 1fddab323..1fddab323 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/asio/http.h +++ b/core/pkg/tbox.pkg/inc/tbox/asio/http.h diff --git a/core/pkg/tbox.pkg/inc/tbox/asio/prefix.h b/core/pkg/tbox.pkg/inc/tbox/asio/prefix.h index fe7990e96..fe7990e96 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/asio/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/asio/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/asio/ssl.h b/core/pkg/tbox.pkg/inc/tbox/asio/ssl.h index a2d192e52..a2d192e52 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/asio/ssl.h +++ b/core/pkg/tbox.pkg/inc/tbox/asio/ssl.h diff --git a/core/pkg/tbox.pkg/inc/tbox/charset/charset.h b/core/pkg/tbox.pkg/inc/tbox/charset/charset.h index e33d12436..e33d12436 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/charset/charset.h +++ b/core/pkg/tbox.pkg/inc/tbox/charset/charset.h diff --git a/core/pkg/tbox.pkg/inc/tbox/charset/prefix.h b/core/pkg/tbox.pkg/inc/tbox/charset/prefix.h index 4f36158ce..4f36158ce 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/charset/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/charset/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/config.h b/core/pkg/tbox.pkg/inc/tbox/config.h index 27ccfd550..27ccfd550 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/config.h +++ b/core/pkg/tbox.pkg/inc/tbox/config.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/bloom_filter.h b/core/pkg/tbox.pkg/inc/tbox/container/bloom_filter.h index 346e115d5..883e0bab9 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/bloom_filter.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/bloom_filter.h @@ -138,7 +138,7 @@ typedef enum __tb_bloom_filter_probability_e * @param item_maxn the item maxn * @param element the element only for hash * - * @return the bloom_filter + * @return the bloom filter */ tb_bloom_filter_ref_t tb_bloom_filter_init(tb_size_t probability, tb_size_t hash_count, tb_size_t item_maxn, tb_element_t element); diff --git a/core/pkg/tbox.pkg/inc/tbox/container/circle_queue.h b/core/pkg/tbox.pkg/inc/tbox/container/circle_queue.h index 82157147c..82157147c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/circle_queue.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/circle_queue.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/container.h b/core/pkg/tbox.pkg/inc/tbox/container/container.h index 237ceb9c1..237ceb9c1 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/container.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/container.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/element.h b/core/pkg/tbox.pkg/inc/tbox/container/element.h index 1ded4b0ff..1ded4b0ff 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/element.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/element.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/element/hash.h b/core/pkg/tbox.pkg/inc/tbox/container/element/hash.h index 54a4e411a..54a4e411a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/element/hash.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/element/hash.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/element/prefix.h b/core/pkg/tbox.pkg/inc/tbox/container/element/prefix.h index 51bf8c8a4..51bf8c8a4 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/element/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/element/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/hash_map.h b/core/pkg/tbox.pkg/inc/tbox/container/hash_map.h index 976369f6f..976369f6f 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/hash_map.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/hash_map.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/hash_set.h b/core/pkg/tbox.pkg/inc/tbox/container/hash_set.h index db0e930e8..db0e930e8 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/hash_set.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/hash_set.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/heap.h b/core/pkg/tbox.pkg/inc/tbox/container/heap.h index 612618bca..612618bca 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/heap.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/heap.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/iterator.h b/core/pkg/tbox.pkg/inc/tbox/container/iterator.h index c0d26e620..c0d26e620 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/iterator.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/iterator.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/iterator/prefix.h b/core/pkg/tbox.pkg/inc/tbox/container/iterator/prefix.h index d84483189..d84483189 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/iterator/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/iterator/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/list.h b/core/pkg/tbox.pkg/inc/tbox/container/list.h index f27c4935a..f27c4935a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/list.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/list.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/list_entry.h b/core/pkg/tbox.pkg/inc/tbox/container/list_entry.h index 810736b64..810736b64 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/list_entry.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/list_entry.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/prefix.h b/core/pkg/tbox.pkg/inc/tbox/container/prefix.h index 3dde431fe..3dde431fe 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/priority_queue.h b/core/pkg/tbox.pkg/inc/tbox/container/priority_queue.h index 2e87a64ae..2e87a64ae 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/priority_queue.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/priority_queue.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/queue.h b/core/pkg/tbox.pkg/inc/tbox/container/queue.h index 8aa5a98aa..8aa5a98aa 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/queue.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/queue.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/single_list.h b/core/pkg/tbox.pkg/inc/tbox/container/single_list.h index 861c749c0..861c749c0 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/single_list.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/single_list.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/single_list_entry.h b/core/pkg/tbox.pkg/inc/tbox/container/single_list_entry.h index a5e0923a3..a5e0923a3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/single_list_entry.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/single_list_entry.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/stack.h b/core/pkg/tbox.pkg/inc/tbox/container/stack.h index d357eca0a..d357eca0a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/stack.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/stack.h diff --git a/core/pkg/tbox.pkg/inc/tbox/container/vector.h b/core/pkg/tbox.pkg/inc/tbox/container/vector.h index 53b3e111d..53b3e111d 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/container/vector.h +++ b/core/pkg/tbox.pkg/inc/tbox/container/vector.h diff --git a/core/pkg/tbox.pkg/inc/tbox/database/database.h b/core/pkg/tbox.pkg/inc/tbox/database/database.h index 26122a4ec..26122a4ec 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/database/database.h +++ b/core/pkg/tbox.pkg/inc/tbox/database/database.h diff --git a/core/pkg/tbox.pkg/inc/tbox/database/prefix.h b/core/pkg/tbox.pkg/inc/tbox/database/prefix.h index e0e7f10d5..e0e7f10d5 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/database/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/database/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/database/sql.h b/core/pkg/tbox.pkg/inc/tbox/database/sql.h index 26f66c99a..26f66c99a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/database/sql.h +++ b/core/pkg/tbox.pkg/inc/tbox/database/sql.h diff --git a/core/pkg/tbox.pkg/inc/tbox/database/value.h b/core/pkg/tbox.pkg/inc/tbox/database/value.h index a28d286ee..a28d286ee 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/database/value.h +++ b/core/pkg/tbox.pkg/inc/tbox/database/value.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/libc.h b/core/pkg/tbox.pkg/inc/tbox/libc/libc.h index 0ae380055..0ae380055 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/libc.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/libc.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/misc/ctype.h b/core/pkg/tbox.pkg/inc/tbox/libc/misc/ctype.h index 878fce45c..878fce45c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/misc/ctype.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/misc/ctype.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/misc/limits.h b/core/pkg/tbox.pkg/inc/tbox/libc/misc/limits.h index 45828a1a7..45828a1a7 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/misc/limits.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/misc/limits.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/misc/misc.h b/core/pkg/tbox.pkg/inc/tbox/libc/misc/misc.h index 84a6aebbf..84a6aebbf 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/misc/misc.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/misc/misc.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/misc/prefix.h b/core/pkg/tbox.pkg/inc/tbox/libc/misc/prefix.h index 3cd542525..3cd542525 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/misc/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/misc/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/misc/setjmp.h b/core/pkg/tbox.pkg/inc/tbox/libc/misc/setjmp.h index b8583dcfd..b8583dcfd 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/misc/setjmp.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/misc/setjmp.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/misc/signal.h b/core/pkg/tbox.pkg/inc/tbox/libc/misc/signal.h index ca15dc661..ca15dc661 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/misc/signal.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/misc/signal.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/misc/stdarg.h b/core/pkg/tbox.pkg/inc/tbox/libc/misc/stdarg.h index 16aff2378..16aff2378 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/misc/stdarg.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/misc/stdarg.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/prefix.h b/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/prefix.h index af57dee8b..af57dee8b 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/time.h b/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/time.h index d96c76432..d96c76432 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/time.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/time.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/type.h b/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/type.h index 25679768a..25679768a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/type.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/misc/time/type.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/prefix.h b/core/pkg/tbox.pkg/inc/tbox/libc/prefix.h index d01c40204..d01c40204 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/stdio/prefix.h b/core/pkg/tbox.pkg/inc/tbox/libc/stdio/prefix.h index 0b3b5db9e..0b3b5db9e 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/stdio/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/stdio/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/stdio/printf_object.h b/core/pkg/tbox.pkg/inc/tbox/libc/stdio/printf_object.h index 966ddc4a9..966ddc4a9 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/stdio/printf_object.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/stdio/printf_object.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/stdio/stdio.h b/core/pkg/tbox.pkg/inc/tbox/libc/stdio/stdio.h index 99935bce8..99935bce8 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/stdio/stdio.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/stdio/stdio.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/stdlib/prefix.h b/core/pkg/tbox.pkg/inc/tbox/libc/stdlib/prefix.h index 16225fb06..16225fb06 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/stdlib/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/stdlib/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/stdlib/stdlib.h b/core/pkg/tbox.pkg/inc/tbox/libc/stdlib/stdlib.h index e22467e29..e22467e29 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/stdlib/stdlib.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/stdlib/stdlib.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/string/prefix.h b/core/pkg/tbox.pkg/inc/tbox/libc/string/prefix.h index 4a7bd507e..4a7bd507e 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/string/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/string/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libc/string/string.h b/core/pkg/tbox.pkg/inc/tbox/libc/string/string.h index ead619b44..ead619b44 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libc/string/string.h +++ b/core/pkg/tbox.pkg/inc/tbox/libc/string/string.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/ceil.h b/core/pkg/tbox.pkg/inc/tbox/libm/ceil.h index eb3eaf343..eb3eaf343 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/ceil.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/ceil.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/fabs.h b/core/pkg/tbox.pkg/inc/tbox/libm/fabs.h index 2465c49e2..2465c49e2 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/fabs.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/fabs.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/floor.h b/core/pkg/tbox.pkg/inc/tbox/libm/floor.h index 8c31041c1..8c31041c1 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/floor.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/floor.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/inf.h b/core/pkg/tbox.pkg/inc/tbox/libm/inf.h index 289ead7e3..289ead7e3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/inf.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/inf.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/libm.h b/core/pkg/tbox.pkg/inc/tbox/libm/libm.h index ddcb0df07..ddcb0df07 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/libm.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/libm.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/maf.h b/core/pkg/tbox.pkg/inc/tbox/libm/maf.h index 3101d4a4a..3101d4a4a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/maf.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/maf.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/math.h b/core/pkg/tbox.pkg/inc/tbox/libm/math.h index 5f6b91737..5f6b91737 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/math.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/math.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/mif.h b/core/pkg/tbox.pkg/inc/tbox/libm/mif.h index 0518db0d3..0518db0d3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/mif.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/mif.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/nan.h b/core/pkg/tbox.pkg/inc/tbox/libm/nan.h index 0aca2f237..0aca2f237 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/nan.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/nan.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/pi.h b/core/pkg/tbox.pkg/inc/tbox/libm/pi.h index 29bbc59c7..29bbc59c7 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/pi.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/pi.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/prefix.h b/core/pkg/tbox.pkg/inc/tbox/libm/prefix.h index 0e0e72d14..0e0e72d14 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/libm/round.h b/core/pkg/tbox.pkg/inc/tbox/libm/round.h index 17e9148fc..17e9148fc 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/libm/round.h +++ b/core/pkg/tbox.pkg/inc/tbox/libm/round.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/fixed.h b/core/pkg/tbox.pkg/inc/tbox/math/fixed.h index 590578a73..590578a73 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/fixed.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/fixed.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/fixed16.h b/core/pkg/tbox.pkg/inc/tbox/math/fixed16.h index abe99aadc..abe99aadc 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/fixed16.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/fixed16.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/fixed30.h b/core/pkg/tbox.pkg/inc/tbox/math/fixed30.h index 41965701a..41965701a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/fixed30.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/fixed30.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/fixed6.h b/core/pkg/tbox.pkg/inc/tbox/math/fixed6.h index 0703e2b0d..0703e2b0d 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/fixed6.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/fixed6.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/impl/fixed16_arm.h b/core/pkg/tbox.pkg/inc/tbox/math/impl/fixed16_arm.h index 2a84fca64..2a84fca64 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/impl/fixed16_arm.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/impl/fixed16_arm.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/impl/fixed30_arm.h b/core/pkg/tbox.pkg/inc/tbox/math/impl/fixed30_arm.h index 68ea25f26..68ea25f26 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/impl/fixed30_arm.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/impl/fixed30_arm.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/impl/prefix.h b/core/pkg/tbox.pkg/inc/tbox/math/impl/prefix.h index 55e9f3aff..55e9f3aff 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/impl/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/impl/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/impl/random.h b/core/pkg/tbox.pkg/inc/tbox/math/impl/random.h index c73accf88..c73accf88 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/impl/random.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/impl/random.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/int32.h b/core/pkg/tbox.pkg/inc/tbox/math/int32.h index b51d425a3..b51d425a3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/int32.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/int32.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/math.h b/core/pkg/tbox.pkg/inc/tbox/math/math.h index 9eef102c4..9eef102c4 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/math.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/math.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/prefix.h b/core/pkg/tbox.pkg/inc/tbox/math/prefix.h index e42d4e57a..e42d4e57a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/math/random.h b/core/pkg/tbox.pkg/inc/tbox/math/random.h index f21a364ee..f21a364ee 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/math/random.h +++ b/core/pkg/tbox.pkg/inc/tbox/math/random.h diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/allocator.h b/core/pkg/tbox.pkg/inc/tbox/memory/allocator.h index cbd3db77c..d78d66b90 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/memory/allocator.h +++ b/core/pkg/tbox.pkg/inc/tbox/memory/allocator.h @@ -38,22 +38,58 @@ __tb_extern_c_enter__ * macros */ -#define tb_allocator_malloc(allocator, size) tb_allocator_malloc_(allocator, size __tb_debug_vals__) -#define tb_allocator_malloc0(allocator, size) tb_allocator_malloc0_(allocator, size __tb_debug_vals__) +#define tb_allocator_malloc(allocator, size) tb_allocator_malloc_(allocator, size __tb_debug_vals__) +#define tb_allocator_malloc0(allocator, size) tb_allocator_malloc0_(allocator, size __tb_debug_vals__) -#define tb_allocator_nalloc(allocator, item, size) tb_allocator_nalloc_(allocator, item, size __tb_debug_vals__) -#define tb_allocator_nalloc0(allocator, item, size) tb_allocator_nalloc0_(allocator, item, size __tb_debug_vals__) +#define tb_allocator_nalloc(allocator, item, size) tb_allocator_nalloc_(allocator, item, size __tb_debug_vals__) +#define tb_allocator_nalloc0(allocator, item, size) tb_allocator_nalloc0_(allocator, item, size __tb_debug_vals__) -#define tb_allocator_ralloc(allocator, data, size) tb_allocator_ralloc_(allocator, (tb_pointer_t)(data), size __tb_debug_vals__) -#define tb_allocator_free(allocator, data) tb_allocator_free_(allocator, (tb_pointer_t)(data) __tb_debug_vals__) +#define tb_allocator_ralloc(allocator, data, size) tb_allocator_ralloc_(allocator, (tb_pointer_t)(data), size __tb_debug_vals__) +#define tb_allocator_free(allocator, data) tb_allocator_free_(allocator, (tb_pointer_t)(data) __tb_debug_vals__) + +#define tb_allocator_large_malloc(allocator, size, real) tb_allocator_large_malloc_(allocator, size, real __tb_debug_vals__) +#define tb_allocator_large_malloc0(allocator, size, real) tb_allocator_large_malloc0_(allocator, size, real __tb_debug_vals__) + +#define tb_allocator_large_nalloc(allocator, item, size, real) tb_allocator_large_nalloc_(allocator, item, size, real __tb_debug_vals__) +#define tb_allocator_large_nalloc0(allocator, item, size, real) tb_allocator_large_nalloc0_(allocator, item, size, real __tb_debug_vals__) + +#define tb_allocator_large_ralloc(allocator, data, size, real) tb_allocator_large_ralloc_(allocator, (tb_pointer_t)(data), size, real __tb_debug_vals__) +#define tb_allocator_large_free(allocator, data) tb_allocator_large_free_(allocator, (tb_pointer_t)(data) __tb_debug_vals__) + +#define tb_allocator_align_malloc(allocator, size, align) tb_allocator_align_malloc_(allocator, size, align __tb_debug_vals__) +#define tb_allocator_align_malloc0(allocator, size, align) tb_allocator_align_malloc0_(allocator, size, align __tb_debug_vals__) + +#define tb_allocator_align_nalloc(allocator, item, size, align) tb_allocator_align_nalloc_(allocator, item, size, align __tb_debug_vals__) +#define tb_allocator_align_nalloc0(allocator, item, size, align) tb_allocator_align_nalloc0_(allocator, item, size, align __tb_debug_vals__) + +#define tb_allocator_align_ralloc(allocator, data, size, align) tb_allocator_align_ralloc_(allocator, (tb_pointer_t)(data), size, align __tb_debug_vals__) +#define tb_allocator_align_free(allocator, data) tb_allocator_align_free_(allocator, (tb_pointer_t)(data) __tb_debug_vals__) /* ////////////////////////////////////////////////////////////////////////////////////// * types */ +/// the allocator type enum +typedef enum __tb_allocator_type_e +{ + TB_ALLOCATOR_NONE = 0 +, TB_ALLOCATOR_DEFAULT = 1 +, TB_ALLOCATOR_NATIVE = 2 +, TB_ALLOCATOR_STATIC = 4 +, TB_ALLOCATOR_LARGE = 5 +, TB_ALLOCATOR_SMALL = 6 + +}tb_allocator_type_e; + /// the allocator type typedef struct __tb_allocator_t { + /// the type + tb_size_t type; + + /// the lock + tb_spinlock_t lock; + /*! malloc data * * @param allocator the allocator @@ -82,12 +118,63 @@ typedef struct __tb_allocator_t */ tb_bool_t (*free)(struct __tb_allocator_t* allocator, tb_pointer_t data __tb_debug_decl__); + /*! malloc large data + * + * @param allocator the allocator + * @param size the size + * @param real the real allocated size >= size, optional + * + * @return the data address + */ + tb_pointer_t (*large_malloc)(struct __tb_allocator_t* allocator, tb_size_t size, tb_size_t* real __tb_debug_decl__); + + /*! realloc large data + * + * @param allocator the allocator + * @param data the data address + * @param size the data size + * @param real the real allocated size >= size, optional + * + * @return the new data address + */ + tb_pointer_t (*large_ralloc)(struct __tb_allocator_t* allocator, tb_pointer_t data, tb_size_t size, tb_size_t* real __tb_debug_decl__); + + /*! free large data + * + * @param allocator the allocator + * @param data the data address + * + * @return tb_true or tb_false + */ + tb_bool_t (*large_free)(struct __tb_allocator_t* allocator, tb_pointer_t data __tb_debug_decl__); + + /*! clear allocator + * + * @param allocator the allocator + */ + tb_void_t (*clear)(struct __tb_allocator_t* allocator); + + /*! exit allocator + * + * @param allocator the allocator + */ + tb_void_t (*exit)(struct __tb_allocator_t* allocator); + #ifdef __tb_debug__ /*! dump allocator * * @param allocator the allocator */ tb_void_t (*dump)(struct __tb_allocator_t* allocator); + + /*! have this given data addess? + * + * @param allocator the allocator + * @param data the data address + * + * @return tb_true or tb_false + */ + tb_bool_t (*have)(struct __tb_allocator_t* allocator, tb_cpointer_t data); #endif }tb_allocator_t, *tb_allocator_ref_t; @@ -96,12 +183,28 @@ typedef struct __tb_allocator_t * interfaces */ +/*! the allocator + * + * @return the allocator + */ +tb_allocator_ref_t tb_allocator(); + /*! the native allocator * + * uses system memory directly + * * @return the allocator */ tb_allocator_ref_t tb_allocator_native(tb_noarg_t); +/*! the allocator type + * + * @param allocator the allocator + * + * @return the allocator type + */ +tb_size_t tb_allocator_type(tb_allocator_ref_t allocator); + /*! malloc data * * @param allocator the allocator @@ -159,12 +262,156 @@ tb_pointer_t tb_allocator_ralloc_(tb_allocator_ref_t allocator, tb_po */ tb_bool_t tb_allocator_free_(tb_allocator_ref_t allocator, tb_pointer_t data __tb_debug_decl__); +/*! malloc large data + * + * @param allocator the allocator + * @param size the size + * @param real the real allocated size >= size, optional + * + * @return the data address + */ +tb_pointer_t tb_allocator_large_malloc_(tb_allocator_ref_t allocator, tb_size_t size, tb_size_t* real __tb_debug_decl__); + +/*! malloc large data and fill zero + * + * @param allocator the allocator + * @param size the size + * @param real the real allocated size >= size, optional + * + * @return the data address + */ +tb_pointer_t tb_allocator_large_malloc0_(tb_allocator_ref_t allocator, tb_size_t size, tb_size_t* real __tb_debug_decl__); + +/*! malloc large data with the item count + * + * @param allocator the allocator + * @param item the item count + * @param size the item size + * @param real the real allocated size >= item * size, optional + * + * @return the data address + */ +tb_pointer_t tb_allocator_large_nalloc_(tb_allocator_ref_t allocator, tb_size_t item, tb_size_t size, tb_size_t* real __tb_debug_decl__); + +/*! malloc large data with the item count and fill zero + * + * @param allocator the allocator + * @param item the item count + * @param size the item size + * @param real the real allocated size >= item * size, optional + * + * @return the data address + */ +tb_pointer_t tb_allocator_large_nalloc0_(tb_allocator_ref_t allocator, tb_size_t item, tb_size_t size, tb_size_t* real __tb_debug_decl__); + +/*! realloc large data + * + * @param allocator the allocator + * @param data the data address + * @param size the data size + * @param real the real allocated size >= size, optional + * + * @return the new data address + */ +tb_pointer_t tb_allocator_large_ralloc_(tb_allocator_ref_t allocator, tb_pointer_t data, tb_size_t size, tb_size_t* real __tb_debug_decl__); + +/*! free large data + * + * @param allocator the allocator + * @param data the data address + * + * @return tb_true or tb_false + */ +tb_bool_t tb_allocator_large_free_(tb_allocator_ref_t allocator, tb_pointer_t data __tb_debug_decl__); + +/*! align malloc data + * + * @param allocator the allocator + * @param size the size + * @param align the alignment bytes + * + * @return the data address + */ +tb_pointer_t tb_allocator_align_malloc_(tb_allocator_ref_t allocator, tb_size_t size, tb_size_t align __tb_debug_decl__); + +/*! align malloc data and fill zero + * + * @param allocator the allocator + * @param size the size + * @param align the alignment bytes + * + * @return the data address + */ +tb_pointer_t tb_allocator_align_malloc0_(tb_allocator_ref_t allocator, tb_size_t size, tb_size_t align __tb_debug_decl__); + +/*! align malloc data with the item count + * + * @param allocator the allocator + * @param item the item count + * @param size the item size + * @param align the alignment bytes + * + * @return the data address + */ +tb_pointer_t tb_allocator_align_nalloc_(tb_allocator_ref_t allocator, tb_size_t item, tb_size_t size, tb_size_t align __tb_debug_decl__); + +/*! align malloc data with the item count and fill zero + * + * @param allocator the allocator + * @param item the item count + * @param size the item size + * @param align the alignment bytes + * + * @return the data address + */ +tb_pointer_t tb_allocator_align_nalloc0_(tb_allocator_ref_t allocator, tb_size_t item, tb_size_t size, tb_size_t align __tb_debug_decl__); + +/*! align realloc data + * + * @param allocator the allocator + * @param data the data address + * @param size the data size + * + * @return the new data address + */ +tb_pointer_t tb_allocator_align_ralloc_(tb_allocator_ref_t allocator, tb_pointer_t data, tb_size_t size, tb_size_t align __tb_debug_decl__); + +/*! align free data + * + * @param allocator the allocator + * @param data the data address + * + * @return tb_true or tb_false + */ +tb_bool_t tb_allocator_align_free_(tb_allocator_ref_t allocator, tb_pointer_t data __tb_debug_decl__); + +/*! clear it + * + * @param allocator the allocator + */ +tb_void_t tb_allocator_clear(tb_allocator_ref_t allocator); + +/*! exit it + * + * @param allocator the allocator + */ +tb_void_t tb_allocator_exit(tb_allocator_ref_t allocator); + #ifdef __tb_debug__ /*! dump it * * @param allocator the allocator */ tb_void_t tb_allocator_dump(tb_allocator_ref_t allocator); + +/*! have this given data addess? + * + * @param allocator the allocator + * @param data the data address + * + * @return tb_true or tb_false + */ +tb_bool_t tb_allocator_have(tb_allocator_ref_t allocator, tb_cpointer_t data); #endif /* ////////////////////////////////////////////////////////////////////////////////////// diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/buffer.h b/core/pkg/tbox.pkg/inc/tbox/memory/buffer.h index 98c6f568e..98c6f568e 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/memory/buffer.h +++ b/core/pkg/tbox.pkg/inc/tbox/memory/buffer.h diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/default_allocator.h b/core/pkg/tbox.pkg/inc/tbox/memory/default_allocator.h new file mode 100644 index 000000000..4762a5e7d --- /dev/null +++ b/core/pkg/tbox.pkg/inc/tbox/memory/default_allocator.h @@ -0,0 +1,87 @@ +/*!The Treasure Box Library + * + * TBox is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * TBox is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with TBox; + * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> + * + * Copyright (C) 2009 - 2015, ruki All rights reserved. + * + * @author ruki + * @file default_allocator.h + * @ingroup memory + * + */ +#ifndef TB_MEMORY_DEFAULT_ALLOCATOR_H +#define TB_MEMORY_DEFAULT_ALLOCATOR_H + +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "prefix.h" +#include "allocator.h" +#include "large_allocator.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_enter__ + +/* ////////////////////////////////////////////////////////////////////////////////////// + * interfaces + */ + +/*! the global default allocator + * + * @param data the buffer data, uses the native buffer if be null + * @param size the buffer size + * + * @return the allocator + */ +tb_allocator_ref_t tb_default_allocator(tb_byte_t* data, tb_size_t size); + +/*! init the default allocator + * + * <pre> + * + * ---------------- ------------------------------------------------------- + * | native memory | or | data | + * ---------------- ------------------------------------------------------- + * | if data be null | + * `---------------------------------------> | + * | + * ----------------------------------------------------------------------------- + * | large allocator | + * ----------------------------------------------------------------------------- + * | | + * | --------------------------------------- + * | | small allocator | + * | --------------------------------------- + * | | + * ----------------------------------------------------------------------------- + * | >3KB | <=3KB | + * |-----------------------------------------------------------------------------| + * | default allocator | + * ----------------------------------------------------------------------------- + * + * @param large_allocator the large allocator, cannot be null + * + * @return the allocator + */ +tb_allocator_ref_t tb_default_allocator_init(tb_allocator_ref_t large_allocator); + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_leave__ + +#endif diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/fixed_pool.h b/core/pkg/tbox.pkg/inc/tbox/memory/fixed_pool.h index 998a0a02f..433948dd8 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/memory/fixed_pool.h +++ b/core/pkg/tbox.pkg/inc/tbox/memory/fixed_pool.h @@ -27,7 +27,7 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * includes */ -#include "large_pool.h" +#include "large_allocator.h" /* ////////////////////////////////////////////////////////////////////////////////////// * extern @@ -139,69 +139,69 @@ typedef tb_bool_t (*tb_fixed_pool_item_walk_func_t)(tb_pointer_t data, tb_ /*! init fixed pool * - * @param large_pool the large pool, using the default large pool if be null - * @param slot_size the item count per-slot, using the default size if be zero - * @param item_size the item size - * @param item_init the item init func - * @param item_exit the item exit func - * @param priv the private data + * @param large_allocator the large allocator, uses the global allocator if be null + * @param slot_size the item count per-slot, using the default size if be zero + * @param item_size the item size + * @param item_init the item init func + * @param item_exit the item exit func + * @param priv the private data * - * @return the pool + * @return the pool */ -tb_fixed_pool_ref_t tb_fixed_pool_init(tb_large_pool_ref_t large_pool, tb_size_t slot_size, tb_size_t item_size, tb_fixed_pool_item_init_func_t item_init, tb_fixed_pool_item_exit_func_t item_exit, tb_cpointer_t priv); +tb_fixed_pool_ref_t tb_fixed_pool_init(tb_allocator_ref_t large_allocator, tb_size_t slot_size, tb_size_t item_size, tb_fixed_pool_item_init_func_t item_init, tb_fixed_pool_item_exit_func_t item_exit, tb_cpointer_t priv); /*! exit pool * - * @param pool the pool + * @param pool the pool */ -tb_void_t tb_fixed_pool_exit(tb_fixed_pool_ref_t pool); +tb_void_t tb_fixed_pool_exit(tb_fixed_pool_ref_t pool); /*! the item count * - * @param pool the pool + * @param pool the pool * - * @return the item count + * @return the item count */ -tb_size_t tb_fixed_pool_size(tb_fixed_pool_ref_t pool); +tb_size_t tb_fixed_pool_size(tb_fixed_pool_ref_t pool); /*! the item size * - * @param pool the pool + * @param pool the pool * - * @return the item size + * @return the item size */ -tb_size_t tb_fixed_pool_item_size(tb_fixed_pool_ref_t pool); +tb_size_t tb_fixed_pool_item_size(tb_fixed_pool_ref_t pool); /*! clear pool * - * @param pool the pool + * @param pool the pool */ -tb_void_t tb_fixed_pool_clear(tb_fixed_pool_ref_t pool); +tb_void_t tb_fixed_pool_clear(tb_fixed_pool_ref_t pool); /*! malloc data * - * @param pool the pool + * @param pool the pool * - * @return the data + * @return the data */ -tb_pointer_t tb_fixed_pool_malloc_(tb_fixed_pool_ref_t pool __tb_debug_decl__); +tb_pointer_t tb_fixed_pool_malloc_(tb_fixed_pool_ref_t pool __tb_debug_decl__); /*! malloc data and clear it * - * @param pool the pool + * @param pool the pool * - * @return the data + * @return the data */ -tb_pointer_t tb_fixed_pool_malloc0_(tb_fixed_pool_ref_t pool __tb_debug_decl__); +tb_pointer_t tb_fixed_pool_malloc0_(tb_fixed_pool_ref_t pool __tb_debug_decl__); /*! free data * - * @param pool the pool - * @param data the data + * @param pool the pool + * @param data the data * - * @return tb_true or tb_false + * @return tb_true or tb_false */ -tb_bool_t tb_fixed_pool_free_(tb_fixed_pool_ref_t pool, tb_pointer_t data __tb_debug_decl__); +tb_bool_t tb_fixed_pool_free_(tb_fixed_pool_ref_t pool, tb_pointer_t data __tb_debug_decl__); /*! walk item * @@ -213,18 +213,18 @@ tb_bool_t tb_fixed_pool_free_(tb_fixed_pool_ref_t pool, tb_pointer } * @endcode * - * @param pool the pool - * @param func the walk func - * @param priv the private data + * @param pool the pool + * @param func the walk func + * @param priv the private data */ -tb_void_t tb_fixed_pool_walk(tb_fixed_pool_ref_t pool, tb_fixed_pool_item_walk_func_t func, tb_cpointer_t priv); +tb_void_t tb_fixed_pool_walk(tb_fixed_pool_ref_t pool, tb_fixed_pool_item_walk_func_t func, tb_cpointer_t priv); #ifdef __tb_debug__ /*! dump pool * - * @param pool the pool + * @param pool the pool */ -tb_void_t tb_fixed_pool_dump(tb_fixed_pool_ref_t pool); +tb_void_t tb_fixed_pool_dump(tb_fixed_pool_ref_t pool); #endif /* ////////////////////////////////////////////////////////////////////////////////////// diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/large_allocator.h b/core/pkg/tbox.pkg/inc/tbox/memory/large_allocator.h new file mode 100644 index 000000000..f78e70eee --- /dev/null +++ b/core/pkg/tbox.pkg/inc/tbox/memory/large_allocator.h @@ -0,0 +1,71 @@ +/*!The Treasure Box Library + * + * TBox is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * TBox is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with TBox; + * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> + * + * Copyright (C) 2009 - 2015, ruki All rights reserved. + * + * @author ruki + * @file large_allocator.h + * @ingroup memory + * + */ +#ifndef TB_MEMORY_LARGE_ALLOCATOR_H +#define TB_MEMORY_LARGE_ALLOCATOR_H + +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "allocator.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_enter__ + +/* ////////////////////////////////////////////////////////////////////////////////////// + * interfaces + */ + +/*! init the large allocator + * + * <pre> + * + * ------------------------- ------------------------ + * | native memory | | data | + * ------------------------- ------------------------ + * | | + * ------------------------- ------------------------ + * | native large allocator | | static large allocator | + * ------------------------- ------------------------ + * | | + * ------------------------------------------------------ + * | large allocator | + * ------------------------------------------------------ + * + * </pre> + * + * @param data the data, uses the native memory if be null + * @param size the size + * + * @return the allocator + */ +tb_allocator_ref_t tb_large_allocator_init(tb_byte_t* data, tb_size_t size); + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_leave__ + +#endif diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/large_pool.h b/core/pkg/tbox.pkg/inc/tbox/memory/large_pool.h deleted file mode 100755 index 5cb79d18d..000000000 --- a/core/pkg/tbox.pkg/inc/tbox/memory/large_pool.h +++ /dev/null @@ -1,182 +0,0 @@ -/*!The Treasure Box Library - * - * TBox is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * TBox is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with TBox; - * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> - * - * Copyright (C) 2009 - 2015, ruki All rights reserved. - * - * @author ruki - * @file large_pool.h - * @ingroup memory - * - */ -#ifndef TB_MEMORY_LARGE_POOL_H -#define TB_MEMORY_LARGE_POOL_H - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "prefix.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_enter__ - -/* ////////////////////////////////////////////////////////////////////////////////////// - * macros - */ -#define tb_large_pool_malloc(pool, size, real) tb_large_pool_malloc_(pool, size, real __tb_debug_vals__) -#define tb_large_pool_malloc0(pool, size, real) tb_large_pool_malloc0_(pool, size, real __tb_debug_vals__) - -#define tb_large_pool_nalloc(pool, item, size, real) tb_large_pool_nalloc_(pool, item, size, real __tb_debug_vals__) -#define tb_large_pool_nalloc0(pool, item, size, real) tb_large_pool_nalloc0_(pool, item, size, real __tb_debug_vals__) - -#define tb_large_pool_ralloc(pool, data, size, real) tb_large_pool_ralloc_(pool, (tb_pointer_t)(data), size, real __tb_debug_vals__) -#define tb_large_pool_free(pool, data) tb_large_pool_free_(pool, (tb_pointer_t)(data) __tb_debug_vals__) - -/* ////////////////////////////////////////////////////////////////////////////////////// - * types - */ - -/*! the large pool ref type - * - * <pre> - * - * ------------------------- ---------------------- - * | native memory | | data | - * ------------------------- ---------------------- - * | | - * ------------------------- ---------------------- - * | native pool | | static pool | - * ------------------------- ---------------------- - * | | - * ----------------------------------------------------- - * | if (pool address & 1) | else | - * |-----------------------------------------------------| - * | large pool | - * ----------------------------------------------------- - * - * </pre> - * - */ -typedef struct{}* tb_large_pool_ref_t; - -/* ////////////////////////////////////////////////////////////////////////////////////// - * interfaces - */ - -/*! the large pool instance - * - * @return the pool - */ -tb_large_pool_ref_t tb_large_pool(tb_noarg_t); - -/*! init the large pool - * - * @param data the pool data, using the native memory if be null - * @param size the pool size - * - * @return the pool - */ -tb_large_pool_ref_t tb_large_pool_init(tb_byte_t* data, tb_size_t size); - -/*! exit the pool - * - * @param pool the pool - */ -tb_void_t tb_large_pool_exit(tb_large_pool_ref_t pool); - -/*! clear the pool - * - * @param pool the pool - */ -tb_void_t tb_large_pool_clear(tb_large_pool_ref_t pool); - -/*! malloc data - * - * @param pool the pool - * @param size the size - * @param real the real allocated size >= size, optional - * - * @return the data address - */ -tb_pointer_t tb_large_pool_malloc_(tb_large_pool_ref_t pool, tb_size_t size, tb_size_t* real __tb_debug_decl__); - -/*! malloc data and fill zero - * - * @param pool the pool - * @param size the size - * @param real the real allocated size >= size, optional - * - * @return the data address - */ -tb_pointer_t tb_large_pool_malloc0_(tb_large_pool_ref_t pool, tb_size_t size, tb_size_t* real __tb_debug_decl__); - -/*! malloc data with the item count - * - * @param pool the pool - * @param item the item count - * @param size the item size - * @param real the real allocated size >= item * size, optional - * - * @return the data address - */ -tb_pointer_t tb_large_pool_nalloc_(tb_large_pool_ref_t pool, tb_size_t item, tb_size_t size, tb_size_t* real __tb_debug_decl__); - -/*! malloc data with the item count and fill zero - * - * @param pool the pool - * @param item the item count - * @param size the item size - * @param real the real allocated size >= item * size, optional - * - * @return the data address - */ -tb_pointer_t tb_large_pool_nalloc0_(tb_large_pool_ref_t pool, tb_size_t item, tb_size_t size, tb_size_t* real __tb_debug_decl__); - -/*! realloc data - * - * @param pool the pool - * @param data the data address - * @param size the data size - * @param real the real allocated size >= size, optional - * - * @return the new data address - */ -tb_pointer_t tb_large_pool_ralloc_(tb_large_pool_ref_t pool, tb_pointer_t data, tb_size_t size, tb_size_t* real __tb_debug_decl__); - -/*! free data - * - * @param pool the pool - * @param data the data address - * - * @return tb_true or tb_false - */ -tb_bool_t tb_large_pool_free_(tb_large_pool_ref_t pool, tb_pointer_t data __tb_debug_decl__); - -#ifdef __tb_debug__ -/*! dump the pool - * - * @param pool the pool - */ -tb_void_t tb_large_pool_dump(tb_large_pool_ref_t pool); -#endif - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_leave__ - -#endif diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/memory.h b/core/pkg/tbox.pkg/inc/tbox/memory/memory.h index 9dbc7fc47..b80d00ba2 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/memory/memory.h +++ b/core/pkg/tbox.pkg/inc/tbox/memory/memory.h @@ -28,16 +28,17 @@ * includes */ #include "prefix.h" -#include "pool.h" #include "buffer.h" #include "allocator.h" #include "fixed_pool.h" -#include "large_pool.h" -#include "small_pool.h" -#include "static_pool.h" #include "string_pool.h" #include "queue_buffer.h" #include "static_buffer.h" +#include "large_allocator.h" +#include "small_allocator.h" +#include "native_allocator.h" +#include "static_allocator.h" +#include "default_allocator.h" /* ////////////////////////////////////////////////////////////////////////////////////// * extern @@ -52,18 +53,18 @@ __tb_extern_c_enter__ * * <pre> * - * ---------------- ------------------------------------------------------- ---------------------- - * | native memory | or | data | -> | static_pool | - * ---------------- ------------------------------------------------------- ---------------------- + * ---------------- ------------------------------------------------------- ---------------------- + * | native memory | or | data | <- | static allocator | + * ---------------- ------------------------------------------------------- ---------------------- * | if data be null | * `---------------------------------------> | * | * ----------------------------------------------------------------------------- ---------------------- ------ ------ - * | large pool[lock] | -> | fixed pool:NB | -> | slot | -> | slot | -> ... + * | large allocator | -> | fixed pool:NB | -> | slot | -> | slot | -> ... * ----------------------------------------------------------------------------- ---------------------- ------ ------ * | | * | --------------------------------------- ---------------------- ------ ------ - * | | small pool | -> | fixed pool:16B | -> | slot | -> | slot | -> ... + * | | small allocator | -> | fixed pool:16B | -> | slot | -> | slot | -> ... * | --------------------------------------- |----------------------| ------ ------ * | | | fixed pool:32B | -> ... * | | |----------------------| @@ -92,11 +93,7 @@ __tb_extern_c_enter__ * ------------------------------------------------------------------------------ * | >3KB | <=3KB | * |------------------------------------------------------------------------------| - * | pool[lock] | - * ------------------------------------------------------------------------------ - * | - * ------------------------------------------------------------------------------ - * | malloc, nalloc, strdup, free ... | + * | default allocator | * ------------------------------------------------------------------------------ * | * ---------------------- @@ -112,13 +109,11 @@ __tb_extern_c_enter__ /*! init memory * - * @param allocator the allocator, uses data and size if be null - * @param data the memory pool data - * @param size the memory pool size + * @param allocator the allocator * * @return tb_true or tb_false */ -tb_bool_t tb_memory_init(tb_allocator_ref_t allocator, tb_byte_t* data, tb_size_t size); +tb_bool_t tb_memory_init(tb_allocator_ref_t allocator); /// exit memory tb_void_t tb_memory_exit(tb_noarg_t); diff --git a/core/pkg/tbox.pkg/inc/tbox/zip/rlc.h b/core/pkg/tbox.pkg/inc/tbox/memory/native_allocator.h index adaec0ce6..3df6a16dd 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/zip/rlc.h +++ b/core/pkg/tbox.pkg/inc/tbox/memory/native_allocator.h @@ -17,17 +17,17 @@ * Copyright (C) 2009 - 2015, ruki All rights reserved. * * @author ruki - * @file rlc.h - * @ingroup zip + * @file native_allocator.h + * @ingroup memory * */ -#ifndef TB_ZIP_RLC_H -#define TB_ZIP_RLC_H +#ifndef TB_MEMORY_NATIVE_ALLOCATOR_H +#define TB_MEMORY_NATIVE_ALLOCATOR_H /* ////////////////////////////////////////////////////////////////////////////////////// * includes */ -#include "prefix.h" +#include "allocator.h" /* ////////////////////////////////////////////////////////////////////////////////////// * extern @@ -35,41 +35,14 @@ __tb_extern_c_enter__ /* ////////////////////////////////////////////////////////////////////////////////////// - * macros - */ - -// vlc -#define TB_ZIP_RLC_VLC_TYPE_FIXED (0) -#define TB_ZIP_RLC_VLC_TYPE_GAMMA (1) -#define TB_ZIP_RLC_VLC_TYPE_GOLOMB (0) - -/* ////////////////////////////////////////////////////////////////////////////////////// - * types - */ - -// the rlc zip type -typedef struct __tb_zip_rlc_t -{ - // the zip base - tb_zip_t base; - - // the reference to vlc - tb_zip_vlc_t* vlc; - - // the last byte - tb_byte_t last; - - // the repeat size - tb_size_t repeat; - -}tb_zip_rlc_t; - -/* ////////////////////////////////////////////////////////////////////////////////////// * interfaces */ -tb_zip_ref_t tb_zip_rlc_init(tb_size_t action); -tb_void_t tb_zip_rlc_exit(tb_zip_ref_t zip); +/*! the global native allocator + * + * @return the allocator + */ +tb_allocator_ref_t tb_native_allocator(tb_noarg_t); /* ////////////////////////////////////////////////////////////////////////////////////// * extern @@ -77,4 +50,3 @@ tb_void_t tb_zip_rlc_exit(tb_zip_ref_t zip); __tb_extern_c_leave__ #endif - diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/pool.h b/core/pkg/tbox.pkg/inc/tbox/memory/pool.h deleted file mode 100755 index e66fcd27d..000000000 --- a/core/pkg/tbox.pkg/inc/tbox/memory/pool.h +++ /dev/null @@ -1,240 +0,0 @@ -/*!The Treasure Box Library - * - * TBox is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * TBox is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with TBox; - * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> - * - * Copyright (C) 2009 - 2015, ruki All rights reserved. - * - * @author ruki - * @file pool.h - * @ingroup memory - * - */ -#ifndef TB_MEMORY_POOL_H -#define TB_MEMORY_POOL_H - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "prefix.h" -#include "allocator.h" -#include "large_pool.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_enter__ - -/* ////////////////////////////////////////////////////////////////////////////////////// - * macros - */ - -#define tb_pool_malloc(pool, size) tb_pool_malloc_(pool, size __tb_debug_vals__) -#define tb_pool_malloc0(pool, size) tb_pool_malloc0_(pool, size __tb_debug_vals__) - -#define tb_pool_nalloc(pool, item, size) tb_pool_nalloc_(pool, item, size __tb_debug_vals__) -#define tb_pool_nalloc0(pool, item, size) tb_pool_nalloc0_(pool, item, size __tb_debug_vals__) - -#define tb_pool_ralloc(pool, data, size) tb_pool_ralloc_(pool, (tb_pointer_t)(data), size __tb_debug_vals__) -#define tb_pool_free(pool, data) tb_pool_free_(pool, (tb_pointer_t)(data) __tb_debug_vals__) - -/* ////////////////////////////////////////////////////////////////////////////////////// - * types - */ - -/*! the pool - * - * <pre> - * - * ---------------- ------------------------------------------------------- - * | native memory | or | data | - * ---------------- ------------------------------------------------------- - * | if data be null | - * `---------------------------------------> | - * | - * ----------------------------------------------------------------------------- - * | large pool[lock] | - * ----------------------------------------------------------------------------- - * | | - * | --------------------------------------- - * | | small pool | - * | --------------------------------------- - * | | - * ----------------------------------------------------------------------------- - * | >3KB | <=3KB | - * |-----------------------------------------------------------------------------| - * | pool[lock] | - * ----------------------------------------------------------------------------- - * - * </pre> - */ - -/* ////////////////////////////////////////////////////////////////////////////////////// - * interfaces - */ - -/*! the pool instance - * - * @return the pool - */ -tb_pool_ref_t tb_pool(); - -/*! init the pool - * - * @param allocator the allocator, uses large pool if be null - * @param large_pool the large pool, uses the default large pool if be null - * - * @return the pool - */ -tb_pool_ref_t tb_pool_init(tb_allocator_ref_t allocator, tb_large_pool_ref_t large_pool); - -/*! exit the pool - * - * @param pool the pool - */ -tb_void_t tb_pool_exit(tb_pool_ref_t pool); - -/*! malloc data - * - * @param pool the pool - * @param size the size - * - * @return the data address - */ -tb_pointer_t tb_pool_malloc_(tb_pool_ref_t pool, tb_size_t size __tb_debug_decl__); - -/*! malloc data and fill zero - * - * @param pool the pool - * @param size the size - * - * @return the data address - */ -tb_pointer_t tb_pool_malloc0_(tb_pool_ref_t pool, tb_size_t size __tb_debug_decl__); - -/*! malloc data with the item count - * - * @param pool the pool - * @param item the item count - * @param size the item size - * - * @return the data address - */ -tb_pointer_t tb_pool_nalloc_(tb_pool_ref_t pool, tb_size_t item, tb_size_t size __tb_debug_decl__); - -/*! malloc data with the item count and fill zero - * - * @param pool the pool - * @param item the item count - * @param size the item size - * - * @return the data address - */ -tb_pointer_t tb_pool_nalloc0_(tb_pool_ref_t pool, tb_size_t item, tb_size_t size __tb_debug_decl__); - -/*! realloc data - * - * @param pool the pool - * @param data the data address - * @param size the data size - * - * @return the new data address - */ -tb_pointer_t tb_pool_ralloc_(tb_pool_ref_t pool, tb_pointer_t data, tb_size_t size __tb_debug_decl__); - -/*! free data - * - * @param pool the pool - * @param data the data address - * - * @return tb_true or tb_false - */ -tb_bool_t tb_pool_free_(tb_pool_ref_t pool, tb_pointer_t data __tb_debug_decl__); - -/*! align malloc data - * - * @param pool the pool - * @param size the size - * @param align the alignment bytes - * - * @return the data address - */ -tb_pointer_t tb_pool_align_malloc_(tb_pool_ref_t pool, tb_size_t size, tb_size_t align __tb_debug_decl__); - -/*! align malloc data and fill zero - * - * @param pool the pool - * @param size the size - * @param align the alignment bytes - * - * @return the data address - */ -tb_pointer_t tb_pool_align_malloc0_(tb_pool_ref_t pool, tb_size_t size, tb_size_t align __tb_debug_decl__); - -/*! align malloc data with the item count - * - * @param pool the pool - * @param item the item count - * @param size the item size - * @param align the alignment bytes - * - * @return the data address - */ -tb_pointer_t tb_pool_align_nalloc_(tb_pool_ref_t pool, tb_size_t item, tb_size_t size, tb_size_t align __tb_debug_decl__); - -/*! align malloc data with the item count and fill zero - * - * @param pool the pool - * @param item the item count - * @param size the item size - * @param align the alignment bytes - * - * @return the data address - */ -tb_pointer_t tb_pool_align_nalloc0_(tb_pool_ref_t pool, tb_size_t item, tb_size_t size, tb_size_t align __tb_debug_decl__); - -/*! align realloc data - * - * @param pool the pool - * @param data the data address - * @param size the data size - * - * @return the new data address - */ -tb_pointer_t tb_pool_align_ralloc_(tb_pool_ref_t pool, tb_pointer_t data, tb_size_t size, tb_size_t align __tb_debug_decl__); - -/*! align free data - * - * @param pool the pool - * @param data the data address - * - * @return tb_true or tb_false - */ -tb_bool_t tb_pool_align_free_(tb_pool_ref_t pool, tb_pointer_t data __tb_debug_decl__); - -#ifdef __tb_debug__ -/*! dump the pool - * - * @param pool the pool - * @param prefix the trace prefix - */ -tb_void_t tb_pool_dump(tb_pool_ref_t pool); -#endif - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_leave__ - -#endif diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/prefix.h b/core/pkg/tbox.pkg/inc/tbox/memory/prefix.h index 120511a2a..120511a2a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/memory/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/memory/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/queue_buffer.h b/core/pkg/tbox.pkg/inc/tbox/memory/queue_buffer.h index cb4c18d4f..cb4c18d4f 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/memory/queue_buffer.h +++ b/core/pkg/tbox.pkg/inc/tbox/memory/queue_buffer.h diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/small_allocator.h b/core/pkg/tbox.pkg/inc/tbox/memory/small_allocator.h new file mode 100644 index 000000000..78100ad28 --- /dev/null +++ b/core/pkg/tbox.pkg/inc/tbox/memory/small_allocator.h @@ -0,0 +1,91 @@ +/*!The Treasure Box Library + * + * TBox is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * TBox is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with TBox; + * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> + * + * Copyright (C) 2009 - 2015, ruki All rights reserved. + * + * @author ruki + * @file small_allocator.h + * @ingroup memory + * + */ +#ifndef TB_MEMORY_SMALL_ALLOCATOR_H +#define TB_MEMORY_SMALL_ALLOCATOR_H + +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "large_allocator.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_enter__ + +/* ////////////////////////////////////////////////////////////////////////////////////// + * macros + */ + +/// the data size maximum +#define TB_SMALL_ALLOCATOR_DATA_MAXN (3072) + +/* ////////////////////////////////////////////////////////////////////////////////////// + * interfaces + */ + +/*! init the small allocator only for size <=3KB + * + * <pre> + * + * -------------------------------------- + * | fixed pool: 16B | 1-16B | + * |--------------------------------------| + * | fixed pool: 32B | 17-32B | + * |--------------------------------------| + * | fixed pool: 64B | 33-64B | + * |--------------------------------------| + * | fixed pool: 96B* | 65-96B* | + * |--------------------------------------| + * | fixed pool: 128B | 97-128B | + * |--------------------------------------| + * | fixed pool: 192B* | 129-192B* | + * |--------------------------------------| + * | fixed pool: 256B | 193-256B | + * |--------------------------------------| + * | fixed pool: 384B* | 257-384B* | + * |--------------------------------------| + * | fixed pool: 512B | 385-512B | + * |--------------------------------------| + * | fixed pool: 1024B | 513-1024B | + * |--------------------------------------| + * | fixed pool: 2048B | 1025-2048B | + * |--------------------------------------| + * | fixed pool: 3072B* | 2049-3072B* | + * -------------------------------------- + * + * </pre> + * + * @param large_allocator the large allocator, uses the global allocator if be null + * + * @return the pool + */ +tb_allocator_ref_t tb_small_allocator_init(tb_allocator_ref_t large_allocator); + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_leave__ + +#endif diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/small_pool.h b/core/pkg/tbox.pkg/inc/tbox/memory/small_pool.h deleted file mode 100755 index 7736adf39..000000000 --- a/core/pkg/tbox.pkg/inc/tbox/memory/small_pool.h +++ /dev/null @@ -1,186 +0,0 @@ -/*!The Treasure Box Library - * - * TBox is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * TBox is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with TBox; - * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> - * - * Copyright (C) 2009 - 2015, ruki All rights reserved. - * - * @author ruki - * @file small_pool.h - * @ingroup memory - * - */ -#ifndef TB_MEMORY_SMALL_POOL_H -#define TB_MEMORY_SMALL_POOL_H - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "large_pool.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_enter__ - -/* ////////////////////////////////////////////////////////////////////////////////////// - * macros - */ - -// the data size maximum -#define TB_SMALL_POOL_DATA_SIZE_MAXN (3072) - -#define tb_small_pool_malloc(pool, size) tb_small_pool_malloc_(pool, size __tb_debug_vals__) -#define tb_small_pool_malloc0(pool, size) tb_small_pool_malloc0_(pool, size __tb_debug_vals__) - -#define tb_small_pool_nalloc(pool, item, size) tb_small_pool_nalloc_(pool, item, size __tb_debug_vals__) -#define tb_small_pool_nalloc0(pool, item, size) tb_small_pool_nalloc0_(pool, item, size __tb_debug_vals__) - -#define tb_small_pool_ralloc(pool, data, size) tb_small_pool_ralloc_(pool, (tb_pointer_t)(data), size __tb_debug_vals__) -#define tb_small_pool_free(pool, data) tb_small_pool_free_(pool, (tb_pointer_t)(data) __tb_debug_vals__) - -/* ////////////////////////////////////////////////////////////////////////////////////// - * types - */ - -/*! the small pool ref type - * - * <pre> - * - * -------------------------------------- - * | fixed pool: 16B | 1-16B | - * |--------------------------------------| - * | fixed pool: 32B | 17-32B | - * |--------------------------------------| - * | fixed pool: 64B | 33-64B | - * |--------------------------------------| - * | fixed pool: 96B* | 65-96B* | - * |--------------------------------------| - * | fixed pool: 128B | 97-128B | - * |--------------------------------------| - * | fixed pool: 192B* | 129-192B* | - * |--------------------------------------| - * | fixed pool: 256B | 193-256B | - * |--------------------------------------| - * | fixed pool: 384B* | 257-384B* | - * |--------------------------------------| - * | fixed pool: 512B | 385-512B | - * |--------------------------------------| - * | fixed pool: 1024B | 513-1024B | - * |--------------------------------------| - * | fixed pool: 2048B | 1025-2048B | - * |--------------------------------------| - * | fixed pool: 3072B* | 2049-3072B* | - * -------------------------------------- - * - * </pre> - */ -typedef struct{}* tb_small_pool_ref_t; - -/* ////////////////////////////////////////////////////////////////////////////////////// - * interfaces - */ - -/*! init the small pool only for size <=3KB - * - * @param large_pool the large pool, using the default large pool if be null - * - * @return the pool - */ -tb_small_pool_ref_t tb_small_pool_init(tb_large_pool_ref_t large_pool); - -/*! exit the pool - * - * @param pool the pool - */ -tb_void_t tb_small_pool_exit(tb_small_pool_ref_t pool); - -/*! clear the pool - * - * @param pool the pool - */ -tb_void_t tb_small_pool_clear(tb_small_pool_ref_t pool); - -/*! malloc data - * - * @param pool the pool - * @param size the size - * - * @return the data address - */ -tb_pointer_t tb_small_pool_malloc_(tb_small_pool_ref_t pool, tb_size_t size __tb_debug_decl__); - -/*! malloc data and fill zero - * - * @param pool the pool - * @param size the size - * - * @return the data address - */ -tb_pointer_t tb_small_pool_malloc0_(tb_small_pool_ref_t pool, tb_size_t size __tb_debug_decl__); - -/*! malloc data with the item count - * - * @param pool the pool - * @param item the item count - * @param size the item size - * - * @return the data address - */ -tb_pointer_t tb_small_pool_nalloc_(tb_small_pool_ref_t pool, tb_size_t item, tb_size_t size __tb_debug_decl__); - -/*! malloc data with the item count and fill zero - * - * @param pool the pool - * @param item the item count - * @param size the item size - * - * @return the data address - */ -tb_pointer_t tb_small_pool_nalloc0_(tb_small_pool_ref_t pool, tb_size_t item, tb_size_t size __tb_debug_decl__); - -/*! realloc data - * - * @param pool the pool - * @param data the data address - * @param size the data size - * - * @return the new data address - */ -tb_pointer_t tb_small_pool_ralloc_(tb_small_pool_ref_t pool, tb_pointer_t data, tb_size_t size __tb_debug_decl__); - -/*! free data - * - * @param pool the pool - * @param data the data address - * - * @return tb_true or tb_false - */ -tb_bool_t tb_small_pool_free_(tb_small_pool_ref_t pool, tb_pointer_t data __tb_debug_decl__); - -#ifdef __tb_debug__ -/*! dump the pool - * - * @param pool the pool - * @param prefix the trace prefix - */ -tb_void_t tb_small_pool_dump(tb_small_pool_ref_t pool); -#endif - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_leave__ - -#endif diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/static_allocator.h b/core/pkg/tbox.pkg/inc/tbox/memory/static_allocator.h new file mode 100644 index 000000000..19334dfb9 --- /dev/null +++ b/core/pkg/tbox.pkg/inc/tbox/memory/static_allocator.h @@ -0,0 +1,85 @@ +/*!The Treasure Box Library + * + * TBox is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * TBox is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with TBox; + * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> + * + * Copyright (C) 2009 - 2015, ruki All rights reserved. + * + * @author ruki + * @file static_allocator.h + * @ingroup memory + * + */ +#ifndef TB_MEMORY_STATIC_ALLOCATOR_H +#define TB_MEMORY_STATIC_ALLOCATOR_H + +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "allocator.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_enter__ + +/* ////////////////////////////////////////////////////////////////////////////////////// + * interfaces + */ + +/*! the global static allocator + * + * @note + * this allocator may be called before tb_init() + * + * @param data the allocator data + * @param size the allocator size + * + * @return the allocator + */ +tb_allocator_ref_t tb_static_allocator(tb_byte_t* data, tb_size_t size); + +/*! init the static allocator + * + * <pre> + * + * ----------------------------------------------------- + * | data | + * ----------------------------------------------------- + * | + * ----------------------------------------------------- + * | static allocator | + * ----------------------------------------------------- + * + * </pre> + * + * @param data the allocator data + * @param size the allocator size + * + * @return the allocator + */ +tb_allocator_ref_t tb_static_allocator_init(tb_byte_t* data, tb_size_t size); + +/*! exit the allocator + * + * @param allocator the allocator + */ +tb_void_t tb_static_allocator_exit(tb_allocator_ref_t allocator); + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_leave__ + +#endif diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/static_buffer.h b/core/pkg/tbox.pkg/inc/tbox/memory/static_buffer.h index daaa065fd..daaa065fd 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/memory/static_buffer.h +++ b/core/pkg/tbox.pkg/inc/tbox/memory/static_buffer.h diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/static_pool.h b/core/pkg/tbox.pkg/inc/tbox/memory/static_pool.h deleted file mode 100755 index d14945c6b..000000000 --- a/core/pkg/tbox.pkg/inc/tbox/memory/static_pool.h +++ /dev/null @@ -1,166 +0,0 @@ -/*!The Treasure Box Library - * - * TBox is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * TBox is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with TBox; - * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> - * - * Copyright (C) 2009 - 2015, ruki All rights reserved. - * - * @author ruki - * @file static_pool.h - * @ingroup memory - * - */ -#ifndef TB_MEMORY_STATIC_POOL_H -#define TB_MEMORY_STATIC_POOL_H - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "prefix.h" -#include "large_pool.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_enter__ - -/* ////////////////////////////////////////////////////////////////////////////////////// - * macros - */ -#define tb_static_pool_malloc(pool, size) tb_static_pool_malloc_(pool, size __tb_debug_vals__) -#define tb_static_pool_malloc0(pool, size) tb_static_pool_malloc0_(pool, size __tb_debug_vals__) - -#define tb_static_pool_nalloc(pool, item, size) tb_static_pool_nalloc_(pool, item, size __tb_debug_vals__) -#define tb_static_pool_nalloc0(pool, item, size) tb_static_pool_nalloc0_(pool, item, size __tb_debug_vals__) - -#define tb_static_pool_ralloc(pool, data, size) tb_static_pool_ralloc_(pool, (tb_pointer_t)(data), size __tb_debug_vals__) -#define tb_static_pool_free(pool, data) tb_static_pool_free_(pool, (tb_pointer_t)(data) __tb_debug_vals__) - -/* ////////////////////////////////////////////////////////////////////////////////////// - * types - */ - -/*! the static pool ref type - * - * <pre> - * - * ----------------------------------------------------- - * | data | - * ----------------------------------------------------- - * | - * ----------------------------------------------------- - * | static pool | - * ----------------------------------------------------- - * - * </pre> - * - */ -typedef struct{}* tb_static_pool_ref_t; - -/* ////////////////////////////////////////////////////////////////////////////////////// - * interfaces - */ - -/*! init the static pool - * - * @param data the pool data - * @param size the pool size - * - * @return the pool - */ -tb_static_pool_ref_t tb_static_pool_init(tb_byte_t* data, tb_size_t size); - -/*! exit the pool - * - * @param pool the pool - */ -tb_void_t tb_static_pool_exit(tb_static_pool_ref_t pool); - -/*! clear the pool - * - * @param pool the pool - */ -tb_void_t tb_static_pool_clear(tb_static_pool_ref_t pool); - -/*! malloc data - * - * @param pool the pool - * @param size the size - * - * @return the data address - */ -tb_pointer_t tb_static_pool_malloc_(tb_static_pool_ref_t pool, tb_size_t size __tb_debug_decl__); - -/*! malloc data and fill zero - * - * @param pool the pool - * @param size the size - * - * @return the data address - */ -tb_pointer_t tb_static_pool_malloc0_(tb_static_pool_ref_t pool, tb_size_t size __tb_debug_decl__); - -/*! malloc data with the item count - * - * @param pool the pool - * @param item the item count - * @param size the item size - * - * @return the data address - */ -tb_pointer_t tb_static_pool_nalloc_(tb_static_pool_ref_t pool, tb_size_t item, tb_size_t size __tb_debug_decl__); - -/*! malloc data with the item count and fill zero - * - * @param pool the pool - * @param item the item count - * @param size the item size - * - * @return the data address - */ -tb_pointer_t tb_static_pool_nalloc0_(tb_static_pool_ref_t pool, tb_size_t item, tb_size_t size __tb_debug_decl__); - -/*! realloc data - * - * @param pool the pool - * @param data the data address - * @param size the data size - * - * @return the new data address - */ -tb_pointer_t tb_static_pool_ralloc_(tb_static_pool_ref_t pool, tb_pointer_t data, tb_size_t size __tb_debug_decl__); - -/*! free data - * - * @param pool the pool - * @param data the data address - * - * @return tb_true or tb_false - */ -tb_bool_t tb_static_pool_free_(tb_static_pool_ref_t pool, tb_pointer_t data __tb_debug_decl__); - -#ifdef __tb_debug__ -/*! dump the pool - * - * @param pool the pool - */ -tb_void_t tb_static_pool_dump(tb_static_pool_ref_t pool); -#endif - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_leave__ - -#endif diff --git a/core/pkg/tbox.pkg/inc/tbox/memory/string_pool.h b/core/pkg/tbox.pkg/inc/tbox/memory/string_pool.h index a1c068a92..a1c068a92 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/memory/string_pool.h +++ b/core/pkg/tbox.pkg/inc/tbox/memory/string_pool.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/cookies.h b/core/pkg/tbox.pkg/inc/tbox/network/cookies.h index 5d6438fe9..5d6438fe9 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/cookies.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/cookies.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/dns/cache.h b/core/pkg/tbox.pkg/inc/tbox/network/dns/cache.h index b4bcdd662..b4bcdd662 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/dns/cache.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/dns/cache.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/dns/dns.h b/core/pkg/tbox.pkg/inc/tbox/network/dns/dns.h index d4553323f..d4553323f 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/dns/dns.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/dns/dns.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/dns/looker.h b/core/pkg/tbox.pkg/inc/tbox/network/dns/looker.h index b400e8108..b400e8108 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/dns/looker.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/dns/looker.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/dns/prefix.h b/core/pkg/tbox.pkg/inc/tbox/network/dns/prefix.h index ba0e8ccbe..ba0e8ccbe 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/dns/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/dns/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/dns/server.h b/core/pkg/tbox.pkg/inc/tbox/network/dns/server.h index 7a574a28c..7a574a28c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/dns/server.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/dns/server.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/http.h b/core/pkg/tbox.pkg/inc/tbox/network/http.h index 6ff4cb986..6ff4cb986 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/http.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/http.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/hwaddr.h b/core/pkg/tbox.pkg/inc/tbox/network/hwaddr.h index f3168cf24..f3168cf24 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/hwaddr.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/hwaddr.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/ipaddr.h b/core/pkg/tbox.pkg/inc/tbox/network/ipaddr.h index d24f7400d..d24f7400d 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/ipaddr.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/ipaddr.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/ipv4.h b/core/pkg/tbox.pkg/inc/tbox/network/ipv4.h index 5d6639c9d..5d6639c9d 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/ipv4.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/ipv4.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/ipv6.h b/core/pkg/tbox.pkg/inc/tbox/network/ipv6.h index b9b4b99d5..b9b4b99d5 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/ipv6.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/ipv6.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/network.h b/core/pkg/tbox.pkg/inc/tbox/network/network.h index 31e6b74c0..31e6b74c0 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/network.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/network.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/prefix.h b/core/pkg/tbox.pkg/inc/tbox/network/prefix.h index f84388c05..f84388c05 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/ssl.h b/core/pkg/tbox.pkg/inc/tbox/network/ssl.h index 160bec37d..160bec37d 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/ssl.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/ssl.h diff --git a/core/pkg/tbox.pkg/inc/tbox/network/url.h b/core/pkg/tbox.pkg/inc/tbox/network/url.h index b82094ec8..b82094ec8 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/network/url.h +++ b/core/pkg/tbox.pkg/inc/tbox/network/url.h diff --git a/core/pkg/tbox.pkg/inc/tbox/object/array.h b/core/pkg/tbox.pkg/inc/tbox/object/array.h index 7e860acbd..7e860acbd 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/object/array.h +++ b/core/pkg/tbox.pkg/inc/tbox/object/array.h diff --git a/core/pkg/tbox.pkg/inc/tbox/object/boolean.h b/core/pkg/tbox.pkg/inc/tbox/object/boolean.h index 5ad12edb6..5ad12edb6 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/object/boolean.h +++ b/core/pkg/tbox.pkg/inc/tbox/object/boolean.h diff --git a/core/pkg/tbox.pkg/inc/tbox/object/data.h b/core/pkg/tbox.pkg/inc/tbox/object/data.h index 893f1568b..893f1568b 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/object/data.h +++ b/core/pkg/tbox.pkg/inc/tbox/object/data.h diff --git a/core/pkg/tbox.pkg/inc/tbox/object/date.h b/core/pkg/tbox.pkg/inc/tbox/object/date.h index 289951c85..289951c85 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/object/date.h +++ b/core/pkg/tbox.pkg/inc/tbox/object/date.h diff --git a/core/pkg/tbox.pkg/inc/tbox/object/dictionary.h b/core/pkg/tbox.pkg/inc/tbox/object/dictionary.h index fac229aa9..fac229aa9 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/object/dictionary.h +++ b/core/pkg/tbox.pkg/inc/tbox/object/dictionary.h diff --git a/core/pkg/tbox.pkg/inc/tbox/object/null.h b/core/pkg/tbox.pkg/inc/tbox/object/null.h index f1e20b427..f1e20b427 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/object/null.h +++ b/core/pkg/tbox.pkg/inc/tbox/object/null.h diff --git a/core/pkg/tbox.pkg/inc/tbox/object/number.h b/core/pkg/tbox.pkg/inc/tbox/object/number.h index 830afc660..830afc660 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/object/number.h +++ b/core/pkg/tbox.pkg/inc/tbox/object/number.h diff --git a/core/pkg/tbox.pkg/inc/tbox/object/object.h b/core/pkg/tbox.pkg/inc/tbox/object/object.h index f3853df22..f3853df22 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/object/object.h +++ b/core/pkg/tbox.pkg/inc/tbox/object/object.h diff --git a/core/pkg/tbox.pkg/inc/tbox/object/prefix.h b/core/pkg/tbox.pkg/inc/tbox/object/prefix.h index 0179b06ce..0179b06ce 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/object/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/object/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/object/string.h b/core/pkg/tbox.pkg/inc/tbox/object/string.h index a3721b777..a3721b777 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/object/string.h +++ b/core/pkg/tbox.pkg/inc/tbox/object/string.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/android/android.h b/core/pkg/tbox.pkg/inc/tbox/platform/android/android.h index 3868f34e5..3868f34e5 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/android/android.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/android/android.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/android/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/android/prefix.h index 65be2ee39..65be2ee39 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/android/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/android/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/atomic.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/atomic.h index 131cd2ed3..131cd2ed3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/atomic.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/atomic.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/frame.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/frame.h index 4e0b57417..4e0b57417 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/frame.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/frame.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/prefix.h index 6e4b9b805..6e4b9b805 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/arm/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/atomic.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/atomic.h index ea9bc45d8..ea9bc45d8 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/atomic.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/atomic.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/barrier.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/barrier.h index 5c4542140..5c4542140 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/barrier.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/barrier.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/frame.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/frame.h index 9d029823a..9d029823a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/frame.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/frame.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/prefix.h index ead1d4e22..ead1d4e22 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/atomic.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/atomic.h index 8ff26d126..8ff26d126 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/atomic.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/atomic.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/barrier.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/barrier.h index 08fdb7c11..08fdb7c11 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/barrier.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/barrier.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/frame.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/frame.h index 512b06e00..512b06e00 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/frame.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/frame.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/prefix.h index c2d356bde..c2d356bde 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x64/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/atomic.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/atomic.h index b708e5d03..b708e5d03 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/atomic.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/atomic.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/barrier.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/barrier.h index e88531d88..e88531d88 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/barrier.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/barrier.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/frame.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/frame.h index bdbbcd715..bdbbcd715 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/frame.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/frame.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/prefix.h index ca366b4b1..ca366b4b1 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/arch/x86/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/atomic.h b/core/pkg/tbox.pkg/inc/tbox/platform/atomic.h index 0075668f9..0075668f9 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/atomic.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/atomic.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/atomic64.h b/core/pkg/tbox.pkg/inc/tbox/platform/atomic64.h index c7e88121d..c7e88121d 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/atomic64.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/atomic64.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/backtrace.h b/core/pkg/tbox.pkg/inc/tbox/platform/backtrace.h index 733a75dbd..733a75dbd 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/backtrace.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/backtrace.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/barrier.h b/core/pkg/tbox.pkg/inc/tbox/platform/barrier.h index 5054febfe..5054febfe 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/barrier.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/barrier.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/cache_time.h b/core/pkg/tbox.pkg/inc/tbox/platform/cache_time.h index 1979c7817..1979c7817 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/cache_time.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/cache_time.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/atomic.h b/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/atomic.h index 66eba4d6d..66eba4d6d 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/atomic.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/atomic.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/atomic64.h b/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/atomic64.h index e4bc06098..e4bc06098 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/atomic64.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/atomic64.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/barrier.h b/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/barrier.h index 06ac42942..06ac42942 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/barrier.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/barrier.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/prefix.h index 2900ee549..2900ee549 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/compiler/gcc/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/compiler/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/compiler/prefix.h index c41e8c01d..c41e8c01d 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/compiler/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/compiler/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/directory.h b/core/pkg/tbox.pkg/inc/tbox/platform/directory.h index 23df0b329..23df0b329 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/directory.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/directory.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/dns.h b/core/pkg/tbox.pkg/inc/tbox/platform/dns.h index 8fa360c63..8fa360c63 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/dns.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/dns.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/dynamic.h b/core/pkg/tbox.pkg/inc/tbox/platform/dynamic.h index 420772d19..420772d19 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/dynamic.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/dynamic.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/environment.h b/core/pkg/tbox.pkg/inc/tbox/platform/environment.h index 238e368af..238e368af 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/environment.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/environment.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/event.h b/core/pkg/tbox.pkg/inc/tbox/platform/event.h index 48b05e008..48b05e008 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/event.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/event.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/exception.h b/core/pkg/tbox.pkg/inc/tbox/platform/exception.h index 080fb7e21..080fb7e21 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/exception.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/exception.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/file.h b/core/pkg/tbox.pkg/inc/tbox/platform/file.h index 0590e47a2..0590e47a2 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/file.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/file.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/hostname.h b/core/pkg/tbox.pkg/inc/tbox/platform/hostname.h index f6eb57090..f6eb57090 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/hostname.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/hostname.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/ifaddrs.h b/core/pkg/tbox.pkg/inc/tbox/platform/ifaddrs.h index b24acf3b8..b24acf3b8 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/ifaddrs.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/ifaddrs.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/libc/exception.h b/core/pkg/tbox.pkg/inc/tbox/platform/libc/exception.h index a8ffbc1b7..a8ffbc1b7 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/libc/exception.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/libc/exception.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/libc/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/libc/prefix.h index 0b9dab421..0b9dab421 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/libc/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/libc/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/linux/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/linux/prefix.h index e131be8ad..e131be8ad 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/linux/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/linux/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/ltimer.h b/core/pkg/tbox.pkg/inc/tbox/platform/ltimer.h index 523cd2c0a..523cd2c0a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/ltimer.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/ltimer.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/mach/barrier.h b/core/pkg/tbox.pkg/inc/tbox/platform/mach/barrier.h index 3a54f5ef5..3a54f5ef5 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/mach/barrier.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/mach/barrier.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/mach/ios/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/mach/ios/prefix.h index d8bdbc6d3..d8bdbc6d3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/mach/ios/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/mach/ios/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/mach/mac/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/mach/mac/prefix.h index f4e014c91..f4e014c91 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/mach/mac/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/mach/mac/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/mach/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/mach/prefix.h index e306ad0da..e306ad0da 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/mach/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/mach/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/memory.h b/core/pkg/tbox.pkg/inc/tbox/platform/memory.h index be46941a8..0cb294d35 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/memory.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/memory.h @@ -40,6 +40,9 @@ __tb_extern_c_enter__ /*! init native memory * + * @note + * need support to be called repeatly + * * @return tb_true or tb_false */ tb_bool_t tb_native_memory_init(tb_noarg_t); diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/mutex.h b/core/pkg/tbox.pkg/inc/tbox/platform/mutex.h index 2600463f7..2600463f7 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/mutex.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/mutex.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/page.h b/core/pkg/tbox.pkg/inc/tbox/platform/page.h index ecdb61458..c3c9ca9c0 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/page.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/page.h @@ -40,7 +40,10 @@ __tb_extern_c_enter__ /*! init page * - * @return the page size + * @note + * need support to be called repeatly + * + * @return tb_true or tb_false */ tb_bool_t tb_page_init(tb_noarg_t); diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/path.h b/core/pkg/tbox.pkg/inc/tbox/platform/path.h index c08eb4f6c..c08eb4f6c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/path.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/path.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/platform.h b/core/pkg/tbox.pkg/inc/tbox/platform/platform.h index 7233c2272..7233c2272 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/platform.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/platform.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/posix/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/posix/prefix.h index cf88c8e85..cf88c8e85 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/posix/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/posix/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/posix/sockaddr.h b/core/pkg/tbox.pkg/inc/tbox/platform/posix/sockaddr.h index 1b18bfaf8..1b18bfaf8 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/posix/sockaddr.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/posix/sockaddr.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/prefix.h index 0795b9f37..0795b9f37 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/print.h b/core/pkg/tbox.pkg/inc/tbox/platform/print.h index a7b00e490..a7b00e490 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/print.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/print.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/process.h b/core/pkg/tbox.pkg/inc/tbox/platform/process.h index 1bc0d09c7..1bc0d09c7 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/process.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/process.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/processor.h b/core/pkg/tbox.pkg/inc/tbox/platform/processor.h index 16ca7360c..16ca7360c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/processor.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/processor.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/sched.h b/core/pkg/tbox.pkg/inc/tbox/platform/sched.h index 09ca92f27..09ca92f27 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/sched.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/sched.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/semaphore.h b/core/pkg/tbox.pkg/inc/tbox/platform/semaphore.h index 1eb800ce8..1eb800ce8 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/semaphore.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/semaphore.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/socket.h b/core/pkg/tbox.pkg/inc/tbox/platform/socket.h index 2f05ca48e..2f05ca48e 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/socket.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/socket.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/spinlock.h b/core/pkg/tbox.pkg/inc/tbox/platform/spinlock.h index 583943c26..583943c26 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/spinlock.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/spinlock.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/systemv/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/systemv/prefix.h index 64c917a0f..64c917a0f 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/systemv/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/systemv/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/thread.h b/core/pkg/tbox.pkg/inc/tbox/platform/thread.h index e1de62e96..e1de62e96 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/thread.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/thread.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/thread_pool.h b/core/pkg/tbox.pkg/inc/tbox/platform/thread_pool.h index 2f8df50dc..2f8df50dc 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/thread_pool.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/thread_pool.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/thread_store.h b/core/pkg/tbox.pkg/inc/tbox/platform/thread_store.h index 150799caa..ea15fe37e 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/thread_store.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/thread_store.h @@ -56,7 +56,7 @@ typedef struct __tb_thread_store_data_t // the free func tb_void_t (*free)(struct __tb_thread_store_data_t* data); -}tb_thread_store_data_t; +}tb_thread_store_data_t, *tb_thread_store_data_ref_t; /* ////////////////////////////////////////////////////////////////////////////////////// * interfaces @@ -64,24 +64,24 @@ typedef struct __tb_thread_store_data_t /*! init thread store for thread store * - * @return tb_true or tb_false + * @return tb_true or tb_false */ -tb_bool_t tb_thread_store_init(tb_noarg_t); +tb_bool_t tb_thread_store_init(tb_noarg_t); /// exit thread store -tb_void_t tb_thread_store_exit(tb_noarg_t); +tb_void_t tb_thread_store_exit(tb_noarg_t); /*! set thread store data * - * @param data the thread store data + * @param data the thread store data */ -tb_void_t tb_thread_store_setp(tb_thread_store_data_t const* data); +tb_void_t tb_thread_store_setp(tb_thread_store_data_t const* data); /*! get thread store data * - * @return the thread store data + * @return the thread store data */ -tb_thread_store_data_t* tb_thread_store_getp(tb_noarg_t); +tb_thread_store_data_ref_t tb_thread_store_getp(tb_noarg_t); /* ////////////////////////////////////////////////////////////////////////////////////// * extern diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/time.h b/core/pkg/tbox.pkg/inc/tbox/platform/time.h index bc9009c70..bc9009c70 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/time.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/time.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/timer.h b/core/pkg/tbox.pkg/inc/tbox/platform/timer.h index 9e18ecd57..9e18ecd57 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/timer.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/timer.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/unix/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/unix/prefix.h index c5735c89c..c5735c89c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/unix/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/unix/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/unix/syscall.h b/core/pkg/tbox.pkg/inc/tbox/platform/unix/syscall.h index ffa028f34..ffa028f34 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/unix/syscall.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/unix/syscall.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/atomic.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/atomic.h index 6d11e832a..6d11e832a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/atomic.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/atomic.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/atomic64.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/atomic64.h index 3cf651b98..3cf651b98 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/atomic64.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/atomic64.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/barrier.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/barrier.h index 61e27d51c..61e27d51c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/barrier.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/barrier.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/exception.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/exception.h index 132d38d17..132d38d17 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/exception.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/exception.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/dbghelp.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/dbghelp.h index 582082055..582082055 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/dbghelp.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/dbghelp.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/interface.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/interface.h index 24e843258..24e843258 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/interface.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/interface.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/iphlpapi.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/iphlpapi.h index 677690f66..677690f66 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/iphlpapi.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/iphlpapi.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/kernel32.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/kernel32.h index aafd97c91..aafd97c91 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/kernel32.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/kernel32.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/mswsock.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/mswsock.h index b791d5c07..b791d5c07 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/mswsock.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/mswsock.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/prefix.h index c65ec26ab..c65ec26ab 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/shell32.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/shell32.h index 54f3d38ca..54f3d38ca 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/shell32.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/shell32.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/user32.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/user32.h index a1875436c..a1875436c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/user32.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/user32.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/ws2_32.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/ws2_32.h index d53b99cfb..d53b99cfb 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/ws2_32.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/interface/ws2_32.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/ntstatus.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/ntstatus.h index c57efe865..c57efe865 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/ntstatus.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/ntstatus.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/prefix.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/prefix.h index d14a6fea8..d14a6fea8 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/windows/socket_pool.h b/core/pkg/tbox.pkg/inc/tbox/platform/windows/socket_pool.h index ff8fde64a..ff8fde64a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/platform/windows/socket_pool.h +++ b/core/pkg/tbox.pkg/inc/tbox/platform/windows/socket_pool.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix.h b/core/pkg/tbox.pkg/inc/tbox/prefix.h index c72e3af69..c72e3af69 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/abort.h b/core/pkg/tbox.pkg/inc/tbox/prefix/abort.h index a882013f9..a882013f9 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/abort.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/abort.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/arch.h b/core/pkg/tbox.pkg/inc/tbox/prefix/arch.h index 8364dceb6..6bebf5f90 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/arch.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/arch.h @@ -75,7 +75,7 @@ # else # define TB_ARCH_STRING "x64" # endif -#elif defined(__arm__) || defined(__arm64) || defined(__arm64__) +#elif defined(__arm__) || defined(__arm64) || defined(__arm64__) || (defined(__aarch64__) && __aarch64__) # define TB_ARCH_ARM # if defined(__ARM64_ARCH_8__) # define TB_ARCH_ARM64 @@ -122,6 +122,10 @@ # define TB_ARCH_ARM_v5 # define TB_ARCH_STRING "armv5" # endif +# elif defined(__aarch64__) && __aarch64__ +# define TB_ARCH_ARM_v8 +# define TB_ARCH_ARM64 +# define TB_ARCH_STRING "arm64-v8a" # else # error unknown arm arch version # endif diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/asm.h b/core/pkg/tbox.pkg/inc/tbox/prefix/asm.h index 7480e805d..7480e805d 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/asm.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/asm.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/arm/prefix.S b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/arm/prefix.S index 85744e43e..85744e43e 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/arm/prefix.S +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/arm/prefix.S diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/arm/prefix.h b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/arm/prefix.h index 58d8a6e9f..58d8a6e9f 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/arm/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/arm/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/asm.h b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/asm.h index f3c6bbfa4..f3c6bbfa4 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/asm.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/asm.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/cache.h b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/cache.h index 9ffa51d6d..9ffa51d6d 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/cache.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/cache.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/prefix.S b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/prefix.S index 574675b8a..574675b8a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/prefix.S +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/prefix.S diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/prefix.h b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/prefix.h index d211e155e..d211e155e 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/asm/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/asm/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/assembler.h b/core/pkg/tbox.pkg/inc/tbox/prefix/assembler.h index 8f55841a3..8f55841a3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/assembler.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/assembler.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/assert.h b/core/pkg/tbox.pkg/inc/tbox/prefix/assert.h index cf42f6770..cf42f6770 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/assert.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/assert.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/check.h b/core/pkg/tbox.pkg/inc/tbox/prefix/check.h index b64aacd55..b64aacd55 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/check.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/check.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/compiler.h b/core/pkg/tbox.pkg/inc/tbox/prefix/compiler.h index aab9863e5..aab9863e5 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/compiler.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/compiler.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/config.h b/core/pkg/tbox.pkg/inc/tbox/prefix/config.h index d8b62dcb3..d8b62dcb3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/config.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/config.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/cpu.h b/core/pkg/tbox.pkg/inc/tbox/prefix/cpu.h index 1ce3717de..1ce3717de 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/cpu.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/cpu.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/endian.h b/core/pkg/tbox.pkg/inc/tbox/prefix/endian.h index 04ce3c8db..04ce3c8db 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/endian.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/endian.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/keyword.h b/core/pkg/tbox.pkg/inc/tbox/prefix/keyword.h index df3236d90..246310bd2 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/keyword.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/keyword.h @@ -170,6 +170,15 @@ # define __tb_extern_c_leave__ #endif +// export for the shared library +#if defined(TB_COMPILER_IS_MSVC) +# define __tb_export__ __declspec(dllexport) +#elif defined(TB_COMPILER_IS_GCC) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) +# define __tb_export__ __attribute__((visibility("default"))) +#else +# define __tb_export__ +#endif + // has feature #ifdef __has_feature # define __tb_has_feature__(x) __has_feature(x) diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/limits.h b/core/pkg/tbox.pkg/inc/tbox/prefix/limits.h index 7bc322f8c..7bc322f8c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/limits.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/limits.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/malloc.h b/core/pkg/tbox.pkg/inc/tbox/prefix/malloc.h index b20c0fd71..37651ad51 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/malloc.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/malloc.h @@ -37,37 +37,44 @@ __tb_extern_c_enter__ /* ////////////////////////////////////////////////////////////////////////////////////// * macros */ -#define tb_free(data) tb_pool_free_(tb_pool(), (tb_pointer_t)data __tb_debug_vals__) -#define tb_malloc(size) tb_pool_malloc_(tb_pool(), size __tb_debug_vals__) -#define tb_malloc0(size) tb_pool_malloc0_(tb_pool(), size __tb_debug_vals__) -#define tb_nalloc(item, size) tb_pool_nalloc_(tb_pool(), item, size __tb_debug_vals__) -#define tb_nalloc0(item, size) tb_pool_nalloc0_(tb_pool(), item, size __tb_debug_vals__) -#define tb_ralloc(data, size) tb_pool_ralloc_(tb_pool(), (tb_pointer_t)data, size __tb_debug_vals__) +#define tb_free(data) tb_allocator_free_(tb_allocator(), (tb_pointer_t)data __tb_debug_vals__) +#define tb_malloc(size) tb_allocator_malloc_(tb_allocator(), size __tb_debug_vals__) +#define tb_malloc0(size) tb_allocator_malloc0_(tb_allocator(), size __tb_debug_vals__) +#define tb_nalloc(item, size) tb_allocator_nalloc_(tb_allocator(), item, size __tb_debug_vals__) +#define tb_nalloc0(item, size) tb_allocator_nalloc0_(tb_allocator(), item, size __tb_debug_vals__) +#define tb_ralloc(data, size) tb_allocator_ralloc_(tb_allocator(), (tb_pointer_t)data, size __tb_debug_vals__) -#define tb_malloc_cstr(size) (tb_char_t*)tb_pool_malloc_(tb_pool(), size __tb_debug_vals__) -#define tb_malloc0_cstr(size) (tb_char_t*)tb_pool_malloc0_(tb_pool(), size __tb_debug_vals__) -#define tb_nalloc_cstr(item, size) (tb_char_t*)tb_pool_nalloc_(tb_pool(), item, size __tb_debug_vals__) -#define tb_nalloc0_cstr(item, size) (tb_char_t*)tb_pool_nalloc0_(tb_pool(), item, size __tb_debug_vals__) -#define tb_ralloc_cstr(data, size) (tb_char_t*)tb_pool_ralloc_(tb_pool(), (tb_pointer_t)data, size __tb_debug_vals__) +#define tb_malloc_cstr(size) (tb_char_t*)tb_allocator_malloc_(tb_allocator(), size __tb_debug_vals__) +#define tb_malloc0_cstr(size) (tb_char_t*)tb_allocator_malloc0_(tb_allocator(), size __tb_debug_vals__) +#define tb_nalloc_cstr(item, size) (tb_char_t*)tb_allocator_nalloc_(tb_allocator(), item, size __tb_debug_vals__) +#define tb_nalloc0_cstr(item, size) (tb_char_t*)tb_allocator_nalloc0_(tb_allocator(), item, size __tb_debug_vals__) +#define tb_ralloc_cstr(data, size) (tb_char_t*)tb_allocator_ralloc_(tb_allocator(), (tb_pointer_t)data, size __tb_debug_vals__) -#define tb_malloc_bytes(size) (tb_byte_t*)tb_pool_malloc_(tb_pool(), size __tb_debug_vals__) -#define tb_malloc0_bytes(size) (tb_byte_t*)tb_pool_malloc0_(tb_pool(), size __tb_debug_vals__) -#define tb_nalloc_bytes(item, size) (tb_byte_t*)tb_pool_nalloc_(tb_pool(), item, size __tb_debug_vals__) -#define tb_nalloc0_bytes(item, size) (tb_byte_t*)tb_pool_nalloc0_(tb_pool(), item, size __tb_debug_vals__) -#define tb_ralloc_bytes(data, size) (tb_byte_t*)tb_pool_ralloc_(tb_pool(), (tb_pointer_t)data, size __tb_debug_vals__) +#define tb_malloc_bytes(size) (tb_byte_t*)tb_allocator_malloc_(tb_allocator(), size __tb_debug_vals__) +#define tb_malloc0_bytes(size) (tb_byte_t*)tb_allocator_malloc0_(tb_allocator(), size __tb_debug_vals__) +#define tb_nalloc_bytes(item, size) (tb_byte_t*)tb_allocator_nalloc_(tb_allocator(), item, size __tb_debug_vals__) +#define tb_nalloc0_bytes(item, size) (tb_byte_t*)tb_allocator_nalloc0_(tb_allocator(), item, size __tb_debug_vals__) +#define tb_ralloc_bytes(data, size) (tb_byte_t*)tb_allocator_ralloc_(tb_allocator(), (tb_pointer_t)data, size __tb_debug_vals__) -#define tb_malloc_type(type) (type*)tb_pool_malloc_(tb_pool(), sizeof(type) __tb_debug_vals__) -#define tb_malloc0_type(type) (type*)tb_pool_malloc0_(tb_pool(), sizeof(type) __tb_debug_vals__) -#define tb_nalloc_type(item, type) (type*)tb_pool_nalloc_(tb_pool(), item, sizeof(type) __tb_debug_vals__) -#define tb_nalloc0_type(item, type) (type*)tb_pool_nalloc0_(tb_pool(), item, sizeof(type) __tb_debug_vals__) -#define tb_ralloc_type(data, item, type) (type*)tb_pool_ralloc_(tb_pool(), (tb_pointer_t)data, ((item) * sizeof(type)) __tb_debug_vals__) +#define tb_malloc_type(type) (type*)tb_allocator_malloc_(tb_allocator(), sizeof(type) __tb_debug_vals__) +#define tb_malloc0_type(type) (type*)tb_allocator_malloc0_(tb_allocator(), sizeof(type) __tb_debug_vals__) +#define tb_nalloc_type(item, type) (type*)tb_allocator_nalloc_(tb_allocator(), item, sizeof(type) __tb_debug_vals__) +#define tb_nalloc0_type(item, type) (type*)tb_allocator_nalloc0_(tb_allocator(), item, sizeof(type) __tb_debug_vals__) +#define tb_ralloc_type(data, item, type) (type*)tb_allocator_ralloc_(tb_allocator(), (tb_pointer_t)data, ((item) * sizeof(type)) __tb_debug_vals__) -#define tb_align_free(data) tb_pool_align_free_(tb_pool(), (tb_pointer_t)data __tb_debug_vals__) -#define tb_align_malloc(size, align) tb_pool_align_malloc_(tb_pool(), size, align __tb_debug_vals__) -#define tb_align_malloc0(size, align) tb_pool_align_malloc0_(tb_pool(), size, align __tb_debug_vals__) -#define tb_align_nalloc(item, size, align) tb_pool_align_nalloc_(tb_pool(), item, size, align __tb_debug_vals__) -#define tb_align_nalloc0(item, size, align) tb_pool_align_nalloc0_(tb_pool(), item, size, align __tb_debug_vals__) -#define tb_align_ralloc(data, size, align) tb_pool_align_ralloc_(tb_pool(), (tb_pointer_t)data, size, align __tb_debug_vals__) +#define tb_align_free(data) tb_allocator_align_free_(tb_allocator(), (tb_pointer_t)data __tb_debug_vals__) +#define tb_align_malloc(size, align) tb_allocator_align_malloc_(tb_allocator(), size, align __tb_debug_vals__) +#define tb_align_malloc0(size, align) tb_allocator_align_malloc0_(tb_allocator(), size, align __tb_debug_vals__) +#define tb_align_nalloc(item, size, align) tb_allocator_align_nalloc_(tb_allocator(), item, size, align __tb_debug_vals__) +#define tb_align_nalloc0(item, size, align) tb_allocator_align_nalloc0_(tb_allocator(), item, size, align __tb_debug_vals__) +#define tb_align_ralloc(data, size, align) tb_allocator_align_ralloc_(tb_allocator(), (tb_pointer_t)data, size, align __tb_debug_vals__) + +#define tb_large_free(data) tb_allocator_large_free_(tb_allocator(), (tb_pointer_t)data __tb_debug_vals__) +#define tb_large_malloc(size, real) tb_allocator_large_malloc_(tb_allocator(), size, real __tb_debug_vals__) +#define tb_large_malloc0(size, real) tb_allocator_large_malloc0_(tb_allocator(), size, real __tb_debug_vals__) +#define tb_large_nalloc(item, size, real) tb_allocator_large_nalloc_(tb_allocator(), item, size, real __tb_debug_vals__) +#define tb_large_nalloc0(item, size, real) tb_allocator_large_nalloc0_(tb_allocator(), item, size, real __tb_debug_vals__) +#define tb_large_ralloc(data, size, real) tb_allocator_large_ralloc_(tb_allocator(), (tb_pointer_t)data, size, real __tb_debug_vals__) #if TB_CPU_BIT64 # define tb_align8_free(data) tb_free((tb_pointer_t)data) @@ -88,13 +95,27 @@ __tb_extern_c_enter__ /* ////////////////////////////////////////////////////////////////////////////////////// * declaration */ -tb_pool_ref_t tb_pool(tb_noarg_t); -tb_pointer_t tb_pool_malloc_(tb_pool_ref_t pool, tb_size_t size __tb_debug_decl__); -tb_pointer_t tb_pool_malloc0_(tb_pool_ref_t pool, tb_size_t size __tb_debug_decl__); -tb_pointer_t tb_pool_nalloc_(tb_pool_ref_t pool, tb_size_t item, tb_size_t size __tb_debug_decl__); -tb_pointer_t tb_pool_nalloc0_(tb_pool_ref_t pool, tb_size_t item, tb_size_t size __tb_debug_decl__); -tb_pointer_t tb_pool_ralloc_(tb_pool_ref_t pool, tb_pointer_t data, tb_size_t size __tb_debug_decl__); -tb_bool_t tb_pool_free_(tb_pool_ref_t pool, tb_pointer_t data __tb_debug_decl__); + +struct __tb_allocator_t; +struct __tb_allocator_t* tb_allocator(); +tb_pointer_t tb_allocator_malloc_(struct __tb_allocator_t* allocator, tb_size_t size __tb_debug_decl__); +tb_pointer_t tb_allocator_malloc0_(struct __tb_allocator_t* allocator, tb_size_t size __tb_debug_decl__); +tb_pointer_t tb_allocator_nalloc_(struct __tb_allocator_t* allocator, tb_size_t item, tb_size_t size __tb_debug_decl__); +tb_pointer_t tb_allocator_nalloc0_(struct __tb_allocator_t* allocator, tb_size_t item, tb_size_t size __tb_debug_decl__); +tb_pointer_t tb_allocator_ralloc_(struct __tb_allocator_t* allocator, tb_pointer_t data, tb_size_t size __tb_debug_decl__); +tb_bool_t tb_allocator_free_(struct __tb_allocator_t* allocator, tb_pointer_t data __tb_debug_decl__); +tb_pointer_t tb_allocator_align_malloc_(struct __tb_allocator_t* allocator, tb_size_t size, tb_size_t align __tb_debug_decl__); +tb_pointer_t tb_allocator_align_malloc0_(struct __tb_allocator_t* allocator, tb_size_t size, tb_size_t align __tb_debug_decl__); +tb_pointer_t tb_allocator_align_nalloc_(struct __tb_allocator_t* allocator, tb_size_t item, tb_size_t size, tb_size_t align __tb_debug_decl__); +tb_pointer_t tb_allocator_align_nalloc0_(struct __tb_allocator_t* allocator, tb_size_t item, tb_size_t size, tb_size_t align __tb_debug_decl__); +tb_pointer_t tb_allocator_align_ralloc_(struct __tb_allocator_t* allocator, tb_pointer_t data, tb_size_t size, tb_size_t align __tb_debug_decl__); +tb_bool_t tb_allocator_align_free_(struct __tb_allocator_t* allocator, tb_pointer_t data __tb_debug_decl__); +tb_pointer_t tb_allocator_large_malloc_(struct __tb_allocator_t* allocator, tb_size_t size, tb_size_t* real __tb_debug_decl__); +tb_pointer_t tb_allocator_large_malloc0_(struct __tb_allocator_t* allocator, tb_size_t size, tb_size_t* real __tb_debug_decl__); +tb_pointer_t tb_allocator_large_nalloc_(struct __tb_allocator_t* allocator, tb_size_t item, tb_size_t size, tb_size_t* real __tb_debug_decl__); +tb_pointer_t tb_allocator_large_nalloc0_(struct __tb_allocator_t* allocator, tb_size_t item, tb_size_t size, tb_size_t* real __tb_debug_decl__); +tb_pointer_t tb_allocator_large_ralloc_(struct __tb_allocator_t* allocator, tb_pointer_t data, tb_size_t size, tb_size_t* real __tb_debug_decl__); +tb_bool_t tb_allocator_large_free_(struct __tb_allocator_t* allocator, tb_pointer_t data __tb_debug_decl__); /* ////////////////////////////////////////////////////////////////////////////////////// * extern diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/packed.h b/core/pkg/tbox.pkg/inc/tbox/prefix/packed.h index 815c294bb..815c294bb 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/packed.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/packed.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/prefix.h b/core/pkg/tbox.pkg/inc/tbox/prefix/prefix.h index db4bf42f3..db4bf42f3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/state.h b/core/pkg/tbox.pkg/inc/tbox/prefix/state.h index d8e5dc454..d8e5dc454 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/state.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/state.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/trace.h b/core/pkg/tbox.pkg/inc/tbox/prefix/trace.h index 15fcbf4a4..15fcbf4a4 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/trace.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/trace.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/type.h b/core/pkg/tbox.pkg/inc/tbox/prefix/type.h index d8b08ee95..d8b08ee95 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/type.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/type.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/utils.h b/core/pkg/tbox.pkg/inc/tbox/prefix/utils.h index 51c4e35b5..51c4e35b5 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/utils.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/utils.h diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/version.h b/core/pkg/tbox.pkg/inc/tbox/prefix/version.h index 9d066993f..9d066993f 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/prefix/version.h +++ b/core/pkg/tbox.pkg/inc/tbox/prefix/version.h diff --git a/core/pkg/tbox.pkg/inc/tbox/stream/async_stream.h b/core/pkg/tbox.pkg/inc/tbox/stream/async_stream.h index 4f7517d66..4f7517d66 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/stream/async_stream.h +++ b/core/pkg/tbox.pkg/inc/tbox/stream/async_stream.h diff --git a/core/pkg/tbox.pkg/inc/tbox/stream/async_transfer.h b/core/pkg/tbox.pkg/inc/tbox/stream/async_transfer.h index 525820a59..525820a59 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/stream/async_transfer.h +++ b/core/pkg/tbox.pkg/inc/tbox/stream/async_transfer.h diff --git a/core/pkg/tbox.pkg/inc/tbox/stream/filter.h b/core/pkg/tbox.pkg/inc/tbox/stream/filter.h index f6c1535e2..f6c1535e2 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/stream/filter.h +++ b/core/pkg/tbox.pkg/inc/tbox/stream/filter.h diff --git a/core/pkg/tbox.pkg/inc/tbox/stream/prefix.h b/core/pkg/tbox.pkg/inc/tbox/stream/prefix.h index f2e4b50d7..f2e4b50d7 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/stream/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/stream/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/stream/static_stream.h b/core/pkg/tbox.pkg/inc/tbox/stream/static_stream.h index 3cead8dc0..3cead8dc0 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/stream/static_stream.h +++ b/core/pkg/tbox.pkg/inc/tbox/stream/static_stream.h diff --git a/core/pkg/tbox.pkg/inc/tbox/stream/stream.h b/core/pkg/tbox.pkg/inc/tbox/stream/stream.h index 1cf448447..1cf448447 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/stream/stream.h +++ b/core/pkg/tbox.pkg/inc/tbox/stream/stream.h diff --git a/core/pkg/tbox.pkg/inc/tbox/stream/transfer.h b/core/pkg/tbox.pkg/inc/tbox/stream/transfer.h index f82a23308..f82a23308 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/stream/transfer.h +++ b/core/pkg/tbox.pkg/inc/tbox/stream/transfer.h diff --git a/core/pkg/tbox.pkg/inc/tbox/stream/transfer_pool.h b/core/pkg/tbox.pkg/inc/tbox/stream/transfer_pool.h index a251b099c..a251b099c 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/stream/transfer_pool.h +++ b/core/pkg/tbox.pkg/inc/tbox/stream/transfer_pool.h diff --git a/core/pkg/tbox.pkg/inc/tbox/string/prefix.h b/core/pkg/tbox.pkg/inc/tbox/string/prefix.h index baa78f413..baa78f413 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/string/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/string/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/string/static_string.h b/core/pkg/tbox.pkg/inc/tbox/string/static_string.h index 8f97aeacb..8f97aeacb 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/string/static_string.h +++ b/core/pkg/tbox.pkg/inc/tbox/string/static_string.h diff --git a/core/pkg/tbox.pkg/inc/tbox/string/string.h b/core/pkg/tbox.pkg/inc/tbox/string/string.h index f59bb04ae..f59bb04ae 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/string/string.h +++ b/core/pkg/tbox.pkg/inc/tbox/string/string.h diff --git a/core/pkg/tbox.pkg/inc/tbox/tbox.h b/core/pkg/tbox.pkg/inc/tbox/tbox.h index e5ce2c7ab..c97db64f1 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/tbox.h +++ b/core/pkg/tbox.pkg/inc/tbox/tbox.h @@ -73,20 +73,37 @@ __tb_extern_c_enter__ /*! init tbox * * @param priv the platform private data - * pass JNIEnv* env for android + * pass JavaVM* jvm for android jni * pass tb_null for other platform - * @param data the memory data for the memory pool, uses the native memory if be tb_null - * @param size the memory size for the memory pool, uses the native memory if be zero + * + * @param allocator the allocator, supports: + * + * - tb_native_allocator() + * uses native memory directly + * + * - tb_static_allocator(data, size) + * uses the a static small buffer and we can check memory error and leaking + * + * - tb_default_allocator(data, size) + * uses the a large pool with the static memory and we can check memory error and leaking + * + * - tb_default_allocator(tb_null, 0) + * uses the a large pool with the native memory and we can check memory error and leaking + * + * - tb_null + * uses tb_default_allocator(tb_null, 0) for large mode + * uses tb_native_allocator() for small mode, need define __tb_small__ * * @return tb_true or tb_false * * @code + * #include "tbox/tbox.h" int main(int argc, char** argv) { // init tbox - if (!tb_init(tb_null, tb_null, tb_null, 0)) return 0; + if (!tb_init(tb_null, tb_null)) return 0; // print info with tag tb_trace_i("hello tbox"); @@ -125,7 +142,7 @@ __tb_extern_c_enter__ } * @endcode */ -#define tb_init(priv, allocator, data, size) tb_init_(priv, allocator, data, size, (tb_size_t)(__tb_mode_debug__ | __tb_mode_small__), TB_VERSION_BUILD) +#define tb_init(priv, allocator) tb_init_(priv, allocator, (tb_size_t)(__tb_mode_debug__ | __tb_mode_small__), TB_VERSION_BUILD) /* ////////////////////////////////////////////////////////////////////////////////////// * interfaces @@ -136,19 +153,45 @@ __tb_extern_c_enter__ * @param priv the platform private data * pass JavaVM* jvm for android jni * pass tb_null for other platform - * @param allocator the allocator, uses data and size if be null - * @param data the memory data for the memory pool, uses the native memory if be tb_null - * @param size the memory size for the memory pool, uses the native memory if be zero + * + * @param allocator the allocator, supports: + * + * - tb_native_allocator() + * uses native memory directly + * + * - tb_static_allocator(data, size) + * uses the a static small buffer and we can check memory error and leaking + * + * - tb_default_allocator(data, size) + * uses the a large pool with the static memory and we can check memory error and leaking + * + * - tb_default_allocator(tb_null, 0) + * uses the a large pool with the native memory and we can check memory error and leaking + * + * - tb_null + * uses tb_default_allocator(tb_null, 0) for large mode + * uses tb_native_allocator() for small mode, need define __tb_small__ + * * @param mode the compile mode for check __tb_small__ and __tb_debug__ * @param build the build version * * @return tb_true or tb_false */ -tb_bool_t tb_init_(tb_handle_t priv, tb_allocator_ref_t allocator, tb_byte_t* data, tb_size_t size, tb_size_t mode, tb_hize_t build); +tb_bool_t tb_init_(tb_handle_t priv, tb_allocator_ref_t allocator, tb_size_t mode, tb_hize_t build); /// exit the tbox library tb_void_t tb_exit(tb_noarg_t); +/*! the state + * + * - TB_STATE_OK + * - TB_STATE_END + * - TB_STATE_EXITING + * + * @return the tbox state + */ +tb_size_t tb_state(tb_noarg_t); + #ifdef TB_CONFIG_INFO_HAVE_VERSION /*! the tbox version * diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/adler32.h b/core/pkg/tbox.pkg/inc/tbox/utils/adler32.h index dc0240a55..dc0240a55 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/adler32.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/adler32.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/base32.h b/core/pkg/tbox.pkg/inc/tbox/utils/base32.h index 912139a89..912139a89 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/base32.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/base32.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/base64.h b/core/pkg/tbox.pkg/inc/tbox/utils/base64.h index 957dd0910..957dd0910 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/base64.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/base64.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/bits.h b/core/pkg/tbox.pkg/inc/tbox/utils/bits.h index cdc05ad66..cdc05ad66 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/bits.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/bits.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/crc.h b/core/pkg/tbox.pkg/inc/tbox/utils/crc.h index 047ca5142..047ca5142 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/crc.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/crc.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/dump.h b/core/pkg/tbox.pkg/inc/tbox/utils/dump.h index 07f254673..07f254673 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/dump.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/dump.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_arm.h b/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_arm.h index 988e2a311..988e2a311 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_arm.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_arm.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_gcc.h b/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_gcc.h index 70df7ae14..70df7ae14 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_gcc.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_gcc.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_sh4.h b/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_sh4.h index d73418104..d73418104 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_sh4.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_sh4.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_x86.h b/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_x86.h index 2eef8b0fd..2eef8b0fd 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_x86.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/impl/bits_x86.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/impl/crc_arm.h b/core/pkg/tbox.pkg/inc/tbox/utils/impl/crc_arm.h index e3164bd20..e3164bd20 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/impl/crc_arm.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/impl/crc_arm.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/impl/prefix.h b/core/pkg/tbox.pkg/inc/tbox/utils/impl/prefix.h index 0f32a6b68..0f32a6b68 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/impl/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/impl/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/lock_profiler.h b/core/pkg/tbox.pkg/inc/tbox/utils/lock_profiler.h index 657d5ee31..657d5ee31 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/lock_profiler.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/lock_profiler.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/md5.h b/core/pkg/tbox.pkg/inc/tbox/utils/md5.h index 3503712cf..3503712cf 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/md5.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/md5.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/option.h b/core/pkg/tbox.pkg/inc/tbox/utils/option.h index f1c67cc5e..f1c67cc5e 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/option.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/option.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/prefix.h b/core/pkg/tbox.pkg/inc/tbox/utils/prefix.h index c9bbc618f..c9bbc618f 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/sha.h b/core/pkg/tbox.pkg/inc/tbox/utils/sha.h index 845dd5c64..845dd5c64 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/sha.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/sha.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/singleton.h b/core/pkg/tbox.pkg/inc/tbox/utils/singleton.h index 72e41713a..bc4557d61 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/singleton.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/singleton.h @@ -41,11 +41,11 @@ __tb_extern_c_enter__ /// the singleton type enum typedef enum __tb_singleton_type_e { - /// the large pool type - TB_SINGLETON_TYPE_LARGE_POOL = 0 + /// the default allocator + TB_SINGLETON_TYPE_DEFAULT_ALLOCATOR = 0 - /// the pool type -, TB_SINGLETON_TYPE_POOL = 1 + /// the static allocator +, TB_SINGLETON_TYPE_STATIC_ALLOCATOR = 1 /// the lock profiler type , TB_SINGLETON_TYPE_LOCK_PROFILER = 2 @@ -99,7 +99,7 @@ typedef tb_void_t (*tb_singleton_exit_func_t)(tb_handle_t instance, tb_cpointe typedef tb_void_t (*tb_singleton_kill_func_t)(tb_handle_t instance, tb_cpointer_t priv); /// the singleton static init func type -typedef tb_bool_t (*tb_singleton_static_init_func_t)(tb_handle_t instance); +typedef tb_bool_t (*tb_singleton_static_init_func_t)(tb_handle_t instance, tb_cpointer_t priv); /* ////////////////////////////////////////////////////////////////////////////////////// * interfaces @@ -125,15 +125,16 @@ tb_void_t tb_singleton_exit(tb_noarg_t); * @param init the singleton init func * @param exit the singleton exit func * @param kill the singleton kill func + * @param priv the private data * * @return the singleton instance handle */ -tb_handle_t tb_singleton_instance(tb_size_t type, tb_singleton_init_func_t init, tb_singleton_exit_func_t exit, tb_singleton_kill_func_t kill); +tb_handle_t tb_singleton_instance(tb_size_t type, tb_singleton_init_func_t init, tb_singleton_exit_func_t exit, tb_singleton_kill_func_t kill, tb_cpointer_t priv); /*! the singleton static instance * * @code - static tb_bool_t tb_xxxx_instance_init(tb_handle_t instance) + static tb_bool_t tb_xxxx_instance_init(tb_handle_t instance, tb_cpointer_t priv) { // init // ... @@ -148,7 +149,7 @@ tb_handle_t tb_singleton_instance(tb_size_t type, tb_singleton_init_func static tb_xxxx_t s_xxxx = {0}; // init the static instance - tb_bool_t ok = tb_singleton_static_init(&s_binited, &s_xxxx, tb_xxxx_instance_init); + tb_bool_t ok = tb_singleton_static_init(&s_binited, &s_xxxx, tb_xxxx_instance_init, tb_null); tb_assert(ok); // ok @@ -159,10 +160,11 @@ tb_handle_t tb_singleton_instance(tb_size_t type, tb_singleton_init_func * @param binited the singleton static instance is inited? * @param instance the singleton static instance * @param init the singleton static init func + * @param priv the private data * * @return tb_true or tb_false */ -tb_bool_t tb_singleton_static_init(tb_atomic_t* binited, tb_handle_t instance, tb_singleton_static_init_func_t init); +tb_bool_t tb_singleton_static_init(tb_atomic_t* binited, tb_handle_t instance, tb_singleton_static_init_func_t init, tb_cpointer_t priv); /* ////////////////////////////////////////////////////////////////////////////////////// * extern diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/trace.h b/core/pkg/tbox.pkg/inc/tbox/utils/trace.h index ffdd0efd3..ffdd0efd3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/trace.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/trace.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/url.h b/core/pkg/tbox.pkg/inc/tbox/utils/url.h index e8b671152..e8b671152 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/url.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/url.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/used.h b/core/pkg/tbox.pkg/inc/tbox/utils/used.h index 624ce2acd..624ce2acd 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/used.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/used.h diff --git a/core/pkg/tbox.pkg/inc/tbox/utils/utils.h b/core/pkg/tbox.pkg/inc/tbox/utils/utils.h index 8be786da1..8be786da1 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/utils/utils.h +++ b/core/pkg/tbox.pkg/inc/tbox/utils/utils.h diff --git a/core/pkg/tbox.pkg/inc/tbox/xml/node.h b/core/pkg/tbox.pkg/inc/tbox/xml/node.h index 23da09d11..23da09d11 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/xml/node.h +++ b/core/pkg/tbox.pkg/inc/tbox/xml/node.h diff --git a/core/pkg/tbox.pkg/inc/tbox/xml/prefix.h b/core/pkg/tbox.pkg/inc/tbox/xml/prefix.h index eddf8bca1..eddf8bca1 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/xml/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/xml/prefix.h diff --git a/core/pkg/tbox.pkg/inc/tbox/xml/reader.h b/core/pkg/tbox.pkg/inc/tbox/xml/reader.h index df67e03b3..df67e03b3 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/xml/reader.h +++ b/core/pkg/tbox.pkg/inc/tbox/xml/reader.h diff --git a/core/pkg/tbox.pkg/inc/tbox/xml/writer.h b/core/pkg/tbox.pkg/inc/tbox/xml/writer.h index 8541ba03e..8541ba03e 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/xml/writer.h +++ b/core/pkg/tbox.pkg/inc/tbox/xml/writer.h diff --git a/core/pkg/tbox.pkg/inc/tbox/xml/xml.h b/core/pkg/tbox.pkg/inc/tbox/xml/xml.h index 4c0214775..4c0214775 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/xml/xml.h +++ b/core/pkg/tbox.pkg/inc/tbox/xml/xml.h diff --git a/core/pkg/tbox.pkg/inc/tbox/zip/gzip.h b/core/pkg/tbox.pkg/inc/tbox/zip/gzip.h index e614e1a5f..e614e1a5f 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/zip/gzip.h +++ b/core/pkg/tbox.pkg/inc/tbox/zip/gzip.h diff --git a/core/pkg/tbox.pkg/inc/tbox/zip/lzsw.h b/core/pkg/tbox.pkg/inc/tbox/zip/lzsw.h deleted file mode 100755 index d1a28d738..000000000 --- a/core/pkg/tbox.pkg/inc/tbox/zip/lzsw.h +++ /dev/null @@ -1,167 +0,0 @@ -/*!The Treasure Box Library - * - * TBox is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * TBox is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with TBox; - * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> - * - * Copyright (C) 2009 - 2015, ruki All rights reserved. - * - * @author ruki - * @file lzsw.h - * @ingroup zip - * - */ -#ifndef TB_STREAM_ZSTREAM_LZSW_H -#define TB_STREAM_ZSTREAM_LZSW_H - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "prefix.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_enter__ - -/* ////////////////////////////////////////////////////////////////////////////////////// - * macros - */ - -// vlc -#define TB_LZSW_VLC_TYPE_FIXED (0) -#define TB_LZSW_VLC_TYPE_GAMMA (1) -#define TB_LZSW_VLC_TYPE_GOLOMB (0) - -// window -//#define TB_LZSW_WINDOW_SIZE_MAX (256) -//#define TB_LZSW_WINDOW_SIZE_MAX (4096) -#define TB_LZSW_WINDOW_SIZE_MAX (65536) -//#define TB_LZSW_WINDOW_SIZE_MAX (8) - -#define TB_LZSW_WINDOW_HASH_FIND (1) -#define TB_LZSW_WINDOW_HASH_MAX (768) // (256 + 256 + 256) - -/* ////////////////////////////////////////////////////////////////////////////////////// - * types - */ - -#if TB_LZSW_WINDOW_HASH_FIND -// the node type -typedef struct __tb_lzsw_node_t -{ - // the signature - tb_byte_t sign[4]; - - // the circle offset - tb_size_t coff; - - // the global address - tb_byte_t const* addr; - - // the next & prev - tb_size_t prev; - tb_size_t next; - -}tb_lzsw_node_t; -#endif - -// the inflate window type -typedef struct __tb_lzsw_inflate_window_t -{ - // the window rage - tb_byte_t const* we; - tb_size_t wn; - - // the window bits - tb_size_t wb; - tb_size_t mb; - -}tb_lzsw_inflate_window_t; - - -// the deflate window type -typedef struct __tb_lzsw_deflate_window_t -{ - // the window rage - tb_byte_t const* we; - tb_size_t wn; - - // the window bits - tb_size_t wb; - tb_size_t mb; - -#if TB_LZSW_WINDOW_HASH_FIND - // the circle base - tb_size_t base; - - // the window hash - tb_pointer_t pool; - tb_size_t hash[TB_LZSW_WINDOW_HASH_MAX]; -#endif - -}tb_lzsw_deflate_window_t; - - -// the lzsw inflate zstream type -typedef struct __tb_lzsw_inflate_stream_filter_zip_t -{ - // the stream base - tb_inflate_stream_filter_zip_t base; - - // the reference to vlc - tb_stream_filter_zip_vlc_t* vlc; - - // the window - tb_lzsw_inflate_window_t window; - -}tb_lzsw_inflate_stream_filter_zip_t; - -// the lzsw deflate zstream type -typedef struct __tb_lzsw_deflate_stream_filter_zip_t -{ - // the stream base - tb_deflate_stream_filter_zip_t base; - - // the reference to vlc - tb_stream_filter_zip_vlc_t* vlc; - - // the window - tb_lzsw_deflate_window_t window; - -}tb_lzsw_deflate_stream_filter_zip_t; - - -// the lzsw zstream type -typedef union __tb_lzsw_stream_filter_zip_t -{ - tb_lzsw_inflate_stream_filter_zip_t infst; - tb_lzsw_deflate_stream_filter_zip_t defst; - -}tb_lzsw_stream_filter_zip_t; - -/* ////////////////////////////////////////////////////////////////////////////////////// - * interfaces - */ - -tb_stream_filter_t* tb_stream_filter_zip_open_lzsw_inflate(tb_lzsw_inflate_stream_filter_zip_t* zst); -tb_stream_filter_t* tb_stream_filter_zip_open_lzsw_deflate(tb_lzsw_deflate_stream_filter_zip_t* zst); -tb_stream_filter_t* tb_stream_filter_zip_open_lzsw(tb_lzsw_stream_filter_zip_t* zst, tb_size_t action); - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_leave__ - -#endif - diff --git a/core/pkg/tbox.pkg/inc/tbox/zip/prefix.h b/core/pkg/tbox.pkg/inc/tbox/zip/prefix.h index b4d16270c..76f5d0884 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/zip/prefix.h +++ b/core/pkg/tbox.pkg/inc/tbox/zip/prefix.h @@ -29,7 +29,6 @@ #include "../prefix.h" #include "../stream/static_stream.h" #include "../memory/memory.h" -#include "vlc.h" /* ////////////////////////////////////////////////////////////////////////////////////// * types @@ -38,7 +37,7 @@ // the zip action type typedef enum __tb_zip_action_t { - TB_ZIP_ACTION_NULL = 0 + TB_ZIP_ACTION_NONE = 0 , TB_ZIP_ACTION_INFLATE = 1 , TB_ZIP_ACTION_DEFLATE = 2 @@ -47,15 +46,10 @@ typedef enum __tb_zip_action_t // the zip algorithm type typedef enum __tb_zip_algo_t { - TB_ZIP_ALGO_NONE = 0 //!< null -, TB_ZIP_ALGO_RLC = 1 //!< run length coding -, TB_ZIP_ALGO_HUFFMAN = 2 //!< adaptive huffman -, TB_ZIP_ALGO_LZSW = 3 //!< sliding window .e.g lz77 lzss ... -, TB_ZIP_ALGO_LZPD = 4 //!< phrase dictionary .e.g lzw lz78 ... -, TB_ZIP_ALGO_ZLIBRAW = 5 //!< zlib: raw inflate & deflate -, TB_ZIP_ALGO_ZLIB = 6 //!< zlib -, TB_ZIP_ALGO_GZIP = 7 //!< gnu zip -, TB_ZIP_ALGO_ARITHMETIC = 8 //!< arithmetic coding + TB_ZIP_ALGO_NONE = 0 //!< none +, TB_ZIP_ALGO_ZLIBRAW = 1 //!< zlib: raw inflate & deflate +, TB_ZIP_ALGO_ZLIB = 2 //!< zlib +, TB_ZIP_ALGO_GZIP = 3 //!< gnu zip }tb_zip_algo_t; @@ -71,15 +65,6 @@ typedef struct __tb_zip_t // spak tb_long_t (*spak)(struct __tb_zip_t* zip, tb_static_stream_ref_t ist, tb_static_stream_ref_t ost, tb_long_t sync); - // the vlc - union __tb_zip_vlc_union_t - { - tb_zip_vlc_fixed_t fixed; - tb_zip_vlc_golomb_t golomb; - tb_zip_vlc_gamma_t gamma; - - }vlc; - }tb_zip_t; /// the zip ref type diff --git a/core/pkg/tbox.pkg/inc/tbox/zip/vlc.h b/core/pkg/tbox.pkg/inc/tbox/zip/vlc.h deleted file mode 100755 index b0e23f339..000000000 --- a/core/pkg/tbox.pkg/inc/tbox/zip/vlc.h +++ /dev/null @@ -1,120 +0,0 @@ -/*!The Treasure Box Library - * - * TBox is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * TBox is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with TBox; - * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> - * - * Copyright (C) 2009 - 2015, ruki All rights reserved. - * - * @author ruki - * @file vlc.h - * @ingroup zip - * - */ -#ifndef TB_ZIP_VLC_H -#define TB_ZIP_VLC_H - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "../prefix.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * macros - */ - -// adaptive golomb coding -#define TB_ZIP_VLC_GOLOMB_ADAPTIVE - -/* ////////////////////////////////////////////////////////////////////////////////////// - * types - */ - -// the callback type -struct __tb_zip_vlc_t; -typedef tb_void_t (*tb_zip_vlc_set_t)(struct __tb_zip_vlc_t* vlc, tb_uint32_t val, tb_static_stream_ref_t sstream); -typedef tb_uint32_t (*tb_zip_vlc_get_t)(struct __tb_zip_vlc_t* vlc, tb_static_stream_ref_t sstream); -typedef tb_void_t (*tb_zip_vlc_clos_t)(struct __tb_zip_vlc_t* vlc); - -// the vlc type -typedef enum __tb_zip_vlc_type_t -{ - TB_ZIP_VLC_TYPE_FIXED = 0 -, TB_ZIP_VLC_TYPE_GOLOMB = 1 -, TB_ZIP_VLC_TYPE_GAMMA = 2 - -}tb_zip_vlc_type_t; - -// the variable length coding type -typedef struct __tb_zip_vlc_t -{ - // the vlc type - tb_size_t type; - - // set value to the bits stream - tb_zip_vlc_set_t set; - - // get value from the bits stream - tb_zip_vlc_get_t get; - - // close it - tb_zip_vlc_clos_t clos; - -}tb_zip_vlc_t; - - -// the fixed length coding type -typedef struct __tb_zip_vlc_fixed_t -{ - // the base - tb_zip_vlc_t base; - - // the bits - tb_byte_t nbits; - -}tb_zip_vlc_fixed_t; - -// the gamma length coding type -typedef struct __tb_zip_vlc_gamma_t -{ - // the base - tb_zip_vlc_t base; - -}tb_zip_vlc_gamma_t; - -// the golomb length coding type -typedef struct __tb_zip_vlc_golomb_t -{ - // the base - tb_zip_vlc_t base; - - // the m value - tb_size_t defm; - -#ifdef TB_ZIP_VLC_GOLOMB_ADAPTIVE - // for computing the average value - tb_size_t total; - tb_size_t count; -#endif - -}tb_zip_vlc_golomb_t; - -/* ////////////////////////////////////////////////////////////////////////////////////// - * interfaces - */ - -tb_zip_vlc_t* tb_zip_vlc_gamma_open(tb_zip_vlc_gamma_t* gamma); -tb_zip_vlc_t* tb_zip_vlc_golomb_open(tb_zip_vlc_golomb_t* golomb, tb_size_t defm); -tb_zip_vlc_t* tb_zip_vlc_fixed_open(tb_zip_vlc_fixed_t* fixed, tb_byte_t nbits); - -#endif diff --git a/core/pkg/tbox.pkg/inc/tbox/zip/vlc/prefix.h b/core/pkg/tbox.pkg/inc/tbox/zip/vlc/prefix.h deleted file mode 100755 index 4fb7ae046..000000000 --- a/core/pkg/tbox.pkg/inc/tbox/zip/vlc/prefix.h +++ /dev/null @@ -1,31 +0,0 @@ -/*!The Treasure Box Library - * - * TBox is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * TBox is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with TBox; - * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> - * - * Copyright (C) 2009 - 2015, ruki All rights reserved. - * - * @author ruki - * @file prefix.h - * - */ -#ifndef TB_ZIP_VLC_PREFIX_H -#define TB_ZIP_VLC_PREFIX_H - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "../prefix.h" - -#endif diff --git a/core/pkg/tbox.pkg/inc/tbox/zip/zip.h b/core/pkg/tbox.pkg/inc/tbox/zip/zip.h index 04d8a145a..04d8a145a 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/zip/zip.h +++ b/core/pkg/tbox.pkg/inc/tbox/zip/zip.h diff --git a/core/pkg/tbox.pkg/inc/tbox/zip/zlib.h b/core/pkg/tbox.pkg/inc/tbox/zip/zlib.h index f6b2ae730..f6b2ae730 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/zip/zlib.h +++ b/core/pkg/tbox.pkg/inc/tbox/zip/zlib.h diff --git a/core/pkg/tbox.pkg/inc/tbox/zip/zlibraw.h b/core/pkg/tbox.pkg/inc/tbox/zip/zlibraw.h index 805f7c50b..805f7c50b 100755..100644 --- a/core/pkg/tbox.pkg/inc/tbox/zip/zlibraw.h +++ b/core/pkg/tbox.pkg/inc/tbox/zip/zlibraw.h diff --git a/core/src/xmake/xmake.c b/core/src/xmake/xmake.c index f551f3138..759c286a8 100755 --- a/core/src/xmake/xmake.c +++ b/core/src/xmake/xmake.c @@ -107,7 +107,7 @@ tb_bool_t xm_init_(tb_size_t mode, tb_hize_t build) xm_version_check(build); // init tbox - if (!tb_init(tb_null, tb_null, tb_null, 0)) return tb_false; + if (!tb_init(tb_null, tb_null)) return tb_false; // trace tb_trace_d("init: ok"); diff --git a/xmake/templates/c++/console_tbox/project/src/main.cpp b/xmake/templates/c++/console_tbox/project/src/main.cpp index 80d02e35e..ad676ef58 100644 --- a/xmake/templates/c++/console_tbox/project/src/main.cpp +++ b/xmake/templates/c++/console_tbox/project/src/main.cpp @@ -9,7 +9,7 @@ tb_int_t main(tb_int_t argc, tb_char_t** argv) { // init tbox - if (!tb_init(tb_null, tb_null, tb_null, 0)) return -1; + if (!tb_init(tb_null, tb_null)) return -1; // trace tb_trace_i("hello tbox!"); diff --git a/xmake/templates/c++/shared_library_tbox/project/src/demo/main.cpp b/xmake/templates/c++/shared_library_tbox/project/src/demo/main.cpp index 2b974bfd8..818ff6919 100644 --- a/xmake/templates/c++/shared_library_tbox/project/src/demo/main.cpp +++ b/xmake/templates/c++/shared_library_tbox/project/src/demo/main.cpp @@ -9,7 +9,7 @@ tb_int_t main(tb_int_t argc, tb_char_t** argv) { // init tbox - if (!tb_init(tb_null, tb_null, tb_null, 0)) return -1; + if (!tb_init(tb_null, tb_null)) return -1; // trace tb_trace_i("hello tbox!"); diff --git a/xmake/templates/c++/static_library_tbox/project/src/demo/main.cpp b/xmake/templates/c++/static_library_tbox/project/src/demo/main.cpp index 2b974bfd8..818ff6919 100644 --- a/xmake/templates/c++/static_library_tbox/project/src/demo/main.cpp +++ b/xmake/templates/c++/static_library_tbox/project/src/demo/main.cpp @@ -9,7 +9,7 @@ tb_int_t main(tb_int_t argc, tb_char_t** argv) { // init tbox - if (!tb_init(tb_null, tb_null, tb_null, 0)) return -1; + if (!tb_init(tb_null, tb_null)) return -1; // trace tb_trace_i("hello tbox!"); diff --git a/xmake/templates/c/console_tbox/project/src/main.c b/xmake/templates/c/console_tbox/project/src/main.c index 80d02e35e..ad676ef58 100644 --- a/xmake/templates/c/console_tbox/project/src/main.c +++ b/xmake/templates/c/console_tbox/project/src/main.c @@ -9,7 +9,7 @@ tb_int_t main(tb_int_t argc, tb_char_t** argv) { // init tbox - if (!tb_init(tb_null, tb_null, tb_null, 0)) return -1; + if (!tb_init(tb_null, tb_null)) return -1; // trace tb_trace_i("hello tbox!"); diff --git a/xmake/templates/c/shared_library_tbox/project/src/demo/main.c b/xmake/templates/c/shared_library_tbox/project/src/demo/main.c index 2b974bfd8..818ff6919 100644 --- a/xmake/templates/c/shared_library_tbox/project/src/demo/main.c +++ b/xmake/templates/c/shared_library_tbox/project/src/demo/main.c @@ -9,7 +9,7 @@ tb_int_t main(tb_int_t argc, tb_char_t** argv) { // init tbox - if (!tb_init(tb_null, tb_null, tb_null, 0)) return -1; + if (!tb_init(tb_null, tb_null)) return -1; // trace tb_trace_i("hello tbox!"); diff --git a/xmake/templates/c/static_library_tbox/project/src/demo/main.c b/xmake/templates/c/static_library_tbox/project/src/demo/main.c index 2b974bfd8..818ff6919 100644 --- a/xmake/templates/c/static_library_tbox/project/src/demo/main.c +++ b/xmake/templates/c/static_library_tbox/project/src/demo/main.c @@ -9,7 +9,7 @@ tb_int_t main(tb_int_t argc, tb_char_t** argv) { // init tbox - if (!tb_init(tb_null, tb_null, tb_null, 0)) return -1; + if (!tb_init(tb_null, tb_null)) return -1; // trace tb_trace_i("hello tbox!"); |
