GNU PROLOG with UTF8 support
bt_string.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------*
2  * GNU Prolog *
3  * *
4  * Part : WAM to mini-assembler translator *
5  * File : bt_string.h *
6  * Descr.: string dico management - header file *
7  * Author: Daniel Diaz *
8  * *
9  * Copyright (C) 1999-2015 Daniel Diaz *
10  * *
11  * This file is part of GNU Prolog *
12  * *
13  * GNU Prolog is free software: you can redistribute it and/or *
14  * modify it under the terms of either: *
15  * *
16  * - the GNU Lesser General Public License as published by the Free *
17  * Software Foundation; either version 3 of the License, or (at your *
18  * option) any later version. *
19  * *
20  * or *
21  * *
22  * - the GNU General Public License as published by the Free *
23  * Software Foundation; either version 2 of the License, or (at your *
24  * option) any later version. *
25  * *
26  * or both in parallel, as here. *
27  * *
28  * GNU Prolog is distributed in the hope that it will be useful, *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
31  * General Public License for more details. *
32  * *
33  * You should have received copies of the GNU General Public License and *
34  * the GNU Lesser General Public License along with this program. If *
35  * not, see http://www.gnu.org/licenses/. *
36  *-------------------------------------------------------------------------*/
37 
38 
39 /*---------------------------------*
40  * Constants *
41  *---------------------------------*/
42 
43 /*---------------------------------*
44  * Type Definitions *
45  *---------------------------------*/
46 
47 typedef struct btnode *PBTNode;
48 
49 typedef struct btnode
50 {
51  char *str;
52  int no;
53 #if WORD_SIZE == 64
54  int filler; /* to preserve 64-bits align for info=PlLong (to avoid a SIGBUS) */
55 #endif
56  char info[32]; /* a buffer to store some information */
57  PBTNode left;
58  PBTNode right;
59 }
60 BTNode;
61 
62 
63 
64 
65 typedef struct
66 {
68  int nb_elem;
69 }
70 BTString;
71 
72 typedef void (*BTStrLstFct) (int no, char *str, void *info);
73 
74 
75 /*---------------------------------*
76  * Global Variables *
77  *---------------------------------*/
78 
79 
80 
81 
82 /*---------------------------------*
83  * Function Prototypes *
84  *---------------------------------*/
85 
86 void BT_String_Init(BTString *bt_str);
87 
88 BTNode *BT_String_Add(BTString *bt_str, char *str);
89 
90 BTNode *BT_String_Lookup(BTString *bt_str, char *str);
91 
92 void BT_String_List(BTString *bt_str, BTStrLstFct fct);
Definition: bt_string.h:49
PBTNode right
Definition: bt_string.h:58
BTNode * BT_String_Add(BTString *bt_str, char *str)
Definition: bt_string.c:81
BTNode * BT_String_Lookup(BTString *bt_str, char *str)
Definition: bt_string.c:121
struct btnode * PBTNode
Definition: bt_string.h:47
void BT_String_List(BTString *bt_str, BTStrLstFct fct)
Definition: bt_string.c:144
char info[32]
Definition: bt_string.h:56
void(* BTStrLstFct)(int no, char *str, void *info)
Definition: bt_string.h:72
Definition: bt_string.h:65
BTNode * tree
Definition: bt_string.h:67
struct btnode BTNode
char * str
Definition: bt_string.h:51
PBTNode left
Definition: bt_string.h:57
int no
Definition: bt_string.h:52
char * fct[MAX_FCT]
Definition: extract_asm.c:79
void BT_String_Init(BTString *bt_str)
Definition: bt_string.c:67
int nb_elem
Definition: bt_string.h:68