5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2008 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
20 /****h* silcutil/Runtime Toolkit Interface
24 * The SILC Runtime Toolkit API is used to initialize and uninitialize the
25 * Runtime Toolkit. The application should call silc_runtime_init at the
26 * very start of the application and the silc_runtime_uninit at the very end
27 * of the application before it is exited.
34 /* Version check macro. Use this to check that package is of specific
35 version compile time. Use the __SILC_XXX_VERSION below in comparison.
38 #if __SILC_RUNTIME_VERSION < SILC_VERSION(1,2,0)
43 #define SILC_VERSION(a, b, c) (((a) << 24) + ((b) << 16) + ((c) << 8)
44 #endif /* !SILC_VERSION */
46 /* SILC Runtime Toolkit version */
47 @__RUNTIME_PACKAGE_VERSION@
49 /* Compilation time defines, for third-party software. Use these to check
50 in configuration/compilation time how the SILC Runtime Toolkit was
51 configured/compiled. */
54 @__SILC_ENABLE_STACKTRACE@
58 #define SILC_SIZEOF_LONG_LONG @SILC_SIZEOF_LONG_LONG@
59 #define SILC_SIZEOF_LONG @SILC_SIZEOF_LONG@
60 #define SILC_SIZEOF_INT @SILC_SIZEOF_INT@
61 #define SILC_SIZEOF_SHORT @SILC_SIZEOF_SHORT@
62 #define SILC_SIZEOF_CHAR @SILC_SIZEOF_CHAR@
63 #define SILC_SIZEOF_VOID_P @SILC_SIZEOF_VOID_P@
75 #if defined(__EPOC32__) || defined(__SYMBIAN32__)
83 #if defined(__MACH__) && defined(__APPLE__)
95 /* Platform specific includes */
96 #if defined(SILC_WIN32)
97 #include <silcwin32.h>
100 #if defined(SILC_SYMBIAN)
101 #include <silcsymbian.h>
108 /* We except all systems to have these include files */
113 #if defined(HAVE_RUNTIMEDEFS_H)
115 /* Automatically generated configuration header. These are included only
116 when the SILC Runtime Toolkit itself is compiled. */
118 #include "runtimedefs.h"
120 #include "../../symbian/silcdefs.h"
121 #endif /* SILC_SYMBIAN */
122 #include "silcdistdefs.h"
123 #include "silccompile.h"
127 /* Autodetect CPU so that inline assembly in headers are enabled */
129 #if defined(__i386__)
134 #endif /* __i386__ */
136 #if defined(__i486__)
141 #endif /* __i486__ */
143 #if defined(__i586__)
150 #endif /* __i586__ */
152 #if defined(__i686__)
161 #endif /* __i686__ */
163 #if defined(__x86_64__)
166 #endif /* __x86_64__ */
168 #if defined(__ia64__)
171 #endif /* __ia64__ */
173 #if defined(__ppc__) || defined(__ppc64__)
176 #endif /* __ppc__ || __ppc64__ */
178 #ifndef SILC_ALIGNMENT
179 #define SILC_ALIGNMENT SILC_SIZEOF_VOID_P
180 #endif /* SILC_ALIGNMENT */
182 #endif /* HAVE_RUNTIMEDEFS_H */
184 /* Feature defines */
185 #ifdef __SILC_HAVE_PTHREAD
187 #define SILC_THREADS 1
188 #endif /* __SILC_HAVE_PTHREAD */
190 #ifdef __SILC_ENABLE_DEBUG
193 #endif /* __SILC_ENABLE_DEBUG */
195 #ifdef __SILC_ENABLE_STACKTRACE
196 #undef SILC_STACKTRACE
197 #define SILC_STACKTRACE 1
198 #endif /* __SILC_ENABLE_STACKTRACE */
200 /* SILC Runtime Toolkit includes */
201 #include <silcerrno.h>
202 #include <silctypes.h>
203 #include <silcbitops.h>
204 #include <silcmutex.h>
205 #include <silcatomic.h>
206 #include <silcgetopt.h>
207 #include <silcstack.h>
208 #include <silcmemory.h>
209 #include <silclist.h>
210 #include <silcdlist.h>
211 #include <silcsnprintf.h>
212 #include <silctime.h>
213 #include <silctimer.h>
214 #include <silccond.h>
215 #include <silcglobal.h>
216 #include <silcthread.h>
217 #include <silcthreadqueue.h>
218 #include <silcschedule.h>
220 #include <silcfileutil.h>
222 #include <silcbuffer.h>
223 #include <silcbuffmt.h>
224 #include <silcasync.h>
225 #include <silcregex.h>
228 #include <silchashtable.h>
229 #include <silcstream.h>
231 #include <silcbase64.h>
232 #include <silcstrutil.h>
233 #include <silcutf8.h>
234 #include <silcstringprep.h>
235 #include <silcutil.h>
236 #include <silcconfig.h>
238 #include <silcsocketstream.h>
239 #include <silcfdstream.h>
240 #include <silcmime.h>
241 #include <silcrand.h>
242 #include <silchttpserver.h>
243 #include <silchttpphp.h>
245 /* Runtime Toolkit API */
247 /****f* silcutil/silc_runtime_init
251 * static inline void silc_runtime_init(void)
255 * Initializes the Runtime Toolkit. Application should call this as the
256 * very first call to the Runtime Toolkit. The function initializes some
257 * of the Toolkit features.
261 void silc_runtime_init(void)
263 /* For now we don't have much here. Strictly speaking, calling this
264 currently isn't required. But in the future we may have something that
265 really must be initialized at the very start. Even the Tls doesn't
266 actually require initialization since any routine using Tls currently
267 takes care of that. */
269 /* Initialize Tls for this thread (probably main process thread). */
270 silc_thread_tls_init();
273 /****f* silcutil/silc_runtime_uninit
277 * static inline void silc_runtime_uninit(void)
281 * Uninitializes the Runtime Toolkit. Application should call this as the
282 * very last call to the Runtime Toolkit. The function uninitializes and
283 * frees all allocated resources.
287 void silc_runtime_uninit(void)
289 /* Uninitialize the whole Tls system (not just one thread). */
290 silc_thread_tls_uninit();
297 #endif /* SILCRUNTIME_H */