Main Page   Class Hierarchy   Alphabetical List   Compound List   Examples  
libconfig.h
1 /***************************************************************************
2  copyright : (C) by 2002-2004 Stefano Barbato
3  email : stefano@codesink.org
4 
5  $Id: libconfig.h,v 1.10 2009-02-16 18:08:59 tat Exp $
6  ***************************************************************************/
7 #ifndef _MIMETIC_LIB_CONFIG_H_
8 #define _MIMETIC_LIB_CONFIG_H_
9 #if defined(__unix__) || defined(__linux__) || defined(__unix) || defined(_AIX)
10 #ifdef HAVE_MIMETIC_CONFIG
11 #include "config.h"
12 #endif
13 #define CONFIG_UNIX
14 #endif
15 
16 /* Mac OS X */
17 #if defined(__APPLE__) && defined(__MACH__)
18 typedef unsigned int uint;
19 #ifdef HAVE_MIMETIC_CONFIG
20 #include "config.h"
21 #endif
22 #define CONFIG_UNIX
23 #endif
24 
25 /* Windows */
26 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
27 #include <mimetic/config_win32.h>
28 #include <process.h>
29 #include <io.h>
30 #include <ctime>
31 #include <cstdio>
32 typedef unsigned int uint;
33 #define CONFIG_WIN32
34 #endif
35 
36 #if !defined(CONFIG_WIN32) && !defined(CONFIG_UNIX)
37 #error "I'm unable to guess platform type. please define CONFIG_WIN32 or CONFIG_UNIX"
38 #endif
39 #if defined(CONFIG_WIN32) && defined(CONFIG_UNIX)
40 #error "I'm unable to guess platform type. please define CONFIG_UNIX or CONFIG_WIN32"
41 #endif
42 
43 #ifdef CONFIG_UNIX
44 #include <cstdlib>
45 #define PATH_SEPARATOR '/'
46 typedef unsigned int uint32;
47 struct newline_traits
48 {
49  enum { lf = 0xA, cr = 0xD };
50  enum { size = 1 };
51  enum { ch0 = lf, ch1 = 0 };
52 };
53 #endif
54 
55 #ifdef CONFIG_WIN32
56 #define PATH_SEPARATOR '\\'
57 typedef unsigned int uint32;
58 struct newline_traits
59 {
60  enum { lf = 0xA, cr = 0xD };
61  enum { size = 2 };
62  enum { ch0 = cr, ch1 = lf };
63 };
64 #endif
65 
66 #endif