]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/Utils/common/eCosStd.h
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / tools / src / tools / Utils / common / eCosStd.h
1 //####COPYRIGHTBEGIN####
2 //
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
11 // any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
16 // more details.
17 //
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 //
22 // ----------------------------------------------------------------------------
23 //
24 //####COPYRIGHTEND####
25 //#####DESCRIPTIONBEGIN####
26 //
27 // Author(s):     sdf
28 // Contributors:  sdf
29 // Date:          1999-04-01
30 // Description:   Standard include file - include file
31 // Usage:
32 //
33 //####DESCRIPTIONEND####
34
35 // ----------------------------------------------------------------------------
36 // This header sets us up with what is generally needed, both for WIN32 and UNIX
37 // Apart from header includes it defines the time-related quantities:
38 //     Time     - type to measure an absolute time
39 //     Duration - type to measure the difference between two times, or a delay
40 //     Now()    - the time now.
41 //     MIN and MAX
42 //     LogFunc  - a function to which output can be sent
43 // ----------------------------------------------------------------------------
44
45 #if !defined(AFX_STDAFX_H__F20BA9C4_CFD5_11D2_BF75_00A0C949ADAC__INCLUDED_)
46 #define AFX_STDAFX_H__F20BA9C4_CFD5_11D2_BF75_00A0C949ADAC__INCLUDED_
47
48 #if defined(__CYGWIN__)
49   #include <winsock2.h>
50   #include <winsock.h>
51   #include <unistd.h>
52   #include <process.h>
53   #include <signal.h>
54   #define cPathsep '/'
55
56   #include <malloc.h>     // malloc
57   #include <stdlib.h>     // atoi
58   #include <errno.h>
59   #define WOULDBLOCK EWOULDBLOCK
60
61   #include "wcharunix.h"
62   #include <sys/time.h>
63
64   #define _stat stat
65
66   typedef long long Time;
67   #define MODE_TEXT
68
69   #include <windows.h>
70
71 #elif defined(_WIN32)
72   #ifdef _UNICODE
73     #ifndef UNICODE
74       #define UNICODE         // UNICODE is used by Windows headers
75     #endif
76   #endif
77
78   #include <tchar.h>
79   #undef NDEBUG
80
81   #if _MSC_VER > 1000
82     #pragma once
83   #endif // _MSC_VER > 1000
84
85   #define VC_EXTRALEAN          // Exclude rarely-used stuff from Windows headers
86
87   #include <winsock2.h>
88   #ifndef _WINDOWS_
89     #include <windows.h>
90   #endif
91   #include <direct.h>
92   #define cPathsep _TCHAR('\\')
93   #include <io.h>
94   #include <process.h>
95
96   #include <malloc.h> // _heapchk
97
98   #define CALLBACK    __stdcall               // Calling conventions for a callback
99   #define WOULDBLOCK WSAEWOULDBLOCK           // "Would blocking" error
100   #define errno       (*_errno())
101   #define vsnprintf _vsnprintf
102   #pragma warning (disable:4710)  // Not inlined warning
103   typedef __int64 Time;
104   #define MODE_TEXT _T("t")
105 #else // UNIX
106   #include <termios.h>
107   #include <unistd.h>
108   #include <sys/wait.h>
109   #include <dirent.h>
110   #include <sys/file.h>
111   #include <sys/socket.h> // socket etc...
112   #include <netinet/in.h> // inet_addr
113   #include <arpa/inet.h>  // inet_addr
114   #include <netdb.h>      // gethostbyname
115   #include <sys/timeb.h>
116   #include <signal.h>
117   #define cPathsep '/'
118
119   #include <malloc.h>     // malloc
120   #include <stdlib.h>     // atoi
121   #include <errno.h>
122   #define WOULDBLOCK EWOULDBLOCK
123   #define CALLBACK
124
125   #include "wcharunix.h"
126   #include <sys/time.h>
127
128   #define _stat stat
129
130   typedef long long Time;
131   #define MODE_TEXT
132 #endif
133
134 #define ECOS_VERSION "1.3.2"
135
136 typedef int Duration;
137
138 extern Time Now();
139
140 // do not use macros, which would lead to double argument evaluation:
141 extern int MIN(int a, int b);
142 extern int MAX(int a, int b);
143
144 #include <string.h>
145
146 #include <time.h>
147 #include <sys/stat.h>
148 #include <sys/types.h>
149 #include <ctype.h>
150 #include <fcntl.h>
151 #include <assert.h>
152 #include <malloc.h>
153 #include <stdlib.h>
154 #include <time.h>
155 #include <stdarg.h>     // vsnprintf
156
157 #include <assert.h> // assert
158 #include <string.h> // strcpy
159 #include <stdarg.h>
160 #include <stdio.h>
161
162 // Allow user to define a function to which logged output is sent (in addition to being stored internally)
163 typedef void (CALLBACK LogFunc)(void *, LPCTSTR );
164
165 #endif