This commit is contained in:
Saturneic 2019-01-03 18:33:14 +08:00
parent 16b326b177
commit 36560ef07b
2 changed files with 54 additions and 1 deletions

View File

@ -3,7 +3,7 @@
/** /**
@param p_node @param p_node
@return @return
@ -26,6 +26,13 @@ Node *copyNode(Node *p_node) {
return t_node; return t_node;
} }
/**
@param p_list
@return
*/
List *copyList(List *p_list) { List *copyList(List *p_list) {
Node *p_node; Node *p_node;
Node *t_node; Node *t_node;

View File

@ -2,6 +2,11 @@
#include <list/list.h> #include <list/list.h>
#include <list/list_expand.h> #include <list/list_expand.h>
/**
@return
*/
Node *nodeWithComplex(void) { Node *nodeWithComplex(void) {
Node *p_node = initNode(0); Node *p_node = initNode(0);
p_node->type = LIST; p_node->type = LIST;
@ -9,6 +14,15 @@ Node *nodeWithComplex(void) {
return p_node; return p_node;
} }
/**
@param p_node
@param type
@param value
@return
*/
int addValueForComplex(Node * p_node, int type, void *value) { int addValueForComplex(Node * p_node, int type, void *value) {
List *c_list; List *c_list;
Node *c_node; Node *c_node;
@ -22,6 +36,14 @@ int addValueForComplex(Node * p_node, int type, void *value) {
return -1; return -1;
} }
/**
@param p_node
@param temp
@return
*/
int addIntForComplex(Node *p_node, int temp) { int addIntForComplex(Node *p_node, int temp) {
if (p_node->type == LIST) { if (p_node->type == LIST) {
int *p_temp = (int *)malloc(sizeof(int)); int *p_temp = (int *)malloc(sizeof(int));
@ -35,6 +57,14 @@ int addIntForComplex(Node *p_node, int temp) {
return -1; return -1;
} }
/**
@param p_node
@param temp
@return
*/
int addDoubleForComplex(Node *p_node, double temp) { int addDoubleForComplex(Node *p_node, double temp) {
if (p_node->type == LIST) { if (p_node->type == LIST) {
double *p_temp = (double *)malloc(sizeof(double)); double *p_temp = (double *)malloc(sizeof(double));
@ -48,6 +78,14 @@ int addDoubleForComplex(Node *p_node, double temp) {
return -1; return -1;
} }
/**
@param p_node
@param temp
@return
*/
int addStringForComplex(Node *p_node, char *temp) { int addStringForComplex(Node *p_node, char *temp) {
if (p_node->type == LIST) { if (p_node->type == LIST) {
char *p_temp = (char *)malloc(sizeof(strlen(temp) + 1)); char *p_temp = (char *)malloc(sizeof(strlen(temp) + 1));
@ -61,6 +99,14 @@ int addStringForComplex(Node *p_node, char *temp) {
return -1; return -1;
} }
/**
@param p_node
@param temp
@return
*/
int addPointerForComplex(Node *p_node, void *temp) { int addPointerForComplex(Node *p_node, void *temp) {
if (p_node->type == LIST) { if (p_node->type == LIST) {
addValueForComplex(p_node, POINTER, temp); addValueForComplex(p_node, POINTER, temp);