238f8dee047d5c76ecdbc9a5fe68a01eaf01e4b7
[freeglut] / src / fg_internal.h
1 /*
2  * fg_internal.h
3  *
4  * The freeglut library private include file.
5  *
6  * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
7  * Written by Pawel W. Olszta, <olszta@sourceforge.net>
8  * Creation date: Thu Dec 2 1999
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and associated documentation files (the "Software"),
12  * to deal in the Software without restriction, including without limitation
13  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  * and/or sell copies of the Software, and to permit persons to whom the
15  * Software is furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included
18  * in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
23  * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26  */
27
28 #ifndef  FREEGLUT_INTERNAL_H
29 #define  FREEGLUT_INTERNAL_H
30
31 #ifdef HAVE_CONFIG_H
32 #    include "config.h"
33 #endif
34
35 #include "fg_version.h"
36 #include "fg_callback_macros.h"
37
38 /* Freeglut is intended to function under all Unix/X11 and Win32 platforms. */
39 /* XXX: Don't all MS-Windows compilers (except Cygwin) have _WIN32 defined?
40  * XXX: If so, remove the first set of defined()'s below.
41  */
42 #if !defined(TARGET_HOST_POSIX_X11) && !defined(TARGET_HOST_MS_WINDOWS) && !defined(TARGET_HOST_MAC_OSX) && !defined(TARGET_HOST_SOLARIS) && \
43     !defined(TARGET_HOST_ANDROID) && !defined(TARGET_HOST_BLACKBERRY) && !defined(TARGET_HOST_POSIX_WAYLAND)
44 #if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__MINGW32__) \
45     || defined(_WIN32) || defined(_WIN32_WCE) \
46     || ( defined(__CYGWIN__) && defined(X_DISPLAY_MISSING) )
47 #   define  TARGET_HOST_MS_WINDOWS 1
48
49 #elif defined (__ANDROID__)
50 #   define  TARGET_HOST_ANDROID  1
51
52 #elif defined (__QNXNTO__) || defined (__PLAYBOOK__)
53 #   define  TARGET_HOST_BLACKBERRY  1
54
55 #elif defined(__posix__) || defined(__unix__) || defined(__linux__) || defined(__sun)
56 #   if defined(FREEGLUT_WAYLAND)
57 #      define  TARGET_HOST_POSIX_WAYLAND  1
58 #   else
59 #      define  TARGET_HOST_POSIX_X11  1
60 #   endif
61
62 #elif defined(__APPLE__)
63 /* This is a placeholder until we get native OSX support ironed out -- JFF 11/18/09 */
64 #   define  TARGET_HOST_POSIX_X11  1
65 /* #   define  TARGET_HOST_MAC_OSX    1 */
66
67 #else
68 #   error "Unrecognized target host!"
69
70 #endif
71 #endif
72
73 /* Detect both SunPro and gcc compilers on Sun Solaris */
74 #if defined (__SVR4) && defined (__sun)
75 #   define TARGET_HOST_SOLARIS 1
76 #endif
77
78 #ifndef TARGET_HOST_MS_WINDOWS
79 #   define  TARGET_HOST_MS_WINDOWS     0
80 #endif
81
82 #ifndef TARGET_HOST_ANDROID
83 #   define  TARGET_HOST_ANDROID        0
84 #endif
85
86 #ifndef TARGET_HOST_BLACKBERRY
87 #   define  TARGET_HOST_BLACKBERRY     0
88 #endif
89
90 #ifndef  TARGET_HOST_POSIX_WAYLAND
91 #   define  TARGET_HOST_POSIX_WAYLAND  0
92 #endif
93
94 #ifndef  TARGET_HOST_POSIX_X11
95 #   define  TARGET_HOST_POSIX_X11      0
96 #endif
97
98 #ifndef  TARGET_HOST_MAC_OSX
99 #   define  TARGET_HOST_MAC_OSX        0
100 #endif
101
102 #ifndef  TARGET_HOST_SOLARIS
103 #   define  TARGET_HOST_SOLARIS        0
104 #endif
105
106 /* -- FIXED CONFIGURATION LIMITS ------------------------------------------- */
107
108 #define  FREEGLUT_MAX_MENUS            3
109
110 /* These files should be available on every platform. */
111 #include <stdio.h>
112 #include <string.h>
113 #include <math.h>
114 #include <stdlib.h>
115 #include <stdarg.h>
116
117 /* These are included based on autoconf directives. */
118 #ifdef HAVE_SYS_TYPES_H
119 #    include <sys/types.h>
120 #endif
121 #ifdef HAVE_UNISTD_H
122 #    include <unistd.h>
123 #endif
124 #ifdef TIME_WITH_SYS_TIME
125 #    include <sys/time.h>
126 #    include <time.h>
127 #elif defined(HAVE_SYS_TIME_H)
128 #    include <sys/time.h>
129 #else
130 #    include <time.h>
131 #endif
132
133 /* -- AUTOCONF HACKS --------------------------------------------------------*/
134
135 /* XXX: Update autoconf to avoid these.
136  * XXX: Are non-POSIX platforms intended not to use autoconf?
137  * If so, perhaps there should be a config_guess.h for them. Alternatively,
138  * config guesses could be placed above, just after the config.h exclusion.
139  */
140 #if defined(__FreeBSD__) || defined(__NetBSD__)
141 #    define HAVE_USB_JS 1
142 #endif
143
144 #if defined(_MSC_VER) || defined(__WATCOMC__)
145 /* strdup() is non-standard, for all but POSIX-2001 */
146 #define strdup   _strdup
147 #endif
148
149 /* M_PI is non-standard (defined by BSD, not ISO-C) */
150 #ifndef M_PI
151 #    define  M_PI  3.14159265358979323846
152 #endif
153
154 #ifdef HAVE_STDBOOL_H
155 #    include <stdbool.h>
156 #    ifndef TRUE
157 #        define TRUE true
158 #    endif
159 #    ifndef FALSE
160 #        define FALSE false
161 #    endif
162 #else
163 #    ifndef TRUE
164 #        define  TRUE  1
165 #    endif
166 #    ifndef FALSE
167 #        define  FALSE  0
168 #    endif
169 #endif
170
171 /* General defines */
172 #define INVALID_MODIFIERS 0xffffffff
173
174 /* FreeGLUT internal time type */
175 #if defined(HAVE_STDINT_H)
176 #   include <stdint.h>
177     typedef uint64_t fg_time_t;
178 #elif defined(HAVE_INTTYPES_H)
179 #   include <inttypes.h>
180     typedef uint64_t fg_time_t;
181 #elif defined(HAVE_U__INT64)
182     typedef unsigned __int64 fg_time_t;
183 #elif defined(HAVE_ULONG_LONG)
184     typedef unsigned long long fg_time_t;
185 #else
186     typedef unsigned long fg_time_t;
187 #endif
188
189 #ifndef __fg_unused
190 # ifdef __GNUC__
191 #  define __fg_unused __attribute__((unused))
192 # else
193 #  define __fg_unused
194 # endif
195 #endif
196
197 /* Platform-specific includes */
198 #if TARGET_HOST_POSIX_WAYLAND
199 #include "wayland/fg_internal_wl.h"
200 #endif
201 #if TARGET_HOST_POSIX_X11
202 #include "x11/fg_internal_x11.h"
203 #endif
204 #if TARGET_HOST_MS_WINDOWS
205 #include "mswin/fg_internal_mswin.h"
206 #endif
207 #if TARGET_HOST_ANDROID
208 #include "android/fg_internal_android.h"
209 #endif
210 #if TARGET_HOST_BLACKBERRY
211 #include "blackberry/fg_internal_blackberry.h"
212 #endif
213
214
215 /* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */
216
217 /*
218  * Freeglut callbacks type definitions
219  *
220  * If anything here is modified or added, update fg_callback_macros.h functions.
221  *
222  * This is not ideal, but freeglut needs to either define minimal compiler specs,
223  * or update header every time this is changed or updated.
224  */
225 typedef void* FGCBUserData;
226
227 typedef void (* FGCBDisplay         )( void );
228 typedef void (* FGCBDisplayUC       )( FGCBUserData );
229 typedef void (* FGCBReshape         )( int, int );
230 typedef void (* FGCBReshapeUC       )( int, int, FGCBUserData );
231 typedef void (* FGCBPosition        )( int, int );
232 typedef void (* FGCBPositionUC      )( int, int, FGCBUserData );
233 typedef void (* FGCBVisibility      )( int );
234 typedef void (* FGCBVisibilityUC    )( int, FGCBUserData );
235 typedef void (* FGCBKeyboard        )( unsigned char, int, int );
236 typedef void (* FGCBKeyboardUC      )( unsigned char, int, int, FGCBUserData );
237 typedef void (* FGCBKeyboardUp      )( unsigned char, int, int );
238 typedef void (* FGCBKeyboardUpUC    )( unsigned char, int, int, FGCBUserData );
239 typedef void (* FGCBSpecial         )( int, int, int );
240 typedef void (* FGCBSpecialUC       )( int, int, int, FGCBUserData );
241 typedef void (* FGCBSpecialUp       )( int, int, int );
242 typedef void (* FGCBSpecialUpUC     )( int, int, int, FGCBUserData );
243 typedef void (* FGCBMouse           )( int, int, int, int );
244 typedef void (* FGCBMouseUC         )( int, int, int, int, FGCBUserData );
245 typedef void (* FGCBMouseWheel      )( int, int, int, int );
246 typedef void (* FGCBMouseWheelUC    )( int, int, int, int, FGCBUserData );
247 typedef void (* FGCBMotion          )( int, int );
248 typedef void (* FGCBMotionUC        )( int, int, FGCBUserData );
249 typedef void (* FGCBPassive         )( int, int );
250 typedef void (* FGCBPassiveUC       )( int, int, FGCBUserData );
251 typedef void (* FGCBEntry           )( int );
252 typedef void (* FGCBEntryUC         )( int, FGCBUserData );
253 typedef void (* FGCBWindowStatus    )( int );
254 typedef void (* FGCBWindowStatusUC  )( int, FGCBUserData );
255 typedef void (* FGCBJoystick        )( unsigned int, int, int, int );
256 typedef void (* FGCBJoystickUC      )( unsigned int, int, int, int, FGCBUserData );
257 typedef void (* FGCBOverlayDisplay  )( void );
258 typedef void (* FGCBOverlayDisplayUC)( FGCBUserData );
259 typedef void (* FGCBSpaceMotion     )( int, int, int );
260 typedef void (* FGCBSpaceMotionUC   )( int, int, int, FGCBUserData );
261 typedef void (* FGCBSpaceRotation   )( int, int, int );
262 typedef void (* FGCBSpaceRotationUC )( int, int, int, FGCBUserData );
263 typedef void (* FGCBSpaceButton     )( int, int );
264 typedef void (* FGCBSpaceButtonUC   )( int, int, FGCBUserData );
265 typedef void (* FGCBDials           )( int, int );
266 typedef void (* FGCBDialsUC         )( int, int, FGCBUserData );
267 typedef void (* FGCBButtonBox       )( int, int );
268 typedef void (* FGCBButtonBoxUC     )( int, int, FGCBUserData );
269 typedef void (* FGCBTabletMotion    )( int, int );
270 typedef void (* FGCBTabletMotionUC  )( int, int, FGCBUserData );
271 typedef void (* FGCBTabletButton    )( int, int, int, int );
272 typedef void (* FGCBTabletButtonUC  )( int, int, int, int, FGCBUserData );
273 typedef void (* FGCBDestroy         )( void );    /* Used for both window and menu destroy callbacks */
274 typedef void (* FGCBDestroyUC       )( FGCBUserData );
275
276 typedef void (* FGCBMultiEntry      )( int, int );
277 typedef void (* FGCBMultiEntryUC    )( int, int, FGCBUserData );
278 typedef void (* FGCBMultiButton     )( int, int, int, int, int );
279 typedef void (* FGCBMultiButtonUC   )( int, int, int, int, int, FGCBUserData );
280 typedef void (* FGCBMultiMotion     )( int, int, int );
281 typedef void (* FGCBMultiMotionUC   )( int, int, int, FGCBUserData );
282 typedef void (* FGCBMultiPassive    )( int, int, int );
283 typedef void (* FGCBMultiPassiveUC  )( int, int, int, FGCBUserData );
284
285 typedef void (* FGCBInitContext     )( void );
286 typedef void (* FGCBInitContextUC   )( FGCBUserData );
287 typedef void (* FGCBAppStatus       )( int );
288 typedef void (* FGCBAppStatusUC     )( int, FGCBUserData );
289
290 /* The global callbacks type definitions */
291 typedef void (* FGCBIdle            )( void );
292 typedef void (* FGCBIdleUC          )( FGCBUserData );
293 typedef void (* FGCBTimer           )( int );
294 typedef void (* FGCBTimerUC         )( int, FGCBUserData );
295 typedef void (* FGCBMenuState       )( int );
296 typedef void (* FGCBMenuStatus      )( int, int, int );
297 typedef void (* FGCBMenuStatusUC    )( int, int, int, FGCBUserData );
298
299 /* The callback used when creating/using menus */
300 typedef void (* FGCBMenu            )( int );
301 typedef void (* FGCBMenuUC          )( int, FGCBUserData );
302
303 /* The FreeGLUT error/warning handler type definition */
304 typedef void (* FGError             )( const char *fmt, va_list ap );
305 typedef void (* FGErrorUC           )( const char *fmt, va_list ap, FGCBUserData userData );
306 typedef void (* FGWarning           )( const char *fmt, va_list ap );
307 typedef void (* FGWarningUC         )( const char *fmt, va_list ap, FGCBUserData userData );
308
309
310 /* A list structure */
311 typedef struct tagSFG_List SFG_List;
312 struct tagSFG_List
313 {
314     void *First;
315     void *Last;
316 };
317
318 /* A list node structure */
319 typedef struct tagSFG_Node SFG_Node;
320 struct tagSFG_Node
321 {
322     void *Next;
323     void *Prev;
324 };
325
326 /* A helper structure holding two ints and a boolean */
327 typedef struct tagSFG_XYUse SFG_XYUse;
328 struct tagSFG_XYUse
329 {
330     GLint           X, Y;               /* The two integers...               */
331     GLboolean       Use;                /* ...and a single boolean.          */
332 };
333
334 /*
335  * An enumeration containing the state of the GLUT execution:
336  * initializing, running, or stopping
337  */
338 typedef enum
339 {
340   GLUT_EXEC_STATE_INIT,
341   GLUT_EXEC_STATE_RUNNING,
342   GLUT_EXEC_STATE_STOP
343 } fgExecutionState ;
344
345 /* This structure holds different freeglut settings */
346 typedef struct tagSFG_State SFG_State;
347 struct tagSFG_State
348 {
349     SFG_XYUse        Position;             /* The default windows' position  */
350     SFG_XYUse        Size;                 /* The default windows' size      */
351     unsigned int     DisplayMode;          /* Display mode for new windows   */
352
353     GLboolean        Initialised;          /* freeglut has been initialised  */
354
355     int              DirectContext;        /* Direct rendering state         */
356
357     GLboolean        ForceIconic;          /* New top windows are iconified  */
358     GLboolean        UseCurrentContext;    /* New windows share with current */
359
360     GLboolean        GLDebugSwitch;        /* OpenGL state debugging switch  */
361     GLboolean        XSyncSwitch;          /* X11 sync protocol switch       */
362
363     int              KeyRepeat;            /* Global key repeat mode.        */
364     int              Modifiers;            /* Current ALT/SHIFT/CTRL state   */
365
366     GLuint           FPSInterval;          /* Interval between FPS printfs   */
367     GLuint           SwapCount;            /* Count of glutSwapBuffer calls  */
368     GLuint           SwapTime;             /* Time of last SwapBuffers       */
369
370     fg_time_t        Time;                 /* Time that glutInit was called  */
371     SFG_List         Timers;               /* The freeglut timer hooks       */
372     SFG_List         FreeTimers;           /* The unused timer hooks         */
373
374     FGCBIdleUC       IdleCallback;         /* The global idle callback       */
375     FGCBUserData     IdleCallbackData;     /* The global idle callback data  */
376
377     int              ActiveMenus;          /* Num. of currently active menus */
378     FGCBMenuState    MenuStateCallback;    /* Menu callbacks are global      */
379     FGCBMenuStatusUC MenuStatusCallback;
380     FGCBUserData     MenuStatusCallbackData;
381     void*            MenuFont;             /* Font to be used for newly created menus */
382
383     SFG_XYUse        GameModeSize;         /* Game mode screen's dimensions  */
384     int              GameModeDepth;        /* The pixel depth for game mode  */
385     int              GameModeRefresh;      /* The refresh rate for game mode */
386
387     int              ActionOnWindowClose;  /* Action when user closes window  */
388
389     fgExecutionState ExecState;            /* Used for GLUT termination       */
390     char            *ProgramName;          /* Name of the invoking program    */
391     GLboolean        JoysticksInitialised; /* Only initialize if application calls for them */
392     int              NumActiveJoysticks;   /* Number of active joysticks (callback defined and positive pollrate) -- if zero, don't poll joysticks */
393     GLboolean        InputDevsInitialised; /* Only initialize if application calls for them */
394
395     int              MouseWheelTicks;      /* Number of ticks the mouse wheel has turned */
396
397     int              AuxiliaryBufferNumber;/* Number of auxiliary buffers */
398     int              SampleNumber;         /*  Number of samples per pixel  */
399
400     GLboolean        SkipStaleMotion;      /* skip stale motion events */
401
402     GLboolean        StrokeFontDrawJoinDots;/* Draw dots between line segments of stroke fonts? */
403     GLboolean        AllowNegativeWindowPosition; /* GLUT, by default, doesn't allow negative window positions. Enable it? */
404
405     int              MajorVersion;         /* Major OpenGL context version  */
406     int              MinorVersion;         /* Minor OpenGL context version  */
407     int              ContextFlags;         /* OpenGL context flags          */
408     int              ContextProfile;       /* OpenGL context profile        */
409     int              HasOpenGL20;          /* fgInitGL2 could find all OpenGL 2.0 functions */
410     FGErrorUC        ErrorFunc;            /* User defined error handler    */
411     FGCBUserData     ErrorFuncData;        /* User defined error handler user data */
412     FGWarningUC      WarningFunc;          /* User defined warning handler  */
413     FGCBUserData     WarningFuncData;      /* User defined warning handler user data */
414 };
415
416 /* The structure used by display initialization in fg_init.c */
417 typedef struct tagSFG_Display SFG_Display;
418 struct tagSFG_Display
419 {
420     SFG_PlatformDisplay pDisplay;
421
422     int             ScreenWidth;        /* The screen's width in pixels      */
423     int             ScreenHeight;       /* The screen's height in pixels     */
424     int             ScreenWidthMM;      /* The screen's width in milimeters  */
425     int             ScreenHeightMM;     /* The screen's height in milimeters */
426 };
427
428
429 /* The user can create any number of timer hooks */
430 typedef struct tagSFG_Timer SFG_Timer;
431 struct tagSFG_Timer
432 {
433     SFG_Node        Node;
434     int             ID;                 /* The timer ID integer              */
435     FGCBTimerUC     Callback;           /* The timer callback                */
436     FGCBUserData    CallbackData;       /* The timer callback user data      */
437     fg_time_t       TriggerTime;        /* The timer trigger time            */
438 };
439
440 /*
441  * A window and its OpenGL context. The contents of this structure
442  * are highly dependent on the target operating system we aim at...
443  */
444 typedef struct tagSFG_Context SFG_Context;
445 struct tagSFG_Context
446 {
447     SFG_WindowHandleType  Handle;    /* The window's handle                 */
448     SFG_WindowContextType Context;   /* The window's OpenGL/WGL context     */
449
450     SFG_PlatformContext pContext;    /* The window's FBConfig (X11) or device context (Windows) */
451
452     int             DoubleBuffered;  /* Treat the window as double-buffered */
453
454     /* When drawing geometry to vertex attribute buffers, user specifies
455      * the attribute indices for vertices, normals and/or texture coords
456      * to freeglut. Those are stored here
457      */
458     GLint           attribute_v_coord;
459     GLint           attribute_v_normal;
460     GLint           attribute_v_texture;
461 };
462
463
464 /*
465  * Bitmasks indicating the different kinds of
466  * actions that can be scheduled for a window.
467  */
468 #define GLUT_INIT_WORK        (1<<0)
469 #define GLUT_VISIBILITY_WORK  (1<<1)
470 #define GLUT_POSITION_WORK    (1<<2)
471 #define GLUT_SIZE_WORK        (1<<3)
472 #define GLUT_ZORDER_WORK      (1<<4)
473 #define GLUT_FULL_SCREEN_WORK (1<<5)
474 #define GLUT_DISPLAY_WORK     (1<<6)
475
476 /*
477  * An enumeration containing the desired mapping state of a window
478  */
479 typedef enum
480 {
481   DesireHiddenState,
482   DesireIconicState,
483   DesireNormalState
484 } fgDesiredVisibility ;
485
486 /*
487  *  There is considerable confusion about the "right thing to
488  *  do" concerning window  size and position.  GLUT itself is
489  *  not consistent between Windows and UNIX/X11; since
490  *  platform independence is a virtue for "freeglut", we
491  *  decided to break with GLUT's behaviour.
492  *
493  *  Under UNIX/X11, it is apparently not possible to get the
494  *  window border sizes in order to subtract them off the
495  *  window's initial position until some time after the window
496  *  has been created.  Therefore we decided on the following
497  *  behaviour, both under Windows and under UNIX/X11:
498  *  - When you create a window with position (x,y) and size
499  *    (w,h), the upper left hand corner of the outside of the
500  *    window is at (x,y) and the size of the drawable area is
501  *    (w,h).
502  *  - When you query the size and position of the window--as
503  *    is happening here for Windows--"freeglut" will return
504  *    the size of the drawable area--the (w,h) that you
505  *    specified when you created the window--and the coordinates
506  *    of the upper left hand corner of the drawable area, i.e.
507  *    of the client rect--which is NOT the (x,y) you specified.
508  */
509 typedef struct tagSFG_WindowState SFG_WindowState;
510 struct tagSFG_WindowState   /* as per notes above, sizes always refer to the client area (thus without the window decorations) */
511 {
512     /* window state - size, position, look */
513     int             Xpos;               /* Window's top-left of client area, X-coordinate */
514     int             Ypos;               /* Window's top-left of client area, Y-coordinate */
515     int             Width;              /* Window's width in pixels          */
516     int             Height;             /* The same about the height         */
517     GLboolean       Visible;            /* Is the window visible now? Not using fgVisibilityState as we only care if visible or not */
518     int             Cursor;             /* The currently selected cursor style */
519     GLboolean       IsFullscreen;       /* is the window fullscreen?         */
520
521     /* FreeGLUT operations are deferred, that is, window moving, resizing,
522      * Z-order changing, making full screen or not do not happen immediately
523      * upon the user's request, but only in the next iteration of the main
524      * loop, before the display callback is called. This allows multiple
525      * reshape, position, etc requests to be combined into one and is
526      * compatible with the way GLUT does things. Callbacks get triggered
527      * based on the feedback/messages/notifications from the window manager.
528      * Below here we define what work should be done, as well as the relevant
529      * parameters for this work.
530      */
531     unsigned int    WorkMask;           /* work (resize, etc) to be done on the window */
532     int             DesiredXpos;        /* desired X location */
533     int             DesiredYpos;        /* desired Y location */
534     int             DesiredWidth;       /* desired window width */
535     int             DesiredHeight;      /* desired window height */
536     int             DesiredZOrder;      /* desired window Z Order position */
537     fgDesiredVisibility DesiredVisibility;/* desired visibility (hidden, iconic, shown/normal) */
538
539     SFG_PlatformWindowState pWState;    /* Window width/height (X11) or rectangle/style (Windows) from before a resize, and other stuff only needed on specific platforms */
540
541     long            JoystickPollRate;   /* The joystick polling rate         */
542     fg_time_t       JoystickLastPoll;   /* When the last poll happened       */
543
544     int             MouseX, MouseY;     /* The most recent mouse position    */
545
546     GLboolean       IgnoreKeyRepeat;    /* Whether to ignore key repeat.     */
547
548     GLboolean       VisualizeNormals;   /* When drawing objects, draw vectors representing the normals as well? */
549 };
550
551
552 /*
553  * A generic function pointer.  We should really use the GLUTproc type
554  * defined in freeglut_ext.h, but if we include that header in this file
555  * a bunch of other stuff (font-related) blows up!
556  */
557 typedef void (*SFG_Proc)();
558
559
560 /*
561  * SET_WCB() is used as:
562  *
563  *     SET_WCB( window, cbname, func, udata );
564  *
565  * ...where {window} is the freeglut window to set the callback,
566  *          {cbname} is the window-specific callback to set,
567  *          {func} is a function-pointer,
568  *          {udata} is a void* pointer for user data.
569  *
570  * Originally, {FETCH_WCB( ... ) = func} was rather sloppily used,
571  * but this can cause warnings because the FETCH_WCB() macro type-
572  * casts its result, and a type-cast value shouldn't be an lvalue.
573  *
574  * The {if( FETCH_WCB( ... ) != func )} test is to do type-checking
575  * and for no other reason.  Since it's hidden in the macro, the
576  * ugliness is felt to be rather benign.
577  *
578  * If the function-pointer is the same, the data will be the only
579  * value updated. If the function-pointer changes, the data will
580  * be changed as well, preventing stail data from being passed in.
581  * Just updating the data does nothing unless a function-pointer
582  * exists, as the data is otherwise already allocated.
583  */
584 #define SET_WCB(window,cbname,func,udata)                      \
585 do                                                             \
586 {                                                              \
587     if( FETCH_WCB( window, cbname ) != (SFG_Proc)(func) )      \
588     {                                                          \
589         (((window).CallBacks[WCB_ ## cbname]) = (SFG_Proc)(func)); \
590         (((window).CallbackDatas[WCB_ ## cbname]) = (udata));  \
591     }                                                          \
592     else if( FETCH_USER_DATA_WCB( window, cbname ) != udata )  \
593     {                                                          \
594         (((window).CallbackDatas[WCB_ ## cbname]) = (udata));  \
595     }                                                          \
596 } while( 0 )
597
598 /*
599  * FETCH_WCB() is used as:
600  *
601  *     FETCH_WCB( window, cbname );
602  *
603  * ...where {window} is the freeglut window to fetch the callback from,
604  *          {cbname} is the window-specific callback to fetch.
605  *
606  * The result is correctly type-cast to the callback function pointer
607  * type.
608  */
609 #define FETCH_WCB(window,cbname) \
610     ((window).CallBacks[WCB_ ## cbname])
611
612 /*
613  * FETCH_USER_DATA_WCB() is used as:
614  *
615  *     FETCH_USER_DATA_WCB( window, cbname );
616  *
617  * ...where {window} is the freeglut window,
618  *          {cbname} is the window-specific callback to be invoked,
619  *
620  * This expects a variable named "window" of type tagSFG_Window to exist.
621  *
622  * The result is the callback data pointer.
623  */
624 #define FETCH_USER_DATA_WCB(window,cbname) \
625     ((window).CallbackDatas[WCB_ ## cbname])
626
627 /*
628  * EXPAND_WCB() is used as:
629  *
630  *     EXPAND_WCB( cbname )(( arg_list, userData ))
631  *
632  * ... where {(arg_list)} is the parameter list and userData is user
633  * provided data.
634  *
635  * This will take the arg_list and extend it by one argument, adding
636  * the argument "userData" to the end of the list.
637  *
638  * All of this is defined in fg_callback_macros.h
639  *
640  * See that header for more info.
641  *
642  * ------------------------------------------------------------------
643  */
644
645 /*
646  * INVOKE_WCB() is used as:
647  *
648  *     INVOKE_WCB( window, cbname, ( arg_list ) );
649  *
650  * ...where {window} is the freeglut window,
651  *          {cbname} is the window-specific callback to be invoked,
652  *          {(arg_list)} is the parameter list.
653  *
654  * The callback is invoked as:
655  *
656  *    callback( arg_list, userData );
657  *
658  * ...where userData is added to the arg_list, but the parentheses
659  * are REQUIRED in the {arg_list}.
660  *
661  * NOTE that it does a sanity-check and also sets the
662  * current window.
663  *
664  */
665 #define INVOKE_WCB(window,cbname,arg_list)    \
666 do                                            \
667 {                                             \
668     if( FETCH_WCB( window, cbname ) )         \
669     {                                         \
670         FGCB ## cbname ## UC func = (FGCB ## cbname ## UC)(FETCH_WCB( window, cbname )); \
671         FGCBUserData userData = FETCH_USER_DATA_WCB( window, cbname ); \
672         fgSetWindow( &window );               \
673         func EXPAND_WCB( cbname )(( arg_list, userData )); \
674     }                                         \
675 } while( 0 )
676
677 /*
678  * The window callbacks the user can supply us with. Should be kept portable.
679  *
680  * This enumeration provides the freeglut CallBack numbers.
681  * The symbolic constants are indices into a window's array of
682  * function callbacks.  The names are formed by splicing a common
683  * prefix onto the callback's base name.  (This was originally
684  * done so that an early stage of development could live side-by-
685  * side with the old callback code.  The old callback code used
686  * the bare callback's name as a structure member, so I used a
687  * prefix for the array index name.)
688  */
689 enum
690 {
691     WCB_Display,
692     WCB_Reshape,
693     WCB_Position,
694     WCB_Keyboard,
695     WCB_KeyboardUp,
696     WCB_Special,
697     WCB_SpecialUp,
698     WCB_Mouse,
699     WCB_MouseWheel,
700     WCB_Motion,
701     WCB_Passive,
702     WCB_Entry,
703     WCB_Visibility,
704     WCB_WindowStatus,
705     WCB_Joystick,
706     WCB_Destroy,
707
708     /* Multi-Pointer X and touch related */
709     WCB_MultiEntry,
710     WCB_MultiButton,
711     WCB_MultiMotion,
712     WCB_MultiPassive,
713
714     /* Mobile platforms LifeCycle */
715     WCB_InitContext,
716     WCB_AppStatus,
717
718     /* Presently ignored */
719     WCB_Select,
720     WCB_OverlayDisplay,
721     WCB_SpaceMotion,     /* presently implemented only on UNIX/X11 and Windows */
722     WCB_SpaceRotation,   /* presently implemented only on UNIX/X11 and Windows */
723     WCB_SpaceButton,     /* presently implemented only on UNIX/X11 and Windows */
724     WCB_Dials,
725     WCB_ButtonBox,
726     WCB_TabletMotion,
727     WCB_TabletButton,
728
729     /* Always make this the LAST one */
730     TOTAL_CALLBACKS
731 };
732
733
734 /* This structure holds the OpenGL rendering context for all the menu windows */
735 typedef struct tagSFG_MenuContext SFG_MenuContext;
736 struct tagSFG_MenuContext
737 {
738     SFG_WindowContextType MContext;       /* The menu window's WGL context   */
739 };
740
741 /* This structure describes a menu */
742 typedef struct tagSFG_Window SFG_Window;
743 typedef struct tagSFG_MenuEntry SFG_MenuEntry;
744 typedef struct tagSFG_Menu SFG_Menu;
745 struct tagSFG_Menu
746 {
747     SFG_Node            Node;
748     void               *UserData;     /* User data passed back at callback   */
749     int                 ID;           /* The global menu ID                  */
750     SFG_List            Entries;      /* The menu entries list               */
751     FGCBMenuUC          Callback;     /* The menu callback                   */
752     FGCBUserData        CallbackData; /* The menu callback user data         */
753     FGCBDestroyUC       Destroy;      /* Destruction callback                */
754     FGCBUserData        DestroyData;  /* Destruction callback user data      */
755     GLboolean           IsActive;     /* Is the menu selected?               */
756     void*               Font;         /* Font to be used for displaying this menu */
757     int                 Width;        /* Menu box width in pixels            */
758     int                 Height;       /* Menu box height in pixels           */
759     int                 X, Y;         /* Menu box raster position            */
760
761     SFG_MenuEntry      *ActiveEntry;  /* Currently active entry in the menu  */
762     SFG_Window         *Window;       /* Window for menu                     */
763     SFG_Window         *ParentWindow; /* Window in which the menu is invoked */
764 };
765
766 /* This is a menu entry */
767 struct tagSFG_MenuEntry
768 {
769     SFG_Node            Node;
770     int                 ID;                     /* The menu entry ID (local) */
771     int                 Ordinal;                /* The menu's ordinal number */
772     char*               Text;                   /* The text to be displayed  */
773     SFG_Menu*           SubMenu;                /* Optional sub-menu tree    */
774     GLboolean           IsActive;               /* Is the entry highlighted? */
775     int                 Width;                  /* Label's width in pixels   */
776 };
777
778 /*
779  * A window, making part of freeglut windows hierarchy.
780  * Should be kept portable.
781  *
782  * NOTE that ActiveMenu is set to menu itself if the window is a menu.
783  */
784 struct tagSFG_Window
785 {
786     SFG_Node            Node;
787     int                 ID;                     /* Window's ID number        */
788
789     SFG_Context         Window;                 /* Window and OpenGL context */
790     SFG_WindowState     State;                  /* The window state          */
791     SFG_Proc            CallBacks[ TOTAL_CALLBACKS ]; /* Array of window callbacks */
792     FGCBUserData        CallbackDatas[ TOTAL_CALLBACKS ]; /* Array of window callback datas */
793     void               *UserData ;              /* For use by user           */
794
795     SFG_Menu*           Menu[ FREEGLUT_MAX_MENUS ]; /* Menus appended to window  */
796     SFG_Menu*           ActiveMenu;             /* The window's active menu  */
797
798     SFG_Window*         Parent;                 /* The parent to this window */
799     SFG_List            Children;               /* The subwindows d.l. list  */
800
801     GLboolean           IsMenu;                 /* Set to 1 if we are a menu */
802 };
803
804
805 /* A linked list structure of windows */
806 typedef struct tagSFG_WindowList SFG_WindowList ;
807 struct tagSFG_WindowList
808 {
809     SFG_Node node;
810     SFG_Window *window ;
811 };
812
813 /* This holds information about all the windows, menus etc. */
814 typedef struct tagSFG_Structure SFG_Structure;
815 struct tagSFG_Structure
816 {
817     SFG_List        Windows;         /* The global windows list            */
818     SFG_List        Menus;           /* The global menus list              */
819     SFG_List        WindowsToDestroy;
820
821     SFG_Window*     CurrentWindow;   /* The currently set window          */
822     SFG_Menu*       CurrentMenu;     /* Same, but menu...                 */
823
824     SFG_MenuContext* MenuContext;    /* OpenGL rendering context for menus */
825
826     SFG_Window*      GameModeWindow; /* The game mode window               */
827
828     int              WindowID;       /* The window ID for the next window to be created */
829     int              MenuID;         /* The menu ID for the next menu to be created */
830 };
831
832 /*
833  * This structure is used for the enumeration purposes.
834  * You can easily extend its functionalities by declaring
835  * a structure containing enumerator's contents and custom
836  * data, then casting its pointer to (SFG_Enumerator *).
837  */
838 typedef struct tagSFG_Enumerator SFG_Enumerator;
839 struct tagSFG_Enumerator
840 {
841     GLboolean   found;                          /* Used to terminate search  */
842     void*       data;                           /* Custom data pointer       */
843 };
844 typedef void (* FGCBWindowEnumerator  )( SFG_Window *, SFG_Enumerator * );
845 typedef void (* FGCBMenuEnumerator  )( SFG_Menu *, SFG_Enumerator * );
846
847 /* The bitmap font structure */
848 typedef struct tagSFG_Font SFG_Font;
849 struct tagSFG_Font
850 {
851     char*           Name;         /* The source font name             */
852     int             Quantity;     /* Number of chars in font          */
853     int             Height;       /* Height of the characters         */
854     const GLubyte** Characters;   /* The characters mapping           */
855
856     float           xorig, yorig; /* Relative origin of the character */
857 };
858
859 /* The stroke font structures */
860
861 typedef struct tagSFG_StrokeVertex SFG_StrokeVertex;
862 struct tagSFG_StrokeVertex
863 {
864     GLfloat         X, Y;
865 };
866
867 typedef struct tagSFG_StrokeStrip SFG_StrokeStrip;
868 struct tagSFG_StrokeStrip
869 {
870     int             Number;
871     const SFG_StrokeVertex* Vertices;
872 };
873
874 typedef struct tagSFG_StrokeChar SFG_StrokeChar;
875 struct tagSFG_StrokeChar
876 {
877     GLfloat         Right;
878     int             Number;
879     const SFG_StrokeStrip* Strips;
880 };
881
882 typedef struct tagSFG_StrokeFont SFG_StrokeFont;
883 struct tagSFG_StrokeFont
884 {
885     char*           Name;                       /* The source font name      */
886     int             Quantity;                   /* Number of chars in font   */
887     GLfloat         Height;                     /* Height of the characters  */
888     const SFG_StrokeChar** Characters;          /* The characters mapping    */
889 };
890
891
892 /* -- JOYSTICK-SPECIFIC STRUCTURES AND TYPES ------------------------------- */
893 /*
894  * Initial defines from "js.h" starting around line 33 with the existing "fg_joystick.c"
895  * interspersed
896  */
897
898 #if TARGET_HOST_MACINTOSH
899 #    include <InputSprocket.h>
900 #endif
901
902 #if TARGET_HOST_MAC_OSX
903 #    include <mach/mach.h>
904 #    include <IOKit/IOkitLib.h>
905 #    include <IOKit/hid/IOHIDLib.h>
906 #endif
907
908 /* XXX It might be better to poll the operating system for the numbers of buttons and
909  * XXX axes and then dynamically allocate the arrays.
910  */
911 #define _JS_MAX_BUTTONS 32
912
913 #if TARGET_HOST_MACINTOSH
914 #    define _JS_MAX_AXES  9
915 typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick;
916 struct tagSFG_PlatformJoystick
917 {
918 #define  ISP_NUM_AXIS    9
919 #define  ISP_NUM_NEEDS  41
920     ISpElementReference isp_elem  [ ISP_NUM_NEEDS ];
921     ISpNeed             isp_needs [ ISP_NUM_NEEDS ];
922 };
923 #endif
924
925 #if TARGET_HOST_MAC_OSX
926 #    define _JS_MAX_AXES 16
927 typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick;
928 struct tagSFG_PlatformJoystick
929 {
930     IOHIDDeviceInterface ** hidDev;
931     IOHIDElementCookie buttonCookies[41];
932     IOHIDElementCookie axisCookies[_JS_MAX_AXES];
933 /* The next two variables are not used anywhere */
934 /*    long minReport[_JS_MAX_AXES],
935  *         maxReport[_JS_MAX_AXES];
936  */
937 };
938 #endif
939
940
941 /*
942  * Definition of "SFG_Joystick" structure -- based on JS's "jsJoystick" object class.
943  * See "js.h" lines 80-178.
944  */
945 typedef struct tagSFG_Joystick SFG_Joystick;
946 struct tagSFG_Joystick
947 {
948     SFG_PlatformJoystick pJoystick;
949
950     int          id;
951     GLboolean    error;
952     char         name [ 128 ];
953     int          num_axes;
954     int          num_buttons;
955
956     float dead_band[ _JS_MAX_AXES ];
957     float saturate [ _JS_MAX_AXES ];
958     float center   [ _JS_MAX_AXES ];
959     float max      [ _JS_MAX_AXES ];
960     float min      [ _JS_MAX_AXES ];
961 };
962
963
964
965 /* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */
966
967 /* Freeglut display related stuff (initialized once per session) */
968 extern SFG_Display fgDisplay;
969
970 /* Freeglut internal structure */
971 extern SFG_Structure fgStructure;
972
973 /* The current freeglut settings */
974 extern SFG_State fgState;
975
976
977 /* -- PRIVATE FUNCTION DECLARATIONS ---------------------------------------- */
978
979 /*
980  * A call to this function makes us sure that the Display and Structure
981  * subsystems have been properly initialized and are ready to be used
982  */
983 #define  FREEGLUT_EXIT_IF_NOT_INITIALISED( string )               \
984   if ( ! fgState.Initialised )                                    \
985   {                                                               \
986     fgError ( " ERROR:  Function <%s> called"                     \
987               " without first calling 'glutInit'.", (string) ) ;  \
988   }
989
990 #define  FREEGLUT_INTERNAL_ERROR_EXIT_IF_NOT_INITIALISED( string )  \
991   if ( ! fgState.Initialised )                                      \
992   {                                                                 \
993     fgError ( " ERROR:  Internal <%s> function called"              \
994               " without first calling 'glutInit'.", (string) ) ;    \
995   }
996
997 #define  FREEGLUT_INTERNAL_ERROR_EXIT( cond, string, function )  \
998   if ( ! ( cond ) )                                              \
999   {                                                              \
1000     fgError ( " ERROR:  Internal error <%s> in function %s",     \
1001               (string), (function) ) ;                           \
1002   }
1003
1004 /*
1005  * Following definitions are somewhat similar to GLib's,
1006  * but do not generate any log messages:
1007  */
1008 #define  freeglut_return_if_fail( expr ) \
1009     if( !(expr) )                        \
1010         return;
1011 #define  freeglut_return_val_if_fail( expr, val ) \
1012     if( !(expr) )                                 \
1013         return val ;
1014
1015 /*
1016  * A call to those macros assures us that there is a current
1017  * window set, respectively:
1018  */
1019 #define  FREEGLUT_EXIT_IF_NO_WINDOW( string )                               \
1020   if ( ! fgStructure.CurrentWindow &&                                       \
1021        ( fgState.ActionOnWindowClose != GLUT_ACTION_CONTINUE_EXECUTION ) )  \
1022   {                                                                         \
1023     fgError ( " ERROR:  Function <%s> called"                               \
1024               " with no current window defined.", (string) ) ;              \
1025   }
1026
1027 /*
1028  * The deinitialize function gets called on glutMainLoop() end. It should clean up
1029  * everything inside of the freeglut
1030  */
1031 void fgDeinitialize( void );
1032
1033 /*
1034  * Those two functions are used to create/destroy the freeglut internal
1035  * structures. This actually happens when calling glutInit() and when
1036  * quitting the glutMainLoop() (which actually happens, when all windows
1037  * have been closed).
1038  */
1039 void fgCreateStructure( void );
1040 void fgDestroyStructure( void );
1041
1042 /*
1043  * Window creation, opening, closing and destruction.
1044  * Also CallBack clearing/initialization.
1045  * Defined in fg_structure.c, fg_window.c.
1046  */
1047 SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
1048                             GLboolean positionUse, int x, int y,
1049                             GLboolean sizeUse, int w, int h,
1050                             GLboolean gameMode, GLboolean isMenu );
1051 void        fgSetWindow ( SFG_Window *window );
1052 void        fgOpenWindow( SFG_Window* window, const char* title,
1053                           GLboolean positionUse, int x, int y,
1054                           GLboolean sizeUse, int w, int h,
1055                           GLboolean gameMode, GLboolean isSubWindow );
1056 void        fgCloseWindow( SFG_Window* window );
1057 void        fgAddToWindowDestroyList ( SFG_Window* window );
1058 void        fgCloseWindows ();
1059 void        fgDestroyWindow( SFG_Window* window );
1060
1061 /* Menu creation and destruction. Defined in fg_structure.c */
1062 SFG_Menu*   fgCreateMenu( FGCBMenuUC menuCallback, FGCBUserData userData );
1063 void        fgDestroyMenu( SFG_Menu* menu );
1064
1065 /* Joystick device management functions, defined in fg_joystick.c */
1066 int         fgJoystickDetect( void );
1067 void        fgInitialiseJoysticks( void );
1068 void        fgJoystickClose( void );
1069 void        fgJoystickPollWindow( SFG_Window* window );
1070
1071 /* InputDevice Initialisation and Closure */
1072 int         fgInputDeviceDetect( void );
1073 void        fgInitialiseInputDevices( void );
1074 void        fgInputDeviceClose( void );
1075
1076 /* spaceball device functions, defined in fg_spaceball.c */
1077 void        fgInitialiseSpaceball( void );
1078 void        fgSpaceballClose( void );
1079 void        fgSpaceballSetWindow( SFG_Window *window );
1080
1081 int         fgHasSpaceball( void );
1082 int         fgSpaceballNumButtons( void );
1083
1084 /* Setting the cursor for a given window */
1085 void fgSetCursor ( SFG_Window *window, int cursorID );
1086
1087 /*
1088  * Helper function to enumerate through all registered windows
1089  * and one to enumerate all of a window's subwindows...
1090  *
1091  * The GFunc callback for those functions will be defined as:
1092  *
1093  *      void enumCallback( gpointer window, gpointer enumerator );
1094  *
1095  * where window is the enumerated (sub)window pointer (SFG_Window *),
1096  * and userData is the a custom user-supplied pointer. Functions
1097  * are defined and exported from fg_structure.c file.
1098  */
1099 void fgEnumWindows( FGCBWindowEnumerator enumCallback, SFG_Enumerator* enumerator );
1100 void fgEnumSubWindows( SFG_Window* window, FGCBWindowEnumerator enumCallback,
1101                        SFG_Enumerator* enumerator );
1102
1103 /*
1104  * fgWindowByHandle returns a (SFG_Window *) value pointing to the
1105  * first window in the queue matching the specified window handle.
1106  * The function is defined in fg_structure.c file.
1107  */
1108 SFG_Window* fgWindowByHandle( SFG_WindowHandleType hWindow );
1109
1110 /*
1111  * This function is similar to the previous one, except it is
1112  * looking for a specified (sub)window identifier. The function
1113  * is defined in fg_structure.c file.
1114  */
1115 SFG_Window* fgWindowByID( int windowID );
1116
1117 /*
1118  * Looks up a menu given its ID. This is easier than fgWindowByXXX
1119  * as all menus are placed in a single doubly linked list...
1120  */
1121 SFG_Menu* fgMenuByID( int menuID );
1122
1123 /*
1124  * Returns active menu, if any. Assumption: only one menu active throughout application at any one time.
1125  * This is easier than fgWindowByXXX as all menus are placed in one doubly linked list...
1126  */
1127 SFG_Menu* fgGetActiveMenu( );
1128
1129 /*
1130  * The menu activation and deactivation the code. This is the meat
1131  * of the menu user interface handling code...
1132  */
1133 void fgUpdateMenuHighlight ( SFG_Menu *menu );
1134 GLboolean fgCheckActiveMenu ( SFG_Window *window, int button, GLboolean pressed,
1135                               int mouse_x, int mouse_y );
1136 void fgDeactivateMenu( SFG_Window *window );
1137
1138 /*
1139  * This function gets called just before the buffers swap, so that
1140  * freeglut can display the pull-down menus via OpenGL. The function
1141  * is defined in fg_menu.c file.
1142  */
1143 void fgDisplayMenu( void );
1144
1145 /* Elapsed time as per glutGet(GLUT_ELAPSED_TIME). */
1146 fg_time_t fgElapsedTime( void );
1147
1148 /* System time in milliseconds */
1149 fg_time_t fgSystemTime(void);
1150
1151 /* List functions */
1152 void fgListInit(SFG_List *list);
1153 void fgListAppend(SFG_List *list, SFG_Node *node);
1154 void fgListRemove(SFG_List *list, SFG_Node *node);
1155 int fgListLength(SFG_List *list);
1156 void fgListInsert(SFG_List *list, SFG_Node *next, SFG_Node *node);
1157
1158 /* Error Message functions */
1159 void fgError( const char *fmt, ... );
1160 void fgWarning( const char *fmt, ... );
1161
1162 SFG_Proc fgPlatformGetProcAddress( const char *procName );
1163
1164 /* pushing attribute/value pairs into an array */
1165 #define ATTRIB(a) attributes[where++]=(a)
1166 #define ATTRIB_VAL(a,v) {ATTRIB(a); ATTRIB(v);}
1167
1168 int fghMapBit( int mask, int from, int to );
1169 int fghIsLegacyContextRequested( void );
1170 void fghContextCreationError( void );
1171 int fghNumberOfAuxBuffersRequested( void );
1172
1173 #endif /* FREEGLUT_INTERNAL_H */
1174
1175 /*** END OF FILE ***/