Main Page   Class Hierarchy   Alphabetical List   Compound List   Examples  
libconfig.h
00001 /***************************************************************************
00002     copyright            : (C) by 2002-2004 Stefano Barbato
00003     email                : stefano@codesink.org
00004 
00005     $Id: libconfig.h,v 1.10 2009-02-16 18:08:59 tat Exp $
00006  ***************************************************************************/
00007 
00008 /***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 #ifndef _MIMETIC_LIB_CONFIG_H_
00017 #define _MIMETIC_LIB_CONFIG_H_
00018 #if defined(__unix__) || defined(__linux__) || defined(__unix) || defined(_AIX)
00019 #ifdef HAVE_MIMETIC_CONFIG
00020 #include "config.h"
00021 #endif
00022 #define CONFIG_UNIX
00023 #endif
00024 
00025 /* Mac OS X */
00026 #if defined(__APPLE__) && defined(__MACH__)
00027 typedef unsigned int uint;
00028 #ifdef HAVE_MIMETIC_CONFIG
00029 #include "config.h"
00030 #endif
00031 #define CONFIG_UNIX
00032 #endif
00033 
00034 /* Windows */
00035 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
00036 #include <mimetic/config_win32.h>
00037 #include <process.h>
00038 #include <io.h>
00039 #include <ctime>
00040 #include <cstdio>
00041 typedef unsigned int uint;
00042 #define CONFIG_WIN32
00043 #endif
00044 
00045 #if !defined(CONFIG_WIN32) && !defined(CONFIG_UNIX)
00046 #error "I'm unable to guess platform type. please define CONFIG_WIN32 or CONFIG_UNIX"
00047 #endif
00048 #if defined(CONFIG_WIN32) && defined(CONFIG_UNIX)
00049 #error "I'm unable to guess platform type. please define CONFIG_UNIX or CONFIG_WIN32"
00050 #endif
00051 
00052 #ifdef CONFIG_UNIX
00053 #include <cstdlib>
00054 #define PATH_SEPARATOR '/'
00055 typedef unsigned int uint32;
00056 struct newline_traits
00057 {
00058     enum { lf = 0xA, cr = 0xD };
00059     enum { size = 1 };
00060     enum { ch0 = lf, ch1 = 0 };
00061 };
00062 #endif
00063 
00064 #ifdef CONFIG_WIN32
00065 #define PATH_SEPARATOR '\\'
00066 typedef unsigned int uint32;
00067 struct newline_traits
00068 {
00069     enum { lf = 0xA, cr = 0xD };
00070     enum { size = 2 };
00071     enum { ch0 = cr, ch1 = lf };
00072 };
00073 #endif
00074 
00075 #endif