windows test program working

This commit is contained in:
Mike Jerris 2015-09-04 16:37:49 -04:00
parent 93a647468b
commit 6445012dd6
5 changed files with 218 additions and 33 deletions

View File

@ -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

View File

@ -24,6 +24,7 @@
#ifndef __MPOOL_H__
#define __MPOOL_H__
#include "ks.h"
#include <sys/types.h>
/*
@ -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. */

View File

@ -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:

View File

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{766F7FF4-CF39-4CDF-ABDC-4E9C88568F1F}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>testpools</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\src\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\src\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\src\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\src\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\testpools.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\libks.vcxproj">
<Project>{70d178d8-1100-4152-86c0-809a91cff832}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\testpools.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>