mframe-preface.h
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:4k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. /* General purpose definitions for the GNU Objective-C Library.
  2.    Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
  3.    Written by:  Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
  4.    Created: May 1993
  5.    This file is part of the GNUstep Base Library.
  6.    This library is free software; you can redistribute it and/or
  7.    modify it under the terms of the GNU Library General Public
  8.    License as published by the Free Software Foundation; either
  9.    version 2 of the License, or (at your option) any later version.
  10.    
  11.    This library is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.    Library General Public License for more details.
  15.    You should have received a copy of the GNU Library General Public
  16.    License along with this library; if not, write to the Free
  17.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */ 
  19. #ifndef __preface_h_OBJECTS_INCLUDE
  20. #define __preface_h_OBJECTS_INCLUDE
  21. #undef PACKAGE
  22. #undef VERSION
  23. #include <config.h>
  24. #undef PACKAGE
  25. #undef VERSION
  26. #if defined(__hpux__) && defined(HAVE_SYS_SIGEVENT_H)
  27. #include <sys/sigevent.h>
  28. #endif
  29. #include <stdarg.h>
  30. #include <stdlib.h>
  31. #include <string.h> /* memcpy */
  32. #if 0
  33. #include <base/objc-gnu2next.h>
  34. #include <base/fake-main.h>
  35. #endif
  36. typedef struct  {
  37.   int           offset;
  38.   unsigned      size;
  39.   const char    *type;
  40. #ifndef NO_GNUSTEP
  41.   unsigned      align;
  42.   unsigned      qual;
  43.   BOOL          isReg;
  44. #endif
  45. } NSArgumentInfo;
  46. #define NSCParameterAssert(x) assert(x)
  47. #if (defined(__WIN32__) || defined(_WIN32)) && 0
  48. #include <windows.h>
  49. #define GNUSTEP_BASE_SOCKET_MESSAGE (WM_USER + 1)
  50. #endif
  51. #if NeXT_runtime
  52.  #include <objc/objc.h>
  53.  #include <objc/objc-class.h>
  54.  #include <objc/objc-runtime.h>
  55.  #ifndef _C_ATOM
  56.   #define _C_ATOM '%'
  57.  #endif
  58.  #define _F_CONST    0x01
  59.  #define _F_IN       0x01
  60.  #define _F_OUT      0x02
  61.  #define _F_INOUT    0x03
  62.  #define _F_BYCOPY   0x04
  63.  #define _F_ONEWAY   0x08
  64.  #define _C_CONST    'r'
  65.  #define _C_IN       'n'
  66.  #define _C_INOUT    'N'
  67.  #define _C_OUT      'o'
  68.  #define _C_BYCOPY   'O'
  69.  #define _C_ONEWAY   'V'
  70. #else /* GNU Objective C Runtime */
  71.  #include <objc/objc.h>
  72.  #include <objc/objc-api.h>
  73.  #include <objc/encoding.h>
  74.  #include <objc/sarray.h>
  75.  /* #include <objc/objc-list.h> */
  76. #endif
  77. #ifndef __WIN32__
  78. #include <sys/param.h> /* Hack to get rid of warning in GNU libc 2.0.3. */
  79. #endif
  80. #if 0
  81. #include <Foundation/NSObject.h>
  82. #include <Foundation/NSObjCRuntime.h>
  83. #endif
  84. #define OBJC_MALLOC(VAR, TYPE, NUM) 
  85.    ((VAR) = (TYPE *) objc_malloc ((unsigned)(NUM)*sizeof(TYPE))) 
  86. #define OBJC_VALLOC(VAR, TYPE, NUM) 
  87.    ((VAR) = (TYPE *) objc_valloc ((unsigned)(NUM)*sizeof(TYPE))) 
  88. #define OBJC_ATOMIC_MALLOC(VAR, TYPE, NUM) 
  89.    ((VAR) = (TYPE *) objc_atomic_malloc ((unsigned)(NUM)*sizeof(TYPE))) 
  90. #define OBJC_REALLOC(VAR, TYPE, NUM) 
  91.    ((VAR) = (TYPE *) objc_realloc ((VAR), (unsigned)(NUM)*sizeof(TYPE)))
  92. #define OBJC_CALLOC(VAR, TYPE, NUM) 
  93.    ((VAR) = (TYPE *) objc_calloc ((unsigned)(NUM), sizeof(TYPE)))
  94. #define OBJC_FREE(PTR) objc_free (PTR)
  95. #ifndef MAX
  96. #define MAX(a,b) 
  97.        ({typeof(a) _MAX_a = (a); typeof(b) _MAX_b = (b);  
  98.          _MAX_a > _MAX_b ? _MAX_a : _MAX_b; })
  99. #endif
  100. #ifndef MIN
  101. #define MIN(a,b) 
  102.        ({typeof(a) _MIN_a = (a); typeof(b) _MIN_b = (b);  
  103.          _MIN_a < _MIN_b ? _MIN_a : _MIN_b; })
  104. #endif
  105. #ifndef ABS
  106. #define ABS(a) 
  107.        ({typeof(a) _ABS_a = (a); 
  108.          _ABS_a < 0 ? -_ABS_a : _ABS_a; })
  109. #endif
  110. #ifndef STRINGIFY
  111. #define STRINGIFY(s) XSTRINGIFY(s)
  112. #define XSTRINGIFY(s) #s
  113. #endif
  114. #ifndef OBJC_STRINGIFY
  115. #define OBJC_STRINGIFY(s) OBJC_XSTRINGIFY(s)
  116. #define OBJC_XSTRINGIFY(s) @#s
  117. #endif
  118. #ifndef PTR2LONG
  119. #define PTR2LONG(P) (((char*)(P))-(char*)0)
  120. #endif
  121. #ifndef LONG2PTR
  122. #define LONG2PTR(L) (((char*)0)+(L))
  123. #endif
  124. #if VSPRINTF_RETURNS_LENGTH 
  125. #define VSPRINTF_LENGTH(VSPF_CALL) (VSPF_CALL)
  126. #else
  127. #define VSPRINTF_LENGTH(VSPF_CALL) strlen((VSPF_CALL))
  128. #endif /* VSPRINTF_RETURNS_LENGTH */
  129. #endif /* __preface_h_OBJECTS_INCLUDE */