1 /* $Id: __typemap.h,v 1.10 2004/05/10 02:42:51 sgreenhill Exp $ */ 2 /* Mapping of basic types to C types. 3 Copyright (C) 1997-2003 Michael van Acken 4 5 This module is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public License 7 as published by the Free Software Foundation; either version 2 of 8 the License, or (at your option) any later version. 9 10 This module is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with OOC. If not, write to the Free Software Foundation, 17 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 */ 19 #ifndef __typemap__ 20 #define __typemap__ 21 22 #include "__config.h" 23 24 /* these types should be used when writing a C function whose header has to 25 correspond to an Oberon-2 declaration */ 26 typedef unsigned char OOC_BOOLEAN; 27 typedef unsigned char OOC_CHAR8; 28 typedef unsigned short int OOC_CHAR16; 29 typedef unsigned int OOC_CHAR32; 30 typedef signed char OOC_INT8; 31 typedef signed short int OOC_INT16; 32 typedef signed int OOC_INT32; 33 typedef OOC_INT64_T OOC_INT64; 34 typedef float OOC_REAL32; 35 typedef double OOC_REAL64; 36 typedef unsigned char OOC_UINT8; 37 typedef unsigned short int OOC_UINT16; 38 typedef unsigned int OOC_UINT32; 39 typedef unsigned OOC_INT64_T OOC_UINT64; 40 typedef unsigned char OOC_BYTE; 41 typedef void *OOC_PTR; 42 43 /* type used to store length of array types: */ 44 typedef OOC_INT32 OOC_LEN; 45 typedef OOC_UINT32 OOC_ULEN; 46 47 /* type of character position in files: */ 48 typedef OOC_INT32 OOC_CHARPOS; 49 50 /* standard constants: */ 51 #ifndef NULL 52 #define NULL (void*)0 53 #endif 54 #define OOC_FALSE 0 55 #define OOC_TRUE 1 56 57 /* format string used by printf for OOC_INT32 (%i if it is equal to int, 58 %li if it is long int), and OOC_LEN */ 59 #define OOC_INT32_FORMAT "%i" 60 #define OOC_LEN_FORMAT "%i" 61 62 63 64 #undef NORETURN 65 #undef NORETURN2 66 #if __GNUC__>2 || (__GNUC__==2 && __GNUC_MINOR__>=6) 67 #define NORETURN 68 #define NORETURN2 __attribute__ ((__noreturn__)) 69 #else 70 #define NORETURN 71 #define NORETURN2 72 #endif 73 74 /* Certain library modules assume that size parameters are defined using the 75 * `ssize_t' type. Some environments use `int' for size parameters and do not 76 * define the `ssize_t' type. Here is a fix for such environments. Currently, 77 * this seems to be required for mingw32 versions prior to 3.1. 78 */ 79 80 #ifndef HAVE_SSIZE_T 81 typedef int ssize_t; 82 #endif 83 84 #endif /* __typemap__ */ 85