Compare commits

...

8 Commits

Author SHA1 Message Date
MapleSign
ff312dd56b Merge branch 'develop' of https://github.com/saturneric/ZE-Standard-Libraries into develop 2019-01-12 17:50:40 +08:00
Saturneic
dd5d39bb1d 错误修改 2019-01-12 15:31:12 +08:00
MapleSign
e7e708ad8f Merge branch 'develop' of https://github.com/saturneric/ZE-Standard-Libraries into develop 2019-01-12 13:33:53 +08:00
Saturneic
1116412c0a Fixed. 2019-01-12 08:54:05 +08:00
MapleSign
6ee11e324c Just Merge. 2018-08-22 23:36:25 +08:00
MapleSign
61110f5af9 fixed 2018-08-03 19:48:51 +08:00
MapleSign
1fdb271174 Merge branch 'develop' of https://github.com/saturneric/ZE-Standard-Libraries into develop 2018-08-03 11:43:43 +08:00
MapleSign
6b5dd60ea3 fixed 2018-08-03 11:39:16 +08:00
23 changed files with 481 additions and 326 deletions

View File

@ -6,29 +6,29 @@
### 详细梗概
该库以模块化的方式来组织,主要模块包括内存管理模块、高级数据结构模块、文件储存模块、网络传输模块、子程序管理模块、回调机制实现模块、错误管理模块、在主要模块还会被分为几个小模块。模块之间有对应的依赖关系。
#### 内存管理模块
该库以内存管理模块为基础,通过两种内存管理结构,对于储存在内存中的数据进行组织、操作。该模块的子模块主要分为链式内存管理,块式内存管理。链式内存管理对于内存中离散的数据进行组织和管理;块式内存管理对于内存中的整块数据进行管理。这两个子模块会分别实现链式和块式的内存管理的管理结构及相关操作。该模块的第三个子模块是内存泄露管理模块,该模块对于已经分配的内存空间进行全面地监控,及时地完全地释放不需要的内存空间。内存泄漏管理对于长期运行的软件系统来说至关重要。链式和块式内存管理具体要实现的基本操作函数有:初始化类函数、赋值类函数、复制类函数、插入类函数、删除类函数、查询类函数、释放类函数。
#### 内存管理模块memory
该库以内存管理模块为基础,通过两种内存管理结构,对于储存在内存中的数据进行组织、操作。该模块的子模块主要分为链式内存管理list,块式内存管理block。链式内存管理对于内存中离散的数据进行组织和管理;块式内存管理对于内存中的整块数据进行管理。这两个子模块会分别实现链式和块式的内存管理的管理结构及相关操作。该模块的第三个子模块是内存泄露管理模块,该模块对于已经分配的内存空间进行全面地监控,及时地完全地释放不需要的内存空间。内存泄漏管理对于长期运行的软件系统来说至关重要。链式和块式内存管理具体要实现的基本操作函数有:初始化类函数、赋值类函数、复制类函数、插入类函数、删除类函数、查询类函数、释放类函数。
#### 高级数据结构模块
高级数据结构模块是对于内存管理模块的一次封装和抽象,它依赖于内存管理模块所提供的链式内存和块式内存管理结构和相关操作方法,运用相关方法来实现高级数据结构及其基本操作和算法。这些高级数据结构包括:目录树、二叉树、堆、栈、队列、有向图、无向图、链表、字典、字符串。通过高级数据模块,使得库能够更加快速地对于实际问题进行建模,更加有效率的解决实际问题。高级数据结构的子模块包含:基本操作子模块和算法子模块。前者完成了对于高级数据结构的基本操作:初始化数据结构、插入数据、删除数据、更新数据;后者将提供高级数据结构常用的高级算法:查找算法、排序算法、优化算法、转换算法。
#### 高级数据结构模块datastruct
高级数据结构模块是对于内存管理模块的一次封装和抽象,它依赖于内存管理模块所提供的链式内存和块式内存管理结构和相关操作方法,运用相关方法来实现高级数据结构及其基本操作和算法。这些高级数据结构包括:目录树tree、二叉树、堆、栈、队列、有向图、无向图、链表(chain)、字典、字符串。通过高级数据模块,使得库能够更加快速地对于实际问题进行建模,更加有效率的解决实际问题。高级数据结构的子模块包含:基本操作子模块和算法子模块。前者完成了对于高级数据结构的基本操作:初始化数据结构、插入数据、删除数据、更新数据;后者将提供高级数据结构常用的高级算法:查找算法、排序算法、优化算法、转换算法。
#### 文件储存模块
文件储存模块依赖内存管理模块、回调机制模块和高级数据结构模块,该模块实现将内存数据管理结构与高级数据结构的信息及其中储存的数据储存到到文件中。该模块中定义的文件管理结构分为两类:关系型文件管理结构,非关系型文件管理结构。这两个结构的区别是是否记录所储存信息之间的关系。前者将有专门的数据结构来储存所储存的数据之间的联系,后者按照块的形式来叠放数据。模块内部将专门实现这两个数据管理结构写入文件、从文件读出的操作方法。并且,将实现各个高级数据结构与文件管理结构之间的转化。这样,能够直接将高级数据结构转化为文件管理结构,从而储存到文件中。或者,将文件中的数据读出,独处的数据在内存中的表现形式为对应的文件管理结构,而后再将文件管理结构转化为对应的高级数据结构。模块将实现对于这两种结构的操作方法:初始化,转化,写入,读取,释放。
#### 文件储存模块communicate_file
文件储存模块依赖内存管理模块、回调机制模块和高级数据结构模块,该模块实现将内存数据管理结构与高级数据结构的信息及其中储存的数据储存到到文件中。该模块中定义的文件管理结构分为两类:关系型文件管理结构std,非关系型文件管理结构。这两个结构的区别是是否记录所储存信息之间的关系。前者将有专门的数据结构来储存所储存的数据之间的联系,后者按照块的形式来叠放数据。模块内部将专门实现这两个数据管理结构写入文件、从文件读出的操作方法。并且,将实现各个高级数据结构与文件管理结构之间的转化。这样,能够直接将高级数据结构转化为文件管理结构,从而储存到文件中。或者,将文件中的数据读出,独处的数据在内存中的表现形式为对应的文件管理结构,而后再将文件管理结构转化为对应的高级数据结构。模块将实现对于这两种结构的操作方法:初始化,转化,写入,读取,释放。
#### 网络传输模块
网路传输模块依赖内存管理模块、回调机制模块、高级数据结构模块和文件储存模块,此模块主要提供将高级数据结构转化为文件信息管理结构,文件管理结构转化为网络信息块管理结构,将信息分块进行传输。对于简单的字符信息,该模块也提供网络消息管理结构,通过该结构能够在一台计算机和另外一台计算机之间传递字符串消息。模块将实现对于这两种结构的操作方法:初始化、转化、赋值、传输、释放。
#### 网络传输模块communicate_network
网路传输模块依赖内存管理模块、回调机制模块、高级数据结构模块和文件储存模块,此模块主要提供将高级数据结构转化为文件信息管理结构,文件管理结构转化为网络信息块管理结构,将信息分块进行传输。对于简单的字符信息,该模块也提供网络消息管理结构message,通过该结构能够在一台计算机和另外一台计算机之间传递字符串消息。模块将实现对于这两种结构的操作方法:初始化、转化、赋值、传输、释放。
#### 回调机制模块
#### 回调机制模块event
回调机制模块依赖内存管理模块和高级数据结构,该模块实现一种方法调用机制,将实现回调函数的注册、传参、返回值传参的标准化宏与相关支撑函数。高级模块中的相关方法,通过使用以上的宏和函数,中能够以更加标准的、更加优雅的方法来实现相关功能。这也使得,事件机制的运用能够更加便捷有效,从而跨计算机之间的函数调用与传参成为可能。
#### 错误管理模块
#### 错误管理模块error
错误管理模块依赖内存管理模块和回调机制模块,该模块提供程序输出信息的分类:严重错误、错误、警告、提示。该模块将实现错误的处理函数的注册,在严重错误或者错误出现的情况下,根据开发者通过该模块的错误处理函数的注册信息,调用相应的错误处理函数并提供关键信息来辅助错误修复。该模块将提供相应的管理结构与方法来建立程序中的相关信息的日志文件,并且提供更加方便的方法来管理与更新相应的日志文件,实现程序输出信息的更加规范的清晰地产生与显示。
#### 子程序管理模块
#### 子程序管理模块subfunc
该模块依赖以上的所有模块,该模块也为该库的最高级的部分。该模块提供子程序的注册,调用,传输以及依赖关系的管理。子程序是一个独立的软件系统的所有功能的一部分,具有相对的独立性。一个程序的子程序可以储存在相同的计算机上,也可以储存在不同的计算机上,子程序之间不论储存的地方在何处,只要能够通过内存或者网络的方式访问到,则可以进行传参和调用。位置信息的记录与子程序的调用由相应的管理结构与操作方法来实现。对于一个要由多个子程序之间协调合作来完成的复杂任务的情景,该模块将通过子程序依赖关系管理结构及其方法来进行相应的系统性的有序调用。对于一个大任务中两个不互为依赖的过程,在允许的情况下模块将进行并行调用。通过子程序的传输方法,子程序能够更加方便地通过网络在计算机之间进行转移。总之,通过该模块,实现了一个独立的软件系统在不同的计算机中储存并且运行在不同计算机的内存中却可以虚拟出在同一计算机中储存运行的效果,能够并行执行软件系统中的某些功能,也可以让软件系统的设计者随时根据具体情况来转移子程序。
### 通信模块
由于实际原因,网络传输模块与文件储存模块合为通信模块。
### 通信模块communicate
由于实际原因,网络传输模块与文件储存模块合为通信模块。通信模块统一负责内存管理结构、高级数据结构与文件和网络的对接工作。
### 目录结构管理方式
- src源文件
@ -49,14 +49,14 @@
- list 链式内存管理
- tree 目录树
- error错误管理模块
- subfunc子程序管理模块
- type.h全局信息头文件
- subfunc子程序管理模块
- type.h全局信息头文件
- document文档
- info工程说明及计划文档
- raw design模块概要设计文档
- design模块详细设计文档
- test测试方案及数据文档
- info工程说明及计划文档
- raw design模块概要设计文档
- design模块详细设计文档
- test测试方案及数据文档
- test不同平台下的测试程序文件
- unix
- windows
- unix
- windows
- bin编译后的二进制文件

View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.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">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{77936A90-7A47-462C-BB65-1F4297AA853C}</ProjectGuid>
<RootNamespace>ZEStandardLibraries</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</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 />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="communicate\communicate.h" />
<ClInclude Include="error\error.h" />
<ClInclude Include="graph\graph.h" />
<ClInclude Include="id\id.h" />
<ClInclude Include="list\list.h" />
<ClInclude Include="list\list_expand.h" />
<ClInclude Include="stack\stack.h" />
<ClInclude Include="stack\stack_expand.h" />
<ClInclude Include="test.h" />
<ClInclude Include="tree\tree.h" />
<ClInclude Include="tree\tree_expand.h" />
<ClInclude Include="type\type.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="communicate\communicate.c" />
<ClCompile Include="error\error.c" />
<ClCompile Include="graph\graph.c" />
<ClCompile Include="id\id.c" />
<ClCompile Include="list\list.c" />
<ClCompile Include="list\list_expand.c" />
<ClCompile Include="stack\stack.c" />
<ClCompile Include="stack\stack_expand.c" />
<ClCompile Include="test.c" />
<ClCompile Include="tree\tree.c" />
<ClCompile Include="tree\tree_expand.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<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>
<ClInclude Include="communicate\communicate.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="error\error.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="graph\graph.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="id\id.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="list\list.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="list\list_expand.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="stack\stack.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="stack\stack_expand.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="tree\tree.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="tree\tree_expand.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="type\type.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="test.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="communicate\communicate.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="error\error.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="graph\graph.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="id\id.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="list\list.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="list\list_expand.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="stack\stack.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="stack\stack_expand.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="tree\tree.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="tree\tree_expand.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="test.c">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@ -232,7 +232,7 @@ extern void *getByPointerForNode(CNode *);
/*
*
*: */
extern unsigned long long getIndexForNode(Chain *p_list,CNode *p_node);
extern uint64_t getIndexForNode(Chain *p_list,CNode *p_node);
/*
*,.
@ -262,7 +262,7 @@ Chain *copyList(Chain *p_list);
/*
*
*: ,NULL.*/
extern CNode *findByIndexForNode(Chain *, unsigned long long);
extern CNode *findByIndexForNode(Chain *, uint64_t);
/*
*
@ -285,4 +285,149 @@ extern CNode *findByStringForNode(Chain *, char *);
extern CNode *findByPointerForNode(Chain *, void *);
/************************************************
*,
************************************************/
/****
*ID模块相关宏
*/
/*直接获取一个以整型值初始化的节点不带ID的缩略*/
#define lni(cn) nodeWithInt(cn,0)
/*直接获取一个以无符号整型值初始化的不带ID节点的缩略*/
#define lnu(cn) nodeWithUInt(cn,0)
/*直接获取一个以无符号长整形值初始化的节点的缩略*/
#define lnull(cn) nodeWithULLInt(cn,0)
/*直接获取一个以浮点值初始化的不带ID节点的缩略*/
#define lnd(cn) nodeWithDouble(cn,0)
/*直接获取一个以字符串值初始化的不带ID节点的缩略*/
#define lns(cn) nodeWithString(cn,0)
/*直接获取一个以指针值初始化的不带ID节点的缩略*/
#define lnp(cn) nodeWithPointer(cn,0)
/****
*ID模块的相关宏
*/
/*直接获取一个以整型值初始化的带ID节点的缩略*/
#define lsni(cn) nodeWithInt(cn,1)
/*直接获取一个以浮点值初始化的带ID节点的缩略*/
#define lsnd(cn) nodeWithDouble(cn,1)
/*直接获取一个以字符串值初始化的带ID节点的缩略*/
#define lsns(cn) nodeWithString(cn,1)
/*直接获取一个以指针值初始化的节点的缩略*/
#define lsnp(cn) nodeWithPointer(cn,1)
/************************************************
*
************************************************/
/****
*
*/
/*在链表尾部直接加入一个已经用整型值初始化的不带ID的节点*/
#define lisrti(chain, cn) insertInTail(chain, lni(cn));
/*在链表尾部直接加入一个已经用浮点值初始化的不带ID的节点*/
#define lisrtd(chain, cn) insertInTail(chain, lnd(cn));
/*在链表尾部直接加入一个已经用无符号整型值初始化的不带ID的节点*/
#define lisrtu(chain, cn) insertInTail(chain, lnu(cn));
/*在链表尾部直接加入一个已经用无符号长整型值初始化的不带ID的节点*/
#define lisrtull(chain, cn) insertInTail(chain, lnull(cn));
/*在链表尾部直接加入一个已经用指针值初始化的不带ID的节点*/
#define lisrtp(chain, cn) insertInTail(chain, lnp(cn));
/*在链表尾部直接加入一个已经用字符串值初始化的不带ID的节点*/
#define lisrts(chain, cn) insertInTail(chain, lns(cn));
/****
*
*/
/*在链表头部直接加入一个已经用整型值初始化的不带ID的节点*/
#define lisrhi(chain, cn) insertInHead(chain, lni(cn));
/*在链表头部直接加入一个已经用浮点值初始化的不带ID的节点*/
#define lisrhd(chain, cn) insertInHead(chain, lnd(cn));
/*在链表头部直接加入一个已经用无符号整型值初始化的不带ID的节点*/
#define lisrhu(chain, cn) insertInHead(chain, lnu(cn));
/*在链表头部直接加入一个已经用无符号长整型值初始化的不带ID的节点*/
#define lisrhull(chain, cn) insertInHead(chain, lnull(cn));
/*在链表头部直接加入一个已经用指针值初始化的不带ID的节点*/
#define lisrhp(chain, cn) insertInHead(chain, lnp(cn));
/*在链表头部直接加入一个已经用字符串值初始化的不带ID的节点*/
#define lisrhs(chain, cn) insertInHead(chain, lns(cn));
/************************************************
*
************************************************/
/*快速获得指针类型的节点所储存的值*/
#define lidxp(chain, cn) getByPointerForNode(findByIndexForNode(chain, cn))
/*快速获得整型类型的节点所储存的值*/
#define lidxi(chain, cn) getByIntForNode(findByIndexForNode(chain, cn))
/*快速获得浮点类型的节点所储存的值*/
#define lidxd(chain, cn) getByDoubleForNode(findByIndexForNode(chain, cn))
/*快速获得字符串类型的节点所储存的值*/
#define lidxs(chain, cn) getByStringForNode(findByIndexForNode(chain, cn))
/*快速获得无符号长整型类型的节点所储存的值*/
#define lupdull(chain,cn,value) updateValueWithULLIntForNode(findByIndexForNode(chain, cn),value)
/************************************************
*
************************************************/
/*通过节点的序号直接得到它的值*/
#define lidxvle(chain,cn) (findByIndexForNode(chain, cn)->value)
/*通过节点序号直接移除节点*/
#define lrmvidx(chain,cn) removeByNode(chain, findByIndexForNode(chain, cn)
/*从列表头移除节点的缩略*/
#define lpoph(chain) popFromHead(chain)
/*从列表尾移除节点的缩略*/
#define lpopt(chain) popFromTail(chain)
/*通过节点的ID直接获得节点的值*/
#define lfndsid(chain,sid) (findByIdForNode(chain,sid)->value)
/*创建一个不带ID的链表的缩略*/
#define lstns() initList(0);
/*创建一个带有ID的链表缩略*/
#define lstn() initList(1);
#endif /* chain_h */

View File

@ -1,5 +1,5 @@
#ifndef list_print_h
#define list_print_h
#ifndef chain_print_h
#define chain_print_h
#include <chain/chain.h>
#include <event/event.h>
@ -39,4 +39,4 @@ __CALLBACK_STATE(printListForCustom);
void printNode(CNode *p_node);
#endif /* list_print_h */
#endif /* chain_h */

View File

@ -3,12 +3,12 @@
#include <list/list_type.h>
/*
/**
*
*/
typedef struct Node CNode;
/*
/**
*
*/
typedef struct List Chain;

View File

@ -102,8 +102,6 @@ extern int dataFileReadOut(D_FILE *p_dfile);
/************************************************
:
************************************************/

View File

@ -1,155 +1,8 @@
#ifndef list_expand_1_h
#define list_expand_1_h
#ifndef event_h
#define event_h
#include <chain/chain.h>
/************************************************
*,
************************************************/
/****
*ID模块相关宏
*/
/*直接获取一个以整型值初始化的节点不带ID的缩略*/
#define lni(x) nodeWithInt(x,0)
/*直接获取一个以无符号整型值初始化的不带ID节点的缩略*/
#define lnu(x) nodeWithUInt(x,0)
/*直接获取一个以无符号长整形值初始化的节点的缩略*/
#define lnull(x) nodeWithULLInt(x,0)
/*直接获取一个以浮点值初始化的不带ID节点的缩略*/
#define lnd(x) nodeWithDouble(x,0)
/*直接获取一个以字符串值初始化的不带ID节点的缩略*/
#define lns(x) nodeWithString(x,0)
/*直接获取一个以指针值初始化的不带ID节点的缩略*/
#define lnp(x) nodeWithPointer(x,0)
/****
*ID模块的相关宏
*/
/*直接获取一个以整型值初始化的带ID节点的缩略*/
#define lsni(x) nodeWithInt(x,1)
/*直接获取一个以浮点值初始化的带ID节点的缩略*/
#define lsnd(x) nodeWithDouble(x,1)
/*直接获取一个以字符串值初始化的带ID节点的缩略*/
#define lsns(x) nodeWithString(x,1)
/*直接获取一个以指针值初始化的节点的缩略*/
#define lsnp(x) nodeWithPointer(x,1)
/************************************************
*
************************************************/
/****
*
*/
/*在链表尾部直接加入一个已经用整型值初始化的不带ID的节点*/
#define lisrti(list, x) insertInTail(list, lni(x));
/*在链表尾部直接加入一个已经用浮点值初始化的不带ID的节点*/
#define lisrtd(list, x) insertInTail(list, lnd(x));
/*在链表尾部直接加入一个已经用无符号整型值初始化的不带ID的节点*/
#define lisrtu(list, x) insertInTail(list, lnu(x));
/*在链表尾部直接加入一个已经用无符号长整型值初始化的不带ID的节点*/
#define lisrtull(list, x) insertInTail(list, lnull(x));
/*在链表尾部直接加入一个已经用指针值初始化的不带ID的节点*/
#define lisrtp(list, x) insertInTail(list, lnp(x));
/*在链表尾部直接加入一个已经用字符串值初始化的不带ID的节点*/
#define lisrts(list, x) insertInTail(list, lns(x));
/****
*
*/
/*在链表头部直接加入一个已经用整型值初始化的不带ID的节点*/
#define lisrhi(list, x) insertInHead(list, lni(x));
/*在链表头部直接加入一个已经用浮点值初始化的不带ID的节点*/
#define lisrhd(list, x) insertInHead(list, lnd(x));
/*在链表头部直接加入一个已经用无符号整型值初始化的不带ID的节点*/
#define lisrhu(list, x) insertInHead(list, lnu(x));
/*在链表头部直接加入一个已经用无符号长整型值初始化的不带ID的节点*/
#define lisrhull(list, x) insertInHead(list, lnull(x));
/*在链表头部直接加入一个已经用指针值初始化的不带ID的节点*/
#define lisrhp(list, x) insertInHead(list, lnp(x));
/*在链表头部直接加入一个已经用字符串值初始化的不带ID的节点*/
#define lisrhs(list, x) insertInHead(list, lns(x));
/************************************************
*
************************************************/
/*快速获得指针类型的节点所储存的值*/
#define lidxp(list, x) getByPointerForNode(findByIndexForNode(list, x))
/*快速获得整型类型的节点所储存的值*/
#define lidxi(list, x) getByIntForNode(findByIndexForNode(list, x))
/*快速获得浮点类型的节点所储存的值*/
#define lidxd(list, x) getByDoubleForNode(findByIndexForNode(list, x))
/*快速获得字符串类型的节点所储存的值*/
#define lidxs(list, x) getByStringForNode(findByIndexForNode(list, x))
/*快速获得无符号长整型类型的节点所储存的值*/
#define lupdull(list,x,value) updateValueWithULLIntForNode(findByIndexForNode(list, x),value)
/************************************************
*
************************************************/
/*通过节点的序号直接得到它的值*/
#define lidxvle(list,x) (findByIndexForNode(list, x)->value)
/*通过节点序号直接移除节点*/
#define lrmvidx(list,x) removeByNode(list, findByIndexForNode(list, x)
/*从列表头移除节点的缩略*/
#define lpoph(list) popFromHead(list)
/*从列表尾移除节点的缩略*/
#define lpopt(list) popFromTail(list)
/*通过节点的ID直接获得节点的值*/
#define lfndsid(list,sid) (findByIdForNode(list,sid)->value)
/*创建一个不带ID的链表的缩略*/
#define lstns() initList(0);
/*创建一个带有ID的链表缩略*/
#define lstn() initList(1);
#endif /* list_expand_1_h */
/************************************************
*便
************************************************/
@ -226,3 +79,5 @@
*使
*/
#define __CRETURN__ newCReturn()
#endif /* event_h */

View File

@ -1,79 +0,0 @@
#ifndef list_simple_h
#define list_simple_h
#include <list/list_type.h>
/************************************************
*: ,
* 使.
************************************************/
/*
*, 使
*: ,NULL.*/
extern s_Node *s_nodeWithInt(int);
/*
*, 使
*: ,NULL.*/
extern s_Node *s_nodeWithUInt(unsigned int);
/*
*, 使
*: ,NULL.*/
extern s_Node *s_nodeWithDouble(double);
/*
*, 使
*: ,NULL.*/
extern s_Node *s_nodeWithString(const char *);
/*
*, 使
*: ,NULL.*/
extern s_Node *s_nodeWithPointer(const void *);
/*
*,List结构中.
*.,便.
*: ,NULL.*/
extern s_Node *s_initNode(void);
/*在单项链表的头部插入一个节点
*: 0,-1.*/
extern int s_insertInHead(List *p_list, s_Node *s_p_node);
/*
*
*: 0,-1.*/
extern int s_insertInTail(List *p_list, s_Node *s_p_node);
/*
*
*: 0, -1.*/
extern int s_releaseNode(s_Node *s_p_node);
/*
*
*: 0, -1.*/
extern int s_releaseList(List *p_list);
/*
*
*: func是一个函数指针,,
* ,.
* 0,-1.
*: 0, -1.*/
extern int s_releaseListForCustom(List *p_list, int (*func)(void *));
/*
*
*: func是一个函数指针,,
* ,.
* 0,-1.
*: 0, -1.*/
extern int s_releaseNodeForCustom(s_Node *s_p_node, int (*func)(void *));
#endif /* list_simple_h */

View File

@ -6,24 +6,24 @@
#endif
/*
*
*
*/
typedef struct Node{
unsigned int type;//类型
void *value;//值指针
struct Node *next;//指向下一个节点
struct Node *last;//指向上一个节点
struct Node *next;//指向下一个链式结构节点
struct Node *last;//指向上一个链式结构节点
#ifdef id_enable
SID *s_id;
#endif
} Node;
/*
*
*
*/
typedef struct List{
Node *head;//指向第一个节点
Node *tail;//指向最后一个节点
Node *head;//指向第一个链式结构节点
Node *tail;//指向最后一个链式结构节点
uint64_t length;
#ifdef id_enable
SID *s_id;

View File

@ -33,7 +33,6 @@
#define STRING 3
#define POINTER 4
#define LIST 5
#define STACK 6
#define TREE 7
#define LIST_NODE 8
#define TREE_NODE 9
@ -43,7 +42,6 @@
#define STANDARD_DATA 13
#define DATA_FILE 14
#define MESSAGE 15
#define HOLE 16
#define ULLINT 17
@ -69,10 +67,6 @@
#define FILE_TSET_LEN 18
#define HEAD_TEST_LEN 9
#define INFO_TEST_LEN 8
#define ENABLE_LIST_QUICK 65535
#define FN_NODE_SPARE 500
#define INDEX_CHANGE_MAX 500
#define INDEX_DISTANCE_MAX 120
#define STD_TEXT_LEN 4
#define HIGH 0x3
#define STANDARD 0x2

View File

@ -9,7 +9,7 @@
@return
*/
uint64_t calListMemory(Chain * p_list){
Node *p_node = p_list->head;
CNode *p_node = p_list->head;
uint64_t nodes_size = 0LL;
uint64_t list_size = sizeof(p_list);
while(p_node != NULL){

View File

@ -187,7 +187,7 @@ inline Chain *mply_findByPointerForNode(Chain* p_list, void *temp) {
@param m_index
@return
*/
CNode *findByIndexForNode(Chain *p_list, unsigned long long m_index) {
CNode *findByIndexForNode(Chain *p_list, uint64_t m_index) {
if(p_list == NULL) return NULL;
CNode *p_node = p_list->head;
unsigned long long i;

View File

@ -21,7 +21,7 @@ int getByIntForNode(CNode *p_node) {
@return 0
*/
unsigned int getByUIntForNode(CNode *p_node){
if (p_node->type == UINT) return *(unsigned int *)(p_node->value);
if (p_node->type == UINT) return *(uint32_t *)(p_node->value);
else return 0;
}
@ -65,9 +65,9 @@ void *getByPointerForNode(CNode *p_node) {
@param p_node
@return 0
*/
unsigned long long getIndexByNode(Chain *p_list, CNode *p_node) {
uint64_t getIndexByNode(Chain *p_list, CNode *p_node) {
register CNode *t_node = p_list->head;
register unsigned long long index = 0;
register uint64_t index = 0;
while (t_node != NULL) {
// id模块可能启用的时候则编译以下代码
#ifdef id_enable
@ -78,3 +78,15 @@ unsigned long long getIndexByNode(Chain *p_list, CNode *p_node) {
}
return 0;
}
/**
@param p_list
@param p_node
@return 0
*/
extern uint64_t getIndexForNode(Chain *p_list,CNode *p_node){
return getIndexByNode(p_list, p_node);
}

View File

@ -105,13 +105,9 @@ Chain *newReturn(int if_status ,int status, char *argc, ...){
lisrtull(p_list, va_arg(args, unsigned long long));
count += 2;
}
else{
count++;
}
}
else{
lisrtu(p_list, va_arg(args, unsigned int));
else count++;
}
else lisrtu(p_list, va_arg(args, unsigned int));
break;
default:
break;
@ -130,6 +126,6 @@ Chain *newReturn(int if_status ,int status, char *argc, ...){
@return
*/
Chain *newCReturn(void){
inline Chain *newCReturn(void){
return newReturn(1, 0, NULL);
}

View File

@ -3,10 +3,10 @@
/**
@param p_node
@return
@param p_node
@return
*/
Node *copyNode(Node *p_node) {
Node *t_node = NULL;
@ -25,10 +25,10 @@ Node *copyNode(Node *p_node) {
/**
@param p_list
@return
@param p_list
@return
*/
List *copyList(List *p_list) {
Node *p_node;

View File

@ -4,11 +4,11 @@
//如果ID模块可能启用则编译以下代码
#ifdef id_enable
/**
ID查找链表中符合条件的第一个节点
ID查找链式结构中符合条件的第一个链式结构节点
@param p_list
@param p_list
@param s_id ID值
@return NULL
@return NULL
*/
Node *findByIdForNode(List *p_list, SID * s_id) {
Node *ph_node = p_list->head;
@ -39,12 +39,12 @@ Node *findByIdForNode(List *p_list, SID * s_id) {
/**
@param p_list
@param p_list
@param type
@param value
@return NULL
@return NULL
*/
Node *findByValue(List *p_list, uint type, const void *value) {
Node *p_node = p_list->head;
@ -82,12 +82,12 @@ Node *findByValue(List *p_list, uint type, const void *value) {
}
/**
@param p_list
@param p_list
@param type
@param value
@return
@return
*/
List *mply_findByValue(List *p_list, unsigned int type, const void *value) {
List *f_list = initList(0);

View File

@ -3,20 +3,20 @@
/**
@param p_list
@return
@param p_list
@return
*/
uint64_t len(List *p_list) {
return p_list->length;
}
/**
@param p_list
@return 10
@param p_list
@return 10
*/
int isListEmpty(List *p_list) {
if (p_list->head == NULL || p_list->tail == NULL)// If its head or tail is NULL,it would be thought as empty.

View File

@ -3,10 +3,10 @@
/**
@param if_sid ID
@return
@param if_sid ID
@return
*/
#ifdef id_enable
Node *initNode(_Bool if_sid)
@ -27,7 +27,7 @@ Node *initNode(void)
p_node->next = NULL;
p_node->last = NULL;
p_node->type = VOID;
// 链内存安全模式相关操作
// 链式结构内存安全模式相关操作
if (if_safeModeForNode) {
if_safeModeForNode = 0;
prec_node = initNode(0);
@ -39,10 +39,10 @@ Node *initNode(void)
}
/**
@param if_sid ID
@return
@param if_sid ID
@return
*/
#ifdef id_enable
List *initList(_Bool if_sid)
@ -73,9 +73,9 @@ List *initList(void)
}
/**
@param p_node
@param p_node
@param type
@param p_value
@return 0

View File

@ -2,10 +2,10 @@
#include <list/list.h>
/**
@param p_list
@param p_node
@param p_list
@param p_node
@return 0
*/
int insertInHead(List *p_list, Node *p_node) {
@ -24,19 +24,13 @@ int insertInHead(List *p_list, Node *p_node) {
}
/**
@param p_list
@param p_node
@param p_list
@param p_node
@return 0
*/
int insertInTail(List *p_list, Node *p_node) {
// 如果可能需要使用长链表模块则编译以下代码
/*
#ifdef list_quick_enable
if(p_list->p_lq != NULL && p_list->p_lq->if_sort) return -1;
#endif
*/
if (isListEmpty(p_list)) {
p_list->head = p_node;
p_list->tail = p_node;

View File

@ -6,7 +6,7 @@ int releaseNode(Node *p_node) {
removeByNode(node_list, p_node);
}
if (p_node->value != NULL) {
if (p_node->type != POINTER && p_node->type != HOLE) {
if (p_node->type != POINTER) {
if (p_node->type == LIST) {
releaseList((List *)p_node->value);
}

View File

@ -1,6 +1,5 @@
#include <type.h>
#include <list/list.h>
#include <chain/chain_quick.h>
static int if_safeModeForNode = 0;
static List *node_list = NULL;