<libroxml  version="2.3.0" />
contact: tristan.lelong@libroxml.net
roxml-tune.h
Go to the documentation of this file.
1 
53 #ifndef ROXML_TUNE_H
54 #define ROXML_TUNE_H
55 
56 #ifdef ROXML_DEF_H
57 #error "roxml-defines.h must be included after roxml-tune.h to be tuned."
58 #endif
59 
60 #ifdef HAVE_CONFIG_H
61 #include "config.h"
62 #endif
63 
64 /*************** Define the default behaviour **********************/
65 
66 /* Is the target library thread safe or not
67  * This option should be activated.
68  * If unsure, set to 1
69  */
70 #ifndef CONFIG_XML_THREAD_SAFE
71 #if(CONFIG_XML_HEAP_BUFFERS==1)
72 #error "The CONFIG_XML_THREAD_SAFE option is not compatible with CONFIG_XML_HEAP_BUFFERS. Disable one of those."
73 #endif
74 #define CONFIG_XML_THREAD_SAFE 1
75 #endif /* CONFIG_XML_THREAD_SAFE */
76 
77 /* Is the target library uses stack for internal
78  * buffers or heap. Stack require some RAM while heap
79  * can cut off performances.
80  * This option should not be activated.
81  * If unsure, set to 0
82  */
83 #ifndef CONFIG_XML_HEAP_BUFFERS
84 #define CONFIG_XML_HEAP_BUFFERS 0
85 #endif /* CONFIG_XML_HEAP_BUFFERS */
86 
87 /* Define the size of internal buffer.
88  * For very small systems, large internal buffers
89  * can cause the systeml the behave strangely.
90  * This option should not be activated.
91  * If unsure, set to 0
92  */
93 #ifndef CONFIG_XML_SMALL_BUFFER
94 #define CONFIG_XML_SMALL_BUFFER 0
95 #endif /* CONFIG_XML_SMALL_BUFFER */
96 
97 /* Limit the size of input XML libroxml can handle
98  * to 64kb instead of 4Gb.
99  * Setting this option will reduce the size of RAM loaded tree
100  * This option should not be activated.
101  * If unsure, set to 0
102  */
103 #ifndef CONFIG_XML_SMALL_INPUT_FILE
104 #define CONFIG_XML_SMALL_INPUT_FILE 0
105 #endif /* CONFIG_XML_SMALL_INPUT_FILE */
106 
107 /* Can the target library modify XML tree
108  * When set to 0, this result in smaller binary.
109  * (this saves about 3kb)
110  * This option should be activated.
111  * If unsure, set to 1
112  */
113 #ifndef CONFIG_XML_READ_WRITE
114 #define CONFIG_XML_READ_WRITE 1
115 #endif /* CONFIG_XML_READ_WRITE */
116 
117 /* Can the target library commit a tree
118  * When set to 0, this result in smaller binary.
119  * (this saves about 5kb)
120  * This option should be activated.
121  * If unsure, set to 1
122  */
123 #ifndef CONFIG_XML_COMMIT_XML_TREE
124 #define CONFIG_XML_COMMIT_XML_TREE 1
125 #endif /* CONFIG_XML_COMMIT_XML_TREE */
126 
127 /* Can the target library perform xpath queries
128  * When set to 0, this result in smaller binary.
129  * (this saves about 20kb)
130  * This option should be activated.
131  * If unsure, set to 1
132  */
133 #ifndef CONFIG_XML_XPATH_ENGINE
134 #define CONFIG_XML_XPATH_ENGINE 1
135 #endif /* CONFIG_XML_XPATH_ENGINE */
136 
137 /*************** Implement HEAP/STACK BUFFERS **********************/
138 #if(CONFIG_XML_HEAP_BUFFERS==1)
139  #define ROXML_GET_BASE_BUFFER(name) char *name = malloc(ROXML_BASE_LEN)
140  #define ROXML_PUT_BASE_BUFFER(name) free(name)
141 #else /* CONFIG_XML_HEAP_BUFFERS==0 */
142  #define ROXML_GET_BASE_BUFFER(name) char name[ROXML_BASE_LEN]
143  #define ROXML_PUT_BASE_BUFFER(name)
144 #endif /* CONFIG_XML_HEAP_BUFFERS */
145 
146 /**************** Implement THREAD SAFETY **************************/
147 #if(CONFIG_XML_THREAD_SAFE==0)
148  #define pthread_t char
149  #define pthread_mutex_t char
150 
151  #define pthread_self() 0
152  #define pthread_mutex_init(a, b)
153  #define pthread_mutex_lock(a) *(a) = 0
154  #define pthread_mutex_unlock(a) *(a) = 0
155  #define pthread_mutex_destroy(a)
156 #else /* CONFIG_XML_THREAD_SAFE==1 */
157  #if defined(_WIN32)
158  #include "roxml-win32-native.h"
159  #else
160  #include <pthread.h>
161  #endif
162 #endif /* CONFIG_XML_THREAD_SAFE */
163 
164 #endif /* ROXML_TUNE_H */