PlatformSpecific.h
资源名称:cppapp.zip [点击查看]
上传用户:smh666999
上传日期:2007-01-14
资源大小:553k
文件大小:2k
源码类别:
BREW编程
开发平台:
Visual C++
- #ifndef PS_H
- #define PS_H
- typedef unsigned int UINT;
- #define BREW
- #ifdef BREW
- #include <aeestdlib.h>
- inline void* operator new(UINT size)
- {
- return MALLOC(size);
- }
- inline void operator delete(void * ptr)
- {
- FREE(ptr);
- }
- inline void* operator new[](UINT size)
- {
- return MALLOC(size);
- }
- inline void operator delete[](void * ptr)
- {
- FREE(ptr);
- }
- #ifndef STRUPPER
- extern "C" bool isLower(char c);
- static bool isUpper(char c)
- {
- return (c <91) && (c >64);
- }
- static char toUpper(char c)
- {
- if (!isUpper(c) && isLower(c))
- return c - 32;
- return c;
- }
- static void STRUPPER(char* s)
- {
- while(*s)
- {
- *s = toUpper(*s);
- s++;
- }
- }
- #endif
- #ifndef STRLOWER
- static bool isLower(char c)
- {
- return c <123 && c >96;
- }
- static char toLower(char c)
- {
- if (!isLower(c) && isUpper(c))
- return c + 32;
- return c;
- }
- static void STRLOWER(char* s)
- {
- while(*s)
- {
- *s = toLower(*s);
- s++;
- }
- }
- #endif
- #else
- #include <stdlib.h>
- #define MALLOC malloc
- #define FREE free
- #define STRCMP strcmp
- #define STRNCMP strncmp
- #define STRLEN strlen
- #define STRSTR strstr
- #define STRCPY strcpy
- #define STRNCPY strncpy
- #define STRCAT strcat
- #define STRCHR strchr
- #define STRLOWER strlwr
- #define STRUPPER strupr
- #define MEMCPY memcpy
- #define MEMMOVE memmove
- #define SPRINTF sprintf
- #endif
- template <int v>
- struct Int2Type
- {
- enum {value = v};
- };
- template <class T>
- struct Type2Type
- {
- typedef T TYPE;
- };
- #endif