1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
/* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mobile Application Link.
*
* The Initial Developer of the Original Code is AvantGo, Inc.
* Portions created by AvantGo, Inc. are Copyright (C) 1997-1999
* AvantGo, Inc. All Rights Reserved.
*
* Contributor(s):
*/
#ifndef __AGUTILWIN_H__
#define __AGUTILWIN_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <AGTypes.h>
#include <windows.h>
#if _WIN32_WCE >= 211
#include <windef.h>
#endif
#ifdef _WIN32
# include <stdlib.h>
# include <string.h>
# include <stdarg.h>
/* Common functions missing from windows. */
# define snprintf _snprintf
# define strncasecmp(s1, s2, len) strnicmp(s1, s2, len)
# define strcasecmp(s1, s2) stricmp(s1, s2)
# define bzero(dst, len) memset((dst), (0), (len))
# define bcopy(src, dst, len) memmove((dst), (src), (len))
# define AGSleepMillis(x) Sleep((x))
# define AGFreeFunc free
ExportFunc int32 index(const char *str, int8 c);
ExportFunc int32 rindex(const char *str, int8 c);
ExportFunc TCHAR *AGTStrDup(char *str);
ExportFunc char *AGCStrDup(TCHAR *str);
# ifdef _WIN32_WCE
/* map character classification tests to wide versions; this works because
* every ASCII character can be used as a Unicode character */
# ifndef isalnum
# define isalnum(c) iswalnum((wint_t) (c))
# endif
# ifndef isalpha
# define isalpha(c) iswalpha((wint_t) (c))
# endif
# ifndef isascii
# define isascii(c) iswascii((wint_t) (c))
# endif
# ifndef iscntrl
# define iscntrl(c) iswcntrl((wint_t) (c))
# endif
# ifndef isdigit
# define isdigit(c) iswdigit((wint_t) (c))
# endif
# ifndef isgraph
# define isgraph(c) iswgraph((wint_t) (c))
# endif
# ifndef islower
# define islower(c) iswlower((wint_t) (c))
# endif
# ifndef isprint
# define isprint(c) iswprint((wint_t) (c))
# endif
# ifndef ispunct
# define ispunct(c) iswpunct((wint_t) (c))
# endif
# ifndef isspace
# define isspace(c) iswspace((wint_t) (c))
# endif
# ifndef isupper
# define isupper(c) iswupper((wint_t) (c))
# endif
# ifndef isxdigit
# define isxdigit(c) iswxdigit((wint_t) (c))
# endif
# ifndef isalphanum
# define isalphanum(c) isalnum(c)
# endif
# ifndef hexDigit
# define hexDigit(n) ((n)<10 ? '0'+(n) : 'A'+(n)-10)
# endif
# define itoa _itoa
# if _WIN32_WCE < 211
ExportFunc int sprintf(char *buffer, const char *format,... );
# endif
ExportFunc char *strdup(const char *strSource );
# if _WIN32_WCE < 300
ExportFunc void *calloc(size_t num, size_t size );
ExportFunc int strnicmp(const char *s1, const char *s2, int len);
ExportFunc char *strrchr(char *s, int c);
# endif
ExportFunc int stricmp(const char *s1, const char *s2);
ExportFunc HRESULT AnsiToUnicode(LPCSTR pszA, LPWSTR* ppszW);
ExportFunc HRESULT UnicodeToAnsi(LPWSTR pszW, LPCSTR* ppszA);
ExportFunc WCHAR *ConvertAnsiToUnicode(const char *string);
ExportFunc char *ConvertUnicodeToAnsi(WCHAR *string);
ExportFunc void AGAssertionFailed();
# ifdef NDEBUG
# define assert(x)
# else
# define assert(x) if (!(x)) AGAssertionFailed()
# endif
# else /* _WIN32_WCE */
# include <stdio.h>
/* Windows doesn't have gettimeofday() (but it does have struct timeval
in winsock). This is an implementation in terms of ftime() which
only has millisecond resolution. */
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
ExportFunc int gettimeofday(struct timeval *tp, struct timezone *tzp);
# endif /* _WIN32_WCE */
#endif /* _WIN32 */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __AGUTILWIN_H__ */
|