#include #include #ifndef __LIST_H__ #define __LIST_H__ typedef struct node { int n; /* data field(s) */ char * data; //数据 char cmd; //发送的命令 int len; //发送的长度 /* float b; * char c; * ... etc. */ struct node *next; /* pointer to next element */ }Node; #if 0 Node *newNode(int ); /* physically creates a new node */ #else Node *newNode(int x,int cmd,char *data,int len); #endif /* N.B. this function is called by other functions because does not take care * of inserting the Node in the list, but delegates this operation to other * functions, such as *Insert functions */ Node *preInsert(Node *, int,int,char *,int); /* inserts a new item at the top of the list */ Node *orderInsert(Node *, int ,int,char *,int); /* inserts a new element in order, according to a key field */ Node *postInsert(Node *, int ,int,char *,int); /* inserts a new item at the end of the list */ Node *findNode(Node *, int ); /* find a node in the list */ Node *deleteNode(Node *, int ); /* deletes a node corresponding to the inserted key */ Node *deleteList(Node *); /* deletes a list */ void printList(Node *); /* prints all the nodes in the list */ void MergeSort(Node **); /* sorting algorithm */ Node *Merge(Node *, Node *); /* merges two sorted linked lists */ void Split(Node *, Node **, Node **); /* split the nodes of the list into two sublists */ int countNodes(Node *); /* returns the number of nodes in the list */ Node* copyList( Node* originalList); int countClockNodes_byCMD(Node *top,char type_cmd); Node *deleteNode_head(Node *top); #define MAX_MSG_ID_NUM 1000 int allocateMsgIdNum(); void deallocateMsgIdNum(int idNum); #if 0 void wait_Send_Data_Insert(int msgid,uint8_t *data,int len); #endif void wait_Send_Data_Delete(int msgid); #endif