]> err.no Git - sope/blob - sope-appserver/NGObjWeb/common.h
added svn:keywords and svn:ignore where appropriate. removed CVS artifacts.
[sope] / sope-appserver / NGObjWeb / common.h
1 /*
2   Copyright (C) 2000-2003 SKYRIX Software AG
3
4   This file is part of OGo
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __NGObjWeb_common_H__
24 #define __NGObjWeb_common_H__
25
26 // common include files
27
28 #if !defined(__MINGW32__)
29 #  include <strings.h>
30 #endif
31
32 #include <unistd.h>
33 #include <sys/stat.h>
34
35 #if LIB_FOUNDATION_LIBRARY
36 #  import <Foundation/exceptions/GeneralExceptions.h>
37 #endif
38
39 #if NeXT_Foundation_LIBRARY
40 #  include <NGExtensions/NGObjectMacros.h>
41 #  include <NGExtensions/NSString+Ext.h>
42 #  include <NGExtensions/NSRunLoop+FileObjects.h>
43 #  include "UnixSignalHandler.h"
44 #endif
45
46 #if !LIB_FOUNDATION_LIBRARY
47 #  include <NGExtensions/NGPropertyListParser.h>
48 #endif
49
50 #include <objc/objc-api.h>
51 #import <Foundation/Foundation.h>
52 #import <Foundation/NSDateFormatter.h>
53 #import <Foundation/NSNumberFormatter.h>
54 #import <Foundation/NSHost.h>
55
56 #include <NGExtensions/NGExtensions.h>
57 #include <NGStreams/NGStreams.h>
58 #include <NGStreams/NGNet.h>
59
60 #include <NGMime/NGMime.h>
61
62 #if NeXT_RUNTIME || APPLE_RUNTIME
63 #  ifndef sel_get_name
64 #    define sel_get_name(__XXX__)    sel_getName(__XXX__)
65 #    define sel_get_any_uid(__XXX__) sel_getUid(__XXX__)
66 #  endif
67 #endif
68
69 #define IS_DEPRECATED \
70   NSLog(@"WARNING: used deprecated method: %s:%i.", \
71         __PRETTY_FUNCTION__, __LINE__);
72
73 #if PROFILE
74 #  define BEGIN_PROFILE \
75      { NSTimeInterval __ti = [[NSDate date] timeIntervalSince1970],__last=__ti;
76
77 #  define END_PROFILE \
78      __ti = [[NSDate date] timeIntervalSince1970] - __ti;\
79      if (__ti > 0.05) \
80        printf("***PROF[%s]: %0.3fs\n", __PRETTY_FUNCTION__, __ti);\
81      else if (__ti > 0.005) \
82        printf("PROF[%s]: %0.3fs\n", __PRETTY_FUNCTION__, __ti);\
83      }
84
85 #  define PROFILE_CHECKPOINT(__key__) \
86      {\
87        NSTimeInterval __new = [[NSDate date] timeIntervalSince1970];\
88        printf("---PROF[%s] CP %s: %0.3fs %0.3fs\n", __PRETTY_FUNCTION__,\
89               __key__, __new - __ti, __new - __last);\
90        __last=__new; \
91      }
92
93 #else
94 #  define BEGIN_PROFILE {
95 #  define END_PROFILE   }
96 #  define PROFILE_CHECKPOINT(__key__)
97 #endif
98
99 @interface NSException(setUserInfo)
100 - (id)setReason:(NSString *)_reason;
101 - (id)setUserInfo:(NSDictionary *)_userInfo;
102 @end
103
104 #endif /* __NGObjWeb_common_H__ */