FEDRA emulsion software from the OPERA Collaboration
Milsetup.h
Go to the documentation of this file.
1/***************************************************************************/
2/* */
3/* */
4/* Filename: MILSETUP.H */
5/* Owner : Matrox Imaging dept. */
6/* Rev : $Revision: 1.1 $ */
7/* Content : This file contains definitions for specifying the target */
8/* compile environment and the default state to set for */
9/* MIL (Matrox Imaging Library). It also defines the */
10/* MappAllocDefault() and MappFreeDefault() macros. */
11/* */
12/* COPYRIGHT (c) 1993-1995 Matrox Electronic Systems Ltd. */
13/* All Rights Reserved. */
14/* */
15/* */
16/***************************************************************************/
17
18#ifndef __MILSETUP_H__
19#define __MILSETUP_H__
20
21
22/************************************************************************/
23/* COMPILATION FLAG */
24/* One and only one flag must be active */
25/************************************************************************/
26
27#ifndef M_MIL_USE_OS
28#define M_MIL_USE_OS 1
29#define M_MIL_USE_WINDOWS 1
30#define M_MIL_USE_CE 0
31#define M_MIL_USE_PPC 0
32#endif
33
34#if !(M_MIL_USE_WINDOWS || M_MIL_USE_PPC || M_MIL_USE_LINUX)
35#error You must set at least one compilation flag.
36#endif
37
38#if (M_MIL_USE_WINDOWS && M_MIL_USE_PPC && M_MIL_USE_LINUX)
39#error You must select one and only one compilation flag.
40#endif
41
42/************************************************************************/
43/* DEFAULT STATE INITIALIZATION FLAG */
44/************************************************************************/
45
46#define M_SETUP M_DEFAULT
47
48#if !M_MIL_USE_CE
49#define M_IMAGE_PATH MIL_TEXT("INSTALLDIR\\images\\")
50#else
51#define M_IMAGE_PATH MIL_TEXT("\\cedisk\\mil\\images\\")
52#endif
53
54/************************************************************************/
55/* DEFAULT SYSTEM SPECIFICATIONS */
56/************************************************************************/
57
58/*DO NOT EDIT: you should change the default values with the Mil Configuration utility*/
59#define M_DEF_SYSTEM_TYPE M_SYSTEM_DEFAULT
60#define M_DEF_SYSTEM_NUM M_DEFAULT
61#define M_SYSTEM_SETUP M_DEF_SYSTEM_TYPE
62
63/************************************************************************/
64/* DEFAULT DIGITIZER SPECIFICATIONS */
65/************************************************************************/
66
67/*DO NOT EDIT: you should change the default values with the Mil Configuration utility*/
68#define M_DEF_DIGITIZER_NUM M_DEFAULT
69#define M_DEF_DIGITIZER_FORMAT MIL_TEXT("M_DEFAULT")
70#define M_DEF_DIGITIZER_INIT M_DEFAULT
71#define M_CAMERA_SETUP M_DEF_DIGITIZER_FORMAT
72
73/************************************************************************/
74/* DEFAULT DISPLAY SPECIFICATIONS */
75/************************************************************************/
76
77/*DO NOT EDIT: you should change the default values with the Mil Configuration utility*/
78#define M_DEF_DISPLAY_NUM M_DEFAULT
79#define M_DEF_DISPLAY_FORMAT MIL_TEXT("M_DEFAULT")
80#define M_DEF_DISPLAY_INIT M_DEFAULT
81#define M_DISPLAY_SETUP M_DEF_DISPLAY_FORMAT
82#define M_DEF_DISPLAY_KEY_COLOR 0
83#define M_DEF_DISPLAY_KEY_ENABLE_ON_ALLOC 0
84#define M_DEF_DISPLAY_KEY_DISABLE_ON_FREE 0
85
86/************************************************************************/
87/* DEFAULT IMAGE BUFFER SPECIFICATIONS */
88/************************************************************************/
89
90#define M_DEF_IMAGE_NUMBANDS_MIN 1
91#define M_DEF_IMAGE_SIZE_X_MIN 512
92#define M_DEF_IMAGE_SIZE_Y_MIN 480
93#define M_DEF_IMAGE_SIZE_X_MAX 4000000
94#define M_DEF_IMAGE_SIZE_Y_MAX 4000000
95#define M_DEF_IMAGE_TYPE 8+M_UNSIGNED
96#define M_DEF_IMAGE_ATTRIBUTE_MIN M_IMAGE+M_PROC
97
98/***************************************************************************/
99/* LocalBufferAllocDefault - Local macro to allocate a default MIL buffer: */
100/* */
101/* MIL_ID *SystemIdVarPtr; */
102/* MIL_ID *DisplayIdVarPtr; */
103/* MIL_ID *ImageIdVarPtr; */
104/* */
105/***************************************************************************/
106#define LocalBufferAllocDefault(SystemIdVarPtr,DisplayIdVarPtr,DigitizerIdVarPtr,ImageIdVarPtr) \
107{ \
108 /* local variables */ \
109 long m_def_image_numbands = M_DEF_IMAGE_NUMBANDS_MIN; \
110 long m_def_image_size_x = M_DEF_IMAGE_SIZE_X_MIN; \
111 long m_def_image_size_y = M_DEF_IMAGE_SIZE_Y_MIN; \
112 long m_def_image_type = M_DEF_IMAGE_TYPE; \
113 long m_def_image_attribute= M_DEF_IMAGE_ATTRIBUTE_MIN; \
114 MIL_ID *LNullPtr = M_NULL; \
115 MIL_ID LNull = M_NULL; \
116 \
117 /* determines the needed size band, x, y, type and attribute */ \
118 if ((((MIL_ID *)(DisplayIdVarPtr)) != LNullPtr) && \
119 ((*((MIL_ID *)(DisplayIdVarPtr)))!= LNull)) \
120 { \
121 if ((((MIL_ID *)(DigitizerIdVarPtr)) != LNullPtr) && \
122 ((*((MIL_ID *)(DigitizerIdVarPtr)))!= LNull)) \
123 { \
124 m_def_image_size_x = \
125 MdigInquire(*((MIL_ID *)(DigitizerIdVarPtr)),M_SIZE_X,M_NULL); \
126 m_def_image_size_y = \
127 MdigInquire(*((MIL_ID *)(DigitizerIdVarPtr)),M_SIZE_Y,M_NULL); \
128 m_def_image_type = \
129 MdigInquire(*((MIL_ID *)(DigitizerIdVarPtr)),M_TYPE,M_NULL); \
130 } \
131 else \
132 { \
133 m_def_image_size_x = M_DEF_IMAGE_SIZE_X_MIN; \
134 m_def_image_size_y = M_DEF_IMAGE_SIZE_Y_MIN; \
135 m_def_image_type = M_DEF_IMAGE_TYPE; \
136 } \
137 } \
138 if (m_def_image_size_x < M_DEF_IMAGE_SIZE_X_MIN) \
139 m_def_image_size_x = M_DEF_IMAGE_SIZE_X_MIN; \
140 if (m_def_image_size_y < M_DEF_IMAGE_SIZE_Y_MIN) \
141 m_def_image_size_y = M_DEF_IMAGE_SIZE_Y_MIN; \
142 if (m_def_image_size_x > M_DEF_IMAGE_SIZE_X_MAX) \
143 m_def_image_size_x = M_DEF_IMAGE_SIZE_X_MAX; \
144 if (m_def_image_size_y > M_DEF_IMAGE_SIZE_Y_MAX) \
145 m_def_image_size_y = M_DEF_IMAGE_SIZE_Y_MAX; \
146 if (((m_def_image_type & 0xFF) < (M_DEF_IMAGE_TYPE & 0xFF)) || \
147 ((m_def_image_type & 0xFF) > (M_DEF_IMAGE_TYPE & 0xFF))) \
148 m_def_image_type = M_DEF_IMAGE_TYPE; \
149 \
150 /* determines the needed attribute and number of band */ \
151 m_def_image_attribute = M_DEF_IMAGE_ATTRIBUTE_MIN; \
152 m_def_image_numbands = M_DEF_IMAGE_NUMBANDS_MIN; \
153 if ((((MIL_ID *)(DisplayIdVarPtr)) != LNullPtr) && \
154 ((*((MIL_ID *)(DisplayIdVarPtr)))!= LNull)) \
155 m_def_image_attribute |= M_DISP; \
156 if (((((MIL_ID *)DigitizerIdVarPtr)) != LNullPtr) && \
157 ((*((MIL_ID *)(DigitizerIdVarPtr)))!= LNull)) \
158 { \
159 m_def_image_attribute |= M_GRAB; \
160 m_def_image_numbands = \
161 MdigInquire(*(MIL_ID *)DigitizerIdVarPtr,M_SIZE_BAND,M_NULL); \
162 if (m_def_image_numbands<M_DEF_IMAGE_NUMBANDS_MIN) \
163 m_def_image_numbands=M_DEF_IMAGE_NUMBANDS_MIN; \
164 } \
165 \
166 /* allocates a monochromatic or color image buffer */ \
167 MbufAllocColor(*((MIL_ID *)(SystemIdVarPtr)), \
168 m_def_image_numbands, \
169 m_def_image_size_x, \
170 m_def_image_size_y, \
171 m_def_image_type, \
172 m_def_image_attribute, \
173 ((MIL_ID *)(ImageIdVarPtr))); \
174 \
175 /* clear and display the image buffer */ \
176 if (((DisplayIdVarPtr) !=LNullPtr) && \
177 ((*((MIL_ID *)(DisplayIdVarPtr)))!=LNull) && \
178 ((*((MIL_ID *)(ImageIdVarPtr))) !=LNull)) \
179 { \
180 MbufClear(*((MIL_ID *)(ImageIdVarPtr)), 0); \
181 MdispSelect(*((MIL_ID *)(DisplayIdVarPtr)), \
182 *((MIL_ID *)(ImageIdVarPtr))); \
183 } \
184}
185
186/**************************************************************************/
187/* MappAllocDefault - macro to allocate default MIL objects: */
188/* */
189/* long InitFlag; */
190/* MIL_ID *ApplicationIdVarPtr; */
191/* MIL_ID *SystemIdVarPtr; */
192/* MIL_ID *DisplayIdVarPtr; */
193/* MIL_ID *DigitizerIdVarPtr; */
194/* MIL_ID *ImageIdVarPtr; */
195/* */
196/* Note: */
197/* An application must be allocated before a system. */
198/* An system must be allocated before a display,digitzer or image. */
199/* */
200/**************************************************************************/
201
202#define MappAllocDefault(InitFlag,ApplicationIdVarPtr,SystemIdVarPtr,DisplayIdVarPtr,DigitizerIdVarPtr,ImageIdVarPtr) \
203{ \
204 /* local variables */ \
205 MIL_ID *LNullPtr = M_NULL; \
206 MIL_ID LNull = M_NULL; \
207 \
208 /* allocate a MIL application. */ \
209 if (((MIL_ID *)(ApplicationIdVarPtr)) != LNullPtr) \
210 MappAlloc(InitFlag,((MIL_ID *)(ApplicationIdVarPtr))); \
211 \
212 /* allocate a system */ \
213 if ((((MIL_ID *)(SystemIdVarPtr)) != LNullPtr) && \
214 (((MIL_ID *)(ApplicationIdVarPtr)) != LNullPtr) && \
215 ((*((MIL_ID *)(ApplicationIdVarPtr)))!= LNull)) \
216 MsysAlloc(M_DEF_SYSTEM_TYPE, \
217 M_DEF_SYSTEM_NUM, \
218 (InitFlag), \
219 ((MIL_ID *)(SystemIdVarPtr))); \
220 \
221 /* allocate a display */ \
222 if ((((MIL_ID *)(DisplayIdVarPtr)) != LNullPtr) && \
223 (((MIL_ID *)(SystemIdVarPtr)) != LNullPtr) && \
224 ((*((MIL_ID *)(SystemIdVarPtr))) != LNull)) \
225 MdispAlloc(*((MIL_ID *)(SystemIdVarPtr)), \
226 M_DEF_DISPLAY_NUM, \
227 M_DEF_DISPLAY_FORMAT, \
228 M_DEF_DISPLAY_INIT, \
229 ((MIL_ID *)(DisplayIdVarPtr))); \
230 \
231 /* allocate a digitizer */ \
232 if ((((MIL_ID *)(DigitizerIdVarPtr)) != LNullPtr) && \
233 (((MIL_ID *)(SystemIdVarPtr)) != LNullPtr) && \
234 ((*((MIL_ID *)(SystemIdVarPtr))) != LNull)) \
235 MdigAlloc(*((MIL_ID *)(SystemIdVarPtr)), \
236 M_DEF_DIGITIZER_NUM, \
237 M_DEF_DIGITIZER_FORMAT, \
238 M_DEF_DIGITIZER_INIT, \
239 ((MIL_ID *)(DigitizerIdVarPtr))); \
240 \
241 /* enable keying if keying is supported */ \
242 if (((DisplayIdVarPtr) !=LNullPtr) && \
243 ((*((MIL_ID *)(DisplayIdVarPtr)))!=LNull) && \
244 (M_DEF_DISPLAY_KEY_ENABLE_ON_ALLOC!=LNull) && \
245 (MdispInquire(*((MIL_ID *)(DisplayIdVarPtr)),M_KEY_SUPPORTED,0)))\
246 MdispOverlayKey(*((MIL_ID *)(DisplayIdVarPtr)),M_KEY_ON_COLOR, \
247 M_EQUAL,0xFFL,M_DEF_DISPLAY_KEY_COLOR); \
248 \
249 /* allocate an image buffer */ \
250 if ((((MIL_ID *)(ImageIdVarPtr)) != LNullPtr) && \
251 (((MIL_ID *)(SystemIdVarPtr)) != LNullPtr) && \
252 ((*((MIL_ID *)(SystemIdVarPtr)))!= LNull)) \
253 LocalBufferAllocDefault(((MIL_ID *)(SystemIdVarPtr)), \
254 ((MIL_ID *)(DisplayIdVarPtr)), \
255 ((MIL_ID *)(DigitizerIdVarPtr)), \
256 ((MIL_ID *)(ImageIdVarPtr))); \
257 \
258 /* enable keying if keying is supported */ \
259 if (((DisplayIdVarPtr) !=LNullPtr) && \
260 ((*((MIL_ID *)(DisplayIdVarPtr)))!=LNull) && \
261 (M_DEF_DISPLAY_KEY_ENABLE_ON_ALLOC!=LNull) && \
262 (MdispInquire(*((MIL_ID *)(DisplayIdVarPtr)),M_KEY_SUPPORTED,0)))\
263 MdispOverlayKey(*((MIL_ID *)(DisplayIdVarPtr)),M_KEY_ON_COLOR, \
264 M_EQUAL,0xFFL,M_DEF_DISPLAY_KEY_COLOR); \
265}
266
267/************************************************************************/
268/* MappFreeDefault - macro to free default MIL objects: */
269/* */
270/* MIL_ID ApplicationId; */
271/* MIL_ID SystemId; */
272/* MIL_ID DisplayId; */
273/* MIL_ID DigitizerId; */
274/* MIL_ID ImageId; */
275/* */
276/************************************************************************/
277
278#define MappFreeDefault(ApplicationId,SystemId,DisplayId,DigitizerId,BufferId) \
279{ \
280 MIL_ID NullId = M_NULL; \
281 \
282 /* free the image buffer */ \
283 if ((BufferId) != NullId) \
284 { \
285 MbufFree((BufferId)); \
286 } \
287 \
288 /* free digitizer */ \
289 if ((DigitizerId) != NullId) \
290 { \
291 MdigFree((DigitizerId)); \
292 } \
293 \
294 /* free the display */ \
295 if ((DisplayId) != NullId) \
296 { \
297 if ((M_DEF_DISPLAY_KEY_DISABLE_ON_FREE != NullId)&& \
298 MdispInquire((DisplayId),M_KEY_SUPPORTED,0)) \
299 MdispOverlayKey((DisplayId),M_KEY_OFF,M_NULL,M_NULL,M_NULL); \
300 MdispFree((DisplayId)); \
301 } \
302 \
303 /* free the system */ \
304 if ((SystemId) != NullId) \
305 { \
306 MsysFree((SystemId)); \
307 } \
308 \
309 /* free the system */ \
310 if ((ApplicationId) != NullId) \
311 { \
312 MappFree((ApplicationId)); \
313 } \
314}
315
316#endif /*__MILSETUP_H__*/