Ignore:
Timestamp:
Mar 5, 2014 6:48:59 AM (8 years ago)
Author:
riza
Message:

Re #1704:

  • Fix duplicate code on os_winphone.h
  • Change the use of PJ_WIN32_WINPHONE to follow the code convention
  • Fix incorrect link of the Thread library
  • Handle exception raised from select() API. However the break window will still be shown when debugging on Visual Studio. To disable it, from Debug>Exceptions>Win32 Exceptions> unmark the "An invalid handle was specified” exception.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/winphone/pjlib/include/pj/compat/os_winphone.h

    r4618 r4777  
    2222 
    2323/** 
    24  * @file os_win32.h 
    25  * @brief Describes Win32 operating system family specifics. 
     24 * @file os_winphone.h 
     25 * @brief Describes Windows Phone operating system family specifics. 
    2626 */ 
    2727 
     
    146146 
    147147 
    148 #endif  /* __PJ_COMPAT_OS_WIN32_WINCE_H__ */ 
     148#endif  /* __PJ_COMPAT_OS_WIN32_WINPHONE_H__ */ 
    149149 
    150 /* $Id$ */ 
    151 /*  
    152  * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) 
    153  * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> 
    154  * 
    155  * This program is free software; you can redistribute it and/or modify 
    156  * it under the terms of the GNU General Public License as published by 
    157  * the Free Software Foundation; either version 2 of the License, or 
    158  * (at your option) any later version. 
    159  * 
    160  * This program is distributed in the hope that it will be useful, 
    161  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    162  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    163  * GNU General Public License for more details. 
    164  * 
    165  * You should have received a copy of the GNU General Public License 
    166  * along with this program; if not, write to the Free Software 
    167  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    168  */ 
    169 #ifndef __PJ_COMPAT_OS_WINPHONE_H__ 
    170 #define __PJ_COMPAT_OS_WIN32_WINPHONE_H__ 
    171  
    172 /** 
    173  * @file os_win32.h 
    174  * @brief Describes Win32 operating system family specifics. 
    175  */ 
    176  
    177 #define PJ_OS_NAME                  "winphone" 
    178  
    179 #define WIN32_LEAN_AND_MEAN 
    180 #define RPC_NO_WINDOWS_H 
    181 #define PJ_WIN32_WINNT              0x0602 /*_WIN32_WINNT_WIN8*/ 
    182 #ifdef _WIN32_WINNT 
    183 #undef _WIN32_WINNT 
    184 #define _WIN32_WINNT                PJ_WIN32_WINNT 
    185 #endif 
    186  
    187 #define PJ_HAS_ARPA_INET_H          0 
    188 #define PJ_HAS_ASSERT_H             1 
    189 #define PJ_HAS_CTYPE_H              1 
    190 #define PJ_HAS_ERRNO_H              0   /* Must be zero, otherwise errno_test() fails. */ 
    191 #define PJ_HAS_LINUX_SOCKET_H       0 
    192 #define PJ_HAS_MALLOC_H             1 
    193 #define PJ_HAS_NETDB_H              0 
    194 #define PJ_HAS_NETINET_IN_H         0 
    195 #define PJ_HAS_NETINET_TCP_H        0 
    196 #define PJ_HAS_SETJMP_H             1 
    197 #define PJ_HAS_STDARG_H             1 
    198 #define PJ_HAS_STDDEF_H             1 
    199 #define PJ_HAS_STDIO_H              1 
    200 #define PJ_HAS_STDLIB_H             1 
    201 #define PJ_HAS_STRING_H             1 
    202 #define PJ_HAS_SYS_IOCTL_H          0 
    203 #define PJ_HAS_SYS_SELECT_H         0 
    204 #define PJ_HAS_SYS_SOCKET_H         0 
    205 #define PJ_HAS_SYS_TIME_H           0 
    206 #define PJ_HAS_SYS_TIMEB_H          0   /* Doesn't have sys/timeb.h */ 
    207 #define PJ_HAS_SYS_TYPES_H          0   /* Doesn't have sys/types.h */ 
    208 #define PJ_HAS_TIME_H               1 
    209 #define PJ_HAS_UNISTD_H             0 
    210  
    211 #define PJ_HAS_MSWSOCK_H            1 
    212 #define PJ_HAS_WINSOCK_H            0 
    213 #define PJ_HAS_WINSOCK2_H           1 
    214  
    215 #define PJ_SOCK_HAS_INET_ATON       0 
    216  
    217 /* Set 1 if native sockaddr_in has sin_len member.  
    218  * Default: 0 
    219  */ 
    220 #define PJ_SOCKADDR_HAS_LEN         0 
    221  
    222 /* Is errno a good way to retrieve OS errors? (no) 
    223  */ 
    224 #define PJ_HAS_ERRNO_VAR            0 
    225  
    226 /* When this macro is set, getsockopt(SOL_SOCKET, SO_ERROR) will return 
    227  * the status of non-blocking connect() operation. 
    228  */ 
    229 #define PJ_HAS_SO_ERROR             0 
    230  
    231 /* This value specifies the value set in errno by the OS when a non-blocking 
    232  * socket recv() or send() can not return immediately. 
    233  */ 
    234 #define PJ_BLOCKING_ERROR_VAL       WSAEWOULDBLOCK 
    235  
    236 /* This value specifies the value set in errno by the OS when a non-blocking 
    237  * socket connect() can not get connected immediately. 
    238  */ 
    239 #define PJ_BLOCKING_CONNECT_ERROR_VAL   WSAEWOULDBLOCK 
    240  
    241 /** 
    242  * If this macro is set, it tells select I/O Queue that select() needs to 
    243  * be given correct value of nfds (i.e. largest fd + 1). This requires 
    244  * select ioqueue to re-scan the descriptors on each registration and 
    245  * unregistration. 
    246  * If this macro is not set, then ioqueue will always give FD_SETSIZE for 
    247  * nfds argument when calling select(). 
    248  * 
    249  * Default: 0 
    250  */ 
    251 #define PJ_SELECT_NEEDS_NFDS        0 
    252  
    253 /* Endianness */ 
    254 #ifndef PJ_IS_LITTLE_ENDIAN 
    255 #   define PJ_IS_LITTLE_ENDIAN  1 
    256 #   define PJ_IS_BIG_ENDIAN     0 
    257 #endif 
    258  
    259 /* Default threading is enabled, unless it's overridden. */ 
    260 #ifndef PJ_HAS_THREADS 
    261 #  define PJ_HAS_THREADS            (1) 
    262 #endif 
    263  
    264 #define PJ_HAS_HIGH_RES_TIMER       1 
    265 #define PJ_HAS_MALLOC               1 
    266 #define PJ_OS_HAS_CHECK_STACK       1 
    267  
    268 #define PJ_ATOMIC_VALUE_TYPE        long 
    269  
    270 /* No console. */ 
    271 #define PJ_TERM_HAS_COLOR           0 
    272  
    273 /* TlsAlloc() error value. */ 
    274 #define TLS_OUT_OF_INDEXES          0xFFFFFFFF 
    275  
    276 /* No rdtsc */ 
    277 #define PJ_TIMESTAMP_USE_RDTSC      0 
    278  
    279 /* Native string is Unicode. */ 
    280 #define PJ_NATIVE_STRING_IS_UNICODE 1 
    281  
    282 /* If 1, use Read/Write mutex emulation for platforms that don't support it */ 
    283 #define PJ_EMULATE_RWMUTEX          1 
    284  
    285 /* If 1, pj_thread_create() should enforce the stack size when creating  
    286  * threads. 
    287  * Default: 0 (let OS decide the thread's stack size). 
    288  */ 
    289 #define PJ_THREAD_SET_STACK_SIZE        0 
    290  
    291 /* If 1, pj_thread_create() should allocate stack from the pool supplied. 
    292  * Default: 0 (let OS allocate memory for thread's stack). 
    293  */ 
    294 #define PJ_THREAD_ALLOCATE_STACK        0 
    295  
    296  
    297 #endif  /* __PJ_COMPAT_OS_WIN32_WINCE_H__ */ 
    298  
    299 /* $Id$ */ 
    300 /*  
    301  * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) 
    302  * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> 
    303  * 
    304  * This program is free software; you can redistribute it and/or modify 
    305  * it under the terms of the GNU General Public License as published by 
    306  * the Free Software Foundation; either version 2 of the License, or 
    307  * (at your option) any later version. 
    308  * 
    309  * This program is distributed in the hope that it will be useful, 
    310  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    311  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    312  * GNU General Public License for more details. 
    313  * 
    314  * You should have received a copy of the GNU General Public License 
    315  * along with this program; if not, write to the Free Software 
    316  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    317  */ 
    318 #ifndef __PJ_COMPAT_OS_WINPHONE_H__ 
    319 #define __PJ_COMPAT_OS_WIN32_WINPHONE_H__ 
    320  
    321 /** 
    322  * @file os_win32.h 
    323  * @brief Describes Win32 operating system family specifics. 
    324  */ 
    325  
    326 #define PJ_OS_NAME                  "winphone" 
    327  
    328 #define WIN32_LEAN_AND_MEAN 
    329 #define RPC_NO_WINDOWS_H 
    330 #define PJ_WIN32_WINNT              0x0602 /*_WIN32_WINNT_WIN8*/ 
    331 #ifdef _WIN32_WINNT 
    332 #undef _WIN32_WINNT 
    333 #define _WIN32_WINNT                PJ_WIN32_WINNT 
    334 #endif 
    335  
    336 #define PJ_HAS_ARPA_INET_H          0 
    337 #define PJ_HAS_ASSERT_H             1 
    338 #define PJ_HAS_CTYPE_H              1 
    339 #define PJ_HAS_ERRNO_H              0   /* Must be zero, otherwise errno_test() fails. */ 
    340 #define PJ_HAS_LINUX_SOCKET_H       0 
    341 #define PJ_HAS_MALLOC_H             1 
    342 #define PJ_HAS_NETDB_H              0 
    343 #define PJ_HAS_NETINET_IN_H         0 
    344 #define PJ_HAS_NETINET_TCP_H        0 
    345 #define PJ_HAS_SETJMP_H             1 
    346 #define PJ_HAS_STDARG_H             1 
    347 #define PJ_HAS_STDDEF_H             1 
    348 #define PJ_HAS_STDIO_H              1 
    349 #define PJ_HAS_STDLIB_H             1 
    350 #define PJ_HAS_STRING_H             1 
    351 #define PJ_HAS_SYS_IOCTL_H          0 
    352 #define PJ_HAS_SYS_SELECT_H         0 
    353 #define PJ_HAS_SYS_SOCKET_H         0 
    354 #define PJ_HAS_SYS_TIME_H           0 
    355 #define PJ_HAS_SYS_TIMEB_H          0   /* Doesn't have sys/timeb.h */ 
    356 #define PJ_HAS_SYS_TYPES_H          0   /* Doesn't have sys/types.h */ 
    357 #define PJ_HAS_TIME_H               1 
    358 #define PJ_HAS_UNISTD_H             0 
    359  
    360 #define PJ_HAS_MSWSOCK_H            1 
    361 #define PJ_HAS_WINSOCK_H            0 
    362 #define PJ_HAS_WINSOCK2_H           1 
    363  
    364 #define PJ_SOCK_HAS_INET_ATON       0 
    365  
    366 /* Set 1 if native sockaddr_in has sin_len member.  
    367  * Default: 0 
    368  */ 
    369 #define PJ_SOCKADDR_HAS_LEN         0 
    370  
    371 /* Is errno a good way to retrieve OS errors? (no) 
    372  */ 
    373 #define PJ_HAS_ERRNO_VAR            0 
    374  
    375 /* When this macro is set, getsockopt(SOL_SOCKET, SO_ERROR) will return 
    376  * the status of non-blocking connect() operation. 
    377  */ 
    378 #define PJ_HAS_SO_ERROR             0 
    379  
    380 /* This value specifies the value set in errno by the OS when a non-blocking 
    381  * socket recv() or send() can not return immediately. 
    382  */ 
    383 #define PJ_BLOCKING_ERROR_VAL       WSAEWOULDBLOCK 
    384  
    385 /* This value specifies the value set in errno by the OS when a non-blocking 
    386  * socket connect() can not get connected immediately. 
    387  */ 
    388 #define PJ_BLOCKING_CONNECT_ERROR_VAL   WSAEWOULDBLOCK 
    389  
    390 /** 
    391  * If this macro is set, it tells select I/O Queue that select() needs to 
    392  * be given correct value of nfds (i.e. largest fd + 1). This requires 
    393  * select ioqueue to re-scan the descriptors on each registration and 
    394  * unregistration. 
    395  * If this macro is not set, then ioqueue will always give FD_SETSIZE for 
    396  * nfds argument when calling select(). 
    397  * 
    398  * Default: 0 
    399  */ 
    400 #define PJ_SELECT_NEEDS_NFDS        0 
    401  
    402 /* Endianness */ 
    403 #ifndef PJ_IS_LITTLE_ENDIAN 
    404 #   define PJ_IS_LITTLE_ENDIAN  1 
    405 #   define PJ_IS_BIG_ENDIAN     0 
    406 #endif 
    407  
    408 /* Default threading is enabled, unless it's overridden. */ 
    409 #ifndef PJ_HAS_THREADS 
    410 #  define PJ_HAS_THREADS            (1) 
    411 #endif 
    412  
    413 #define PJ_HAS_HIGH_RES_TIMER       1 
    414 #define PJ_HAS_MALLOC               1 
    415 #define PJ_OS_HAS_CHECK_STACK       1 
    416  
    417 #define PJ_ATOMIC_VALUE_TYPE        long 
    418  
    419 /* No console. */ 
    420 #define PJ_TERM_HAS_COLOR           0 
    421  
    422 /* TlsAlloc() error value. */ 
    423 #define TLS_OUT_OF_INDEXES          0xFFFFFFFF 
    424  
    425 /* No rdtsc */ 
    426 #define PJ_TIMESTAMP_USE_RDTSC      0 
    427  
    428 /* Native string is Unicode. */ 
    429 #define PJ_NATIVE_STRING_IS_UNICODE 1 
    430  
    431 /* If 1, use Read/Write mutex emulation for platforms that don't support it */ 
    432 #define PJ_EMULATE_RWMUTEX          1 
    433  
    434 /* If 1, pj_thread_create() should enforce the stack size when creating  
    435  * threads. 
    436  * Default: 0 (let OS decide the thread's stack size). 
    437  */ 
    438 #define PJ_THREAD_SET_STACK_SIZE        0 
    439  
    440 /* If 1, pj_thread_create() should allocate stack from the pool supplied. 
    441  * Default: 0 (let OS allocate memory for thread's stack). 
    442  */ 
    443 #define PJ_THREAD_ALLOCATE_STACK        0 
    444  
    445  
    446 #endif  /* __PJ_COMPAT_OS_WIN32_WINCE_H__ */ 
    447  
Note: See TracChangeset for help on using the changeset viewer.