1(* $Id: C.Mod,v 1.8 2005/08/31 06:49:48 mva Exp $ *) 2MODULE C [INTERFACE "C"]; 3(* Basic data types for interfacing to C code. 4 Copyright (C) 1997-1998, 2005 Michael van Acken 5 6 This module is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public License 8 as published by the Free Software Foundation; either version 2 of 9 the License, or (at your option) any later version. 10 11 This module is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with OOC. If not, write to the Free Software Foundation, 18 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19*) 20 21IMPORT 22 SYSTEM, RT0; 23 24(**The types from this module are intended to be equivalent to their C 25 counterparts. They may vary depending on your system, but as long as you 26 stick to a 32 Bit Unix they should be fairly safe. *) 27 28TYPE 29 char* = CHAR; 30 signedchar* = SHORTINT; (* signed char *) 31 shortint* = INTEGER; (* short int *) 32 int* = LONGINT; 33 set* = SET; (* unsigned int, used as set *) 34 longint* = LONGINT; (* long int *) 35 longset* = SET; (* unsigned long, used as set *) 36 address* = SYSTEM.ADDRESS; 37 float* = REAL; 38 double* = LONGREAL; 39 40 enum1* = int; 41 enum2* = int; 42 enum4* = int; 43 44 (* if your C compiler uses short enumerations, you'll have to replace the 45 declarations above with 46 enum1* = SHORTINT; 47 enum2* = INTEGER; 48 enum4* = LONGINT; 49 *) 50 51 FILE* = address; (* this is acually a replacement for `FILE*', i.e., for a pointer type *) 52 size_t* = longint; 53 uid_t* = int; 54 gid_t* = int; 55 56 57TYPE (* some commonly used C array types *) 58 charPtr1d* = RT0.charPtr1d; 59 charPtr2d* = RT0.charPtr2d; 60 intPtr1d* = POINTER TO ARRAY OF int; 61 62TYPE (* C string type, assignment compatible with character arrays and 63 string constants *) 64 string* = POINTER [CSTRING] TO ARRAY OF char; 65 66TYPE 67 Proc* = PROCEDURE; 68 69END C. 70