1
/* ***** BEGIN LICENSE BLOCK *****
2
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
* The contents of this file are subject to the Mozilla Public License Version
5
* 1.1 (the "License"); you may not use this file except in compliance with
6
* the License. You may obtain a copy of the License at
7
* http://www.mozilla.org/MPL/
9
* Software distributed under the License is distributed on an "AS IS" basis,
10
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
* for the specific language governing rights and limitations under the
14
* The Original Code is MOZCE Lib.
16
* The Initial Developer of the Original Code is Doug Turner <dougt@meer.net>.
18
* Portions created by the Initial Developer are Copyright (C) 2005
19
* the Initial Developer. All Rights Reserved.
22
* John Wolfe <wolfe@lobo.us>
24
* Alternatively, the contents of this file may be used under the terms of
25
* either the GNU General Public License Version 2 or later (the "GPL"), or
26
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
* in which case the provisions of the GPL or the LGPL are applicable instead
28
* of those above. If you wish to allow use of your version of this file only
29
* under the terms of either the GPL or the LGPL, and not to allow others to
30
* use your version of this file under the terms of the MPL, indicate your
31
* decision by deleting the provisions above and replace them with the notice
32
* and other provisions required by the GPL or the LGPL. If you do not delete
33
* the provisions above, a recipient may use your version of this file under
34
* the terms of any one of the MPL, the GPL or the LGPL.
36
* ***** END LICENSE BLOCK ***** */
41
#include "environment.h"
47
#ifndef _WCHAR_T_DEFINED
48
typedef unsigned short wchar_t;
49
#define _WCHAR_T_DEFINED
60
// define these so we don't include <new> from either VC or
65
#ifndef __NOTHROW_T_DEFINED
66
#define __NOTHROW_T_DEFINED
69
extern const nothrow_t nothrow;
73
// grab malloc and free prototypes
76
// Normal and nothrow versions of operator new, none of which
77
// actually throw for us. These are both inline and exported
79
inline void *operator new(size_t size) throw() {
80
return (void*) malloc(size);
82
inline void *operator new(size_t size, const std::nothrow_t&) throw() {
83
return (void*) malloc(size);
85
inline void operator delete(void *ptr) throw() {
88
inline void *operator new[](size_t size) throw() {
89
return (void*) malloc(size);
91
inline void *operator new[](size_t size, const std::nothrow_t&) throw() {
92
return (void*) malloc(size);
94
inline void operator delete[](void *ptr) throw() {
98
// Placement new. Just inline, not exported (which doesn't work for
99
// some reason, but it's a noop in any case)
100
inline void *operator new(size_t, void *p) {
103
inline void *operator new[](size_t, void *p) {
120
_strdup(const char*);
123
_wcsdup(const wchar_t *);
126
_strndup(const char *, unsigned int);
129
_wcsndup(const wchar_t *, unsigned int);
137
#define strdup _strdup
138
#define strndup _strndup
139
#define wcsdup _wcsdup
140
#define wcsndup _wcsndup
143
#define strcmpi _stricmp
144
#define stricmp _stricmp
145
#define wgetcwd _wgetcwd
146
#define vsnprintf _vsnprintf
148
#define SHGetSpecialFolderPathW SHGetSpecialFolderPath
149
#define SHGetPathFromIDListW SHGetPathFromIDList
150
#define FONTENUMPROCW FONTENUMPROC
156
/* errno and family */
163
/* Environment stuff */
164
char* getenv(const char* inName);
165
int putenv(const char *a);
166
char SetEnvironmentVariableW(const unsigned short * name, const unsigned short * value );
167
char GetEnvironmentVariableW(const unsigned short * lpName, unsigned short* lpBuffer, unsigned long nSize);
169
unsigned int ExpandEnvironmentStringsW(const unsigned short* lpSrc,
170
unsigned short* lpDst,
173
/* File system stuff */
174
unsigned short * _wgetcwd(unsigned short* dir, unsigned long size);
175
unsigned short *_wfullpath( unsigned short *absPath, const unsigned short *relPath, unsigned long maxLength );
176
int _unlink(const char *filename );
177
int _wchdir(const unsigned short* path);
179
/* The time stuff should be defined here, but it can't be because it
180
is already defined in time.h.
182
size_t strftime(char *, size_t, const char *, const struct tm *)
183
struct tm* localtime(const time_t* inTimeT)
184
struct tm* mozce_gmtime_r(const time_t* inTimeT, struct tm* outRetval)
185
struct tm* gmtime(const time_t* inTimeT)
186
time_t mktime(struct tm* inTM)
187
time_t time(time_t *)
194
#ifndef _TIME_T_DEFINED
196
#define _TIME_T_DEFINED
199
struct tm* gmtime_r(const time_t* inTimeT, struct tm* outRetval);
200
struct tm* localtime_r(const time_t* inTimeT, struct tm* outRetval);
204
/* The locale stuff should be defined here, but it can't be because it
205
is already defined in locale.h.
207
struct lconv * localeconv(void)
212
unsigned short* mozce_GetEnvironmentCL();
214
/* square root of 1/2, missing from math.h */
215
#define M_SQRT1_2 0.707106781186547524401
221
#endif //MOZCE_SHUNT_H