libxspf  1.2.0
XspfDefines.h
Go to the documentation of this file.
1 /*
2  * libxspf - XSPF playlist handling library
3  *
4  * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer.
14  *
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials
18  * provided with the distribution.
19  *
20  * * Neither the name of the Xiph.Org Foundation nor the names of
21  * its contributors may be used to endorse or promote products
22  * derived from this software without specific prior written
23  * permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
36  * OF THE POSSIBILITY OF SUCH DAMAGE.
37  *
38  * Sebastian Pipping, sping@xiph.org
39  */
40 
45 #ifndef XSPF_DEFINES_H
46 #define XSPF_DEFINES_H
47 
48 
49 #include "XspfVersion.h"
50 
51 
52 // Namespace handling
53 #define XSPF_NS_HOME _PT("http://xspf.org/ns/0/")
54 #define XSPF_NS_HOME_LEN 21
55 #define XSPF_NS_SEP_CHAR _PT(' ')
56 #define XSPF_NS_SEP_STRING _PT(" ")
57 #define XML_NS_HOME _PT("http://www.w3.org/XML/1998/namespace")
58 #define XML_NS_HOME_LEN 36
59 
60 
61 // Expat 1.95.8 or later
62 #include <expat.h>
63 #if (!defined(XML_MAJOR_VERSION) || !defined(XML_MINOR_VERSION) \
64  || !defined(XML_MICRO_VERSION) || (XML_MAJOR_VERSION < 1) \
65  || ((XML_MAJOR_VERSION == 1) && ((XML_MINOR_VERSION < 95) \
66  || ((XML_MINOR_VERSION == 95) && (XML_MICRO_VERSION < 8)))))
67 # error Expat 1.95.8 or later is required
68 #endif
69 
70 
75 #define XSPF_MAX_BLOCK_SIZE 100000
76 
77 
79 
80 // Deny overriding from outside
81 #undef XSPF_OS_WINDOWS
82 #undef XSPF_OS_UNIX
83 
84 
85 // Portability defines
86 #if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32))
87 
88 // Windows =========================
89 #include <windows.h>
90 #include <tchar.h>
91 
92 #define XSPF_OS_WINDOWS 1
93 // =================================
94 
95 # ifdef UNICODE
96 # ifndef _UNICODE
97 # error _UNICODE not defined
98 # endif
99 # else
100 # ifdef _UNICODE
101 # error UNICODE not defined
102 # endif
103 # endif
104 #else
105 
106 // Unix, ANSI ======================
107 #define XSPF_OS_UNIX 1
108 // =================================
109 
110 #endif
111 
112 
113 // OS-specific selection macro
114 #ifdef XSPF_OS_WINDOWS
115 # define XSPF_OS_SELECT(windows, unix) windows
116 #else
117 # ifdef XSPF_OS_UNIX
118 # define XSPF_OS_SELECT(windows, unix) unix
119 # endif
120 #endif
121 
122 
123 #define PORT_ATOI XSPF_OS_SELECT(_ttoi, atoi)
124 #define PORT_FOPEN XSPF_OS_SELECT(_tfopen, fopen)
125 #define PORT_MAIN XSPF_OS_SELECT(_tmain, main)
126 #define PORT_PRINTF XSPF_OS_SELECT(_tprintf, printf)
127 
128 #ifdef UNICODE
129 # define PORT_SNPRINTF XSPF_OS_SELECT(_snwprintf, snprintf)
130 #else
131 # define PORT_SNPRINTF XSPF_OS_SELECT(_snprintf, snprintf)
132 #endif
133 
134 #define PORT_STRCMP XSPF_OS_SELECT(_tcscmp, strcmp)
135 #define PORT_STRCPY XSPF_OS_SELECT(_tcscpy, strcpy)
136 #define PORT_STRLEN XSPF_OS_SELECT(_tcslen, strlen)
137 #define PORT_STRNCMP XSPF_OS_SELECT(_tcsncmp, strncmp)
138 #define PORT_STRNCPY XSPF_OS_SELECT(_tcsncpy, strncpy)
139 #define PORT_STRNICMP XSPF_OS_SELECT(_tcsnicmp, strnicmp)
140 #define _PT(x) XSPF_OS_SELECT(_T(x), x)
141 
143 
144 
145 #endif // XSPF_DEFINES_H