diff --git a/ZE-Standard-Libraries.xcodeproj/project.pbxproj b/ZE-Standard-Libraries.xcodeproj/project.pbxproj index d7447cc..5e6b815 100644 --- a/ZE-Standard-Libraries.xcodeproj/project.pbxproj +++ b/ZE-Standard-Libraries.xcodeproj/project.pbxproj @@ -7,15 +7,11 @@ objects = { /* Begin PBXBuildFile section */ - 9233C310212292B000FB2485 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 9233C30F212292B000FB2485 /* md5.c */; }; 9269D4E8210F1B3D00161557 /* stack_expand.c in Sources */ = {isa = PBXBuildFile; fileRef = 9269D4E7210F1B3D00161557 /* stack_expand.c */; }; 9269D4EA210F1B4B00161557 /* list_expand_get.c in Sources */ = {isa = PBXBuildFile; fileRef = 9269D4E9210F1B4B00161557 /* list_expand_get.c */; }; 9269D4ED210F1B5E00161557 /* test.c in Sources */ = {isa = PBXBuildFile; fileRef = 9269D4EB210F1B5E00161557 /* test.c */; }; - 9269D4F4210F1BB000161557 /* id.c in Sources */ = {isa = PBXBuildFile; fileRef = 9269D4F2210F1BB000161557 /* id.c */; }; 9269D4F5210F1BCE00161557 /* list_info.c in Sources */ = {isa = PBXBuildFile; fileRef = 9246994F20CD000300B4E894 /* list_info.c */; }; 9269D4F6210F1CD900161557 /* stack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9246995920CE52A700B4E894 /* stack.c */; }; - 9286EB7A211400C900752977 /* error_file.c in Sources */ = {isa = PBXBuildFile; fileRef = 9286EB79211400C900752977 /* error_file.c */; }; - 9286EB7E2114022A00752977 /* communicate.c in Sources */ = {isa = PBXBuildFile; fileRef = 9286EB7D2114022A00752977 /* communicate.c */; }; 92CC992E212EF3E50060EFA5 /* list_quick.c in Sources */ = {isa = PBXBuildFile; fileRef = 92CC992D212EF3E50060EFA5 /* list_quick.c */; }; 92CC9931212EF4BF0060EFA5 /* list_sort.c in Sources */ = {isa = PBXBuildFile; fileRef = 92CC9930212EF4BF0060EFA5 /* list_sort.c */; }; 92CC9934212EF5330060EFA5 /* safe_mode.c in Sources */ = {isa = PBXBuildFile; fileRef = 92CC9933212EF5330060EFA5 /* safe_mode.c */; }; @@ -35,7 +31,11 @@ 92CC995D212F048B0060EFA5 /* list_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 92CC995C212F048B0060EFA5 /* list_copy.c */; }; 92CC995F212F04EE0060EFA5 /* list_insert.c in Sources */ = {isa = PBXBuildFile; fileRef = 92CC995E212F04EE0060EFA5 /* list_insert.c */; }; 92CC9961212F05330060EFA5 /* list_replace.c in Sources */ = {isa = PBXBuildFile; fileRef = 92CC9960212F05330060EFA5 /* list_replace.c */; }; - 92CC9969212F1DEB0060EFA5 /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 92CC9968212F1DEB0060EFA5 /* error.c */; }; + 92DE530A21CCEA430057ADCB /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 92DE530821CCEA430057ADCB /* md5.c */; }; + 92DE530B21CCEA430057ADCB /* id.c in Sources */ = {isa = PBXBuildFile; fileRef = 92DE530921CCEA430057ADCB /* id.c */; }; + 92DE530E21CCEA510057ADCB /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 92DE530C21CCEA510057ADCB /* error.c */; }; + 92DE530F21CCEA510057ADCB /* error_file.c in Sources */ = {isa = PBXBuildFile; fileRef = 92DE530D21CCEA510057ADCB /* error_file.c */; }; + 92DE531121CCEA5B0057ADCB /* communicate.c in Sources */ = {isa = PBXBuildFile; fileRef = 92DE531021CCEA5B0057ADCB /* communicate.c */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -52,7 +52,6 @@ /* Begin PBXFileReference section */ 9233C30E212292B000FB2485 /* md5.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = ""; }; - 9233C30F212292B000FB2485 /* md5.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = md5.c; path = id/md5.c; sourceTree = ""; }; 9246994F20CD000300B4E894 /* list_info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = list_info.c; sourceTree = ""; }; 9246995020CD000300B4E894 /* list_expand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = list_expand.h; sourceTree = ""; }; 9246995120CD000300B4E894 /* list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = list.h; sourceTree = ""; }; @@ -66,13 +65,10 @@ 9269D4EB210F1B5E00161557 /* test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = test.c; sourceTree = ""; }; 9269D4EC210F1B5E00161557 /* test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = test.h; sourceTree = ""; }; 9269D4F0210F1B8000161557 /* type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = type.h; sourceTree = ""; }; - 9269D4F2210F1BB000161557 /* id.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = id.c; path = id/id.c; sourceTree = ""; }; 9269D4F3210F1BB000161557 /* id.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = id.h; sourceTree = ""; }; 9269D4F7210F1D0B00161557 /* tree_expand.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tree_expand.c; sourceTree = ""; }; 9269D4F9210F1D0F00161557 /* tree_expand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tree_expand.h; sourceTree = ""; }; 927993BD20CB87D6008CE3A9 /* ZE-Standard-Libraries */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "ZE-Standard-Libraries"; sourceTree = BUILT_PRODUCTS_DIR; }; - 9286EB79211400C900752977 /* error_file.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = error_file.c; path = error/error_file.c; sourceTree = ""; }; - 9286EB7D2114022A00752977 /* communicate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 0; name = communicate.c; path = communicate/communicate.c; sourceTree = ""; }; 9286EB7F2114022F00752977 /* communicate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = communicate.h; sourceTree = ""; }; 92CC992D212EF3E50060EFA5 /* list_quick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = list_quick.c; sourceTree = ""; }; 92CC992F212EF4340060EFA5 /* list_quick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = list_quick.h; sourceTree = ""; }; @@ -102,7 +98,11 @@ 92CC9960212F05330060EFA5 /* list_replace.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = list_replace.c; sourceTree = ""; }; 92CC9966212F11920060EFA5 /* stack_type.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stack_type.h; sourceTree = ""; }; 92CC9967212F17C70060EFA5 /* error_file.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = error_file.h; sourceTree = ""; }; - 92CC9968212F1DEB0060EFA5 /* error.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = error.c; path = error/error.c; sourceTree = ""; }; + 92DE530821CCEA430057ADCB /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = md5.c; path = src/id/md5.c; sourceTree = ""; }; + 92DE530921CCEA430057ADCB /* id.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = id.c; path = src/id/id.c; sourceTree = ""; }; + 92DE530C21CCEA510057ADCB /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = error.c; path = src/error/error.c; sourceTree = ""; }; + 92DE530D21CCEA510057ADCB /* error_file.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = error_file.c; path = src/error/error_file.c; sourceTree = ""; }; + 92DE531021CCEA5B0057ADCB /* communicate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = communicate.c; path = src/communicate/communicate.c; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -119,27 +119,27 @@ 9246994E20CD000300B4E894 /* list */ = { isa = PBXGroup; children = ( - 9246994F20CD000300B4E894 /* list_info.c */, - 9269D4E9210F1B4B00161557 /* list_expand_get.c */, - 92CC992D212EF3E50060EFA5 /* list_quick.c */, - 92CC9930212EF4BF0060EFA5 /* list_sort.c */, - 92CC9933212EF5330060EFA5 /* safe_mode.c */, - 92CC9936212EF60A0060EFA5 /* list_print.c */, - 92CC9939212EF62A0060EFA5 /* list_simple.c */, - 92CC9942212EFE7E0060EFA5 /* list_expand_find.c */, + 92CC995C212F048B0060EFA5 /* list_copy.c */, + 92CC9951212F02200060EFA5 /* list_expand_calculate.c */, 92CC9945212EFEF70060EFA5 /* list_expand_callback.c */, 92CC9948212EFF6F0060EFA5 /* list_expand_complex.c */, + 92CC9942212EFE7E0060EFA5 /* list_expand_find.c */, + 9269D4E9210F1B4B00161557 /* list_expand_get.c */, 92CC994B212F00030060EFA5 /* list_expand_node.c */, 92CC994D212F003F0060EFA5 /* list_expand_update.c */, - 92CC994F212F014A0060EFA5 /* list_simple_node.c */, - 92CC9951212F02200060EFA5 /* list_expand_calculate.c */, 92CC9953212F03190060EFA5 /* list_find.c */, + 9246994F20CD000300B4E894 /* list_info.c */, 92CC9955212F037F0060EFA5 /* list_init.c */, + 92CC995E212F04EE0060EFA5 /* list_insert.c */, + 92CC9936212EF60A0060EFA5 /* list_print.c */, + 92CC992D212EF3E50060EFA5 /* list_quick.c */, 92CC9958212F03CB0060EFA5 /* list_release.c */, 92CC995A212F042E0060EFA5 /* list_remove.c */, - 92CC995C212F048B0060EFA5 /* list_copy.c */, - 92CC995E212F04EE0060EFA5 /* list_insert.c */, 92CC9960212F05330060EFA5 /* list_replace.c */, + 92CC994F212F014A0060EFA5 /* list_simple_node.c */, + 92CC9939212EF62A0060EFA5 /* list_simple.c */, + 92CC9930212EF4BF0060EFA5 /* list_sort.c */, + 92CC9933212EF5330060EFA5 /* safe_mode.c */, ); path = list; sourceTree = ""; @@ -166,25 +166,21 @@ 9269D4F1210F1B9E00161557 /* id */ = { isa = PBXGroup; children = ( - 9269D4F2210F1BB000161557 /* id.c */, - 9233C30F212292B000FB2485 /* md5.c */, + 92DE530921CCEA430057ADCB /* id.c */, + 92DE530821CCEA430057ADCB /* md5.c */, ); name = id; + path = ..; sourceTree = ""; }; 927993B420CB87D6008CE3A9 = { isa = PBXGroup; children = ( + 92DE530721CCE96D0057ADCB /* documents */, + 92DE530621CCE9280057ADCB /* bin */, + 92DE530521CCE91B0057ADCB /* test */, + 92DE530421CCE90B0057ADCB /* src */, 92CC993B212EF7400060EFA5 /* include */, - 92A15CFC211442C700826FB8 /* graph */, - 9286EB7C2114021E00752977 /* communicate */, - 9286EB78211400BD00752977 /* error */, - 9269D4F1210F1B9E00161557 /* id */, - 9246995C20CE654600B4E894 /* tree */, - 9246995720CE507900B4E894 /* stack */, - 9246994E20CD000300B4E894 /* list */, - 9269D4EB210F1B5E00161557 /* test.c */, - 9269D4EC210F1B5E00161557 /* test.h */, 927993BE20CB87D6008CE3A9 /* Products */, ); sourceTree = ""; @@ -200,18 +196,20 @@ 9286EB78211400BD00752977 /* error */ = { isa = PBXGroup; children = ( - 9286EB79211400C900752977 /* error_file.c */, - 92CC9968212F1DEB0060EFA5 /* error.c */, + 92DE530D21CCEA510057ADCB /* error_file.c */, + 92DE530C21CCEA510057ADCB /* error.c */, ); name = error; + path = ..; sourceTree = ""; }; 9286EB7C2114021E00752977 /* communicate */ = { isa = PBXGroup; children = ( - 9286EB7D2114022A00752977 /* communicate.c */, + 92DE531021CCEA5B0057ADCB /* communicate.c */, ); name = communicate; + path = ..; sourceTree = ""; }; 92A15CFC211442C700826FB8 /* graph */ = { @@ -219,6 +217,7 @@ children = ( ); name = graph; + path = ..; sourceTree = ""; }; 92CC993B212EF7400060EFA5 /* include */ = { @@ -294,6 +293,43 @@ path = communicate; sourceTree = ""; }; + 92DE530421CCE90B0057ADCB /* src */ = { + isa = PBXGroup; + children = ( + 92A15CFC211442C700826FB8 /* graph */, + 9286EB7C2114021E00752977 /* communicate */, + 9286EB78211400BD00752977 /* error */, + 9269D4F1210F1B9E00161557 /* id */, + 9246995C20CE654600B4E894 /* tree */, + 9246995720CE507900B4E894 /* stack */, + 9246994E20CD000300B4E894 /* list */, + ); + path = src; + sourceTree = ""; + }; + 92DE530521CCE91B0057ADCB /* test */ = { + isa = PBXGroup; + children = ( + 9269D4EB210F1B5E00161557 /* test.c */, + 9269D4EC210F1B5E00161557 /* test.h */, + ); + path = test; + sourceTree = ""; + }; + 92DE530621CCE9280057ADCB /* bin */ = { + isa = PBXGroup; + children = ( + ); + path = bin; + sourceTree = ""; + }; + 92DE530721CCE96D0057ADCB /* documents */ = { + isa = PBXGroup; + children = ( + ); + path = documents; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -350,32 +386,32 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 92DE530A21CCEA430057ADCB /* md5.c in Sources */, 92CC9931212EF4BF0060EFA5 /* list_sort.c in Sources */, - 9233C310212292B000FB2485 /* md5.c in Sources */, 92CC9961212F05330060EFA5 /* list_replace.c in Sources */, 9269D4F6210F1CD900161557 /* stack.c in Sources */, 92CC9959212F03CB0060EFA5 /* list_release.c in Sources */, 92CC993A212EF62A0060EFA5 /* list_simple.c in Sources */, - 9286EB7A211400C900752977 /* error_file.c in Sources */, 92CC992E212EF3E50060EFA5 /* list_quick.c in Sources */, 92CC9943212EFE7E0060EFA5 /* list_expand_find.c in Sources */, 9269D4E8210F1B3D00161557 /* stack_expand.c in Sources */, + 92DE530F21CCEA510057ADCB /* error_file.c in Sources */, 92CC9937212EF60A0060EFA5 /* list_print.c in Sources */, + 92DE530E21CCEA510057ADCB /* error.c in Sources */, 92CC994C212F00030060EFA5 /* list_expand_node.c in Sources */, + 92DE531121CCEA5B0057ADCB /* communicate.c in Sources */, 92CC9956212F037F0060EFA5 /* list_init.c in Sources */, 92CC9954212F03190060EFA5 /* list_find.c in Sources */, 92CC9949212EFF6F0060EFA5 /* list_expand_complex.c in Sources */, 92CC995D212F048B0060EFA5 /* list_copy.c in Sources */, - 9286EB7E2114022A00752977 /* communicate.c in Sources */, + 92DE530B21CCEA430057ADCB /* id.c in Sources */, 9269D4EA210F1B4B00161557 /* list_expand_get.c in Sources */, - 9269D4F4210F1BB000161557 /* id.c in Sources */, 9269D4ED210F1B5E00161557 /* test.c in Sources */, 9269D4F5210F1BCE00161557 /* list_info.c in Sources */, 92CC9952212F02200060EFA5 /* list_expand_calculate.c in Sources */, 92CC9946212EFEF70060EFA5 /* list_expand_callback.c in Sources */, 92CC9950212F014A0060EFA5 /* list_simple_node.c in Sources */, 92CC9934212EF5330060EFA5 /* safe_mode.c in Sources */, - 92CC9969212F1DEB0060EFA5 /* error.c in Sources */, 92CC995B212F042E0060EFA5 /* list_remove.c in Sources */, 92CC994E212F003F0060EFA5 /* list_expand_update.c in Sources */, 92CC995F212F04EE0060EFA5 /* list_insert.c in Sources */, @@ -500,6 +536,7 @@ CODE_SIGN_STYLE = Automatic; COPY_HEADERS_RUN_UNIFDEF = NO; HEADER_SEARCH_PATHS = "\"$(SRCROOT)/include\"/**"; + LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/bin\"/**"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -510,6 +547,7 @@ CODE_SIGN_STYLE = Automatic; COPY_HEADERS_RUN_UNIFDEF = NO; HEADER_SEARCH_PATHS = "\"$(SRCROOT)/include\"/**"; + LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/bin\"/**"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 7d471f5..b6f7cc9 100644 --- a/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -147,22 +147,6 @@ landmarkType = "9"> - - - - @@ -557,11 +541,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.101581" + timestampString = "566967242.118185" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "165" - endingLineNumber = "165" + startingLineNumber = "166" + endingLineNumber = "166" landmarkName = "__CALLBACK_DEFINE" landmarkType = "9"> @@ -573,11 +557,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.1016541" + timestampString = "566967242.1185679" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "281" - endingLineNumber = "281" + startingLineNumber = "282" + endingLineNumber = "282" landmarkName = "__CALLBACK_DEFINE" landmarkType = "9"> @@ -589,13 +573,13 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.101725" + timestampString = "566967242.118932" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "273" - endingLineNumber = "273" - landmarkName = "releaseDFile" - landmarkType = "9"> + startingLineNumber = "274" + endingLineNumber = "274" + landmarkName = "unknown" + landmarkType = "0"> @@ -621,11 +605,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.101868" + timestampString = "566967242.1196409" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "96" - endingLineNumber = "96" + startingLineNumber = "97" + endingLineNumber = "97" landmarkName = "initStandardData" landmarkType = "9"> @@ -637,11 +621,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.101934" + timestampString = "566967242.119988" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "167" - endingLineNumber = "167" + startingLineNumber = "168" + endingLineNumber = "168" landmarkName = "__CALLBACK_DEFINE" landmarkType = "9"> @@ -669,11 +653,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.102102" + timestampString = "566967242.120361" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "65" - endingLineNumber = "65" + startingLineNumber = "66" + endingLineNumber = "66" landmarkName = "initStandardDBlocks" landmarkType = "9"> @@ -685,11 +669,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.10221" + timestampString = "566967242.1207041" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "104" - endingLineNumber = "104" + startingLineNumber = "105" + endingLineNumber = "105" landmarkName = "initStandardData" landmarkType = "9"> @@ -701,11 +685,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.102289" + timestampString = "566967242.121045" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "208" - endingLineNumber = "208" + startingLineNumber = "209" + endingLineNumber = "209" landmarkName = "__CALLBACK_DEFINE" landmarkType = "9"> @@ -717,11 +701,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.102362" + timestampString = "566967242.121385" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "189" - endingLineNumber = "189" + startingLineNumber = "190" + endingLineNumber = "190" landmarkName = "__CALLBACK_DEFINE" landmarkType = "9"> @@ -733,13 +717,13 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.102428" + timestampString = "566967242.121727" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "191" - endingLineNumber = "191" - landmarkName = "unknown" - landmarkType = "0"> + startingLineNumber = "192" + endingLineNumber = "192" + landmarkName = "__CALLBACK_DEFINE" + landmarkType = "9"> - - - - - - - - + + + + + + + + + startingLineNumber = "111" + endingLineNumber = "111"> - - - - @@ -905,11 +873,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.103106" + timestampString = "566967242.123542" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "367" - endingLineNumber = "367" + startingLineNumber = "356" + endingLineNumber = "356" landmarkName = "unknown" landmarkType = "0"> @@ -921,11 +889,27 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.1031719" + timestampString = "566967242.123886" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "377" - endingLineNumber = "377" + startingLineNumber = "368" + endingLineNumber = "368" + landmarkName = "unknown" + landmarkType = "0"> + + + + @@ -937,11 +921,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.103237" + timestampString = "566967242.1245739" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "359" - endingLineNumber = "359" + startingLineNumber = "360" + endingLineNumber = "360" landmarkName = "unknown" landmarkType = "0"> @@ -953,11 +937,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.103299" + timestampString = "566967242.125172" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "386" - endingLineNumber = "386" + startingLineNumber = "387" + endingLineNumber = "387" landmarkName = "readDataFileInfo" landmarkType = "9"> @@ -985,27 +969,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.103398" + timestampString = "566967242.125859" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "159" - endingLineNumber = "159" - landmarkName = "dataFileWriteIn" - landmarkType = "9"> - - - - @@ -1017,71 +985,7 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.10353" - startingColumnNumber = "9223372036854775807" - endingColumnNumber = "9223372036854775807" - startingLineNumber = "371" - endingLineNumber = "371" - landmarkName = "unknown" - landmarkType = "0"> - - - - - - - - - - - - - - - - @@ -1113,11 +1017,91 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.103917" + timestampString = "566967242.127499" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "381" - endingLineNumber = "381" + startingLineNumber = "370" + endingLineNumber = "370" + landmarkName = "unknown" + landmarkType = "0"> + + + + + + + + + + + + + + + + + + + + @@ -1145,11 +1129,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.1040421" + timestampString = "566967242.13007" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "416" - endingLineNumber = "416" + startingLineNumber = "417" + endingLineNumber = "417" landmarkName = "readStandardData" landmarkType = "9"> @@ -1161,11 +1145,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.104105" + timestampString = "566967242.130564" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "385" - endingLineNumber = "385" + startingLineNumber = "386" + endingLineNumber = "386" landmarkName = "readDataFileInfo" landmarkType = "9"> @@ -1177,11 +1161,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.1041681" + timestampString = "566967242.131088" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "138" - endingLineNumber = "138" + startingLineNumber = "139" + endingLineNumber = "139" landmarkName = "initDataFileForRead" landmarkType = "9"> @@ -1193,11 +1177,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.10423" + timestampString = "566967242.131614" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "391" - endingLineNumber = "391" + startingLineNumber = "392" + endingLineNumber = "392" landmarkName = "readDataFileInfo" landmarkType = "9"> @@ -1209,23 +1193,7 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.104292" - startingColumnNumber = "9223372036854775807" - endingColumnNumber = "9223372036854775807" - startingLineNumber = "145" - endingLineNumber = "145" - landmarkName = "dataFileAddStandardData" - landmarkType = "9"> - - - - + + + + @@ -1287,11 +1271,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.104582" + timestampString = "566967242.134397" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "460" - endingLineNumber = "460" + startingLineNumber = "461" + endingLineNumber = "461" landmarkName = "printStandardData" landmarkType = "9"> @@ -1303,11 +1287,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.104646" + timestampString = "566967242.134836" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "406" - endingLineNumber = "406" + startingLineNumber = "407" + endingLineNumber = "407" landmarkName = "readStandardData" landmarkType = "9"> @@ -1319,11 +1303,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.10471" + timestampString = "566967242.135197" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "412" - endingLineNumber = "412" + startingLineNumber = "413" + endingLineNumber = "413" landmarkName = "readStandardData" landmarkType = "9"> @@ -1335,11 +1319,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.104777" + timestampString = "566967242.1355489" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "287" - endingLineNumber = "287" + startingLineNumber = "288" + endingLineNumber = "288" landmarkName = "__CALLBACK_DEFINE" landmarkType = "9"> @@ -1351,11 +1335,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.104844" + timestampString = "566967242.135901" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "277" - endingLineNumber = "277" + startingLineNumber = "278" + endingLineNumber = "278" landmarkName = "standardDataToList" landmarkType = "9"> @@ -1367,7 +1351,23 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.104982" + timestampString = "566967242.136245" + startingColumnNumber = "9223372036854775807" + endingColumnNumber = "9223372036854775807" + startingLineNumber = "428" + endingLineNumber = "428" + landmarkName = "readStandardData" + landmarkType = "9"> + + + + - - - - @@ -1415,11 +1399,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.105185" + timestampString = "566967242.137645" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "442" - endingLineNumber = "442" + startingLineNumber = "443" + endingLineNumber = "443" landmarkName = "readStandardData" landmarkType = "9"> @@ -1431,11 +1415,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.105251" + timestampString = "566967242.138097" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "285" - endingLineNumber = "285" + startingLineNumber = "286" + endingLineNumber = "286" landmarkName = "__CALLBACK_DEFINE" landmarkType = "9"> @@ -1479,31 +1463,15 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "communicate/communicate.c" - timestampString = "556736003.10543" + timestampString = "566967242.138545" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "328" - endingLineNumber = "328" + startingLineNumber = "329" + endingLineNumber = "329" landmarkName = "__CALLBACK_DEFINE" landmarkType = "9"> - - - - - - - - - - - - - - - - diff --git a/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcschemes/xcschememanagement.plist b/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcschemes/xcschememanagement.plist index 2045221..c2e0451 100644 --- a/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcschemes/xcschememanagement.plist @@ -9,6 +9,11 @@ orderHint 0 + ZE-Standard-Libraries.xcscheme_^#shared#^_ + + orderHint + 0 + diff --git a/include/communicate/communicate.h b/include/communicate/communicate.h index 33cbdd8..4136b86 100644 --- a/include/communicate/communicate.h +++ b/include/communicate/communicate.h @@ -6,7 +6,7 @@ */ typedef struct file_head{ char head_test[18];//数据文件头部的验证信息 - unsigned long long data_num;//数据文件中的标准数据结构的数目 + uint32_t data_num;//数据文件中的标准数据结构的数目 }F_HEAD; /* @@ -22,8 +22,8 @@ typedef struct data_file{ *标准数据结构的管理及操作的结构 */ typedef struct standard_data_blocks{ - unsigned int type;//数据块的类型 - unsigned long long location;//数据块在数据文件中的定位 + uint16_t type;//数据块的类型 + uint32_t location;//数据块在数据文件中的定位 char *sid;//数据块的ID _Bool if_data;//数据块是否赋值 unsigned int blocks_num;//数据块字节大小 @@ -34,7 +34,7 @@ typedef struct standard_data_blocks{ *标准数据结构中数据块的连接关系的管理及操作的结构 */ typedef struct standard_data_connection{ - unsigned long long location;//数据块链接关系结构在文件中的定位 + uint32_t location;//数据块链接关系结构在文件中的定位 char *f_sid;//前一个数据块的ID char *s_sid;//后一个数据块的ID }STD_CTN; @@ -43,8 +43,8 @@ typedef struct standard_data_connection{ *标准数据结构头的管理及操作的结构 */ typedef struct standard_data_head{ - unsigned long long data_blk_num;//数据块的数目 - unsigned long long data_ctn_num;//数据块链接关系结构的数目 + uint32_t data_blk_num;//数据块的数目 + uint32_t data_ctn_num;//数据块链接关系结构的数目 }STD_HEAD; /* @@ -53,9 +53,9 @@ typedef struct standard_data_head{ typedef struct standard_data{ SID *s_id;//标准数据结构的ID int read_data;//标准数据结构是否已经读取完整 - unsigned int type;//标准数据结构所对应的类型 - unsigned long long size;//标准数据结构在数据文件中的大小 - unsigned long long location;//标准数据结构的头在数据文件中的定位 + uint16_t type;//标准数据结构所对应的类型 + uint32_t size;//标准数据结构在数据文件中的大小 + uint32_t location;//标准数据结构的头在数据文件中的定位 _Bool lock;//标准数据文件是否被锁住 List *pd_blocklst;//数据块储存链表 List *pd_ctnlst;//数据块连接关系结构的储存链表 @@ -98,7 +98,7 @@ extern D_FILE *initDataFileForRead(char *route); *参数: type指示数据块储存数据的数据类型,data_size指示数据块储存数据的大小 *返回: 处理成功则返回指向相关结构体所在内存空间的指针,不成功则返回NULL. */ -extern STD_BLOCKS *initStandardDBlocks(SID *p_sid, unsigned int type, unsigned long long data_size); +extern STD_BLOCKS *initStandardDBlocks(SID *p_sid, uint16_t type, uint32_t data_size); /* *初始化数据块链接关系管理结构 @@ -113,7 +113,7 @@ extern STD_CTN *initStandardDConnection(SID *f_sid, SID *s_sid); 若s_id为NULL,则另外分配一个ID.为了方便管理,标准数据结构必须有ID. *返回: 处理成功则返回指向相关结构体所在内存空间的指针,不成功则返回NULL. */ -extern STD_DATA *initStandardData(unsigned int type, SID *s_id); +extern STD_DATA *initStandardData(uint16_t type, SID *s_id); @@ -141,7 +141,7 @@ extern int dataFileAddStandardData(D_FILE *p_dfile, STD_DATA *p_std); *参数: type指示所添加数据的数据类型, data为指向所添加数据所在内存空间的指针, data_size指示所添加数据的大小 *返回: 处理成功则返回0,不成功则返回-1. */ -extern int standardDataAddBlock(STD_DATA *p_std, SID *p_sid ,unsigned int type, void *data, unsigned long long data_size); +extern int standardDataAddBlock(STD_DATA *p_std, SID *p_sid ,uint16_t type, void *data, uint32_t data_size); /* *为标准数据结构添加数据块链接关系结构体 diff --git a/include/list/list_type.h b/include/list/list_type.h index 94a9881..b0a8786 100644 --- a/include/list/list_type.h +++ b/include/list/list_type.h @@ -9,7 +9,9 @@ *节点的管理及操作的结构 */ typedef struct Node{ +#ifdef list_quick_enable unsigned long long f_number;//长链表模式下,分派的数组节点编号 +#endif unsigned int type;//类型 void *value;//值指针 struct Node *next;//指向下一个节点 diff --git a/include/type.h b/include/type.h index 55c48eb..da588d2 100644 --- a/include/type.h +++ b/include/type.h @@ -11,13 +11,14 @@ #include #include #include +#include -/* +#ifdef UNIX #include #include #include #include -*/ +#endif diff --git a/list/list_copy.c b/src/list/list_copy.c similarity index 83% rename from list/list_copy.c rename to src/list/list_copy.c index 73edce2..99f64f8 100644 --- a/list/list_copy.c +++ b/src/list/list_copy.c @@ -1,8 +1,16 @@ #include #include + +/** + 以一个已存在的节点为模板创建一个新的节点 + + @param p_node 指向作为模板的节点的指针 + @return 返回指向新的节点的指针 + */ Node *copyNode(Node *p_node) { Node *t_node = NULL; +//当开启ID模块的时候编译 #ifdef id_enable if (p_node->s_id == NULL) t_node = initNode(0); else t_node = initNode(p_node->s_id->deep); @@ -12,7 +20,9 @@ Node *copyNode(Node *p_node) { t_node->next = p_node->next; t_node->type = p_node->type; t_node->value = p_node->value; +#ifdef list_quick_enable t_node->f_number = p_node->f_number; +#endif return t_node; } diff --git a/list/list_expand_calculate.c b/src/list/list_expand_calculate.c similarity index 63% rename from list/list_expand_calculate.c rename to src/list/list_expand_calculate.c index ebfc7bf..b685233 100644 --- a/list/list_expand_calculate.c +++ b/src/list/list_expand_calculate.c @@ -1,6 +1,12 @@ #include #include +/** + 计算链表占用的内存空间大小,以字节为单位输出。 + + @param p_list 指向目标链表的指针 + @return 以字节为单位返回链表及链表内包含的节点所占的内存空间 + */ unsigned long long calListMemory(List * p_list){ Node *p_node = p_list->head; unsigned long long nodes_size = 0LL; diff --git a/list/list_expand_callback.c b/src/list/list_expand_callback.c similarity index 100% rename from list/list_expand_callback.c rename to src/list/list_expand_callback.c diff --git a/list/list_expand_complex.c b/src/list/list_expand_complex.c similarity index 100% rename from list/list_expand_complex.c rename to src/list/list_expand_complex.c diff --git a/list/list_expand_find.c b/src/list/list_expand_find.c similarity index 100% rename from list/list_expand_find.c rename to src/list/list_expand_find.c diff --git a/list/list_expand_get.c b/src/list/list_expand_get.c similarity index 95% rename from list/list_expand_get.c rename to src/list/list_expand_get.c index 767d3ef..dbb9347 100644 --- a/list/list_expand_get.c +++ b/src/list/list_expand_get.c @@ -1,24 +1,26 @@ #include #include #include + #ifdef list_quick_enable #include -#endif - -char *getByStringForNode(Node *p_node) { - if (p_node->type == STRING) return (char *)(p_node->value); - else return NULL; -} - -double getByDoubleForNode(Node *p_node) { - if (p_node->type == DOUBLE) return *(double *)(p_node->value); - else return -1; -} - -void *getByPointerForNode(Node *p_node) { - return (void *)(p_node->value); -} - +#endif + +/*直接获得节点中储存的字符串值*/ +char *getByStringForNode(Node *p_node) { + if (p_node->type == STRING) return (char *)(p_node->value); + else return NULL; +} + +double getByDoubleForNode(Node *p_node) { + if (p_node->type == DOUBLE) return *(double *)(p_node->value); + else return -1; +} + +void *getByPointerForNode(Node *p_node) { + return (void *)(p_node->value); +} + unsigned long long getIndexByNode(List *p_list, Node *p_node) { #ifdef list_quick_enable if (p_list->p_lq != NULL){ @@ -26,15 +28,15 @@ unsigned long long getIndexByNode(List *p_list, Node *p_node) { register Node *rp_node = p_node; for (register int i = 0; i < p_list->length; i++) if (p_fn_node[i] == rp_node) return i; } -#endif - register Node *t_node = p_list->head; - register unsigned long long index = 0; +#endif + register Node *t_node = p_list->head; + register unsigned long long index = 0; while (t_node != NULL) { -#ifdef id_enable +#ifdef id_enable if (p_node->s_id == t_node->s_id) return index; -#endif - index++; - t_node = t_node->next; - } - return 0; +#endif + index++; + t_node = t_node->next; + } + return 0; } diff --git a/list/list_expand_node.c b/src/list/list_expand_node.c similarity index 100% rename from list/list_expand_node.c rename to src/list/list_expand_node.c diff --git a/list/list_expand_update.c b/src/list/list_expand_update.c similarity index 100% rename from list/list_expand_update.c rename to src/list/list_expand_update.c diff --git a/list/list_find.c b/src/list/list_find.c similarity index 100% rename from list/list_find.c rename to src/list/list_find.c diff --git a/list/list_info.c b/src/list/list_info.c similarity index 100% rename from list/list_info.c rename to src/list/list_info.c diff --git a/list/list_init.c b/src/list/list_init.c similarity index 100% rename from list/list_init.c rename to src/list/list_init.c diff --git a/list/list_insert.c b/src/list/list_insert.c similarity index 100% rename from list/list_insert.c rename to src/list/list_insert.c diff --git a/list/list_print.c b/src/list/list_print.c similarity index 100% rename from list/list_print.c rename to src/list/list_print.c diff --git a/list/list_quick.c b/src/list/list_quick.c similarity index 100% rename from list/list_quick.c rename to src/list/list_quick.c diff --git a/list/list_release.c b/src/list/list_release.c similarity index 100% rename from list/list_release.c rename to src/list/list_release.c diff --git a/list/list_remove.c b/src/list/list_remove.c similarity index 100% rename from list/list_remove.c rename to src/list/list_remove.c diff --git a/list/list_replace.c b/src/list/list_replace.c similarity index 100% rename from list/list_replace.c rename to src/list/list_replace.c diff --git a/list/list_simple.c b/src/list/list_simple.c similarity index 100% rename from list/list_simple.c rename to src/list/list_simple.c diff --git a/list/list_simple_node.c b/src/list/list_simple_node.c similarity index 100% rename from list/list_simple_node.c rename to src/list/list_simple_node.c diff --git a/list/list_sort.c b/src/list/list_sort.c similarity index 100% rename from list/list_sort.c rename to src/list/list_sort.c diff --git a/list/safe_mode.c b/src/list/safe_mode.c similarity index 100% rename from list/safe_mode.c rename to src/list/safe_mode.c diff --git a/stack/stack.c b/src/stack/stack.c similarity index 99% rename from stack/stack.c rename to src/stack/stack.c index 1f760e6..ad66956 100644 --- a/stack/stack.c +++ b/src/stack/stack.c @@ -71,4 +71,4 @@ int initMallocValueForSNode(SNode *p_snode, unsigned int type, void *value) { p_snode->type = type; p_snode->value = value; return 0; -} +} diff --git a/stack/stack_expand.c b/src/stack/stack_expand.c similarity index 96% rename from stack/stack_expand.c rename to src/stack/stack_expand.c index e4079eb..39287fd 100644 --- a/stack/stack_expand.c +++ b/src/stack/stack_expand.c @@ -1,62 +1,62 @@ #include #include -#include - -SNode *snodeWithInt(int temp) { - SNode *p_snode = initSNode(); +#include + +SNode *snodeWithInt(int temp) { + SNode *p_snode = initSNode(); int *p_temp = (int *)malloc(sizeof(int)); if(p_temp == NULL){ return NULL; - } - *p_temp = temp; - initMallocValueForSNode(p_snode, INT, p_temp); - return p_snode; -} - -SNode *snodeWithDouble(double temp) { - SNode *p_snode = initSNode(); + } + *p_temp = temp; + initMallocValueForSNode(p_snode, INT, p_temp); + return p_snode; +} + +SNode *snodeWithDouble(double temp) { + SNode *p_snode = initSNode(); double *p_temp = (double *)malloc(sizeof(double)); if(p_temp == NULL){ return NULL; - } - *p_temp = temp; - initMallocValueForSNode(p_snode, DOUBLE, p_temp); - return p_snode; -} - -SNode *snodeWithString(char *temp) { - SNode *p_snode = initSNode(); + } + *p_temp = temp; + initMallocValueForSNode(p_snode, DOUBLE, p_temp); + return p_snode; +} + +SNode *snodeWithString(char *temp) { + SNode *p_snode = initSNode(); char *p_temp = (char *)malloc(sizeof(char)*(strlen(temp) + 1)); if(p_temp == NULL){ return NULL; - } - strcpy(p_temp, temp); - initMallocValueForSNode(p_snode, STRING, p_temp); - return p_snode; -} - -SNode *snodeWithPointer(void *temp) { - SNode *p_snode = initSNode(); - initMallocValueForSNode(p_snode, POINTER, temp); - return p_snode; -} - -int getValueByIntForSNode(SNode *p_snode) { - if (p_snode->type == INT) return *(int *)p_snode->value; - else return -1; -} - -double getValueByDoubleForSNode(SNode *p_snode) { - if (p_snode->type == DOUBLE) return *(double *)p_snode->value; - else return -1; -} - -char *getValueByStringForSNode(SNode *p_snode) { - if (p_snode->type == STRING) return (char *)p_snode->value; - else return NULL; -} - -void *getValueByPointerForSNode(SNode *p_snode) { - if (p_snode->type == POINTER) return (void *)p_snode->value; - else return NULL; -} + } + strcpy(p_temp, temp); + initMallocValueForSNode(p_snode, STRING, p_temp); + return p_snode; +} + +SNode *snodeWithPointer(void *temp) { + SNode *p_snode = initSNode(); + initMallocValueForSNode(p_snode, POINTER, temp); + return p_snode; +} + +int getValueByIntForSNode(SNode *p_snode) { + if (p_snode->type == INT) return *(int *)p_snode->value; + else return -1; +} + +double getValueByDoubleForSNode(SNode *p_snode) { + if (p_snode->type == DOUBLE) return *(double *)p_snode->value; + else return -1; +} + +char *getValueByStringForSNode(SNode *p_snode) { + if (p_snode->type == STRING) return (char *)p_snode->value; + else return NULL; +} + +void *getValueByPointerForSNode(SNode *p_snode) { + if (p_snode->type == POINTER) return (void *)p_snode->value; + else return NULL; +} diff --git a/tree/tree.c b/src/tree/tree.c similarity index 96% rename from tree/tree.c rename to src/tree/tree.c index 87794fa..87e5e51 100644 --- a/tree/tree.c +++ b/src/tree/tree.c @@ -1,497 +1,497 @@ -#include"tree.h" - -static int if_safeModeForTree = 0; - -int safeModeForTree(int ifon) { - if (ifon == 1) { - if (tnode_list == NULL && tree_list == NULL) { +#include"tree.h" + +static int if_safeModeForTree = 0; + +int safeModeForTree(int ifon) { + if (ifon == 1) { + if (tnode_list == NULL && tree_list == NULL) { tnode_list = (List *)malloc(sizeof(List)); if(tnode_list == NULL){ showError(pushError(TREE_NODE, HIGH, initInfo("safeModeForTree()", "Error in get the memory of tnode_list."))); return -1; - } - tree_list = (List *)malloc(sizeof(List)); + } + tree_list = (List *)malloc(sizeof(List)); if(tree_list == NULL){ showError(pushError(TREE_NODE, HIGH, initInfo("safeModeForTree()", "Error in get the memory of tree_list."))); return -1; - } - tree_list->head = NULL; - tree_list->length = 0; - tree_list->tail = NULL; - - tnode_list->head = NULL; - tnode_list->length = 0; - tnode_list->tail = NULL; - - if_safeModeForTree = 1; - } - else { - return -1; - } - } - - return ifon; -} - -TNode *initTNode(void) { - Node *s_node; + } + tree_list->head = NULL; + tree_list->length = 0; + tree_list->tail = NULL; + + tnode_list->head = NULL; + tnode_list->length = 0; + tnode_list->tail = NULL; + + if_safeModeForTree = 1; + } + else { + return -1; + } + } + + return ifon; +} + +TNode *initTNode(void) { + Node *s_node; TNode *p_tnode = (TNode *)malloc(sizeof(TNode)); if(p_tnode == NULL){ showError(pushError(TREE_NODE, STANDARD, initInfo("initTNode()", "Error in getting the memory of tnode."))); return NULL; } p_tnode->s_id = getS_id(TREE_NODE, 1); - p_tnode->if_sid = 1; - p_tnode->child_num = 0; - p_tnode->father = NULL; - p_tnode->if_malloc = 0; - p_tnode->value = NULL; - p_tnode->type = VOID; - p_tnode->home = initList(); - p_tnode->room = NULL; - if (if_safeModeForTree) { - if (if_safeModeForNode) { - if_safeModeForNode = 0; - s_node = initNode(); - initMallocValueForNode(s_node, POINTER, (void *)p_tnode); - insertInTail(tnode_list, s_node); - if_safeModeForNode = 1; - } - else - { - s_node = initNode(); - initMallocValueForNode(s_node, POINTER, (void *)p_tnode); - insertInTail(tnode_list, s_node); - } - } - return p_tnode; -} - -Tree *initTree(void) { - Node *s_node; + p_tnode->if_sid = 1; + p_tnode->child_num = 0; + p_tnode->father = NULL; + p_tnode->if_malloc = 0; + p_tnode->value = NULL; + p_tnode->type = VOID; + p_tnode->home = initList(); + p_tnode->room = NULL; + if (if_safeModeForTree) { + if (if_safeModeForNode) { + if_safeModeForNode = 0; + s_node = initNode(); + initMallocValueForNode(s_node, POINTER, (void *)p_tnode); + insertInTail(tnode_list, s_node); + if_safeModeForNode = 1; + } + else + { + s_node = initNode(); + initMallocValueForNode(s_node, POINTER, (void *)p_tnode); + insertInTail(tnode_list, s_node); + } + } + return p_tnode; +} + +Tree *initTree(void) { + Node *s_node; Tree *p_tree = (Tree *)malloc(sizeof(Tree)); if(p_tree == NULL){ showError(pushError(TREE, STANDARD, initInfo("initTree()", "Error in getting the memory of tree."))); return NULL; } p_tree->s_id = getS_id(TREE, 1); - p_tree->if_sid = 1; - p_tree->root = NULL; - if (if_safeModeForTree) { - if (if_safeModeForNode) { - if_safeModeForNode = 0; - s_node = initNode(); - initMallocValueForNode(s_node, POINTER, (void *)p_tree); - if_safeModeForNode = 1; - insertInTail(tree_list, s_node); - } - else - { - s_node = initNode(); - initMallocValueForNode(s_node, POINTER, (void *)p_tree); - insertInTail(tree_list, s_node); - } - } - return p_tree; -} - -int *initMallocValueForTNode(TNode *p_tnode, unsigned int type, void *value) { - p_tnode->type = type; - p_tnode->value = value; - p_tnode->if_malloc = 1; - return 0; -} - -int addChildInLeft(TNode *f_tnode, TNode *c_tnode) { - Node *p_node = initNode(); - initMallocValueForNode(p_node, POINTER, c_tnode); - insertInHead(f_tnode->home, p_node); - c_tnode->father = f_tnode; - c_tnode->room = p_node; - f_tnode->child_num++; - return 0; -} - -int addChildInRight(TNode *f_tnode, TNode *c_tnode) { - Node *p_node = initNode(); - initMallocValueForNode(p_node, POINTER, c_tnode); - insertInTail(f_tnode->home, p_node); - c_tnode->father = f_tnode; - c_tnode->room = p_node; - f_tnode->child_num++; - return 0; -} - -TNode *getBrotherInLeft(TNode *p_tnode) { - List *p_home = p_tnode->father->home; - Node *p_node = p_tnode->room; - unsigned long long index = getIndexByNode(p_home, p_node); - if (index > 0) return (TNode *)(findByIndexForNode(p_home, index - 1)->value); - return NULL; -} - -TNode *getBrotherInRight(TNode *p_tnode) { - List *p_home = p_tnode->father->home; - Node *p_node = p_home->head; - unsigned long long index = getIndexByNode(p_home, p_node); - if (index < p_home->length - 1) return (TNode *)(findByIndexForNode(p_home, index + 1)->value); - return NULL; -} - -int removeChildInLeft(TNode *p_tnode) { - TNode *c_tnode = (TNode *)p_tnode->home->head->value; - c_tnode->father = NULL; - releaseOnlyNode(c_tnode->room); - c_tnode->room = NULL; - p_tnode->child_num--; - popFromHead(p_tnode->home); - return 0; -} - -int removeChildInRight(TNode *p_tnode) { - TNode *c_tnode = (TNode *)p_tnode->home->tail->value; - c_tnode->father = NULL; - releaseOnlyNode(c_tnode->room); - c_tnode->room = NULL; - p_tnode->child_num--; - popFromTail(p_tnode->home); - return 0; -} - - -TNode *getChildById(TNode *p_tnode, const SID *s_id) { - List *p_home = p_tnode->home; + p_tree->if_sid = 1; + p_tree->root = NULL; + if (if_safeModeForTree) { + if (if_safeModeForNode) { + if_safeModeForNode = 0; + s_node = initNode(); + initMallocValueForNode(s_node, POINTER, (void *)p_tree); + if_safeModeForNode = 1; + insertInTail(tree_list, s_node); + } + else + { + s_node = initNode(); + initMallocValueForNode(s_node, POINTER, (void *)p_tree); + insertInTail(tree_list, s_node); + } + } + return p_tree; +} + +int *initMallocValueForTNode(TNode *p_tnode, unsigned int type, void *value) { + p_tnode->type = type; + p_tnode->value = value; + p_tnode->if_malloc = 1; + return 0; +} + +int addChildInLeft(TNode *f_tnode, TNode *c_tnode) { + Node *p_node = initNode(); + initMallocValueForNode(p_node, POINTER, c_tnode); + insertInHead(f_tnode->home, p_node); + c_tnode->father = f_tnode; + c_tnode->room = p_node; + f_tnode->child_num++; + return 0; +} + +int addChildInRight(TNode *f_tnode, TNode *c_tnode) { + Node *p_node = initNode(); + initMallocValueForNode(p_node, POINTER, c_tnode); + insertInTail(f_tnode->home, p_node); + c_tnode->father = f_tnode; + c_tnode->room = p_node; + f_tnode->child_num++; + return 0; +} + +TNode *getBrotherInLeft(TNode *p_tnode) { + List *p_home = p_tnode->father->home; + Node *p_node = p_tnode->room; + unsigned long long index = getIndexByNode(p_home, p_node); + if (index > 0) return (TNode *)(findByIndexForNode(p_home, index - 1)->value); + return NULL; +} + +TNode *getBrotherInRight(TNode *p_tnode) { + List *p_home = p_tnode->father->home; + Node *p_node = p_home->head; + unsigned long long index = getIndexByNode(p_home, p_node); + if (index < p_home->length - 1) return (TNode *)(findByIndexForNode(p_home, index + 1)->value); + return NULL; +} + +int removeChildInLeft(TNode *p_tnode) { + TNode *c_tnode = (TNode *)p_tnode->home->head->value; + c_tnode->father = NULL; + releaseOnlyNode(c_tnode->room); + c_tnode->room = NULL; + p_tnode->child_num--; + popFromHead(p_tnode->home); + return 0; +} + +int removeChildInRight(TNode *p_tnode) { + TNode *c_tnode = (TNode *)p_tnode->home->tail->value; + c_tnode->father = NULL; + releaseOnlyNode(c_tnode->room); + c_tnode->room = NULL; + p_tnode->child_num--; + popFromTail(p_tnode->home); + return 0; +} + + +TNode *getChildById(TNode *p_tnode, const SID *s_id) { + List *p_home = p_tnode->home; target_value_sid = NULL; List *er_list = initList(); - insertInTail(er_list, nodeWithPointer(s_id)); + insertInTail(er_list, nodeWithPointer(s_id)); List *rtnc_list = listThrough(p_home, _dogetChildById, er_list); free(er_list); - Node *p_node= findByIndexForNode(rtnc_list, 1); + Node *p_node= findByIndexForNode(rtnc_list, 1); if (p_node != NULL) { TNode *p_tnode = getByPointerForNode(p_node); - free(rtnc_list); - return p_tnode; - } - return NULL; -} - + free(rtnc_list); + return p_tnode; + } + return NULL; +} + List *_dogetChildById(unsigned int type, void *value, List *er_list) { SID *target_sid = getByPointerForNode(findByIndexForNode(er_list, 0)); - List *rtn_list = initList(); - if (type == POINTER) { - TNode *p_tode = (TNode *)value; - if (simFitS_id(p_tode->s_id, target_sid)) { + List *rtn_list = initList(); + if (type == POINTER) { + TNode *p_tode = (TNode *)value; + if (simFitS_id(p_tode->s_id, target_sid)) { target_value_sid = p_tode; insertInTail(rtn_list, nodeWithInt(-1)); - insertInTail(rtn_list, nodeWithPointer(target_value_sid)); - return rtn_list; - } + insertInTail(rtn_list, nodeWithPointer(target_value_sid)); + return rtn_list; + } } - insertInTail(rtn_list, nodeWithInt(0)); - return rtn_list; -} - -TNode *getChildByValue(TNode *p_tnode, unsigned int type, void *value) { - List *p_home = p_tnode->home; - target_value = value; - target_type = type; + insertInTail(rtn_list, nodeWithInt(0)); + return rtn_list; +} + +TNode *getChildByValue(TNode *p_tnode, unsigned int type, void *value) { + List *p_home = p_tnode->home; + target_value = value; + target_type = type; target_value_value = NULL; List *er_list = initList(); insertInTail(er_list, nodeWithUInt(type)); insertInTail(er_list, nodeWithPointer(value)); List *rtnc_list = listThrough(p_home, _dogetChildByValue,er_list); free(er_list); - Node *p_node = NULL; + Node *p_node = NULL; if ((p_node = findByIndexForNode(rtnc_list, 1)) != NULL) { TNode *p_tnode = getByPointerForNode(p_node); - free(rtnc_list); - return p_tnode; - } - return NULL; -} - + free(rtnc_list); + return p_tnode; + } + return NULL; +} + List *_dogetChildByValue(unsigned int type, void *value, List *er_list) { List *rtn_list = initList(); unsigned int target_type = getByUIntForNode(findByIndexForNode(rtn_list, 0)); - void *target_value = getByPointerForNode(findByIndexForNode(rtn_list, 1)); - if (type == target_type) { - TNode *p_tode = (TNode *)value; - if (target_type == INT) { - if (*(int *)p_tode->value == *(int *)target_value) + void *target_value = getByPointerForNode(findByIndexForNode(rtn_list, 1)); + if (type == target_type) { + TNode *p_tode = (TNode *)value; + if (target_type == INT) { + if (*(int *)p_tode->value == *(int *)target_value) { insertInTail(rtn_list, nodeWithInt(-1)); - insertInTail(rtn_list, nodeWithPointer(p_tode)); - return rtn_list; - } - } - else if (target_type == DOUBLE) - { - if (*(double *)p_tode->value == *(double *)target_value) + insertInTail(rtn_list, nodeWithPointer(p_tode)); + return rtn_list; + } + } + else if (target_type == DOUBLE) + { + if (*(double *)p_tode->value == *(double *)target_value) { insertInTail(rtn_list, nodeWithInt(-1)); - insertInTail(rtn_list, nodeWithPointer(p_tode)); - return rtn_list; - } - } - else if (target_type == STRING) - { - if (!strcmp((char *)p_tode->value, (char *)target_value)) + insertInTail(rtn_list, nodeWithPointer(p_tode)); + return rtn_list; + } + } + else if (target_type == STRING) + { + if (!strcmp((char *)p_tode->value, (char *)target_value)) { insertInTail(rtn_list, nodeWithInt(-1)); - insertInTail(rtn_list, nodeWithPointer(p_tode)); - return rtn_list; - } - } - else if (target_type == POINTER) - { - if (p_tode->value == target_value) + insertInTail(rtn_list, nodeWithPointer(p_tode)); + return rtn_list; + } + } + else if (target_type == POINTER) + { + if (p_tode->value == target_value) { insertInTail(rtn_list, nodeWithInt(-1)); - insertInTail(rtn_list, nodeWithPointer(p_tode)); - return rtn_list; - } - } - + insertInTail(rtn_list, nodeWithPointer(p_tode)); + return rtn_list; + } + } + } - insertInTail(rtn_list, nodeWithInt(0)); - return rtn_list; -} - -int removeChildById(TNode *p_tnode, const SID *s_id) { - TNode *t_tnode = getChildById(p_tnode, s_id); - if (t_tnode != NULL) { - TNode *p_fnode = t_tnode->father; - p_fnode->child_num--; - removeById(p_fnode->home, t_tnode->room->s_id); - releaseOnlyNode(t_tnode->room); - t_tnode->room = NULL; - return 0; - } - return -1; -} - -int removeChildByValue(TNode *p_tnode, unsigned int type, void *value) { - TNode *t_tnode = getChildByValue(p_tnode, type, value); - if (t_tnode != NULL) { - TNode *p_fnode = t_tnode->father; - p_fnode->child_num--; - removeById(p_fnode->home, t_tnode->room->s_id); - releaseOnlyNode(t_tnode->room); - t_tnode->room = NULL; - return 0; - } - return -1; -} - -TNode *getChildByIndex(TNode *p_tnode, unsigned long long index) { - List *p_home = p_tnode->home; - Node *p_node = p_home->head; - int m_index = 0; - if (index < p_tnode->child_num) - { - while (p_node != NULL && m_index < index) { - m_index++; - p_node = p_node->next; - } - return (TNode *)p_node->value; - } - return NULL; -} - -unsigned long long getIndexByChild(TNode *f_tnode, TNode *c_tnode) { - List *p_home = f_tnode->home; - Node *p_node = p_home->head; - int m_index = 0; - while (p_node != NULL) { - TNode *p_tnode = (TNode *)p_node->value; - if (p_tnode->s_id == c_tnode->s_id) { - return m_index; - } - m_index++; - p_node = p_node->next; - } - return -1; -} - -int removeChildByIndex(TNode *p_tnode, unsigned long long index) { - TNode *t_tnode = getChildByIndex(p_tnode, index); - if (t_tnode != NULL) { - TNode *p_fnode = t_tnode->father; - p_fnode->child_num--; - removeById(p_fnode->home, t_tnode->room->s_id); - releaseOnlyNode(t_tnode->room); - t_tnode->room = NULL; - return 0; - } - return -1; -} - - -int TreeThroughUp(Tree *p_tree, int(*func)(TNode *, unsigned long long height)) { - int i; - TNode *p_tnode = p_tree->root; - if (p_tnode != NULL) { - if (p_tnode->child_num > 0) { - for (i = 0; i < p_tnode->child_num; i++) { - if (_doTreeThroughUp(getChildByIndex(p_tnode, i), 1, func) == -1) { - break; - } - } - } - func(p_tnode, 0); - } - return 0; -} - -int _doTreeThroughUp(TNode *p_tnode, int height, int(*func)(TNode *, unsigned long long height)) { - int i, func_back; - - if (p_tnode->child_num > 0) { - for (i = 0; i < p_tnode->child_num; i++) { - if (_doTreeThroughUp(getChildByIndex(p_tnode, i), height + 1, func)) return -1; - } - } - func_back = func(p_tnode, height); - if (func_back == -1)return -1; - return 0; -} - - -int TreeThroughDown(Tree *p_tree, int(*func)(TNode *, unsigned long long height)) { - int i; - TNode *p_tnode = p_tree->root; - if (p_tree->root != NULL) { - func(p_tnode, 0); - if (p_tree->root->child_num > 0) { - for (i = 0; i < p_tnode->child_num; i++) { - if (_doTreeThroughDown(getChildByIndex(p_tnode, i), 1, func) == -1) { - break; - } - } - } - } - return 0; -} - -int _doTreeThroughDown(TNode *p_tnode, int height, int(*func)(TNode *, unsigned long long height)) { - int i; - int func_back = func(p_tnode, height); - if (p_tnode->child_num > 0) { - for (i = 0; i < p_tnode->child_num; i++) { - if (_doTreeThroughDown(getChildByIndex(p_tnode, i), height + 1, func)) return -1; - } - } - if (func_back == -1)return -1; - return 0; -} - -int TreeTravel(Tree *p_tree, int(*func)(TNode *, unsigned long long height)) { - TNode *p_tnode = p_tree->root; - unsigned long long height = 0; - if (p_tnode != NULL) { - int func_back = func(p_tnode, height); - while (func_back > -2) { - if (func_back > -1) { - p_tnode = getChildByIndex(p_tnode, func_back); - func(p_tnode, height + 1); - } - else - { - p_tnode = p_tnode->father; - func(p_tnode, height - 1); - - } - } - } - return 0; -} -int releaseTNode(TNode *p_tnode) { - if (p_tnode->child_num == 0) { - releaseList(p_tnode->home); - if (p_tnode->father != NULL) { - removeChildById(p_tnode->father, p_tnode->s_id); - } - if (p_tnode->type != POINTER) { - if (p_tnode->type == LIST) { - releaseList((List *)p_tnode->value); - } - else { - free(p_tnode->value); - } - } - p_tnode->value = NULL; - p_tnode->type = VOID; - freeS_id(p_tnode->s_id); - p_tnode->if_malloc = 0; - free(p_tnode); - } - return 0; -} - -int releaseTree(Tree *p_tree) { - TreeThroughUp(p_tree, _doreleaseTree); - p_tree->root = NULL; - freeS_id(p_tree->s_id); - free(p_tree); - return 0; -} - -int _doreleaseTree(TNode *p_tnode, unsigned long long height) { - releaseTNode(p_tnode); - return 0; -} - -int releaseOnlyTree(Tree *p_tree) { - freeS_id(p_tree->s_id); - p_tree->root = NULL; - free(p_tree); - return 0; -} - -int releaseOnlyTNode(TNode *p_tnode) { - releaseList(p_tnode->home); - if (p_tnode->if_malloc) { - if (p_tnode->type != STRING) { - if (p_tnode->type == LIST) { - releaseList((List *)p_tnode->value); - } - else { - free(p_tnode->value); - } - } - } - p_tnode->value = NULL; - p_tnode->type = VOID; - freeS_id(p_tnode->s_id); - p_tnode->if_malloc = 0; - free(p_tnode); - return 0; -} - -int releaseAllForTree(void) { - Node *p_node; - Tree *p_tree; - if (if_safeModeForTree) { - if_safeModeForTree = 0; - p_node = tnode_list->head; - while (p_node != NULL) { - TNode *p_tnode = (TNode *)p_node->value; - releaseOnlyTNode(p_tnode); - p_node = p_node->next; - } - p_node = tree_list->head; - while (p_node != NULL) { - p_tree = (Tree *)p_node->value; - releaseOnlyTree(p_tree); - p_node = p_node->next; - } - releaseList(tnode_list); - releaseList(tree_list); - } - return 0; -} - -int setRoot(Tree *p_tree, TNode *p_tnode) { - p_tree->root = p_tnode; - return 0; + insertInTail(rtn_list, nodeWithInt(0)); + return rtn_list; +} + +int removeChildById(TNode *p_tnode, const SID *s_id) { + TNode *t_tnode = getChildById(p_tnode, s_id); + if (t_tnode != NULL) { + TNode *p_fnode = t_tnode->father; + p_fnode->child_num--; + removeById(p_fnode->home, t_tnode->room->s_id); + releaseOnlyNode(t_tnode->room); + t_tnode->room = NULL; + return 0; + } + return -1; +} + +int removeChildByValue(TNode *p_tnode, unsigned int type, void *value) { + TNode *t_tnode = getChildByValue(p_tnode, type, value); + if (t_tnode != NULL) { + TNode *p_fnode = t_tnode->father; + p_fnode->child_num--; + removeById(p_fnode->home, t_tnode->room->s_id); + releaseOnlyNode(t_tnode->room); + t_tnode->room = NULL; + return 0; + } + return -1; +} + +TNode *getChildByIndex(TNode *p_tnode, unsigned long long index) { + List *p_home = p_tnode->home; + Node *p_node = p_home->head; + int m_index = 0; + if (index < p_tnode->child_num) + { + while (p_node != NULL && m_index < index) { + m_index++; + p_node = p_node->next; + } + return (TNode *)p_node->value; + } + return NULL; +} + +unsigned long long getIndexByChild(TNode *f_tnode, TNode *c_tnode) { + List *p_home = f_tnode->home; + Node *p_node = p_home->head; + int m_index = 0; + while (p_node != NULL) { + TNode *p_tnode = (TNode *)p_node->value; + if (p_tnode->s_id == c_tnode->s_id) { + return m_index; + } + m_index++; + p_node = p_node->next; + } + return -1; +} + +int removeChildByIndex(TNode *p_tnode, unsigned long long index) { + TNode *t_tnode = getChildByIndex(p_tnode, index); + if (t_tnode != NULL) { + TNode *p_fnode = t_tnode->father; + p_fnode->child_num--; + removeById(p_fnode->home, t_tnode->room->s_id); + releaseOnlyNode(t_tnode->room); + t_tnode->room = NULL; + return 0; + } + return -1; +} + + +int TreeThroughUp(Tree *p_tree, int(*func)(TNode *, unsigned long long height)) { + int i; + TNode *p_tnode = p_tree->root; + if (p_tnode != NULL) { + if (p_tnode->child_num > 0) { + for (i = 0; i < p_tnode->child_num; i++) { + if (_doTreeThroughUp(getChildByIndex(p_tnode, i), 1, func) == -1) { + break; + } + } + } + func(p_tnode, 0); + } + return 0; +} + +int _doTreeThroughUp(TNode *p_tnode, int height, int(*func)(TNode *, unsigned long long height)) { + int i, func_back; + + if (p_tnode->child_num > 0) { + for (i = 0; i < p_tnode->child_num; i++) { + if (_doTreeThroughUp(getChildByIndex(p_tnode, i), height + 1, func)) return -1; + } + } + func_back = func(p_tnode, height); + if (func_back == -1)return -1; + return 0; +} + + +int TreeThroughDown(Tree *p_tree, int(*func)(TNode *, unsigned long long height)) { + int i; + TNode *p_tnode = p_tree->root; + if (p_tree->root != NULL) { + func(p_tnode, 0); + if (p_tree->root->child_num > 0) { + for (i = 0; i < p_tnode->child_num; i++) { + if (_doTreeThroughDown(getChildByIndex(p_tnode, i), 1, func) == -1) { + break; + } + } + } + } + return 0; +} + +int _doTreeThroughDown(TNode *p_tnode, int height, int(*func)(TNode *, unsigned long long height)) { + int i; + int func_back = func(p_tnode, height); + if (p_tnode->child_num > 0) { + for (i = 0; i < p_tnode->child_num; i++) { + if (_doTreeThroughDown(getChildByIndex(p_tnode, i), height + 1, func)) return -1; + } + } + if (func_back == -1)return -1; + return 0; +} + +int TreeTravel(Tree *p_tree, int(*func)(TNode *, unsigned long long height)) { + TNode *p_tnode = p_tree->root; + unsigned long long height = 0; + if (p_tnode != NULL) { + int func_back = func(p_tnode, height); + while (func_back > -2) { + if (func_back > -1) { + p_tnode = getChildByIndex(p_tnode, func_back); + func(p_tnode, height + 1); + } + else + { + p_tnode = p_tnode->father; + func(p_tnode, height - 1); + + } + } + } + return 0; +} +int releaseTNode(TNode *p_tnode) { + if (p_tnode->child_num == 0) { + releaseList(p_tnode->home); + if (p_tnode->father != NULL) { + removeChildById(p_tnode->father, p_tnode->s_id); + } + if (p_tnode->type != POINTER) { + if (p_tnode->type == LIST) { + releaseList((List *)p_tnode->value); + } + else { + free(p_tnode->value); + } + } + p_tnode->value = NULL; + p_tnode->type = VOID; + freeS_id(p_tnode->s_id); + p_tnode->if_malloc = 0; + free(p_tnode); + } + return 0; +} + +int releaseTree(Tree *p_tree) { + TreeThroughUp(p_tree, _doreleaseTree); + p_tree->root = NULL; + freeS_id(p_tree->s_id); + free(p_tree); + return 0; +} + +int _doreleaseTree(TNode *p_tnode, unsigned long long height) { + releaseTNode(p_tnode); + return 0; +} + +int releaseOnlyTree(Tree *p_tree) { + freeS_id(p_tree->s_id); + p_tree->root = NULL; + free(p_tree); + return 0; +} + +int releaseOnlyTNode(TNode *p_tnode) { + releaseList(p_tnode->home); + if (p_tnode->if_malloc) { + if (p_tnode->type != STRING) { + if (p_tnode->type == LIST) { + releaseList((List *)p_tnode->value); + } + else { + free(p_tnode->value); + } + } + } + p_tnode->value = NULL; + p_tnode->type = VOID; + freeS_id(p_tnode->s_id); + p_tnode->if_malloc = 0; + free(p_tnode); + return 0; +} + +int releaseAllForTree(void) { + Node *p_node; + Tree *p_tree; + if (if_safeModeForTree) { + if_safeModeForTree = 0; + p_node = tnode_list->head; + while (p_node != NULL) { + TNode *p_tnode = (TNode *)p_node->value; + releaseOnlyTNode(p_tnode); + p_node = p_node->next; + } + p_node = tree_list->head; + while (p_node != NULL) { + p_tree = (Tree *)p_node->value; + releaseOnlyTree(p_tree); + p_node = p_node->next; + } + releaseList(tnode_list); + releaseList(tree_list); + } + return 0; +} + +int setRoot(Tree *p_tree, TNode *p_tnode) { + p_tree->root = p_tnode; + return 0; } diff --git a/tree/tree_expand.c b/src/tree/tree_expand.c similarity index 96% rename from tree/tree_expand.c rename to src/tree/tree_expand.c index 5d9992d..0a584df 100644 --- a/tree/tree_expand.c +++ b/src/tree/tree_expand.c @@ -1,231 +1,231 @@ -#include "tree_expand.h" - -TNode *tnodeWithInt(int temp) { - TNode *p_tnode = initTNode(); +#include "tree_expand.h" + +TNode *tnodeWithInt(int temp) { + TNode *p_tnode = initTNode(); int *p_temp = (int *)malloc(sizeof(int)); if(p_temp == NULL){ showError(pushError(INT, STANDARD, initInfo("tnodeWithInt()", "Error in getting the memory of int."))); return NULL; - } - *p_temp = temp; - initMallocValueForTNode(p_tnode, INT, p_temp); - return p_tnode; -} - -TNode *tnodeWithDouble(double temp) { - TNode *p_tnode = initTNode(); + } + *p_temp = temp; + initMallocValueForTNode(p_tnode, INT, p_temp); + return p_tnode; +} + +TNode *tnodeWithDouble(double temp) { + TNode *p_tnode = initTNode(); double *p_temp = (double *)malloc(sizeof(double)); if(p_temp == NULL){ showError(pushError(DOUBLE, STANDARD, initInfo("tnodeWithDouble()", "Error in getting the memory of double."))); return NULL; - } - *p_temp = temp; - initMallocValueForTNode(p_tnode, DOUBLE, p_temp); - return p_tnode; -} -TNode *tnodeWithString(char *temp) { - TNode *p_tnode = initTNode(); + } + *p_temp = temp; + initMallocValueForTNode(p_tnode, DOUBLE, p_temp); + return p_tnode; +} +TNode *tnodeWithString(char *temp) { + TNode *p_tnode = initTNode(); char *p_temp = (char *)malloc(sizeof(temp)); if(p_temp == NULL){ showError(pushError(STRING, STANDARD, initInfo("tnodeWithString()", "Error in getting the memory of string."))); return NULL; - } - strcpy(p_temp, temp); - initMallocValueForTNode(p_tnode, STRING, p_temp); - return p_tnode; -} - -TNode *tnodeWithPointer(void *temp) { - TNode *p_tnode = initTNode(); - initMallocValueForTNode(p_tnode, POINTER, temp); - return p_tnode; -} - -int getValueByIntForTree(TNode *p_tnode) { - if (p_tnode->type == INT) { - return *(int *)p_tnode->value; - } - return -1; -} - -double getValueByDoubleForTree(TNode *p_tnode) { - if (p_tnode->type == DOUBLE) { - return *(double *)p_tnode->value; - } - return -1; -} - -char *getValueByStringForTree(TNode *p_tnode) { - if (p_tnode->type == STRING) { - return (char *)p_tnode->value; - } - return NULL; -} - -void *getValueByPointerForTree(TNode *p_tnode) { - if (p_tnode->type == POINTER) { - return p_tnode->value; - } - return NULL; -} - -int printTNode(TNode *p_tnode, int priority) { - int i; - if (p_tnode != NULL) { - for (i = 0; i < priority; i++) printf(" "); - if (priority == 0) printf("###"); - else printf("#"); - - printf("TNode(id: %s)\n", s_idToASCIIString(p_tnode->s_id)); - for (i = 0; i < priority + 1; i++) printf(" "); - printf("ifMalloc: "); - if (p_tnode->if_malloc) { - printf("YES\n"); - for (i = 0; i < priority + 1; i++) printf(" "); - printf("Value(type: %d): ", p_tnode->type); - if (p_tnode->type == INT) { - printf("%d\n", *(int *)(p_tnode->value)); - } - else if (p_tnode->type == DOUBLE) { - printf("%a\n", *(double *)(p_tnode->value)); - } - else if (p_tnode->type == STRING) { - printf("%s\n", (char *)(p_tnode->value)); - } - else if (p_tnode->type == POINTER) { - printf("%p\n", (char *)(p_tnode->value)); - } - } - else printf("NO\n"); - - if (p_tnode->child_num > 0) { - for (i = 0; i < priority + 1; i++) printf(" "); - printf("Child number: %llu\n", p_tnode->child_num); - } - return 0; - } - return -1; -} - -int printTNodeWithHome(TNode *p_tnode,int priority) { - int i; - List *p_home; - Node *p_node; - if (p_tnode != NULL) { - if (priority == 0) printf("###"); - else printf("#"); - printf("TNode(id: %s)\n", s_idToASCIIString(p_tnode->s_id)); - for (i = 0; i < priority + 1; i++) printf(" "); - printf("ifMalloc: "); - if (p_tnode->if_malloc) { - printf("YES\n"); - for (i = 0; i < priority + 1; i++) printf(" "); - printf("Value(type: %d): ", p_tnode->type); - if (p_tnode->type == INT) { - printf("%d\n", *(int *)(p_tnode->value)); - } - else if (p_tnode->type == DOUBLE) { - printf("%a\n", *(double *)(p_tnode->value)); - } - else if (p_tnode->type == STRING) { - printf("%s\n", (char *)(p_tnode->value)); - } - else if (p_tnode->type == POINTER) { - printf("%p\n", (char *)(p_tnode->value)); - } - } - else printf("NO\n"); - - if (p_tnode->father != NULL) { - for (i = 0; i < priority + 1; i++) printf(" "); - printf("Father id: %s\n", s_idToASCIIString(p_tnode->father->s_id)); - } - else - { - for (i = 0; i < priority + 1; i++) printf(" "); - printf("Father: NO\n"); - } - - if (p_tnode->child_num > 0) { - for (i = 0; i < priority + 1; i++) printf(" "); - printf("Child(number: %llu):\n", p_tnode->child_num); - } - - p_home = p_tnode->home; - p_node = p_home->head; - while (p_node != NULL) { - printTNode((TNode *)p_node->value, priority + 2); - p_node = p_node->next; - } - return 0; - } - return -1; -} - -int printTNodeWithFamily(TNode *p_tnode, int priority) { - int i; - List *p_home; - Node *p_node; - if (p_tnode != NULL) { - for (i = 0; i < priority; i++) printf(" "); - if (priority == 0) printf("###"); - else printf("#"); - printf("TNode(id: %s)\n", s_idToASCIIString(p_tnode->s_id)); - for (i = 0; i < priority + 1; i++) printf(" "); - printf("ifMalloc: "); - if (p_tnode->if_malloc) { - printf("YES\n"); - for (i = 0; i < priority + 1; i++) printf(" "); - printf("Value(type: %d): ", p_tnode->type); - if (p_tnode->type == INT) { - printf("%d\n", *(int *)(p_tnode->value)); - } - else if (p_tnode->type == DOUBLE) { - printf("%a\n", *(double *)(p_tnode->value)); - } - else if (p_tnode->type == STRING) { - printf("%s\n", (char *)(p_tnode->value)); - } - else if (p_tnode->type == POINTER) { - printf("%p\n", (char *)(p_tnode->value)); - } - } - else printf("NO\n"); - - if (p_tnode->father != NULL) { - for (i = 0; i < priority + 1; i++) printf(" "); - printf("Father id: %s\n", s_idToASCIIString(p_tnode->father->s_id)); - } - else - { - for (i = 0; i < priority + 1; i++) printf(" "); - printf("Father: NO\n"); - } - - if (p_tnode->child_num > 0) { - for (i = 0; i < priority + 1; i++) printf(" "); - printf("Child(number: %llu):\n", p_tnode->child_num); - } - - p_home = p_tnode->home; - p_node = p_home->head; - while (p_node != NULL) { - printTNodeWithFamily((TNode *)p_node->value, priority + 2); - p_node = p_node->next; - } - return 0; - } - return -1; -} - -int printTree(Tree *p_tree) { - printf("###"); - printf("Tree(id: %s)",s_idToASCIIString(p_tree->s_id)); - printTNodeWithFamily(p_tree->root,0); - return 0; + } + strcpy(p_temp, temp); + initMallocValueForTNode(p_tnode, STRING, p_temp); + return p_tnode; } -static unsigned long long tnodes_size = 0LL; +TNode *tnodeWithPointer(void *temp) { + TNode *p_tnode = initTNode(); + initMallocValueForTNode(p_tnode, POINTER, temp); + return p_tnode; +} + +int getValueByIntForTree(TNode *p_tnode) { + if (p_tnode->type == INT) { + return *(int *)p_tnode->value; + } + return -1; +} + +double getValueByDoubleForTree(TNode *p_tnode) { + if (p_tnode->type == DOUBLE) { + return *(double *)p_tnode->value; + } + return -1; +} + +char *getValueByStringForTree(TNode *p_tnode) { + if (p_tnode->type == STRING) { + return (char *)p_tnode->value; + } + return NULL; +} + +void *getValueByPointerForTree(TNode *p_tnode) { + if (p_tnode->type == POINTER) { + return p_tnode->value; + } + return NULL; +} + +int printTNode(TNode *p_tnode, int priority) { + int i; + if (p_tnode != NULL) { + for (i = 0; i < priority; i++) printf(" "); + if (priority == 0) printf("###"); + else printf("#"); + + printf("TNode(id: %s)\n", s_idToASCIIString(p_tnode->s_id)); + for (i = 0; i < priority + 1; i++) printf(" "); + printf("ifMalloc: "); + if (p_tnode->if_malloc) { + printf("YES\n"); + for (i = 0; i < priority + 1; i++) printf(" "); + printf("Value(type: %d): ", p_tnode->type); + if (p_tnode->type == INT) { + printf("%d\n", *(int *)(p_tnode->value)); + } + else if (p_tnode->type == DOUBLE) { + printf("%a\n", *(double *)(p_tnode->value)); + } + else if (p_tnode->type == STRING) { + printf("%s\n", (char *)(p_tnode->value)); + } + else if (p_tnode->type == POINTER) { + printf("%p\n", (char *)(p_tnode->value)); + } + } + else printf("NO\n"); + + if (p_tnode->child_num > 0) { + for (i = 0; i < priority + 1; i++) printf(" "); + printf("Child number: %llu\n", p_tnode->child_num); + } + return 0; + } + return -1; +} + +int printTNodeWithHome(TNode *p_tnode,int priority) { + int i; + List *p_home; + Node *p_node; + if (p_tnode != NULL) { + if (priority == 0) printf("###"); + else printf("#"); + printf("TNode(id: %s)\n", s_idToASCIIString(p_tnode->s_id)); + for (i = 0; i < priority + 1; i++) printf(" "); + printf("ifMalloc: "); + if (p_tnode->if_malloc) { + printf("YES\n"); + for (i = 0; i < priority + 1; i++) printf(" "); + printf("Value(type: %d): ", p_tnode->type); + if (p_tnode->type == INT) { + printf("%d\n", *(int *)(p_tnode->value)); + } + else if (p_tnode->type == DOUBLE) { + printf("%a\n", *(double *)(p_tnode->value)); + } + else if (p_tnode->type == STRING) { + printf("%s\n", (char *)(p_tnode->value)); + } + else if (p_tnode->type == POINTER) { + printf("%p\n", (char *)(p_tnode->value)); + } + } + else printf("NO\n"); + + if (p_tnode->father != NULL) { + for (i = 0; i < priority + 1; i++) printf(" "); + printf("Father id: %s\n", s_idToASCIIString(p_tnode->father->s_id)); + } + else + { + for (i = 0; i < priority + 1; i++) printf(" "); + printf("Father: NO\n"); + } + + if (p_tnode->child_num > 0) { + for (i = 0; i < priority + 1; i++) printf(" "); + printf("Child(number: %llu):\n", p_tnode->child_num); + } + + p_home = p_tnode->home; + p_node = p_home->head; + while (p_node != NULL) { + printTNode((TNode *)p_node->value, priority + 2); + p_node = p_node->next; + } + return 0; + } + return -1; +} + +int printTNodeWithFamily(TNode *p_tnode, int priority) { + int i; + List *p_home; + Node *p_node; + if (p_tnode != NULL) { + for (i = 0; i < priority; i++) printf(" "); + if (priority == 0) printf("###"); + else printf("#"); + printf("TNode(id: %s)\n", s_idToASCIIString(p_tnode->s_id)); + for (i = 0; i < priority + 1; i++) printf(" "); + printf("ifMalloc: "); + if (p_tnode->if_malloc) { + printf("YES\n"); + for (i = 0; i < priority + 1; i++) printf(" "); + printf("Value(type: %d): ", p_tnode->type); + if (p_tnode->type == INT) { + printf("%d\n", *(int *)(p_tnode->value)); + } + else if (p_tnode->type == DOUBLE) { + printf("%a\n", *(double *)(p_tnode->value)); + } + else if (p_tnode->type == STRING) { + printf("%s\n", (char *)(p_tnode->value)); + } + else if (p_tnode->type == POINTER) { + printf("%p\n", (char *)(p_tnode->value)); + } + } + else printf("NO\n"); + + if (p_tnode->father != NULL) { + for (i = 0; i < priority + 1; i++) printf(" "); + printf("Father id: %s\n", s_idToASCIIString(p_tnode->father->s_id)); + } + else + { + for (i = 0; i < priority + 1; i++) printf(" "); + printf("Father: NO\n"); + } + + if (p_tnode->child_num > 0) { + for (i = 0; i < priority + 1; i++) printf(" "); + printf("Child(number: %llu):\n", p_tnode->child_num); + } + + p_home = p_tnode->home; + p_node = p_home->head; + while (p_node != NULL) { + printTNodeWithFamily((TNode *)p_node->value, priority + 2); + p_node = p_node->next; + } + return 0; + } + return -1; +} + +int printTree(Tree *p_tree) { + printf("###"); + printf("Tree(id: %s)",s_idToASCIIString(p_tree->s_id)); + printTNodeWithFamily(p_tree->root,0); + return 0; +} + +static unsigned long long tnodes_size = 0LL; unsigned long long calTreeMemory(Tree *p_tree){ tnodes_size = 0LL; diff --git a/tree/tree_expand.h b/src/tree/tree_expand.h similarity index 97% rename from tree/tree_expand.h rename to src/tree/tree_expand.h index bec0086..8649f82 100644 --- a/tree/tree_expand.h +++ b/src/tree/tree_expand.h @@ -1,27 +1,27 @@ -#ifndef TREE_EXPAND_H -#define TREE_EXPAND_H - -#include "tree.h" - -TNode *tnodeWithInt(int); -TNode *tnodeWithDouble(double); -TNode *tnodeWithString(char *); -TNode *tnodeWithPointer(void *); - -int getValueByIntForTree(TNode *); -double getValueByDoubleForTree(TNode *); -char *getValueByStringForTree(TNode *); -void *getValueByPointerForTree(TNode *); - -int printTree(Tree *p_tree); -int printTNodeWithHome(TNode *p_tnode, int priority); -int printTNodeWithFamily(TNode *p_tnode, int priority); -int printTNode(TNode *p_tnode, int priority); +#ifndef TREE_EXPAND_H +#define TREE_EXPAND_H + +#include "tree.h" + +TNode *tnodeWithInt(int); +TNode *tnodeWithDouble(double); +TNode *tnodeWithString(char *); +TNode *tnodeWithPointer(void *); + +int getValueByIntForTree(TNode *); +double getValueByDoubleForTree(TNode *); +char *getValueByStringForTree(TNode *); +void *getValueByPointerForTree(TNode *); + +int printTree(Tree *p_tree); +int printTNodeWithHome(TNode *p_tnode, int priority); +int printTNodeWithFamily(TNode *p_tnode, int priority); +int printTNode(TNode *p_tnode, int priority); unsigned long long calTreeMemory(Tree *); int _doCalTreeMemory(TNode *p_tnode, unsigned long long height); List *treeToList(Tree *p_tree); - -#endif + +#endif diff --git a/test.c b/test/test.c similarity index 92% rename from test.c rename to test/test.c index 3438b13..65025bb 100644 --- a/test.c +++ b/test/test.c @@ -1,7 +1,7 @@ -#include "test.h" - - -int list(void) { +#include "test.h" + + +int list(void) { List *p_list = initList(1); for(int i = 0; i < 12; i++){ insertInTail(p_list, nodeWithInt(i, 0)); @@ -13,53 +13,52 @@ int list(void) { dataFileAddStandardData(pd_file, pa_std); dataFileWriteIn(pd_file); releaseList(p_list); - releaseDFile(pd_file); - - return 0; -} - -/*int _useTreeThroughDown(TNode *p_tnode, unsigned long long height) { - printTNode(p_tnode,0); - return 0; -}*/ - - -/*int tree(void) { - TNode *t_tnode, *cr_tnode, *cl_tnode; - Tree *t_tree; - TNode *gs_tnode; - safeModeForTree(1); - t_tree = initTree(); - t_tnode = tnodeWithInt(1); - cr_tnode = tnodeWithInt(3); - cl_tnode = tnodeWithInt(2); - addChildInRight(t_tnode, cl_tnode); - addChildInRight(t_tnode, cr_tnode); - addChildInRight(cl_tnode, tnodeWithInt(4)); - gs_tnode = tnodeWithInt(5); - addChildInRight(cl_tnode,gs_tnode); - addChildInRight(cr_tnode, tnodeWithInt(6)); - addChildInRight(cr_tnode, tnodeWithInt(7)); - addChildInRight(gs_tnode, tnodeWithInt(8)); - setRoot(t_tree, t_tnode); - TreeThroughUp(t_tree, _useTreeThroughDown); - //printTNodeWithFamily(t_tnode, 0); - releaseAllForTree(); - return 0; -}*/ - -int stack(void) { - int i; - Stack *t_stack = initStack(); - for (i = 0; i < 10; i++) { - pushStack(t_stack, snodeWithInt(i)); - } - for (i = 0; i < 10; i++) { - printf("%d", getValueByIntForSNode(popStack(t_stack))); - } - releaseStack(t_stack); - return 0; -} + releaseDFile(pd_file); + + return 0; +} + +/*int _useTreeThroughDown(TNode *p_tnode, unsigned long long height) { + printTNode(p_tnode,0); + return 0; +}*/ + +/*int tree(void) { + TNode *t_tnode, *cr_tnode, *cl_tnode; + Tree *t_tree; + TNode *gs_tnode; + safeModeForTree(1); + t_tree = initTree(); + t_tnode = tnodeWithInt(1); + cr_tnode = tnodeWithInt(3); + cl_tnode = tnodeWithInt(2); + addChildInRight(t_tnode, cl_tnode); + addChildInRight(t_tnode, cr_tnode); + addChildInRight(cl_tnode, tnodeWithInt(4)); + gs_tnode = tnodeWithInt(5); + addChildInRight(cl_tnode,gs_tnode); + addChildInRight(cr_tnode, tnodeWithInt(6)); + addChildInRight(cr_tnode, tnodeWithInt(7)); + addChildInRight(gs_tnode, tnodeWithInt(8)); + setRoot(t_tree, t_tnode); + TreeThroughUp(t_tree, _useTreeThroughDown); + //printTNodeWithFamily(t_tnode, 0); + releaseAllForTree(); + return 0; +}*/ + +int stack(void) { + int i; + Stack *t_stack = initStack(); + for (i = 0; i < 10; i++) { + pushStack(t_stack, snodeWithInt(i)); + } + for (i = 0; i < 10; i++) { + printf("%d", getValueByIntForSNode(popStack(t_stack))); + } + releaseStack(t_stack); + return 0; +} int time_avg(void){ List *t_list = initList(0); @@ -82,11 +81,11 @@ int time_avg(void){ printf("TIME: %fus\n",avg_time); releaseList(t_list); return 0; -} - +} + int main(int argc, char **argv) { //time_avg(); - List *t_list = initList(0); + /*List *t_list = initList(0); for(int i = 0; i < 65535; i++) lisrti(t_list, i); for(int i = 0; i < 65535; i++) lisrti(t_list, i); for(int i = 0; i < 65535; i++) lisrti(t_list, i); @@ -98,6 +97,13 @@ int main(int argc, char **argv) { insertBeforeNode(t_list, findByIndexForNode(t_list, 5), lni(6)); popFromHead(t_list); Node *p_node = findByIndexForNode(t_list, 7); - releaseList(t_list); - return 0; -} + releaseList(t_list);*/ + while(1){ + List *p_list = initList(0); + for(int i = 0; i < 65535; i++){ + insertInTail(p_list, nodeWithInt(i, 1)); + } + releaseList(p_list); + } + return 0; +} diff --git a/test.h b/test/test.h similarity index 97% rename from test.h rename to test/test.h index 54ed677..adb1ab8 100644 --- a/test.h +++ b/test/test.h @@ -1,22 +1,22 @@ -#ifndef TEST_H +#ifndef TEST_H #define TEST_H #include - + #include -#include +#include #include #include #include -#include +#include #include -#include +#include //#include "tree/tree_expand.h" -#include "communicate/communicate.h" - -int stack(void); -int list(void); +#include "communicate/communicate.h" + +int stack(void); +int list(void); int tree(void); -int time_avg(void); - +int time_avg(void); + #endif // TEST_H