/*****************************************************************************
 * GEMFAST.H - Header for the high-level functions in the GemFast library.
 *
 * Maintenance:
 *  02/01/93   v1.9
 *             > Created by splitting old gemfast.h into this plus gemfbind.h.
 *             > Changed to __PROTO() style prototypes.
 *             > Added conditional block for GNU compiler.
 *             > Added NO_GEMFAST_HLL conditional block stuff.
 ****************************************************************************/

#ifndef GEMFAST_H
#define GEMFAST_H

#include <stdarg.h>     /* need this for va_list type */

/*****************************************************************************
 * first include the right set of binding headers, and set up some macros
 * to provide independance from the variations between different bindings.
 ****************************************************************************/

#ifdef __cplusplus
  extern "C" {
#endif

#if defined(__STDC__) && defined(M68000) && defined(GEMDOS)
  #if !defined(__GNUC__) && !defined(LATTICE)
    #define MWC
  #endif
#endif

/*----------------------------------------------------------------------------
 * Lattice C v5.x
 *--------------------------------------------------------------------------*/

#if defined(LATTICE)

  #define GEMFAST_PROTOS

  #include <aes.h>
  #include <vdi.h>

  #define _Ob_spec      ob_spec
  #define _Ob_spec_t    void*

  #define GSTACKARGS    __stdargs
  #define GREGARGS      __regargs
  #define GFAR          far
  #define GNEAR         near
  #ifdef _BASEREL
    #define GLOADDS     __saveds
  #else
    #define GLOADDS
  #endif

  /* remap our standard global var names to LC's names */

  #define gl_apversion  ( (short)_AESglobal[0] )
  #define gl_apcount    ( (short)_AESglobal[1] )
  #define gl_apid       ( (short)_AESglobal[2] )
  #define gl_apprivate  ( *(long *)(&_AESglobal[3]) )
  #define gl_apptree    ( *(void **)(&_AESglobal[5]) )
  #define gl_ap1resv    ( *(long *)(&_AESglobal[7]) )
  #define gl_aprshdr    ( *(void **)(&_AESglobal[9]) )

  /* set up some names defined in gemfbind.h but not LC's aes.h */

  #define IS_HOLLOW     0
  #define IS_SOLID      1
  #define IS_PATTERN    2
  #define IS_HATCH      3
  #define IS_UDPTRN     4

  #define IP_HOLLOW     0
  #define IP_SOLID      7

  #define TE_SYSTEM     3
  #define TE_SMALL      5

/*----------------------------------------------------------------------------
 * GNU C 2.x using GemFast as the low-level bindings
 *--------------------------------------------------------------------------*/

#elif defined(__GNUC__)

  #define GEMFAST_PROTOS

  #include <gemfbind.h>

  #define _Ob_spec      ob_spec
  #define _Ob_spec_t    long

  #define GSTACKARGS
  #define GREGARGS
  #define GFAR
  #define GNEAR
  #define GLOADDS

/*----------------------------------------------------------------------------
 * Turbo C (I'm not sure about all these being right; they would be on msdos)
 *--------------------------------------------------------------------------*/

#elif defined(__TURBOC__)

  #define GEMFAST_PROTOS

  #include <gem.h>

  #define _Ob_spec      ob_spec.string
  #define _Ob_spec_t    char*

  #define GSTACKARGS    cdecl
  #define GREGARGS
  #define GFAR          __far
  #define GNEAR         __near
  #define GLOADDS       __loadds

/*----------------------------------------------------------------------------
 * Sozobon, HSC v1.x and 2.x
 *--------------------------------------------------------------------------*/

#elif defined(SOZOBON) || defined(__HSC__) || defined(MWC)

  #undef GEMFAST_PROTOS         /* non-ansi compilers here! */

  #include <gemfbind.h>

  #define _Ob_spec   ob_spec
  #define _Ob_spec_t long

  #define GSTACKARGS
  #define GREGARGS
  #define GFAR
  #define GNEAR
  #define GLOADDS

/*----------------------------------------------------------------------------
 * catch-all for unknown compilers
 *--------------------------------------------------------------------------*/

#else

  #error Unknown compiler in GEMFAST.H!

#endif

/*****************************************************************************
 * all high-level library stuff will be omitted if NO_GEMFAST_HLL is
 * defined.  defining it effectively gives you vanilla DRI-standard GEM
 * bindings with no extensions in terms of functions, datatypes, macros,
 * constants, or anything else.
 ****************************************************************************/

#ifndef NO_GEMFAST_HLL

/*****************************************************************************
 * macros used in declarations and prototypes.
 *  GCALLBACK is a set of function modifiers used when the AES or GemFast
 *  internals call back into client code.  For some compilers' memory
 *  models, it's necessary to specify stacked args & auto-load data base reg.
 ****************************************************************************/

#define GCALLBACK       GFAR GSTACKARGS GLOADDS

#ifndef __PROTO
  #ifdef GEMFAST_PROTOS
    #define __PROTO(a) a
  #else
    #define __PROTO(a) ()
  #endif
#endif

#ifdef LATTICE          /* Lattice C bug workaround:  __saveds in a proto   */
  #define __saveds      /* causes spurious arg type mismatches; define it   */
#endif                  /* away until the end of this header file.          */

/*****************************************************************************
 * some handy function-like macros for GRECT and VRECT parm passing.
 ****************************************************************************/

#define RECTVALS(r)  (r)->g_x,    (r)->g_y,    (r)->g_w,    (r)->g_h
#define RECTPTRS(r)  &((r)->g_x), &((r)->g_y), &((r)->g_w), &((r)->g_h)
#define RECTARRAY(r) ((short *)(r))

/*****************************************************************************
 * GemFast-defined constants.
 ****************************************************************************/

/*----------------------------------------------------------------------------
 * Tell the world we're here.
 *--------------------------------------------------------------------------*/

#define GEMF_VERSION    0x0190  /* Tell the world we are v1.90             */

/*----------------------------------------------------------------------------
 * miscellanious stuff.
 *--------------------------------------------------------------------------*/

#define NO_OBJECT        (-1)   /* object (in tree) not found               */

#define GRF_MSALTARROW    200   /* alternate value of ARROW for grf_mouse() */
#define GRF_MSINQUIRE    (-1)   /* inquire current shape for grf_mouse()    */
#define OBJ_BMINQUIRE    (-1)   /* get w/o change from obj_bmbuttons()      */
#define FRM_GETDEFAULTS (-1L)   /* get w/o change from frm_defaults()       */
#define FRM_MOVER      0x4000   /* special ob_flags value for moveable forms*/

#define G_THERMO          200   /* ob_type for a thermometer display object */
#define G_TSCROLL         201   /* ob_type for a text scroll object         */
#define G_RSTRING         202   /* ob_type for a replace-string object      */
#define G_NSLIDE          203   /* ob_type for a numeric-slider object      */

#define OBJ_NODRAW          0   /* obj_XXchange(): no draw after change     */
#define OBJ_WITHDRAW        1   /* obj_XXchange(): draw after change        */
#define OBJ_CLIPDRAW        2   /* obj_XXchange(): draw with optional clip  */

#define OBJ_TINQUIRE  (-32000)  /* inquire current G_THERMO position        */
#define OBJ_TINCREMENT    (-1)  /* increment current G_THERMO position by 1 */

#define FRM_DSMAXBUTTONS    5   /* max dynamic button strings               */
#define FRM_DSMAXSTRINGS   20   /* max dynamic dialog display strings       */

#define EVN_BUTTONUP        0   /* evn_wbutton(): wait for button-up        */
#define EVN_BUTTONDOWN      1   /* evn_wbutton(): wait for button-down      */

/*----------------------------------------------------------------------------
 * options for apl_whatever() functions.
 *--------------------------------------------------------------------------*/

#define APL_RTRANSIENT      0x0001  /* cleanup transient resources */
#define APL_RPERMANENT      0x0002  /* cleanup permenant resources */

/*----------------------------------------------------------------------------
 * actions for frm_desktop().
 *--------------------------------------------------------------------------*/

#define FRM_DTINSTALL   0x00000000L  /* install form as system desktop      */
#define FRM_DTREMOVE    0x10000000L  /* remove form, revert to sys desktop  */

/*----------------------------------------------------------------------------
 * actions for frm_dialog().
 *--------------------------------------------------------------------------*/

#define FRM_DSTART      0x10000000L  /* do FMD_START                        */
#define FRM_DDRAW       0x20000000L  /* do objc_draw()                      */
#define FRM_DDO         0x40000000L  /* do form_do()                        */
#define FRM_DFINISH     0x80000000L  /* do FMD_FINISH                       */
#define FRM_DCOMPLETE   0xF0000000L  /* do all the steps above in one call  */

/*----------------------------------------------------------------------------
 * actions for frm_progress().
 *--------------------------------------------------------------------------*/

#define FRM_PSTART      0x10000000L  /* set up and display progress dialog  */
#define FRM_PUPDATE     0x40000000L  /* update progress thermometer         */
#define FRM_PFINISH     0x80000000L  /* close and cleanup progress dialog   */

/*----------------------------------------------------------------------------
 * options for all frm_whatever() functions.
 *   0xauddbbbb
 *     ||| |______ Basic options for all dialog handling.
 *     |||________ Dynamic dialog options.
 *     ||_________ User options; never touched by GemFast.
 *     |__________ Actions.
 *--------------------------------------------------------------------------*/

#define FRM_NORMAL          0x00000000L /* placeholder when you want none   */
#define FRM_EXPLODE         0x00000001L /* exploding box graphics in dialog */
#define FRM_CENTER          0x00000002L /* center dialog in screen          */
#define FRM_NEARMOUSE       0x00000004L /* center dialog over mouse         */
#define FRM_MOUSEARROW      0x00000008L /* force mouse ARROW during dialog  */
#define FRM_USEBLIT         0x00000010L /* use blits instead of redraw msgs */
#define FRM_MOVEABLE        0x00000020L /* dialog is moveable               */
#define FRM_NODEFAULTS      0x00008000L /* these options override defaults  */

#define FRM_DMUSTSELECT     0x00010000L /* dsdialog/dsmenu: no default exit */
#define FRM_DSHADOWED       0x00020000L /* dsdialog/dsmenu: shadowed parent */
#define FRM_DEFAULTLEFT     0x00040000L /* dsdialog/dsmenu: dflt btn on left*/

#define FRM_DSL1TITLE       0x00100000L /* 1st line is title, higher y pos  */

#define FRM_MEXITPARENT     0x00100000L /* exit if mouse leaves parent      */
#define FRM_MEXITVICINITY   0x00200000L /* exit if mouse leaves vicinity    */

#define FRM_OPTIONBITS      0x0FFFFFFFL /* mask for dialog options          */
#define FRM_BOPTIONBITS     0x0000FFFFL /* mask for basic options           */
#define FRM_DOPTIONBITS     0x00FF0000L /* mask for dynamic options         */
#define FRM_UOPTIONBITS     0x0F000000L /* mask for user options            */
#define FRM_ACTIONBITS      0xF0000000L /* mask for dialog actions          */

/*----------------------------------------------------------------------------
 * option for fsl_dialog().
 *--------------------------------------------------------------------------*/

#define FSL_NORMAL          0x0000
#define FSL_FNOPTIONAL      0x0001
#define FSL_PATHONLY        0x0002

/*----------------------------------------------------------------------------
 * options for grf_blit() and grf_memblit().
 *--------------------------------------------------------------------------*/

#define GRF_NORMAL         0x0000  /* a placeholder value                */
#define GRF_BFROMSCREEN    0x1000  /* blit from screen to buffer         */
#define GRF_BTOSCREEN      0x2000  /* blit from buffer to screen         */
#define GRF_BMEMCALC       0x4000  /* calc mem requirements, don't blit  */
#define GRF_BOBJTREE       0x0001  /* rectparm OBJECT* instead of GRECT* */

/*****************************************************************************
 * GemFast-defined data structures.
 ****************************************************************************/

/*----------------------------------------------------------------------------
 * VRECT structure.
 *--------------------------------------------------------------------------*/

typedef struct vrect {
    short v_x1, v_y1, v_x2, v_y2;
} VRECT;

/*----------------------------------------------------------------------------
 * XMOUSE structure.
 *--------------------------------------------------------------------------*/

typedef struct xmouse {
    short retval;
    short bclicks;
    short mask;
    short state;
    short status;
    short mousex;
    short mousey;
    short mouseb;
    short keystate;
} XMOUSE;

/*----------------------------------------------------------------------------
 * XMULTI structure.
 *--------------------------------------------------------------------------*/

typedef struct xmulti {
    short   msgbuf[8];
    short   mflags;
    short   mbclicks;
    short   mbmask;
    short   mbstate;
    short   mm1flags;
    GRECT   mm1rect;
    short   mm2flags;
    GRECT   mm2rect;
    long    mtcount;
    short   mwhich;
    short   mmox;
    short   mmoy;
    short   mmobutton;
    short   mmokstate;
    short   mkreturn;
    short   mbreturn;
} XMULTI;

/*----------------------------------------------------------------------------
 * GUDSLIDE_FUNC, the type of a callback function for grf_udslidebox.
 *--------------------------------------------------------------------------*/

typedef void GCALLBACK (GUDSLIDE_FUNC) __PROTO((OBJECT *ptree, short obj, short slidepos, void *udata));

/*----------------------------------------------------------------------------
 * XUSERBLK and related items.
 *--------------------------------------------------------------------------*/


struct xparm_blk;           /* tentative decl of these forward-referenced  */
struct xuser_blk;           /* structures keeps facist compilers happy.    */

typedef struct xparm_blk XPARMBLK;
typedef struct xuser_blk XUSERBLK;

typedef enum xuser_touch_status {   /* status returned by xuser_blk.ub_touch() */
    XUBT_NONE   = 0x0000,   /* nothing happened as result of touch             */
    XUBT_VISUAL = 0x0001,   /* touch caused minor visual change in object      */
    XUBT_VALUE  = 0x0002,   /* touch caused important change in obj's value(s) */
    XUBT_DCEXIT = 0x0004    /* touch was d-click, treat as default exit object */
} XUBT_STATUS;

typedef long        GCALLBACK (XUB_DRAWFUNC)  __PROTO((XPARMBLK *xpb));
typedef XUBT_STATUS GCALLBACK (XUB_TOUCHFUNC) __PROTO((XUSERBLK *xub, short mx, short my, short clicks));

struct xuser_blk {
    XUB_DRAWFUNC     *ub_draw;     /* the 1st two fields are USERBLK std, */
    struct xuser_blk *ub_self;     /* but ub_parm always points to self.  */
    XUB_TOUCHFUNC    *ub_touch;    /* call this func when object touched. */
    long              ub_size;     /* size of this XUSERBLK structure.    */
    _Ob_spec_t        ob_spec;     /* ob_spec and ob_type are from the    */
    short             ob_type;     /* original object before we xformed   */
    OBJECT           *parent_tree; /* it.  parent_tree and parent_obj are */
    short             parent_obj;  /* a backlink to the original object.  */
    long              reserved[4]; /* room to grow.                       */
};

/*----------------------------------------------------------------------------
 * XPARMBLK structure (our remapping of a standard PARMBLK).
 *--------------------------------------------------------------------------*/

struct xparm_blk {
    OBJECT   *ptree;
    short    obj;
    short    prevstate;
    short    currstate;
    GRECT    drawrect;
    GRECT    cliprect;
    XUSERBLK *pub;
};

/*****************************************************************************
 * declarations of all global vars defined by gemfast.
 ****************************************************************************/

/*
 * these are valid after apl_xinit()
 */

extern unsigned short    gl_grfhandle;  /* physical VDI handle (graf_handle)*/
extern unsigned short    gl_wchar;      /* width of a character             */
extern unsigned short    gl_w2char;     /* width of a character  / 2        */
extern unsigned short    gl_w4char;     /* width of a character  / 4        */
extern unsigned short    gl_w8char;     /* width of a character  / 8        */
extern unsigned short    gl_hchar;      /* height of a character            */
extern unsigned short    gl_h2char;     /* height of a character / 2        */
extern unsigned short    gl_h4char;     /* height of a character / 4        */
extern unsigned short    gl_h8char;     /* height of a character / 8        */
extern unsigned short    gl_wbox;       /* width of a boxchar               */
extern unsigned short    gl_w2box;      /* width of a boxchar    / 2        */
extern unsigned short    gl_w4box;      /* width of a boxchar    / 4        */
extern unsigned short    gl_w8box;      /* width of a boxchar    / 8        */
extern unsigned short    gl_hbox;       /* height of a boxchar              */
extern unsigned short    gl_h2box;      /* height of a boxchar   / 2        */
extern unsigned short    gl_h4box;      /* height of a boxchar   / 4        */
extern unsigned short    gl_h8box;      /* height of a boxchar   / 8        */

extern GRECT    gl_rwdesk;      /* coordinates of work area of the desktop  */
extern GRECT    gl_rfscrn;      /* coordinates of the full screen           */

/*
 * these are valid after apl_vopen()
 */

extern short  gl_vwout[57];    /* work_out from v_opnvwk()                  */
extern short  gl_vxout[57];    /* work_out from vq_extnd(,1,)               */

/*****************************************************************************
 * prototypes.
 ****************************************************************************/

extern void     apl_cleanup         __PROTO((short cleanup_type));
extern void     apl_mmvectors       __PROTO((void *allocfunc, void *freefunc));
extern void     apl_vclose          __PROTO((short vhandle));
extern short    apl_vopen           __PROTO((void));
extern short    apl_vshared         __PROTO((void));
extern void     apl_xexit           __PROTO((void));
extern short    apl_xinit           __PROTO((void));
extern void     evn_wbutton         __PROTO((short up_or_down));
extern void     frm_confine         __PROTO((OBJECT *tree, GRECT *boundrect));
extern long     frm_defaults        __PROTO((long options));
extern void     frm_desktop         __PROTO((long options, OBJECT *tree));
extern short    frm_dialog          __PROTO((long options, OBJECT *tree, short editobj));
extern short    frm_dsdialog        __PROTO((long options, char **btnarray, char **strarray));
extern short    frm_dsmenu          __PROTO((long options, char *title, char **itemarray));
extern short    frm_eflag           __PROTO((OBJECT *tree, short object, char *fmt, ...));
extern void     frm_enableblit      __PROTO((void));
extern short    frm_error           __PROTO((short errcode, char *buttons, char *fmt, ...));
extern short    frm_menu            __PROTO((long options, OBJECT *tree, short select_state));
extern short    frm_mkmoveable      __PROTO((OBJECT *tree, short mover_object));
extern short    frm_nldialog        __PROTO((long options, char *buttons, char *lines));
extern short    frm_nlmenu          __PROTO((long options, char *title, char *items));
extern short    frm_printf          __PROTO((long options, char *buttons, char *fmt, ...));
extern short    frm_progress        __PROTO((long options, short increments, char *abortbutton, char *fmt, ...));
extern short    frm_qchoice         __PROTO((char *buttons, char *fmt, ...));
extern short    frm_qerror          __PROTO((short error, char *fmt, ...));
extern short    frm_qfatal          __PROTO((short error, char *fmt, ...));
extern short    frm_qmenu           __PROTO((char *title, char *selections));
extern void     frm_qtext           __PROTO((char *fmt, ...));
extern short    frm_question        __PROTO((char *fmt, ...));
extern void     frm_sizes           __PROTO((OBJECT *tree, GRECT *outrect));
extern short    frm_verror          __PROTO((short errcode, char *buttons, char *fmt, va_list args));
extern short    frm_vprintf         __PROTO((long options, char *buttons, char *fmt, va_list args));
extern short    frm_vprogress       __PROTO((long options, short increments, char *abortbutton, char *fmt, va_list args));
extern short    fsl_dialog          __PROTO((short options, char *opath, char *ipath, char *forcewild, char *prompt));
extern long     grf_blit            __PROTO((short options, void *buffer, void *rect_or_tree));
extern void *   grf_memblit         __PROTO((short options, void *buffer, void *rect_or_tree));
extern short    grf_mouse           __PROTO((short newshape, void *usershape));
extern short    grf_udslidebox      __PROTO((OBJECT *ptree, short obj, short v_or_h, GUDSLIDE_FUNC *ufunc, void *udata));
extern short    mnu_bar             __PROTO((OBJECT *tree, short install_or_remove, long reserved));
extern void     mnu_disable         __PROTO((void));
extern void     mnu_enable          __PROTO((void));
extern void     mnu_erase           __PROTO((void));
extern void     mnu_tbar            __PROTO((char *title_string));
extern short    obj_bmbuttons       __PROTO((OBJECT *tree, short parent, short select_state, short bitmap));
extern short    obj_clcalc          __PROTO((OBJECT *tree, short object, GRECT *grectout, VRECT *vrectout));
extern short    obj_dxfind          __PROTO((OBJECT *tree));
extern void     obj_flchange        __PROTO((OBJECT *tree, short object, short newstate, int redraw, ...));
extern char *   obj_gstring         __PROTO((OBJECT *tree, short object));
extern short    obj_gtype           __PROTO((OBJECT *tree, short object));
extern long     obj_gvalue          __PROTO((OBJECT *tree, short object));
extern void     obj_offxywh         __PROTO((OBJECT *tree, short object, GRECT *outrect));
extern short    obj_parent          __PROTO((OBJECT *tree, short object));
extern char **  obj_ppstring        __PROTO((OBJECT *tree));
extern short    obj_rbfind          __PROTO((OBJECT *tree, short parent, short select_state));
extern short    obj_rbselect        __PROTO((OBJECT *tree, short object, short select_state));
extern void     obj_stchange        __PROTO((OBJECT *tree, short object, short new_state, int redraw, ...));
extern void     obj_sstring         __PROTO((OBJECT *tree, short object, char *newstring));
extern void     obj_svalue          __PROTO((OBJECT *tree, short object, long newvalue));
extern short    obj_xtfind          __PROTO((OBJECT *tree, short parent, char xtype));
extern void     obj_xywh            __PROTO((OBJECT *tree, short object, GRECT *outrect));
extern void     rc_confine          __PROTO((GRECT *boundrect, GRECT *therect));
extern GRECT *  rc_gadjust          __PROTO((GRECT *dest, short hadjust, short vadjust));
extern VRECT *  rc_gtov             __PROTO((GRECT *source, VRECT *dest));
extern short    rc_ptinrect         __PROTO((GRECT *therect, short x, short y));
extern GRECT *  rc_scale            __PROTO((GRECT *source, GRECT *dest, short percentage));
extern VRECT *  rc_vadjust          __PROTO((VRECT *dest, short hadjust, short vadjust));
extern GRECT *  rc_vtog             __PROTO((VRECT *source, GRECT *dest));
extern short    rsc_cubuttons       __PROTO((OBJECT *tree));
extern void     rsc_gstrings        __PROTO((OBJECT *tree, int object, char **ppstring, ...));
extern void     rsc_gtrees          __PROTO((int object, OBJECT **pptree, ...));
extern short    rsc_rrbuttons       __PROTO((OBJECT *tree));
extern void     rsc_sstrings        __PROTO((OBJECT *tree, int object, char *string, ...));
extern void     rsc_sxtypes         __PROTO((OBJECT *tree, int object, int xtype, ...));
extern void     rsc_treefix         __PROTO((OBJECT *tree));
extern void     wc_scroll_calc      __PROTO((short curline, short datalines, short windowlines, short *slsize, short *slpos));
extern short    wnd_top             __PROTO((void));
extern short    wnd_update          __PROTO((short semaphore));
extern void     xob_nslide_change   __PROTO((OBJECT *tree, short object, long newmin, long newmax));
extern short    xob_nslide_create   __PROTO((OBJECT *tree, short object, long min, long max));
extern long     xob_nslide_get      __PROTO((OBJECT *tree, short object));
extern void     xob_nslide_set      __PROTO((OBJECT *tree, short object, long newvalue));
extern short    xob_thermo_create   __PROTO((OBJECT *tree, short object, short increments));
extern short    xob_thermo_update   __PROTO((OBJECT *tree, short object, short newpos, GRECT *cliprect));
extern short    xob_tscroll_create  __PROTO((OBJECT *tree, short object, short statusobj));
extern void     xob_tscroll_set     __PROTO((OBJECT *tree, short object, char **datalist, short numitems, short curitem, short topitem));
extern short    xob_tscroll_get     __PROTO((OBJECT *tree, short object, char **curstring, short *curitem, short *topitem));
extern void     xob_transform       __PROTO((OBJECT *tree, short object, XUSERBLK *xub, XUB_DRAWFUNC *pdraw, XUB_TOUCHFUNC *ptouch, long xub_size));
extern void     xob_change          __PROTO((OBJECT *tree, short object, GRECT *cliprect, short newstate, short redraw));
extern void     xob_draw            __PROTO((OBJECT *tree, short object, short depth, GRECT *cliprect));
extern void     xob_offset          __PROTO((OBJECT *tree, short object, short *px, short *py));

extern short    evnx_multi          __PROTO((XMULTI *xm));
extern short    evnx_timer          __PROTO((unsigned long milliseconds));
extern short    frmx_center         __PROTO((OBJECT *tree, GRECT *outrect));
extern short    frmx_dial           __PROTO((short flag, GRECT *little, GRECT *big));
extern short    grfx_dragbox        __PROTO((GRECT *start, GRECT *boundary, GRECT *end));
extern short    winx_calc           __PROTO((short type, short kind, GRECT inrect, GRECT *outrect));
extern short    winx_get            __PROTO((short whandle, short field, GRECT *outrect));

/*****************************************************************************
 * automatically use extended binding routines.
 *   if you undo these macros, all the builtin utilities will break!
 *   the normal low-level bindings will still work, though.
 ****************************************************************************/

#if defined(LATTICE)
  #undef appl_init
  #undef appl_exit
  #undef wind_update
#endif

#define appl_init   apl_xinit   /* extended init fills in new gl_ vars    */
#define appl_exit   apl_xexit   /* extended exit closes shared vdi, etc   */
#define wind_update wnd_update  /* use stack-like wind_update routine     */
#define graf_mouse  grf_mouse   /* use save/restore mouse shape system    */

#define menu_bar(a,b)           mnu_bar((a),(b),0L)
#define frm_sizes(tree, rect)   obj_clcalc((tree), ROOT, (rect), NULL)

/*****************************************************************************
 * Name compatibility stuff
 ****************************************************************************/


#define obj_make_tscroll    xob_tscroll_create
#define obj_set_tscroll     xob_tscroll_set
#define obj_get_tscroll     xob_tscroll_get
#define obj_mkthermo        xob_thermo_create
#define obj_udthermo        xob_thermo_udpate
#define obj_mxuserdef       xob_transform

#define frm_dsdial(str,btn, options) frm_dsdialog((options)|FRM_DSL1TITLE,(btn),(str))

#ifdef LATTICE          /* Lattice C bug workaround: now that all our   */
  #undef __saveds       /* prototypes have been processed, let __saveds */
#endif                  /* have its usual meaning again.                */

#endif /* NO_GEMFAST_HLL */

#ifdef __cplusplus
  }
#endif

#endif /* GEMFAST_H */


