Add OpenStruct tracing support in ND_Library_Open(), ND_Library_Close(), ND_DataStruct_Open() and ND_DataStruct_Close(),

Create NDG_Base global structure variable and move all the sparced global variables into it,
ND_Library_Open() call is now mandatory,
Add library open test in *_C() functions,
Code cleaning,
Fix code indentation.
This commit is contained in:
agibert 2004-08-01 23:18:37 +00:00
parent 2274de2cf2
commit 8541d83655
3 changed files with 1643 additions and 877 deletions

View File

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: node.h,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.6 $ */
/* $Revision: 2.7 $ */
/* $Name: $ */
/* $Date: 2003/07/16 00:20:53 $ */
/* $Date: 2004/08/01 23:18:37 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@ -21,7 +21,7 @@
/* GNU Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with Foobar; if not, write to the Free Software */
/* along with LibNode; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*---------------------------------------------------------------------------------*/
@ -309,10 +309,6 @@ typedef struct NDT_Node
char ND_Error_Msg [512];
typedef int NDT_Recursive_Mode;
typedef int NDT_Recursive_Depth;
typedef int NDT_Recursive_Offset;
@ -339,7 +335,7 @@ typedef int NDT_Recursive_Offset;
#define ND_Library_Open ND_Library_Open_I
#define ND_Library_Close ND_Library_Close_I
#define ND_Library_Stderr_Set ND_Library_Stderr_Set_I
#define ND_Library_StdErr_Set ND_Library_Stderr_Set_I
#define ND_DataStruct_Open ND_DataStruct_Open_I
#define ND_DataStruct_Close ND_DataStruct_Close_I
@ -389,7 +385,7 @@ typedef int NDT_Recursive_Offset;
#define ND_Library_Open ND_Library_Open_C
#define ND_Library_Close ND_Library_Close_C
#define ND_Library_Stderr_Set ND_Library_Stderr_Set_C
#define ND_Library_StdErr_Set ND_Library_Stderr_Set_C
#define ND_DataStruct_Open ND_DataStruct_Open_C
#define ND_DataStruct_Close ND_DataStruct_Close_C
@ -472,8 +468,8 @@ NDD_DLL_API NDT_Status ND_Library_Close_C( void);
/*------------------------------------------------------------------------------*/
/* Définition de la sortie standard des messages d'erreur de la librairie */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Library_Stderr_Set_I( FILE *Out);
NDD_DLL_API NDT_Status ND_Library_Stderr_Set_C( FILE *Out);
NDD_DLL_API NDT_Status ND_Library_StdErr_Set_I( FILE *Out);
NDD_DLL_API NDT_Status ND_Library_StdErr_Set_C( FILE *Out);

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: libnode.h,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.4 $ */
/* $Revision: 2.5 $ */
/* $Name: $ */
/* $Date: 2002/07/29 14:53:51 $ */
/* $Date: 2004/08/01 23:18:38 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@ -21,7 +21,7 @@
/* GNU Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with Foobar; if not, write to the Free Software */
/* along with LibNode; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*---------------------------------------------------------------------------------*/
@ -43,13 +43,9 @@
#ifdef __linux
# define NDD_PRINTF_PTR_PREFIX ""
#else
# define NDD_PRINTF_PTR_PREFIX "0x"
#endif
@ -58,24 +54,52 @@
#define NDD_HUGE_LONG (long)0xFFFFFFL
/* Sortie standard des messages d'erreur */
FILE * ND_stderr;
/* Table des symboles locale */
struct Symbol {
struct NDT_Symbol;
typedef struct NDT_Symbol
{
void *Ptr;
char *Name;
struct Symbol * Next;
} * Symbol_Table = NULL;
struct NDT_Symbol *Next;
} NDT_Symbol;
/* LibNode Global Base Structure */
typedef struct NDT_Base
{
int Open_Status;
int Debug_Mode;
char Err_String[512];
FILE *Err_Stream;
int Sig_Trapped;
NDT_Symbol *Symbol_First_Ptr;
NDT_Index_Type OpenStruct_Index_Type[1];
NDT_Root *OpenStruct_Ptr;
} NDT_Base;
NDT_Base NDG_Base =
{
NDD_FALSE,
NDD_TRUE,
"",
(FILE *)-1,
0,
(NDT_Symbol *)NULL,
{ NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO},
(NDT_Root *)NULL
};
NDT_Root * Tmp_Root;
//extern char * strdup (const char *);
//extern int sigrelse (int sig);
int Sig_Trapped;
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
@ -88,7 +112,14 @@ int Sig_Trapped;
/*------------------------------------------------------------------------------*/
/* (I) va_list Arguments : Liste d'arguments contextuels */
/*------------------------------------------------------------------------------*/
NDT_Status Default_Manager( NDT_Root *, NDT_Index_Id, NDT_Command, va_list);
NDT_Status ND_Default_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
/*------------------------------------------------------------------------------*/
/* OpenStruct Manager */
/*------------------------------------------------------------------------------*/
/* (I) va_list Arguments : Liste d'arguments contextuels */
/*------------------------------------------------------------------------------*/
NDT_Status ND_OpenStruct_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
/*------------------------------------------------------------------------------*/
/* Redéfinition de la fonction malloc() avec retour de type NDT_Status */
@ -114,7 +145,7 @@ NDT_Status ND_Node_Alloc (NDT_Root * Root, NDT_Node ** New_Node);
/* (I) Root : adresse de la racine dans laquelle on détruit un noeud */
/* (I) Node : pointeur sur le noeud à détruire */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Node_Free (NDT_Root * Root, NDT_Node * Node);
NDT_Status ND_Node_Free( NDT_Root *, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Création d'une nouvelle structure de données */
@ -144,7 +175,7 @@ NDT_Status ND_Node_Root_Alloc( NDT_Root **, NDT_Index_Nb, NDT_Index_Type[], ch
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine à détruire */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Node_Root_Free (NDT_Root * Root);
NDT_Status ND_Node_Root_Free( NDT_Root *);
/*------------------------------------------------------------------------------*/
/* Ajout d'un noeud à une liste chaînée */
@ -214,14 +245,14 @@ NDT_Status ND_Tree_Equalize (NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* (I) Node : pointeur sur le noeud */
/*------------------------------------------------------------------------------*/
long ND_Tree_MaxDepth_Get (NDT_Node *Node);
long ND_Tree_MaxDepth_Get( NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Retourne la profondeur de la plus petite branche à partir d'un noeud */
/*------------------------------------------------------------------------------*/
/* (I) Node : pointeur sur le noeud */
/*------------------------------------------------------------------------------*/
long ND_Tree_MinDepth_Get (NDT_Node *Node);
long ND_Tree_MinDepth_Get( NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Ajout d'un noeud à un arbre binaire */
@ -242,7 +273,7 @@ NDT_Status ND_Tree_List_Add (NDT_Root *, NDT_Index_Id, NDT_Root *, NDT_Index_Id
/*------------------------------------------------------------------------------*/
/* Fonction de comparaison de noeuds (pour le quick sort) */
/*------------------------------------------------------------------------------*/
int ND_Node_Compare (void ** Node1, void ** Node2);
int ND_Node_Compare( void **, void **);
/*------------------------------------------------------------------------------*/
/* Ordonne une liste chaînée selon l'algorithme du tri à bulle */
@ -273,17 +304,17 @@ NDT_Node * ND_Tree_Recursive_Make (long, long, NDT_Node *);
void ND_Tree_Node_Recursive_Add( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Node **, long , NDT_Node *);
NDT_Node * ND_Tree_Node_First_Recursive_Get (NDT_Node * Node);
NDT_Node * ND_Tree_Node_First_Recursive_Get( NDT_Node *);
NDT_Node * ND_Tree_Node_Last_Recursive_Get (NDT_Node * Node);
NDT_Node * ND_Tree_Node_Last_Recursive_Get( NDT_Node *);
NDT_Node * ND_Tree_Node_Recursive_Find (NDT_Node * Node, void * Value, va_list);
NDT_Node * ND_Tree_Node_Recursive_Find( NDT_Node *, void *, va_list);
NDT_Node * ND_Tree_Parent_Next_Recursive_Get( NDT_Node * Node);
NDT_Node * ND_Tree_Parent_Previous_Recursive_Get (NDT_Node * Node);
NDT_Node * ND_Tree_Parent_Previous_Recursive_Get( NDT_Node *);
void ND_Tree_Recursive_Print (NDT_Node * Node, long Depth, FILE *);
void ND_Tree_Recursive_Print( NDT_Node *, long, FILE *);
void ND_Tree_Link_Recursive_Check( NDT_Node *Node, int *, int *, FILE *);
@ -293,4 +324,4 @@ void ND_Error_Print (void);
void ND_Signal_Trap( int);
NDT_Status ND_Address_Check (void * Address);
NDT_Status ND_Address_Check(void *);