Add and Fixed.

This commit is contained in:
Saturneic 2018-08-07 12:10:55 +08:00
parent c4315326d3
commit d8cac27242
17 changed files with 1399 additions and 174 deletions

View File

@ -3,7 +3,62 @@
version = "1.0">
<ContextStates>
<ContextState
contextName = "freeS_id:id.c">
contextName = "init_node:list.h">
<PersistentStrings>
<PersistentString
value = "list_list">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "listToSTD:communicate.c">
<PersistentStrings>
<PersistentString
value = "(int *)p_node-&gt;value">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "releaseMalloc:list.h">
</ContextState>
<ContextState
contextName = "initS_id:id.c">
</ContextState>
<ContextState
contextName = "getByIntForNode:list_expand.c">
<PersistentStrings>
<PersistentString
value = "(int *)p_node-&gt;value">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "listThrough:list_expand.c">
</ContextState>
<ContextState
contextName = "initStandardDBlocks:communicate.c">
</ContextState>
<ContextState
contextName = "dataForStandardDBlock:communicate.c">
<PersistentStrings>
<PersistentString
value = "(int *)p_stdb-&gt;buff">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "insertInTail:list.h">
<PersistentStrings>
<PersistentString
value = "node_list">
</PersistentString>
<PersistentString
value = "list_list">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "releaseNULLList:list.h">
</ContextState>
<ContextState
contextName = "asciiStringToS_id:id.c">
@ -22,6 +77,45 @@
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "_doStandardDBlockWrite:communicate.c">
<PersistentStrings>
<PersistentString
value = "&amp;p_stdb-&gt;blocks_num">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "dataFileReadOut:communicate.c">
<PersistentStrings>
<PersistentString
value = "strlen(string_sid)">
</PersistentString>
<PersistentString
value = "(int *)content">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "_doStandardDataInfoWrite:communicate.c">
</ContextState>
<ContextState
contextName = "standardDataAddBlock:communicate.c">
<PersistentStrings>
<PersistentString
value = "(int *)data">
</PersistentString>
<PersistentString
value = "(int *)p_stdb-&gt;buff">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "dataFileWriteIn:communicate.c">
</ContextState>
<ContextState
contextName = "freeS_id:id.c">
</ContextState>
<ContextState
contextName = "s_idToASCIIString:id.c">
<PersistentStrings>
@ -33,44 +127,22 @@
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "releaseNULLList:list.h">
</ContextState>
<ContextState
contextName = "insertInTail:list.h">
<PersistentStrings>
<PersistentString
value = "node_list">
</PersistentString>
<PersistentString
value = "list_list">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "releaseMalloc:list.h">
</ContextState>
<ContextState
contextName = "init_node:list.h">
<PersistentStrings>
<PersistentString
value = "list_list">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "initS_id:id.c">
</ContextState>
<ContextState
contextName = "init_list:list.h">
</ContextState>
<ContextState
contextName = "main:test.c">
<PersistentStrings>
<PersistentString
value = "(int *)p_node-&gt;value">
</PersistentString>
<PersistentString
value = "((STD_DATA *)(p_dfiler-&gt;pf_stdlst-&gt;head-&gt;value))-&gt;pd_blocklst">
</PersistentString>
<PersistentString
value = "strlen(string)">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "init_list:list.h">
</ContextState>
</ContextStates>
</VariablesViewState>

View File

@ -154,7 +154,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "test.c"
timestampString = "554986718.90595"
timestampString = "555307651.589517"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "64"
@ -186,7 +186,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.906109"
timestampString = "555307651.589684"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "19"
@ -202,12 +202,12 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.906213"
timestampString = "555307651.589751"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "99"
endingLineNumber = "99"
landmarkName = "simFitS_id"
landmarkName = "s_idToASCIIString"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
@ -218,13 +218,13 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.906307"
timestampString = "555307651.589806"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "102"
endingLineNumber = "102"
landmarkName = "unknown"
landmarkType = "0">
landmarkName = "s_idToASCIIString"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
@ -234,7 +234,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.906399"
timestampString = "555307651.589859"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "122"
@ -250,7 +250,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.90649"
timestampString = "555307651.5899121"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "136"
@ -267,7 +267,7 @@
condition = "buff_count == 26"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.906581"
timestampString = "555307651.589964"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "128"
@ -284,7 +284,7 @@
condition = "string_len != 25"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.90667"
timestampString = "555307651.590016"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "191"
@ -300,7 +300,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.906878"
timestampString = "555307651.590067"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "133"
@ -317,7 +317,7 @@
condition = "buff_count == 26"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.906978"
timestampString = "555307651.5901181"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "139"
@ -333,7 +333,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.907084"
timestampString = "555307651.59017"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "143"
@ -349,7 +349,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.907181"
timestampString = "555307651.590221"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "147"
@ -365,7 +365,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.9072779"
timestampString = "555307651.5902719"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "197"
@ -381,11 +381,27 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.90737"
timestampString = "555307651.590323"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "240"
endingLineNumber = "240"
landmarkName = "freeS_id"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "555307651.590374"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "184"
endingLineNumber = "184"
landmarkName = "asciiStringToS_id"
landmarkType = "9">
</BreakpointContent>
@ -397,23 +413,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.90746"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "184"
endingLineNumber = "184"
landmarkName = "s_idToASCIIString"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.907542"
timestampString = "555307651.5904239"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "23"
@ -429,7 +429,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.9076231"
timestampString = "555307651.590529"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "196"
@ -445,7 +445,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.907701"
timestampString = "555307651.5906"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "204"
@ -461,7 +461,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.907778"
timestampString = "555307651.590657"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "126"
@ -477,7 +477,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.9078521"
timestampString = "555307651.590712"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "206"
@ -493,12 +493,12 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.9079241"
timestampString = "555307651.590765"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "239"
endingLineNumber = "239"
landmarkName = "asciiStringToS_id"
landmarkName = "freeS_id"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
@ -509,7 +509,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "554986718.908048"
timestampString = "555307651.590819"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "217"
@ -518,5 +518,629 @@
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "test.c"
timestampString = "555307651.590879"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "89"
endingLineNumber = "89"
landmarkName = "main"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "test.c"
timestampString = "555307651.5910259"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "91"
endingLineNumber = "91"
landmarkName = "main"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "list/list_expand.c"
timestampString = "555307651.591181"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "83"
endingLineNumber = "83"
landmarkName = "listThrough"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "test.c"
timestampString = "555307651.591266"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "93"
endingLineNumber = "93"
landmarkName = "main"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.591457"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "102"
endingLineNumber = "102"
landmarkName = "_doStandardDataInfoWrite"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.592109"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "137"
endingLineNumber = "137"
landmarkName = "_doStandardDConnectionWrite"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.592618"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "124"
endingLineNumber = "124"
landmarkName = "_doStandardDataWrite"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "test.c"
timestampString = "555307651.593114"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "97"
endingLineNumber = "97"
landmarkName = "main"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "test.c"
timestampString = "555307651.593201"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "105"
endingLineNumber = "105"
landmarkName = "main"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.593284"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "189"
endingLineNumber = "189"
landmarkName = "dataFileReadOut"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.593739"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "118"
endingLineNumber = "118"
landmarkName = "_doStandardDataWrite"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.594172"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "203"
endingLineNumber = "203"
landmarkName = "dataFileReadOut"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "555307651.59465"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "235"
endingLineNumber = "235"
landmarkName = "asciiStringToS_id"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.594716"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "238"
endingLineNumber = "238"
landmarkName = "dataFileReadOut"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.595166"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "231"
endingLineNumber = "231"
landmarkName = "dataFileReadOut"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.595765"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "186"
endingLineNumber = "186"
landmarkName = "dataFileReadOut"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.596207"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "38"
endingLineNumber = "38"
landmarkName = "initStandardData"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.596637"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "120"
endingLineNumber = "120"
landmarkName = "_doStandardDataWrite"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.597056"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "194"
endingLineNumber = "194"
landmarkName = "dataFileReadOut"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.597474"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "217"
endingLineNumber = "217"
landmarkName = "dataFileReadOut"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "id/id.c"
timestampString = "555307651.597877"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "252"
endingLineNumber = "252"
landmarkName = "freeS_id"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.597941"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "224"
endingLineNumber = "224"
landmarkName = "dataFileReadOut"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.598327"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "17"
endingLineNumber = "17"
landmarkName = "dataForStandardDBlock"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.598729"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "7"
endingLineNumber = "7"
landmarkName = "initStandardDBlocks"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.599126"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "43"
endingLineNumber = "43"
landmarkName = "standardDataAddBlock"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.599665"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "170"
endingLineNumber = "170"
landmarkName = "listToSTD"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.6000921"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "221"
endingLineNumber = "221"
landmarkName = "dataFileReadOut"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.600467"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "223"
endingLineNumber = "223"
landmarkName = "dataFileReadOut"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.600853"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "151"
endingLineNumber = "151"
landmarkName = "_doStandardDBlockWrite"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.601244"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "153"
endingLineNumber = "153"
landmarkName = "_doStandardDBlockWrite"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.601626"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "226"
endingLineNumber = "226"
landmarkName = "dataFileReadOut"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "list/list_expand.c"
timestampString = "555307651.602327"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "103"
endingLineNumber = "103"
landmarkName = "getByIntForNode"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "test.c"
timestampString = "555307651.6025029"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "104"
endingLineNumber = "104"
landmarkName = "main"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.602582"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "263"
endingLineNumber = "263"
landmarkName = "releaseDFile"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "test.c"
timestampString = "555307651.602928"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "98"
endingLineNumber = "98"
landmarkName = "main"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.602989"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "267"
endingLineNumber = "267"
landmarkName = "releaseDFile"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "communicate/communicate.c"
timestampString = "555307651.603296"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "264"
endingLineNumber = "264"
landmarkName = "releaseDFile"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "list/list.c"
timestampString = "555307651.603591"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "508"
endingLineNumber = "508"
landmarkName = "releaseListForCustom"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "test.c"
timestampString = "555307651.603639"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "100"
endingLineNumber = "100"
landmarkName = "main"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -1 +1,266 @@
#include "communicate.h"
STD_BLOCKS *initStandardDBlocks(SID *p_sid, unsigned long long data_size){
STD_BLOCKS *p_stdb = (STD_BLOCKS *)malloc(sizeof(STD_BLOCKS));
p_stdb->sid = s_idToASCIIString(p_sid);
p_stdb->if_data = 0;
unsigned int blocks_num = (unsigned int)(data_size/sizeof(char));
p_stdb->blocks_num = blocks_num;
p_stdb->buff = (char *)malloc(sizeof(char) * blocks_num);
return p_stdb;
}
int dataForStandardDBlock(STD_BLOCKS *p_stdb,void *data){
char *t_data = (char *)data;
/*unsigned int data_size = sizeof(data);*/
for(int i = 0; i < p_stdb->blocks_num; i++){
p_stdb->buff[i] = t_data[i];
}
p_stdb->if_data = 1;
return 0;
}
STD_CTN *initStandardDConnection(SID *f_sid, SID *s_sid){
STD_CTN *p_stdc = (STD_CTN *)malloc(sizeof(STD_CTN));
p_stdc->f_sid = s_idToASCIIString(f_sid);
p_stdc->s_sid = s_idToASCIIString(s_sid);
return p_stdc;
}
STD_DATA *initStandardData(unsigned int type){
STD_DATA *p_std = (STD_DATA *)malloc(sizeof(STD_DATA));
p_std->pd_blocklst = initList();
p_std->pd_ctnlst = initList();
p_std->lock = 0;
p_std->type = type;
p_std->s_id = getS_id(STANDARD_DATA, 2);
return p_std;
}
int standardDataAddBlock(STD_DATA *p_std, SID *p_sid ,void *data, unsigned long long data_size){
if (p_std->lock) return -1;
STD_BLOCKS *p_stdb = initStandardDBlocks(p_sid, data_size);
dataForStandardDBlock(p_stdb, data);
insertInTail(p_std->pd_blocklst, nodeWithPointer(p_stdb));
return 0;
}
int standardDataAddConnection(STD_DATA *p_std, SID *f_sid, SID *s_sid){
if (p_std->lock) return -1;
STD_CTN *p_stdb = initStandardDConnection(f_sid, s_sid);
insertInTail(p_std->pd_ctnlst, nodeWithPointer(p_stdb));
return 0;
}
D_FILE *initDataFileForWrite(char *route){
D_FILE *p_dfile = (D_FILE *)malloc(sizeof(D_FILE));
p_dfile->fp = fopen(route, "wb");
p_dfile->pf_head = (F_HEAD *)malloc(sizeof(F_HEAD));
strcpy(p_dfile->pf_head->head_test,"ZESTDLIB_STDDFILE");
p_dfile->pf_head->data_num = 0;
p_dfile->pf_stdlst = initList();
return p_dfile;
}
D_FILE *initDataFileForRead(char *route){
D_FILE *p_dfile = (D_FILE *)malloc(sizeof(D_FILE));
p_dfile->fp = fopen(route, "rb");
p_dfile->pf_head = (F_HEAD *)malloc(sizeof(F_HEAD));
p_dfile->pf_head->data_num = 0;
p_dfile->pf_stdlst = initList();
return p_dfile;
}
int dataFileAddStandardData(D_FILE *p_dfile, STD_DATA *p_std){
insertInTail(p_dfile->pf_stdlst, nodeWithPointer(p_std));
p_dfile->pf_head->data_num = p_dfile->pf_stdlst->length;
return 0;
}
int dataFileWriteIn(D_FILE *p_dfile){
fwrite(p_dfile->pf_head->head_test, sizeof(char), 18, p_dfile->fp);
fwrite(&p_dfile->pf_head->data_num, sizeof(unsigned long long), 1, p_dfile->fp);
fwrite("HEAD_END", sizeof(char), 9, p_dfile->fp);
List *er_list = initList();
insertInTail(er_list, nodeWithPointer(p_dfile->fp));
/*fwrite("STDINFO", sizeof(char), 8, p_dfile->fp);
listThrough(p_dfile->pf_stdlst, _doStandardDataInfoWrite, er_list);*/
/*fwrite("STDLST", sizeof(char), 7, p_dfile->fp);*/
listThrough(p_dfile->pf_stdlst, _doStandardDataWrite, er_list);
releaseList(er_list);
return 0;
}
List *_doStandardDataInfoWrite(unsigned int type, void *value, List *er_list){
List *p_rtnlst = initList();
FILE *fp = getByPointerForNode(findByIndexForNode(er_list, 0));
STD_DATA *p_std = value;
insertInTail(p_rtnlst, nodeWithInt(0));
char *string_sid = s_idToASCIIString(p_std->s_id);
fwrite(string_sid, sizeof(char), DEEPER_LEN, fp);
free(string_sid);
fwrite(&p_std->type, sizeof(unsigned long), 1, fp);
fwrite(&p_std->pd_ctnlst->length, sizeof(unsigned long long), 1, fp);
fwrite(&p_std->pd_blocklst->length, sizeof(unsigned long long), 1, fp);
return p_rtnlst;
}
List *_doStandardDataWrite(unsigned int type, void *value, List *er_list){
List *p_rtnlst = initList();
FILE *fp = getByPointerForNode(findByIndexForNode(er_list, 0));
insertInTail(p_rtnlst, nodeWithInt(0));
STD_DATA *p_std = value;
List *erc_list = initList();
insertInTail(erc_list, nodeWithPointer(fp));
fwrite("STD", sizeof(char), 4, fp);
char *string_sid = s_idToASCIIString(p_std->s_id);
unsigned long sid_len = strlen(string_sid) + 1;
fwrite(&sid_len, sizeof(unsigned long), 1, fp);
char *sid_w = s_idToASCIIString(p_std->s_id);
fwrite(sid_w, sizeof(char), sid_len, fp);
fwrite(&p_std->type, sizeof(unsigned int), 1, fp);
fwrite(&p_std->pd_ctnlst->length, sizeof(unsigned long long), 1, fp);
fwrite(&p_std->pd_blocklst->length, sizeof(unsigned long long), 1, fp);
listThrough(p_std->pd_ctnlst, _doStandardDConnectionWrite, erc_list);
listThrough(p_std->pd_blocklst, _doStandardDBlockWrite, erc_list);
releaseList(erc_list);
free(sid_w);
free(string_sid);
return p_rtnlst;
}
List *_doStandardDConnectionWrite(unsigned int type, void *value, List *er_list){
List *p_rtnlst = initList();
insertInTail(p_rtnlst, nodeWithInt(0));
FILE *fp = getByPointerForNode(findByIndexForNode(er_list, 0));
STD_CTN *p_stdc = value;
unsigned long fsid_len = strlen(p_stdc->f_sid) + 1, ssid_len = strlen(p_stdc->s_sid)+1;
fwrite(&fsid_len, sizeof(unsigned long), 1, fp);
fwrite(p_stdc->f_sid, sizeof(char), fsid_len, fp);
fwrite(&ssid_len, sizeof(unsigned long), 1, fp);
fwrite(p_stdc->s_sid, sizeof(char), ssid_len, fp);
return p_rtnlst;
}
List *_doStandardDBlockWrite(unsigned int type, void *value, List *er_list){
List *p_rtnlst = initList();
insertInTail(p_rtnlst, nodeWithInt(0));
STD_BLOCKS *p_stdb = value;
FILE *fp = getByPointerForNode(findByIndexForNode(er_list, 0));
unsigned long sid_len = strlen(p_stdb->sid)+1, blocks_num = p_stdb->blocks_num;
fwrite(&sid_len, sizeof(unsigned long), 1, fp);
fwrite(p_stdb->sid, sizeof(char), sid_len, fp);
fwrite(&blocks_num, sizeof(unsigned long), 1, fp);
fwrite(p_stdb->buff, sizeof(char), p_stdb->blocks_num, fp);
return p_rtnlst;
}
STD_DATA *listToSTD(List *p_list){
STD_DATA *p_std = initStandardData(LIST);
Node *p_node = p_list->head;
while (p_node != NULL) {
unsigned long long data_size = 0;
if(p_node->type == INT) data_size = sizeof(int);
else if (p_node->type == DOUBLE) data_size = sizeof(double);
else if (p_node->type == STRING) data_size = strlen((char *)p_node->value) + 1;
else data_size = sizeof(void *);
standardDataAddBlock(p_std, p_node->s_id, p_node->value, data_size);
p_node = p_node->next;
}
return p_std;
}
int dataFileReadOut(D_FILE *p_dfile){
char test_info[FILE_TSET_LEN],head_test_info[HEAD_TEST_LEN];
fread(test_info, sizeof(char), FILE_TSET_LEN, p_dfile->fp);
strcpy(p_dfile->pf_head->head_test, test_info);
if(!strcmp(test_info, "ZESTDLIB_STDDFILE")){
unsigned long long std_num = 0;
fread(&std_num, sizeof(unsigned long long), 1, p_dfile->fp);
p_dfile->pf_head->data_num = std_num;
fread(head_test_info, sizeof(char), 9, p_dfile->fp);
if (!strcmp(head_test_info, "HEAD_END")) {
for(int i = 0; i < std_num; i++){
char std_test_info[4];
fread(std_test_info, sizeof(char), 4, p_dfile->fp);
if(!strcmp(std_test_info, "STD")){
unsigned long long sid_len = 0, ctn_num = 0, blk_num = 0;
unsigned int type = 0;
fread(&sid_len, sizeof(unsigned long), 1, p_dfile->fp);
char *string_sid = (char *)malloc(sizeof(char) * sid_len);
fread(string_sid, sizeof(char), sid_len, p_dfile->fp);
fread(&type, sizeof(unsigned int), 1, p_dfile->fp);
STD_DATA *p_std = initStandardData(type);
freeS_id(p_std->s_id);
p_std->s_id = asciiStringToS_id(string_sid);
dataFileAddStandardData(p_dfile, p_std);
free(string_sid);
fread(&ctn_num, sizeof(unsigned long long), 1, p_dfile->fp);
fread(&blk_num, sizeof(unsigned long long), 1, p_dfile->fp);
for(int j = 0; j < ctn_num; j++){
fread(&sid_len, sizeof(unsigned long), 1, p_dfile->fp);
char *fstring_sid = (char *)malloc(sizeof(char) * sid_len);
fread(fstring_sid, sizeof(char), sid_len, p_dfile->fp);
fread(&sid_len, sizeof(unsigned long), 1, p_dfile->fp);
char *sstring_sid = (char *)malloc(sizeof(char) * sid_len);
fread(sstring_sid, sizeof(char), sid_len, p_dfile->fp);
SID *fs_id = asciiStringToS_id(fstring_sid), *ss_id = asciiStringToS_id(sstring_sid);
standardDataAddConnection(p_std, fs_id,ss_id);
freeS_id(fs_id);
freeS_id(ss_id);
free(fstring_sid);
free(sstring_sid);
}
for(int k = 0; k < blk_num; k++){
fread(&sid_len, sizeof(unsigned long), 1, p_dfile->fp);
char *string_sid = (char *)malloc(sizeof(char) * sid_len);
fread(string_sid, sizeof(char), sid_len, p_dfile->fp);
unsigned long blk_len = 0;
fread(&blk_len, sizeof(unsigned long), 1, p_dfile->fp);
char *content = (char *)malloc(sizeof(char) * blk_len);
fread(content, sizeof(char), blk_len, p_dfile->fp);
SID *s_id = asciiStringToS_id(string_sid);
standardDataAddBlock(p_std, s_id, content, blk_len);
freeS_id(s_id);
free(string_sid);
free(content);
}
return 0;
}
else break;
}
}
}
showError(pushError(DATA_FILE, STANDARD, initInfo("dataFileReadOut()", "Datafile not complete.")));
return -1;
}
int releaseSTDConnection(STD_CTN *p_stdc){
free(p_stdc->f_sid);
free(p_stdc->s_sid);
free(p_stdc);
return 0;
}
int releaseSTDBlocks(STD_BLOCKS *p_stdb){
free(p_stdb->sid);
free(p_stdb->buff);
free(p_stdb);
return 0;
}
int releaseStandardData(STD_DATA *p_std){
freeS_id(p_std->s_id);
releaseListForCustom(p_std->pd_blocklst, (int (*)(void *))releaseSTDBlocks);
releaseListForCustom(p_std->pd_ctnlst, (int (*)(void *))releaseSTDConnection);
free(p_std);
return 0;
}
int releaseDFile(D_FILE *p_dfile){
releaseListForCustom(p_dfile->pf_stdlst, (int (*)(void *))releaseStandardData);
fclose(p_dfile->fp);
free(p_dfile->pf_head);
free(p_dfile);
return 0;
}

View File

@ -1,6 +1,77 @@
#ifndef communicate_h
#define communicate_h
#include "../type/type.h"
#include "../list/list_expand.h"
typedef struct message{
SID *p_sid;
char titile[16];
char content[0];
}MSG;
typedef struct file_head{
char head_test[18];
unsigned long long data_num;
}F_HEAD;
typedef struct data_file{
FILE *fp;
F_HEAD *pf_head;
List *pf_stdlst;
}D_FILE;
typedef struct standard_data_blocks{
unsigned int type;
char *sid;
_Bool if_data;
unsigned int blocks_num;
char *buff;
}STD_BLOCKS;
typedef struct standard_data_connection{
char *f_sid;
char *s_sid;
}STD_CTN;
typedef struct standard_data_head{
unsigned long long data_blk_num;
unsigned long long data_ctn_num;
}STD_HEAD;
typedef struct standard_data{
SID *s_id;
unsigned int type;
_Bool lock;
List *pd_blocklst;
List *pd_ctnlst;
}STD_DATA;
D_FILE *initDataFileForWrite(char *route);
D_FILE *initDataFileForRead(char *route);
STD_BLOCKS *initStandardDBlocks(SID *p_sid, unsigned long long data_size);
STD_CTN *initStandardDConnection(SID *f_sid, SID *s_sid);
STD_DATA *initStandardData(unsigned int type);
int dataForStandardDBlock(STD_BLOCKS *p_stdb,void *data);
int dataFileAddStandardData(D_FILE *p_dfile, STD_DATA *p_std);
int standardDataAddBlock(STD_DATA *p_std, SID *p_sid ,void *data, unsigned long long data_size);
int standardDataAddConnection(STD_DATA *p_std, SID *f_sid, SID *s_sid);
int dataFileWriteIn(D_FILE *p_dfile);
int dataFileReadOut(D_FILE *p_dfile);
int releaseSTDBlocks(STD_BLOCKS *p_stdb);
int releaseStandardData(STD_DATA *p_std);
int releaseSTDConnection(STD_CTN *p_stdc);
int releaseDFile(D_FILE *p_file);
List *_doStandardDataInfoWrite(unsigned int type, void *value, List *er_list);
List *_doStandardDataWrite(unsigned int type, void *value, List *er_list);
List *_doStandardDConnectionWrite(unsigned int type, void *value, List *er_list);
List *_doStandardDBlockWrite(unsigned int type, void *value, List *er_list);
STD_DATA *listToSTD(List *);
STD_DATA *stackToSTD(Stack *);
STD_DATA *treeToSTD(Tree *);
#endif /* communicate_h */

View File

@ -9,12 +9,12 @@ int safeModeForNode(int ifon) {
if (node_list == NULL && list_list == NULL) {
node_list = (List *)malloc(sizeof(List));
if(node_list == NULL){
showError(pushError(LIST, HIGH, initInfo("safeModeForNode()", "Error in get the memory of node_list.")));
showError(pushError(LIST, HIGH, initInfo("safeModeForNode()", "Error in getting the memory of node_list.")));
return -1;
}
list_list = (List *)malloc(sizeof(List));
if(list_list == NULL){
showError(pushError(LIST, HIGH, initInfo("safeModeForNode()", "Error in get the memory of list_list.")));
showError(pushError(LIST, HIGH, initInfo("safeModeForNode()", "Error in getting the memory of list_list.")));
return -1;
}
list_list->head = NULL;
@ -89,7 +89,7 @@ int releaseAllForNode(void) {
Node *initNode(void) {
Node *p_node = (Node *)malloc(sizeof(Node));
if(p_node == NULL){
showError(pushError(LIST_NODE, STANDARD, initInfo("initNode()", "Error in get the memory of node.")));
showError(pushError(LIST_NODE, STANDARD, initInfo("initNode()", "Error in getting the memory of node.")));
return NULL;
}
Node *prec_node = NULL;
@ -113,7 +113,7 @@ List *initList(void) {
Node *p_node = NULL;
List *p_list = (List *)malloc(sizeof(List));
if(p_list == NULL){
showError(pushError(LIST_NODE, STANDARD, initInfo("initList()", "Error in get the memory of list.")));
showError(pushError(LIST_NODE, STANDARD, initInfo("initList()", "Error in getting the memory of list.")));
return NULL;
}
p_list->s_id = getS_id(LIST, 1);
@ -131,10 +131,10 @@ List *initList(void) {
return p_list;
}
int initMallocValueForNode(Node *p_node, unsigned int type, void *p_value) {
int initMallocValueForNode(Node *p_node, unsigned int type, const void *p_value) {
p_node->if_malloc = 1;
p_node->type = type;
p_node->value = p_value;
p_node->value = (void *)p_value;
return 0;
}
@ -479,7 +479,7 @@ int releaseNodeForCustom(Node *p_node, int (*func)(void *)){
removeByNode(node_list, p_node);
}
if (p_node->if_malloc == 1) {
if (!func(p_node->value))
if (func(p_node->value))
showError(pushError(LIST_NODE, STANDARD, initInfo("releaseNodeForCustom()", "Error in using custom freeing value function.")));
p_node->value = NULL;
}

View File

@ -11,7 +11,7 @@ int releaseAllForNode(void);
List *initList(void);
Node *initNode(void);
int initMallocValueForNode(Node *,unsigned int,void *);
int initMallocValueForNode(Node *,unsigned int,const void *);
int insertInHead(List *p_list, Node *p_node);
int insertInTail(List *p_list, Node *p_node);

View File

@ -3,15 +3,36 @@
Node *nodeWithInt(int m_int) {
Node *p_node;
int *p_int = (int *)malloc(sizeof(int));
if(p_int == NULL){
showError(pushError(INT, STANDARD, initInfo("nodeWithInt()", "Error in getting the memory of int.")));
return NULL;
}
*p_int = m_int;
p_node = initNode();
initMallocValueForNode(p_node, INT, (void *)p_int);
return p_node;
}
Node *nodeWithUInt(unsigned int m_uint){
Node *p_node;
unsigned int *pu_int = (unsigned int *)malloc(sizeof(unsigned int));
if(pu_int == NULL){
showError(pushError(INT, STANDARD, initInfo("nodeWithUInt()", "Error in getting the memory of int.")));
return NULL;
}
*pu_int = m_uint;
p_node = initNode();
initMallocValueForNode(p_node, INT, (void *)pu_int);
return p_node;
}
Node *nodeWithDouble(double m_double) {
Node *p_node;
double *p_double = (double *)malloc(sizeof(double));
if(p_double == NULL){
showError(pushError(DOUBLE, STANDARD, initInfo("nodeWithDouble()", "Error in getting the memory of double.")));
return NULL;
}
*p_double = m_double;
p_node = initNode();
initMallocValueForNode(p_node, DOUBLE, (void *)p_double);
@ -21,13 +42,17 @@ Node *nodeWithDouble(double m_double) {
Node *nodeWithString(const char *m_string) {
Node *p_node;
char *p_string = (char *)malloc(sizeof(char)*(strlen(m_string) + 1));
if(p_string == NULL){
showError(pushError(STRING, STANDARD, initInfo("initWithString()", "Error in getting the memory of string.")));
return NULL;
}
strcpy(p_string, m_string);
p_node = initNode();
initMallocValueForNode(p_node, STRING, (void *)p_string);
return p_node;
}
Node *nodeWithPointer(void *m_pointer) {
Node *nodeWithPointer(const void *m_pointer) {
Node *p_node = initNode();
initMallocValueForNode(p_node, POINTER, m_pointer);
return p_node;
@ -50,23 +75,28 @@ Node *findByIndexForNode(List *p_list, unsigned long long m_index) {
return p_node;
}
int listThrough(List *p_list, int(*p_func)(unsigned int, void *)) {
List *listThrough(List *p_list, List *(*p_func)(unsigned int, void *, List *), List *expand_resources) {
Node *p_node = p_list->head;
List *m_rtnlst = NULL;
while (p_node != NULL) {
if (p_node->if_malloc == 1) {
int m_return = (*p_func)(p_node->type, p_node->value);
if (m_return == -1) break;
else if (m_return == 1) {
List *m_rtnlst = (*p_func)(p_node->type, p_node->value, expand_resources);
int status = getByIntForNode(findByIndexForNode(m_rtnlst, 0));
if (status == -1) break;
else if (status == 1) {
p_node = p_node->last;
releaseList(m_rtnlst);
m_rtnlst = NULL;
continue;
}
else {
releaseList(m_rtnlst);
m_rtnlst = NULL;
}
}
p_node = p_node->next;
}
return 0;
return m_rtnlst;
}
int getByIntForNode(Node *p_node) {
@ -74,6 +104,11 @@ int getByIntForNode(Node *p_node) {
else return -1;
}
unsigned int getByUIntForNode(Node *p_node){
if (p_node->type == UINT) return *(unsigned int *)(p_node->value);
else return -1;
}
char *getByStringForNode(Node *p_node) {
if (p_node->type == STRING) return (char *)(p_node->value);
else return NULL;
@ -250,6 +285,10 @@ int addValueForComplex(Node * p_node, int type, void *value) {
int addIntForComplex(Node *p_node, int temp) {
if (p_node->type == LIST) {
int *p_temp = (int *)malloc(sizeof(int));
if(p_temp == NULL){
showError(pushError(INT, STANDARD, initInfo("addIntForComplex()", "Error in getting the memory of int.")));
return -1;
}
*p_temp = temp;
addValueForComplex(p_node, INT, p_temp);
return 0;
@ -260,6 +299,10 @@ int addIntForComplex(Node *p_node, int temp) {
int addDoubleForComplex(Node *p_node, double temp) {
if (p_node->type == LIST) {
double *p_temp = (double *)malloc(sizeof(double));
if(p_temp == NULL){
showError(pushError(DOUBLE, STANDARD, initInfo("addDoubleForComplex()", "Error in getting the memory of double.")));
return -1;
}
*p_temp = temp;
addValueForComplex(p_node, DOUBLE, p_temp);
return 0;
@ -270,6 +313,10 @@ int addDoubleForComplex(Node *p_node, double temp) {
int addStringForComplex(Node *p_node, char *temp) {
if (p_node->type == LIST) {
char *p_temp = (char *)malloc(sizeof(strlen(temp) + 1));
if(p_temp == NULL){
showError(pushError(STRING, STANDARD, initInfo("addStringForComplex()", "Error in getting the memory of string.")));
return -1;
}
strcpy(p_temp, temp);
addValueForComplex(p_node, STRING, p_temp);
return 0;
@ -287,6 +334,10 @@ int addPointerForComplex(Node *p_node, void *temp) {
List *m_findByInt(List* p_list, int temp) {
int *p_temp = (int *)malloc(sizeof(int));
if(p_temp == NULL){
showError(pushError(INT, STANDARD, initInfo("m_findByInt()", "Error in getting the memory of int.")));
return NULL;
}
List *t_list;
*p_temp = temp;
t_list = mply_findByValue(p_list, INT, (void *)p_temp);
@ -297,6 +348,10 @@ List *m_findByInt(List* p_list, int temp) {
List *m_findByDouble(List* p_list, double temp) {
List *t_list;
double *p_temp = (double *)malloc(sizeof(double));
if(p_temp == NULL){
showError(pushError(DOUBLE, STANDARD, initInfo("m_findByDouble()", "Error in getting the memory of double.")));
return NULL;
}
*p_temp = temp;
t_list = mply_findByValue(p_list, DOUBLE, (void *)p_temp);
free(p_temp);
@ -306,6 +361,10 @@ List *m_findByDouble(List* p_list, double temp) {
List *m_findByString(List* p_list, char *temp) {
List *t_list;
char *p_temp = (char *)malloc(sizeof(char)*(strlen(temp) + 1));
if(p_temp == NULL){
showError(pushError(STRING, STANDARD, initInfo("m_findByString()", "Error in getting the memory of string.")));
return NULL;
}
strcpy(p_temp, temp);
t_list = mply_findByValue(p_list, STRING, (void *)p_temp);
free(p_temp);
@ -329,19 +388,31 @@ unsigned long long getIndexByNode(List *p_list, Node *p_node) {
}
List *m_findByIntForNode(List* p_list, int temp) {
int *p_temp = (int *)malloc(sizeof(int));
int *p_temp = (int *)malloc(sizeof(int));
if(p_temp == NULL){
showError(pushError(INT, STANDARD, initInfo("m_findByIntForNode()", "Error in getting the memory of int.")));
return NULL;
}
*p_temp = temp;
return mply_findByValue(p_list, INT, (void *)p_temp);
}
List *m_findByDoubleForNode(List* p_list, double temp) {
double *p_temp = (double *)malloc(sizeof(double));
if(p_temp == NULL){
showError(pushError(DOUBLE, STANDARD, initInfo("m_findByDoubleForNode()", "Error in getting the memory of double.")));
return NULL;
}
*p_temp = temp;
return mply_findByValue(p_list, DOUBLE, (void *)p_temp);
}
List *m_findByStringForNode(List* p_list, char *temp) {
char *p_temp = (char *)malloc(sizeof(char) * (strlen(temp) + 1));
if(p_temp == NULL){
showError(pushError(STRING, STANDARD, initInfo("m_findByStringForNode()", "Error in getting the memory of string.")));
return NULL;
}
strcpy(p_temp, temp);
return mply_findByValue(p_list, STRING, (void *)p_temp);
}
@ -360,3 +431,45 @@ unsigned long long calListMemory(List * p_list){
}
return list_size + nodes_size;
}
int updateValueWithInt(Node *p_node,int value){
int *p_value = (int *)malloc(sizeof(int));
if(p_value == NULL){
showError(pushError(INT, STANDARD, initInfo("updateValueWithInt()", "Error in getting the memory of int.")));
return -1;
}
*p_value = value;
free(p_node->value);
p_node->value = p_value;
return 0;
}
int updateValueWithDouble(Node *p_node, double value){
double *p_value = (double *)malloc(sizeof(double));
if(p_value == NULL){
showError(pushError(DOUBLE, STANDARD, initInfo("updateValueWithDouble()", "Error in getting the memory of double.")));
return -1;
}
*p_value = value;
free(p_node->value);
p_node->value = p_value;
return 0;
}
int updateValueWithString(Node *p_node, char *string){
char *p_value = (char *)malloc(sizeof(strlen(string)) + 1);
if(p_value == NULL){
showError(pushError(STRING, STANDARD, initInfo("updateValueWithString()", "Error in getting the memory of string.")));
return -1;
}
strcpy(p_value, string);
free(p_node->value);
p_node->value = p_value;
return 0;
}
int updateValueWithPointer(Node *p_node, void *pointer){
free(p_node->value);
p_node->value = pointer;
return 0;
}

View File

@ -4,9 +4,10 @@
#include "list.h"
Node *nodeWithInt(int);
Node *nodeWithUInt(unsigned int);
Node *nodeWithDouble(double);
Node *nodeWithString(const char *);
Node *nodeWithPointer(void *);
Node *nodeWithPointer(const void *);
Node *nodeWithComplex(void);
int addValueForComplex(Node *, int type, void *value);
@ -15,6 +16,12 @@ int addDoubleForComplex(Node *, double);
int addStringForComplex(Node *, char *);
int addPointerForComplex(Node *, void *);
int updateValueWithInt(Node *,int);
int updateValueWithDouble(Node *,double);
int updateValueWithString(Node *,char *);
int updateValueWithPointer(Node *,void *);
Node *findByIndexForNode(List *, unsigned long long);
Node *findByIntForNode(List *, int);
Node *findByDoubleForNode(List *, double);
@ -32,11 +39,12 @@ void printList(List *);
void printNode(Node *p_node);
int getByIntForNode(Node *);
unsigned int getByUIntForNode(Node *);
double getByDoubleForNode(Node *);
char *getByStringForNode(Node *);
void *getByPointerForNode(Node *);
unsigned long long getIndexByNode(List *p_list,Node *p_node);
int listThrough(List *p_list, int (*p_func)(unsigned int type, void *value));
List *listThrough(List *p_list, List *(*p_func)(unsigned int type, void *value, List *), List *expand_resources);
unsigned long long calListMemory(List *);
#endif

View File

@ -3,7 +3,7 @@
Stack *initStack(void) {
Stack *p_stack = (Stack *)malloc(sizeof(Stack));
if(p_stack == NULL){
showError(pushError(STACK, STANDARD, initInfo("initStack()", "Error in get the memory of stack.")));
showError(pushError(STACK, STANDARD, initInfo("initStack()", "Error in getting the memory of stack.")));
return NULL;
}
p_stack->s_id = getS_id(STACK, 1);
@ -15,7 +15,7 @@ Stack *initStack(void) {
SNode *initSNode(void) {
SNode *p_snode = (SNode *)malloc(sizeof(SNode));
if(p_snode == NULL){
showError(pushError(STACK_NODE, STANDARD, initInfo("initSNode()", "Error in get the memory of snode.")));
showError(pushError(STACK_NODE, STANDARD, initInfo("initSNode()", "Error in getting the memory of snode.")));
return NULL;
}
p_snode->s_id = getS_id(STACK_NODE, 2);

View File

@ -1,23 +1,8 @@
#ifndef STACK_H
#define STACK_H
#include "../type/type.h"
#include "../list/list_expand.h"
typedef struct stack_node{
SID *s_id;
_Bool if_malloc;
_Bool if_sid;
unsigned int type;
void *value;
struct stack_node *next;
} SNode;
typedef struct stack{
SID *s_id;
unsigned long long length;
SNode *top;
_Bool if_sid;
} Stack;
Stack *initStack(void);
SNode *initSNode(void);
int initMallocValueForSNode(SNode *p_snode, unsigned int type, void *value);

View File

@ -3,6 +3,10 @@
SNode *snodeWithInt(int temp) {
SNode *p_snode = initSNode();
int *p_temp = (int *)malloc(sizeof(int));
if(p_temp == NULL){
showError(pushError(INT, STANDARD, initInfo("snodeWithInt()", "Error in getting the memory of int.")));
return NULL;
}
*p_temp = temp;
initMallocValueForSNode(p_snode, INT, p_temp);
return p_snode;
@ -11,6 +15,10 @@ SNode *snodeWithInt(int temp) {
SNode *snodeWithDouble(double temp) {
SNode *p_snode = initSNode();
double *p_temp = (double *)malloc(sizeof(double));
if(p_temp == NULL){
showError(pushError(DOUBLE, STANDARD, initInfo("snodeWithDouble()", "Error in getting the memory of double.")));
return NULL;
}
*p_temp = temp;
initMallocValueForSNode(p_snode, DOUBLE, p_temp);
return p_snode;
@ -19,6 +27,10 @@ SNode *snodeWithDouble(double temp) {
SNode *snodeWithString(char *temp) {
SNode *p_snode = initSNode();
char *p_temp = (char *)malloc(sizeof(char)*(strlen(temp) + 1));
if(p_temp == NULL){
showError(pushError(STRING, STANDARD, initInfo("snodeWithString()", "Error in getting the memory of string.")));
return NULL;
}
strcpy(p_temp, temp);
initMallocValueForSNode(p_snode, STRING, p_temp);
return p_snode;

19
test.c
View File

@ -82,7 +82,24 @@ int stack(void) {
int main(int argc, char **argv) {
//tree();
init_rand();
for (int j = 0; j < 65535; j++) {
List *t_list = initList();
for (int i = 0; i < 12; i++) {
insertInHead(t_list, nodeWithInt(i));
}
STD_DATA *p_std = listToSTD(t_list);
D_FILE *p_dfilew = initDataFileForWrite("data.df");
dataFileAddStandardData(p_dfilew, p_std);
dataFileWriteIn(p_dfilew);
releaseDFile(p_dfilew);
D_FILE *p_dfiler = initDataFileForRead("data.df");
dataFileReadOut(p_dfiler);
releaseDFile(p_dfiler);
releaseList(t_list);
printf("%d\n",j);
usleep(2000);
}
return 0;
}

1
test.h
View File

@ -5,6 +5,7 @@
#include "list/list_expand.h"
#include "stack/stack_expand.h"
#include "tree/tree_expand.h"
#include "communicate/communicate.h"
int stack(void);
int list(void);

View File

@ -1,7 +1,5 @@
#include"tree.h"
static SID *target_sid = NULL;
static TNode *target_value_sid = NULL;
static int if_safeModeForTree = 0;
int safeModeForTree(int ifon) {
@ -39,7 +37,7 @@ 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 get the memory of tnode.")));
showError(pushError(TREE_NODE, STANDARD, initInfo("initTNode()", "Error in getting the memory of tnode.")));
return NULL;
}
p_tnode->s_id = getS_id(TREE_NODE, 2);
@ -73,7 +71,7 @@ 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 get the memory of tree.")));
showError(pushError(TREE, STANDARD, initInfo("initTree()", "Error in getting the memory of tree.")));
return NULL;
}
p_tree->s_id = getS_id(TREE, 1);
@ -163,79 +161,100 @@ int removeChildInRight(TNode *p_tnode) {
TNode *getChildById(TNode *p_tnode, const SID *s_id) {
List *p_home = p_tnode->home;
target_sid = NULL;
target_value_sid = NULL;
listThrough(p_home, _dogetChildById);
if (target_value_sid != NULL) {
return target_value_sid;
List *er_list = initList();
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);
if (p_node != NULL) {
TNode *p_tnode = getByPointerForNode(p_node);
free(rtnc_list);
return p_tnode;
}
return NULL;
}
int _dogetChildById(unsigned int type, void *value) {
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)) {
target_value_sid = p_tode;
return -1;
insertInTail(rtn_list, nodeWithInt(-1));
insertInTail(rtn_list, nodeWithPointer(target_value_sid));
return rtn_list;
}
}
return 0;
insertInTail(rtn_list, nodeWithInt(0));
return rtn_list;
}
static int target_type = VOID;
static void *target_value = NULL;
static TNode *target_value_value = NULL;
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;
listThrough(p_home, _dogetChildByValue);
if (target_value_value != NULL) {
return target_value_value;
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;
if ((p_node = findByIndexForNode(rtnc_list, 1)) != NULL) {
TNode *p_tnode = getByPointerForNode(p_node);
free(rtnc_list);
return p_tnode;
}
return NULL;
}
int _dogetChildByValue(unsigned int type, void *value) {
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)
{
target_value_value = p_tode;
return -1;
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)
{
target_value_value = p_tode;
return -1;
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))
{
target_value_value = p_tode;
return -1;
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)
{
target_value_value = p_tode;
return -1;
insertInTail(rtn_list, nodeWithInt(-1));
insertInTail(rtn_list, nodeWithPointer(p_tode));
return rtn_list;
}
}
}
return 0;
insertInTail(rtn_list, nodeWithInt(0));
return rtn_list;
}
int removeChildById(TNode *p_tnode, const SID *s_id) {

View File

@ -28,8 +28,8 @@ int TreeThroughDown(Tree *p_tree, int(*func)(TNode *, unsigned long long height)
int TreeThroughUp(Tree *p_tree, int(*func)(TNode *, unsigned long long height));
int TreeTravel(Tree *p_tree, int(*func)(TNode *, unsigned long long height));
int _dogetChildById(unsigned int type, void *value);
int _dogetChildByValue(unsigned int type, void *value);
List *_dogetChildById(unsigned int type, void *value, List *er_list);
List *_dogetChildByValue(unsigned int type, void *value, List *er_list);
int _doreleaseTree(TNode *p_tnode, unsigned long long height);
int _doTreeThroughDown(TNode *p_tnode, int height, int(*func)(TNode *, unsigned long long height));
int _doTreeThroughUp(TNode *p_tnode, int height, int(*func)(TNode *, unsigned long long height));

View File

@ -3,6 +3,10 @@
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;
@ -11,6 +15,10 @@ TNode *tnodeWithInt(int temp) {
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;
@ -18,6 +26,10 @@ TNode *tnodeWithDouble(double temp) {
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;

View File

@ -5,6 +5,7 @@
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#define VOID 0
#define INT 1
@ -18,6 +19,9 @@
#define TREE_NODE 9
#define STACK_NODE 10
#define T_SID 11
#define UINT 12
#define STANDARD_DATA 13
#define DATA_FILE 14
#define DEEPC 1
#define DEEPB 2
@ -27,6 +31,12 @@
#define DEEPB_LEN 8
#define DEEPA_LEN 32
#define DATA_BIT 5
#define DEEP_LEN 25
#define DEEPER_LEN 65
#define DEEPEST_LEN 225
#define FILE_TSET_LEN 18
#define HEAD_TEST_LEN 9
#define HIGH 0x3
#define STANDARD 0x2
@ -83,6 +93,22 @@ typedef struct Log{
unsigned long int id;
}Log;
typedef struct stack_node{
SID *s_id;
_Bool if_malloc;
_Bool if_sid;
unsigned int type;
void *value;
struct stack_node *next;
} SNode;
typedef struct stack{
SID *s_id;
unsigned long long length;
SNode *top;
_Bool if_sid;
} Stack;
typedef struct tree_node
{
SID *s_id;