This repository was archived by the owner on Apr 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlphabet.h
152 lines (123 loc) · 5.05 KB
/
Alphabet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/****************************************************************************/
/* */
/* But: Definition des donnees d'un alphabet . */
/* */
/****************************************************************************/
/* */
/* Resume: */
/* */
/*==========================================================================*/
/* Donnees: | Routines */
/*==========================================================================*/
/* TAlphSize | - */
/*--------------------------------------------------------------------------*/
/* TLet | Print_Let */
/*--------------------------------------------------------------------------*/
/* TAlph | I_Alph */
/* | Free_Alph */
/* | Clone_Alph */
/* | Str_To_Alph */
/* | Alph_LetPos */
/* | Print_Alph */
/* | Alph_LetNth */
/* | Alph_Size */
/****************************************************************************/
#ifndef _ALPHABET_
#define _ALPHABET_
#include <string.h>
#include <stddef.h>
#include "GeneralTypes.h"
/*****************************/
/* DEFINITION DES CONSTANTES */
/*****************************/
/*==============================*/
/* Chaines standards d'alphabet */
/*==============================*/
#define AL_STD_PROT "ACDEFGHIKLMNPQRSTVWY"
#define AL_STD_ADN "ACGT"
/**************************/
/* DEFINITION DES DONNEES */
/**************************/
/*=================================*/
/* Type de la taille d'un alphabet */
/*=================================*/
typedef TCharStrSize TAlphSize;
/*===================*/
/* Type d'une lettre */
/*===================*/
typedef char TLet;
/*====================*/
/* Type d'un alphabet */
/*====================*/
typedef TCharStr TAlphPtr;
/***************************/
/* DEFINITION DES ROUTINES */
/***************************/
/*==========================*/
/* Manipulation des lettres */
/*==========================*/
/*------------*/
/* Selecteurs */
/*------------*/
/*--------------------------------------------------------------------------*/
/* Macro d'impression d'une lettre */
/*--------------------------------------------------------------------------*/
#define Print_Let(Let)\
Print_Char((TChar)Let)
/*============================*/
/* Manipulation des alphabets */
/*============================*/
/*-----------------*/
/* Gestion memoire */
/*-----------------*/
/*--------------------------------------------------------------------------*/
/* Macro de construction d'un alphabet */
/*--------------------------------------------------------------------------*/
#define I_Alph(AlphSize)\
((TAlphPtr)(ICharStr((TCharStrSize)AlphSize)))
/*--------------------------------------------------------------------------*/
/* Macro de destruction d'un alphabet */
/*--------------------------------------------------------------------------*/
#define Free_Alph(AlphPtr)\
Free_CharStr((TCharStr)AlphPtr)
/*--------------------------------------------------------------------------*/
/* Macro de clonage d'un alphabet */
/*--------------------------------------------------------------------------*/
#define Clone_Alph(AlphPtr)\
((TAlphPtr)(Str_To_CharStr((char*)AlphPtr)))
/*---------------*/
/* Constructeurs */
/*---------------*/
/*--------------------------------------------------------------------------*/
/* Macro de construction d'un alphabet a partir d'une chaine */
/*--------------------------------------------------------------------------*/
#define Str_To_Alph(Str)\
((TAlphPtr)(Str_To_CharStr(Str)))
/*------------*/
/* Selecteurs */
/*------------*/
/*--------------------------------------------------------------------------*/
/* Position d'une lettre dans l'alphabet a partir de 1 */
/*--------------------------------------------------------------------------*/
/* Entree: | AlphPtr | Alphabet */
/* | Let | Lettre */
/* Sortie: | Alph_LetPos | Position de la lettre */
/* Erreur: | - | - */
/*--------------------------------------------------------------------------*/
TAlphSize Alph_LetPos(TAlphPtr AlphPtr, TLet Let);
/*--------------------------------------------------------------------------*/
/* Macro d'impression de l'alphabet */
/*--------------------------------------------------------------------------*/
#define Print_Alph(AlphPtr)\
Print_CharStr((TCharStr)AlphPtr)
/*--------------------------------------------------------------------------*/
/* Macro retournant la lettre No LetterIndex a partir de 1 */
/*--------------------------------------------------------------------------*/
#define Alph_LetNth(AlphPtr, LetIndex)\
((AlphPtr)[(LetIndex) - 1])
/*--------------------------------------------------------------------------*/
/* Macro retournant la taille de l'alphabet */
/*--------------------------------------------------------------------------*/
#define Alph_Size(AlphPtr)\
((TAlphSize)strlen(AlphPtr))
#endif