From 47e7de1c94be7f826080b3711451eafee894791f Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 19 Jan 2006 03:58:29 +0000 Subject: Initial, quick and dirty WinCE port with EVC4 git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@125 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/include/pj/compat/errno.h | 3 +- pjlib/include/pj/compat/m_arm.h | 38 ++++++++++++ pjlib/include/pj/compat/os_linux.h | 1 + pjlib/include/pj/compat/os_linux_kernel.h | 1 + pjlib/include/pj/compat/os_palmos.h | 1 + pjlib/include/pj/compat/os_sunos.h | 1 + pjlib/include/pj/compat/os_win32.h | 1 + pjlib/include/pj/compat/os_win32_wince.h | 99 +++++++++++++++++++++++++++++++ pjlib/include/pj/compat/socket.h | 6 +- pjlib/include/pj/compat/string.h | 6 +- pjlib/include/pj/compat/unicode.h | 45 ++++++++++++++ 11 files changed, 197 insertions(+), 5 deletions(-) create mode 100644 pjlib/include/pj/compat/m_arm.h create mode 100644 pjlib/include/pj/compat/os_win32_wince.h create mode 100644 pjlib/include/pj/compat/unicode.h (limited to 'pjlib/include/pj/compat') diff --git a/pjlib/include/pj/compat/errno.h b/pjlib/include/pj/compat/errno.h index a4246d72..8c86daa9 100644 --- a/pjlib/include/pj/compat/errno.h +++ b/pjlib/include/pj/compat/errno.h @@ -19,7 +19,8 @@ #ifndef __PJ_COMPAT_ERRNO_H__ #define __PJ_COMPAT_ERRNO_H__ -#if defined(PJ_WIN32) && PJ_WIN32 != 0 +#if defined(PJ_WIN32) && PJ_WIN32 != 0 || \ + defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE != 0 typedef unsigned long pj_os_err_type; # define pj_get_native_os_error() GetLastError() diff --git a/pjlib/include/pj/compat/m_arm.h b/pjlib/include/pj/compat/m_arm.h new file mode 100644 index 00000000..b81ce32c --- /dev/null +++ b/pjlib/include/pj/compat/m_arm.h @@ -0,0 +1,38 @@ +/* $Id$ */ +/* + * Copyright (C)2003-2006 Benny Prijono + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PJ_COMPAT_M_ARM_H__ +#define __PJ_COMPAT_M_ARM_H__ + +/** + * @file m_arm.h + * @brief Describes ARM family processor specifics. + */ + +/* + * This file covers PJ_M_ARMV4 etc. + */ + +#define PJ_M_NAME "ARM" + +#define PJ_HAS_PENTIUM 0 +#define PJ_IS_LITTLE_ENDIAN 1 +#define PJ_IS_BIG_ENDIAN 0 + + +#endif /* __PJ_COMPAT_M_ARM_H__ */ diff --git a/pjlib/include/pj/compat/os_linux.h b/pjlib/include/pj/compat/os_linux.h index 7f90164f..ab26852f 100644 --- a/pjlib/include/pj/compat/os_linux.h +++ b/pjlib/include/pj/compat/os_linux.h @@ -77,6 +77,7 @@ #define PJ_HAS_HIGH_RES_TIMER 1 #define PJ_HAS_MALLOC 1 #define PJ_OS_HAS_CHECK_STACK 0 +#define PJ_NATIVE_STRING_IS_UNICODE 0 #define PJ_ATOMIC_VALUE_TYPE long diff --git a/pjlib/include/pj/compat/os_linux_kernel.h b/pjlib/include/pj/compat/os_linux_kernel.h index 164cde52..11e22da0 100644 --- a/pjlib/include/pj/compat/os_linux_kernel.h +++ b/pjlib/include/pj/compat/os_linux_kernel.h @@ -96,6 +96,7 @@ #define PJ_HAS_HIGH_RES_TIMER 1 #define PJ_OS_HAS_CHECK_STACK 0 #define PJ_TERM_HAS_COLOR 0 +#define PJ_NATIVE_STRING_IS_UNICODE 0 #define PJ_ATOMIC_VALUE_TYPE int #define PJ_THREAD_DESC_SIZE 128 diff --git a/pjlib/include/pj/compat/os_palmos.h b/pjlib/include/pj/compat/os_palmos.h index 9f62fe28..3d540a3b 100644 --- a/pjlib/include/pj/compat/os_palmos.h +++ b/pjlib/include/pj/compat/os_palmos.h @@ -75,5 +75,6 @@ #define PJ_HAS_HIGH_RES_TIMER 1 #define PJ_OS_HAS_CHECK_STACK 0 +#define PJ_NATIVE_STRING_IS_UNICODE 0 #endif /* __PJ_COMPAT_OS_PALMOS_H__ */ diff --git a/pjlib/include/pj/compat/os_sunos.h b/pjlib/include/pj/compat/os_sunos.h index 9a3ff335..269631ff 100644 --- a/pjlib/include/pj/compat/os_sunos.h +++ b/pjlib/include/pj/compat/os_sunos.h @@ -77,6 +77,7 @@ #define PJ_HAS_HIGH_RES_TIMER 1 #define PJ_HAS_MALLOC 1 #define PJ_OS_HAS_CHECK_STACK 0 +#define PJ_NATIVE_STRING_IS_UNICODE 0 #define PJ_ATOMIC_VALUE_TYPE long diff --git a/pjlib/include/pj/compat/os_win32.h b/pjlib/include/pj/compat/os_win32.h index 03c4f544..a078a7e7 100644 --- a/pjlib/include/pj/compat/os_win32.h +++ b/pjlib/include/pj/compat/os_win32.h @@ -81,6 +81,7 @@ #define PJ_HAS_HIGH_RES_TIMER 1 #define PJ_HAS_MALLOC 1 #define PJ_OS_HAS_CHECK_STACK 1 +#define PJ_NATIVE_STRING_IS_UNICODE 0 #define PJ_ATOMIC_VALUE_TYPE long diff --git a/pjlib/include/pj/compat/os_win32_wince.h b/pjlib/include/pj/compat/os_win32_wince.h new file mode 100644 index 00000000..05b89187 --- /dev/null +++ b/pjlib/include/pj/compat/os_win32_wince.h @@ -0,0 +1,99 @@ +/* $Id$ */ +/* + * Copyright (C)2003-2006 Benny Prijono + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PJ_COMPAT_OS_WIN32_WINCE_H__ +#define __PJ_COMPAT_OS_WIN32_WINCE_H__ + +/** + * @file os_win32.h + * @brief Describes Win32 operating system family specifics. + */ + +#define PJ_OS_NAME "win32-wince" + +#define WIN32_LEAN_AND_MEAN +//#define PJ_WIN32_WINNT 0x0400 +//#define _WIN32_WINNT PJ_WIN32_WINNT + +#define PJ_HAS_ARPA_INET_H 0 +#define PJ_HAS_ASSERT_H 1 +#define PJ_HAS_CTYPE_H 1 +#define PJ_HAS_ERRNO_H 0 /* Must be zero, otherwise errno_test() fails. */ +#define PJ_HAS_LINUX_SOCKET_H 0 +#define PJ_HAS_MALLOC_H 1 +#define PJ_HAS_NETDB_H 0 +#define PJ_HAS_NETINET_IN_H 0 +#define PJ_HAS_SETJMP_H 1 +#define PJ_HAS_STDARG_H 1 +#define PJ_HAS_STDDEF_H 1 +#define PJ_HAS_STDIO_H 1 +#define PJ_HAS_STDLIB_H 1 +#define PJ_HAS_STRING_H 1 +#define PJ_HAS_SYS_IOCTL_H 0 +#define PJ_HAS_SYS_SELECT_H 0 +#define PJ_HAS_SYS_SOCKET_H 0 +#define PJ_HAS_SYS_TIMEB_H 0 /* Doesn't have sys/timeb.h */ +#define PJ_HAS_SYS_TYPES_H 0 /* Doesn't have sys/types.h */ +#define PJ_HAS_TIME_H 1 +#define PJ_HAS_UNISTD_H 0 + +#define PJ_HAS_MSWSOCK_H 1 +#define PJ_HAS_WINSOCK_H 0 +#define PJ_HAS_WINSOCK2_H 1 + +#define PJ_SOCK_HAS_INET_ATON 0 + +/* When this macro is set, getsockopt(SOL_SOCKET, SO_ERROR) will return + * the status of non-blocking connect() operation. + */ +#define PJ_HAS_SO_ERROR 0 + +/* This value specifies the value set in errno by the OS when a non-blocking + * socket recv() or send() can not return immediately. + */ +#define PJ_BLOCKING_ERROR_VAL WSAEWOULDBLOCK + +/* This value specifies the value set in errno by the OS when a non-blocking + * socket connect() can not get connected immediately. + */ +#define PJ_BLOCKING_CONNECT_ERROR_VAL WSAEWOULDBLOCK + +/* Default threading is enabled, unless it's overridden. */ +#ifndef PJ_HAS_THREADS +# define PJ_HAS_THREADS (1) +#endif + +#define PJ_HAS_HIGH_RES_TIMER 1 +#define PJ_HAS_MALLOC 1 +#define PJ_OS_HAS_CHECK_STACK 1 + +#define PJ_ATOMIC_VALUE_TYPE long + +/* TlsAlloc() error value. */ +#define TLS_OUT_OF_INDEXES 0xFFFFFFFF + +/* No console. */ +#define PJ_TERM_HAS_COLOR 0 + +/* No rdtsc */ +#define PJ_TIMESTAMP_USE_RDTSC 0 + +/* Native string is Unicode. */ +#define PJ_NATIVE_STRING_IS_UNICODE 1 + +#endif /* __PJ_COMPAT_OS_WIN32_WINCE_H__ */ diff --git a/pjlib/include/pj/compat/socket.h b/pjlib/include/pj/compat/socket.h index 1ef7fff3..ee4f3a6e 100644 --- a/pjlib/include/pj/compat/socket.h +++ b/pjlib/include/pj/compat/socket.h @@ -95,7 +95,7 @@ /* * Linux kernel specifics */ -#ifdef PJ_LINUX_KERNEL +#if defined(PJ_LINUX_KERNEL) # include # include /* FIONBIO */ # include /* sys_select() */ @@ -123,8 +123,8 @@ /* * Windows specific */ -#ifdef PJ_WIN32 - typedef int socklen_t;; +#if defined(PJ_WIN32) || defined(PJ_WIN32_WINCE) + typedef int socklen_t; #endif diff --git a/pjlib/include/pj/compat/string.h b/pjlib/include/pj/compat/string.h index 56ae5c2f..fd041230 100644 --- a/pjlib/include/pj/compat/string.h +++ b/pjlib/include/pj/compat/string.h @@ -35,7 +35,11 @@ #if defined(_MSC_VER) # define strcasecmp stricmp -# define strncasecmp strnicmp +# if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0 +# define strncasecmp _strnicmp +# else +# define strncasecmp strnicmp +# endif # define snprintf _snprintf #else # define stricmp strcasecmp diff --git a/pjlib/include/pj/compat/unicode.h b/pjlib/include/pj/compat/unicode.h new file mode 100644 index 00000000..cefa44ce --- /dev/null +++ b/pjlib/include/pj/compat/unicode.h @@ -0,0 +1,45 @@ +/* $Id$ */ +/* + * Copyright (C)2003-2006 Benny Prijono + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PJ_COMPAT_UNICODE_H__ +#define __PJ_COMPAT_UNICODE_H__ + +#include + +/** + * @file unicode.h + * @brief Provides Unicode conversion for Unicode OSes + */ + +#if defined(PJ_NATIVE_STRING_IS_UNICODE) && PJ_NATIVE_STRING_IS_UNICODE!=0 + +# define PJ_DECL_UNICODE_TEMP_BUF(var,size) wchar_t var[size] +# define PJ_NATIVE_STRING(s,buf) pj_ansi_to_unicode(s,buf,PJ_ARRAY_SIZE(buf)) + + PJ_DECL(wchar_t*) pj_ansi_to_unicode(const char *s, wchar_t *buf, + pj_size_t buf_count); + +#else /* PJ_NATIVE_STRING_IS_UNICODE */ + +# define PJ_DECL_UNICODE_TEMP_BUF(var,size) +# define PJ_NATIVE_STRING(s, buf) s + +#endif /* PJ_NATIVE_STRING_IS_UNICODE */ + + +#endif /* __PJ_COMPAT_UNICODE_H__ */ -- cgit v1.2.3