Initial commit:
- Kit and Instrument data structure - Kit and Instrument XML loading - No layer support! - No GFX and no Sound!
This commit is contained in:
commit
1218622bc6
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
*~
|
||||
*.o
|
||||
*.so
|
||||
*.ttl
|
||||
drummer
|
||||
/tmp
|
288
drummer.h
Normal file
288
drummer.h
Normal file
@ -0,0 +1,288 @@
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Includes */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _DRUMMER_H_
|
||||
#define _DRUMMER_H_
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <glob.h>
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <node.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Global definitions */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
typedef short DRT_Boolean;
|
||||
|
||||
#define DRD_FALSE ( DRT_Boolean) 0
|
||||
#define DRD_TRUE ( DRT_Boolean) 1
|
||||
|
||||
#define DRD_NO 'n'
|
||||
#define DRD_YES 'y'
|
||||
|
||||
#define DRD_MAX(A,B) (((A) < (B)) ? (B) : (A))
|
||||
#define DRD_MIN(A,B) (((A) > (B)) ? (B) : (A))
|
||||
|
||||
#define NDD_CMD_INDEX0_PRINT ( NDT_Command) 65
|
||||
#define NDD_CMD_INDEX1_PRINT ( NDT_Command) 66
|
||||
|
||||
#define NAME_LEN (short) 256
|
||||
#define NAME_SIZE (NAME_LEN + 1)
|
||||
#define FILENAME_LEN (short) 1024
|
||||
#define FILENAME_SIZE (FILENAME_LEN)
|
||||
#define DESC_LEN (short) 2048
|
||||
#define DESC_SIZE (DESC_LEN + 1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Status definition */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
typedef short DRT_Status;
|
||||
|
||||
#define DRS_OK ( DRT_Status) 0
|
||||
|
||||
#define DRS_KO ( DRT_Status) 1
|
||||
#define DRS_NO_IDENT ( DRT_Status) -2
|
||||
#define DRS_BAD_FORMAT ( DRT_Status) -3
|
||||
#define DRS_ROLLBACK ( DRT_Status) -4
|
||||
|
||||
#define DRS_NO_DATA ( DRT_Status) 3
|
||||
#define DRS_SIGNAL ( DRT_Status) 4
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Kit_DS Indexes */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#define DRD_INSTRUMENT_DS_INDEX_NB (short)2
|
||||
|
||||
static NDT_Index_Type DRG_Instrument_DS_Index_Tab_Initial[DRD_INSTRUMENT_DS_INDEX_NB] =
|
||||
{
|
||||
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_SORTED),
|
||||
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_SORTED)
|
||||
};
|
||||
|
||||
static NDT_Index_Type DRG_Instrument_DS_Index_Tab_Final[DRD_INSTRUMENT_DS_INDEX_NB] =
|
||||
{
|
||||
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED),
|
||||
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED)
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Kit_DS Indexes */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#define DRD_KIT_DS_INDEX_NB (short)2
|
||||
|
||||
static NDT_Index_Type DRG_Kit_DS_Index_Tab_Initial[DRD_KIT_DS_INDEX_NB] =
|
||||
{
|
||||
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_SORTED),
|
||||
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_SORTED)
|
||||
};
|
||||
|
||||
static NDT_Index_Type DRG_Kit_DS_Index_Tab_Final[DRD_KIT_DS_INDEX_NB] =
|
||||
{
|
||||
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED),
|
||||
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* XML XPATH Tags */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
#define STR(A) #A
|
||||
#define TAG(A) STR(A)
|
||||
|
||||
#define XML_XPATH_ELEMENT(A) *[local-name()=(A)]
|
||||
|
||||
#define XML_XPATH_DRUMKIT_BASE_TAG XML_XPATH_ELEMENT('drumkit_info')
|
||||
#define XML_XPATH_DRUMKIT_NAME_TAG XML_XPATH_ELEMENT('name')
|
||||
#define XML_XPATH_DRUMKIT_INFO_TAG XML_XPATH_ELEMENT('info')
|
||||
#define XML_XPATH_DRUMKIT_INSTRUMENTLIST_TAG XML_XPATH_ELEMENT('instrumentList')
|
||||
#define XML_XPATH_DRUMKIT_INSTRUMENT_TAG XML_XPATH_ELEMENT('instrument')
|
||||
#define XML_XPATH_DRUMKIT_ID_TAG XML_XPATH_ELEMENT('id')
|
||||
#define XML_XPATH_DRUMKIT_INSTRUMENTCOMPONENT_TAG XML_XPATH_ELEMENT('instrumentComponent')
|
||||
#define XML_XPATH_DRUMKIT_LAYER_TAG XML_XPATH_ELEMENT('layer')
|
||||
#define XML_XPATH_DRUMKIT_FILENAME_TAG XML_XPATH_ELEMENT('filename')
|
||||
|
||||
#define XML_XPATH_DRUMKIT_BASE_STR TAG(/XML_XPATH_DRUMKIT_BASE_TAG)
|
||||
#define XML_XPATH_DRUMKIT_ID_STR TAG(/XML_XPATH_DRUMKIT_ID_TAG)
|
||||
#define XML_XPATH_DRUMKIT_NAME_STR TAG(/XML_XPATH_DRUMKIT_NAME_TAG)
|
||||
#define XML_XPATH_DRUMKIT_LAYER_FILENAME_STR TAG(/XML_XPATH_DRUMKIT_INSTRUMENTCOMPONENT_TAG/XML_XPATH_DRUMKIT_LAYER_TAG[1]/XML_XPATH_DRUMKIT_FILENAME_TAG)
|
||||
|
||||
#define XML_XPATH_DRUMKIT_KIT_NAME_FULL TAG(/XML_XPATH_DRUMKIT_BASE_TAG/XML_XPATH_DRUMKIT_NAME_TAG)
|
||||
#define XML_XPATH_DRUMKIT_KIT_INFO_FULL TAG(/XML_XPATH_DRUMKIT_BASE_TAG/XML_XPATH_DRUMKIT_INFO_TAG)
|
||||
#define XML_XPATH_DRUMKIT_INSTRUMENT_FULL TAG(/XML_XPATH_DRUMKIT_BASE_TAG/XML_XPATH_DRUMKIT_INSTRUMENTLIST_TAG/XML_XPATH_DRUMKIT_INSTRUMENT_TAG[%i])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* TypeDefs */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
typedef struct DRT_Instrument
|
||||
{
|
||||
short Id;
|
||||
char Name[ NAME_SIZE];
|
||||
char FileName[ FILENAME_SIZE];
|
||||
double Gain;
|
||||
char *Sample_Ptr;
|
||||
long Sample_Size;
|
||||
} DRT_Instrument;
|
||||
|
||||
|
||||
|
||||
typedef struct DRT_Kit
|
||||
{
|
||||
short Id;
|
||||
char Name[ NAME_SIZE];
|
||||
char Desc[ DESC_SIZE];
|
||||
char FileName[ FILENAME_SIZE];
|
||||
NDT_Root *Instrument_DS_Ptr;
|
||||
} DRT_Kit;
|
||||
|
||||
|
||||
/*
|
||||
typedef struct DRT_Library
|
||||
{
|
||||
NDT_Root *Kit_DS;
|
||||
} DRT_Library;
|
||||
*/
|
||||
|
||||
|
||||
typedef struct DRT_Base
|
||||
{
|
||||
NDT_Root *Kit_DS_Ptr;
|
||||
} DRT_Base;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Prototypes */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* DS Managers */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
NDT_Status DR_Instrument_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list *);
|
||||
NDT_Status DR_Kit_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list *);
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* DR_Instrument_Add */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
DRT_Status DR_Instrument_Add( DRT_Instrument **, NDT_Root *, char *, char *, double, char *, long);
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* DR_Instrument_Dump */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
DRT_Status DR_Instrument_Dump( DRT_Instrument *, long);
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* DR_Kit_Add */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
DRT_Status DR_Kit_Add( DRT_Kit **, NDT_Root *, char *, char *, char *);
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* DR_Kit_Dump */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
DRT_Status DR_Kit_Dump( DRT_Kit *, long);
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* DR_Kits_Load */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
DRT_Status DRT_Kits_Load( DRT_Base *);
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* DR_Kits_Dump */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
DRT_Status DRT_Kits_Dump( DRT_Base *);
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* DR_Init */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
DRT_Status DRT_Init( DRT_Base *);
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* DeInit */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
DRT_Status DRT_DeInit( DRT_Base *);
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* main */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* ArgC: argument number */
|
||||
/* ArgV: Argument tab */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
int main( int, char **);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
6
go.sh
Executable file
6
go.sh
Executable file
@ -0,0 +1,6 @@
|
||||
gcc -g -c -I . -o libnode.o libnode.c
|
||||
|
||||
#gcc -g -I . -L . -shared -o drummer.so -fPIC drummer.c
|
||||
|
||||
gcc -g -I. -I/usr/include/libxml2 -o drummer -fPIC libnode.o -ldl -lxml2 -lz -llzma -lm drummer.c
|
||||
#gcc -g -I. -I/usr/include/libxml2 -o xpath -fPIC -ldl -lxml2 -lz -llzma -lm xpath.c
|
347
libnode.h
Normal file
347
libnode.h
Normal file
@ -0,0 +1,347 @@
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* $RCSfile: libnode.h,v $ */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* $Revision: 2.10 $ */
|
||||
/* $Name: libnode-2_2_0-1 $ */
|
||||
/* $Date: 2010/06/06 21:26:31 $ */
|
||||
/* $Author: agibert $ */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* This file is part of LibNode */
|
||||
/* */
|
||||
/* LibNode is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU Lesser General Public Licence as published by */
|
||||
/* the Free Software Foundation; either version 2.1 of the License, or */
|
||||
/* (at your option) any later version. */
|
||||
/* */
|
||||
/* LibNode is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU Lesser General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU Lesser General Public License */
|
||||
/* along with LibNode; if not, write to the Free Software */
|
||||
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
|
||||
|
||||
/* Utilisation des API de la LIBNODE sans vérification des arguments */
|
||||
|
||||
#define ND_MODE 1
|
||||
|
||||
#include <node.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __linux
|
||||
# define NDD_PRINTF_PTR_PREFIX ""
|
||||
#else
|
||||
# define NDD_PRINTF_PTR_PREFIX "0x"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define NDD_HUGE_LONG ( long) 0xFFFFFFL
|
||||
|
||||
|
||||
|
||||
/* Table des symboles locale */
|
||||
|
||||
struct NDT_Symbol;
|
||||
|
||||
typedef struct NDT_Symbol
|
||||
{
|
||||
void *Ptr;
|
||||
char *Name;
|
||||
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;
|
||||
#if !defined(_WIN32)
|
||||
sigjmp_buf SigLongJmp_Env;
|
||||
#else
|
||||
jmp_buf SigLongJmp_Env;
|
||||
#endif
|
||||
NDT_Symbol *Symbol_First_Ptr;
|
||||
void *DL_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,
|
||||
{0},
|
||||
(NDT_Symbol *) NULL,
|
||||
NULL,
|
||||
{ NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO},
|
||||
(NDT_Root *) NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Fonctions et procédures privées de la librairie (moyen niveau) */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Manager par défaut */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) va_list Arguments : Liste d'arguments contextuels */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
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 */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Default_Allocator( void **, size_t, void *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Redéfinition de la fonction free() avec retour de type NDT_Status */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Default_Desallocator( void *, void *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Création d'un noeud */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Root : adresse de la racine pour laquelle on crée un noeud */
|
||||
/* (O) New_Node : adresse du pointeur sur le nouveau noeud */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Node_Alloc( NDT_Root * Root, NDT_Node ** New_Node);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Destruction d'un noeud */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (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 *, NDT_Node *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Création d'une nouvelle structure de données */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (O) Root: adresse d'un pointeur sur la racine de la nouvelle structure */
|
||||
/* (I) Type: type de la structure.de données (liste ou arbre binaire) */
|
||||
/* (I) Allocator: pointeur vers la fonction d'allocation */
|
||||
/* (I) Desallocator: pointeur vers la fonction de désallocation */
|
||||
/* (I) Data : pointeur de données utiles à l'allocateur */
|
||||
/* (I) Own_Value : indique si la structure est propriétaire de ses valeurs */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Index_Clear( NDT_Root *, NDT_Index_Id);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Création de la racine d'une structure de données quelconque */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (O) New_Root : adresse du pointeur sur la nouvelle racine */
|
||||
/* (I) Type : type de la structure de données */
|
||||
/* (I) Allocater : pointeur vers la fonction d'allocation */
|
||||
/* (I) Desallocater : pointeur vers la fonction de désallocation */
|
||||
/* (I) Data : pointeur de données utiles à l'allocateur */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Node_Root_Alloc( NDT_Root **, NDT_Index_Nb, NDT_Index_Type[], char *, NDT_Manager *, char *, NDT_Allocator *, char *, NDT_Desallocator *, short, void *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Destruction d'une racine */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Root : pointeur sur la racine à détruire */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Node_Root_Free( NDT_Root *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Ajout d'un noeud à une liste chaînée */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Root : pointeur sur la racine de la liste */
|
||||
/* (I) New_Node : pointeur sur le noeud à ajouter */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_List_Node_Add( NDT_Root *, NDT_Index_Id, NDT_Node *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Ajout d'une nouvelle valeur à une liste */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Root : pointeur sur la racine de la liste */
|
||||
/* (I) Value : pointeur sur la valeur à ajouter */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_List_Value_Add( NDT_Root *, NDT_Index_Id, void *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Ajout d'un noeud à un arbre binaire */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Root : pointeur sur la racine de l'arbre */
|
||||
/* (I) Value : pointeur sur la valeur à ajouter */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Tree_Value_Add( NDT_Root *, NDT_Index_Id, void *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Supprime le noeud d'une liste */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Node : pointeur sur le noeud à supprimer */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_List_Node_Remove( NDT_Node *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Conversion d'une structure en liste chaînée */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Root : pointeur sur la racine du la structure à convertir */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_List_Make( NDT_Root *, NDT_Index_Id);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Recherche une valeur dans une liste et retourne le noeud correspondant */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Node *ND_List_Node_Find( NDT_Root *, NDT_Index_Id, void *, va_list *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Recherche un noeud dans un arbre et retourne le pointeur sur le noeud */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Node *ND_Tree_Node_Find( NDT_Root *, NDT_Index_Id, void *, va_list *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Conversion d'une structure en arbre binaire */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Root : pointeur sur la racine du la structure à convertir */
|
||||
/* (I) Type : type du futur arbre */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Tree_Make( NDT_Root *, NDT_Index_Id);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Equilibrage d'un arbre */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Root : pointeur sur la racine de l'arbre */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Tree_Equalize( NDT_Root *, NDT_Index_Id);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Retourne la profondeur de la plus grande branche à partir d'un noeud */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Node : pointeur sur le noeud */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
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 *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Ajout d'un noeud à un arbre binaire */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Root : pointeur sur la racine de l'arbre */
|
||||
/* (I) Node : pointeur sur le noeud à ajouter */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Tree_Node_Add( NDT_Root *, NDT_Index_Id, NDT_Node *);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Ajoute tous les noeud d'une liste à un arbre */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Tree_Root : pointeur sur la racine de l'arbre */
|
||||
/* (I) List_Root : pointeur sur la racine de la liste */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
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 **, void **);
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Ordonne une liste chaînée selon l'algorithme du tri à bulle */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* (I) Root : pointeur sur la racine de la liste à trier */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
NDT_Status ND_List_Sort( NDT_Root *, NDT_Index_Id);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* PRIVATE FUNCTIONS */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
void ND_List_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||
|
||||
void ND_List_Link_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||
|
||||
void ND_Value_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||
|
||||
void ND_Tree_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||
|
||||
void ND_Tree_Link_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||
|
||||
NDT_Status ND_List_Recursive_Make( NDT_Node *, NDT_Root *, NDT_Index_Id);
|
||||
|
||||
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 *);
|
||||
|
||||
NDT_Node *ND_Tree_Node_Last_Recursive_Get( NDT_Node *);
|
||||
|
||||
NDT_Node *ND_Tree_Node_Recursive_Find( NDT_Node *, void *, va_list *);
|
||||
|
||||
NDT_Node *ND_Tree_Parent_Next_Recursive_Get( NDT_Node *);
|
||||
|
||||
NDT_Node *ND_Tree_Parent_Previous_Recursive_Get( NDT_Node *);
|
||||
|
||||
void ND_Tree_Recursive_Print( NDT_Node *, long, FILE *);
|
||||
|
||||
void ND_Tree_Link_Recursive_Check( NDT_Node *, int *, int *, FILE *);
|
||||
|
||||
NDT_Status ND_Symbol_Find( void **, const char *);
|
||||
|
||||
void ND_Error_Print( void);
|
||||
|
||||
void ND_Signal_Trap( int);
|
||||
|
||||
NDT_Status ND_Address_Check( void *);
|
Loading…
Reference in New Issue
Block a user