diff --git a/libs/libks/libks.sln b/libs/libks/libks.sln index d57322d2ef..fe03d30e74 100644 --- a/libs/libks/libks.sln +++ b/libs/libks/libks.sln @@ -5,6 +5,11 @@ VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libks", "libks.vcxproj", "{70D178D8-1100-4152-86C0-809A91CFF832}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testpools", "test\testpools\testpools.vcxproj", "{766F7FF4-CF39-4CDF-ABDC-4E9C88568F1F}" + ProjectSection(ProjectDependencies) = postProject + {70D178D8-1100-4152-86C0-809A91CFF832} = {70D178D8-1100-4152-86C0-809A91CFF832} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -21,6 +26,14 @@ Global {70D178D8-1100-4152-86C0-809A91CFF832}.Release|x64.Build.0 = Release|x64 {70D178D8-1100-4152-86C0-809A91CFF832}.Release|x86.ActiveCfg = Release|Win32 {70D178D8-1100-4152-86C0-809A91CFF832}.Release|x86.Build.0 = Release|Win32 + {766F7FF4-CF39-4CDF-ABDC-4E9C88568F1F}.Debug|x64.ActiveCfg = Debug|x64 + {766F7FF4-CF39-4CDF-ABDC-4E9C88568F1F}.Debug|x64.Build.0 = Debug|x64 + {766F7FF4-CF39-4CDF-ABDC-4E9C88568F1F}.Debug|x86.ActiveCfg = Debug|Win32 + {766F7FF4-CF39-4CDF-ABDC-4E9C88568F1F}.Debug|x86.Build.0 = Debug|Win32 + {766F7FF4-CF39-4CDF-ABDC-4E9C88568F1F}.Release|x64.ActiveCfg = Release|x64 + {766F7FF4-CF39-4CDF-ABDC-4E9C88568F1F}.Release|x64.Build.0 = Release|x64 + {766F7FF4-CF39-4CDF-ABDC-4E9C88568F1F}.Release|x86.ActiveCfg = Release|Win32 + {766F7FF4-CF39-4CDF-ABDC-4E9C88568F1F}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/libs/libks/src/include/mpool.h b/libs/libks/src/include/mpool.h index 43ec920ccb..b1c1ba7c58 100644 --- a/libs/libks/src/include/mpool.h +++ b/libs/libks/src/include/mpool.h @@ -24,6 +24,7 @@ #ifndef __MPOOL_H__ #define __MPOOL_H__ +#include "ks.h" #include /* @@ -180,8 +181,7 @@ typedef void mpool_t; * error_p <- Pointer to integer which, if not NULL, will be set with * a mpool error code. */ -extern -mpool_t *mpool_open(const unsigned int flags, const unsigned int page_size, +KS_DECLARE(mpool_t *) mpool_open(const unsigned int flags, const unsigned int page_size, void *start_addr, int *error_p); /* @@ -202,8 +202,7 @@ mpool_t *mpool_open(const unsigned int flags, const unsigned int page_size, * * mp_p <-> Pointer to our memory pool. */ -extern -int mpool_close(mpool_t *mp_p); +KS_DECLARE(int) mpool_close(mpool_t *mp_p); /* * int mpool_clear @@ -222,8 +221,7 @@ int mpool_close(mpool_t *mp_p); * * mp_p <-> Pointer to our memory pool. */ -extern -int mpool_clear(mpool_t *mp_p); +KS_DECLARE(int) mpool_clear(mpool_t *mp_p); /* * void *mpool_alloc @@ -248,8 +246,7 @@ int mpool_clear(mpool_t *mp_p); * error_p <- Pointer to integer which, if not NULL, will be set with * a mpool error code. */ -extern -void *mpool_alloc(mpool_t *mp_p, const unsigned long byte_size, +KS_DECLARE(void *) mpool_alloc(mpool_t *mp_p, const unsigned long byte_size, int *error_p); /* @@ -278,8 +275,7 @@ void *mpool_alloc(mpool_t *mp_p, const unsigned long byte_size, * error_p <- Pointer to integer which, if not NULL, will be set with * a mpool error code. */ -extern -void *mpool_calloc(mpool_t *mp_p, const unsigned long ele_n, +KS_DECLARE(void *)mpool_calloc(mpool_t *mp_p, const unsigned long ele_n, const unsigned long ele_size, int *error_p); /* @@ -304,8 +300,8 @@ void *mpool_calloc(mpool_t *mp_p, const unsigned long ele_n, * * size -> Size of the address being freed. */ -extern -int mpool_free(mpool_t *mp_p, void *addr, const unsigned long size); + +KS_DECLARE(int) mpool_free(mpool_t *mp_p, void *addr, const unsigned long size); /* * void *mpool_resize @@ -338,8 +334,7 @@ int mpool_free(mpool_t *mp_p, void *addr, const unsigned long size); * error_p <- Pointer to integer which, if not NULL, will be set with * a mpool error code. */ -extern -void *mpool_resize(mpool_t *mp_p, void *old_addr, +KS_DECLARE(void *) mpool_resize(mpool_t *mp_p, void *old_addr, const unsigned long old_byte_size, const unsigned long new_byte_size, int *error_p); @@ -378,8 +373,7 @@ void *mpool_resize(mpool_t *mp_p, void *old_addr, * will be set to the total amount of space (including administrative * overhead) used by the pool. */ -extern -int mpool_stats(const mpool_t *mp_p, unsigned int *page_size_p, +KS_DECLARE(int) mpool_stats(const mpool_t *mp_p, unsigned int *page_size_p, unsigned long *num_alloced_p, unsigned long *user_alloced_p, unsigned long *max_alloced_p, @@ -406,8 +400,7 @@ int mpool_stats(const mpool_t *mp_p, unsigned int *page_size_p, * log_func -> Log function (defined in mpool.h) which will be called * with each mpool transaction. */ -extern -int mpool_set_log_func(mpool_t *mp_p, mpool_log_func_t log_func); +KS_DECLARE(int) mpool_set_log_func(mpool_t *mp_p, mpool_log_func_t log_func); /* * int mpool_set_max_pages @@ -434,8 +427,7 @@ int mpool_set_log_func(mpool_t *mp_p, mpool_log_func_t log_func); * * max_pages -> Maximum number of pages used by the library. */ -extern -int mpool_set_max_pages(mpool_t *mp_p, const unsigned int max_pages); +KS_DECLARE(int) mpool_set_max_pages(mpool_t *mp_p, const unsigned int max_pages); /* * const char *mpool_strerror @@ -454,8 +446,7 @@ int mpool_set_max_pages(mpool_t *mp_p, const unsigned int max_pages); * * error -> Error number that we are converting. */ -extern -const char *mpool_strerror(const int error); +KS_DECLARE(const char *) mpool_strerror(const int error); /*<<<<<<<<<< This is end of the auto-generated output from fillproto. */ diff --git a/libs/libks/src/mpool.c b/libs/libks/src/mpool.c index e5381933bc..31c7a166aa 100644 --- a/libs/libks/src/mpool.c +++ b/libs/libks/src/mpool.c @@ -886,7 +886,7 @@ static int free_mem(mpool_t *mp_p, void *addr, const unsigned long size) * error_p <- Pointer to integer which, if not NULL, will be set with * a mpool error code. */ -mpool_t *mpool_open(const unsigned int flags, const unsigned int page_size, +KS_DECLARE(mpool_t *) mpool_open(const unsigned int flags, const unsigned int page_size, void *start_addr, int *error_p) { mpool_block_t *block_p; @@ -1049,7 +1049,7 @@ mpool_t *mpool_open(const unsigned int flags, const unsigned int page_size, * * mp_p <-> Pointer to our memory pool. */ -int mpool_close(mpool_t *mp_p) +KS_DECLARE(int) mpool_close(mpool_t *mp_p) { mpool_block_t *block_p, *next_p; void *addr; @@ -1136,7 +1136,7 @@ int mpool_close(mpool_t *mp_p) * * mp_p <-> Pointer to our memory pool. */ -int mpool_clear(mpool_t *mp_p) +KS_DECLARE(int) mpool_clear(mpool_t *mp_p) { mpool_block_t *block_p; int final = MPOOL_ERROR_NONE, bit_n, ret; @@ -1207,7 +1207,7 @@ int mpool_clear(mpool_t *mp_p) * error_p <- Pointer to integer which, if not NULL, will be set with * a mpool error code. */ -void *mpool_alloc(mpool_t *mp_p, const unsigned long byte_size, +KS_DECLARE(void *) mpool_alloc(mpool_t *mp_p, const unsigned long byte_size, int *error_p) { void *addr; @@ -1274,7 +1274,7 @@ void *mpool_alloc(mpool_t *mp_p, const unsigned long byte_size, * error_p <- Pointer to integer which, if not NULL, will be set with * a mpool error code. */ -void *mpool_calloc(mpool_t *mp_p, const unsigned long ele_n, +KS_DECLARE(void *) mpool_calloc(mpool_t *mp_p, const unsigned long ele_n, const unsigned long ele_size, int *error_p) { void *addr; @@ -1343,7 +1343,7 @@ void *mpool_calloc(mpool_t *mp_p, const unsigned long ele_n, * * size -> Size of the address being freed. */ -int mpool_free(mpool_t *mp_p, void *addr, const unsigned long size) +KS_DECLARE(int) mpool_free(mpool_t *mp_p, void *addr, const unsigned long size) { if (mp_p == NULL) { /* special case -- do a normal free */ @@ -1402,7 +1402,7 @@ int mpool_free(mpool_t *mp_p, void *addr, const unsigned long size) * error_p <- Pointer to integer which, if not NULL, will be set with * a mpool error code. */ -void *mpool_resize(mpool_t *mp_p, void *old_addr, +KS_DECLARE(void *) mpool_resize(mpool_t *mp_p, void *old_addr, const unsigned long old_byte_size, const unsigned long new_byte_size, int *error_p) @@ -1559,7 +1559,7 @@ void *mpool_resize(mpool_t *mp_p, void *old_addr, * will be set to the total amount of space (including administrative * overhead) used by the pool. */ -int mpool_stats(const mpool_t *mp_p, unsigned int *page_size_p, +KS_DECLARE(int) mpool_stats(const mpool_t *mp_p, unsigned int *page_size_p, unsigned long *num_alloced_p, unsigned long *user_alloced_p, unsigned long *max_alloced_p, @@ -1605,7 +1605,7 @@ int mpool_stats(const mpool_t *mp_p, unsigned int *page_size_p, * log_func -> Log function (defined in mpool.h) which will be called * with each mpool transaction. */ -int mpool_set_log_func(mpool_t *mp_p, mpool_log_func_t log_func) +KS_DECLARE(int) mpool_set_log_func(mpool_t *mp_p, mpool_log_func_t log_func) { if (mp_p == NULL) { return MPOOL_ERROR_ARG_NULL; @@ -1647,7 +1647,7 @@ int mpool_set_log_func(mpool_t *mp_p, mpool_log_func_t log_func) * * max_pages -> Maximum number of pages used by the library. */ -int mpool_set_max_pages(mpool_t *mp_p, const unsigned int max_pages) +KS_DECLARE(int) mpool_set_max_pages(mpool_t *mp_p, const unsigned int max_pages) { if (mp_p == NULL) { return MPOOL_ERROR_ARG_NULL; @@ -1690,7 +1690,7 @@ int mpool_set_max_pages(mpool_t *mp_p, const unsigned int max_pages) * * error -> Error number that we are converting. */ -const char *mpool_strerror(const int error) +KS_DECLARE(const char *) mpool_strerror(const int error) { switch (error) { case MPOOL_ERROR_NONE: diff --git a/libs/libks/test/testpools/testpools.vcxproj b/libs/libks/test/testpools/testpools.vcxproj new file mode 100644 index 0000000000..0313278219 --- /dev/null +++ b/libs/libks/test/testpools/testpools.vcxproj @@ -0,0 +1,159 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {766F7FF4-CF39-4CDF-ABDC-4E9C88568F1F} + Win32Proj + testpools + 8.1 + + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(ProjectDir)..\..\src\include + + + Console + true + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(ProjectDir)..\..\src\include + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(ProjectDir)..\..\src\include + + + Console + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(ProjectDir)..\..\src\include + + + Console + true + true + true + + + + + + + + {70d178d8-1100-4152-86c0-809a91cff832} + + + + + + \ No newline at end of file diff --git a/libs/libks/test/testpools/testpools.vcxproj.filters b/libs/libks/test/testpools/testpools.vcxproj.filters new file mode 100644 index 0000000000..85777cf3ad --- /dev/null +++ b/libs/libks/test/testpools/testpools.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file