Internal\xlatLib.h

/*****************************************************************************

    Copyright (c) GeoWorks 1992 -- All Rights Reserved

PROJECT:	PC/GEOS
MODULE:		Translation Libraries
FILE:		xlatLib.h

AUTHOR:		Jenny Greenwood, 2 January 1992

REVISION HISTORY:
        Name	Date		Description
        ----	----		-----------
        Jenny	1/92		Initial version

DESCRIPTION:
    Definitions for translation libraries written in C.

    $Id: xlatLib.h,v 1.9.11.1 96/04/28 08:32:35 chris Exp $

*****************************************************************************/

#ifndef __XLATLIB_H
#define __XLATLIB_H

/*
 * A translation library's TransImport, TransExport, and TransGetFormat
 * routines must return values of type TransError to Impex. If the
 * library is returning TE_CUSTOM, it must also return the handle of
 * a custom error message.
 */

typedef enum  {
    TE_NO_ERROR    ,	       	/* No error */
    TE_ERROR    ,	    	    	/* General error */
    TE_INVALID_FORMAT    ,	    	/* Format is invalid */
    TE_IMPORT_NOT_SUPPORTED    ,   	/* Format is not supported for export */
    TE_EXPORT_NOT_SUPPORTED    ,    /* Format is not supported for export */
    TE_IMPORT_ERROR    ,    	/* General error during import */
    TE_EXPORT_ERROR    ,    	/* General error during export */
    TE_FILE_ERROR    ,    	    	/* Generic file error */
    TE_DISK_FULL    ,    	    	/* The disk is full */
    TE_FILE_OPEN    ,    	    	/* Error in opening a file */
    TE_FILE_READ    ,    	    	/* Error in reading from a file */
    TE_FILE_WRITE    ,    	    	/* Error in writing to a file */
    TE_FILE_TOO_LARGE    ,	    	/* File is too large to process */
    TE_OUT_OF_MEMORY    ,	    	/* Insufficient memory for import/export */
    TE_METAFILE_CREATION_ERROR    ,	/* Error in creating the metafile */
    TE_EXPORT_FILE_EMPTY    ,	/* File to be exported is empty */
    TE_EXPORT_INVALID_CLIPBOARD_FORMAT    , /* App Passed invalid ClipboardFormat*/
    TE_CUSTOM    	    	    	/* Custom error message */
} TransError} ;

/*
 * All Impex routines callable from a translation library written in C
 * return a value of type TransErrorInfo to the library.
 */

typedef struct {
    TransError	transError;

    /* NOTE:
     *   customMsgHandle will be valid only if transError is TE_CUSTOM.
     */

    word		customMsgHandle;
} TransErrorInfo} ;

/*
 * Macros which operate on values of type TransErrorInfo:
 */

#define TRANS_ERROR_IS_NONE (val) ((val).transError == TE_NO_ERROR)
#define TRANS_ERROR_IS_CUSTOM (val) ((val).transError == TE_CUSTOM)
#define GET_TRANS_ERROR (val) ((val).transError)
#define GET_CUSTOM_MSG_HANDLE (val) ((val).customMsgHandle)

/* If a translation library's TransGetFormat routine cannot determine the
   file format, it returns NO_IDEA_FORMAT to Impex. */

#define NO_IDEA_FORMAT    -1

#endif


alb.goh

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	alb.goh
 * AUTHOR:	Doug Fults
 *
 * DECLARER:	kernel
 *
 * DESCRIPTION:
 *	This file defines the AppLaunchBlock
 *
 *	$Id: alb.goh,v 1.2.6.1 96/04/28 08:29:18 chris Exp $
 *
 ***********************************************************************/
@optimize

typedef struct {
    PathName		AIR_fileName;
    FileLongName	AIR_stateFile;
    DiskHandle		AIR_diskHandle;
    byte		AIR_savedDiskData[1];
} AppInstanceReference} ;

typedef struct {
    AppInstanceReference	ALB_appRef;
    word			ALB_appMode;
    AppLaunchFlags		ALB_launchFlags;
    MemHandle			ALB_diskHandle;
    TCHAR			ALB_path[PATH_BUFFER_SIZE];
    FileLongName		ALB_dataFile;
    optr			ALB_genParent;
    optr			ALB_userLoadAckOutput;
    Message			ALB_userLoadAckMessage;
    word			ALB_userLoadAckID;
    word			ALB_extraData;
} AppLaunchBlock} ;


Mailbox\appt.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    (c) Copyright Geoworks 1996 -- All Rights Reserved
    GEOWORKS CONFIDENTIAL

PROJECT:	PC GEOS
MODULE:
FILE:		appt.goh

AUTHOR:		Jason Ho, Aug 15, 1996

MACROS:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    kho	8/15/96   	Initial version.

DESCRIPTION:
    Definition of the structure of a generic appointment
    (MANUFACTURER_ID_GEOWORKS:GMDFID_APPOINTMENT)

    The structure allows one or more than one appointment to be transmitted
    in a message body. Each appointment is in its own VM block. Use the
    MANUFACTURER_ID_GEOWORKS:GMSID_VM_TREE storage driver

    To send more than one appointment, use a tree block to refer to the
    individual appointments. I figure it's easier to code this way, as
    you can have a routine that converts one of your appointments into
    an MBAppointment block and call that for each of the appointments
    you want to send, storing the handles into the tree block you've
    allocated.

    Receivers of GMDFID_APPOINTMENT should examine the MBA_meta.VMCL_next
    field to see if it's VM_CHAIN_TREE. If it is, they've got a list of
    appointments to add. Again, a routine can be called to process each
    block in turn. If the field isn't VM_CHAIN_TREE, just call the routine
    on the first block of the message body and you're done.

    $Id: appt.goh,v 1.1.1.2 97/02/20 20:38:48 kho Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _APPT_GOH_
#define _APPT_GOH_

/*********************************************************************
 *
 * Pre-event Alarm Information
 *
 * This says how long before the event the user should be notified of its
 * impending arrival.
 *
 */

typedef enum {
    MBAIT_MINUTES     = 0x0,
    MBAIT_HOURS    	= 0x1,
    MBAIT_DAYS     = 0x2,
} MBAlarmIntervalType} ;

typedef WordFlags MBAlarmInfo ;
#define MBAI_TYPE 		0xC000   /* MBAlarmIntervalType */
#define MBAI_HAS_ALARM 		0x2000
#define MBAI_INTERVAL 		0x1fff
#define MBAI_TYPE_OFFSET 	14
#define MBAI_HAS_ALARM_OFFSET 	13
#define MBAI_INTERVAL_OFFSET 	0

/*********************************************************************
 *
 * Repeating Event Information
 *
 * These things tell the recipient how the event is supposed to be repeated.
 * It should cover all the bases. If you cannot handle some mode of repeating
 * the event, tell the user, but register the initial event so the user can
 * possibly duplicate it and place it in the proper place by hand.
 *
 */

typedef enum {
    MBRD_FOREVER     = 0x0,	 /* no additional data */
    MBRD_UNTIL     = 0x1,	 /* MBRepeatEndDate */
    MBRD_LENGTH    	= 0x2,   /* MBRepeatLength */
} MBRepeatDuration} ;

typedef enum {
    MBRLUT_DAY     = 0x0,
    MBRLUT_WEEK     = 0x1,
    MBRLUT_MONTH     = 0x2,
    MBRLUT_YEAR     = 0x3,
} MBRepeatLengthUnitType} ;

typedef WordFlags MBRepeatLength ;
#define MBRL_UNIT 		0xC000   /* MBRepeatLengthUnitType */
#define MBRL_COUNT 		0x3FFF
    /* number of those units, *including* the initial event day. thus
    /*  an event repeating every day for 3 days set for 12/15 would have
    /*  the event 12/15, 12/16, and 12/17 */

#define MBRL_UNIT_OFFSET 	14
#define MBRL_COUNT_OFFSET 	0

typedef union {
    FileDate            MBRDD_until;
    MBRepeatLength      MBRDD_length;
} MBRepeatDurationData} ;

typedef enum {
    MBRW_SUNDAY     = 0x0,
    MBRW_MONDAY    	= 0x1,
    MBRW_TUESDAY     = 0x2,
    MBRW_WEDNESDAY     = 0x3,
    MBRW_THURSDAY     = 0x4,
    MBRW_FRIDAY    	= 0x5,
    MBRW_SATURDAY     = 0x6,
} MBRepeatWeekday} ;

typedef enum {
    MBRIT_DAILY     = 0x0,
    MBRIT_WEEKLY     = 0x1,
    MBRIT_MONTHLY_WEEKDAY     = 0x2,
    MBRIT_MONTHLY_DATE     = 0x3,
    MBRIT_YEARLY_WEEKDAY     = 0x4,
    MBRIT_YEARLY_DATE     = 0x5,
    MBRIT_MON_TO_FRI     = 0x6,		/* every Mon-Fri */
    MBRIT_MON_TO_SAT     = 0x7,		/* every Mon-Sat */
} MBRepeatIntervalType} ;

typedef WordFlags MBRepeatInterval ;
#define MBRI_WEEK 			0xE000
#define MBRI_DAY  MBRepeatWeekday	0x1C00
        /* for MBRIT_MONTHLY_WEEKDAY or MBRIT_MONTHLY_DATE or */
        /*  MBRIT_YEARLY_WEEKDAY (month for that last is the same */
        /*  as the event; data indicates which weekday of which */
        /*  week within the month the event should repeat) */
#define MBRI_COUNT 			0x03F8
            /* number of units between events. */
#define MBRI_TYPE 			0x0007
            /* MBRepeatIntervalType */

#define MBRI_WEEK_OFFSET 		13
#define MBRI_DAY_OFFSET 			10
#define MBRI_COUNT_OFFSET 		3
#define MBRI_TYPE_OFFSET 		0

typedef struct {
    MBRepeatInterval		MBRI_interval;
                                /* how long between events? */
    MBRepeatDuration		MBRI_duration;
                /* how long shall we keep this up? */
    MBRepeatDurationData	MBRI_durationData;
                /* more details of same */
    word			MBRI_numExceptions;
                /* number of exception dates */
    FileDate                    MBRI_exceptions[0];
    /* data to follow, an array of dates on which events is *not* to
     * take places. */
} MBRepeatInfo} ;

/*********************************************************************
 *
 * Appointment Description Formats
 *
 * An appointment description can be textual, ink, or...? Note that not all
 * receivers will be able to handle all formats. For example, a single-byte
 * system cannot properly handle a Unicode textual description. If you get such
 * an appointment, you need to tell the user why you can't handle it and then
 * drop the whole thing on the floor.
 *
 */
typedef enum {
    MBADT_GEOS_TEXT     = 0x0,	/* Description is a null-terminated,
                 *  single-byte text string in the GEOS
                 *  character set. */
    MBADT_UNICODE     = 0x1,	/* Description is a null-terminated,
                 *  double-byte text string in the
                 *  Unicode character set. */
    MBADT_INK     = 0x2,		/* Description is digital ink. Number
                 *  of points can be determined from
                 *  MBA_descSize */
} MBAppointmentDescType} ;

#ifdef __HWR_H			/* defined in hwr.h. include that ""
                 *  file if you want to handle digital
                 *  ink in appointments */
                /* appt.def uses InkPoint, but we have
                 * to use __HWR_H */
typedef struct {
    word	MBII_count;

    /* data to follow, an array of InkPoint */
} MBInkInfo} ;

#endif /* __HWR_H InkPoint */

/*********************************************************************
 *
 * Escape Table Definitions
 *
 * The idea behind escapes is to allow schedulers to include additional ""
 * information about the appointment that is beyond the scope of a generic
 * appointment. This allows them, if they are the recipient, to duplicate
 * the original appointment exactly. If the recipient doesn't understand the
 * escape, however, the appointment is still useful.
 *
 * Each escape contains the ManufacturerID of the developer who has defined the
 * contents of the escape.
 *
 */

typedef struct {
    word		MBEI_size;
            /* size of escape, including the MBEscapeInfo
             *  header */
    ManufacturerID	MBEI_manufacturer;
            /* manufacturer who defined the contents of
             *  the escape. */
    word                MBEI_escapeType;
                        /* type of the escape, in case a manufacturer
             * has several. */
    byte                MBEI_data[0];
    /* data to follow, in format determined by the manufacturer. */

} MBEscapeInfo} ;

typedef struct {
    word		MBET_numEscapes;
    MBEscapeInfo        MBET_escapes[0];
    /* data to follow, arry of MBEscapeInfo */
} MBEscapeTable} ;

/*********************************************************************
 *
 * The Appointment Itself (finally)
 *
 * This structure appears at the start of the VM block. The description of
 * the appointment follows immediately thereafter. All other optional
 * information follows the description as you see fit.
 *
 */

#define MB_NO_TIME 		(-1)	/* value in FDAT_time if the event is
                     *  not for a specific time of
                     *  the day. */

/*
 * When creating to-do item, pass MBA_start to be one of the following:
 */
#define MB_TODO_NORMAL_PRIORITY 	(16973823)
                    /* 102h << 16 + ffffh
                     *  value in MBA_start if
                     *  the event is actually a
                     *  to-do item, normal priority. */
#define MB_TODO_HIGH_PRIORITY 	(16908287)
                    /* 101h << 16 + ffffh:
                     *  value in MBA_start if
                     *  the event is actually a
                     *  to-do item, high priority. */

typedef struct {
    VMChainLink		MBA_meta;
    FileDateAndTime	MBA_start;	/* start date & time */
    FileDateAndTime	MBA_end;	/* end date & time */
    MBAlarmInfo		MBA_alarmInfo;	/* description of when alarm
                                 *  should be generated. 0 if
                     *  no alarm */
    MBRepeatInfo _near *MBA_repeatInfo;	/* description of how event
                     *  should be repeated. 0 if
                                  *  one-time thing */
    MBEscapeInfo _near *MBA_escapes;	/* pointer to manufacturer-
                                 *  specific information to be
                                  *  processed by those apps
                                  *  that understand it. Might
                                  *  include formatting info, ""
                                  *  for example. */
    word                MBA_descSize;	/* number of bytes in the
                                  *  description */
    byte /* MBAppointmentDescType */ MBA_descType;
                    /* type of data that make up the
                     *  appointment description */
    byte                MBA_description [0];
} MBAppointment} ;

#endif /* _APPT_GOH_ */


Internal\Resp\bftp.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1997. Nokia Mobile Phones
*/
@ifndef BFTP_GOH
@define BFTP_GOH

@include  <stdapp.goh>

/*
** Change datasegment
*/
#define CHANGE_SEGMENT  word wTemp; _asm mov wTemp, ds; 	\
            GeodeLoadDGroup (GeodeGetCodeProcessHandle ())

/*
** Reset the previous segment from stack
*/
#define RESET_SEGMENT  _asm mov ds, wTemp

#define FILENAME_LENGTH   31
#define MACHINEID_LENGTH  8
#define PID_LENGTH        2
#define BFTP_ERROR_PDU_LENGTH  14

/*
** Macro to convert Little Endian word to Big Endian word and VV.
*/
#define 	W 	( value) ((value >> 8) | (value << 8))

/*
** Macro to convert Little Endian dWord to Big Endian dWord and VV.
*/
#define dW ( value) 	( (( value >> 24) & 0x000000FF) | 				\
                              (( value >>  8) & 0x0000FF00) |            \
                              (( value << 24) & 0xFF000000) |				\
                              (( value <<  8) & 0x00FF0000) )

typedef byte MachineID [MACHINEID_LENGTH];
typedef byte PID [PID_LENGTH];
typedef byte szWhat [4];
typedef byte szTime [15];

/*
** bFTP service errorcodes
*/
typedef enum {
    ERR_UNDEFINED					= 0x0000,
    ERR_ILLEGAL_DATA	 			= 0x0001,
    ERR_UNSUPPORTED_PID			= 0x0002,
    ERR_ILLEGAL_ATTR				= 0x0010,
    ERR_UNSUPPORTED_CMD			= 0x0011,
    ERR_FILE_SYSTEM_FULL			= 0x0020,
    ERR_NO_FILE_OR_DIR			= 0x0021,
    ERR_LOW_BATTERY				= 0x0030,
    ERR_ABORT_CMD_EXEC			= 0x0031
} BFTP_ERRORCODE} ;

@ifdef BFTP_QUERIES
typedef enum {
   CMD_NO_COMMAND   ,
   CMD_Q_RIMG   ,
   CMD_Q_RINF   ,
   CMD_Q_RCMD   ,
   CMD_Q_UNDEFINED   ,
   CMD_P_RPL   ,
   CMD_ERR

} bFTP_commandType} ;

@endif
/*
typedef enum {
   bFTP_NOEXIST = 0,
   bFTP_WRSP,
   bFTP_EXEC
} bFTP_STATE;

typedef struct {
   MachineID ResponderMID;
   MachineID RequestorMID;
   PID       RequestorPID;
   szWhat    What;
} F_Query_indStruct;
*/

typedef struct {
   Boolean   AckOrNackFlag;
   MachineID ResponderMID;
   MachineID RequestorMID;
   PID       RequestorPID;
   byte*     Result;
} bFTP_rspStruct} ;

/*
typedef struct {
   byte  width,
   byte  height
} PixelAspect;
*/

/*
typedef struct {
   byte  width[2];
   byte  height[2];
} Resolution;
*/
@ifdef BFTP_QUERIES
typedef struct {
/*   PixelAspect    pixelAspect;*/
   byte       originalSize;
   byte       acceptedSizes;
   dword      acceptedFileSize;
}  bFTP_RIMGqueryStruct}  ;

typedef struct {
   word           memAvailable;
   word           batteryLeft;
}  bFTP_RINFqueryStruct}  ;

typedef ByteEnum ImageRes ;
#define	RES_QVGA	                0x01
#define	RES_VGA	                 0x02
#define	RES_SVGA	                0x04
#define	RES_XGA	                 0x08
#define	RES_SXGA	                0x10
#define	RES_FREE	                0x20

@endif

/*
typedef struct {
   MachineID ResponderMID;
   MachineID RequestorMID;
   PID       RequestorPID;
   TCHAR     FileName[FILENAME_LENGTH+1];
   TCHAR     UserFileName[FILENAME_LENGTH+1];
   szTime    Time;
   byte*     FileHeader;
   byte*     ThumbNail;
   TCHAR     File[FILENAME_LENGTH+1];
} F_Put_indStruct;
*/

typedef bFTP_rspStruct F_Query_rspStruct ;
typedef bFTP_rspStruct F_Query_cnfStruct ;
typedef bFTP_rspStruct F_Put_rspStruct ;
typedef bFTP_rspStruct F_Put_cnfStruct ;

extern void bFTP_Command_ind
(
   TCHAR*            UserDataFile,              /* IN  name of data file
                                                   OUT name of image file or NULL   */
   Boolean           (*fpUserCancelled)(void),  /* IN  function for checking
                                                       user cancellation            */
   Boolean*          pAckOrNackFlag,
   word*             wResultLength,             /* OUT length of response user data */
   MemHandle*        pmhResponseData,           /* OUT response data                */
   BFTP_ERRORCODE*   pErrorCode
);

extern void bFTP_ConstructErrorPDU
(
   const BFTP_ERRORCODE ecErrorCode,
/*   dword*               pdwAttValLen,*/
   MemHandle*           pmhResult
);

extern void bFTP_ConstructPutReq
(
   const TCHAR*   szBodyDataFile,               /* IN  name of file of the body data */
   dword          dwBodyFileSize,               /* IN  size of the body data */
   MemHandle*     pmhHeaderBlock,               /* OUT block where the bFTP header */
                                                /*       is written                    */
   word*          pwHeaderLength                /* OUT length of bFTP header block   */
);

@ifdef BFTP_QUERIES

extern void bFTP_ConstructQueryReq
(
   bFTP_commandType      what,

   MemHandle*     pmhHeaderBlock,               /* OUT block where the bFTP header
                                                       is written                    */
   word*          pwHeaderLength                /* OUT length of bFTP header block   */
);

extern void bFTP_Command_cnf
(
   const MemHandle   mhUserData,                /* IN */
   bFTP_commandType* type,
   word*             wResultLength,             /* OUT length of response user data */
   MemHandle *       mhResult
);

extern void bFTP_parseResolution
(
   byte *resolution,
   byte* result
);

@endif

@endif


calendar.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1996 -- All Rights Reserved

PROJECT:	GEOS
MODULE:		Calendar application
FILE:		calendar.goh

AUTHOR:		Sean Sullivan, Mar 19, 1996

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    sean	3/19/96   	Initial version.

DESCRIPTION:
    Defines the external methods (and internal private methods) that
    can be used by other applications to access the calendar's data.

    $Id: calendar.goh,v 1.1.2.13 98/03/20 18:18:44 jwu Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@ifndef __CALENDAR_GOH
@define __CALENDAR_GOH

@class  CalendarClass, GenProcessClass;

/*
 *  Synopis:	Used by the rolodex to request a search through the
 * 	        Calendar's events for the passed string
 *
 *		Not used by Communicator products.
 *
 *  Pass:	textLength	= Length of text
 * 		txtBlockHandle	= Block handle containing text
 *  Returns:	Nothing
 */
@message void MSG_CALENDAR_REQUEST_SEARCH (
                    word textLength = cx,
                    MemHandle textBlockHandle = dx);

/*
 *  Synopsis:	Delete all normal calendar events before the passed date
 *
 *  Pass:       cutYear	= cutoff year
 * 		cutMonth= cutoff month
 * 		cutDay	= cutoff day
 *
 *  Returns:	Nothing
 */
@message void MSG_CALENDAR_DELETE_EVENTS_BEFORE_DATE (
                    word cutOffYear = dx,
                    byte cutOffMonth = ch,
                    byte cutOffDay = cl);

/* ----------------------------------------------------------------------------
 * 			Calendar API Limitation
 * ----------------------------------------------------------------------------
 */

/*
 *  The Calendar API provided for Communicator after Feb 97 has the following
 *  limitation:
 *
 *  * Repeat events are not supported. Any event with repetition information is
 *    considered repeat event and will not be processed by Calendar API. This
 *    applies to addition, retrival, deletion and modification of
 *    events. Checking if events exist within a time period also does not include ""
 *    repeat events.
 *
 *  * The earliest year that can specified for events is the constant,
 *    FILE_BASE_YEAR, which is year 1980.
 */

/* ----------------------------------------------------------------------------
 * 			Calendar API Errors
 * ----------------------------------------------------------------------------
 */

/*
 *  Errors Calendar APIs return
 */
typedef enum {
    CEE_NORMAL     = 0x0,
    CEE_GENERAL_ERROR    ,
    CEE_INTERNAL_ERROR    ,
    CEE_NOT_ENOUGH_MEMORY    ,
    CEE_NOT_ENOUGH_DISKSPACE    ,
    CEE_EVENT_NOT_FOUND    ,
    CEE_EVENT_TEXT_TOO_LONG    ,
    CEE_INVALID_DATE    ,
    CEE_INVALID_TIME    ,
    CEE_INVALID_TODO_ITEM_STATUS    ,
    CEE_INVALID_RESERVE_WHOLE_DAY    ,
    CEE_INVALID_ALARM    ,
    CEE_INVALID_EVENT_TYPE    ,
    CEE_START_DATE_LATER_THAN_END_DATE    ,
    CEE_START_TIME_LATER_THAN_END_TIME    ,
    CEE_MISSING_END_TIME_WHEN_START_TIME_AND_END_DATE_ARE_SET    ,
    CEE_EVENT_NOT_SUPPORTED    ,
    CEE_INVALID_TIME_RANGE    ,
    /*  The time range specified is invalid: end date/time
     *  is earlier than start date/time.  This error is returned
     *  when the parameters expect a time range and the range
     *  specified is invalid.  Differs from
     *  CEE_START_DATE/TIME_LATER_THAN_END_DATE/TIME as these
     *  are returned when API is used to modify the end
     *  date/time of an event using an invalid date/time value.  */

    CEE_ACCESS_DENIED    			/*  The requested event is in use and
                     *  your access is denied. */
} CalendarEventError} ;

/* --------------------------------------------------------------------------
 * 			Pre-event Alarm Information
 * --------------------------------------------------------------------------
 */

/*
 *  This says how long before the event the user should be notified of its
 *  impending arrival.
 */
typedef ByteEnum CalendarAlarmIntervalType ;
#define CAIT_MINUTES 	(0x0)
#define CAIT_HOURS 	(0x1)
#define CAIT_DAYS 	(0x2)

/*
 *  Description of alarm
 */
typedef WordFlags CalendarAlarmStruct ;
/* CalendarAlarmIntervalType */
#define CAS_TYPE             (0x8000 | 0x4000)
#define CAS_TYPE_OFFSET      (14)

/*  set if there is alarm */
#define CAS_HAS_ALARM        (0x2000)

/*  data according to CAS_TYPE */
#define CAS_INTERVAL         (0x1fff)
#define CAS_INTERVAL_OFFSET  (0)

/* ---------------------------------------------------------------------------
 * 			Calendar Repeat Events
 * ---------------------------------------------------------------------------
 */

/*
 *  These things tell the recipient how the event is supposed to be repeated.
 *  It should cover all the bases.
 */
typedef ByteEnum CalendarEventRepeatDuration ;
#define CERD_FOREVER 	(0x0)		/*  no additional data */
#define CERD_UNTIL 	(0x1)	        /*  Repeat end date */
#define CERD_LENGTH 	(0x2)	        /*  CalendarEventRepeatLength */

/*
 *  Unit of event repeat frequency
 */
typedef ByteEnum CalendarEventRepeatLengthUnitType ;
#define CERLUT_DAY 	(0x0)
#define CERLUT_WEEK 	(0x1)
#define CERLUT_MONTH 	(0x2)
#define CERLUT_YEAR 	(0x3)

/*
 *  How long to repeat. How many years, months, weeks and days...
 */
typedef WordFlags CalendarEventRepeatLength ;

/*
 * number of those units, *including* the initial event day. thus an
 * event repeating every day for 3 days set for 12/15 would have the
 * event 12/15, 12/16, and 12/17
 */
#define CERL_COUNT 	  (0xfffc)
#define CERL_COUNT_OFFSET  (2)

/* CalendarEventRepeatLengthUnitType */
#define CERL_UNIT 	  (0x0002 | 0x0001)
#define CERL_UNIT_OFFSET   (0)

/*
 *  Either the event lasts for a period of time or repeats for a
 *  certain number of occurrences.
 */
typedef union {
    FileDate	              CERDD_until;   /* Repeat until when */
    CalendarEventRepeatLength CERDD_length;  /* Repeat for how long */
} CalendarEventRepeatDurationData} ;

/*
 *  Which day of the week to repeat the event
 */
typedef ByteEnum CalendarEventRepeatWeekday ;
#define CERW_SUNDAY 	(0x0)
#define CERW_MONDAY 	(0x1)
#define CERW_TUESDAY 	(0x2)
#define CERW_WEDNESDAY 	(0x3)
#define CERW_THURSDAY 	(0x4)
#define CERW_FRIDAY 	(0x5)
#define CERW_SATURDAY 	(0x6)

/*
 *  How frequent the event should be repeated
 */
typedef ByteEnum CalendarEventRepeatIntervalType ;
#define CERIT_DAILY            (0x0)
#define CERIT_WEEKLY           (0x1)
#define CERIT_MONTHLY_WEEKDAY  (0x2)
#define CERIT_MONTHLY_DATE     (0x3)
#define CERIT_YEARLY_WEEKDAY   (0x4)
#define CERIT_YEARLY_DATE      (0x5)

/*
 *  Detailed description of event repetition
 */
typedef WordFlags CalendarEventRepeatInterval ;

/* which week */
#define CERI_WEEK 	  (0x8000 | 0x4000 | 0x2000)
#define CERI_WEEK_OFFSET   (13)

/*  number of units between events. */
#define CERI_COUNT 	  (0x1000 | 0x0800 | 0x0400 | 0x0200 | 0x0100 | 0x0080 | 0x0040)
#define CERI_COUNT_OFFSET  (6)

/*
 *  CalendarEventRepeatWeekday
 *
 *  for CERIT_MONTHLY_WEEKDAY or CERIT_MONTHLY_DATE or
 *  CERIT_YEARLY_WEEKDAY  (month for that last is the same as the
 *  event; data indicates which weekday of which week within the
 *  month the event should repeat)
 */
#define CERI_DAY           (0x0020 | 0x0010 | 0x0008)
#define CERI_DAY_OFFSET    (3)

/* CalendarEventRepeatIntervalType */
#define CERI_TYPE          (0x0004 | 0x0002 | 0x0001)
#define CERI_TYPE_OFFSET   (0)

/*
 *  Guidelines to specify repeat event info
 *  ========================================
 *
 *  For DAILY:
 *        CERI_WEEK = unused
 *        CERI_DAY = unused
 *        CERI_COUNT = number of days between repeats (usually 1)
 *
 *  For WEEKLY:
 *        CERI_WEEK = unused
 *        CERI_DAY = which day of week to repeat
 *        CERI_COUNT = number of weeks between repeats (usually 1)
 *
 *  For BI-WEEKLY:
 *        CERI_WEEK = unused
 *        CERI_DAY = which day of week to repeat
 *        CERI_COUNT = number of weeks between repeats (2 in this case)
 *
 *  For MONTHLY_WEEKDAY event (like the first Thursday of each month):
 *        CERI_WEEK = which week in month
 *        CERI_DAY = which day of week
 *        CERI_COUNT = number of months between repeats (usually 1)
 *
 *  For MONTH_DATE event (like the 15th of each month is pay day!):
 *        CERI_WEEK = unused
 *        CERI_DAY = unused
 *        CERI_COUNT = number of months between repeats (the date is
 *                taken from the appointment info itself, not the repeat info)
 *
 *  For YEARLY_WEEKDAY event (like the first Thursday of November):
 *        CERI_WEEK = which week in month
 *        CERI_DAY = which day of week
 *        CERI_COUNT = number of years between repeats (month is taken from
 *                the appointment info itself, not the repeat info)
 *
 *  For YEARLY_DATE event (like birthdays):
 *        CERI_WEEK = unused
 *        CERI_DAY = unused
 *        CERI_COUNT = number of years between repeats (month and day are
 *                taken from the appointment info itself, not the repeat info)
 */

/*
 *  The final thing: more fine details of repeat events
 */
typedef struct {
    CalendarEventRepeatInterval	CERI_interval;
    /*  how long between events? */

    CalendarEventRepeatDuration	CERI_duration;
    /*  how long shall we keep this up? */

    CalendarEventRepeatDurationData CERI_durationData;
    /*  more details of duration */

    word	CERI_numExceptions;
    /*  number of exception dates */

/*  label	FileDate	CERI_exceptions;*/
    /*  array of dates on which event is *not* to take place */
} CalendarEventRepeatInfo} ;

/* ---------------------------------------------------------------------------
 * 			Calendar Events
 * ---------------------------------------------------------------------------
 */

/* Max event text length */
#define CALENDAR_MAX_EVENT_TEXT_LENGTH   (255)

#define CALENDAR_MAX_RESERVE_WHOLE_DAYS  (999)

/*
 *  value in FDAT_date if the event is a to-do list item
 *
 *  When creating to-do item, pass CEPS_start.FDAT_date = CAL_NO_DATE, and
 *  CEPS_start.FDAT_time to be CalendarToDoItemStatus.
 */
#define CAL_NO_DATE                      (0xffff)

/*
 *  value in FDAT_time if the event is not for a specific time of the day
 *
 *  When creating to-do item for a day, pass CEPS_start.FDAT_time =
 *  CAL_NO_TIME.
 */
#define CAL_NO_TIME                      (0xffff)

/*
 *  When creating to-do item, pass CEPS_start.FDAT_date = CAL_NO_DATE, and
 *  CEPS_start.FDAT_time to be one of the following:
 *
 *  This is the status describing the status of the to-do item.
 */
typedef enum {
    CTDIS_HIGH_PRIORITY     = 0x101,
    CTDIS_NORMAL_PRIORITY    ,
    CTDIS_COMPLETED    ,
} CalendarToDoItemStatus} ;

/*
 *  Event description formats
 *
 *  It is used to describe what type of information is the event data. Note
 *  that only CEDT_GEOS_TEXT is currently supported.
 */
typedef ByteEnum CalendarEventDescType ;
#define CEDT_GEOS_TEXT 	(0x0)		/* Description is a null-terminated,
                     * single-byte text string in the
                     * GEOS character set */
#define CEDT_UNICODE 	(0x1)		/* Description is a null-terminated,
                     * double-byte text string in the
                     * Unicode character set. */
#define CEDT_INK 	(0x2)		/* Description is digital ink. Number
                     * of points can be determined from
                     * the data length field of the param
                     * or event struct.
                     * Not supported for Communicator
                     * products. */

/*
 *  Calendar event used to pass to the API
 */
typedef struct {
    FileDateAndTime	CEPS_startDateTime;
    /*  Event start date and time */

    FileDateAndTime	CEPS_endDateTime;
    /*  Event end date and time */

    word		CEPS_reserveWholeDay;
    /*  Number of whole day to reserve the event. The max is
     *  CALENDAR_MAX_RESERVE_WHOLE_DAYS. 0 if not applicable.
     *
     *    If this field is non-zero, the end date specified in
     *    CEPS_endDateTime is ignored.
     *
     *    If CEPS_startDateTime does not have time specified, it is assumed
     *    the start time is 00:00.
     *
     *    If CEPS_endDateTime does not have time specified, it is assumed
     *    the end time is 23:59
     */

    CalendarAlarmStruct	CEPS_alarm;
    /*  Alarm associated with the event */

    CalendarEventDescType CEPS_eventType;
    /*  Type of data of the event */

    CalendarEventRepeatInfo *CEPS_repeatInfo;
    /* Repeat event info. 0 if the event is not repeating */

    word		CEPS_dataLength;
    /*  The number of bytes of the data in CEPS_data. If
     *  CEPS_eventType is CEDT_GEOS_TEXT, CEPS_dataLength does not include ""
     *  NULL.
     */

    void*		CEPS_data;
    /*  The event data. If the CEPS_eventType is CEDT_GEOS_TEXT, the
     *  text passed in from this field must be null-terminated.
     */
} CalendarEventParamStruct} ;

/*
 *  Structure of calendar event data that is returned from Calendar API
 */
typedef dword CalendarEventID ;

typedef struct {
    CalendarEventID     CRES_eventID;
    /*  Unique event ID */

    FileDateAndTime	CRES_startDateTime;
    /*  Event start date and time */

    FileDateAndTime	CRES_endDateTime;
    /*  Event end date and time */

    word		CRES_reserveWholeDay;
    /*  Number of whole day to reserve the event. The max is
     *  CALENDAR_MAX_RESERVE_WHOLE_DAYS. 0 if not applicable.
     *
     *    If this field is non-zero, the end date specified in
     *    CRES_reserveWholeDay is ignored.
     *
     *    If CRES_startDateTime does not have time specified, it is assumed
     *    the start time is 00:00.
     *
     *    If CRES_endDateTime does not have time specified, it is assumed
     *    the end time is 23:59
     */

    CalendarAlarmStruct	CRES_alarm;
    /*  Alarm associated with the event */

    CalendarEventDescType CRES_eventType;
    /*  Type of data of the event */

    word		CRES_repeatInfo;
    /* Offset in this block that points to CalendarEventRepeatInfo repeat
     * event info. 0 if the event is not repeating. */

    word		CRES_dataLength;
    /*  The number of bytes of the data in CRES_data. If
     *  CRES_eventType is CEDT_GEOS_TEXT, CRES_dataLength does not include ""
     *  NULL.
     */

/*    label	char		CRES_data;*/
    /*  The event data. If the CRES_eventType is CEDT_GEOS_TEXT, the
     *  text passed in from this field must be null-terminated.
     */
} CalendarReturnedEventStruct} ;

/*
 *  SYNOPSIS:	Add a calendar event
 *
 * 		** Message supported in Communicator products after
 *              Feb 1997 **
 *
 *  Pass:	CalendarEventParamStruct* params
 *			= Pointer to CalendarEventParamStruct
 *
 *		optr completionOptr
 *			= callback object to return result OR
 *			  NullOptr if no callback
 *
 *		Message completionMsg
 *			= callback message to return result
 *
 *  Return:     void from this message
 *
 *		The results of the operation are returned via the callback
 *		message which should be in form of: prototype
 *		CALENDAR_ADD_EVENT_CALLBACK_MSG (See below)
 */
@message void MSG_CALENDAR_ADD_EVENT(@stack CalendarEventParamStruct *params,
                     optr completionOptr,
                     Message completionMsg);

/*
 *  Synopsis:   Prototype of the callback message for
 *              MSG_CALENDAR_ADD_EVENT
 *
 *  Pass:	CalendarEventError error
 *			= Error on adding event to calendar. CEE_NORMAL if no
 *			  error
 *              CalendarEventID eventID
 *			= Unique event ID of the added event if there is no
 *			  error.
 *
 *  Return:	void
 *
 */
@prototype void CALENDAR_ADD_EVENT_CALLBACK_MSG (
                                     CalendarEventError error = cx,
                     CalendarEventID eventID = dx:bp);

/*
 *  SYNOPSIS:	Modify a calendar event by event ID
 *
 * 		** Message supported in Communicator products after
 *              Feb 1997 **
 *
 *  Pass:	CalendarEventParamStruct* params
 *			= Pointer to CalendarEventParamStruct
 *
 *              CalendarEventID eventID
 *                      = unique event ID of event to modify
 *
 *		optr completionOptr
 *			= callback object to return result OR
 *			  NullOptr if no callback
 *
 *		Message completionMsg
 *			= callback message to return result
 *
 *  Return:     void from this message
 *
 *		The results of the operation are returned via the callback
 *		message which should be in form of: prototype
 *		CALENDAR_ACCESS_EVENT_COMMON_CALLBACK_MSG (See below)
 */
@message void MSG_CALENDAR_MODIFY_EVENT_BY_ID(@stack
                CalendarEventParamStruct *params,
                CalendarEventID eventID,
                optr completionOptr,
                Message completionMsg);

/*
 *  Synopsis:   Prototype of the callback message for
 *              MSG_CALENDAR_MODIFY_EVENT_BY_ID,
 *              MSG_CALENDAR_DELETE_EVENT_BY_ID,
 *              MSG_CALENDAR_CHECK_IF_EVENT_EXISTS
 *
 *  Pass:	CalendarEventError error
 *			= Error on calendar access operation. CEE_NORMAL if
 *                        no error
 *
 *  Return:	void
 *
 */
@prototype void CALENDAR_ACCESS_EVENT_COMMON_CALLBACK_MSG (
                                     CalendarEventError error = cx);

/*
 *  SYNOPSIS:	Get a calendar event by event ID
 *
 * 		** Message supported in Communicator products after
 *              Feb 1997 **
 *
 *  Pass:	CalendarEventID eventID
 *			= unique event ID of event to get
 *
 *              GeodeHandle owner
 *                      = owner of the block returned
 *			  An owner MUST be specified.
 *
 *		optr completionOptr
 *			= callback object to return result
 *
 *		Message completionMsg
 *			= callback message to return result
 *
 *  Return:     void from this message
 *
 *		The results of the operation are returned via the callback
 *		message which should be in form of: prototype
 *		CALENDAR_GET_EVENT_CALLBACK_MSG (See below)
 */
@message void MSG_CALENDAR_GET_EVENT_BY_ID(@stack
                                     CalendarEventID eventID,
                                     GeodeHandle owner,
                     optr completionOptr,
                     Message completionMsg);

/*
 *  Synopsis:   Prototype of the callback message for
 *              MSG_CALENDAR_GET_EVENT_BY_ID
 *
 *  Pass:	CalendarEventError error
 *			= Error on adding event to calendar. CEE_NORMAL if no
 *			  error
 *              MemHandle eventBlock
 *                      = Unlocked block of CalendarReturnedEventStruct
 *
 *  Return:	void
 *
 */
@prototype void CALENDAR_GET_EVENT_CALLBACK_MSG (
                                     CalendarEventError error = cx,
                     MemHandle eventBlock = dx);

/*
 *  SYNOPSIS:	Delete a calendar event by event ID
 *
 * 		** Message supported in Communicator products after
 *              Feb 1997 **
 *
 *  Pass:	CalendarEventID eventID
 *			= unique event ID of event to delete
 *
 *		optr completionOptr
 *			= callback object to return result OR
 *			  NullOptr if no callback
 *
 *		Message completionMsg
 *			= callback message to return result
 *
 *  Return:     void from this message
 *
 *		The results of the operation are returned via the callback
 *		message which should be in form of: prototype
 *		CALENDAR_ACCESS_EVENT_COMMON_CALLBACK_MSG (See below)
 */
@message void MSG_CALENDAR_DELETE_EVENT_BY_ID(@stack
                     CalendarEventID eventID,
                     optr completionOptr,
                     Message completionMsg);

/*
 *  SYNOPSIS:	check if there is any event exists within a period of time
 *
 * 		** Message supported in Communicator products after
 *              Feb 1997 **
 *
 *  Pass:	FileDateAndTime startDateTime
 *			= Start date and time to search
 *
 *              FileDateAndTime endDateTime
 *			= End date and time to search
 *
 *		optr completionOptr
 *			= callback object to return result
 *
 *		Message completionMsg
 *			= callback message to return result
 *
 *  Return:     void from this message
 *
 *		The results of the operation are returned via the callback
 *		message which should be in form of: prototype
 *		CALENDAR_ACCESS_EVENT_COMMON_CALLBACK_MSG.
 *
 *              If there is event overlapping the search range,
 *                      it returns CEE_NORMAL.
 *
 *              If there is no event overlapping the search range,
 *                      it returns CEE_EVENT_NOT_FOUND
 */
@message void MSG_CALENDAR_CHECK_IF_EVENT_EXISTS(@stack
                     FileDateAndTime startDateTime,
                                     FileDateAndTime endDateTime,
                     optr completionOptr,
                     Message completionMsg);

/*
 *  Synopsis:	Get the unique event ID that is to be assigned to the
 * 		next new event.
 *
 * 		** Message supported in Communicator products after
 *              Feb 1997 **
 *
 *  Pass:	dest	= recipient object,
 * 			  pass dest == 0 if none
 * 		destMessage = message which the calendar app would call on
 * 			  the recipient object with.
 * 			prototype of reply message:
 *                      @message void MSG_XXX_CALLBACK(dword nextID = cx:dx);
 *  Returns:	next event ID
 */
@message dword MSG_CALENDAR_GET_NEXT_EVENT_ID (
                    optr dest = cx:dx,
                    Message destMessage = bp) = cx:dx;

/*
 *  Synopsis:	Set the unique event ID that is to be assigned to the
 * 		next new event. If the argument is smaller than the
 * 		current value, the value will NOT be changed.
 *
 * 		The minimum value is FIRST_EVENT_ID (00020001h).
 *
 * 		** Message supported in Communicator products after
 *              Feb 1997 **
 *
 *  Pass:	nextEventID	= next event ID
 *  Returns:	Nothing
 */
@message void MSG_CALENDAR_SET_NEXT_EVENT_ID (
                    CalendarEventID nextEventID = cx:dx);

@endc	/* CalendarClass */

#define		CALENDAR_DEFAULT_DIR			"CALENDAR"
#define		CALENDAR_DEFAULT_FILE			"CALENDAR\\Calendar"

#define		CALENDAR_TOKEN			{{'P','L','N','R'}, MANUFACTURER_ID_GEOWORKS}

#define		CALENDAR_PASSWD_INIT_CATEGORY			"Calendar"
#define		CALENDAR_PASSWD_INIT_KEY			"password"
#define		CALENDAR_LAST_EVENT_ID_KEY			"lastEventIDHighWord"

/*
 * First unique id to be used.
 */
#define		FIRST_EVENT_ID				(0x00020001)

/*
 * Invalid unique id
 */
#define         INVALID_EVENT_ID                 (FIRST_EVENT_ID-1)

@endif /* __CALENDAR_GOH */


cell.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	cell.h
 * AUTHOR:	Anna Lijphart: January, 1992
 *
 * DESCRIPTION:
 *	C version of cell.def
 *
 *	$Id: cell.h,v 1.25.6.1 96/04/28 08:29:14 chris Exp $
 *
 ***********************************************************************/

#ifndef	__CELL_H
#define __CELL_H

#include  <graphics.h>
#include  <dbase.h>

/* The CellRef structure is obsolete; you should just use an optr
 * instead. This typedef is left for backwards compatibility. */

typedef optr CellRef ;        	/* MemHandle and Chunk of
                 * locked cell */

#define	CellDeref	(cellRef)	LMemDeref(cellRef)

#define	LARGEST_VISIBLE_ROW		16383
#define LARGEST_ROW 		(LARGEST_VISIBLE_ROW + 128)
#define	LARGEST_COLUMN			255
#define	MAX_SINGLE_ROW_SIZE		((LARGEST_COLUMN+1) * sizeof(ColumnArrayElement))
#define	N_ROWS_PER_ROW_BLOCK		 32
#define N_ROW_BLOCKS 	(((LARGEST_ROW + 1) / N_ROWS_PER_ROW_BLOCK) + 1)

typedef ByteFlags       CellFunctionParameterFlags       ;
#define CFPF_DIRTY  		0x80	/* apps may read or change this.  */
#define	CFPF_NO_FREE_COUNT	 	0x07

typedef	struct {
    CellFunctionParameterFlags	CFP_flags;
    VMFileHandle		CFP_file;
    VMBlockHandle		CFP_rowBlocks[N_ROW_BLOCKS];
} CellFunctionParameters} ;

extern void
    _pascal CellReplace (CellFunctionParameters *cfp, word row,
        word column, const void *cellData, word size);

extern void *
    _pascal CellLock (CellFunctionParameters *cfp, word row, word column);

extern void *
    _pascal CellLockGetRef (CellFunctionParameters *cfp, word row, word column,
            optr *ref);

#define CellUnlock (cellptr)	DBUnlock(cellptr)

#define CellDirty (cellptr)	DBDirty(cellptr)

extern void 	/* XXX */
    _pascal CellDirty (const void *ptr);

extern DBGroupAndItem /* XXX */
    _pascal CellGetDBItem (CellFunctionParameters *cfp, word row, byte column);

typedef struct {
    word	CAH_numEntries;		/* Number of array entries.	*/
    word	CAH_rowFlags;
} ColumnArrayHeader} ;

#define	RANGE_ENUM_CALLBACK_RETURN_TYPE		dword
#define	RANGE_ENUM_CALLBACK_RETURN_VALUE	(haltEnumP, rangeEnumFlags)	\
        (((dword) ((haltEnumP << 8) | rangeEnumFlags)) << 16)

/*
 *	RangeEnumFlags	record
 */
typedef ByteFlags RangeEnumFlags ;

#define REF_ALL_CELLS 		    0x80
#define REF_NO_LOCK 		    0x40
#define REF_ROW_FLAGS     	    0x20
#define REF_MATCH_ROW_FLAGS 	    0x10

#define REF_CELL_ALLOCATED 	    0x08
#define REF_CELL_FREED 		    0x04
#define REF_OTHER_ALLOC_OR_FREE 	    0x02
#define REF_ROW_FLAGS_MODIFIED       0x01

typedef struct {
    struct _RangeEnumParams *RECP_params;
    word    	    	RECP_row;
    word    	    	RECP_column;
    void    	    	*RECP_cellData;
    RangeEnumFlags	RECP_rangeFlags;
} RangeEnumCallbackParams} ;

typedef struct _RangeEnumParams  {
    PCB    (RANGE_ENUM_CALLBACK_RETURN_TYPE, REP_callback,
            (RangeEnumCallbackParams));
    Rectangle	    	    REP_bounds;
    word    	    	    REP_rowFlags;
    CellFunctionParameters  *REP_cfp;
    word    	    	    REP_matchFlags;
    word    	    	    REP_flagRow;
    void    	    	    *REP_locals;
} RangeEnumParams} ;

/*
 * C version of the RangeEnumParams to be passed to the RangeEnum() stub.
 */
typedef struct {
    RangeEnumParams 	    CREP_params;
    void    	    	    *CREP_locals;
    PCB    (RANGE_ENUM_CALLBACK_RETURN_TYPE, CREP_callback,
            (RangeEnumCallbackParams));
} CRangeEnumParams} ;

extern void 	/* XXX */
    _pascal CellGetExtent (CellFunctionParameters *cfp, RangeEnumParams *rep);

typedef	struct {
    Rectangle	RIP_bounds;
    Point	RIP_delta;
    dword	RIP_cfp;
} RangeInsertParams} ;

extern void
    _pascal RangeInsert (CellFunctionParameters *cfp,
                RangeInsertParams *rip);

extern dword 	/* XXX */
    _pascal RowGetFlags (CellFunctionParameters *cfp, word rowNum);

extern dword 	/* XXX */
    _pascal RowSetFlags (CellFunctionParameters *cfp, word rowNum, word flags);

extern Boolean
    _pascal RangeExists (CellFunctionParameters *cfp,
            word rowStart, word colStart,
            word rowEnd,   word colEnd);

extern Boolean /* XXX */
    _pascal RangeEnum (CellFunctionParameters *cfp,
              CRangeEnumParams *params,
              RangeEnumFlags flags);

/*
 * NOTE:  I have no idea how to prototype RangeSort for C.
 * Someone else will have to do this.
 */

/*
 *	RangeSortFlags	record
 */
typedef ByteFlags RangeSortFlags ;

#define RSF_SORT_ROWS 		0x80
#define RSF_SORT_ASCENDING 	0x40
#define RSF_IGNORE_CASE 		0x20
#define RSF_IGNORE_SPACES    	0x01	/* app only */

/*
 *	RangeSortCellExistsFlags	record
 */
typedef ByteFlags RangeSortCellExistsFlags ;

#define RSCEF_SECOND_CELL_EXISTS 	0x02
#define RSCEF_FIRST_CELL_EXISTS 		0x01

typedef struct {
    Rectangle	RSP_range;
    Point	RSP_active;
    dword	RSP_callback;
    byte	RSP_flags;	/* RangeSortFlags */
    dword	RSP_cfp;
    word	RSP_sourceChunk;
    word	RSP_destChunk;
    word	RSP_base;
    dword	RSP_lockedEntry;
    byte	RSP_cachedFlags;
} RangeSortParams} ;

typedef enum /* word */ {
    RSE_NO_ERROR    ,
    RSE_UNABLE_TO_ALLOC    ,
} RangeSortError} ;

#ifdef __HIGHC__
pragma Alias (CellLock, "CELLLOCK");
pragma Alias (CellLockGetRef, "CELLLOCKGETREF");
pragma Alias (CellReplace, "CELLREPLACE");
pragma Alias (RowGetFlags, "ROWGETFLAGS");
pragma Alias (RowSetFlags, "ROWSETFLAGS");
pragma Alias (RangeExists, "RANGEEXISTS");
pragma Alias (RangeEnum, "RANGEENUM");
#if (0)
pragma Alias (CellGetDBItem, "CELLGETDBITEM");
pragma Alias (CellGetExtent, "CELLGETEXTENT");
pragma Alias (RangeInsert, "RANGEINSERT");
pragma Alias (RangeSort, "RANGESORT");
#endif
#endif

#endif


char.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	char.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines the GEOS character set
 *
 *	$Id: char.h,v 1.7.6.1 96/04/28 08:28:03 chris Exp $
 *
 ***********************************************************************/

#ifndef	__CHAR_H
#define __CHAR_H

#ifdef DO_DBCS
#include  <unicode.h>
#else
/*
 *	The following represent the low byte of the character value
 *	 only when the high byte is CS_BSW:
 */

typedef ByteEnum Chars ;
#define C_NULL    0x0	/* NULL */
#define C_CTRL_A    0x1	/* <ctrl>-A */
#define C_CTRL_B    0x2	/* <ctrl>-B */
#define C_CTRL_C    0x3	/* <ctrl>-C */
#define C_CTRL_D    0x4	/* <ctrl>-D */
#define C_CTRL_E    0x5	/* <ctrl>-E */
#define C_CTRL_F    0x6	/* <ctrl>-F */
#define C_CTRL_G    0x7	/* <ctrl>-G */
#define C_CTRL_H    0x8	/* <ctrl>-H */
#define C_TAB    0x9	/*  TAB */
#define C_LINEFEED    0xa	/*  LINE FEED */
#define C_CTRL_K    0xb	/* <ctrl>-K */
#define C_CTRL_L    0xc	/* <ctrl>-L */
#define C_ENTER    0xd	/*  ENTER or CR */
#define C_SHIFT_OUT    0xe	/* <ctrl>-N */
#define C_SHIFT_IN    0xf	/* <ctrl>-O */
#define C_CTRL_P    0x10	/* <ctrl>-P */
#define C_CTRL_Q    0x11	/* <ctrl>-Q */
#define C_CTRL_R    0x12	/* <ctrl>-R */
#define C_CTRL_S    0x13	/* <ctrl>-S */
#define C_CTRL_T    0x14	/* <ctrl>-T */
#define C_CTRL_U    0x15	/* <ctrl>-U */
#define C_CTRL_V    0x16	/* <ctrl>-V */
#define C_CTRL_W    0x17	/* <ctrl>-W */
#define C_CTRL_X    0x18	/* <ctrl>-X */
#define C_CTRL_Y    0x19	/* <ctrl>-Y */
#define C_CTRL_Z    0x1a	/* <ctrl>-Z */
#define C_ESCAPE    0x1b	/* ESC */

#define C_NULL_WIDTH    0x19	/* null width character */
#define C_GRAPHIC    0x1a	/* Graphic in text. */

#define C_THINSPACE    0x1b	/* 1/4 width space */
#define C_ENSPACE    0x1c	/* En-space, fixed width */
#define C_EMSPACE    0x1d	/* Em-space, fixed width. */

#define C_NONBRKHYPHEN    0x1e	/* Non breaking hyphen. */
#define C_OPTHYPHEN    0x1f	/* Optional hyphen, only drawn at eol */

/*  the standard ASCII chars: */

#define C_SPACE   ' '
#define C_EXCLAMATION   '!'
#define C_QUOTE   '"'
#define C_NUMBER_SIGN   '#'
#define C_DOLLAR_SIGN   '$'
#define C_PERCENT   '%'
#define C_AMPERSAND   '&'
#define C_SNG_QUOTE    0x27
#define C_LEFT_PAREN   '('
#define C_RIGHT_PAREN   ')'
#define C_ASTERISK   '*'
#define C_PLUS   '+'
#define C_COMMA   ','
#define C_MINUS   '-'
#define C_PERIOD   '.'
#define C_SLASH   '/'
#define C_ZERO   '0'
#define C_ONE   '1'
#define C_TWO   '2'
#define C_THREE   '3'
#define C_FOUR   '4'
#define C_FIVE   '5'
#define C_SIX   '6'
#define C_SEVEN   '7'
#define C_EIGHT   '8'
#define C_NINE   '9'
#define C_COLON   ':'
#define C_SEMICOLON   ';'
#define C_LESS_THAN   '<'
#define C_EQUAL   '='
#define C_GREATER_THAN   '>'
#define C_QUESTION_MARK   '?'
/* #define C_AT_SIGN  '@' */
/* GOC doesn't like this */
#define C_AT_SIGN    0x40
#define C_CAP_A   'A'
#define C_CAP_B   'B'
#define C_CAP_C   'C'
#define C_CAP_D   'D'
#define C_CAP_E   'E'
#define C_CAP_F   'F'
#define C_CAP_G   'G'
#define C_CAP_H   'H'
#define C_CAP_I   'I'
#define C_CAP_J   'J'
#define C_CAP_K   'K'
#define C_CAP_L   'L'
#define C_CAP_M   'M'
#define C_CAP_N   'N'
#define C_CAP_O   'O'
#define C_CAP_P   'P'
#define C_CAP_Q   'Q'
#define C_CAP_R   'R'
#define C_CAP_S   'S'
#define C_CAP_T   'T'
#define C_CAP_U   'U'
#define C_CAP_V   'V'
#define C_CAP_W   'W'
#define C_CAP_X   'X'
#define C_CAP_Y   'Y'
#define C_CAP_Z   'Z'
#define C_LEFT_BRACKET   '['
#define C_BACKSLASH    0x5c
#define C_RIGHT_BRACKET   ']'
#define C_ASCII_CIRCUMFLEX   '^'
#define C_UNDERSCORE   '_'
#define C_BACKQUOTE   '`'
#define C_SMALL_A   'a'
#define C_SMALL_B   'b'
#define C_SMALL_C   'c'
#define C_SMALL_D   'd'
#define C_SMALL_E   'e'
#define C_SMALL_F   'f'
#define C_SMALL_G   'g'
#define C_SMALL_H   'h'
#define C_SMALL_I   'i'
#define C_SMALL_J   'j'
#define C_SMALL_K   'k'
#define C_SMALL_L   'l'
#define C_SMALL_M   'm'
#define C_SMALL_N   'n'
#define C_SMALL_O   'o'
#define C_SMALL_P   'p'
#define C_SMALL_Q   'q'
#define C_SMALL_R   'r'
#define C_SMALL_S   's'
#define C_SMALL_T   't'
#define C_SMALL_U   'u'
#define C_SMALL_V   'v'
#define C_SMALL_W   'w'
#define C_SMALL_X   'x'
#define C_SMALL_Y   'y'
#define C_SMALL_Z   'z'
#define C_LEFT_BRACE   '{'
#define C_VERTICAL_BAR   '|'
#define C_RIGHT_BRACE   '}'
#define C_ASCII_TILDE   '~'
#define C_DELETE    0x7f

#define C_UA_DIERESIS    0x80
#define C_UA_RING    0x81
#define C_UC_CEDILLA    0x82
#define C_UE_ACUTE    0x83
#define C_UN_TILDE    0x84
#define C_UO_DIERESIS    0x85
#define C_UU_DIERESIS    0x86
#define C_LA_ACUTE    0x87
#define C_LA_GRAVE    0x88
#define C_LA_CIRCUMFLEX    0x89
#define C_LA_DIERESIS    0x8a
#define C_LA_TILDE    0x8b
#define C_LA_RING    0x8c
#define C_LC_CEDILLA    0x8d
#define C_LE_ACUTE    0x8e
#define C_LE_GRAVE    0x8f
#define C_LE_CIRCUMFLEX    0x90
#define C_LE_DIERESIS    0x91
#define C_LI_ACUTE    0x92
#define C_LI_GRAVE    0x93
#define C_LI_CIRCUMFLEX    0x94
#define C_LI_DIERESIS    0x95
#define C_LN_TILDE    0x96
#define C_LO_ACUTE    0x97
#define C_LO_GRAVE    0x98
#define C_LO_CIRCUMFLEX    0x99
#define C_LO_DIERESIS    0x9a
#define C_LO_TILDE    0x9b
#define C_LU_ACUTE    0x9c
#define C_LU_GRAVE    0x9d
#define C_LU_CIRCUMFLEX    0x9e
#define C_LU_DIERESIS    0x9f
#define C_DAGGER    0xa0
#define C_DEGREE    0xa1
#define C_CENT    0xa2
#define C_STERLING    0xa3
#define C_SECTION    0xa4
#define C_BULLET    0xa5
#define C_PARAGRAPH    0xa6
#define C_GERMANDBLS    0xa7
#define C_REGISTERED    0xa8
#define C_COPYRIGHT    0xa9
#define C_TRADEMARK    0xaa
#define C_ACUTE    0xab
#define C_DIERESIS    0xac
#define C_NOTEQUAL    0xad
#define C_U_AE    0xae
#define C_UO_SLASH    0xaf
#define C_INFINITY    0xb0
#define C_PLUSMINUS    0xb1
#define C_LESSEQUAL    0xb2
#define C_GREATEREQUAL    0xb3
#define C_YEN    0xb4
#define C_L_MU    0xb5
#define C_L_DELTA    0xb6
#define C_U_SIGMA    0xb7
#define C_U_PI    0xb8
#define C_L_PI    0xb9
#define C_INTEGRAL    0xba
#define C_ORDFEMININE    0xbb
#define C_ORDMASCULINE    0xbc
#define C_U_OMEGA    0xbd
#define C_L_AE    0xbe
#define C_LO_SLASH    0xbf
#define C_QUESTIONDOWN    0xc0
#define C_EXCLAMDOWN    0xc1
#define C_LOGICAL_NOT    0xc2
#define C_ROOT    0xc3
#define C_FLORIN    0xc4
#define C_APPROX_EQUAL    0xc5
#define C_U_DELTA    0xc6
#define C_GUILLEDBLLEFT    0xc7
#define C_GUILLEDBLRIGHT    0xc8
#define C_ELLIPSIS    0xc9
#define C_NONBRKSPACE    0xca
#define C_UA_GRAVE    0xcb
#define C_UA_TILDE    0xcc
#define C_UO_TILDE    0xcd
#define C_U_OE    0xce
#define C_L_OE    0xcf
#define C_ENDASH    0xd0
#define C_EMDASH    0xd1
#define C_QUOTEDBLLEFT    0xd2
#define C_QUOTEDBLRIGHT    0xd3
#define C_QUOTESNGLEFT    0xd4
#define C_QUOTESNGRIGHT    0xd5
#define C_DIVISION    0xd6
#define C_DIAMONDBULLET    0xd7
#define C_LY_DIERESIS    0xd8
#define C_UY_DIERESIS    0xd9
#define C_FRACTION    0xda
#define C_CURRENCY    0xdb
#define C_GUILSNGLEFT    0xdc
#define C_GUILSNGRIGHT    0xdd
#define C_LY_ACUTE    0xde
#define C_UY_ACUTE    0xdf
#define C_DBLDAGGER    0xe0
#define C_CNTR_DOT    0xe1
#define C_SNGQUOTELOW    0xe2
#define C_DBLQUOTELOW    0xe3
#define C_PERTHOUSAND    0xe4
#define C_UA_CIRCUMFLEX    0xe5
#define C_UE_CIRCUMFLEX    0xe6
#define C_UA_ACUTE    0xe7
#define C_UE_DIERESIS    0xe8
#define C_UE_GRAVE    0xe9
#define C_UI_ACUTE    0xea
#define C_UI_CIRCUMFLEX    0xeb
#define C_UI_DIERESIS    0xec
#define C_UI_GRAVE    0xed
#define C_UO_ACUTE    0xee
#define C_UO_CIRCUMFLEX    0xef
#define C_LOGO    0xf0
#define C_UO_GRAVE    0xf1
#define C_UU_ACUTE    0xf2
#define C_UU_CIRCUMFLEX    0xf3
#define C_UU_GRAVE    0xf4
#define C_LI_DOTLESS    0xf5
#define C_CIRCUMFLEX    0xf6
#define C_TILDE    0xf7
#define C_MACRON    0xf8
#define C_BREVE    0xf9
#define C_DOTACCENT    0xfa
#define C_RING    0xfb
#define C_CEDILLA    0xfc
#define C_HUNGARUMLAT    0xfd
#define C_OGONEK    0xfe
#define C_CARON    0xff

/* common shortcuts for low 32 codes */

#define C_NUL 		C_NULL
#define C_STX 		C_CTRL_B
#define C_ETX 		C_CTRL_C
#define C_BEL 		C_CTRL_G
#define C_BS 		C_CTRL_H
#define C_HT 		C_CTRL_I
#define C_VT 		C_CTRL_K
#define C_FF 		C_CTRL_L
#define C_SO 		C_CTRL_N
#define C_SI 		C_CTRL_O
#define C_DC1 		C_CTRL_Q
#define C_DC2 		C_CTRL_R
#define C_DC3 		C_CTRL_S
#define C_DC4 		C_CTRL_T
#define C_CAN 		C_CTRL_X
#define C_EM 		C_CTRL_Y
#define C_ESC 		C_ESCAPE

/* some alternative names: */

#define C_CR 		C_ENTER
#define C_CTRL_M 	C_ENTER
#define C_CTRL_I 	C_TAB
#define C_CTRL_J 	C_LINEFEED
#define C_LF 		C_LINEFEED
#define C_CTRL_N 	C_SHIFT_OUT
#define C_CTRL_O 	C_SHIFT_IN
#define C_FS 		C_ENSPACE
#define C_FIELD_SEP 	C_FS

/* some alternative names: */

#define C_HYPHEN 	C_MINUS
#define C_GRAVE 		C_BACKQUOTE

/* some alternative names: */

#define C_PARTIAL_DIFF 	C_L_DELTA
#define C_SUM 		C_U_SIGMA
#define C_PRODUCT 	C_U_PI
#define C_RADICAL 	C_ROOT
#define C_LOZENGE 	C_DIAMONDBULLET

#endif /* DBCS */
#endif


chunkarr.h

/***********************************************************************
 *
 *      Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:     PC GEOS
 * FILE:        chunkarr.h
 * AUTHOR:      Tony Requist: February 1, 1991
 *
 * DECLARER:    Kernel
 *
 * DESCRIPTION:
 *      This file defines chunk array structures and routines.
 *
 *      $Id: chunkarr.h,v 1.40.6.1 96/04/28 08:28:12 chris Exp $
 *
 ***********************************************************************/

#ifndef __CHUNKARR_H
#define __CHUNKARR_H

#include  <object.h>

/*
 *      Constants and Structures
 */

#define CA_NULL_ELEMENT      0xffff

typedef struct {
    word        CAH_count;
    word        CAH_elementSize;
    word        CAH_curOffset;
    word        CAH_offset;
} ChunkArrayHeader} ;

#define EA_FREE_LIST_TERMINATOR  CA_NULL_ELEMENT

typedef struct {
    ChunkArrayHeader    EAH_meta;
    word                EAH_freePtr;
} ElementArrayHeader} ;

typedef struct {
    WordAndAHalf        REH_refCount;
} RefElementHeader} ;

/***/

extern ChunkHandle      /*XXX*/
    _pascal ChunkArrayCreateAt (optr arr, word elementSize, word headerSize,
                ObjChunkFlags ocf);

#define ChunkArrayCreateAtHandles (mh, ch, esize, hsize, ocf)    \
    ChunkArrayCreateAt(ConstructOptr(mh, ch), esize, hsize, ocf)

#define ChunkArrayCreate (mh, esize, hsize, ocf) \
    ChunkArrayCreateAt(HandleToOptr(mh), esize, hsize, ocf)

/***/

extern void *   /*XXX*/
    _pascal ChunkArrayElementToPtr (optr arr, word elementNumber, word *elementSize);

#define ChunkArrayElementToPtrHandles (mh, ch, en, es) \
    ChunkArrayElementToPtr(ConstructOptr(mh, ch), en, es)

/***/

extern word     /*XXX*/
    _pascal ChunkArrayPtrToElement (optr arr, void *element);

#define ChunkArrayPtrToElementHandle (ch, el) \
    ChunkArrayPtrToElement(ConstructOptr(0, ch), el)

/***/

extern void     /*XXX*/
    _pascal ChunkArrayGetElement (optr arr, word elementNumber, void *buffer);

#define ChunkArrayGetElementHandles (mh, ch, en, buf) \
        ChunkArrayGetElement(ConstructOptr(mh, ch), en, buf)

/***/

extern void *   /*XXX*/
    _pascal ChunkArrayAppend (optr arr, word elementSize);

#define ChunkArrayAppendHandles (mh, ch, es) \
        ChunkArrayAppend(ConstructOptr(mh, ch), es)

/***/

extern void *   /*XXX*/
    _pascal ChunkArrayInsertAt (optr arr, void *insertPointer, word elementSize);

#define ChunkArrayInsertAtHandle (ch, ip, es) \
        ChunkArrayInsertAt(ConstructOptr(0, ch), ip, es)

/***/

extern void     /*XXX*/
    _pascal ChunkArrayDelete (optr arr, void *element);

#define ChunkArrayDeleteHandle (ch, el) \
        ChunkArrayDelete(ConstructOptr(0, ch), el)

/***/

extern void     /*XXX*/
    _pascal ChunkArrayDeleteRange (optr arr, word firstElement, word count);

/***/

extern word     /*XXX*/
    _pascal ChunkArrayGetCount (optr arr);

#define ChunkArrayGetCountHandles (mh, ch) \
        ChunkArrayGetCount(ConstructOptr(mh, ch))

/***/

extern void     /*XXX*/
    _pascal ChunkArrayElementResize (optr arr, word element, word newSize);

#define ChunkArrayElementResizeHandles (mh, ch, el, ns) \
        ChunkArrayElementResize(ConstructOptr(mh, ch), el, ns)

/***/

extern Boolean  /*XXX*/
    _pascal ChunkArrayEnum (optr arr, void *enumData,
           PCB(Boolean, callback,       /* TRUE to stop */
                (void *element, void *enumData)));

#define ChunkArrayEnumHandles (mh, ch, ed, cb) \
        ChunkArrayEnum(ConstructOptr(mh, ch), ed, cb)
/***/

extern Boolean  /*XXX*/
    _pascal ChunkArrayEnumRange (optr array, word startElement, word count,
            void *enumData,
            PCB(Boolean, callback,  /* TRUE to stop */
                (void *element, void *enumData)));

#define ChunkArrayEnumRangeHandles (mh, ch, st, co, ed, cb) \
    ChunkArrayEnumRange(ConstructOptr(mh,ch),st,co,ed,cb)

extern void     /*XXX*/
    _pascal ChunkArrayZero (optr arr);

#define ChunkArrayZeroHandles (mh, ch) ChunkArrayZero(ConstructOptr(mh, ch))

/***/

extern void     /*XXX*/
    _pascal ChunkArraySort (optr arr, word valueForCallback,
           PCB(sword, callback, (void *el1, void *el2,
                      word valueForCallback)));

#define ChunkArraySortHandles (mh, ch, vfc, cb) \
        ChunkArraySort(ConstructOptr(mh, ch), vfc, cb)

/***/

/*
 * Structure passed to ArrayQuickSort.
 */

typedef struct _QuickSortParameters  {
    PCB	(word,  QSP_compareCallback, (void *el1, void *el2,
                       word valueForCallback));
    PCB	(void,  QSP_lockCallback, (void *el, word valueForCallback));
    PCB	(void,  QSP_unlockCallback, (void *el, word valueForCallback));
    word       QSP_insertLimit;
    word       QSP_medianLimit;

    /* These are set internally by the quicksort algorithm and should not
       be set by the caller: */

    word       QSP_nLesser;
    word       QSP_nGreater;

} QuickSortParameters} ;

extern void     /*XXX*/
    _pascal ArrayQuickSort (void *array, word count, word elementSize,
               word valueForCallback,
               QuickSortParameters *parameters);

/*
 *      Element array routines
 */

extern ChunkHandle      /*XXX*/
    _pascal ElementArrayCreateAt (optr arr, word elementSize, word headerSize,
                    ObjChunkFlags ocf);

#define ElementArrayCreateAtHandles (mh, ch, esize, hsize, ocf)  \
    ElementArrayCreateAt(ConstructOptr(mh, ch), esize, hsize, ocf)

#define ElementArrayCreate (mh, esize, hsize, ocf) \
    ElementArrayCreateAtHandles(mh, NullChunk, esize, hsize, ocf)

/***/

extern void     /*XXX*/
    _pascal ElementArrayAddReference (optr arr, word token);

#define ElementArrayAddReferenceHandles (mh, ch, tok) \
        ElementArrayAddReference(ConstructOptr(mh, ch), tok)

/***/

extern word     /*XXX*/
    _pascal ElementArrayAddElement (optr arr, void *element, dword callbackData,
               PCB(Boolean, callback, (void *elementToAdd,
                        void *elementFromArray,
                        dword valueForCallback)));

#define ElementArrayAddElementHandles (mh, ch, el, cbd, cb) \
        ElementArrayAddElement(ConstructOptr(mh, ch), el, cbd, cb)

/***/

extern void     /*XXX*/
    _pascal ElementArrayRemoveReference (optr arr, word token, dword callbackData,
                PCB(void, callback, (void *element,
                          dword valueForCallback)));

#define ElementArrayRemoveReferenceHandles (mh, ch, tok, cbd, cb) \
        ElementArrayRemoveReference(ConstructOptr(mh, ch), tok, cbd, cb)

/***/

extern void     /*XXX*/
    _pascal ElementArrayDelete (optr arr, word token);

#define ElementArrayDeleteHandles (mh, ch, tok) \
        ElementArrayDelete(ConstructOptr(mh, ch), tok)

/***/

extern word     /*XXX*/
    _pascal ElementArrayElementChanged (optr arr, word token, dword callbackData,
               PCB(Boolean, callback, (void *elementChanged,
                        void *elementToCompare,
                        dword valueForCallback)));

#define ElementArrayElementChangedHandles (mh, ch, tok) \
        ElementArrayElementChanged(ConstructOptr(mh, ch), tok, \
                       callbackData, callback)

/***/

extern word     /*XXX*/
    _pascal ElementArrayGetUsedCount (optr arr, dword callbackData,
                 PCB(Boolean, callback, (void *element,
                             dword cbData)));

#define ElementArrayGetUsedCountHandles (mh, ch, cbd, cb) \
        ElementArrayGetUsedCount(ConstructOptr(mh, ch), cbd, cb)

/***/

extern word     /*XXX*/
    _pascal ElementArrayUsedIndexToToken (optr arr, word index, dword callbackData,
                 PCB(Boolean, callback, (void *element,
                             dword cbData)));

#define ElementArrayUsedIndexToTokenHandles (mh, ch, in, cbd, cb) \
    ElementArrayUsedIndexToToken(ConstructOptr(mh, ch), in, cbd, cb)

/***/

extern word     /*XXX*/
    _pascal ElementArrayTokenToUsedIndex (optr arr, word token, dword callbackData,
                 PCB(Boolean, callback, (void *element,
                             dword cbData)));

#define ElementArrayTokenToUsedIndexHandles (mh, ch, in, cbd, cb) \
    ElementArrayTokenToUsedIndex(ConstructOptr(mh, ch), in, cbd, cb)

/*
 *      Name array routines
 */

#define NAME_ARRAY_MAX_NAME_SIZE  256
#ifdef DO_DBCS
#define NAME_ARRAY_MAX_NAME_LENGTH  127
#else
#define NAME_ARRAY_MAX_NAME_LENGTH  255
#endif
#define NAME_ARRAY_MAX_DATA_SIZE  64

typedef struct {
    ElementArrayHeader  NAH_meta;
    word                NAH_dataSize;
} NameArrayHeader} ;

typedef struct {
    RefElementHeader    NAE_meta;
} NameArrayElement} ;

typedef struct {
    RefElementHeader    NAME_meta;
    byte                NAME_data[NAME_ARRAY_MAX_DATA_SIZE];
    TCHAR                NAME_name[NAME_ARRAY_MAX_NAME_LENGTH];
} NameArrayMaxElement} ;

typedef WordFlags NameArrayAddFlags ;
#define NAAF_SET_DATA_ON_REPLACE     0x8000

/***/

extern ChunkHandle      /*XXX*/
    _pascal NameArrayCreateAt (optr arr, word dataSize, word headerSize,
                    ObjChunkFlags ocf);

#define NameArrayCreateAtHandles (mh, ch, dsize, hsize, ocf)     \
    NameArrayCreateAt(ConstructOptr(mh, ch), dsize, hsize, ocf)

#define NameArrayCreate (mh, dsize, hsize, ocf) \
    NameArrayCreateAt(ConstructOptr(mh, 0), dsize, hsize, ocf)

/***/

extern word     /*XXX*/
    _pascal NameArrayAdd (optr arr, const TCHAR *nameToAdd, word nameLength,
         NameArrayAddFlags flags, const void *data);

#define NameArrayAddHandles (mh, ch, nm, len, fl, data) \
        NameArrayAdd(ConstructOptr(mh, ch), nm, len, fl, data)

/***/

extern word     /*XXX*/
    _pascal NameArrayFind (optr arr, const TCHAR *nameToAdd, word nameLength,
          void *returnData);

#define NameArrayFindHandles (mh, ch, nm, len, data) \
        NameArrayFind(ConstructOptr(mh, ch), nm, len, data)

/***/

extern void     /*XXX*/
    _pascal NameArrayChangeName (optr arr, word nameToken, const TCHAR *newName,
            word nameLength);

#define NameArrayChangeNameHandles (mh, ch, tok, nm, len) \
        NameArrayChangeName(ConstructOptr(mh, ch), tok, nm, len)

/***/

#ifdef __HIGHC__
pragma Alias(ChunkArrayCreateAt, "CHUNKARRAYCREATEAT");
pragma Alias(ChunkArrayElementToPtr, "CHUNKARRAYELEMENTTOPTR");
pragma Alias(ChunkArrayPtrToElement, "CHUNKARRAYPTRTOELEMENT");
pragma Alias(ChunkArrayGetElement, "CHUNKARRAYGETELEMENT");
pragma Alias(ChunkArrayAppend, "CHUNKARRAYAPPEND");
pragma Alias(ChunkArrayInsertAt, "CHUNKARRAYINSERTAT");
pragma Alias(ChunkArrayDelete, "CHUNKARRAYDELETE");
pragma Alias(ChunkArrayDeleteRange, "CHUNKARRAYDELETERANGE");
pragma Alias(ChunkArrayGetCount, "CHUNKARRAYGETCOUNT");
pragma Alias(ChunkArrayElementResize, "CHUNKARRAYELEMENTRESIZE");
pragma Alias(ChunkArrayEnum, "CHUNKARRAYENUM");
pragma Alias(ChunkArrayEnumRange, "CHUNKARRAYENUMRANGE");
pragma Alias(ChunkArrayZero, "CHUNKARRAYZERO");
pragma Alias(ChunkArraySort, "CHUNKARRAYSORT");
pragma Alias(ArrayQuickSort, "ARRAYQUICKSORT");
pragma Alias(ElementArrayCreateAt, "ELEMENTARRAYCREATEAT");
pragma Alias(ElementArrayAddReference, "ELEMENTARRAYADDREFERENCE");
pragma Alias(ElementArrayAddElement, "ELEMENTARRAYADDELEMENT");
pragma Alias(ElementArrayRemoveReference, "ELEMENTARRAYREMOVEREFERENCE");
pragma Alias(ElementArrayDelete, "ELEMENTARRAYDELETE");
pragma Alias(ElementArrayElementChanged, "ELEMENTARRAYELEMENTCHANGED");
pragma Alias(ElementArrayGetUsedCount, "ELEMENTARRAYGETUSEDCOUNT");
pragma Alias(ElementArrayUsedIndexToToken, "ELEMENTARRAYUSEDINDEXTOTOKEN");
pragma Alias(ElementArrayTokenToUsedIndex, "ELEMENTARRAYTOKENTOUSEDINDEX");
pragma Alias(NameArrayCreateAt, "NAMEARRAYCREATEAT");
pragma Alias(NameArrayAdd, "NAMEARRAYADD");
pragma Alias(NameArrayFind, "NAMEARRAYFIND");
pragma Alias(NameArrayChangeName, "NAMEARRAYCHANGENAME");
#endif

#endif


Objects\clipbrd.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	Objects/clipbrd.goh
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines clipboard stuff
 *
 *	$Id: clipbrd.goh,v 1.32.6.1 96/04/28 08:31:15 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

#include  <geoworks.h>
#include  <geode.h>
#include  <graphics.h>
@include  <Objects/metaC.goh>
@include  <Objects/uiInputC.goh>

/*
 *	Messages used for transfers
 */

typedef WordFlags ClipboardQuickNotifyFlags ;
#define CQNF_ERROR 		0x8000
#define CQNF_SOURCE_EQUAL_DEST 	0x4000
#define CQNF_MOVE 		0x2000
#define CQNF_COPY 		0x1000
#define CQNF_NO_OPERATION 	0x0800
#define CQNF_UNUSED 		0x04ff

/*
 *	Constants and structures used for transfers
 */

#define CLIPBOARD_MAX_FORMATS 	10

typedef dword ClipboardItemFormatID ;

#define FormatIDFromManufacturerAndType (m,t) 	((((dword)(t)) << 16) | (m) )
#define ManufacturerFromFormatID (id) 		((word) (id))
#define TypeFromFormatID (id) 			((word) ((id) >> 16))

typedef dword TransferBlockID ;

#define BlockIDFromFileAndBlock (f,b) 	(((dword)(f) << 16) | (b))
#define FileFromTransferBlockID (id) 	((VMFileHandle) ((id) >> 16))
#define BlockFromTransferBlockID (id) 	((VMBlockHandle) (id))

typedef WordFlags ClipboardItemFlags ;
#define CIF_UNUSED1 	0x8000
#define CIF_QUICK 	0x4000
#define TIF_NORMAL 	0x0000
#define CIF_UNUSED2 	0x2fff

#if DBCS_GEOS
#define CLIPBOARD_ITEM_NAME_LENGTH 	15
#else
#define CLIPBOARD_ITEM_NAME_LENGTH 	32
#endif

typedef TCHAR ClipboardItemNameBuffer [CLIPBOARD_ITEM_NAME_LENGTH+1];

typedef struct {
    ClipboardItemFormatID	CIFI_format;
    word		CIFI_extra1;
    word		CIFI_extra2;
    VMChain		CIFI_vmChain;
    GeodeToken		CIFI_renderer;
} ClipboardItemFormatInfo} ;

typedef ClipboardItemFormatInfo	FormatArray	[CLIPBOARD_MAX_FORMATS];

typedef struct {
    optr			CIH_owner;
    ClipboardItemFlags		CIH_flags;
    ClipboardItemNameBuffer	CIH_name;
#if DBCS_GEOS
    char			CIH_pad0DBCS;
#endif
    word			CIH_formatCount;
    optr			CIH_sourceID;
    FormatArray			CIH_formats;
    dword			CIH_reserved;
} ClipboardItemHeader} ;

/*
 *	Routines used for transfers
 */

extern Boolean
    _pascal ClipboardRegisterItem (TransferBlockID header, ClipboardItemFlags flags);

extern void	/* XXX */
    _pascal ClipboardUnregisterItem (optr owner);

typedef struct {
    word		CQA_numFormats;
    optr		CQA_owner;
    TransferBlockID	CQA_header;
} ClipboardQueryArgs} ;

extern void
    _pascal ClipboardQueryItem (word ClipboardItemFlags, ClipboardQueryArgs *retValues);

extern Boolean
    _pascal ClipboardTestItemFormat (TransferBlockID header, ClipboardItemFormatID format);

extern word _pascal	/* XXX */
    ClipboardEnumItemFormats    (TransferBlockID header,
                 word maxNumFormats,
                 ClipboardItemFormatID *buffer);

extern dword		/* XXX */
    _pascal ClipboardGetItemInfo (TransferBlockID header);

typedef struct {
    VMFileHandle    	CRA_file;
    VMChain 		CRA_data;
    word		CRA_extra1;
    word		CRA_extra2;
} ClipboardRequestArgs} ;

extern void		/* XXX */
    _pascal ClipboardRequestItemFormat (ClipboardItemFormatID format,
                       TransferBlockID header,
                       ClipboardRequestArgs *retValue);
extern void		/* XXX */
    _pascal ClipboardDoneWithItem (TransferBlockID header);

extern TransferBlockID	/* XXX */
    _pascal ClipboardGetNormalItemInfo (void);

extern TransferBlockID	/* XXX */
    _pascal ClipboardGetQuickItemInfo (void);

extern TransferBlockID	/* XXX */
    _pascal ClipboardGetUndoItemInfo (void);

extern VMFileHandle	/* XXX */
    _pascal ClipboardGetClipboardFile (void);

/* ClipboardOpenClipboardFile will return 0 on success or a VMStatus
   error code if it could not open the clipboard file.
*/
extern word		/* XXX */
    _pascal ClipboardOpenClipboardFile (void);

extern void
    _pascal ClipboardCloseClipboardFile (void);

extern void		/* XXX */
    _pascal ClipboardAddToNotificationList (optr notificationOD);

extern Boolean		/* XXX */
    _pascal ClipboardRemoveFromNotificationList (optr notificationOD);

extern Boolean		/* XXX */
    _pascal ClipboardRemoteSend (void);
extern Boolean		/* XXX */
    _pascal ClipboardRemoteReceive (void);

/*
 * Constants and structures for quick transfers
 */

typedef WordFlags ClipboardQuickTransferFlags ;
#define CQTF_IN_PROGRESS 	0x8000
#define CQTF_COPY_ONLY 		0x4000
#define CQTF_USE_REGION 		0x2000
#define CQTF_NOTIFICATION 	0x1000

typedef struct {
    word	CQTRI_paramAX;
    word	CQTRI_paramBX;
    word	CQTRI_paramCX;
    word	CQTRI_paramDX;
    Point	CQTRI_regionPos;
    dword	CQTRI_strategy;
    dword	CQTRI_region;
} ClipboardQuickTransferRegionInfo} ;

typedef enum {
    CQTF_SET_DEFAULT    ,
    CQTF_CLEAR_DEFAULT    ,
    CQTF_MOVE    ,
    CQTF_COPY    ,
    CQTF_CLEAR
} ClipboardQuickTransferFeedback} ;

/*
 *	Routines used for quick-transfers
 */

extern Boolean	/* XXX */
    _pascal ClipboardStartQuickTransfer (ClipboardQuickTransferFlags flags,
               ClipboardQuickTransferFeedback initialCursor,
               word mouseXPos,
               word mouseYPos,
               ClipboardQuickTransferRegionInfo *regionParams,
               optr notificationOD);

extern Boolean 	/* XXX */
    _pascal ClipboardGetQuickTransferStatus (void);

extern void	/* XXX */
    _pascal ClipboardSetQuickTransferFeedback (
            ClipboardQuickTransferFeedback cursor,
            UIFunctionsActive buttonFlags);

extern void	/* XXX */
    _pascal ClipboardEndQuickTransfer (ClipboardQuickNotifyFlags flags);

extern void	/* XXX */
    _pascal ClipboardAbortQuickTransfer (void);

extern void
    _pascal ClipboardClearQuickTransferNotification (optr notificationOD);

extern dword _pascal	/* XXX */
    ClipboardHandleEndMoveCopy    (word activeGrab,
                   word uifa,
                   Boolean checkQTInProgress);

/* ClipboardHandleEndMoveCopy returns method and UIFunctionsActive flags: */

#define UIFAFromClipboardHandleEndMoveCopy (retValue) \
    ((word) ((retValue) >> 16))
#define MethodFromClipboardHandleEndMoveCopy (retValue) \
    ((word) (retValue))

/***/

#ifdef __HIGHC__
pragma Alias(ClipboardRegisterItem, "CLIPBOARDREGISTERITEM");
pragma Alias(ClipboardUnregisterItem, "CLIPBOARDUNREGISTERITEM");
pragma Alias(ClipboardQueryItem, "CLIPBOARDQUERYITEM");
pragma Alias(ClipboardTestItemFormat, "CLIPBOARDTESTITEMFORMAT");
pragma Alias(ClipboardEnumItemFormats, "CLIPBOARDENUMITEMFORMATS");
pragma Alias(ClipboardGetItemInfo, "CLIPBOARDGETITEMINFO");
pragma Alias(ClipboardRequestItemFormat, "CLIPBOARDREQUESTITEMFORMAT");
pragma Alias(ClipboardDoneWithItem, "CLIPBOARDDONEWITHITEM");
pragma Alias(ClipboardGetNormalItemInfo, "CLIPBOARDGETNORMALITEMINFO");
pragma Alias(ClipboardGetQuickItemInfo, "CLIPBOARDGETQUICKITEMINFO");
pragma Alias(ClipboardGetUndoItemInfo, "CLIPBOARDGETUNDOITEMINFO");
pragma Alias(ClipboardGetClipboardFile, "CLIPBOARDGETCLIPBOARDFILE");
pragma Alias(ClipboardOpenClipboardFile, "CLIPBOARDOPENCLIPBOARDFILE");
pragma Alias(ClipboardCloseClipboardFile, "CLIPBOARDCLOSECLIPBOARDFILE");
pragma Alias(ClipboardAddToNotificationList, "CLIPBOARDADDTONOTIFICATIONLIST");
pragma Alias(ClipboardRemoveFromNotificationList, "CLIPBOARDREMOVEFROMNOTIFICATIONLIST");
pragma Alias(ClipboardStartQuickTransfer, "CLIPBOARDSTARTQUICKTRANSFER");
pragma Alias(ClipboardGetQuickTransferStatus, "CLIPBOARDGETQUICKTRANSFERSTATUS");
pragma Alias(ClipboardSetQuickTransferFeedback, "CLIPBOARDSETQUICKTRANSFERFEEDBACK");
pragma Alias(ClipboardEndQuickTransfer, "CLIPBOARDENDQUICKTRANSFER");
pragma Alias(ClipboardAbortQuickTransfer, "CLIPBOARDABORTQUICKTRANSFER");
pragma Alias(ClipboardClearQuickTransferNotification, "CLIPBOARDCLEARQUICKTRANSFERNOTIFICATION");
pragma Alias(ClipboardHandleEndMoveCopy, "CLIPBOARDHANDLEENDMOVECOPY");
pragma Alias(ClipboardRemoteSend, "CLIPBOARDREMOTESEND");
pragma Alias(ClipboardRemoteReceive, "CLIPBOARDREMOTERECEIVE");
#endif

@endlib


color.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  GEOS
 * MODULE:	  Kernel graphics
 * FILE:	  color.h
 *
 * AUTHOR:  	  Jim DeFrisco: Oct 23, 1992
 *
 * REVISION HISTORY:
 *	Name	  Date	    Description
 *	----	  ----	    -----------
 *	jim	  10/23/92	    Initial version
 *
 * DESCRIPTION:
 *	Color-related
 *
 *
 * 	$Id: color.h,v 1.4.5.1 96/04/28 08:28:32 chris Exp $
 *
 ***********************************************************************/
#ifndef _COLOR_H_
#define _COLOR_H_

typedef ByteEnum Color ;
#define C_BLACK  0
#define C_BLUE  1
#define C_GREEN  2
#define C_CYAN  3
#define C_RED  4
#define C_VIOLET  5
#define C_BROWN  6
#define C_LIGHT_GRAY  7
#define C_DARK_GRAY  8
#define C_LIGHT_BLUE  9
#define C_LIGHT_GREEN  10
#define C_LIGHT_CYAN  11
#define C_LIGHT_RED  12
#define C_LIGHT_VIOLET  13
#define C_YELLOW  14
#define C_WHITE  15

#define C_LIGHT_GREY 		C_LIGHT_GRAY
#define C_DARK_GREY 		C_DARK_GRAY

#define C_BW_GREY 		0x84

#define C_GRAY_0  0x10
#define C_GRAY_7  0x11
#define C_GRAY_13  0x12
#define C_GRAY_20  0x13
#define C_GRAY_27  0x14
#define C_GRAY_33  0x15
#define C_GRAY_40  0x16
#define C_GRAY_47  0x17
#define C_GRAY_53  0x18
#define C_GRAY_60  0x19
#define C_GRAY_68  0x1a
#define C_GRAY_73  0x1b
#define C_GRAY_80  0x1c
#define C_GRAY_88  0x1d
#define C_GRAY_93  0x1e
#define C_GRAY_100  0x1f

#define C_UNUSED_0  0x20
#define C_UNUSED_1  0x21
#define C_UNUSED_2  0x22
#define C_UNUSED_3  0x23
#define C_UNUSED_4  0x24
#define C_UNUSED_5  0x25
#define C_UNUSED_6  0x26
#define C_UNUSED_7  0x27

#define C_R0_G0_B0  0x28
#define C_R0_G0_B1  0x29
#define C_R0_G0_B2  0x2a
#define C_R0_G0_B3  0x2b
#define C_R0_G0_B4  0x2c
#define C_R0_G0_B5  0x2d
#define C_R0_G1_B0  0x2e
#define C_R0_G1_B1  0x2f
#define C_R0_G1_B2  0x30
#define C_R0_G1_B3  0x31
#define C_R0_G1_B4  0x32
#define C_R0_G1_B5  0x33
#define C_R0_G2_B0  0x34
#define C_R0_G2_B1  0x35
#define C_R0_G2_B2  0x36
#define C_R0_G2_B3  0x37
#define C_R0_G2_B4  0x38
#define C_R0_G2_B5  0x39
#define C_R0_G3_B0  0x3a
#define C_R0_G3_B1  0x3b
#define C_R0_G3_B2  0x3c
#define C_R0_G3_B3  0x3d
#define C_R0_G3_B4  0x3e
#define C_R0_G3_B5  0x3f
#define C_R0_G4_B0  0x40
#define C_R0_G4_B1  0x41
#define C_R0_G4_B2  0x42
#define C_R0_G4_B3  0x43
#define C_R0_G4_B4  0x44
#define C_R0_G4_B5  0x45
#define C_R0_G5_B0  0x46
#define C_R0_G5_B1  0x47
#define C_R0_G5_B2  0x48
#define C_R0_G5_B3  0x49
#define C_R0_G5_B4  0x4a
#define C_R0_G5_B5  0x4b
#define C_R1_G0_B0  0x4c
#define C_R1_G0_B1  0x4d
#define C_R1_G0_B2  0x4e
#define C_R1_G0_B3  0x4f
#define C_R1_G0_B4  0x50
#define C_R1_G0_B5  0x51
#define C_R1_G1_B0  0x52
#define C_R1_G1_B1  0x53
#define C_R1_G1_B2  0x54
#define C_R1_G1_B3  0x55
#define C_R1_G1_B4  0x56
#define C_R1_G1_B5  0x57
#define C_R1_G2_B0  0x58
#define C_R1_G2_B1  0x59
#define C_R1_G2_B2  0x5a
#define C_R1_G2_B3  0x5b
#define C_R1_G2_B4  0x5c
#define C_R1_G2_B5  0x5d
#define C_R1_G3_B0  0x5e
#define C_R1_G3_B1  0x5f
#define C_R1_G3_B2  0x60
#define C_R1_G3_B3  0x61
#define C_R1_G3_B4  0x62
#define C_R1_G3_B5  0x63
#define C_R1_G4_B0  0x64
#define C_R1_G4_B1  0x65
#define C_R1_G4_B2  0x66
#define C_R1_G4_B3  0x67
#define C_R1_G4_B4  0x68
#define C_R1_G4_B5  0x69
#define C_R1_G5_B0  0x6a
#define C_R1_G5_B1  0x6b
#define C_R1_G5_B2  0x6c
#define C_R1_G5_B3  0x6d
#define C_R1_G5_B4  0x6e
#define C_R1_G5_B5  0x6f
#define C_R2_G0_B0  0x70
#define C_R2_G0_B1  0x71
#define C_R2_G0_B2  0x72
#define C_R2_G0_B3  0x73
#define C_R2_G0_B4  0x74
#define C_R2_G0_B5  0x75
#define C_R2_G1_B0  0x76
#define C_R2_G1_B1  0x77
#define C_R2_G1_B2  0x78
#define C_R2_G1_B3  0x79
#define C_R2_G1_B4  0x7a
#define C_R2_G1_B5  0x7b
#define C_R2_G2_B0  0x7c
#define C_R2_G2_B1  0x7d
#define C_R2_G2_B2  0x7e
#define C_R2_G2_B3  0x7f
#define C_R2_G2_B4  0x80
#define C_R2_G2_B5  0x81
#define C_R2_G3_B0  0x82
#define C_R2_G3_B1  0x83
#define C_R2_G3_B2  0x84
#define C_R2_G3_B3  0x85
#define C_R2_G3_B4  0x86
#define C_R2_G3_B5  0x87
#define C_R2_G4_B0  0x88
#define C_R2_G4_B1  0x89
#define C_R2_G4_B2  0x8a
#define C_R2_G4_B3  0x8b
#define C_R2_G4_B4  0x8c
#define C_R2_G4_B5  0x8d
#define C_R2_G5_B0  0x8e
#define C_R2_G5_B1  0x8f
#define C_R2_G5_B2  0x90
#define C_R2_G5_B3  0x91
#define C_R2_G5_B4  0x92
#define C_R2_G5_B5  0x93
#define C_R3_G0_B0  0x94
#define C_R3_G0_B1  0x95
#define C_R3_G0_B2  0x96
#define C_R3_G0_B3  0x97
#define C_R3_G0_B4  0x98
#define C_R3_G0_B5  0x99
#define C_R3_G1_B0  0x9a
#define C_R3_G1_B1  0x9b
#define C_R3_G1_B2  0x9c
#define C_R3_G1_B3  0x9d
#define C_R3_G1_B4  0x9e
#define C_R3_G1_B5  0x9f
#define C_R3_G2_B0  0xa0
#define C_R3_G2_B1  0xa1
#define C_R3_G2_B2  0xa2
#define C_R3_G2_B3  0xa3
#define C_R3_G2_B4  0xa4
#define C_R3_G2_B5  0xa5
#define C_R3_G3_B0  0xa6
#define C_R3_G3_B1  0xa7
#define C_R3_G3_B2  0xa8
#define C_R3_G3_B3  0xa9
#define C_R3_G3_B4  0xaa
#define C_R3_G3_B5  0xab
#define C_R3_G4_B0  0xac
#define C_R3_G4_B1  0xad
#define C_R3_G4_B2  0xae
#define C_R3_G4_B3  0xaf
#define C_R3_G4_B4  0xb0
#define C_R3_G4_B5  0xb1
#define C_R3_G5_B0  0xb2
#define C_R3_G5_B1  0xb3
#define C_R3_G5_B2  0xb4
#define C_R3_G5_B3  0xb5
#define C_R3_G5_B4  0xb6
#define C_R3_G5_B5  0xb7
#define C_R4_G0_B0  0xb8
#define C_R4_G0_B1  0xb9
#define C_R4_G0_B2  0xba
#define C_R4_G0_B3  0xbb
#define C_R4_G0_B4  0xbc
#define C_R4_G0_B5  0xbd
#define C_R4_G1_B0  0xbe
#define C_R4_G1_B1  0xbf
#define C_R4_G1_B2  0xc0
#define C_R4_G1_B3  0xc1
#define C_R4_G1_B4  0xc2
#define C_R4_G1_B5  0xc3
#define C_R4_G2_B0  0xc4
#define C_R4_G2_B1  0xc5
#define C_R4_G2_B2  0xc6
#define C_R4_G2_B3  0xc7
#define C_R4_G2_B4  0xc8
#define C_R4_G2_B5  0xc9
#define C_R4_G3_B0  0xca
#define C_R4_G3_B1  0xcb
#define C_R4_G3_B2  0xcc
#define C_R4_G3_B3  0xcd
#define C_R4_G3_B4  0xce
#define C_R4_G3_B5  0xcf
#define C_R4_G4_B0  0xd0
#define C_R4_G4_B1  0xd1
#define C_R4_G4_B2  0xd2
#define C_R4_G4_B3  0xd3
#define C_R4_G4_B4  0xd4
#define C_R4_G4_B5  0xd5
#define C_R4_G5_B0  0xd6
#define C_R4_G5_B1  0xd7
#define C_R4_G5_B2  0xd8
#define C_R4_G5_B3  0xd9
#define C_R4_G5_B4  0xda
#define C_R4_G5_B5  0xdb
#define C_R5_G0_B0  0xdc
#define C_R5_G0_B1  0xdd
#define C_R5_G0_B2  0xde
#define C_R5_G0_B3  0xdf
#define C_R5_G0_B4  0xe0
#define C_R5_G0_B5  0xe1
#define C_R5_G1_B0  0xe2
#define C_R5_G1_B1  0xe3
#define C_R5_G1_B2  0xe4
#define C_R5_G1_B3  0xe5
#define C_R5_G1_B4  0xe6
#define C_R5_G1_B5  0xe7
#define C_R5_G2_B0  0xe8
#define C_R5_G2_B1  0xe9
#define C_R5_G2_B2  0xea
#define C_R5_G2_B3  0xeb
#define C_R5_G2_B4  0xec
#define C_R5_G2_B5  0xed
#define C_R5_G3_B0  0xee
#define C_R5_G3_B1  0xef
#define C_R5_G3_B2  0xf0
#define C_R5_G3_B3  0xf1
#define C_R5_G3_B4  0xf2
#define C_R5_G3_B5  0xf3
#define C_R5_G4_B0  0xf4
#define C_R5_G4_B1  0xf5
#define C_R5_G4_B2  0xf6
#define C_R5_G4_B3  0xf7
#define C_R5_G4_B4  0xf8
#define C_R5_G4_B5  0xf9
#define C_R5_G5_B0  0xfa
#define C_R5_G5_B1  0xfb
#define C_R5_G5_B2  0xfc
#define C_R5_G5_B3  0xfd
#define C_R5_G5_B4  0xfe
#define C_R5_G5_B5  0xff

/* flags to pass to GrSetXXXXColor routines */

typedef ByteEnum ColorFlag ;
#define CF_INDEX    0
#define CF_GRAY    1
#define CF_SAME    2
#define CF_CMY     3
#define CF_RGB  0x80

typedef struct {
    byte	CQ_redOrIndex;
    ColorFlag	CQ_info;
    byte	CQ_green;
    byte	CQ_blue;
} ColorQuad} ;

typedef dword ColorQuadAsDWord ;

#define ConstructColorQuadAsDWord (redOrIndex, info, green, blue)     \
    (ColorQuadAsDWord)((((ColorQuadAsDWord)(redOrIndex)) << 24)  |   \
               (((ColorQuadAsDWord)(info))  	 << 16)  |   \
               (((ColorQuadAsDWord)(green)) 	 << 8)   |   \
                ((ColorQuadAsDWord)(blue)))

/* Structures for defining color correction tables */

typedef struct {
    byte   RGBD_red;
    byte   RGBD_green;
    byte   RGBD_blue;
} RGBDelta} ;

typedef struct {
    RGBDelta	CT_data[125];
} ColorTransfer} ;

/* structure region for RGB values */

typedef dword RGBColorAsDWord ;

#define RGB_RED (val) ( val & 0xff )
#define RGB_GREEN (val) ( (val >> 8) & 0xff )
#define RGB_BLUE (val) ( (val >> 16) & 0xff )
#define RGB_INDEX (val) ( (val >> 24) & 0xff )

typedef struct {
    byte	RGB_red;
    byte	RGB_green;
    byte	RGB_blue;
} RGBValue} ;

/* Structure of custom palette allocated by GrCreatePalette and
 * associated with windows. The default value of P_entries is 16.
 */
typedef struct {
    word P_entries;             /* # 3-byte entries in palette */
} Palette} ;

#endif /* _COLOR_H_ */


Objects\colorC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	colorC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines classes for the color library
 *
 *	$Id: colorC.goh,v 1.17.6.1 96/04/28 08:31:45 chris Exp $
 *
 ***********************************************************************/
@optimize

@deflib color

@class	ColorSelectorClass, GenControlClass ;

/*
 * Returns non-zero if objects of different colors are selected.
 */
@message Boolean MSG_COLOR_SELECTOR_GET_COLOR (
                                ColorQuad *retValue = dx.cx) = bp;

/*
 * The indeterminateFlag should be non-zero if objects of different
 * colors are selected.
 */
@message void MSG_COLOR_SELECTOR_UPDATE_COLOR (
                                ColorQuad colorQuad = dx.cx,
                                Boolean indeterminateFlag = bp);

@message void MSG_COLOR_SELECTOR_SET_COLOR (
                                ColorQuad colorQuad = dx.cx,
                                Boolean indeterminateFlag = bp);

@message void MSG_COLOR_SELECTOR_APPLY_COLOR (ColorQuad colorQuad = dx.cx);

/*
 * The indeterminateFlag should be non-zero if objects of different
 * colors are selected.
 */
@message void MSG_COLOR_SELECTOR_UPDATE_FILLED_STATUS (
                                SystemDrawMask drawMask = cl,
                                Boolean indeterminateFlag = dx,
                                word updateToolboxFlag = bp);

/*
 * Returns 0 if the default should be used, in which case retValue
 * will be invalid.
 */
@message Boolean MSG_COLOR_SELECTOR_GET_FILLED_MONIKER (
                                optr *retValue = dxcx) = cx;

/*
 * Returns 0 if the default should be used, in which case retValue
 * will be invalid.
 */
@message Boolean MSG_COLOR_SELECTOR_GET_UNFILLED_MONIKER (
                                optr *retValue = dxcx) = cx;

/*
 * The indeterminateFlag should be non-zero if objects with different
 * draw masks are selected.
 */
@message void MSG_COLOR_SELECTOR_UPDATE_DRAW_MASK (
                                SystemDrawMask drawMask = cl,
                                Boolean indeterminateFlag = dx);

/*
 * Returns non-zero if objects with different draw masks are selected.
 */
@message Boolean MSG_COLOR_SELECTOR_GET_DRAW_MASK (
                                SystemDrawMask *retValue = cl) = dx;

/*
 * The indeterminateFlag should be non-zero if objects with different
 * draw masks are selected.
 */
@message void MSG_COLOR_SELECTOR_SET_DRAW_MASK (
                                SystemDrawMask drawMask = cl,
                                Boolean indeterminateFlag = dx);

@message void MSG_COLOR_SELECTOR_APPLY_DRAW_MASK (
                                SystemDrawMask drawMask = cl);

/*
 * The indeterminateFlag should be non-zero if objects with different
 * patterns are selected.
 */
@message void MSG_COLOR_SELECTOR_UPDATE_PATTERN (
                                GraphicPattern pattern = cx,
                                Boolean indeterminateFlag = dx);

/*
 * Returns non-zero if objects with different patterns are selected.
 */
@message Boolean MSG_COLOR_SELECTOR_GET_PATTERN (
                                GraphicPattern *retValue = cx) = dx;

/*
 * The indeterminateFlag should be non-zero if objects with different
 * patterns are selected.
 */
@message void MSG_COLOR_SELECTOR_SET_PATTERN (
                                GraphicPattern pattern = cx,
                                Boolean indeterminateFlag = dx);

@message void MSG_COLOR_SELECTOR_APPLY_PATTERN (
                                GraphicPattern pattern = cx);

@message void MSG_CS_SET_FILLED_STATUS ();   /* INTERNAL */
@message void MSG_CS_SET_CF_INDEX ();   	    /* INTERNAL */
@message void MSG_CS_SET_CF_RGB_RED ();      /* INTERNAL */
@message void MSG_CS_SET_CF_RGB_GREEN ();    /* INTERNAL */
@message void MSG_CS_SET_CF_RGB_BLUE ();     /* INTERNAL */
@message void MSG_CS_SET_DRAW_MASK ();       /* INTERNAL */
@message void MSG_CS_SET_PATTERN ();   	    /* INTERNAL */

@importMessage MetaColorMessages, void MSG_META_COLORED_OBJECT_SET_COLOR (
                                ColorQuad colorQuad = dx.cx);
@importMessage MetaColorMessages, void MSG_META_COLORED_OBJECT_SET_DRAW_MASK (
                                SystemDrawMask drawMask = cl);
@importMessage MetaColorMessages, void MSG_META_COLORED_OBJECT_SET_PATTERN (
                                GraphicPattern pattern = cx);

typedef WordFlags CSFeatures ;
#define CSF_FILLED_LIST 	0x10
#define CSF_INDEX 	0x08
#define CSF_RGB 		0x04
#define CSF_DRAW_MASK 	0x02
#define CSF_PATTERN 	0x01

typedef WordFlags CSToolboxFeatures ;
#define CSTF_INDEX 	0x04
#define CSTF_DRAW_MASK 	0x02
#define CSTF_PATTERN 	0x01

#define CS_DEFAULT_FEATURES  \
    (CSF_FILLED_LIST | CSF_INDEX | CSF_RGB | CSF_DRAW_MASK | CSF_PATTERN)

#define CS_DEFAULT_TOOLBOX_FEATURES  \
    (CSTF_INDEX | CSTF_DRAW_MASK | CSTF_PATTERN)

typedef ByteFlags ColorModifiedStates ;
#define CMS_COLOR_CHANGED 	0x04
#define CMS_DRAW_MASK_CHANGED 	0x02
#define CMS_PATTERN_CHANGED 	0x01

typedef ByteEnum ColoredObjectOrientation ;
#define     COO_AREA_ORIENTED      0
#define     COO_TEXT_ORIENTED      1
#define     COO_LINE_ORIENTED      2

typedef ByteFlags ColorToolboxPreferences ;
#define CTP_INDEX_ORIENTATION 		0x30
#define CTP_DRAW_MASK_ORIENTATION 	0x0c
#define CTP_PATTERN_ORIENTATION 		0x02
#define CTP_IS_POPUP 			0x01

#define CTP_INDEX_ORIENTATION_OFFSET 		4
#define CTP_DRAW_MASK_ORIENTATION_OFFSET 	2
#define CTP_PATTERN_ORIENTATION_OFFSET 		1

    @instance ColorQuad			CSI_color = {0, 0, 0, 0};
    @instance byte			CSI_colorIndeterminate;
    @instance SystemDrawMask		CSI_drawMask = SDM_0;
    @instance byte			CSI_drawMaskIndeterminate;
    @instance GraphicPattern		CSI_pattern = {0, 0};
    @instance byte			CSI_patternIndeterminate;
    @instance ColorModifiedStates	CSI_states = 0;
    @instance ColorToolboxPreferences	CSI_toolboxPrefs = CTP_IS_POPUP;

    @vardata optr	ATTR_COLOR_SELECTOR_DISABLE_OBJECT;
        @reloc ATTR_COLOR_SELECTOR_DISABLE_OBJECT, 0, optr;

@endc

@endlib


Internal\Resp\compose.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1995. Nokia Mobile Phones
*/

/*
--------------------------------------------------------------------------------

DESCRIPTION

Header file for Compose, included by all clients of Compose. ""
--------------------------------------------------------------------------------
*/

@ifndef COMPOSE_GOH
@define COMPOSE_GOH

@deflib compose

/* INCLUDE FILES */

@include  <stdapp.goh>
#include  <library.h>

#define TUNE_NAME_MAX_LENGTH 		32

/* Compose Control  include header file. */ ""

@class ComposeControlClass,GenControlClass;
   @message void MSG_CMP_INITIATE (TCHAR *ptFile /*byte index remmed by  AIV*/);
   @message void MSG_CMP_CLOSE ();
   @message void MSG_CMP_EDIT ();
   @message void MSG_CMP_PLAY (Boolean bChangePlayButton /* AIV 090697 Parameter name change AIV 250398 */);
   @message void MSG_CMP_BACK ();
   @message void MSG_CMP_CTRL_CLEAR ();
   @message void MSG_CMP_CLEAR_DIALOG_RESET ();
   @message void MSG_CMP_UNDO_DIALOG_RESET ();
   @message void MSG_CMP_UNDO_DIALOG_SET ( optr dialog);
   @message void MSG_CMP_VP_ECI_RECEIVE (word messageId ,MemHandle structure); /* Added parameter AIV 170498 */
   @message int MSG_CMP_TEST ();

   /* Following by AIV */
   @message void MSG_CMP_GET_OTA (TCHAR *ptcFile);
   @message void MSG_CMP_OTA_OPEN (TCHAR *ptcFile);
   @message Boolean MSG_CMP_SAVE_OK (optr newDlg);
   @message MemHandle MSG_CMP_FIND_TUNE_NAME (MemHandle hTune);
   @message void MSG_CMP_ONE_NOTE_PLAY ();
   @message int MSG_CMP_ONE_NOTE_TO_STRING (byte *tone_string);

   @message void MSG_CMP_PLAY_FROM_BUTTON ();           /*   AIV 090697 bug 7392*/
   @message void MSG_CMP_STOP_FROM_BUTTON ();           /*   AIV 090697 bug 7392*/

   @message void MSG_CMP_UPDATE_NAME (TCHAR *ptcFileName, Boolean boolOnMemoryCard);
   /* AIV 050897 bug 8666 fix 379 boolOnMemoryCard added AIV 160698 */

   @default GI_states = (@default | GS_ENABLED);
   @default GII_type = (GIT_MULTIPLE_RESPONSE);
   @default GII_visibility = (GIV_DIALOG);
   @default GII_attrs = (@default | GIA_NOT_USER_INITIATABLE | GIA_MODAL);

   @instance optr CCI_visObject  = NullOptr;
   @instance optr CCI_undoDialogOptr = NullOptr;
   @instance optr CCI_clearDialogOptr = NullOptr;

@endc

/* --------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */

@endlib
@endif /* End of COMPOSE.GOH */


compress.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	Compress Library
 * FILE:	compress.h
 *
 *
 * REVISION HISTORY:
 *
 *	Name	Date		Description
 *	----	----		-----------
 *	atw	1/25/93		Initial revision
 *
 *
 * DESCRIPTION:
 *	Contains declarations for externally callable routines in the compress
 *	library.
 *
 *	$Id: compress.h,v 1.4.6.1 96/04/28 08:29:40 chris Exp $
 *
 ***********************************************************************/

#ifndef	__COMPRESS_H
#define	__COMPRESS_H

#define	COMPRESS_PROTO_MAJOR		1
#define	COMPRESS_PROTO_MINOR		0

typedef WordFlags CompLibFlags ;

#define	CLF_SOURCE_IS_BUFFER		0x8000
#define	CLF_DEST_IS_BUFFER		0x4000
#define	CLF_DECOMPRESS		    	0x2000
#define	CLF_MOSTLY_ASCII		0x1000

extern word
    _pascal CompressDecompress (CompLibFlags flags,
                   FileHandle sourceFileHandle,
                   void *sourceBuffer,
                   word sourceBufferSize,
                   FileHandle destFileHandle,
                   void *destBuffer);

#ifdef    __HIGHC__
pragma Alias(CompressDecompress, "COMPRESSDECOMPRESS");
#endif

#endif


config.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1993 -- All Rights Reserved
 *
 * PROJECT:
 * MODULE:
 * FILE:	  config.goh
 *
 * AUTHOR:  	  Adam de Boor: Apr  6, 1993
 *
 * REVISION HISTORY:
 *	Name	  Date	    Description
 *	----	  ----	    -----------
 *	ardeb	  4/ 6/93    Initial version
 *
 * DESCRIPTION:
 *	Definition file for the config library
 *
 * 	$Id: config.goh,v 1.24.4.1 96/04/28 08:28:42 chris Exp $
 *
 ***********************************************************************/

@include  <ui.goh>
#include  <dbase.h>

/*=============================================================================
 *
 *		     Module Interface Definition
 *
 *===========================================================================*/

/*
 * Revision level of this interface. These constants must be *outside* of the
 * StartLibrary so they end up in the symbol table of the module, and can thus
 * be used by Glue to set the protocol number of the module.
 */
#define PREF_MODULE_PROTO_MAJOR 	2
#define PREF_MODULE_PROTO_MINOR 	0

@deflib	config

/*
 * Note that unlike normal UI features, the user cannot set these flags
 * directly.  Instead, they are normally set by running a small
 * "launcher" app which passes the flags to PrefMgr in the extra data
 * block.  DO NOT Rearrange these bits without changing the
 * usabilityTable in prefmgrApplication.asm
 */
typedef WordFlags PrefMgrFeatures ;
#define	PMF_HARDWARE		0x8000
    /* These settings are for a user who has permissions to
     * actually change the configuration of the workstation.  In a
     * network environment where users log in to different machines
     * at different times, normal users would be prevented from
     * changing the mouse & video drivers, etc. */

#define	PMF_SYSTEM		0x4000
    /* These changes are more complex & potentially more damaging
     * than the basic "user" changes, therefore, some users may be
     * prevented from using these settings. */

#define PMF_NETWORK 	0x2000
    /* Network settings -- generally only the system administrator
     * will see these settings */

#define	PMF_USER		0x1000
    /* These are basic user changes -- normally this flag works the
     * opposite way of the other flags -- by default all UI is
     * "on", but if the user flag is off, then some basic UI might
     * go away.  This would allow a network administrator, for
     * example, to look at a scaled-down, "network-only" prefmgr. */

/*
 * Entry points for the Preferences Modules.  Each module (library)
 * MUST have the following routines exported in its .gp file, in the
 * following order, as the FIRST routines exported from that library.
 */
typedef enum {
    PMET_FETCH_UI    ,  	    /* Return the OD of the top-most object in the UI
                 * tree. All UI *must* be in the same segment as
                 * this object. The UI tree will be duplicated by
                 * the application, and added to the app's generic
                 * tree.
                 *
                 * Parameters:  optr _pascal (void)
                 */
    PMET_GET_MODULE_INFO    ,   /* Return information about this module that will
                 * be used to determine whether to display it
                 * on-screen, what it will look like, etc, etc.
                 *
                 * Parameters: void _pascal (PrefModuleInfo *)
                 */
} PrefModuleEntryType} ;

typedef	struct {
    PrefMgrFeatures	    PMI_requiredFeatures;
    PrefMgrFeatures	    PMI_prohibitedFeatures;
    UIInterfaceLevel    PMI_minLevel;
    UIInterfaceLevel    PMI_maxLevel;
    optr	    	    PMI_monikerList;
    GeodeToken	    PMI_monikerToken;
} PrefModuleInfo} ;

/*---------------------------------------------------------------------------
 *	TOC FILE
 *---------------------------------------------------------------------------*/
#define DT_UNKNOWN 	(-1)
 /* When the source disk for a file is unknown */

#define DT_EXTRA_ENTRY 	(-2)
 /* item is a temporary entry.  File is on the hard disk. */

/* This structure is the map item of the TOC file.
 * The TOC file consists of two main arrays -- the DISKS array and the
 * CATEGORIES array.   */

typedef	struct {
    DBGroupAndItem	TM_disks;
    DBGroupAndItem	TM_categories;
} TocMap} ;

typedef	struct {
    VolumeName	TDSS_volumeName;
    MediaType	TDSS_mediaType;
     TCHAR	    	TDSS_name[1];
} TocDiskStruct} ;

/*---------------------------------------------------------------------------
 *	UPDATING A CATEGORY
 *---------------------------------------------------------------------------
 * Certain operations (opening a device list, scanning for modules), cause a
 * category to be updated, which means that the files are scanned, and
 * the list is maintained, etc.  Each category in question is
 * identified by its token chars, which MUST be unique across all
 * categories.  Normally, a category consists of an array of FILES,
 * each element of which is of size TocFileStruct.  However, a custom
 * array may be created, in which elements are of the passed size.  If
 * a custom array is used, the caller must specify a callback routine
 * that gets called when a new element is added to the array.
 */

typedef WordFlags TocUpdateCategoryFlags ;
#define	TUCF_EXTENDED_DEVICE_DRIVERS		0x8000
    /* Files being enumerated are assumed to be extended device drivers. */

#define	TUCF_CUSTOM_FILES	   	    	0x4000
    /* The TUCP_fileArrayElementSize field will be
     * used when creating the files array.  Otherwise, each element
     * of the files array will be of size TocFileStruct.  NOTE:  If
     * this flag is used, the data structure used for each file
     * element MUST contain TocFileStruct as its first element. */

#define	TUCF_ADD_CALLBACK	   	    	0x2000
    /* TUCP_addCallback contains a fptr to a callback
     * routine that will be called when a file is added to the
     * files array. */

#define	TUCF_DIRECTORY_NOT_FOUND	    	0x1000
    /* Don't actually scan the directory, because it doesn't exist.
     * Just create the category, and leave it empty. */

typedef word _pascal TocUpdateAddCallback (const char *filename,
                          optr chunkArray);
    /* Return 0 if add aborted, else return offset of new element within
     * block */

typedef struct {
    TocUpdateCategoryFlags	TUCP_flags;
    TokenChars		TUCP_tokenChars;
    byte	    	    	TUCP_fileArrayElementSize;

    TocUpdateAddCallback	*TUCP_addCallback;
    byte	TUCP_pad;   	/* Wants to be word-aligned */
} TocUpdateCategoryParams} ;

/* This is the element structure for each element in the categories
 * array.  */
typedef	struct {
    TokenChars	TCS_tokenChars;
    DBGroupAndItem	TCS_files;	/* file name array */
    DBGroupAndItem	TCS_devices;	/* device name array -- only if
                     * TCF_EXTENDED_DEVICE_DRIVERS
                     * is set. */
} TocCategoryStruct} ;

typedef	struct {
    word	    	TFS_sourceDisk;		/* disk token */
    ReleaseNumber	TFS_release;
    TCHAR	    	TFS_name[1];
} TocFileStruct} ;

typedef struct {
    word	TDS_driver;		/* element in driver array */
    word	TDS_info;		/* extra word of info (depends
                     * on device type)	 */

    TCHAR	TDS_name[1];
} TocDeviceStruct} ;

#define TOC_NAME_MAX_LENGTH  64
#define TOC_ELEMENT_BUFFER_SIZE 	((size TocDeviceStruct) + (TOC_NAME_MAX_LENGTH * sizeof(TCHAR)))

/*---------------------------------------------------------------------------
 *	STRUCTURES
 *---------------------------------------------------------------------------*/

typedef ByteFlags PrefInitFileFlags ;

#define	PIFF_USE_ITEM_STRINGS		    	    0x80
    /* If set, then the item group's children must be of class
     * PrefStringItemClass, and their strings will be used to
     * interact with the init file. */

#define	PIFF_USE_ITEM_MONIKERS		    	    0x40
    /* If set, then the monikers of the items are used to interact
     * with the init file. */

#define	PIFF_APPEND_TO_KEY	  	    	    0x20
    /* If set, the strings in this list will be ADDED to strings
     * that may already exist for this key */

#define	PIFF_ABSENT_KEY_OVERRIDES_DEFAULTS	  0x10
    /* If set, an absent key for the item group will cause it to
     * behave as if an empty key were in the ini file, effectively
     * overriding any default values stored with the group when it was
     * compiled. Used primarily by those groups where one subclasses
     * MSG_PREF_STRING_ITEM_CHECK_IF_IN_INIT_FILE_KEY to determine the
     * initial setting, rather than looking in the ini file. */

#define	PIFF_SUSPEND_ON_LOAD_OPTIONS		    0x08
    /* Suspend the item group when loading options, to keep it from
     * sending out status messages, etc. */

#if DBCS_GEOS
#define	PIFF_NUMERIC_MONIKERS			    0x04
    /* Used with PIFF_USE_ITEM_MONIKERS to force item to be stored in
     * init file as an integer rather than a string.  Only relevant for
     * DBCS.  For this to work, PIFF_APPEND_TO_KEY and
     * ATTR_PREF_ITEM_GROUP_EXTRA_STRING_SECTION mustn't be set, and
     * the item group must be exclusive or exclusive-none, and the
     * numeric moniker must be in the range 0-65535. */
#endif

typedef ByteFlags PrefEnableFlags ;
#define	PEF_DISABLE_IF_SELECTED		    0x80
    /* if set, disable the object if the associated item is selected,
     * otherwise do the opposite. */

#define	PEF_DISABLE_IF_NONE	 	    0x40
    /* If this flag is set, then the PED_item field is ignored.
     * Instead, the item group will disable the specified object if
     * no items are selected -- or if there are no items in the list. */

typedef ByteFlags PrefCategoryFlags ;
#define	PCF_DELETE_IF_SELECTED		    0x80
    /* If set, delete the category if the item is selected.
     * Otherwise, the category will be created if the item is
     * selected, and deleted otherwise. */

typedef	struct {
    word	    	    PCD_item;
    /* Item identifier to control deletion/creation of category */

    PrefCategoryFlags   PCD_flags;
} PrefCategoryData} ;

typedef	struct {
    word	    	PED_item;   /* Identifier of the item that controls
                     * enabling / disabling of object.  If the
                     * identifier is GIGS_NONE, then the action
                     * will be performed if no items are
                     * selected. */
    ChunkHandle 	PED_lptr;   /* Object to be enabled/disabled */
    PrefEnableFlags	PED_flags;
} PrefEnableData} ;

/*=============================================================================
 *
 *			      PrefClass
 *
 * The root class of the various subclasses of generic objects used to
 * implement new Preferences modules. Each of these subclasses
 * performs various functions beyond the basic save/load options
 * functionality provided by the generic object of which they are a
 * subclass.
 *
 * PrefClass is a variant master class, meaning each subclass of it will be
 * asked at runtime what its generic superclass should be, if it's not
 * already been specified (when you define these objects in a resource, they
 * are already built to the Gen level).
 *
 * PrefClass exists to provide common functionality required by all the various
 * Pref subclasses, define messages implemented by every subclass, and define
 * instance data required to implement the common functionality.
 *===========================================================================*/

#define ObjDerefPref (op)	ObjDeref((op),offsetof(PrefBase,Pref_offset))

@class PrefClass, GenClass, master, variant;

@message void MSG_PREF_SET_INIT_FILE_CATEGORY (const char *category = cx:dx);
/*
 * Change the value of vardata ATTR_GEN_INIT_FILE_CATEGORY
 *
 * Context:
 * Source:
 * Destination:
 * Interception:
 *
 */

@message Boolean MSG_PREF_HAS_STATE_CHANGED () = carry;
/*
 * Determine whether this object, or any of its children, have changed
 * since the last LOAD_OPTIONS
 *
 * Context:	Part of APPLY/SAVE OPTIONS mechanism
 * Source:
 * Destination:
 * Interception:
 *
 */

@message optr MSG_PREF_GET_REBOOT_INFO () = cx:dx;
/*
 * Sent to any of the "Pref" objects to see if the system needs
 * rebooting as a result of changes.
 *
 * Context:	    APPLY mechanism in PrefMgr
 * Source:
 * Destination:     any "Pref" object
 * Interception:    subclass should determine whether state has changed,
 * 	    	    and, if so, what reboot message to put up on
 * 	    	    screen.  If reboot is * never needed for a class,
 * 	    	    then no need to do anything.
 *
 * Return:	IF NEEDS REBOOT:
 *			OD of string to put up in ConfirmDialog (placed
 *	    	    	in the middle of a sentence)
 *		ELSE
 *			0
 */

@message optr MSG_PREF_GET_REBOOT_STRING () = cx:dx;
/*
 * Return the optr of a string in a sharable lmem resource that will be
 * displayed in the reboot dialog.  If this object doesn't have such a
 * string, it will call its gen parent (if the GenParent is a subclass
 * of PrefClass).
 *
 *
 * Return:	optr of string (cx = 0 if not found)
 */

@message void MSG_PREF_INIT (PrefMgrFeatures features=cx,
                UIInterfaceLevel level=dx);
/*
 * Initialize this object.   Perform any setup that's required when the
 * object first comes on-screen.  This message is sent from a
 * PrefDialog to all of its children when the dialog is first
 * initiated.
 *
 * Context:	    Part of initialization mechanism
 * Source:	    generic parent
 * Destination:     any PrefClass object
 * Interception:    default behavior is to determine whether to make the
 * 		    object usable based on UI level and features (or will
 * 		    be, when implemented).  Subclass should call
 * 		    superclass before handling, as subclass behavior may
 * 		    be different if the object is not usable, etc.
 */

@message void MSG_PREF_NOTIFY_DIALOG_CHANGE (PrefDialogChangeType type=cx);
/* Message sent out over PDGCNLT_DIALOG_CHANGE list bound to PrefDialog object,
 * telling interested parties of a change in the box's state.
 *
 * Context:	    Sent when the dialog box is being opened, closed, or
 *	    	    destroyed.
 * Source:	    PrefDialogClass
 * Destination:     Any Pref object registered on PDGCNLT_DIALOG_CHANGE
 * Interception:    Must be intercepted to do anything (no default handler)
 */

typedef enum {
    PDCT_OPEN    ,
    PDCT_CLOSE    ,
    PDCT_DESTROY    ,
    PDCT_RESTART    ,
    PDCT_SHUTDOWN
} PrefDialogChangeType} ;

@message void MSG_PREF_SET_ORIGINAL_STATE ();
/*
 * Copy this object's current state to the "original" settings, which
 * will be restored on a MSG_GEN_RESET.
 *
 */

/*---------------------------------------------------------------------------
 *	INSTANCE DATA
 *---------------------------------------------------------------------------*/
typedef ByteFlags PrefAttributes ;
#define	PA_REBOOT_IF_CHANGED		0x80
    /* This bit signals that changes in the state of this object
     * require a system reboot to take effect. */

#define	PA_LOAD_IF_USABLE	   	0x40
    /* Load options only if this object is usable (this is ON by
     * default). */

#define	PA_SAVE_IF_USABLE	   	0x20
    /* Save options only if this object is usable (this is ON by
     * default)  */

#define	PA_SAVE_IF_ENABLED	  	0x10
    /* Save options only if this object is enabled */

#define	PA_SAVE_IF_CHANGED	  	0x08
    /* Save options only if this object has changed. */

    @instance PrefAttributes PI_attrs = (PA_LOAD_IF_USABLE|PA_SAVE_IF_USABLE);

/*---------------------------------------------------------------------------
 *	VARIABLE DATA
 *---------------------------------------------------------------------------*/

@vardata optr ATTR_PREF_REBOOT_STRING;
/* This is the string passed to MSG_PREF_MGR_DO_REBOOT_DIALOG -- the
 * string must be in a SHARABLE LMEM resource and is incorporated into the
 * middle of another sentence. In English, the sentence is "The system software
 * will shut down and restart to change the <reboot_string>. Do you wish
 * to proceed?"
 *
 * If an object has its PA_REBOOT_IF_CHANGED attribute set, it will scan for
 * this attribute, first in itself, then up the generic tree, until it
 * finds one. */
@reloc ATTR_PREF_REBOOT_STRING, 0, optr;

@vardata PrefMgrFeatures ATTR_PREF_REQUIRED_FEATURES;
/* features bits that MUST be set for this object to be usable. */

@vardata PrefMgrFeatures ATTR_PREF_PROHIBITED_FEATURES;
/* features bits that MUST NOT be set for this object to be usable. */

@vardata UIInterfaceLevel ATTR_PREF_MIN_LEVEL;
/* interface level below which this object will not be usable */

@vardata UIInterfaceLevel ATTR_PREF_MAX_LEVEL;
/* interface level above which this object will not be usable */

@endc;

/*============================================================================
 *
 *			    PrefValueClass
 *
 * A subclass of GenValue to implement MSG_GEN_RESET automatically, as well
 * as the standard functionality implemented by all Pref objects.
 * Unlike GenValueClass, this class only deals with word-sized INTEGER
 * values.
 *
 *===========================================================================*/

@class PrefValueClass, PrefClass;
    @default Pref = GenValueClass;

@message void MSG_PREF_VALUE_SET_ORIGINAL_VALUE (word orig=cx,
                        Boolean indeterminate=bp);
/*
 * Set the original value of a PrefValue object -- also sets the value
 * of the superclass.
 *
 *
 * Context:	usually sent during startup of pref module
 * Source:	app
 * Destination: any PrefValue object
 * Interception: not likely
 */

/*---------------------------------------------------------------------------
 *		INSTANCE DATA
 *---------------------------------------------------------------------------*/

@vardata void ATTR_PREF_VALUE_ORIG_IS_INDETERMINATE;

@vardata word ATTR_PREF_VALUE_ROUND;
/*
 * Specifies an integer value to which the value will be rounded on
 * init file reads/writes
 */

@protominor AttrPrefValueWrap

@vardata word ATTR_PREF_VALUE_WRAP;

@protoreset

/*
 * If the value is incremented beyond its top value, it will "wrap
 * around" to its bottom value, and vice versa.
 */

    @instance word	PVI_originalValue = 0;

@endc;

/*===========================================================================
 *
 *			  PrefItemGroupClass
 *
 * This GenItemGroup subclass has extended functionality for
 * reading/writing strings to the .INI file -- setting text objects
 * from the selected item's moniker (there is also some functionality
 * in GenItemGroupClass to do this, but it was not there when this
 * class was first written), etc.
 *
 * INHERITANCE:
 *
 * MSG_META_LOAD_OPTIONS - calls superclass, saves original state for RESET
 *			  mechanism, sends out status message.
 *
 * MSG_GEN_LOAD/SAVE_OPTIONS - can be configured to use item monikers or
 *			      optional additional strings to load/save options.
 *			      See PrefInitFileFlags for more info.
 *
 * MSG_GEN_APPLY - will update the text object specified in
 *		  ATTR_PREF_ITEM_GROUP_TEXT_DISPLAY, if any.
 *
 * MSG_GEN_RESET - will reset settings to original values, and also
 *		  update the text display
 *
 *===========================================================================*/

@class PrefItemGroupClass, PrefClass;
    @default Pref = GenItemGroupClass;

/*--------------------------------------------------------------------------
 *		MESSAGES
 *--------------------------------------------------------------------------*/

@message void MSG_PREF_ITEM_GROUP_SET_ORIGINAL_SELECTION (word selection=cx);
/*
 * Set the "originalSelection" field of the item group.  Also, sends
 * MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION to superclass.
 *
 *
 * Context:	usually sent from app during startup of pref module
 * Source:	anywhere
 * Destination:  an EXCLUSIVE prefItemGroup
 * Interception: not likely
 */

@message word MSG_PREF_ITEM_GROUP_GET_SELECTED_ITEM_TEXT (char *buffer=cx:dx,
                             word bufSize=bp) = bp;
/*
 * Return the text in the moniker of the selected item. Value returned is the
 * number of characters in the string. If nothing selected, value returned is 0
 */

@message word MSG_PREF_ITEM_GROUP_GET_ITEM_MONIKER(@stack TCHAR *buffer,
                           word bufSize,
                           word identifier) = bp;
/*
 * Get the text in the moniker of one of the items of a PrefItemGroup.  Works
 * for dynamic list subclasses as well. Returns number of characters in the
 * returned text.
 */

@message void MSG_PREF_ITEM_GROUP_UPDATE_TEXT (ChunkHandle textObject=cx);
/* Update the specified text object with text of the currently selected
 * item.   The PrefItemGroup sends this to itself in conjunction with
 * either  ATTR_PREF_ITEM_GROUP_TEXT_DISPLAY or
 * ATTR_PREF_ITEM_GROUP_STATUS_TEXT.   By default, this message will
 * also cause the text object to send out its status message.
 *
 * Source:	    self
 * Destination:     self
 * Interception:    default behavior is to fetch the moniker of the
 * 		    current selection, and sent that to the text.
 * 		    Subclasser can use different text, if desired
 */

#define PREF_ITEM_GROUP_STRING_BUFFER_SIZE 	256
#define PREF_ITEM_GROUP_MAX_SELECTIONS  	    	16

typedef struct {
    TCHAR _near	*PIGSV_endPtr;
    word	    	PIGSV_selections[PREF_ITEM_GROUP_MAX_SELECTIONS];
    word 	    	PIGSV_numSelections;
    TCHAR	    	PIGSV_buffer[PREF_ITEM_GROUP_STRING_BUFFER_SIZE];
} PrefItemGroupStringVars} ;

/*----------------------------------------------------------------------------
 *		INSTANCE DATA
 *----------------------------------------------------------------------------*/

    @instance PrefInitFileFlags	PIGI_initFileFlags = 0;
    @instance word	PIGI_originalSelection = 0;
    @instance word PIGI_originalNumSelections = 0;
    @instance byte PIGI_suspendCount = 0;

/*---------------------------------------------------------------------------
 *		VARDATA
 *---------------------------------------------------------------------------*/

    @vardata PrefEnableData	ATTR_PREF_ITEM_GROUP_ENABLE;
    /* allows setting up an object to be enabled/disabled when
     * settings are made in the item group */

    @vardata word	ATTR_PREF_ITEM_GROUP_OVERRIDE;
    /* This attribute is used to specify an item which will act
     * as an OVERRIDE for all other items (in a non-exclusive
     * item group).
     *
     * When the specified item is SELECTED, then all other items
     * are DE-SELECTED.
     *
     * When any other item is SELECTED, the override item is
     * DE-SELECTED.
     *
     * If all items are DE-SELECTED, the override item becomes SELECTED */

    @vardata ChunkHandle ATTR_PREF_ITEM_GROUP_TEXT_DISPLAY;
    /* chunk handle of a GenText object that will be updated
     * with the moniker of the currently selected item on APPLY /
     * RESET.  */

    @vardata ChunkHandle ATTR_PREF_ITEM_GROUP_STATUS_TEXT;
    /* chunk handle of a GenText object that will be updated every
     * time this object receives a
     * MSG_GEN_ITEM_GROUP_SEND_STATUS_MSG.   */

    @vardata TCHAR[] ATTR_PREF_ITEM_GROUP_EXTRA_STRING_SECTION;
    /* If a string is given -- the string will always be written
     * out as the FIRST string section for the .INI file key.  For
     * example, the "Memory" item group uses this to always insert
     * "disk.geo" whenever writing out the memory types.  Note:
     * this item is only written if the item group has either the
     * PIFF_USE_ITEM_MONIKERS or PIFF_USE_ITEM_STRINGS set. */

@endc;

/*============================================================================
 *
 *			 PrefStringItemClass
 *
 * This GenItem subclass is used with PrefItemGroup, if the
 * "useItemStrings" flag is set.  Each item has a string that will be
 * written/read to the .INI file.  Note that if
 * PIFF_USE_ITEM_MONIKERS is used instead, then normal GenItem objects
 * can be used.
 *
 *============================================================================*/
@class PrefStringItemClass, GenItemClass;

/*---------------------------------------------------------------------------
 *	MESSAGES
 *---------------------------------------------------------------------------*/

@message void MSG_PREF_STRING_ITEM_SET_INIT_FILE_STRING (const char *str=cx:dx);
/*
 * Set the string that's read/written to the init file.
 *
 * Context:
 * Source:	    anywhere
 * Destination:     any StringItemClass object
 * Interception:    unlikely but possible.  Default behavior sets the
 *		    string and then checks again with the .INI file to make
 *		    sure item should be selected.
 */

@message Boolean MSG_PREF_STRING_ITEM_CHECK_IF_IN_INIT_FILE_KEY (PrefItemGroupStringVars *vars = ss:bp) = carry;
/*
 * Check the passed string to see if the string bound to this item is in one of
 * its pieces.
 *
 * Context:	    Sent by PrefItemGroup with PIFF_USE_ITEM_STRINGS set when it
 *		    is loading options.
 * Source:	    PrefItemGroup
 * Destination:	    PrefStringItem
 * Interception:    May be intercepted if the subclass needs to check other
 *		    things to decide whether it should be selected. If you wish
 *		    to also have the default behaviour, you may call the
 *		    superclass either before or after you've made your own
 *		    decision, as appropriate.
 *
 * Return:	TRUE if bound string is within the string stored in the local
 *		variable.
 */
    @instance ChunkHandle PSII_initFileString = 0;

@endc;

/*============================================================================
 *
 *			PrefBooleanGroupClass
 *
 *============================================================================*/

@class PrefBooleanGroupClass, PrefClass;
    @default Pref = GenBooleanGroupClass;

/*---------------------------------------------------------------------------
 *	MESSAGES
 *---------------------------------------------------------------------------*/

@message void MSG_PREF_BOOLEAN_GROUP_SET_ORIGINAL_STATE (word state = cx);
/*
 * Set the original state of the boolean group.
 *
 * Context:
 * Source:
 * Destination:
 * Interception:
 */

    @instance PrefInitFileFlags	PBGI_initFileFlags = 0;
    @instance word	PBGI_originalState = 0;

@endc;

/*============================================================================
 *
 *			 PrefDynamicListClass
 *
 *============================================================================*/
@class PrefDynamicListClass, PrefItemGroupClass;
    @default Pref = GenDynamicListClass;

/*---------------------------------------------------------------------------
 *	MESSAGES
 *---------------------------------------------------------------------------*/
@message void MSG_PREF_DYNAMIC_LIST_BUILD_ARRAY ();
/*
 * Context:	The PrefDynamicList sends itself this message when it
 * 		receives MSG_INIT (normally sent when the dialog is
 *		initiated)
 * Source:	PrefDynamicListClass
 * Destination:  SUBCLASS of PrefDynamicListClass
 * Interception: The subclasser should create an array of item strings
 * 		-- sorted, ideally.
 */

@message Boolean MSG_PREF_DYNAMIC_LIST_FIND_ITEM (word *itemPtr = multipleax,
                         const char *str = cx:dx,
                         Boolean ignoreCase = bp) = carry;
/*
 * Find an item given a (possible) item moniker.
 *
 * Context:	Part of LOAD OPTIONS mechanism
 * Source:	PrefDynamicList sends this to itself when loading
 * 		options.
 * Destination:  Any PrefDynamicList subclass
 * Interception: There is NO default behavior -- subclasser MUST handle
 * 		this. See PrefDeviceListClass and
 * 		PrefNetQListClass for examples of how this is handled.
 *
 * Return:	TRUE if found, *itemPtr = item #
 *	    	FALSE if not found, *itemPtr = first item after requested item
 *	    	    (lexicographically speaking)
 *			carry clear
 */

@message void MSG_PREF_DYNAMIC_LIST_TIMER ();	/* private */
/*
 * INTERNAL -- the pref dynamic list sends this message to itself
 * a few seconds after a key is pressed to flush the keyboard buffer.
 */

/*---------------------------------------------------------------------------
 *	VARDATA
 *---------------------------------------------------------------------------*/

#define PDL_CHAR_BUFFER_SIZE  	32
#define PDL_CHAR_MAX_COUNT   	(PDL_CHAR_BUFFER_SIZE -1)

typedef	struct {
    char	PDLKD_buffer[PDL_CHAR_BUFFER_SIZE];
    word	PDLKD_count; 	    /* # chars in buffer */

    word	PDLKD_timerHandle;
    word	PDLKD_timerID;
} PDLKbdData} ;

    @vardata PDLKbdData TEMP_PDL_KBD_DATA;

@endc;

/*============================================================================
 *
 *			   PrefIniDynamicListClass
 *
 *============================================================================*/

@class PrefIniDynamicListClass, PrefDynamicListClass;

    @instance optr	PIDLI_array = 0;

    @vardata TCHAR[] ATTR_PREF_INI_INIT_FILE_LIST_CATEGORY;
    @vardata TCHAR[] ATTR_PREF_INI_INIT_FILE_LIST_KEY;

@endc

/*============================================================================
 *
 *			   PrefTocListClass
 *
 *============================================================================*/

@class PrefTocListClass, PrefDynamicListClass;

@message Boolean MSG_PREF_TOC_LIST_GET_SELECTED_ITEM_INFO (word *infoPtr = multipleax) = carry;
/*
 * Return the info word about the currently selected item.  This
 * message can only be used with PrefTocLists that have the
 * TCF_EXTENDED_DEVICE_DRIVERS FLAG set.
 *
 * Return:	FALSE if found, *infoPtr = info
 */

@message word MSG_PREF_TOC_LIST_GET_SELECTED_DRIVER_NAME (char *buf = cx:dx,
                             word bufSize = bp) = bp;
/*
 * Return the name of the driver for the selected device.  Can only be
 * called if TCF_EXTENDED_DEVICE_DRIVERS is set.
 *
 * Return:	returns # of chars returned if buffer big enough, else 0
 */

typedef struct {
    word	TIP_disk;	/* disk handle */
    MemHandle	TIP_pathBlock;	/* Handle of block holding path (locked) */
    char	*TIP_path;	/* Locked null-terminated absolute path */
} TocItemPath} ;

@message void
    MSG_PREF_TOC_LIST_GET_SELECTED_ITEM_PATH    (TocItemPath *retValue = bpaxdxcx);

/* Get the absolute path of the selected item.
 *
 * Pass:	pointer to TocItemPath
 * Return:	TocItemPath filled in
 */

@message Boolean MSG_PREF_TOC_LIST_CHECK_DEVICE_AVAILABLE (word *retvalPtr = multipleax) = carry;
/*
 * Determine if the device selected by the list is available in the
 * machine.  May only be called for PrefTocLists that have the
 * TCF_EXTENDED_DEVICE_DRIVERS flag set.
 *

 * Return: TRUE if device is available. If driver is a video driver,
 * 	   *retvalPtr is set to the device's DisplayType.  FALSE if
 *         device isn't available. *retvalPtr is 0 if the device
 *         doesn't exist, or GeodeLoadError+1 if driver couldn't be
 *         loaded.
 */

@message void MSG_PREF_TOC_LIST_SET_TOKEN_CHARS (TokenChars *chars = ss:bp);

/*---------------------------------------------------------------------------
 *	INSTANCE DATA
 *---------------------------------------------------------------------------*/
    @instance TocUpdateCategoryFlags	PTLI_flags = 0;
    @instance TocCategoryStruct	PTLI_tocInfo = {"", 0, 0};

/*---------------------------------------------------------------------------
 *	VARIABLE DATA
 *---------------------------------------------------------------------------*/
typedef struct {
    ChunkHandle PTEE_item;
    /* lptr of item name.  For device lists, this is the device.
     * For others, this is the filename */

    ChunkHandle PTEE_driver;
    /* Driver name (for device lists ONLY) */

    word	PTEE_info;
    /* Extra word of information */
} PrefTocExtraEntry} ;

@vardata PrefTocExtraEntry	ATTR_PREF_TOC_LIST_EXTRA_ENTRY_1;

@vardata PrefTocExtraEntry	ATTR_PREF_TOC_LIST_EXTRA_ENTRY_2 ;

@vardata char ATTR_PREF_TOC_LIST_INFO_KEY[];
/* This key is used to write the "info" word for device lists */

@vardata optr ATTR_PREF_TOC_LIST_CONTAINER;
/* PrefContainer object to which we should send the absolute path of the
 * preferences VM file/library associated with the current selection when
 * the selection changes. The file selected is the one whose FEA_NOTICE
 * extended attribute is the same as the longname of the selected
 * driver/library, after removing any "EC " prefix Glue might have prepended to
 * the name originally specified by the programmer. */

@endc;

/*============================================================================
 *
 *			   TitledGlyphClass
 *
 *============================================================================*/

@class TitledGlyphClass, GenGlyphClass;
@endc;

/*============================================================================
 *
 *			 PrefInteractionClass
 *
 * INHERITANCE:
 *
 * MSG_META_LOAD/SAVE_OPTIONS - Sends these messages to each child that matches
 *			       the criteria based on its PrefAttrs record.
 *
 *============================================================================*/
@class PrefInteractionClass, PrefClass;
    @default Pref = GenInteractionClass;

typedef ByteFlags PrefInteractionAttrs ;
#define	PIA_LOAD_OPTIONS_ON_INITIATE		0x80
    /* If set, then the dialog will send MSG_PREF_INIT, followed by
     * MSG_META_LOAD_OPTIONS to itself when it receives a
     * MSG_GEN_INTERACTION_INITIATE */

#define PIA_SAVE_OPTIONS_ON_APPLY    	0x40
    /* This flag is normally OFF, to allow non-dialog
     * prefInteraction objects to reside inside other interactions
     * without duplicate SAVE_OPTIONS messages being sent. */
#define PIA_COMPLETE_INTERACTION_ON_APPLY    	0x20

/*---------------------------------------------------------------------------
 *	INSTANCE DATA
 *---------------------------------------------------------------------------*/

    @instance PrefInteractionAttrs	PII_attrs = 0;

@endc;

/*============================================================================
 *
 *			  PrefContainerClass
 *
 * An interaction that manages a read-only VM file or sub-library containing
 * other Pref objects, usually used to specify preferences for device drivers
 * or similar things that one doesn't wish to have dependent on the config
 * library.
 *
 * INHERITANCE:
 *
 * MSG_GEN_PATH_SET - Treats final component of path as file name, which it
 *		     strips off before passing it to its superclass. This is
 *		     how you tell it what file it should open.
 *
 *============================================================================*/

#define PREFVM_DOC_PROTO_MAJOR 	2	/* Protocol number for an acceptable */
#define PREFVM_DOC_PROTO_MINOR 	0	/*  VM file (must be outside library
                     *  segment so it can be used */

@class PrefContainerClass, PrefInteractionClass;
    @default Pref = GenInteractionClass;

@message void MSG_PC_CLOSE_HANDLE (word fileOrLibHandle=cx,
                  Boolean isLibrary = dx);
/* Close the VM file or unload the library containing the tree we were
 * managing.
 *
 * Context:	Sent by PrefContainer to itself using
 *		MSG_META_FLUSH_INPUT_QUEUES after having sent a
 *		MSG_META_BLOCK_FREE, if appropriate, to the tree it's
 *		been holding.
 * Source:	PrefContainerClass
 * Destination:	PrefContainerClass
 * Intercept:	Not intercepted.
 *
 */

typedef	struct {		/* Map block for a VM file this object can
                 *  handle. */
    dword	PVMMB_root;		/* Root of the object tree contained in
                     *  the VM file. Segment portion is VM
                     *  block handle */
} PrefVMMapBlock} ;

#define PREFVM_ATTRIBUTES 	VMA_OBJECT_ATTRS or mask VMA_SYNC_UPDATE
                    /* VMAttributes such a file must have.*/

    @instance word PCI_handle = 0;		/* Handle of open VM file, or
                         *  handle of library */
    @instance FileLongName PCI_fileName = _TEXT("");	/* Name of open file. */
    @instance ChunkHandle  PCI_templateMon = 0;	/* Template to use when
                         *  constructing our moniker.
                         *  \1 is replaced by the name
                         *  of the file whose objects
                         *  are being displayed. If 0,
                         *  no moniker is created. */
    @instance dword 	   PCI_dupRoot = 0; 	/* Root of duplicated tree. If
                         *  handle is 0, PCI_handle is
                         *  a VM file. */
    @default GI_states = @default & ~GS_USABLE;
@endc;

/*============================================================================
 *
 *			   PrefDialogClass
 *
 * INHERITANCE:
 *
 * MSG_GEN_APPLY:
 *	Normally sends a MSG_META_SAVE_OPTIONS to all children.  If
 *	any of the children have their PA_REBOOT_IF_CHANGED flag set,
 *	then the dialog will determine if any children have changed
 *	state, and if so, will put up a reboot confirmation dialog
 *	box, before continuing.  Returns carry SET if apply aborted.
 *
 *
 *============================================================================*/

@class PrefDialogClass, PrefInteractionClass;
    @default Pref = GenInteractionClass;

@message void MSG_PREF_DIALOG_REBOOT ();
/* Cause PC/GEOS to restart (doesn't return) */

@message Boolean MSG_PREF_DIALOG_CONFIRM_REBOOT (optr string = cx:dx) = carry;
/* Put up a yes/no dialog box asking user if s/he wants to restart the
 *  system to effect the change.
 *
 * Pass:	string - optr of string which will be inserted in a
 *			 sentence of the form "The system software will
 *			 shut down and restart to change the XXX.
 *			 Do you wish to proceed?'
 * Return:	Boolean
 */

@message void MSG_PREF_DIALOG_RESTART_ACK (word restart=cx);
/* Internal message - sent by the kernel to the dialog object to
 * confirm that now is a good time to shutdown / restart.
 */

/*
 * GCN lists to which kids can add themselves. (step by 2)
 */
typedef enum {
    PDGCNLT_DIALOG_CHANGE    =(int)_FIRST_PrefDialogClass,
    /* MSG_PREF_NOTIFY_DIALOG_CHANGE sent out. */
} GeoWorksPrefDialogGCNListType} ;

    @default GII_visibility = GIV_DIALOG;
    @default GII_type = GIT_PROPERTIES;
    @default GII_attrs = @default | GIA_NOT_USER_INITIATABLE |
        GIA_MODAL;
    @default PII_attrs = @default | PIA_SAVE_OPTIONS_ON_APPLY;

/*
 * VARDATA
 */

@vardata word ATTR_PREF_DIALOG_SYS_SHUTDOWN_TYPE;

@endc;

/*============================================================================
 *
 *			    PrefTextClass
 *
 * INHERITANCE:
 *
 * MSG_META_LOAD_OPTIONS - saves text as originalText
 *
 * MSG_GEN_RESET - copies originalText string to current string
 *
 * MSG_PREF_HAS_STATE_CHANGED - compares originalText string to current
 *	string.
 *
 *============================================================================*/

@class PrefTextClass, PrefClass;
    @default Pref = GenTextClass;

/*---------------------------------------------------------------------------
 *	INSTANCE DATA
 *---------------------------------------------------------------------------*/

    @instance ChunkHandle PTI_originalText = 0;
    /* Text value immediately after LOAD_OPTIONS */

/*---------------------------------------------------------------------------
 *	VARDATA
 *---------------------------------------------------------------------------*/

@vardata ChunkHandle ATTR_PREF_TEXT_INIT_FILE_CATEGORY_TARGET;
/* PrefTextClass has the wonderful ability that it can set another
 * object's init file category from its text.  Category gets updated
 * whenever the text object receives MSG_GEN_TEXT_SEND_STATUS_MSG */

@endc;

/*===========================================================================
 *	PrefTriggerClass.  This is not a "pref" class - it's just a
 *	normal old GenTrigger with the added functionality that
 *	additional messages can be sent out.
 *===========================================================================*/

@class PrefTriggerClass, GenTriggerClass;
/*---------------------------------------------------------------------------
 *	VARDATA
 *---------------------------------------------------------------------------*/
typedef	struct {
    word	PTA_message;
    optr	PTA_dest;
} PrefTriggerAction} ;

@vardata PrefTriggerAction	ATTR_PREF_TRIGGER_ACTION;
/* Specifies an additional action to be performed.  There may be more
 * than one of these -- they'll be processed in order. */
    @reloc ATTR_PREF_TRIGGER_ACTION, PTA_dest, optr;

@endc;

/*===========================================================================
    PrefControlClass
 *===========================================================================*/
@class PrefControlClass, PrefInteractionClass;
    @default Pref = GenControlClass;
@endc;

/*===========================================================================
    PrefTimeDateControlClass
 *===========================================================================*/
@class PrefTimeDateControlClass, PrefControlClass;
    @default Pref = GenControlClass;

/* Internal messages */
@message void MSG_PTDC_TIMER_TICK ();
@message void MSG_PTDC_MONTH_CHANGE ();
@message void MSG_PTDC_YEAR_CHANGE ();
@message void MSG_PTDC_SET_TIME ();
@message void MSG_PTDC_SET_DATE ();

@instance dword    	PTDCI_timer;
@instance byte 		PTDCI_maxDays;
@instance byte 		PTDCI_month;
@instance word 		PTDCI_year;

@endc;

/*===========================================================================
    PrefTimeDateControlClass
 *===========================================================================*/
@class PrefPortItemClass, PrefClass;
    @default Pref = PrefStringItemClass;

@message word MSG_PREF_PORT_ITEM_GET_STATUS ();

/* Internal messages */
@message void MSG_PREF_PORT_ITEM_FREE_DRIVER ();

/* Instance data */

typedef enum {
    PPIT_SERIAL_MOUSE    ,
    PPIT_SERIAL    ,
    PPIT_PARALLEL
} PrefPortItemType} ;

@instance word	PPII_portMask;
@instance byte	PPII_type;
@instance byte  PPII_status;

@endc;

/*---------------------------------------------------------------------------
 *	EXPORTED ROUTINES
 *---------------------------------------------------------------------------*/

extern void _pascal ConfigBuildTitledMoniker (optr monikerList);
extern ChunkHandle
    _pascal ConfigBuildTitledMonikerUsingToken (GeodeToken *token,
                           MemHandle destBlock);

/* Video routines should probably be moved to a "Video" module, if
 * anyone ever creates one. */

extern void
    _pascal PrefSaveVideo (void);
extern void
    _pascal PrefRestoreVideo (void);
extern void
    _pascal PrefDiscardSavedVideo (void);

extern word
    _pascal TocSortedNameArrayAdd (word arr, const char *nameToAdd,
                   NameArrayAddFlags flags,
                   const void *data);

typedef WordFlags SortedNameArrayFindFlags ;
#define SNAFF_IGNORE_CASE    0x0080

extern Boolean
    _pascal TocSortedNameArrayFind (word arr, const char *nameToFind,
                SortedNameArrayFindFlags flags,
                void *buffer, word *elementNum);

extern Boolean
    _pascal TocFindCategory (TocCategoryStruct *cat);
extern word
    _pascal TocNameArrayFind (DBGroupAndItem array, const char *name,
                 void *buffer);
extern word
    _pascal TocNameArrayGetElement (DBGroupAndItem array, word element,
                   void *buffer);
extern void
    _pascal TocUpdateCategory (TocUpdateCategoryParams *params);
extern word
    _pascal TocNameArrayAdd (DBGroupAndItem array, const char *nameToFind,
                const void *data);
extern void *
    _pascal TocDBLock (DBGroupAndItem thing);
extern void *
    _pascal TocDBLockGetRef (DBGroupAndItem thing, optr *refPtr);

extern word
    _pascal TocAddDisk (const char *diskName, const TocDiskStruct *diskDesc);
extern Boolean
    _pascal TocCreateNewFile (void);

extern word
    _pascal TocGetFileHandle ();

#ifdef __HIGHC__
pragma Alias(ConfigBuildTitledMoniker, "CONFIGBUILDTITLEDMONIKER");
pragma Alias(ConfigBuildTitledMonikerUsingToken, "CONFIGBUILDTITLEDMONIKERUSINGTOKEN");
pragma Alias(PrefSaveVideo, "PREFSAVEVIDEO");
pragma Alias(PrefRestoreVideo, "PREFRESTOREVIDEO");
pragma Alias(PrefDiscardSavedVideo, "PREFDISCARDSAVEDVIDEO");
pragma Alias(TocSortedNameArrayAdd, "TOCSORTEDNAMEARRAYADD");
pragma Alias(TocSortedNameArrayFind, "TOCSORTEDNAMEARRAYFIND");
pragma Alias(TocFindCategory, "TOCFINDCATEGORY");
pragma Alias(TocNameArrayFind, "TOCNAMEARRAYFIND");
pragma Alias(TocNameArrayGetElement, "TOCNAMEARRAYGETELEMENT");
pragma Alias(TocUpdateCategory, "TOCUPDATECATEGORY");
pragma Alias(TocNameArrayAdd, "TOCNAMEARRAYADD");
pragma Alias(TocDBLock, "TOCDBLOCK");
pragma Alias(TocDBLockGetRef, "TOCDBLOCKGETREF");
pragma Alias(TocAddDisk, "TOCADDDISK");
pragma Alias(TocCreateNewFile, "TOCCREATENEWFILE");
pragma Alias(TocGetFileHandle, "TOCGETFILEHANDLE");

#endif

@endlib


connect.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1995 -- All Rights Reserved

PROJECT:	PC GEOS
MODULE:		Connect Library
FILE:		connect.goh

AUTHOR:		Thomas Lester, Mar 31, 1995

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    lester	3/31/95   	Initial version.

DESCRIPTION:
        Definitions for the Connect Library.
    ** Don't forget to update connect.def correspondingly.

    $Id: connect.goh,v 1.56.1.23 98/07/28 14:40:24 mjoy Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@ifndef __CONNECT_GOH
@define __CONNECT_GOH

@ifdef _CONNECT_INTERNAL
@define PROTOMINOR(token) /* protominor token */
@else
@define PROTOMINOR(token) @protominor token
@endif

@deflib connect

#include  <geos.h>
@include  <pccom.goh>
@include  <foam.goh>
#include  <Internal/ctXlatDr.h> 		/* Connect Translate Driver */
@include  <Internal/ctXferDr.goh> 	/* Connect Transfer Driver */
@include  <Objects/gCtrlC.goh> 		/* include GenControlClass */
#include  <file.h> 			/* string size constants */
#include  <initfile.h>

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
          Constants and Structures
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Desktop Connectivity Library Token Chars
 * These token chars are used in inter-application communication.
 */
#define	CONNECT_LIB_TOKEN		"DTCL"

/*
 * Size of the Drive, Directory Path, and File Path setting strings
 * with null termination.
 * These are defined here so applications know how big to make their
 * buffers.
 */
#define	CONNECT_SETTINGS_DRIVE_LENGTH_ZT		3
           /* 1 char for drive + 1 char for colon + 1 for the NULL */

#define	CONNECT_SETTINGS_PATH_LENGTH_ZT			(3 + DOS_STD_PATH_LENGTH + 1)
           /* 1 char for drive + 1 for colon + 1 for backslash
          + path length + 1 for NULL */

/*
 * Maximum length of a format name string, including null.
 * The format name string is always SBCS so its length = its size.
 */
#define FILE_FORMAT_NAME_SIZE 		CTLD_FORMAT_NAME_SIZE

#define CONNECT_OPEN_CONNECTION_TIME_OUT 	600 /* 10 seconds */

/*
 * The MultiFileArrayHeader and MultiFileArrayEntry structures are used by
 * the messages of ConnectMultiFileClass to form a chunk array of source and
 * destination paths for files to be uploaded or downloaded in a batch.
 */
typedef struct {
    ChunkArrayHeader    MFAH_CAH;
    char		MFAH_synopsis[81];
    dword		MFAH_size;
} MultiFileArrayHeader} ;

typedef struct {
    DiskHandle   MFAE_localDisk;
    byte         MFAE_remotePathOffset;
    char    	 MFAE_localFormat[FILE_FORMAT_NAME_SIZE];
    char    	 MFAE_remoteFormat[FILE_FORMAT_NAME_SIZE];
    char         MFAE_paths[1];
} MultiFileArrayEntry} ;

#define MAX_PRODUCT_ARRAY_ELEMENT_SIZE  ((sizeof(MultiFileArrayEntry)) + \
                    (2 * PATH_BUFFER_SIZE))

/* The PackageDescriptorArrayEntry structure is used by
 * ConnectMultiFileActionClass to form a chunk array of descriptive
 * information for different packages.
 *
 * Likely maximum sizes for package information.
 */
#define MAX_PACKAGE_NAME_LENGTH 	        80
#define MAX_PACKAGE_SYNOPSIS_LENGTH 	80
#define MAX_PACKAGE_SIZE_LENGTH 	        14

#define MAX_PACKAGE_NAME_LENGTH_ZT 	(MAX_PACKAGE_NAME_LENGTH + 1)
#define MAX_PACKAGE_SYNOPSIS_LENGTH_ZT 	(MAX_PACKAGE_SYNOPSIS_LENGTH + 1)
#define MAX_PACKAGE_SIZE_LENGTH_ZT       (MAX_PACKAGE_SIZE_LENGTH + 1)
#define MAX_PACKAGE_INFO_LENGTH 	        (MAX_PACKAGE_NAME_LENGTH_ZT + \
                     MAX_PACKAGE_SYNOPSIS_LENGTH_ZT + \
                     MAX_PACKAGE_SIZE_LENGTH_ZT)

typedef struct {
    byte    PDAE_synopsisOffset;
    byte    PDAE_sizeOffset;
    byte    PDAE_packageFilePathOffset;
    char    PDAE_data[1];  /* for: package name '/0'
                *	   package synopsis '/0'
                *	   package size '/0'
                *	   server absolute path to package file '/0'
                */
} PackageDescriptorArrayEntry} ;

/*
 * Passed to ConnectGetPackageDescriptorData routine to indicate what information
 * to return.
 */
typedef enum {
    PDDT_NAME    ,               /* package name */
    PDDT_SYNOPSIS    ,           /* package synopsis */
    PDDT_SIZE    ,               /* package size */
    PDDT_PATH                    /* path to package's package file */
} PackageDescriptorDataType} ;

typedef struct {
    dword		PPAE_unused;
    StandardPath	PPAE_standardPath;
    char		PPAE_filePath[1]; /* for: local path to file '/0' */
} PackageProgressArrayEntry} ;

/*
 * State variables for the process of forcing a geode to quit.
 */
typedef struct {
    Boolean     CQGS_isApp;
      /* TRUE - if CONNECT_FORCE_GEODE is quitting an application geode. */

    optr        CQGS_geodesArray;
      /* The chunk array of app-geode handles to force to quit. */

    word        CQGS_arrayIndex;
      /* Current app (index into the gAppGeodesArray) to quit. */

    word        CQGS_numApps;
      /* The number of running applications. */

    TCHAR       CQGS_geodeName[GEODE_NAME_SIZE+GEODE_NAME_EXT_SIZE+1];
      /* Permanent name of the geode and ext and null-terminator */

    GeodeHandle CQGS_geode;
      /* Geode to quit. */

    word        CQGS_appCompletionMsg;
      /* Message to send when the geode finally quits. */

    optr        CQGS_appCompletionOptr;
      /* Object to receive the completion message. */

    word        CQGS_libCompletionMsg;
      /* Message to send when the library geode finally quits. */

    optr        CQGS_libCompletionOptr;
      /* Object to receive the library completion message. */

    GeodeHandle CQGS_excluded;
      /* Don't remove this app, when removing the library. */
} ConnectQuitGeodeState} ;

/*
 * Magic structure whose address you must pass to
 * ConnectDisableAppLaunchKeys().  Must agree with structure
 * definition in connect.def.
 */
typedef struct {
    byte	CDALKM_monitor[18];
      /* You don't want to know what's in here (it's only defined in
     assembly.)  18 is the size of struct Monitor in im.def. */

    optr	CDALKM_notifyOptr;
      /* Object to notify when if user hits a launch key while it's
     prohibited to do so (i.e. this should probably bring up a
     dialog telling them what's up). */

    Message	CDALKM_notifyMsg;
      /* Message to send to above object.  MUST NOT EXPECT ANY
     ARGUMENTS. */

} ConnectDisableAppLaunchKeysMonitor} ;

/*
 * These strings are passed to MSG_CONNECT_GET/SEND_FILE to
 * specify source and destination file formats.
 */
#define FAX_FORMAT               "fax"
#define TIFF_FORMAT              "tiff"
#define NOTES_FORMAT             "notes"
#define ASCII_FORMAT             "ascii"

/*
 * The temporary lock file used to ensure the Memory Card is kept in
 * when we have an open connection
 */
#define CONNECT_MEMORY_CARD_LOCK_FILE 	"A:\\CONNECT.LCK"

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        .INI File Categories and Keys
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#define	CONNECT_INI_MAIN_CATEGORY		"connect"

#define	CONNECT_INI_SERIAL_PORT_KEY		"serialPort"
#define	CONNECT_INI_SERIAL_BAUD_KEY		"serialBaud"
#define	CONNECT_INI_INFRARED_PORT_KEY		"infraredPort"
#define	CONNECT_INI_INFRARED_BAUD_KEY		"infraredBaud"
#define CONNECT_INI_SOCKET_PORT_KEY 	"socketPort"

/*
 * The ConnectSettingsControl object sends itself a
 * MSG_META_GET_INI_CATEGORY to get the ini category to use when
 * saving and reading the settings from the init file.
 *
 * So, each app using a ConnectSettingsControlClass object should
 * have a
 *     ATTR_GEN_INIT_FILE_CATEGORY = "someCategoryNameString";
 * in its application object to specify the category string
 * to use when saving and reading the settings.
 */
#define	CONNECT_INI_CONNECTION_TYPE_KEY	 "connectionTypeSetting"
#define	CONNECT_INI_DATA_GROUP_KEY		"dataGroupSetting"
#define	CONNECT_INI_DRIVE_KEY			"driveSetting"
#define	CONNECT_INI_DIRECTORY_PATH_KEY		"directoryPathSetting"
#define	CONNECT_INI_FILE_PATH_KEY		"filePathSetting"
#define CONNECT_INI_DESTINATION_TYPE_KEY  "destinationTypeSetting"

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
          Type defs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifdef DO_DBCS
typedef TCHAR PathAndFileName [(PATH_BUFFER_SIZE+FILE_LONGNAME_BUFFER_SIZE)/2];
#else
typedef char PathAndFileName [PATH_BUFFER_SIZE+FILE_LONGNAME_BUFFER_SIZE];
#endif

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
          Enumerated types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*
 * Connection Types
 */
typedef enum {
    CT_SERIAL    ,
    CT_INFRARED    ,
    CT_MEMORYCARD    ,
    CT_SOCKET
} ConnectionType} ;

/*
 * Data Groups
 */
typedef enum {
    DG_CONTACTS    ,
    DG_DOCUMENTS    ,
    DG_ALL_DATA    ,
    DG_CALENDAR    ,
} DataGroup} ;

/*
 * Destination Type
 */
typedef enum {
    DT_COMMUNICATOR     = 0x0,
    DT_MEMORYCARD    ,
} DestinationType} ;
/*
 * DOSFileCopy return types
 */
typedef enum {
    MMCRT_FILE_STARTING    ,
    MMCRT_TRANSFER_CONTINUES    ,
    MMCRT_TRANSFER_COMPLETE    ,
    MMCRT_TRANSFER_ABORTED
} MMCReturnType} ;

/*
 * Connect Errors
 *
 * NOTE: If you add/remove/change any of the ConnectError enums, be sure
 *	 to make the same change to connect.def.
 */
#define	CE_DIALOG_DISPLAYED		0x8000
/*
 * If this bit is set in a ConnectError and the ConnectError has been
 * returned by the completion message for one of the messages listed
 * below, it means that the connect library has already displayed an
 * error dialog for the error. This is useful when the caller wants to
 * know if it should display an error dialog itself.
 *
 * The following messages display error dialogs for ConnectErrors with
 * the CE_DIALOG_DISPLAYED bit set:
 *	MSG_CONNECT_GET_FILE, MSG_CONNECT_SEND_FILE
 *	MSG_CMF_GET_FILE_ARRAY, MSG_CMF_SEND_FILE_ARRAY
 *	MSG_CMFA_LIST_PACKAGES
 *	MSG_CMFA_GET_PACKAGE
 *	MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE
 */
typedef enum {
    CE_SUCCESS     = 0x0,
    CE_NOT_ENOUGH_MEMORY    ,
    /* There was not enough memory to perform the operation. */

    CE_MISC_FILE_ERROR    ,
    /* Some file error occurred. */

    CE_NOT_ENOUGH_DISK_SPACE_TO_START    ,
    /* There was not enough disk space to start the operation. */

    CE_NOT_ENOUGH_DISK_SPACE_TO_COMPLETE    ,
    /* There was not enough disk space to complete the operation,
       which may have started. */

    CE_OPERATION_FAILED    ,
    /* The operation failed for some reason.
       The library does NOT put up a dialog for this error. */

    CE_USER_CANCELED    ,
    /* The user canceled the operation. */

    CE_FILE_TRANSFER_OPERATION_ALREADY_IN_PROGRESS    ,

    CE_DEST_DIRECTORY_DOES_NOT_EXIST    ,
    /* Tried to put file in directory but the directory did not exist. */

    /*
     * errors for ConnectSetServerPath
     */
    CE_CANNOT_SET_SERVER_PATH    ,
    /* Returned by ConnectSetServerPath if it was unable to set the path
       on the server.
       The library does NOT put up a dialog for this error. */

    /*
     * errors for ConnectGetServerPath
     */
    CE_CANNOT_GET_SERVER_PATH    ,
    /* Returned by ConnectGetServerPath if it was unable to get the path
       from the server.
       The library does NOT put up a dialog for this error. */

    /*
     * errors for MSG_CONNECT_OPEN_CONNECTION
     */
    CE_CONNECTION_MEDIUM_IN_USE    ,
    /* There is some other app using the connection medium.
       The user should have the other app quit using the connection
       medium and try opening the connection again. */

    CE_CANNOT_START_CLIENT_SIDE_CONNECTION    ,
    /* Unable to start the client side part of the connection. */

    CE_CANNOT_CONTACT_SERVER    ,
    /* Unable to contact the server part of the connection.
       The user should check that the server software is running. */

    /*
     * errors for MSG_CONNECT_CLOSE_CONNECTION
     */
    CE_CANNOT_CLOSE_CONNECTION    ,
    /* The connection was opened by a different application than the one
       trying to close the connection.
       This would only happen if ConnectCloseConnection is called after
       ConnectOpenConnection has failed, which would be undesirable. */

    CE_NO_PACKAGES_FOUND    ,
    /* No packages could be found and listed. */

    CE_PACKAGE_FILE_INVALID    ,
    /* Returned by MSG_CMFA_GET_PACKAGE or
       MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE.
       The library does NOT put up a dialog for this error.
       The package file for the chosen package is invalid. */

    CE_PACKAGE_INSTALLED_BUT_MUST_REBOOT_TO_USE    ,
    /* The package has been installed, almost.  The user must reboot the
       device to finish installation.  (Rebooting will overwrite some
       geodes that were in use at install time with newer versions. */

    CE_FILE_PROTOCOL_TOO_LOW    ,
    /* Internal ConnectError used by the get-package mechanism.
       The new file has a lower protocol than the preexisting file
       it would replace. */

    CE_UNABLE_TO_LOAD_TRANSFER_DRIVER    ,
    /* Returned if unable to load the transfer driver set via
       MSG_CONNECT_SET_TRANSFER_DRIVER. */

    CE_FILE_OPEN_BY_ANOTHER_APP    ,
    /* Another application has this local file opened. */

    /*******************************************************************
     * The following connect errors are mapped from the PCCom library.
     *******************************************************************/
    CE_FILE_NOT_FOUND    ,
    /* PCCom cannot locate specified file.  Check filename spelling? */

    CE_PATH_NAME_INVALID    ,
    /* PCCom doesn't like the pathname.  Check for invalid characters
       and formatting. */

    CE_ACCESS_DENIED    ,
    /* PCCom couldn't modify the file and no details are given. */

    CE_FILE_NAME_INVALID    ,
    /* PCCom doesn't like the filename.  Check for invalid characters
       and formatting. */

    CE_VOLUME_UNAVAILABLE    ,
    /* PCCom can't access the volume medium; eg. disk drive doesn't
       have a disk in it. */

    CE_FILE_READ_ONLY    ,
    /* Target file has read-only status so we can't write to it. */

    CE_SHORT_READ_WRITE    ,
    /* While reading/writing a file, PCCom ran across this problem and
       has no explanation for it. */

    CE_VOLUME_WRITE_PROTECTED    ,
    /* PCCom was unable to modify the medium on the volume so assumes
       that it's write-protected. */
    /*
     * The following reported errors occurred on the REMOTE end.
     * These errors are analogous to the local errors as listed above.
     */
    CE_REMOTE_FILE_NOT_FOUND    ,
    /* PCCom cannot locate specified file.  Check filename spelling? */

    CE_REMOTE_PATH_NAME_INVALID    ,
    /* PCCom doesn't like the pathname.  Check for invalid characters
       and formatting. */

    CE_REMOTE_ACCESS_DENIED    ,
    /* PCCom couldn't modify the file and no details are given. */

    CE_REMOTE_FILE_NAME_INVALID    ,
    /* PCCom doesn't like the filename.  Check for invalid characters
       and formatting. */

    CE_REMOTE_FILE_OPEN_BY_ANOTHER_APP    ,
    /* A remote application has this remote file opened. */

    CE_REMOTE_FILE_READ_ONLY    ,
    /* Target file has read-only status so we can't write to it. */

    CE_REMOTE_SHORT_READ_WRITE    ,
    /* While reading/writing a file, PCCom ran across this problem and
       has no explanation for it. */

    CE_REMOTE_VOLUME_WRITE_PROTECTED    ,
    /* PCCom was unable to modify the medium on the volume so assumes
       that it's write-protected. */

    CE_REMOTE_USER_CANCELED    ,
    /* PCCom received an abort directive that did not originated from
       within the PCCom library. */

/*
 * The following errors are available on Communicator products shipped
 * after April 1997.  (Does not include those errors starting from  ""
 * CE_DIALOG_DISPLAYED.)
 */
    CE_OVERWRITE_CANCELLED    ,
    /* Used to distinguish between user cancelling a single overwrite
     * and a transfer operation which may consist of many files
     * being transferred at once.
     */

/*
 * Start of ConnectErrors for which the main connect library messages
 * display error dialogs. See the CE_DIALOG_DISPLAYED documentation
 * for more details.
 */
    CE_OPERATION_ABORTED     = CE_DIALOG_DISPLAYED,
    /* The operation was aborted for some reason.
       This error is returned when an operation has been started but aborts
       before it's done. The user should check the connection, etc. */

    CE_CANNOT_TRANSLATE_FILE    ,
    /* Some error occured when trying translate the file from one format to
       another. This could be an error trying to load the translation driver
       or an error during the translation. */

    CE_CANNOT_CREATE_DIRECTORY    ,
    /* Tried to create directory but failed.   (Remote or local drive.) */

    CE_CONNECTION_LOST    ,
    /* PCCom has lost connection after retrying many times. Please check
       the physical connection then try again. */

    CE_PATH_NOT_FOUND    ,
    /* PCCom cannot locate the specified path.  Check pathname spelling? */

    CE_DRIVE_INVALID    ,
    /* Target drive doesn't exist. */

    CE_SOURCE_FILE_OPEN_BY_ANOTHER_APP    ,
    /* Returned if the local source file is in use by another app
       and the CTF_NO_TRANSFER_IF_FILE_OPEN ConnectTransferFlags
       was passed. */

    CE_DEST_FILE_OPEN_BY_ANOTHER_APP    ,
    /* Returned if the local destination file is in use by another app
       and the CTF_NO_TRANSFER_IF_FILE_OPEN ConnectTransferFlags
       was passed. */

    CE_REMOTE_OPERATION_ABORTED    ,
    /* PCCom doesn't have a a reason for the abortion on the remote. */

    CE_REMOTE_PATH_NOT_FOUND    ,
    /* PCCom cannot locate the specified path.  Check pathname spelling? */

    CE_REMOTE_DRIVE_INVALID    ,
    /* Target drive doesn't exist. */

    CE_REMOTE_NOT_ENOUGH_DISK_SPACE_TO_COMPLETE    ,
    /* PC disk is out of space. */

    CE_REMOTE_VOLUME_UNAVAILABLE    ,
    /* PCCom can't access the volume medium; eg. disk drive doesn't
       have a disk in it. */

    CE_PACKAGE_OLD_SO_NOT_INSTALLED    ,
    /* Returned by MSG_CMFA_GET_PACKAGE or
       MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE.
       No files in the package were installed because they had lower
       protocols than versions already existing on the device. */

    CE_PACKAGE_NOT_COMPATIBLE    ,
    /* Returned by MSG_CMFA_GET_PACKAGE or
       MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE.
       The package was not installed because it contains files that are not
       compatible with the software existing on the device. */

    CE_CANNOT_USE_INSTALL_BATCH_FILE_FOR_MORE_THAN_ONE_INSTALL    ,
    /* Returned by SetupNewFileToBeMovedOnReboot if the last installation
       changed the install batch file (install.bat), and the current
       installation will do so as well.  We can't allow this because if
       the current installation fails, the batch file is deleted which
       would wipe out the previous, successful install. */

    CE_COULD_NOT_PREPARE_FOR_TRANSFER    ,
    /* Returned by MSG_CONNECT_PREPARE_FOR_TRANSFER if virtual serial
       port could not be reserved or another error is encountered.
       Error dialog will have been displayed by the connect library.
       MSG_CONNECT_RESET_AFTER_TRANSFER must NOT be called if this
       error has been returned because none of the set up actions were
       effected.*/
    CE_MMC_NOT_ENOUGH_DISK_SPACE_TO_COMPLETE    ,
    /* Memory card disk is out of space. */
} ConnectError} ;
/*
 * NOTE: If you add/remove/change any of the ConnectError enums, be sure
 *	 to a make the same change to connect.def.
 */

/*
 * If you change ConnectSoundType, update connect.def too.
 */
typedef enum {
    CST_SUCCESS     = 0x0,
    /*
     * Sound to play when operation is successful
     */
} ConnectSoundType} ;

/*
 * ConnectStandardDialogBoxType
 *
 * NOTES:
 *
 * The dialog can be of any CustomDialogType: CDT_QUESTION, CDT_WARNING,
 *				              CDT_NOTIFICATION, CDT_ERROR
 *
 * Possible GenInteractionType's are: GIT_PROPERTIES, GIT_PROGRESS,
 *				      GIT_COMMAND, GIT_NOTIFICATION,
 *				      GIT_AFFIRMATION
 *
 * Only GIT_NOTIFICATION and GIT_PROPERTIES interactions can have a custom
 * reply trigger.
 *
 * The GIT_PROPERTIES dialogs return either IC_APPLY or IC_DISMISS.
 * The GIT_NOTIFICATION dialogs return IC_OK.
 *
 * To add a new type:
 *	1) Add an enumerated constant here.
 * 	2) Add a string for the body text (CSDS_???) in UI\uiStrings.goc.
 *	3) Add a string for title text, and/or trigger text if appropriate.
 *	4) Add a bitmap for the title icon if appropriate.
 *	5) Add extern's for the string and bitmap chunks to UI\uiDialogs.goc.
 *	5) Add an entry to the ConnectStdDialogEntryTable table in
 *	   UI\uiDialogs.goc.
 */
typedef enum {
    /*
     * Common dialogs.
     */
    CSDBT_FILE_OVERWRITE_WARNING     = 0x0,
    /* Trying to create file but file already exists.
       Ask user if we should overwrite it.
       CDT_QUESTION, GIT_PROPERTIES, arg1 = file name */

    CSDBT_CANNOT_COPY_TO_FILE    ,
    /* Trying to copy(transfer) a file but can't for some reason.
       Display the reason if it's known.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = file name, arg2 = reason */

    CSDBT_CANNOT_COPY_FROM_FILE    ,
    /* Trying to copy(transfer) a file but can't for some reason.
       Display the reason if it's known.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = file name, arg2 = reason */

    CSDBT_DEST_FILE_OPEN_BY_ANOTHER_APP    ,
    /* Destination file can not be overwriten because it's
       open by another application.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = file name */

    CSDBT_CANNOT_FIND_DRIVE    ,
    /* Trying to change to drive but can't.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = drive */

    CSDBT_CANNOT_FIND_DIRECTORY    ,
    /* Trying to change to directory but can't.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = directory path */

    CSDBT_CANNOT_FIND_DISK_IN_REMOTE_DRIVE    ,
    /* Tried accessing the remote drive, but there wasn't a disk.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = drive */

    CSDBT_DIRECTORY_DOES_NOT_EXIST_CREATE_IT    ,
    /* Trying to do something with directory but directory does not
       exits. Ask user if we should create the directory.
       CDT_QUESTION, GIT_PROPERTIES, arg1 = directory path */

    CSDBT_DIRECTORY_CREATE_ERROR    ,
    /* Trying to create directory but can't.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = directory path */

    CSDBT_CANNOT_ESTABLISH_CONNECTION    ,
    /* Trying to establish connection to PC but can't.
       CDT_NOTIFICATION, GIT_NOTIFICATION */

    CSDBT_CANNOT_ESTABLISH_MMC_CONNECTION    ,
    /* Trying to cd to the MMC, but can't .
       CDT_NOTIFICATION, GIT_NOTIFICATION */

    CSDBT_CONNECTION_MEDIUM_ALREADY_IN_USE    ,
    /* Trying to switch to connection medium but it's already in use.
       CDT_NOTIFICATION, GIT_NOTIFICATION */

    CSDBT_OPERATION_ABORTED    ,
    /* An operation was aborted.
       CDT_NOTIFICATION, GIT_NOTIFICATION */

    CSDBT_TRANSLATION_ERROR    ,
    /* Error during file translation.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = reason for error */

    CSDBT_ILLEGAL_SETTING    ,
    /* The user gave an illegal setting to the settings controller.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = setting name,
       arg2 = illegal setting text */

    CSDBT_CONNECTION_LOST    ,
    /* The connection was dropped after a number of failed attempts to
       re-connect.
       CDT_NOTIFICATION, GIT_NOTIFICATION */

    /*
     * Dialogs used by Get Package code.
     */
    CSDBT_REPLACE_EXISTING_SOFTWARE    ,
    /* A new package will replace some existing file with a
       newer version.
       Ask user if we should replace it.
       CDT_QUESTION, GIT_PROPERTIES, arg1 = package name */

    CSDBT_REPLACE_UNRELATED_SOFTWARE    ,
    /* A new package will replace some unrelated existing file.
       Ask user if we should replace it.
       CDT_QUESTION, GIT_PROPERTIES, arg1 = package name */

    CSDBT_REPLACE_EXISTING_DOCUMENT    ,
    /* A new package will replace an existing document.
       Ask user if we should replace it.
       CDT_QUESTION, GIT_PROPERTIES, arg1 = package name,
                     arg2 = existing document name */

    CSDBT_WILL_NEED_TO_REBOOT    ,
    /* After the package is installed, the device will need to
       be rebooted for it to be usable.
       Tell the user what's going on and ask if we should continue.
       CDT_QUESTION, GIT_PROPERTIES, arg1 = package name */

    CSDBT_PACKAGE_OLD_SO_NOT_INSTALLED    ,
    /* No files in the package were installed because they had lower
       protocols than versions already existing on the device.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = package name */

    CSDBT_PACKAGE_NOT_COMPATIBLE    ,
    /* The package is not compatible with software existing on the
       device. For example, the package contains a library with a major
       protocol different than the existing version on the device.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = package name */

    CSDBT_CANNOT_USE_INSTALL_BATCH_FILE_FOR_MORE_THAN_ONE_INSTALL    ,
    /* The install batch file, used at reboot to copy files that were
       part of an installation, can only be used for one installation
       at a time.  This is because a *failed* installation that modified
       the batch file causes the batch file to be deleted.  But deletion
       would wipe out the work of any previous, successful installation.
       CDT_NOTIFICATION, GIT_NOTIFICATION */

    CSDBT_SOURCE_FILE_OPEN_BY_ANOTHER_APP    ,
    /* Source file can not be sent because it's open by another
       application.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = file name */

    CSDBT_NULL_SETTING    ,
    /* The user gave a blank setting to the settings controller.
       CDT_NOTIFICATION, GIT_NOTIFICATION, arg1 = setting name */

    CSDBT_REMOTE_NOT_ENOUGH_DISK_SPACE_TO_COMPLETE    ,
    /* PC disk is out of space.
       CDT_NOTIFICATION, GIT_NOTIFICATION */

    CSDBT_OUT_OF_MEMORY    ,
    /* Insufficient memory (heap space memory, that is) to perform operation.
       CDT_NOTIFICATION, GIT_NOTIFICATION. */

    CSDBT_DATA_CALL_IN_PROGRESS    ,
    /* Connectivity operations are not allowed when a data call is in progress.
       CDT_NOTIFICATION, GIT_NOTIFICATION */

    CSDBT_MMC_NOT_ENOUGH_DISK_SPACE_TO_COMPLETE    ,
    /* MMC is out of disk space.
       CDT_NOTIFICATION, GIT_NOTIFICATOIN */

    CSDBT_THIS_IS_THE_LAST_ONE    ,
    /* This is just a dummy entry used for error checking.
       It must remain at the end of the list. */

} ConnectStandardDialogBoxType} ;

/*
 * Force geode to quit return value for completion message.
 */
typedef enum {
    CQGS_BUSY    ,
    /*
     * The geode will not quit because it has one or more
     * APP_MODE_CONNECTIONS.
     */

    CQGS_FAILED_IACP_CONNECTION    ,
    /*
     * Couldn't establish an IACP_CONNECTION with the geode; the geode may
     * not be running.
     */

    CQGS_FAILED    ,
    /*
     * Failed due to memory allocation error or other misc errors.
     */

    CQGS_SUCCESS    ,
    /* The geode has quit. */

} ConnectQuitGeodeStatus} ;

/*
 * Return values for the ConnectCheckLegalDos* routines.
 */
typedef enum {
    CCLE_LEGAL    ,
    CCLE_STRING_NULL    ,
    CCLE_STRING_TOO_LONG    ,
    CCLE_DOS_DEVICE_NAME_CONFLICT    ,
    CCLE_ONE_LETTER_DRIVE_NAME    ,
    CCLE_ILLEGAL_DOS_DRIVE_NAME    ,
    CCLE_ILLEGAL_DOS_DIR_PATH    ,
    CCLE_ILLEGAL_DOS_FILE_PATH    ,
    CCLE_ILLEGAL_DOS_FILE_NAME    ,

} ConnectCheckLegalError} ;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Connect Class

Notes on the ConnectClass

An application that wishes to use the Connect library to transfer
files needs to include a connect object and send messages telling ""
it to transfer files.

Detaching, Quitting, and Lazarus:

The connect object prevents the application from being transparently
detached while an operation is in progress by setting and
clearing the application's AS_AVOID_TRANSPARENT_DETACH flag.

If an application using a connect object is forced to detach while
a connect operation is in progress (someone calls SysShutdown or something
similar), the application should cancel the operation and delay passing the
MSG_META_DETACH to the application object's superclass until the operation
completion message has been received and handled.
Applications should use the ConnectSubApplicationClass, which provides a
mechanism for doing this. Please refer to the ConnectSubApplicationClass
for more information.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@class  ConnectClass, MetaClass ;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@message void MSG_CONNECT_OPEN_CONNECTION (ConnectionType cType,
                      sword timeOut,
                      optr completionOptr,
                      Message completionMsg);
/*
 * Desc:	Establish a connection to the server.
 *
 *		The connect library will display error dialogs for
 *		all errors that can occur while trying to establish
 *		a connection.
 *
 * Context:	connect connection management
 * Source:	any object
 * Destination:	any ConnectClass object
 * Interception:unlikely
 *
 * Pass:
 *	cType
 *		The type of connection to open.
 *
 *	timeOut
 *		Number of clock tics to keep trying to open a connection.
 *		A value of -1 will cause the connect object to continue
 *		trying to open the connection until it succeeds or the user
 *		presses the CANCEL button.
 *
 *	completionOptr
 *	completionMsg
 *		Message to send upon completion of the operation or on an
 *		error and the optr to which it will be sent. The message
 *		should be defined using the
 *		CONNECT_OPEN_CONNECTION_COMPLETION_MSG prototype. The optr
 *		may be NULL if no completion message is desired.
 *
 * Return:
 *	void
 */

/*
 * Message prototype for return message sent back from
 * MSG_CONNECT_OPEN_CONNECTION with the result of the attempt to
 * open a connection.
 */
@prototype void CONNECT_OPEN_CONNECTION_COMPLETION_MSG (ConnectError error);

@message ConnectError MSG_CONNECT_CLOSE_CONNECTION ();
/*
 * Desc:	Close the connection to the server.
 *
 * Context:	connect connection management
 * Source:	any object
 * Destination:	any ConnectClass object
 * Interception:unlikely
 *
 * Pass:
 *	nothing
 *
 * Return:
 * 	ConnectError -	CE_SUCCESS
 *			CE_CANNOT_CLOSE_CONNECTION
 */

/*
 * Message prototype to be used by applications when defining a
 * completion message to pass to the send and get messages.
 */
@prototype void CONNECT_COMPLETION_MSG (ConnectError error);

typedef ByteFlags ConnectTransferFlags  ;
#define	   CTF_MULTIPLE_TRANSFER	   		0x10
/* If set, connect library will return different errors when
 * user cancels file specific queries.   Useful when doing a
 * multiple file transfer.
 * (e.g. cancelling overwrite does not mean user cancelled
 * file transfer).
 * Available in Communicator products shipped after April 1997.
 */
#define	   CTF_DONT_RESERVE_VIRTUAL_SERIAL_PORT	   	0x08
/* If set, the connect object will NOT reserve the virtual
   serial port during connectivity operations. */
#define	   CTF_NO_TRANSFER_IF_FILE_OPEN	   		0x04
/* If set, the connect object will NOT try to get/send a file
   if it is open locally by another app. */
#define    CTF_CREATE_DEST_PATH_DIRECTORY     	0x02
/* If set, an attempt will be made to create the destination path
   if it does not exist. */
#define    CTF_QUERY_ON_OVERWRITE     		0x01
/* If set, check for overwriting an existing file and put up dialog
   asking the user if we should overwrite. */

/*
 * MSG_CONNECT_SEND_FILE
 *
 * Desc:	Send a file to the server.
 *
 *		Will translate the file format if localFormat and
 *		remoteFormat are non null. After the file is translated
 *		the connect object will send the progress dialog, if any,
 *		a MSG_CONNECT_PROGRESS_DIALOG_SET_TRANSFER_SIZE with the
 *		size of the translated file so the progress dialog will
 *		display the correct total transfer size.
 *
 *		Note: This message does not support the use of transfer
 *		      drivers.
 *
 * Context:	connect file transfer
 * Source:	any object
 * Destination:	any ConnectClass object
 * Interception:unlikely
 *
 * Pass:
 *	localDiskHandle
 *	localFilePath
 *		Source disk handle and source path and file name.
 *		The file name may be a GEOS FileLongName only if format
 *		translation is requested and the translation driver
 *		takes a GEOS file.
 *		The file path specifies a path relative to the location
 *		specified by the corresponding disk handle. If the handle is
 *		a disk handle, the path is relative to that disk's root. If
 *		the handle is a standard path constant, the path is relative
 *		to that standard path. If the handle is null, the path is
 *		relative to the current working directory.
 *		Examples: 	SP_DOCUMENT, "foo\source.txt"
 *			  	SP_APPLICATION, "tetris.geo"
 *
 *	remoteFilePath
 *		Destination path and DOS file name.
 * 		The file path specifies either an absolute path with drive
 *		specifier or a path relative to the current
 *		directory on the server which can be changed with the
 *		ConnectSetServerPath routine. The file path can not start
 *		with a backslash.
 *		Examples: 	"temp\backup\file.txt"
 *				"file.txt"
 *				"c:\temp\file.txt"
 *				"..\backup\file.txt"
 *
 *	localFormat
 *	remoteFormat
 *		Strings indicating the format of the source file and
 *		destination file, used for format translation. May be
 *		NULL if no format translation is required.
 *
 *	progressDialog
 *		Optr of the ConnectProgressDialogClass object to recieve
 *		the transfer status updates. May be NULL for no status
 *		updates.
 *
 *	flags
 *		ConnectTransferFlags for this operation.
 *
 *	completionOptr
 *	completionMsg
 *		Message to send upon completion of the operation or on an
 *		error and the optr to which it will be sent. The message
 *		should be defined using the CONNECT_COMPLETION_MSG
 *		prototype. The optr may be NULL if no completion message is
 *		desired.
 *		Error dialogs are displayed for	ConnectErrors with the
 *		CE_DIALOG_DISPLAYED bit set.
 *
 * Return:
 *	void
 */
@message void
MSG_CONNECT_SEND_FILE(DiskHandle localDiskHandle,
              TCHAR *localFilePath,
              TCHAR *remoteFilePath,
              char *localFormat,
              char *remoteFormat,
              optr progressDialog,
              ConnectTransferFlags flags,
              optr completionOptr,
              Message completionMsg);

/*
 * MSG_CONNECT_GET_FILE
 *
 * Desc:	Get a file from the server.
 *
 *		Will translate the file format if localFormat and
 *		remoteFormat are non null.
 *
 *		Note: This message supports the use of a ConnectTransferDrivers
 *		      which may be set with the
 *		      MSG_CONNECT_SET_TRANSFER_DRIVER message.
 *
 * Context:	connect file transfer
 * Source:	any object
 * Destination:	any ConnectClass object
 * Interception:unlikely
 *
 * Pass:
 *	localDiskHandle
 *	localFilePath
 *		Destination disk handle and desination path and file name.
 *		The file name may be a GEOS FileLongName only if format
 *		translation is requested and the translation driver
 *		creates a GEOS file.
 *		The file path specifies a path relative to the location
 *		specified by the corresponding disk handle. If the handle is
 *		a disk handle, the path is relative to that disk's root. If
 *		the handle is a standard path constant, the path is relative
 *		to that standard path. If the handle is null, the path is
 *		relative to the current working directory.
 *		Examples: 	SP_DOCUMENT, "foo\dest.txt"
 *			  	SP_APPLICATION, "tetris.geo"
 *
 *	remoteFilePath
 *		Source path and DOS file name.
 * 		The file path specifies either an absolute path with drive
 *		specifier or a path relative to the current
 *		directory on the server which can be changed with the
 *		ConnectSetServerPath routine. The file path can not start
 *		with a backslash.
 *		If a ConnectTransferDriver is being used, the remoteFilePath
 *		must be an absolute path.
 *		Examples: 	"temp\backup\file.txt"
 *				"file.txt"
 *				"c:\temp\file.txt"
 *				"..\backup\file.txt"
 *
 *	localFormat
 *	remoteFormat
 *		Strings indicating the format of the destination file and
 *		source file, used for format translation. May be
 *		NULL if no format translation is required.
 *
 *	progressDialog
 *		Optr of the ConnectProgressDialogClass object to recieve
 *		the transfer status updates. May be NULL for no status
 *		updates.
 *
 *	flags
 *		ConnectTransferFlags for this operation.
 *
 *	completionOptr
 *	completionMsg
 *		Message to send upon completion of the operation or on an
 *		error and the optr to which it will be sent. The message
 *		should be defined using the CONNECT_COMPLETION_MSG
 *		prototype. The optr may be NULL if no completion message is
 *		desired.
 *		Error dialogs are displayed for	ConnectErrors with the
 *		CE_DIALOG_DISPLAYED bit set.
 *
 * Return:
 *	void
 */
@message void
MSG_CONNECT_GET_FILE(DiskHandle localDiskHandle,
              TCHAR *localFilePath,
              TCHAR *remoteFilePath,
              char *localFormat,
              char *remoteFormat,
              optr progressDialog,
              ConnectTransferFlags flags,
              optr completionOptr,
              Message completionMsg);
/*
 * Possible ConnectError's returned with completion message.
 *	XXX: NOT ACCURATE!!!!!!!!!!!
 *
 *		CE_SUCCESS
 *		CE_FILE_TRANSFER_OPERATION_ALREADY_IN_PROGRESS
 *		CE_USER_CANCELED
 *		CE_OPERATION_FAILED
 *		CE_CANNOT_CREATE_DIRECTORY
 *		CE_DEST_DIRECTORY_DOES_NOT_EXIST
 *		CE_CONNECTION_FAILED
 *		CE_NOT_ENOUGH_DISK_SPACE
 *		CE_NOT_ENOUGH_MEMORY
 *	   XXX: add any errors from DoFileFormatTranslation
 *	   XXX: file open by other app error
 *
 */

/*
 * Desc:	Cancel the current GET or SEND operation.
 *
 * Context:	connect file transfer
 * Source:	any object
 * Destination:	any ConnectClass object
 * Interception:unlikely
 *
 * Pass:
 *	void
 * Return:
 *	void
 */
@message void MSG_CONNECT_CANCEL_TRANSFER ();

/*
 * Desc:	Set a ConnectTransferDriver to use instead of the PCCom library.
 *		Currently only MSG_CONNECT_GET_FILE supports the use of
 *		a ConnectTransferDriver; MSG_CONNECT_SEND_FILE does not.
 *		You can switch back to using the PCCom library by calling
 *		MSG_CONNECT_SET_TRANSFER_DRIVER passing NULL.
 *
 * Context:	connect file transfer
 * Source:	any object
 * Destination:	any ConnectClass object
 * Interception:unlikely
 *
 * Pass:
 *	driver
 *		The long name of the ConnectTransferDriver to use.
 *
 * Return:
 *	void
 */
@message void MSG_CONNECT_SET_TRANSFER_DRIVER (char *driver);

/*
 * Forces the given geode (library or app) to quit.  This is necessary
 * in certain cases like deinstallation.  This message does not guarantee
 * that the app/library will quit -- the completionOptr should check the
 * error value of the completion message to be sure.  The completion message
 * should be defined  using the CONNECT_QUIT_GEODE_COMPLETION_MSG prototype.
 *
 * Context:	deinstallation process or similar situations
 * Source:	any object
 * Destination:	any ConnectClass object
 * Interception:unlikely
 * Pass:        GeodeHandle geode - target geode
 *              word completionMsg - CONNECT_QUIT_GEODE_COMPLETION_MSG prototype
 *              optr completionOptr - object to receive completion message.
 *              optr exceptThisApp - usually the message caller or sender
 *
 */
@message void MSG_CONNECT_FORCE_GEODE_TO_QUIT (GeodeHandle geode,
                          word completionMsg,
                          optr completionOptr,
                          GeodeHandle exceptThisApp);

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Internal Messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Internal message used by MSG_CONNECT_OPEN_CONNECTION to repeatedly
 * try to contact the server in a cancellable fashion.
 */
@message void MSG_CONNECT_CONTACT_SERVER ();

/*
 * Internal messages used during file get and send operations.
 */
@message void MSG_CONNECT_CONTINUE_SEND_AFTER_TRANSLATION ();
@message void MSG_CONNECT_FINISH_SEND_AFTER_TRANSFER ();

@message void MSG_CONNECT_CONTINUE_GET_AFTER_TRANSFER ();
@message void MSG_CONNECT_FINISH_GET_AFTER_TRANSLATION ();

@message ConnectError MSG_CONNECT_HANDLE_ERROR (ConnectError error,
                           TCHAR *arg1,
                           TCHAR *arg2);

@message ConnectError MSG_CONNECT_START_TRANSLATION (DiskHandle sourceDiskHandle,
                            TCHAR *sourceFilePath,
                            char *sourceFormat,
                            DiskHandle destDiskHandle,
                            TCHAR *destFilePath,
                            char *destFormat);

@message void MSG_CONNECT_TRANSLATION_DONE (ConnectTranslateDriverError xlatError,
                       MemHandle driverArgs);

/*
 * Internal transfer status message sent from the PCCom library to the
 * Connect object during PCComGet's and PCComSend's.
 */
@message (PCCOM_STATUS_MSG) MSG_CONNECT_PCCOM_TRANSFER_STATUS;

/*
 * Internal transfer status message sent from the Connect Transfer Driver
 * to the Connect object during DR_CTFD_GET_FILE and DR_CTFD_SEND_FILE's.
 */
@message (CONNECT_TRANSFER_DRIVER_STATUS_MSG) MSG_CONNECT_TRANSFER_DRIVER_TRANSFER_STATUS;

/*
 * Desc:	Internal messages.
 *		Allocate the vardata path buffers.
 *		Delete the vardata path buffers.
 *
 * Context:	connect file transfer
 * Source:	Connect object itself.
 * Destination:	Connect object itself.
 *
 * Interception:If someone is going to do multiple GET/SEND operations,
 *		they may want to subclass this message and
 *		MSG_CONNECT_DELETE_VARDATA_PATH_BUFFERS and set things
 *		up so the path buffers are only allocated once before
 *		the multiple GET/SEND operations and delete once afterwards.
 *		That is, keep the Connect object from allocating and
 *		deleting the vardata path buffers during each single file
 *		transfer operation.
 *
 * Pass:	void
 * Return:	void
 */
@message void MSG_CONNECT_ALLOCATE_VARDATA_PATH_BUFFERS ();
@message void MSG_CONNECT_DELETE_VARDATA_PATH_BUFFERS ();

@prototype void CONNECT_QUIT_GEODE_COMPLETION_MSG (GeodeHandle geode,
                           ConnectQuitGeodeStatus status);

/*
 * When a library is asked to quit, via MSG_CONNECT_FORCE_GEODE_TO_QUIT, it
 * tells all running apps to shutdown, and this is the completion message for
 * each app that quits.
 *
 * Context:	shutting down of a library geode
 * Source:	ConnectClass object
 * Destination:	Connect
 * Interception:not likely
 *
 */
@message (CONNECT_QUIT_GEODE_COMPLETION_MSG)
    MSG_CONNECT_CONTINUE_FORCE_LIBRARY_TO_QUIT;

/*
 * During a transfer, we don't want the application to transparently
 * detach. These messages are used to prevent/allow transparent detaching.
 *
 * Also, the virtual serial port will be reserved during a transfer to
 * disable data calls unless the CTF_DONT_RESERVE_VIRTUAL_SERIAL_PORT
 * flag is set. If the port cannot be reserved, an error will
 * be returned and transparent detaching will not be prevented.
 * MSG_CONNECT_RESET_AFTER_TRANSFER should NOT be called
 * in this case.
 *
 * MSG_CONNECT_RESET_AFTER_TRANSFER will release the virtual
 * serial port if it was reserved, and will allow the app to be
 * transparently attached.
 *
 * Note:
 *	The MSG_CONNECT_{PREPARE_FOR/RESET_AFTER}_TRANSFER
 *	messages may be nested and we will not tell the application
 *	it can transparently detach nor release the virtual serial
 *	port until we've received a matching number of PREPARE/RESET
 *	messages.
 *
 *	This is useful when a subclass of the Connect object wants
 *	to prevent the app from detaching around an operation that
 *	uses MSG_CONNECT_(GET|SEND)_FILE.
 *
 * Context:      file transfer
 * Source:       ConnectClass (or subclass) object itself
 * Destination:  the object itself
 * Interception: not likely
 */
@message ConnectError
    MSG_CONNECT_PREPARE_FOR_TRANSFER    (ConnectTransferFlags flags);
@message void MSG_CONNECT_RESET_AFTER_TRANSFER ();

@PROTOMINOR(MemoryCardSupport);

/*
 *  For internal use only
 */
@message void MSG_CONNECT_MMC_TRANSFER_STATUS (MMCReturnType returnType,
                          dword bytesThisFile);

/*
 *  This message will cause the next call to
 *  MSG_CONNECT_OPEN_CONNECTION to allow the application to receive
 *  output notifications directly from PCCom (see the PCComInit()
 *  API).  Use this only if you have a good reason, and with caution.
 */
@message void MSG_CONNECT_SET_PCCOM_NOTIFICATIONS (PCComInitFlags flags,
                                                  optr output);

@message void MSG_CONNECT_USE_OPEN_DIALOG (optr progressDialog);
/*
 * Desc:        This message will cause the next call to
 *              MSG_CONNECT_OPEN_CONNECTION to use the passed
 *              ConnectProgressDialog object instead of creating its
 *              own.  Dismissing and destroying the dialog are the
 *              responsibility of the caller.
 */

@protoreset;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Instance data and defaults
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Status of the current GET or SEND operation.
 */
typedef WordFlags ConnectGetSendStatus  ;

#define CGSS_USING_TRANSFER_DRIVER 		0x0100
/* Set when a ConnectTransferDriver is being used instead of
   the PCCom library. */

#define CGSS_USER_CANCELED 			0x0080
/* Set when the user has canceled the operation. */

#define CGSS_SEND_REMOVE_TEMP_FILE 		0x0040
/* Set when doing a file SEND and translation was done.
   The source file was translated into a temporary file
   and the temporary file is being transferred to the PC.
   The Connect object will remove the temporary file when
   the transfer has completed. */

#define	CGSS_SEND_IN_PROGRESS				0x0020
/* Set when the connect object is in the process of SEND'ing a file. */

#define	CGSS_GET_DEST_FILE_EXISTS			0x0010
/* Set when there is an existing destination file
   during a GET operation. */

#define CGSS_GET_MOVE_TEMP_TO_DEST 		0x0008
/* Set when doing a file GET and an existing destination file
   will be overwritten and there is room for a temp file.
   The source file is being transferred into a temporary file
   and the Connect object will move the temporary file to
   the dest file when the transfer has completed. */

#define	CGSS_GET_TRANSFER_INTO_TEMP			0x0004
/* Set when doing a file GET and the source file is
   being transfered into a temp file. */

#define	CGSS_GET_NEED_TRANSLATION			0x0002
/* Set when doing a file GET and a translation is needed.
   The source file is being transferred into a temporary file
   and the Connect object will translate the temporary file
   into the dest file when the transfer has completed. */

#define	CGSS_GET_IN_PROGRESS				0x0001
/* Set when the connect object is in the process of GET'ing a file. */

/*
 * Context:	Status of the current transfer.
 * Usage:	Used by the connect object to check if an operation is
 *		currently in progress before starting a new one.
 *		Also used by the connect object to remember what it
 *		needs to do when a GET or SEND transfer is completed
 *		(ie, move the temp file to the destination or translate
 *		the temp file to the destination or remove the temp file.)
 *		Also used by the connect object to figure out what needs
 *		to be cleaned up when a GET or SEND operation is canceled.
 */
@instance	ConnectGetSendStatus CI_connectGetSendStatus = 0x0000;

/*
 * Context:	Optr and message to send upon transfer completion.
 * Usage:	Used by the Connect object to remember where and what
 *		message to send when the GET/SEND operation completes
 *		or is canceled.
 */
@instance	optr	CI_notifyOnCompletionOptr = NullOptr ;
@instance	Message	CI_notifyOnCompletionMsg = NULL ;

/*
 * Context:	Optr of progress dialog for transfer progress updates.
 * Usage:	Used by the Connect object to send progress updates
 *		during file transfers.
 */
@instance	optr	CI_progressDialogOptr = NullOptr ;

/*
 * Context:	Path and filename of temp file.
 * Usage:	Used when translating a file or GET'ing a file to
 *		to a temporary file before overwriting the destination.
 *		Also used by the send operation to save the source file
 *		path between stage 1 and 2 when there is no translation.
 */
@instance	DiskHandle	CI_tempDiskHandle = NULL;
@vardata	PathAndFileName TEMP_CONNECT_TEMP_FILE_PATH;

/*
 * Context:	Path and filename of transfer destination, and
 *              file handle of already existing destination.
 * Usage:	This data is used by the connect object when the
 *		GET transfer completes to move the temp file to the
 *		destination.
 *		The CI_destFilePath is also used by the SEND operation
 *		to save the destination file path between stage 1 and 2
 *		of the send operation.
 *
 *		If the GET operation is overwriting an existing destination
 *		file, we try to open the existing file for exclusive access
 *		to prevent another app from opening it while the GET is in
 *		progress. If the open is successful, the file handle is
 *		stored in the CI_originalDestFile instance data.
 */
@instance	DiskHandle	CI_destDiskHandle ;
@vardata	PathAndFileName TEMP_CONNECT_DEST_FILE_PATH;
@instance       FileHandle      CI_originalDestFile = NullHandle;

/*
 * Context:	Source and destination file formats.
 *		Only for a GET operation.
 * Usage:	This data is used by the connect object when the
 *		GET transfer completes to translate the temp file
 *		to the destination.
 */
@instance	char	CI_sourceFormat[FILE_FORMAT_NAME_SIZE] ;
@instance	char	CI_destFormat[FILE_FORMAT_NAME_SIZE] ;

/*
 * Context:	Handle of data block used for the get operation.
 *		Only for a GET operation.
 * Usage:
 *
 */
@instance	MemHandle	CI_getSourceDataBlock = NullHandle ;

/*
 * Instance data for file format translation.
 */
/* Context:	Handle of translation thread. */
@instance	ThreadHandle	CI_xlateThread = NullHandle;

/* Context:	Handle of translation driver geode. */
@instance	GeodeHandle	CI_xlateDrvHandle = NullHandle;

/* Context:	fptr to translation driver strategy routine. */
@instance	void (*CI_xlateDrvStratRoutine)() = NULL;

/*
 * Instance data for open connection operation.
 */

@instance	optr		CI_openConnectionDialog = NullOptr;
@instance	optr		CI_openConnectionReturnObj = NullOptr;
@instance	Message		CI_openConnectionReturnMsg = NULL;
@instance	dword		CI_openConnectionTimeOutTime;

typedef ByteFlags ConnectOpenConnectionTimeOutFlags ;
#define	COCTOF_INFINITE				0x02
/* Set if the user wants an infinite time out. */
#define	COCTOF_OVERFLOW				0x01
/* Internally used to indicate that the system tic counter will overflow. */
@instance	ConnectOpenConnectionTimeOutFlags CI_openConnectionTimeOutFlags;

/*
 * Instance data for using a ConnectTransferDriver.
 *
 * Context:	Name of ConnectTransferDriver to use.
 *		If NULL, PCCom is used.
 */
@instance	FileLongName	CI_xferDriverName = NULL;

/* Context:	Handle of ConnectTransferDriver geode. */
@instance	GeodeHandle	CI_xferDrvHandle = NullHandle;

/* Context:	fptr to ConnectTransferDriver strategy routine. */
@instance	void (*CI_xferDrvStratRoutine)() = NULL;

@vardata	ConnectQuitGeodeState TEMP_CONNECT_QUIT_VARS;

/*
 * Context:	Counter for ALLOW/PREVENT transparent detach mechanism
 * Usage:	Used by MSG_CONNECT_(ALLOW|PREVENT)_APP_TRANSPARENT_DETACH
 */
@instance	word		CI_avoidDetachCount = 0;

/*
 * Status of the connection to the server.
 */
typedef ByteFlags ConnectConnectionStatus ;
#define CCS_VIRTUAL_SERIAL_PORT_RESERVED 	0x02
/* Set when the connect object has the virtual serial
   port reserved. */
#define CCS_CONNECTION_OPEN 			0x01
/* Set when the connect object has an open connection
   to the server. */

/*
 * Context:	INTERNAL: Status of the connection to the server.
 * Usage:	Used by the connect object to store the
 *		connection status.
 */
@instance	ConnectConnectionStatus	CI_connectionStatus = 0x00;

/*
 * Context:	INTERNAL: IACP Connection token of the connection to
 *			  a document server.
 * Usage:	This vardata is used by the get file code to store
 *		the token for the connection to the document server when
 *		it tries to gain access to an existing file. The file
 *		access is released when MSG_CONNECT_HANDLE_ERROR calls
 *		UtilReleaseFileAccess.
 */
@vardata	IACPConnection	TEMP_CONNECT_IACP_CONNECTION_TOKEN;

@PROTOMINOR(MemoryCardSupport);
/*
 * Context:	Set by application
 * Usage:	Put this attr on a ConnectClass (or subclass) object
 *		to prevent it from using any UI that requires user input.
 */
@vardata        void       ATTR_CONNECT_NO_USER_INTERACTION;

/*
 * Context:	Set Internally, by MSG_CONNECT_SET_PCCOM_NOTIFICATIONS
 * Usage:	Put this attr on a ConnectClass (or subclass) object
 *		to prevent it from using any UI that requires user input.
 */
typedef struct {
    optr           PCCN_output;
    PCComInitFlags PCCN_initFlags;
} PCCNotifications} ;

@vardata        PCCNotifications TEMP_CONNECT_PCCOM_NOTIFICATIONS;

@vardata        optr    TEMP_CONNECT_ALTERNATE_OPEN_DIALOG;

@protoreset;

@endc	/* ConnectClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        ConnectMultiFileClass

ConnectMultiFileClass is subclassed from ConnectClass to provide
synchronization for cases where files are batch transferred.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@class ConnectMultiFileClass, ConnectClass;

/*
 * MSG_CMF_GET_FILE_ARRAY, MSG_CMF_SEND_FILE_ARRAY
 *
 * Desc:	Gets (sends) a bunch of file from (to) the server.
 *		May also translate the file format.
 *
 * Context:	connect file transfer
 * Source:	any object
 * Destination:	any ConnectMultiFileClass object
 * Interception:unlikely
 *
 * Pass:
 *  	array
 *  	    Optr to a chunk array of MultiFileArrayEntry structures.
 *          The chunk array should reside in its own block and will be
 *          freed in MSG_CMF_FINISH_FILE_ARRAY.
 *
 *	flags		= ConnectTransferFlags
 *
 *      progressDialog	= optr of associated ConnectProgressDialog.
 *			  May be NullOptr.
 *
 *	completionOptr
 *	completionMsg
 *		Message to send upon completion of the operation or on an
 *		error and the optr to which it will be sent. The message
 *		should be defined using the CONNECT_COMPLETION_MSG
 *		prototype. The optr may be NULL if no completion message is
 *		desired.
 *		Error dialogs are displayed for	ConnectErrors with the
 *		CE_DIALOG_DISPLAYED bit set.
 *
 * NOTE for MSG_CMF_SEND_FILE_ARRAY:
 *	If any of the MultiFileArrayEntry's request that a file be
 *	translated, do NOT use a progress dialog that displays the
 *	the total transfer size. Translation changes the file size
 *	causing the total transfer size to not match the cumulative
 *	byte tally. This does not apply to MSG_CMF_GET_FILE_ARRAY
 *	because during a get operation, the files are transfered
 *	before being translated.
 */
@message void MSG_CMF_GET_FILE_ARRAY (
    optr array,
    ConnectTransferFlags flags,
    optr progressDialog,
    optr completionOptr,
    Message completionMsg);
@message void MSG_CMF_SEND_FILE_ARRAY (
    optr array,
    ConnectTransferFlags flags,
    optr progressDialog,
    optr completionOptr,
    Message completionMsg);

/*
 * MSG_CMF_GET_NEXT_FILE, MSG_CMF_SEND_NEXT_FILE
 *
 * Desc:	Gets (sends) a file from (to) the server, as specified
 *  	    	by the MultiFileArray in the object's instance data.
 *
 * Context:	connect file transfer
 * Source:  	any object
 * Destination:	any ConnectClass object
 * Interception: Subclass this message to perform any file-by-file functions
 *  	    	 during a batch transfer.
 *
 * Pass:
 *  	see CONNECT_COMPLETION_MSG prototype
 *
 */
@message (CONNECT_COMPLETION_MSG) MSG_CMF_SEND_NEXT_FILE;
@message (CONNECT_COMPLETION_MSG) MSG_CMF_GET_NEXT_FILE;

/*
 * MSG_CMF_FINISH_FILE_ARRAY
 *
 * Desc:	Deals with various clean-up issues once the file array has
 *  	    	been transferred. Frees the chunk array and the block it
 *		resides in and then sends the completion AD, etc.
 *
 * Pass:
 *  	    error
 *  	    	ConnectError to pass on to the completion message.
 *
 */
@message void MSG_CMF_FINISH_FILE_ARRAY (ConnectError error);

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Instance data and defaults
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Status of the current GET or SEND operation.
 */
typedef WordFlags ConnectMFGetSendStatus  ;

#define CMFGSS_DO_NOT_ALLOCATE_OR_DELETE_PATH_BUFFERS 	0x0002
/* Set when the subclassed messages
   MSG_CONNECT_(ALLOCATE|DELETE)_VARDATA_PATH_BUFFERS
   should not allocate/delete the vardata path buffers. */

#define CMFGSS_TRANSFER_CANCELED 			0x0001
/* Set when the multi-file transfer in progress has been
   cancelled by the user. */

/*
 * CMFI_fileArray keeps track of the MultiFileArray during successive calls
 * to MSG_CMF_GET(SEND)_NEXT_FILE. This field is set by
 * MSG_CMF_GET(SEND)_FILE_ARRAY.
 */
@instance	optr		CMFI_fileArray = NullOptr;

/*
 * CMFI_nextFile is an index into CMFI_fileArray, specifying which file
 * should be sent or retrieved next.
 */
@instance	word		CMFI_nextFile = 0;

@instance	optr		CMFI_progressDialog = NullOptr;

/*
 * CMFI_completionOptr and CMFI_completionMsg store the AD to send
 * once the entire array has been transferred.
 */
@instance	optr		CMFI_completionOptr = NullOptr;
@instance	Message		CMFI_completionMsg = 0;

/*
 * Status of the multi-file transfer in progress is kept in this
 * field.
 */
@instance       ConnectMFGetSendStatus CMFI_connectmfGetSendStatus = 0;

/*
 * Context:	INTERNAL: Temporary vardata storage used to pass the
 *			  ConnectTransferFlags from
 *			  MSG_CMF_(GET|SEND)_FILE_ARRAY to
 *			  MSG_CMF_(GET|SEND)_NEXT_FILE.
 *
 * Usage:	This vardata is allocated and set by the
 *		MSG_CMF_(GET|SEND)_FILE_ARRAY, used by
 *		MSG_CMF_(GET|SEND)_NEXT_FILE, and deleted by
 *		MSG_CMF_FINISH_FILE_ARRAY.
 */
@vardata	ConnectTransferFlags	TEMP_CMF_CONNECT_TRANSFER_FLAGS;

@endc	/* ConnectMultiFileClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        ConnectMultiFileActionClass

ConnectMultiFileActionClass is subclassed from ConnectMultiFileClass
to allow the sending of a message to deal with each file in a batch
file transfer upon its receipt.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@class ConnectMultiFileActionClass, ConnectMultiFileClass;

/*
 * MSG_CMFA_SET_FILE_ACTION
 *
 * Desc:	Sets the action to take upon receipt of a file
 *
 * Context:	Caller wants to do something with each file in the
 *		course of a multi-file get.
 * Source:	any object
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *  	fileActionOptr
 *  	fileActionMsg
 *		Message to send upon receipt of a file and the optr to
 *		which it will be sent. The message should be defined
 *		using the CMFA_FILE_ACTION_MSG prototype. The optr may
 *		be NULL if no file action message is desired.
 */
@message void MSG_CMFA_SET_FILE_ACTION (optr fileActionOptr,
                       Message fileActionMsg);

/*
 * Message prototype to be used when defining a file action
 * message to pass to MSG_CMFA_SET_FILE_ACTION.
 * The completionOptr and completionMsg will be filled in by
 * the ConnectMultiFileActionClass when it sends off the file
 * action message.
 */
@prototype void CMFA_FILE_ACTION_MSG (optr completionOptr,
                     Message completionMsg);

/*
 * MSG_CMFA_GET_FILE_DETAILS_BLOCK
 *
 * Desc:	Gets the block detailing the file transfer just completed
 *
 * Context:	Caller has received the CMFAI_fileActionMsg in the course of
 *		a multi-file get, and needs to find out what file to handle.
 * Source:	any object
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *	nothing
 *
 * Return:
 *	handle of the CMFAI_fileDetailsBlock
 *
 */
@message MemHandle MSG_CMFA_GET_FILE_DETAILS_BLOCK ();

/*
 * MSG_CMFA_ALLOCATE_PACKAGE_ARRAY
 *
 * Desc:	Allocates CMFAI_packageArray.
 *
 * Context:	Caller wants to start using the array
 * Source:	any object
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *	headerSize	= size to allocate
 *
 * Return:
 *  	nothing
 */
@message void MSG_CMFA_ALLOCATE_PACKAGE_ARRAY (
    word headerSize);

/*
 * Message prototype to be used by applications when defining a
 * completion message to pass to MSG_CMFA_LIST_PACKAGES.
 */
@prototype void CMFA_LIST_PACKAGES_COMPLETION_MSG (ConnectError error,
                          optr packageArray);

/*
 * MSG_CMFA_LIST_PACKAGES
 *
 * Desc:	Initiates the process of getting a list of the software
 *              packages available on the specified drive of the server.
 *
 * Context:	Caller needs to display a list of downloadable packages
 * Source:	any object
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *  	remotePath
 *  	    string indicating absolute remote path from which to list packages
 *	flags		= ConnectTransferFlags
 *	progressDialog	= optr of associated ConnectProgressDialog.
 *			  May be NullOptr.
 *	completionOptr
 *	completionMsg
 *		Message to send upon completion of the operation or on an
 *		error and the optr to which it will be sent. The message
 *		should be defined using the CMFA_LIST_PACKAGES_COMPLETION_MSG
 *		prototype. The optr may be NULL if no completion message is
 *		desired.
 *		Error dialogs are displayed for	ConnectErrors with the
 *		CE_DIALOG_DISPLAYED bit set.
 */
@message void MSG_CMFA_LIST_PACKAGES (
    TCHAR *remotePath,
    ConnectTransferFlags flags,
    optr progressDialog,
    optr completionOptr,
    Message completionMsg);

/*
 * Message prototype to be used by applications when defining a
 * completion message to pass to MSG_CMFA_GET_PACKAGE or
 * MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE.
 */
@prototype void CMFA_GET_PACKAGE_COMPLETION_MSG (ConnectError error);

/*
 * MSG_CMFA_GET_PACKAGE
 *
 * Desc:	Downloads the package specified by the passed index
 *		into the passed PackageDescriptorArray.
 * Context:	Caller wants to download selected package
 * Source:	anyone
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *	packageArray	= optr to chunk array of PackageDescriptorArrayEntries
 *	n		= index of package to get
 *	flags		= ConnectTransferFlags
 *	progressDialog	= optr of associated ConnectProgressDialog
 *			  May be NullOptr.
 *	completionOptr
 *	completionMsg
 *		Message to send upon completion of the operation or on an
 *		error and the optr to which it will be sent. The message
 *		should be defined using the CMFA_GET_PACKAGE_COMPLETION_MSG
 *		prototype. The optr should be NullOptr if no completion
 *		message is desired.
 *		Error dialogs are displayed for	ConnectErrors with the
 *		CE_DIALOG_DISPLAYED bit set.
 */
@message void MSG_CMFA_GET_PACKAGE (
    optr packageArray,
    word n,
     ConnectTransferFlags flags,
    optr progressDialog,
    optr completionOptr,
    Message completionMsg);

/*
 * MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE
 *
 * Desc:	Downloads the package specified by the passed
 *              local package file path and remote package path
 * Context:	Caller already has the package file locally, knows where
 *              the package is, and wants to download it
 * Source:	anyone
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *	Gets the package specified in the passed package file.
 *
 *	localDiskHandle
 *	localPackageFilePath
 *		Disk handle and local path and file name of package file.
 *		The file path specifies a path relative to the location
 *		specified by the corresponding disk handle. If the handle is
 *		an actual disk handle, the path is relative to that disk's
 *		root. If the handle is a standard path constant, the path is
 *		relative to that standard path. If the handle is null, the
 *		path is relative to the current working directory.
 *		Examples: 	SP_DOCUMENT, "foo\package.ins"
 *			  	SP_TEMP_FILES, "package.ins"
 *	remotePackagePath
 *		Absolute remote directory path with drive specifier to
 *		package, not including any file name. The source paths of
 *		the files listed in the package file are relative to this
 *		remotePackagePath. The directory path cannot end with
 *		a backslash.
 *		Examples: 	"c:\install"
 *			  	"f:"
 *
 *	flags		= ConnectTransferFlags
 *	progressDialog	= optr of progress dialog to which progress
 *			  updates should be sent.
 *			  Pass NullOptr if no progress reports are desired.
 *	completionOptr
 *	completionMsg
 *		Message to send upon completion of the operation or on an
 *		error and the optr to which it will be sent. The message
 *		should be defined using the CMFA_GET_PACKAGE_COMPLETION_MSG
 *		prototype. The optr should be NullOptr if no completion
 *		message is desired.
 *		Error dialogs are displayed for	ConnectErrors with the
 *		CE_DIALOG_DISPLAYED bit set.
 */
@message void MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE (
    DiskHandle localDiskHandle,
    TCHAR *localPackageFilePath,
    TCHAR *remotePackagePath,
    ConnectTransferFlags flags,
    optr progressDialog,
    optr completionOptr,
    Message completionMsg);

/*
 * MSG_CMFA_CANCEL_GET_PACKAGE
 *
 * Desc:	Cancels current transfer and deletes all files so far
 *		downloaded.
 *
 * Context:	Caller wants to cancel and clean up.
 * Source:	anyone
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *  	    nothing
 */
@message void MSG_CMFA_CANCEL_GET_PACKAGE ();

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Internal Messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * MSG_CMFA_FINISH_LIST_PACKAGES
 *
 * Desc:	Cleans up after a package listing and sends CMFAI_completionMsg
 *              (with a ConnectError and PackageDescriptorArray optr) to
 *		CMFAI_completionOptr.
 *
 * Context:	INTERNAL. Call specified within MSG_CMFA_LIST_PACKAGES.
 * Source:	any ConnectMultiFileActionClass object
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *  	see CONNECT_COMPLETION_MSG prototype
 *
 */
@message (CONNECT_COMPLETION_MSG) MSG_CMFA_FINISH_LIST_PACKAGES;

/*
 * MSG_CMFA_CONTINUE_GET_PACKAGE
 *
 * Desc:	Parses the retrieved package file and downloads the
 *		specified files.
 *
 * Context:	INTERNAL. Call specified within MSG_CONNECT_GET_PACKAGE.
 * Source:	any ConnectMultiFileActionClass object
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *  	see CONNECT_COMPLETION_MSG prototype
 *
 */
@message (CONNECT_COMPLETION_MSG) MSG_CMFA_CONTINUE_GET_PACKAGE;

/*
 * MSG_CMFA_FINISH_GET_PACKAGE
 *
 * Desc:	Cleans up after a package download and sends
 *		CMFAI_completionMsg (with a ConnectError) to
 *		CMFAI_completionOptr.
 *
 * Context:	INTERNAL. Call specified within MSG_CMFA_GET_PACKAGE.
 * Source:	any ConnectMultiFileActionClass object
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *  	see CONNECT_COMPLETION_MSG prototype
 *
 */
@message (CONNECT_COMPLETION_MSG) MSG_CMFA_FINISH_GET_PACKAGE;

/*
 * MSG_CMFA_UPDATE_PACKAGE_DESCRIPTOR_ARRAY
 *
 * Desc:	Reads the package name, description, and size out of a package
 *              file and stores them in a PackageDescriptorArrayEntry
 *		chunk in CMFAI_packageArray.
 *
 * Context:	INTERNAL. Call specified within MSG_CMFA_LIST_PACKAGES.
 * Source:	any ConnectMultiFileActionClass object
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *  	see CMFA_FILE_ACTION_MSG prototype
 *
 */
@message (CMFA_FILE_ACTION_MSG) MSG_CMFA_UPDATE_PACKAGE_DESCRIPTOR_ARRAY;

/*
 * MSG_CMFA_FILE_ACTION_FOR_GET_PACKAGE
 *
 * Desc:	This is the file action message that gets sent out to
 *		deal with each file downloaded durring a get package
 *		operation.
 *
 * Context:	INTERNAL. Call specified within MSG_CONNECT_GET_PACKAGE.
 * Source:	any ConnectMultiFileActionClass object
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *  	see CMFA_FILE_ACTION_MSG prototype
 */
@message (CMFA_FILE_ACTION_MSG)	MSG_CMFA_FILE_ACTION_FOR_GET_PACKAGE;
@message (CONNECT_QUIT_GEODE_COMPLETION_MSG)
    MSG_CMFA_FILE_ACTION_FOR_GET_PACKAGE_STAGE_2;

/*
 * MSG_CMFA_CONTINUE_GET_NEXT_FILE
 *
 * Desc:	INTERNAL: Second part of the ConnectMultiFileActionClass
 *		MSG_CMF_GET_NEXT_FILE handler.
 *
 *		Note that this message must be defined to take the same
 *		parameters as MSG_CMF_GET_NEXT_FILE. See the
 *		MSG_CMFA_CONTINUE_GET_NEXT_FILE code for more details.
 *
 * Context:	INTERNAL. ConnectMultiFileActionClass multi-file get.
 * Source:	ConnectMultiFileActionClass object
 * Destination:	ConnectMultiFileActionClass object
 * Interception:unlikely
 *
 * Pass:
 *  	see CONNECT_COMPLETION_MSG prototype
 */
@message (CONNECT_COMPLETION_MSG) MSG_CMFA_CONTINUE_GET_NEXT_FILE;

@PROTOMINOR(MemoryCardSupport);

/*
 * MSG_CMFA_SET_PACKAGE_DESTINATION
 *
 * Desc:        Sets/deletes the drive handle and root path to which
 *              files should be installed in a package. If this
 *              is not called before calling MSG_CMFA_GET_PACKAGE
 *              or MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE,
 *              files will be installed to SP_TOP. If an app sets the
 *              the root path, it must make sure and delete it after the
 *              package is installed
 *
 * Context:     Right before doing a package install
 * Source:      Applications that want to install things to
 *              someplace other than SP_TOP.
 * Destination: ConnectMultiFileActionClass object
 *
 * Pass:        rootDrive       Drive Handle of install destination
 *              rootPath        path relative to rootDrive of install
 *                              destination
 */
@message void MSG_CMFA_SET_PACKAGE_DESTINATION (
    DiskHandle rootDrive,
    TCHAR *rootPath);

@protoreset;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Instance data and defaults
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * CMFAI_packageArray stores the OD for the chunk array of
 * PackageDescriptorArrayEntries created when listing packages,
 * or for the array of PackageProgressArrayEntries created when
 * getting a package.
 */
@instance	optr		CMFAI_packageArray = NullOptr;
/*
 * CMFAI_fileDetailsBlock stores the MultiFileArrayEntry for the file just
 * received.
 */
@instance	MemHandle	CMFAI_fileDetailsBlock = NullHandle;
/*
 * CMFAI_fileActionOptr and CMFAI_fileActionMsg store the AD to call
 * upon receipt of each file.
 */
@instance	optr		CMFAI_fileActionOptr = NullOptr;
@instance	Message		CMFAI_fileActionMsg = 0;
/*
 * CMFAI_completionOptr and CMFAI_completionMsg store the AD to send
 * once the whole transfer operation has completed.
 */
@instance	optr		CMFAI_completionOptr = NullOptr;
@instance	Message		CMFAI_completionMsg = 0;

/*
 * Status of the current get package operation if any.
 */
typedef WordFlags ConnectMFAGetPackageStatus ;

#define CMFAGPS_REPLACE_DOCUMENT_DIALOG_DISPLAYED 	0x0200
/*
 * Set if the "replacing existing document" dialog
 * has been displayed for this particular file being
 * downloaded from a package.
 *
 * This flag is cleared by MSG_CMFA_FILE_ACTION_FOR_GET_PACKAGE
 * and checked/set by DisplayReplaceExistingDocumentDialog.
 */

#define CMFAGPS_REBOOT_DIALOG_DISPLAYED 			0x0100
#define CMFAGPS_EXISTING_DIALOG_DISPLAYED 		0x0080
#define CMFAGPS_UNRELATED_DIALOG_DISPLAYED 		0x0040
/*
 * These flags are set if the corresponding dialog
 * has already been displayed during the current
 * package install.
 */

#define CMFAGPS_FILE_INSTALLED_FROM_PACKAGE 		0x0010
/*
 * Set if at least one file from the current
 * package has been installed. This flag is
 * used to determine if the "package not installed"
 * dialog should be displayed.
 */

#define CMFAGPS_NEED_TO_REBOOT 				0x0008
/*
 * Set if the device needs to be re-booted in order
 * for the package just install to be usable.
 */

#define CMFAGPS_NEW_FILE_IS_GEOS_FILE 			0x0004
/*
 * Set if the file being downloaded from the package
 * is a GEOS file.
 */
#define CMFAGPS_EXISTING_LOCAL_DEST_FILE 		0x0002
/*
 * Set when the file being downloaded from a package
 * will overwrite an existing local destination file.
 * By local is meant that the file exists in directory
 * under the primary tree.
 */
#define CMFAGPS_DOWNLOADING_FILES_IN_PACKAGE 		0x0001
/*
 * Set when downloading the files in a package.
 * This flag is set by MSG_CMFA_CONTINUE_GET_PACKAGE
 * and cleared by MSG_CMFA_FINISH_GET_PACKAGE.
 */

/*
 * INTERNAL: Status of the get-package operation in progress is kept
 *           in this field.
 */
@instance	ConnectMFAGetPackageStatus  CMFAI_getPackageStatus = 0x0000;

/*
 * Context:	INTERNAL: Completion optr and message for the get
 *			  package file action message.
 * Usage:	Used by MSG_CMFA_FILE_ACTION_FOR_GET_PACKAGE and siblings
 *		to store the completion optr and message.
 */
@instance	optr	MFAI_getPackageFileActionCompletionOptr = NullOptr;
@instance	Message	MFAI_getPackageFileActionCompletionMsg = 0;

/*
 * Context:	INTERNAL: File path of destination file during package get.
 * Usage:	This vardata is used by the get package code to store
 *		the destination file path since it modifies the
 *		MultiFileArrayEntry to download the new file into a
 *		a temporary place so we can do protocol and file name
 *		checks before moving it to its final destination.
 *		The vardata is allocated by MSG_CMFA_CONTINUE_GET_PACKAGE
 *		and deleted by MSG_CMFA_FINISH_GET_PACKAGE.
 *              See also: TEMP_CMFA_DEST_DRIVE
 */
@vardata	PathAndFileName TEMP_CMFA_DEST_FILE_PATH;

/*
 * Context:	INTERNAL: GEOS file name of new file if it's a GEOS file.
 * Usage:	This vardata is used by the get package code to store
 *		the GEOS file name of the new file if it's a GEOS file.
 *		The vardata is allocated and set by
 *		CheckForAndDealWithOverwriteConflicts and deleted
 *		by MSG_CMFA_FILE_ACTION_FOR_GET_PACKAGE_STAGE_3.
 */
@vardata	FileLongName	TEMP_CMFA_NEW_FILE_GEOS_FILE_NAME;

/*
 * Context:	INTERNAL: Package name of the package being gotten.
 * Usage:	This vardata is used by the get package code to store
 *		the package name. The vardata is allocated and set by
 *		MSG_CMFA_GET_PACKAGE or
 *		MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE. The vardata
 *		is deleted by MSG_CMFA_FINISH_GET_PACKAGE.
 *		The get package file action message uses the vardata
 *		when it puts up dialogs.
 */
@vardata	char[]	TEMP_CMFA_PACKAGE_NAME;

/*
 * Context:	INTERNAL: Package filename of the package being gotten.
 * Usage:	This vardata is used by the get package code to store
 *		the DOS package file name. The vardata is allocated and
 *		set by MSG_CMFA_GET_PACKAGE or
 *		MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE. The vardata
 *		used and deleted by MSG_CMFA_CONTINUE_GET_PACKAGE.
 */
@vardata	TCHAR[]	TEMP_CMFA_PACKAGE_FILENAME;

/*
 * Context:	INTERNAL: Absolute remote directory path with drive
 *			  specifier to package.
 * Usage:	This vardata is used by the get package code to store
 *		the remote package directory path. The vardata is
 *		allocated and set by MSG_CMFA_GET_PACKAGE or
 *		MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE. The vardata
 *		used and deleted by MSG_CMFA_CONTINUE_GET_PACKAGE.
 */
@vardata	TCHAR[]	TEMP_CMFA_REMOTE_PACKAGE_PATH;

/*
 * Context:	INTERNAL: IACP Connection token of the connection to
 *			  a document server.
 * Usage:	This vardata is used by the get package code to store
 *		the token for the connection to the document sever when
 *		it tries to gain access to a document.
 *		The vardata is allocated and set by FreeUpDestFile.
 *		The vardata used and deleted by
 *		MSG_CMFA_FILE_ACTION_FOR_GET_PACKAGE_STAGE_3.
 */
@vardata	IACPConnection	TEMP_CMFA_IACP_CONNECTION_TOKEN;

/*
 * Context:	INTERNAL: Temporary vardata storage used to pass the
 *			  ConnectTransferFlags from MSG_CMFA_GET_PACKAGE
 *			  and MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE
 *			  to MSG_CMFA_CONTINUE_GET_PACKAGE.
 *
 * Usage:	This vardata is allocated and set by the
 *		CommonGetPackageCode() routine which is called by
 *		MSG_CMFA_GET_PACKAGE and
 *		MSG_CMFA_GET_PACKAGE_GIVEN_PACKAGE_FILE.
 *		It's used and deleted by MSG_CMFA_CONTINUE_GET_PACKAGE.
 */
@vardata	ConnectTransferFlags	TEMP_CMFA_CONNECT_TRANSFER_FLAGS;

@PROTOMINOR(MemoryCardSupport);

/*
 * Context:     INTERNAL: if not using SP_TOP as the root of installed
 *              packages, the drive & path to use are stored here.
 *
 * Usage:       Allocated & set by MSG_CMFA_SET_PACKAGE_DESTINATION.
 *              Cleared when an install is complete, either sucessfuly
 *              or unsucessfuly.
 */
typedef struct {
    DiskHandle PR_drive;
#if defined (__HIGHC__)
    TCHAR       PR_path[0];
#else
    TCHAR       PR_path[];
#endif
} PackageRoot} ;

@vardata        PackageRoot     TEMP_CMFA_PACKAGE_DESTINATION;

@protoreset;

@endc	/* ConnectMultiFileActionClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Connect Settings Controller
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Notes on the ConnectSettingsControlClass:
 *
 * The ConnectSettingsControlClass stores the current connect settings
 * in the inti file. It sends itself a MSG_META_GET_INI_CATEGORY to
 * get the ini category to use when saving and reading the settings.
 * Applications will generally have ATTR_GEN_INIT_FILE_CATEGORY attr
 * in their application object specifying the category string.
 *
 * The ConnectSettingsControlClass also provides messages that the
 * application can use to get the current settings.
 */
@class  ConnectSettingsControlClass, GenControlClass ;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*
 * Bring the settings dialog on screen.
 *
 * Context:	settings dialog opening
 * Source:	any object (most likely a trigger in the application)
 * Destination:	any ConnectSettingsControl object
 * Interception:unlikely
 */
@message void MSG_CONNECT_SETTINGS_CONTROL_INITIATE_DIALOG ();

/*
 * Get the current value for a particular setting.
 *
 * These messages are used by the application to get the current settings.
 *
 * Context:	ConnectSettingsControl setting fetching
 * Source:	any object
 * Destination:	any ConnectSettingsControl object
 * Interception:unlikely
 */
@message ConnectionType
    MSG_CONNECT_SETTINGS_CONTROL_GET_CONNECTION_TYPE_SETTING    ();
@message DataGroup
    MSG_CONNECT_SETTINGS_CONTROL_GET_DATA_GROUP_SETTING    ();

#define CONNECTION_TYPE_TEXT_BUFFER_LENGTH  80

@message void
    MSG_CONNECT_SETTINGS_CONTROL_GET_CONNECTION_TYPE_TEXT    (TCHAR *buffer,
                              word bufferLength);

#define DATA_GROUP_TEXT_BUFFER_LENGTH  80

@message void
    MSG_CONNECT_SETTINGS_CONTROL_GET_DATA_GROUP_TEXT    (TCHAR *buffer,
                             word bufferLength);
/*
 * Get the entire text of the setting into a buffer referenced by a pointer.
 *	PASS:	buffer		= Pointer to the text buffer
 *		bufferLength	= length of buffer
 *
 *	Note: Use CONNECT_SETTINGS_DRIVE_LENGTH_ZT and
 *	      and CONNECT_SETTINGS_PATH_LENGTH_ZT for buffer lengths.
 */
@message void
    MSG_CONNECT_SETTINGS_CONTROL_GET_DRIVE_TEXT    (TCHAR *buffer,
                        word bufferLength);
@message void
    MSG_CONNECT_SETTINGS_CONTROL_GET_DIRECTORY_PATH_TEXT    (TCHAR *buffer,
                        word bufferLength);
@message void
    MSG_CONNECT_SETTINGS_CONTROL_GET_FILE_PATH_TEXT    (TCHAR *buffer,
                        word bufferLength);

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Internal Messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Close the settings dialog.
 *
 * Context:	settings dialog closing
 * Source:	any object (most likely the dialog's custom close trigger)
 * Destination:	any ConnectSettingsControl object
 * Interception:unlikely
 */
@message void MSG_CONNECT_SETTINGS_CONTROL_CLOSE_DIALOG ();

/*
 * Writes the current text settings to the init file.
 *
 * This message is sent by the controller to itself when the user
 * closes the controller interaction.
 *
 * Context:	ConnectSettingsControl init file setting management
 * Source:	ourself
 * Destination:	any ConnectSettingsControl object
 * Interception:unlikely
 */
@message void MSG_CONNECT_SETTINGS_CONTROL_WRITE_SETTINGS ();

/*
 * Reads the current settings from the init file and updates the
 * controller UI to display the current settings.
 *
 * If the init file does not contain an entry for the feature,
 * we check for vardata holding an app specific default value.
 *
 * This message is sent by the controller to itself when it first
 * comes up on screen.
 *
 * Context:	ConnectSettingsControl init file setting management
 * Source:	ourself
 * Destination:	any ConnectSettingsControl object
 * Interception:unlikely
 */
@message void MSG_CONNECT_SETTINGS_CONTROL_READ_SETTINGS ();

/*
 * Checks if the drive name, directory path and/or file
 * path settings are legal.
 *
 * If the CLSF_WARN flag is set, puts up an error dialog
 * for the first illegal setting it finds.
 *
 * Returns the ConnectSettingsControlFeatures flag of the
 * first illegal setting it finds or NULL if no settings
 * are illegal.
 *
 * Context:	ConnectSettingsControl legal settings checking
 * Source:	ourself
 * Destination:	any ConnectSettingsControl object
 * Interception:unlikely
 */
typedef ByteFlags CheckLegalSettingsFlags ;
#define    CLSF_WARN     		0x01
/* If set, display a dialog for illegal settings. */

@message ConnectSettingsControlFeatures
    MSG_CONNECT_SETTINGS_CONTROL_CHECK_LEGAL_SETTINGS
    (CheckLegalSettingsFlags flags);

/*
 * Save the current settings of the connectiion type and
 * data group GenItemGroups to the init file.
 *
 * Context:	ConnectSettingsControl init file setting management
 * Source:	ourself
 * Destination:	any ConnectSettingsControl object
 * Interception:unlikely
 */
@message void MSG_CONNECT_SETTINGS_CONTROL_SAVE_GIG_SETTINGS ();

@PROTOMINOR(MemoryCardSupport);

/*
 * For IR and Cable this will be the same as MSG_CONNECT_SETTIGNS_CONTROL_
 * GET_DIRECTORY_PATH_TEXT, but for Memorycard,  we don't want to display
 * the entire path, just the folder name
 * PASS: bp:dx - fptr.TCHAR to the buffer
 *       cx    - buffer length (word)
 */
@message void
    MSG_CONNECT_SETTINGS_CONTROL_GET_DIRECTORY_PATH_DISPLAY_TEXT    (
    TCHAR *buffer, word bufferLength);

/*
 * Called by GenDynamicList when it needs a moniker
 * Pass: optr of the list
 *      index of selection
 * Returns: nothing
 */
@message void MSG_CONNECT_SETTINGS_CONTROL_NEED_MONIKER (optr theList = cx:dx,
                            word index = bp);

/*
 *Context: ConnectSettings Control, build list of things to display in the
 *GenDynamicList
 *Source:  ourself
 *Destination: any ConnectSettingsControl object
 *Interception: unlikely
 */
@message void MSG_CONNECT_SETTINGS_CONTROL_INIT_DYNAMIC_LIST ();

@message void MSG_CONNECT_SETTINGS_CONTROL_SAVE_CT_GIG_SETTINGS ();

@message void
    MSG_CONNECT_SETTINGS_CONTROL_GET_MEMORYCARD_FOLDER    (TCHAR *buffer,
                               word bufferLength);
@message void MSG_CONNECT_SETTINGS_CONTROL_ADD_FOLDER ();

@message void MSG_CONNECT_SETTINGS_CONTROL_DO_RENAME_FOLDER_DIALOG ();
@message void MSG_CONNECT_SETTINGS_CONTROL_RENAME_FOLDER ();

@message void MSG_CONNECT_SETTINGS_CONTROL_DELETE_FOLDER ();

@message (GEN_ITEM_GROUP_STATUS_MSG) MSG_CONNECT_SETTINGS_CONTROL_DIRS_SELECTED;

@message DestinationType
    MSG_CONNECT_SETTINGS_CONTROL_GET_DESTINATION_TYPE_SETTING    ();

#define DESTINATION_TYPE_TEXT_BUFFER_LENGTH  80

@message void
    MSG_CONNECT_SETTINGS_CONTROL_GET_DESTINATION_TYPE_TEXT    (TCHAR *buffer,
                              word bufferLength);
@protoreset;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Vardata
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*
 * Help file for this controller object.  If this is not present then GenClass
 * queries up the tree.
 * eg:
 * ATTR_CONNECT_SETTINGS_CONTROL_HELP_FILE {
 *      char "contax  ", 0
 * }
 */
@vardata char[] ATTR_CONNECT_SETTINGS_CONTROL_HELP_FILE;

/*
 * Specifies the help context for this controller object.
 * eg:
 * ATTR_CONNECT_SETTINGS_CONTROL_HELP_CONTEXT {
 *      char "Settings", 0
 * }
 * Placed on an object of GenControlClass windowed GenInteraction,
 * although it doesn't have to be.
 */
@vardata char[] ATTR_CONNECT_SETTINGS_CONTROL_HELP_CONTEXT;

/*
 * VArdata to hold default settings.
 *
 * If the app wants to provide a default setting, it should add the
 * appropriate ATTR to it's ConnectSettingsControl object.
 */
@vardata ConnectionType	ATTR_CONNECT_SETTINGS_CONTROL_DEFAULT_CONNECTION_TYPE;
@vardata DataGroup ATTR_CONNECT_SETTINGS_CONTROL_DEFAULT_DATA_GROUP;
/* FIXME: These should be using TCHAR[] but GOC produces invalid objects if
   TCHAR[] is used and a statically defined object contains the vardata.
   See goc bug #48345 */
@vardata char[] ATTR_CONNECT_SETTINGS_CONTROL_DEFAULT_DRIVE;
@vardata char[] ATTR_CONNECT_SETTINGS_CONTROL_DEFAULT_DIRECTORY_PATH;
@vardata char[] ATTR_CONNECT_SETTINGS_CONTROL_DEFAULT_FILE_PATH;

@PROTOMINOR(MemoryCardSupport);
@vardata char[] ATTR_CONNECT_SETTINGS_CONTROL_DEFAULT_MEMORYCARD_DIR;

/* chunk array of dir names */
@vardata optr   TEMP_CONNECT_SETTINGS_CONTROL_DIR_ARRAY;

@vardata DestinationType ATTR_CONNECT_SETTINGS_CONTROL_DEFAULT_DESTINATION_TYPE;
@protoreset;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Instance data and defaults
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

typedef ByteFlags ConnectSettingsControllerMiscFlags ;

#define	CSCMF_GENERATING_UI			0x01
/* Set when the settings controller is generating its UI.
   Set and cleared by our subclass of MSG_GEN_CONTROL_GENERATE_UI.
   If this flag is set, we can ignore the apply messages sent by the
   GenItemGroups and not save thier settings to the init file. */

/*
 * Context:	Miscellaneous flags.
 * Usage:	INTERNAL
 */
@instance	ConnectSettingsControllerMiscFlags  CSCI_miscFlags = 0x00;

/*
 * Context:	Title of the settings dialog.
 * Usage:	When the settings dialog is built, this text chunk is
 *		used to set its complex moniker.
 */
@instance	ChunkHandle	CSCI_dialogTitle = NullChunk;

/*
 * Context:	Settings changed notification mechanism.
 * Usage:	If the app has a ConnectSettingsDisplay controller that is
 *		displaying the settings set by this controller, this
 *		optr shouild be set to that ConnectSettingsDisplay
 *		controller so it gets send a
 *		MSG_CONNECT_SETTINGS_DISPLAY_CONTROL_UPDATE_UI when
 *		our setting dialog closes.
 */
@instance	optr	CSCI_settingsDisplayController = NullOptr;

/***********************************************************************
 *              Feature Sets
 ***********************************************************************/
typedef WordFlags ConnectSettingsControlFeatures ;
#define CSCF_DESTINATION 	0x0080
#define CSCF_MEMORYCARD_PATH     0x0040
#define CSCF_MEMORY_CARD         0x0020
#define CSCF_CONNECTION_TYPE 	0x0010
#define CSCF_DATA_GROUP 		0x0008
#define CSCF_DRIVE 		0x0004
#define CSCF_DIRECTORY_PATH 	0x0002
#define CSCF_FILE_PATH 		0x0001

#define CSC_DEFAULT_FEATURES  (CSCF_CONNECTION_TYPE | CSCF_DATA_GROUP | \
                  CSCF_DRIVE | CSCF_DIRECTORY_PATH | \
                  CSCF_FILE_PATH)

/* NOTE: This controller has no toolbox features. */

@endc	/* ConnectSettingsControlClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Connect Settings Display Controller
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Notes on the ConnectSettingsDisplayControlClass:
 *
 * The ConnectSettingsDisplayControlClass is used to display the current
 * connect settings. It will be used in the main screens of the Responder
 * Connectivity Applications.
 */
@class  ConnectSettingsDisplayControlClass, GenControlClass ;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Fetch the current connect settings from the ConnectSettings controller
 * and update our UI to display them.
 *
 * Context:	settings update
 * Source:	any object (probably either ourself or a ConnectSettings
 *		controller)
 * Destination:	any ConnectSettingsDisplayControl object
 * Interception:unlikely
 */
@message void MSG_CONNECT_SETTINGS_DISPLAY_CONTROL_UPDATE_UI ();

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Vardata
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * If present,  it won't show the path if the connection type is Memory Card
 */
@vardata void HINT_CONNECT_SETTINGS_DISPLAY_DONT_SHOW_MEMORY_CARD_PATH;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Instance data and defaults
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@default	GI_states = (@default) | GS_ENABLED;

/*
 * Context:	settings update mechanism
 * Usage:	This is the optr of the ConnectSettings controller which
 *		sets the settings that we are displaying. The default
 *		MSG_CONNECT_SETTINGS_DISPLAY_CONTROL_UPDATE_UI handler
 *		uses this optr to fetch the current connect settings.
 */
@instance	optr	CSDCI_settingsController = NullOptr;

/***********************************************************************
 *              Feature Sets
 ***********************************************************************/
typedef WordFlags ConnectSettingsDisplayControlFeatures ;
#define CSDCF_DESTINATION 	0x0020
#define CSDCF_CONNECTION_TYPE 	0x0010
#define CSDCF_DATA_GROUP 	0x0008
#define CSDCF_DRIVE 		0x0004
#define CSDCF_DIRECTORY_PATH 	0x0002
#define CSDCF_FILE_PATH 		0x0001

#define CSDC_DEFAULT_FEATURES  (CSDCF_CONNECTION_TYPE | CSDCF_DATA_GROUP | \
                  CSDCF_DRIVE | CSDCF_DIRECTORY_PATH | \
                  CSDCF_FILE_PATH)

/* NOTE: This controller has no toolbox features. */

@endc	/* ConnectSettingsDisplayControlClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Connect Progress Dialog
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*
 * Notes on the ConnectProgressDialogClass
 *
 * This is what a progress dialog looks like.
 *
 *	 --------------------------------------------------------
 *	 |<text describing what is happening>            	|
 *	 |                                               	|
 *	 |             <xxx bytes transfered.>			|
 *	 |                     or                          	|
 *	 |          <xxx bytes of yyy transfered.>		|
 *	 |                                               	|
 *	 |                   <bitmap>                    	|
 *	 |                                               Cancel	|
 *	 --------------------------------------------------------
 *
 * Here is a sample usage of a progress dialog:
 *
 * dialog = ConnectCreateProgressDialog(cancellationOptr, cancellationMsg);
 *
 * Use MSG_FOAM_PROGRESS_DIALOG_*_DESCRIPTION_TEXT* messages to set
 * the description text.
 *
 * @call dialog::
 *   MSG_CONNECT_PROGRESS_DIALOG_INITIATE_DIALOG(ConnectProgressDialogFlags);
 *
 * Use the connect object to do some file transfer operations, and the
 * connect object will automatically update the progress dialog with
 * the current byte count.
 *
 * @call connectObject::MSG_CONNECT_GET_FILE(..., dialog, ...);
 * [...]
 * @call connectObject::MSG_CONNECT_GET_FILE(..., dialog, ...);
 *
 * @call dialog::MSG_CONNECT_PROGRESS_DIALOG_DISMISS_DIALOG();
 * @call dialog::MSG_CONNECT_PROGRESS_DIALOG_DESTROY_DIALOG();
 *
 */
@class  ConnectProgressDialogClass, FoamProgressDialogClass ;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

typedef ByteFlags ConnectProgressDialogFlags  ;

#define CPDF_INHIBIT_CANCELLATION 		0x10
/* Internal only: Set if pressing the cancel trigger should not result in
   cancellation immediately, but when MSG_CONNECT_PROGRESS_DIALOG_RESUME_
   CANCEL is sent. */

#define	CPDF_IGNORE_STATUS_UPDATES			0x08
/* Set to leave the status text the same, regardless of updates from
   MSG_CONNECT_PROGRESS_DIALOG_REPORT_PROGRESS.
   This flag does not prevent the status text from being reset with
   MSG_FOAM_PROGRESS_DIALOG_SET_STATUS_TEXT. */

#define	CPDF_CANCELLING					0x04
/* Set if the operation is being cancelled. */

#define	CPDF_DISPLAY_TOTAL_TRANSFER_SIZE		0x02
/* Set if the total transfer size should be displayed
   in the status string. */

#define	CPDF_DISPLAY_CUMULATIVE_BYTE_TALLY		0x01
/* Set if the progress dialog should display the cumulative
   tally of bytes for all files transfered since the progress
   dialog was initiated. */

/*
 * Initiate the progress dialog.
 *
 * Context:	progress dialog initiation
 * Source:	any object
 * Destination:	any ConnectProgressDialog object
 * Interception:unlikely
 */
@message void
MSG_CONNECT_PROGRESS_DIALOG_INITIATE_DIALOG(ConnectProgressDialogFlags flags);

/*
 * Dismiss the progress dialog.  Has no effect if dialog has already
 * been dismissed, i.e., the user cancelled the operation.
 *
 * Context:	progress dialog dismissal
 * Source:	any object
 * Destination:	any ConnectProgressDialog object
 * Interception:unlikely
 */
@message void MSG_CONNECT_PROGRESS_DIALOG_DISMISS_DIALOG ();

/*
 * Destroy the progress dialog.
 *
 * Context:	progress dialog management
 * Source:	any object
 * Destination:	any ConnectProgressDialog object
 * Interception:unlikely
 */
@message void MSG_CONNECT_PROGRESS_DIALOG_DESTROY_DIALOG ();

/*
 * Set the total transfer size.
 *
 * If the CPDF_DISPLAY_TOTAL_TRANSFER_SIZE flag is set, the
 * status string will be displayed as
 * "xxx bytes of <total transfer size>".
 *
 * Context:     progress dialog management
 * Source:      any object
 * Destination:	any ConnectProgressDialog object
 * Interception:unlikely
 */
@message void MSG_CONNECT_PROGRESS_DIALOG_SET_TRANSFER_SIZE (dword size);

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Internal Messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Connect Progress Types
 */
typedef enum {
    CPT_BYTE_COUNT    ,
} ConnectProgressType} ;

/*
 * Update the progress status, unless CPDF_IGNORE_STATUS_UPDATES is
 * set in CPDI_flags.
 *
 * If CPDF_DISPLAY_CUMULATIVE_BYTE_TALLY is set and the ConnectProgressType
 * is CPT_BYTE_COUNT, the displayed byte count is the cumulative tally
 * of bytes for all files transfered since the progress dialog was initiated.
 *
 *
 * Context:	progress dialog status update
 * Source:	any object (usually the Connect object doing the file transfer)
 * Destination:	any ConnectProgressDialogClass object
 * Interception:unlikely
 */
@message void
MSG_CONNECT_PROGRESS_DIALOG_REPORT_PROGRESS(ConnectProgressType type,
                                            dword data);

/*
 * Tell the progress dialog that a new file is being sent.
 * Used to keep the cumulative byte tally.
 * Sent by the connect object.
 *
 * Right now the dataBlock handle is always null but in the future it might
 * hold the handle of a block containing the name of the new file being
 * transfered.
 */
@message void
MSG_CONNECT_PROGRESS_DIALOG_STARTING_NEW_FILE(MemHandle dataBlock);

/*
 * Tell the progress dialog to cancel the operation.
 * Sent by the progress dialog itself when its cancel trigger is hit.
 */
@message void
MSG_CONNECT_PROGRESS_DIALOG_CANCEL();

/*
 * Message prototype for cancellation message sent from
 * MSG_CONNECT_PROGRESS_DIALOG_CANCEL after internal cancellation
 * matters have been handled.
 */
@prototype void CONNECT_PROGRESS_DIALOG_CANCELLATION_MSG ();

/*
 * Set the cancellation action, if any, to take in the course of
 * handling MSG_CONNECT_PROGRESS_DIALOG_CANCEL.
 */
@message void
MSG_CONNECT_PROGRESS_DIALOG_SET_CANCEL_ACTION(optr cancellationOptr,
                          Message cancellationMsg);

/*
 * Get the ConnectProgressDialogFlags stored in CPDI_flags.
 */
@message ConnectProgressDialogFlags
MSG_CONNECT_PROGRESS_DIALOG_GET_FLAGS();

/*
 *  Allow the app to guarantee that the user cannot cancel during some
 *  section of code, returning the current flags, so that the cancel
 *  status can be tested.
 */
@message ConnectProgressDialogFlags
MSG_CONNECT_PROGRESS_DIALOG_SUSPEND_CANCEL();

/*
 * Allow cancels to be sent from the progress dialog again.  If
 * Cancel was pressed since the call to SUSPEND_CANCEL, it will occurr
 * at this time.
 */
@message void
MSG_CONNECT_PROGRESS_DIALOG_RESUME_CANCEL();

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Instance data and defaults
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Context:	flag storage
 * Usage:
 */
@instance	ConnectProgressDialogFlags	CPDI_flags;

/*
 * Context:	Cumulative tally of bytes for all files transfered
 *		since the progress dialog was initiated, not including
 *		the current file.
 * Usage:
 */
@instance	dword	CPDI_cumulativeTally;

/*
 * Context:	bytes transferred so far for the current file
 * Usage:
 */
@instance	dword	CPDI_bytesCurrentFile;

/*
 * Context:	Total transfer size used in the status string
 *		if the CPDF_DISPLAY_TOTAL_TRANSFER_SIZE flag
 *		is set.
 * Usage:	Set by MSG_CONNECT_PROGRESS_DIALOG_SET_TRANSFER_SIZE.
 *
 */
@instance       dword   CPDI_transferSize = 0;

/*
 * Context:	CPDI_cancellationOptr and CPDI_cancellationMsg store the AD
 * 		specified by the creator of the progress dialog to send on
 *		cancellation.
 * Usage:	Sent by handler for MSG_CONNECT_PROGRESS_DIALOG_CANCEL
 *		after CPDF_CANCELLING has first been set in CPDI_flags.
 */
@instance	optr		CPDI_cancellationOptr = NullOptr;
@instance	Message		CPDI_cancellationMsg = 0;

/*
 * Context:     CPDI_cancelDialog stores a dialog which notifies
 *              that operation is being cancelled.  When the user
 *              presses cancel, this dialog comes up.
 * Usage:       In MSG_CONNECT_PROGRESS_CANCEL, this dialog is created
 *              and displayed.  In MSG_CONNECT_PROGRESS_DIALOG_DESTROY_DIALOG,
 *              this dialog is nuked.
 */
@instance       optr            CPDI_cancelDialog = 0;

@endc	/* ConnectProgressDialogClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        ConnectSubApplicationClass

This class should be used for applications that are using a
Connect object. It provides a mechanism for delaying the
application from detaching if there is a connect operation in
progress when the application is asked to detach.

Note that ConnectSubApplicationClass is a subclass of the
FoamSubApplicationClass so it is not appropriate for applications
that should not use the FoamSubApplicationClass.

The application needs to follow these steps:

1) Use the ConnectSubApplicationClass.

2) Set the CSAI_connectObj instance data to the optr of the
application's connect object.

3) Call the application with
MSG_CSA_SET_FLAGS(CSAF_WAITING_FOR_COMPLETION_MSG, NULL) right before
sending the connect object a message starting a connect operation.

Have the completion message do the following:
4) Call the application with MSG_CSA_SET_FLAGS(NULL,
CSAF_WAITING_FOR_COMPLETION_MSG) at the start of the
completion message handler.

7) Check the ConnectSubApplicationFlags returned by MSG_CSA_SET_FLAGS
and if the application is waiting to continue a detach, don't put up
any dialogs.

8) If the application is waiting to continue a detach, send the application
a MSG_CSA_CONTINUE_DETACH at the end of the completion message handler.

Example completion message handler:
{
    ConnectSubApplicationFlags csaFlags;

    * The completion message is being handled, so clear the
    * CSAF_WAITING_FOR_COMPLETION_MSG flag. This needs to be done
    * at the start of the completion message handler.
    *
    * At the same time, get the current ConnectSubApplicationFlags
    * so we can check if the application object is waiting to continue
    * an application detach when we're done handling the completion
    * message.
    csaFlags = @call app::
    MSG_CSA_SET_FLAGS(NULL, CSAF_WAITING_FOR_COMPLETION_MSG);

    if (!(csaFlags & CSAF_WAITING_TO_DETACH)) {
     * Code that should only be executed if we're not about to
     * detach. For example: putting up error dialogs.
    [insert code here]
    }

     * Code that should be executed even if we're about to detach.
     * For example: Freeing memory, deleting temp files, etc.
    [insert code here]

     * If the app is waiting to detach, tell it to continue the detach.
     * This needs to be at the end of the completion message handler.
    if (csaFlags & CSAF_WAITING_TO_DETACH) {
    @send app::MSG_CSA_CONTINUE_DETACH();
    }
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@class  ConnectSubApplicationClass, FoamSubApplicationClass;

typedef ByteFlags	ConnectSubApplicationFlags	;
#define	CSAF_WAITING_TO_DETACH				0x02
/* This flag is set if the application has received a MSG_META_DETACH
 * and is waiting for the completion message to send it a
 * MSG_CSA_CONTINUE_DETACH before continuing the application detach.
 */

#define	CSAF_WAITING_FOR_COMPLETION_MSG			0x01
/* This flag is set if the application has started a connect operation
 * but has not yet received and handled the completion message for the
 * operation.
 */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * MSG_CSA_GET_FLAGS
 *
 * Desc:	Get the current ConnectSubApplicationFlags.
 *
 * Context:	ConnectSubApplicationClass flags
 * Source:	any object
 * Destination:	any ConnectSubApplicationClass object
 * Interception:unlikely
 *
 * Pass:	nothing
 * Return:	ConnectSubApplicationFlags - current flags
 */
@message ConnectSubApplicationFlags MSG_CSA_GET_FLAGS ();

/*
 * MSG_CSA_SET_FLAGS
 *
 * Desc:	Set and clear some ConnectSubApplicationFlags.
 *
 * Context:	ConnectSubApplicationClass flags
 * Source:	any object
 * Destination:	any ConnectSubApplicationClass object
 * Interception:unlikely
 *
 * Pass:	flagsToSet	- ConnectMultiFileActionClass flags to set
 *		flagsToClear	- ConnectMultiFileActionClass flags to clear
 * Return:	ConnectSubApplicationFlags - current flags after the
 *					     requested flags have been
 *					     set and cleared.
 */
@message ConnectSubApplicationFlags \
    MSG_CSA_SET_FLAGS    (ConnectSubApplicationFlags flagsToSet,
              ConnectSubApplicationFlags flagsToClear);

/*
 * MSG_CSA_CONTINUE_DETACH
 *
 * Desc:	Continues the application detach by sending the superclass
 *		a MSG_META_DETACH.
 *
 * Context:	mechanism to delay application detach
 * Source:	the ConnectSubApplicationClass MSG_META_DETACH handler or
 *		one of the application's connect completion message handlers
 * Destination:	any ConnectMultiFileActionClass object
 * Interception:This message should be intercepted if the application needs
 *		to do anything before the application really detaches.
 *		Here is a good place to prepare for the lazarus case.
 */
@message void	MSG_CSA_CONTINUE_DETACH	();

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Instance data and defaults
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Context:	ConnectSubApplicationClass flags
 * Usage:	The flags can be set with MSG_CSA_SET_FLAGS and
 *		retrieved with MSG_CSA_GET_FLAGS.
 */
@instance	ConnectSubApplicationFlags	CSAI_flags = 0x00;

/*
 * Context:	mechanism to delay application detach
 * Usage:	Contains the optr of the connect object to which to send a
 *		MSG_CONNECT_CANCEL_TRANSFER if there is an operation in
 *		progress when the ConnectSubApplicationClass receives
 *		a MSG_META_DETACH.
 *
 *		Assuming the application has one static connect object,
 *		this instance data should be set in the application
 *		object declaration.
 */
@instance	optr		CSAI_connectObj = NullOptr;

/*
 * Context:	mechanism to delay application detach
 * Usage:	This vardata is used to store the callerID and ackOD
 *		passed with MSG_META_DETACH to ConnectSubApplicationClass.
 *		The vardata is later used and deleted by the
 *		ConnectSubApplicationClass MSG_CSA_CONTINUE_DETACH handler
 *		when it sends a MSG_META_DETACH to our superclass to
 *		continue the detach.
 */
typedef	struct {
    word	CSADD_callerID;
    optr	CSADD_ackOD;
} ConnectSubAppDetachData} ;
@vardata	ConnectSubAppDetachData	TEMP_CONNECT_SUB_APP_DETACH_DATA;

@endc	/* ConnectSubApplicationClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
          Exported functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Desc:	Create a basic progress dialog using UserCreateDialog,
 *		and set the cancellation action to be taken by
 *		MSG_CONNECT_PROGRESS_DIALOG_CANCEL.
 *
 *		Generally, set the cancellationOptr to the Connect
 *              object and the cancellationMsg to
 *		MSG_CONNECT_CANCEL_TRANSFER.
 *
 * Return: 	optr of created dialog or NULL if couldn't create dialog.
 */
extern optr _cdecl
ConnectCreateProgressDialog(optr cancellationOptr, Message cancellationMsg);

/*
 * Desc:	Create a subclassed progress dialog using UserCreateDialog,
 *		and set the cancellation action to be taken by
 *		MSG_CONNECT_PROGRESS_DIALOG_CANCEL.
 *
 *		Generally, set the cancellationOptr to the Connect
 *              object and the cancellationMsg to
 *		MSG_CONNECT_CANCEL_TRANSFER.
 *
 * Return: 	optr of created dialog or NULL if couldn't create dialog.
 */
extern optr _cdecl
ConnectCreateProgressDialogFromTemplate(optr progressDialogTemplate,
                    optr cancellationOptr,
                    Message cancellationMsg);

/*
 * SYNOPSIS:	Put up a standard Connect dialog box.
 */
extern InteractionCommand _cdecl ConnectDoStandardDialog (
                   ConnectStandardDialogBoxType dialogType,
                   TCHAR *arg1,
                   TCHAR *arg2);

/*
 * SYNOPSIS:	Put up a standard Connect dialog box, unless the connectObj
 *              has the ATTR_CONNECT_NO_USER_INTERACTION vardata.  In that
 *              case, a default InteractionCommand will be returned
 *              for the dialog type, as if it had been displayed,
 *              and the user reacted.
 */
extern InteractionCommand _cdecl ConnectMaybeDoStandardDialog (
                   ConnectStandardDialogBoxType dialogType,
                   TCHAR *arg1,
                   TCHAR *arg2,
                                   optr connectObj);

/*
 * Desc:	Set the server's current directory.
 *
 *		The path may be relative to the server's current
 *		directory or absolute with a drive specification.
 *
 *		For example: a relative path would be "temp\dir1"
 *			     an absolute path would be "c:\foo\temp\dir1"
 *			     "a:" goes to the root dir of the A drive
 */
extern ConnectError _cdecl ConnectSetServerPath (TCHAR *path);

/*
 * Desc:	Get the server's current path.
 *
 *		The server's absolute path with drive specifier is
 *		copied into the buffer.
 *
 *		The buffer must be PATH_BUFFER_SIZE.
 */
extern ConnectError _cdecl ConnectGetServerPath (TCHAR *buffer);

/*
 * Desc:	Tell the server to display its current absolute
 *		directory path.
 *
 * Return: 	ConnectError
 */
extern ConnectError _cdecl ConnectDisplayServerPath (void);

/*
 * Desc:	Fill the passed buffer with the requested information.
 *
 *		pkgArray = optr of locked chunk array. Each entry is a
 *                         PackageDescriptorArrayEntry.
 *              n        = index of element about which to get info
 *              pddt     = PackageDescriptorDataType: kind of info desired
 *              retBuf   = buffer in which to return requested info
 *              bufLength   = number of chars (not bytes) to read into retBuf,
 *                            BUT the last position is nulled.  (If data is
 *                            less than bufLength chars, then the extra space
 *                            is null padded.)
 *
 *
 */
extern ConnectError _cdecl
ConnectGetPackageDescriptorData(optr pkgDescArray, word n,
                PackageDescriptorDataType pddt,
                TCHAR *retBuf, word bufLength );

/*
 * Desc:	Abridge the path so it fits in the passed number of
 *		points minus the width of the includedInWidth string, if any. ""
 *
 *		includedInWidth is a pointer to a string whose width ""
 *		will be subtracted from the maxWidth before the path
 *		is abridged. includedInWidth may be NULL. ""
 *
 *		The includedInWidth argument is useful for cases where you ""
 *		know the total width available for a string like
 *		"to <file path>" and want to abridge the file path to fit
 *		in the total width minus the width of the "to " sub-string.
 *
 *		Pass 0 for the fontID and/or pointSize to use the
 *		default (whatever that is).
 */
extern void _cdecl
ConnectAbridgePath(char *thePath, word maxWidth,
           char *includedInWidth, ""
           FontID fontID, WWFixedAsDWord pointSize);

/*
 * Desc:	Check if the passed string is a legal DOS drive name.
 *
 *		Legal drive names look like "X:" or "X:\", where X is
 *		an upper or lower case letter between A and Z.
 *
 * Return: 	ConnectCheckLegalError -
 *			CCLE_LEGAL
 *			CCLE_STRING_NULL
 *			CCLE_STRING_TOO_LONG
 *			CCLE_ONE_LETTER_DRIVE_NAME
 *			CCLE_ILLEGAL_DOS_DRIVE_NAME
 */
extern ConnectCheckLegalError _cdecl
ConnectCheckLegalDosDriveName (const TCHAR *driveName);

/*
 * Desc:	Check if the passed string is a legal absolute DOS
 *		directory path.
 *
 *              "." and ".." may appear in the directory path.
 *
 *		Note: This routine does not check if the characters
 *		      are legal DOS path characters.
 *
 * Return: 	ConnectCheckLegalError -
 *			CCLE_LEGAL
 *			CCLE_STRING_NULL
 *			CCLE_STRING_TOO_LONG
 *			CCLE_ONE_LETTER_DRIVE_NAME
 *			CCLE_ILLEGAL_DOS_DRIVE_NAME
 *			CCLE_DOS_DEVICE_NAME_CONFLICT
 *			CCLE_ILLEGAL_DOS_DIR_PATH
 */
extern ConnectCheckLegalError _cdecl
ConnectCheckLegalDosDirPath (const TCHAR *dirPath);

/*
 * Desc:	Check if the passed string is a legal absolute DOS
 *		file path.
 *
 *              "." and ".." may appear in the file path.
 *		Note: This routine does not check if the characters
 *		      are legal DOS path characters.
 *
 * Return: 	ConnectCheckLegalError -
 *			CCLE_LEGAL
 *			CCLE_STRING_NULL
 *			CCLE_STRING_TOO_LONG
 *			CCLE_ILLEGAL_DOS_DRIVE_NAME
 *			CCLE_DOS_DEVICE_NAME_CONFLICT
 *			CCLE_ILLEGAL_DOS_FILE_NAME
 *			CCLE_ILLEGAL_DOS_FILE_PATH
 */
extern ConnectCheckLegalError _cdecl
ConnectCheckLegalDosFilePath (TCHAR *filePath);

/*
 * Desc:	Check if the passed string is a legal DOS file name.
 *
 *		Note: This routine does not check if the characters
 *		      are legal DOS file name characters.
 *
 * Return: 	ConnectCheckLegalError -
 *			CCLE_LEGAL
 *			CCLE_STRING_NULL
 *			CCLE_STRING_TOO_LONG
 *			CCLE_DOS_DEVICE_NAME_CONFLICT
 *			CCLE_ILLEGAL_DOS_FILE_NAME
 */
extern ConnectCheckLegalError _cdecl
ConnectCheckLegalDosFileName (const TCHAR *fileName);

/*
 * Desc:        Creates the passed path on the server, if the path
 *              does not exist.
 */
ConnectError _cdecl
ConnectCreatePathOnServer (TCHAR *serverPath);

/*
 * Desc:        Routine called in completion messages.  Puts up a warning
 *              or error dialog if:
 *               - the passed error message is CE_NOT_ENOUGH_DISK_SPACE
 *                 _TO_{START,COMPLETE}, as returned by
 *		   MSG_CONNECT_(GET|SEND)_FILE or MSG_CMFA_GET_PACKAGE.
 *               - the amount of space left (after a successful transfer)
 *                 is below the warning or critical level.
 *              Returns TRUE if warning/error dialog was displayed.
 */

Boolean _cdecl
ConnectWarnIfOutOfSpace ( ConnectError error );

/* Desc:         Same as ConnectWarnIfOutOfSpace, unless the connectObj
 *               has the ATTR_CONNECT_NO_USER_INTERACTION vardata.
 *               TRUE or FALSE will be returned under the same
 *               circumstances as ConnectWarnIfOutOfSpace would.
 */

Boolean _cdecl
ConnectMaybeWarnIfOutOfSpace (ConnectError error, optr connectObj);

/* Desc:        Same as ConnectWarnIfOutOfSpace, except that it checks
 *              for free space on the passed disk.

Boolean _cdecl
ConnectWarnIfOutOfSpaceOnDisk(ConnectError error, DiskHandle diskHan);

/*
 * Desc:        The following routines will retrieve the geode handle
 *              given the long name.
 *              If CE_SUCCESS is returned, then geodeHan is the GeodeHandle of
 *              the first-found running geode of specified name, or NullHandle
 *              if geode not found running.
 *              CE_MISC_FILE_ERROR returned if some error occurred while trying
 *              to find the geode.
 */
extern ConnectError _far _pascal
ConnectGeodeFindFromLongName( const char _far *name,
                  GeodeAttrs attrMatch,
                  GeodeAttrs attrNoMatch,
                  GeodeHandle _far *geodeHan);

/*
 * Desc:        Play custom sound with UserStandardSound
 */
extern void
_far _pascal ConnectPlaySound ( ConnectSoundType soundToPlay );

/*
 * Desc: 	Maps PCComFullReturnType to ConnectError.  The
 * 		default error code is used when the mapping fails.
 *	    	Okay to pass PCCRT_NO_ERROR.
 *
 */
extern ConnectError _cdecl
ConnectMapPCCFRTToConnectError( ConnectError defaultErr,
                    PCComFullReturnType pccomErr );

/*
 * Desc:        Displays an abort error message in the following format:
 *			"[Error msg body] [arg][ - reason str]!"
 *			eg. "Cannot copy to file foo.txt - file is read-only!"
 *              The error message body is determined by dbType.
 *		The reason string is determined by error.
 */
extern InteractionCommand _cdecl
ConnectDoStandardDialogWithReason( ConnectError error,
                   ConnectStandardDialogBoxType dbType,
                   TCHAR *arg );

/*
 * Desc:	Displays error dialogs for common case ConnectErrors,
 *		that is, ConnectErrors with the CE_DIALOG_DISPLAYED
 *		bit set.
 *
 *	These are the cases that the dialog will be displayed. "*" means
 *	the argument passed in isn't important.
 *
 *	ConnectError			arg1			arg2
 *	-----------			----			----
 *	CE_CANNOT_TRANSLATE_FILE	*			*
 *	CE_OPERATION_ABORTED		*			*
 *	CE_REMOTE_OPERATION_ABORTED	*			*
 *	CE_CONNECTION_LOST		*			*
 *	CE_PATH_NOT_FOUND		dir path w/o filename	*
 *	CE_REMOTE_PATH_NOT_FOUND	dir path w/o filename	*
 *	CE_DRIVE_INVALID		arg1[0] = drive letter	*
 *	CE_REMOTE_DRIVE_INVALID		arg1[0] = drive letter	*
 *	CE_REMOTE_VOLUME_UNAVAILABLE	arg1[0] = drive letter	*
 *	CE_CANNOT_CREATE_DIRECTORY	dir path w/o filename	*
 *	CE_REMOTE_NOT_ENOUGH...COMPLETE	   *			*
 *	CE_SOURCE_FILE_OPEN_BY_ANOTHER_APP file name or file path *
 *	CE_DEST_FILE_OPEN_BY_ANOTHER_APP   file name or file path *
 *	CE_PACKAGE_OLD_SO_NOT_INSTALLED package name		*
 *	CE_PACKAGE_NOT_COMPATIBLE	package name		*
 *	CE_CANNOT_USE_INSTALL_BATCH_
 *	 FILE_FOR_MORE_THAN_ONE_INSTALL	*			*
 *
 * Return: 	TRUE - if a dialog was displayed.
 */
extern Boolean _cdecl
ConnectDoStandardErrorDialog( ConnectError error, TCHAR *arg1, TCHAR *arg2 );

/*
 * SYNOPSIS: Same as ConnectDoStandardErrorDialog(), unless the
 *              connectObj has the ATTR_CONNECT_NO_USER_INTERACTION
 *              vardata.  Even though the dialog will not actually
 *              be displayed, TRUE/FALSE will be returned under the same
 *              circumstances as ConnectDoStandardDialog would.
 */
extern Boolean _cdecl
ConnectMaybeDoStandardErrorDialog( ConnectError error,
                                   TCHAR *arg1, TCHAR *arg2,
                                   optr connectObj);

/*
 * Desc:	Prevents the keys F5-F12 from launching an app.
 */
extern void _far _pascal
ConnectDisableAppLaunchKeys(ConnectDisableAppLaunchKeysMonitor *monitor);

/*
 * Desc:	Allows the keys F5-F12 to launch apps again, after
 *		having called ConnectDisableAppLaunchKeys().
 * Pass:	Pointer to same monitor you passed to
 *		ConnectDisableAppLaunchKeys().
 */
extern void _far _pascal
ConnectEnableAppLaunchKeys(ConnectDisableAppLaunchKeysMonitor *monitor);

/*-------------------------------------------------------------------------
 *   Any API below this line is not available for Communicator devices
 *   shipped before January 1997.  (pragmas excluded)
 *-----------------------------------------------------------------------*/

/*
 * Desc:        Compress/Decompress the source file into the
 *              destination file.
 *
 * Pass:        source & destination file handles
 *
 * Return:      number of bytes written out (0 if error)
 */

extern word _far _pascal
ConnectCompressFile (FileHandle srcFileHan, FileHandle destFileHan);

extern word _far _pascal
ConnectDecompressFile (FileHandle srcFileHan, FileHandle destFileHan);

extern ConnectError _cdecl
ConnectGetFreeSpace (dword *driveSpace, word driveLetter, dword localSize);
/*
 * returns free space on the server or Memorycard, depending on connection
 * type
 */

extern word _cdecl
ConnectFileEnum (FileEnumParams *params, MemHandle *bufCreated,
         word *numNoFit);
/*
 * enumerate files on server or memory card
 */

extern ConnectError _cdecl
ConnectGetFileSize (dword *fileSize, char *fileName);
/*
 * Get size of passed file
 */

extern ConnectError _cdecl
ConnectRemark (ConnectError error, TCHAR *actionString);
/*
 * If serial or IR connection call PCComRemark
 */

extern void _cdecl
ConnectValidateIniPathSettings(TCHAR *fname);
/* validate the ini path settings in the passed file is the right one
 * for the N9110
 */
#ifdef __HIGHC__
pragma Alias(ConnectGeodeFindFromLongName, "CONNECTGEODEFINDFROMLONGNAME");
pragma Alias(ConnectPlaySound, "CONNECTPLAYSOUND");
pragma Alias(ConnectDisableAppLaunchKeys, "CONNECTDISABLEAPPLAUNCHKEYS");
pragma Alias(ConnectEnableAppLaunchKeys, "CONNECTENABLEAPPLAUNCHKEYS");
pragma Alias(ConnectCompressFile, "CONNECTCOMPRESSFILE");
pragma Alias(ConnectDecompressFile, "CONNECTDECOMPRESSFILE");
#endif /* __HIGHC__ */

@endlib /* connect */

@endif /* __CONNECT_GOH */


contdb.goh

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1994,1995 -- All Rights Reserved
 *			GEOWORKS CONFIDENTIAL
 *
 * PROJECT:	Foam
 * FILE:	contdb.h
 *
 *
 * REVISION HISTORY:
 *
 *	Name	Date		Description
 *	----	----		-----------
 *	atw	11/10/94	Initial revision
 *	kho	3/2/95		ContactGetUserDataID added
 *	ss	7/11/95		added messages/vardata to
 *				ContactEditClass
 *
 *
 * DESCRIPTION:
 *	Contains equates, etc for the contdb library
 *
 *	$Id: contdb.goh,v 1.45.1.55 98/08/07 15:09:05 mevissen Exp $
 *
 ***********************************************************************/

#ifndef	__CONTDB_GOH
#define __CONTDB_GOH
@deflib	contdb

@include  <foam.goh>
@include  <foamdb.h>
@include  <Objects/vTextC.goh>
#include  <contdb.h>
/*
 * SIM contact lists are part of the contdb library; their declarations are
 * collected in the following separate file:
 */
@include  <contSIM.goh>

@class	ContactListClass, GenControlClass;

typedef WordFlags ContactListFeatures ;
#define CLF_SELECT_CONTACT_NUMBER 	0x02
#define CLF_SEARCH 		    	0x01
#define	CL_DEFAULT_FEATURES	  CLF_SEARCH

@message void MSG_CONTACT_LIST_QUERY_ENTRY_MONIKER (optr list = cx:dx, word entry = bp);
/*
 * Message sent to the list to get a moniker for an item in the list
 */

@message void MSG_CONTACT_LIST_SELECTION_CHANGED ();
/*
 * Notification sent to the controller when the selection in the list has
 * changed
 */

@message void MSG_CONTACT_LIST_SEARCH_TEXT_LOST_FOCUS ();
/*
 * Internal message sent to the controller when the search text has lost the
 * focus
 */

@message dword MSG_CONTACT_LIST_GET_ID_OF_SELECTED_RECORD ();
/*
 * Returns the record ID of the currently selected record
 */

@message void MSG_CONTACT_LIST_SEARCH_TEXT_TIMEOUT_MSG ();
/*
 * Message sent out when it is time to perform a search
 */

@message void MSG_CONTACT_LIST_QUERY_NUMBER_LIST_MONIKER ();
/*
 * Internal message sent out to get a moniker for the contact number list
 */

@message void MSG_CONTACT_LIST_SELECT_CURRENT_CONTACT ();
/*
 * Internal - Sends a notification message callback when user has
 * selected a contact, either in alternate or regular select mode.
 */

@message void MSG_CONTACT_LIST_SELECT_CONTACT_NUMBER ();
/*
 * Internal message sent out when the user clicks the "Select" trigger in
 * the dialog box listing all the contact numbers for a person.
 */

@message void MSG_CONTACT_LIST_CLOSE_CONTACT_NUMBER_POPUP ();
/*
 * Internal message which closes the dialog box listing all the
 * contact numbers for a person, and sets the list selection to what
 * it should be.
 */

@message void MSG_CONTACT_LIST_HANDLE_SELECTION_CHANGE_NOTIFICATION (word selection = bp);
/*
 * Internal message used to delay setting the selection until after the GCN
 * list has been unlocked.
 */

@message void MSG_CONTACT_LIST_COMPLETE_SEARCH ();
/*
 * Internal message sent to the list object when the user hits enter, to
 * perform a search immediately instead of waiting for the normal timeout
 */

/* --------------------------------------------------------------------------
 *  Messages available only in Communicator products after Feb 1997:
 * -------------------------------------------------------------------------*/

@message void MSG_CONTACT_LIST_PRESERVE_SEARCH_ON_NEXT_LOST_FOCUS ();
/*
 *  Tells the contact list not to reset the search list when the focus
 *  is lost the very next time.
 */

@message ContactListSelectedRecordsData \
    MSG_CONTACT_LIST_GET_IDS_OF_SELECTED_RECORDS	() = ax:cx;
/*
 *  Returns the current list of contact selections. The caller must
 *  allocate a buffer for the entries and pass the size of the buffer.
 *  If there is insufficient space in the passed buffer for the
 *  selections, the buffer will not be filled in. Use this message if
 *  you've set the list to be non-exclusive.
 */

typedef struct {
    MemHandle CLSRD_dataBlock; 		/* block containing contact IDs */
                    /* should be freed by caller */
    word      CLSRD_numSelections;      /* # of contact IDs returned */
} ContactListSelectedRecordsData} ;

@message void MSG_CONTACT_LIST_NOTIFY_CONTACT_SELECTED ();
/*
 *  Internal - sent out when the user selects the "Select" trigger
 *
 */

@message void MSG_CONTACT_LIST_ALTERNATE_NOTIFY_CONTACT_SELECTED ();
/*
 *  Internal - Asks us to send out the callback message when the user
 *  has selected a contact and pressed F1 long enough to select that
 *  contact in alternate select mode.
 */

@message void MSG_CONTACT_LIST_CANCEL_CONTACT_NUMBER_POPUP ();
/*
 *  Internal - sent out when the user chooses "cancel" in the dialog box
 *  listing all the contact numbers for a person.
 */

@message void MSG_CONTACT_LIST_SET_EMERGENCY_NUMBERS (
            const TCHAR *numbers = cx:dx, word num = bp);
/*
 *  Sets the special emergency numbers for which we will never find a
 *  match in our database. Usually used by type CCT_PHONE.
 *
 *  "numbers" contain "num" contigously stored null-terminated numbers.
 */
@protominor NewAPIApr98;
@message Handle MSG_CONTACT_LIST_GET_SEARCH_RESULTS () = ax;
/*
 * Internal message for getting the search result datablock
 * from instance data.
 * The caller has to know where in the block the chunk array resides.
 */

@message void MSG_CONTACT_LIST_SEARCH_TEXT_GAINED_FOCUS ();
/*
 * Internal: sent to us when the text object receives the focus again.
 */

@message void MSG_CONTACT_LIST_SET_ALTERNATE_LINE_TEXT (TCHAR *text = cx:dx);
/*
 *  Sets the text displayed in the alternate line text area of the title
 *  bar. Set text = NULL, if the text is to be removed.
 */

@message void MSG_CONTACT_LIST_LIMIT_TO_GROUP (RecordID *record = dx:bp);
/*
 * Limits the contacts that the contact list shows to the members of
 * a particular group.  Pass 0 for the currently selected group or
 * -1 to remove the limit.
 */

@message RecordID MSG_CONTACT_LIST_GET_GROUP_LIMIT ();
/*
 * Return the RecordID of the group the list is limiting contact to.
 * Returns NULL_GROUP_ID if the list isn't limiting to a group.
 */

@message void MSG_CONTACT_LIST_DO_GROUP_SEARCH ();
/*
 * Internal message used when contact lists limit themselves to
 * showing group members.
 */

@message void MSG_CONTACT_LIST_GET_CURRENT_DB_NAME (TCHAR *buffer = cx:dx);
/*
 * Returns the name of the database currently selected in the contact
 * list or NULL if no db name is selected.  It also returns NULL if more
 * than 1 item is selected.
 */

typedef struct {
    MemHandle CMSWDBN_contactsBlock;  /* handle to block containing RecordIDs
                                         of selected contacts.
                                         Must be freed by caller even if 0
                                         selections.
                                         */
    word      CMSWBDN_numContacts;    /* Number or RecordIDs in contactsBlock. */
    MemHandle CMSWBDN_dbNamesBlock;   /* Handle of block containing the names
                                         of the selected databases.
                                         Array of FileLongNames.
                                         Must be freed by caller even 0 dbnames.
                                         */
    word      CMSWBDN_numDBs;          /* Number of dbnames in dbNamesBlock */
} ContactMultipleSelectionWithDBNames} ;

@message void  MSG_CONTACT_LIST_GET_SELECTION_AND_DB_NAMES  (ContactMultipleSelectionWithDBNames *returnValue = cx:dx);

/*
 * Returns information about the current seleciton.  If dbnames are selectd, the
 * names of the dbs are returned in a block.
 */

@protominor NewAPIApr98_2;

@message sword MSG_CONTACT_LIST_GET_VISIBLE_ORDER_OF_SELECTED_RECORD () = ax;
/*
 *	Returns the visible order of the selected record.  (Use
 *	FoamDBGetVisibleRecord with high-word of RecordID zero to fetch the
 *	record.)
 *
 *		Note that the order number of a record can change as records
 *		are added or deleted from the DB.  Use this only when you're
 *		going to use the results immediately.  (Use
 *		MSG_CONTACT_LIST_GET_ID_OF_SELECTED_RECORD to get a persistent
 *		record identifier.)
 *
 *		The advantage of using order number is that finding the record
 *		in the DB is quick.  Using record IDs requires a linear search
 *		from the beginning of the DB, which is noticably slow after a
 *		few thousand records are added.
 */

@message ContactListSelectedRecordsData \
    MSG_CONTACT_LIST_GET_VISIBLE_ORDERS_OF_SELECTED_RECORDS	() = ax:cx;
/*
 *	Returns a block with selected records' visible order numbers
 *	in the DB.  -- same as
 *	MSG_CONTACT_LIST_GET_IDS_OF_SELECTED_RECORDS, but returning
 *	visible record order numbers.
 *
 *	Same as that routine, returns nothing if a DB is among the
 *	selections.
 *
 *	(See also MSG_CONTACT_LIST_GET_VISIBLE_ORDER_OF_SELECTED_RECORD.)
 *
 *	Returned block is an array of CLSRD_numSelections words, which are
 *	the visible order numbers.  BLOCK SHOULD BE FREED BY CALLER if handle
 *	is non-zero (which should be the case iff CLSRD_numSelections is
 * 	non-zero).
 */

@protoreset;

@prototype void CONTACT_LIST_NOTIFY_CONTACT_SELECTED_MSG (
                   dword recordID = cx:dx,
                word fieldID = bp);
@prototype void CONTACT_LIST_STATUS_MSG (word num = cx);
@prototype void CONTACT_LIST_NOTIFY_NUMBER_ENTERED_MSG (
                MemHandle block = cx);
/*
 * Block contains null-terminated number.
 * Block MUST be freed by recepient
 */
@prototype void CONTACT_LIST_ALTERNATE_NOTIFY_CONTACT_SELECTED_MSG (
                   dword recordID = cx:dx,
                word fieldID = bp);
@prototype void CONTACT_LIST_ALTERNATE_NOTIFY_NUMBER_ENTERED_MSG (
                MemHandle block = cx);
/*
 * Block contains null-terminated number.
 * Block MUST be freed by recepient
 */

typedef struct {
    MemHandle	CLSD_contactsBlock;	/* ptr to block containing
                       GenItemGroup id's of
                       selected contacts */
    word	CLSD_contactsTotal;	/* # of selected contacts */
    word	CLSD_contactsIndex;	/* index to contact being
                      * processed in CLSD_contactsBlock */
    MemHandle	CLSD_selectedBlock;	/* block containing sets of
                     * ContactListSelectedEntry */
    word	CLSD_selectedTotal;	/* total # ContactListSelectedEntry
                     * in CLSD_selectedBlock */
} ContactListSelectionData} ;

typedef struct {
    dword	CLSE_recordID;
    word	CLSE_fieldID;
} ContactListSelectedEntry} ;

@prototype void CONTACT_LIST_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG (
                MemHandle block = cx, word num = dx);
/*
 * Block contains "num" ContactListSelectedEntry items.
 */
@prototype void CONTACT_LIST_ALTERNATE_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG (
                MemHandle block = cx, word num = dx);
/*
 * Block contains "num" ContactListSelectedEntry items.
 */

@vardata ChunkHandle	ATTR_CONTACT_LIST_MONIKER;
@vardata Message	ATTR_CONTACT_LIST_STATUS_MSG;
@vardata Rectangle	TEMP_CONTACT_LIST_TAB_BOUNDS;
@vardata void		TEMP_CONTACT_LIST_DO_NOT_SEND_NOTIFICATIONS;
@vardata ContdbCallType	ATTR_CONTACT_LIST_CALL_TYPE;
@vardata Message    	ATTR_CONTACT_LIST_NOTIFY_CONTACT_SELECTED_MSG;
@vardata RecordID  	TEMP_CONTACT_LIST_SELECTED_CONTACT;

/* --------------------------------------------------------------------
 *  Vardata available only in Communicator products after Feb 1997:
 * --------------------------------------------------------------------*/

@vardata void		TEMP_CONTACT_LIST_PRESERVE_SEARCH;
/*
 *  If present, then the search list won't be reset the next time the
 *  focus is lost.
 */

@vardata word           ATTR_CONTACT_LIST_NUM_ITEMS;
/*  Keeps track of # of currently selected items */

@vardata void           HINT_CONTACT_LIST_NON_EXCLUSIVE_LIST;
/*
 *  User can select more than one contact (or none) at any time.
 *  Default is exclusive list.
 */

@vardata Message        ATTR_CONTACT_LIST_NOTIFY_NUMBER_ENTERED_MSG;
/*
 * The message sent out when there are no matches in the
 * Contact List AND the user has entered a valid phone number
 * in the search field. Only useful if CLF_SELECT_CONTACT set.
 * Use callback message of the type CONTACT_LIST_NOTIFY_NUMBER_ENTERED_MSG.
 */

@vardata ChunkHandle    ATTR_CONTACT_LIST_EMERGENCY_NUMBERS;
/*
 *  A list of special numbers which will never be matched to contact
 *  cards, in the search box. Contains 1 or more ChunkHandles to
 *  null-terminated numbers.
 *  The numbers can either be set dynamically using
 *  MSG_CONTACT_LIST_SET_EMERGENCY_NUMBERS, or be used statically like:
 *
 *  ...
 *  @chunk TCHAR Number1[] = "911";
 *  ...
 *  	ATTR_CONTACT_LIST_EMERGENCY_NUMBERS = @Number1;
 *
 *  NOTE: In GOC you can set only one emergency number statically,
 *        wtih ESP, you can set more.
 */

@vardata word 		ATTR_CONTACT_LIST_ALTERNATE_NOTIFY_CONTACT_SELECTED_MSG;
/*
 *  The message sent out when the user selects a contact from the
 *  list. AND user has cause us to send out an alternate
 *  notification message. If more than one selection was
 *  selected, then it returns the first selection. Works when we
 *  are of type CCT_PHONE. Use callback message of the type
 *  CONTACT_LIST_ALTERNATE_NOTIFY_CONTACT_SELECTED_MSG.
 */

@vardata Message 	ATTR_CONTACT_LIST_ALTERNATE_NOTIFY_NUMBER_ENTERED_MSG;
/*
 *  The message sent out when there are no matches in the
 *  Contact List AND the user has entered a valid phone number
 *  in the search field. And user has cause us to send out an
 *  alternate notification message. Only useful if
 *  CLF_SELECT_CONTACT set. Wrks when we are of type CCT_PHONE.
 *  Use callback message of the type
 *  CONTACT_LIST_ALTERNATE_NOTIFY_NUMBER_ENTERED_MSG.
 */

@vardata void 		TEMP_CONTACT_LIST_ALTERNATE_SELECTION_MODE;
/*
 *  If present, we should send out an alternate notify contact
 *  selected message. Works when we are of type CCT_PHONE.
 */

@vardata ContactListSelectedData 	TEMP_CONTACT_LIST_SELECTED_INFO;
/*
 *  The contacts that have been selected in a non-exclusive list
 *  and have to be displayed in the number bubble popup.
 */

@vardata Message ATTR_CONTACT_LIST_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG;
/*
 *  The message sent out when the user selects 1 or more
 *  contacts from the list (REQUIRED IF CLF_SELECT_CONTACT SET
 *  and HINT_NON_EXCLUSIVE_LIST is present).
 *
 *  More than one contact and more than one field per contact
 *  can be selected.
 *
 *  Use callback message of the type
 *  CONTACT_LIST_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG.
 */

@vardata Message ATTR_CONTACT_LIST_ALTERNATE_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG;
/*
 *  The message sent out when the user selects 1 or more
 *  contacts from the list (REQUIRED IF CLF_SELECT_CONTACT SET
 *  and HINT_NON_EXCLUSIVE_LIST is present). Works when we are
 *  of type CCT_PHONE.
 *
 *  More than one contact and more than one field per contact
 *  can be selected.
 *
 *  Use callback message of the type
 *  CONTACT_LIST_ALTERNATE_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG.
 */

/* --------------------------------------------------------------------
 *  Vardata available only in Communicator products after Apr 1998:
 * --------------------------------------------------------------------*/
@protominor NewAPIApr98;
@vardata void ATTR_CONTACT_LIST_ATTACH_DETAILS_VIEW;
/*
 * Show the details view of the contact list (as seen in the contact manager).
 * The ui of Names list and the Details view is fairly inflexible.
 */

@vardata void ATTR_CONTACT_LIST_SHOW_MEMORY_CARD;
/*
 * Users should add this if they want memory cards to appears as
 * folders in the contact list.
 */

@vardata ChunkHandle TEMP_CONTACT_LIST_ALTERNATE_LINE_TEXT;
/*
 *  Internal use: contains pointer to chunk of text to use in
 *  alternate line display
 */

@vardata RecordID ATTR_CONTACT_LIST_LIMITING_GROUP_ID;
/*
 * Internal use: RecordID that the searches will be limited too (for groups).
 *               (set by MSG_CONTACT_LIST_LIMIT_TO_GROUP).
 */

@vardata void HINT_CONTACT_LIST_DONT_ADD_DEFAULT_HINTS;
/*
 * Don't add DRAW_IN_BOX and SHADOW hints when the contact list is created.
 */

@vardata MemHandle ATTR_CONTACT_LIST_DONT_ALLOW_RECORDS;
/* The MemHandle should be a block containing an array of
 * RecordIDs that will be dimmed and unselectable
 * in the contact list.
 * The array should be ended with NULL_GROUP_ID (0).
 */

@vardata void ATTR_CONTACT_LIST_ALLOW_GROUP_AS_CALL_TYPE;
/*  If you have ATTR_CONTACT_LIST_CALL_TYPE on the list
 *  and you want the user to be able to select groups in
 *  addition to call types, add this attribute.
 *  There is now guarantee that the group will contain
 *  any members that have fields of the calltype.
 *  You have to determine that when you enum the members
 *  of the group.
 */

@vardata void HINT_CONTACT_LIST_NO_SECOND_COLUMN;
/* Don't display the column of company names in the list.
 * (If there is no CFT_NAME field, the company name will still
 * be shown in the first column, as usual.)
 */

@protoreset;

@instance VMBlockHandle CLI_searchResult;
@instance word CLI_timerID = 0;
@instance TimerHandle CLI_timerHandle = 0;
@instance word CLI_curItem = 0;
@default GI_states = (@default | GS_ENABLED);
@endc

@class	ContactEditClass, GenControlClass;

typedef WordFlags ContactEditFeatures ;
#define CEF_ATTACH_IMAGE 	    0x40
#define CEF_MENU   	    	    0x20
#define CEF_SAVE     	    	    0x10
#define CEF_FIELDS   	    	    0x08
#define CEF_MARK_SECRET 	    	    0x04
#define CEF_SPECIAL_RINGING_TONE     0x02
#define CEF_SPEED_DIAL 	    	    0x01
#define	CE_DEFAULT_FEATURES	  (CEF_SPEED_DIAL | CEF_SPECIAL_RINGING_TONE | CEF_FIELDS | CEF_SAVE | CEF_MENU | CEF_ATTACH_IMAGE)

@message void MSG_CONTACT_EDIT_DISPLAY_RECORD (MemHandle record = cx);
/*
 * Displays the passed record for editing
 */

@message void MSG_CONTACT_EDIT_DELETE_RECORD ();
/*
 * Deletes the currently displayed record
 */

@message void MSG_CONTACT_EDIT_SAVE_RECORD_DATA ();
/*
 * Saves the record being viewed, but displays warnings if the record will
 * be deleted because it is empty, not enough disk space to save, etc. If
 * the record is empty, it will be deleted. If the record is saved or deleted,
 * CEI_record is cleared.
 */
@message void MSG_CONTACT_EDIT_SAVE_RECORD_DATA_SILENTLY (MemHandle record = cx);
/*
 * Subclassable messages to save the edited record someplace other than in
 * the contact db (e.g. as a template, as user data, whatever)
 */

/*
 * Saves the currently displayed record, even if there is not sufficient disk
 * space. This routine does no checking - it saves the record regardless.
 */

typedef enum {
    CESS_NOT_SECRET    ,
    CESS_SECRET
} ContactEditSecretStatus} ;

@message void MSG_CONTACT_EDIT_SET_SECRET_STATUS (ContactEditSecretStatus secretStatus = cx);

typedef enum {
    CERT_NONE    ,
    CERT_SPECIAL_TONE
} ContactEditRingingTone} ;

/*
 * This is ALWAYS obsolete. Use MSG_CONTACT_EDIT_SET_RINGING_TONE_NAME.
 */
@message void MSG_CONTACT_EDIT_SET_RINGING_TONE (ContactEditRingingTone tone = cx);

@message void MSG_CONTACT_EDIT_ADD_FIELD (ContdbFieldType type = cx);
@message void MSG_CONTACT_EDIT_ADD_FIELD_TYPE_SELECTED (ContdbFieldType type = cx);
@message void MSG_CONTACT_EDIT_DELETE_FIELD ();
@message void MSG_CONTACT_EDIT_CHANGE_FIELD_LABEL ();

@message void MSG_CONTACT_EDIT_FIELD_HAS_FOCUS (FieldID id = cx);
@message void MSG_CONTACT_EDIT_INITIATE_ADD_FIELD_DIALOG ();

@message void MSG_CONTACT_EDIT_GET_CHANGE_FIELD_LABEL_MONIKER (optr list = cx:dx, word entry = bp);
@message void MSG_CONTACT_EDIT_CHANGE_LABEL_OF_FOCUSED_FIELD ();
@message void MSG_CONTACT_EDIT_FIELD_LABEL_SELECTED (ContdbFieldType type = cx);

@message void MSG_CONTACT_EDIT_INITIATE_OPTIONS_DIALOG ();
@message void MSG_CONTACT_EDIT_MARK_MODIFIED ();

@message void MSG_CONTACT_EDIT_CORRECT_TEL_HALF_LINES ();
@message void MSG_CONTACT_EDIT_CORRECT_FAX_HALF_LINES ();
@message void MSG_CONTACT_EDIT_ADD_FIELD_SPEED_DIAL ();
@message void MSG_CONTACT_EDIT_SAVE_AND_CLOSE ();
@message MemHandle MSG_CONTACT_EDIT_GET_RECORD_HANDLE ()=cx;

/*
 * Marks the current record as modified, so it will get saved out
 */

@message void MSG_CONTACT_EDIT_SET_FOCUS_TO_TOP_FIELD ();
/*
 * Set the editor's focus to top field.
 */

/* --------------------------------------------------------------------------
 *  Messages available only in Communicator products after Feb 1997:
 * -------------------------------------------------------------------------*/

@message void MSG_CONTACT_EDIT_INITIATE_MENU_DIALOG ();
/*
 * Internal: Sent to us by the Menu trigger
 */

@message void MSG_CONTACT_EDIT_DISPLAY_NEXT_RECORD ();
/*
 * Load the next record, relative to the one being displayed
 */

@message void MSG_CONTACT_EDIT_DISPLAY_PREVIOUS_RECORD ();
/*
 * Load the previous record, relative to the one being displayed
 */

@message void MSG_CONTACT_EDIT_COPY_RECORD ();
/*
 * Internal: Sent to us by the copy card trigger
 */

@message void MSG_CONTACT_EDIT_COPY_FIELDS_TO_CLIPBOARD ();
/*
 * Internal: Sent to us by the Copy To Clipboard trigger in the menu
 */

@message void MSG_CONTACT_EDIT_CORRECT_TEL_FAX_HALF_LINES ();
@message void MSG_CONTACT_EDIT_CORRECT_TEL_DATA_HALF_LINES ();
/*
 *  Fixes half-line inconsistencies among tel/fax & tel/data
 *  fields.
 */

@message void MSG_CONTACT_EDIT_FETCH_URL ();
/*
 *  Internal: The "Fetch" trigger sends this to us.
 */

@message void MSG_CONTACT_EDIT_SET_SELECTION_TO_TOP_FIELD ();
/*
 *  Sets focus to the top field and select its contents.
 */

@protominor NewAPIApr98;
@message void MSG_CONTACT_EDIT_INITIATE_REAL_OPTIONS_DIALOG ();
/*
 * Internal: "Options" trigger sends this to us.
 */

@message void MSG_CONTACT_EDIT_SET_IMAGE_NAME (FileLongName *image=cx:dx);
/*
 * Associates the passed filename with the Contact Card.
 * Pass: image = 0, if no image name
 */

@message void MSG_CONTACT_EDIT_SET_RINGING_TONE_NAME (FileLongName *tone=cx:dx);
/*
 * Associates the passed filename with the Contact Card.
 * Pass: tone = 0, if no tone name
 */

@message void MSG_CONTACT_EDIT_SHOW_GROUPS ();
/*
 * Internal: "belongs to groups" menu item sends this.
 */
@protoreset;

@vardata void	ATTR_CONTACT_EDIT_NO_FIELD_DATA_ALLOWED;

@vardata void	ATTR_CONTACT_EDIT_RECORD_WAS_EMPTY;
@vardata VMFileHandle	TEMP_CONTACT_EDIT_DB_HANDLE;

typedef struct {
    word           CERD_fieldId;  /* cont DB Id of the last record on screen */
    VisTextRange   CERD_selection;/* selection in saved field object */
} ContactEditRecoverData} ;
@vardata ContactEditRecoverData ATTR_CONTACT_EDIT_RECOVER_FROM_STATE;

@vardata void	ATTR_CONTACT_EDIT_CTRLNP_SAVE_ALLOWED;
@vardata void	TEMP_CONTACT_EDIT_RECORD_MODIFIED;
@vardata word   TEMP_CONTACT_EDIT_ORIGINAL_BLOCK_SIZE;
/*
 * Used to store the original size of the data block pointed by
 * CEI_record. So we know how much extra diskspace is required when
 * saving/auto-saving.
 */
@vardata void	ATTR_CONTACT_EDIT_SHOW_RECORD_IMAGE;
/*
 * If present, contact edit card would show the record image if any.
 */

@instance MemHandle CEI_record;
@instance RecordID CEI_recordID;
@default GI_states = (@default | GS_ENABLED);
@endc

@class 	SpeedDialControlClass, GenControlClass;

typedef WordFlags SpeedDialControlFeatures ;
#define SDCF_UI 	    	    	0x01
#define	SD_DEFAULT_FEATURES	 	(SDCF_UI)

@message void MSG_SPEED_DIAL_QUERY_LIST_ENTRY ();
/*
 *  Internal: message sent by our dynamic list to query for items.
 */

@message void MSG_SPEED_DIAL_OPEN_LIST ();
/*
 *  Internal: message sent by the speed dial item trigger to open the
 *  list in wedge dialog.
 */

@message void MSG_SPEED_DIAL_REPLACE_ENTRY ();
/*
 *  Internal: message applied by the list, when user selects a speed
 *  dial entry to replace.
 */

@message void MSG_SPEED_DIAL_DISPLAY_CONTACT (RecordID recordID = cx:dx);
/*
 *  This message is to initalize the controller to display the speed
 *  dial records for a particular contact.
 */

@vardata VMFileHandle	TEMP_SPEED_DIAL_DB_HANDLE;
/*
 *  Internal: This is kept cached so we can tell when the contact DB is
 *  being closed.
 */

@instance dword 	SDCI_recordID;
/*  record ID of the contact we are displaying */

@instance word 		SDCI_fieldID;
/*
 *  the field ID associated with the record ID, that brought up
 *  the speed dial entry list
 */

@instance optr 		SDCI_triggerObject;
/*  the trigger which initiated the speed dial entry list */

@default GI_states = (@default | GS_ENABLED);
@endc

@endlib

/*
 * Class for displaying the list of groups in a database.
 */
@class     ContactGroupListClass, GenDynamicListClass;

@message   void  MSG_CONTACT_GROUP_LIST_INIT  ();
/*
 * If the database changes, the group list needs to recalcualte the
 * group information.  Send this message to force that to happen.
 */

@instance optr		CGLI_storedGroups;

/*
 * Set dispalyMemberCount to FALSE if you only want to display the group
 * names and not the mebers in it.
 */

@instance word          CGLI_displayMemberCount = TRUE;
@endc;

/*
 * Class for displaying all the groups a given contact record is in.
 */
@class ContactParentGroupListClass, GenDynamicListClass;
@message  void MSG_CONTACT_PARENT_GROUP_LIST_SET_RECORDID (dword rid=dx:cx);
/*
 * Set the RecordID of the record we should display the parent groups of.
 * Sending this message will reinit the list.
 */

@message void MSG_CONTACT_PARENT_GROUP_LIST_RESET ();
/*
 * Determines the number of elements that should be shown in the list and
 * gets the new monikers.
 */

@instance RecordID  CPGLI_record;
/* RecorrdID that we are getting the parents of. */

@instance word CPGLI_hasParents;
/* Set to false if the record is not in any groups.
   Only used for displaying correct monikers */

@endc;
#endif


contdb.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1998.  All rights reserved.
 *	GEOWORKS CONFIDENTIAL
 *
 * PROJECT:
 * MODULE:
 * FILE:	  contdb.h
 *
 * AUTHOR:  	  Ronald Braunstein: Jan 12, 1998
 *
 * REVISION HISTORY:
 *	Name		Date		Description
 *	----		----		-----------
 *	ron     	1/12/98   	Initial version
 *
 * DESCRIPTION:
 *
 *	c header information for the contdb library
 *
 *	$Id: contdb.h,v 1.1.1.20 98/09/18 10:55:44 mevissen Exp $
 *
 ***********************************************************************/
#ifndef _CONTDB_H_
#define _CONTDB_H_
#include  <foamdb.h>

typedef ByteEnum ContdbFieldType ;
/*
 * The standard field types in the contact database
 *
 * 	Note: CFT_TEL_FAX & CFT_TEL_DATA types work just like Tel
 * 	fields. You can set speed dials, phone numbers will match to
 * 	these fields, phone directory will allow contacts to be
 * 	selectable based on these fields too.
 */
#define	CFT_NAME	    	0
#define	CFT_COMPANY	 	1
#define	CFT_TITLE	 	2
#define	CFT_ADDRESS	 	3
#define	CFT_PHONE	   	4
#define	CFT_FAX		    	5
#define	CFT_EMAIL	   	6
#define	CFT_DTMF	    	7
#define	CFT_NOTES	   	8
/* Only available in Communicator products after Feb 1997: */
#define CFT_URL          9
#define CFT_PASSWORD     10
#define CFT_TEL_FAX 	11
#define CFT_TEL_DATA 	12
/* Only available in Communicator products after Apr 1998 */
#define CFT_IMAGE 	13
#define CFT_TONE         14
#define CFT_GROUP_LINK   15   /* Group this record belongs to */
#define CFT_IS_GROUP     16   /* Is this record a group       */
#define CFT_CALLER_GROUP  17  /* bitmask of profiles that have caller group set*/

typedef ByteFlags ContdbRecordFlags ;
#define CRF_SPECIAL_RINGING_TONE     0x01
/* If set on a record, specifies that it has a special ringing tone */

#define MAX_NAME_DATA_LEN 	100
#define MAX_COMPANY_DATA_LEN 	100
#define MAX_JOB_TITLE_DATA_LEN 	150
#define MAX_ADDRESS_DATA_LEN 	150
#define MAX_NUMBER_FIELD_DATA_LEN 	30
#define MAX_EMAIL_DATA_LEN 	1024
#define MAX_NOTE_DATA_LEN 		400
#define MAX_URL_DATA_LEN         400
#define BOOKING_PWD_LENGTH       8
#define MAX_DTMF_FIELD_DATA_LEN 	100
#define MAX_IMAGE_DATA_LEN 	FILE_LONGNAME_LENGTH+2

#define MAX_FIELD_LABEL_LEN_NO_NULL 	31
#define MAX_FIELD_LABEL_LEN 	(MAX_FIELD_LABEL_LEN_NO_NULL+1)
#define MAX_TONE_DATA_LEN        FILE_LONGNAME_LENGTH+2
#define MAX_GROUP_NAME_LEN       32
#define MAX_GROUP_NAME_LEN_WITH_NULL   (MAX_GROUP_NAME_LEN+2)
#define NULL_GROUP_ID            0

#define CONTACT_MAX_NUMBER_DBS 	20

typedef TCHAR ContactGroupName [MAX_GROUP_NAME_LEN_WITH_NULL];

typedef struct {
    RecordID  		CGLS_id;
    word                CGLS_numMembers;
    ContactGroupName	CGLS_name;
} ContactListGroupStruct} ;

/*
 * Use this constant to export all records in
 * ContactExportDBToTextFile.
 */
#define CONTACT_EXPORT_ALL_RECORDS 	-1

/*
 * Use this constant to see if a recordID you get back is really a
 * db name on a memory card instead of contact.  This can happen when you
 * ask for the current selection.  It isn't a valid argument to functions
 * that expect a real RecordID
 */
#define CONTACT_DB_SELECTION_IS_DB_NAME  -2

typedef enum {
    CES_NO_ERROR    ,
    CES_FILE_ERROR    ,
    CES_MMC_REMOVED_ERROR
} ContactExportStatus} ;

extern VMFileHandle
    _pascal ContactGetDBHandle (void);
/*
 * Returns the handle of the database that contains all the contact entries,
 * or blocks if it is currently closed.
 *
 * NEW FOR N9110:
 * If your geode never sets an override DB, the return value will (barring
 * catastrophic failure) always be a valid DB handle.  However, if you set an
 * override DB on the memcard and that DB is deleted or the memcard is removed,
 * the return value will be zero.  (When you remove the override, you will get
 * valid handles again.)
 *
 * This change is backward-compatible, as ContactSetOverrideDB() did not exist
 * prior to the N9110.
 */

extern VMFileHandle
    _pascal ContactGetDBHandleNoBlock (void);
/*
 * Returns the handle of the database that contains all the contact entries,
 * or 0 if it is currently closed. If a non-zero handle is returned, the
 * caller needs to call ContactReleaseDBHandle().
 */

extern void
    _pascal ContactReleaseDBHandle (void);
/*
 * Releases the database handle, so the file can be closed
 */

extern word			/* Returns value is same as VMClose */
    _pascal ContactCloseDBFile (void);

extern VMFileHandle
    _pascal ContactReOpenDBFile (void);
/*
 * Routines called to close/reopen the file so data backup/restore can occur
 * If ContactReOpenFile returns 0, then the file is not opened, and
 * ThreadGetError can be called to get the error
 */

extern MemHandle
    _pascal ContactCreateRecordFromTemplate (void);
/*
 * Creates a new record with all the fields that are in the template record,
 * and returns the handle of the record. This new record will have no data
 * stored in the fields.
 * It should either be saved to the database using ContactSaveRecord,
 * destroyed using FoamDBDiscardRecord, or set as the *new* template by
 * calling ContactSetTemplateRecord.
 *
 * New for N9110v01:
 * The template will always be copied from the device DB. (The user will only
 * see one template, regardless of which DB is open.)  However, you should
 * have the current DB set to the DB in which you plan to save the copied
 * record -- ContactCreateRecordFromTemplate will translate the field names
 * and increment the field-name-in-use counts accordingly.
 *
 * Pass: nothing (current contact DB should be set to DB you want the record
 *                to be from)
 */

extern FieldID
    _pascal ContactEnsureField (MemHandle record, optr fieldName,
                   ContdbFieldType fieldType);
/*
 * Ensures a field exists in the given record. If not, it adds the
 * field with the given fieldName (or if NULL, uses the default name),
 * of the type fieldType.
 */

extern FieldID
    _pascal ContactEnsureEmptyField (MemHandle record, optr fieldName,
                   ContdbFieldType fieldType);
/*
 * Ensures an *empty* field exists in the given record, with the passed name
 * and type. If not, it adds the field with the given fieldName (or if NULL,
 * uses the default name), of the type fieldType.
 */

extern void
    _pascal ContactSetTemplateRecord (MemHandle record);
/*
 * Replaces the existing template record with the passed record. The passed
 * record can not have any data in it (all fields must be empty)
 *
 * New for N9110v01:
 * The template will always be copied to the device DB for storage -- there is
 * only one template per phone.  However, the current DB should be set to the
 * DB from which this record was created.
 *
 * Pass: record - handle of record
o *	          (Current DB set to DB record was created from.)
 */

extern dword
    _pascal ContactSaveRecord (MemHandle record);
/*
 * Saves the passed record in the database, inserting it in the correct sort
 * order.
 */

extern dword
    _pascal  ContactGetUserDataID  (void);
/*
 * Returns the record ID of the user data card. The secret record
 * contains the user info.
 */

extern word
    _pascal ContactGetUserDataName (TCHAR *username, word bufSize);
/*
 * Copies the name field from the user data card into the passed buffer
 * which must be at least (MAX_NAME_DATA_LEN * size TCHAR) bytes.
 * Returns the size of the name.
 */

typedef	ByteEnum ContdbCallType ;
#define	CCT_PHONE		 0
#define	CCT_SMS			 1	/* implies Tel(GSM) and Tel(PCN) */
#define	CCT_FAX			 2
#define	CCT_EMAIL		 3
#define	CCT_GSM_FAX		 4	/* implies Fax(GSM) and Fax(PCN) */
#define CCT_SMS_ONLY 	 5	/* Tel(GSM) only */
#define	CCT_PCN_SMS_ONLY	 6	/* Tel(PCN) only */
#define	CCT_GSM_FAX_ONLY	 7	/* Fax(GSM) only */
#define	CCT_PCN_FAX_ONLY	 8	/* Fax(PCN) only */
#define	CCT_ANY		    255

extern RecordID _pascal
    ContactMatchNumber    (TCHAR *number, ContdbCallType type, FieldID *field,
               word *numMatches);
/*
 * Given a phone number, searches all the fields of the specified type in the
 * contact database, and returns the RecordID/FieldID of the matching one
 * If no match, returns a RecordID of -1
 */

extern RecordID _pascal
    ContactMatchName    (TCHAR *name, ContdbFieldType type, Boolean stopEarly,
             FieldID *field, word *numMatches);
/*
 * Given a string, searches all the fields of the specified type in the
 * contact database, and returns the RecordID/FieldID of the matching one
 * (must be an *exact* case-insensitive match).
 *
 * Note that ContactMatchName takes a ContdbFieldType, while ContactMatchNumber
 * takes a ContdbCallType. These are *NOT* the same thing!
 *
 * If no match, returns a RecordID of -1
 *
 * If stopEarly is true the search will stop on the first match.
 *
 * LocalCmpStringsNoCase is used to match the fields
 */

extern Boolean
    _pascal ContactGetName (MemHandle record, TCHAR *dest);
/*
 * Given a record handle, gets the name associated with the record
 * dest = buffer to hold null-terminated name
 * (should hold MAX_NAME_DATA_LEN+1 TCHARs).
 *
 * Returns non-zero if the record was unnamed.
 */

extern Boolean
    _pascal ContactGetTruncatedName (MemHandle record, TCHAR *dest, word destSize);
/*
 * Given a record handle, gets the name associated with the record
 * dest = buffer to hold null-terminated name
 * destSize = size of destination buffer
 *   (e.g. if destSize = 10, routine can return at most 9 chars + 1 null)
 *
 * Returns non-zero if the record was unnamed.
 */

extern int
    _pascal SpeedDialGetSlot (RecordID rid, FieldID fid);
/*
 * Gets the slot # for the passed record/field ID.
 * If not found, returns BW_TRUE (-1).
 */

extern int
    _pascal SpeedDialGetRecord (int slot, RecordID *rid, FieldID *fid);
/*
 * Gets the record & field ID, given a slot #.
 * If error, returns BW_TRUE (-1).
 */

extern int
    _pascal SpeedDialSetRecord (int slot, RecordID rid, FieldID fid);
/*
 * Saves a record/field ID combo in a slot.
 * If slot wasn't previously empty, returns BW_TRUE (-1).
 */

extern int
    _pascal SpeedDialGetNumber (int slot, TCHAR *buf);
/*
 * Gets the phone number, given the slot #.
 * If slot is empty, returns BW_TRUE (-1).
 */

extern void
    _pascal ContactImportDBFromTextFile (hptr fileImport);
/*
 * Imports information from a text file to the contact database.
 */

extern ContactExportStatus
    _pascal ContactImportDBFromTextFileStatus (hptr fileImport);
/*
 * Same as ContactImportDBFromTextFile, but returns a status.
 */

extern ContactExportStatus
    _pascal ContactExportDBToTextFile (hptr fileExport,
                      dword startElement,
                      dword numOfRecords);
/*
 * This exports a range of records in the contact database into
 * a text file, starting with record (startElement). (numOfRecords)
 * records will be processed.
 * If you want to export all records, use
 *	startElement = 0,
 *	numOfRecords = CONTACT_EXPORT_ALL_RECORDS
 */

extern void
    _pascal ContdbRecreateFieldLabel (TCHAR *subLabel,
                     TCHAR *destination,
                     int fieldType);
/*
 * Creates a valid field label given a sub-label, and a field
 * type. This routine will also handle clipping the final string
 * so it will not be any more than MAX_FIELD_LABEL_PIXEL_WIDTH
 * pixels wide.
 */

extern void
    _pascal ContdbTranslateSubFieldLabelToEnglish (TCHAR *subLabel,
                          TCHAR *destination);
/*
 * Translates the sub-label of a field name into english, if
 * the sublabel isn't translatable, return the sublabel.
 */

extern Boolean
    _pascal ContactCompareNumbers (TCHAR *number1, TCHAR *number2);
/*
 * Compares two phone numbers (after stripping non-numeric characters, etc)
 * Returns non-zero if they did *not* match
 */

typedef ByteEnum ContactNetworkVersionType ;
#define CNVT_GSM 	0x0
#define CNVT_PCN 	0x1

extern void
    _pascal ContactChangeNetworkVersion (ContactNetworkVersionType cnvt);
/*
 *  The cellular network version has been determined and we should
 *  change the default Tel & Fax GSM-like field labels to the appropiate
 *  type. This will affect the default template and user data card.
 *
 */

extern void
    _pascal ContactVerifyNetworkVersion (void);

/*
 * (Added for April 1998 release)
 *
 * Verify that the contact DB is set up for the current
 * network type (GSM, PCN).  If not, translate it.
 *
 * Useful after restoring the *entire* DB file from backup or
 * other source where the previous network is not guaranteed.
 * Calls ContactChangeNetworkVersion if the current network
 * does not match the DB file.
 */

#define CONTACT_GET_CURRENT_DB_NAME  -2

extern int _pascal ContactGetDBName (int dbIndex, TCHAR *dbName);
/*
 * Returns the name of a database on the memory card.
 * Pass dbIndex  = -2 to get the name of the db being used.
 *
 * If the user selects a db name in the contact list and you want
 * to switch to that db using ContactChangeStandardDB,
 * send MSG_CONTACT_LIST_GET_CURRENT_DB_NAME to the list to get
 * the name of the selected db.
 *
 * To find out the name of the db currently being used by the app
 * pass CONTACT_GET_CURRENT_DB_NAME.
 */

#define CONTACT_DEVICE_DB_NAME  NULL
extern int
    _pascal ContactChangeStandardDB (TCHAR *dbName);
/*
 * Sets the database that your app and other apps will use
 * unless they explicitly overried the db they want to use.
 * Use ContactSetOverrideDB() to change for your app only.
 * Returns FALSE if name is not a valid db.
 * Pass dbName as CONTACT_DEVICE_DB_NAME to use the db on
 * the device.  (A ptr to "" will also set the device db.)
 */

#define CONTACT_SET_OVERRIDE_ERROR  (-2)
extern word
    _pascal ContactSetOverrideDB (TCHAR *dbName);
/*
 * Sets the database that your app will use for all the db
 * operations until the override is cleared.
 * If the db is invalid, CONTACT_SET_OVERRIDE_ERROR is returned and
 * no override is set.  There is no need to call ContactRestoreOverrideDB()
 * if there is an error.
 *
 * Pass dbName = CONTACT_DEVICE_DB_NAME (or "") to use the db on the
 * device.  You can also get the Nth DB (0=device, 1=first on memcard, etc) by
 * passing a dword value of the form: (-1:N).
 *
 * Returns a token for the previous override.
 * To restore the previous override call ContactRestoreOverrideDB(dbToken).
 *
 * ***NOTE: It's very important to get/release the DB handle a balanced number
 * of times during the override.  Else, you may release a different handle than
 * the one you got, and this will invalidate the handle in-use counts, and the
 * cached standard handle for your geode. ***
 *
 * The contdb library maintains a list of active overrides, so it's better
 * to set and restore the override every time you need it, rather than set it
 * once when your app opens and never removing it until your app exits.
 *
 * See the comment on "memcard usage" in contdb.def.
 *
 *
 */

/**  !! use ContactRestoreOverrideDB() instead. **/
extern void
    _pascal ContactRemoveOverrideDB (void );
/*
 * Removes any db override of the standard database that the
 * app may have set.
 */

/*
 * Only use RESTORE_STANARD_DB if you are sure you haven't set an override yet.
 * Use the result of ContactSetOverrideDB() instead.
 */
#define CONTACT_RESTORE_STANDARD_DB  -1
extern void
    _pascal ContactRestoreOverrideDB (word dbToken );
/*
 * Restore an override that was set with ContactSetOverrideDB()
 * Does nothing if the token passed is CONTACT_SET_OVERRIDE_ERROR.
 */

#define CONTACT_CREATE_DB_OKAY 			0
#define CONTACT_CREATE_DB_ERROR 			1
#define CONTACT_CREATE_DB_ERROR_NAME_EXISTS 	2
extern word
    _pascal ContactCreateNewDB (TCHAR *dbName);
/*
 * Creates a new database name on the memory card.
 * Returns CONTACT_CREATE_DB_* error code:
 *   CONTACT_CREATE_DB_ERROR_NAME_EXISTS if the passed name already exists
 * on the memcard.
 *   CONTACT_CREATE_DB_ERROR if CONTACT_MAX_NUMBER_DBS databases already
 * exist on the card, if the card is full, or if there are any other errors in
 * creating the new DB.
 */

extern int
    _pascal ContactGetNumDBsOnMemoryCard (void);
/*
 * Returns the number of contact database that exist on the memory
 * card.  Returns 0, if no memory card in the device.
 */

extern int
    _pascal ContactGetMemCardStatus (void);
/*
 * Returns true if the geode is currently using/viewing a database on a
 * memory card.
 */

typedef enum {
    CIFT_OK    ,
    CIFT_INVALID_ID    ,
    CIFT_NO_IMAGE    ,
} ContactImageFileType} ;

extern ContactImageFileType
    _pascal ContactGetImageFile (RecordID recordID, TCHAR *imageLocation);
/*
 *  Fills buffer with the location of the image file. It does not
 *  check to see if the file exists. Fills buffer with empty
 *  string if no file associated. The image is expected to be in the
 *  "Downloaded Files\Contact Images" directory.
 */

extern ContactImageFileType
    _pascal ContactSetImageFile (RecordID recordID, TCHAR *imageLocation);
/*
 *  Pass null pointer in imageLocation to disassociate the
 *  image. Passing an illegal filename or non-existent file will not
 *  return an error. Only the first MAX_IMAGE_DATA_LEN characters of
 *  the location will get stored. The image is expected to be in the
 *  "Downloaded Files\Contact Images" directory.
 */

typedef enum {
    CTFT_OK    ,
    CTFT_INVALID_ID    ,
    CTFT_NO_TONE    ,
} ContactToneFileType} ;

extern ContactToneFileType
    _pascal ContactGetToneFile (RecordID recordID, TCHAR *toneLocation);
/*
 *  Fills buffer with the location of the tone file. It does not
 *  check to see if the file exists. Fills buffer with empty
 *  string if no file associated. The tone is expected to be in the
 *  "Tones" directory.
 */

extern ContactToneFileType
    _pascal ContactSetToneFile (RecordID recordID, TCHAR *toneLocation);
/*
 *  Pass null pointer in toneLocation to disassociate the
 *  tone. Passing an illegal filename or non-existent file will not
 *  return an error. Only the first MAX_TONE_DATA_LEN characters of
 *  the location will get stored. The tone is expected to be in the
 *  "Tones" directory.
 */

extern RecordID
     _pascal ContactCreateGroup (TCHAR *groupName);
/*
 * Creates the group if it doesn't exist.
 * Returns the RecordID of the group, or 0 if out of space on disk.
 */

#define CONTACT_ADD_RECORD_OKAY 		0
#define CONTACT_ADD_RECORD_ERROR 	1

extern word
     _pascal ContactAddRecordToGroup (RecordID childRecord, RecordID group);
/*
 * Adds childRecord to the group.
 * Does check to make sure the group exists of if a cycle would be created.
 * No error returned if child doesn't exist.
 *
 * Only returns error (CONTACT_ADD_RECORD_ERROR) if out of space on device;
 * in that case, you should
 * stop adding group members and skip any space checks.
 *
 * Otherwise, if CONTACT_ADD_RECORD_OKAY is returned, after adding group
 * members you should call ContactGetDBDiskHandle() and pass the handle to
 * FoamWarnSpaceAfterOperationOnDisk().
 */

extern Boolean
      _pascal ContactIsRecordAGroup (Handle record);
/*
 * TRUE if this record is a group record.
 * (It is a record if it has a CFT_IS_GROUP field).
 */

extern void
    _pascal ContactRemoveRecordFromGroup (RecordID recordToRemove, RecordID group);
/*
 * Removes recordToRemove from group if it is currently a member.
 */

extern optr
        _pascal ContactListGroups (Boolean getMemberCount );
/*
 * Returns a chunk array listing all groups currently in the db.
 * Each element in the chunk array is of type ContactListGroupStruct.
 * The memory block the chunk array is in should be freed by the caller.
 * The chunk array is the only thing in the block.
 * Passing getMemberCount of TRUE will fill in the CGLS_numMembers field,
 * otherwise the value will be 0.
 */

extern Boolean _pascal
ContactIsLockedRecordInGroup(RecordID group, RecordHeader *record);
/*
 * Determines if the record is in the specified group.
 * Returns TRUE/FALSE.
 */

typedef word ContactEnumReturnValue ;
#define CERV_CONTINUE_ENUM  0
#define CERV_STOP_ENUM      1
#define CERV_ERROR          2
/*
 * The callback called during an enum can return CERV_CONTINUE_ENUM
 * to continue processing to the next record.
 * It should return CERV_STOP_ENUM if it should stop processing records.
 * and the routine itself may return CERV_ERROR if there was a memory
 * error and all the records could not be processed.
 * If you need to return real data from the callback, you should
 * pass it along via the arguments data1 and data2.
 * Any value other than 0, will stop the processing.
 */

typedef ContactEnumReturnValue _pascal GroupCallbackFunc (RecordHeader *record, void *data1, void *data2);
/*
 * callback for EnumOnGroupMembers and EnumOnAllGroupMembers.
 */

typedef ContactEnumReturnValue _pascal GroupHandleCallbackFunc (MemHandle *record, void *data1, void *data2);
/*
 * callback for EnumOnGroupsRecordIsIn and EnumOnAllGroupsRecordIsIn.
 */

ContactEnumReturnValue _pascal
ContactEnumOnGroupMembers (RecordID groupID, GroupCallbackFunc *callback, void *data1, void *data2);
/*
 * Calls a callback routine for all members of the group.
 * data1 and data2 are passed to callback.
 * Returns the value of the callback.  The callback should return non-zero to stop the enum.
 */

ContactEnumReturnValue _pascal
ContactEnumOnALLGroupMembers (RecordID groupID, GroupCallbackFunc *callback, void *data1, void *data2);
/*
 * Calls a callback routine for all members and all descendents of the group.
 * The groups which are members, and the origin group will be called too.
 * A record is guaranteed to be called only once no matter how many ways it is
 * a descendant of the given group.
 *
 * data1 and data2 are passed to callback.
 * Returns the value of the callback.  The callback should return non-zero to stop the enum.
 */

Boolean _pascal
ContactIsLockedRecordAGroup(RecordHeader *record);
/*
 * Determines if the record is a group or not.
 */

ContactEnumReturnValue _pascal
ContactEnumOnGroups(GroupCallbackFunc *callback, void *data1, void *data2);
/*
 * Calls a callback routine for all records in the database which are groups.
 * data1 and data2 are passed to callback.
 * Returns the value of the callback.  The callback should return non-zero to stop the enum.
 */

Boolean _pascal
ContactIsRecordInGroup(RecordID rid, RecordID gid, word checkParentGroups);
/*
 * Determines if the record (rid) is in group (gid).
 * If checkParentGroups is TRUE then, the routine will return TRUE if gid is an
 * ancestor of rid, otherwise gid has to be a direct parent of rid.
 */

ContactEnumReturnValue _pascal
ContactEnumOnGroupsRecordIsIn(RecordID record, GroupHandleCallbackFunc *callback, void *data1, void *data2);
/*
 * Calls a callback routine for all groups the record (possibly a group) is direct member of.
 * data1 and data2 are passed to callback.
 * Returns the value of the callback.  The callback should return non-zero to stop the enum.
 */

ContactEnumReturnValue _pascal
ContactEnumOnALLGroupsRecordIsIn(RecordID record, GroupHandleCallbackFunc *callback, void *data1, void *data2);
/*
 * Calls a callback routine for all groups the record (possibly a group) is direct member or
 * desendent of.
 *
 * data1 and data2 are passed to callback.
 * Returns the value of the callback.  The callback should return non-zero to stop the enum.
 */

RecordID _pascal
ContactMatchGroupName(TCHAR *groupName);
/*
 * Determines if the given group exists or not.
 * Returns the RecordID of the group or NULL_GROUP_ID if it doesn't exist.
 */

#define CONTACT_RENAME_DB_OKAY 			0
#define CONTACT_RENAME_DB_ERROR 			1
#define CONTACT_RENAME_DB_ERROR_NAME_EXISTS 	2

word _pascal
ContactRenameDB(word dbIndex, TCHAR *newName);
/*
 * Rename a database on the memory card.
 *
 * Pass:	newName	= new name (NULL-terminated)
 *		dbIndex	= index of name on memcard to change (0 is first).
 *			  -1 for "selected" db in ContactList.
 *
 * Return:		=  CONTACT_RENAME_DB_OKAY (no error)
 *			=  CONTACT_RENAME_DB_ERROR (unspecified error)
 *			=  CONTACT_RENAME_DB_ERROR_NAME_EXISTS (name already
 *				exists)
 */

RecordID _pascal
ContactCopyRecordToDB(VMFileHandle destDBHandle, VMFileHandle srcDBHandle,
                       MemHandle srcRecord);
/*
 * Copies a record from one database to another.
 * If the record is a group, create a new group (if necessary) and copy all
 * the members
 *
 *	 *** original record is always discarded ***
 *
 * Return:	RecordID of new record if copy is successful,
 *	     or RecordID of already-existing identical record in dest,
 *	     or 0 if the destination is full, or memcard cover is open.
 */

void _pascal
ContactRenameGroup(RecordID group, TCHAR *newName);
/*
 * Rename a group.
 * newName is ptr to the new NULL-terminated name.
 * Group names are limited to MAX_GROUP_NAME_LEN characters.
 */

int _pascal
ContactDeleteDatabase(TCHAR *dbName);
/*
 * Close and delete the database on the memory card.
 * Returns 0 if succesful, 1 if there is a problem closing it.
 */

void _pascal
ContactDrawMMCTitle(GStateHandle gstate, word xPos, word yPos);
/*
 * Draws "MMC_ICON <dbname>" into a gstate.
 * Useful for apps that need that as their title.
 */

#define DRAW_MMC_ICON  0
#define DRAW_TONE_ICON  1

void _pascal
ContactDrawBitmap(GStateHandle gstate, word xPos, word yPos, word whichIcon);
/*
 * Draws either the MMC icon or the TONE icon the contdb library uses.
 * Useful for apps that need that as their title.
 * use DRAW_MMC_ICON or DRAW_TONE_ICON for whichIcon
 */

typedef byte CallerGroupData ;

CallerGroupData _pascal
ContactReadCallerGroupField(TCHAR *dbName, RecordID groupID);
/*
 * Reads the CallerGroup information for the group.
 * Returns 0 on invalid dbname or if the record isn't a group.
 * Returns 0 if CallerGroup data is never set on the group.
 * Use the constant CONTACT_DEVICE_DB_NAME for dbName to access the device db
 */

void _pascal
ContactWriteCallerGroupField(TCHAR *dbName, RecordID groupID,
                            CallerGroupData bitsToSet,
                            CallerGroupData bitsToClear);
/*
 * Sets the CallerGroup data.
 * If the dbname is invalid or the group isn't a caller group, nothing happens.
 * Use the constant CONTACT_DEVICE_DB_NAME for dbName to access the device db
 */

Boolean _pascal
ContactIsRecordInCallerGroup(MemHandle record, CallerGroupData groupsToMatch);
/*
 * Determines if the contact record is in a descendent of a group which
 * has CallerGroupData with bits in common to "groupsToMatch'.
 * Recursively checks all ancestors of the passed record.
 */

CallerGroupData _pascal
ContactRecordReadCallerGroups(MemHandle record);
/*
 * Returns the CallerGroupData for the record.
 * Returns 0 if the data has never been set.
 */

extern Boolean
    _pascal ContactDeleteRecord (MemHandle record);
/*
 *	Deletes a record from the DB like FoamDBDeleteRecord, but
 *	also cleans up references to it if it's a group.
 *	The current DB must be the DB the record is from.
 *	Returns value from FoamDBDeleteRecord().
 */

extern DiskHandle
    _pascal ContactGetDBDiskHandle (void);
/*
 *	Return the disk handle for the disk that holds the caller's
 *	current DB.   (Use with FoamWarnIfOutOfSpaceOnDisk, etc.)
 *	Blocks while the DB is closed during backup.
 */

extern word
    _pascal ContactGetGroupCount (void);
/*
 *	Count the number of groups in the current DB.
 */

extern void
    _pascal ContactCloseDBFilesOnMMC (void);
/*
 *	Close the DB files on MMC, probably for backup.
 *	Block until all files are closed.
 */

extern void
    _pascal ContactReOpenDBFilesOnMMC (void);
/*
 *	Reopen all the DB files on MMC, probably after backup.
 */

#ifdef	__HIGHC__
pragma Alias(ContactGetDBHandle, "CONTACTGETDBHANDLE");
pragma Alias(ContactGetDBHandleNoBlock, "CONTACTGETDBHANDLENOBLOCK");
pragma Alias(ContactReleaseDBHandle, "CONTACTRELEASEDBHANDLE");
pragma Alias(ContactCloseDBFile, "CONTACTCLOSEDBFILE");
pragma Alias(ContactReOpenDBFile, "CONTACTREOPENDBFILE");
pragma Alias(ContactCreateRecordFromTemplate, "CONTACTCREATERECORDFROMTEMPLATE");
pragma Alias(ContactEnsureField, "CONTACTENSUREFIELD");
pragma Alias(ContactEnsureEmptyField, "CONTACTENSUREEMPTYFIELD");
pragma Alias(ContactSetTemplateRecord, "CONTACTSETTEMPLATERECORD");
pragma Alias(ContactSaveRecord, "CONTACTSAVERECORD");
pragma Alias(ContactGetUserDataID, "CONTACTGETUSERDATAID");
pragma Alias(ContactGetUserDataName, "CONTACTGETUSERDATANAME");
pragma Alias(ContactMatchNumber, "CONTACTMATCHNUMBER");
pragma Alias(ContactMatchName, "CONTACTMATCHNAME");
pragma Alias(ContactGetName, "CONTACTGETNAME");
pragma Alias(ContactGetTruncatedName, "CONTACTGETTRUNCATEDNAME");
pragma Alias(SpeedDialGetSlot,"SPEEDDIALGETSLOT");
pragma Alias(SpeedDialGetRecord,"SPEEDDIALGETRECORD");
pragma Alias(SpeedDialSetRecord,"SPEEDDIALSETRECORD");
pragma Alias(SpeedDialGetNumber,"SPEEDDIALGETNUMBER");
pragma Alias(ContactImportDBFromTextFile,"CONTACTIMPORTDBFROMTEXTFILE");
pragma Alias(ContactImportDBFromTextFileStatus, "CONTACTIMPORTDBFROMTEXTFILESTATUS");
pragma Alias(ContactExportDBToTextFile,"CONTACTEXPORTDBTOTEXTFILE");
pragma Alias(ContdbRecreateFieldLabel,"CONTDBRECREATEFIELDLABEL");
pragma Alias(ContdbTranslateSubFieldLabelToEnglish,"CONTDBTRANSLATESUBFIELDLABELTOENGLISH");
pragma Alias(ContactCompareNumbers, "CONTACTCOMPARENUMBERS");
pragma Alias(ContactChangeNetworkVersion, "CONTACTCHANGENETWORKVERSION");
pragma Alias(ContactVerifyNetworkVersion, "CONTACTVERIFYNETWORKVERSION");
pragma Alias(ContactGetDBName, "CONTACTGETDBNAME");
pragma Alias(ContactChangeStandardDB, "CONTACTCHANGESTANDARDDB");
pragma Alias(ContactSetOverrideDB, "CONTACTSETOVERRIDEDB");
pragma Alias(ContactRemoveOverrideDB, "CONTACTREMOVEOVERRIDEDB");
pragma Alias(ContactRestoreOverrideDB, "CONTACTRESTOREOVERRIDEDB");
pragma Alias(ContactCreateNewDB, "CONTACTCREATENEWDB");
pragma Alias(ContactGetNumDBsOnMemoryCard, "CONTACTGETNUMDBSONMEMORYCARD");
pragma Alias(ContactGetMemCardStatus, "CONTACTGETMEMCARDSTATUS");
pragma Alias(ContactGetImageFile, "CONTACTGETIMAGEFILE");
pragma Alias(ContactSetImageFile, "CONTACTSETIMAGEFILE");
pragma Alias(ContactGetToneFile, "CONTACTGETTONEFILE");
pragma Alias(ContactSetToneFile, "CONTACTSETTONEFILE");
pragma Alias(ContactCreateGroup, "CONTACTCREATEGROUP");
pragma Alias(ContactAddRecordToGroup, "CONTACTADDRECORDTOGROUP");
pragma Alias(ContactIsRecordAGroup, "CONTACTISRECORDAGROUP");
pragma Alias(ContactRemoveRecordFromGroup, "CONTACTREMOVERECORDFROMGROUP");
pragma Alias(ContactListGroups, "CONTACTLISTGROUPS");
pragma Alias(ContactIsLockedRecordInGroup, "CONTACTISLOCKEDRECORDINGROUP");
pragma Alias(ContactEnumOnGroupMembers, "CONTACTENUMONGROUPMEMBERS");
pragma Alias(ContactEnumOnALLGroupMembers, "CONTACTENUMONALLGROUPMEMBERS");
pragma Alias(ContactIsLockedRecordAGroup, "CONTACTISLOCKEDRECORDAGROUP");
pragma Alias(ContactEnumOnGroups, "CONTACTENUMONGROUPS");
pragma Alias(ContactIsRecordInGroup, "CONTACTISRECORDINGROUP");

/*
 * Use #define instead of pragma to get rid of problems in the .gp file.
 */
#if 0
pragma Alias(ContactGroupIsContactRecordInGroup, "CONTACTGROUPISCONTACTRECORDINGROUP");
pragma Alias(ContactEnumOnRecordParents, "CONTACTENUMONRECORDPARENTS");
pragma Alias(ContactEnumOnALLRecordParents, "CONTACTENUMONALLRECORDPARENTS");
#endif

pragma Alias(ContactEnumOnGroupsRecordIsIn, "CONTACTENUMONGROUPSRECORDISIN");
pragma Alias(ContactEnumOnALLGroupsRecordIsIn, "CONTACTENUMONALLGROUPSRECORDISIN");
pragma Alias(ContactMatchGroupName, "CONTACTMATCHGROUPNAME");
pragma Alias(ContactRenameDB, "CONTACTRENAMEDB");
pragma Alias(ContactCopyRecordToDB, "CONTACTCOPYRECORDTODB");
pragma Alias(ContactRenameGroup, "CONTACTRENAMEGROUP");
pragma Alias(ContactDeleteDatabase, "CONTACTDELETEDATABASE");
pragma Alias(ContactDrawMMCTitle, "CONTACTDRAWMMCTITLE");
pragma Alias(ContactDrawBitmap, "CONTACTDRAWBITMAP");
pragma Alias(ContactReadCallerGroupField, "CONTACTREADCALLERGROUPFIELD");
pragma Alias(ContactWriteCallerGroupField, "CONTACTWRITECALLERGROUPFIELD");
pragma Alias(ContactIsRecordInCallerGroup, "CONTACTISRECORDINCALLERGROUP");
pragma Alias(ContactRecordReadCallerGroups, "CONTACTRECORDREADCALLERGROUPS");
pragma Alias(ContactDeleteRecord, "CONTACTDELETERECORD");
pragma Alias(ContactGetDBDiskHandle, "CONTACTGETDBDISKHANDLE");
pragma Alias(ContactGetGroupCount, "CONTACTGETGROUPCOUNT");
pragma Alias(ContactCloseDBFilesOnMMC, "CONTACTCLOSEDBFILESONMMC");
pragma Alias(ContactReOpenDBFilesOnMMC, "CONTACTREOPENDBFILESONMMC");

#endif  /* _HIGH_C */

#endif /* _CONTDB_H_ */


contlog.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    (c) Copyright Geoworks 1994 -- All Rights Reserved
    GEOWORKS CONFIDENTIAL

PROJECT:	GEOS
MODULE:		Contact Log
FILE:		contlog.goh

AUTHOR:		Vivek Narasayya, Dec 20, 1994

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    VN	12/20/94   	Initial version.

DESCRIPTION:
    Header file for the contact log and recent contacts lists.

    $Id: contlog.goh,v 1.28.1.16 98/10/22 18:37:28 simon Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@optimize
@deflib	contlog

/* -------------------------------------------------------------------------
 *   Constants
 * ------------------------------------------------------------------------*/

#define NAMENUMBER_LENGTH 	31
#define TYPE_STRING_LENGTH 	16
#define DIRECTION_STRING_LENGTH 	16
#define DATETIME_STRING_LENGTH 	18
#define DURATION_BUFFER_SIZE 	30

#define CONTACT_LOG_FILE_NAME 		"ContactLog 11/27/96"
#define RECENT_CONTACTS_FILE_NAME 	"RecentContacts 11/27/96"

/*
 *  maximum # of entries in the general contact log
 */
#define MAX_CONTACT_LOG_ENTRIES 		5000

/*
 *  maximum number of entries in each recent contacts stack
 */
#define MAX_RECENT_CONTACTS_ENTRIES 	20

/* --------------------------------------------------------------------------
 *   Enumerated types
 * ------------------------------------------------------------------------*/

typedef ByteEnum LogEntryDirection ;
#define LED_SENT 	0x0
#define LED_RECEIVED 	0x2
#define LED_MISSED 	0x4
#define LED_ANY 		0x6

typedef ByteEnum LogEntryType ;
#define LET_CALL 		0x0
#define LET_FAX 			0x2
#define LET_SMS 			0x4
#define LET_DATA_MAILBOX 	0x6
#define LET_DATA_WWW 		0x8
#define LET_DATA_TELNET 		0xa
#define LET_DATA_ANY 		0xc		/*  used in views */

#define	LET_DATA			LET_DATA_MAILBOX

typedef enum {
    RC_SENT_CALLS     	= 0x0,
    RC_RECEIVED_CALLS     	= 0x2,
    RC_MISSED_CALLS     	= 0x4,
    RC_SENT_FAXES     	= 0x6,
    RC_RECEIVED_FAXES     	= 0x8,
    RC_SENT_SMS     	= 0xa,
    RC_RECEIVED_SMS     	= 0xc
} RecentContactsType} ;

/*
 * When operating on the log, this type can be used to specify which field
 * is to be used to find matching entries.
 */
typedef ByteEnum LogFieldType ;
#define LFT_ALL 		0x0        		/*  all entries */
#define LFT_NUMBER 	0x2
#define LFT_TYPE 	0x4
#define LFT_DIRECTION 	0x6
#define LFT_DATETIME 	0x8
#define LFT_CONTACT_ID 	0xa
#define LFT_CONTACT_AND_DATETIME  0xc 		/* person logs used in
                           trimming */
#define LFT_MANUALLY_ORIG_CALLS 	0xe		/* for finding manually
                           originated calls */

/* --------------------------------------------------------------------------
 *   Structures
 * ------------------------------------------------------------------------*/

typedef struct {
    word	DAT_year;
    byte	DAT_month;
    byte	DAT_day;
    byte	DAT_hour;
    byte	DAT_minute;
} DateAndTime} ;

typedef	TCHAR NameOrNumber [NAMENUMBER_LENGTH];

typedef ByteFlags LogEntryFlags ; 	/* Internally used flags
                       when processing entries
                       NOTE: must be cleared
                       out when calling
                       LogAddEntry for
                       start of call */

#define LEF_SHOW_COMPANY_NAME 	(0x80)	/* if set, we show
                       company name when multiple
                       number matches are found */
#define LEF_START_LOGGED         (0x40)	/* set after start of call,
                       clear after end of call */
#define LEF_WILDCARD_NUMBER      (0x20)  /* if set, will match any end
                       call log with the same
                       direction, type & datetime */
#define LEF_DO_NOT_STORE_CONTACT_ID  (0x10)
                    /* if set,  do not attempt to match
                     *  phone number to any contact */
/* 4 bits unused */

typedef	struct {
    NameOrNumber	LE_number;
    dword               LE_contactID;
    LogEntryType	LE_type;
    LogEntryDirection	LE_direction;
    dword		LE_duration;
    DateAndTime		LE_datetime;
    LogEntryFlags	LE_flags; 	/* Internally used flags
                       when processing entries
                       NOTE: must be cleared
                       out when calling
                       LogAddEntry for
                       start of call */
} LogEntry} ;

#define LECI_INVALID_CONTACT_ID  0xffffffff

typedef struct {
    dword               RCD_contactID;
    NameOrNumber        RCD_number;
} RecentContactsData} ;

/*--------------------------------------------------------------------------
 * 	Class declarations
 *--------------------------------------------------------------------------*/

typedef WordFlags LogLengthControlFeatures ;
/* 15 bits unused */
#define LLCF_LOG_UI 	(0x0001)

#define	LLC_DEFAULT_FEATURES		LLCF_LOG_UI

@class  LogLengthControlClass, GenControlClass;
@message void  	MSG_LOG_LENGTH_CONTROL_INITIATE_DIALOG  	();
@message void  	MSG_LOG_LENGTH_CONTROL_LIST_ITEM_SELECTED  	();
@instance optr 	LLCI_dialogs;
@endc

@class  LogGenControlClass, GenControlClass;
@message void   MSG_LOG_GEN_CONTROL_LIST_ENTRY_QUERY   ();
@message void   MSG_LOG_GEN_CONTROL_SET_FIELD_SPACING   ();
@message void   MSG_LOG_GEN_CONTROL_DRAW_LIST_MONIKER   (optr list = cx:dx);
@message void	MSG_LOG_GEN_CONTROL_SET_LIST_VISIBILITY	(
            ListVisibilityStatus status = cx);
@message void   MSG_LOG_GEN_CONTROL_DRAW_FIELD_LINES   (GState gstate = cx,
            int top = bp, int bottom = dx);

@instance word 	LGCI_hugeArrayHandle;
@instance byte 	LGCI_listType;
@instance byte 	LGCI_spacingSet;
@instance word 	LGCI_nameNumberLineOffset;
@instance word 	LGCI_typeLineOffset;
@instance word 	LGCI_directionLineOffset;
@instance word 	LGCI_datetimeLineOffset;
@instance word 	LGCI_durationLineOffset;
@endc

typedef WordFlags LogControlFeatures ;
/* 15 bits unused */
#define LCF_LOG_UI 	(0x0001)

#define	LC_DEFAULT_FEATURES		LCF_LOG_UI

@class	LogControlClass, LogGenControlClass;
@message void	MSG_LOG_CONTROL_AFFIRM_DELETE	();
@message void	MSG_LOG_CONTROL_DISPLAY_LOG	();
@message void	MSG_LOG_CONTROL_VIEW_EVENTS_SEARCH_SUBSET	();
@message void	MSG_LOG_CONTROL_TRIM_LOG	();
@message void   MSG_LOG_CONTROL_SELECTION_CHANGED   (int selection = cx);
@message void   MSG_LOG_CONTROL_SELECT_CURRENT_ENTRY   ();

@prototype void LOG_CONTROL_NOTIFY_ENTRY_SELECTED_MSG ();

@vardata Message ATTR_LOG_CONTROL_NOTIFY_ENTRY_SELECTED_MSG;

@default GI_states = (@default | GS_ENABLED);
@default LGCI_listType = 0;
@endc

typedef WordFlags PersonContactsControlFeatures ;
/* 15 bits unused */
#define PCCF_LOG_UI 	(0x0001)

#define PCC_DEFAULT_FEATURES 	PCCF_LOG_UI

@class	PersonContactsControlClass, LogGenControlClass;
@message void   MSG_PERSON_CONTACTS_CONTROL_DISPLAY_LOG   (dword recID = dx:cx);
@message void	MSG_PERSON_CONTACTS_CONTROL_PERSON_CONTACTS_SEARCH_SUBSET	();
@message void   MSG_PERSON_CONTACTS_CONTROL_PERSON_CONTACTS_AFFIRM_DELETE   ();
@default GI_states = (@default | GS_ENABLED);
@default LGCI_listType = 1;

@instance dword PCCI_currentContactID;
@endc

@class	RecentContactsControlClass, LogGenControlClass;
@message void	MSG_RECENT_CONTACTS_CONTROL_RETRIEVE_LIST	(
            RecentContactsType rct = cx);
@message void	MSG_RECENT_CONTACTS_CONTROL_OPEN_LIST	();
@message void	MSG_RECENT_CONTACTS_CONTROL_LIST_QUERY	();
@message void	MSG_RECENT_CONTACTS_CONTROL_CLEAR_ALL	();
@message void   MSG_RECENT_CONTACTS_CONTROL_SELECT_CURRENT_ENTRY   ();

@message void	MSG_RECENT_CONTACTS_CONTROL_ERASE_STACK	();
/* Internal */
@message void   MSG_RECENT_CONTACTS_CONTROL_ERASE_STACK_CANCELED   ();
/* Internal */

/* ---------------------------------------------------------------------------
 *  Messages available only in Communicator products after Feb 1997:
 * --------------------------------------------------------------------------*/

@message void   MSG_RECENT_CONTACTS_CONTROL_COPY_NUMBER   ();
/* Internal */
@message void   MSG_RECENT_CONTACTS_CONTROL_CLEAR_ALL_LISTS   ();
/* Internal: Sent by the Clear lists trigger. */
@message void   MSG_RECENT_CONTACTS_CONTROL_CLEAR_ALL_LISTS_OK   ();
/* Internal: Sent when user has accepted clearing the lists from the */
/*           main view */
@message void   MSG_RECENT_CONTACTS_CONTROL_SELECTION_CHANGED   ();
/* Internal: Sent when a selection has changed in the number list
 */
@message void   MSG_RECENT_CONTACTS_CONTROL_OPEN_GIVEN_LIST   (RecentContactsType
                        rct = cx);
@message void   MSG_RECENT_CONTACTS_CONTROL_CREATE_CARD   (
                        ChunkHandle logGenDynamicList = cx,
            ChunkHandle contactTemplateEditor = dx,
            ChunkHandle contactTemplateEditorBox = bp);
/* Internal */

/* Open the passed list type for viewing.
 */

@prototype void CONTACTS_CONTROL_NOTIFY_ENTRY_SELECTED_MSG (
                    RecentContactsData *data = ss:bp);

@prototype void CONTACTS_CONTROL_NOTIFY_MULTIPLE_ENTRIES_SELECTED_MSG (
            MemHandle block = cx, word count = dx);
/*
 * block = contains RecentContactsData entries
 * count = # of RecentContactsData entries in block
 */

@vardata Message ATTR_RECENT_CONTACTS_CONTROL_NOTIFY_ENTRY_SELECTED_MSG;
@vardata optr    TEMP_RECENT_CONTACTS_CONTROL_CONFIRM_DIALOG;
/* Internal */

/* --------------------------------------------------------------------
 *  Vardata available only in Communicator products after Feb 1997:
 * --------------------------------------------------------------------*/

@vardata Message ATTR_RECENT_CONTACTS_CONTROL_NOTIFY_MULTIPLE_ENTRIES_SELECTED_MSG;
/*
 *  The message sent out when the user selects entries
 *  from the list, and either RCFCF_MULTIPLE_SELECTION or
 *  RCMCF_MULTIPLE_SELECTION is set.
 *
 *  Use callback message CONTACTS_CONTROL_NOTIFY_MULTIPLE_ENTRIES_SELECTED_MSG.
 */

@default LGCI_listType = 2;
@instance word RCCI_listGroupOffset;
@endc

typedef WordFlags RecentContactsPhoneControlFeatures ;
/* 15 bits unused */
#define RCPCF_LOG_UI 	(0x0001)

#define	RCPC_DEFAULT_FEATURES		RCPCF_LOG_UI

@class	RecentContactsPhoneControlClass, RecentContactsControlClass;
@default GI_states = (@default | GS_ENABLED);
@prototype void CONTACTS_PHONE_CONTROL_NOTIFY_MISSED_CALLS_LIST_OPENED_MSG ();
@vardata Message \
    ATTR_RECENT_CONTACTS_PHONE_CONTROL_NOTIFY_MISSED_CALLS_LIST_OPENED_MSG;
@endc

typedef WordFlags RecentContactsFaxControlFeatures ;
/* 14 bits unused */
#define RCFCF_LOG_UI 	(0x0001)
#define RCFCF_MULTIPLE_SELECTION  (0x0002)

#define	RCFC_DEFAULT_FEATURES		RCFCF_LOG_UI

@class	RecentContactsFaxControlClass, RecentContactsControlClass;
@default GI_states = (@default | GS_ENABLED);
@endc

typedef WordFlags RecentContactsSMSControlFeatures ;
/* 14 bits unused */
#define RCMCF_LOG_UI 	(0x0001)
#define RCMCF_MULTIPLE_SELECTION  (0x0002)

#define	RCMC_DEFAULT_FEATURES		RCMCF_LOG_UI

@class	RecentContactsSMSControlClass, RecentContactsControlClass;
@default GI_states = (@default | GS_ENABLED);
@endc

/* ---------------------------------------------------------------------------
 *   Exported functions
 * ------------------------------------------------------------------------*/
/*
 *  This should be called to add log entries. The following situations
 *  are examples of when to use LogAddEntry, and it's effects on the
 *  general and recent contacts:
 *
 * 	1.	At start of call, with duration ZERO.
 * 			entry will have it's duration marked as "unknown".
 *
 * 	2.	At start of call, with duration ZERO, and later again at end
 * 		of call with duration filled in.
 * 			standard way of usage.
 *
 * 	3.	At end of call with duration filled in.
 * 			assumes you forgot to log entry at beginning
 * 			of call.
 *
 *		When calling LogAddEntry at start of call, set LE_flags = 0,
 *		or LEF_WILDCARD_NUMBER if you want matching at the end
 *		of the call to this log entry not be based on the phone number.
 *
 *  In any case, the recent contacts log will reflect the log entry the
 *  first time it is called.
 *
 * 	Returns:	True if error (could be too little diskspace)
 * 			False otherwise, and
 * 				LE_contactID filled in if it was
 * 				initially = LECI_INVALID_CONTACT_ID
 * 				(pass this same LogEntry with duration
 * 				filled in at end of call).
 */
extern	Boolean _far _pascal \
        LogAddEntry        (LogEntry *logEntry);
extern	void _far _pascal \
        LogDeleteAllEntries        ();
extern	void _far _pascal \
        LogDestroy        ();
extern  word _far _pascal \
        RecentContactsGetCount        (RecentContactsType rcType);
extern  word _far _pascal \
        RecentContactsGetEntry        (RecentContactsType rcType, int item, \
            LogEntry *buffer);
extern	word _far _pascal \
    RecentContactsGetNewCount	(RecentContactsType rcType);
extern	void _far _pascal \
    RecentContactsResetNewCount	(RecentContactsType rcType);
extern	Boolean _far _pascal \
        RecentContactsEraseStack        (RecentContactsType rcType);
extern	void _far _pascal \
        RecentContactsResetMissedCallsTotalCount        ();
extern	int _far _pascal \
        RecentContactsGetMissedCallsTotalCount        ();

extern  word _far _pascal \
    LogGetCount	();
/*
 *  Returns the # of items in the Contact Log.
 */

extern	Boolean _far _pascal \
    LogGetEntry	(int item, LogEntry *buffer);
/*
 *  Retrieves the specified entry from the Contact Log.
 *
 * 	Pass:	item - item #
 * 		buffer - LogEntry buffer to be filled
 * 	Return:	TRUE if error
 * 		FALSE otherwise and buffer filled
 */

extern	Boolean _far _pascal \
    LogFindMatchingType	(word lft, optr logEntry,
                VMBlockHandle hugeArray);

/*
 * Returns all the entries which match the given criteria.
 *
 *      Pass:   lft - LogFieldType to determine which fields to use.
 *              logEntry - LogEntry filled in with the appropiate
 *                         fields (not used with LFT_ALL).
 *              hugeArray - HugeArray handle in clipboard to return results.
 *
 *  The following fields will be considered for matching:
 *
 *  LogFieldType			Fields
 *  -------------------------------------------------------------------------
 *  LFT_ALL			none, all entries matched
 *  LFT_NUMBER			LE_number
 *  LFT_TYPE			LE_type
 *  LFT_DIRECTION		LE_direction
 *  LFT_DATETIME		LE_datetime, entries older than the passed
 *  				date/time will be matched
 *  LFT_CONTACT_ID		LE_contactID
 *  LFT_CONTACT_AND_DATETIME 	LE_contactID & LE_datetime, entries
 *  				older than the passed date/time will
 *  				be matched
 *  LFT_MANUALLY_ORIG_CALLS	LE_contactID & LE_direction, LE_type
 *  				must be different
 * 				Note: this is most useful when filled
 * 				with LE_contactID = LECI_INVALID_CONTACT_ID
 * 				     LE_direction = LED_SENT
 * 				     LE_type = LET_DATA_ANY
 */

extern	Boolean _far _pascal \
    LogDeleteMatchingType	(LogFieldType lft, optr logEntry);
/*
 * Deletes matching entries based on the given criteria.
 *
 *      Pass:   lft - LogFieldType to determine which fields to use.
 *              logEntry - LogEntry filled in with the appropiate
 *                         fields (not used with LFT_ALL).
 *
 * See LogFindMatchingType for matching rules.
 */

#ifdef __HIGHC__
pragma	Alias(LogAddEntry, "LOGADDENTRY");
pragma	Alias(LogDeleteAllEntries, "LOGDELETEALLENTRIES");
pragma	Alias(LogDestroy, "LOGDESTROY");
pragma  Alias(RecentContactsGetCount, "RECENTCONTACTSGETCOUNT");
pragma	Alias(RecentContactsGetEntry, "RECENTCONTACTSGETENTRY");
pragma  Alias(RecentContactsGetNewCount, "RECENTCONTACTSGETNEWCOUNT");
pragma  Alias(RecentContactsResetNewCount, "RECENTCONTACTSRESETNEWCOUNT");
pragma  Alias(RecentContactsEraseStack, "RECENTCONTACTSERASESTACK");
pragma  Alias(RecentContactsResetMissedCallsTotalCount, \
          "RECENTCONTACTSRESETMISSEDCALLSTOTALCOUNT");
pragma  Alias(RecentContactsGetMissedCallsTotalCount, \
          "RECENTCONTACTSGETMISSEDCALLSTOTALCOUNT");
pragma 	Alias(LogGetCount, "LOGGETCOUNT");
pragma	Alias(LogGetEntry, "LOGGETENTRY");
pragma  Alias(LogFindMatchingType, "LOGFINDMATCHINGTYPE");
pragma  Alias(LogDeleteMatchingType, "LOGDELETEMATCHINGTYPE");
#endif

@endlib


contSIM.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1997.  All rights reserved.
    GEOWORKS CONFIDENTIAL

PROJECT:
MODULE:
FILE:		contSIM.goh

AUTHOR:		John Mevissen, Dec 24, 1997

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name		Date		Description
    ----		----		-----------
    mevissen	12/24/97   	Initial version.

DESCRIPTION:

    Include file for SIM contact lists.

    DO NOT include this file directly in your app; include contdb.goh ""
    instead.

    $Id: contSIM.goh,v 1.1.1.10 98/06/01 14:24:19 jwu Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef	__CONTSIM_GOH
#define __CONTSIM_GOH

/***********************************************************************
 * local contstants, enums, etc
 **********************************************************************/

#define MAX_SIM_NAME 	30
#define MAX_SIM_NUMBER 	30

typedef enum {
    SIM_LIST_SELECTED	 = 0,
    SIM_LIST_DESELECTED
} ContactSIMListSelectionStatusType} ;

typedef enum {
    CSE_OK		= 0,
    CSE_DATA_FETCHABLE	,
    CSE_DATA_UNAVAILABLE	,
    CSE_SAVE_NOT_EDITING	,
    CSE_SAVE_NAME_TRUNCATED	,
    CSE_SAVE_FAILED	,
    CSE_SAVE_FAILED_SIM_BUSY	,
    CSE_SAVE_FAILED_NUMBER_TOO_LONG	,
    CSE_SAVE_FAILED_MISSING_RESOURCE	,
    CSE_SAVE_FAILED_OTHER_ERROR	,
} ContactSIMError} ;

/***********************************************************************
 * Functions
 **********************************************************************/

extern ContactSIMError
    _pascal ContactSIMGetCacheStatus (void);
/*
 *	Return status of SIM contacts cache - filled, may be filled,
 *		can't be filled:
 *	CSE_OK - contacts cached
 *	CSE_DATA_FETCHABLE - contacts may be fetched
 *	CSE_DATA_UNAVAILABLE - contacts unavailable
 */

extern Boolean
    _pascal ContactSIMFetchContacts (void);
/*
 *	Fetch all the SIM contact data.
 *	Block until finished.
 *	Put up progress dialog while fetching.
 *	Put up error note (via ContactSIMCheckSIMStatus) if contact
 *		cache is empty and the contacts can't be fetched.
 *
 * Return:	TRUE if contacts are cached, ready for use
 *		FALSE if contacts not cached and not available.
 *
 * NOTE:  May invalidate Object segment pointers.
 */

extern ContactSIMError
    _pascal ContactSIMNumber (word *totalSIMContacts,
                 word *usedSIMContacts );
/*
 *	Get total number of available SIM locations, and the number in use.
 *
 *		*total = total number of SIM locations
 *		*used  = used SIM locations
 *
 * Return:	Parameters filled in
 *		CSE_OK if values returned;
 *		CSE_DATA_UNAVAILABLE if cache not fetched yet
 *
 *	NOTE: this routine does NOT force SIM contacts to be fetched.
 *	(Call ContactSIMFetchContacts to fetch contacts.)  This routine
 *	only returns data if they have already been fetched.
 */

extern ContactSIMError
    _pascal ContactSIMGetLocationEntry (word location,
                       TCHAR *name,
                       TCHAR *number );
/*
 *	Return SIM contact name & number strings indexed by
 *	SIM location (1-based counting)
 *
 *		location	= SIM location requested
 *		*name 		= string return buffer for contact name
 *		*number		= string return buffer for contact number
 *
 *		Buffers "name" and "number" must be big enough to
 *		hold return strings and NULL (MAX_SIM_NAME+1, e.g.)
 *
 * Return:	Buffers filled in
 *		CSE_OK if values returned;
 *		CSE_DATA_UNAVAILABLE if cache not fetched yet
 *
 *	NOTE: this routine does NOT force SIM contacts to be fetched.
 *	(Call ContactSIMFetchContacts to fetch contacts.)  This routine
 *	only returns data if they have already been fetched.
 */

extern ContactSIMError
    _pascal ContactSIMGetSortedEntry (word sortOrder,
                     TCHAR *name,
                     TCHAR *number );
/*
 * Same as ContactSIMGetLocationEntry (above), except entries are indexed
 * by name-sorted order (1-based counting).
 */

extern Boolean
    _pascal ContactSIMCheckLocationEmpty (word location);
/*
 *	Utility routine which indicates whether SIM location has data
 *	or is empty
 *
 *		location	= SIM location to check
 *
 * Return:	TRUE if SIM location is empty (no data in either field)
 *		FALSE if SIM location has contact data (at least one field
 *			filled in)
 *
 *	NOTE: It is an error to call this routine before SIM contacts
 *	are fetched.
 */

extern Boolean
    _pascal ContactSIMCheckLocationHasNumber (word location);
/*
 *	Utility routine which indicates whether SIM location has number
 *	data stored
 *
 *		location	= SIM location to check
 *
 * Return:	TRUE if number is present (number field is non-empty)
 *		FALSE if contact has no number (number field is empty)
 *
 *	NOTE: It is an error to call this routine before SIM contacts
 *	are fetched.
 */

extern Boolean
    _pascal ContactSIMCheckSIMStatus (void);
/*
 * 	Check whether phone is on and SIM available.
 *	Put up dialog if not.
 *
 *	Also checks FDN status like ContactSIMCheckFDNStatus();
 *	FDN must be off, or this routine will return FALSE. (If
 *	ContactSIMCheckFDNStatus() returns TRUE, this routine returns
 *	FALSE; if ContactSIMCheckFDNStatus() returns FALSE, the phone
 *	and SIM card are checked via SecurityGetSIMAndPhoneStatus().)
 *
 *		Note: use SecurityGetSIMAndPhoneStatus() (in security lib)
 *		if you wish to check SIM status SILENTLY -- without
 *		putting up user dialogs.  (You must check FDN separately
 *		with SecurityGetFDNStatus().)
 *
 * Return:	TRUE if SIM accessible   (phone on and SIM okay)
 *		FALSE if SIM not accessible
 *			   (phone off or SIM locked, blocked, not ready)
 *
 *
 *	WARNING:  This routine MAY resize LMem and/or object blocks, moving
 *		  them on the heap and invalidating stored segment pointers
 *		  to them, due to the call to FoamDisplayNoteNoBlock.
 *		  (Only if the return value is FALSE and a dialog is put up.)
 */

extern word
    _pascal ContactSIMGetFirstEmptyLocation (void);
/*
 *	Return the SIM location number of the first empty location
 *
 * Return:	first empty SIM location, if any;
 *		0 if all locations are used
 *
 *	NOTE: It is an error to call this routine before SIM contacts
 *	are fetched.
 */

extern word
    _pascal ContactSIMXlatToLocation (word sortOrder);
/*
 *	Translate number from name-sorted order to SIM location #.
 *	That is, return the SIM location corresponding to an entry
 *	in name-sorted order.
 *
 *		sortOrder	= sort order to translate (1-based)
 *
 * Return:	SIM location # (1-based)
 *
 *	NOTE: It is an error to call this routine before SIM contacts
 *	      are fetched.
 *
 *	NOTE: The assembly version of this routine counts sort-order
 *	      starting from zero.  The C-stub counts everything starting
 *	      from one.
 */

extern word
    _pascal ContactSIMXlatToSortOrder (word location);
/*
 *	Translate number from SIM location # to name-sorted order.
 *	That is, return the name-sorted order of a SIM location contact.
 *
 *		location	= SIM location # (1-based)
 *
 * Return:	sort order of that location (1-based)
 *
 *	NOTE: It is an error to call this routine before SIM contacts
 *	      are fetched.
 *
 *	NOTE: The assembly version of this routine counts sort-order
 *	      starting from zero.  The C-stub counts everything starting
 *	      from one.
 */

extern Boolean
    _pascal ContactSIMCheckFDNStatus (void);
/*
 * 	Check whether FDN (fixed-dialing numbers) is active.
 *	Put up dialog if so.
 *	(Like SecurityGetFDNStatus, but puts up a dialog for you too.)
 *
 *		Note: use SecurityGetFDNStatus() (in security lib)
 *		if you wish to check FDN status SILENTLY -- without
 *		putting up user dialogs.
 *
 * Return:	TRUE if FDN active
 *		FALSE if not
 *
 *
 *	WARNING:  This routine MAY resize LMem and/or object blocks, moving
 *		  them on the heap and invalidating stored segment pointers
 *		  to them, due to the call to FoamDisplayNoteNoBlock.
 *		  (Only if the return value is TRUE; a dialog is put up.)
 */

#ifdef	__HIGHC__
pragma Alias(ContactSIMGetCacheStatus, "CONTACTSIMGETCACHESTATUS");
pragma Alias(ContactSIMFetchContacts, "CONTACTSIMFETCHCONTACTS");
pragma Alias(ContactSIMNumber, "CONTACTSIMNUMBER");
pragma Alias(ContactSIMGetLocationEntry, "CONTACTSIMGETLOCATIONENTRY");
pragma Alias(ContactSIMGetSortedEntry, "CONTACTSIMGETSORTEDENTRY");
pragma Alias(ContactSIMCheckLocationEmpty, "CONTACTSIMCHECKLOCATIONEMPTY");
pragma Alias(ContactSIMCheckLocationHasNumber,
                     "CONTACTSIMCHECKLOCATIONHASNUMBER");
pragma Alias(ContactSIMCheckSIMStatus, "CONTACTSIMCHECKSIMSTATUS");
pragma Alias(ContactSIMGetFirstEmptyLocation,
                     "CONTACTSIMGETFIRSTEMPTYLOCATION");
pragma Alias(ContactSIMXlatToLocation, "CONTACTSIMXLATTOLOCATION");
pragma Alias(ContactSIMXlatToSortOrder, "CONTACTSIMXLATTOSORTORDER");
pragma Alias(ContactSIMCheckFDNStatus, "CONTACTSIMCHECKFDNSTATUS");
#endif

/***********************************************************************
 * Classes
 **********************************************************************/

/*
 * ContactSIMListClass
 *
 * Works much like a ContactListClass object, except that it displays contacts
 * from the user's SIM card.  SIM contacts are identified by their "location
 * number" on the SIM card, and each location has two fields: one for the
 * contact name and one for the contact's phone number.  (Or any numeric data.)
 *
 * Data on the SIM card are only available when the phone is turned on; thus,
 * until the user turns on the phone and activates a SIM list, SIM contact
 * data are not available for display in a list and they are not available to
 * the SIM utility routines above.  Once they have been fetched, however, they
 * are cached on the PDA side and remain available, regardless of whether the
 * phone is on or off, until the device is rebooted,
 *
 * If a SIM list in a dialog is put up when SIM contacts have not been cached,
 * it will attempt to fetch them.  This will cause either a progress dialog or
 * an error note to come up, depending on whether the SIM is available.  If the
 * fetch is canceled by the user or there is an error (phone not on, SIM locked,
 * etc.), the SIM list will try to close the dialog it's in.
 *
 * If you do not want the list to attempt a fetch, you can intercept
 * MSG_GEN_INTERACTION_INITIATE for your SIM dialog (or write a handler for the
 * trigger that brings up the list) and use ContactSIMGetCacheStatus to
 * check whether the cache is already filled.
 *
 * Given the visible ugliness of the dialog box opening and then immediately
 * closing itself, it is suggested that you intercept
 * MSG_GEN_INTERACTION_INITIATE anyway, call ContactSIMFetchContacts, and NOT
 * @callsuper() if it returns FALSE.
 */

@class ContactSIMListClass, GenControlClass;

@message ContactSIMListSelectedLocationData
    MSG_CONTACT_SIM_LIST_GET_SELECTED_LOCATION	() = cx:ax;
/*
 *	Returns the number of selected locations, and the currently
 *	selected location.  (That is, the SIM location number,
 *	regardless of list order.)  Useful when you just want to know
 *	"the current selection."  (Check the number of selections to
 *	verify that only one is selected.)
 */

typedef struct {
    word CSLSLD_numSelected;	/* number of selected locations */
    word CSLSLD_location;		/* SIM location number of current */
                    /*   selection (may be GIGS_NONE) */
} ContactSIMListSelectedLocationData} ;

@message ContactSIMListSelectedLocationsListData
     MSG_CONTACT_SIM_LIST_GET_SELECTED_LOCATIONS_LIST	 () = cx:ax;
/*
 *	Return a block handle with a list of selected locations.
 *	Caller must free block if and only if (numSelected != 0)
 */

typedef struct {
    word CSLSLLD_numSelected;	/* number of locations in list */
    MemHandle CSLSLLD_dataBlock;	/* handle to list of SIM locations */
                    /*  (words, 1-based) - GARBAGE if
                     *  CSLSLLD_numSelected is zero */
} ContactSIMListSelectedLocationsListData} ;

@message void MSG_CONTACT_SIM_LIST_CLEAR_SELECTED_ENTRIES ();
/*
 *	Clears SIM locations that are selected in the list
 *	That is, the contact data are deleted.
 */

@message void MSG_CONTACT_SIM_LIST_COPY_CONTACT_RECORDS_TO_SIM (
                MemHandle block=cx,
                word number=dx);
/*
 *	Given a list of contact DB records, copy their names and
 *	numbers to SIM memory.
 */

@message void MSG_CONTACT_SIM_LIST_COPY_LIST_FROM_CONTACTS ( /* private */
                MemHandle block=cx,
                word number=dx,
                word offset=bp);
/*
 *	Copy a list of contDB records to empty SIM locations.
 *	DO NOTE USE - This is a helper called by
 *	MSG_CONTACT_SIM_LIST_COPY_CONTACT_RECORDS_TO_SIM
 */

@message Boolean MSG_CONTACT_SIM_LIST_GET_NAME_SORTED_STATUS () = carry;
/*
 *	Returns whether the SIM list is sorted by name or SIM location
 *	(TRUE if list is name sorted, FALSE if location-sorted.)
 */

@message void MSG_CONTACT_SIM_LIST_SET_NAME_SORTED_STATUS (
                Boolean nameSorted=cx);
/*
 *	Tell the SIM list to display by name- or location-order
 *	Same contact remains selected.
 *
 *	Pass TRUE to set list to name-sorted, FALSE to set location-ordered.
 */

@message void MSG_CONTACT_SIM_LIST_SET_EMERGENCY_NUMBERS (
                word  *list=cx:dx,
                word  number=bp);
/*
 *	Sets the special emergency numbers we're not supposed
 *	to match in the list, by copying it to our block.
 *
 * Pass:	cx:dx	= buffer containing contiguous null-terminated numbers
 *		bp	= length of list (number of emergency numbers)
 */

/***********************************************************************/
/* internal messages - do not use*/

@message void MSG_CONTACT_SIM_LIST_QUERY_USER_MONIKER (optr list=cx:dx,
                              word position=bp);

@message void MSG_CONTACT_SIM_LIST_SEARCH_ENTRIES ();

@message void MSG_CONTACT_SIM_LIST_SET_FOCUS_BY_LOCATION (word location=bp);

@message void MSG_CONTACT_SIM_LIST_SELECTION_CHANGED (
                word current=cx,
                word number=bp,
                GenItemGroupStateFlags flags=dl);

@message void MSG_CONTACT_SIM_LIST_NOTIFY_CONTACT_SELECTED ();

@message void MSG_CONTACT_SIM_LIST_ALTERNATE_NOTIFY_CONTACT_SELECTED ();

@message void MSG_CONTACT_SIM_LIST_SELECT_CURRENT_CONTACT ();

@protominor	NewAPIApr98SIMList;

@message void MSG_CONTACT_SIM_LIST_CUR_SEL_TIMER_SEND_NOW ();
@message void MSG_CONTACT_SIM_LIST_CUR_SEL_TIMER_TIMEOUT_MSG ();
@message void MSG_CONTACT_SIM_LIST_GAINED_FOCUS ();
@message void MSG_CONTACT_SIM_LIST_LOST_FOCUS ();

@protoreset;

@protominor	NewSIMListMessageMay98;
@message void MSG_CONTACT_SIM_LIST_SET_ALTERNATE_LINE_TEXT (TCHAR *text = cx:dx);
@protoreset;

/***********************************************************************
 * prototypes
 */

@prototype void CONTACT_SIM_LIST_STATUS_MSG ( word num = cx );

@prototype void CONTACT_SIM_LIST_NOTIFY_CONTACT_SELECTED_MSG (
                   word location = cx);

@prototype void CONTACT_SIM_LIST_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG (
                MemHandle block = cx, word num = dx);

/*
 * block contains an array, num entries long, of words - the selected
 * SIM locations.
 * block MUST be freed by recipient
 */

@prototype void CONTACT_SIM_LIST_NOTIFY_NUMBER_ENTERED_MSG (
                MemHandle block = cx);
/*
 * Block contains null-terminated number.
 * Block MUST be freed by recipient
 */

/***********************************************************************
 * vardata
 */

@vardata ContdbCallType		ATTR_CONTACT_SIM_LIST_CALL_TYPE;
/*
 * will display all SIM contacts enabled if type == CCT_ANY;
 * for other types (CCT_PHONE, CCT_SMS), contacts are enabled only
 * if something is present in the number field.
 */

@vardata Message	ATTR_CONTACT_SIM_LIST_STATUS_MSG;
/*
 * This field contains the message that is sent out whenever the
 * contact list selection changes
 *
 * Use the CONTACT_SIM_LIST_STATUS_MSG prototype to declare your message.
 */

/*
 * for the following messages, the ALTERNATE version is sent if
 * the list is of type CCT_PHONE and the F1 key has been held down
 * long enough to enable the calling-card mode.
 * Also, contacts can only be selected by this mechanism if
 * the CSLF_SELECT_CONTACT_NUMBER feature is set for the list.
 */

@vardata Message	ATTR_CONTACT_SIM_LIST_NOTIFY_CONTACT_SELECTED_MSG;
@vardata Message    ATTR_CONTACT_SIM_LIST_ALTERNATE_NOTIFY_CONTACT_SELECTED_MSG;
/*
 * The message sent out when the user selects a contact from the
 * list (REQUIRED IF CSLF_SELECT_CONTACT SET).
 *
 * Use the CONTACT_SIM_LIST_NOTIFY_CONTACT_SELECTED_MSG prototype to declare
 * your message.
 */

@vardata Message    ATTR_CONTACT_SIM_LIST_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG;
@vardata Message \
    ATTR_CONTACT_SIM_LIST_ALTERNATE_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG;
/*
 * The message sent out when the user selects a contact from the
 * list, and the list allows multiple selections.
 * (REQUIRED IF CSLF_SELECT_CONTACT and
 * HINT_CONTACT_SIM_LIST_NON_EXCLUSIVE_LIST set.)
 *
 * Use the CONTACT_SIM_LIST_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG
 * prototype to declare your message.
 */

@vardata Message	ATTR_CONTACT_SIM_LIST_NOTIFY_NUMBER_ENTERED_MSG;
@vardata Message    ATTR_CONTACT_SIM_LIST_ALTERNATE_NOTIFY_NUMBER_ENTERED_MSG;
/*
 * The message sent out when there are no matches in the
 * SIM List AND the user has entered a valid phone number
 * in the search field.  Only useful if
 * CSLF_SELECT_CONTACT set. Works when we are of type CCT_PHONE.
 *
 * Use the CONTACT_SIM_LIST_NOTIFY_NUMBER_ENTERED_MSG
 * prototype to declare your message.
 */

@vardata ChunkHandle	ATTR_CONTACT_SIM_LIST_EMERGENCY_NUMBERS;
/*
 * A list of special numbers which will never be matched to
 * SIM contacts when entered in the search box. Contains 1 or more
 *  null-terminated numbers.
 *  The numbers can either be set dynamically using
 *  MSG_CONTACT_SIM_LIST_SET_EMERGENCY_NUMBERS, or be used statically like:
 *
 *  ...
 *  @chunk TCHAR Number1[] = "911";
 *  ...
 *  	ATTR_CONTACT_LIST_EMERGENCY_NUMBERS = @Number1;
 *
 *  NOTE: In GOC you can set only one emergency number statically;
 *        wtih ESP, you can set more.
 */

@vardata void		HINT_CONTACT_SIM_LIST_NON_EXCLUSIVE_LIST;
/*
 * User can select more than one contact (or none) at any time.
 * Default is exclusive list.
 */

@vardata void		HINT_CONTACT_SIM_LIST_NOTIFY_ON_FOCUS_CHANGE;
/*
 * ONLY THE PHONE APP SHOULD USE THIS HINT.
 *
 * Send notification to GCNSLT_CONTACT_SIM_LIST_CHANGES
 * when the SIM list is put up or taken down.
 * It passes a data word of type ContactSIMListSelectionStatusType
 * with the notification GWNT_CONTACT_SIM_LIST_SELECTION_CHANGE.
 */

@vardata void		HINT_CONTACT_SIM_LIST_START_IN_LOCATION_ORDER;
/*
 * Indicates the list should start in location order.
 * Default is name-sorted order.
 */

@vardata void		HINT_CONTACT_SIM_LIST_DO_NOT_DISPLAY_LOCATION_NUMBERS;
/*
 * Indicates that the list should not display SIM location numbers
 * in the first column.
 */

@vardata void		TEMP_CONTACT_SIM_LIST_ALTERNATE_SELECTION_MODE;
/*
 * If present, we should send out an alternate notify contact
 * selected message. Works when we are of type CCT_PHONE.
 */

@protominor	NewSIMListMessageMay98;

@vardata ChunkHandle	TEMP_CONTACT_SIM_LIST_ALTERNATE_LINE_TEXT;

@protoreset;
/***********************************************************************
 * Instance data -- private
 */

typedef	ByteFlags CSListFlags ;
#define	CSLF_NAME_SORTED		0x80
#define	CSLF_CANCEL_COPY		0x40
#define CSLF_SUSPEND_SELECT_NOTIFY  0x20
#define CSLF_REFRESH_LIST 	0x10
#define CSLF_HAVE_FOCUS 		0x08

@instance	CSListFlags	CSLI_flags = CSLF_NAME_SORTED;
@instance	optr 		CSLI_copyProgressOptr;
@noreloc			CSLI_copyProgressOptr;
@instance	word		CSLI_matchLength;

@protominor	NewAPIApr98SIMList;

@instance	hptr		CSLI_timerHandle;
@instance	word		CSLI_timerID;
@instance	word		CSLI_reserved;

@protoreset;

@default GI_states = (@default | GS_ENABLED);

@endc

/*
 * SIMContactList Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 * ATTR_GEN_CONTROL_PROHIBIT_UI)
 */

typedef	WordFlags ContactSIMListFeatures ;
#define	CSLF_SELECT_CONTACT_NUMBER		0x01
    /* Displays a "select" trigger, which allows the user to select a
       contact */

#define	CSL_DEFAULT_FEATURES		0

/***********************************************************************/

@class	ContactSIMEditClass, GenControlClass;

/*
 * NOTE:  In order for the 'memory location' list to display its 'change'
 * trigger properly, you must put your ContactSIMEditClass object into a
 * "properties" GenInteraction.
 */

@message void MSG_CONTACT_SIM_EDIT_DISPLAY_LOCATION (word location = bp);
/*
 *	Sets fields and instance data in an edit object to a
 *	particular SIM location's contact info.  ANY CHANGES TO A
 *	LOCATION ALREADY BEING EDITED ARE DISCARDED.
 */

@message ContactSIMEditFieldLengthData
       MSG_CONTACT_SIM_EDIT_GET_FIELD_LENGTHS	   () = dx:cx;
/*
 *	Get the number of chars in the name and in the number fields
 *	of the SIM edit box.
 *	Useful for testing whether a "Copy to contacts" trigger should
 *	be enabled.
 */

typedef struct {
    word CSEFLD_nameLength;		/* # of chars currently in the name */
    word CSEFLD_numberLength;	/* # of chars currently in the number*/
} ContactSIMEditFieldLengthData} ;

typedef struct {
    word CSESD_location;
    word CSESD_status;
} ContactSIMEditSaveData} ;

@message ContactSIMEditSaveData MSG_CONTACT_SIM_EDIT_SAVE_IF_MODIFIED () = cx:bp;
/*
 *	Save the location being edited to the SIM card.
 *
 * Return:
 *	CSESD_status	= ContactSIMError code:
 *			CSE_OK
 *				No error -- data saved to SIM card.
 *
 *			CSE_SAVE_NOT_EDITING
 *				Edit box has been closed (received
 *				MSG_VIS_CLOSE) and has not received a new
 *				MSG_CONTACT_SIM_EDIT_DISPLAY_LOCATION.  Thus,
 *				no SIM location is defined for the edit object
 *				and no attempt was made to save anything.
 *
 *			CSE_SAVE_NAME_TRUNCATED
 *				ECI "name truncated" error was returned from
 *				from save attempt.  The new number and a
 *				truncated name were saved to SIM card.  Because
 *				the name edit field of the edit object is
 *				limited to the max name length reported by the
 *				SIM card, this error should never occur.
 *
 *	The save attempt fails for each of the following, and no change is made
 *	to data on the SIM card:
 *
 *			CSE_SAVE_FAILED
 *				ECI "fail" error.
 *
 *			CSE_SAVE_FAILED_SIM_BUSY
 *				ECI "busy" error.
 *
 *			CSE_SAVE_FAILED_NUMBER_TOO_LONG
 *				ECI "number too long" error.  This can occur
 *				because the number edit field is sometimes long
 *				enough to accommodate optional "+" or "p"
 *				characters, but the save fails if completely
 *				filled with numbers.
 *
 *			CSE_SAVE_FAILED_MISSING_RESOURCE
 *				Phone off or other internal error -- no
 *				attempt made to save.
 *
 *			CSE_SAVE_FAILED_OTHER_ERROR
 *				Any other ECI error when save attempted.
 *
 *
 *	CSESD_location	= location number saved to, or original location
 *			  if no modifications.
 *			  *** only set if CSESD_status is CSE_OK or
 *			      CSE_SAVE_NAME_TRUNCATED -- garbage otherwise ***
 *
 *		May invalidate object pointers due to call to
 *		ContactSIMCheckSIMStatus()
 *
 * NOTE: If the phone is not on, the SIM contact data cannot be saved to
 * the SIM card.  The handler for this message will test for (phone on) and
 * (SIM available) and put up a dialog box if SIM data cannot be saved.
 * You probably want to test CSESD_status != CSE_OK and take appropriate action
 * in this case.  (For example, not close an edit dialog box.)

 * A SIM edit object in a dialog box sends this message to itself when
 * the dialog box is closed.  If you rely on this mechanism to save changes,
 * note that the user will LOSE CHANGES if the phone is off -- the edit box
 * cannot re-open itself, and it can't save the edit information either.
 * You might want to subclass your dialog box, intercept
 * MSG_GEN_GUP_INTERACTION_COMMAND, and not callsuper if this routine
 * returns error -- that will leave the edit box open.
 */

/* internal messages, do not use */

@message word MSG_CONTACT_SIM_EDIT_GET_NTH_EMPTY_LOCATION (word nth = cx) = cx;

@message void MSG_CONTACT_SIM_EDIT_QUERY_EMPTY_MONIKER (optr list = cx:dx,
                               word item = bp);

/*
 * Instance data -- private
 */

@instance	word	CSEI_editedLocation;  /* SIM location being edited */

@default GI_states = (@default | GS_ENABLED);

@endc

#endif


Internal\ctXferDr.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1995 -- All Rights Reserved

PROJECT:	PC GEOS
MODULE:		Desktop Connectivity
FILE:		ctXferDr.goh

AUTHOR:		Thomas E Lester, Jun 27, 1995

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    lester	6/27/95   	Initial version.

DESCRIPTION:
    Interface definition for Connect Transfer drivers.

    $Id: ctXferDr.goh,v 1.2.6.1 96/04/28 08:32:50 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _CTXFERDR_H_
#define _CTXFERDR_H_

#include  <driver.h>

/*
 * Protocol number for this interface.
 */
#define CTFER_PROTO_MAJOR 	(DRIVER_PROTO_MAJOR+1)
#define CTFER_PROTO_MINOR 	(DRIVER_PROTO_MAJOR+0)

/*----------------------------------------------------------------------------
 *		Structures and Constants
 *--------------------------------------------------------------------------*/

typedef enum {
    CTFDE_NO_ERROR    ,
    CTFDE_ERROR    ,
    CTFDE_FILE_OPEN    ,
    CTFDE_FILE_READ    ,
    CTFDE_FILE_WRITE    ,
    CTFDE_FILE_CREATE    ,
    CTFDE_DISK_FULL    ,
    CTFDE_OUT_OF_MEMORY    ,
    CTFDE_CANCELED    ,
    CTFDE_TRANSFER_STARTING    ,
    CTFDE_TRANSFER_CONTINUES    ,
    CTFDE_TRANSFER_COMPLETE    ,

} ConnectTransferDriverError} ;

/*
 * Structure to pass with DR_CTFD_GET_FILE and DR_CTFD_SEND_FILE
 */
typedef struct {
    DiskHandle	CTFDTA_localDiskHandle;
    char _far *	CTFDTA_localFilePath;
    /*
     * Disk handle and file path specifying the local file.
     */

    char _far *	CTFDTA_remoteFilePath;
    /*
     * Absolute file path specifying the remote file.
     */

    word	CTFDTA_bytesPerStatusReport;
    /*
     * How often to send status reports.
     * 		The driver may not be able to send status reports at the
     *		specified interval, but it needs to send at least a
     *		transfer_starting report and a transfer_complete report.
     */

    optr	CTFDTA_statusOptr;
    /*
     * Object to receive status reports.
     */

    Message	CTFDTA_statusMsg;
    /*
     * The message to send for status reports.
     *		Use the prototype MSG_CTFER_STATUS_MSG below.
     */

} ConnectTransferDriverTransferArgs} ;

/*
 * Connect Transfer Driver Status Types
 */
typedef enum {
    CTDST_BYTE_COUNT    ,
} ConnectTransferDriverStatusType} ;

/*
 * Structure passed with transfer status message.
 */
typedef struct {
    ConnectTransferDriverError		CTFSP_error;
    ConnectTransferDriverStatusType	CTFSP_type;
    dword				CTFSP_data;
} ConnectTransferStatusParams} ;

/*
 * Prototype for transfer status message.
 */
@prototype void CONNECT_TRANSFER_DRIVER_STATUS_MSG (ConnectTransferStatusParams *params = ss:bp);

/*----------------------------------------------------------------------------
 *		Driver Function Calls
 *--------------------------------------------------------------------------*/

/* enum ConnectTransferDriverFunction */
typedef enum {
    DR_CTFD_GET_FILE     = 8,
    DR_CTFD_SEND_FILE     = 10,
    DR_CTFD_CANCEL     = 12,

} ConnectTransferDriverFunction} ;

#endif /* _CTXFERDR_H_ */


Internal\ctXlatDr.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1995 -- All Rights Reserved
 *
 * PROJECT:	  PC GEOS
 * MODULE:	  Desktop Connectivity
 * FILE:	  ctXlatDr.h
 *
 * AUTHOR:  	  Thomas E Lester: May 30, 1995
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	lester	5/30/95   	Initial version
 *
 * DESCRIPTION:
 *	Interface definition for Connect Translation drivers.
 *
 *
 * 	$Id: ctXlatDr.h,v 1.6.3.1 96/04/28 08:32:49 chris Exp $
 *
 ***********************************************************************/
#ifndef _CTXLATDR_H_
#define _CTXLATDR_H_

#include  <driver.h>

/*
 * Protocol number for this interface.
 */
#define CTLATE_PROTO_MAJOR 	(DRIVER_PROTO_MAJOR+1)
#define CTLATE_PROTO_MINOR 	(DRIVER_PROTO_MAJOR+0)

/*----------------------------------------------------------------------------
 *		Structures and Constants
 *--------------------------------------------------------------------------*/

typedef enum {
CTLDE_NO_ERROR,
CTLDE_ERROR,
CTLDE_TRANSLATION_NOT_SUPPORTED,
CTLDE_INVALID_FORMAT,
CTLDE_SOURCE_FILE_EMPTY,
CTLDE_FILE_OPEN,
CTLDE_FILE_READ,
CTLDE_FILE_WRITE,
CTLDE_FILE_CREATE,
CTLDE_FILE_TOO_LARGE,
CTLDE_DISK_FULL,
CTLDE_OUT_OF_MEMORY,
CTLDE_CANCELED,

} ConnectTranslateDriverError} ;

/*
 * Maximum length of a format name string, including null.
 * The format name string is always SBCS so its length = its size.
 */
#define CTLD_FORMAT_NAME_SIZE 		16

/*
 * Structure to pass with DR_CTLD_TRANSLATE.
 */
typedef struct {
    DiskHandle	CTLDA_sourceDiskHandle;
    char       	CTLDA_sourceFilePath[PATH_BUFFER_SIZE+FILE_LONGNAME_BUFFER_SIZE];

    DiskHandle	CTLDA_destDiskHandle;
    char       	CTLDA_destFilePath[PATH_BUFFER_SIZE+FILE_LONGNAME_BUFFER_SIZE];

    char	CTLDA_sourceFormat[CTLD_FORMAT_NAME_SIZE];
    char 	CTLDA_destFormat[CTLD_FORMAT_NAME_SIZE];

} ConnectTranslateDriverArgs} ;

/*----------------------------------------------------------------------------
 *		Driver Function Calls
 *--------------------------------------------------------------------------*/

/* enum ConnectTranslateDriverFunction */
typedef enum {
    DR_CTLD_TRANSLATE     = 8,
    DR_CTLD_CANCEL     = 10,

} ConnectTranslateDriverFunction} ;

#endif /* _CTXLATDR_H_ */


Ansi\ctype.h

/*********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * 	PROJECT:	PC GEOS
 * 	MODULE:
 * 	FILE:		ctype.h
 *
 *	AUTHOR:		jimmy lefkowitz
 *
 *	REVISION HISTORY:
 *
 *	Name	Date		Description
 *	----	----		-----------
 *	jimmy	8/15/91		Initial
 *	schoon	4/8/92		Updated to Ansi C standards
 *
 *	DESCRIPTION:
 *
 *	$Id: ctype.h,v 1.10.4.1 96/04/28 08:30:46 chris Exp $
 *
 *********************************************************************/
#ifndef __CTYPE_H
#define __CTYPE_H

extern int
  _pascal isalnum (unsigned int __c);

extern int
  _pascal isalpha (unsigned int __c);

extern int
  _pascal iscntrl (unsigned int __c);

extern int
  _pascal isdigit (unsigned int __c);

extern int
  _pascal isgraph (unsigned int __c);

extern int
  _pascal islower (unsigned int __c);

extern int
  _pascal isprint (unsigned int __c);

extern int
  _pascal ispunct (unsigned int __c);

extern int
  _pascal isspace (unsigned int __c);

extern int
  _pascal isupper (unsigned int __c);

extern int
  _pascal isxdigit (unsigned int __c);

extern int
  _pascal toupper (unsigned int __c);

extern int
  _pascal tolower (unsigned int __c);

#ifdef __HIGHC__
pragma Alias(isupper, "ISUPPER");
pragma Alias(islower, "ISLOWER");
pragma Alias(isalpha, "ISALPHA");
pragma Alias(ispunct, "ISPUNCT");
pragma Alias(isspace, "ISSPACE");
pragma Alias(iscntrl, "ISCNTRL");
pragma Alias(isdigit, "ISDIGIT");
pragma Alias(isxdigit, "ISXDIGIT");
pragma Alias(isalnum, "ISALNUM");
pragma Alias(isprint, "ISPRINT");
pragma Alias(isgraph, "ISGRAPH");
pragma Alias(toupper, "TOUPPER");
pragma Alias(tolower, "TOLOWER");
#endif

#endif


dbase.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	dbase.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines database structures and routines.
 *
 *	$Id: dbase.h,v 1.25.4.1 96/04/28 08:27:54 chris Exp $
 *
 ***********************************************************************/

#ifndef	__DBASE_H
#define __DBASE_H

#include  <vm.h> 		/* VMFileHandle */
#include  <lmem.h> 	/* LMemDeref */
/*
 * Database types
 */

/* The "GetRef" routines used to return a DBItemRef, which is functionally
 * identical to an optr. They now just use the optr. This typedef is
 * left in for those who still use DBItemRefs. */
typedef optr	 DBItemRef	 ;

#define NullDBGroupAndItem  ((DBGroupAndItem) 0)

#define DBGroupFromGroupAndItem (gi) ((DBGroup) ((gi) >> 16))
#define DBItemFromGroupAndItem (gi) ((DBItem) (gi))

#define DBCombineGroupAndItem (group, item) \
    ((((DBGroupAndItem) (group)) << 16) | (item))

/***/

/* The "GetRef" versions of DBLock return an optr to the chunk in
 * addition to the far pointer.  This allows the code to do other LMem
 * things with the chunk. The optr is not generally needed, so the
 * general DBLock routine is not burdened with returning it.  */

extern void * 	/* XXX */
    _pascal DBLockUngrouped (VMFileHandle file, DBGroupAndItem id);

#define DBLock (file, group, item)	\
    DBLockUngrouped(file, DBCombineGroupAndItem(group, item))

extern void *	/*XXX*/
    _pascal DBLockGetRefUngrouped (VMFileHandle file, DBGroupAndItem id,
              optr *refPtr);

#define DBLockGetRef (file, group, item, refPtr)	\
    DBLockGetRefUngrouped(file, DBCombineGroupAndItem(group, item), refPtr)

/***/

#define DBDeref (ref) 	LMemDeref((optr) (ref))

/***/

extern void
    _pascal DBUnlock (void *ptr);

/***/

extern void
    _pascal DBDirty (const void *ptr);

/***/

#define DB_UNGROUPED 	((DBGroup) 0xffff)

extern DBGroupAndItem	/*XXX*/
    _pascal DBRawAlloc (VMFileHandle file, DBGroup group, word size);

#define DBAlloc (file, group, size)	\
    DBItemFromGroupAndItem(DBRawAlloc((file), (group), (size)))

#define DBAllocUngrouped (file, size)	\
    DBRawAlloc((file), DB_UNGROUPED, (size))

/***/

extern void 	/*XXX*/
    _pascal DBReAllocUngrouped (VMFileHandle file, DBGroupAndItem id, word size);

#define DBReAlloc (file, group, item, size)	\
    DBReAllocUngrouped((file), DBCombineGroupAndItem((group), (item)), (size))

/***/

extern void 	/*XXX*/
    _pascal DBFreeUngrouped (VMFileHandle file, DBGroupAndItem id);

#define DBFree (file, group, item)	\
    DBFreeUngrouped((file), DBCombineGroupAndItem((group), (item)))

/***/

extern DBGroup	/*XXX*/
    _pascal DBGroupAlloc (VMFileHandle file);

/***/

extern void	/*XXX*/
    _pascal DBGroupFree (VMFileHandle file, DBGroup group);

/***/

extern void 	/*XXX*/
    _pascal DBSetMapUngrouped (VMFileHandle file, DBGroupAndItem id);

#define DBSetMap (file, group, item)	\
    DBSetMapUngrouped((file), DBCombineGroupAndItem((group), (item)))

/***/

extern DBGroupAndItem
    _pascal DBGetMap (VMFileHandle file);

#define DBLockMap (file) DBLockUngrouped((file), DBGetMap(file))

/***/

extern void 	/*XXX*/
    _pascal DBInsertAtUngrouped (VMFileHandle file, DBGroupAndItem id,
            word insertOffset, word insertCount);

#define DBInsertAt (file, group, item, off, count)	\
    DBInsertAtUngrouped((file), DBCombineGroupAndItem((group), (item)), (off), (count))

/***/

extern void	/*XXX*/
    _pascal DBDeleteAtUngrouped (VMFileHandle file, DBGroupAndItem id,
            word deleteOffset, word deleteCount);

#define DBDeleteAt (file, group, item, off, count)	\
    DBDeleteAtUngrouped((file), DBCombineGroupAndItem((group), (item)), (off), (count))

extern DBGroupAndItem	/*XXX*/
    _pascal DBRawCopyDBItem (VMFileHandle srcFile, DBGroupAndItem srcID,
             VMFileHandle destFile,  DBGroup destGroup);

#define DBCopyDBItem (srcFile, srcGroup, srcItem, destFile, destGroup)	\
    DBItemFromGroupAndItem(DBRawCopyDBItem((srcFile), 			\
                DBCombineGroupAndItem((srcGroup), (srcItem)),  \
                (destFile), (destGroup)))

#define DBCopyDBItemUngrouped (srcFile, srcID, destFile)		\
    DBRawCopyDBItem((srcFile), (srcID), (destFile), DB_UNGROUPED)

extern Boolean
    _pascal DBInfoUngrouped (VMFileHandle file, DBGroupAndItem grpAndItem,
                word *sizePtr);

#define DBInfo (file, group, item, sizePtr) \
    DBInfoUngrouped((file), DBCombineGroupAndItem((group),(item)), (sizePtr))

#ifdef __HIGHC__
pragma Alias(DBLockUngrouped, "DBLOCKUNGROUPED");
pragma Alias(DBLockGetRefUngrouped, "DBLOCKGETREFUNGROUPED");
pragma Alias(DBUnlock, "DBUNLOCK");
pragma Alias(DBDirty, "DBDIRTY");
pragma Alias(DBRawAlloc, "DBRAWALLOC");
pragma Alias(DBReAllocUngrouped, "DBREALLOCUNGROUPED");
pragma Alias(DBFreeUngrouped, "DBFREEUNGROUPED");
pragma Alias(DBGroupAlloc, "DBGROUPALLOC");
pragma Alias(DBGroupFree, "DBGROUPFREE");
pragma Alias(DBSetMapUngrouped, "DBSETMAPUNGROUPED");
pragma Alias(DBGetMap, "DBGETMAP");
pragma Alias(DBInsertAtUngrouped, "DBINSERTATUNGROUPED");
pragma Alias(DBDeleteAtUngrouped, "DBDELETEATUNGROUPED");
pragma Alias(DBRawCopyDBItem, "DBRAWCOPYDBITEM");
#endif

#endif


dict.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	Spell Library
 * FILE:	spell.goh
 *
 *
 * REVISION HISTORY:
 *
 *	Name	Date		Description
 *	----	----		-----------
 *	atw	9/27/92		Initial revision
 *
 *
 * DESCRIPTION:
 *	Contains controllers for the spell library
 *
 *	$Id: dict.goh,v 1.1.21.1 96/04/28 08:28:50 chris Exp $
 *
 ***********************************************************************/
#ifndef __DICT_GOH
#define __DICT_GOH
@deflib dict

@include  <Objects/gCtrlC.goh>
@include  <Objects/vTextC.goh>

@class DictControlClass, GenControlClass;

/* internal messages that should not be sent by external objects */

@message void MSG_DC_LOOKUP
@message void MSG_DC_MATCH
@message void MSG_DC_SPELL
@message void MSG_DC_WILDCARD
@message void MSG_DC_SEARCH
@message void MSG_DC_ANAGRAMS
@message void MSG_DC_DEFINITION_SELECTED
@message void MSG_DC_RETRIEVAL_TYPE
@message void MSG_DC_PARTS_OF_SPEECH
@message void MSG_DC_RETRIEVE
@message void MSG_DC_OPTION
@message void MSG_DC_GET_DEFINITION_MONIKER

typedef WordFlags DictFeatures ;
#define DF_DICT  0x01
#define DICT_GCM_FEATURES  DF_DICT

typedef WordFlags DictToolboxFeatures ;
#define DTF_DICT  0x01
#define DICT_GCM_TOOLBOX_FEATURES  DTF_DICT

    @instance word	DCI_status;
         @default GCI_output = (TO_APP_TARGET);
    @default GII_visibility = GIV_DIALOG;
    @default GI_states = (@default | GS_ENABLED);

@endc

@endlib

#endif __DICT_GOH


disk.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	disk.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines disk structures and routines.
 *
 *	$Id: disk.h,v 1.17.4.1 96/04/28 08:27:39 chris Exp $
 *
 ***********************************************************************/

#ifndef	__DISK_H
#define __DISK_H

#include  <file.h> 	/* VolumeName */
#include  <drive.h> 	/* DriveType, MediaType */

#define DISK_IS_STD_PATH_MASK 	1

/***/

typedef struct {
    word		DIS_blockSize;
    sdword		DIS_freeSpace;
    sdword		DIS_totalSpace;
    VolumeName	    	DIS_name;
} DiskInfoStruct} ;

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal DiskGetVolumeInfo (DiskHandle dh, DiskInfoStruct *info);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal DiskSetVolumeName (DiskHandle dh, const char *name);

/***/

extern dword				/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal DiskGetVolumeFreeSpace (DiskHandle dh);

/***/

typedef enum /* word */ {
    CALLBACK_GET_SOURCE_DISK    ,
    CALLBACK_REPORT_NUM_SWAPS    ,
    CALLBACK_GET_DEST_DISK    ,
    CALLBACK_VERIFY_DEST_DESTRUCTION    ,
    CALLBACK_REPORT_FORMAT_PCT    ,
    CALLBACK_REPORT_COPY_PCT
} DiskCopyCallback} ;

typedef enum /* word */ {
    ERR_DISKCOPY_INSUFFICIENT_MEM    =0xd0,
    ERR_CANT_COPY_FIXED_DISKS    ,
    ERR_CANT_READ_FROM_SOURCE    ,
    ERR_CANT_WRITE_TO_DEST    ,
    ERR_INCOMPATIBLE_FORMATS    ,
    ERR_OPERATION_CANCELLED    ,
    ERR_CANT_FORMAT_DEST    ,
} DiskCopyError} ;

extern DiskCopyError	/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal DiskCopy (word source, word dest,
            PCB(Boolean, callback, (DiskCopyCallback code,
                     DiskHandle disk,
                     word param)));

/***/
typedef WordFlags DiskFormatFlags ;
#define DFF_CALLBACK_PCT_DONE 	0x0004
#define DFF_CALLBACK_CYL_HEAD 	0x0002
#define DFF_FORCE_ERASE 	    	0x0001

typedef enum {
    FMT_DONE    ,
    FMT_READY    ,
    FMT_RUNNING    ,
    FMT_DRIVE_NOT_READY    ,
    FMT_ERR_WRITING_BOOT    ,
    FMT_ERR_WRITING_ROOT_DIR    ,
    FMT_ERR_WRITING_FAT    ,
    FMT_ABORTED    ,
    FMT_SET_VOLUME_NAME_ERR    ,
    FMT_CANNOT_FORMAT_FIXED_DISKS_IN_CUR_RELEASE    ,
    FMT_BAD_PARTITION_TABLE    ,
    FMT_ERR_READING_PARTITION_TABLE    ,
    FMT_ERR_NO_PARTITION_FOUND    ,
    FMT_ERR_MULTIPLE_PRIMARY_PARTITIONS    ,
    FMT_ERR_NO_EXTENDED_PARTITION_FOUND    ,
    FMT_ERR_CANNOT_ALLOC_SECTOR_BUFFER    ,
    FMT_ERR_DISK_IS_IN_USE    ,
    FMT_ERR_WRITE_PROTECTED    ,
    FMT_ERR_DRIVE_CANNOT_SUPPORT_GIVEN_FORMAT    ,
    FMT_ERR_INVALID_DRIVE_SPECIFIED    ,
    FMT_ERR_DRIVE_CANNOT_BE_FORMATTED    ,
    FMT_ERR_DISK_UNAVAILABLE
} FormatError} ;
extern FormatError	/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal DiskFormat (word driveNumber,
        MediaType media,
        DiskFormatFlags flags,
        dword *goodClusters,
        dword *badClusters,
        DiskHandle disk,
        char *volumeName,
        PCB(Boolean, callback, (word percentDone)) /* true = cancel */);

/***/

extern DiskHandle	/*XXX*/
    _pascal DiskRegisterDisk (word driveNumber);

/***/

extern DiskHandle	/*XXX*/
    _pascal DiskRegisterDiskSilently (word driveNumber);

/***/

extern DiskHandle	/*XXX*/
    _pascal DiskForEach(PCB((Boolean, callback, (DiskHandle disk)) /* true = cancel */);

/***/

extern word	/*XXX*/
    _pascal DiskGetDrive (DiskHandle disk);

/***/

extern void	/*XXX*/
    _pascal DiskGetVolumeName (DiskHandle disk, char *buffer);

/***/

typedef enum /* word */ {
    DFR_UNIQUE    ,
    DFR_NOT_UNIQUE    ,
    DFR_NOT_FOUND    ,
} DiskFindResult} ;

extern DiskHandle	/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal DiskFind (const char *fname, DiskFindResult *code);

/***/

extern Boolean	/*XXX*/
    _pascal DiskCheckWritable (DiskHandle disk);

/***/

extern Boolean	/*XXX*/
    _pascal DiskCheckInUse (DiskHandle disk);

/***/

extern Boolean	/*XXX*/
    _pascal DiskCheckUnnamed (DiskHandle disk);

/***/

extern Boolean _pascal DiskSave (DiskHandle disk, void *buffer, word *bufSizePtr);

/***/

typedef enum /* word */ {
    DRE_DISK_IN_DRIVE    ,
    DRE_DRIVE_NO_LONGER_EXISTS    ,
    DRE_REMOVABLE_DRIVE_DOESNT_HOLD_DISK    ,
    DRE_USER_CANCELED_RESTORE    ,
    DRE_COULDNT_CREATE_NEW_DISK_HANDLE    ,
    DRE_REMOVABLE_DRIVE_IS_BUSY    ,
    DRE_NOT_ATTACHED_TO_SERVER    ,
    DRE_PERMISSION_DENIED    ,
    DRE_ALL_DRIVES_USED
} DiskRestoreError} ;

extern DiskHandle _pascal DiskRestore (void  *buffer,
                  PCB(DiskRestoreError,
                      callback, (const char *driveName,
                        const char *diskName,
                        void **bufferPtr,
                        DiskRestoreError errorPtr)));

#ifdef __HIGHC__
pragma Alias(DiskGetVolumeInfo, "DISKGETVOLUMEINFO");
pragma Alias(DiskSetVolumeName, "DISKSETVOLUMENAME");
pragma Alias(DiskGetVolumeFreeSpace, "DISKGETVOLUMEFREESPACE");
pragma Alias(DiskCopy, "DISKCOPY");
pragma Alias(DiskFormat, "DISKFORMAT");
pragma Alias(DiskRegisterDisk, "DISKREGISTERDISK");
pragma Alias(DiskRegisterDiskSilently, "DISKREGISTERDISKSILENTLY");
pragma Alias(DiskForEach, "DISKFOREACH");
pragma Alias(DiskGetDrive, "DISKGETDRIVE");
pragma Alias(DiskGetVolumeName, "DISKGETVOLUMENAME");
pragma Alias(DiskFind, "DISKFIND");
pragma Alias(DiskCheckWritable, "DISKCHECKWRITABLE");
pragma Alias(DiskCheckInUse, "DISKCHECKINUSE");
pragma Alias(DiskCheckUnnamed, "DISKCHECKUNNAMED");
pragma Alias(DiskSave, "DISKSAVE");
pragma Alias(DiskRestore, "DISKRESTORE");
#endif

#endif


drive.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	drive.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines (logical) drive structures and routines.
 *
 *	$Id: drive.h,v 1.11.26.2 97/07/15 13:57:33 eballot Exp $
 *
 ***********************************************************************/

#ifndef	__DRIVE_H
#define __DRIVE_H

#define DRIVE_MAX_DRIVES 	255

typedef ByteEnum DriveType ;
#define DRIVE_5_25  0
#define DRIVE_3_5  1
#define DRIVE_FIXED  2
#define DRIVE_RAM  3
#define DRIVE_CD_ROM  4
#define DRIVE_8  5
#define DRIVE_PCMCIA  6
#define DRIVE_UNKNOWN  0xf

/***/

#define DS_PRESENT 		0x80
#define DS_MEDIA_REMOVABLE 	0x40
#define DS_NETWORK 		0x20
#define DS_TYPE 			0x0f		/* DriveType */

extern word		/* 0 for error */	/*XXX*/
    _pascal DriveGetStatus (word driveNumber);

/***/

#define DES_LOCAL_ONLY 	    	0x1000
#define DES_READ_ONLY 	    	0x0800
#define DES_FORMATTABLE 	    	0x0400
#define DES_ALIAS    	    	0x0200
#define DES_BUSY     	    	0x0100

extern word	    	/* 0 for error */  	/*XXX*/
    _pascal DriveGetExtStatus (word driveNumber);

/***/

typedef ByteEnum MediaType ;
#define MEDIA_NONEXISTENT  0
#define MEDIA_160K  1
#define MEDIA_180K  2
#define MEDIA_320K  3
#define MEDIA_360K  4
#define MEDIA_720K  5
#define MEDIA_1M2  6
#define MEDIA_1M44  7
#define MEDIA_2M88  8
#define MEDIA_FIXED_DISK  9
#define MEDIA_CUSTOM  10
#define MEDIA_SRAM  11
#define MEDIA_ATA  12
#define MEDIA_FLASH  13

extern MediaType	/*XXX*/
    _pascal DriveGetDefaultMedia (word driveNumber);

/***/

extern Boolean		/* true if media supported */	/*XXX*/
    _pascal DriveTestMediaSupport (word driveNumber, MediaType media);

/***/

extern char _far *    	/* NULL if buffer too small */ /*XXX*/
    _far _pascal DriveGetName (word driveNumber, char _far *buffer,
                  word bufferSize);

#ifdef __HIGHC__
pragma Alias(DriveGetStatus, "DRIVEGETSTATUS");
pragma Alias(DriveGetExtStatus, "DRIVEGETEXTSTATUS");
pragma Alias(DriveGetDefaultMedia, "DRIVEGETDEFAULTMEDIA");
pragma Alias(DriveTestMediaSupport, "DRIVETESTMEDIASUPPORT");
pragma Alias(DriveGetName, "DRIVEGETNAME");
#endif

#endif


driver.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	driver.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines driver structures and routines.
 *
 *	$Id: driver.h,v 1.20.4.1 96/04/28 08:30:03 chris Exp $
 *
 ***********************************************************************/

#ifndef	__DRIVER_H
#define __DRIVER_H

#include  <lmem.h> 	/* LMemBlockHeader */
#include  <geode.h>
/*
 * Driver info structure
 */

/* Geode driver types */

typedef enum /* word */ {
    DRIVER_TYPE_VIDEO    =1,
    DRIVER_TYPE_INPUT    ,
    DRIVER_TYPE_MASS_STORAGE    ,
    DRIVER_TYPE_STREAM    ,
    DRIVER_TYPE_FONT    ,
    DRIVER_TYPE_OUTPUT    ,
    DRIVER_TYPE_LOCALIZATION    ,
    DRIVER_TYPE_FILE_SYSTEM    ,
    DRIVER_TYPE_PRINTER    ,
    DRIVER_TYPE_SWAP    ,
    DRIVER_TYPE_POWER_MANAGEMENT    ,
    DRIVER_TYPE_TASK_SWITCH    ,
    DRIVER_TYPE_NETWORK    ,
    DRIVER_TYPE_SOUND    ,
    DRIVER_TYPE_PAGER    ,
    DRIVER_TYPE_PCMCIA    ,
    DRIVER_TYPE_FEP    ,
    DRIVER_TYPE_MAILBOX_DATA    ,
    DRIVER_TYPE_MAILBOX_TRANSPORT    ,
    DRIVER_TYPE_SOCKET    ,
    DRIVER_TYPE_SCAN    ,
    DRIVER_TYPE_OTHER_PROCESSOR    ,
    DRIVER_TYPE_MAILBOX_RECEIVE    ,
    DRIVER_TYPE_MODEM    ,
    DRIVER_TYPE_CONNECT_TRANSLATE    ,
    DRIVER_TYPE_CONNECT_TRANSFER
} DriverType} ;

/* Geode driver attributes */

typedef WordFlags DriverAttrs ;
#define DA_FILE_SYSTEM 		0x8000
#define DA_CHARACTER 		0x4000
#define DA_HAS_EXTENDED_INFO 	0x2000

/* Structure of a driver info table */

typedef struct {
    void		(*DIS_strategy)();
    DriverAttrs		DIS_driverAttributes;
    DriverType		DIS_driverType;
} DriverInfoStruct} ;

/***/

extern GeodeHandle			/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal GeodeUseDriver (const char *name, word protoMajor, word protoMinor,
                    GeodeLoadError *err);

/***/

extern void	/*XXX*/
    _pascal GeodeFreeDriver (GeodeHandle gh);

/***/

extern DriverInfoStruct *	/*XXX*/
    _pascal GeodeInfoDriver (GeodeHandle gh);

/***/

typedef enum /* word */ {
    GDDT_FILE_SYSTEM    =0,
    GDDT_KEYBOARD    =2,
    GDDT_MOUSE    =4,
    GDDT_VIDEO    =6,
    GDDT_MEMORY_VIDEO    =8,
    GDDT_POWER_MANAGEMENT    =10,
    GDDT_TASK    =12
} GeodeDefaultDriverType} ;

extern GeodeHandle	/*XXX*/
    _pascal GeodeGetDefaultDriver (GeodeDefaultDriverType type);

/***/

extern void	/*XXX*/
    _pascal GeodeSetDefaultDriver (GeodeDefaultDriverType type, GeodeHandle gh);

/*
 * Driver function calls
 */

#define DR_INIT 		0
#define DR_EXIT 		2
#define DR_SUSPEND   	4
#define DR_UNSUSPEND 	6

#define DRIVER_SUSPEND_ERROR_BUFFER_SIZE  128

#define DRIVER_PROTO_MAJOR 	2
#define DRIVER_PROTO_MINOR 	0

/*
 *	Extended driver definitions
 */

#define DRIVER_EXT_PROTO_MAJOR 	(DRIVER_PROTO_MAJOR+1)
#define DRIVER_EXT_PROTO_MINOR 	(DRIVER_PROTO_MINOR+0)

typedef enum /* word */ {
    DP_NOT_PRESENT    =0xffff,
    DP_CANT_TELL    =0,
    DP_PRESENT    =1,
    DP_INVALID_DEVICE    =0xfffe
} DevicePresent} ;

#define DRE_TEST_DEVICE 	8
#define DRE_SET_DEVICE 	10

/* Structure of an extended driver info table */

typedef struct {
    DriverInfoStruct	DEIS_common;
    MemHandle		DEIS_resource;
} DriverExtendedInfoStruct} ;

/* Maximum size of device name strings (see DEIT_nameTable, below). */

#define GEODE_MAX_DEVICE_NAME_LENGTH 	64
#define GEODE_MAX_DEVICE_NAME_SIZE  GEODE_MAX_DEVICE_NAME_LENGTH * sizeof(TCHAR)

typedef struct {
    LMemBlockHeader	DEIT_common;
    word		DEIT_numDevices;
    ChunkHandle		DEIT_ChunkHandle;
    word		DEIT_infoTable;
} DriverExtendedInfoTable} ;

/*
 *	Driver standard escape codes
 */

#define DRV_ESC_QUERY_ESC 	0x8000

#ifdef __HIGHC__
pragma Alias(GeodeUseDriver, "GEODEUSEDRIVER");
pragma Alias(GeodeFreeDriver, "GEODEFREEDRIVER");
pragma Alias(GeodeInfoDriver, "GEODEINFODRIVER");
pragma Alias(GeodeGetDefaultDriver, "GEODEGETDEFAULTDRIVER");
pragma Alias(GeodeSetDefaultDriver, "GEODESETDEFAULTDRIVER");
#endif

#endif


ec.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	ec.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines error checking structures and routines.
 *
 *	$Id: ec.h,v 1.27.1.1 96/04/28 08:29:15 chris Exp $
 *
 ***********************************************************************/

#ifndef	__EC_H
#define __EC_H

/*
 * Definitions for fatal errors
 */

#define SYSTEM_ERROR_CODES  CAN_NOT_USE_CHUNKSIZEPTR_MACRO_ON_EMPTY_CHUNKS, \
    CHUNK_ARRAY_BAD_ELEMENT, MACRO_REQUIRES_FIXED_SIZE_ELEMENTS, CANNOT_USE_DBCS_IN_THIS_VERSION

/***/

extern void	/*XXX*/
    _pascal CFatalError (word code);

#define FatalError (code) CFatalError(code)

extern void
    _pascal CWarningNotice (word code);

#define Warning (code)	CWarningNotice(code)

/***/

extern void    /*XXX*/
    _pascal ECCheckFileHandle (FileHandle fh);

/***/

extern void	/*XXX*/
    _pascal ECCheckMemHandle (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal ECCheckMemHandleNS (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal ECCheckThreadHandle (ThreadHandle th);

/***/

extern void	/*XXX*/
    _pascal ECCheckProcessHandle (GeodeHandle gh);

/***/

extern void	/*XXX*/
    _pascal ECCheckResourceHandle (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal ECCheckGeodeHandle (GeodeHandle gh);

/***/

extern void	/*XXX*/
    _pascal ECCheckDriverHandle (GeodeHandle gh);

/***/

extern void	/*XXX*/
    _pascal ECCheckLibraryHandle (GeodeHandle gh);

/***/

extern void	/*XXX*/
    _pascal ECCheckGStateHandle (GStateHandle gsh);

/***/

extern void	/*XXX*/
    _pascal ECCheckWindowHandle (WindowHandle wh);

/***/

extern void	/*XXX*/
    _pascal ECCheckQueueHandle (QueueHandle qh);

/***/

extern void	/*XXX*/
    _pascal ECCheckEventHandle (EventHandle eh);

/***/

extern void	/*XXX*/
    _pascal ECCheckLMemHandle (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal ECCheckLMemHandleNS (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal ECLMemValidateHeap (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal ECLMemValidateHandle (optr o);

#define ECLMemValidateHandleHandles (mh, ch) \
        ECLMemValidateHandle(ConstructOptr(mh, ch))

/***/

extern void	/*XXX*/
    _pascal ECCheckLMemChunk (void *chunkPtr);

/***/

extern void	/*XXX*/
    _pascal ECMemVerifyHeap (void);

/***/

extern void	/*XXX*/
    _pascal ECLMemExists (optr o);

#define ECLMemExistsHandles (mh, ch) ECLMemExists(ConstructOptr(mh, ch))

/***/

extern void	/*XXX*/
    _pascal ECCheckChunkArray (optr o);

#define ECCheckChunkArrayHandles (mh, ch) \
        ECCheckChunkArray(ConstructOptr(mh, ch))

/***/

extern void	/*XXX*/
    _pascal ECCheckClass (ClassStruct *class);

/***/

extern void	/*XXX*/
    _pascal ECCheckObject (optr obj);

#define ECCheckObjectHandles (mh, ch) ECCheckObject(ConstructOptr(mh, ch))

/***/

extern void	/*XXX*/
    _pascal ECCheckLMemObject (optr obj);

#define ECCheckLMemObjectHandles (mh, ch) \
        ECCheckLMemObject(ConstructOptr(mh, ch))

/***/

extern void	/*XXX*/
    _pascal ECCheckOD (optr obj);

#define ECCheckODHandles (mh, ch) ECCheckOD(ConstructOptr(mh, ch))

/***/

extern void	/*XXX*/
    _pascal ECCheckLMemOD (optr o);

#define ECCheckLMemODHandles (mh, ch) ECCheckLMemOD(ConstructOptr(mh, ch))

/***/

extern void	/*XXX*/
    _pascal ECCheckStack (void);

/***/

extern void	/*XXX*/
    _pascal ECVMCheckVMFile (VMFileHandle file);

extern void	/*XXX*/
    _pascal ECVMCheckVMBlockHandle (VMFileHandle file, VMBlockHandle block);

extern void	/*XXX*/
    _pascal ECVMCheckMemHandle (MemHandle han);

/***/

extern void	/*XXX*/
    _pascal ECCheckBounds (void *address);

/***/

#if 0
typedef WordFlags ErrorCheckingFlags;
#define ECF_REGION 		0x8000
#define ECF_HEAP_FREE_BLOCKS 	0x4000
#define ECF_LMEM_INTERNAL 	0x2000
#define ECF_LMEM_FREE_AREAS 	0x1000
#define ECF_LMEM_OBJECT 		0x0800
#define ECF_BLOCK_CHECKSUM 	0x0400
#define ECF_GRAPHICS 		0x0200
#define ECF_SEGMENT 		0x0100
#define ECF_NORMAL 		0x0080
#define ECF_VMEM 		0x0040
#define ECF_APP 			0x0020
#define ECF_LMEM_MOVE 		0x0010
#define ECF_UNLOCK_MOVE 		0x0008
#define ECF_VMEM_DISCARD 	0x0004

#else

typedef WordFlags ErrorCheckingFlags ;
#define ECF_ANAL_VMEM 		0x2000
#define	ECF_FREE			0x1000
#define	ECF_HIGH			0x0800
#define	ECF_LMEM			0x0400
#define ECF_BLOCK_CHECKSUM 	0x0200
#define ECF_GRAPHICS 		0x0100
#define ECF_SEGMENT 		0x0080
#define ECF_NORMAL 		0x0040
#define ECF_VMEM 		0x0020
#define ECF_APP 			0x0010
#define ECF_LMEM_MOVE 		0x0008
#define ECF_UNLOCK_MOVE 		0x0004
#define ECF_VMEM_DISCARD 	0x0002
#define	ECF_TEXT			0x0001

#endif

extern ErrorCheckingFlags
    _pascal SysGetECLevel (MemHandle *checksumBlock);

/***/

extern void
    _pascal SysSetECLevel (ErrorCheckingFlags flags, MemHandle checksumBlock);

/***/

/*
 * Macros for conditional compilation based on EC flag
 */

#if	ERROR_CHECK

#define EC (line) 		line
#define EC_ERROR (code) 		FatalError(code)
#define EC_ERROR_IF (test, code) if (test) FatalError(code)
#define NEC (line)
#define EC_BOUNDS (addr) 	ECCheckBounds(addr)
#define EC_WARNING_IF (test, code) if (test) CWarningNotice(code)
#define EC_WARNING (code)    	CWarningNotice(code)

#else

#define EC (line)
#define EC_ERROR (code)
#define EC_ERROR_IF (test, code)
#define NEC (line) 		line
#define EC_BOUNDS (addr)
#define EC_WARNING_IF (test, code)
#define EC_WARNING (code)

#endif

#ifdef __HIGHC__
pragma Alias(CFatalError, "CFATALERROR");
pragma Alias(CWarningNotice, "CWARNINGNOTICE");
pragma Alias(ECCheckFileHandle, "ECCHECKFILEHANDLE");
pragma Alias(ECCheckMemHandle, "ECCHECKMEMHANDLE");
pragma Alias(ECCheckMemHandleNS, "ECCHECKMEMHANDLENS");
pragma Alias(ECCheckThreadHandle, "ECCHECKTHREADHANDLE");
pragma Alias(ECCheckProcessHandle, "ECCHECKPROCESSHANDLE");
pragma Alias(ECCheckResourceHandle, "ECCHECKRESOURCEHANDLE");
pragma Alias(ECCheckGeodeHandle, "ECCHECKGEODEHANDLE");
pragma Alias(ECCheckDriverHandle, "ECCHECKDRIVERHANDLE");
pragma Alias(ECCheckLibraryHandle, "ECCHECKLIBRARYHANDLE");
pragma Alias(ECCheckGStateHandle, "ECCHECKGSTATEHANDLE");
pragma Alias(ECCheckWindowHandle, "ECCHECKWINDOWHANDLE");
pragma Alias(ECCheckQueueHandle, "ECCHECKQUEUEHANDLE");
pragma Alias(ECCheckEventHandle, "ECCHECKEVENTHANDLE");
pragma Alias(ECCheckLMemHandle, "ECCHECKLMEMHANDLE");
pragma Alias(ECCheckLMemHandleNS, "ECCHECKLMEMHANDLENS");
pragma Alias(ECLMemValidateHeap, "ECLMEMVALIDATEHEAP");
pragma Alias(ECLMemValidateHandle, "ECLMEMVALIDATEHANDLE");
pragma Alias(ECCheckLMemChunk, "ECCHECKLMEMCHUNK");
pragma Alias(ECMemVerifyHeap, "ECMEMVERIFYHEAP");
pragma Alias(ECLMemExists, "ECLMEMEXISTS");
pragma Alias(ECCheckChunkArray, "ECCHECKCHUNKARRAY");
pragma Alias(ECCheckClass, "ECCHECKCLASS");
pragma Alias(ECCheckObject, "ECCHECKOBJECT");
pragma Alias(ECCheckLMemObject, "ECCHECKLMEMOBJECT");
pragma Alias(ECCheckOD, "ECCHECKOD");
pragma Alias(ECCheckLMemOD, "ECCHECKLMEMOD");
pragma Alias(ECCheckStack, "ECCHECKSTACK");
pragma Alias(ECVMCheckVMFile, "ECVMCHECKVMFILE");
pragma Alias(ECVMCheckVMBlockHandle, "ECVMCHECKVMBLOCKHANDLE");
pragma Alias(ECVMCheckMemHandle, "ECVMCHECKMEMHANDLE");
pragma Alias(ECCheckBounds, "ECCHECKBOUNDS");
pragma Alias(SysGetECLevel, "SYSGETECLEVEL");
pragma Alias(SysSetECLevel, "SYSSETECLEVEL");
#endif

#endif


Internal\Resp\eci.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1998. Nokia Mobile Phones
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

-----------------------------------------------------------------------------
*/

@ifndef  ECI_GOH
@define  ECI_GOH

/*  INCLUDE FILES  */

@include  <Internal/Resp/smdefine.goh>

/*  C CONSTANTS  */

/*  GEOS CONSTANTS  */

/*  C MACROS  */

/*  GEOS MACROS  */

/*  DATA TYPES  */

/*  CLASS DEFINITIONS  */

/*  EXTERNAL OBJECTS  */

/*  EXTERNAL DATA STRUCTURES  */

/*  GLOBAL FUNCTION PROTOTYPES  */

/*
 * Returns phones imei code.
 */
extern word _cdecl EciGetImei ( byte *imei);

/*
 * Returns phones imei code.
 */
extern word _cdecl EciStartVoiceCall ( TCHAR *number);

/*
 * Gets the cell id
 */
extern word _cdecl EciGetCellId ( word *cellId );

/*
 * Shows text on the phone side
 */
extern byte _cdecl EciShowTextStart ( byte type,   /* Type tells how text is shown
                                                     values: ECI_TEXT_SHOW_AS_NOTE
                                                     ECI_TEXT_SHOW_AS_SOFTNOTIF
                                                     ECI_TEXT_SHOW_PERMANENTLY */
                                     byte time,   /* Time tells how long time display string
                                                     is shown on phone's display in seconds.
                                                     This value is used when value of type is
                                                     ECI_TEXT_SHOW_AS_NOTE */
                                     byte format,  /* ECI_TEXT_BLINKING
                                                      ECI_TEXT_FIXED */
                                     byte font,    /* ECI_TEXT_EUROPEAN_8_POINT_PLAIN
                                                      ECI_TEXT_EUROPEAN_8_POINT_BOLD
                                                      ECI_TEXT_EUROPEAN_13_POINT_BOLD */
                                     TCHAR *message /* L[72] Display string to show on
                                                       phone's display (ASCIIZ) */);

/*
 * Stops showing text on the phone side
 */
extern byte _cdecl EciShowTextStop ();

@endif /* End of File */


Internal\Resp\eci_oem.h

/*
Copyright (c) 1996. Nokia Mobile Phones
*/

#ifndef ECI_OEM_H
#define ECI_OEM_H

typedef byte ECICauseType ;
typedef byte ECICommonCause ;

#endif


faxfile.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1995 -- All Rights Reserved

PROJECT:
MODULE:
FILE:		faxfile.goh

AUTHOR:		Jim Wood, Oct 13, 1995

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    jimw	10/13/95   	Initial version.

DESCRIPTION:

    $Id: faxfile.goh,v 1.5.1.1 96/04/28 08:30:39 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@ifndef __FAXFILE_GOH
@define __FAXFILE_GOH

@deflib	faxfile

/*----------------------------------------------------------------------------*
 *				  Data Types                                  *
 *----------------------------------------------------------------------------*/

/*------------------------------*
 *	Protocol for fax files  *
 * -----------------------------*/

#define FAXFILE_TOKEN    "FXFL"

@class	CPCMergeTextClass, VisTextClass;

@message    void MSG_CPC_MERGE_TEXT_SET_VALID ();
/*
 *	Sets VOV_GEMOETRY_INVALID bit.  Must do this so
 *	MSG_VIS_NOTIFY_GEOMETRY_VALID will work.  That's needed
 *	in order to build out the text obj's LINE information,
 *	used in	MSG_VIS_DRAW.  whew.
 *
 *	PASS:	nothing
 *
 *	RETURN:	nothing
 */

@endc

@endlib /* faxfile */

@endif /* __FAXFILE_GOH */


Foam\faxOpts.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1994 -- All Rights Reserved
 *
 * PROJECT:	  PCGEOS
 * MODULE:	  faxOpts.h
 * FILE:	  faxOpts.h
 *
 * AUTHOR:  	  Jeremy Dashe: Jun  7, 1995
 *
 * REVISION HISTORY:
 *	Date	  Name	    Description
 *	----	  ----	    -----------
 *	6/ 7/95	  jeremy	    Initial version
 *
 * DESCRIPTION:
 *	Contains definitions for fax viewing, etc.
 *
 * 	$Id: faxOpts.h,v 1.2.1.1 96/04/28 08:33:18 chris Exp $
 *
 ***********************************************************************/
#ifndef _FAXOPTS_H_
#define _FAXOPTS_H_

typedef enum {
    FSRC_STANDARD	,
    FSRC_FINE
} FaxSendResolutionChoice} ;

#endif /* _FAXOPTS_H_ */


Mailbox\faxsendtd.h

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    (c) Copyright Geoworks 1998.  All rights reserved.
            GEOWORKS CONFIDENTIAL

PROJECT:
MODULE:
FILE:		faxsendtd.goh

AUTHOR:		Steve Kertes, Jun  3, 1998

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    SK	6/ 3/98   	Initial version.

DESCRIPTION:

    Interface for the FaxSendTransportDriver

    $Id: faxsendtd.h,v 1.1.1.1 98/06/03 15:03:45 kertes Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef _FAXSENDTD_H_
#define _FAXSENDTD_H_

/*
;
; When using MSG_MAILBOX_SEND_CONTROL_SET_ADDRESSES or
; MSG_VSC_SET_REPLY_ADDRESSES use this structure for the
; MailboxTransAddr.  This is related to the FaxMailboxAddrElement
; defined in fax.def, but fax is not giving up all the
; details of its opaque data.
;
; The three strings must be null terminated. (although in C this should not
; be an issue!)
;
*/

#define FAX_PHONE_NUMBER_SIZE     31
#define FAX_NAME_SIZE            101
#define FAX_COMPANY_NAME_SIZE     51

typedef struct {

    TCHAR FMEA_number[FAX_PHONE_NUMBER_SIZE];
    TCHAR FMEA_name[FAX_NAME_SIZE];
    TCHAR FMEA_company[FAX_COMPANY_NAME_SIZE];

} FaxMailboxExternalAddr} ;

#endif /* _FAXSENDTD_H_ */


faxtiff.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    (c) Copyright Geoworks 1997.  All rights reserved.
            GEOWORKS CONFIDENTIAL

PROJECT:
MODULE:
FILE:		faxtiff.goh

AUTHOR:		Steve Kertes, Mar 27, 1997

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    SK	3/27/97   	Initial version.

DESCRIPTION:

    C declarations for the faxtiff library

    $Id: faxtiff.goh,v 1.1.1.4 98/02/24 14:58:16 kertes Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@ifndef __FAXTIFF_GOH
@define __FAXTIFF_GOH

@optimize
@deflib	faxtiff

typedef enum {
    FTCT_PROGRESS		= 0x0,
    FTCT_NEW_PAGE		= 0x1
} FaxTiffCallbackType} ;

/*
 * translation errors
 */
typedef enum {
    FTCE_NO_ERROR    ,
    FTCE_ERROR    ,
    FTCE_TRANSLATION_NOT_SUPPORTED    ,
    FTCE_INVALID_FORMAT    ,
    FTCE_SOURCE_FILE_EMPTY    ,
    FTCE_FILE_OPEN    ,
    FTCE_FILE_READ    ,
    FTCE_FILE_WRITE    ,
    FTCE_FILE_CREATE    ,
    FTCE_FILE_TOO_LARGE    ,
    FTCE_DISK_FULL    ,
    FTCE_OUT_OF_MEMORY    ,
    FTCE_CANCELED
} FaxTiffConvertError} ;

/*
 *   Returns true if the conversion was successful
 *
 *   faxfileHandle must be for a valid faxfile.  Use an existing faxfile
 *   or create a new one with FaxTiffCreateFaxFile
 */
extern Boolean _far _pascal FaxTiffConvertToFaxfile (
    hptr tiffHandle, hptr faxfileHandle
    );

/*
 *   Returns FaxTiffConvertError
 *
 *   faxfileHandle must be for a valid faxfile.  Use an existing faxfile
 *   or create a new one with FaxTiffCreateFaxFile
 */
extern FaxTiffConvertError _far _pascal FaxTiffConvertToFaxfileReturnError (
    hptr tiffHandle, hptr faxfileHandle
    );

/*
 *   Returns true if the conversion was successful
 */
extern Boolean _far _pascal FaxTiffConvertToTiff (
    hptr tiffHandle, hptr faxfileHandle,
    word firstPage, word lastPage
    );

/*
 *   Returns FaxTiffConvertError
 */
extern FaxTiffConvertError _far _pascal FaxTiffConvertToTiffReturnError (
    hptr tiffHandle, hptr faxfileHandle,
    word firstPage, word lastPage
    );

/*
 *   Returns true if the file is a tiff
 */
extern Boolean _far _pascal FaxTiffValidateTiffFile (
    hptr tiffHandle
    );

/*
 *   Returns true if the file is a tiff
 */
extern Boolean _far _pascal FaxTiffValidateTiffFile (
    hptr tiffHandle
    );

/*
 *   Returns handle of created faxfile, sets value for ThreadGetError()
 *   The arguments are passed unchanged to VMOpen.
 */
extern VMFileHandle _far _pascal FaxTiffCreateFaxFile (
    char *name,
    VMAccessFlags flags,
    VMOpenType mode,
    word compression
    );

#ifdef __HIGHC__
pragma Alias(FaxTiffConvertToFaxfile,"FAXTIFFCONVERTTOFAXFILE");
pragma Alias(FaxTiffConvertToTiff,"FAXTIFFCONVERTTOTIFF");
pragma Alias(FaxTiffConvertToFaxfileReturnError,"FAXTIFFCONVERTTOFAXFILERETURNERROR");
pragma Alias(FaxTiffConvertToTiffReturnError,"FAXTIFFCONVERTTOTIFFRETURNERROR");
pragma Alias(FaxTiffValidateTiffFile,"FAXTIFFVALIDATETIFFFILE");
pragma Alias(FaxTiffCreateFaxFile,"FAXTIFFCREATEFAXFILE");
#endif

@endlib /* faxtiff */

@endif /* __FAXTIFF_GOH */


Objects\FlatFile\ffDbase.goh

/***********************************************************************
 *
 *      Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:       PC/GEOS
 * MODULE:        ffDbase.goh
 * FILE:          ffDbase.goh
 *
 * AUTHOR:        Jeremy Dashe: Apr 16, 1992
 *
 * REVISION HISTORY:
 *      Date      Name      Description
 *      ----      ----      -----------
 *      4/16/92   jeremy    Initial version
 *
 * DESCRIPTION:
 *      This file contains type definitions for the flat file database.
 *
 *      $Id: ffDbase.goh,v 1.37.6.1 96/04/28 08:32:14 chris Exp $
 *
 ***********************************************************************/
@optimize
@include  <ffile.goh>
@include  <spool.goh>

/*
 * Define in which row the field information is kept.
 */
#define FIELD_TYPE_ROW           (LARGEST_VISIBLE_ROW + 1)       /* == 4000h */
#define FIELD_DEFAULT_VALUE_ROW  (FIELD_TYPE_ROW + 1)
#define TEMP_DATA_ROW            (FIELD_DEFAULT_VALUE_ROW + 1)
#define RECORD_LAYOUT_ROW        (TEMP_DATA_ROW + 1)
#define MULTI_RECORD_LAYOUT_ROW  (RECORD_LAYOUT_ROW + 1)
#define MISCELLANEOUS_INFO_ROW   (MULTI_RECORD_LAYOUT_ROW + 1)
#define TEMP_DATA_ROW_FOR_VISUAL_UPDATES         (MISCELLANEOUS_INFO_ROW + 1)

/*
 * Define the column in RECORD_LAYOUT_ROW that holds the list of
 * sorted name arrays
 */
#define LAYOUT_NAME_ARRAY_COLUMN  0

/*
 * Flags to track which attributes are legal for each data type
 */
typedef ByteFlags       FFD_attributes       ;
#define FFD_ATTRIBUTES_DEFAULT           0x01
#define FFD_ATTRIBUTES_MAX_TEXT_LENGTH   0x02
#define FFD_ATTRIBUTES_MIN_VALUE         0x04
#define FFD_ATTRIBUTES_MAX_VALUE         0x08

/* so far, min/max will always be enabled/disabled together so: */

#define FFD_ATTRIBUTES_MIN_MAX_VALUE     (FFD_ATTRIBUTES_MIN_VALUE | \
                     FFD_ATTRIBUTES_MAX_VALUE)

/*
 * Field range checking defines:
 */
typedef ByteEnum FieldRangeCheck ;
#define FIELD_IN_RANGE       0
#define FIELD_BELOW_MIN      1
#define FIELD_ABOVE_MAX      2

/*
 * Structures used for general text and formula use:
 */
typedef struct {
    CellText cellTextStruct;
    TCHAR string[MAX_TEXT_FIELD_LENGTH + 1];
} TextCellStruct} ;

typedef struct {
    CellFormula cf;
    byte formula[MAX_TOKEN_STREAM_SIZE];
    TCHAR data[MAX_EXPRESSION_STRING_LENGTH];
} FormulaCellStruct} ;

/*
 * Structures used for layout and page dimensions:
 */
typedef struct {
    sdword LS_height;
    sdword LS_width;
} LayoutSize} ;

/* Data Type & Attribute info is stored in a row in the additional
   block of data (after the cell data). The attributes for field n
   are stored in column n of the sparse array. */

/*
 * Common Field Data Types attributes
 */

/* This constant defines the offset of FDA_type within the common
   FieldDataAttrs structure. Code in several places needs to know where
   to find it, so if you change this structure, update this constant
   as well! */
#define FDA_TYPE_POSITION        0

typedef struct {
    FieldDataType       FDA_type;
    FieldDataTypesFlags FDA_flags;      /* from FieldDataTypesFlags */
    word                FDA_nameToken;  /* token for field name */
} FieldDataAttrs} ;

/*
 * Computed/default field token stream attributes.
 */
typedef struct {
    word                TSA_size;       /* Number of tokens in stream. */
} TokenStreamAttrs} ;

/*
 * Text Field Data Type attributes
 */
typedef struct {
    FieldDataAttrs      TFDA_common;
    word                TFDA_maxLength;         /* max # chars in text
                           field; user-defined */
} TextFieldDataAttrs} ;

/*
 * Value Field Data Type attributes
 */
typedef struct {
    FieldDataAttrs      VFDA_common;
    FloatNum            VFDA_min;
    FloatNum            VFDA_max;

} ValueFieldDataAttrs} ;

typedef struct {
    FieldDataAttrs      DFDA_common;
    FloatNum            DFDA_min;
    FloatNum            DFDA_max;
} DateFieldDataAttrs} ;

typedef struct {
    FieldDataAttrs      CFDA_common;

} ComputedFieldDataAttrs} ;

#define MAX_TOTAL_NAME_LENGTH    (60)

typedef struct {
    TCHAR                TASA_name[MAX_TOTAL_NAME_LENGTH];
    TCHAR                *TASA_formula;
} SubsetAttrs} ;

/*
 * Mode Types
 */
typedef ByteEnum ModeType ;
#define MT_CURRENT               0x0
#define MT_DESIGN                0x01
#define MT_DATA_ENTRY            0x02

/*
 * Layout Types
 */
typedef ByteEnum LayoutType ;
#define LT_NO_LAYOUT_TYPE        0x0
#define LT_SINGLE_RECORD         0x01
#define LT_MULTI_RECORD          0x02
#define LT_REPORT                0x04

/*
 * CommitRecord Types; used by MSG_FFD_COMMIT_TEMP_DATA_ROW_TO_DATABASE
 */
typedef ByteEnum CommitRecordType ;
#define CRT_REGULAR_COMMIT        0x01
#define CRT_VISUAL_UPDATE_COMMIT  0x02
#define CRT_SAVE_FILE_COMMIT      0x03

/*
 * NewRecordTypes; used by MSG_FFD_EDIT_NEW_RECORD
 */
typedef ByteEnum NewRecordType ;
#define NRT_REGULAR      0x01
#define NRT_LOAD_FROM_TEMP_VISUAL_UPDATE_ROW     0x02

/*
 * EditRecordTypes; used by MSG_FFD_EDIT_EXISTING_RECORD
 */
typedef ByteEnum EditRecordType ;
#define ERT_REGULAR      0x01
#define ERT_LOAD_FROM_TEMP_VISUAL_UPDATE_ROW     0x02

/*
 * Field edge drawing flags:
 */
typedef ByteFlags FieldEdgeFlags ;
#define FEF_TOP                  0x01
#define FEF_LEFT                 0x02
#define FEF_RIGHT                0x04
#define FEF_BOTTOM               0x08
#define FEF_FIRST_FIELD_FLAG     0x80   /* <- always the MSB, and not an edge! */
#define FEF_LEAVE_EDGES_ALONE    0x80   /* <- always the MSB, and not an edge! */

#define FEF_ALL_EDGES           (FEF_TOP | FEF_BOTTOM | FEF_LEFT | FEF_RIGHT)

/*
 * MinOrMaxValue is used as a parameter to
 * FFD_GET_COLUMN_MIN_OR_MAX_STRING
 */
typedef ByteEnum MinOrMaxValue ;
#define MIN      0
#define MAX      1

/*
 * Record Order: Top->Bottom & Left->Right, or Left->Right & Top->Bottom
 */

typedef ByteEnum RecordOrderOption ;
#define ROO_LEFT_TO_RIGHT  0
#define ROO_TOP_TO_BOTTOM  1

/*
 * InsertResult is used as the return parameter to
 * FFD_COMMIT_TEMP_ROW_TO_DATABASE
 */
typedef ByteEnum InsertResult ;
#define INSERT_OK        0
#define NO_INSERT_DONE   1
#define INSERT_FAILED    2

typedef ByteEnum FFLayoutNameInsertionResult ;
#define FFD_NO_ERROR     0
#define FFD_DUPLICATE_LAYOUT_NAME  1

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Field Navigation Order
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * FieldOrderMovementCommand is used to convey the desired style of
 * 'movement' action.
 *
 * See the FieldOrderInfoGetField() for more information.
 */
typedef enum
{
    FOMC_FIRST_FIELD    ,
    FOMC_PREVIOUS_FIELD    ,
    FOMC_NEXT_FIELD    ,
    FOMC_LAST_FIELD
} FieldOrderMovementCommand} ;

typedef struct
{
    /*
     * lastItemIndex contains the index of the last valid item in the
     * fieldsList. It contains 0xffff if nothing is set.
     */
    sword               FNOI_lastItemIndex;

    /*
     * fieldsList defines the sort keys in decreasing order of primacy.
     * Each layout contains it's own sort order.
     */
     FieldID    FNOI_fieldOrderList [MAX_NUM_FIELDS];
} FFDBFieldNavigationOrderInfo} ;

/*
 * Chunk array constants/structures for storing record layouts
 */

#define MAX_LAYOUT_NAME_LENGTH   40
#ifdef DO_DBCS
#define MAX_LAYOUT_NOTES_LENGTH  127
#else
#define MAX_LAYOUT_NOTES_LENGTH  255
#endif
#define MAX_NUM_LAYOUTS          255
#define MAX_LENGTH_TREASURE_CHEST_MONIKER  60
#define MAX_LENGTH_RECORD_CONTROL_PANEL_MONIKER  40

typedef struct {
     VMBlockHandle    LC_grObjBodyVMBlock;
     ChunkHandle      LC_grObjBodyChunk;
} LayoutCommon} ;

typedef struct {
    ChunkArrayHeader    RLCAH_standardChunkArrayHeader;
    LayoutCommon        RLCAH_layoutCommon;
    TCHAR               RLCAH_layoutName[MAX_LAYOUT_NAME_LENGTH];
    dword               RLCAH_lastFieldYPosition;
    byte                RLCAH_layoutSortedFieldList[MAX_NUM_FIELDS];
    byte                RLCAH_numFieldsInLayout;
    TCHAR               RLCAH_layoutNotes[MAX_LAYOUT_NOTES_LENGTH];
    ModeType            RLCAH_layoutMode;       /* indicates which mode
                           the GrObjects are
                           set up for */
    LayoutType          RLCAH_layoutType;       /* Since every layout
                           has at least a record
                           layout, we store the
                           type here */
    LayoutSize          RLCAH_singleRecordSize;
    FFDBFieldNavigationOrderInfo
            RLCAH_fieldOrderInfo;
} RecordLayoutChunkArrayHeader} ;

/*
 * Structure for multi-record layouts
 */
typedef struct {
    VMBlockHandle       MRLS_mrBoundaryVMBlock;
    ChunkHandle         MRLS_mrBoundaryChunk;
    LayoutCommon        MRLS_layoutCommon;
    ModeType            MRLS_layoutMode;
    PageSizeReport      MRLS_pageReport;        /* Page size and paper
                           type. */
    RecordOrderOption   MRLS_recordOrder;
} MultiRecordLayoutStruct} ;

typedef struct {
    VMBlockHandle       GOEOP_grObjectVMBlock;
    ChunkHandle         GOEOP_grObjectChunk;
} GrObjElementObjPtr} ;

typedef GrObjElementObjPtr RecordLayoutChunkArrayElement ;

/*
 * The NameLockTokenStream structure is used by the eval code to pass
 * a field's name token info to the library evaluation code.  It simply
 * keeps the mem block's handle in the first word and passes the address
 * after.  When the address is passed back to be freed, the handle is one
 * word before the passed address.  A signature word is kept for error
 * checking purposes.
 */
#define NLTS_SIGNATURE  0xf0ba       /* Signature: foobar! */

typedef struct {
    word        NLTS_signature;
    MemHandle   NLTS_handle;
} NameLockTokenStreamWithData} ;

/*
 * Constants for default placement of fields and labels
 */

#define DEFAULT_FIELD_X_POSITION             100
#define FIRST_FIELD_Y_POSITION               20
#define DEFAULT_FIELD_WIDTH                  600
#define DEFAULT_IMPORT_FIELD_WIDTH           432
#define DEFAULT_FIELD_HEIGHT                 20
#define DEFAULT_Y_DISTANCE_BETWEEN_FIELDS    10
#define A_BIT_EXTRA_TO_LOOK_NICE             5
#define MIN_FIELD_WIDTH                      (72 / 2)    /* <- 1/2 an inch */

#define DEFAULT_LABEL_WIDTH                  75
#define DEFAULT_LABEL_X_POSITION             10

#define DEFAULT_PAGE_NUMBER_WIDTH            60

#define PAGE_NUMBER_SYMBOL                   "#"

/*
 * Constants and structures for record/multi-record layout boundary
 */
#define DEFAULT_RECORD_BOUNDARY_X_POSITION  0
#define DEFAULT_RECORD_BOUNDARY_Y_POSITION  0
#define DEFAULT_RECORD_BOUNDARY_WIDTH  250
#define DEFAULT_RECORD_BOUNDARY_HEIGHT  300
#define DEFAULT_RECORD_BOUNDARY_LINE_WIDTH  1
#define DEFAULT_MULTI_RECORD_BOUNDARY_LINE_WIDTH  2

typedef struct {
    WWFixedAsDWord  RWWF_left;
    WWFixedAsDWord  RWWF_top;
    WWFixedAsDWord  RWWF_right;
    WWFixedAsDWord  RWWF_bottom;
} RectWWFixedAsDWord} ;

/*
 * Constants used for some routines indicating whether ro draw
 * or not
 */
typedef ByteEnum ffDrawFlags ;
#define DRAW  0
#define DONT_DRAW  1

typedef ByteEnum LayoutBoundaryDrawFlags ;
#define LBDF_SPRITE  0
#define LBDF_OBJECT  1

/*
 * Structure for FlatFile map block
 */

typedef struct {
    byte        FFMB_columnsTaken[COLUMNS_TAKEN_ARRAY_SIZE];
    byte        FFMB_currentMode;
    byte        FFMB_currentLayout;
    byte        FFMB_numLayouts;
    byte        FFMB_numRecords;
    byte        FFMB_numFields;
    FieldID     FFMB_databaseNameList[MAX_NUM_FIELDS];
    byte        FFMB_numInNotInLayoutNameList;
    FieldID     FFMB_notInLayoutNameList[MAX_NUM_FIELDS];
    byte        FFMB_numInLayoutNameList;
    FieldID     FFMB_layoutNameList[MAX_NUM_FIELDS];
    byte        FFMB_highestLayoutNumber;
    byte        FFMB_currentLayoutType;
} FlatFileMapBlock} ;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Sorting Information
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * FFDSortOptions indicates which things we should or shouldn't take into
 * account when sorting the data.
 */
typedef WordFlags FFDSortOptions ;
@define FFDSO_IGNORE_CASE_AND_ACCENTS           (0x01)
@define FFDSO_IGNORE_SPACES_AND_PUNCTUATION     (0x02)

@define FFDSO_NO_OPTIONS        (0)
@define FFDSO_ALL_OPTIONS       (@FFDSO_IGNORE_CASE_AND_ACCENTS | \
                 @FFDSO_IGNORE_SPACES_AND_PUNCTUATION)

/* SortInfoAscentFlags indicates the sort order for each of the keys.   */
typedef ByteFlags SortInfoAscentFlags ;
#define SIAF_ALL_ASCENDING       (63)
#define SIAF_ALL_DESCENDING      (0)

typedef struct
{
    /*
     * lastItemIndex contains the index of the last valid item in the
     * sortKeyList. It contains 0xff if nothing is set.
     */
    sbyte       SIS_lastItemIndex;

    /*
     * ascentFlags is a bit vector specifying whether the corresponding
     * position in the sortKeyList should be sorted in ascending (set, 1) or
     * descending (clear, 0).
     */
    SortInfoAscentFlags SIS_ascentFlags;

    /*
     * sortOptions contains the current sorting options.
     */
    FFDSortOptions      SIS_sortOptions;

    /*
     * sortKeyList defines the sort keys in decreasing order of primacy.
     * Each layout contains it's own sort order.
     */
    FieldID     SIS_sortKeyList [MAX_SORT_KEYS_AND_SUB_TOTAL_FIELDS];
} FFDBSortInfo} ;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Subset Information
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

typedef ByteEnum SubsetEvalResult ;
#define SER_FALSE            0
#define SER_TRUE             1
#define SER_BOGUS            2

typedef ByteEnum SubsetMarkModification ;
#define SMM_SET_MARK_FLAG        0
#define SMM_UNSET_MARK_FLAG      1
#define SMM_INVERT_MARK_FLAG     3

/*
 * Column flags for marked records.
 * NOTE:  These MUST be in the low 4 bits of the byte.  If not, really awful
 *        things can happen.
 */
#define MARKED_RECORD        0x01        /* 0000 0001 */
#define UNMARKED_RECORD      0x00

/*
 * The column in which the marked record flags live.
 */
#define MARKED_RECORD_COLUMN     0

/*
 * The value which means "this is not an available record."
 */
#define NOT_A_RECORD         0xffff

typedef enum
{
    FFDSOI_SHOW_ONLY_MARKED	         = 0x01,
    FFDSOI_AUTO_APPLY_MARK	          = 0x02,
    FFDSOI_CLEAR_MARKS_FIRST	        = 0x04
} FFDSubsetOptionsInfo} ;


Objects\FlatFile\ffDbaseC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	GEOS
 * FILE:	CInclude/Objects/FlatFile/ffDbaseC.goh
 *
 * AUTHOR:  	Jeremy Dashe: Jan 24, 1992
 *
 * REVISION HISTORY:
 *	Date	 Name	Description
 *	----	 ----	-----------
 *	1/24/92	 jeremy	Initial version
 *
 * DESCRIPTION:
 *	Class description for the flat file database object.
 *
 * 	$Id: ffDbaseC.goh,v 1.108.6.1 96/04/28 08:32:18 chris Exp $
 *
 ***********************************************************************/
@optimize

#include  <geos.h>

@include  <ssheet.goh>
@include  <ffile.goh>
@include  <impex.goh>
@include  <Objects/uiInputC.goh>
@include  <Objects/FlatFile/ffDbase.goh>
#include  <Objects/FlatFile/ffKbd.h>

@class	FlatFileDatabaseClass, SpreadsheetClass;

/*
 * MSG_FFD_SUCCESSFUL_FIELD_CREATION_OR_MODIFICATION_TEMPLATE --
 *
 * This message is used to cast the success message that gets sent to
 * MSG_FFD_CREATE_NEW_FIELD_WITH_RESPONSE to a message with no parameters
 * and no return value
 */
@message void MSG_FFD_SUCCESSFUL_FIELD_CREATION_OR_MODIFICATION_TEMPLATE ();

/*
 * MSG_FFD_RESULT_OF_FIELD_CREATION_TEMPLATE --
 *
 * This message is used to cast the second message that gets sent to
 * MSG_FFD_CREATE_NEW_FIELD_WITH_RESPONSE to a message with a boolean
 * parameter, the column number of the field, and no return value. The
 * Boolean parameter indicates whether the attempted field creation
 * was successful.
 */
@message void MSG_FFD_RESULT_OF_FIELD_CREATION_TEMPLATE (
                    FFFieldCreationResult fieldResult,
                    byte colNum);

/*
 * MSG_FFD_RESULT_OF_FIELD_MODIFICATION_TEMPLATE --
 *
 * This message is used to cast the second message that gets sent to
 * MSG_FFD_CHANGE_FIELD_ATTRIBUTES_WITH_RESPONSE to a message with two
 * boolean parameters, the column number of the field, and no return
 * value. The first parameter is an enumerated value indicating the
 * outcome  of the attempted field modification, and the second indicates
 * whether or not the name was changed.
 */
@message void MSG_FFD_RESULT_OF_FIELD_MODIFICATION_TEMPLATE (
                    FFFieldCreationResult fieldResult,
                    byte colNum,
                    Boolean nameChanged);

/*
 * MSG_FFD_INIT_CELL_PARAMS
 *
 * This message serves to set the document handle in the
 * spreadsheet's cellparams structure. If you call MSG_FFD_INIT_SINGLE_
 * RECORD_LAYOUT before calling MSG_FFD_ATTACH_UI, you must call this
 * message first.
 */
@message void MSG_FFD_INIT_CELL_PARAMS (FileHandle documentHandle,
                       VMBlockHandle floatControllerVMBlock);

/*
 * MSG_FFD_LOAD_FLOAT_FORMAT_BLOCK --
 *	This message loads up a NotifyFloatFormatChange data block
 *	with the document file's handle and the block stored in
 *	FFI_floatControlBlock.
 */
@message void MSG_FFD_LOAD_FLOAT_FORMAT_BLOCK (MemHandle floatFormatDataBlock,
                          FormatIdType fieldFormat);

/*
 * MSG_FFD_NOTIFY_MAP_CONTROL --
 *
 * Sends a notification data block to map controller
 *
 */

@message void MSG_FFD_NOTIFY_MAP_CONTROL ();

/*
 * MSG_FFD_FLUSH_MAP_CONTROL --
 *
 * Sends no data block to map controller
 *
 */

@message void MSG_FFD_FLUSH_MAP_CONTROL ();

/*
 * MSG_FFD_ATTACH_FILE --
 *
 * Attach a (new) file to the flatfile
 *
 */
@message void MSG_FFD_ATTACH_FILE (VMBlockHandle ssMapBlock,
                  VMFileHandle fileHandle);

/*
 * MSG_FFD_ATTACH_UI --
 *
 * Attach UI to the flatfile
 *
 */
@message void MSG_FFD_ATTACH_UI (MemHandle setupData, FileHandle fileHandle);

@message void MSG_FFD_CHANGE_COMPUTED_FIELD (MemHandle textHandle);

@message byte MSG_FFD_GET_NUMBER_OF_FIELDS (optr dList,
                       FieldListQuery whichList);

/*
 * MSG_FFD_GET_NUMBER_OF_LAYOUTS --
 *
 * Returns the number of layouts in the database.
 *
 */
@message byte MSG_FFD_GET_NUMBER_OF_LAYOUTS ();

@message void MSG_FFD_REQUEST_FIELD_MONIKER (optr dList,
                        word entryNum,
                        FieldListQuery whichList);

/*
 * MSG_FFD_REQUEST_FIELD_MONIKER_DISABLED
 *
 *	Insert the appropriate moniker from the given database list into
 *	the given dynamic list and make it disabled.
 */
@message void MSG_FFD_REQUEST_FIELD_MONIKER_DISABLED
        (optr dynList, word entryNum, FieldListQuery whichList);

/*
 * MSG_FFD_REQUEST_FIELD_NOTES --
 *	This message sends a field list element's notes to a text display.
 */
@message void MSG_FFD_REQUEST_FIELD_NOTES (word entryNum,
                      FieldListQuery whichList,
                      optr notesDisplay);

@message void MSG_FFD_EXPRESSION_BUILDER_GET_FIELD_NAME (MemHandle childBlock,
                            ChunkHandle textEditor,
                            word fieldID);

/*
 * MSG_FFD_CREATE_NEW_FIELD --
 *	This message adds a field to the database and adds it to the
 *	database_name_list.
 *
 *	If the name was successfully added to the database, TRUE
 *	is returned; otherwise, FALSE is returned.
 */
@message Boolean MSG_FFD_CREATE_NEW_FIELD (MemHandle fieldInfoHandle,
                      FieldID _far *colNum);
/*
 * MSG_FFD_CREATE_NEW_FIELD_WITH_RESPONSE --
 *	This message adds a field to the database and adds it to the
 *	database_name_list, then sends back messages based on the
 *	success or failure of adding the new field.
 *
 *	successMessage must have no parameters and no return
 *	value. It is sent if the insert was successful.
 *
 *	resultMessage has two parameters: a Boolean (indicating
 *	whether the insert was successful or not) and a byte for
 *	the new column number.
 */
@message void MSG_FFD_CREATE_NEW_FIELD_WITH_RESPONSE (MemHandle fieldInfoHandle,
                             optr outputOD,
                             Message successMessage,
                             Message resultMessage);

/*
 * MSG_FFD_CHANGE_FIELD_ATTRIBUTES --
 *	This message changes the attributes of an existing field in
 *	the database.  Pass a handle to a FFFieldPropertiesMessageBlock
 *	with the new information and a column number to blast the
 *	changes into.
 *
 *	If the changes were successfully made to the field, TRUE is
 *	returned; otherwise, FALSE is returned.
 */
@message Boolean MSG_FFD_CHANGE_FIELD_ATTRIBUTES (MemHandle fieldInfoHandle,
                         byte colNum);

/*
 * MSG_FFD_CHANGE_FIELD_ATTRIBUTES_WITH_RESPONSE --
 *	This message changes the attributes of an existing field in
 *	the database and in the database_name_list.  The
 *	database_name_list is affected only if the name
 *	changed.
 *
 *	Pass a handle to a FFFieldPropertiesMessageBlock
 *	with the new information and a column number to blast the
 *	changes into.  Two passed messages will be sent back based on
 *	the success or failure of the attribute change:
 *
 *	successMessage has no parameters and no return
 *	value. It is sent if the modification was successful.
 *
 *	resultMessage has two parameters: a Boolean (indicating
 *	whether the modification was successful or not) and a byte for
 *	the old column number.
 */
@message void MSG_FFD_CHANGE_FIELD_ATTRIBUTES_WITH_RESPONSE (
                          MemHandle fieldInfoHandle,
                          byte colNum,
                          optr outputOD,
                          Message successMessage,
                          Message resultMessage);

/*
 * MSG_FFD_FIELD_DEPENDED_UPON --
 * 	This method checks whether or not a specific field
 *   	has dependents.  If it does, TRUE is returned.  If it
 *    	does not have any dependents, FALSE is returned.
 */
@message Boolean MSG_FFD_FIELD_DEPENDED_UPON (FieldID colNum);

/*
 * MSG_FFD_DELETE_FIELD --
 *	This message deletes a field from the database and from the
 *	database_name_list.  Pass the column number of the field to
 * 	delete.
 *
 *    	TRUE is returned if the field was deleted successfully,
 *    	FALSE is returned otherwise.
 */
@message Boolean MSG_FFD_DELETE_FIELD (byte colNum);

/*
 * MSG_FFD_DELETE_CURRENT_RECORD --
 *	Deletes the current record (SSI_curRow) from the database.
 * 	Leaves SSI_curRow alone, unless it was the last record in
 *	the database, in which case it gets decremented to reflect
 * 	the *new* last record in the datbase.
 */
@message void MSG_FFD_DELETE_CURRENT_RECORD ();

/*
 * MSG_FFD_ADD_NAME_TO_LAYOUT_LIST --
 *	This message adds a name to the layout_name_list, and creates
 * 	a screen field and label on the screen.
 *
 *	NOTE: redundant names CAN be added.  Beware.
 *
 *	The appropriate list notifications will be made.
 */
@message void MSG_FFD_ADD_NAME_TO_LAYOUT_LIST (byte colNum, word width);

/*
 * MSG_FFD_ADD_NAME_TO_NOT_IN_LAYOUT_LIST --
 *	This message adds a name to the not_in_layout_name_list.  Pass
 * 	the column number of the field to add.
 *
 *	NOTE: redundant names CAN be added.  Beware.
 *
 *	The appropriate list notifications will be made.
 */
@message void MSG_FFD_ADD_NAME_TO_NOT_IN_LAYOUT_LIST (byte colNum);

/*
 * MSG_FFD_DELETE_NAME_FROM_LAYOUT_LIST --
 *	This message removes a name from the layout_name_list and
 * 	deletes the associated screen fields. Pass the old column
 * 	number.
 *
 *	The appropriate list notifications will be made.
 */
@message void MSG_FFD_DELETE_NAME_FROM_LAYOUT_LIST (byte colNum,
                        FieldListQuery whichList);

/*
 * MSG_FFD_DELETE_NAME_FROM_NOT_IN_LAYOUT_LIST --
 *	This message deletes a name to the not_in_layout_name_list.  Pass
 * 	the old column number of the field to delete.
 *
 *	The appropriate list notifications will be made.
 */
@message void MSG_FFD_DELETE_NAME_FROM_NOT_IN_LAYOUT_LIST (byte colNum);

/*
 * MSG_FFD_CHANGE_NAME_IN_LAYOUT_LIST --
 *	This message changes a name in the layout_name_list and
 * 	changes its screen label as well.  Pass the column number of the
 * 	changed name.  The field will be repositioned in the list, and
 * 	appropriate list notifications will be made.
 */
@message void MSG_FFD_CHANGE_NAME_IN_LAYOUT_LIST (byte colNum);

/*
 * MSG_FFD_CHANGE_NAME_IN_NOT_IN_LAYOUT_LIST --
 *	This message changes a name from the layout_name_list or the
 * 	not_in_layout_name_list.  Pass the column number of the
 * 	changed name.  The field will be repositioned in the list, and
 * 	appropriate list notifications will be made.
 */
@message void MSG_FFD_CHANGE_NAME_IN_NOT_IN_LAYOUT_LIST (byte colNum);

/*
 * MSG_FFD_SET_RECORD_ORDER_FOR_LAYOUT
 *	This message sets the record order for the given layout.
 *	Options are top->bottom, then left->right (ROO_TOP_TO_BOTTOM)
 *	or left->right, then top->bottom (ROO_LEFT_TO_RIGHT)
 */
@message void MSG_FFD_SET_RECORD_ORDER_FOR_LAYOUT (byte layoutNum,
                        RecordOrderOption recordOrder);

/*
 * MSG_FFD_SET_RECORD_ORDER_FOR_CURRENT_LAYOUT
 *	This message sets the record order for the current layout.
 *	Options are top->bottom, then left->right (ROO_TOP_TO_BOTTOM)
 *	or left->right, then top->bottom (ROO_LEFT_TO_RIGHT)
 */
@message void MSG_FFD_SET_RECORD_ORDER_FOR_CURRENT_LAYOUT (
                    RecordOrderOption recordOrder);

/*
 * MSG_FFD_GET_RECORD_ORDER_FOR_LAYOUT
 *	This message returns the record order for the given layout.
 */
@message RecordOrderOption MSG_FFD_GET_RECORD_ORDER_FOR_LAYOUT (byte layoutNum);

/*
 * MSG_FFD_GET_RECORD_ORDER_FOR_CURRENT_LAYOUT
 *	This message returns the record order for the current layout.
 */
@message RecordOrderOption MSG_FFD_GET_RECORD_ORDER_FOR_CURRENT_LAYOUT ();

/*
 * MSG_FFD_CHANGE_SCREEN_FIELD_ATTRIBUTES
 *	This message changes the attributes for a field's screen
 * 	representation.  Pass the column number.
 */
@message void MSG_FFD_CHANGE_SCREEN_FIELD_ATTRIBUTES (FieldID colNum,
                             FieldDataType dataType);

/*
 * MSG_FFD_NOTIFY_ATTRIBUTE_CHANGES --
 *	This message tells the database that a field's attributes might have
 *	changed.
 *	Currently, the only thing that happens is that the Treasure Chest
 *	is told to updates its notes field.
 */
@message void MSG_FFD_NOTIFY_ATTRIBUTE_CHANGES ();

/* MSG_FFD_ADD_FIELD_TO_LAYOUT
 *
 *	Creates a label (text GrObject), rectangle GrObject
 *	and a field (text GrObject), and adds them to the
 *	GrObjBody.
 *	It then draws them on the current layout.
 *	Note: the index passed is the index into the sorted LAYOUT_NAME_LIST,
 *	NOT an absolute column number.
 */
@message void MSG_FFD_ADD_FIELD_TO_LAYOUT (byte index, word width);

/* MSG_FFD_ADD_EXISTING_GROBJ_TO_LAYOUT --
 *
 *	- Adds the passed TextGuardian to the
 *	  GrObjBody of the current layout.
 *	- Adds it to the record layout chunk
 *	  array for the current layout.
 *	- Redraws it with its new name.
 *	- Copies over the latest copy of the layout's sorted
 *	  list from the instance data into the header of the
 *	  chunk array. This is so that when we switch layouts,
 *	  we can just copy the sorted list from the chunk array
 *	  into the instance data (instead of having to re-sort
 *	  every time we switch layouts: slow.......)
 *    	- Re-attach its associated label.
 *
 *	Note: the index passed is the index into the sorted LAYOUT_NAME_LIST,
 *	NOT an absolute column number.
 */
@message void MSG_FFD_ADD_EXISTING_GROBJ_TO_LAYOUT (FieldID index,
                           optr fieldOptr,
                           optr labelOptr);

/* MSG_FFD_GET_DOCUMENT_HANDLE --
 *	This message returns the VMFileHandle for this database.
 */
@message VMFileHandle MSG_FFD_GET_DOCUMENT_HANDLE ();

/* MSG_FFD_DELETE_FIELD_FROM_LAYOUT
 *
 *	Delete field from the layout's chunk array, and
 *	remove the associated GrObject from the GrObjBody.
 *	Note: the index passed is the index into the sorted LAYOUT_NAME_LIST,
 *	NOT an abolute column number.
 */
@message void MSG_FFD_DELETE_FIELD_FROM_LAYOUT (byte index);

/* MSG_FFD_DELETE_CHUNK_ELEMENT_FROM_LAYOUT
 *
 *	Delete field from the layout's chunk array.
 *	If the field is in the current layout name list, it is removed
 *	and a list notification is dispatched.
 *	Note: the index passed is the field's absolute column number.
 */
@message void MSG_FFD_DELETE_CHUNK_ELEMENT_FROM_LAYOUT (FieldID colNum);

/*
 * MSG_FFD_DELETE_FIELDS_BUT_ASK_FIRST --
 *	This message deletes fields from the database after getting
 *	permission from the user.  It clears all the data, deletes the
 *	field names, updates all the lists in the instance data,
 *	notifies controllers of the change, updates all computed
 *	fields which reference the deleted fields and deletes the fields
 *	from all layouts.
 */
@message void MSG_FFD_DELETE_FIELDS_BUT_ASK_FIRST (MemHandle fieldIDListHandle,
                          FieldListQuery list,
                          word numItems);

/*
 * MSG_FFD_GET_COLUMN_FIELD_NAME --
 *	This message retrieves the field name for a given column.
 *	If textBuffer is non-NULL, the name will be strcpy()'d into
 *	the area pointed to by the textBuffer.  Else, a block will be
 *	allocated as sharable, the name copied into the block, the block
 *	will be unlocked, and the block's handle returned.
 */
@message MemHandle MSG_FFD_GET_COLUMN_FIELD_NAME (word columnNum,
                         TCHAR *textBuffer);

/*
 * MSG_FFD_GET_INDEXED_FIELD_NAME --
 * 	This message returns a MemHandle to the text of a field in one
 *	of the indexed lists (or fills a passed textBuffer -- see
 *	MSG_FFD_GET_COLUMN_FIELD_NAME for details) based on whichList
 *	is being requested.  The main, alphabetized list of every
 *	field in the database is selected by DATABASE_NAME_LIST; the list
 *	of fields in the current layout is used with LAYOUT_NAME_LIST; and
 *	the fields in the database which are not in the current layout
 *	are available though the NOT_IN_LAYOUT_NAME_LIST.
 */
@message MemHandle MSG_FFD_GET_INDEXED_FIELD_NAME (word fieldNum,
                          FieldListQuery whichList,
                          TCHAR *textBuffer);

/*
 * MSG_FFD_REQUEST_UNIQUE_FIELD_NAME --
 *
 * 	This method provides the caller with a unique field
 *	name.
 *
 *    	The caller can provide a candidate name, which
 *    	will be used as the base of the new, unique name.  For
 *    	example, if "Foo" is passed as the candidate, and no
 *    	other fields exist with this name, "Foo" will be returned.
 *    	Then, if "Foo" is used again as the candidate, then
 *    	"Foo_2" will be returned, and so on.
 *
 *	If the candidate field ends with an underscore and a number,
 *	the number will be incremented until the name is accepted.
 *	For example, if "Foo_2" is provided as the candidate, the
 *	result will be "Foo_3".
 *
 *    	If no candidate name is provided, "Field_1" will be
 *    	used (with the number incremented accordingly).
 *
 *    	As an added bonus, if an optr to a text object is
 *    	provided, the new name will be loaded into the field
 *    	and will be selected.
 *
 *    	If an error occurred (like the candidate name being un-
 *    	acceptable), FALSE will be returned.  Otherwise, TRUE
 *    	is returned.
 *
 */
@message Boolean MSG_FFD_REQUEST_UNIQUE_FIELD_NAME (optr textObject,
                        TCHAR *candidate,
                        TCHAR *newFieldName);

/*
 * MSG_FFD_REQUEST_UNIQUE_FIELD_NAME_WITH_RESPONSE --
 *
 * 	This method calls MSG_FFD_REQUEST_UNIQUE_FIELD_NAME then
 *	calls a message passed in resultMsg to a destination passed
 *	in resultDest.  The message (below) takes no arguments.
 */
@message void MSG_FFD_REQUEST_UNIQUE_FIELD_NAME_WITH_RESPONSE (
                            optr textObject,
                        TCHAR *candidate,
                        TCHAR *newFieldName,
                        optr resultDest,
                            Message resultMsg);

@prototype void MSG_FFD_RESULT_OF_REQUEST_UNIQUE_FIELD_NAME ();

/*
 * MSG_FFD_ADD_PAGE_NUMBER_TO_LAYOUT --
 *
 * DESCRIPTION: - Can only be called when in multi-record layout
 *	    	  design mode.
 *	    	- Creates a label (multText GrObject)
 *		  and a field (text GrObject), and adds them to the
 *		  GrObjBody of the current layout.
 *	    	- Tells the label to say "Page", and the field
 *	    	  to be a FDT_PAGE_NUMBER.  This is a non-data-holding
 *	    	  data type that appears as a "#" in design mode, and
 *	    	  as the current page number in data-entry mode.
 */
@message void MSG_FFD_ADD_PAGE_NUMBER_TO_LAYOUT ();

/*
 * MSG_FFD_NOTIFY_CLIPBOARD_PASTE --
 * 	This message is sent when objects have been pasted
 * 	into from the clipboard into a GrObj body.
 *
 *	If fields have been pasted into the single record layout, we
 * 	attempt to hook them up to the database by loading them into
 * 	the current layout, or duplicating them if they are already in
 * 	the current layout.
 *
 *	If fields have been pasted into a multi-record layout,
 *    	then the user is warned that they won't be hooked up.
 */
@message void MSG_FFD_NOTIFY_CLIPBOARD_PASTE (optr grObjBody);

/*
 * MSG_FFD_ADD_PASTED_FIELD_TO_LAYOUT --
 *	This message is called by field guardian GrObjects that
 *	have been pasted into a layout, and want to let the database
 *	know about it.
 *
 *	The column number indicates which field of the current
 *	database this object is supposed to represent.  If the field
 *      is not yet in the current layout, the new GrObject will
 *	represent it.
 *
 *	If the field is already in the current layout, a new field
 *	created in the database that has all the same attributes as
 *	the original, and is named with MSG_FFD_REQUEST_UNIQUE_FIELD_NAME
 *	using the original field name as the name candidate.
 */
@message void MSG_FFD_ADD_PASTED_FIELD_TO_LAYOUT (optr guardianOptr,
                         optr labelOptr,
                         FieldID colNum);

/*
 * MSG_FFD_GET_COLUMN_MIN_OR_MAX_STRING
 *
 *  	Get min or max value for specified column, and convert it
 *	to a text string. Requested column must represent
 *	either an integer or a real number.
 *	Text buffer must be of size FLOAT_TO_ASCII_NORMAL_BUF_LEN
 *
 *	If the number was not valid (like the cell was empty,
 *	for example), FALSE will be returned.  Otherwise,
 *	TRUE will be.
 */
@message Boolean MSG_FFD_GET_COLUMN_MIN_OR_MAX_STRING (word columnNum,
                              TCHAR *textBuffer,
                              MinOrMaxValue minOrMax);

/*
 * MSG_FFD_MOVE_FIELDS_INTO_LAYOUT_LIST --
 *	This message moves fields from the not_in_layout_list
 *	into the layout_list.  Pass the indices of the
 *	fields WRT to the not_in_layout_list.
 */
@message void MSG_FFD_MOVE_FIELDS_INTO_LAYOUT_LIST (MemHandle fieldIDListHandle,
                           word numItems);

/*
 * MSG_FFD_MOVE_FIELDS_OUT_OF_LAYOUT_LIST --
 *	This message moves fields from the layout_list
 *	into the not_in_layout_list.  Pass the indices of the
 *	fields WRT to the layout_list.
 */
@message void MSG_FFD_MOVE_FIELDS_OUT_OF_LAYOUT_LIST (
                        MemHandle fieldIDListHandle,
                        word numItems);

/*
 * MSG_FFD_EDIT_FIELD_PROPERTIES --
 * 	This message loads up a request to edit a field's
 *	properties from a particular field list and sends it
 *    	off to the field properties UI controller pointed to
 *    	by the editFieldOptr.
 */
@message void MSG_FFD_EDIT_FIELD_PROPERTIES (FieldListQuery whichList,
                        word fieldID,
                        optr editFieldOptr);

/*
 * MSG_FFD_SET_CUR_COL
 *	This message sets the current column (in the instance data)
 * 	to the given column number.
 *
 */
@message void MSG_FFD_SET_CUR_COL (byte colNumber);

/*
 * MSG_FFD_GET_CUR_COL
 *	Returns current column.
 *
 */
@message byte MSG_FFD_GET_CUR_COL ();

/*
 * MSG_FFD_GET_NEXT_COL
 *	Returns column for next field. Returns -1 if we're already
 *	at the last field.
 *
 */
@message byte MSG_FFD_GET_NEXT_COL ();

/*
 * MSG_FFD_SET_CUR_ROW
 *	This message sets the current row (in the instance data)
 * 	to the given row number.
 *
 */
@message void MSG_FFD_SET_CUR_ROW (word rowNumber);

/*
 * MSG_FFD_GET_CUR_ROW
 *	Returns current row.
 *
 */
@message word MSG_FFD_GET_CUR_ROW ();

/*
 * MSG_FFD_GET_NUM_FIELDS
 *	Returns number of fields in the database.
 *
 */
@message byte MSG_FFD_GET_NUM_FIELDS ();

/*
 * MSG_FFD_GET_NUM_RECORDS --
 *	Returns number of records in the database.
 *
 */
@message word MSG_FFD_GET_NUM_RECORDS ();

/*
 * MSG_FFD_GET_NUM_MARKED_RECORDS --
 *	Returns number of marked records in the database.
 *
 */
@message word MSG_FFD_GET_NUM_MARKED_RECORDS ();

/*
 * MSG_FFD_GET_SHOW_ONLY_MARKED --
 *	Returns the status of "show only marked" flag.
 *
 */
@message Boolean MSG_FFD_GET_SHOW_ONLY_MARKED ();

/*
 * MSG_FFD_GET_NUM_LAYOUTS
 *	Returns number of layouts in the database.
 *
 */
@message byte MSG_FFD_GET_NUM_LAYOUTS ();

/*
 * MSG_FFD_GET_INDEXED_COL_NUM
 *	Returns column number of the field at the given position
 *	in the list of sorted fields.
 *	For instance, if you want to know which column of data
 *	corresponds to the first alphabetical field,
 *	send index = 0.
 */
@message byte MSG_FFD_GET_INDEXED_COL_NUM (byte index);

/*
 * MSG_FFD_GET_DATA_TYPE_AND_FLAGS
 *	Returns the data type and flags of the given field.
 */
@message FieldDataType MSG_FFD_GET_DATA_TYPE_AND_FLAGS (byte fieldNum,
                         FieldDataTypesFlags *flags);

/*
 * MSG_FFD_VALIDATE_SCREEN_FIELD --
 *	This message is sent when a field's text object is to be
 *	entered into the database.  It grabs the text from the field,
 *	and sends it off to MSG_FFD_STORE_FIELD_DATA_IN_TEMP_ROW_CELL.
 *	If the text is illegal for some reason, the appropriate error
 *	value will be returned.  Otherwise, FFFV_FIELD_OK or one of
 *	the other benign values is returned.
 */
@message FFFieldValidationType MSG_FFD_VALIDATE_SCREEN_FIELD (optr textOptr,
                                FieldID colNum,
                                Boolean formatText);

/*
 * MSG_FFD_VALIDATE_SCREEN_FIELD_WITH_MESSAGE --
 * 	This message validates a screen field via the
 *    	FFDValidateScreenFieldWithMessage function and displays an
 *    	error message if something went wrong.  The return
 *    	value from MSG_FFD_VALIDATE_SCREEN_FIELD is returned.
 */
@message FFFieldValidationType MSG_FFD_VALIDATE_SCREEN_FIELD_WITH_MESSAGE (
                                optr textOptr,
                                FieldID colNum,
                                Boolean formatText);

/*
 * MSG_FFD_DISPLAY_VALIDATION_ERROR --
 *
 * 	This message puts up an error message describing an
 *   	invalid value in a field, unless for some reason we
 *    	should not put up an error.
 */
@message void MSG_FFD_DISPLAY_VALIDATION_ERROR (FieldID colNum,
                           FFFieldValidationType retval);

/*
 * MSG_FFD_NOTIFY_FIELD_NAVIGATION --
 * 	This message is sent when a field intercepts some random navigation
 *	key combination.
 */
@message void MSG_FFD_NOTIFY_FIELD_NAVIGATION (optr textOptr, FieldID colNum,
                          ShortcutCode shortcut);

/*
 * MSG_FFD_STORE_FIELD_DATA_IN_TEMP_ROW_CELL
 *	This message stores given data in given field in the temporary
 *	row.
 *
 *	Type checking is done for numeric types.  If the text cannot be
 *	validly converted to a FloatNum, FALSE will be returned.  Otherwise,
 *	TRUE is returned.
 */
@message Boolean MSG_FFD_STORE_FIELD_DATA_IN_TEMP_ROW_CELL (word colNum,
                               char *data);

/*
 * MSG_FFD_SET_TEMP_DATA_ROW_FOR_NEW_RECORD --
 * 	This method loads up the TEMP_DATA_ROW's fields (well,
 *    	the ones used by the current layout, anyway) with
 *    	default computed values or blanks, as the case may be.
 */
@message void MSG_FFD_SET_TEMP_DATA_ROW_FOR_NEW_RECORD ();

/*
 * MSG_FFD_STORE_CURRENT_ROW
 *	Moves data from the temporary row (TEMP_DATA_ROW) into
 *	the current row.
 */
@message void MSG_FFD_STORE_CURRENT_ROW ();

/*
 * MSG_FFD_CHECK_FIELD_DATA_TYPE
 * 	Checks the user entry for this field against defined data type
 *	for the field. Returns TRUE if the data's OK, FALSE otherwise.
 *	Also, if data can be converted to a FloatNum (i.e. it's an integer,
 *	real, date or time), then the FloatNum representation is stored
 *	at the given address.
 */
@message Boolean MSG_FFD_CHECK_FIELD_DATA_TYPE (word column,
                           MemHandle dataHandle,
                                    dword floatAddress);

/*
 * MSG_FFD_CHECK_FIELD_DATA_BETWEEN_MIN_AND_MAX
 *	Checks whether the given data (in dataHandle's block) is
 *	between the min and max for the given column.
 *	Returns	FIELD_IN_RANGE if data's OK
 *		FIELD_BELOW_MIN if value < min
 *		FIELD_ABOVE_MAX if value > max
 *
 */
@message FieldRangeCheck MSG_FFD_CHECK_FIELD_DATA_BETWEEN_MIN_AND_MAX (
                                    word column,
                                           FloatNum dataValue);

/*
 * MSG_FFD_EDIT_EXPRESSION --
 *
 *	This message handles when an expression or computed expression
 *	is be edited.  Given a token stream and an Expression Builder
 *	OD, this message translates the token stream into a string and
 *	gives the string to the expression builder.
 *
 *	MSG_FFD_PARSE_EXPRESSION deals with parsing the new string and
 *	dealing with errors.
 *
 * 	If the resultDestinationOptr is non-NULL, it will be sent the
 *	passed resultMessage.
 *
 *	The resultMessage's one argument is a MemHandle to the resulting
 *	token stream (so it's up to the resultDestination to determine if
 *	the stream changed or not).
 */
@message void MSG_FFD_EDIT_EXPRESSION (MemHandle tokenStreamHandle,
                      optr expressionBuilderOptr,
                      optr resultDestinationOptr,
                      Message resultMessage);

/*
 * MSG_FFD_PARSE_EXPRESSION --
 *	This message handles when an expresion builder is done
 *	building a string out and wants it to be parsed and translated
 *	into a token stream.
 *
 *	The parse library is called to parse the string. and any
 *	errors that might occur are displayed.  If an error does
 *	occur, the expression builder pointed to by the
 *	expressionBuilderOptr instance datum is requested to
 *	highlight (select) the offending part of the string.
 *
 *	Otherwise, the expression builder is called to shut itself
 *	down, and the resultDestinationOptr will be sent the passed
 *	resultMessage with a token stream's MemHandle.
 */
@message void MSG_FFD_PARSE_EXPRESSION (MemHandle stringHandle);

/*
 * MSG_PARSE_RETURN_TEMPLATE --
 *	This is a template for the return message discussed in
 *	MSG_FFD_EDIT_EXPRESSION above.  tokenStreamHandle is a
 *	MemHandle to a token stream determined by parsing an
 *	expression string, and numTokens is the number of tokens
 *	(well, bytes, really) in the stream.
 */
@prototype void MSG_FFD_PARSE_RETURN_TEMPLATE (MemHandle tokenStreamHandle,
                          word numTokens);

/*
 * MSG_FFD_PARSE_PARSE_STRING --
 *
 *
 */
@message Boolean MSG_FFD_PARSE_PARSE_STRING  (MemHandle stringHandle,
                         MemHandle tokenBufferHandle,
                         word tokenBufferSize,
                         word *numTokens,
                         VisTextRange *errorOffsetPtr);

/*
 * MSG_FFD_INIT_SINGLE_RECORD_LAYOUT
 *	This routine initializes the structure for the given
 *	layout of given layout type. Note that if you initializing
 *	a multi-record layout, you will want to call MSG_FFD_INIT_
 *	MULTI_RECORD_LAYOUT as well. This method stores the GrObjBody location
 *	in the database, and initializes the record layout structure.
 *	If you want the first available layout number, set layoutNum = -1.
 *	Returns layoutNum.
 */
@message byte MSG_FFD_INIT_SINGLE_RECORD_LAYOUT (byte layoutNum,
                     VMBlockHandle grObjBodyVMBlock,
                     ChunkHandle grObjBodyChunk,
                     optr grObjBodyOptr,
                     LayoutType layoutType);

/*
 * MSG_FFD_INIT_MULTI_RECORD_LAYOUT
 *	This routine initializes the structure for the given
 *	multi-record layout.
 *	This method stores the GrObjBody location in the database,
 *	and initializes the multi-record layout structure.
 */
@message void MSG_FFD_INIT_MULTI_RECORD_LAYOUT (byte layoutNum,
                              MemHandle mrGrObjBodyHandle,
                         ChunkHandle mrGrObjBodyChunk,
                                optr ffGrObjHeadOptr);

/* MSG_FFD_LOAD_FIELD_WITH_PAGE_NUMBER --
 * 	This message loads a text field with the current page
 *      number in multi-record mode.
 */
@message void MSG_FFD_LOAD_FIELD_WITH_PAGE_NUMBER (optr fieldOptr);

/* MSG_FFD_NOTIFY_LAYOUT_SIZE_GREW --
 *	This message is sent out by the database object to notify
 *	subclassed database objects that the single record layout
 *	(and possibly the page layout) has changed to a new size.
 *
 *	NOTE: this message is handled only by subclasses; it's ignored
 *	      by the database itself.
 */
@message void MSG_FFD_NOTIFY_LAYOUT_SIZE_GREW (LayoutSize srBounds,
                          PageSizeReport psr);

/*
 * MSG_FFD_CREATE_NEW_LAYOUT
 *	This routine creates a new layout, and displays it.
 *	It creates both the single-record and multi-record layouts
 *	(which together make up this layout), but displays the
 *	single-record layout.
 *
 *	The new layout number is returned.
 */
@message byte MSG_FFD_CREATE_NEW_LAYOUT (MemHandle singleRecordGrObjBodyHandle,
                    MemHandle multiRecordGrObjBodyHandle,
                    ChunkHandle ffGrObjBodyChunk,
                    optr ffGrObjHeadOptr);

/*
 * MSG_FFD_SET_SINGLE_RECORD_BOUNDS --
 * 	This message sets the single record bounds for the current
 *    	layout.  Note that the actual view is not modified, only
 *    	flat file's data.
 */
@message void MSG_FFD_SET_SINGLE_RECORD_BOUNDS (LayoutSize bounds);

/*
 * MSG_FFD_GET_SINGLE_RECORD_BOUNDS
 *
 *	Returns the size of the record layout boundary for the current
 *	layout.
 */
@message void MSG_FFD_GET_SINGLE_RECORD_BOUNDS (LayoutSize *bounds);

/*
 * MSG_FFD_REDRAW_MULTI_RECORD
 *
 * 	This message simply invalidates the current multi-record
 *	box so it redraws.
 */
@message void MSG_FFD_REDRAW_MULTI_RECORD ();

/*
 * MSG_FFD_GET_MULTI_RECORD_BOUNDS
 *
 *	Returns the size of the page layout boundary for the current
 *	layout.
 */
@message void MSG_FFD_GET_MULTI_RECORD_BOUNDS (LayoutSize *bounds);

/*
 * MSG_FFD_SET_MULTI_RECORD_BOUNDS
 *
 *	Sets the size of the page layout boundary for the current
 *	layout. Note the view is not updated, only flat file's data.
 */
@message void MSG_FFD_SET_MULTI_RECORD_BOUNDS (LayoutSize bounds);

/*
 * MSG_FFD_SET_MULTI_RECORD_WITHIN_MARGINS --
 *
 *	This message makes sure the current multi-record area is not
 *	above or to the left of the top and left margins.  It will
 *	move the repeater box if it needs to.
 *
 *	Warning: the size of the repeater box is left alone, so you
 *	         should make sure the size is ok before calling this
 *	    	 message.
 */
@message void MSG_FFD_SET_MULTI_RECORD_WITHIN_MARGINS (PageSizeReport *psr);

/*
 * MSG_FFD_GET_PAGE_BOUNDS
 *
 *	Returns the size of the page bounds for the current
 *	layout.
 */
@message void MSG_FFD_GET_PAGE_BOUNDS (PageSizeReport *psr);

/*
 * MSG_FFD_SET_PAGE_BOUNDS
 *
 *	Sets the size of the page bounds for the current
 *	layout. Note the view is not updated, only flat file's data.
 */
@message void MSG_FFD_SET_PAGE_BOUNDS (PageSizeReport *psr);

/*
 * MSG_FFD_DRAW_MARGINS --
 *	This message draws a margin border if we're currently
 * 	in multi-record design mode.
 */
@message void MSG_FFD_DRAW_MARGINS (GStateHandle gstate);

/*
 * MSG_FFD_GRAB_TARGET_ON_FIRST_FIELD
 * Finds the first visible field in the current layout (according
 * to the tab order) and has it grab the target
 */
@message void MSG_FFD_GRAB_TARGET_ON_FIRST_FIELD ();

/*
 * MSG_FFD_GET_CURRENT_LAYOUT
 *	Returns the current layout number.
 */
@message byte MSG_FFD_GET_CURRENT_LAYOUT ();

/*
 * MSG_FFD_GET_LAYOUT_TYPE
 *	Returns the LayoutType of the given layout.  If curLayout is set to
 *	TRUE, the current layout's type is returned.  Otherwise, layoutNum's
 *	type is returned.
 */
@message LayoutType MSG_FFD_GET_LAYOUT_TYPE (byte layoutNum, Boolean curLayout);

/*
 * MSG_FFD_SET_LAYOUT_TYPE
 *	Sets the LayoutType for the given layout.
 */
@message void MSG_FFD_SET_LAYOUT_TYPE (byte layoutNum, LayoutType layoutType);

/*
 * MSG_FFD_GET_CURRENT_LAYOUT_INDEX
 *	Returns the current layout number's index into the list
 *	of sorted layout names.
 */
@message byte MSG_FFD_GET_CURRENT_LAYOUT_INDEX ();

/*
 * MSG_FFD_GET_LAYOUT_NAME
 *
 *	This message retrieves the layout name for a given layout.
 *	If textBuffer is non-NULL, the name will be strcpy()'d into
 *	the area pointed to by the textBuffer.  Else, a block will be
 *	allocated as sharable, the name copied into the block, the block
 *	will be unlocked, and the block's handle returned.
 */
@message MemHandle MSG_FFD_GET_LAYOUT_NAME (word layoutNum,
                       TCHAR *textBuffer);

/*
 * MSG_FFD_GET_LAYOUT_NOTES
 *
 *	This message retrieves the layout notes for a given layout.
 *	If textBuffer is non-NULL, the notes will be strcpy()'d into
 *	the area pointed to by the textBuffer.  Else, a block will be
 *	allocated as sharable, the notes copied into the block, the block
 *	will be unlocked, and the block's handle returned.
 */
@message MemHandle MSG_FFD_GET_LAYOUT_NOTES (byte layoutNum,
                       TCHAR *textBuffer);

/*
 * MSG_FFD_STORE_LAYOUT_NOTES
 *
 *	This message stores the layout notes for a given layout.
 */
@message void MSG_FFD_STORE_LAYOUT_NOTES (byte layoutNum,
                          TCHAR *textBuffer);

/*
 * MSG_FFD_GET_CURRENT_LAYOUT_NAME
 *
 *	This message retrieves the layout name for the current layout.
 *	If textBuffer is non-NULL, the name will be strcpy()'d into
 *	the area pointed to by the textBuffer.  Else, a block will be
 *	allocated as sharable, the name copied into the block, the block
 *	will be unlocked, and the block's handle returned.
 */
@message MemHandle MSG_FFD_GET_CURRENT_LAYOUT_NAME (TCHAR *textBuffer);

/*
 * MSG_FFD_GET_INDEXED_LAYOUT_NAME
 *
 *	This message retrieves the layout name for the layout at the
 *	given index in the list of sorted layout names.
 *	If textBuffer is non-NULL, the name will be strcpy()'d into
 *	the area pointed to by the textBuffer.  Else, a block will be
 *	allocated as sharable, the name copied into the block, the block
 *	will be unlocked, and the block's handle returned.
 */
@message MemHandle MSG_FFD_GET_INDEXED_LAYOUT_NAME (byte layoutNameIndex,
                               TCHAR *textBuffer);

/*
 * MSG_FFD_GET_LAYOUT_NUM_FROM_INDEX
 *
 *	Given an index into the list of sorted layout names, this message
 *	returns the absolute column number.
 */
@message byte MSG_FFD_GET_LAYOUT_NUM_FROM_INDEX (byte layoutNameIndex);

/*
 * MSG_FFD_SWITCH_TO_LAYOUT
 *
 *	This message detaches the current GrObjBody, and attaches the
 * 	one corresponding to the given layout (with the current layoutType
 *	display).
 *
 *	Set the `printing' flag if you do not want the view to be reset.
 */
@message void MSG_FFD_SWITCH_TO_LAYOUT (byte layoutNum,
                       optr ffGrObjHeadOptr,
                       LayoutType layoutType,
                       Boolean printing);

/*
 * MSG_FFD_SWITCH_TO_INDEXED_LAYOUT
 *
 *	Switches to the layout of the given index (the index is an index
 *	into the sorted list of layout names). Checks the layout type
 *	of the requested layout, and displays it.
 */
@message LayoutType MSG_FFD_SWITCH_TO_INDEXED_LAYOUT (byte index,
                    optr ffGrObjHeadOptr);

/*
 * MSG_FFD_RENAME_LAYOUT
 *
 *	Renames the given layout. The layout number passed represents
 *	the absolute column number of the layout.
 *	Returns FALSE if the name is already used; TRUE if no
 *	problems encountered.
 */
@message Boolean MSG_FFD_RENAME_LAYOUT (byte layoutNum,
                       TCHAR *newLayoutName);

/*
 * MSG_FFD_DELETE_LAYOUT
 *
 *	Deletes the given layout after prompting the user for confirmation.
 *	The layout number passed represents the absolute column number
 *	of the layout.
 *
 *	You must, at all times, have at least one layout. So, if you
 *	try to delete the last layout, the routine will return
 *	ATTEMPTED_TO_DELETE_LAST_LAYOUT. If the user chose not to delete
 *	this routine returns NO_DELETE_DONE.
 *	Otherwise, it will return DELETE_OK.
 *
 *	If you delete the current layout, the "new" current layout will
 *	be the one after the current one in the sorted list of layout
 *	names. If you delete the current layout, and it's also the last
 *	layout (alphabetically), the "new" current layout becomes
 *	the one before the current one.
 */
@message FFDeleteLayoutResult MSG_FFD_DELETE_LAYOUT (byte layoutNum,
                           optr ffGrObjHeadOptr);

/*
 * MSG_FFD_SET_DOCUMENT_HANDLE
 *	This routine sets the current document's file handle in the
 *	instance data for the flat file object. We need this so that
 *	we can later get optrs to the GrObjBody and GrObjects
 *	(given their VM blocks & chunk handles
 */
@message void MSG_FFD_SET_DOCUMENT_HANDLE (VMFileHandle documentFileHandle);

/*
 * MSG_FFD_SET_GROBJ_AM
 *	This routine sets the Attribute Manager's optr in the instance
 *	data for the flat file object.
 */
@message void MSG_FFD_SET_GROBJ_AM (optr grObjAMOptr);

/*
 * MSG_FFD_GET_GROBJ_BODY_FOR_LAYOUT
 *
 *   	Given the layout number and type, returns the GrObjBody
 */
@message optr MSG_FFD_GET_GROBJ_BODY_FOR_LAYOUT (byte layoutNum,
                        LayoutType layoutType);

/*
 * MSG_FFD_GET_GROBJ_BODIES_FOR_CURRENT_LAYOUT
 *
 *   	Returns the GrObjBody for the current layout. If the
 *	current layout is in Data Entry mode and displaying
 *	multi-records, then the pointer to grobjBody2 is
 *	filled in. Note: if both grobj bodies are filled in
 *	then the one returned by the routine is that for
 *	the multi-record layout; the one pointed to by
 *	grobjBody2 is that for the single-record layout.
 */
@message optr MSG_FFD_GET_GROBJ_BODIES_FOR_CURRENT_LAYOUT (optr *grobjBody2);

/*
 * MSG_FFD_SET_CURRENT_MODE --
 *	This message changes the current mode to any of the available
 *	data entry or design modes (enumerated in the ModeTypes).
 *
 *	If the mode is changing from a design mode to a data entry
 *	mode, all decoration GrObjects in the layout are made
 *	uneditable and non-selectable, and all data entry objects are
 *	made editable but not selectable.
 *
 *	If the mode is changing to a design mode, all objects are made
 *	editable, selectable, etc.
 */
@message void MSG_FFD_SET_CURRENT_MODE (ModeType newMode);

/*
 * MSG_FFD_SET_CURRENT_MODE_TO_DESIGN --
 *	This message changes the current mode to design mode through
 *	MSG_FFD_SET_CURRENT_MODE.
 */
@message void MSG_FFD_SET_CURRENT_MODE_TO_DESIGN ();

/*
 * MSG_FFD_SET_CURRENT_MODE_TO_DATA_ENTRY --
 *	This message changes the current mode to data entry mode through
 *	MSG_FFD_SET_CURRENT_MODE.
 */
@message void MSG_FFD_SET_CURRENT_MODE_TO_DATA_ENTRY ();

/*
 * MSG_FFD_GET_CURRENT_MODE --
 *	Returns the current mode type.
 */
@message ModeType MSG_FFD_GET_CURRENT_MODE ();

/*
 * MSG_FFD_LOAD_FIELD_WITH_NAME --
 *	This message loads a text field with its own name.  Pass the OD
 *	of the field, and the column to find the name.
 */
@message void MSG_FFD_LOAD_FIELD_WITH_NAME (optr fieldOptr, FieldID colNum);

/*
 * MSG_FFD_LOAD_FIELD_WITH_UNFORMATTED_TEXT --
 *	This message loads a text field with the unformatted text
 *	that was typed into it.  Pass the OD of the field and its column
 *	number.
 */
@message void MSG_FFD_LOAD_FIELD_WITH_UNFORMATTED_TEXT (optr fieldOptr,
                               FieldID colNum);

/*
 * MSG_FFD_DISPLAY_USER_DEFINED_FORMAT --
 *	This message formats a float number to a user defined format.
 *	Pass a pointer to the text buffer to be filled with the formatted
 *	number, a pointer to the number, and the display format.
 */
@message void MSG_FFD_DISPLAY_USER_DEFINED_FORMAT (TCHAR *fieldText,
                          FloatNum *floatNum,
                          FormatIdType displayFormat);

/*
 * MSG_FFD_VERIFY_SCREEN_FIELDS --
 * 	This method runs through the text objects in the
 *	current layout, making sure that all of the fields
 *	that should have information in them actually do.
 *
 *	If all fields were successfully entered into the row,
 *	then TRUE is returned.  Otherwise, FALSE is.
 */
@message Boolean MSG_FFD_VERIFY_SCREEN_FIELDS ();

/*
 * MSG_FFD_TRANSFER_TEMP_ROW_TO_SCREEN_FIELDS --
 * 	This method runs through the current layout's fields
 *   	and loads the field's text objects with data from the
 *    	TEMP_DATA_ROW's corresponding fields.
 */
@message Boolean MSG_FFD_TRANSFER_TEMP_ROW_TO_SCREEN_FIELDS ();

/*
 * MSG_FFD_DISPLAY_TEMP_ROW_COMPUTED_FIELDS --
 *
 * 	This method runs through the current layout's computed
 *	fields and loads their text objects with data from the
 *    	TEMP_DATA_ROW's corresponding fields.
 */
@message void MSG_FFD_DISPLAY_TEMP_ROW_COMPUTED_FIELDS ();

/*
 * MSG_FFD_GET_DATA_TYPE_AND_LENGTH --
 * 	This method returns the data type and length for a given field
 *	in a given record.
 */
@message void MSG_FFD_GET_DATA_TYPE_AND_LENGTH (word fieldNum,
                           word row,
                           FieldDataType *dataType,
                           word *dataLength);

/*
 * MSG_FFD_LOAD_TEMP_ROW_FROM_ANOTHER_ROW --
 *	This method loads up the TEMP_DATA_ROW with fields from another
 *	database record.
 *
 *	NOTE: only fields in the current layout are loaded!
 */
@message void MSG_FFD_LOAD_TEMP_ROW_FROM_ANOTHER_ROW (word recordToLoad);

/*
 * MSG_FFD_STORE_TEMP_ROW_INTO_ANOTHER_ROW --
 *	This method stores data from the TEMP_DATA_ROW into another row.
 *
 *	NOTE: only fields in the current layout are stored!
 */
@message void MSG_FFD_STORE_TEMP_ROW_INTO_ANOTHER_ROW (word rowToStoreInto);

/*
 * MSG_FFD_LOAD_CURRENT_RECORD_TO_SCREEN --
 * 	This method loads the TEMP_DATA_ROW with field info from
 *	the current record, then loads the current layout's screen
 *	fields with the info for the user's editing pleasure.
 *
 */
@message void MSG_FFD_LOAD_CURRENT_RECORD_TO_SCREEN ();

/*
 * MSG_FFD_EDIT_NEW_RECORD --
 *	This method clears the TEMP_DATA_ROW's fields (the
 *   	ones used by the the current layout, anyway), loads up
 *    	the fields that have computed defaults, loads up the
 *    	screen's fields from the temp row, and sets the
 *    	FFI_editingNewRecord flag.
 *	If you just want to load a clean record into the current
 *	GrObjBody, pass moveGrObjBody = FALSE.
 *	If you are in multi-record mode, and it's possible that
 *	the GrObjBody may have to move, send moveGrObjBody = TRUE,
 *	and the message handler will find the appropriate position.
 *
 *	If you pass newRecordType = NRT_LOAD_FROM_TEMP_VISUAL_UPDATE_ROW,
 *	then the data for this new record will be loaded from
 *	TEMP_DATA_ROW_FOR_VISUAL_UPDATES.
 *	If you just want a regular new record, pass newRecordType =
 *	NRT_REGULAR.
 *
 *	If you want the first field in the record to grab the target,
 *	pass fieldGrabTarget = TRUE. If you don't want the target to
 *	be mucked with, pass fieldGrabTarget = FALSE.
 *
 *    	This is the method to call when the user wants to create
 *    	a new record.
 */
@message void MSG_FFD_EDIT_NEW_RECORD (Boolean moveGrObjBody,
                    NewRecordType newRecordType,
                    Boolean fieldGrabTarget);

/*
 * MSG_FFD_EDIT_EXISTING_RECORD --
 *	This method loads the TEMP_DATA_ROW's fields (the
 *   	ones used by the the current layout, anyway) with data
 *	from a record and loads up the screen's fields with the
 *	data.
 *	If you just want to load the existing record into the current
 *	GrObjBody, pass moveGrObjBody = FALSE.
 *	If you are in multi-record mode, and it's possible that
 *	the GrObjBody may have to move, send moveGrObjBody = TRUE,
 *	and the message handler will find the appropriate position.
 *
 *	If you want the first field in the record to grab the target,
 *	pass fieldGrabTarget = TRUE. If you don't want the target to
 *	be mucked with, pass fieldGrabTarget = FALSE.
 *
 *	For documentation on editRecordType, see
 *	MSG_FFD_EDIT_NEW_RECORD's newRecordType.
 *
 *    	This is the method to call when the user wants to edit
 *    	an existing record.
 */
@message void MSG_FFD_EDIT_EXISTING_RECORD (word recordToEdit, Boolean
                       moveGrObjBody,
                       Boolean fieldGrabTarget,
                       EditRecordType editRecordType);

/*
 * MSG_FFD_REVERT_CURRENT_RECORD --
 *
 *	Revert the currently being edited field to it's last saved
 *	contents.  If editing a new record then all fields reset.
 */
@message Boolean MSG_FFD_REVERT_CURRENT_RECORD ();

/*
 * MSG_FFD_COMMIT_TEMP_DATA_ROW_TO_DATABASE --
 * 	This method saves the information in the TEMP_DATA_ROW's
 *    	fields (the fields used by the current layout, anyway)
 *    	to the current layout's row, unless the
 *    	FFI_editingNewRecord flag is set.  If this is set,
 *    	then a new row will be saved, the total number of
 *    	records will be incremented, the current record will
 *    	be set to the new record, and the FFI_editingNewRecord
 *    	flag will be cleared.
 *
 *     	If the displayErrorMessages flag is set, errors
 *    	are displayed in a UserStandardDialog() error box.
 *
 *	If we're in multi-record data entry mode, then if the
 *	screen needs to redrawn, we do so by moving to each record
 *	on the screen successively. In the process, the current
 *	record will be committed. If the current record is a new
 *	record that has been dirtied, we don't want to commit
 *	this record permanently to the database yet, but we do
 *	want to store it somewhere so it can be read back in.
 *	If this is the case, set CommitRecordType = CRT_VISUAL_UPDATE_COMMIT.
 *	If you just want to commit the record as usual, set
 *	CommitRecordType = CRT_REGULAR_COMMIT.
 *
 */
@message InsertResult MSG_FFD_COMMIT_TEMP_DATA_ROW_TO_DATABASE
                    (Boolean displayErrorMessages,
                     CommitRecordType commitRecordType);

/*
 * MSG_FFD_CURRENTLY_EDITING_A_RECORD --
 *	This message returns TRUE if either FFI_editingNewRecord or
 *	FFI_dirtyRecord is TRUE.
 */
@message Boolean MSG_FFD_CURRENTLY_EDITING_A_RECORD ();

/*
 * MSG_FFD_IS_THIS_A_NEW_RECORD --
 *	This message returns TRUE if FFI_editingNewRecord is TRUE,
 *	FALSE otherwise.
 */
@message Boolean MSG_FFD_IS_THIS_A_NEW_RECORD ();

/*
 * MSG_FFD_SORT_INFO_SHADOW_SAVE --
 *
 *	Save the current sort context.
 */
@message void MSG_FFD_SORT_INFO_SHADOW_SAVE  ();

/*
 * MSG_FFD_SORT_INFO_SHADOW_RESTORE --
 *
 *	Restore the previously save sort context.
 */
@message void MSG_FFD_SORT_INFO_SHADOW_RESTORE  ();

/*
 * MSG_FFD_SORT_INFO_SHADOW_DELETE --
 *
 *	Remove the previously save sort context.
 */
@message void MSG_FFD_SORT_INFO_SHADOW_DELETE  ();

/*
 * MSG_FFD_SORT_INFO_SORT
 *
 *	Stably sort the database on the given field (indexed from the
 *	DATABASE_NAME_LIST list) in the appropriate order
 *	(ascending/descending).
 *
 */
@message sbyte MSG_FFD_SORT_INFO_SORT  ();

/*
 * MSG_FFD_SORT_INFO_GET_NUM_ITEMS
 *
 *	Get the number of entries in the sort keys/sub-total fields list.
 */
@message byte MSG_FFD_SORT_INFO_GET_NUM_ITEMS  ();

/*
 * MSG_FFD_SORT_INFO_ADD_ITEM
 *
 *	Insert an item onto the end sort keys/sub-total fields list.
 */
@message byte MSG_FFD_SORT_INFO_ADD_ITEM  (word item);

/*
 * MSG_FFD_SORT_INFO_DELETE_ITEM
 *
 *	Delete an item from the sort keys/sub-total fields list.
 */
@message byte MSG_FFD_SORT_INFO_DELETE_ITEM  (word itemIndex);

/*
 * MSG_FFD_SORT_INFO_DELETE_ALL_ITEMS
 *
 *	Remove all entries from the sort keys/sub-total fields list.
 */
@message void MSG_FFD_SORT_INFO_DELETE_ALL_ITEMS  ();

/*
 * MSG_FFD_SORT_INFO_ITEM_SEARCH --
 *
 *	Search for a reference to the given DATABASE_NAME_LIST index in the
 *	sort key information list.
 */
@message Boolean MSG_FFD_SORT_INFO_ITEM_SEARCH  (byte dbIndex,
                        byte *sortIndex);

/*
 * MSG_FFD_SORT_INFO_QUERY_ITEM
 *
 *	Get the DATABASE_NAME_LIST list index stored in the sort-keys/sub-total
 *	fields list at the given index.  Inform the caller of the sort
 *	direction of the field also.
 */
@message sword MSG_FFD_SORT_INFO_QUERY_ITEM  (word itemIndex,
                         sbyte *sortAscending);

/*
 * MSG_FFD_SORT_INFO_LIST_MONIKER_QUERY
 *
 *	Provide the given list with the moniker for the requested item.
 */
@message void MSG_FFD_SORT_INFO_LIST_MONIKER_QUERY  (optr dynList,
                            word itemIndex);

/*
 * MSG_FFD_SORT_INFO_LIST_REQUEST_NOTES
 *
 *	Supply the given text object with the notes text associated with
 *	given sort-key/sub-total fields list item.
 */
@message void MSG_FFD_SORT_INFO_LIST_REQUEST_NOTES  (optr textObj,
                            word itemIndex);

/*
 * MSG_FFD_SORT_INFO_GET_SORT_DIRECTION
 *
 *	Retrieve the sort direction (ordering) of the given item in the
 *	sort-key/sub-total fields list.
 */
@message sbyte MSG_FFD_SORT_INFO_GET_SORT_DIRECTION  (word itemIndex);

/*
 * MSG_FFD_SORT_INFO_SET_SORT_DIRECTION
 *
 *	Set the sort direction (ordering) of the given item in the
 *	sort-key/sub-total fields list to that provided.
 */
@message void MSG_FFD_SORT_INFO_SET_SORT_DIRECTION  (word itemIndex,
                            sbyte sortAscending);

/*
 * MSG_FFD_SORT_INFO_INCREASE_PRIORITY
 *
 *	Increase the relative sort priority of the given sort
 *	key/sub-totals item (i.e. move it up in the list).
 */
@message Boolean MSG_FFD_SORT_INFO_INCREASE_PRIORITY  (word itemIndex);

/*
 * MSG_FFD_SORT_INFO_DECREASE_PRIORITY
 *
 *	Decrease the relative sort priority of the given sort
 *	key/sub-totals list item (i.e. move it down in the list);
 */
@message Boolean MSG_FFD_SORT_INFO_DECREASE_PRIORITY  (word itemIndex);

/*
 * MSG_FFD_SORT_INFO_SET_SORT_OPTIONS
 *
 *	Set the sorting options data.
 */
@message void MSG_FFD_SORT_INFO_SET_SORT_OPTIONS
            (FFDSortOptions sortOptions);

/*
 * MSG_FFD_SORT_INFO_GET_SORT_OPTIONS
 *
 *	Get the sorting options data.
 */
@message FFDSortOptions MSG_FFD_SORT_INFO_GET_SORT_OPTIONS  ();

/*
 * MSG_FFD_SORT_INFO_NUKE_FIELD
 *
 *	Delete any item from the sort keys/sub-total fields list that
 *	references the given field/column.
 */
@message void MSG_FFD_SORT_INFO_NUKE_FIELD  (byte columnNum);

/*
 * MSG_FFD_FNO_INFO_SHADOW_SAVE
 *
 *	Save the current field navigation order information.
 */
@message void MSG_FFD_FNO_INFO_SHADOW_SAVE  ();

/*
 * MSG_FFD_FNO_INFO_SHADOW_RESTORE
 *
 *	Remove the currently saved field navigation order information.
 */
@message void MSG_FFD_FNO_INFO_SHADOW_RESTORE  ();

/*
 * MSG_FFD_FNO_INFO_SHADOW_DELETE
 *
 *	Restore the current field navigation order information.
 */
@message void MSG_FFD_FNO_INFO_SHADOW_DELETE  ();

/*
 * MSG_FFD_FNO_INFO_GET_NUM_ITEMS
 *
 *	Return the count of items in the field navigation order list.
 */
@message sword MSG_FFD_FNO_INFO_GET_NUM_ITEMS  ();

/*
 * MSG_FFD_FNO_INFO_ADD_ITEM
 *
 *	Add the given item index to the end of the current database's
 *	field navigation order list.
 */
@message sword MSG_FFD_FNO_INFO_ADD_ITEM  (FieldID fieldID);

/*
 * MSG_FFD_FNO_INFO_DELETE_ITEM
 *
 *	Remove the given item from the current database's field navigation
 *	order list.
 *	Note:	Use MSG_FFD_FNO_INFO_NUKE_FIELD to delete based on the
 *		fieldID.
 */
@message sword MSG_FFD_FNO_INFO_DELETE_ITEM  (word itemIndex);

/*
 * MSG_FFD_FNO_INFO_DELETE_ALL_ITEMS
 *
 *	Delete all of the entries in the field navigation order list.
 */
@message void MSG_FFD_FNO_INFO_DELETE_ALL_ITEMS  ();

/*
 * MSG_FFD_FNO_INFO_QUERY_ITEM
 *
 *	Retrieve the DATABASE_NAME_LIST index value stored at the given
 *	index in the field navigation order list.
 */
@message sword MSG_FFD_FNO_INFO_QUERY_ITEM  (word itemIndex);

/*
 * MSG_FFD_FNO_INFO_LIST_MONIKER_QUERY
 *
 *	Supply the given dynamic list with the moniker for the requested
 *	item from the field navigation order list.
 */
@message void MSG_FFD_FNO_INFO_LIST_MONIKER_QUERY  (optr dynList,
                           word itemIndex);
/*
 * MSG_FFD_FNO_INFO_GET_FIELD
 *
 *	Retrieve the field in the database that closest to the given
 *	field (according to the search criteria mandated by the given
 *	field order movement command) that is in the current layout
 *	based *	on the currently defined field navigation order context.
 */
@message sword MSG_FFD_FNO_INFO_GET_FIELD
            (FieldID fieldID,
             FieldOrderMovementCommand movementCmd);

/*
 * MSG_FFD_FNO_INFO_GET_NEXT_FIELD
 *
 *	Retrieve the FieldID of the field in the current layout that
 *	logically follows the given field (as specified by the user).
 *	If you want the field that follows the fieldID, set
 *	the forwardFlag to TRUE.  If you want the preceding
 *	field, set the forwardFlag to FALSE.
 */
@message sword MSG_FFD_FNO_INFO_GET_NEXT_FIELD  (FieldID fieldID,
                        Boolean forwardFlag);

/*
 * MSG_FFD_FNO_INFO_INCREASE_PRIORITY
 *
 *	Move the given field navigation order list item 'up' one spot in
 *	the list.
 */
@message Boolean MSG_FFD_FNO_INFO_INCREASE_PRIORITY  (word itemIndex);

/*
 * MSG_FFD_FNO_INFO_DECREASE_PRIORITY
 *
 */
@message Boolean MSG_FFD_FNO_INFO_DECREASE_PRIORITY  (word itemIndex);

/*
 * MSG_FFD_FNO_INFO_NUKE_FIELD
 *
 *	Delete any item from the sort keys/sub-total fields list that
 *	references the given field/column.
 */
@message void MSG_FFD_FNO_INFO_NUKE_FIELD  (FieldID fieldID);

/*
 * MSG_FFD_GET_SUBSET_TOKEN_STREAM --
 *
 *	This message returns a MemHandle to the current subset token stream
 *	handle stored in FFI_VAR_SUBSET_TOKEN_STREAM.
 *
 *	It is the caller's responsibility to free the block.
 */
@message MemHandle MSG_FFD_GET_SUBSET_TOKEN_STREAM ();

/*
 * MSG_FFD_SUBSET_APPLY
 *
 *	Create a marked subset in the database by applying the given
 *	tokenized expression to each record.  The expression is
 *	copied into the FFI_SUBSET_TOKEN_STREAM vardata.
 */
@message Boolean MSG_FFD_SUBSET_APPLY  (MemHandle tokenStreamHandle,
                       word numTokens);

/*
 * MSG_FFD_GET_FIRST_MARKED_RECORD --
 *
 *	This message returns the first marked record in the database.
 *	If no marked records exist, it will return NOT_A_RECORD.
 */
@message word MSG_FFD_GET_FIRST_MARKED_RECORD ();

/*
 * MSG_FFD_SUBSET_MARK_ALL --
 *
 *	Mark all records as being in the current subset.
 */
@message void MSG_FFD_SUBSET_MARK_ALL  ();

/*
 * MSG_FFD_SUBSET_UNMARK_ALL --
 *
 *	Clear out all record marks.
 */
@message void MSG_FFD_SUBSET_UNMARK_ALL  ();

/*
 * MSG_FFD_SUBSET_INVERT_MARKS --
 *
 *	Invert the current record marking (subset).
 */
@message void MSG_FFD_SUBSET_INVERT_MARKS  ();

/*
 * MSG_FFD_SUBSET_SHOW_ALL_RECORDS --
 *
 *	Instruct the database to show only marked records or to show all of
 *	the records in the database.
 */
@message Boolean MSG_FFD_SUBSET_SHOW_ALL_RECORDS ();

/*
 * MSG_FFD_SUBSET_SHOW_ONLY_MARKED_RECORDS --
 *
 *	Instruct the database to show only marked records the records in
 *	the database.
 */
@message Boolean MSG_FFD_SUBSET_SHOW_ONLY_MARKED_RECORDS ();

/*
 * MSG_FFD_SUBSET_DELETE_MARKED_RECORDS --
 *
 *	Instruct the database to delete all marked records from the
 *	database.
 */
@message void MSG_FFD_SUBSET_DELETE_MARKED_RECORDS  ();

/*
 * MSG_FFD_SUBSET_AUTO_APPLY_MARK --
 *
 *	Instructs the database to apply the current record marking (subset)
 *	expression to each newly created record.
 *	If applyFlag == FALSE it will refrain from applying things.
 *	Otherwise it will.
 */
@message void MSG_FFD_SUBSET_AUTO_APPLY_MARK  (Boolean applyFlag);

/*
 * MSG_FFD_SUBSET_CLEAR_MARKS_FIRST --
 *
 *	Instructs the database to clear out any and all preexisting record
 *	marks prior to applying a record marking expression.
 *	If applyFlag == FALSE it will refrain from applying things.
 *	Otherwise it will.
 */
@message void MSG_FFD_SUBSET_CLEAR_MARKS_FIRST  (Boolean applyFlag);

/*
 * MSG_FFD_SUBSET_GET_OPTIONS --
 *
 *	Retrieve the current settings of the various record marking
 *	options.
 */
@message FFDSubsetOptionsInfo MSG_FFD_SUBSET_GET_OPTIONS  ();

/*
 * MSG_FFD_GET_MAX_LENGTH
 *
 * 	Returns the user-defined maximum length for the given column
 *	number. If datatype = Text/Anything, it returns the maximum
 *	length defined by the user. Else returns MAX_TEXT_FIELD_LENGTH.
 */
@message word MSG_FFD_GET_MAX_LENGTH  (byte colNum);

/*
 * MSG_FFD_RECORD_CONTROL --
 *
 *	Perform the specified FFRecordControlRequest with the given data.
 */
@message Boolean MSG_FFD_RECORD_CONTROL  (FFRecordControlRequest rcpRequest,
                     word data);

/*
 * MSG_FFD_GET_NUMBER_OF_PAGES --
 *	This message returns the total number of pages printable from
 *	the current layout.
 */
@message word MSG_FFD_GET_NUMBER_OF_PAGES ();

/*
 * MSG_FFD_GO_TO_PAGE --
 *	This message causes the current layout to display the requested page
 *	of records.  Note that this might mean different things in single
 *	and multi-record mode.
 */
@message void MSG_FFD_GO_TO_PAGE (word newPage, Boolean redraw);

/*
 * MSG_FFD_IMPORT_TRANSFER_FILE --
 *
 *	Perform file import operation.
 */
@message void MSG_FFD_IMPORT_TRANSFER_FILE  (ImpexTranslationParams *itParams);

/*
 * MSG_FFD_EXPORT_TRANSFER_FILE --
 *
 *	Perform file export operation.
 */
@message void MSG_FFD_EXPORT_TRANSFER_FILE  (ImpexTranslationParams *itParams,
                        word begRecord, word endRecord);

/*
 * MSG_FFD_EXPORT_TO_CLIPBOARD --
 *
 *	Export file to clipboard.
 */
@message void MSG_FFD_EXPORT_TO_CLIPBOARD  (word begRecord, word endRecord);

/*
 * MSG_FFD_CREATE_DATA_BLOCK_AND_SEND_NOTIFICATION --
 *
 *	Creates a data block and sends it off to the map controller.
 */
@message void MSG_FFD_CREATE_DATA_BLOCK_AND_SEND_NOTIFICATION  ();

/*
 * MSG_FFD_FIELD_ORGANIZER_ENABLE_DISABLE --
 *
 *	Enable/disable the given Field Organizer based on the current
 *	layout mode type.
 */
@message void MSG_FFD_FIELD_ORGANIZER_ENABLE_DISABLE
            (optr fieldOrganizer, VisUpdateMode updateMode);

/*
 * Instance data defaults
 */
    @default VI_typeFlags = ( VTF_IS_COMPOSITE | VTF_IS_INPUT_NODE );

/*
 * Information we want to store for the flatfile
 */
    @instance	VMBlockHandle	FFI_mapBlock;

/*
 * These instance data are used to remember to whom and how a token stream is
 * to be sent.
 */
     @instance   	optr	FFI_tokenStreamDestOptr;
     @instance   	Message	FFI_tokenStreamDestMsg = 0;

/*
 * This instance data is used to make the FlatFile object a target/focus
 * node, so that keyboard/mouse messages are sent to the GrObjBody
 * below it.
 */
    @instance	HierarchicalGrab FFI_targetExcl = {0, 0};
        @instance       HierarchicalGrab FFI_focusExcl = {0, 0};

/*
 * The expressionBuilderOptr is used to remember which expression
 * builder is being used.
 */
     @instance   	optr	FFI_expressionBuilderOptr;

/*
 * optr to the GrObjHead; we need to store this because we'll be
 * sending a messages to it when changing modes (from Design to
 * Data Entry and vice versa)
 */
    @instance	optr	FFI_grObjHeadOptr;

/*
 * optr to the GrObj's AttributeManager
 */
    @instance	optr	FFI_grObjAM;

/*
 * Automatic field generation number, incremented whenever a new field
 * is created.
 */
        @instance   	word	FFI_automaticFieldNumber = 1;

/*
 * Flag: has the currently loaded record been changed?
 * NOTE! FFI_editingNewRecord takes precidence over FFI_dirtyRecord.
 */
     @instance   	byte	FFI_dirtyRecord = FALSE;

/*
 * Flag: are we editing a new record?
 */
     @instance   	byte	FFI_editingNewRecord = FALSE;

/* bit array for columns occupied by fields in the database */
    @instance 	byte	FFI_columnsTaken[COLUMNS_TAKEN_ARRAY_SIZE] =
                        {0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0};
/* bit array for layout columns occupied by fields in the database;
   the first one is marked taken because that's where the sorted list
   of layout names is stored */
    @instance	byte FFI_layoutColumnsTaken[COLUMNS_TAKEN_ARRAY_SIZE] =
                        {0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0};

/* The highest number of layouts ever created. A newly created layout is
   called "Layout x" (Layout 0, Layout 1, etc.) This is used to keep track
   of the highest layout number created so far, so that we can use it
   to name the next layout */

    @instance	word	FFI_highestLayoutNumber = 0;

    @instance 	ModeType FFI_currentMode = MT_DESIGN;
    @instance	byte	FFI_currentLayout = 0;
    @instance	byte	FFI_currentLayoutType = LT_SINGLE_RECORD;
    @instance	byte	FFI_numLayouts = 0;
/*
 * The number of the page we're currently displaying in multi-record
 * data entry mode
 */
    @instance	word	FFI_currentPage = 0;

/*
 * Current layout size.
 */
     @instance   	LayoutSize FFI_pageSize = {0, 0};

    @instance	word	FFI_totalNumRecordsInDatabase = 0;
    @instance	word	FFI_numMarkedRecords = 0;
    @instance	word	FFI_numRecords = 0;
     @instance   	word	FFI_currentMarkedRecord = 0;

    @instance	byte	FFI_currentTopRecordInMultiRecDisplay = -1;

    @instance 	byte	FFI_numFields = 0;
    @instance	FieldID	FFI_databaseNameList[MAX_NUM_FIELDS+1] =
             { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff };

/*
 * FFI_notInLayoutNameList is the list of database fields that are not
 * in the current layout (and FFI_numInNotInLayoutNameList is its
 * corresponding number).  The fields in this array with the fields in
 * the FFI_layoutNameList array MUST equal the total number of defined
 * fields in the database.
 */
    @instance 	byte	FFI_numInNotInLayoutNameList = 0;
    @instance	FieldID	FFI_notInLayoutNameList[MAX_NUM_FIELDS+1] =
             { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff };

/*
 * FFI_layoutNameList is the list of fields that are in the current
 * layout (and FFI_numInLayoutNameList is its corresponding number).
 * The fields in this array with the fields in the FFI_notInLayoutNameList
 * array MUST equal the total number of defined fields in the database.
 */
    @instance 	byte	FFI_numInLayoutNameList = 0;
    @instance	FieldID	FFI_layoutNameList[MAX_NUM_FIELDS+1] =
             { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff };

    @instance	VMFileHandle	documentHandle;

       /*
    * The GFDI_floatControlBlock instance datum holds the block
    * of our file that contains float controller definitions.
    */
       @instance    	VMBlockHandle 	FFI_floatControlBlock;
       @instance    	word	    	FFI_floatControlCount = 0;

/*
 * Store the current tool for design mode, so that when we go to
 * data entry and back, we can reset it
 */
    @instance	ClassStruct	*FFI_designModeGrObjTool;

    /* Record order: Top->Bottom & Left->Right, or Left->Right &
             Top->Bottom */
    @instance	RecordOrderOption	FFI_recordOrder =
                            ROO_TOP_TO_BOTTOM;

    /* Currently defined sort.	*/
    @instance	FFDBSortInfo	FFI_sortInfo =
        {
        -1,
        SIAF_ALL_ASCENDING,
        @FFDSO_NO_OPTIONS,
        { -1, -1, -1, -1, -1, -1 }
        };

    /* Currently defined field navigation order.	*/
    @instance	FFDBFieldNavigationOrderInfo	FFI_fieldOrderInfo =
        { -1,	{  0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
               0xff,0xff,0xff,0xff,0xff,0xff,0xff } };

    /*
     * Counter used for force the delivery of GCN notifications in the
     * presence of duplicate status data.
     */
    @instance	word	FFI_nonce = 0;

    /*
     * Subset information.
     *
     *	showOnlyMarked	== TRUE iff only displaying marked records.
     *			   FALSE otherwise.
     *	autoApplyMark	== TRUE iff currently defined record
     *			   marking expression should be applied
     *			   upon creation of any new record.
     *			   FALSE otherwise.
     *	clearMarksFirst	== TRUE iff any and all existing marks
     *			   should (logically) be cleared prior to
     *			   apply the current record marking.
     */
    @instance	Boolean	FFI_showOnlyMarked	= FALSE;
    @instance	Boolean FFI_autoApplyMark	= FALSE;
    @instance	Boolean FFI_clearMarksFirst	= TRUE;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Variable Data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

    /*
     * FFI_VAR_SUBSET_TOKEN_STREAM --
     *
     *	This is used to hold the token stream of the currently
     *	defined marked record (subset) expression.
     *	Note that the stream is variably sized.  It's just defined
     *	as a byte so that the type information will be given to the
     *	debugger.
     */
    @vardata	byte		FFI_VAR_SUBSET_TOKEN_STREAM;

    /*
     * FFI_VAR_SORT_INFO_SHADOW_DATA --
     *
     *	This is used to hold a copy of the current sort context
     *	while the user is defining a new sort (this facillitates
     *	a true Cancel operation).
     */
    @vardata	FFDBSortInfo	FFI_VAR_SORT_INFO_SHADOW_DATA;

    /*
     * FFI_VAR_FNO_INFO_SHADOW_DATA --
     *
     *	This is used to hold a copy of the current field navigation
     *	order context while the user is defining a new ordering
     *	(this facillitates a true Cancel operation).
     */
    @vardata	FFDBFieldNavigationOrderInfo
                    FFI_VAR_FNO_INFO_SHADOW_DATA;

@endc


Objects\FlatFile\ffDPaste.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PCGEOS
 * MODULE:	  ffDPaste.h
 * FILE:	  ffDPaste.h
 *
 * AUTHOR:  	  Jeremy Dashe: Aug 14, 1992
 *
 * REVISION HISTORY:
 *	Date	  Name	    Description
 *	----	  ----	    -----------
 *	8/14/92	  jeremy    Initial version
 *
 * DESCRIPTION:
 *	This file contains structure definitions used when cutting and
 *	pasting database fields.
 *
 * 	$Id: ffDPaste.h,v 1.2.26.1 96/04/28 08:32:16 chris Exp $
 *
 ***********************************************************************/
#ifndef _FFDPASTE_H_
#define _FFDPASTE_H_

#include  <geos.h>

#define MAX_NUMBER_OF_PASTED_LABELS  256

typedef struct {
    VMBlockHandle VMBlock;
    ChunkHandle chunk;
    optr labelOptr;
} LabelIDSet} ;

typedef struct {
    optr    databaseOptr;
    byte    numLabels;
    LabelIDSet labelSet[MAX_NUMBER_OF_PASTED_LABELS];
} LabelIDArray} ;

#endif /* _FFDPASTE_H_ */


Objects\FlatFile\ffExBld.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PCGEOS
 * MODULE:	  Flat file expression builder
 * FILE:	  ffExBld.h
 *
 * AUTHOR:  	  Jeremy Dashe: Feb  7, 1992
 *
 * REVISION HISTORY:
 *	Date	  Name	    Description
 *	----	  ----	    -----------
 *	2/ 7/92	  jeremy    Initial version
 *
 * DESCRIPTION:
 *	This file contains structures and definitions for the flat file
 *	expression builder UI controller.
 *
 *
 * 	$Id: ffExBld.h,v 1.9.17.1 96/04/28 08:32:06 chris Exp $
 *
 ***********************************************************************/
#ifndef _FFEXBLD_H_
#define _FFEXBLD_H_

/*
 * This defines the context for the available spreadsheet functions.
 * This array indicates whether or not a function is to be listed
 * in the "Functions" list of the flat file expression builders.
 *
 *   The elements of the context array correspond to the function IDs
 * in the parse library.  Each element is a bit mask: if a particular
 * expression builder's bit is set for a function, that function is
 * added to the function list.
 *
 */

#ifndef FFEBFunctionContext
typedef	word FFEBFunctionContext ;
#endif

#define	isalphanum	(x)	(isalpha(x) || isdigit(x))

/* Function contexts */
#define	FFEBFC_DEFAULTS			(0x20)	/* 00000000 00100000 */
#define	FFEBFC_SUBSETS		    	(0x10)	/* 00000000 00010000 */
#define	FFEBFC_TOTALS		    	(0x08)	/* 00000000 00001000 */
#define	FFEBFC_SUBTOTALS		(0x04)	/* 00000000 00000100 */
#define	FFEBFC_SEARCHES			(0x02)	/* 00000000 00000010 */
#define	FFEBFC_COMPUTED_FIELDS		(0x01)	/* 00000000 00000001 */

#define	FFEBFC_ALL	  	    	(0x3f)	/* 00000000 00111111 */
#define	FFEBFC_NONE	  	    	(0)	/* 00000000 00000000 */

                                        /* 00000000 00110001 */
#define	FFEBFC_TSD_AND_C		(FFEBFC_SUBSETS	    	| \
                 FFEBFC_DEFAULTS	| \
                 FFEBFC_COMPUTED_FIELDS)

/*
 * Here are the operator strings and IDs for the scropping operator lists.
 */

/* Math operators */
#define MODULO_STRING 	    	"%"
#define EXPONENT_STRING 	    	"^"
#define MULTIPLY_STRING 	    	"*"
#define DIVISION_STRING 	    	"\326"
#define PLUS_STRING  	    	"+"
#define MINUS_STRING 	    	"-"
#define LEFT_PARENS_STRING     	"\050"
#define RIGHT_PARENS_STRING  	")"

/* Logical operators */
#define AMPERSAND_STRING      	"&"
#define EQUALS_STRING  	    	"="
#define	NOTEQUAL_STRING		    	"\255"
#define LESSTHAN_STRING      	"<"
#define GREATERTHAN_STRING   	">"
#define	LESSEQUAL_STRING	    	"\262"
#define	GREATEREQUAL_STRING	 	"\263"

/* Define the longest string length for any operator. */
#define MAX_OPERATOR_LENGTH  	4

typedef ByteEnum OperatorIDs ;
#define     FFEB_MODULO_ID       0
#define     FFEB_EXPONENT_ID      1
#define     FFEB_MULTIPLY_ID      2
#define     FFEB_DIVISION_ID      3
#define     FFEB_PLUS_ID      4
#define     FFEB_MINUS_ID      5
#define     FFEB_LEFT_PARENS_ID      6
#define     FFEB_RIGHT_PARENS_ID      7
#define     FFEB_AMPERSAND_ID      8
#define     FFEB_EQUALS_ID      9
#define     FFEB_NOTEQUAL_ID      10
#define     FFEB_LESSTHAN_ID      11
#define     FFEB_GREATERTHAN_ID      12
#define     FFEB_LESSEQUAL_ID      13
#define     FFEB_GREATEREQUAL_ID      14

#endif /* _FFEXBLD_H_ */


Objects\FlatFile\ffExBldC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PCGEOS
 * FILE:	  CInclude/Objects/FlatFile/ffExprBuilderC.goh
 *
 * AUTHOR:  	  Jeremy Dashe: Jan 24, 1992
 *
 * REVISION HISTORY:
 *	Date	 Name	Description
 *	----	 ----	-----------
 *	1/24/92	 jeremy	Initial version
 *
 * DESCRIPTION:
 *	This file defines the flat file database expression builder class
 *
 * 	$Id: ffExBldC.goh,v 1.16.10.1 96/04/28 08:32:28 chris Exp $
 *
 ***********************************************************************/
@optimize

@include  <Objects/gCtrlC.goh>
@include  <ffile.goh>

@class FFExpressionBuilderClass, GenControlClass;

/*
 * Instance data
 */

#ifndef FFEBFunctionContext
typedef	word FFEBFunctionContext ;
#endif

@instance FFEBFunctionContext FFEB_context = FFEBFC_NONE;

/*
 * These are used to keep information about where an expression builder's
 * string is supposed to be returned.
 * This should be vardata.
 */
@instance dword resultDestination;
@instance Message resultMessage;

/*
 * These define the functions to display in an expression builder.
 * Which functions to display is determined by the FFEB_context,
 * and the list is built out during the controller's
 * MSG_GEN_CONTROL_GENERATE_UI.
 */
@instance byte numberOfFunctions = 0;
@instance byte availableFunctions[MAX_NUMBER_OF_FUNCTIONS];

/**************************************************************
 * 	    	    	    VARDATA	    	    	      *
 **************************************************************/

/*
 * The FFEB_RESET_TEXT vardata is used to keep the original text
 * of the expression around in case the user hits the RESET button.
 */

@vardata MemHandle FFEB_RESET_TEXT;

/*********************  External messages *********************/

/*
 * MSG_FFEB_EDIT_EXPRESSION --
 *	This message is sent when someone wants an expression edited.
 *	Given a string to parse, the expression builder will allow
 *	the string to be edited and send a "done" message when the
 *	user hits Apply.
 *
 *	There are quite a few arguments for your general use pleasure:
 *
 *	    textHandle - handle to a string to be edited.  THIS WILL
 *	    	    	BE FREED WITHIN THE EXPRESSION BUILDER!
 *	    highlightStart, highlightEnd - offsets into the string to
 *	    	    	select when the text is first displayed.
 *	    	    	Very handy for highlighting problem areas in the
 *	    	    	string.
 *	    resultDestination - optr to whomever should be notified
 *	    	    	that the user hit the "Apply" trigger.
 *	    resultMessage - Message to be sent to the resultDestination.
 *	    	    	The argument to the resultMessage is as follows:
 *	    	    	       (MemHandle resultTextHandle);
 *	    	    	The resultTextHandle is to be freed by the result-
 *	    	    	Destination.  The expressionBuilderOptr is an optr to
 *	    	    	the expression builder.
 */
@message void	MSG_FFEB_EDIT_EXPRESSION	(MemHandle textHandle,
                     dword highlightStart,
                     dword highlightEnd,
                     optr resultDestination,
                     Message resultMessage);

/*
 * MSG_FFEB_CLOSE_DOWN --
 *	This message is sent to an expression builder when it should shut
 *	itself down.  For example, if the string was successfully
 *	parsed, the expression builder ought to "go away."
 */
@message void MSG_FFEB_CLOSE_DOWN ();

/*********************  Internal messages *********************/

/*
 * MSG_FFEB_APPLY_CHANGE --
 *
 *	This message is sent when the "Apply" button is pressed.
 */
@message void MSG_FFEB_APPLY_CHANGE ();

/*
 * MSG_FFEB_RESET_CHANGE --
 *
 *	This message is sent when the "Reset" button is pressed.
 */
@message void MSG_FFEB_RESET_CHANGE ();

/*
 * MSG_FFEB_CANCEL_CHANGE --
 *
 *	This message is sent when the "Cancel" button is pressed.
 */
@message void MSG_FFEB_CANCEL_CHANGE ();

/*
 * MSG_FFEB_FIELD_LIST_MONIKER_QUERY --
 *	This message is sent by the field list when it wants a field's moniker.
 *
 * Parameters: void (optr list, word item)
 */
@message (GEN_DYNAMIC_LIST_QUERY_MSG) MSG_FFEB_FIELD_LIST_MONIKER_QUERY;

/*
 * MSG_FFEB_FUNCTION_LIST_MONIKER_QUERY --
 *	This message is sent by the function list when it wants a
 *	function's moniker.
 *
 * Parameters: void (optr list, word item)
 */
@message (GEN_DYNAMIC_LIST_QUERY_MSG) MSG_FFEB_FUNCTION_LIST_MONIKER_QUERY;

/*
 * MSG_FFEB_ADD_FUNCTION_STRING--
 *	This message is sent by the field list when a user changes
 *	the list.
 *
 * Parameters: void (word selection, word numSelections, word stateFlags)
 */
@message (GEN_ITEM_GROUP_STATUS_MSG) MSG_FFEB_ADD_FIELD_STRING;

@message (GEN_ITEM_GROUP_STATUS_MSG) MSG_FFEB_ADD_FUNCTION_STRING;

@message (GEN_ITEM_GROUP_STATUS_MSG) MSG_FFEB_ADD_OP_STRING;

/*
 * MSG_RETURN_MSG_TEMPLATE --
 *	This is used to cast the expression builder's return message.
 */
@message void MSG_FFEB_RETURN_MSG_TEMPLATE (MemHandle stringHandle);

@default GCI_output = (TO_APP_TARGET);

/*
 * Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 * ATTR_GEN_CONTROL_PROHIBIT_UI)
 */

/* FFEBFeatures */
#define FFEB_TEXTEDIT_BOX 	0x01

/*
 * Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 * ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */

/* (NONE) */

/*
 * Feature flags for different UI levels
 */

#define FFEB_DEFAULT_FEATURES 		(FFEB_TEXTEDIT_BOX)
#define FFEB_DEFAULT_TOOLBOX_FEATURES  	0

@endc


Objects\FlatFile\ffFldEdg.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PCGEOS
 * FILE:	  CInclude/Objects/FlatFile/ffFldEdg.goh
 *
 * AUTHOR:  	  Jeremy Dashe: October 6th, 1992
 *
 * REVISION HISTORY:
 *	Date	 Name	Description
 *	----	 ----	-----------
 *	10/6/92	 jeremy	Initial version
 *
 * DESCRIPTION:
 *	This file defines the flat file database field edge controller
 *
 * 	$Id: ffFldEdg.goh,v 1.2.20.1 96/04/28 08:32:07 chris Exp $
 *
 ***********************************************************************/
@optimize

@include  <Objects/gCtrlC.goh>
@include  <Objects/gBoolGC.goh>
@include  <ffile.goh>

@class FFEdgeControllerClass, GenControlClass;

/*
 * MSG_FFEB_ADD_FUNCTION_STRING--
 *	This message is sent by the field list when a user changes
 *	the list.
 *
 * Parameters: void (word selectedBooleans,
 *	    	     word indeterminateBooleans,
 *	    	     word changedBooleans);
 */
@message (GEN_BOOLEAN_GROUP_STATUS_MSG) MSG_FFE_EDGE_CHANGE;

/* FFEFeatures */
#define FFE_EDGE_LIST 	0x01

/*
 * Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 * ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */

/* (NONE) */

/*
 * Feature flags for different UI levels
 */

#define FFE_DEFAULT_FEATURES 		(FFE_EDGE_LIST)
#define FFE_DEFAULT_TOOLBOX_FEATURES  	0

@default GCI_output = (TO_APP_TARGET);

@endc


Objects\FlatFile\ffFldPr.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PC/GEOS
 * MODULE:	  ffFldPr.goh
 * FILE:	  ffFldPr.goh
 *
 * AUTHOR:  	  Jeremy Dashe: Mar  3, 1992
 *
 * REVISION HISTORY:
 *	Date	  Name	    Description
 *	----	  ----	    -----------
 *	3/ 3/92	  jeremy    Initial version
 *
 * DESCRIPTION:
 *	This file contains definitions -- not structures -- for the
 *	field properties UI controller.
 *
 * 	$Id: ffFldPr.goh,v 1.5.6.1 96/04/28 08:32:11 chris Exp $
 *
 ***********************************************************************/

@optimize

@include  <ffile.goh>

/* Field properties contexts */
typedef ByteEnum FFFPContext ;
#define     FFFPC_FIELD_PROPERTIES      0
#define     FFFPC_CREATE_NEW_FIELD      1
#define     FFFPC_NONE      2

/* Field properties user levels */
typedef ByteEnum FFFPUserLevel ;
#define     FFFPUL_ADVANCED      0
#define     FFFPUL_NOVICE      1
#define     FFFPUL_NONE      2

#define MAX_TEXT_STRING_LENGTH  255
#define MIN_MAX_NUM_CHARS_DISPLAYED  12
#define FIELDNAME_NUM_CHARS_DISPLAYED  40
#define MIN_MAX_NUM_CHARS_ALLOWED  25

/*
 * Constants set when the following values are entered by the user
 */
#define	FFFP_DEFAULT_EXISTS		0x01
#define	FFFP_MIN_EXISTS			0x02
#define	FFFP_MAX_EXISTS			0x04

/*
 * This constant is used to let FFFP_STORE_FIELD_INFO know that
 * we're creating a new field.
 * This MUST be a negative number (i.e. an invalid column number)!
 */
#define CREATING_NEW_FIELD  	-1

/*
 * This enum type is used as a parameter to the message handler for
 * the "OK" and "OK and Create Another" buttons on the Notes Novice
 * dialog box. It indicates which of the two buttons was pressed,
 * so that the appropriate action is taken.
 */

typedef ByteEnum FFFPNotesButtons ;
#define     FFFPNB_OK      0
#define     FFFPNB_OK_AND_CREATE_ANOTHER      1

/*
 * This is the structure sent to and from Advanced/Novice
 * field properties box.
 */
typedef struct {
    FFFieldPropertiesMessageBlock	FFFPIS_messageBlock;
    byte	FFFPIS_notesButton;
    TCHAR	FFFPIS_minString[MIN_MAX_NUM_CHARS_ALLOWED];
    TCHAR	FFFPIS_maxString[MIN_MAX_NUM_CHARS_ALLOWED];
} FFFieldPropertiesInputStruct} ;

/*
 * This enum type is used as a parameter to the message handler for
 * the "Advanced" buttons on the all of the  Novice
 * dialog boxes. It indicates which dialog box we're in, so
 * that the appropriate action is taken.
 */

typedef ByteEnum FFFPAdvancedButtons ;
#define     FFFPAB_FIELD_NAME      0
#define     FFFPAB_DATA_TYPE      1
#define     FFFPAB_MAX_LENGTH      2
#define     FFFPAB_MIN      3
#define     FFFPAB_MAX      4
#define     FFFPAB_DEFAULT      5
#define     FFFPAB_NOTES      6


Objects\FlatFile\ffFldPrC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PC/GEOS
 * FILE:	  CInclude/Objects/FlatFile/ffFldPrC.goh
 *
 * AUTHOR:  	  Anna Lijphart: Feb, 1992
 *
 * REVISION HISTORY:
 *	Date	 Name	Description
 *	----	 ----	-----------
 *	2/92	 anna	Initial version
 *
 * DESCRIPTION:
 *	This file defines the flat file database field properties class
 *
 * 	$Id: ffFldPrC.goh,v 1.41.6.1 96/04/28 08:32:13 chris Exp $
 *
 ***********************************************************************/

@optimize

#include  <geos.h>

@include  <Objects/gCtrlC.goh>
@include  <Objects/gTextC.goh>
@include  <Objects/FlatFile/ffDbase.goh>
@include  <Objects/FlatFile/ffFldPr.goh>

@class FFFieldPropertiesClass, GenControlClass;

/*
 * Instance data
 */
@instance FFFPContext FFFP_context = FFFPC_NONE;

@instance FFD_attributes FFFP_attrEnabled = 0;
@instance byte FFFP_markBusyCount = 0;

/*
 * This structure is used to store the inputs from the novice user
 * dialog boxes. For value inputs (like min/max), it stores the actual
 * text string input as well as the FloatNum it represents. This is to
 * facilitate faster transfer to the Advanced dialog box, and to
 * prevent duplicate (and time-consuming) checking.  If the "Advanced"
 * dialog box is brought up, the values in this structure are
 * displayed in it.
 */
@instance FFFieldPropertiesInputStruct FFFP_fpis = {
    {
        0,			/* colNum                             */
    _TEXT(""),		/* fieldName   	    	    	      */
    FDT_GENERAL_TEXT,	/* dataType                           */
                            /* computedDefaultTokenStream	      */
        {PARSER_TOKEN_END_OF_EXPRESSION,
       0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    0,  	    	    	/* numTokensInTokenStream   	      */
    0,			/* maxNumCharsAllowedInThisTextField  */
    0,  	    		/* minValue                           */
    0,	    	    	/* maxValue                           */
    _TEXT("")		/* notes    	    	    	      */
    },
    0,_TEXT(""), _TEXT("")
};

/*
 * This is the current column being edited. We need to store it
 * in case the user decides to "Reset" old values.
 */
@instance byte FFFP_colNum = 0;

/*
 * FFFP_createNewOptr is used by the Field Properties UI controller when the
 * user hits the "Create Another" trigger.  A MSG_FFFP_INITIATE_DIALOG_BOX
 * is sent to the createNewOptr.
 *
 * Application writers must load these instance data with the optrs to the
 * Create New Field field properties box, etc. (see GeoFile's
 * Main/mainProcess.goc)
 */

@instance optr FFFP_computedFieldExpressionBuilderOptr;
@instance optr FFFP_defaultValueExpressionBuilderOptr;

/*********************  External messages *********************/

/*
 * MSG_FFFP_SET_EXPRESSION_BUILDER_INFO --
 *	This message sets the FFFP_computedFieldExpressionBuilderOptr and
 *	FFFP_defaultValueExpressionBuilderOptr instance data.
 */
@message void MSG_FFFP_SET_EXPRESSION_BUILDER_INFO (optr computedFEB,
                           optr defaultVEB);

/*
 * MSG_FFFP_INITIATE_INTERACTION --
 *
 * This message causes a field properties interaction to come up.
 */
@message void MSG_FFFP_INITIATE_INTERACTION ();

/*
 * MSG_FFFP_INITIATE_NEW_FIELD_INTERACTION --
 *
 * This message causes a field properties interaction to come up,
 * ready to edit a new field.
 */
@message void MSG_FFFP_INITIATE_NEW_FIELD_INTERACTION ();

/*********************  Internal messages *********************/

/*
 * MSG_FFFP_SET_DATA_TYPE_ATTRIBUTE_OPTIONS --
 *
 * This message is sent when a user clicks on a data type list item.
 */
@message (GEN_ITEM_GROUP_STATUS_MSG) MSG_FFFP_SET_DATA_TYPE_ATTRIBUTE_OPTIONS;

/*
 * MSG_FFFP_APPLY --
 *
 * This message is sent when user clicks on the "Apply" button.
 */
@message void MSG_FFFP_APPLY ();

/*
 * MSG_FFFP_RESET --
 *
 * This message is sent when user clicks on the "Reset" button.
 */
@message void MSG_FFFP_RESET ();

/*
 * MSG_FFFP_CLOSE --
 *
 * This message is sent when user clicks on the "Close" button.
 */
@message void MSG_FFFP_CLOSE ();

/*
 * MSG_FFFP_CREATE_FIELD --
 *
 * This message is called by the OK and OK & Create Another triggers
 * in the Advanced box. It creates a new field and stores the inputs.
 */
@message void MSG_FFFP_CREATE_FIELD (word messageToSendBack);

/*
 * MSG_FFFP_STORE_FIELD_INFO--
 *
 * Stores inputs from the dialog box. Used both for creating
 * fields and for updating existing fields.
 * If it's a new field, set colNum = -1.
 */
@message void MSG_FFFP_STORE_FIELD_INFO (word messageToSendBack,
                        byte colNum);

/*
 * MSG_FFFP_CANCEL --
 *
 * This message is sent when user clicks on the Reset button.
 */
@message void MSG_FFFP_CANCEL ();

/*
 * MSG_FFFP_EDIT_DEFAULT_OR_COMPUTED_EXPRESSION --
 *	This message is sent by the SetDefaultOrComputedTrigger in the
 *	Field Properties UI controller.  It impiles that an expression
 *	builder should come up to edit an expression.
 */
@message void MSG_FFFP_EDIT_DEFAULT_OR_COMPUTED_EXPRESSION ();

/*
 * MSG_FFFP_SET_DEFUALT_OR_COMPUTED_EXPRESSION --
 *	This message is called from the outside after the fpUIC
 *	sent out an expression request from MSG_FFFP_EDIT_DEFAULT_OR_
 *	COMPUTED_EXPRESSION.  It (possibly) contains a handle to a new
 *	token stream, and definitely has the number of tokens in the
 *	token stream in numTokens.  If the handle is null, then the
 *	expression is null.
 */
@message void MSG_FFFP_SET_DEFAULT_OR_COMPUTED_EXPRESSION (MemHandle tokenStream,
                              word numTokens);
/*
 * MSG_FFFP_NEW_FIELD --
 *
 * This message clears all fields in the dialog box.
 */
@message void MSG_FFFP_NEW_FIELD ();

/*
 * MSG_FFFP_ENABLE_TRIGGERS --
 * 	This method re-enables the advanced box's Create trigger
 *	and gives the text the tagrget and focus.
 */
@message void MSG_FFFP_ENABLE_TRIGGERS ();

/*
 * MSG_FFFP_DISPLAY_NOTES --
 * 	This method is sent out by the "Set field notes" trigger to
 *	indicate that the set field notes interaction should be
 *	displayed with the current set of field notes.
 */
@message void MSG_FFFP_DISPLAY_NOTES ();

/*
 * MSG_FFFP_ACCEPT_NOTES --
 * 	This method is sent out by the "Set field notes" text object
 *	to indicate that the enclosed text should be used to replace
 *	the current set of field notes.
 */
@message (GEN_TEXT_APPLY_MSG) MSG_FFFP_ACCEPT_NOTES;

/*
 * MSG_FFFP_FIELD_CREATION_DONE --
 *
 * If specified by the caller, this message gets sent by
 * MSG_FFD_CREATE_NEW_FIELD_WITH_RESPONSE
 * when the field properties have been checked for validity.
 * This handler puts up an error message if the field name was
 * invalid.
 * If the field was valid, this method adds the field name to the
 * layout list, and adds two screen display GrObjects (one label
 * and one field)
 *
 * fieldResult: FFFieldCreationResult enum indicating outcome of
 *		attempt to create field.
 * colNum:  the column number of the newly created field
 */
@message void MSG_FFFP_FIELD_CREATION_DONE (
                    FFFieldCreationResult fieldResult,
                    byte colNum);

/*
 * MSG_FFFP_FIELD_MODIFICATION_DONE --
 *
 * If specified by the caller, this message gets sent by
 * MSG_FFD_CHANGE_FIELD_ATTRIBUTES_WITH_RESPONSE
 * when the field properties have been checked for validity.
 * This handler puts up an error message if the field name was
 * invalid.
 * If the field name changed, this method notifies the extra lists
 * (layoutNameList and notInLayoutNameLists) that the name changed.
 * In addition, it notifies the field screen display GrObject.
 *
 * fieldResult: FFFieldCreationResult enum indicating outcome of
 *		attempt to create field.
 * colNum:  the column number of the newly created field
 * nameChanged: TRUE if the field name was changed, FALSE otherwise.
 */
@message void MSG_FFFP_FIELD_MODIFICATION_DONE (
                    FFFieldCreationResult fieldResult,
                    byte colNum,
                    Boolean nameChanged);

/*
 * MSG_FFFP_INC_MARK_BUSY_COUNT
 *
 *	Increment the count of how many times the application has been marked
 *	busy. When the Field Properties box is initiated, it checks
 *	this count, and decrements it if set.
 *	If set, Field Properties controller will mark the app not busy,
 *	and resume input.
 */
@message void MSG_FFFP_INC_MARK_BUSY_COUNT ();

/*
 * HINTS
 */

/*
 * If you want the dialog box to be modal then set this hint
 */
@vardata void HINT_FFFP_MAKE_MODAL;

@default GCI_output = (TO_APP_TARGET);

/*
 * Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 * ATTR_GEN_CONTROL_PROHIBIT_UI)
 */

/* FFFPFeatures */
typedef WordFlags FFFieldPropertiesFeatures ;
#define FFFP_FIELD_NAME_FEATURE 		0x0100	/* field name */
#define FFFP_FIELD_NAME_DESCR_FEATURE 	0x0080	/* field name description */
#define FFFP_DATA_TYPE_FEATURE 		0x0040	/* data type */
#define FFFP_COMPUTED_DATA_TYPE_FEATURE 	0x0020	/* "Computed" data type */
#define FFFP_FIELD_ATTRS_FEATURE  	0x0010	/* Field Attrs: Notes,
                           Computed/Default string */
#define FFFP_DATA_ATTRS_FEATURE 		0x0008	/* Data Attrs: Length,
                           Min, Max */
#define FFFP_CREATE_TRIGGER_FEATURE 	0x0004	/* "Create" trigger */
#define FFFP_CANCEL_TRIGGER_FEATURE 	0x0002	/* "Cancel" trigger */
#define FFFP_APPLY_RESET_CLOSE_TRIGGER_FEATURE 	0x0001	/* Apply/Reset/Close
                               triggers */
/*
 * Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 * ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */

/* (NONE) */

/*
 * Feature flags for different UI levels
 */
#define FFFP_INTERMEDIATE_FEATURES 	(FFFP_FIELD_NAME_FEATURE | \
                     FFFP_FIELD_NAME_DESCR_FEATURE | \
                     FFFP_CREATE_TRIGGER_FEATURE | \
                     FFFP_CANCEL_TRIGGER_FEATURE)

#define FFFP_ADVANCED_FEATURES 		(FFFP_FIELD_NAME_FEATURE | \
                     FFFP_DATA_TYPE_FEATURE | \
                     FFFP_COMPUTED_DATA_TYPE_FEATURE | \
                     FFFP_FIELD_ATTRS_FEATURE | \
                     FFFP_DATA_ATTRS_FEATURE | \
                     FFFP_CREATE_TRIGGER_FEATURE | \
                     FFFP_CANCEL_TRIGGER_FEATURE)

#define FFFP_EDIT_FIELD_INTERMEDIATE_FEATURES  (FFFP_FIELD_NAME_FEATURE | \
                     FFFP_APPLY_RESET_CLOSE_TRIGGER_FEATURE)

#define FFFP_EDIT_FIELD_ADVANCED_FEATURES  (FFFP_FIELD_NAME_FEATURE | \
                     FFFP_DATA_TYPE_FEATURE | \
                     FFFP_COMPUTED_DATA_TYPE_FEATURE | \
                     FFFP_FIELD_ATTRS_FEATURE | \
                     FFFP_DATA_ATTRS_FEATURE | \
                     FFFP_APPLY_RESET_CLOSE_TRIGGER_FEATURE)

#define FFFP_DEFAULT_TOOLBOX_FEATURES  	0

@endc


Objects\FlatFile\ffGrObjC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PCGEOS
 * MODULE:	  ffGrObj.goh
 * FILE:	  ffGrObj.goh
 *
 * AUTHOR:  	  Jeremy Dashe: Oct  6, 1992
 *
 * REVISION HISTORY:
 *	Date	 Name	Description
 *	----	 ----	-----------
 *	10/6/92	 jeremy	Initial version
 *
 * DESCRIPTION:
 *	This file contains the definition for the FFGrObjBodyClass.
 *
 * 	$Id: ffGrObjC.goh,v 1.2.20.1 96/04/28 08:32:20 chris Exp $
 *
 ***********************************************************************/
@optimize

@include  <grobj.goh>
@include  <ffile.goh>

@class  FFGrObjBodyClass, GrObjBodyClass ;

/*
 * MSG_FFGB_SET_FIELD_APPEARENCE_FLAGS --
 * 	This message is called whenever a field becomes selected.
 *    	It sets a flag in instance data to indicate that
 *    	MSG_FFGB_UPDATE_FIELD_APPEARENCE_UI should be called when
 *    	the body becomes unsuspended.
 */
@message void MSG_FFGB_SET_FIELD_APPEARENCES_FLAG ();

/*
 * MSG_FFGB_UPDATE_FIELD_APPEARENCE_UI --
 * 	This message is called whenever a field becodes selected or
 *	unselected.  If we're not suspended, we'll figure out what UI
 *	controller data we need from the selected fields, and send 'em
 *	out.
 *
 *	Currently, we update the following UI controllers:
 *    	    FFEdgeController
 */
@message void MSG_FFGB_UPDATE_FIELD_APPEARENCE_UI ();

/***********************************************************************
                          Instance Data
 ***********************************************************************/

typedef ByteFlags FFGBUpdateUIFlags ;
#define FFGBUF_NOTHING 	    	    	    0
#define FFGBUF_UPDATE_APPEARENCES 	    1

/*
 * The FFGB_updateFieldAppearences flag indicates what UI controllers
 * are to be updated when the body becomes unsuspended.
 */
@instance FFGBUpdateUIFlags FFGBI_updateFieldAppearences = FFGBUF_NOTHING;

@endc


ffile.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PC/GEOS
 * MODULE:	  ffile.goh
 * FILE:	  ffile.goh
 *
 * AUTHOR:  	  Jeremy Dashe: Jan 28, 1992
 *
 * REVISION HISTORY:
 *	Date	  Name	    Description
 *	----	  ----	    -----------
 *	1/28/92	  jeremy    Initial version
 *	92.08.12  JDM	    Name changes.
 *
 * DESCRIPTION:
 *	Structures and definitions for the flat file database library.
 *
 * 	$Id: ffile.goh,v 1.30.6.1 96/04/28 08:28:17 chris Exp $
 *
 ***********************************************************************/
@optimize
@include  <gcnlist.goh>
#include  <math.h>
#include  <parse.h>
@include  <ssheet.goh>

typedef ByteEnum FieldDataType ;
#define	FDT_GENERAL_TEXT	 0	/* alphanumeric string */
#define	FDT_COMPUTED		 1	/* field computed by formula */
#define	FDT_INTEGER		 2	/* number (integers only)*/
#define	FDT_REAL		 3	/* number (non-integers OK) */
#define	FDT_DATE		 4	/* number (representing date) */
#define	FDT_TIME		 5	/* number (representing time) */

/* Non-data holding FieldDataTypes: */
#define FDT_PAGE_NUMBER 	 6  	/* page number (DOES NOT HOLD DATA!  ONLY
                 * USED AS A PLACEMARKER SO THE GROBJ
                              * FIELD KNOWS TO DRAW THE CURRENT NUMBER!
                 */

/* Maximum number of records in the database.	*/
#define	MAX_NUM_RECORDS		(LARGEST_VISIBLE_ROW+1)

/*
 * Maximum number of fields in a record.
 *
 * NOTE: This value is one less than the number of cell columns in the
 *	 spreadsheet because the last cell is used to hold all of the
 *	 per record information.
 *
 */
#define	MAX_NUM_FIELDS				(LARGEST_COLUMN)

/* maximum number of characters allowed in a cell */
#define	MAX_NUM_CHARS_IN_CELL			511

/* maximum number of characters allowed in a text field */
#define	MAX_TEXT_FIELD_LENGTH			511

/* maximum number of bytes in a token stream. */
#define	MAX_TOKEN_STREAM_SIZE			511

/* maximum number of bytes in an individual, non-formula cell */
#define MAX_CELL_DATA_SIZE   (MAX_TOKEN_STREAM_SIZE + \
                 MAX_TEXT_FIELD_LENGTH*sizeof(TCHAR) + \
                 sizeof(CellFormula) + 1)

/* maximum number of characters in an expression string. */
#define	MAX_EXPRESSION_STRING_LENGTH		511

/* maximum number of characters allowed in a function name */
#define	MAX_FUNCTION_STRING_LENGTH		25

/* maximum number of functions to be shown in expression builders. */
#define	MAX_NUMBER_OF_FUNCTIONS			255

/* maximum number of characters in a field's name. */
#define	MAX_FIELD_NAME_LENGTH		    	40

/* maximum number of chars in an automatically generated field name. */
#define MAX_AUTOMATIC_FIELD_NAME_SIZE 	15  /* "Field_65535\0" plus a few. */

/* maximum number of characters in a notes field. */
#define MAX_NOTES_TEXT_LENGTH 	    	255

/*
 * Number of bytes for the expression evaluator's scratch and result
 * buffers.
 */
#define EVAL_BUFFER_SIZE     	    	1024

/* Maximum number of sort keys and sub-total fields.	*/
#define	MAX_SORT_KEYS_AND_SUB_TOTAL_FIELDS		6

/*
 * In converting a FloatNum to ascii, this is the default number of
 * digits
 */
#define	NUM_ASCII_DIGITS		    	10

/*
 * In converting a FloatNum to ascii, this is the default number of
 * fractional digits
 */
#define	NUM_ASCII_FRACTIONAL_DIGITS		5

/*
 * This is the structure sent to and from field properties UI
 * controllers.
 */
typedef struct {
    byte	    colNum;
    TCHAR    	    fieldName[MAX_FIELD_NAME_LENGTH+1];
    FieldDataType   dataType;
    byte    	    computedDefaultTokenStream[MAX_TOKEN_STREAM_SIZE];
    word    	    numTokensInTokenStream;
    word    	    maxNumCharsAllowedInThisTextField;
    FloatNum	    minValue;
    FloatNum	    maxValue;
    TCHAR    	    notes[MAX_NOTES_TEXT_LENGTH];
} FFFieldPropertiesMessageBlock} ;

/*
 * This is the structure written out to and from DAS_FIELD chain
 * of ssmeta file.
 */
typedef	struct {
    byte	    fieldNum;
    TCHAR    	    fieldName[MAX_FIELD_NAME_LENGTH+1];
    FieldDataType   fieldType;
    word	    fieldSize;
    FloatNum	    minValue;
    FloatNum	    maxValue;
} FieldInfoBlock} ;

/*
 * The FFFieldAppearanceStatusChangeMessageBlock structure is passed
 * to and from field appearence UI controllers.
 */
typedef struct {
    word    	 FFESCM_setEdges;
    word    	 FFESCM_indeterminateEdges;
    FormatIdType FFESCM_formatIdType;
} FFFieldAppearanceChangeMessageBlock} ;

typedef byte FieldID ;		/* The column of a spreadsheet, really.	*/
typedef byte FieldListID ;	/* Index into a list of fieldIDs.	*/

/*
 * The FieldCreateRequest is passed to MSG_FFD_STORE_FIELD_INFO to tell
 * which sorted list to add the field into.  Note that these lists are
 * not the database proper, but handy lists sorted alphabetically by field
 * name.
 */
typedef	ByteEnum FieldCreateRequest ;
#define	FCR_ADD_TO_LAYOUT		  0	/* Add field to the current	*/
                    /* layout list.			*/
#define	FCR_ADD_TO_DATABASE		  1	/* Add field to the current	*/
                    /* database list.		*/

typedef	ByteEnum FieldChangeType ;
#define	FCT_CREATED		    	  1	/* The field was just created &	*/
                    /* added to the database list.	*/
#define	FCT_CREATED_AND_ADDED_TO_LAYOUT		2
                    /* The field was just created &	*/
                    /* and immediately added to the	*/
                    /* layout list.			*/
#define	FCT_ADDED_TO_LAYOUT		  3	/* The field was moved from the	*/
                    /* database list to the current	*/
                    /* layout list.			*/
#define FCT_DELETED_FROM_LAYOUT 	  4	/* The field was moved from the	*/
                    /* current layout list back to	*/
                    /* the database list.		*/
#define	FCT_DELETED_FROM_DATABASE	 5 	/* The field was really deleted	*/
                    /* from the database (and was	*/
                    /* removed from both lists).	*/

/*
 * This enum is used to tell UIC internal functions if a field
 * is being added or deleted from a field list.
 */
typedef	ByteEnum FFFieldListChangeStatus ;
#define	ADDED		0
#define	DELETED		1
#define	RESET		2
#define	CHANGED		3
#define SHOW_NOTES  4

/*
 * This enum is used to determine the results from validating a
 * field.  They should be pretty self-explanitary...
 */
typedef ByteEnum FFFieldValidationType ;
#define FFFV_FIELD_OK     	    	0
#define FFFV_FIELD_SMALLER_THAN_MIN 	1
#define FFFV_FIELD_LARGER_THAN_MAX 	2
#define FFFV_FIELD_NOT_LEGAL 	    	3
#define FFFV_NOT_IN_DESIGN_MODE 	    	4
#define FFFV_FIELD_NOT_DIRTY 	    	5
#define FFFV_SYSTEM_ERROR    	    	6

#define	NO_ITEM_HIGHLIGHT	   	    	(0xff)

/*
 * Here's the different list requests from the treasure chest: are we
 * asking about the whole database, the layout list or the whole database
 * minus the fields in the layout list?
 */
typedef	ByteEnum FieldListQuery ;
#define	DATABASE_NAME_LIST		 0  /* Every defined field in database.	*/
#define LAYOUT_NAME_LIST 	 1  /* All fields in current layout.	*/
#define	NOT_IN_LAYOUT_NAME_LIST		 2  /* All fields not in current layout.*/
#define ABSOLUTE_COLUMN_NUMBER 	 3  /* The number is a column number already. */
#define	INVALID_FIELD_LIST_QUERY	 4  /*
                     * Marks non-list status change
                     * messages.
                     */
/*
 * This is the structure sent to anyone who needs to know that a field
 * has been added, deleted, or layout-ized from the current database or if
 * the current database has been changed.
 *	whichList	- Updated list.
 * 	changeType	- ADDED or DELETED, etc.
 *	fieldIndex	- This is an index into the updated list.
 *	numFields	- Number of fields in this list.
 *	nonce		- Silly counter to make sure that each notificaton
 *			  is actually sent.
 *	disableImmediately - TRUE if want the treasure chest disabled
 *				immediately after updating it
 */
typedef struct {
    FieldListQuery		whichList;
    FFFieldListChangeStatus	changeType;
    FieldListID			fieldIndex;
    word			numFields;
    optr			databaseOptr;
    word			nonce;
    Boolean			disableImmediately;
} FFDListStatusChangeMessageBlock} ;

#define	COLUMNS_TAKEN_ARRAY_SIZE		((MAX_NUM_FIELDS + 1) / 8)

/* FieldDataTypesFlags record */
typedef	ByteFlags FieldDataTypesFlags ;

#define	FDTF_MANDATORY			(0x80)	/* TRUE: field must be filled
                       in before insert allowed.	*/
#define	FDTF_HAS_MIN			(0x40)	/* TRUE: VFDA_min attr contains
                       value for quicker lookups.	*/
#define	FDTF_HAS_MAX			(0x20)	/* TRUE: VFDA_max attr contains
                       value for quicker lookups.	*/
#define	FDTF_HAS_DEFAULT		(0x10)	/* TRUE: default attr contains
                       expression for quick lookup.	*/
#define	FDTF_HAS_NOTES			(0x08)	/* TRUE: field has associated
                       notes for quicker lookups.	*/
/*
 * Field redraw flags
 */
typedef ByteEnum RedrawFlag ;
#define NO_REDRAW    0
#define REDRAW 	    1

/*
 * Field creation errors
 */
typedef	ByteEnum FFFieldCreationResult ;
#define	FFD_NAME_OK				0
#define	FFD_DUPLICATE_FIELD_NAME		1
#define	FFD_TOO_MANY_FIELDS			2
#define FFD_CIRCULAR_EXPRESSION 	    	3
#define FFD_ABORT_TYPE_CHANGE 	    	4

/*
 * Delete Layout results
 */
typedef	ByteEnum FFDeleteLayoutResult ;
#define	FFD_ATTEMPTED_TO_DELETE_LAST_LAYOUT		0
#define	FFD_DELETE_LAYOUT_OK				1
#define	FFD_NO_DELETE_LAYOUT_DONE			2 /* no error; just not done */
/*
 * Externally defined functions
 */
extern VMBlockHandle
    _pascal FlatFileInitFile (VMFileHandle vmFileHandle,
                 word spreadsheetFlags);

#if defined(__HIGHC__)
pragma Alias(FlatFileInitFile, "FLATFILEINITFILE");
#endif

/*
 * The EvalErrorItem struct is used to match spreadsheet or parser eval
 * errors with specific error message chunks.
 */
typedef struct {
    word    error;
    optr    errorChunk;
} EvalErrorItem} ;

/*
 * A ceiling function.  No big whoop.
 */
#define FFD_div_ceil (a, b) (((a) / (b)) + (((a) % (b)) ? 1 : 0))

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    Record Control Panel UI Controller Stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    Record Control Panel General Change Notification Stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/* Psuedo-index indicating that 'new'/empty record.	*/
#define	FFRCP_INVALID_RECORD		(~0)
#define	FFRCP_NEW_RECORD		(FFRCP_INVALID_RECORD)

/*
 * FFRecordControlStatusFlags --
 *
 *	This structure has flags for each of the possible conditions that
 *	the database is in at any given time.
 */
typedef struct
{
    unsigned int	disableRCP:1;	/* Disable the controller?	*/
    unsigned int	new:1;		/* New (never entered) record?	*/
    unsigned int	modified:1;	/* Dirty/changed record?	*/
    unsigned int	failedOp:1;	/* Last operation failed?	*/
    unsigned int	marked:1;	/* Is this record marked?	*/
    unsigned int	showOnlyMarked:1;    /* Display marked only?	*/
    unsigned int	autoMarkingChange:1; /* Changing auto marking?	*/
    unsigned int	autoMarking:1;	     /* Auto marking fields?	*/
} FFRecordControlStatusFlags} ;

/*
 * FFRecordControlStatusMessageBlock --
 *
 * 	This structure is filled out by the FlatFile database and is sent
 *	out to notify the Record Control Panel (through the GCN lists) that
 *	the database's status has changed and how it has changed.
 */
typedef	struct
{
    word	curRecord;	/* Current database record.	*/
    word	numRecords;	/* Total number of records in database.	*/
    FFRecordControlStatusFlags	statusFlags;	/* Current status.	*/
} FFRecordControlStatusMessageBlock} ;

/*
 * The following macros fill in the given FFRecordControlStatusMessageBlock
 * in the canonical manner to indicate the state of the database to the
 * Record Control Panel UI Controller.
 *
 * FFRCPSMB_SET_DATA --
 *
 *	This is a convenience macro which sets the given status message
 *	block to specify that the Record Control Panel should update
 *	itself with the given data.
 *
 * FFRCPSMB_CLEAR --
 *
 *	Set the given status message block to the neutral, un-informative,
 *	pristine state.
 *
 * FFRCPSMB_DISABLE_RCP --
 *
 *	Set the given status message block to indicate that the Record
 *	Control Panel should be disabled.
 *
 * FFRCPSMB_NEW_RECORD --
 *
 *	This macro sets the given status message block to specify that the
 *	Record Control Panel should indicate that the user is editing a
 *	'new' (empty) record.
 *
 * FFRCPSMB_IS_CLEAR --
 *
 *	Is the given status message block cleared?
 *
 * FFRCPSMB_IS_DISABLE_RCP --
 *
 *	Does the given status message block specify the disabliing of the
 *	Record Control Panel?
 *
 * FFRCPSMB_IS_NEW_RECORD --
 *
 *	Does the given status message block specify that the current being
 *	edited record in the database has never been saved/committed to the
 *	database proper.
 *
 * FFRCPSMB_IS_MODIFIED --
 *
 *	Does the given status message block specify that the current record
 *	in the database has been modified?
 *
 * FFRCPSMB_IS_FAILED_OP --
 *
 *	Does the given status message block specify that last operation
 *	attempted on the database failed miserably.
 *
 * FFRCPSMB_IS_MARKED --
 *
 *	Does the given status message block specify that the current record
 *	in the database has been marked as being in the currently defined
 *	subset?
 *
 * FFRCPSMB_IS_DISPLAY_ONLY_MARKED --
 *
 *	Are only records marked as being in the currently defined subset
 *	being displayed?
 *
 * FFRCPSMB_IS_CHANGING_AUTO_MARKING --
 *
 *	Is the marking trigger to be enabled or disabled?
 *
 * FFRCPSMB_IS_AUTO_MARKED --
 *
 *	Are records being marked automatically (that is, not by hand)?
 *
 * Note:	Obviously, these are all doable by the programmer in-line
 *	but this makes things really (painfully?) obvious in the code.  The
 *	set data macro is is mostly provided for consistency (but use it
 *	anyways :-).
 *
 * NOTE:	These are macros so treat the arguments that you feed them
 *	with, with respect.  Do things in a nice straight forward manner
 *	and they'll treat you well, otherwise...
 *	Each macro accesses the struct pointer multiple times and the other
 *	arguments exactly once.
 *
 */
#define	FFRCPSMB_SET_DATA	(ffrcpsmb, curRec, numRecs,	\
              newRec, dirtyRec, opError,	\
              disRCP, markedRec, showMarked,\
              aMarkChange, autoMark)	\
        (((ffrcpsmb).curRecord = (curRec)),			\
         ((ffrcpsmb).numRecords = (numRecs)),			\
         ((ffrcpsmb).statusFlags.new = (newRec)),		\
         ((ffrcpsmb).statusFlags.modified = (dirtyRec)),	\
         ((ffrcpsmb).statusFlags.failedOp = (opError)),		\
         ((ffrcpsmb).statusFlags.disableRCP = (disRCP)),	\
         ((ffrcpsmb).statusFlags.marked = (markedRec)),		\
         ((ffrcpsmb).statusFlags.showOnlyMarked = (showMarked)),\
         ((ffrcpsmb).statusFlags.autoMarkingChange = (aMarkChange)),\
         ((ffrcpsmb).statusFlags.autoMarking = (autoMark)))

#define	FFRCPSMB_CLEAR	(ffrcpsmb)	\
        (FFRCPSMB_SET_DATA (ffrcpsmb,			\
                    FFRCP_INVALID_RECORD,	\
                    FFRCP_INVALID_RECORD,	\
                    FALSE, FALSE, FALSE,	\
                    FALSE, FALSE, FALSE,    	\
                    FALSE, FALSE))

#define	FFRCPSMB_DISABLE_RCP	(ffrcpsmb)	    	    	    	    	\
        ((FFRCPSMB_CLEAR (ffrcpsmb)),	    	    	    	\
         ((ffrcpsmb).statusFlags.disableRCP = TRUE))

#define FFRCPSMB_INDICATE_AUTO_MARKING_CHANGE (ffrcpsmb, aMarking)	\
        ((FFRCPSMB_CLEAR (ffrcpsmb)),	    	    	    	\
         ((ffrcpsmb).statusFlags.autoMarkingChange = TRUE), 	\
         ((ffrcpsmb).statusFlags.autoMarking = aMarking))

#define	FFRCPSMB_NEW_RECORD	(ffrcpsmb, numRecs,	\
                dirtyRec, opError,	\
                marked, showMarked)		\
        (FFRCPSMB_SET_DATA ((ffrcpsmb), FFRCP_NEW_RECORD,	\
                    (numRecs), TRUE, (dirtyRec),	\
                    (opError), FALSE, marked,		\
                    (showMarked), FALSE, FALSE))

#define	FFRCPSMB_IS_CLEAR	(ffrcpsmb)	\
        ((FFRCP_INVALID_RECORD == (ffrcpsmb).curRecord) &&	\
         (FFRCP_INVALID_RECORD == (ffrcpsmb).numRecords) &&	\
         (!(ffrcpsmb).statusFlags.new) &&			\
         (!(ffrcpsmb).statusFlags.modified) &&			\
         (!(ffrcpsmb).statusFlags.failedOp) &&			\
         (!(ffrcpsmb).statusFlags.disableRCP) &&		\
         (!(ffrcpsmb).statusFlags.marked) &&			\
         (!(ffrcpsmb).statusFlags.showOnlyMarked))

#define	FFRCPSMB_IS_DISABLE_RCP	(ffrcpsmb)	\
        ((ffrcpsmb).statusFlags.disableRCP)

#define	FFRCPSMB_IS_NEW_RECORD	(ffrcpsmb)	\
        (((ffrcpsmb).statusFlags.new) &&			\
         (FFRCP_NEW_RECORD == (ffrcpsmb).curRecord) &&		\
         (FFRCP_INVALID_RECORD != (ffrcpsmb).numRecords) &&	\
         (!(ffrcpsmb).statusFlags.marked))

#define	FFRCPSMB_IS_NEW_RECORD_IGNORE_MARKING	(ffrcpsmb)	\
        (((ffrcpsmb).statusFlags.new) &&			\
         (FFRCP_NEW_RECORD == (ffrcpsmb).curRecord) &&		\
         (FFRCP_INVALID_RECORD != (ffrcpsmb).numRecords))

#define	FFRCPSMB_IS_MODIFIED	(ffrcpsmb)	\
        ((ffrcpsmb).statusFlags.modified)

#define	FFRCPSMB_IS_FAILED_OP	(ffrcpsmb)	\
        ((ffrcpsmb).statusFlags.failedOp)

#define	FFRCPSMB_IS_MARKED	(ffrcpsmb)	\
        ((ffrcpsmb).statusFlags.marked)

#define	FFRCPSMB_IS_DISPLAY_ONLY_MARKED	(ffrcpsmb)	\
        ((ffrcpsmb).statusFlags.showOnlyMarked)

#define	FFRCPSMB_IS_CHANGING_AUTO_MARKING	(ffrcpsmb)	\
        ((ffrcpsmb).statusFlags.autoMarkingChange)

#define	FFRCPSMB_IS_AUTO_MARKED	(ffrcpsmb)	\
        ((ffrcpsmb).statusFlags.autoMarking)

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Record Control Requests
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

typedef	enum
{
    FFRCR_NULL_REQUEST    ,			/* Why ask for nothing?		*/
    FFRCR_REFRESH    ,			/*
                     * Refresh the RCP state based on
                     * the current database state.
                     */
    FFRCR_CREATE_NEW_RECORD    ,		/* Create a new record.		*/
    FFRCR_COMMIT_CURRENT_RECORD    ,	/* Insert the current record.	*/
    FFRCR_REVERT_CURRENT_RECORD    ,	/* Be as in the beginning.	*/
    FFRCR_DELETE_CURRENT_RECORD    ,	/* Delete the current record.	*/

/*  The following two are not yet supported -- JDM.	*/
#if 0
    FFRCR_DELETE_RECORD,		/* Delete a specified record.	*/
    FFRCR_DELETE_ALL_RECORDS,		/* Delete every record.		*/
#endif

    FFRCR_GOTO_FIRST_RECORD    ,		/* Move to first record.	*/
    FFRCR_GOTO_PREVIOUS_RECORD    ,		/* Move to preceding record.	*/
    FFRCR_GOTO_NEXT_RECORD    ,		/* Move to following record.	*/
    FFRCR_GOTO_LAST_RECORD    ,		/* Move to last record.		*/
    FFRCR_GOTO_RECORD    ,			/* Move to specified record.	*/
    FFRCR_DIRTY_CURRENT_RECORD    ,		/* Record has been modified.	*/
    FFRCR_CLEAN_CURRENT_RECORD    ,		/* Record is pristine.		*/
    FFRCR_MARK_CURRENT_RECORD    ,	    	/* Set the record marked.   	*/
    FFRCR_UNMARK_CURRENT_RECORD    ,	/* Set the record unmarked.   	*/

    FFRCR_INVALID_REQUEST    		/* Naughty caller!		*/
} FFRecordControlRequest} ;


Objects\FlatFile\ffKbd.h

/***********************************************************************
 *
 *      Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:       PCGEOS
 * MODULE:        ffKbd.h
 * FILE:          ffKbd.h
 *
 * AUTHOR:        Jeremy Dashe: Feb 20, 1993
 *
 * REVISION HISTORY:
 *      Date      Name      Description
 *      ----      ----      -----------
 *      2/20/93   jeremy            Initial version
 *
 * DESCRIPTION:
 *      This file contains definitions for keyboard shortcuts used in the
 *      flat file library.
 *
 *
 *      $Id: ffKbd.h,v 1.5.4.1 96/04/28 08:32:23 chris Exp $
 *
 ***********************************************************************/
#ifndef _FFKBD_H_
#define _FFKBD_H_

#include  <input.h>
#ifdef DO_DBCS
#define LITTLE_N  C_LATIN_SMALL_LETTER_N
#define LITTLE_I  C_LATIN_SMALL_LETTER_I
#define CHAR_ENTER  C_SYS_ENTER
#define CHAR_TAB  C_SYS_TAB
#else
#define LITTLE_N  C_SMALL_N
#define LITTLE_I  C_SMALL_I
#define CHAR_ENTER  C_ENTER
#define CHAR_TAB  C_TAB
#endif

/*
 * Here's the Shortcut Tables as used by the fields.  Indices follow.
 */
#define ST_SHIFT_CTRL_ENTER  {CHAR_ENTER & KS_CHAR_MASK \
                   | KS_SHIFT | KS_CTRL | KS_CHAR_SET_CONTROL}
#define ST_SHIFT_CTRL_TAB    {CHAR_TAB & KS_CHAR_MASK \
                   | KS_SHIFT | KS_CTRL | KS_CHAR_SET_CONTROL}
#define ST_ENTER             {CHAR_ENTER & KS_CHAR_MASK \
                   | KS_CHAR_SET_CONTROL}
#define ST_TAB               {CHAR_TAB & KS_CHAR_MASK \
                   | KS_CHAR_SET_CONTROL}
#define ST_SHIFT_ENTER       {CHAR_ENTER & KS_CHAR_MASK \
                   | KS_SHIFT | KS_CHAR_SET_CONTROL}
#define ST_SHIFT_TAB         {CHAR_TAB & KS_CHAR_MASK \
                   | KS_SHIFT | KS_CHAR_SET_CONTROL}
#define ST_CTRL_TAB          {CHAR_TAB & KS_CHAR_MASK \
                   | KS_CTRL | KS_CHAR_SET_CONTROL}
#define ST_CTRL_ENTER        {CHAR_ENTER & KS_CHAR_MASK \
                   | KS_CTRL | KS_CHAR_SET_CONTROL}
#define ST_CTRL_N            {LITTLE_N & KS_CHAR_MASK \
                   | KS_CTRL | KS_PHYSICAL | KS_CHAR_SET_PRINTABLE}
#define ST_CTRL_COMMA        {C_COMMA & KS_CHAR_MASK \
                   | KS_CTRL | KS_PHYSICAL | KS_CHAR_SET_PRINTABLE}
#define ST_CTRL_PERIOD       {C_PERIOD & KS_CHAR_MASK \
                   | KS_CTRL | KS_PHYSICAL | KS_CHAR_SET_PRINTABLE}
#define ST_SHIFT_CTRL_COMMA  {C_COMMA & KS_CHAR_MASK \
                   | KS_CTRL | KS_PHYSICAL | KS_SHIFT | \
                 KS_CHAR_SET_PRINTABLE}
#define ST_SHIFT_CTRL_PERIOD  {C_PERIOD & KS_CHAR_MASK \
                | KS_CTRL | KS_PHYSICAL | KS_SHIFT | \
                 KS_CHAR_SET_PRINTABLE}
#define ST_CTRL_SEMICOLON    {C_SEMICOLON & KS_CHAR_MASK \
                   | KS_CTRL | KS_PHYSICAL | KS_CHAR_SET_PRINTABLE}
#define ST_CTRL_I            {LITTLE_I & KS_CHAR_MASK \
                   | KS_CTRL | KS_PHYSICAL | KS_CHAR_SET_PRINTABLE}

/*
 * Here's the definition of the keyboard shortcut table used within
 * the flat file library.
 */
#define  FF_SHORTCUT_TABLE                                        \
     ST_SHIFT_CTRL_ENTER,      /* INSERT_ENTER_CHAR */      \
     ST_SHIFT_CTRL_TAB,        /* INSERT_TAB_CHAR */        \
     ST_ENTER,                 /* Next field */             \
     ST_TAB,                   /* Next field */             \
     ST_SHIFT_ENTER,           /* Previous field */         \
     ST_SHIFT_TAB,             /* Previous field */         \
     ST_CTRL_TAB,              /* Previous field */         \
     ST_CTRL_ENTER,            /* New record */             \
     ST_CTRL_N,                /* New record */             \
     ST_CTRL_COMMA,            /* Previous record */        \
     ST_CTRL_PERIOD,           /* Next record */            \
     ST_SHIFT_CTRL_COMMA,      /* First record */           \
     ST_SHIFT_CTRL_PERIOD,     /* Last record */            \
     ST_CTRL_SEMICOLON,        /* Mark current record */    \
     ST_CTRL_I                 /* Commit current record */

/*
 * The shortcut code table, which matches one-for-one with the above
 * shortcut character definition table.  Match 'em or weep.
 *
 * Note that since each element of the above table is a word, and the returned
 * value from FlowCheckKbdShortcut() is an offset into the above table,
 * each code below is incremented by 2 ( == sizeof(word)).
 */
typedef enum /* word */ {
    SC_INSERT_ENTER_CHAR     = 0,
    SC_INSERT_TAB_CHAR       = 2,
    SC_NEXT_FIELD            = 4,
    SC_NEXT_FIELD_2          = 6,
    SC_PREVIOUS_FIELD        = 8,
    SC_PREVIOUS_FIELD_2      = 10,
    SC_PREVIOUS_FIELD_3      = 12,
    SC_NEW_RECORD            = 14,
    SC_NEW_RECORD_2          = 16,
    SC_PREVIOUS_RECORD       = 18,
    SC_NEXT_RECORD           = 20,
    SC_FIRST_RECORD          = 22,
    SC_LAST_RECORD           = 24,
    SC_MARK_RECORD           = 26,
    SC_COMMIT_RECORD         = 28
} ShortcutCode} ;

#endif /* _FFKBD_H_ */


Objects\FlatFile\ffPagLRC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PCGEOS
 * MODULE:	  ffPagLRC.goh
 * FILE:	  ffPagLRC.goh
 *
 * AUTHOR:  	  Anna Lijphart: Jul 22, 1992
 *
 * REVISION HISTORY:
 *	Date	 Name	Description
 *	----	 ----	-----------
 *	7/22/92	 anna	Initial version
 *
 * DESCRIPTION:
 *	This file contains class definition for the page layout repeater
 *	rectangle class used in the flat file database library.
 *
 *
 * 	$Id: ffPagLRC.goh,v 1.5.20.1 96/04/28 08:32:17 chris Exp $
 *
 ***********************************************************************/
@optimize

#include  <geos.h>
@include  <grobj.goh>

/**************************************************************************/

@class	FFPageLayoutRectClass, RectClass ;

/*
 * This message sets the record layout boundary's size in the instance
 * data
 */
@message void MSG_FFPLR_SET_RECORD_BOUNDARY_SIZE (LayoutSize recordBounds);

/*
 * This message returns the record layout boundary's size in the instance
 * data
 */
@message void MSG_FFPLR_GET_RECORD_BOUNDARY_SIZE (LayoutSize *recordBounds);

/*
 * Instance data
 */
    @instance LayoutSize FFPLRI_recordLayoutBounds;

@endc


Objects\FlatFile\ffRcpVC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PCGEOS
 * MODULE:	  ffRcpVC.goh
 * FILE:	  ffRcpVC.goh
 *
 * AUTHOR:  	  Jeremy Dashe: Oct 28, 1992
 *
 * REVISION HISTORY:
 *	Date	 Name	Description
 *	----	 ----	-----------
 *	10/28/92	 jeremy	Initial version
 *
 * DESCRIPTION:
 *	This file contains the definition for the flat file library's
 *	record control panel value class.
 *
 * 	$Id: ffRcpVC.goh,v 1.2.20.1 96/04/28 08:32:21 chris Exp $
 *
 ***********************************************************************/
@optimize

@include  <Objects/gValueC.goh>

@class	FFRCPValueClass, GenValueClass;

/*
 * Here's a prototype for the ATTR_FFRCP_VALUE_NEW_RECORD_MSG message:
 * a void-returning message with no args.
 */
@prototype void FFRCP_VALUE_NEW_RECORD_MSG_PROTOTYPE ();

/*
 * Prototype for the ATTR_FFRCP_VALUE_JUMP_TO_RECORD_MSG message:
 * a void-returning message with one arg: a FFRCPJumpType.
 */
typedef enum {
    FFRCPV_FIRST_RECORD    ,
    FFRCPV_LAST_RECORD
} FFRCPJumpType} ;
@prototype void
    FFRCP_VALUE_JUMP_TO_RECORD_MSG_PROTOTYPE    (FFRCPJumpType jumpType);

/*
 * ATTR_FFRCP_VALUE_NEW_RECORD_MSG is the message sent to the
 * GLVI_destination when the user types in "new".
 */
@vardata Message ATTR_FFRCP_VALUE_NEW_RECORD_MSG;

/*
 * ATTR_FFRCP_VALUE_NEW_FIELD_MSG is the message sent to the
 * GLVI_destination when editing a new record and the user clicks
 * the increment or decrement triggers.
 */
@vardata Message ATTR_FFRCP_VALUE_JUMP_TO_RECORD_MSG;

@endc


Objects\FlatFile\ffRecC.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) GeoWorks 1992 -- All Rights Reserved

PROJECT:	PC/GEOS
MODULE:		FlatFile
FILE:		ffRecC.goh

AUTHOR:		John D. Mitchell

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    JDM	92.06.30	Initial version.

DESCRIPTION:
    This file contains the definition of the FlatFile library Record
    Control Panel (RCP) UI controller class.

    $Id: ffRecC.goh,v 1.12.20.1 96/04/28 08:32:12 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@optimize

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Include Files
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@include  <Objects/gCtrlC.goh> 		/* PC/GEOS libraries.	*/
@include  <Objects/gValueC.goh>
@include  <Objects/genC.goh>

@include  <ffile.goh> 			/* FlatFile.	*/
@include  <Objects/FlatFile/ffRcpVC.goh>

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Constants
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Maximum number of characters/bytes needed to hold the string version of
 * the record field index values (*not* including any terminators).
 */
#define	FFRCP_MAX_RECORD_NUM_CHARS		    5

/*
 * Number of characters for the current/total record display (includes one ""
 * " of " (allowed room for " of "
 * equivalent to be up to ten (10) characters long) and 3 characters
 * for the check mark in parens.
 */
#define	FFRCP_CURRENT_RECORD_DISPLAY_STRING_SIZE		\
        (FFRCP_MAX_RECORD_NUM_CHARS + 10 + 3)

/*
 * Number of timer ticks to wait between the time the user clicks on the
 * Goto Record selector and that record is made the current record.
 */
#define	FFRCP_SELECT_RECORD_TIMER_TICKS		    (40)

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Exported Function Prototypes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        FFRecordControlClass Definition
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@class	FFRecordControlClass, GenControlClass;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Instance Data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * The following instance data is used to keep track of the currently
 * outstanding one shot event timer (if any).  Used to provide apply-less
 * Goto Record capabilities.
 */
@instance TimerHandle	timerHandle		= NullHandle;
@instance word		timerID			= 0;
@instance word		timerGotoRecordNumber	= 0;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Default Inherited Attribute Values
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/* Send all messages to the current document.	*/
@default GCI_output	= (TO_APP_TARGET);

/* Multiple possible response types.	*/
@default GII_type	= GIT_MULTIPLE_RESPONSE;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Public Message Declarations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * MSG_FFRCP_CREATE_NEW_RECORD --
 *
 *	Select and display a "new", unused record for the editing pleasure
 *	of the user.
 */
@message void MSG_FFRCP_CREATE_NEW_RECORD  ();

/*
 * MSG_FFRCP_COMMIT_CURRENT_RECORD --
 *
 *	Commit (insert) the currently selected record to the database.
 */
@message (FFRCP_VALUE_NEW_RECORD_MSG_PROTOTYPE)
            MSG_FFRCP_COMMIT_CURRENT_RECORD;

/*
 * MSG_FFRCP_JUMP_TO_RECORD --
 *	This message is sent by the spin gadget when the user hits
 *	the increment or decrement triggers while editing a new record.
 */
@message (FFRCP_VALUE_JUMP_TO_RECORD_MSG_PROTOTYPE)
            MSG_FFRCP_JUMP_TO_RECORD;

/*
 * MSG_FFRCP_REVERT_CURRENT_RECORD --
 *
 *	Restore the temporary database record to the state it was before
 *	being edited/dirtied by the user.  It will restore a 'new'/empty
 *	record to it's pristine state (with reset default values and all
 *	that).
 */
@message void MSG_FFRCP_REVERT_CURRENT_RECORD  ();

/*
 * MSG_FFRCP_DELETE_CURRENT_RECORD --
 *
 *	Delete the currently selected record from the database (with
 *	user confirmation).
 */
@message void MSG_FFRCP_DELETE_CURRENT_RECORD  ();

/*
 * MSG_FFRCP_SELECT_RECORD --
 *
 *	Select and display the record specifed by the Goto Record gadget.
 *	This puppy actually just manages the timer that will invoke the
 *	MSG_FFRCP_GOTO_RECORD handler to do the database manipulation.
 */
@message (GEN_VALUE_STATUS_MSG) MSG_FFRCP_SELECT_RECORD;

/*
 * MSG_FFRCP_GOTO_RECORD --
 *
 *	Make the database record specified by the Goto Record gadget the
 *	currently selected record.
 */
@message void MSG_FFRCP_GOTO_RECORD  ();

/*
 * MSG_FFRCP_GOTO_FIRST_RECORD --
 *
 *	Select and display the first record in the database.
 */
@message void MSG_FFRCP_GOTO_FIRST_RECORD  ();

/*
 * MSG_FFRCP_GOTO_PREVIOUS_RECORD --
 *
 *	Select and display the record immediately preceeding the currently
 *	selected record.
 */
@message void MSG_FFRCP_GOTO_PREVIOUS_RECORD  ();

/*
 * MSG_FFRCP_GOTO_NEXT_RECORD --
 *
 *	Select and display the record immediately followin the currently
 *	selected record.
 */
@message void MSG_FFRCP_GOTO_NEXT_RECORD  ();

/*
 * MSG_FFRCP_GOTO_LAST_RECORD --
 *
 *	Select and display the last record in the database.
 */
@message void MSG_FFRCP_GOTO_LAST_RECORD  ();

/*
 * MSG_FFRCP_SET_RECORD_MARKING --
 *
 *	Set the record marking information for the current record based on
 *	the given setting.
 */
@message (GEN_BOOLEAN_GROUP_APPLY_MSG) MSG_FFRCP_SET_RECORD_MARKING;

/*
 * ENABLE_DISABLE_PROTOTYPE --
 *	A prototype for sending messages off when updating the
 *	reply display.
 */
@prototype void ENABLE_DISABLE_PROTOTYPE  (VisUpdateMode updateMode = dl);

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Controller Features
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/* FFRCPFeatures.	*/
#define	FFRCPF_MARK_RECORDS			(0x0040)
#define	FFRCPF_NAVIGATION			(0x0020)
#define	FFRCPF_GOTO_RECORD			(0x0010)
#define	FFRCPF_CREATE_NEW_RECORD		(0x0008)
#define	FFRCPF_COMMIT_CURRENT_RECORD		(0x0004)
#define	FFRCPF_REVERT_CURRENT_RECORD		(0x0002)
#define	FFRCPF_DELETE_CURRENT_RECORD		(0x0001)

/* FFRCPToolboxFeatures.	*/
#define	FFRCPTF_MARK_RECORDS			(0x0080)
#define	FFRCPTF_CURRENT_RECORD			(0x0040)
#define	FFRCPTF_NAVIGATION			(FFRCPF_NAVIGATION)
#define	FFRCPTF_GOTO_RECORD			(FFRCPF_GOTO_RECORD)
#define	FFRCPTF_CREATE_NEW_RECORD		(FFRCPF_CREATE_NEW_RECORD)
#define	FFRCPTF_COMMIT_CURRENT_RECORD		(FFRCPF_COMMIT_CURRENT_RECORD)
#define	FFRCPTF_REVERT_CURRENT_RECORD		(FFRCPF_REVERT_CURRENT_RECORD)
#define	FFRCPTF_DELETE_CURRENT_RECORD		(FFRCPF_DELETE_CURRENT_RECORD)

#define	FFRCP_DEFAULT_FEATURES		\
        (FFRCPF_NAVIGATION 	    	| \
         FFRCPF_GOTO_RECORD		| \
         FFRCPF_CREATE_NEW_RECORD 	| \
         FFRCPF_COMMIT_CURRENT_RECORD	| \
         FFRCPF_REVERT_CURRENT_RECORD	| \
         FFRCPF_DELETE_CURRENT_RECORD)

#define	FFRCP_DEFAULT_TOOLBOX_FEATURES		\
        (FFRCPTF_MARK_RECORDS		| \
         FFRCPTF_CURRENT_RECORD		| \
         FFRCPTF_NAVIGATION 		| \
         FFRCPTF_GOTO_RECORD	    	| \
         FFRCPTF_CREATE_NEW_RECORD	| \
         FFRCPTF_COMMIT_CURRENT_RECORD	| \
         FFRCPTF_REVERT_CURRENT_RECORD	| \
         FFRCPTF_DELETE_CURRENT_RECORD)

@endc		/* End of FFRecordControlClass.	*/


Objects\FlatFile\ffTChst.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PCGEOS
 * MODULE:	  ffTChst.h
 * FILE:	  ffTChst.h
 *
 * AUTHOR:  	  Jeremy Dashe: Mar 16, 1992
 *
 * REVISION HISTORY:
 *	Date	  Name	    Description
 *	----	  ----	    -----------
 *	3/16/92	  jeremy    Initial version
 *	4/29/92	  jeremy    Moved definition of TCFieldChangeStatus to
 *	    	    	    ffUICtrl.goh
 *
 * DESCRIPTION:
 *	This file contains definitions for the flat file
 *	treasure chest UI controller.
 *
 * 	$Id: ffTChst.h,v 1.4.26.1 96/04/28 08:32:24 chris Exp $
 *
 ***********************************************************************/
#ifndef _FFTCHST_H_
#define _FFTCHST_H_

/***********************************************
    Controller features
***********************************************/
#define FFTC_FIELD_LISTS_FEATURE 	0x0010
#define FFTC_FIELD_NOTES_FEATURE 	0x0008
#define FFTC_CREATE_NEW_FIELD_FEATURE 	0x0004
#define FFTC_EDIT_FIELD_FEATURE 		0x0002
#define FFTC_DELETE_FIELD_FEATURE 	0x0001

/*
 * Feature flags for different UI levels
 */
#define FFTC_DEFAULT_FEATURES            (FFTC_FIELD_LISTS_FEATURE | \
                     FFTC_FIELD_NOTES_FEATURE | \
                     FFTC_CREATE_NEW_FIELD_FEATURE | \
                     FFTC_EDIT_FIELD_FEATURE | \
                     FFTC_DELETE_FIELD_FEATURE)
#define FFTC_DEFAULT_TOOLBOX_FEATURES    0

#endif /* _FFTCHST_H_ */


Objects\FlatFile\ffTChstC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	GEOS
 * MODULE:	ffTChstC.goh
 * FILE:	ffTChstC.goh
 *
 * AUTHOR:  	Jeremy Dashe: Mar 16, 1992
 *
 * REVISION HISTORY:
 *	Date	 Name	Description
 *	----	 ----	-----------
 *	3/16/92	 jeremy	Initial version
 *
 * DESCRIPTION:
 *	This file defines the flat file database treasure chest class.
 *
 * 	$Id: ffTChstC.goh,v 1.20.10.1 96/04/28 08:32:26 chris Exp $
 *
 ***********************************************************************/
@optimize
@include  <Objects/gCtrlC.goh>

@class FFTreasureChestClass, GenControlClass;

/*
 * Instance data.
 */

/*
 * The suppressButtonDisabling flag is set when disabling one dynamic list
 * when the other just got selected.  The old list would assume that it
 * should disable the field edit/delete/transfer triggers, and the new
 * list would immediately re-enable them, causing them to flicker.
 * If this flag is set, then the old list knows not to disable the triggers.
 */
@instance   Boolean suppressButtonDisabling = FALSE;

/*
 * FFTC_editFieldOptr is used by theTreasure Chest UI controller when the
 * user hits the "Edit field" trigger.  A MSG_FFFP_INITIATE_DIALOG_BOX
 * is sent to the editFieldOptr.
 *
 * Application writers must load this instance datum with the optr to the
 * appropriate field properties box (see GeoFile's Main/mainProcess.goc)
 */
@instance optr FFTC_editFieldOptr = NullOptr;

/*
 * FFTC_createNewFieldOptr is used by the Treasure Chest UI controller when the
 * user hits the "Create new fields" trigger.
 */
@instance optr FFTC_createNewFieldOptr = NullOptr;

/*
 * FFTC_currentDatabaseObject is used to keep track of when the target database
 * has changed so that the necessary lists can be updated correctly.
 *
 * Calling it a dword instead of an optr is just to avoid relocation
 * on shutdown. This is a goc problem which will be fixed.
 */
@instance dword FFTC_currentDatabaseObject = 0;

/*********************  External messages *********************/
/*
 * MSG_FFTC_SET_FIELD_PROPERTIES_UIC_INFO --
 *	This message is called to set the destinations for the
 *	"Create New Field" and "Edit this field" triggers.
 */
@message void MSG_FFTC_SET_FIELD_PROPERTIES_UIC_INFO (optr createNewUICOptr,
                             optr editFieldUICOptr);

/*********************  Internal messages *********************/

/*
 * MSG_FFTC_DATABASE_LIST_MONIKER_QUERY --
 *	This message is sent by the layout list when it wants a field's moniker.
 *
 * Parameters: void (optr list, word item)
 */
@message (GEN_DYNAMIC_LIST_QUERY_MSG) MSG_FFTC_DATABASE_LIST_MONIKER_QUERY;

/*
 * MSG_FFTC_LAYOUT_LIST_MONIKER_QUERY --
 *	This message is sent by the layout list when it wants a field's moniker.
 *
 * Parameters: void (optr list, word item)
 */
@message (GEN_DYNAMIC_LIST_QUERY_MSG) MSG_FFTC_LAYOUT_LIST_MONIKER_QUERY;

/*
 * MSG_FFTC_RESET_CHANGE --
 *
 *	This message is sent when the "Reset" button is pressed.
 */
@message void MSG_FFTC_RESET_CHANGE ();

/*
 * MSG_FFTC_TRANSFER_FROM_DATABASE_TO_LAYOUT --
 *
 *	This message is sent when the "right-arrow" trigger is hit.
 */
@message void MSG_FFTC_TRANSFER_FROM_DATABASE_TO_LAYOUT ();

/*
 * MSG_FFTC_TRANSFER_FROM_LAYOUT_TO_DATABASE --
 *
 *	This message is sent when the "left-arrow" trigger is hit.
 */
@message void MSG_FFTC_TRANSFER_FROM_LAYOUT_TO_DATABASE ();

/*
 * MSG_FFTC_DATABASE_LIST_NOTIFICATION --
 *	This message is sent out when something happens in the
 *	database dynamic list.
 */
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_FFTC_DATABASE_LIST_NOTIFICATION;

/*
 * MSG_FFTC_LAYOUT_LIST_NOTIFICATION --
 *	This message is sent out when something happens in the
 *	layout dynamic list.
 */
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_FFTC_LAYOUT_LIST_NOTIFICATION;

/*
 * MSG_FFTC_DELETE_FIELD --
 *	This message is sent by the Treasure Chest's Delete trigger.
 */
@message void MSG_FFTC_DELETE_FIELD ();

/*
 * MSG_FFTC_EDIT_A_FIELD --
 *	This message is sent by the Treasure Chest's Edit trigger.
 */
@message void MSG_FFTC_EDIT_A_FIELD ();

    @default GCI_output = (TO_APP_TARGET);

/*
 * Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 * ATTR_GEN_CONTROL_PROHIBIT_UI)
 */

/*
 * Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 * ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */

/* (NONE) */

@endc;


Objects\FlatFile\ffTextC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PC/GEOS
 * MODULE:	  ffTextC.goh
 * FILE:	  ffTextC.goh
 *
 * AUTHOR:  	  Jeremy Dashe: Jun 10, 1992
 *
 * REVISION HISTORY:
 *	Date	 Name	Description
 *	----	 ----	-----------
 *	6/10/92	 jeremy	Initial version
 *
 * DESCRIPTION:
 *	This file contains class definition for the text classes used
 *	in the flat file database library.
 *
 *
 * 	$Id: ffTextC.goh,v 1.30.5.1 96/04/28 08:32:08 chris Exp $
 *
 ***********************************************************************/

@optimize

#include  <geos.h>
@include  <Objects/FlatFile/ffDbase.goh>
#include  <Objects/FlatFile/ffDPaste.h>
#include  <Objects/FlatFile/ffKbd.h>
@include  <grobj.goh>
#include  <chunkarr.h>
#include  <Objects/Text/tCommon.h>

/**************************************************************************/

@class	FFLabelGuardianClass, MultTextGuardianClass;

/*
 * MSG_FFLG_INITIALIZE --
 *	This method sets the FFLG_field instance data to point to the
 *	guardian of the field that this label is associated with.
 */
@message void MSG_FFLG_INITIALIZE (VMBlockHandle vmBlockHandle,
                  ChunkHandle chunkHandle,
                  VMFileHandle *file);

/*
 * MSG_FFLG_RELEASE_FIELD --
 * 	This method unlinks a label from its associated field.
 */
@message void MSG_FFLG_RELEASE_FIELD ();

/*
 * MSG_FFLG_PASTE_ALERT --
 * 	This message is sent by the database to labels that
 *    	have just been pasted into the layout.  Individual
 *    	labels need to add themselves to a list that is
 *    	created by the database so that matching fields can
 *    	re-attach with their labels.
 */
@message void MSG_FFLG_PASTE_ALERT (LabelIDArray *labels = cx:dx);

/*
 * The FFLG_field is set to point to the field that
 * this label is associated with.
 */
@instance GrObjElementObjPtr FFLG_field;
@instance GrObjElementObjPtr FFLG_self;

typedef struct {    	    	    	/*  	    	    	    	      */
    GrObjElementObjPtr FFLG_field;  	/* <= UPDATE ME IF THE ABOVE INSTANCE */
    GrObjElementObjPtr FFLG_self; 	/* <=  	       DATA CHANGES!   	      */
} FFLabelGuardianInstanceBlock} ;	 	/*  	    	    	    	      */

/*
 * The FFLG_TEMPORARY_WARD_INSTANCE_DATA vardata structure is used when
 * a label's guardian is pasted in, but its ward does not yet exist.
 *
 * The ward's instance data is kept in the vardata block until the ward
 * gets created.  Then the data is taken from the vardata and copied to
 * the ward, and the vardata gets nuked.  Simple, eh?
 */

@vardata optr FFLG_TEMPORARY_WARD_INSTANCE_DATA;

@endc

/**************************************************************************/

@class	FFTextFieldGuardianClass, TextGuardianClass;

/*
 * MSG_FFTFG_INITIALIZE --
 *	This method sets the FFTFG_label instance data to point to the
 *	guardian of the label that this field is associated with, and
 *	to set the edges on or off.
 */
@message void MSG_FFTFG_INITIALIZE (VMBlockHandle vmBlockHandle,
                   ChunkHandle chunkHandle,
                   FieldEdgeFlags edgeFlags);

/*
 * MSG_FFTFG_SET_FIELD_TYPE --
 *	This message sets the flat file field type for a particular
 *	field (this one).
 */
@message void MSG_FFTFG_SET_FIELD_TYPE (FieldDataType fieldType);

/*
 * MSG_FFTFG_SET_DISPLAY_FORMAT --
 *	This message sets the display format for a
 *    	particular field.
 */
@message void MSG_FFTFG_SET_DISPLAY_FORMAT (FormatIdType displayFormat = cx);

/*
 * MSG_FFTFG_SET_FOR_DATA_ENTRY --
 * 	This message prepares a field for data entry.  If the
 *	field type is an editable one, it becomes editable.  Other-
 *	wise, it becomes non-editable.
 */
@message void MSG_FFTFG_SET_FOR_DATA_ENTRY ();

/*
 * MSG_FFTFG_SET_FOR_DESIGN_MODE --
 * 	This message prepares a field for design mode by setting
 *	it not editable and requesting the database to set its name.
 */
@message void MSG_FFTFG_SET_FOR_DESIGN_MODE ();

/*
 * MSG_FFTFG_SIMPLE_SET_FOR_DESIGN_MODE --
 * 	This message just sets the inDesignMode flag for fields.
 *	It is necessary to deal with a bizarre case when switching
 *	layouts and is not recommended for other user (use
 *	MSG_FFTFG_SET_FOR_DESIGN_MODE instead)
 */
@message void MSG_FFTFG_SIMPLE_SET_FOR_DESIGN_MODE ();

/*
 * MSG_FFTFG_GET_LABEL_OPTR --
 *	This message sends back the optr of the label pointed to by
 *	FFTFG_label.
 *	Pass this message the document handle associated with this label.
 */
@message optr MSG_FFTFG_GET_LABEL_OPTR (VMFileHandle documentHandle);

/*
 * MSG_FFTFG_RELEASE_LABEL --
 * 	This method unlinks a field from its associated label.
 */
@message void MSG_FFTFG_RELEASE_LABEL ();

/*
 * MSG_FFTFG_SET_EDGES --
 *	This message sets which of a field's four border lines will be drawn.
 *	Pass it FieldEdgeFlags to indicate which lines to draw, and a
 *	Boolean whether to redraw or not.
 */
@message void MSG_FFTFG_SET_EDGES (FieldEdgeFlags edges, Boolean redraw);

/*
 * MSG_FFTFG_PING --
 *	This message simply increments a passed flag.  Used to detect if
 *	at least one FFTFG exists in a grobj body.
 */
@message void MSG_FFTFG_PING (word *incrementMe = cx:dx);

/*
 * MSG_FFTFG_PASTE_ALERT --
 * 	This message is sent by the database to fields that
 *    	have just been pasted into the layout.  Individual
 *    	fields need to tell the database about their existence
 *    	so that new fields can be created for them (or old
 *    	ones inserted into the current layout).
 *
 *    	The address to an array of labels is passed as well,
 *    	for field GrObjects to look through and see if there
 *    	is a matching label that is to be re-attached to
 *    	its field.  If a matching label is found, it is removed
 *    	from the array to speed up later searches.
 */
@message void MSG_FFTFG_PASTE_ALERT (LabelIDArray *labels = cx:dx);

/*
 * MSG_FFTFG_NUKE_FIELD --
 *	This message is sent when the current field is to be deleted with
 *	no user- or database verification.
 */
@message void MSG_FFTFG_NUKE_FIELD ();

/* MSG_FFTFG_UPDATE_PAGE_NUMBER --
 * 	This message is sent when all page number fields should
 * 	update themselves with a new page number.
 */
@message void MSG_FFTFG_UPDATE_PAGE_NUMBER ();

/*
 * MSG_FFTFG_UPDATE_UI_BLOCK --
 * 	This message is called when one or more fields become
 *	selected, and the various field appearence controllers
 *    	need to be updated.
 *
 *      What we'll do here is take the passed data block and
 *    	describe our appearence via edge flags and format
 *    	tokens.  If there are different edge flags set, we'll
 *    	set the corresponding "indeterminate" flags.
 */
@message void MSG_FFTFG_UPDATE_UI_BLOCK (MemHandle appearenceChangeBlock);

/*
 * MSG_FFTFG_RESET_DEFINED_TYPE --
 *	This message is passed immediately on to our ward, which checks
 *	to see if the passed format id type matches its current id type.
 *	If there's a match, the current type is replaced with the newFormat.
 */
@message void MSG_FFTFG_RESET_DEFINED_TYPE (FormatIdType formatToReset,
                       FormatIdType newFormat);

/*
 * MSG_FFTFG_GET_DISPLAY_ARRAY_ELEMENT --
 *	Used for export to build array of display formats (from current
 *	layout) for each field.
 */
typedef struct {
    FormatIdType    *GDAI_displayArray;     	/* display array to fill in */
    FieldID 	    *GDAI_layoutNameList;	/* FFI_layoutNameList */
    byte    	    GDAI_numInLayoutNameList;	/* number in above */
} GetDisplayArrayInfo} ;
@message void MSG_FFTFG_GET_DISPLAY_ARRAY_ELEMENT (
                Segment getDisplayArrayInfoSegment = cx,
                word getDisplayArrayInfoOffset = dx);

/*************************************************************************
 ***	    Instance data for the FFTextFieldGuardianClass
 ***
 ***			  ***> WARNING! <***
 ***
 ***	    If you change the instance data in any way, BE SURE to
 ***	    update the FFTFGInstanceData structure!
 ***	    REALLY BAD THINGS will happen if you don't!
 *************************************************************************/

/*
 * The FFTFG_fieldType is the data type asociated with this field.
 */
@instance FieldDataType FFTFG_fieldType;

/*
 * The FFTFG_label is set to point to the label that
 * this field is associated with.
 */
@instance GrObjElementObjPtr FFTFG_label;

/*
 * The FFTFG_edgeFlags indicate which of a field's four border
 * edges are to be drawn.
 */
@instance FieldEdgeFlags FFTFG_edgeFlags = FEF_ALL_EDGES;

typedef struct {    	    	    	/*  	    	    	    	      */
    FieldDataType FFTFG_fieldType;  	/* <= UPDATE ME IF THE ABOVE INSTANCE */
    GrObjElementObjPtr FFTFG_label; 	/* <=  	       DATA CHANGES!   	      */
    FieldEdgeFlags FFTFG_edgeFlags; 	/* <= 	     	  	    	      */
} FFTFGInstanceData} ;	    	 	/*  	    	    	    	      */

/**************************************************************************
 ***	    End of instance data for the FFTextFieldGuardianClass.
 ***
 ***        See the above note if you've just added or changed existing
 ***        instance data!
 **************************************************************************/

/*
 * The FFTFG_NUKE_FLAG vardata item is used to indicate that the current
 * field should be deleted without asking permission from the user or
 * notification to the database.
 */
@vardata Boolean FFTFG_NUKE_FLAG;

/*
 * The FFTFG_TEMPORARY_WARD_INSTANCE_DATA vardata structure is used when
 * a field's guardian is pasted in, but its ward does not yet exist.
 *
 * The ward's instance data is kept in the vardata block until the ward
 * gets created.  Then the data is taken from the vardata and copied to
 * the ward, and the vardata gets nuked.  Simple, eh?
 */

@vardata optr FFTFG_TEMPORARY_WARD_INSTANCE_DATA;

@endc

/**************************************************************************/

@class 	FFTextClass, GrObjTextClass;

/*
 * MSG_FFT_INITIALIZE --
 *	This method sets FFT_fieldColumn with the column number of
 *	the field associated with this text object.
 */
@message void MSG_FFT_INITIALIZE (FieldID colNum);

/*
 * MSG_FFT_SET_FIELD_TYPE --
 *	This message sets the flat file field type for a
 *	particular field.  If the resetIfChange flag is
 *    	set, the display format won't be changed unless the
 *    	field type has changed.
 */
@message void MSG_FFT_SET_FIELD_TYPE (FieldDataType fieldType,
                     Boolean resetIfChanged);

/*
 * MSG_FFT_SET_DISPLAY_FORMAT --
 *	This message sets the display format for a
 *    	particular field.
 */
@message void MSG_FFT_SET_DISPLAY_FORMAT (FormatIdType displayFormat);

/*
 * MSG_FFT_SET_FOR_DESIGN_MODE --
 * 	This message causes a field to ignore target losses and
 *    	requests to be filled with a "#" for a page number type
 *    	or the field name otherwise.
 */
@message void MSG_FFT_SET_FOR_DESIGN_MODE ();

/*
 * MSG_FFT_SIMPLE_SET_FOR_DESIGN_MODE --
 * 	This message just sets the inDesignMode flag for fields.
 *	It is necessary to deal with a bizarre case when switching
 *	layouts and is not recommended for other user (use
 *	MSG_FFT_SET_FOR_DESIGN_MODE instead)
 */
@message void MSG_FFT_SIMPLE_SET_FOR_DESIGN_MODE ();

/*
 * MSG_FFT_SET_FOR_DATA_ENTRY_MODE --
 * 	This message causes a field to listen to target losses (if it
 *	is of a type that should).
 */
@message void MSG_FFT_SET_FOR_DATA_ENTRY_MODE ();

/*
 * MSG_FFT_SEND_FIELD_COLUMN --
 *	This method sends the field column a text field is associated
 *	with to the flat file database.
 */
@message void MSG_FFT_SEND_FIELD_COLUMN ();

/*
 * MSG_FFT_SEND_FIELD_NAVIGATION_INFO --
 *	This message sends the flat file library a notification that
 *	a navigation key (TAB, CR, etc.) has been intercepted.
 */
@message void MSG_FFT_SEND_FIELD_NAVIGATION_INFO (ShortcutCode shortcut);

/*
 * MSG_GET_FIELD_COLUMN_FROM_TEXT_OBJECT --
 *	Returns the field column # associated with this text field.
 */
@message FieldID MSG_GET_FIELD_COLUMN_FROM_TEXT_OBJECT ();

/*
 * MSG_FFT_GET_FIELD_NAME --
 * 	This message fills a text buffer with a field's name.
 *	Pass a buffer in which to place the name.
 */
@message void MSG_FFT_GET_FIELD_NAME (char *fieldName);

/*
 * MSG_FFT_ASK_FOR_FIELD_NAME --
 *	This message causes a text field to ask to be filled with
 *	its field name.
 */
@message void MSG_FFT_ASK_FOR_FIELD_NAME ();

/*
 * MSG_FFD_GET_DOCUMENT_HANDLE --
 *	This message returns the VMFileHandle for the current database.
 */
@message VMFileHandle MSG_FFT_GET_DOCUMENT_HANDLE ();

/*
 * MSG_FFT_FIELD_HAS_DEPENDENCIES --
 *	This function queries the database to see if the field
 *    	we represent is depended upon or not.  TRUE is returned
 *    	if the field has dependentss, FALSE is returned otherwise.
 */
@message Boolean MSG_FFT_FIELD_HAS_DEPENDENCIES ();

/*
 * MSG_FFT_REPORT_DEMISE --
 *	This message tells the flat file that we're being nuked.
 *
 *	If the reallyNuke flag is set, tell the database to
 *    	delete the field entirely, not just remove it from the
 *    	current layout.
 */
@message void MSG_FFT_REPORT_DEMISE (Boolean reallyNuke);

/*
 * MSG_FFT_REPORT_PASTED_FIELD --
 *
 * 	This message calls the database reporting that a field
 *    	has just been pasted into the database.
 *
 *	Its database, guardian, and label optrs comprise the args.
 */
@message void MSG_FFT_REPORT_PASTED_FIELD (optr database,
                      optr guardian,
                      optr label);

/*
 * MSG_FFT_WRITE_INSTANCE_TO_TRANSFER --
 *	This message loads a FFTextGuardianAndWardInstanceDataStruct
 *	with a FFText's instance data.
 */
@message void MSG_FFT_WRITE_INSTANCE_TO_TRANSFER (FFTInstanceData *indata);

/*
 * MSG_FFT_READ_INSTANCE_FROM_TRANSFER --
 *	This message loads a FFText's instance data from a passed
 *	FFTInstanceData structure.
 */
@message void MSG_FFT_READ_INSTANCE_FROM_TRANSFER (FFTInstanceData *indata);

/*
 * MSG_FFT_DISPLAY_FIELD_CONTENTS --
 * 	This method displays a cell's data as defined by the
 *   	field's display type.
 *
 *    	Pass a pointer to the cell's data and a handle to a text
 *	buffer at least MAX_TEXT_FIELD_LENGTH in size.  Also pass
 *    	a flag to determine if the field should be shown formatted
 *    	or "raw."
 *
 */
@message void MSG_FFT_DISPLAY_FIELD_CONTENTS (CellCommon *dataCellPtr,
                         MemHandle textHandle,
                         Boolean formatField);

/*
 * MSG_FFT_RETURN_FORMAT_TYPE --
 *	This method returns the field's current format type token.
 */
@message FormatIdType MSG_FFT_RETURN_FORMAT_TYPE ();

/*
 * MSG_FFT_RESET_DEFINED_TYPE --
 *	This message is checks to see if the passed format id type
 *	matches our own current id type. If there's a match, the current
 *	type is replaced with the newFormat.
 */
@message void MSG_FFT_RESET_DEFINED_TYPE (FormatIdType formatToReset,
                     FormatIdType newFormat);

/*
 * MSG_FFT_GET_DISPLAY_ARRAY_ELEMENT --
 *	Used for export to build array of display formats (from current
 *	layout) for each field.
 */
@message void MSG_FFT_GET_DISPLAY_ARRAY_ELEMENT (
                    GetDisplayArrayInfo *getDisplayArrayInfo);

typedef struct {
    word	FVVCGSRP_ax;
    word	FVVCGSRP_bp;
    word	FVVCGSRP_cx;
    word	FVVCGSRP_dx;
} FixedVisVupCreateGStateReturnParams} ;
@alias (MSG_VIS_VUP_CREATE_GSTATE) Boolean MSG_FIXED_VIS_VUP_CREATE_GSTATE(FixedVisVupCreateGStateReturnParams *retValue = axbpcxdx);

/*************************************************************************
 ***	    Instance data for the FFTextClass
 ***
 ***			  ***> WARNING! <***
 ***
 ***	    If you change the instance data in any way, BE SURE to
 ***	    update the FFTInstanceData structure!
 ***	    REALLY BAD THINGS will happen if you don't!
 *************************************************************************/

/*
 * FFT_fieldColumn is set to the specific column number for this field.
 */
@instance FieldID FFT_fieldColumn;

/*
 * FFT_inDesignMode is set when the database is in -- you guessed it --
 * design mode.  The field shouldn't request validation when it
 * loses the target and when it should temporarily clear itself of
 * text when printing.
 */
@instance Boolean FFT_inDesignMode = TRUE;

/*
 * FFT_fieldType is identical to our ward's FFTFG_fieldType.  It's kept
 * locally to speed up redrawing the field's data.
 */
@instance FieldDataType FFT_fieldType;

/*
 * FFT_displayFormat is a FormatIdType used to configure what data is
 * to look like when displayed.
 */
@instance FormatIdType FFT_displayFormat = FORMAT_ID_GENERAL;

/*
 * FFT_navigating is used much like FFT_inDesignMode, but is specifically
 * used when field navigation is happening.
 */
@instance Boolean FFT_navigating = FALSE;

typedef struct {
    FieldID FFT_fieldColumn;	    	/* <= 	    	    	    	      */
    Boolean FFT_inDesignMode;	    	/* <= UPDATE ME IF THE ABOVE INSTANCE */
    FieldDataType FFT_fieldType;    	/* <=  	       DATA CHANGES!   	      */
    FormatIdType FFT_displayFormat; 	/* <= 	     	  	    	      */
    Boolean FFT_navigating; 	    	/* <=	    	    	    	      */

    VisTextCharAttr FFT_charAttrs;  	/* <- These are independant of in-    */
    VisTextParaAttr FFT_paraAttrs;  	/* <- stance data because they were   */
                                        /*    handiest to cut/paste this way. */
} FFTInstanceData} ;

/**************************************************************************
 ***	    End of instance data for the FFTextClass.
 ***
 ***        See the above note if you've just added or changed existing
 ***        instance data!
 **************************************************************************/

@endc

/**************************************************************************/

/*
 * The infamous FFTextGuardianAndWardInstanceDataStruct structure.
 * This structure is used when cut-/copy-/pasting fields to/from the
 * clipboard.
 *
 * It is intended to be the same size and content as the combined instance
 * data for the FFTextFieldGuardianClass and the FFTextClass.  If either
 * of the two classes' instance data changes, be sure to reflect the changes
 * here and in ffDatabaseFields.goc.
 */
typedef struct {
    FFTFGInstanceData	g_indata;    /* FFTextFieldGuardianClass instance data */
    FFTInstanceData 	t_indata;    /* FFTextClass instance data */
} FFTextGuardianAndWardInstanceDataStruct} ;

/*
 * The infamous FFLabelGuardianAndWardInstanceDataStruct structure.
 * This structure is used when cut-/copy-/pasting labels to/from the
 * clipboard.
 *
 * It is intended to be the same size and content as the combined instance
 * data for the FFLabelFieldGuardianClass and the FFTextClass.  If either
 * of the two classes' instance data changes, be sure to reflect the changes
 * here and in ffDatabaseFields.goc.
 */
typedef struct {
    FFLabelGuardianInstanceBlock g_indata;   /* FFLabelGuardian instance data */
    FFTInstanceData 	t_indata;    	     /* FFTextClass instance data */
} FFLabelGuardianAndWardInstanceDataStruct} ;


Objects\FlatFile\ffUICtrl.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PC/GEOS
 * MODULE:	  ffUICtrl.goh
 * FILE:	  ffUICtrl.goh
 *
 * AUTHOR:  	  Jeremy Dashe: Apr 27, 1992
 *
 * REVISION HISTORY:
 *	Date	 Name	Description
 *	----	 ----	-----------
 *	4/27/92	 jeremy	Initial version
 *
 * DESCRIPTION:
 *	This file contains the declaration of the FFControlClass, used
 *	by all UI controllers who display field lists.
 *
 * 	$Id: ffUICtrl.goh,v 1.5.20.1 96/04/28 08:32:25 chris Exp $
 *
 ***********************************************************************/

@optimize

@include  <ffile.goh>
@include  <Objects/gCtrlC.goh>

@class	FFControlClass, GenControlClass;

/*********************  External messages *********************/

/*
 * MSG_FFCC_{DATABASE,LAYOUT,WHOLE}_LIST_STATUS_CHANGE --
 *	These messages are sent by the database object via the
 *	GWNT_FLAT_FILE_FIELD_LIST_CHANGE notification, through GCN
 *	lists.  They contain information about a list change.
 */
@message void MSG_FFCC_DATABASE_LIST_STATUS_CHANGE (
              FFFieldListChangeMessageBlock listChange);
@message void MSG_FFCC_LAYOUT_LIST_STATUS_CHANGE (
              FFFieldListChangeMessageBlock listChange);
@message void MSG_FFCC_WHOLE_LIST_STATUS_CHANGE (
              FFFieldListChangeMessageBlock listChange);

@endc


file.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	file.h
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines file structures and routines.
 *
 *	$Id: file.h,v 1.56.1.2 96/12/01 16:58:40 kho Exp $
 *
 ***********************************************************************/

#ifndef	__FILE_H
#define __FILE_H

/*
 * File system errors
 */

#define ERROR_UNSUPPORTED_FUNCTION   	1
#define ERROR_FILE_NOT_FOUND 		2
#define ERROR_PATH_NOT_FOUND 		3
#define ERROR_TOO_MANY_OPEN_FILES 	4
#define ERROR_ACCESS_DENIED 		5
#define ERROR_INSUFFICIENT_MEMORY 	8
#define ERROR_INVALID_VOLUME 		15
#define ERROR_IS_CURRENT_DIRECTORY 	16
#define ERROR_DIFFERENT_DEVICE 		17
#define ERROR_NO_MORE_FILES 		18
#define ERROR_WRITE_PROTECTED 		19
#define ERROR_UNKNOWN_VOLUME 		20
#define ERROR_DRIVE_NOT_READY 		21
#define ERROR_CRC_ERROR 			23
#define ERROR_SEEK_ERROR 		25
#define ERROR_UNKNOWN_MEDIA 		26
#define ERROR_SECTOR_NOT_FOUND 		27
#define ERROR_WRITE_FAULT 		29
#define ERROR_READ_FAULT 		30
#define ERROR_GENERAL_FAILURE 		31
#define ERROR_SHARING_VIOLATION 		32
#define ERROR_ALREADY_LOCKED 		33
#define ERROR_SHARING_OVERFLOW 		36
#define ERROR_NETWORK_CONNECTION_BROKEN 	55
#define ERROR_NETWORK_ACCESS_DENIED  	65
#define ERROR_NETWORK_NOT_LOGGED_IN  	78
#define ERROR_SHORT_READ_WRITE 		128
#define ERROR_INVALID_LONGNAME 		129
#define ERROR_FILE_EXISTS 		130
#define ERROR_DOS_EXEC_IN_PROGRESS 	131
#define ERROR_FILE_IN_USE 		132
#define ERROR_ARGS_TOO_LONG 		133
#define ERROR_DISK_UNAVAILABLE 	    	134
#define ERROR_DISK_STALE 	    	135
#define ERROR_FILE_FORMAT_MISMATCH 	136
#define ERROR_CANNOT_MAP_NAME 	    	137
#define ERROR_DIRECTORY_NOT_EMPTY 	138
#define ERROR_ATTR_NOT_SUPPORTED 	139
#define ERROR_ATTR_NOT_FOUND 	    	140
#define ERROR_ATTR_SIZE_MISMATCH 	141
#define ERROR_ATTR_CANNOT_BE_SET 	142
#define ERROR_CANNOT_MOVE_DIRECTORY 	143
#define ERROR_PATH_TOO_LONG 	    	144
#define ERROR_ARGS_INVALID   	    	145
#define ERROR_CANNOT_FIND_COMMAND_INTERPRETER  146
#define ERROR_NO_TASK_DRIVER_LOADED  	147

/*
 * Constants for file system routines
 */

typedef ByteEnum FileExclude ;
#define FE_EXCLUSIVE  1
#define FE_DENY_WRITE  2
#define FE_DENY_READ  3
#define FE_NONE  4

typedef ByteEnum FileAccess ;
#define FA_READ_ONLY  0
#define FA_WRITE_ONLY  1
#define FA_READ_WRITE  2

typedef ByteFlags FileAccessFlags ;
#define FILE_DENY_RW 	0x10
#define FILE_DENY_W 	0x20
#define FILE_DENY_R 	0x30
#define FILE_DENY_NONE 	0x40

#define FILE_ACCESS_R 	0x00
#define FILE_ACCESS_W 	0x01
#define FILE_ACCESS_RW 	0x02

#define FILE_NO_ERRORS 	0x80

typedef ByteFlags FileAttrs ;
#define FA_LINK 	    	0x40
#define FA_ARCHIVE 	0x20
#define FA_SUBDIR 	0x10
#define FA_VOLUME 	0x8
#define FA_SYSTEM 	0x4
#define FA_HIDDEN 	0x2
#define FA_RDONLY 	0x1

#define FILE_ATTR_NORMAL 	0
#define FILE_ATTR_READ_ONLY 	FA_RDONLY
#define FILE_ATTR_HIDDEN 	FA_HIDDEN
#define FILE_ATTR_SYSTEM 	FA_SYSTEM
#define FILE_ATTR_VOLUME_LABEL 	FA_VOLUME

typedef dword	FileID	;
typedef struct {    /* Element of array returned by FileGetCurrentPathIDs */
    word    FPID_disk;	    /* disk handle */
    FileID  FPID_id;	    /* id for path on that disk */
} FilePathID} ;

#define FILE_NO_ID   (0)

typedef enum /* word */ {
    FEA_MODIFICATION    ,
    FEA_FILE_ATTR    ,
    FEA_SIZE    ,
    FEA_FILE_TYPE    ,
    FEA_FLAGS    ,
    FEA_RELEASE    ,
    FEA_PROTOCOL    ,
    FEA_TOKEN    ,
    FEA_CREATOR    ,
    FEA_USER_NOTES    ,
    FEA_NOTICE    ,
    FEA_CREATION    ,
    FEA_PASSWORD    ,
    FEA_CUSTOM    ,
    FEA_NAME    ,
    FEA_GEODE_ATTR    ,
    FEA_PATH_INFO    ,
    FEA_FILE_ID    ,
    FEA_DESKTOP_INFO    ,
    FEA_DRIVE_STATUS    ,
    FEA_DISK    ,
    FEA_DOS_NAME    ,
    FEA_OWNER    ,
    FEA_RIGHTS    ,
    FEA_MULTIPLE    =0xfffe,
    FEA_END_OF_LIST    =0xffff,
} FileExtendedAttribute} ;

typedef struct {
    FileExtendedAttribute   FEAD_attr;	    /* Attribute to get/set */
    void    	    	    *FEAD_value;    /* Pointer to buffer/new value */
    word    	    	    FEAD_size;	    /* Size of buffer/new value */
    char    	    	    *FEAD_name;	    /* Null-terminated ASCII name of
                         * attribute if FEA_CUSTOM */
} FileExtAttrDesc} ;

/* very similar v^, just needed to get around too picky type checking in XIP */

typedef struct {
    FileExtendedAttribute   FEAD_attr;	    /* Attribute to get/set */
    dword    	    	    *FEAD_value;    /* Pointer to buffer/new value */
    word    	    	    FEAD_size;	    /* Size of buffer/new value */
    char    	    	    *FEAD_name;	    /* Null-terminated ASCII name of
                         * attribute if FEA_CUSTOM */
} FileExtAttrDescLike} ;

/* GEOS file types */

typedef enum /* word */ {
    GFT_NOT_GEOS_FILE    ,
    GFT_EXECUTABLE    ,
    GFT_VM    ,
    GFT_DATA    ,
    GFT_DIRECTORY    ,
    GFT_LINK
} GeosFileType} ;

/* GEOS file header flags */

typedef WordFlags GeosFileHeaderFlags ;
#define GFHF_TEMPLATE 		0x8000
#define GFHF_SHARED_MULTIPLE 	0x4000
#define GFHF_SHARED_SINGLE 	0x2000
#define GFHF_HIDDEN 		0x0800
#define GFHF_DBCS 		0x0400
#define GFHF_UNREAD  	    	0x0200
#define GFHF_NOTES   	    	0x0100

/* Size of the user notes field in the file header */

#define GFH_USER_NOTES_LENGTH 		(100 / sizeof(TCHAR)) - 1
#define GFH_USER_NOTES_BUFFER_SIZE 	(GFH_USER_NOTES_LENGTH + 1) * sizeof(TCHAR)
typedef TCHAR FileUserNotes [GFH_USER_NOTES_BUFFER_SIZE];

/* Size of copyright notice */

#define GFH_NOTICE_SIZE 	32
typedef char FileCopyrightNotice [GFH_NOTICE_SIZE];

/*	Room reserved for use by the desktop. Currently unused. */

#define FILE_DESKTOP_INFO_SIZE 	16
typedef char FileDesktopInfo [FILE_DESKTOP_INFO_SIZE];

/*	Password bound to the file (FEA_PASSWORD). Currently unused. Not
 *	likely to be returned in cleartext...null-terminated unless array
 *	is full... */

#define FILE_PASSWORD_SIZE 	8
typedef char FilePassword [FILE_PASSWORD_SIZE];

/*	The name of the owner of a file (FEA_OWNER). Supported primarily by
 *	network filesystem drivers. Null-terminated in the PC/GEOS character
 *	set. */

#define FILE_OWNER_NAME_SIZE 	16
typedef char FileOwnerName [FILE_OWNER_NAME_SIZE];

/*	The access rights for the file (FEA_RIGHTS), either overall (e.g.
 *	for NFS) or for the current user (e.g. for novell). Supported primarily
 *	by network filesystem drivers. Null-terminated in the PC/GEOS character
 *	set in a format that's appropriate to the filesystem. */

#define FILE_RIGHTS_SIZE 	16
typedef char FileAccessRights [FILE_RIGHTS_SIZE];

/*	Data for FEA_PATH_INFO */

typedef word	DirPathInfo	;
#define DPI_EXISTS_LOCALLY 		0x8000
#define DPI_ENTRY_NUMBER_IN_PATH 	0x7f00
#define DPI_ENTRY_NUMBER_IN_PATH_OFFSET 	8
#define DPI_STD_PATH 			0x00ff
#define DPI_STD_PATH_OFFSET 		0

typedef WordFlags FileOpenAndReadFlags ;
#define FOARF_ADD_CRLF 	    	    	0x8000
#define FOARF_ADD_EOF 	    	    	0x4000
#define FOARF_NULL_TERMINATE 	    	0x2000

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal FileCreateDir (const char *name);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal FileDeleteDir (const char *name);

/***/

extern void
    _pascal FilePushDir (void);

/***/

extern void
    _pascal FilePopDir (void);

/***/

extern DiskHandle	/*XXX*/
    _pascal FileGetCurrentPath (char *buffer, word bufferSize);

/***/

extern ChunkHandle  	/*XXX*/
    _pascal FileGetCurrentPathIDs (MemHandle block);

/***/

extern void
    _pascal FileEnableOpenCloseNotification (void);

extern void
    _pascal FileDisableOpenCloseNotification (void);

/***/

extern void
    _pascal FileBatchChangeNotifications (void);

extern void
    _pascal FileFlushChangeNotifications (void);

/***/

extern DiskHandle			/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal FileSetCurrentPath (DiskHandle disk, const char *path);

/***/

extern FileHandle			/* Sets value for ThreadGetError() */
    _pascal FileOpen (const char *name, FileAccessFlags flags);

/***/

#define FILE_CREATE_TRUNCATE  (0 << 8)
#define FILE_CREATE_NO_TRUNCATE  (1 << 8)
#define FILE_CREATE_ONLY  (2 << 8)

typedef WordFlags FileCreateFlags ;

#define FCF_NATIVE   	    	    0x8000
#define FCF_NATIVE_WITH_EXT_ATTRS    0x4000
#define FCF_MODE     	    	    0x0300	/* Filled with FILE_CREATE_*
                         * constant */
#define FCF_ACCESS   	    	    0x00ff	/* Filled with FileAccessFlags*/

extern FileHandle			/* Sets value for ThreadGetError() */
    _pascal FileCreate (const char *name, FileCreateFlags flags, FileAttrs attributes);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */

    _pascal FileClose (FileHandle fh, Boolean noErrorFlag);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal FileCommit (FileHandle fh, Boolean noErrorFlag);

/***/

extern FileHandle			/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal FileCreateTempFile (const char *dir,
                   FileCreateFlags flags,
                   FileAttrs attributes);
/***/

extern word	    	/* Returns error and sets value for ThreadGetError() */
    _pascal FileDelete (const char *name);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal FileRename (const char *oldName, const char *newame);

/***/

extern word				/* Sets value for ThreadGetError() */
    _pascal FileRead (FileHandle fh, void *buf, word count, Boolean noErrorFlag);

/***/

extern word				/* Sets value for ThreadGetError() */
    _pascal FileWrite (FileHandle fh, const void *buf, word count, Boolean noErrorFlag);

/***/

typedef ByteEnum FilePosMode ;
#define FILE_POS_START  0
#define FILE_POS_RELATIVE  1
#define FILE_POS_END  2

extern dword				/* Sets value for ThreadGetError() */
    _pascal FilePos (FileHandle fh, dword posOrOffset, FilePosMode mode);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal FileTruncate (FileHandle fh, dword offset, Boolean noErrorFlag);

/***/

extern dword	/*XXX*/
    _pascal FileSize (FileHandle fh);

/***/

/* Masks & offsets for FileTime values */
typedef WordFlags FileTime ;
#define FT_HOUR 		        0xf800
#define FT_MINUTE 		0x07e0
#define FT_2SECOND 		0x001f
#define FT_HOUR_OFFSET 	        11
#define FT_MINUTE_OFFSET 	5
#define FT_2SECOND_OFFSET 	0

/* Masks & offsets for FileDate values */
typedef WordFlags FileDate ;
#define FD_YEAR 		        0xfe00
#define FD_MONTH 		0x01e0
#define FD_DAY                   0x001f
#define FD_YEAR_OFFSET 	        9
#define FD_MONTH_OFFSET 	        5
#define FD_DAY_OFFSET 		0

/* Masks & offsets for FileDateAndTime values */
typedef DWordFlags FileDateAndTime ;
#define FDAT_HOUR 		0xf8000000
#define FDAT_MINUTE 		0x07e00000
#define FDAT_2SECOND 		0x001f0000
#define FDAT_YEAR 		0x0000fe00
#define FDAT_MONTH 		0x000001e0
#define FDAT_DAY 		0x0000001f

#define FDAT_HOUR_OFFSET 	27
#define FDAT_MINUTE_OFFSET 	21
#define FDAT_2SECOND_OFFSET 	16
#define FDAT_YEAR_OFFSET 	9
#define FDAT_MONTH_OFFSET 	5
#define FDAT_DAY_OFFSET 		0

#define FDAT_BASE_YEAR 		1980

/* Macros for extracting fields from FileDateAndTime values */

#define FDATExtractHour (fdat) /* XXX */		\
    ((byte) (((fdat) & FDAT_HOUR) >> FDAT_HOUR_OFFSET))

#define FDATExtractMinute (fdat) /* XXX */	\
    ((byte) (((fdat) & FDAT_MINUTE) >> FDAT_MINUTE_OFFSET))

#define FDATExtract2Second (fdat) /* XXX */	\
    ((byte) (((fdat) & FDAT_2SECOND) >> FDAT_2SECOND_OFFSET))

#define FDATExtractSecond (fdat) /* XXX */	\
    (FDATExtract2Second(fdat) << 1)

#define FDATExtractYear (fdat) /* XXX */		\
    ((byte) (((fdat) & FDAT_YEAR) >> FDAT_YEAR_OFFSET))

#define FDATExtractYearAD (fdat) /* XXX */	\
    (((word) FDATExtractYear(fdat)) + FDAT_BASE_YEAR)

#define FDATExtractMonth (fdat) /* XXX */	\
    ((byte) (((fdat) & FDAT_MONTH) >> FDAT_MONTH_OFFSET))

#define FDATExtractDay (fdat) /* XXX */		\
     ((byte) (((fdat) & FDAT_DAY) >> FDAT_DAY_OFFSET))

extern FileDateAndTime		/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal FileGetDateAndTime (FileHandle fh);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal FileSetDateAndTime (FileHandle fh, FileDateAndTime dateAndTime);

/***/

extern FileHandle			/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal FileDuplicateHandle (FileHandle fh);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal FileLockRecord (FileHandle fh, dword filePos, dword regLength);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal FileUnlockRecord (FileHandle fh, dword filePos, dword regLength);

/***/

extern DiskHandle			/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal FileGetDiskHandle (FileHandle fh);

/***/

extern FileAttrs			/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal FileGetAttributes (const char *path);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal FileSetAttributes (const char *path, FileAttrs attr);

/***/
extern word    /* Returns error and sets value for ThreadGetError() */ /*XXX*/
    _pascal FileGetPathExtAttributes (const char *path, FileExtendedAttribute attr,
                 void *buffer, word bufSize);

extern word    /* Returns error and sets value for ThreadGetError() */ /*XXX*/
    _pascal FileGetHandleExtAttributes (FileHandle fh, FileExtendedAttribute attr,
                   void *buffer, word bufSize);

extern MemHandle  /* Sets value for ThreadGetError() */  /*XXX*/
    _pascal FileGetHandleAllExtAttributes (FileHandle fh, word *numExtAttrs);

extern word    /* Returns error and sets value for ThreadGetError() */ /*XXX*/
    _pascal FileSetPathExtAttributes (const char *path, FileExtendedAttribute attr,
                 const void *buffer, word bufSize);

extern word    /* Returns error and sets value for ThreadGetError() */ /*XXX*/
    _pascal FileSetHandleExtAttributes (FileHandle fh, FileExtendedAttribute attr,
                   const void *buffer, word bufSize);

/***/

typedef enum /* word */ {
    SP_NOT_STANDARD_PATH    =0,
    SP_TOP    =1,
    SP_APPLICATION    =3,
    SP_DOCUMENT    =5,
    SP_SYSTEM    =7,
    SP_PRIVATE_DATA    =9,
    SP_STATE    =11,
    SP_FONT    =13,
    SP_SPOOL    =15,
    SP_SYS_APPLICATION    =17,
    SP_USER_DATA    =19,
    SP_MOUSE_DRIVERS    =21,
    SP_PRINTER_DRIVERS    =23,
    SP_FILE_SYSTEM_DRIVERS    =25,
    SP_VIDEO_DRIVERS    =27,
    SP_SWAP_DRIVERS    =29,
    SP_KEYBOARD_DRIVERS    =31,
    SP_FONT_DRIVERS    =33,
    SP_IMPORT_EXPORT_DRIVERS    =35,
    SP_TASK_SWITCH_DRIVERS    =37,
    SP_HELP_FILES    =39,
    SP_TEMPLATE    =41,
    SP_POWER_DRIVERS    =43,
    SP_DOS_ROOM    =45,
    SP_HWR    =47,
    SP_WASTE_BASKET    =49,
    SP_BACKUP    =51,
    SP_PAGER_DRIVERS    =53,
    SP_DUMMY    =256
} StandardPath} ;

/*
 * The names of some standard paths have changed. For backwards
 * compatibility, the old names are defined as equal to the new ones:
 */

#define SP_TEMP_FILES  	SP_WASTE_BASKET
#define SP_PUBLIC_DATA 	SP_USER_DATA

extern void
    _pascal FileSetStandardPath (StandardPath sp);

extern void
    _pascal FileSetRootPath (DiskHandle disk);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */
    _pascal FileCopy (const char *source, const char *dest,
             DiskHandle sourceDisk, DiskHandle destDisk);

extern word		/* Returns error and sets value for ThreadGetError() */
    _pascal FileCopyLocal (const char *source, const char *dest,
              DiskHandle sourceDisk, DiskHandle destDisk);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */
    _pascal FileMove (const char *source, const char *dest,
             DiskHandle sourceDisk, DiskHandle destDisk);

extern word		/* Returns error and sets value for ThreadGetError() */
    _pascal FileMoveLocal (const char *source, const char *dest,
              DiskHandle sourceDisk, DiskHandle destDisk);

/***/

extern StandardPath	/*XXX*/
    _pascal FileParseStandardPath (DiskHandle disk, const char **path);

/***/

extern DiskHandle	/*XXX*/
    _pascal FileConstructFullPath (char **buffer, word bufSize,
                    DiskHandle disk,
                    const char *tail,
                    Boolean addDriveLetter);

/***/

typedef WordFlags FileResolveStandardPathFlags ;
#define FRSPF_ADD_DRIVE_NAME 	    0x0002
#define FRSPF_RETURN_FIRST_DIR 	    0x0001

extern DiskHandle   	/*XXX*/
    _pascal FileResolveStandardPath (char **buffer, word bufSize, const char *tail,
                FileResolveStandardPathFlags flags,
                FileAttrs *attrsPtr);
/***/

typedef ByteEnum PathCompareType ;

#define PCT_EQUAL  0
#define PCT_SUBDIR  1
#define PCT_UNRELATED  2
#define PCT_ERROR  3

extern PathCompareType
 /*XXX*/
    _pascal FileComparePaths (const char *path1,
                         DiskHandle disk1,
                         const char *path2,
                         DiskHandle disk2);

extern word
    _pascal FileCreateLink (const char *path,
                    word targetDiskHandle,
                    const char *targetPath,
                    word targetAttrsFlag);
extern DiskHandle
    _pascal FileReadLink (const char *path, const char *targetPath);

extern DiskHandle
    _pascal FileSetLinkExtraData (const char *path,
                    char *buffer,
                    word bufSize);
extern DiskHandle
    _pascal FileGetLinkExtraData (const char *path,
                    char *buffer,
                    word bufSize);
extern DiskHandle
    _pascal FileConstructActualPath (char **buffer,
                        word bufSize, DiskHandle disk,
                        const char _far *tail,
                        Boolean addDriveLetter);
extern word
    /*XXX*/
 _pascal FileCopyPathExtAttributes (const char *sourcePath,
                DiskHandle sourceDisk,
                const char *destPath,
                DiskHandle destDisk);

extern MemHandle /*XXX*/
 _pascal FileOpenAndRead (FileOpenAndReadFlags flags,
                const char _far *filename,
                FileHandle *fh);

/*
 * Various file system constants
 */

#define FILE_LONGNAME_LENGTH 		32 / sizeof(TCHAR)
#define FILE_LONGNAME_BUFFER_SIZE 	36

#define DRIVE_NAME_MAX_LENGTH 	    	32

#define DOS_DRIVE_REF_LENGTH 		3	/* B:\ */
#define DOS_STD_PATH_LENGTH 		64

#define DOS_FILE_NAME_CORE_LENGTH 	8
#define DOS_FILE_NAME_EXT_LENGTH 	3

/* Size of item without null termination */

#define DOS_NO_DOT_FILE_NAME_LENGTH 	(DOS_FILE_NAME_CORE_LENGTH + \
                    DOS_FILE_NAME_EXT_LENGTH)
#define DOS_DOT_FILE_NAME_LENGTH 	(DOS_NO_DOT_FILE_NAME_LENGTH + 1)
#define VOLUME_NAME_LENGTH 	(DOS_FILE_NAME_CORE_LENGTH + DOS_FILE_NAME_EXT_LENGTH)
#define PATH_LENGTH 		(DRIVE_NAME_MAX_LENGTH+5*(FILE_LONGNAME_LENGTH+1))

/* Size of strings with null termination */

#define DOS_NO_DOT_FILE_NAME_LENGTH_ZT 	(DOS_NO_DOT_FILE_NAME_LENGTH + 1)
#define DOS_DOT_FILE_NAME_LENGTH_ZT 	(DOS_DOT_FILE_NAME_LENGTH + 1)
#define VOLUME_NAME_LENGTH_ZT 		(VOLUME_NAME_LENGTH + 1)
#define PATH_LENGTH_ZT 			(PATH_LENGTH + 1)

/* Size to make buffers (null termination, rounded up to word size) */

#define DOS_NO_DOT_FILE_NAME_SIZE  ((DOS_NO_DOT_FILE_NAME_LENGTH_ZT+1) & 0xfffe)
#define DOS_DOT_FILE_NAME_SIZE 	((DOS_DOT_FILE_NAME_LENGTH_ZT+1) & 0xfffe)
#define VOLUME_BUFFER_SIZE 	((VOLUME_NAME_LENGTH_ZT+1) & 0xfffe)
#define PATH_BUFFER_SIZE 	((PATH_LENGTH_ZT+1) & 0xfffe) * sizeof(TCHAR)

/* Common types */

#ifdef DO_DBCS
typedef TCHAR DosNoDotFileName [DOS_NO_DOT_FILE_NAME_SIZE/2];
typedef TCHAR DosDotFileName [DOS_DOT_FILE_NAME_SIZE/2];
typedef TCHAR  FileLongName  [FILE_LONGNAME_BUFFER_SIZE/2];
typedef TCHAR  PathName  [PATH_BUFFER_SIZE/2];
typedef TCHAR VolumeName [VOLUME_BUFFER_SIZE/2];
#else
typedef char DosNoDotFileName [DOS_NO_DOT_FILE_NAME_SIZE];
typedef char DosDotFileName [DOS_DOT_FILE_NAME_SIZE];
typedef char  FileLongName  [FILE_LONGNAME_BUFFER_SIZE];
typedef char  PathName  [PATH_BUFFER_SIZE];
typedef char VolumeName [VOLUME_BUFFER_SIZE];
#endif

/*
 * Keeping these mistyped definitions for backwards compatibility only.
 * Use DOS_NO_DOT_FILE_NAME_LENGTH, DOS_DOT_FILE_NAME_LENGTH,
 * DOS_NO_DOT_FILE_NAME_LENGTH_ZT, DOS_DOT_FILE_NAME_LENGTH_ZT,
 * DOS_NO_DOT_FILE_NAME_SIZE, and DOS_DOT_FILE_NAME_SIZE instead.
 */
#define DOS_NO_DOT_DOS_FILE_NAME_LENGTH 	(DOS_FILE_NAME_CORE_LENGTH + \
                    DOS_FILE_NAME_EXT_LENGTH)
#define DOS_DOT_DOS_FILE_NAME_LENGTH 	(DOS_NO_DOT_DOS_FILE_NAME_LENGTH + 1)

#define DOS_NO_DOT_DOS_FILE_NAME_LENGTH_ZT  (DOS_NO_DOT_DOS_FILE_NAME_LENGTH + 1)
#define DOS_DOT_DOS_FILE_NAME_LENGTH_ZT 	(DOS_DOT_DOS_FILE_NAME_LENGTH + 1)

#define DOS_NO_DOT_DOS_FILE_NAME_SIZE  ((DOS_NO_DOT_DOS_FILE_NAME_LENGTH_ZT+1) & 0xfffe)
#define DOS_DOT_DOS_FILE_NAME_SIZE 	((DOS_DOT_DOS_FILE_NAME_LENGTH_ZT+1) & 0xfffe)

#ifdef __HIGHC__
pragma Alias(FileCreateDir, "FILECREATEDIR");
pragma Alias(FileDeleteDir, "FILEDELETEDIR");
pragma Alias(FilePushDir, "FILEPUSHDIR");
pragma Alias(FilePopDir, "FILEPOPDIR");
pragma Alias(FileGetCurrentPath, "FILEGETCURRENTPATH");
pragma Alias(FileSetCurrentPath, "FILESETCURRENTPATH");
pragma Alias(FileOpen, "FILEOPEN");
pragma Alias(FileCreate, "FILECREATE");
pragma Alias(FileClose, "FILECLOSE");
pragma Alias(FileCommit, "FILECOMMIT");
pragma Alias(FileCreateTempFile, "FILECREATETEMPFILE");
pragma Alias(FileDelete, "FILEDELETE");
pragma Alias(FileRename, "FILERENAME");
pragma Alias(FileRead, "FILEREAD");
pragma Alias(FileWrite, "FILEWRITE");
pragma Alias(FilePos, "FILEPOS");
pragma Alias(FileTruncate, "FILETRUNCATE");
pragma Alias(FileSize, "FILESIZE");
pragma Alias(FileGetDateAndTime, "FILEGETDATEANDTIME");
pragma Alias(FileSetDateAndTime, "FILESETDATEANDTIME");
pragma Alias(FileDuplicateHandle, "FILEDUPLICATEHANDLE");
pragma Alias(FileLockRecord, "FILELOCKRECORD");
pragma Alias(FileUnlockRecord, "FILEUNLOCKRECORD");
pragma Alias(FileGetDiskHandle, "FILEGETDISKHANDLE");
pragma Alias(FileGetAttributes, "FILEGETATTRIBUTES");
pragma Alias(FileSetAttributes, "FILESETATTRIBUTES");
pragma Alias(FileSetStandardPath, "FILESETSTANDARDPATH");
pragma Alias(FileSetRootPath, "FILESETROOTPATH");
pragma Alias(FileCopy, "FILECOPY");
pragma Alias(FileCopyLocal, "FILECOPYLOCAL");
pragma Alias(FileMove, "FILEMOVE");
pragma Alias(FileMoveLocal, "FILEMOVELOCAL");
pragma Alias(FileParseStandardPath, "FILEPARSESTANDARDPATH");
pragma Alias(FileConstructFullPath, "FILECONSTRUCTFULLPATH");
pragma Alias(FileResolveStandardPath, "FILERESOLVESTANDARDPATH");
pragma Alias(FileConstructActualPath, "FILECONSTRUCTACTUALPATH");
pragma Alias(FileGetPathExtAttributes, "FILEGETPATHEXTATTRIBUTES");
pragma Alias(FileGetHandleExtAttributes, "FILEGETHANDLEEXTATTRIBUTES");
pragma Alias(FileGetHandleAllExtAttributes, "FILEGETHANDLEALLEXTATTRIBUTES");
pragma Alias(FileSetPathExtAttributes, "FILESETPATHEXTATTRIBUTES");
pragma Alias(FileSetHandleExtAttributes, "FILESETHANDLEEXTATTRIBUTES");
pragma Alias(FileComparePaths, "FILECOMPAREPATHS");
pragma Alias(FileCreateLink, "FILECREATELINK");
pragma Alias(FileReadLink, "FILEREADLINK");
pragma Alias(FileSetLinkExtraData, "FILESETLINKEXTRADATA");
pragma Alias(FileGetLinkExtraData, "FILEGETLINKEXTRADATA");
pragma Alias(FileCopyPathExtAttributes, "FILECOPYPATHEXTATTRIBUTES");
pragma Alias(FileEnableOpenCloseNotification, "FILEENABLEOPENCLOSENOTIFICATION");
pragma Alias(FileDisableOpenCloseNotification, "FILEDISABLEOPENCLOSENOTIFICATION");
pragma Alias(FileBatchChangeNotifications, "FILEBATCHCHANGENOTIFICATIONS");
pragma Alias(FileFlushChangeNotifications, "FILEFLUSHCHANGENOTIFICATIONS");
pragma Alias(FileGetCurrentPathIDs, "FILEGETCURRENTPATHIDS");
pragma Alias(FileOpenAndRead, "FILEOPENANDREAD");
#endif

#endif


Mailbox\filedd.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1994 -- All Rights Reserved
 *
 * PROJECT:	  Clavin
 * MODULE:	  File Data Driver
 * FILE:	  filedd.h
 *
 * AUTHOR:  	  Chung Liu: Nov 21, 1994
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	CL	11/21/94   	Initial version
 *
 * DESCRIPTION:
 *	Interface for File Data Driver
 *
 *
 * 	$Id: filedd.h,v 1.1.9.1 96/04/28 08:33:17 chris Exp $
 *
 ***********************************************************************/
#ifndef _FILEDD_H_
#define _FILEDD_H_

typedef struct {
    DiskHandle FAR_diskHandle;
 /* label char *FAR_filename */
} FileDDAppRef} ;

typedef struct {
    DiskHandle FMAR_diskHandle;
    PathName   FMAR_filename;
} FileDDMaxAppRef} ;

#endif /* _FILEDD_H_ */


fileEnum.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	fileEnum.h
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines structures and routines for FileEnum.
 *
 *	$Id: fileEnum.h,v 1.18.13.1 96/04/28 08:29:48 chris Exp $
 *
 ***********************************************************************/

#ifndef	__FILE_ENUM_H
#define __FILE_ENUM_H

#include  <file.h>

/*
 *	Parameters passed to FileEnum()
 */

typedef ByteFlags FileEnumSearchFlags ;
#define FESF_DIRS    	    	0x80
#define FESF_NON_GEOS 	    	0x40
#define FESF_GEOS_EXECS 	    	0x20
#define FESF_GEOS_NON_EXECS  	0x10
#define FESF_REAL_SKIP 	    	0x08
#define FESF_CALLBACK 	    	0x04
#define FESF_LOCK_CB_DATA    	0x02
#define FESF_LEAVE_HEADER    	0x01

#define FILE_ENUM_ALL_FILE_TYPES 	(FESF_NON_GEOS|FESF_GEOS_EXECS \
                            |FESF_GEOS_NON_EXECS)

#define FE_BUFSIZE_UNLIMITED 	0xffff      /* Value for FEP_bufSize to place
                         * no limit on the number of files
                         * for which to return data */

typedef enum /* word */ {
    FESRT_COUNT_ONLY    ,
    FESRT_DOS_INFO    ,
    FESRT_NAME    ,
    FESRT_NAME_AND_ATTR
} FileEnumStandardReturnType} ;

typedef enum /* word */ {
    FESC_WILDCARD
} FileEnumStandardCallback} ;

/*
 *	Structures returned by FileEnum
 */

typedef struct {
    FileAttrs		DFIS_attributes;
    FileDateAndTime	DFIS_modTimeDate;
    dword		DFIS_fileSize;
    FileLongName	DFIS_name;
    DirPathInfo		DFIS_pathInfo;
} FEDosInfo} ;

typedef struct {
    FileAttrs	    	FENAA_attr;
    FileLongName    	FENAA_name;
} FENameAndAttr} ;

typedef struct _FileEnumCallbackData  {
    FileExtAttrDesc 	FECD_attrs[1];
} FileEnumCallbackData} ;

typedef struct _FileEnumParams  {
    FileEnumSearchFlags	FEP_searchFlags;
    FileExtAttrDesc 	*FEP_returnAttrs;
    word    	    	FEP_returnSize;
    FileExtAttrDesc 	*FEP_matchAttrs;
    word    	    	FEP_bufSize;
    word    	    	FEP_skipCount;

    PCB    (word, 		FEP_callback, (struct _FileEnumParams *params,
                     FileEnumCallbackData *fecd,
                     word frame));

    FileExtAttrDesc 	*FEP_callbackAttrs;
    dword   	    	FEP_cbData1;
    dword   	    	FEP_cbData2;
    word    	    	FEP_headerSize;
} FileEnumParams} ;

/***/

extern word				/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal FileEnum (FileEnumParams *params, MemHandle *bufCreated, word *numNoFit);

extern void *    /* NULL if attr not found */ /*XXX*/
    _pascal FileEnumLocateAttr (FileEnumCallbackData *fecd,
               FileExtendedAttribute attr,
               const char *name);   /* Only if attr is FEA_CUSTOM */

extern Boolean
    _pascal FileEnumWildcard (FileEnumCallbackData *fecd, word frame);

#ifdef __HIGHC__
pragma Alias(FileEnum, "FILEENUM");
pragma Alias(FileEnumLocateAttr, "FILEENUMLOCATEATTR");
pragma Alias(FileEnumWildcard, "FILEENUMWILDCARD");
#endif

#endif


float.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC/GEOS
 * FILE:	math.h
 * AUTHOR:	Anna Lijphart: January, 1992
 *
 * DESCRIPTION:
 *	C version of math.def.
 *
 *	$Id: float.h,v 1.12.21.1 96/04/28 08:29:00 chris Exp $
 *
 ***********************************************************************/

#ifndef	__FLOATC_GOH
#define __FLOATC_GOH

#define FPSIZE 			 	10
#define DECIMAL_EXPONENT_UPPER_LIMIT 	4932
#define DECIMAL_EXPONENT_LOWER_LIMIT 	(-4932)
#define FACTORIAL_LIMIT 			1754
#define DECIMAL_PRECISION  		18
#define SIGN_STR_LEN 	 		5
#define PAD_STR_LEN 	 		8

#define FP_DEFAULT_STACK_ELEMENTS 	25
#define FP_DEFAULT_STACK_SIZE 	(FP_DEFAULT_STACK_ELEMENTS*FPSIZE)
#define FP_MIN_STACK_ELEMENTS 	5
#define FP_MIN_STACK_SIZE    	(FP_MIN_STACK_ELEMENTS*FPSIZE)

#define	FP_NAN		    	    	0x7fff

#define MAX_DIGITS_FOR_NORMAL_NUMBERS 		DECIMAL_PRECISION
#define MAX_CHARS_FOR_COMMAS_IN_NORMAL_NUMBERS 	(DECIMAL_PRECISION / 3 + 1)
#define MAX_DIGITS_FOR_HUGE_NUMBERS 		64
#define MAX_CHARS_FOR_COMMAS_IN_HUGE_NUMBERS 	\
                (MAX_DIGITS_FOR_HUGE_NUMBERS / 3 + 1)
#define MAX_CHARS_FOR_DECIMAL_POINT 		1
#define MAX_CHARS_FOR_EXPONENT 			6
#define MAX_CHARS_FOR_PERCENATGE 		1
#define MAX_CHARS_FOR_NULL_TERM 			1

#define MAX_CHARS_FOR_FORMAT_STUFF_IN_NORMAL_NUMBERS 	 \
    (SIGN_STR_LEN * 2 + \
     PAD_STR_LEN * 2 + \
     MAX_CHARS_FOR_COMMAS_IN_NORMAL_NUMBERS + \
     MAX_CHARS_FOR_DECIMAL_POINT + \
     MAX_CHARS_FOR_EXPONENT + \
     MAX_CHARS_FOR_PERCENATGE)

#define MAX_CHARS_FOR_FORMAT_STUFF_IN_HUGE_NUMBERS 	 \
    (SIGN_STR_LEN * 2 + \
     PAD_STR_LEN * 2 + \
     MAX_CHARS_FOR_COMMAS_IN_HUGE_NUMBERS + \
     MAX_CHARS_FOR_DECIMAL_POINT + \
     MAX_CHARS_FOR_EXPONENT + \
     MAX_CHARS_FOR_PERCENATGE)

#define MAX_CHARS_FOR_NORMAL_NUMBER 	 \
    (MAX_DIGITS_FOR_NORMAL_NUMBERS + \
     DECIMAL_PRECISION + \
     MAX_CHARS_FOR_FORMAT_STUFF_IN_NORMAL_NUMBERS + \
     MAX_CHARS_FOR_NULL_TERM)

#define MAX_CHARS_FOR_HUGE_NUMBER 	\
    (MAX_DIGITS_FOR_HUGE_NUMBERS + \
     MAX_CHARS_FOR_FORMAT_STUFF_IN_HUGE_NUMBERS + \
     MAX_CHARS_FOR_NULL_TERM)

#define FLOAT_TO_ASCII_NORMAL_BUF_LEN 	\
    (((MAX_CHARS_FOR_NORMAL_NUMBER + 1) / 2) * 2)

#define FLOAT_TO_ASCII_HUGE_BUF_LEN 	\
    (((MAX_CHARS_FOR_HUGE_NUMBER + 1) / 2) * 2)

#define YEAR_LENGTH 	365
#define YEAR_MAX 	2099
#define YEAR_MIN 	1900
#define MONTH_MAX 	12
#define MONTH_MIN 	1
#define DAY_MAX 		31
#define DAY_MIN 		1

#define HOUR_MAX 	23
#define HOUR_MIN 	0
#define MINUTE_MAX 	59
#define MINUTE_MIN 	0
#define SECOND_MAX 	59
#define SECOND_MIN 	0

#define DATE_NUMBER_MIN 		1
#define DATE_NUMBER_MAX 		73049

/*
 *	FloatExponent	record
 */
typedef WordFlags FloatExponent ;
#define	FE_SIGN			0x8000
#define	FE_EXPONENT		0x7fff

typedef struct {
    word	F_mantissa_wd0;
    word	F_mantissa_wd1;
    word	F_mantissa_wd2;
    word	F_mantissa_wd3;
    FloatExponent	F_exponent;
} FloatNum} ;
/*
 * This is just used for C stubs needed to have formal parameters
 * of 64 bits, the mantissa is bits 0-52 and exponent is 53-64
 */
typedef struct {
    word 	IEEE64F_word1;
    word 	IEEE64F_word2;
    word 	IEEE64F_word3;
    word 	IEEE64F_word4;
} IEEE64FloatNum} ;

typedef double IEEE64Number ;
typedef long double FloatNumber ;
/*
 *	FloatAsciiToFloatFlags	record
 */
typedef ByteFlags FloatAsciiToFloatFlags ;
#define	FAF_PUSH_RESULT			0x02
#define	FAF_STORE_NUMBER		0x01

/*
 * FloatFloatToAsciiFormatFlags	record
 */
typedef WordFlags FloatFloatToAsciiFormatFlags ;
#define	FFAF_FLOAT_RESERVED				0x8000
#define	FFAF_FROM_ADDR					0x4000
#define	FFAF_DONT_USE_SCIENTIFIC			0x0200
#define	FFAF_SCIENTIFIC					0x0100
#define	FFAF_PERCENT					0x0080
#define	FFAF_USE_COMMAS					0x0040
#define	FFAF_NO_TRAIL_ZEROS				0x0020
#define	FFAF_NO_LEAD_ZERO				0x0010
#define	FFAF_HEADER_PRESENT				0x0008
#define	FFAF_TRAILER_PRESENT				0x0004
#define	FFAF_SIGN_CHAR_TO_FOLLOW_HEADER			0x0002
#define	FFAF_SIGN_CHAR_TO_PRECEDE_TRAILER		0x0001

typedef	struct {
    FloatFloatToAsciiFormatFlags	formatFlags;
    byte	decimalOffset;
    byte	totalDigits;
    byte	decimalLimit;
    char	preNegative[SIGN_STR_LEN+1];
    char	postNegative[SIGN_STR_LEN+1];
    char	prePositive[SIGN_STR_LEN+1];
    char	postPositive[SIGN_STR_LEN+1];
    char	header[PAD_STR_LEN+1];
    char	trailer[PAD_STR_LEN+1];
    byte	FFTAP_unused;
} FloatFloatToAsciiParams} ;

typedef struct {
    FloatFloatToAsciiParams	FFA_params;
    word			FFA_startNumber;
    word			FFA_decimalPoint;
    word			FFA_endNumber;
    word			FFA_numChars;
    word			FFA_startExponent;
    word			FFA_bufSize;
    word			FFA_saveDI;
    word			FFA_numSign;
    byte			FFA_startSigCount;
    byte			FFA_sigCount;
    byte			FFA_noMoreSigInfo;
    byte			FFA_startDecCount;
    byte			FFA_decCount;
    word			FFA_decExponent;
    word			FFA_curExponent;
    byte			FFA_useCommas;
    byte			FFA_charsToComma;
    char			FFA_commaChar;
    char			FFA_decimalChar;
} FloatFloatToAsciiData} ;

/*
 *	FloatFloatToDateTimeFlags	record
 */
typedef WordFlags FloatFloatToDateTimeFlags ;
#define	FFDT_DATE_TIME_OP		0x8000
#define	FFDT_FROM_ADDR			0x4000
#define	FFDT_FORMAT			0x3fff

typedef	struct {
    FloatFloatToDateTimeFlags	FFA_dateTimeFlags;
    word	FFA_year;
    byte	FFA_month;
    byte	FFA_day;
    byte	FFA_weekday;
    byte	FFA_hours;
    byte	FFA_minutes;
    byte	FFA_seconds;
} FloatFloatToDateTimeParams} ;

typedef struct {
    FloatFloatToDateTimeParams	FFA_dateTimeParams;
} FloatFloatToDateTimeData} ;

typedef union {
    FloatFloatToAsciiData	FFA_float;
    FloatFloatToDateTimeData	FFA_dateTime;
} FFA_stackFrame} ;

typedef union {
    FloatFloatToAsciiParams		FFAP_FLOAT;
    FloatFloatToDateTimeParams	FFAP_DATE_TIME;
} FloatFloatToAsciiParams_Union} ;

/*
 *	RandomGenInitFlags	record
 */
typedef ByteFlags RandomGenInitFlags ;
#define	RGIF_USE_SEED			0x80
#define	RGIF_GENERATE_SEED		0x40

#define	FLOAT_ERROR_CODES_ENUM_START		250

typedef ByteEnum FloatErrorType ;
#define FLOAT_POS_INFINITY    FLOAT_ERROR_CODES_ENUM_START
#define FLOAT_NEG_INFINITY  1
#define FLOAT_GEN_ERR  2

typedef ByteEnum    FloatStackType    ;
#define FLOAT_STACK_GROW  0
#define FLOAT_STACK_WRAP  1
#define FLOAT_STACK_ERROR  2

/****************************************************
         Initialization and shutdown routines
*****************************************************/
extern void _pascal FloatInit (word stackSize, FloatStackType stackType);
extern void _pascal FloatExit (void);

/*****************************************************
      comparison routines
******************************************************/
extern word _pascal FloatComp (void);
extern word _pascal FloatCompAndDrop (void);
extern word _pascal FloatCompESDI (FloatNum *);
extern word _pascal FloatEq0 (void);
extern word _pascal FloatLt0 (void);
extern word _pascal FloatGt0 (void);

/****************************************************
          stack manipulation routines
*****************************************************/
extern word _pascal FloatPushNumber (FloatNum *number);
extern word _pascal FloatPopNumber (FloatNum *number);
extern void _pascal FloatRoll (word num);
extern void _pascal FloatRollDown (word num);
extern void _pascal FloatPick (word num);
extern void _pascal FloatSwap (void);
extern void _pascal FloatOver (void);
extern void _pascal FloatSetStackPointer (word newValue);
extern int _pascal FloatGetStackPointer (void);

/***************************************************************
  conversion routines to and from different formats of numbers

  Geos80 : same as standard IEEE 80 bit format floatint point
  Float  : same as Geos80
  IEEE64 : standard 64 bit format floating point
  IEEE32 : standard 32 bit format floating point
  Dword  : 64 bit signed integer
  Word   : 32 bit signed integer
  (to go from FloatToWord just use FloatToDword and take low 32 bits)
****************************************************************/
extern void _pascal FloatGeos80ToIEEE64 (double *num);
extern void _pascal FloatGeos80ToIEEE32 (float *num);
extern void _pascal FloatIEEE64ToGeos80 (double *num);
extern void _pascal FloatIEEE32ToGeos80 (float *num);
extern void _pascal FloatDwordToFloat (long num);
extern void _pascal FloatWordToFloat (int num);
extern long _pascal FloatFloatToDword (void);

/******************************************************
          useful constants
*******************************************************/
extern void _pascal Float0 (void);
extern void _pascal Float1 (void);
extern void _pascal FloatMinus1 (void);
extern void _pascal FloatMinusPoint5 (void);
extern void _pascal FloatPoint5 (void);
extern void _pascal Float2 (void);
extern void _pascal Float5 (void);
extern void _pascal Float10 (void);
extern void _pascal Float3600 (void);
extern void _pascal Float16384 (void);
extern void _pascal Float86400 (void);
extern void _pascal FloatPi (void);
extern void _pascal FloatPiDiv2 (void);

/********************************************************
          miscellaneous math routines
*********************************************************/
extern void _pascal FloatAbs (void);
extern void _pascal FloatAdd (void);
extern void _pascal FloatArcCos (void);
extern void _pascal FloatArcCosh (void);
extern void _pascal FloatArcSin (void);
extern void _pascal FloatArcSinh (void);
extern void _pascal FloatArcTan (void);
extern void _pascal FloatArcTan2 (void);
extern void _pascal FloatArcTanh (void);
extern void _pascal FloatCos (void);
extern void _pascal FloatCosh (void);
extern void _pascal FloatDepth (void);
extern void _pascal FloatDIV (void);
extern void _pascal FloatDivide (void);
extern void _pascal FloatDivide2 (void);
extern void _pascal FloatDivide10 (void);
extern void _pascal FloatDrop (void);
extern void _pascal FloatDup (void);
extern void _pascal FloatExp (void);
extern void _pascal FloatExponential (void);
extern void _pascal FloatFactorial (void);
extern void _pascal FloatFrac (void);
extern void _pascal FloatInt (void);
extern void _pascal FloatIntFrac (void);
extern void _pascal FloatInverse (void);
extern void _pascal FloatLg (void);
extern void _pascal FloatLg10 (void);
extern void _pascal FloatLn (void);
extern void _pascal FloatLn1plusX (void);
extern void _pascal FloatLn2 (void);
extern void _pascal FloatLn10 (void);
extern void _pascal FloatLog (void);
extern void _pascal FloatMax (void);
extern void _pascal FloatMin (void);
extern void _pascal FloatMod (void);
extern void _pascal FloatMultiply (void);
extern void _pascal FloatMultiply2 (void);
extern void _pascal FloatMultiply10 (void);
extern void _pascal FloatNegate (void);
extern void _pascal FloatRandom (void);
extern void _pascal FloatRandomize (void);
extern void _pascal FloatRandomN (void);
extern void _pascal FloatRot (void);
extern void _pascal FloatRound (byte numDecimalPlaces);
extern void _pascal FloatSin (void);
extern void _pascal FloatSinh (void);
extern void _pascal FloatSqr (void);
extern void _pascal FloatSqrt (void);
extern void _pascal FloatSqrt2 (void);
extern void _pascal FloatSub (void);
extern void _pascal FloatTan (void);
extern void _pascal FloatTanh (void);
extern void _pascal Float10ToTheX (void);
extern void _pascal FloatTrunc (void);
extern void _pascal FloatEpsilon  (void);

/********************************************************
          number string routines
*********************************************************/
extern Boolean 	/* XXX */
    _pascal FloatAsciiToFloat (word floatAtoFflags, word stringLength,
                void *string, void *resultLocation);
extern word /* XXX */
    _pascal FloatFloatToAscii_StdFormat (char *string, FloatNum *number,
                FloatFloatToAsciiFormatFlags format,
                word numDigits, word numFractionalDigits);

extern word /* XXX */
    _pascal FloatFloatToAscii (FFA_stackFrame *stackFrame, char *resultString,
                FloatNum *number);

extern word /* XXX */
    _pascal FloatFloatIEEE64ToAscii_StdFormat (char *string, IEEE64FloatNum number,
                FloatFloatToAsciiFormatFlags format,
                word numDigits, word numFractionalDigits);

extern void _pascal FloatTimeNumberGetSeconds (void);
extern word	/*XXX*/
    _pascal FloatStringGetDateNumber (char *dateString);
extern word	/*XXX*/
    _pascal FloatStringGetTimeNumber (char *timeString);
extern byte _pascal FloatGetDaysInMonth (word year, byte month);
extern void _pascal FloatTimeNumberGetMinutes (void);
extern void _pascal FloatTimeNumberGetHour (void);
extern FloatErrorType _pascal FloatGetDateNumber (word year, byte month, byte day);
extern FloatErrorType
        _pascal FloatGetTimeNumber (byte hours, byte minutes, byte seconds);
extern void _pascal FloatDateNumberGetWeekday (void);
extern word _pascal FloatDateNumberGetYear (void);
extern void _pascal FloatDateNumberGetMonthAndDay (byte *month, byte *day);
extern word _pascal FloatGetNumDigitsInIntegerPart (void);

#ifdef __HIGHC__
pragma Alias(Float0, "FLOAT0");
pragma Alias(Float1, "FLOAT1");
pragma Alias(FloatAsciiToFloat, "FLOATASCIITOFLOAT");
pragma Alias(FloatComp, "FLOATCOMP");
pragma Alias(FloatCompAndDrop, "FLOATCOMPANDDROP");
pragma Alias(FloatCompESDI, "FLOATCOMPESDI");
pragma Alias(FloatEq0, "FLOATEQ0");
pragma Alias(FloatExit, "FLOATEXIT");
pragma Alias(FloatFloatIEEE64ToAscii_StdFormat,
         "FLOATFLOATIEEE64TOASCII_STDFORMAT");
pragma Alias(FloatFloatToAscii, "FLOATFLOATTOASCII");
pragma Alias(FloatFloatToAscii_StdFormat, "FLOATFLOATTOASCII_STDFORMAT");
pragma Alias(FloatInit, "FLOATINIT");
pragma Alias(FloatPopNumber, "FLOATPOPNUMBER");
pragma Alias(FloatPushNumber, "FLOATPUSHNUMBER");
pragma Alias(FloatRound, "FLOATROUND");
pragma Alias(FloatStringGetDateNumber, "FLOATSTRINGGETDATENUMBER");
pragma Alias(FloatStringGetTimeNumber, "FLOATSTRINGGETTIMENUMBER");
pragma Alias(FloatMinus1, "FLOATMINUS1");
pragma Alias(FloatMinusPoint5, "FLOATMINUSPOINT5");
pragma Alias(FloatPoint5, "FLOATPOINT5");
pragma Alias(Float2, "FLOAT2");
pragma Alias(Float5, "FLOAT5");
pragma Alias(Float10, "FLOAT10");
pragma Alias(Float3600, "FLOAT3600");
pragma Alias(Float16384, "FLOAT16384");
pragma Alias(Float86400, "FLOAT86400");
pragma Alias(FloatAbs, "FLOATABS");
pragma Alias(FloatAdd, "FLOATADD");
pragma Alias(FloatArcCos, "FLOATARCCOS");
pragma Alias(FloatArcCosh, "FLOATARCCOSH");
pragma Alias(FloatArcSin, "FLOATARCSIN");
pragma Alias(FloatArcSinh, "FLOATARCSINH");
pragma Alias(FloatArcTan, "FLOATARCTAN");
pragma Alias(FloatArcTan2, "FLOATARCTAN2");
pragma Alias(FloatArcTanh, "FLOATARCTANH");
pragma Alias(FloatCos, "FLOATCOS");
pragma Alias(FloatCosh, "FLOATCOSH");
pragma Alias(FloatDepth, "FLOATDEPTH");
pragma Alias(FloatDIV, "FLOATDIV");
pragma Alias(FloatDivide, "FLOATDIVIDE");
pragma Alias(FloatDivide2, "FLOATDIVIDE2");
pragma Alias(FloatDivide10, "FLOATDIVIDE10");
pragma Alias(FloatDwordToFloat, "FLOATDWORDTOFLOAT");
pragma Alias(FloatWordToFloat, "FLOATWORDTOFLOAT");
pragma Alias(FloatFloatToDword, "FLOATFLOATTODWORD");
pragma Alias(FloatDrop, "FLOATDROP");
pragma Alias(FloatDup, "FLOATDUP");
pragma Alias(FloatEpsilon, "FLOATEPSILON");
pragma Alias(FloatExp, "FLOATEXP");
pragma Alias(FloatExponential, "FLOATEXPONENTIAL");
pragma Alias(FloatFactorial, "FLOATFACTORIAL");
pragma Alias(FloatFrac, "FLOATFRAC");
pragma Alias(FloatGeos80ToIEEE64, "FLOATGEOS80TOIEEE64");
pragma Alias(FloatIEEE64ToGeos80, "FLOATIEEE64TOGEOS80");
pragma Alias(FloatGeos80ToIEEE32, "FLOATGEOS80TOIEEE32");
pragma Alias(FloatIEEE32ToGeos80, "FLOATIEEE32TOGEOS80");
pragma Alias(FloatInt, "FLOATINT");
pragma Alias(FloatIntFrac, "FLOATINTFRAC");
pragma Alias(FloatInverse, "FLOATINVERSE");
pragma Alias(FloatLg, "FLOATLG");
pragma Alias(FloatLg10, "FLOATLG10");
pragma Alias(FloatLn, "FLOATLN");
pragma Alias(FloatLn1plusX, "FLOATLN1PLUSX");
pragma Alias(FloatLn2, "FLOATLN2");
pragma Alias(FloatLn10, "FLOATLN10");
pragma Alias(FloatLog, "FLOATLOG");
pragma Alias(FloatMax, "FLOATMAX");
pragma Alias(FloatMin, "FLOATMIN");
pragma Alias(FloatMod, "FLOATMOD");
pragma Alias(FloatMultiply, "FLOATMULTIPLY");
pragma Alias(FloatMultiply2, "FLOATMULTIPLY2");
pragma Alias(FloatMultiply10, "FLOATMULTIPLY10");
pragma Alias(FloatNegate, "FLOATNEGATE");
pragma Alias(FloatOver, "FLOATOVER");
pragma Alias(FloatPi, "FLOATPI");
pragma Alias(FloatPiDiv2, "FLOATPIDIV2");
pragma Alias(FloatPick, "FLOATPICK");
pragma Alias(FloatRandom, "FLOATRANDOM");
pragma Alias(FloatRandomize, "FLOATRANDOMIZE");
pragma Alias(FloatRot, "FLOATROT");
pragma Alias(FloatSin, "FLOATSIN");
pragma Alias(FloatSinh, "FLOATSINH");
pragma Alias(FloatSqr, "FLOATSQR");
pragma Alias(FloatSqrt, "FLOATSQRT");
pragma Alias(FloatSqrt2, "FLOATSQRT2");
pragma Alias(FloatSub, "FLOATSUB");
pragma Alias(FloatSwap, "FLOATSWAP");
pragma Alias(FloatTan, "FLOATTAN");
pragma Alias(FloatTanh, "FLOATTANH");
pragma Alias(Float10ToTheX, "FLOAT10TOTHEX");
pragma Alias(FloatTrunc, "FLOATTRUNC");
pragma Alias(FloatGetStackPointer, "FLOATGETSTACKPOINTER");
pragma Alias(FloatGetDaysInMonth, "FLOATGETDAYSINMONTH");
pragma Alias(FloatTimeNumberGetHour, "FLOATTIMENUMBERGETHOUR");
pragma Alias(FloatTimeNumberGetMinutes, "FLOATTIMENUMBERGETMINUTES");
pragma Alias(FloatTimeNumberGetSeconds, "FLOATTIMENUMBERGETSECONDS");
pragma Alias(FloatGetDateNumber, "FLOATGETDATENUMBER");
pragma Alias(FloatGetTimeNumber, "FLOATGETTIMENUMBER");
pragma Alias(FloatDateNumberGetYear, "FLOATDATENUMBERGETYEAR");
pragma Alias(FloatDateNumberGetWeekday, "FLOATDATENUMBERGETWEEKDAY");
pragma Alias(FloatDateNumberGetMonthAndDay, "FLOATDATENUMBERGETMONTHANDDAY");
pragma Alias(FloatGt0, "FLOATGT0");
pragma Alias(FloatLt0, "FLOATLT0");
pragma Alias(FloatSetStackPointer, "FLOATSETSTACKPOINTER");
pragma Alias(FloatRoll, "FLOATROLL");
pragma Alias(FloatRollDown, "FLOATROLLDOWN");
pragma Alias(FloatGetNumDigitsInIntegerPart, "FLOATGETNUMDIGITSININTEGERPART");
pragma Alias(FloatRandomN, "FLOATRANDOMN");
/******************
pragma Alias(FloatGenerateFormatStr, "FLOATGENERATEFORMATSTR");
******************/
#undef abs
#undef labs
extern int _pascal abs (int __i);
extern long   _pascal labs (long);
#define abs (i) (_abs(i))
#define labs (i) (_abs(i))

extern double _pascal cabs (struct complex);   /* non-ansi versions of cabs  and hypot */
extern double _pascal hypot (double __x, double __y);
extern double _pascal atof (const char *);
extern double _pascal sin (double __x);
extern double _pascal cos (double __x);
extern double _pascal asin (double __x);
extern double _pascal acos (double __x);
extern double _pascal tan (double __x);
extern double _pascal atan (double __x);
extern double _pascal sinh (double __x);
extern double _pascal cosh (double __x);
extern double _pascal tanh (double __x);
extern double _pascal asinh (double __x);
extern double _pascal acosh (double __x);
extern double _pascal atanh (double __x);
extern double _pascal sqrt (double __x);
#endif

#endif


foam.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1994 -- All Rights Reserved

PROJECT:	GEOS
MODULE:		Foam Library
FILE:		foam.goh

AUTHOR:		Skarpi Hedinsson, Nov  9, 1994

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    SH	11/ 9/94   	Initial version.

DESCRIPTION:

    $Id: foam.goh,v 1.171.1.74 98/10/22 16:17:12 kho Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@ifndef __FOAM_GOH
@define __FOAM_GOH

@optimize
@deflib	foam

@include  <mailbox.goh>

/* ----------------------------------------------------------------------------
 *   Constants
 * --------------------------------------------------------------------------*/

/*
 *  Mailbox format ID's specific to N9000V20.  To be used along with
 *  MANUFACTURER_ID_NOKIA in the MailboxDataFormat structure.
 */

typedef enum {
    NMDFID_INVALID     = 0x0,
    NMDFID_WYSWYG_FOAM_FILE     = 0x1,		/*  FILE */
} NokiaMailboxDataFormatID} ;

#define IC_CHANGE 		11	/* comes after InteractionCommand */
#define IC_CANCEL_POPUP_LIST 	12

#define GIT_FLASHING             7    	/* comes after GenInteractionType */

typedef enum {
    FDSS_NOT_FULL     = 0x0,
    FDSS_NEARLY_FULL     = 0x2,
    FDSS_FULL     = 0x4,
} FoamDiskSpaceStatus} ;

typedef enum {
    FSA_SAVE_DATA     = 0x0,
    FSA_THROW_AWAY_CHANGES     = 0x2,
    FSA_DO_NOTHING     = 0x4,
} FoamSaveAction} ;

typedef enum {
    FDD_PRIVATE     = -0x2,
    FDD_DOCUMENT    ,
    FDD_NONE    ,
    FDD_CREATED_TEXTS    ,
    FDD_RECEIVED_FAXES    ,
    FDD_RECEIVED_SM    ,
    FDD_RECEIVED_MAIL    ,
    FDD_MESSAGE_TEMPLATES    ,
    FDD_BUSINESS_CARDS    ,
    FDD_DOWNLOADED_FILES    ,
    FDD_WWW_HOTLIST    ,
    FDD_BROADCAST_MESSAGES    ,
    FDD_INTERNET    ,
    FDD_TONES    ,
    FDD_CALENDAR_MEMOS    ,
    FDD_CONTACT_IMAGES    ,
    FDD_MMC    ,
    FDD_MMC_CONTACT_IMAGES    ,
    FDD_APP_DATA
} FDocumentDir} ;

#define FDD_RECEIVED_MAILS 	FDD_RECEIVED_MAIL

#define CONSTANT_MAX_FDD 	0x0100
/*
 * Any FDocumentDir value must be below CONSTANT_MAX_FDD because
 * FoamPathHandles use values above this.
 *
 * With N9000V20 project, we introduced sub-folders that spawn off from
 * FDocumentDir folders.  These sub-folders are created by the user,
 * which means that we cannot expect all user accessible directories
 * to be one of FDocumentDir's anymore.  So, we defined FoamPathHandle
 * type.  These handles are completely interchangeable with FDocumentDir
 * constants.
 */

typedef word FoamPathHandle ;
#define NULL_FOAM_PATH  -3

typedef enum {
    FDA_READ_WRITE     = 0x0,
    FDA_READ_ONLY     = 0x2,
    FDA_READ_ONLY_DENY_NONE     = 0x4,
} FDocAccess} ;

#define FOAM_INI_APP_DOC_PATHS  "appDocPaths"
#define FOAM_INI_LAST_DOC_PATH  "lastDocPath"
#define FOAM_INI_DOC_PATH  "docPath"

/*
 * FoamPathError types: returned by FoamPathAlloc or FoamSetDocumentDir, etc...
 */
typedef enum {
    FPE_NO_ERROR     = 0x0,		/*  everything is peachy */
    FPE_MEMORY_SHORTAGE    ,	/*  can't get memory */
    FPE_PATH_NOT_FOUND    ,		/*  someone deleted the directory */
    FPE_PATH_TABLE_FULL    ,	/*  someone forgets to free... */
    FPE_HAS_NO_PARENT    ,
    FPE_BUFFER_TOO_SMALL    ,
} FoamPathError} ;

/*
    Default settings for the notes editor (set in notebook).
*/
#define NOTES_EDITOR_INIT_CATAGORY  "notesEditor"
#define NOTES_EDITOR_DEFAULT_FONT_ID_KEY  "defaultFont"
#define NOTES_EDITOR_DEFAULT_FONT_SIZE_KEY  "defaultFontSize"
#define NOTES_EDITOR_DEFAULT_TOP_MARGIN_KEY  "defaultTopMargin"
#define NOTES_EDITOR_DEFAULT_BOTTOM_MARGIN_KEY  "defaultBottomMargin"
#define NOTES_EDITOR_DEFAULT_LEFT_MARGIN_KEY  "defaultLeftMargin"
#define NOTES_EDITOR_DEFAULT_RIGHT_MARGIN_KEY  "defaultRightMargin"

/*
 *  FEA_CREATOR token for all responder documents.
 */
#define DOCUMENT_CREATOR_TOKEN  "RDOC"

/*
 *  FEA_CREATOR token for viewer loader documents ("Document outbox" and
 *  "Remote mailbox".
 */
#define VIEWER_LIBRARY_LOADER_DOCUMENT_CREATOR_TOKEN  "VLLD"

/*
 Token and protocol numbers of a Foam notebook document.  All geodes using
 the ViewerControlClass must use the same major protocol number has the
 notes files.  ViewerControlClass checks the major protocol, if applications
 need to do their own protocol varification they can use the minor protocol.
*/
#define NOTES_FILE_TOKEN  "NOTE"
#define NOTES_FILE_MAJOR_PROTOCOL  2
#define NOTES_FILE_MINOR_PROTOCOL  0

#define SMS_FILE_TOKEN  "SMSF"
#define SMS_FILE_MAJOR_PROTOCOL  NOTES_FILE_MAJOR_PROTOCOL
#define SMS_FILE_MINOR_PROTOCOL  0

#define MEMO_FILE_TOKEN 	"MEMO"
#define MEMO_FILE_MAJOR_PROTOCOL  NOTES_FILE_MAJOR_PROTOCOL
#define MEMO_FILE_MINOR_PROTOCOL  0

#define FAX_NOTE_FILE_TOKEN  "FAXN"
#define FAX_NOTE_FILE_MAJOR_PROTOCOL  NOTES_FILE_MAJOR_PROTOCOL
#define FAX_NOTE_FILE_MINOR_PROTOCOL  0

#define OUTBOX_FILE_TOKEN  "OUTB"

/*
 *  Token for the special "Remote mailbox" file that is used to launch the
 *  remote mailbox view.  Use this token with ATTR_FILE_OPEN_EXCLUDE_FILE
 *  if you don't want the remote mailbox in your FileOpenControl.
 */
#define REMOTE_MAILBOX_FILE_TOKEN  "RMMB"

/*
 *  Token for the special "Delivery Reports" file that is used by the
 *  Mail app.
 */
#define DELIVERY_REPORTS_FILE_TOKEN  "SMSC"

#define FOAM_MAX_SMS_TEXT_SIZE  160
#define FOAM_MAX_SMS_TEXT_SIZE_WITHOUT_HEADERS  152
#define FOAM_MAX_CONCATENATED_MESSAGES  30
#define FOAM_MAX_CONCATENATED_SMS_TEXT_SIZE  (FOAM_MAX_SMS_TEXT_SIZE_WITHOUT_HEADERS*FOAM_MAX_CONCATENATED_MESSAGES)
#define FOAM_DOCUMENT_PREFIX_TEXT_SIZE  26
#define FOAM_FILE_SELECTOR_WIDTH  54

#define FOAM_DEFAULT_COMPONENT_WIDTH 	405
/*  Default width of a UI component pos */

#define FOAM_DEFAULT_BUBBLE_WIDTH  250
/*  Default width of a UI bubble */

#define FOAM_HEADER_ICON_WIDTH 		37
/*
 * Width of the Icon portion of a main screen's ComplexMoniker (plus space).
 * Children should be indented by this amount in order to be left-
 * justified with the text portion of the moniker.
 */

#define FOAM_ZOOM2_FONT_SIZE 	26	/* 150 % zoom of normal */
#define FOAM_LIGHT_ZOOM2_FONT_SIZE  25	/* light 18 pt 150% zoom */
#define FOAM_ZOOM1_FONT_SIZE 	21	/* 120 % zoom of normal */
#define FOAM_LARGE_FONT_SIZE 	20	/* titles, reply triggers */
#define FOAM_LIGHT_ZOOM1_FONT_SIZE  19	/* light 18 pt 120% zoom */
#define FOAM_NORMAL_FONT_SIZE 	18	/* normal text */
#define FOAM_LIGHT_FONT_SIZE 	17	/* light 18 pt text */
#define FOAM_SMALL_FONT_SIZE 	16	/* log data, etc. */

#define VTDS_FOAM_NORMAL 	VTDS_18
#define VTDS_FOAM_SMALL 		VTDS_12

#define VTDF_RESPONDER 		VTDF_BERKELEY

#define FOAM_BUBBLE_TITLE_FONT_SIZE 	FOAM_LARGE_FONT_SIZE
#define FOAM_TITLE_FONT_SIZE 		FOAM_LARGE_FONT_SIZE

/*
 *  Special comments placed in GStrings to allow automatic zoom
 *  conversion in lists.
 */
typedef enum {
    FZCT_INVALID     = 0x0,
    FZCT_FONT    ,
    FZCT_MOVE_TO    ,
    FZCT_CLIP_X    ,
} FoamZoomCommentType} ;

#define FOAM_ZOOM_COMMENT_MAX_LENGTH 		20
#define FOAM_ZOOM_COMMENT_MNEMONIC_LENGTH 	5

#define FOAM_ZOOM_COMMENT_FONT_LENGTH 		10
#define FOAM_ZOOM_COMMENT_FONT 			'FONT    '
/*  GrComment('FONT ttiif') */

#define FOAM_ZOOM_COMMENT_MOVE_TO_LENGTH 	18
#define FOAM_ZOOM_COMMENT_MOVE_TO 		'MOVE '
/*  GrComment('MOVE x1y1x2y2x3y3?') */

#define FOAM_ZOOM_COMMENT_CLIP_X_LENGTH 		18
#define FOAM_ZOOM_COMMENT_CLIP_X 		'CLIX '
/*  GrComment('CLIX x1x2x3x4x5x6?') */

/* Critical levels of free disk space */
#define FOAM_DISK_SPACE_NEARLY_FULL_LEVEL   	0x0000c800	/* 50K */
#define FOAM_DISK_SPACE_FULL_LEVEL 		0x00006400	/* 25K */

/*
 Names of directories under "world" used to store various applications.
*/
#define SYSAPPS_DIR_NAME  "SYSAPPS"
#define SERVICES_DIR_NAME  "SVCAPPS"
#define EXTRAS_DIR_NAME 	"EXTRAPPS"

#define MAX_COMPLEX_MONIKER_WIDTH   (FOAM_DEFAULT_COMPONENT_WIDTH-20)
#define MAX_COMPLEX_MONIKER_HEIGHT  200

#define COMPLEX_MONIKER_MAX_TOP_TEXT_LENGTH 		100
#define COMPLEX_MONIKER_MAX_BOTTOM_TEXT_LENGTH 		50

/*
 Application enum's used with FoamLaunchApplication
*/
typedef enum {
    FA_PHONE_APP     = 0x0,
    FA_FAX_APP    ,
    FA_SMS_APP    ,
    FA_SERVICES_APP    ,
    FA_CONTACT_APP    ,
    FA_NOTEBOOK_APP    ,
    FA_CALENDAR_APP    ,
    FA_SYSTEM_APP    ,
    FA_EXTRAS_APP    ,
    FA_CALCULATOR_APP    ,
    FA_CLOCK_APP    ,
    FA_USER_DATA_APP    ,
    FA_WWW_INSTALL_APP    ,
} FApplication} ;

/*
 * Flashing notes
 */
#define FLASHING_NOTE_DEFAULT_DURATION 	        (3*60) /*  3 seconds */
#define FLASHING_NOTE_DEFAULT_MINIMUM_DURATION 	(1*60) /*  1 second */

/*
 * width of indicator for Rudy to decide whether indicator should float
 * up or sink when a window comes up
 */
#define FOAM_INDICATOR_WIDTH 			80

/*
 * sound key click type, to be included by user library ""
 *
 * if there is new type, add before SKCT_THE_END
 */
typedef enum {
    SKCAT_CLICK_OFF			= 0x0,
    SKCAT_CLICK_QUIET		= 0x2,
    SKCAT_CLICK_LOUD		= 0x4,
    SKCAT_ALARM_SOUND_1		= 0x6,
    SKCAT_ALARM_SOUND_2		= 0x8,
    SKCAT_ALARM_SOUND_3		= 0xa,

} SoundKeyClickAlarmType} ;

#define FOAM_NUM_SPECIAL_SOUNDS 	6	/* six things above */
/*
 * default values to be used in user library
 */
#define FOAM_KEY_CLICK_DEFAULT  SKCAT_CLICK_QUIET
#define FOAM_ALARM_SOUND_DEFAULT  SKCAT_ALARM_SOUND_1

/*
 *  one special sound type for clock alarm
 */
#define FOAM_FCLOCK_ALARM_SOUND 		-1

/*
 *  volume levels and warning tones
 */
typedef enum {
    FVL_1     = 0x1,
    FVL_2    ,
    FVL_3    ,
    FVL_4    ,
    FVL_5    ,
} FoamVolumeLevel} ;

#define FOAM_VOLUME_LEVEL_DEFAULT 	FVL_5

typedef enum {
    FWTS_OFF     = 0x0,
    FWTS_ON    ,
} FoamWarningToneState} ;

#define FOAM_WARNING_TONE_DEFAULT 	FWTS_ON

typedef enum {
    FPCT_IR     = 0x0,
    FPCT_SERIAL    ,
    FPCT_PARALLEL    ,
} FoamPrintConnectType} ;

#define FOAM_PRINT_CONNECT_DEFAULT 	FPCT_IR

typedef enum {
    FPHS_OFF     = 0x0,
    FPHS_ON    ,
} FoamPrintHeaderState} ;

#define FOAM_PRINT_HEADER_DEFAULT 	FPHS_ON

typedef enum {
    FPPS_A4     = 0x0,
    FPPS_LETTER    ,
} FoamPrintPaperSize} ;

#define FOAM_PRINT_PAPER_SIZE_DEFAULT 	FPPS_A4

#define FOAM_PRINT_A4_WIDTH  		595
#define FOAM_PRINT_A4_HEIGHT  		842
#define FOAM_PRINT_LETTER_WIDTH 		612
#define FOAM_PRINT_LETTER_HEIGHT 	792

typedef enum {
    FPBR_9600     = 0x0,
    FPBR_19200    ,
    FPBR_57600    ,
    FPBR_115200    ,
} FoamPrintBaudRate} ;

/*
 * The FoamPrintBaudRate values never get to the .ini file, so adding
 * things in front of 9600 is fine, just update the stuff in the system app
 * (SPBRGenSaveOptions and SPBRGenLoadOptions)
 */

#define FOAM_PRINT_BAUD_RATE_DEFAULT 		FPBR_57600
#define FOAM_PRINT_BAUD_RATE_DEFAULT_INTEGER 	57600

typedef enum {
    FPFC_NONE     = 0x0,
    FPFC_SOFTWARE    ,
} FoamPrintFlowControl} ;

#define FOAM_PRINT_FLOW_CONTROL_DEFAULT 	FPFC_SOFTWARE

typedef enum {
    FPDB_SEVEN     = 0x7,
    FPDB_EIGHT    ,
} FoamPrintDataBits} ;

#define FOAM_PRINT_DATA_BITS_DEFAULT 	FPDB_EIGHT

typedef enum {
    FPP_NONE     = 0x0,
    FPP_ODD    ,
    FPP_EVEN    ,
} FoamPrintParity} ;

#define FOAM_PRINT_PARITY_DEFAULT 	FPP_NONE

typedef enum {
    FPSB_ONE     = 0x1,
    FPSB_TWO    ,
} FoamPrintStopBits} ;

#define FOAM_PRINT_STOP_BITS_DEFAULT 	FPSB_ONE

typedef enum {
    FUAT_YES     = 0x0,
    FUAT_NO    ,
} FoamUseApplicationTones} ;

#define FOAM_USE_APPLICATION_TONES_DEFAULT 	FUAT_YES

/*
 * Margin values used in Notebook and NotesEdit.
 */
#define MIN_PAGE_MARGIN  36			/* 1/2" */
#define MAX_PAGE_MARGIN  216			/* 3"   */
#define DEFAULT_PAGE_MARGIN  72		        /* 1"   */
#define PAGE_MARGIN_INCREMENT  18		/* 1/4" */

/*
 * help character. This is provided merely for convenience; read: rudy
 * does not know about this constant.
 */
#ifdef DO_DBCS
#define RUDY_HELP_CHAR 	C_SYS_INS
#else
#define RUDY_HELP_CHAR 	((word)(VC_ISCTRL << 8) | VC_BACKSPACE)
#endif

/*
 *  Backlight stuff
 */
#define DEFAULT_BACKLIGHT_LEVEL 		2	/* level, not actual time */
#define MINIMUM_BACKLIGHT_LEVEL 		0
#define MAXIMUM_BACKLIGHT_LEVEL 		7

/*
 *  Delta time stuff
 */
typedef enum {
    ANT_minutes	 = 0x0,
    ANT_hours	 = 0x1,
    ANT_days	 = 0x2
} AdvanceNoticeType} ;

/* ----------------------------------------------------------------------------
 *   Structures
 * --------------------------------------------------------------------------*/

typedef	struct {
    FileLongName DI_docName;
    /* Document name */
    FDocumentDir DI_docDir;
    /* Document directory */
} DocumentInfo} ;

typedef struct {
    GeodeToken	FAI_token;		/*  token of file */
    ProtocolNumber FAI_protocol;	/*  protocol number of file */
} FileAttrInfo} ;

typedef TCHAR DocumentPrefix [FOAM_DOCUMENT_PREFIX_TEXT_SIZE+1];
typedef hptr DocumentHandle ;

/* enum FoamDocHeader */
typedef enum {
    FDH_TEXT_TR_ITEM     = 0x0,
    FDH_ADDRESS_INFO     = 0x2,
    FDH_HANDLE1     = 0x4,
    FDH_HANDLE2     = 0x6,
    FDH_HANDLE3     = 0x8,
    FDH_HANDLE4     = 0xa,
    FDH_HANDLE5     = 0xc,
} FoamDocHeader} ;

/*
 *  Passed to FoamDocTextSetFormatted to mark the document as containing
 *  formatted or not formatted text.
 */
typedef enum {
    FDTF_NOT_FORMATTED     = 0x0,
    FDTF_FORMATTED    ,
} FoamDocTextFormatted} ;

/*
 FoamDocHeader stores various information about the document, like margins.
*/
typedef struct {
/* points*8 */
    word	FDS_leftMargin;
/* points*8 */
    word	FDS_topMargin;
/* points*8 */
    word	FDS_rightMargin;
/* points*8 */
    word	FDS_bottomMargin;
} FoamDocSettings} ;

/*
 FoamDocMapBlock is the structure stored in the mapblock of a Foam
 document file.
*/
typedef struct {
    word FDMB_textTrItem;
    word FDMB_addressInfo;
    word FDMB_handle1;
    word FDMB_handle2;
    word FDMB_handle3;
    word FDMB_handle4;
    word FDMB_handle5;
    FoamDocSettings FDMB_docSettings;
} FoamDocMapBlock} ;

#define EVENT_TEXT_STRING_SIZE  40
typedef TCHAR EventTextString [EVENT_TEXT_STRING_SIZE];

typedef struct {
    TCHAR ILEP_singularText[EVENT_TEXT_STRING_SIZE];
    TCHAR ILEP_pluralText[EVENT_TEXT_STRING_SIZE];
} IndicatorLogEventParams} ;

typedef ByteFlags ColumnBorder ;
#define CB_LEFT 	 (0x80)
#define CB_RIGHT  (0x40)

/*
 *  Structure to be used in CreateVisMoniker.
 *  The structure defines the string to be used in creating
 *  VisMonikers. A few attributes can be defined for each string in any
 *  column.
 */
typedef struct {
    byte 		VMC_width;   /* Width of text in chars, 0 if bitmap */
    const void * 	VMC_ptr;     /* Pointer to text or bitmap */
    Justification 	VMC_just;    /* How to justify the column text */
    TextStyle 	VMC_style;   /* Column text styles */
    ColumnBorder    VMC_border;  /* Draw vertical border */
} VisMonikerColumn} ;

/*
 *  Placed in vardata by flashing note
 */
typedef struct {
    word	FNTD_timerID;
    word	FNTD_timerHandle;
} FlashingNoteTimerData} ;

/*
 *  Returned by FoamDocIsTextFormatted
 */
typedef struct {
    FontID	DFI_font;
    word	DFI_pointSize;
} DocumentFontInfo} ;

/*
 * These correspond to [readerApps] in the .ini file. Sample .ini file entry:
 *
 *	[readerApps]
 *	app0 = SMSA0		; SMS App (TokenChar w/ ManufacturerID)
 *	app0_dir = 3		; FDD_RECEIVED_SM
 *	app2 = MAIL11		; Mail App
 *	app2_dir = 4		; FDD_RECEIVED_MAIL
 */
typedef enum {
    FRAT_SMS     = 0x0,
    FRAT_FAX    ,
    FRAT_MAIL    ,
    FRAT_OUTBOX    ,
    FRAT_MISSED_CALLS
} FoamReaderAppType} ;

/* ----------------------------------------------------------------------------
 *   Records
 * --------------------------------------------------------------------------*/

typedef ByteFlags IconsShown ;
#define IS_ICON_LEFT   0x80
#define IS_ICON_RIGHT  0x40

/* ----------------------------------------------------------------------------
 *   FFileSelector class
 * --------------------------------------------------------------------------*/
@class  FFileSelectorClass, GenFileSelectorClass;

/*
 *  Set the open directory.
 *
 *  Pass:	cx -- FDocumentDir
 *  Return:	nothing
 *
 */
@message void MSG_FFS_SET_PATH (FDocumentDir fDocDir = cx);

/*
 *  Get the current path.
 *
 *  Pass:	nothing
 *  Return:	cx -- FDocumentDir
 *
 */
@message FDocumentDir MSG_FFS_GET_PATH () = cx;

/*
 *  Sent when the user presses the "ENTER" key.
 *
 *  Pass:	nothing
 *  Return:	nothing
 *
 */
@message void MSG_FFS_OPEN ();

@vardata FDocumentDir	ATTR_FFS_DOCUMENT_DIR;
/*  Default document directory for the file selector. */

@endc	/* FFileSelectorClass */

/* ------------------------------------------------------------------------
 *   ExtendedFileSelector class (Only available in Communicator products
 *   shipped in April 1997 or later.  E.G., this class is not available
 *   on build 4.8.8 or earlier versions of the Communicator.)
 * ----------------------------------------------------------------------*/

@class  ExtendedFileSelectorClass, GenFileSelectorClass, master, variant;

typedef WordFlags ExtendedFileSelectorAttrs ;
#define EFSA_NON_EXCLUSIVE 	(0x8000)
    /*
     *  When set, file selector allows multiple files to be
     *  selected.  Note the change in parameters &
     *  semantics of GFSI_notificationMsg below, and that
     *  the following GenFileSelectorClass messages
     *  are prohibited:
     *
     * 	MSG_GEN_FILE_SELECTOR_GET_FULL_SELECTION_PATH
     * 	MSG_GEN_FILE_SELECTOR_SET_FULL_SELECTION_PATH
     * 	MSG_GEN_FILE_SELECTOR_DELETE_SELECTION
     *
     *  The following messages have different semantics
     *  when in non-exclusive mode, documented below.
     *
     * 	MSG_GEN_FILE_SELECTOR_GET_SELECTION_TOKEN
     */

#define EFSA_SEARCHABLE 		(0x4000)
    /*
     *  When set, a search box will be provided, permitting
     *  the user to narrow the list of files to those that
     *  match the text typed into the search box.
     */

/* 14 bits unused */

typedef struct {

    word			EFSE_id;     /* entry # of file */
    GenFileSelectorEntryFlags	EFSE_flags;  /* attributes of file */
    GenFileSelectorSelection	EFSE_file;   /* name of file */

} ExtendedFileSelectorEntry} ;

/*
 *  Returns the current array of selections
 *
 *  Pass:	selections -- fptr to ExtendedFileSelectorEntry array
 * 		bufLength  -- # of entries in selections
 *  Return:	Total number of selected items.
 *		selections -- array filled with as many of the current
 * 			 selections as will fit.
 */
@message word MSG_EFS_GET_MULTIPLE_SELECTIONS
    (ExtendedFileSelectorEntry *selections = cx:dx,
     word bufLength = bp) = ax;

/*
 *  @message MSG_GEN_FILE_SELECTOR_GET_SELECTION
 *
 *  	Takes and returns same values as GenFileSelectorClass,
 *      except that if multiple files are selected, returns one
 *	of them at random.  Because of this unpredictable behavior,
 *	MSG_EFS_GET_MULTIPLE_SELECTIONS should be used instead.
 */

/*
 *  @message MSG_GEN_FILE_SELECTOR_GET_SELECTION_TOKEN
 *
 *  	Returns the GeodeToken of the selected file.  If the file is
 *      a DOS file the dos extension (including the dot) is returned.
 *
 *	If multiple files are selected, then the token of one of
 * 	those files (at random) is returned.  Therefore, for this
 * 	message to be useful, you should only call it when
 * 	you know there is exactly one selection.
 *
 * 	If no files are selected, then the passed GeodeToken
 * 	buffer will be unchanged.
 */

/*
 *  Returns the current value of EFSI_attrs
 *
 *  Pass:	nothing
 *  Return:	ExtendedFileSelectorAttrs
 *  Destroyed:	nothing
 */
@message ExtendedFileSelectorAttrs MSG_EFS_GET_ATTRS () = cx;

/*
 *  Changes the current EFSI_attrs.  Currently, only the EFSA_SEARCHABLE
 *  flag may be altered.
 *
 *  Pass:	set   -- ExtendedFileSelectorAttrs to set
 * 		clear -- ExtendedFileSelectorAttrs to clear
 *  Returns:	nothing
 */
@message void MSG_EFS_SET_ATTRS (ExtendedFileSelectorattrs set = cx,
                    ExtendedFileSelectorattrs clear = dx);

/*
 *  Returns the current number of selections for this file selector.
 *  Returns zero if there's no selection.
 *
 *  Pass:	nothing
 *  Return:	number of selections
 *  Destroyed:	nothing
 */
@message word MSG_EFS_GET_NUM_SELECTIONS () = ax;

@message ExtendedFileSelectorEntryData MSG_EFS_GET_MULTIPLE_SELECTIONS_BLOCK () = cx:ax;
/*
 *  Returns the current array of selections in a block.
 *
 *  Pass:	nothing
 *  Return:	ExtendedFileSelectorEntryData
 */

typedef struct {
    word      EFSED_numSelections;
    MemHandle EFSED_block;
} ExtendedFileSelectorEntryData} ;

@message void MSG_EFS_RESET_SEARCH ();
/*
 * If a searchable file selector, clears the search and restores all
 * entries. Returns the current array of selections in a block.
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_EFS_GET_SELECTION_INFO (EFSSelectionInfo *retValue=cxdxbpax);

typedef struct {
    word			numSelections;
    GenFileSelectorEntryFlags	determinate;
    GenFileSelectorEntryFlags	entryFlags;
    word			junk;
} EFSSelectionInfo} ;

@vardata	void	HINT_EFS_SHORT_SEARCH_MONIKER;
/*
 *  Uses a smaller moniker for the Search input box, instead
 *  of the full Icon + Text
 */

@instance ExtendedFileSelectorAttrs  EFSI_attrs = EFSA_NON_EXCLUSIVE;
    /*
     * Features which this file selector should offer.
     */

@instance ChunkHandle		     EFSI_selections;
    /* Chunk containing the currently selected files,
     * in an array of ExtendedFileSelectorEntry.
     */

/* @instance  Message GFSI_notificationMsg;  */
/*
 *  When EFSA_NON_EXCLUSIVE is set, the GFSI_notification message
 *  uses this prototype, not GEN_FILE_SELECTOR_NOTIFICATION_MESSAGE:
 *
 *  params:	numSelections  -- Number of selected files
 *		entryFlags     -- Value of GenFileSelectorEntryFlags of
 *				   selected files
 *		determinate    -- GenFileSelectorEntryFlags which have
 *				   the same value in all selected files.
 */

@prototype void EXT_FILE_SELECTOR_NON_EXCLUSIVE_NOTIFICATION_MSG (
    word numSelections = cx,
    GenFileSelectorEntryFlags entryFlags = bp,
    GenFileSelectorEntryFlags determinate = dx);

@endc	/* ExtendedFileSelectorClass */

/* ----------------------------------------------------------------------------
 *   ComplexMonikerClass
 * --------------------------------------------------------------------------*/
@class ComplexMonikerClass, GenClass, master, variant;

typedef enum {
    CMT_NULL	 		= 0,
    CMT_OK				= 1,
    CMT_CLOSE			= 3,
    CMT_CHANGE			= 5,
    CMT_CANCEL			= 7,
    CMT_CLEAR			= 9,
    CMT_CALL			= 11,
    CMT_CLEAR_ALL			= 13,
    CMT_YES				= 15,
    CMT_NO				= 17,
    CMT_RENAME			= 19,
    CMT_COPY			= 21,
    CMT_SETTINGS			= 23,
    CMT_OPEN			= 25,
    CMT_CREATE_NEW			= 27,
    CMT_SEND			= 29,
    CMT_DELETE			= 31,
    CMT_ROTATE			= 33,
    CMT_ZOOM			= 35,
    CMT_ZOOM_IN			= 37,
    CMT_ZOOM_OUT			= 39,
    CMT_VIEWING_TOOLS		= 41,
    CMT_SEND_OPTIONS		= 43,
    CMT_OPTIONS			= 45,
    CMT_FORWARD			= 47,
    CMT_REPLY			= 49,
    CMT_SELECT			= 51,
    CMT_START			= 53,
    CMT_CONNECT			= 55,
    CMT_GO				= 57,
    CMT_INSTALL			= 59,
    CMT_DEINSTALL			= 61,
    CMT_NEXT			= 63,
    CMT_PREVIOUS			= 65,
    CMT_RECENT_CALLS		= 67,
    CMT_RECENT_FAXES		= 69,
    CMT_RECENT_MESSAGES		= 71,
    CMT_USER_DEFINED		= 73,
    CMT_CLEAR_LIST			= 75,
    CMT_CALLS			= 77,
    CMT_FAXES			= 79,
    CMT_DATA_CALLS			= 81,
    CMT_MESSAGES			= 83,
    CMT_NO_CONTACT_INFORMATION	 = 85,
    CMT_CONTACT_CARD		= 87,
    CMT_NONE			= 89,
    CMT_CALL_LOWERCASE		= 91,
    CMT_CLEAR_ALL_COMMAND		= 93,
    CMT_TO_COLON			= 95,
    CMT_FROM_COLON			= 97,
    CMT_ACCEPT			= 99,
    CMT_RESET			= 101,
    CMT_STOP			= 103,
    CMT_RECEIVED_CALLS		= 105,
    CMT_RECEIVED_FAXES		= 107,
    CMT_RECEIVED_MESSAGES		= 109,
    CMT_MISSED_CALLS		= 111,
    CMT_LAST_DIALED_CALLS		= 113,
    CMT_ACTIVATE			= 115,
    CMT_DISABLE			= 117,
    CMT_HELP			= 119,
    CMT_BACK			= 121,
    CMT_SELECT_RECEIVER	     = 123,
    CMT_SPECIAL_KEYS_COMMAND		= 125,
    CMT_SPECIAL_KEYS		= 127,
    CMT_TEXT			= 129,
    CMT_TEXTS			= 131,
    CMT_ZOOM_PLUS			= 133,
    CMT_ZOOM_MINUS			= 135,
    CMT_HANGUP			= 137,
    CMT_CAPTURE			= 139,
    CMT_INSERT			= 141,
    CMT_PHONE			= 143,
    CMT_OFF				= 145,
    CMT_ON				= 147,
    CMT_TEXT_SEND			= 149,
    CMT_TEXT_CAPTURE		= 151,
    CMT_STOP_CAPTURE		= 153,
    CMT_FORWARD_FAX	         = 155,
    CMT_MENU	                = 157,
    CMT_SEARCH	              = 159,

} ComplexMonikerText} ;

typedef enum {
    CMB_LEFT_FINGER     = 1,
    CMB_RIGHT_FINGER     = 3,
    CMB_CONTACT_CARD     = 5,
    CMB_CONTACT_LIST     = 7,
    CMB_SPEED_DIAL     = 9,
    CMB_SETTINGS_TITLE_ICON     = 11,
    CMB_SERVICES_VIEW     = 13,
    CMB_SERVICES_DEFINE     = 15,
    CMB_QUESTION_ICON     = 17,
    CMB_OPEN_FOLDER     = 19,
    CMB_DRAWER     = 21,
    CMB_RENAME_COPY     = 23,
    CMB_FOLDER     = 25,
    CMB_SECURITY_SUCCESS     = 27,
    CMB_SECURITY_ERROR     = 29,
    CMB_PC_ICON     = 31,
    CMB_INPUT_TITLE_ICON     = 33,
    CMB_WARNING_TITLE_ICON     = 35,
    CMB_SMS_CARD_ICON     = 37,
    CMB_SEARCH     = 39
} ComplexMonikerBitmap} ;

/*
 *  Source type information passed to MSG_COMPLEX_MONIKER_REPLACE_MONIKER
 */
typedef enum {                   /* enum ComplexMonikerSourceType */
    CMST_FPTR     = 0x1,
    /*  Indicates source is referenced by a fptr. */
    CMST_OPTR    ,
    /*  Indicates source is referenced by a optr. */
    CMST_HPTR    ,
    /*  Indicates source is referenced by a hptr and offset. */
    CMST_LPTR    ,
    /*
     *  Indicates source is referenced by a local memory chunk and thus
     *  does not have to copy the source into the object block.  When this
     *  source type is uses the overwrite flag does not apply.
     */
    CMST_CMT    ,
    /*
     *  Indicates source is referenced by a ComplexMonikerText enumerated
     *  type.
     */
    CMST_CMB    ,
    /*
     *  Indicates source is referenced by ComplexMonikerBitmap enumerated
     *  type.
     */
    CMST_KEEP    ,
    /*
     *  Indicates that you want to keep the current chunk in the new
     *  complex moniker.
     */

} ComplexMonikerSourceType} ;

typedef WordFlags RCMOverwrite ;
  #define RCMO_TOP_TEXT  (0x8000)
  /*  Indicates that you want to overwrite the text if set. */
  #define RCMO_ICON_BITMAP  (0x4000)
  /*  Indicates that you want to overwrite the iconBitmap if set. */

typedef struct {
    TextStyle	RCM_textStyleSet;
    /*  TextStyle to set */
    TextStyle	RCM_textStyleClear;
    /*  TextStyle to clear */
    /*
     *   NOTE: These flags in the ComplexMoniker object get inverted
     *   from their previous values, not cleared.  So before using,
     *   you should know that the flags in question are already set.
     */
    word	RCM_fontSize;
    /*  Size of topText font. (0 for no change) */
    dword	RCM_topTextSource;
    /*  Top text source. */
    dword	RCM_iconBitmapSource;
    /*  Icon bitmap source */
    ComplexMonikerSourceType	RCM_topTextSourceType;
    /*  Top text source type */
    ComplexMonikerSourceType	RCM_iconBitmapSourceType;
    /*  Icon bitmap source type */
    word	RCM_iconBitmapSize;
    /*  Size of icon bitmap */
    RCMOverwrite	RCM_overwrite;
    /*  Set TRUE if you want to overwrite existing complex moniker chunks. */
} ReplaceComplexMoniker} ;

typedef struct {
    TextStyle	GCM_textStyle;
    /*  TextStyle of moniker */
    byte	GCM_fontSize;
    /*  size of moniker text */
    ComplexMonikerText	GCM_topText;
    /*  top text id or chunk handle */
    ComplexMonikerBitmap	GCM_iconBitmap;
    /*  icon bitmap id or chunk handle */
} GetComplexMoniker} ;

/*
 *  Replace the complex moniker with the newly specified elements. And
 *  rebuilds itself onscreen.
 */
typedef struct {
    ChunkHandle	RCMCH_topText;
    word	RCMCH_unusedCX;
    ChunkHandle	RCMCH_iconBitmap;
    word	RCMCH_unusedBP;
} ReplaceComplexMonikerChunkHandles} ;

@message void \
MSG_COMPLEX_MONIKER_REPLACE_MONIKER(ReplaceComplexMonikerChunkHandles \
                    *retValue = axcxdxbp,
                    const ReplaceComplexMoniker *rcm = dx:bp);

/*
 * Fetch information about a complex moniker, including it's text and
 * bitmap chunks.
 */
@message void \
MSG_COMPLEX_MONIKER_GET_MONIKER(const GetComplexMoniker *gcm = dx:bp);

@vardata  void          ATTR_COMPLEX_MONIKER_PLACE_BITMAP_AT_LEFT;

@vardata  Point		ATTR_COMPLEX_MONIKER_SEPARATOR_START_POINT;
/*
 * Contains the x,y coordinate (with respect to the origin of the
 * visMoniker's gstring) of the left edge of the separator line.
 * Used by the Rudy SPUI to draw the separator, if necessary.
 */

@vardata  void    	HINT_COMPLEX_MONIKER_DRAW_SEPARATOR;

@vardata  void		HINT_COMPLEX_MONIKER_DONT_DRAW_SEPARATOR;

@vardata  void          HINT_COMPLEX_MONIKER_CENTER_TEXT_HORIZONTALLY;

@vardata  void		HINT_COMPLEX_MONIKER_MINIMIZE_ICON_SPACING;

@vardata  void		TEMP_COMPLEX_MONIKER_CURRENT_ZOOM_LEVEL;
/* Internal: used to store the current zoom level */

@instance TextStyle CMI_textStyle = (TS_BOLD);
@instance word CMI_topText;
@instance word CMI_iconBitmap;
@instance byte CMI_fontSize;

@endc

/* --------------------------------------------------------------------------
 *   TwoLevelTrigger class
 * ------------------------------------------------------------------------*/
@class	TwoLevelTriggerClass, ComplexMonikerClass;

@default ComplexMoniker = GenTriggerClass;

@message	void MSG_TLT_ACTIVATE_OTHER_LEVEL ();

@instance  optr	TLTI_other_parent;

@default GTI_actionMsg = MSG_TLT_ACTIVATE_OTHER_LEVEL;
@default GTI_destination = (TO_SELF);
@default CMI_textStyle = (TS_BOLD);
@vardata void ATTR_TLT_IS_BACK_TRIGGER;
/* If present, the object will supply its own standard "back" moniker */

@endc
/* ------------------------------------------------------------------------*/

@class GreyFrameClass, GenInteractionClass;

@protominor NewForFlatFrameLook

@vardata	void ATTR_GREY_FRAME_FLAT_FRAME_LOOK;
    /*
     *  If present will draw a "flat" looking frame, normally used
     *  in two-windowed views.
     */

@protoreset

@endc

@class UnderlinedGenTextClass, GenTextClass;
@endc

@class UnderlinedVisTextClass, VisTextClass;
@message void MSG_UVT_DRAW_UNDERLINE ();
          /*
       * Internal message to redraw the underline.
       */
@message void MSG_UVT_MOVE_TO_END_IF_NOT_FOCUSED ();
        /*
       * Internal message queued up when we lose the focus - if we've
       * *really* lost the focus (as opposed to merely had it momentarily
       * usurped by the charset dialog), then move cursor to the end.
           */

@vardata void ATTR_UNDERLINED_VIS_TEXT_NO_UNDERLINES;
      /*
       * Turn off the underline functionality, act as a normal
       * VisText object.
       */
@endc

@class GenValueWithListClass, GenValueClass;
@instance optr GVWLC_listObj;

@vardata void ATTR_GEN_VALUE_WITH_LIST_DO_NOT_ALLOW_NAVIGATION;
/*
 *  Do not allow navigation to this object - it will only take the focus
 *  if explicitly given to it via MSG_GEN_MAKE_FOCUS
 */

@vardata word ATTR_GEN_VALUE_WITH_LIST_MAX_TEXT_LEN;
/*
 *  Specify the maximum number of characters the GenValue allows the user
 *  to enter.
 */

@endc

@class UnderlinedTextWithListClass, UnderlinedGenTextClass;
    @instance optr UTWLC_listObj;
    @vardata void ATTR_UNDERLINED_TEXT_WITH_LIST_DO_NOT_ALLOW_NAVIGATION;
@endc

@class TextWithListClass, GenTextClass;
    @instance optr TWLC_listObj;
    @vardata void ATTR_TEXT_WITH_LIST_DO_NOT_ALLOW_NAVIGATION;
@endc

/* ----------------------------------------------------------------------------
 *   FilterListClass	 (only availible in Communicator products
 *			         shipped in April 1997 or later)
 * ----------------------------------------------------------------------------
 *
 *  FilterList acts just like a GenDynamicList, but instead
 *  of referring to the items by their order in the list, it allows
 *  an application to supply an array of the identifiers (the
 *  filter) that should be displayed in the item group.  The list
 *  object internally maps back and forth between the physical item
 *  number and the application item identifer when communicating
 *  with the application.
 *
 *  In addition, the app may supply monikers to be displayed when
 *  there are no items in the list, or there are no items in the filter.
 *
 *  Possible uses for FilterList:
 * 	- Displaying results of a narrowing database search
 * 	- re-ordering the display of a list
 * 	- displaying an item multiple times
 *
 *  Any GenItemGroupClass or GenDynamicListClass message that deals
 *  with item identifiers has a corresponding like-named message in
 *  FilterListClass.  The application must use the FilterListClass
 *  version of the message instead of the GenItemGroup or
 *  GenDynamicListClass messages to query and set item state.  The
 *  semantics and parameters of each message are the same as the
 *  GenItemGroup/GenDynamicList counterpart, except where noted.
 *  The word "identifier", in the message descriptions, means
 *  application identifer, except where noted.
 */

@class  FilterListClass, GenDynamicListClass;

/*
 *  Returns the application item ID that corresponds to the passed
 *  physical item ID in the current filter.
 *
 *  Source:	can be called at any time, but shouldn't be necessary,
 * 		as rest of FilterList API handles this automatically.
 *
 *  Pass:	id	= physical item identifier
 *  Return:	corresponding application ID, or GIGS_NONE
 * 		    if current filter doesn't contain the item.
 *  Destroyed:	nothing
 */
@message word MSG_FILTER_LIST_MAP_PHYSICAL_TO_APP (word id = cx) = cx;

/*
 *  Returns the physical item ID that corresponds to the passed
 *  application item ID in the current filter.
 *
 *  Source:	can be called at any time, but shouldn't be necessary,
 * 		as rest of FilterList API handles this automatically.
 *
 *  Pass:	id	= application item identifier
 *  Return:	corresponding application ID, or GIGS_NONE
 * 		    if current filter doesn't contain the item.
 *  Destroyed:	nothing
 */
@message word MSG_FILTER_LIST_MAP_APP_TO_PHYSICAL (word id = cx) = cx;

/*
 *  Pass:	identifer -- identifier of the item to select
 * 		indeterminate -- non-zero if indeterminate
 *  Return:	nothing
 */
@message void MSG_FILTER_LIST_SET_SINGLE_SELECTION (word identifier = cx,
                      Boolean indeterminate = dx);

/*
 *  Pass: 	selectionList - fptr to buffer with the selections.
 * 		numSelections - number of selections in selectionList
 *  Return:	nothing
 *  Destroyed:	the contents of the passed buffer are destroyed
 */
@message void MSG_FILTER_LIST_SET_MULTIPLE_SELECTIONS (
                      word *selectionList = cx:dx,
                       word numSelections = bp);

/*
 *  Pass:		nothing
 *  Return:	current selection, or GIGS_NONE if no selections,
 * 		      or the first selection in the item group if there are
 *  		      multiple selections in a non-exclusive or extended-
 *  		      selection-exclusive item group.
 */
@message word MSG_FILTER_LIST_GET_SELECTION () = ax;

/*
 *  Pass:	selectionList -- Buffer to hold the selections.
 * 		maxSelections -- Max number of selections to place in buffer
 *  Return:	Number of selections.
 *		selectionList -- filled in with the identifiers of the
 * 			 selections (the list will not be null-terminated).
 *
 */
@message word MSG_FILTER_LIST_GET_MULTIPLE_SELECTIONS (
                    word *selectionList = cx:dx,
                    word maxSelections = bp) = ax;

/*
 *  Pass:	identifier -- identifier to look for
 *  Return:	optr of item, or null if none found
 */
@message optr MSG_FILTER_LIST_GET_ITEM_OPTR (word identifier = cx) = cx:dx;

/*
 *  Pass:	identifer -- identifier of item to select
 * 		state -- non-zero if item should be selected, zero if not
 *  Return:	nothing
 */
@message void MSG_FILTER_LIST_SET_ITEM_STATE (word identifier = cx,
                            Boolean state = dx);

/*
 *  Pass:	identifer -- identifier of item to check on
 *  Return:	non-zero if item is selected
 */
@message Boolean MSG_FILTER_LIST_IS_ITEM_SELECTED (word identifier = cx) = carry;

/*
 *  Pass:	identifier -- identifier of item to ensure visible
 *  Return:	nothing
 */
@message void MSG_FILTER_LIST_MAKE_ITEM_VISIBLE (word identifier = cx);

/*
 *  Pass:	Params as in MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_MONIKER
 *  Return:	nothing
 */
@message void MSG_FILTER_LIST_REPLACE_ITEM_MONIKER(@stack
        word item, ReplaceItemMonikerFlags flags,
        word height, word width, word length,
        VisMonikerDataType dataType,
        VisMonikerSourceType sourceType,
        dword source);

/*
 *  Pass:	moniker - source VisMoniker
 * 		item - identifier of item to replace
 *  Return:	nothing
 */
@message void MSG_FILTER_LIST_REPLACE_ITEM_MONIKER_OPTR (word item = bp,
                    optr moniker = cx:dx);

/*
 *  Pass:	text - far pointer to source null-terminated text string
 * 		item - identifier of item to replace
 *  Return:	nothing
 */
@message void MSG_FILTER_LIST_REPLACE_ITEM_TEXT (word item = bp,
                              char *text = cx:dx);

/*
 *  Pass:	nothing
 *  Return:	item identifier of current focus exclusive,
 * 		      or GIGS_NONE if none, or not spec built.
 */
@message word MSG_FILTER_LIST_GET_FOCUS_ITEM () = cx;

/*
 *  Pass:	identifer -- identifier of the item to move the focus
 * 			 exclusive to. GIGS_NONE if no exclusive is desired
 *  Return:	nothing
 */
@message void MSG_FILTER_LIST_SET_FOCUS_ITEM (word identifier = cx);

/*
 *  Notifies the dynamic list to display a new list of items.
 *  If the list is already usable, invalidates all the current
 *  items and re-requests all the monikers.  All items will be
 *  deselected.  The list will not scroll back to the top
 *  explicitly -- send a MSG_GEN_ITEM_GROUP_MAKE_ITEM_VISIBLE
 *  to get back to the top of the list.
 *
 *  NOTE: the application should use this message, not
 *  MSG_GEN_DYNAMIC_LIST_INITIALIZE to set the number of items in the list.
 *
 *  Context:	Can be called any time.
 *  Source:	No restrictions
 *  Destination:	Any GenDynamicList object.
 *  Interception:	Generally not intercepted.
 *
 *  Pass:		cx -- new number of displayed items
 * 		dx:bp -- new filter for list.  The filter is
 * 			array of application item identifiers
 * 			to display in the list.
 * 			If NULL, then physical ID's and application ID's
 * 				are the same, and no mapping between
 * 				them takes place.
 * 			If not null, and cx=0, then there are no matching
 * 				items, and FLI_noMatchMoniker will be
 * 				displayed.
 *  Return:	nothing
 *  Destroys:	nothing
 */
@message void MSG_FILTER_LIST_INITIALIZE (word numItems = cx,
                     word *filter = dx:bp);

/*
 *  Data type for ATTR_FILTER_LIST_CUSTOM_IDENTIFIERS
 */
typedef struct {
    word	FLCI_noItems;
    word	FLCI_noMatch;
} FilterListCustomIdentifiers} ;

@vardata FilterListCustomIdentifiers ATTR_FILTER_LIST_CUSTOM_IDENTIFIERS;
/*
 *  Normally, when the list is displaying "no items" or "no
 *  matches", the list uses the identifier GIGS_NONE,
 *  making these states transparent to the application.
 *  This ATTR allows the application to supply alternate
 *  identifiers for these states, should the application
 *  need to distinguish them from GIGS_NONE.
 */

@instance @visMoniker FLI_noItemsMoniker;
/*
 *  A chunk containing the item moniker to display
 *  when the item count is 0, and there is no filter.
 */

@instance @visMoniker FLI_noMatchMoniker;
/*
 *  A chunk containing the item moniker to display
 *  when the item count is 0, and the filter has zero length.
 */

@instance word	FLI_currentNoneMoniker;
/*
 *  INTERNAL: points to either FLI_noItemsMoniker,
 *  FLI_noMatchMoniker, or NULL
 */

@instance ChunkHandle FLI_filterItems;
/*
 *  INTERNAL: if non-zero, chunk is an array of application ID's
 *  to display.  if the array is of zero length, then
 *  there are no items which match, and
 *  FLI_noMatchText is displayed.
 */

@endc	/* FilterListClass */

/* ----------------------------------------------------------------------------
 *   FilterTextClass	 (only availible in Communicator products
 *			         shipped in April 1997 or later)
 * ----------------------------------------------------------------------------
 *
 *  This is the class of object used to enter the text that will
 *  limit the items displayed in a corresponding FilterListClass
 *  object.
 */

@class  FilterTextClass, TextWithListClass;

/*
 *  Causes the filter timeout to be reset, and to send the
 *  FTI_filterMsg.  Sent internally by timeout, or by
 *  application to cause an immediate filter
 *
 *  Pass:	nothing
 *  Return:	nothing
 */
@message void MSG_FILTER_TEXT_SEND_FILTER_MSG ();

/*
 *  Clears the current search text, and immediately sends out
 *  FTI_filterMsg, causing the destination to clear the search.
 *  This is the equivalent of MSG_VIS_TEXT_DELETE_ALL followed by
 *  MSG_FILTER_TEXT_SEND_FILTER_MSG
 *
 *  Pass:		nothing
 *  Return:	nothing
 */
@message void MSG_FILTER_TEXT_RESET ();

/*
 *  Message queued up when we lose the focus - if we've *really* lost the
 *  focus, then nuke the text.
 *
 *  Pass: nothing
 *  Return: nothing
 */
@message void MSG_FILTER_TEXT_RESET_TEXT_IF_NOT_FOCUSED ();

@default GTXI_attrs = (@default | GTA_SINGLE_LINE_TEXT);

@instance word FTI_filterTimeout = 30;
/*
 *  Time delay (in ticks) after text is modified that the
 *  FTI_filterMsg should be sent.
 */

@instance Message FTI_filterMsg;
/*
 *  Message to send out to the GTXI_destination to initiate
 *  a filter search.  The actual text to filter on may be obtained
 *  with MSG_VIS_TEXT_GET_ALL_xxx. The message takes the following
 *  form:
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@instance word FTI_timerID;
@instance word FTI_timerHandle;
/*
 *  Internal: handle/ID of timer used to determine when to start a
 *  search.
 */

@endc	/* FilterTextClass */

@class RepeatingGenGlyphClass, GenGlyphClass;
@message void MSG_RGG_STOP_ANIMATION ();
/*
      Send this to stop the animation and leave the last glyph on
    screen.
*/

@message void MSG_RGG_START_ANIMATION ();
/*
    Restarts the previously stopped animation.
*/

@message void MSG_RGG_CHANGE_MONIKER ();
/*
    Internal message, to trigger changing of moniker to the next one in
    the list
*/

@instance word RGGI_currentItem;
@instance word RGGI_timerHandle;
@instance word RGGI_timerID;
@instance word RGGI_delayTime;
@instance @visMoniker RGGI_monikerList;
@endc

@class ListWithUserDefinedClass, GenItemGroupClass;
/*
 *  A special list with "User defined" item.
 *  This list which has an associated (Underlined)TextWithList object.
 *  It handles the giving/taking of focus from the text object, when we
 *  move to/from the specified item in the list.
 */

@message void MSG_LWUD_SET_SINGLE_SELECTION_OR_USER_DEFINED (
                    word identifier = cx,
                    Boolean indeterminate = dx);
/*
 *  Works like MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION the difference being
 *  if the identifier you are trying to set is not found in a GenItem then the
 *  user defined GenItem is selected.
 *
 */

    @vardata void ATTR_LIST_WITH_USER_DEFINED_TEXT_OBJECT_SELECTED;
    /*  If present, the text object is currently selected. */

    @instance optr LWUDI_textObj;
    @instance word LWUDI_textID;
@endc

/* --------------------------------------------------------------------------
 *   Indicator Library classes
 * ------------------------------------------------------------------------*/

@class GreyGenInteractionClass, GenPrimaryClass;
@endc

@class IndicatorClass, GenGlyphClass;
@instance IconsShown II_numIcons;
@endc

@class IconIndicatorClass, IndicatorClass;
@message void MSG_II_SET_LEFT_ICON (word iconNumber = cx);
/*
    Sets the left icon to be displayed in the indicator slot.
*/

@message void MSG_II_SET_RIGHT_ICON (word iconNumber = cx);
/*
    Sets the right icon to be displayed in the indicator slot.
*/

@instance ChunkHandle    III_leftIconList;
@instance ChunkHandle    III_rightIconList;
@instance word           III_leftIcon;
@instance word           III_rightIcon;
@endc

@class LevelIndicatorClass, IndicatorClass;
@message void MSG_LI_REPLACE_TYPE_BITMAP (ChunkHandle typeBitmap = cx);
/*
    Replace the tiny bitmap on the left, and redraws itself.
            0 to not draw a bitmap and not draw the levels
            (setting to 0 will NOT erase the old bitmap lptr).
*/

@message void MSG_LI_SET_LEVEL (word iconNumber = cx);
/*
    Sets the new indicator level, and redraws itself
*/

@vardata void HINT_LI_DRAW_LEVELS_VERTICALLY;
/*
     If present will stack the bitmaps from bottom to top when drawing,
     otherwise by default it will draw them from left to right.
*/

@instance word          LII_currLevel;
@instance ChunkHandle   LII_typeBitmap;
@instance ChunkHandle   LII_levelBitmapList;
@endc

@class IndicatorInteractionClass, GenInteractionClass;
@endc

/*
 * AppLaunchClass
 */

@class	AppLaunchClass, GenFileSelectorClass;

@message void MSG_AL_LAUNCH_SELECTED_APP ();
/*
 * Launches the selected app.   Usually sent as a result of the user pressing
 * on the "select" trigger.
 */

@message void MSG_AL_APP_SELECTED ();
/*
 * Message sent out when an app is selected in the file selector.
 */

@instance FApplication	ALI_launcherApp;
@instance optr          ALI_triggerObj;

@default GFSI_destination = (TO_SELF);
@default GFSI_notificationMsg = MSG_AL_APP_SELECTED;

@endc

/*
 * FoamHelpControlClass
 */
@class	FoamHelpControlClass, HelpControlClass;

@vardata    hptr    TEMP_FOAM_HELP_CONTROL_UI;

@endc

/******************************************************************************
 *		FaomTextStyleControlClass
 *****************************************************************************/

@class	FoamTextStyleControlClass, GenControlClass;

/*
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_TEXT_STYLE (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_STYLE_CHANGE: FoamNotifyTextStyleChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

/*--------------------------------------------------------------------------
 * 		Methods
 *--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
 * 		Internal methods
 *--------------------------------------------------------------------------*/

@message void MSG_FTSC_PLAIN_TEXT_CHANGE ();
/*
 *  Sent from "Plain" list entry on any change
 *
 *  Pass:   nothing
 */

@message void MSG_FTSC_STYLE_CHANGE (word selectedBooleans = cx,
                   word changedBooleans = bp);
/*
 *  Sent from non-exclusive "Style" list on any change
 *
 *  Pass:
 * 	selectedBooleans - new state of style list
 * 	changedBooleans - changed bits in style list
 */

@message void MSG_FTSC_EXTENDED_STYLE_CHANGE (word selectedBooleans = cx,
                        word changedBooleans = bp);
/*
 *  Sent from non-exclusive "Extended Style" list on any change
 *
 *  Pass:
 * 	selectedBooleans - new state of style list
 * 	changedBooleans - changed bits in style list
 */

/* -------------------------------------------------------------------------
 * 		Hints
 * -------------------------------------------------------------------------*/

/* -------------------------------------------------------------------------
 * 		Constants & Structures
 * -------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags FTSCFeatures ;
#define FTSCF_PLAIN 		0x0800
#define FTSCF_BOLD 		0x0400
#define FTSCF_ITALIC 		0x0200
#define FTSCF_UNDERLINE 		0x0100
#define FTSCF_STRIKE_THRU 	0x0080
#define FTSCF_SUBSCRIPT 		0x0040
#define FTSCF_SUPERSCRIPT 	0x0020
#define FTSCF_BOXED 		0x0010
#define FTSCF_BUTTON 		0x0008
#define FTSCF_INDEX 		0x0004
#define FTSCF_ALL_CAP 		0x0002
#define FTSCF_SMALL_CAP 		0x0001

#define FTSC_DEFAULT_FEATURES  (FTSCF_PLAIN | FTSCF_BOLD \
            | FTSCF_ITALIC | FTSCF_UNDERLINE \
            | FTSCF_SUBSCRIPT | FTSCF_SUPERSCRIPT \
            | FTSCF_STRIKE_THRU | FTSCF_BOXED | FTSCF_BUTTON \
            | FTSCF_INDEX | FTSCF_ALL_CAP | FTSCF_SMALL_CAP)
/*
 *  Notification structure
 */
typedef struct {
    TextStyle			FNTSC_styles;		/* TextStyle */
    TextStyle			FNTSC_indeterminates;	/* TextStyle */
} FoamNotifyTextStyleChange} ;

/*---------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/

    @default GCI_output = (TO_APP_TARGET);
    @default GI_attrs = (@default | GA_KBD_SEARCH_PATH);

@endc

/******************************************************************************
 * 		FoamFontControlClass
 ******************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_FONT_ID (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_FONT_CHANGE: FoamNotifyFontChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class	FoamFontControlClass, GenControlClass;

/*---------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *---------------------------------------------------------------------------*/

@message void MSG_FFC_SET_FONT (word fontID = cx);
/*
 *  Handle a font set via the short list
 *
 *  Pass:
 * 	fontID - font ID
 */

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

    @vardata FontEnumFlags ATTR_FOAM_FONT_CONTROL_SHORT_LIST_FONT_TYPE;
    /*
     *  This attribute sets the legal font types for the short font list
     */

/*--------------------------------------------------------------------------
 * 		Constants & Structures
 *--------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 *
 *  the original name is FFCFeatures (Foam Font Ctrl Feature) but
 *  math.def has a struct with same name already... -- kho, 7/11/95
 */
typedef WordFlags FFCCFeatures ;
#define FFCCF_SHORT_LIST 	0x0001

#define FFCC_DEFAULT_FEATURES  	    (FFCCF_SHORT_LIST)

/*
 * 	Notification structure
 */
typedef struct {
    FontID			FNFC_fontID;
    byte			FNFC_diffs;
} FoamNotifyFontChange} ;

/*--------------------------------------------------------------------------
 * 		Instance Data
 *--------------------------------------------------------------------------*/
    @default GCI_output = (TO_APP_TARGET);

@endc

/******************************************************************************
 * 		FoamPointSizeControlClass
 ******************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_POINT_SIZE (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_FONT_SIZE_CHANGE: FoamNotifyFontSizeChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class	FoamPointSizeControlClass, GenControlClass;

@message void MSG_FPSC_SET_POINT_SIZE (WWFixed size = dx:cx);
/*
 *  Pass:   size - WWFixed
 */

@message void MSG_FPSC_SET_POINT_SIZE_FROM_LIST (word size = cx);
/*
 *  Pass:   size - word
 */

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags FPSCFeatures ;
#define FPSCF_10 	        0x0080
#define FPSCF_12 		0x0040
#define FPSCF_14 		0x0020
#define FPSCF_18 		0x0010
#define FPSCF_24 		0x0008
#define FPSCF_36 		0x0004
#define FPSCF_54 		0x0002
#define FPSCF_USER_DEFINED 	0x0001

#define FPSC_DEFAULT_FEATURES  (FPSCF_10 | FPSCF_12 | FPSCF_14 \
            | FPSCF_18 | FPSCF_24 | FPSCF_36 \
            | FPSCF_54 | FPSCF_USER_DEFINED)

#define SIZE_USER_DEFINED  0

/*
 *	Notification structure
 */
typedef struct {
    WWFixedAsDWord		FNPSC_FontSize;
    byte			FNPSC_diffs;
} FoamNotifyPointSizeChange} ;

/*---------------------------------------------------------------------------
 * 		Instance Data
 *--------------------------------------------------------------------------*/
    @default GCI_output = (TO_APP_TARGET);
    @default GI_attrs = (@default | GA_KBD_SEARCH_PATH);

@endc

/*****************************************************************************
 * 		FoamJustificationControlClass
 *****************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_PARA_ATTRIBUTES (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_JUSTIFICATION_CHANGE:
 *                                             FoamNotifyJustificationChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class FoamJustificationControlClass, GenControlClass;

/*----------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *---------------------------------------------------------------------------*/

@message void MSG_FJC_SET_JUSTIFICATION ();

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags FJCFeatures ;
#define FJCF_FULL_CHAR 	0x0010	    /* DBCS only */
#define FJCF_LEFT 	0x0008
#define FJCF_RIGHT 	0x0004
#define FJCF_CENTER 	0x0002
#define FJCF_FULL 	0x0001

#define FJC_DEFAULT_FEATURES   (FJCF_LEFT | FJCF_RIGHT | FJCF_CENTER \
                   | FJCF_FULL)

/* 	Notification structure */
typedef struct {
    Justification	FNJC_justification;
    byte		FNJC_diffs;

    /*
     * if non-zero then use "general" in place
     * of "full"
     */
    byte		FNJC_useGeneral;
} FoamNotifyJustificationChange} ;

    @default GCI_output = (TO_APP_TARGET);
    @default GI_attrs = (@default | GA_KBD_SEARCH_PATH);

@endc

/******************************************************************************
 * 		ClockContentClass
 ******************************************************************************
 *
 */

@class	ClockContentClass, VisContentClass;
/*---------------------------------------------------------------------------
 * 		Instance Data
 *--------------------------------------------------------------------------*/
@instance optr CAI_curClock;
@instance word CAI_interval;
@endc

/******************************************************************************
 * 		VisClockClass
 ******************************************************************************
 *
 */

@class	VisClockClass, VisCompClass, master;
@message void MSG_VC_REMOVE_ME (int ticks = cx);

@message void MSG_VC_CLOCK_TICK ();

@message void MSG_VC_START_TIMER ();

@message void MSG_VC_STOP_TIMER ();

#define  VC_CLOCK   1

typedef enum {
    VCC_CONTINUE     = 0x0,
    VCC_DONT_CONTINUE
} VisClockContinue} ;

typedef ByteFlags VisClockFlags ;
#define VCF_MOVING      		0x0040
#define VCF_RESTORED    		0x0020

/*---------------------------------------------------------------------------
 * 		Instance Data
 *--------------------------------------------------------------------------*/
@instance hptr VCI_timer;
@instance word VCI_timerID;
@instance VisClockContinue VCI_timerContinue;
@instance ChunkHandle VCI_region;
@instance word VCI_interval;
@endc

/******************************************************************************
 * 		VisAnalogClockClass
 ******************************************************************************
 *
 */
@class	VisAnalogClockClass, VisClockClass;

typedef struct {
    Rectangle		BGS_bounds;
    byte	        BGS_gstring;
} BoundedGString} ;

/*---------------------------------------------------------------------------
 * 		Instance Data
 *--------------------------------------------------------------------------*/
@instance ChunkHandle VACI_pattern;
@instance ChunkHandle VACI_hourHand;
@instance ChunkHandle VACI_minuteHand;
@instance ChunkHandle VACI_secondHand;

typedef enum {
    VACC_BACKGROUND	 	= 0,
    VACC_HOUR_HAND		      	= 1,
    VACC_MINUTE_HAND	        = 2,
    VACC_SECOND_HAND	        = 3,
} VisAnalogClockColor} ;

#define GR_CLOCK_COLOR_ESCAPE  GR_FIRST_GEOWORKS_ESCAPE

@instance WWFixed VACI_xScale;
@instance WWFixed VACI_yScale;
@instance WWFixed VACI_aspectRatio;
@instance word VACI_lastHourAngle;
@instance word VACI_lastMinuteAngle;
@instance word VACI_lastSecondAngle;
@instance word VACI_diameter;

@vardata Point ATTR_ANALOG_CLOCK_SHOW_AM_PM;

@endc

/* ----------------------------------------------------------------------------
 *   FlashingNoteClass
 * ------------------------------------------------------------------------- */
@class  FlashingNoteClass, GenInteractionClass;
/*
 *  The recommended usage of a FlashingNote object is to place it as the
 *  root of an unattached tree in it's own UI block. If you then use
 *  PutUpDialogViaUIThread to initiate it, and you don't manually
 *  destroy the dialog later, you should use
 *  HINT_FLASHING_NOTE_DESTROY_SELF_AFTER_DISMISS
 *
 */

/*
 *  Sets how long the dialog will stay up, before dimissing itself.
 *  (default = 3 seconds)
 *
 *  Pass:	ticks = number of ticks (if 0, then the dialog box will
 * 		never be dismissed, and any keystrokes will be ignored).
 */
@message void MSG_FLASHING_NOTE_SET_DURATION (int ticks = cx);

/*
 *  Internal messages:
 */
/*
 *  Sent to ourselves (by timer) when the dead zone is over,
 *  and we can start accepting keystrokes.
 */
@message void MSG_FLASHING_NOTE_ACCEPT_USER_ACTION ();

/*
 *  Sent to ourselves (by timer) when we want to be taken down.
 */
@message void MSG_FLASHING_NOTE_DISMISS_DIALOG (int timerID = bp);

/*
 *  External message again:
 */
@protominor FlashingNoteDismissNow
/*
 * Dismiss the dialog now, disregarding minimum duration. The timer,
 * if any, will be stopped.
 */
@message void MSG_FLASHING_NOTE_DISMISS_DIALOG_NOW ();
@protoreset

/*
 *  Vardata:
 */
@vardata void HINT_FLASHING_NOTE_DESTROY_SELF_AFTER_DISMISS;
/*
 *  Calls UserDestroyDialog on itself after dismissing the dialog.
 *  Suitable for routines which don't care when the dialog is taken
 *  down, and don't want to manually destroy it.
 */

@vardata word ATTR_FLASHING_NOTE_MINIMUM_DURATION;
/*
 *  How long, in # of ticks, the dialog will ignore keystrokes before
 *  allowing the user to bring down the dialog with a keystroke. Also,
 *  during this time, any IC_DISMISS sent to our object will be delayed
 *  till minimum duration is over.
 *  If not present, the default is 1 second.
 */

@vardata FlashingNoteTimerData TEMP_FLASHING_NOTE_TIMER_DATA;
/*
 *  Used to temporarily store the timer ID & timer handle.
 */

@vardata void TEMP_FLASHING_NOTE_DISMISS_ACTION_OK;
/*
 *  If present, user can dismiss dialog box with keystroke, or
 *  programmer can dismiss dialog.
 */

@vardata void TEMP_FLASHING_NOTE_TRIED_DISMISS;
/*
 *  If present, programmer tried to dismiss dialog before dead zone
 *  timer expired.
 */

@vardata void TEMP_FLASHING_NOTE_ALT_MARGINS;
/*
 * Used internally when smaller margins are needed to accomodate larger
 * flashing note contents.
 */

/*
 *  Instance data:
 */
@instance word	FNI_duration;
/*
 *  # of ticks to stay up
 */

@default GII_attrs      = (GIA_NOT_USER_INITIATABLE | GIA_SYS_MODAL);
@default GII_visibility = GIV_DIALOG;
@default GII_type       = GIT_MULTIPLE_RESPONSE;
@default FNI_duration   = FLASHING_NOTE_DEFAULT_DURATION;

@endc	/* FlashingNoteClass */

/* ----------------------------------------------------------------------------
 *   SelfDestroyingDialogClass
 * ------------------------------------------------------------------------- */
@class  SelfDestroyingDialogClass, GenInteractionClass;
/*
 *  A dialog which knows how to destroy itself after being closed.
 *
 *  This is used by FoamStandardDialogOptr's UI.
 *  The recommended usage of this object is to place it as the
 *  root of an unattached tree in it's own UI block.
 *
 *  Never call UserDestroyDialog directly on this object, instead use
 *  MSG_GEN_GUP_INTERACTION_COMMAND to send IC_DISMISS.
 */
@endc	/* SelfDestroyingDialogClass */

/* ----------------------------------------------------------------------------
 *   FoamProgressDialogClass
 * ------------------------------------------------------------------------- */
@class	FoamProgressDialogClass, GenControlClass;
/* A standard dialog which provides the cancellation animation.
 *
 *  Will contain:
 * 	description text to say what's going on
 * 	standard cancellation animation
 * 	status text for progress updates if desired
 * 	cancellation trigger
 */

/*
 *  Set the description text.
 *
 *  Pass: ^lcx:dx = optr to description text
 *  Return: nothing
 */
@message void MSG_FOAM_PROGRESS_DIALOG_SET_DESCRIPTION_TEXT_OPTR (
                optr descText = cx:dx);

/*
 *  Set the status text.
 *
 *  Pass: cx:dx = fptr to status text
 *  Return: nothing
 */
@message void MSG_FOAM_PROGRESS_DIALOG_SET_STATUS_TEXT (
                TCHAR *statusText = cx:dx);

/*
 *  Set the cancel action.
 *
 *  Pass: ^lcx:dx = optr to destination
 * 	   bp 	  = cancellation msg message
 *  Return: nothing
 */
@message void MSG_FOAM_PROGRESS_DIALOG_SET_CANCEL_ACTION (
                optr dest = cx:dx,
                word msg = bp);

/*
 *  Set the status text.
 *
 *  Pass: ^lcx:dx = optr to status text
 *  Return: nothing
 */
@message void MSG_FOAM_PROGRESS_DIALOG_SET_STATUS_TEXT_OPTR (
                  optr statusText = cx:dx);

/*
 *  Append text to the current status text.
 *
 *  Pass: cx:dx = fptr to status text to append
 * 		to current status text
 *  Return: nothing
 */
@message void MSG_FOAM_PROGRESS_DIALOG_APPEND_STATUS_TEXT (
                  TCHAR *statusText = cx:dx);

/*
 *  Set the description text.
 *
 *  Pass: cx:dx = fptr to description text
 *  Return: nothing
 */
@message void MSG_FOAM_PROGRESS_DIALOG_SET_DESCRIPTION_TEXT (
                  TCHAR *descText = cx:dx);

/*
 *  Append text to the current description text.
 *
 *  Pass: cx:dx = fptr to description text to append
 * 		to current description text
 *  Return: nothing
 */
@message void MSG_FOAM_PROGRESS_DIALOG_APPEND_DESCRIPTION_TEXT (
                  TCHAR *descText = cx:dx);

/*
 * Internal: Sent to us by our Cancel trigger when pressed.
 *
 * Pass: nothing
 * Return: nothing
 */
@message void MSG_FOAM_PROGRESS_DIALOG_CANCEL_TRIGGERED ();

/*
 * Calls UserDestroyDialog on itself after dismissing the dialog.
 * Suitable for routines which don't care when the dialog is taken
 * down, and don't want to manually destroy it.
 */
@vardata void HINT_FOAM_PROGRESS_DIALOG_DESTROY_SELF_AFTER_DISMISS;

/*
 * Specifies that the dialog should not be dismissed when the
 * cancel trigger is activated.  The application is responsible for
 * dismissing the dialog.
 */
@vardata void ATTR_FOAM_PROGRESS_DIALOG_DONT_DISMISS_ON_CANCEL;

@instance	ChunkHandle	FPDI_descriptionText 	= NullChunk;
@instance	ChunkHandle	FPDI_statusText 	= NullChunk;
@instance	optr		FPDI_cancelDestination 	= NullOptr;
@instance	word		FPDI_cancelActionMsg 	= 0;

@default 	GII_visibility	= GIV_POPUP;
@default 	GII_type	= GIT_MULTIPLE_RESPONSE;
@default 	GII_attrs      	= (GIA_NOT_USER_INITIATABLE | GIA_MODAL);
@default	GI_attrs	= GA_SIGNAL_INTERACTION_COMPLETE;
@default	GI_states	= (@default | GS_ENABLED);

@endc  /* FoamProgressDialogClass */

typedef WordFlags FoamProgressDialogFeatures ;
/* 15 bits unused */
#define FPDF_CANCEL 	(0x0001) /* whether there is a cancel trigger */

/*----------------------------------------------------------------------------
 *  FoamSubApplicationClass
 *--------------------------------------------------------------------------*/

@class FoamSubApplicationClass, GenApplicationClass;
/*
 * This class should be used for any application that must exist under the
 * systems, extras, or services application.    It provides needed default
 * behavior for sub-applications, and a method handler to call when the
 * user clicks on the "Close" button.
 */

@instance FApplication	FSAI_launcherApp;
    /* The name of the application that should launch this app.
     * Needed for proper open and close behavior for the sub-app.
     */

@message void MSG_FSA_RETURN_TO_LAUNCHER ();
/*
 * Provided for sub-apps to have an easy way to return to their parent app.
 * Usually called as a result of the user pressing "Close" in the sub-app.
 */

@vardata  void		TEMP_FOAM_SUB_APP_NOT_DEFAULT_LAUNCHABLE;
        /*
      * Used internally by FoamSubApplicationClass to determine
     * when the app may be lauched in place of the default launcher.
     */

@endc	/* FoamSubApplicationClass */

/*----------------------------------------------------------------------
 *	PickAToneClass
 *---------------------------------------------------------------------*/

/* Be sure to add entries to defaultToneTable. */

typedef enum {
    PATT_RINGING_TONE     = 0,
    PATT_CLOCK_ALARM    ,
    PATT_CALENDAR_ALARM    ,
    PATT_RECEIVED_SMS    ,
    PATT_RECEIVED_FAX    ,
    PATT_RECEIVED_MAIL    ,
    PATT_ALT_RINGING_TONE    ,
    PATT_RECALL_ALERT    ,
    PATT_CELL_BROADCAST    ,
    PATT_PERSONAL_TONE    ,
} PickAToneType} ;

#define PATT_COMMON_RINGING_TONE     PATT_RINGING_TONE

#define TONE_NAME_BUFFER_LENGTH 	FILE_LONGNAME_LENGTH+2

typedef TCHAR  ToneTitle  [TONE_NAME_BUFFER_LENGTH];

typedef enum {
    TT_NO_TONE     = 0,	    /* used for errors */
    TT_FIXED_TONE    ,	    /* one of the 5 fixed rings */
    TT_SHORT_TONE    ,	    /* tone fits in 1 block */
    TT_LONG_TONE    ,	    /* tone more than 1 block (3) */
    TT_UNCHECKED     = 250,     /* tone type has not been looked at yet */
} ToneType} ;

typedef	ByteFlags   ToneInfo   ;
#define	TI_ON_MMC	   0x01	/* Tone resides on MMC */

typedef struct {
    ToneTitle	TN_title;
    ToneType	TN_type;
    ToneInfo	TN_info;
} ToneName} ;

@class PickAToneClass, GenInteractionClass;
/*
 * This class provides standard UI for selecting a tone.
 */

/*
 * Internal: Called by GenDynamicList when it needs a moniker.
 * Pass: optr of the list
 *	 index of selection
 * Returns: nothing
 */
@message void MSG_PAT_NEED_MONIKER (optr theList = cx:dx,
                   word index = bp);

/*
 * Apply message of GenDynamicList.
 * Interception: May be intercepted for custom processing after
 * calling superclass.
 *
 * Pass: index of selection
 * Returns: nothing
 */
@message void MSG_PAT_TONE_SELECTED (word index = cx);

/*
 * Internal: Clean up and dismiss the interaction.
 *
 * Pass: nothing
 * Returns: nothing
 */
@message void MSG_PAT_CLOSE_INTERACTION ();

/*
 * Internal: Build list of the things to display in the GenDynamicList.
 *
 * Pass: nothing
 * Returns: nothing
 */
@message void MSG_PAT_INIT_DYNAMIC_LIST ();

/*
 * Get name of selected tone.
 *
 * Pass: pointer to ToneName structure to be filled in
 * Returns: ToneName structure filled
 */
@message void MSG_PAT_GET_TONE_NAME (ToneName *toneName = cx:dx);

/*
 * Sets the name of the selected tone.
 *
 * Pass: pointer to the string to use
 *	 TRUE/FALSE to indicate if tone is real or if "None" tone
 * Return: nothing
 */
@message void MSG_PAT_SET_TONE_NAME (TCHAR *toneName = cx:dx,
                    Boolean realTone = bp);

/*
 * Reset the tone eslection to the default.
 *
 * Pass: nothing
 * Return: nothing
 */
@message void MSG_PAT_SET_TO_DEFAULT ();

/*
 * Set the tone selection to "None"
 *
 * Pass: nothing
 * Return: nothing
 */
@message void MSG_PAT_SET_TO_NONE ();

/*
 * Internal: Play the currently indicated tone so the user knows
 * what it sounds like.  The tone is not actually selected until OK
 * is pressed.
 *
 * Pass; index of current selection
 *	 number of selections (1)
 *	 GenItemGroupStateFlags
 * Return: nothing
 */
@message void MSG_PAT_PLAY_SAMPLING (word index = cx,
                    word numSelections = bp,
                    GenItemGroupStateFlags flags = dx);

/*
 * Internal: Set the tone to be used for whatever tone type we are.
 *
 * Pass: nothing
 * Return: nothing
 */
@message void MSG_PAT_SET_RINGING_TONE ();

/*
 * Internal: Sent to us when ECI_RINGING_TONE_STATUS is received.
 *
 * Pass: value from selected_tone_7032
 * Return: nothing
 */
@message void MSG_PAT_RINGING_TONE_STATUS (word value = dx);

/*
 * Internal: Called one second after MSG_PAT_PLAY_SAMPLING to
 * actually play the selected tone.  This is triggered by a timer.
 *
 * Pass: tick count (returned by TimerGetCount)
 *	 timerID
 * Return: nothing
 */
@message void MSG_PAT_PLAY_DELAYED_SAMPLING (dword tickCount = cx.dx,
                        word timerID = bp);

@instance optr		    PATI_list;
     /* optr of GenDynamicList assigned to this instance */

@instance PickAToneType	    PATI_type;
     /* type of tone selector that we are */

@instance ChunkHandle	    PATI_toneArray;
     /* chunk array of tone names */

@instance word		    PATI_selection;
     /* index of current tone selection */

@instance ToneName	    PATI_toneName;
     /* string representation of tone name */

@instance Boolean	    PATI_longTones = TRUE;
     /* are long tones allowed for this type? */

@instance word		    PATI_timerID;
@instance hptr		    PATI_timerHandle;
@instance word		    PATI_timerTone;
    /* timer ID and handle for the PLAY_TONE_DELAY timer */

@endc	/* PickAToneClass */

@class MenuAnimationClass, MetaClass;
/*
 *  A class that handles the animation of a window. This is only used by
 *  the Specific UI to handle animation, and not recommended be used by
 *  other apps. If use is so desired, then follow these guidelines:
 *
 *  *  Place the MenuAnimationClass object in a template resource block,
 *     unattached to the UI tree.
 *  *  Duplicate the resource block and call
 *     MSG_MENU_ANIMATION_START_ANIMATION on the object.
 *  *  The duplicated resource block will be self-destroyed when
 *     animation is complete.
 */

@message void MSG_MENU_ANIMATION_START_ANIMATION (optr obj = cx:dx,
                         Message msg = bp);
/*
 *  Start the sequence of window animations
 *
 *  Pass: optr of object to notify when animation is complete
 * 	        = 0 if not to notify anyone
 * 	  message to be sent to object
 */

@message void MSG_MENU_ANIMATION_ADVANCE_ANIMATION ();
/*
 *  Internal: Sent by ourselves to advance to the next animation stage
 *
 *  Pass: nothing
 */

@message void MSG_MENU_ANIMATION_ANIMATION_COMPLETE ();
/*
 *  Internal: Sent when we want to destroy ourselves, cleaning up any open
 *  windows, and destroying the object block we are in.
 *
 *  Pass: nothing
 */

    /* optr of object to be notified when animation is complete */
    @instance optr		MAI_notifyObj = NullOptr;

    /* message to send to above object */
    @instance Message	MAI_notifyMsg = 0;

    /* the current window animation index */
    @instance word		MAI_curIndex = 0;

    /* timer info for the next stage of animation */
    @instance TimerHandle	MAI_timerHan = NullHandle;
    @instance word		MAI_timerID = 0;

    /* the gstate/window handle of the currently open window */
    @instance GStateHandle	MAI_gstate = NullHandle;

@endc	/* MenuAnimationClass */

/* ----------------------------------------------------------------------------
 *   Exported functions
 * --------------------------------------------------------------------------*/
extern void _far _pascal \
    FoamSetDocumentDir	(FDocumentDir fDocDir);

extern FDocumentDir _far _pascal \
    FoamGetDocumentDir	(void);

extern void _far _pascal \
    FoamGetDocumentDirName	(FDocumentDir fDocDir, FileLongName *buffer);

extern InteractionCommand _far _pascal \
    FoamDisplayDeleteWarning	(optr preText, TCHAR *midText, optr postText);

extern void _far _pascal \
        FoamDisplayDeleteWarningNoBlock        (optr bodyText, word msg, optr dest);

extern void _far _pascal \
    FoamDisplayWarning	(optr warningText);

extern InteractionCommand _far _pascal \
    FoamDisplayQuestion	(optr questionText);

extern void _far _pascal \
    FoamDisplayError	(optr errorText);

extern InteractionCommand _far _pascal \
    FoamDisplayOkCancelWarning	(optr warningText);

extern void _far _pascal \
    FoamDocSetAttrInfo	(DocumentHandle docHandle,
               FileAttrInfo *fileAttrInfo);
/*
 * SYNOPSIS:    Checks a document file for the correct protocol and creator
 *              token.
 *
 * PASS:        DocumentHandle docHandle - Document to check
 *              word numCreatorChars - Number of FEA_CREATOR token chars to
 *                                     check.  You can pass two if you only
 *                                     want to check the first to characters.
 *              word majorProtocol - Major protocol number to check
 *              word minorProtocol - Minor protocol number to check
 *                                   (pass -1 if you don't want to check the
 *                                    minor protocol.)
 *
 * RETURNS:    TRUE if the check failed.
 */
extern Boolean _far _pascal \
    FoamDocCheckProtocol	(DocumentHandle docHandle,
                 word numCreatorChars,
                 word majorProtocol,
                 word minorProtocol);

extern word _far _pascal \
    FoamDocCreate	(DocumentInfo *docInfo, FileAttrInfo *fileAttr,
              DocumentPrefix *prefix);

extern DocumentHandle _far _pascal \
    FoamDocOpen	(DocumentInfo *docInfo, FDocAccess docAccess);
        /* Use ThreadGetError to check error value */

extern void _far _pascal \
    FoamDocClose	(DocumentHandle docHandle);

extern Boolean _far _pascal \
    FoamDocDelete	(DocumentInfo *docInfo);

extern void _far _pascal \
    FoamDocSetBlockHandle	(DocumentHandle docHandle, \
                  VMBlockHandle block, FoamDocHeader docHeader);

extern void _far _pascal \
    FoamDocSetHeaderData	(DocumentHandle docHandle, \
                 word data, FoamDocHeader docHeader);

extern word _far _pascal \
    FoamDocGetHeaderData	(DocumentHandle docHandle, \
                 FoamDocHeader docHeader);

extern void _far _pascal \
    FoamDocSetTextLength	(DocumentHandle docHandle, \
                 dword length);

extern dword _far _pascal \
    FoamDocGetTextLength	(DocumentHandle docHandle);

extern dword _far _pascal \
    FoamDocGetTextLengthFromField	(char *field);

extern word _far _pascal \
    FoamDocGetDosTextSmall	(DocumentHandle docHandle, void *buffer,
                   word count);

extern void _far _pascal \
    FoamDocStoreDosTextSmall	(DocumentHandle docHandle, void *buffer, \
                word bufferLen);

extern optr _far _pascal \
    FoamDocConvertFromDosInit	(void);

extern void _far _pascal \
    FoamDocConvertFromDosAppend	(optr object, TCHAR *buffer,
                     word bufferLength);

extern void _far _pascal \
    FoamDocConvertFromDosDone	(DocumentHandle docHandle, optr object);

extern optr _far _pascal \
    FoamDocConvertToDosInit	(DocumentHandle docHandle);

extern word _far _pascal \
    FoamDocConvertToDosRange	(optr object, TCHAR *buffer,
                     dword startPos, dword endPos);

extern void _far _pascal \
    FoamDocConvertToDosDone	(optr object);

extern Boolean _far _pascal \
    FoamDocIsTextFormatted	(DocumentHandle docHandle,
                   DocumentFontInfo *fontInfo);

extern FoamDiskSpaceStatus _far _pascal \
        FoamCheckIfOutOfSpace        (void);

extern Boolean _far _pascal \
        FoamWarnIfOutOfSpace        (void);

extern FoamSaveAction _far _pascal \
        FoamWarnForSaving        (dword space);

extern Boolean _far _pascal \
        FoamCancelIfNoFreeSpace        (void);

extern FoamDiskSpaceStatus _far _pascal \
        FoamWarnIfNotEnoughSpace        (dword space);

extern FoamDiskSpaceStatus _far _pascal \
        FoamWarnSpaceAfterOperation        (void);

extern dword _far _pascal \
        FoamGetFreeDiskSpace        (void);

extern dword _far _pascal \
        FoamRoundUpAsMultipleOfClusterSize        (dword space);

extern dword _far _pascal \
        FoamRoundUpAsMultipleOfClusterSizeOnDisk        (dword space,
                         DiskHandle diskHan);

extern void _far _pascal \
    FoamLaunchApplication	(FApplication applicationConstant);

extern optr _far _pascal \
    PutUpDialogViaUIThread	(optr dialogBoxTemplate);

extern void _far _pascal \
    TakeDownDialogViaUIThread	(optr dialogBox);

typedef WordFlags FoamCustomDialogBoxFlags ;
#define FCDBF_SYSTEM_MODAL 		0x8000
#define FCDBF_DIALOG_TYPE 		0x6000
#define FCDBF_INTERACTION_TYPE 		0x1e00
#define FCDBF_DESTRUCTIVE_ACTION 	0x0100
#define FCDBF_NO_BEEP 			0x0080
#define FCDBF_DIALOG_TYPE_OFFSET 	13
#define FCDBF_INTERACTION_TYPE_OFFSET 	9
#define FCDBF_NO_BEEP_OFFSET 		7

/*
 * NOTE: rejectTriggerMessage, rejectTriggerDestination,
 *	 acceptTriggerMessage, and acceptTriggerDestination are unused
 *       in FoamStandardDialogOptr!!
 */
extern InteractionCommand _far _pascal \
        FoamStandardDialogOptr        (void *helpFile,
                       void *helpContext,
                   LayerPriority layerPriority,
                   Message rejectTriggerMessage,
                   optr rejectTriggerDestination,
                   Message acceptTriggerMessage,
                   optr acceptTriggerDestination,
                   optr triggerTopText,
                                   TCHAR *arg2,
                                   TCHAR *arg1,
                                   FoamCustomDialogBoxFlags dialogFlags,
                   optr bodyText,
                   optr titleText,
                   optr titleIconBitmap);

extern optr _far _pascal \
        FoamStandardDialogOptrNoBlock        (void *helpFile,
                   void *helpContext,
                   LayerPriority layerPriority,
                   Message rejectTriggerMessage,
                   optr rejectTriggerDestination,
                   Message acceptTriggerMessage,
                   optr acceptTriggerDestination,
                   optr triggerTopText,
                                   TCHAR *arg2,
                                   TCHAR *arg1,
                                   FoamCustomDialogBoxFlags dialogFlags,
                   optr bodyText,
                   optr titleText,
                   optr titleIconBitmap);

extern optr _far _pascal \
    CreateVisMonikerLine	(word pointSize,
            FontID typeFace,
            word numberOfFields,
            VisMonikerColumn *columnList);

extern optr _far _pascal \
    CreateVisMonikerLineAdaptableColumns	(word pointSize,
            FontID typeFace,
            word numberOfFields,
            VisMonikerColumn *columnList);

extern void _far _pascal \
    FoamDisplayNote	(optr noteText);

extern void _far _pascal \
    FoamDisplayNoteNoBlock	(optr noteText);

extern void _far _pascal \
    FoamDisplayErrorNoBlock	(optr errorText);

extern void _far _pascal \
    FoamDisplayWarningNoBlock	(optr warningText);

extern GeosFileType _far _pascal \
    FoamGetFileType	(TCHAR *filename);

extern GeosFileType _far _pascal \
    FoamGetHandleFileType	(DocumentHandle docHandle);

extern Boolean _far _pascal \
    FoamStopSoundSequence	(void);

/*
 * make a sequence of sound with UserStandardSound,
 * duration ticks.
 *
 * if (sound==FOAM_FCLOCK_ALARM_SOUND) then the start sound of clock
 * alarm will be played.
 */
#define FOAM_FCLOCK_ALARM_SOUND  -1

extern void _far _pascal \
    FoamStartSoundSequence	(StandardSoundType sound,
                word duration,
                word interval);

/*************************************************************************
C FUNCTION:	FoamUTOffset

C DECLARATION:	extern signed int _far _pascal
        FoamUTOffset(void)

RETURNS:	signed integer gmt offset (or universal time) in minutes.

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
        AW	9/28/95	        Initial version
*************************************************************************/

extern signed int _far _pascal \
        FoamUTOffset        ();

/*
 * Gets the "lexical order" of a character, for use in optimized
 * case and accent-insensitive searching (all versions of a character,
 * accented, unaccented, upper and lower case will have the same lexical
 * order).
 */
extern byte _pascal \
        FoamGetLexicalOrder    	(char theChar);

/*
 * SYNOPSIS:	Generates a unique document name.  A prefix is passed in
 *              fileBuffer, the function will add the "next available"
 *              number to the prefix and return the document name in
 *              the form: "[prefix] #[number]".
 *
 *		NOTE:  The caller should try and create the document using the
 *		       returned name.  If the create fails, call this function
 *		       again to get a new name.
 */
extern void _pascal \
    FoamGenerateUniqueFilename    (FileLongName *nameBuffer);

/*
 * SYNOPSIS:	Given a reason and a reason type passed to handlers for
 * 		ECI_CALL_RELEASE_STATUS and ECI_CALL_TERMINATE_STATUS, this
 * 		function returns values appropriate for returning in a mailbox
 * 		transport driver's DR_MBTD_TRANSMIT_MESSAGE.
 *
 * 		If a string needs to be returned, it will be in the foam
 * 		library's FoamECIErrorStrings resource.
 *
 * PASS:	reasonType	= ECICauseType
 *		reason		= ECICommonCause
 *
 * RETURNS:	TRUE if a problem caused the disconnect
 * 			*mbErrorString	= reason string for failure
 * 			*mbErr 		= MailboxError
 *
 * 		FALSE if it was a clean disconnect
 * 			*mbErr		= ME_SUCCESS
 * 			*mbErrorString	= 0
 */
extern Boolean _far _pascal \
        FoamECIToMailboxError    	(byte reasonType,
                  byte reason,
                  MailboxError *mbErr,
                  optr *mbErrorString);

/*
 * SYNOPSIS:	Copies the text of a text object into a chain of text
 * 		transfer items, each about 4000 bytes in size.  The
 * 		starting block of the chain is saved in FDH_TEXT_TR_ITEM
 *  		of the document mapblock.  The next transfer item block
 * 		handle is saved in the TTBH_reservedVM field of the
 * 		TextTransferBlockHeader.
 *
 *              When it's time read in the chain of text transfer items first
 *              use the block in FDH_TEXT_TR_ITEM with MSG_VIS_TEXT_REPLACE_
 *              WITH_TEXT_TRANSFER_FORMAT then loop until TTBH_reservedVM.high
 *              is zero.  To get at TTBH_reservedVM use VMLock passing the
 *              the VMBlockHandle you used when calling MSG_VIS_TEXT_REPLACE_
 *              WITH_TEXT_TRANSFER_FORMAT.
 *
 * PASS:        DocumentHandle docHandle - Document to store text in
 *              optr textObject - Text object containing text to store.
 *
 * RETURNS:     word - VMBlockHandle of the first text transfer item.
 *              (This handle is also stored in FDH_TEXT_TR_ITEM)
 */
extern word _far _pascal \
    FoamDocStoreTextAsVMChain    (DocumentHandle docHandle,
                  optr textObject);

/*
 * SYNOPSIS:    Tells you if text in a text object is formatted (does it have
 *              multiple character attributes).  If the text is not formatted
 *              the function will return the font and the point size of the
 *              text.
 *
 * PASS:        optr textObject - Text object containing text
 *              DocumentFontInfo *fontInfo - ptr to structure to store font
 *                                           info if the text is not formatted.
 *
 * RETURNS:     boolean - TRUE if text is formatted
 *                        FALSE if text is not formatted
 *                           fontInfo structure filled if text is not formatted
 */
extern Boolean _far _pascal \
    FoamIsTextFormatted    (optr textObject,
            DocumentFontInfo *fontInfo);

/*
 * SYNOPSIS:    Stores information on the document text in the GeosFileHeader
 *              of the Document.  This information can be retrieved by calling
 *              FoamDocIsTextFormatted.
 *
 * PASS:        DocumentHandle docHandle - Document to store info in
 *              FoamDocTextFormatted fdtf - Set to FDTF_FORMATTED if the text
 *                                          is formatted, otherwise
 *                                          FDTF_NOT_FORMATTED.
 *              DocumentFontInfo *fontInfo - If the text is not formatted then
 *                                           pass the font and point size of
 *                                           the text.
 *
 * RETURNS:     Nothing
 */
extern void _far _pascal \
    FoamDocSetTextFormatted    (DocumentHandle docHandle,
                FoamDocTextFormatted fdtf,
                DocumentFontInfo *fontInfo);

/*
 * Set the lowSoundFlag.
 *
 * When the flag is set to TRUE, UserStandardSound will play one plain
 * note, no matter what is being passed.
 *
 */
extern void _far _pascal FoamSetLowSoundFlag (word lowSndFlag);

/*
 * Get the lowSoundFlag.
 *
 */
extern word _far _pascal FoamGetLowSoundFlag (void);

/*
 * Generate a FoamPathHandle
 *
 * stdPath   - standard path to start from
 * pathname  - path name string
 *
 * returns: a valid FoamPathHandle for the path
 *
 */
extern	FoamPathHandle _far _pascal FoamPathMakeSP  (
                       StandardPath stdPath,
                       TCHAR *pathname );
/*
 * Generate a FoamPathHandle
 *
 * parent    - FoamPathHandle of parent directory
 * pathstr   - path string starting from parent
 *
 * returns: a valid FoamPathHandle for the path
 *
 */
extern FoamPathHandle _far _pascal FoamPathMake (
                    FoamPathHandle parent,
                    TCHAR *pathstr );

/*
 * Get parent of a FoamPathHandle
 *
 * fph       - FoamPathHandle to get parent of
 *
 * returns: parent FoamPathHandle
 *
 */
extern FoamPathHandle _far _pascal FoamPathParent ( FoamPathHandle fph );

/*
 * Get full path name of a FoamPathHandle
 *
 * fph       - FoamPathHandle to get full path of
 * buffer    - pointer to a buffer that's at least of size PathName
 *
 * returns:    StandardPath
 *             buffer filled in
 *
 */
extern StandardPath _far _pascal FoamPathGetFullPath (
                    FoamPathHandle fph,
                    TCHAR	   *buffer);
/*
 * Get full path name of a FoamPathHandle, changing the MMC directory
 * to the name of the card.  Do not use this path to access files, just to
 * display UI.
 *
 * fph       - FoamPathHandle to get full path of
 * buffer    - pointer to a buffer that's at least of size PathName
 *
 * returns:    StandardPath
 *             buffer filled in
 *
 */
extern StandardPath _far _pascal FoamPathGetFullPathForDisplay (
                    FoamPathHandle fph,
                    TCHAR	   *buffer);

/*
 * Get the name of folder from FoamPathHandle
 *
 * fph       - FoamPathHandle
 * buffer    - pointer to a buffer that's at least of size FileLongName
 *
 * returns:    nothing( buffer filled in )
 *
 */
extern void _far _pascal FoamPathFolderName ( FoamPathHandle fph,
                         TCHAR *buffer );
/*
 * Get the name of folder from FoamPathHandle, changing the MMC directory
 * to the name of the card.  Do not use this path to access files, just to
 * display UI.
 *
 * fph       - FoamPathHandle
 * buffer    - pointer to a buffer that's at least of size FileLongName
 *
 * returns:    nothing( buffer filled in )
 *
 */
extern void _far _pascal FoamPathFolderNameForDisplay ( FoamPathHandle fph,
                         TCHAR *buffer );

/*
 * Lock a FoamPathHandle
 *
 * fph       - FoamPathHandle to lock
 *
 * Returns:    nothing
 *
 */
extern void _far _pascal FoamPathLock ( FoamPathHandle fph );

/*
 * Unlock a FoamPathHandle
 *
 * fph       - FoamPathHandle to unlock
 *
 * returns:    nothing
 *
 */
extern void _far _pascal FoamPathUnlock ( FoamPathHandle fph );

/*
 * Check if a path is locked( so you cannot delete the directory)
 *
 * fph       - FoamPathHandle
 *
 * retunrs:    -1 if not locked
 *             0 if locked
 *
 */
extern word _far _pascal FoamPathCheckLock ( FoamPathHandle fph );

/*
 * Rename a directory represented by FoamPathHandle
 *
 * fph       - FoamPathHandle
 * newName   - string for new name
 *
 * returns:    nothing
 *
 */
extern void _far _pascal FoamPathRename ( FoamPathHandle fph,
                     TCHAR *newName );

/*
 * Check if a FoamPathHandle is a FDocumentDir
 *
 * fph       - FoamPathHandle
 *
 * returns:    -1 if it is a FDocumentDir
 *             0 if not
 *
 */
extern word _far _pascal FoamPathIsFDD ( FoamPathHandle fph );

/*
 * Launch the appropiate reader app.
 *
 * returns:    -1 if it failed to launch
 *             0 if not
 */
extern Boolean _far _pascal FoamLaunchReaderApp (FoamReaderAppType frat);

/*
 * Get the current backlight timeout level
 *
 * returns: [MINIMUM_BACKLIGHT_LEVEL .. MAXIMUM_BACKLIGHT_LEVEL]
 *          0 is off, actual timeout values are determined in the
 *          Respondr Library
 */
extern int _far _pascal FoamGetBacklightTimeout (void);

/*
 * Set the backlight timeout level
 *
 * pass:    timeout level, must be valid integer between
 *          [MINIMUM_BACKLIGHT_LEVEL .. MAXIMUM_BACKLIGHT_LEVEL]
 */
extern void _far _pascal FoamSetBacklightTimeout (int timeoutLevel);

/*
 * Retrieves the Document Outbox name
 */
extern void _far _pascal FoamGetDocumentOutboxName (FileLongName *buffer);

/*
 * Returns the current date and time as a TimerCompressedDate and hour/min
 */
extern void _far _pascal FoamGetCompressedDateTime (
    TimerCompressedDate *currentDate, word *currentTime);

/*
 * Returns (secondDate&Time) - (firstDate&Time) in minutes
 */
extern dword _far _pascal FoamGetMinutesBetweenTimes (
    TimerCompressedDate firstDate, word firstTime,
    TimerCompressedDate secondDate, word secondTime);

/*
 * Returns (date&time) + (time adjustment)
 */
extern void _far _pascal FoamAdjustTimeForward (
    TimerCompressedDate startDate, word startTime,
    word adjustment, AdvanceNoticeType noticeType,

    TimerCompressedDate *resultDate, word *resultTime);

/*
 * Returns (date&time) - (time adjustment)
 */
extern void _far _pascal FoamAdjustTimeBackward (
    TimerCompressedDate startDate, word startTime,
    word adjustment, AdvanceNoticeType noticeType,

    TimerCompressedDate *resultDate, word *resultTime);

extern optr _far _pascal
    FoamConvertZoomGString    (ZoomLevel zl, Handle hanSource,
    GStringType hanType, word chunkSource);

extern WWFixedAsDWord _far _pascal
    FoamConvertToZoomedSize    (ZoomLevel zoomLevel, WWFixedAsDWord pointSize);

extern void _far _pascal
    FoamZoomSetLevel    (ZoomLevel zoomLevel);

extern ZoomLevel _far _pascal
    FoamZoomGetLevel    ();

extern int _far _pascal
    FoamZoomedTextWidth    (TCHAR *text, int numChars, ZoomLevel zoomLevel,
    WWFixedAsDWord pointSize);

/*
 * Makes a copy of the template string, and replaces \1, \2 and \3 with
 * the not-null-terminated text found in the chunks s1, s2 and s3.
 *
 * s1 MUST have a valid block in it's optr.  s2 and s3 must be in the
 * same block, but are not required to be valid if the template does not
 * include \2 or \3. ""
 *
 * The returned string will be created in the same block as the passed
 * chunks are in.
 *
 *
 * added March 1998 (v3.0)
 */
extern optr _far _pascal FoamReplaceStringInTemplate (
    optr template, optr s1, optr s2, optr s3);

/*
 * Converts the dword into an ascii string in a chunk.
 * Useful for passing numbers into FoamReplaceStringInTemplate.
 *
 * If used for FoamReplaceStringInTemplate be sure not to null-terminate
 * the strings.
 *
 * added March 1998 (v3.0)
 */
extern optr _far _pascal FoamConvertValueToString (
    dword value, hptr lmemHandle, UtilHexToAsciiFlags flags);

extern optr _far _pascal
    FoamGetComplexMonikerBitmap    (ComplexMonikerBitmap cmb);

extern int _far _pascal
    FoamGetComplexMonikerText    (ComplexMonikerText cmt, TCHAR *buffer,
                  int bufsize);

/*
 * Foam disk space routines that take a disk handle as a parameter.
 */
extern FoamDiskSpaceStatus _far _pascal \
        FoamCheckIfOutOfSpaceOnDisk        (DiskHandle diskHan);

extern Boolean _far _pascal \
        FoamWarnIfOutOfSpaceOnDisk        (DiskHandle diskHan);

extern FoamSaveAction _far _pascal \
        FoamWarnForSavingOnDisk        (dword space, DiskHandle diskHan);

extern Boolean _far _pascal \
        FoamCancelIfNoFreeSpaceOnDisk        (DiskHandle diskHan);

extern FoamDiskSpaceStatus _far _pascal \
        FoamWarnIfNotEnoughSpaceOnDisk        (dword space, DiskHandle diskHan);

extern FoamDiskSpaceStatus _far _pascal \
        FoamWarnSpaceAfterOperationOnDisk        (DiskHandle diskHan);

extern dword _far _pascal \
    FoamGetFreeDiskSpaceOnDisk    (DiskHandle diskHan);

/*
 * Play a tone on CMT side.
 *
 * Available in Communicator products N9110 shipped in April 1998
 * or later.
 */
typedef enum {
    FCTT_STOP     = 0,			/* used to stop CMT alarm */
    FCTT_ALARM_CLOCK     = 5,		/* clock alarm */
    FCTT_CALENDAR_ALARM     = 6,		/* calendar alarm */
    FCTT_SMS_RECEIVED     = 7,		/* SMS received tone */
} FoamCMTToneType} ;

extern void _far _pascal FoamPlayCMTTone (FoamCMTToneType cmtTone);

#ifdef __HIGHC__
pragma Alias(FoamSetDocumentDir, "FOAMSETDOCUMENTDIR");
pragma Alias(FoamGetDocumentDir, "FOAMGETDOCUMENTDIR");
pragma Alias(FoamGetDocumentDirName, "FOAMGETDOCUMENTDIRNAME");
pragma Alias(FoamDisplayDeleteWarning, "FOAMDISPLAYDELETEWARNING");
pragma Alias(FoamDisplayDeleteWarningNoBlock, "FOAMDISPLAYDELETEWARNINGNOBLOCK");
pragma Alias(FoamDisplayWarning, "FOAMDISPLAYWARNING");
pragma Alias(FoamDisplayOkCancelWarning, "FOAMDISPLAYOKCANCELWARNING");
pragma Alias(FoamDisplayQuestion, "FOAMDISPLAYQUESTION");
pragma Alias(FoamDisplayError, "FOAMDISPLAYERROR");
pragma Alias(FoamDocSetAttrInfo, "FOAMDOCSETATTRINFO");
pragma Alias(FoamDocCheckProtocol, "FOAMDOCCHECKPROTOCOL");
pragma Alias(FoamDocCreate, "FOAMDOCCREATE");
pragma Alias(FoamDocOpen, "FOAMDOCOPEN");
pragma Alias(FoamDocClose, "FOAMDOCCLOSE");
pragma Alias(FoamDocDelete, "FOAMDOCDELETE");
pragma Alias(FoamDocSetBlockHandle, "FOAMDOCSETBLOCKHANDLE");
pragma Alias(FoamDocSetHeaderData, "FOAMDOCSETHEADERDATA");
pragma Alias(FoamDocGetHeaderData, "FOAMDOCGETHEADERDATA");
pragma Alias(FoamDocSetTextLength, "FOAMDOCSETTEXTLENGTH");
pragma Alias(FoamDocGetTextLength, "FOAMDOCGETTEXTLENGTH");
pragma Alias(FoamDocGetTextLengthFromField, "FOAMDOCGETTEXTLENGTHFROMFIELD");
pragma Alias(FoamDocGetDosTextSmall, "FOAMDOCGETDOSTEXTSMALL");
pragma Alias(FoamDocStoreDosTextSmall, "FOAMDOCSTOREDOSTEXTSMALL");
pragma Alias(FoamDocConvertFromDosInit, "FOAMDOCCONVERTFROMDOSINIT");
pragma Alias(FoamDocConvertFromDosAppend, "FOAMDOCCONVERTFROMDOSAPPEND");
pragma Alias(FoamDocConvertFromDosDone, "FOAMDOCCONVERTFROMDOSDONE");
pragma Alias(FoamDocConvertToDosInit, "FOAMDOCCONVERTTODOSINIT");
pragma Alias(FoamDocConvertToDosRange, "FOAMDOCCONVERTTODOSRANGE");
pragma Alias(FoamDocConvertToDosDone, "FOAMDOCCONVERTTODOSDONE");
pragma Alias(FoamDocIsTextFormatted, "FOAMDOCISTEXTFORMATTED");
pragma Alias(FoamIsTextFormatted, "FOAMISTEXTFORMATTED");
pragma Alias(FoamDocSetTextFormatted, "FOAMDOCSETTEXTFORMATTED");
pragma Alias(FoamCheckIfOutOfSpace, "FOAMCHECKIFOUTOFSPACE");
pragma Alias(FoamWarnIfOutOfSpace, "FOAMWARNIFOUTOFSPACE");
pragma Alias(FoamWarnForSaving, "FOAMWARNFORSAVING");
pragma Alias(FoamCancelIfNoFreeSpace, "FOAMCANCELIFNOFREESPACE");
pragma Alias(FoamWarnIfNotEnoughSpace, "FOAMWARNIFNOTENOUGHSPACE");
pragma Alias(FoamGetFreeDiskSpace, "FOAMGETFREEDISKSPACE");
pragma Alias(FoamWarnSpaceAfterOperation, "FOAMWARNSPACEAFTEROPERATION");
pragma Alias(FoamRoundUpAsMultipleOfClusterSize, "FOAMROUNDUPASMULTIPLEOFCLUSTERSIZE");
pragma Alias(FoamRoundUpAsMultipleOfClusterSizeOnDisk, "FOAMROUNDUPASMULTIPLEOFCLUSTERSIZEONDISK");
pragma Alias(FoamLaunchApplication, "FOAMLAUNCHAPPLICATION");
pragma Alias(PutUpDialogViaUIThread, "PUTUPDIALOGVIAUITHREAD");
pragma Alias(TakeDownDialogViaUIThread, "TAKEDOWNDIALOGVIAUITHREAD");
pragma Alias(FoamStandardDialogOptr, "FOAMSTANDARDDIALOGOPTR");
pragma Alias(FoamStandardDialogOptrNoBlock, "FOAMSTANDARDDIALOGOPTRNOBLOCK");
pragma Alias(CreateVisMonikerLine, "CREATEVISMONIKERLINE");
pragma Alias(CreateVisMonikerLineAdaptableColumns, "CREATEVISMONIKERLINEADAPTABLECOLUMNS");
pragma Alias(FoamDisplayNote,"FOAMDISPLAYNOTE");
pragma Alias(FoamDisplayNoteNoBlock,"FOAMDISPLAYNOTENOBLOCK");
pragma Alias(FoamDisplayWarningNoBlock, "FOAMDISPLAYWARNINGNOBLOCK");
pragma Alias(FoamDisplayErrorNoBlock, "FOAMDISPLAYERRORNOBLOCK");
pragma Alias(FoamGetFileType, "FOAMGETFILETYPE");
pragma Alias(FoamGetHandleFileType, "FOAMGETHANDLEFILETYPE");
pragma Alias(FoamUTOffset, "FOAMUTOFFSET");
pragma Alias(FoamStopSoundSequence, "FOAMSTOPSOUNDSEQUENCE");
pragma Alias(FoamStartSoundSequence, "FOAMSTARTSOUNDSEQUENCE");
pragma Alias(FoamGetLexicalOrder, "FOAMGETLEXICALORDER");
pragma Alias(FoamGenerateUniqueFilename, "FOAMGENERATEUNIQUEFILENAME");
pragma Alias(FoamECIToMailboxError, "FOAMECITOMAILBOXERROR");
pragma Alias(FoamDocStoreTextAsVMChain, "FOAMDOCSTORETEXTASVMCHAIN");
pragma Alias(FoamSetLowSoundFlag, "FOAMSETLOWSOUNDFLAG");
pragma Alias(FoamGetLowSoundFlag, "FOAMGETLOWSOUNDFLAG");
pragma Alias(FoamPathMakeSP, "FOAMPATHMAKESP");
pragma Alias(FoamPathMake, "FOAMPATHMAKE");
pragma Alias(FoamPathGetFullPath, "FOAMPATHGETFULLPATH");
pragma Alias(FoamPathFolderName, "FOAMPATHFOLDERNAME");
pragma Alias(FoamPathParent, "FOAMPATHPARENT");
pragma Alias(FoamPathLock, "FOAMPATHLOCK");
pragma Alias(FoamPathUnlock, "FOAMPATHUNLOCK");
pragma Alias(FoamPathCheckLock, "FOAMPATHCHECKLOCK");
pragma Alias(FoamPathRename, "FOAMPATHRENAME");
pragma Alias(FoamPathIsFDD, "FOAMPATHISFDD");
pragma Alias(FoamLaunchReaderApp,"FOAMLAUNCHREADERAPP");
pragma Alias(FoamSetBacklightTimeout,"FOAMSETBACKLIGHTTIMEOUT");
pragma Alias(FoamGetBacklightTimeout,"FOAMGETBACKLIGHTTIMEOUT");
pragma Alias(FoamGetDocumentOutboxName,"FOAMGETDOCUMENTOUTBOXNAME");
pragma Alias(FoamAdjustTimeForward,"FOAMADJUSTTIMEFORWARD");
pragma Alias(FoamAdjustTimeBackward,"FOAMADJUSTTIMEBACKWARD");
pragma Alias(FoamGetMinutesBetweenTimes,"FOAMGETMINUTESBETWEENTIMES");
pragma Alias(FoamGetCompressedDateTime,"FOAMGETCOMPRESSEDDATETIME");
pragma Alias(FoamConvertZoomGString,"FOAMCONVERTZOOMGSTRING");
pragma Alias(FoamConvertToZoomedSize,"FOAMCONVERTTOZOOMEDSIZE");
pragma Alias(FoamZoomSetLevel,"FOAMZOOMSETLEVEL");
pragma Alias(FoamZoomGetLevel,"FOAMZOOMGETLEVEL");
pragma Alias(FoamReplaceStringInTemplate,"FOAMREPLACESTRINGINTEMPLATE");
pragma Alias(FoamConvertValueToString,"FOAMCONVERTVALUETOSTRING");
pragma Alias(FoamGetComplexMonikerBitmap,"FOAMGETCOMPLEXMONIKERBITMAP");
pragma Alias(FoamGetComplexMonikerText,"FOAMGETCOMPLEXMONIKERTEXT");

pragma Alias(FoamCheckIfOutOfSpaceOnDisk, "FOAMCHECKIFOUTOFSPACEONDISK");
pragma Alias(FoamWarnIfOutOfSpaceOnDisk, "FOAMWARNIFOUTOFSPACEONDISK");
pragma Alias(FoamWarnForSavingOnDisk, "FOAMWARNFORSAVINGONDISK");
pragma Alias(FoamCancelIfNoFreeSpaceOnDisk, "FOAMCANCELIFNOFREESPACEONDISK");
pragma Alias(FoamWarnIfNotEnoughSpaceOnDisk, "FOAMWARNIFNOTENOUGHSPACEONDISK");
pragma Alias(FoamWarnSpaceAfterOperationOnDisk, "FOAMWARNSPACEAFTEROPERATIONONDISK");
pragma Alias(FoamGetFreeDiskSpaceOnDisk, "FOAMGETFREEDISKSPACEONDISK");
pragma Alias(FoamZoomedTextWidth, "FOAMZOOMEDTEXTWIDTH");
pragma Alias(FoamPlayCMTTone,"FOAMPLAYCMTTONE");
#endif
@endlib

@endif


foamdb.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1995 -- All Rights Reserved
 *
 * PROJECT:	Foam library
 * FILE:	foamdb.h
 *
 *
 * REVISION HISTORY:
 *
 *	Name	Date		Description
 *	----	----		-----------
 *	atw	11/ 2/94	Initial revision
 *      eballot 06/06/97        removed erroneous @deflib/@endlib
 *
 *
 * DESCRIPTION:
 *	Contains descriptions of external routines for the Foam DB.
 *	The FoamDB is a general-purpose database engine, upon which
 * 	other databases (such as the Contact database) are built.
 *
 *	Overview:
 *
 *	There are three ways to access record data:
 *
 *	1) FoamDBCreateEmptyRecord, which creates an empty record
 *	2) FoamDBGetRecordFromID, which, given an ID, finds the associated
 *	    record in the database
 *	3) FoamDBGetVisibleRecord, which returns the Nth visible record
 *	    in the database
 *
 *	These routines create in-memory representations of record data,
 *	which can then be passed to the other FoamDB routines. These
 *	in-memory representations should never be freed, but should instead
 *	be destroyed using FoamDBDiscardRecord, FoamDBDeleteRecord, or
 *	FoamDBSaveRecord, as appropriate.
 *
 *	Operations on database records are never actually performed on the
 * 	database file itself, and no changes are stored to the file
 *	until/unless FoamDBSaveRecord is called.
 *
 *	File format:
 *
 *	Each record consists of a RecordHeader structure, followed by an
 *	array of contiguous variable-length fields. Each field consists of a
 *	FieldHeader structure, followed by any data for the field (the data
 *	is not null terminated). The records are stored in two huge arrays, one
 *	for visible records, and one for invisible records (records with the
 *	FDBRF_INVISIBLE flag set). The huge arrays are sorted according to
 *	the data in the records.
 *
 *	The field names are stored in an element array which lies in an lmem
 *	block in the DB file. Each field contains a token which refers to an
 *	item in this field name element array.
 *
 *	Each record has a unique identifier in it, and each field in the
 *	record will have an ID that is unique among all fields in that
 *	record.
 *
 *	$Id: foamdb.h,v 1.16.1.6 98/04/23 16:00:31 mevissen Exp $
 *
 ***********************************************************************/

#ifndef __FOAMDB_H
#define	__FOAMDB_H

typedef dword RecordID ;
typedef word FieldID ;

/*
 * Notification information sent out when changes occur in the database
 */

typedef enum {
    FDBAT_ENTRY_ADDED    ,
    /* Indicates that a record was added to the database */

    FDBAT_ENTRY_CHANGED    ,
    /* Indicates that a record changed */

    FDBAT_ENTRY_DELETED    ,
    /* Indicates that a record was deleted */

    FDBAT_DB_CHANGED    ,
    /*
     * Indicates that there were large-scale changes to the database (restored
     * from backup, or whatever), so the database may need to be rescanned
     */

    FDBAT_DB_CLOSED    ,
    /*
     * Indicates that the database was closed
     */

    FDBAT_DB_ADDED    ,
    /*
     * Indicates a new database was created on the memory card
     */

    FDBAT_DB_REMOVED    ,
    /*
     * Indicates a database was deleted from the memory card
     */

    FDBAT_DB_SWITCHED_DBS
    /*
     * Indicates the "standard" db has changed to another db.
     * FDBCN_fileHan is the new db
     */

} FoamDBActionType} ;

typedef struct {
    /*
     * This is the information sent out with the GWNT_FOAM_DB_CHANGE
     * notification
     */

    VMFileHandle    FDBCN_fileHan;
    /* The handle of the database that has been changed */

    FoamDBActionType	FDBCN_action;
    /* The type of modification that just occurred */

/*
 *	The following fields are only filled in if FDBCN_action is
 *	FDBAT_ENTRY_DELETED, FDBAT_ENTRY_CHANGED, or FDBAT_ENTRY_ADDED
 */

    dword   FDBCN_entry;
#define INVISIBLE_RECORD     (-1)
    /*
     * The record number that was just modified/deleted/added (this is an index
     * into the visible array, or INVISIBLE_RECORD if the item was invisible)
     */

    RecordID	FDBCN_id;
    /* The ID of the record that was just added/modified/deleted */

} FoamDBChangeNotification} ;

typedef WordFlags FoamDBFlags ;
/*
 * Data stored in the map block for the database.
 */
typedef struct {
    RecordID   FDBM_recordID;
    /* The ID of the next record that will be allocated */

    VMBlockHandle   FDBM_fieldNameElementArray;
    /* The VM handle of the block containing the element array with the field
     * names */

    VMBlockHandle   FDBM_mainArray;
    VMBlockHandle   FDBM_secretArray;
    /* The handles of the huge arrays that contain visible and invisible
     * records */

    FoamDBFlags	    FDBM_flags;
    /* Internal flags for the map block */

    word    	    FDBM_reserved;
    /* Reserved for future use */

} FoamDBMap} ;

typedef ByteFlags FoamDBRecordFlags ;
#define FDBRF_INVISIBLE 	0x80
#define FDBRF_TEMPORARILY_VISIBLE    0x40
#define FDBRF_NOT_YET_SAVED    0x20
/*
 * The structure at the start of each record in the database
 */
typedef struct {
    RecordID   RH_id;
    /* The unique ID of this record */

    FieldID    RH_fieldID;
    /* The ID that will be assigned to the next field that is created in this
     * record */

    word    RH_fieldCount;
    /* The # fields in this record */

    FoamDBRecordFlags	RH_flags;
    /* Flags for the record */

} RecordHeader} ;

/*
 * The structure at the start of each field in the database
 */
typedef	struct {
    FieldID	FH_id;
    /* The ID for this field */

    word    	FH_nameToken;
    /* The token for the field name */

    word    	FH_size;
    /* The # bytes in the field, not counting the FieldHeader (0 if no data) */

    byte    	FH_type;
    /* The type of the field, used to insert the field in the correct place in
     * the record */
} FieldHeader} ;

extern VMFileHandle
    _pascal FoamDBOpen (char *filename, word mapBlockSize, word majorProtocol, word minorProtocol);
/*
 * Opens an existing database file, or creates a new one if it does not
 * currently exist. Returns the handle of the database file, or 0 if the
 * file could not be opened. ThreadGetError() can be called to return the
 * error type, which is the error returned from VMOpen, or -1 if there was
 * a protocol mismatch.
 *
 * mapBlockSize is used to specify the size of the map block for the database.
 * The default (minimum) size is "sizeof(FoamDBMap)", but more space can
 * be allocated if the application needs to store extra data in the map block.
 *
 * When creating a new file, the new file will be assigned the protocol number
 * passed in majorProtocol and minorProtocol. When opening an existing file,
 * the protocol number of the file is compared against the protocol number
 * passed in majorProtocol and minorProtocol, and if they do not match, an
 * error of -1 is returned.
 */

extern word
    _pascal FoamDBClose (VMFileHandle file);
/*
 * Closes the file (same as VMClose)
 */

extern MemHandle
    _pascal FoamDBCreateEmptyRecord (VMFileHandle file);
/*
 * Creates a new record in the database, gives it a unique ID, and returns
 * the handle of the record data. This record will contain no fields/data.
 * This record does not get saved to the database unless FoamDBSaveRecord()
 * is called. Clients should never call MemFree() on records, but should call
 * FoamDBDiscardRecord() or FoamDBSaveRecord() to discard any record changes
 * or commit them to the database.
 */

extern MemHandle
    _pascal FoamDBDuplicateRecord (VMFileHandle file, MemHandle record);
/*
 * Duplicates an existing record, assigns a new ID to it, and returns the
 * handle of the duplicate.
 * As with FoamDBCreateEmptyRecord, the record must eventually be saved or
 * destroyed by calling FoamDBDiscardRecord() or FoamDBSaveRecord().
 */

extern RecordID
    _pascal FoamDBGetRecordID (MemHandle record);
/*
 * Given a record handle, returns the RH_id field from the record
 */

extern FieldID
    _pascal FoamDBAddFieldToRecord (VMFileHandle file, MemHandle record, char *fieldName, word fieldType);
/*
 * Adds a field to the passed record, and gives it the specified name. A unique
 * FieldID is assigned to the new field, and returned to the caller.
 *
 * The "fieldType" is used by the database to determine the sort order of the
 * records (i.e. a field of type "3" will be inserted after all the existing
 * fields of type "3", but before the fields of type "4"). The Contdb library
 * defines what each field type is for contact databases.
 *
 * === WARNING ===
 *
 * The record block "record" passed to this routine may be resized and
 * moved upon returning. Any pointer pointing to this block may become
 * invalid.
 */

extern void
    _pascal FoamDBDeleteFieldFromRecord (VMFileHandle file, MemHandle record, FieldID id);
/*
 * Deletes a field from the record - FieldID is the ID of the field as returned
 * from FoamDBAddFieldToRecord().
 */

extern void
    _pascal FoamDBSetFieldName (VMFileHandle file, MemHandle record, FieldID id, char *name);
/*
 * Changes the name of the specified field. "name" is a null-terminated string
 */

extern void
    _pascal FoamDBSetFieldData (VMFileHandle file, MemHandle record, FieldID id, char *data, word dataSize);
/*
 * Stores data in the specified field.
 *
 * When storing ASCII data (strings), the strings should *not* be null
 * terminated. For example, if you want to store the string "ABCD", then
 * pass a pointer to the string, and dataSize=4.
 */

extern Boolean
    _pascal FoamDBGetFieldName (VMFileHandle file, MemHandle record, FieldID id, TCHAR *dest, word maxBytesToGet);
/*
 * Copies the null-terminated name of the specified field into the passed
 * buffer.
 */

extern Boolean
    _pascal FoamDBGetFieldType (VMFileHandle file, MemHandle record, FieldID id, byte *type);
/*
 * Gets the type of the specified field - returns non-zero if the field did not
 * exist.
 */

extern word
    _pascal FoamDBGetFieldData (VMFileHandle file, MemHandle record, FieldID id, char *dest, word maxBytesToGet);
/*
 * Gets the data for the passed field, and returns the number of bytes of data
 * associated with that field.
 *
 * Remember that the standard (most efficient) way to store string data is
 * *without* a null terminator, so callers will need to use the returned
 * data size.
 */

extern Boolean
    _pascal FoamDBFieldEnum (MemHandle record, void *enumData,
                PCB(Boolean, callback, /* TRUE to stop enum */
                (FieldHeader *field, void *enumData)));
/*
 * Calls a callback routine for each field in a record. The callback routine
 * can return non-zero to stop the enumeration. enumData is a pointer to
 * data that you can pass to the callback routine, and that the callback
 * routine can modify.
 *
 * Declaration of callback routine:
 *
 * Boolean _pascal CallBackRoutine(FieldHeader *field, void *enumData);
 */

extern Boolean
    _pascal FoamDBLockedRecordEnum (RecordHeader *record, void *enumData,
                 PCB(Boolean, callback, /* TRUE to stop enum */
                       (FieldHeader *field, void *enumData)));
/*
 * Calls a callback routine for each field in a locked down record. The
 * callback routine can return non-zero to stop the enumeration. enumData is
 * a pointer to data that you can pass to the callback routine, and that
 * the callback routine can modify.
 *
 * Declaration of callback routine:
 *
 * Boolean _pascal CallBackRoutine(FieldHeader *field, void *enumData);
 */

extern dword
    _pascal FoamDBSaveRecord (VMFileHandle file, MemHandle record,
                   PCB(sword, callback,
                   (RecordHeader *record1,
                    RecordHeader *record2)));
/*
 * Saves a record in the database file, and frees up the passed memory
 * block containing the record data. The callback routine determines where
 * in the database the record should be stored. The Contdb library provides
 * a front-end to this routine, which should be used when saving records
 * to a contact database.
 *
 * Declaration of callback routine:
 *
 * sword _pascal CallBackRoutine(RecordHeader *record1, RecordHeader *record2)
 *
 * The callback routine should return -1 if record1 should come before record2,
 * or +1 if record1 should come after record2 in the database
 */

extern void
    _pascal FoamDBDiscardRecord (VMFileHandle file, MemHandle record);
/*
 * Discards any changes to the passed record, and frees up the record
 * data stored in the passed handle, but does nothing to the data stored
 * in the database file.
 */

extern Boolean	/* XXX */
    _pascal FoamDBDeleteRecord (VMFileHandle file, MemHandle record);
/*
 * Frees up the passed record data, and, if the record exists in the
 * database, deletes it from the database as well.
 *
 * Returns non-zero if the record did not exist in the database.
 */

extern MemHandle
    _pascal FoamDBGetRecordFromID (VMFileHandle file, RecordID id);
/*
 * Looks for a record in the database with the specified ID, copies it
 * into memory, and returns the handle. If no record in the database had
 * the passed ID, returns 0.
 *
 * The handle returned should be freed using FoamDBDeleteRecord,
 * FoamDBDiscardRecord, or FoamDBSaveRecord.
 */

extern dword
    _pascal FoamDBGetNumVisibleRecords (VMFileHandle file);
/*
 * Returns the count of visible records in the database. Used to provide a
 * list of records to the user
 */

extern MemHandle
    _pascal FoamDBGetVisibleRecord (VMFileHandle file, dword index);
/*
 * Given the index of a visible record, copies the data into memory
 * and returns the handle of the block to the caller. If the index is
 * out of bounds, FoamDBGetVisibleRecord returns 0.
 *
 * The handle returned should be freed using FoamDBDeleteRecord,
 * FoamDBDiscardRecord, or FoamDBSaveRecord.
 */

extern Boolean
    _pascal FoamDBVisibleRecordEnumWithRange (VMFileHandle file, void *enumData,
                         dword startElement,
                         dword numOfRecords,
                PCB(Boolean, callback, /* TRUE to stop enum */
                (RecordHeader *record, void *enumData)));
/*
 * Calls a callback routine for some records in the database, starting
 * with the record # (Element to start at), and process (Number to
 * process) records only. The callback routine can return non-zero to
 * stop the enumeration. enumData is a pointer to data that you can
 * pass to the callback routine, and that the callback routine can modify.
 *
 * Declaration of callback routine:
 *
 * Boolean _pascal CallBackRoutine(RecordHeader *record, void *enumData);
 */

extern Boolean
    _pascal FoamDBVisibleRecordEnum (VMFileHandle file, void *enumData,
                PCB(Boolean, callback, /* TRUE to stop enum */
                (RecordHeader *record, void *enumData)));
/*
 * Calls a callback routine for each visible record in the database. The
 * callback routine can return non-zero to stop the enumeration. enumData
 * is a pointer to data that you can pass to the callback routine, and that
 * the callback routine can modify.
 *
 * Declaration of callback routine:
 *
 * Boolean _pascal CallBackRoutine(RecordHeader *record, void *enumData);
 */

extern Boolean
    _pascal FoamDBMapTokenToName (VMFileHandle file, word nameToken, word maxBytesToCopy, TCHAR *dest);
/*
 * Given a file handle, and a field name token, returns the field name
 * associated with the token. Returns non-zero if token was out of bounds
 */

extern void
    _pascal FoamDBSetNameForToken (VMFileHandle file, word nameToken, TCHAR *name);
/*
 * Given a field name token, changes the name associated with the token to
 * the passed name
 */

extern Boolean
    _pascal FoamDBMapNameToToken (VMFileHandle file, TCHAR *nameToLookFor, word *token);
/*
 * Given a file handle and a field name, looks the field name up in the DB,
 * to see if any fields currently have that name. If so, returns non-zero,
 * and stores the field name token in "token".
 */

extern dword
    _pascal FoamDBGetNextPrevRecord (VMFileHandle file, RecordID record,\
                    word count);
/*
 * Given a file handle, a RecordID, and the number of records we want
 * to move forward or backward (negative numbers), this routine returns
 * the index in the huge array for the target record
 *
 */

extern void
    _pascal FoamDBSuspendNotifications (VMFileHandle file);
/*
 * Stop generating notifications for the passed database. Calls to this routine
 * must be matched by calls to FoamDBResumeNotifications.
 */

extern void
    _pascal FoamDBResumeNotifications (VMFileHandle file);
/*
 * Resumes generating notifications for the passed database.
 */

extern RecordID
    _pascal FoamDBGetCurrentRecordID (VMFileHandle file);
/*
 * Returns the record ID that would be set for the next record
 */

extern void
    _pascal FoamDBSetCurrentRecordID (VMFileHandle file, RecordID id);
/*
 * Sets the record ID that would be set for the next record
 */

extern RecordID
    _pascal FoamDBBinarySearch (VMFileHandle file,
                   MemHandle record,
                   PCB(int, callback,
                   (void * passedRecord,
                    void * curRecord )));
/*
 * Do a binary search through all the records.
 *
 * Pass: file     - handle of the foam db file
 *       record   - handle of the record to search for or to be inserted
 *       callback - a virtual pointer to a callback routine
 *
 * The callback is passed:
 *	passedRecord - points to "record" passed to FoamDBBinarySearch
 *	curRecord    - current record found so far; compare this to
 *		       passRecord and return one of the following:
 *			 0 if items match
 *			-1 if passedRecord < curRecord
 *			 1 if passedRecord > curRecord
 */

extern void
    _pascal FoamDBSuspendUpdates (VMFileHandle file);
/*
 * Stop generating updates for the passed database. Calls to this routine
 * must be matched by calls to FoamDBResumeUpdates.
 */

extern void
    _pascal FoamDBResumeUpdates (VMFileHandle file);
/*
 * Resumes generating updates for the passed database.
 */

extern void
    _pascal FoamDBResortDatabase (VMFileHandle file,
                   PCB(sword, callback,
                   (RecordHeader *record1,
                    RecordHeader *record2)));
/*
 * Resorts the database
 */

/*
 * Function(s) available in N9110 (released after April 1998):
 */

extern dword
    _pascal FoamDBGetVisibleIndexFromID (VMFileHandle file, RecordID id);
/*
 * Given an ID, returns the visible index for the record associated with it
 * or 0xffffffff (-1) if the record is not in the visible array.
 */

#ifdef	__HIGHC__
pragma Alias(FoamDBOpen, "FOAMDBOPEN");
pragma Alias(FoamDBClose, "FOAMDBCLOSE");
pragma Alias(FoamDBCreateEmptyRecord, "FOAMDBCREATEEMPTYRECORD");
pragma Alias(FoamDBAddFieldToRecord, "FOAMDBADDFIELDTORECORD");
pragma Alias(FoamDBDeleteFieldFromRecord, "FOAMDBDELETEFIELDFROMRECORD");
pragma Alias(FoamDBSetFieldName, "FOAMDBSETFIELDNAME");
pragma Alias(FoamDBSetFieldData, "FOAMDBSETFIELDDATA");
pragma Alias(FoamDBGetFieldName, "FOAMDBGETFIELDNAME");
pragma Alias(FoamDBGetFieldData, "FOAMDBGETFIELDDATA");
pragma Alias(FoamDBFieldEnum, "FOAMDBFIELDENUM");
pragma Alias(FoamDBSaveRecord, "FOAMDBSAVERECORD");
pragma Alias(FoamDBDiscardRecord, "FOAMDBDISCARDRECORD");
pragma Alias(FoamDBDeleteRecord, "FOAMDBDELETERECORD");
pragma Alias(FoamDBGetRecordFromID, "FOAMDBGETRECORDFROMID");
pragma Alias(FoamDBGetNumVisibleRecords, "FOAMDBGETNUMVISIBLERECORDS");
pragma Alias(FoamDBGetVisibleRecord, "FOAMDBGETVISIBLERECORD");
pragma Alias(FoamDBDuplicateRecord, "FOAMDBDUPLICATERECORD");
pragma Alias(FoamDBVisibleRecordEnumWithRange, "FOAMDBVISIBLERECORDENUMWITHRANGE");
pragma Alias(FoamDBVisibleRecordEnum, "FOAMDBVISIBLERECORDENUM");
pragma Alias(FoamDBMapNameToToken, "FOAMDBMAPNAMETOTOKEN");
pragma Alias(FoamDBMapTokenToName, "FOAMDBMAPTOKENTONAME");
pragma Alias(FoamDBLockedRecordEnum, "FOAMDBLOCKEDRECORDENUM");
pragma Alias(FoamDBGetRecordID, "FOAMDBGETRECORDID");
pragma Alias(FoamDBGetNextPrevRecord, "FOAMDBGETNEXTPREVRECORD");
pragma Alias(FoamDBSuspendNotifications, "FOAMDBSUSPENDNOTIFICATIONS");
pragma Alias(FoamDBResumeNotifications, "FOAMDBRESUMENOTIFICATIONS");
pragma Alias(FoamDBGetCurrentRecordID, "FOAMDBGETCURRENTRECORDID");
pragma Alias(FoamDBSetCurrentRecordID, "FOAMDBSETCURRENTRECORDID");
pragma Alias(FoamDBBinarySearch, "FOAMDBBINARYSEARCH");
pragma Alias(FoamDBSuspendUpdates, "FOAMDBSUSPENDUPDATES");
pragma Alias(FoamDBResumeUpdates, "FOAMDBRESUMEUPDATES");
pragma Alias(FoamDBSetNameForToken, "FOAMDBSETNAMEFORTOKEN");
pragma Alias(FoamDBResortDatabase, "FOAMDBRESORTDATABASE");
pragma Alias(FoamDBGetVisibleIndexFromID, "FOAMDBGETVISIBLEINDEXFROMID");
#endif

#endif


font.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	font.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines font structures and routines
 *
 *	$Id: font.h,v 1.21.6.1 96/04/28 08:27:51 chris Exp $
 *
 ***********************************************************************/

#ifndef	__FONT_H
#define __FONT_H

#include  <fontID.h>

/* Font Constants */

#define DEFAULT_FONT_ID 		FID_BERKELEY
#define DEFAULT_FONT_SIZE 	10
#define FID_NAME_LEN 		20

#define MIN_POINT_SIZE 		4

#ifdef DO_DBCS
#define MAX_POINT_SIZE 		432
#else
#define MAX_POINT_SIZE 		792
#endif

/* Font Manufacturers */

typedef WordFlags FontIDRecord ;
#define FIDR_maker 	0xf000
#define FIDR_ID 		0x0fff

#define FIDR_maker_OFFSET 	12
#define FIDR_ID_OFFSET 		0

/* Font Type */

typedef ByteFlags FontAttrs ;
#define FA_USEFUL  	0x80
#define FA_FIXED_WIDTH 	0x40
#define FA_ORIENT 	0x20
#define FA_OUTLINE 	0x10
#define FA_FAMILY 	0x0f

#define FA_FAMILY_OFFSET 	0

/* Font Weights */

typedef ByteEnum    FontWeight    ;
#define FW_MINIMUM   75
#define FW_NORMAL    100
#define FW_MAXIMUM   125

/* Font Widths */

typedef ByteEnum    FontWidth    ;
#define    FWI_MINIMUM     	    25
#define    FWI_NARROW     	    75
#define    FWI_CONDENSED        85
#define    FWI_MEDIUM     	    100
#define    FWI_WIDE     	    125
#define    FWI_EXPANDED         150
#define    FWI_MAXIMUM     	    20

/***/

#define MAX_FONTS 	400
#define MAX_MENU_FONTS 	10

/***/

typedef struct {
    FontID	FES_ID;
    TCHAR	FES_name[FID_NAME_LEN];
} FontEnumStruct} ;

typedef ByteFlags FontEnumFlags ;
#define FEF_ALPHABETIZE 	0x80
#define FEF_USEFUL 	0x40
#define FEF_FIXED_WIDTH 	0x20
#define FEF_FAMILY 	0x10
#define FEF_STRING 	0x08
#define FEF_DOWNCASE 	0x04
#define FEF_BITMAPS 	0x02
#define FEF_OUTLINES 	0x01

extern word	/*XXX*/
    _pascal GrEnumFonts (FontEnumStruct *buffer, word size, FontEnumFlags flags,
        word family);

/***/

extern FontID	/*XXX*/
    _pascal GrCheckFontAvailID (FontEnumFlags flags, word family, FontID id);

extern FontID	/*XXX*/
    _pascal GrCheckFontAvailName (FontEnumFlags flags, word family, const char *name);

/***/

extern Boolean	/*XXX*/
    _pascal GrFindNearestPointsize (FontID id, dword sizeSHL16, word styles,
               word *styleFound, dword *sizeFoundSHL16);

/***/

extern FontID	/*XXX*/
    _pascal GrGetDefFontID (dword *sizeSHL16);

/***/

typedef enum /* word */ {
    GCMI_MIN_X    ,
    GCMI_MIN_X_ROUNDED    ,
    GCMI_MIN_Y    ,
    GCMI_MIN_Y_ROUNDED    ,
    GCMI_MAX_X    ,
    GCMI_MAX_X_ROUNDED    ,
    GCMI_MAX_Y    ,
    GCMI_MAX_Y_ROUNDED    ,
} GCM_info} ;

extern dword		/* value << 16  or value */	/*XXX*/
    _pascal GrCharMetrics (GStateHandle gstate, GCM_info info, word ch);

/***/

typedef enum /* word */ {
    GFMI_HEIGHT    =0, /* 0 */
    GFMI_HEIGHT_ROUNDED    =1,
    GFMI_MEAN    =2,
    GFMI_MEAN_ROUNDED    =3,
    GFMI_DESCENT    =4,
    GFMI_DESCENT_ROUNDED    =5,
    GFMI_BASELINE    =6,
    GFMI_BASELINE_ROUNDED    =7,
    GFMI_LEADING    =8,
    GFMI_LEADING_ROUNDED    =9,
    GFMI_AVERAGE_WIDTH    =10, /* 10 */
    GFMI_AVERAGE_WIDTH_ROUNDED    =11,
    GFMI_ASCENT    =12,
    GFMI_ASCENT_ROUNDED    =13,
    GFMI_MAX_WIDTH    =14,
    GFMI_MAX_WIDTH_ROUNDED    =15,
    GFMI_MAX_ADJUSTED_HEIGHT    =16,
    GFMI_MAX_ADJUSTED_HEIGHT_ROUNDED    =17,
    GFMI_UNDER_POS    =18,
    GFMI_UNDER_POS_ROUNDED    =19,
    GFMI_UNDER_THICKNESS    =20, /* 20 */
    GFMI_UNDER_THICKNESS_ROUNDED    =21,
    GFMI_ABOVE_BOX    =22,
    GFMI_ABOVE_BOX_ROUNDED    =23,
    GFMI_ACCENT    =24,
    GFMI_ACCENT_ROUNDED    =25,
    GFMI_DRIVER    =26, /* 26 */
    GFMI_KERN_COUNT    =28, /* 28 */
    GFMI_FIRST_CHAR    =30, /* 30 */
    GFMI_LAST_CHAR    =32, /* 32 */
    GFMI_DEFAULT_CHAR    =34, /* 34 */
    GFMI_STRIKE_POS    =36, /* 36 */
    GFMI_STRIKE_POS_ROUNDED    =37,
    GFMI_BELOW_BOX    =38,
    GFMI_BELOW_BOX_ROUNDED    =39,
} GFM_info} ;

extern dword		/* value << 16  or value */	/*XXX*/
    _pascal GrFontMetrics (GStateHandle gstate, GFM_info info);

/***/

extern word	/*XXX*/
    _pascal GrGetFontName (FontID id, char *name);

/***/

extern void 	/*XXX*/
    _pascal GrSetFontWeight (GStateHandle gstate, FontWeight weight);

extern void 	/*XXX*/
    _pascal GrSetFontWidth (GStateHandle gstate, FontWidth width);

typedef ByteEnum SuperscriptPosition ;
#define SPP_DISPLAY      50
#define SPP_FOOTNOTE     40
#define SPP_ALPHA        45
#define SPP_NUMERATOR    50
#define SPP_DEFAULT      50

typedef ByteEnum SuperscriptSize ;
#define SPS_DISPLAY      55
#define SPS_FOOTNOTE     65
#define SPS_ALPHA        75
#define SPS_NUMERATOR    60
#define SPS_DEFAULT      50

typedef struct {
    SuperscriptPosition position;
    SuperscriptSize     size;
} SuperscriptAttr} ;

extern void 	/*XXX*/
    _pascal GrSetSuperscriptAttr (GStateHandle gstate, SuperscriptAttr attrs);

typedef ByteEnum SubscriptPosition ;
#define SBP_CHEMICAL     30
#define SBP_DENOMINATOR   0
#define SBP_DEFAULT      50

typedef ByteEnum SubscriptSize ;
#define SBS_CHEMICAL     65
#define SBS_DENOMINATOR  60
#define SBS_DEFAULT      50

typedef struct {
    SubscriptPosition position;
    SubscriptSize     size;
} SubscriptAttr} ;

extern void 	/*XXX*/
    _pascal GrSetSubscriptAttr (GStateHandle gstate, SubscriptAttr attrs);

extern FontWeight   /*XXX*/
    _pascal GrGetFontWeight (GStateHandle gstate);

extern FontWidth    /*XXX*/
    _pascal GrGetFontWidth (GStateHandle gstate);

extern SuperscriptAttr	/*XXX*/
    _pascal GrGetSuperscriptAttr (GStateHandle gstate);

extern SubscriptAttr	/*XXX*/
    _pascal GrGetSubscriptAttr (GStateHandle gstate);

/***/

#ifdef __HIGHC__
pragma Alias(GrEnumFonts, "GRENUMFONTS");
pragma Alias(GrCheckFontAvailID, "GRCHECKFONTAVAILID");
pragma Alias(GrCheckFontAvailName, "GRCHECKFONTAVAILNAME");
pragma Alias(GrFindNearestPointsize, "GRFINDNEARESTPOINTSIZE");
pragma Alias(GrGetDefFontID, "GRGETDEFFONTID");
pragma Alias(GrCharMetrics, "GRCHARMETRICS");
pragma Alias(GrFontMetrics, "GRFONTMETRICS");
pragma Alias(GrGetFontName, "GRGETFONTNAME");
pragma Alias(GrSetFontWeight, "GRSETFONTWEIGHT");
pragma Alias(GrSetFontWidth, "GRSETFONTWIDTH");
pragma Alias(GrSetSuperscriptAttr, "GRSETSUPERSCRIPTATTR");
pragma Alias(GrSetSubscriptAttr, "GRSETSUBSCRIPTATTR");
pragma Alias(GrGetFontWeight, "GRGETFONTWEIGHT");
pragma Alias(GrGetFontWidth, "GRGETFONTWIDTH");
pragma Alias(GrGetSuperscriptAttr, "GRGETSUPERSCRIPTATTR");
pragma Alias(GrGetSubscriptAttr, "GRGETSUBSCRIPTATTR");
#endif

#endif


fontID.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1995 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	fontID.h
 * AUTHOR:	makefid Mon Jun 29 17:45:02 PDT 1998
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines font IDs.  To recreate it, use
 *	/staff/pcgeos/Tools/misc/makefid/makefid.  That script will
 *	create a new /tmp/fontID.h which you can then use to replace
 *	CInclude/fontID.h.
 *
 *	THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT IT
 *
 ***********************************************************************/

#ifndef __FONTID_H
#define __FONTID_H

typedef word FontMaker ;
#define FM_PRINTER  0xf000
#define FM_MICROLOGIC  0xe000
#define FM_ATECH  0xd000
#define FM_PUBLIC  0xc000
#define FM_AGFA  0x4000
#define FM_BITSTREAM  0x3000
#define FM_ADOBE  0x2000
#define FM_NIMBUSQ  0x1000
#define FM_BITMAP  0x0000

typedef word FontID ;
#define FID_PRINTER_24CPI  0xfa06
#define FID_PRINTER_20CPI  0xfa05
#define FID_PRINTER_17CPI  0xfa04
#define FID_PRINTER_16CPI  0xfa03
#define FID_PRINTER_15CPI  0xfa02
#define FID_PRINTER_12CPI  0xfa01
#define FID_PRINTER_10CPI  0xfa00
#define FID_PRINTER_PROP_SANS  0xf200
#define FID_PRINTER_PROP_SERIF  0xf000
#define FID_BITSTREAM_LETTER_GOTHIC  0x3a03
#define FID_PS_LETTER_GOTHIC  0x2a03
#define FID_DTC_LETTER_GOTHIC  0x1a03
#define FID_BITSTREAM_PRESTIGE_ELITE  0x3a02
#define FID_PS_PRESTIGE_ELITE  0x2a02
#define FID_DTC_PRESTIGE_ELITE  0x1a02
#define FID_BITSTREAM_AMERICAN_TYPEWRITER  0x3a01
#define FID_PS_AMERICAN_TYPEWRITER  0x2a01
#define FID_DTC_AMERICAN_TYPEWRITER  0x1a01
#define FID_BITSTREAM_URW_MONO  0x3a00
#define FID_PS_COURIER  0x2a00
#define FID_DTC_URW_MONO  0x1a00
#define FID_BITSTREAM_FUN_DINGBATS  0x380d
#define FID_PS_FUN_DINGBATS  0x280d
#define FID_DTC_FUN_DINGBATS  0x180d
#define FID_BITSTREAM_CHEQ  0x380c
#define FID_PS_CHEQ  0x280c
#define FID_DTC_CHEQ  0x180c
#define FID_BITSTREAM_BUNDESBAHN_PI_3  0x380b
#define FID_PS_BUNDESBAHN_PI_3  0x280b
#define FID_DTC_BUNDESBAHN_PI_3  0x180b
#define FID_BITSTREAM_BUNDESBAHN_PI_2  0x380a
#define FID_PS_BUNDESBAHN_PI_2  0x280a
#define FID_DTC_BUNDESBAHN_PI_2  0x180a
#define FID_BITSTREAM_BUNDESBAHN_PI_1  0x3809
#define FID_PS_BUNDESBAHN_PI_1  0x2809
#define FID_DTC_BUNDESBAHN_PI_1  0x1809
#define FID_BITSTREAM_U_GREEK_MATH_PI  0x3808
#define FID_PS_U_GREEK_MATH_PI  0x2808
#define FID_DTC_U_GREEK_MATH_PI  0x1808
#define FID_BITSTREAM_U_NEWS_COMM_PI  0x3807
#define FID_PS_U_NEWS_COMM_PI  0x2807
#define FID_DTC_U_NEWS_COMM_PI  0x1807
#define FID_BITSTREAM_ACE_I  0x3806
#define FID_PS_ACE_I  0x2806
#define FID_DTC_ACE_I  0x1806
#define FID_BITSTREAM_SONATA  0x3805
#define FID_PS_SONATA  0x2805
#define FID_DTC_SONATA  0x1805
#define FID_BITSTREAM_CARTA  0x3804
#define FID_PS_CARTA  0x2804
#define FID_DTC_CARTA  0x1804
#define FID_BITSTREAM_MICR  0x3803
#define FID_PS_MICR  0x2803
#define FID_DTC_MICR  0x1803
#define FID_BITSTREAM_ZAPF_DINGBATS  0x3802
#define FID_PS_ZAPF_DINGBATS  0x2802
#define FID_DTC_ZAPF_DINGBATS  0x1802
#define FID_BITSTREAM_DINGBATS  0x3801
#define FID_PS_DINGBATS  0x2801
#define FID_DTC_DINGBATS  0x1801
#define FID_BITSTREAM_URW_SYMBOLPS  0x3800
#define FID_PS_SYMBOL  0x2800
#define FID_DTC_URW_SYMBOLPS  0x1800
#define FID_BITSTREAM_JUNIPER  0x367f
#define FID_PS_JUNIPER  0x267f
#define FID_DTC_JUNIPER  0x167f
#define FID_BITSTREAM_COTTONWOOD  0x367e
#define FID_PS_COTTONWOOD  0x267e
#define FID_DTC_COTTONWOOD  0x167e
#define FID_BITSTREAM_BANCO  0x367d
#define FID_PS_BANCO  0x267d
#define FID_DTC_BANCO  0x167d
#define FID_BITSTREAM_ARCADIA  0x367c
#define FID_PS_ARCADIA  0x267c
#define FID_DTC_ARCADIA  0x167c
#define FID_BITSTREAM_ZIPPER  0x367b
#define FID_PS_ZIPPER  0x267b
#define FID_DTC_ZIPPER  0x167b
#define FID_BITSTREAM_WEIFZ_RUNDGOTIFCH  0x367a
#define FID_PS_WEIFZ_RUNDGOTIFCH  0x267a
#define FID_DTC_WEIFZ_RUNDGOTIFCH  0x167a
#define FID_BITSTREAM_WASHINGTON  0x3679
#define FID_PS_WASHINGTON  0x2679
#define FID_DTC_WASHINGTON  0x1679
#define FID_BITSTREAM_VICTORIAN  0x3678
#define FID_PS_VICTORIAN  0x2678
#define FID_DTC_VICTORIAN  0x1678
#define FID_BITSTREAM_VEGAS  0x3677
#define FID_PS_VEGAS  0x2677
#define FID_DTC_VEGAS  0x1677
#define FID_BITSTREAM_VARIO  0x3676
#define FID_PS_VARIO  0x2676
#define FID_DTC_VARIO  0x1676
#define FID_BITSTREAM_VAG_RUNDSCHRIFT  0x3675
#define FID_PS_VAG_RUNDSCHRIFT  0x2675
#define FID_DTC_VAG_RUNDSCHRIFT  0x1675
#define FID_BITSTREAM_TRAJANUS  0x3674
#define FID_PS_TRAJANUS  0x2674
#define FID_DTC_TRAJANUS  0x1674
#define FID_BITSTREAM_TITUS  0x3673
#define FID_PS_TITUS  0x2673
#define FID_DTC_TITUS  0x1673
#define FID_BITSTREAM_TIME_SCRIPT  0x3672
#define FID_PS_TIME_SCRIPT  0x2672
#define FID_DTC_TIME_SCRIPT  0x1672
#define FID_BITSTREAM_THUNDERBIRD  0x3671
#define FID_PS_THUNDERBIRD  0x2671
#define FID_DTC_THUNDERBIRD  0x1671
#define FID_BITSTREAM_THOROWGOOD  0x3670
#define FID_PS_THOROWGOOD  0x2670
#define FID_DTC_THOROWGOOD  0x1670
#define FID_BITSTREAM_TARRAGON  0x366f
#define FID_PS_TARRAGON  0x266f
#define FID_DTC_TARRAGON  0x166f
#define FID_BITSTREAM_TANGO  0x366e
#define FID_PS_TANGO  0x266e
#define FID_DTC_TANGO  0x166e
#define FID_BITSTREAM_SYNCHRO  0x366d
#define FID_PS_SYNCHRO  0x266d
#define FID_DTC_SYNCHRO  0x166d
#define FID_BITSTREAM_SUPERSTAR  0x366c
#define FID_PS_SUPERSTAR  0x266c
#define FID_DTC_SUPERSTAR  0x166c
#define FID_BITSTREAM_STOP  0x366b
#define FID_PS_STOP  0x266b
#define FID_DTC_STOP  0x166b
#define FID_BITSTREAM_STILLA_CAPS  0x366a
#define FID_PS_STILLA_CAPS  0x266a
#define FID_DTC_STILLA_CAPS  0x166a
#define FID_BITSTREAM_STILLA  0x3669
#define FID_PS_STILLA  0x2669
#define FID_DTC_STILLA  0x1669
#define FID_BITSTREAM_STENTOR  0x3668
#define FID_PS_STENTOR  0x2668
#define FID_DTC_STENTOR  0x1668
#define FID_BITSTREAM_SQUIRE  0x3667
#define FID_PS_SQUIRE  0x2667
#define FID_DTC_SQUIRE  0x1667
#define FID_BITSTREAM_SPRINGFIELD  0x3666
#define FID_PS_SPRINGFIELD  0x2666
#define FID_DTC_SPRINGFIELD  0x1666
#define FID_BITSTREAM_SLIPSTREAM  0x3665
#define FID_PS_SLIPSTREAM  0x2665
#define FID_DTC_SLIPSTREAM  0x1665
#define FID_BITSTREAM_SINALOA  0x3664
#define FID_PS_SINALOA  0x2664
#define FID_DTC_SINALOA  0x1664
#define FID_BITSTREAM_SHELLEY  0x3663
#define FID_PS_SHELLEY  0x2663
#define FID_DTC_SHELLEY  0x1663
#define FID_BITSTREAM_SERPENTINE  0x3662
#define FID_PS_SERPENTINE  0x2662
#define FID_DTC_SERPENTINE  0x1662
#define FID_BITSTREAM_RUBBER_STAMP  0x3661
#define FID_PS_RUBBER_STAMP  0x2661
#define FID_DTC_RUBBER_STAMP  0x1661
#define FID_BITSTREAM_ROMIC  0x3660
#define FID_PS_ROMIC  0x2660
#define FID_DTC_ROMIC  0x1660
#define FID_BITSTREAM_RIALTO  0x365f
#define FID_PS_RIALTO  0x265f
#define FID_DTC_RIALTO  0x165f
#define FID_BITSTREAM_REVUE  0x365e
#define FID_PS_REVUE  0x265e
#define FID_DTC_REVUE  0x165e
#define FID_BITSTREAM_QUENTIN  0x365d
#define FID_PS_QUENTIN  0x265d
#define FID_DTC_QUENTIN  0x165d
#define FID_BITSTREAM_PRO_ARTE  0x365c
#define FID_PS_PRO_ARTE  0x265c
#define FID_DTC_PRO_ARTE  0x165c
#define FID_BITSTREAM_PRINCETOWN  0x365b
#define FID_PS_PRINCETOWN  0x265b
#define FID_DTC_PRINCETOWN  0x165b
#define FID_BITSTREAM_PRESIDENT  0x365a
#define FID_PS_PRESIDENT  0x265a
#define FID_DTC_PRESIDENT  0x165a
#define FID_BITSTREAM_PREMIER  0x3659
#define FID_PS_PREMIER  0x2659
#define FID_DTC_PREMIER  0x1659
#define FID_BITSTREAM_POST_ANTIQUA  0x3658
#define FID_PS_POST_ANTIQUA  0x2658
#define FID_DTC_POST_ANTIQUA  0x1658
#define FID_BITSTREAM_PLAZA  0x3657
#define FID_PS_PLAZA  0x2657
#define FID_DTC_PLAZA  0x1657
#define FID_BITSTREAM_PLAYBILL  0x3656
#define FID_PS_PLAYBILL  0x2656
#define FID_DTC_PLAYBILL  0x1656
#define FID_BITSTREAM_PICCADILLY  0x3655
#define FID_PS_PICCADILLY  0x2655
#define FID_DTC_PICCADILLY  0x1655
#define FID_BITSTREAM_PEIGNOT  0x3654
#define FID_PS_PEIGNOT  0x2654
#define FID_DTC_PEIGNOT  0x1654
#define FID_BITSTREAM_PAPYRUS  0x3653
#define FID_PS_PAPYRUS  0x2653
#define FID_DTC_PAPYRUS  0x1653
#define FID_BITSTREAM_PADDINGTION  0x3652
#define FID_PS_PADDINGTION  0x2652
#define FID_DTC_PADDINGTION  0x1652
#define FID_BITSTREAM_OKAY  0x3651
#define FID_PS_OKAY  0x2651
#define FID_DTC_OKAY  0x1651
#define FID_BITSTREAM_ODIN  0x3650
#define FID_PS_ODIN  0x2650
#define FID_DTC_ODIN  0x1650
#define FID_BITSTREAM_OCTOPUSS  0x364f
#define FID_PS_OCTOPUSS  0x264f
#define FID_DTC_OCTOPUSS  0x164f
#define FID_BITSTREAM_MOTTER_FEMINA  0x364e
#define FID_PS_MOTTER_FEMINA  0x264e
#define FID_DTC_MOTTER_FEMINA  0x164e
#define FID_BITSTREAM_MICROGRAMMA  0x364d
#define FID_PS_MICROGRAMMA  0x264d
#define FID_DTC_MICROGRAMMA  0x164d
#define FID_BITSTREAM_MACHINE  0x364c
#define FID_PS_MACHINE  0x264c
#define FID_DTC_MACHINE  0x164c
#define FID_BITSTREAM_LINOTEXT  0x364b
#define FID_PS_LINOTEXT  0x264b
#define FID_DTC_LINOTEXT  0x164b
#define FID_BITSTREAM_LIBERTY  0x364a
#define FID_PS_LIBERTY  0x264a
#define FID_DTC_LIBERTY  0x164a
#define FID_BITSTREAM_LAZYBONES  0x3649
#define FID_PS_LAZYBONES  0x2649
#define FID_DTC_LAZYBONES  0x1649
#define FID_BITSTREAM_LATIN_WIDE  0x3648
#define FID_PS_LATIN_WIDE  0x2648
#define FID_DTC_LATIN_WIDE  0x1648
#define FID_BITSTREAM_KNIGHTSBRIDGE  0x3647
#define FID_PS_KNIGHTSBRIDGE  0x2647
#define FID_DTC_KNIGHTSBRIDGE  0x1647
#define FID_BITSTREAM_KAPITELLIA  0x3646
#define FID_PS_KAPITELLIA  0x2646
#define FID_DTC_KAPITELLIA  0x1646
#define FID_BITSTREAM_KALLIGRAPHIA  0x3645
#define FID_PS_KALLIGRAPHIA  0x2645
#define FID_DTC_KALLIGRAPHIA  0x1645
#define FID_BITSTREAM_ICE_AGE  0x3644
#define FID_PS_ICE_AGE  0x2644
#define FID_DTC_ICE_AGE  0x1644
#define FID_BITSTREAM_ICONE  0x3643
#define FID_PS_ICONE  0x2643
#define FID_DTC_ICONE  0x1643
#define FID_BITSTREAM_HORNDON  0x3642
#define FID_PS_HORNDON  0x2642
#define FID_DTC_HORNDON  0x1642
#define FID_BITSTREAM_HORATIO  0x3641
#define FID_PS_HORATIO  0x2641
#define FID_DTC_HORATIO  0x1641
#define FID_BITSTREAM_HIGHLIGHT  0x3640
#define FID_PS_HIGHLIGHT  0x2640
#define FID_DTC_HIGHLIGHT  0x1640
#define FID_BITSTREAM_HADFIELD  0x363f
#define FID_PS_HADFIELD  0x263f
#define FID_DTC_HADFIELD  0x163f
#define FID_BITSTREAM_GLASER_STENCIL  0x363e
#define FID_PS_GLASER_STENCIL  0x263e
#define FID_DTC_GLASER_STENCIL  0x163e
#define FID_BITSTREAM_GILL_KAYO  0x363d
#define FID_PS_GILL_KAYO  0x263d
#define FID_DTC_GILL_KAYO  0x163d
#define FID_BITSTREAM_GALADRIEL  0x363c
#define FID_PS_GALADRIEL  0x263c
#define FID_DTC_GALADRIEL  0x163c
#define FID_BITSTREAM_FUTURA_DISPLAY  0x363b
#define FID_PS_FUTURA_DISPLAY  0x263b
#define FID_DTC_FUTURA_DISPLAY  0x163b
#define FID_BITSTREAM_FUTURA_C_BLACK  0x363a
#define FID_PS_FUTURA_C_BLACK  0x263a
#define FID_DTC_FUTURA_C_BLACK  0x163a
#define FID_BITSTREAM_FRANKFURTER  0x3639
#define FID_PS_FRANKFURTER  0x2639
#define FID_DTC_FRANKFURTER  0x1639
#define FID_BITSTREAM_FLORA  0x3638
#define FID_PS_FLORA  0x2638
#define FID_DTC_FLORA  0x1638
#define FID_BITSTREAM_FLANGE  0x3637
#define FID_PS_FLANGE  0x2637
#define FID_DTC_FLANGE  0x1637
#define FID_BITSTREAM_FLASH  0x3636
#define FID_PS_FLASH  0x2636
#define FID_DTC_FLASH  0x1636
#define FID_BITSTREAM_FLAMENCO  0x3635
#define FID_PS_FLAMENCO  0x2635
#define FID_DTC_FLAMENCO  0x1635
#define FID_BITSTREAM_FETTE_GOTILCH  0x3634
#define FID_PS_FETTE_GOTILCH  0x2634
#define FID_DTC_FETTE_GOTILCH  0x1634
#define FID_BITSTREAM_FETTE_FRAKTUR  0x3633
#define FID_PS_FETTE_FRAKTUR  0x2633
#define FID_DTC_FETTE_FRAKTUR  0x1633
#define FID_BITSTREAM_ENVIRO  0x3632
#define FID_PS_ENVIRO  0x2632
#define FID_DTC_ENVIRO  0x1632
#define FID_BITSTREAM_EINHORN  0x3631
#define FID_PS_EINHORN  0x2631
#define FID_DTC_EINHORN  0x1631
#define FID_BITSTREAM_ECKMANN  0x3630
#define FID_PS_ECKMANN  0x2630
#define FID_DTC_ECKMANN  0x1630
#define FID_BITSTREAM_DYNAMO  0x362f
#define FID_PS_DYNAMO  0x262f
#define FID_DTC_DYNAMO  0x162f
#define FID_BITSTREAM_DOM_CASUAL  0x362e
#define FID_PS_DOM_CASUAL  0x262e
#define FID_DTC_DOM_CASUAL  0x162e
#define FID_BITSTREAM_DAVIDA  0x362d
#define FID_PS_DAVIDA  0x262d
#define FID_DTC_DAVIDA  0x162d
#define FID_BITSTREAM_CROISSANT  0x362c
#define FID_PS_CROISSANT  0x262c
#define FID_DTC_CROISSANT  0x162c
#define FID_BITSTREAM_CRILLEE  0x362b
#define FID_PS_CRILLEE  0x262b
#define FID_DTC_CRILLEE  0x162b
#define FID_BITSTREAM_COUNTDOWN  0x362a
#define FID_PS_COUNTDOWN  0x262a
#define FID_DTC_COUNTDOWN  0x162a
#define FID_BITSTREAM_CORTEZ  0x3629
#define FID_PS_CORTEZ  0x2629
#define FID_DTC_CORTEZ  0x1629
#define FID_BITSTREAM_CONFERENCE  0x3628
#define FID_PS_CONFERENCE  0x2628
#define FID_DTC_CONFERENCE  0x1628
#define FID_BITSTREAM_COMPANY  0x3627
#define FID_PS_COMPANY  0x2627
#define FID_DTC_COMPANY  0x1627
#define FID_BITSTREAM_COLUMNA_SOLID  0x3626
#define FID_PS_COLUMNA_SOLID  0x2626
#define FID_DTC_COLUMNA_SOLID  0x1626
#define FID_BITSTREAM_CITY  0x3625
#define FID_PS_CITY  0x2625
#define FID_DTC_CITY  0x1625
#define FID_BITSTREAM_CIRKULUS  0x3624
#define FID_PS_CIRKULUS  0x2624
#define FID_DTC_CIRKULUS  0x1624
#define FID_BITSTREAM_CHURCHWARD_BRUSH  0x3623
#define FID_PS_CHURCHWARD_BRUSH  0x2623
#define FID_DTC_CHURCHWARD_BRUSH  0x1623
#define FID_BITSTREAM_CHROMIUM_ONE  0x3622
#define FID_PS_CHROMIUM_ONE  0x2622
#define FID_DTC_CHROMIUM_ONE  0x1622
#define FID_BITSTREAM_CHOC  0x3621
#define FID_PS_CHOC  0x2621
#define FID_DTC_CHOC  0x1621
#define FID_BITSTREAM_CHISEL  0x3620
#define FID_PS_CHISEL  0x2620
#define FID_DTC_CHISEL  0x1620
#define FID_BITSTREAM_CHESTERFIELD  0x361f
#define FID_PS_CHESTERFIELD  0x261f
#define FID_DTC_CHESTERFIELD  0x161f
#define FID_BITSTREAM_CAROUSEL  0x361e
#define FID_PS_CAROUSEL  0x261e
#define FID_DTC_CAROUSEL  0x161e
#define FID_BITSTREAM_CAMELLIA  0x361d
#define FID_PS_CAMELLIA  0x261d
#define FID_DTC_CAMELLIA  0x161d
#define FID_BITSTREAM_CABARET  0x361c
#define FID_PS_CABARET  0x261c
#define FID_DTC_CABARET  0x161c
#define FID_BITSTREAM_BUXOM  0x361b
#define FID_PS_BUXOM  0x261b
#define FID_DTC_BUXOM  0x161b
#define FID_BITSTREAM_BUSTER  0x361a
#define FID_PS_BUSTER  0x261a
#define FID_DTC_BUSTER  0x161a
#define FID_BITSTREAM_BOTTLENECK  0x3619
#define FID_PS_BOTTLENECK  0x2619
#define FID_DTC_BOTTLENECK  0x1619
#define FID_BITSTREAM_BLOCK  0x3618
#define FID_PS_BLOCK  0x2618
#define FID_DTC_BLOCK  0x1618
#define FID_BITSTREAM_BINNER  0x3617
#define FID_PS_BINNER  0x2617
#define FID_DTC_BINNER  0x1617
#define FID_BITSTREAM_BERNHARD_ANTIQUE  0x3616
#define FID_PS_BERNHARD_ANTIQUE  0x2616
#define FID_DTC_BERNHARD_ANTIQUE  0x1616
#define FID_BITSTREAM_BELSHAW  0x3615
#define FID_PS_BELSHAW  0x2615
#define FID_DTC_BELSHAW  0x1615
#define FID_BITSTREAM_BARCELONA  0x3614
#define FID_PS_BARCELONA  0x2614
#define FID_DTC_BARCELONA  0x1614
#define FID_BITSTREAM_BAUHAUS  0x3613
#define FID_PS_BAUHAUS  0x2613
#define FID_DTC_BAUHAUS  0x1613
#define FID_BITSTREAM_AUGUSTEA_OPEN  0x3612
#define FID_PS_AUGUSTEA_OPEN  0x2612
#define FID_DTC_AUGUSTEA_OPEN  0x1612
#define FID_BITSTREAM_AMERICAN_UNCIAL  0x3611
#define FID_PS_AMERICAN_UNCIAL  0x2611
#define FID_DTC_AMERICAN_UNCIAL  0x1611
#define FID_BITSTREAM_ULTE_SCHWABACHER  0x3610
#define FID_PS_ULTE_SCHWABACHER  0x2610
#define FID_DTC_ULTE_SCHWABACHER  0x1610
#define FID_BITSTREAM_ARNOLD_BOCKLIN  0x360f
#define FID_PS_ARNOLD_BOCKLIN  0x260f
#define FID_DTC_ARNOLD_BOCKLIN  0x160f
#define FID_BITSTREAM_ALGERIAN  0x360e
#define FID_PS_ALGERIAN  0x260e
#define FID_DTC_ALGERIAN  0x160e
#define FID_BITSTREAM_PUMP  0x360d
#define FID_PS_PUMP  0x260d
#define FID_DTC_PUMP  0x160d
#define FID_BITSTREAM_MARIAGE  0x360c
#define FID_PS_MARIAGE  0x260c
#define FID_DTC_MARIAGE  0x160c
#define FID_BITSTREAM_OLD_TOWN  0x360b
#define FID_PS_OLD_TOWN  0x260b
#define FID_DTC_OLD_TOWN  0x160b
#define FID_BITSTREAM_HOBO  0x360a
#define FID_PS_HOBO  0x260a
#define FID_DTC_HOBO  0x160a
#define FID_BITSTREAM_GOUDY_HEAVYFACE  0x3609
#define FID_PS_GOUDY_HEAVYFACE  0x2609
#define FID_DTC_GOUDY_HEAVYFACE  0x1609
#define FID_BITSTREAM_DATA_70  0x3608
#define FID_PS_DATA_70  0x2608
#define FID_DTC_DATA_70  0x1608
#define FID_BITSTREAM_LCD  0x3607
#define FID_PS_LCD  0x2607
#define FID_DTC_LCD  0x1607
#define FID_BITSTREAM_BALLOON  0x3606
#define FID_PS_BALLOON  0x2606
#define FID_DTC_BALLOON  0x1606
#define FID_BITSTREAM_BLIPPO_C_BLACK  0x3605
#define FID_PS_BLIPPO_C_BLACK  0x2605
#define FID_DTC_BLIPPO_C_BLACK  0x1605
#define FID_BITSTREAM_COOPER_C_BLACK  0x3604
#define FID_PS_COOPER_C_BLACK  0x2604
#define FID_DTC_COOPER_C_BLACK  0x1604
#define FID_BITSTREAM_COPPERPLATE  0x3603
#define FID_PS_COPPERPLATE  0x2603
#define FID_DTC_COPPERPLATE  0x1603
#define FID_BITSTREAM_STENCIL  0x3602
#define FID_PS_STENCIL  0x2602
#define FID_DTC_STENCIL  0x1602
#define FID_BITSTREAM_OLD_ENGLISH  0x3601
#define FID_PS_OLD_ENGLISH  0x2601
#define FID_DTC_OLD_ENGLISH  0x1601
#define FID_BITSTREAM_BROADWAY  0x3600
#define FID_PS_BROADWAY  0x2600
#define FID_DTC_BROADWAY  0x1600
#define FID_BITSTREAM_KANJI_HON_MINCHO  0x3431
#define FID_PS_KANJI_HON_MINCHO  0x2431
#define FID_DTC_KANJI_HON_MINCHO  0x1431
#define FID_BITSTREAM_NUPITAL_SCRIPT  0x3430
#define FID_PS_NUPITAL_SCRIPT  0x2430
#define FID_DTC_NUPITAL_SCRIPT  0x1430
#define FID_BITSTREAM_MEDICI_SCRIPT  0x342f
#define FID_PS_MEDICI_SCRIPT  0x242f
#define FID_DTC_MEDICI_SCRIPT  0x142f
#define FID_BITSTREAM_CHARME  0x342e
#define FID_PS_CHARME  0x242e
#define FID_DTC_CHARME  0x142e
#define FID_BITSTREAM_CASCADE_SCRIPT  0x342d
#define FID_PS_CASCADE_SCRIPT  0x242d
#define FID_DTC_CASCADE_SCRIPT  0x142d
#define FID_BITSTREAM_LITHOS  0x342c
#define FID_PS_LITHOS  0x242c
#define FID_DTC_LITHOS  0x142c
#define FID_BITSTREAM_TEKTON  0x342b
#define FID_PS_TEKTON  0x242b
#define FID_DTC_TEKTON  0x142b
#define FID_BITSTREAM_VLADIMIR_SCRIPT  0x342a
#define FID_PS_VLADIMIR_SCRIPT  0x242a
#define FID_DTC_VLADIMIR_SCRIPT  0x142a
#define FID_BITSTREAM_VAN_DIJK  0x3429
#define FID_PS_VAN_DIJK  0x2429
#define FID_DTC_VAN_DIJK  0x1429
#define FID_BITSTREAM_SLOGAN  0x3428
#define FID_PS_SLOGAN  0x2428
#define FID_DTC_SLOGAN  0x1428
#define FID_BITSTREAM_SHAMROCK  0x3427
#define FID_PS_SHAMROCK  0x2427
#define FID_DTC_SHAMROCK  0x1427
#define FID_BITSTREAM_ROMAN_SCRIPT  0x3426
#define FID_PS_ROMAN_SCRIPT  0x2426
#define FID_DTC_ROMAN_SCRIPT  0x1426
#define FID_BITSTREAM_RAGE  0x3425
#define FID_PS_RAGE  0x2425
#define FID_DTC_RAGE  0x1425
#define FID_BITSTREAM_PRESENT_SCRIPT  0x3424
#define FID_PS_PRESENT_SCRIPT  0x2424
#define FID_DTC_PRESENT_SCRIPT  0x1424
#define FID_BITSTREAM_PHYLLIS_INITIALS  0x3423
#define FID_PS_PHYLLIS_INITIALS  0x2423
#define FID_DTC_PHYLLIS_INITIALS  0x1423
#define FID_BITSTREAM_PHYLLIS  0x3422
#define FID_PS_PHYLLIS  0x2422
#define FID_DTC_PHYLLIS  0x1422
#define FID_BITSTREAM_PEPITA  0x3421
#define FID_PS_PEPITA  0x2421
#define FID_DTC_PEPITA  0x1421
#define FID_BITSTREAM_PENDRY_SCRIPT  0x3420
#define FID_PS_PENDRY_SCRIPT  0x2420
#define FID_DTC_PENDRY_SCRIPT  0x1420
#define FID_BITSTREAM_PALETTE  0x341f
#define FID_PS_PALETTE  0x241f
#define FID_DTC_PALETTE  0x141f
#define FID_BITSTREAM_PALACE_SCRIPT  0x341e
#define FID_PS_PALACE_SCRIPT  0x241e
#define FID_DTC_PALACE_SCRIPT  0x141e
#define FID_BITSTREAM_NEVISON_CASUAL  0x341d
#define FID_PS_NEVISON_CASUAL  0x241d
#define FID_DTC_NEVISON_CASUAL  0x141d
#define FID_BITSTREAM_HILL  0x341c
#define FID_PS_HILL  0x241c
#define FID_DTC_HILL  0x141c
#define FID_BITSTREAM_LINOSCRIPT  0x341b
#define FID_PS_LINOSCRIPT  0x241b
#define FID_DTC_LINOSCRIPT  0x141b
#define FID_BITSTREAM_LINDSAY  0x341a
#define FID_PS_LINDSAY  0x241a
#define FID_DTC_LINDSAY  0x141a
#define FID_BITSTREAM_LE_GRIFFE  0x3419
#define FID_PS_LE_GRIFFE  0x2419
#define FID_DTC_LE_GRIFFE  0x1419
#define FID_BITSTREAM_KUNSTLERSCHREIBSCHRIFT  0x3418
#define FID_PS_KUNSTLERSCHREIBSCHRIFT  0x2418
#define FID_DTC_KUNSTLERSCHREIBSCHRIFT  0x1418
#define FID_BITSTREAM_JULIA_SCRIPT  0x3417
#define FID_PS_JULIA_SCRIPT  0x2417
#define FID_DTC_JULIA_SCRIPT  0x1417
#define FID_BITSTREAM_ISBELL  0x3416
#define FID_PS_ISBELL  0x2416
#define FID_DTC_ISBELL  0x1416
#define FID_BITSTREAM_ISADORA  0x3415
#define FID_PS_ISADORA  0x2415
#define FID_DTC_ISADORA  0x1415
#define FID_BITSTREAM_HOGARTH_SCRIPT  0x3414
#define FID_PS_HOGARTH_SCRIPT  0x2414
#define FID_DTC_HOGARTH_SCRIPT  0x1414
#define FID_BITSTREAM_HARLOW  0x3413
#define FID_PS_HARLOW  0x2413
#define FID_DTC_HARLOW  0x1413
#define FID_BITSTREAM_GLASTONBURY  0x3412
#define FID_PS_GLASTONBURY  0x2412
#define FID_DTC_GLASTONBURY  0x1412
#define FID_BITSTREAM_GILLIES_GOTHIC  0x3411
#define FID_PS_GILLIES_GOTHIC  0x2411
#define FID_DTC_GILLIES_GOTHIC  0x1411
#define FID_BITSTREAM_FREESTYLE_SCRIPT  0x3410
#define FID_PS_FREESTYLE_SCRIPT  0x2410
#define FID_DTC_FREESTYLE_SCRIPT  0x1410
#define FID_BITSTREAM_ENGLISCHE_SCHREIBSCHRIFT  0x340f
#define FID_PS_ENGLISCHE_SCHREIBSCHRIFT  0x240f
#define FID_DTC_ENGLISCHE_SCHREIBSCHRIFT  0x140f
#define FID_BITSTREAM_DEMIAN  0x340e
#define FID_PS_DEMIAN  0x240e
#define FID_DTC_DEMIAN  0x140e
#define FID_BITSTREAM_CANDICE  0x340d
#define FID_PS_CANDICE  0x240d
#define FID_DTC_CANDICE  0x140d
#define FID_BITSTREAM_BRONX  0x340c
#define FID_PS_BRONX  0x240c
#define FID_DTC_BRONX  0x140c
#define FID_BITSTREAM_BRODY  0x340b
#define FID_PS_BRODY  0x240b
#define FID_DTC_BRODY  0x140b
#define FID_BITSTREAM_BIBLE_SCRIPT  0x340a
#define FID_PS_BIBLE_SCRIPT  0x240a
#define FID_DTC_BIBLE_SCRIPT  0x140a
#define FID_BITSTREAM_ARISTON  0x3409
#define FID_PS_ARISTON  0x2409
#define FID_DTC_ARISTON  0x1409
#define FID_BITSTREAM_ANGLIA  0x3408
#define FID_PS_ANGLIA  0x2408
#define FID_DTC_ANGLIA  0x1408
#define FID_BITSTREAM_MISTRAL  0x3407
#define FID_PS_MISTRAL  0x2407
#define FID_DTC_MISTRAL  0x1407
#define FID_BITSTREAM_BALMORAL  0x3406
#define FID_PS_BALMORAL  0x2406
#define FID_DTC_BALMORAL  0x1406
#define FID_BITSTREAM_COMMERCIAL_SCRIPT  0x3405
#define FID_PS_COMMERCIAL_SCRIPT  0x2405
#define FID_DTC_COMMERCIAL_SCRIPT  0x1405
#define FID_BITSTREAM_KAUFMANN  0x3404
#define FID_PS_KAUFMANN  0x2404
#define FID_DTC_KAUFMANN  0x1404
#define FID_BITSTREAM_PARK_AVENUE  0x3403
#define FID_PS_PARK_AVENUE  0x2403
#define FID_DTC_PARK_AVENUE  0x1403
#define FID_BITSTREAM_BRUSH_SCRIPT  0x3402
#define FID_PS_BRUSH_SCRIPT  0x2402
#define FID_DTC_BRUSH_SCRIPT  0x1402
#define FID_BITSTREAM_VIVALDI  0x3401
#define FID_PS_VIVALDI  0x2401
#define FID_DTC_VIVALDI  0x1401
#define FID_BITSTREAM_ZAPF_CHANCERY  0x3400
#define FID_PS_ZAPF_CHANCERY  0x2400
#define FID_DTC_ZAPF_CHANCERY  0x1400
#define FID_BITSTREAM_KANJI_SQUARE_GOTHIC  0x323e
#define FID_PS_KANJI_SQUARE_GOTHIC  0x223e
#define FID_DTC_KANJI_SQUARE_GOTHIC  0x123e
#define FID_BITSTREAM_AVANTE_GARDE_CONDENSED  0x323d
#define FID_PS_AVANTE_GARDE_CONDENSED  0x223d
#define FID_DTC_AVANTE_GARDE_CONDENSED  0x123d
#define FID_BITSTREAM_INSIGNIA  0x323c
#define FID_PS_INSIGNIA  0x223c
#define FID_DTC_INSIGNIA  0x123c
#define FID_BITSTREAM_INDUSTRIA  0x323b
#define FID_PS_INDUSTRIA  0x223b
#define FID_DTC_INDUSTRIA  0x123b
#define FID_BITSTREAM_DORIC_BOLD  0x323a
#define FID_PS_DORIC_BOLD  0x223a
#define FID_DTC_DORIC_BOLD  0x123a
#define FID_BITSTREAM_AKZINDENZ_GROTESK  0x3239
#define FID_PS_AKZINDENZ_GROTESK  0x2239
#define FID_DTC_AKZINDENZ_GROTESK  0x1239
#define FID_BITSTREAM_GROTESK  0x3238
#define FID_PS_GROTESK  0x2238
#define FID_DTC_GROTESK  0x1238
#define FID_BITSTREAM_TEMPO  0x3237
#define FID_PS_TEMPO  0x2237
#define FID_DTC_TEMPO  0x1237
#define FID_BITSTREAM_SYNTAX  0x3236
#define FID_PS_SYNTAX  0x2236
#define FID_DTC_SYNTAX  0x1236
#define FID_BITSTREAM_STONE_SANS  0x3235
#define FID_PS_STONE_SANS  0x2235
#define FID_DTC_STONE_SANS  0x1235
#define FID_BITSTREAM_SERIF_GOTHIC  0x3234
#define FID_PS_SERIF_GOTHIC  0x2234
#define FID_DTC_SERIF_GOTHIC  0x1234
#define FID_BITSTREAM_PRIMUS_ANTIQUA  0x3233
#define FID_PS_PRIMUS_ANTIQUA  0x2233
#define FID_DTC_PRIMUS_ANTIQUA  0x1233
#define FID_BITSTREAM_PRIMUS  0x3232
#define FID_PS_PRIMUS  0x2232
#define FID_DTC_PRIMUS  0x1232
#define FID_BITSTREAM_PRAXIS  0x3231
#define FID_PS_PRAXIS  0x2231
#define FID_DTC_PRAXIS  0x1231
#define FID_BITSTREAM_PANACHE  0x3230
#define FID_PS_PANACHE  0x2230
#define FID_DTC_PANACHE  0x1230
#define FID_BITSTREAM_OCR_B  0x322f
#define FID_PS_OCR_B  0x222f
#define FID_DTC_OCR_B  0x122f
#define FID_BITSTREAM_OCR_A  0x322e
#define FID_PS_OCR_A  0x222e
#define FID_DTC_OCR_A  0x122e
#define FID_BITSTREAM_NEWTEXT  0x322d
#define FID_PS_NEWTEXT  0x222d
#define FID_DTC_NEWTEXT  0x122d
#define FID_BITSTREAM_NEWS_GOTHIC  0x322c
#define FID_PS_NEWS_GOTHIC  0x222c
#define FID_DTC_NEWS_GOTHIC  0x122c
#define FID_BITSTREAM_NEUZEIT_GROTESK  0x322b
#define FID_PS_NEUZEIT_GROTESK  0x222b
#define FID_DTC_NEUZEIT_GROTESK  0x122b
#define FID_BITSTREAM_MIXAGE  0x322a
#define FID_PS_MIXAGE  0x222a
#define FID_DTC_MIXAGE  0x122a
#define FID_BITSTREAM_MAXIMA  0x3229
#define FID_PS_MAXIMA  0x2229
#define FID_DTC_MAXIMA  0x1229
#define FID_BITSTREAM_LUCIDA_SANS  0x3228
#define FID_PS_LUCIDA_SANS  0x2228
#define FID_DTC_LUCIDA_SANS  0x1228
#define FID_BITSTREAM_LITERA  0x3227
#define FID_PS_LITERA  0x2227
#define FID_DTC_LITERA  0x1227
#define FID_BITSTREAM_KABEL  0x3226
#define FID_PS_KABEL  0x2226
#define FID_DTC_KABEL  0x1226
#define FID_BITSTREAM_HOLSATIA  0x3225
#define FID_PS_HOLSATIA  0x2225
#define FID_DTC_HOLSATIA  0x1225
#define FID_BITSTREAM_HELVETICA_INSERAT  0x3224
#define FID_PS_HELVETICA_INSERAT  0x2224
#define FID_DTC_HELVETICA_INSERAT  0x1224
#define FID_BITSTREAM_NEUE_HELVETICA  0x3223
#define FID_PS_NEUE_HELVETICA  0x2223
#define FID_DTC_NEUE_HELVETICA  0x1223
#define FID_BITSTREAM_HELVETICA  0x3222
#define FID_PS_HELVETICA  0x2222
#define FID_DTC_HELVETICA  0x1222
#define FID_BITSTREAM_HAAS_UNICA  0x3221
#define FID_PS_HAAS_UNICA  0x2221
#define FID_DTC_HAAS_UNICA  0x1221
#define FID_BITSTREAM_GOUDY_SANS  0x3220
#define FID_PS_GOUDY_SANS  0x2220
#define FID_DTC_GOUDY_SANS  0x1220
#define FID_BITSTREAM_GOTHIC  0x321f
#define FID_PS_GOTHIC  0x221f
#define FID_DTC_GOTHIC  0x121f
#define FID_BITSTREAM_GILL_SANS  0x321e
#define FID_PS_GILL_SANS  0x221e
#define FID_DTC_GILL_SANS  0x121e
#define FID_BITSTREAM_GILL  0x321d
#define FID_PS_GILL  0x221d
#define FID_DTC_GILL  0x121d
#define FID_BITSTREAM_FUTURA  0x321c
#define FID_PS_FUTURA  0x221c
#define FID_DTC_FUTURA  0x121c
#define FID_BITSTREAM_FOLIO  0x321b
#define FID_PS_FOLIO  0x221b
#define FID_DTC_FOLIO  0x121b
#define FID_BITSTREAM_FLYER  0x321a
#define FID_PS_FLYER  0x221a
#define FID_DTC_FLYER  0x121a
#define FID_BITSTREAM_FETTE_MIDSCHRIFT  0x3219
#define FID_PS_FETTE_MIDSCHRIFT  0x2219
#define FID_DTC_FETTE_MIDSCHRIFT  0x1219
#define FID_BITSTREAM_FETTE_ENGSCHRIFT  0x3218
#define FID_PS_FETTE_ENGSCHRIFT  0x2218
#define FID_DTC_FETTE_ENGSCHRIFT  0x1218
#define FID_BITSTREAM_ERAS  0x3217
#define FID_PS_ERAS  0x2217
#define FID_DTC_ERAS  0x1217
#define FID_BITSTREAM_DIGI_GROTESK  0x3216
#define FID_PS_DIGI_GROTESK  0x2216
#define FID_DTC_DIGI_GROTESK  0x1216
#define FID_BITSTREAM_CORINTHIAN  0x3215
#define FID_PS_CORINTHIAN  0x2215
#define FID_DTC_CORINTHIAN  0x1215
#define FID_BITSTREAM_COMPACTA  0x3214
#define FID_PS_COMPACTA  0x2214
#define FID_DTC_COMPACTA  0x1214
#define FID_BITSTREAM_CLEARFACE_GOTHIC  0x3213
#define FID_PS_CLEARFACE_GOTHIC  0x2213
#define FID_DTC_CLEARFACE_GOTHIC  0x1213
#define FID_BITSTREAM_OPTIMA  0x3212
#define FID_PS_OPTIMA  0x2212
#define FID_DTC_OPTIMA  0x1212
#define FID_BITSTREAM_CHELMSFORD  0x3211
#define FID_PS_CHELMSFORD  0x2211
#define FID_DTC_CHELMSFORD  0x1211
#define FID_BITSTREAM_CASTLE  0x3210
#define FID_PS_CASTLE  0x2210
#define FID_DTC_CASTLE  0x1210
#define FID_BITSTREAM_BRITANNIC  0x320f
#define FID_PS_BRITANNIC  0x220f
#define FID_DTC_BRITANNIC  0x120f
#define FID_BITSTREAM_BERLINER_GROTESK  0x320e
#define FID_PS_BERLINER_GROTESK  0x220e
#define FID_DTC_BERLINER_GROTESK  0x120e
#define FID_BITSTREAM_BENGUIAT_GOTHIC  0x320d
#define FID_PS_BENGUIAT_GOTHIC  0x220d
#define FID_DTC_BENGUIAT_GOTHIC  0x120d
#define FID_BITSTREAM_AVANTE_GARDE  0x320c
#define FID_PS_AVANTE_GARDE  0x220c
#define FID_DTC_AVANTE_GARDE  0x120c
#define FID_BITSTREAM_ANZEIGEN_GROTESK  0x320b
#define FID_PS_ANZEIGEN_GROTESK  0x220b
#define FID_DTC_ANZEIGEN_GROTESK  0x120b
#define FID_BITSTREAM_ANTIQUE_OLIVE  0x320a
#define FID_PS_ANTIQUE_OLIVE  0x220a
#define FID_DTC_ANTIQUE_OLIVE  0x120a
#define FID_BITSTREAM_ALTERNATE_GOTHIC  0x3209
#define FID_PS_ALTERNATE_GOTHIC  0x2209
#define FID_DTC_ALTERNATE_GOTHIC  0x1209
#define FID_BITSTREAM_AKZIDENZ_GROTESK_BUCH  0x3208
#define FID_PS_AKZIDENZ_GROTESK_BUCH  0x2208
#define FID_DTC_AKZIDENZ_GROTESK_BUCH  0x1208
#define FID_BITSTREAM_AKZIDENZ_GROTESK  0x3207
#define FID_PS_AKZIDENZ_GROTESK  0x2207
#define FID_DTC_AKZIDENZ_GROTESK  0x1207
#define FID_BITSTREAM_AVENIR  0x3206
#define FID_PS_AVENIR  0x2206
#define FID_DTC_AVENIR  0x1206
#define FID_BITSTREAM_UNIVERS  0x3205
#define FID_PS_UNIVERS  0x2205
#define FID_DTC_UNIVERS  0x1205
#define FID_BITSTREAM_FRANKLIN_GOTHIC  0x3204
#define FID_PS_FRANKLIN_GOTHIC  0x2204
#define FID_DTC_FRANKLIN_GOTHIC  0x1204
#define FID_BITSTREAM_ANGRO  0x3203
#define FID_PS_ANGRO  0x2203
#define FID_DTC_ANGRO  0x1203
#define FID_BITSTREAM_EUROSTILE  0x3202
#define FID_PS_EUROSTILE  0x2202
#define FID_DTC_EUROSTILE  0x1202
#define FID_BITSTREAM_FRUTIGER  0x3201
#define FID_PS_FRUTIGER  0x2201
#define FID_DTC_FRUTIGER  0x1201
#define FID_BITSTREAM_URW_SANS  0x3200
#define FID_PS_URW_SANS  0x2200
#define FID_DTC_URW_SANS  0x1200
#define FID_BITSTREAM_ANGSANA_NEW  0x307f
#define FID_PS_ANGSANA_NEW  0x207f
#define FID_DTC_ANGSANA_NEW  0x107f
#define FID_BITSTREAM_GALLIARD_ROMAN_ITALIC  0x307e
#define FID_PS_GALLIARD_ROMAN_ITALIC  0x207e
#define FID_DTC_GALLIARD_ROMAN_ITALIC  0x107e
#define FID_BITSTREAM_GRANJON  0x307d
#define FID_PS_GRANJON  0x207d
#define FID_DTC_GRANJON  0x107d
#define FID_BITSTREAM_GARTH_GRAPHIC  0x307c
#define FID_PS_GARTH_GRAPHIC  0x207c
#define FID_DTC_GARTH_GRAPHIC  0x107c
#define FID_BITSTREAM_BAUER_BODONI  0x307b
#define FID_PS_BAUER_BODONI  0x207b
#define FID_DTC_BAUER_BODONI  0x107b
#define FID_BITSTREAM_BELWE  0x307a
#define FID_PS_BELWE  0x207a
#define FID_DTC_BELWE  0x107a
#define FID_BITSTREAM_CHARLEMAGNE  0x3079
#define FID_PS_CHARLEMAGNE  0x2079
#define FID_DTC_CHARLEMAGNE  0x1079
#define FID_BITSTREAM_TRAJAN  0x3078
#define FID_PS_TRAJAN  0x2078
#define FID_DTC_TRAJAN  0x1078
#define FID_BITSTREAM_ADOBE_GARAMOND  0x3077
#define FID_PS_ADOBE_GARAMOND  0x2077
#define FID_DTC_ADOBE_GARAMOND  0x1077
#define FID_BITSTREAM_ZAPF_INTERNATIONAL  0x3076
#define FID_PS_ZAPF_INTERNATIONAL  0x2076
#define FID_DTC_ZAPF_INTERNATIONAL  0x1076
#define FID_BITSTREAM_ZAPF_BOOK  0x3075
#define FID_PS_ZAPF_BOOK  0x2075
#define FID_DTC_ZAPF_BOOK  0x1075
#define FID_BITSTREAM_WORCESTER_ROUND  0x3074
#define FID_PS_WORCESTER_ROUND  0x2074
#define FID_DTC_WORCESTER_ROUND  0x1074
#define FID_BITSTREAM_WINDSOR  0x3073
#define FID_PS_WINDSOR  0x2073
#define FID_DTC_WINDSOR  0x1073
#define FID_BITSTREAM_WEISS  0x3072
#define FID_PS_WEISS  0x2072
#define FID_DTC_WEISS  0x1072
#define FID_BITSTREAM_WEIDEMANN  0x3071
#define FID_PS_WEIDEMANN  0x2071
#define FID_DTC_WEIDEMANN  0x1071
#define FID_BITSTREAM_WALBAUM  0x3070
#define FID_PS_WALBAUM  0x2070
#define FID_DTC_WALBAUM  0x1070
#define FID_BITSTREAM_VOLTA  0x306f
#define FID_PS_VOLTA  0x206f
#define FID_DTC_VOLTA  0x106f
#define FID_BITSTREAM_VENDOME  0x306e
#define FID_PS_VENDOME  0x206e
#define FID_DTC_VENDOME  0x106e
#define FID_BITSTREAM_VELJOVIC  0x306d
#define FID_PS_VELJOVIC  0x206d
#define FID_DTC_VELJOVIC  0x106d
#define FID_BITSTREAM_ADOBE_UTOPIA  0x306c
#define FID_PS_ADOBE_UTOPIA  0x206c
#define FID_DTC_ADOBE_UTOPIA  0x106c
#define FID_BITSTREAM_USHERWOOD  0x306b
#define FID_PS_USHERWOOD  0x206b
#define FID_DTC_USHERWOOD  0x106b
#define FID_BITSTREAM_URW_ANTIQUA  0x306a
#define FID_PS_URW_ANTIQUA  0x206a
#define FID_DTC_URW_ANTIQUA  0x106a
#define FID_BITSTREAM_TIMES_NEW_ROMAN  0x3069
#define FID_PS_TIMES_NEW_ROMAN  0x2069
#define FID_DTC_TIMES_NEW_ROMAN  0x1069
#define FID_BITSTREAM_TIMELESS  0x3068
#define FID_PS_TIMELESS  0x2068
#define FID_DTC_TIMELESS  0x1068
#define FID_BITSTREAM_TIFFANY  0x3067
#define FID_PS_TIFFANY  0x2067
#define FID_DTC_TIFFANY  0x1067
#define FID_BITSTREAM_TIEPOLO  0x3066
#define FID_PS_TIEPOLO  0x2066
#define FID_DTC_TIEPOLO  0x1066
#define FID_BITSTREAM_SWIFT  0x3065
#define FID_PS_SWIFT  0x2065
#define FID_DTC_SWIFT  0x1065
#define FID_BITSTREAM_STYMIE  0x3064
#define FID_PS_STYMIE  0x2064
#define FID_DTC_STYMIE  0x1064
#define FID_BITSTREAM_STRATFORD  0x3063
#define FID_PS_STRATFORD  0x2063
#define FID_DTC_STRATFORD  0x1063
#define FID_BITSTREAM_STONE_SERIF  0x3062
#define FID_PS_STONE_SERIF  0x2062
#define FID_DTC_STONE_SERIF  0x1062
#define FID_BITSTREAM_STONE_INFORMAL  0x3061
#define FID_PS_STONE_INFORMAL  0x2061
#define FID_DTC_STONE_INFORMAL  0x1061
#define FID_BITSTREAM_STEMPEL_SCHNEIDLER  0x3060
#define FID_PS_STEMPEL_SCHNEIDLER  0x2060
#define FID_DTC_STEMPEL_SCHNEIDLER  0x1060
#define FID_BITSTREAM_SOUVENIR  0x305f
#define FID_PS_SOUVENIR  0x205f
#define FID_DTC_SOUVENIR  0x105f
#define FID_BITSTREAM_SLIMBACH  0x305e
#define FID_PS_SLIMBACH  0x205e
#define FID_DTC_SLIMBACH  0x105e
#define FID_BITSTREAM_SERIFA  0x305d
#define FID_PS_SERIFA  0x205d
#define FID_DTC_SERIFA  0x105d
#define FID_BITSTREAM_SABON_ANTIQUA  0x305c
#define FID_PS_SABON_ANTIQUA  0x205c
#define FID_DTC_SABON_ANTIQUA  0x105c
#define FID_BITSTREAM_SABON  0x305b
#define FID_PS_SABON  0x205b
#define FID_DTC_SABON  0x105b
#define FID_BITSTREAM_ROMANA  0x305a
#define FID_PS_ROMANA  0x205a
#define FID_DTC_ROMANA  0x105a
#define FID_BITSTREAM_ROCKWELL  0x3059
#define FID_PS_ROCKWELL  0x2059
#define FID_DTC_ROCKWELL  0x1059
#define FID_BITSTREAM_RENAULT  0x3058
#define FID_PS_RENAULT  0x2058
#define FID_DTC_RENAULT  0x1058
#define FID_BITSTREAM_RALEIGH  0x3057
#define FID_PS_RALEIGH  0x2057
#define FID_DTC_RALEIGH  0x1057
#define FID_BITSTREAM_QUORUM  0x3056
#define FID_PS_QUORUM  0x2056
#define FID_DTC_QUORUM  0x1056
#define FID_BITSTREAM_PROTEUS  0x3055
#define FID_PS_PROTEUS  0x2055
#define FID_DTC_PROTEUS  0x1055
#define FID_BITSTREAM_PLANTIN  0x3054
#define FID_PS_PLANTIN  0x2054
#define FID_DTC_PLANTIN  0x1054
#define FID_BITSTREAM_PERPETUA  0x3053
#define FID_PS_PERPETUA  0x2053
#define FID_DTC_PERPETUA  0x1053
#define FID_BITSTREAM_PACELLA  0x3052
#define FID_PS_PACELLA  0x2052
#define FID_DTC_PACELLA  0x1052
#define FID_BITSTREAM_NOVARESE  0x3051
#define FID_PS_NOVARESE  0x2051
#define FID_DTC_NOVARESE  0x1051
#define FID_BITSTREAM_NIMROD  0x3050
#define FID_PS_NIMROD  0x2050
#define FID_DTC_NIMROD  0x1050
#define FID_BITSTREAM_NIKIS  0x304f
#define FID_PS_NIKIS  0x204f
#define FID_DTC_NIKIS  0x104f
#define FID_BITSTREAM_NAPOLEAN  0x304e
#define FID_PS_NAPOLEAN  0x204e
#define FID_DTC_NAPOLEAN  0x104e
#define FID_BITSTREAM_MODERN_NO_216  0x304d
#define FID_PS_MODERN_NO_216  0x204d
#define FID_DTC_MODERN_NO_216  0x104d
#define FID_BITSTREAM_MODERN  0x304c
#define FID_PS_MODERN  0x204c
#define FID_DTC_MODERN  0x104c
#define FID_BITSTREAM_MINISTER  0x304b
#define FID_PS_MINISTER  0x204b
#define FID_DTC_MINISTER  0x104b
#define FID_BITSTREAM_MESSIDOR  0x304a
#define FID_PS_MESSIDOR  0x204a
#define FID_DTC_MESSIDOR  0x104a
#define FID_BITSTREAM_MERIDIEN  0x3049
#define FID_PS_MERIDIEN  0x2049
#define FID_DTC_MERIDIEN  0x1049
#define FID_BITSTREAM_MEMPHIS  0x3048
#define FID_PS_MEMPHIS  0x2048
#define FID_DTC_MEMPHIS  0x1048
#define FID_BITSTREAM_MELIOR  0x3047
#define FID_PS_MELIOR  0x2047
#define FID_DTC_MELIOR  0x1047
#define FID_BITSTREAM_MARCONI  0x3046
#define FID_PS_MARCONI  0x2046
#define FID_DTC_MARCONI  0x1046
#define FID_BITSTREAM_MAGNUS  0x3045
#define FID_PS_MAGNUS  0x2045
#define FID_DTC_MAGNUS  0x1045
#define FID_BITSTREAM_MAGNA  0x3044
#define FID_PS_MAGNA  0x2044
#define FID_DTC_MAGNA  0x1044
#define FID_BITSTREAM_MADISON  0x3043
#define FID_PS_MADISON  0x2043
#define FID_DTC_MADISON  0x1043
#define FID_BITSTREAM_LUCIDA  0x3042
#define FID_PS_LUCIDA  0x2042
#define FID_DTC_LUCIDA  0x1042
#define FID_BITSTREAM_LUBALIN_GRAPH  0x3041
#define FID_PS_LUBALIN_GRAPH  0x2041
#define FID_DTC_LUBALIN_GRAPH  0x1041
#define FID_BITSTREAM_LIFE  0x3040
#define FID_PS_LIFE  0x2040
#define FID_DTC_LIFE  0x1040
#define FID_BITSTREAM_LEAWOOD  0x303f
#define FID_PS_LEAWOOD  0x203f
#define FID_DTC_LEAWOOD  0x103f
#define FID_BITSTREAM_KORINNA  0x303e
#define FID_PS_KORINNA  0x203e
#define FID_DTC_KORINNA  0x103e
#define FID_BITSTREAM_JENSON_OLD_STYLE  0x303d
#define FID_PS_JENSON_OLD_STYLE  0x203d
#define FID_DTC_JENSON_OLD_STYLE  0x103d
#define FID_BITSTREAM_JANSON  0x303c
#define FID_PS_JANSON  0x203c
#define FID_DTC_JANSON  0x103c
#define FID_BITSTREAM_JAMILLE  0x303b
#define FID_PS_JAMILLE  0x203b
#define FID_DTC_JAMILLE  0x103b
#define FID_BITSTREAM_ITALIA  0x303a
#define FID_PS_ITALIA  0x203a
#define FID_DTC_ITALIA  0x103a
#define FID_BITSTREAM_IMPRESSUM  0x3039
#define FID_PS_IMPRESSUM  0x2039
#define FID_DTC_IMPRESSUM  0x1039
#define FID_BITSTREAM_HOLLANDER  0x3038
#define FID_PS_HOLLANDER  0x2038
#define FID_DTC_HOLLANDER  0x1038
#define FID_BITSTREAM_HIROSHIGE  0x3037
#define FID_PS_HIROSHIGE  0x2037
#define FID_DTC_HIROSHIGE  0x1037
#define FID_BITSTREAM_HAWTHORN  0x3036
#define FID_PS_HAWTHORN  0x2036
#define FID_DTC_HAWTHORN  0x1036
#define FID_BITSTREAM_GOUDY  0x3035
#define FID_PS_GOUDY  0x2035
#define FID_DTC_GOUDY  0x1035
#define FID_BITSTREAM_GAMMA  0x3034
#define FID_PS_GAMMA  0x2034
#define FID_DTC_GAMMA  0x1034
#define FID_BITSTREAM_GALLIARD  0x3033
#define FID_PS_GALLIARD  0x2033
#define FID_DTC_GALLIARD  0x1033
#define FID_BITSTREAM_FRIZ_QUADRATA  0x3032
#define FID_PS_FRIZ_QUADRATA  0x2032
#define FID_DTC_FRIZ_QUADRATA  0x1032
#define FID_BITSTREAM_FENICE  0x3031
#define FID_PS_FENICE  0x2031
#define FID_DTC_FENICE  0x1031
#define FID_BITSTREAM_EXCELSIOR  0x3030
#define FID_PS_EXCELSIOR  0x2030
#define FID_DTC_EXCELSIOR  0x1030
#define FID_BITSTREAM_ESPRIT  0x302f
#define FID_PS_ESPRIT  0x202f
#define FID_DTC_ESPRIT  0x102f
#define FID_BITSTREAM_ELAN  0x302e
#define FID_PS_ELAN  0x202e
#define FID_DTC_ELAN  0x102e
#define FID_BITSTREAM_EGYPTIENNE  0x302d
#define FID_PS_EGYPTIENNE  0x202d
#define FID_DTC_EGYPTIENNE  0x102d
#define FID_BITSTREAM_EGIZIO  0x302c
#define FID_PS_EGIZIO  0x202c
#define FID_DTC_EGIZIO  0x102c
#define FID_BITSTREAM_EDWARDIAN  0x302b
#define FID_PS_EDWARDIAN  0x202b
#define FID_DTC_EDWARDIAN  0x102b
#define FID_BITSTREAM_EDISON  0x302a
#define FID_PS_EDISON  0x202a
#define FID_DTC_EDISON  0x102a
#define FID_BITSTREAM_DIGI_ANTIQUA  0x3029
#define FID_PS_DIGI_ANTIQUA  0x2029
#define FID_DTC_DIGI_ANTIQUA  0x1029
#define FID_BITSTREAM_DEMOS  0x3028
#define FID_PS_DEMOS  0x2028
#define FID_DTC_DEMOS  0x1028
#define FID_BITSTREAM_CUSHING  0x3027
#define FID_PS_CUSHING  0x2027
#define FID_DTC_CUSHING  0x1027
#define FID_BITSTREAM_CORONA  0x3026
#define FID_PS_CORONA  0x2026
#define FID_DTC_CORONA  0x1026
#define FID_BITSTREAM_CONGRESS  0x3025
#define FID_PS_CONGRESS  0x2025
#define FID_DTC_CONGRESS  0x1025
#define FID_BITSTREAM_CONCORDE_NOVA  0x3024
#define FID_PS_CONCORDE_NOVA  0x2024
#define FID_DTC_CONCORDE_NOVA  0x1024
#define FID_BITSTREAM_CONCORDE  0x3023
#define FID_PS_CONCORDE  0x2023
#define FID_DTC_CONCORDE  0x1023
#define FID_BITSTREAM_CLEARFACE  0x3022
#define FID_PS_CLEARFACE  0x2022
#define FID_DTC_CLEARFACE  0x1022
#define FID_BITSTREAM_CLARENDON  0x3021
#define FID_PS_CLARENDON  0x2021
#define FID_DTC_CLARENDON  0x1021
#define FID_BITSTREAM_CHELTENHAM  0x3020
#define FID_PS_CHELTENHAM  0x2020
#define FID_DTC_CHELTENHAM  0x1020
#define FID_BITSTREAM_CENTURY_OLD_STYLE  0x301f
#define FID_PS_CENTURY_OLD_STYLE  0x201f
#define FID_DTC_CENTURY_OLD_STYLE  0x101f
#define FID_BITSTREAM_CENTURY  0x301e
#define FID_PS_CENTURY  0x201e
#define FID_DTC_CENTURY  0x101e
#define FID_BITSTREAM_CENTENNIAL  0x301d
#define FID_PS_CENTENNIAL  0x201d
#define FID_DTC_CENTENNIAL  0x101d
#define FID_BITSTREAM_CAXTON  0x301c
#define FID_PS_CAXTON  0x201c
#define FID_DTC_CAXTON  0x101c
#define FID_BITSTREAM_ADOBE_CASLON  0x301b
#define FID_PS_ADOBE_CASLON  0x201b
#define FID_DTC_ADOBE_CASLON  0x101b
#define FID_BITSTREAM_CASLON  0x301a
#define FID_PS_CASLON  0x201a
#define FID_DTC_CASLON  0x101a
#define FID_BITSTREAM_CANDIDA  0x3019
#define FID_PS_CANDIDA  0x2019
#define FID_DTC_CANDIDA  0x1019
#define FID_BITSTREAM_BOOKMAN  0x3018
#define FID_PS_BOOKMAN  0x2018
#define FID_DTC_BOOKMAN  0x1018
#define FID_BITSTREAM_BASKERVILLE_HANDCUT  0x3017
#define FID_PS_BASKERVILLE_HANDCUT  0x2017
#define FID_DTC_BASKERVILLE_HANDCUT  0x1017
#define FID_BITSTREAM_BASKERVILLE  0x3016
#define FID_PS_BASKERVILLE  0x2016
#define FID_DTC_BASKERVILLE  0x1016
#define FID_BITSTREAM_BASILIA  0x3015
#define FID_PS_BASILIA  0x2015
#define FID_DTC_BASILIA  0x1015
#define FID_BITSTREAM_BARBEDOR  0x3014
#define FID_PS_BARBEDOR  0x2014
#define FID_DTC_BARBEDOR  0x1014
#define FID_BITSTREAM_AUREALIA  0x3013
#define FID_PS_AUREALIA  0x2013
#define FID_DTC_AUREALIA  0x1013
#define FID_BITSTREAM_NEW_ASTER  0x3012
#define FID_PS_NEW_ASTER  0x2012
#define FID_DTC_NEW_ASTER  0x1012
#define FID_BITSTREAM_ASTER  0x3011
#define FID_PS_ASTER  0x2011
#define FID_DTC_ASTER  0x1011
#define FID_BITSTREAM_AMERICANA  0x3010
#define FID_PS_AMERICANA  0x2010
#define FID_DTC_AMERICANA  0x1010
#define FID_BITSTREAM_AACHEN  0x300f
#define FID_PS_AACHEN  0x200f
#define FID_DTC_AACHEN  0x100f
#define FID_BITSTREAM_NICOLAS_COCHIN  0x300e
#define FID_PS_NICOLAS_COCHIN  0x200e
#define FID_DTC_NICOLAS_COCHIN  0x100e
#define FID_BITSTREAM_COCHIN  0x300d
#define FID_PS_COCHIN  0x200d
#define FID_DTC_COCHIN  0x100d
#define FID_BITSTREAM_ALBERTUS  0x300c
#define FID_PS_ALBERTUS  0x200c
#define FID_DTC_ALBERTUS  0x100c
#define FID_BITSTREAM_ACCOLADE  0x300b
#define FID_PS_ACCOLADE  0x200b
#define FID_DTC_ACCOLADE  0x100b
#define FID_BITSTREAM_PALATINO  0x300a
#define FID_PS_PALATINO  0x200a
#define FID_DTC_PALATINO  0x100a
#define FID_BITSTREAM_GOUDY_OLD_STYLE  0x3009
#define FID_PS_GOUDY_OLD_STYLE  0x2009
#define FID_DTC_GOUDY_OLD_STYLE  0x1009
#define FID_BITSTREAM_BERKELEY_OLD_STYLE  0x3008
#define FID_PS_BERKELEY_OLD_STYLE  0x2008
#define FID_DTC_BERKELEY_OLD_STYLE  0x1008
#define FID_BITSTREAM_ARSIS  0x3007
#define FID_PS_ARSIS  0x2007
#define FID_DTC_ARSIS  0x1007
#define FID_BITSTREAM_UNIVERSITY_ROMAN  0x3006
#define FID_PS_UNIVERSITY_ROMAN  0x2006
#define FID_DTC_UNIVERSITY_ROMAN  0x1006
#define FID_BITSTREAM_BEMBO  0x3005
#define FID_PS_BEMBO  0x2005
#define FID_DTC_BEMBO  0x1005
#define FID_BITSTREAM_GARAMOND  0x3004
#define FID_PS_GARAMOND  0x2004
#define FID_DTC_GARAMOND  0x1004
#define FID_BITSTREAM_GLYPHA  0x3003
#define FID_PS_GLYPHA  0x2003
#define FID_DTC_GLYPHA  0x1003
#define FID_BITSTREAM_BODONI  0x3002
#define FID_PS_BODONI  0x2002
#define FID_DTC_BODONI  0x1002
#define FID_BITSTREAM_CENTURY_SCHOOLBOOK  0x3001
#define FID_PS_CENTURY_SCHOOLBOOK  0x2001
#define FID_DTC_CENTURY_SCHOOLBOOK  0x1001
#define FID_BITSTREAM_URW_ROMAN  0x3000
#define FID_PS_TIMES_ROMAN  0x2000
#define FID_DTC_URW_ROMAN  0x1000
#define FID_PIZZA_KANJI  0x0c00
#define FID_TERMINAL_GRAPHIC  0x0a07
#define FID_TERMINAL  0x0a06
#define FID_RESPONDER  0x0a05
#define FID_NOTEPAD  0x0a04
#define FID_CALENDAR  0x0a03
#define FID_JSYS  0x0a02
#define FID_WINDOWS  0x0a01
#define FID_BISON  0x0a00
#define FID_LED  0x0600
#define FID_PMSYSTEM  0x0203
#define FID_BERKELEY  0x0202
#define FID_UNIVERSITY  0x0201
#define FID_CHICAGO  0x0200
#define FID_ROMA  0x0001
#define FID_INVALID  0x0000

typedef byte SerifFace ;
#define SF_SLAB  0x00c0
#define SF_MODERN  0x0080
#define SF_TRANS  0x0040
#define SF_OLD  0x0000

typedef byte SansFace ;
#define SF_A_CLOSED  0x0080
#define SF_A_OPEN  0x0000

typedef byte ScriptFace ;
#define SF_CURSIVE  0x0080
#define SF_CALLIGRAPHIC  0x0000

typedef word FontGroup ;
#define FG_NON_PORTABLE  0x0e00
#define FG_SPECIAL  0x0c00
#define FG_MONO  0x0a00
#define FG_SYMBOL  0x0800
#define FG_ORNAMENT  0x0600
#define FG_SCRIPT  0x0400
#define FG_SANS_SERIF  0x0200
#define FG_SERIF  0x0000

typedef byte FontFamily ;
#define FF_NON_PORTABLE  0x0007
#define FF_SPECIAL  0x0006
#define FF_MONO  0x0005
#define FF_SYMBOL  0x0004
#define FF_ORNAMENT  0x0003
#define FF_SCRIPT  0x0002
#define FF_SANS_SERIF  0x0001
#define FF_SERIF  0x0000

typedef byte FontMap ;
#define FM_DONT_USE  0x00ff
#define FM_EXACT  0x0000
#endif /* __FONTID_H */


game.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	Spell Library
 * FILE:	game.goh
 *
 *
 * REVISION HISTORY:
 *
 *	Name	Date		Description
 *	----	----		-----------
 *	atw	4/29/93		Initial revision
 *
 *
 * DESCRIPTION:
 *	Contains descriptions of objects/routines from the game library
 *
 *	$Id: game.goh,v 1.5.6.1 96/04/28 08:29:11 chris Exp $
 *
 ***********************************************************************/
@optimize
@deflib game

@include  <Objects/gCtrlC.goh>

/**********************************************************************
    HighScoreClass
**********************************************************************/

@class HighScoreClass, GenControlClass;

@message Boolean MSG_HIGH_SCORE_ADD_SCORE (dword score = dx:cx, MemHandle extra = bp) = carry;

@message word MSG_HIGH_SCORE_GET_NAME (char *buffer = dx:bp) = cx;

@message void  MSG_HIGH_SCORE_SHOW_SCORES  (word scoreToHighlight = cx);

@message void MSG_HIGH_SCORE_FORMAT_SCORE(@stack char *dest, dword score);

#define SCORE_BUFFER_SIZE    DATE_TIME_BUFFER_SIZE

typedef ByteEnum ScoreType ;
#define ST_POINTS    	0
#define ST_ELAPSED_TIME  1
#define ST_MONEY     	2

typedef ByteFlags HighScoreAttributes ;
#define HSA_LOW_SCORE_IS_BETTER  0x80
#define HSA_ONE_SCORE_PER_NAME  0x40

    @instance ChunkHandle   	    HSI_fileName;
    @instance FileHandle    	    HSI_fileHandle = 0;
    @instance GeodeToken    	    HSI_creator;
    @instance @visMoniker   	    HSI_highScoreTitle;
    @instance @visMoniker   	    HSI_highScoreLine1;
    @instance @visMoniker   	    HSI_highScoreLine2;
    @instance @visMoniker   	    HSI_highScoreLine3;
    @instance @visMoniker   	    HSI_highScoreLine4;
    @instance ScoreType	    	    HSI_scoreType = ST_POINTS;
    @instance HighScoreAttributes   HSI_attrs = 0;
    @default GI_states = (@default | GS_ENABLED);

#define HIGH_SCORE_DEFAULT_FEATURES  (HSF_DATE | HSF_SCORE | HSF_SHOW_HIGH_SCORES_TRIGGER)

typedef WordFlags HighScoreFeatures ;
#define HSF_SCORE    	    	    	0x0008
#define HSF_DATE     	    	    	0x0004
#define HSF_EXTRA_DATA  	    	    	0x0002
#define HSF_SHOW_HIGH_SCORES_TRIGGER 	0x0001

/*
 * The High Score data file is a VM file consisting of a map item which
 * is a chunk array of HighScoreArrayElement structures.
 */

typedef struct {
    DBGroupAndItem	HSAE_name;
    DBGroupAndItem	HSAE_score;
    DBGroupAndItem	HSAE_extra;
    word	    	HSAE_year;
    byte	    	HSAE_month;
    byte	    	HSAE_day;
} HighScoreArrayElement} ;

@vardata ChunkHandle ATTR_HIGH_SCORE_SHOW_SCORES_TRIGGER_MONIKER;
@vardata ChunkHandle ATTR_HIGH_SCORE_NAME_TITLE_MONIKER;
@vardata ChunkHandle ATTR_HIGH_SCORE_DATE_TITLE_MONIKER;
@vardata ChunkHandle ATTR_HIGH_SCORE_SCORE_TITLE_MONIKER;
@vardata ChunkHandle ATTR_HIGH_SCORE_EXTRA_TITLE_MONIKER;

@endc

/**********************************************************************
    GameStatusControlClass
**********************************************************************/

@class GameStatusControlClass, GenControlClass;
    @default GI_states = @default | GS_ENABLED;
    @default GI_attrs = (@default | GA_KBD_SEARCH_PATH);

@endc;

typedef ByteEnum GameStatus ;
#define	GS_NULL			0
#define	GS_PAUSED		1
#define	GS_TEMP_PAUSED		2
#define	GS_MINIMIZED		3
#define	GS_RUNNING		4
#define	GS_RESTARTING		5
#define	GS_GAME_OVER		6
#define	GS_STOPPED		7

typedef WordFlags GameStatusControlFeatures ;
#define GSCF_START 	8
#define	GSCF_ABORT		4
#define	GSCF_PAUSE		2
#define	GSCF_CONTINUE		1

/**********************************************************************
    GameContentClass
**********************************************************************/

@class	GameContentClass, VisContentClass;

@instance	GameStatus 	GCI_status;
@instance 	MemHandle	GCI_gstate;
@instance 	TimerHandle	GCI_timerHandle;
@instance	word		GCI_timerID;
@instance	word		GCI_timerInterval;
@instance	word		GCI_baseWidth;
@instance	word		GCI_baseHeight;

@default	VCI_geoAttrs = @default | VCGA_CUSTOM_MANAGE_CHILDREN;

@message void MSG_GAME_CONTENT_START_GAME ();
@message void MSG_GAME_CONTENT_PAUSE_GAME ();
@message void MSG_GAME_CONTENT_CONTINUE_GAME ();
@message void MSG_GAME_CONTENT_ABORT_GAME ();
@message void MSG_GAME_CONTENT_GAME_OVER ();
@message void MSG_GAME_CONTENT_TIMER_TICK ();
@message void MSG_GAME_CONTENT_TEMP_PAUSE ();
@message void MSG_GAME_CONTENT_END_TEMP_PAUSE ();

@endc

    /*
     * GameRandom returns a value between 0 and maxValue-1
     */
extern word
    _pascal GameRandom (word maxValue);

#ifdef __HIGHC__
pragma Alias(GameRandom, "GAMERANDOM");
#endif
@endlib


Objects\gAppC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gAppC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenApplicationClass
 *
 *	$Id: gAppC.goh,v 1.106.1.4 98/01/05 18:28:22 reza Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

#include  <geode.h>
#include  <win.h>
#include  <localize.h>
@include  <Objects/visC.goh>
@include  <Objects/genC.goh>
@include  <Objects/gInterC.goh>
@include  <Objects/gProcC.goh>

@class	GenApplicationClass, GenClass;

@message void MSG_GEN_APPLICATION_MARK_BUSY ();	/* XXX */
@message void MSG_GEN_APPLICATION_MARK_NOT_BUSY ();	/* XXX */
@message void MSG_GEN_APPLICATION_HOLD_UP_INPUT ();	/* XXX */
@message void MSG_GEN_APPLICATION_RESUME_INPUT ();	/* XXX */
@message void MSG_GEN_APPLICATION_IGNORE_INPUT ();	/* XXX */
@message void MSG_GEN_APPLICATION_ACCEPT_INPUT ();	/* XXX */
@message Handle MSG_GEN_APPLICATION_QUERY_UI () = ax;	/* XXX */
@message ApplicationStates MSG_GEN_APPLICATION_GET_STATE () = ax;	/* XXX */
@message optr MSG_GEN_APPLICATION_FIND_MONIKER (
                        MemHandle destBlock = cx,
            VisMonikerSearchFlags searchFlags = bp,
            DisplayType displayType = dh) = cx:dx;	/* XXX */
@message void MSG_GEN_APPLICATION_SET_TASK_ENTRY_MONIKER (
                        optr entryMoniker = cx:dx); /* XXX */
@message void MSG_GEN_APPLICATION_GET_DISPLAY_SCHEME (
            DisplayScheme *displayScheme = axcxdxbp); /* XXX */
@message void MSG_GEN_APPLICATION_SET_APP_MODE_MESSAGE (
                        Message modeMessage = cx); /* XXX */
@message Message MSG_GEN_APPLICATION_GET_APP_MODE_MESSAGE () = cx;	/* XXX */
@message Handle MSG_GEN_APPLICATION_GET_APP_INSTANCE_REFERENCE () = dx;	/* XXX */
@message void MSG_GEN_APPLICATION_SET_APP_INSTANCE_REFERENCE (
                        Handle appInstance = dx); /* XXX */
@message void MSG_GEN_APPLICATION_SEND_APP_INSTANCE_REFERENCE_TO_FIELD ();	/* XXX */
@message void MSG_GEN_APPLICATION_INITIATE_UI_QUIT ();	/* XXX */
@message void MSG_GEN_APPLICATION_INSTALL_TOKEN ();	/* XXX */
@message void MSG_GEN_APPLICATION_TOGGLE_CURSOR ();	/* XXX */
@message AppLaunchFlags MSG_GEN_APPLICATION_GET_LAUNCH_FLAGS () = al;	/* XXX */
@message void MSG_GEN_APPLICATION_SET_APP_LEVEL (
                        UIInterfaceLevel level = cx);

typedef struct {
    UIInterfaceLevel AFI_uiInterfaceLevel;
    word    AFI_appFeatures;
} AppFeaturesInfo} ;

#define GET_UI_INTERFACE_LEVEL (val) ((val).AFI_uiInterfaceLevel)
#define GET_APP_FEATURES (val) ((val).AFI_appFeatures)

@message AppFeaturesInfo MSG_GEN_APPLICATION_GET_APP_FEATURES () = ax.dx;
@message void MSG_GEN_APPLICATION_SET_APP_FEATURES (word features = cx);

@message void MSG_GEN_APPLICATION_DETACH_PENDING ();	/* XXX */
@message optr MSG_GEN_APPLICATION_BUILD_STANDARD_DIALOG (
                        char *customTriggers,
            char *arg2,
            char *arg1,
                char *string,
            CustomDialogBoxFlags dialogFlags) = cx:dx; /* XXX */

@message void MSG_GEN_APPLICATION_UNUSED ();

@message void MSG_GEN_APPLICATION_DO_STANDARD_DIALOG(@stack
                        Message dialogMethod,
                        optr dialogOD,
                char *helpContext,
                        char *customTriggers,
                char *arg2,
                        char *arg1,
                        char *string,
                    CustomDialogBoxFlags dialogFlags);  /* XXX */

    /* Standard prototype for dialogMethod send to dialogOD for
       MSG_GEN_APPLICATION_DO_STANDARD_DIALOG */

    @prototype void GEN_APP_DO_STANDARD_DIALOG_MSG (InteractionCommand response = cx); /* XXX */

@message void MSG_GEN_APPLICATION_MARK_APP_COMPLETELY_BUSY ();	/* XXX */
@message void MSG_GEN_APPLICATION_MARK_APP_NOT_COMPLETELY_BUSY ();	/* XXX */
@message void MSG_GEN_APPLICATION_OPEN_COMPLETE ();	/* XXX */
@message void MSG_GEN_APPLICATION_SET_NOT_USER_INTERACTABLE ();	/* XXX */
@message void MSG_GEN_APPLICATION_SET_USER_INTERACTABLE ();	/* XXX */
@message void MSG_GEN_APPLICATION_SET_ATTACHED_TO_STATE_FILE ();	/* XXX */
@message void MSG_GEN_APPLICATION_SET_NOT_ATTACHED_TO_STATE_FILE ();	/* XXX */
@message void MSG_GEN_APPLICATION_SET_NOT_QUITTING (); /* XXX */
@message void MSG_GEN_APPLICATION_NOTIFY_MODAL_WIN_CHANGE ();	/* XXX */

#define GET_MEASUREMENT_TYPE (m) ((byte) (m))
#define GET_APP_MEASUREMENT_TYPE (m) ((byte) ((m)>>8))

typedef ByteEnum AppMeasurementType ;
#define	AMT_US			0
#define AMT_METRIC 	1
#define	AMT_DEFAULT		0xff

/*
 * Structure returned by MSG_GEN_APPLICATION_GET_MEASUREMENT_TYPE
 */
typedef struct {
    MeasurementType 	WMT_measurementType; 	/* either metric or U.S. */
    AppMeasurementType	WMT_appMeasurementType;	/* in application */
} WholeMeasurementType} ;

@message WholeMeasurementType MSG_GEN_APPLICATION_GET_MEASUREMENT_TYPE () = ax;	/* XXX */
@message void MSG_GEN_APPLICATION_SET_MEASUREMENT_TYPE (
                        AppMeasurementType measurementType = cl);

typedef struct {
    CharFlags	CFASS_charFlags;
    ShiftState	CFASS_shiftState;
} CharFlagsAndShiftState} ;

typedef struct {
    ToggleState	TSASC_toggleState;
    byte    	TSASC_scanCode;
} ToggleStateAndScanCode} ;

@message Boolean MSG_GEN_APPLICATION_TEST_FOR_CANCEL_MNEMONIC ( /* INTERNAL */
                        word character = cx,
            CharFlagsAndShiftState flags = dx,
            ToggleStateAndScanCode state = bp) = carry; /* XXX */

@message void MSG_GEN_APPLICATION_INK_QUERY_REPLY (
                        InkReturnValue inkReturnValue = cx,
            MemHandle inkDestInfo = bp);
@message void MSG_GEN_APPLICATION_GCN_LIST_SEND_INTERNAL ();	/* INTERNAL */
@message ChunkHandle MSG_GEN_APPLICATION_GET_GCN_LIST_OF_LISTS () = ax;	/* XXX */
@reserveMessages 1;
@message (GEN_VISIBILITY_OUTPUT) MSG_GEN_APPLICATION_VISIBILITY_NOTIFICATION; /* XXX */

@message void MSG_GEN_APPLICATION_BRING_WINDOW_TO_TOP (optr window = cx:dx); /* XXX */
@message void MSG_GEN_APPLICATION_LOWER_WINDOW_TO_BOTTOM (optr window = cx:dx); /* XXX */

@message AppAttachFlags MSG_GEN_APPLICATION_GET_ATTACH_FLAGS () = cx; /* XXX */

typedef struct {
    CustomDialogType	ND_dialogType;
    byte    	    	ND_unused1;
    word    	    	ND_unused2;
    optr    	    	ND_dialog;
} NewDialog} ;

@message void MSG_GEN_APPLICATION_BUILD_DIALOG_FROM_TEMPLATE (
                        NewDialog *retValue = bpaxdxcx,
                        optr template = cx:dx);

typedef ByteEnum GenAppUsabilityCommand ;
#define GAUC_USABILITY  0
/*
 * Indicates the controller should be usable if the feature is ON
 * (this is the default)
 */
#define GAUC_RECALC_CONTROLLER  1
/*
 * Indicates the controller needs to have its features recalculate if the
 * feature bit this table represents changes
 */
#define GAUC_REPARENT  2
/*
 * Indicates the controller should be moved to the GAUFP_reparentObject
 */
#define GAUC_POPUP  3
/*
 * Indicates the controller should be made a popup menu if the feature is ON
 * (unless reverse is set)
 */
#define GAUC_TOOLBAR  4
/*
 * Indicates the controller is a GenBoolean that corresponds to a toolbar
 * state.  Turning the feature off or on forces the GenBoolean to send an
 * apply in addition to the normal behavior.
 */
#define GAUC_RESTART  5
/*
 * Indicates that this generic object need to be restarted via setting
 * not-usable then setting usable.
 */

typedef ByteFlags GenAppUsabilityTupleFlags ;
#define GAUTF_END_OF_LIST 	0x20
#define GAUTF_OFF_IF_BIT_ON 	0x10
#define GAUTF_COMMAND 		0x0f

typedef struct {
    GenAppUsabilityTupleFlags	GAUT_flags;
    optr			GAUT_object;	/* actually chunk, resid */
} GenAppUsabilityTuple} ;

@message void MSG_GEN_APPLICATION_UPDATE_APP_FEATURES (@stack
            optr unReparentObject,
            optr reparentObject,
            GenAppUsabilityTuple *levelTable,
            word tableLength,
            void *table,
            word appOpeningFlag,
            UIInterfaceLevel oldLevel,
            UIInterfaceLevel level,
            word featuresChanged,
            word featuresOn);

@message void MSG_GEN_APPLICATION_UPDATE_FEATURES_VIA_TABLE (@stack
            optr unReparentObject,
            optr reparentObject,
            GenAppUsabilityTuple *levelTable,
            word tableLength,
            void *table,
            word appOpeningFlag,
            UIInterfaceLevel oldLevel,
            UIInterfaceLevel level,
            word featuresChanged,
            word featuresOn);

@message void MSG_GEN_APPLICATION_IACP_NO_MORE_CONNECTIONS ( /* PRIVATE */
                        optr ackOD);
@message word MSG_GEN_APPLICATION_IACP_GET_NUMBER_OF_CONNECTIONS () = cx;

@message void MSG_GEN_APPLICATION_APP_MODE_COMPLETE (	    /*INTERNAL */
                        optr ackOD = dx:bp);

@message void MSG_GEN_APPLICATION_IACP_SHUTDOWN_ALL_CONNECTIONS ();
@message void MSG_GEN_APPLICATION_IACP_REGISTER ();
@message void MSG_GEN_APPLICATION_IACP_UNREGISTER ();
@message void MSG_GEN_APPLICATION_IACP_COMPLETE_CONNECTIONS ();
@reserveMessages 4;

@message void MSG_GEN_APPLICATION_BRING_UP_HELP ();

@message void MSG_GEN_APPLICATION_UNUSED_3 ();
@message void MSG_GEN_APPLICATION_UNUSED_4 ();
@message void MSG_GEN_APPLICATION_TOGGLE_CURRENT_MENU_BAR ();
@message void MSG_GEN_APPLICATION_TOGGLE_FLOATING_KEYBOARD ();
@message void MSG_GEN_APPLICATION_TOGGLE_EXPRESS_MENU ();
@reserveMessages 1;
@message optr MSG_GEN_APPLICATION_GET_MODAL_WIN () = cx:dx;
@message void MSG_GEN_APPLICATION_UNUSED_2 ();
@message Boolean MSG_GEN_APPLICATION_CHECK_IF_ALWAYS_INTERACTABLE_OBJECT (
                        optr objToCheck = cx:dx) = carry;

@message void MSG_GEN_APPLICATION_SET_STATE (
                        ApplicationStates set = cx,
            ApplicationStates clear = dx);
@message void MSG_GEN_APPLICATION_QUIT_AFTER_UI ();
@message word MSG_GEN_APPLICATION_IACP_GET_NUMBER_OF_APP_MODE_CONNECTIONS () = ax;

@protominor UINewForZoomer

@message Boolean MSG_GEN_APPLICATION_CHECK_IF_RUNNING_USER_DO_DIALOG () = ax;
@message void MSG_GEN_APPLICATION_FLOATING_KEYBOARD_CLOSED ();
@message word MSG_GEN_APPLICATION_GET_TRANSPARENT_DETACH_LIST () = ax;

@message void MSG_GEN_APPLICATION_CLOSE_COMPLETE (optr ackOD);
@message void MSG_GEN_APPLICATION_FIELD_QUIT_ABORTED ();

@protominor UINewFor21

@message void MSG_GEN_APPLICATION_REMOVE_ALL_BLOCKING_DIALOGS ();

@message optr MSG_GEN_APPLICATION_GET_FLOATING_KEYBOARD_OD () = cx:dx;

@protoreset

@protominor NewForJediAndBeyond

@message void MSG_GEN_APPLICATION_ROTATE_DISPLAY ();

@message void MSG_GEN_APPLICATION_CLOSE_FILE_ACK ();

@protoreset

@protominor NewForN9000V20

@message DisplayMode MSG_GEN_APPLICATION_CHANGE_DISPLAY_MODE (DisplayMode dm = cx) = cx;

@protoreset

typedef enum /* word */ {
    TO_PRINT_CONTROL    =_FIRST_GenApplicationClass
} GenApplicationTravelOption} ;

    @vardata void HINT_APP_IS_ENTERTAINING;
    @vardata void HINT_APP_IS_EDUCATIONAL;
    @vardata void HINT_APP_IS_PRODUCTIVITY_ORIENTED;

    @vardata optr ATTR_GEN_APPLICATION_PRINT_CONTROL;
    @reloc ATTR_GEN_APPLICATION_PRINT_CONTROL, 0, optr;

    @vardata ChunkHandle TEMP_GEN_APPLICATION_NO_LONGER_USED;
    @vardata optr ATTR_GEN_APPLICATION_KBD_OBJ;
    @reloc ATTR_GEN_APPLICATION_KBD_OBJ, 0, optr;
    @vardata MemHandle TEMP_GEN_APPLICATION_SAVED_ALB;
    @vardata void TEMP_GEN_APPLICATION_ABORT_QUIT;
    @vardata optr ATTR_GEN_APPLICATION_SAVE_OPTIONS_TRIGGER;
    @reloc ATTR_GEN_APPLICATION_SAVE_OPTIONS_TRIGGER, 0, optr;

typedef struct {
    Boolean FKI_defaultPosition;
    Boolean FKI_sysModal;
} FloatingKeyboardInfo} ;

    @vardata FloatingKeyboardInfo  TEMP_GEN_APPLICATION_FLOATING_KEYBOARD_INFO;
    @vardata hptr TEMP_GEN_APPLICATION_EXTRA_STATE_BLOCK;
    @vardata optr TEMP_GEN_APPLICATION_APP_MODE_COMPLETE_ACK_OD;
    @vardata GeodeToken ATTR_GEN_APPLICATION_ADDITIONAL_TOKENS[];
    @vardata void HINT_APPLICATION_NO_INBOX_QUERY_WHEN_FOREGROUND_APP;
    @vardata void HINT_APPLICATION_QUIT_ON_IACP_ALLOW_FILE_ACCESS;

@protominor NewForJediAndBeyond
    @vardata EventHandle TEMP_GEN_APPLICATION_CLOSE_FILE_ACK_EVENT;
@protoreset

@protominor NewForN9000V20
    @vardata DisplayMode TEMP_GEN_APPLICATION_DISPLAY_MODE;
@protoreset

typedef WordFlags ApplicationStates ;
#define AS_TRANSPARENT 			0x4000
#define AS_HAS_FULL_SCREEN_EXCL 		0x2000
#define AS_SINGLE_INSTANCE 		0x1000
#define AS_QUIT_DETACHING 		0x0800
#define AS_AVOID_TRANSPARENT_DETACH 	0x0400
#define AS_TRANSPARENT_DETACHING 	0x0200
#define AS_REAL_DETACHING 		0x0100
#define AS_QUITTING 			0x0080
#define AS_DETACHING 			0x0040
#define AS_FOCUSABLE 			0x0020
#define AS_MODELABLE 			0x0010
#define AS_NOT_USER_INTERACTABLE 	0x0008
#define AS_RECEIVED_APP_OBJECT_DETACH 	0x0004
#define AS_ATTACHED_TO_STATE_FILE 	0x0002
#define AS_ATTACHING 			0x0001

typedef ByteFlags AppOptFlags ;
#define AOF_MULTIPLE_INIT_FILE_CATEGORIES 	0x80
typedef AppOptFlags ApplicationOptFlags ;

    @instance AppInstanceReference	GAI_appRef = {0,0,NullHandle,{0}};

    @instance Message			GAI_appMode = 0;
    @instance AppLaunchFlags		GAI_launchFlags = 0;
    @instance ApplicationOptFlags	GAI_optFlags = 0;
    @instance word			GAI_appFeatures = 0;
    @instance Handle			GAI_specificUI = 0;
    @instance ApplicationStates		GAI_states = AS_FOCUSABLE | AS_MODELABLE;
    @instance AppAttachFlags		GAI_attachFlags = 0;
    @instance UIInterfaceLevel	    	GAI_appLevel = UIIL_ADVANCED;
    @instance ChunkHandle		GAI_iacpConnects = 0;

    @default GI_states = @default & ~GS_USABLE;
    @default GI_attrs = @default | GA_TARGETABLE;

@endc

@endlib


Objects\gBoolC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gBoolC.goh
 * AUTHOR:	Chris Hawley: 1/23/92
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenBooleanClass.
 *
 *	$Id: gBoolC.goh,v 1.8.6.1 96/04/28 08:31:40 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <ui.goh>
@include  <Objects/genC.goh>

@class	GenBooleanClass, GenClass;

@message word MSG_GEN_BOOLEAN_GET_IDENTIFIER () = ax;
@message void MSG_GEN_BOOLEAN_SET_IDENTIFIER (word identifier = cx);

@message void MSG_GEN_BOOLEAN_SET_INTERACTABLE_STATE (  /* INTERNAL */
                                        Boolean interactable = cx);

    @instance word	  GBI_identifier;

@endc

@endlib


Objects\gBoolGC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gBoolGC.goh
 * AUTHOR:	Chris Hawley: 1/23/92
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenBooleanGroupClass.
 *
 *	$Id: gBoolGC.goh,v 1.17.6.1 96/04/28 08:31:06 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <ui.goh>
@include  <Objects/genC.goh>

@class	GenBooleanGroupClass, GenClass;

@vardata void BGROUP_UNUSED;
@vardata Message ATTR_GEN_BOOLEAN_GROUP_STATUS_MSG;
@vardata void ATTR_GEN_BOOLEAN_GROUP_INIT_FILE_BOOLEAN;
@vardata void HINT_BOOLEAN_GROUP_SCROLLABLE;
@vardata void HINT_BOOLEAN_GROUP_MINIMIZE_SIZE;
@vardata void HINT_BOOLEAN_GROUP_CHECKBOX_STYLE;
@vardata void HINT_BOOLEAN_GROUP_TOOLBOX_STYLE;
@vardata optr ATTR_GEN_BOOLEAN_GROUP_LINK;
@reloc ATTR_GEN_BOOLEAN_GROUP_LINK, 0, optr;

@message void MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE (word selectedBooleans = cx,
                         word indeterminateBooleans = dx);
@message void MSG_GEN_BOOLEAN_GROUP_SET_GROUP_MODIFIED_STATE (
                       word setBooleans = cx,
                       word clearBooleans = dx);

@message word MSG_GEN_BOOLEAN_GROUP_GET_SELECTED_BOOLEANS () = ax;
@message word MSG_GEN_BOOLEAN_GROUP_GET_INDETERMINATE_BOOLEANS () = ax;
@message word MSG_GEN_BOOLEAN_GROUP_GET_MODIFIED_BOOLEANS () = ax;

@message void MSG_GEN_BOOLEAN_GROUP_SEND_STATUS_MSG (word changedBooleans = cx);
@message optr MSG_GEN_BOOLEAN_GROUP_GET_BOOLEAN_OPTR (word identifier = cx) = cx:dx;

@message void MSG_GEN_BOOLEAN_GROUP_SET_BOOLEAN_STATE (word identifier = cx,
                                      Boolean state = dx);

@message void MSG_GEN_BOOLEAN_GROUP_SET_BOOLEAN_INDETERMINATE_STATE (
                    word identifier = cx,
                        Boolean indeterminateState = dx);

@message void MSG_GEN_BOOLEAN_GROUP_SET_BOOLEAN_MODIFIED_STATE (
                    word identifier = cx,
                        Boolean modifiedState = dx);

@message Boolean MSG_GEN_BOOLEAN_GROUP_IS_BOOLEAN_SELECTED (word identifier = cx)
                    = carry;
@message Boolean MSG_GEN_BOOLEAN_GROUP_IS_BOOLEAN_INDETERMINATE (
                    word identifier = cx) = carry;
@message Boolean MSG_GEN_BOOLEAN_GROUP_IS_BOOLEAN_MODIFIED (
                    word identifier = cx) = carry;

@message optr MSG_GEN_BOOLEAN_GROUP_GET_DESTINATION () = cx:dx;
@message void MSG_GEN_BOOLEAN_GROUP_SET_DESTINATION (optr dest = cx:dx);
@message Message MSG_GEN_BOOLEAN_GROUP_GET_APPLY_MSG () = ax;
@message void MSG_GEN_BOOLEAN_GROUP_SET_APPLY_MSG (Message message = cx);

@message void MSG_GEN_BOOLEAN_GROUP_MAKE_BOOLEAN_VISIBLE (word identifier = cx); /*XXX*/

@message word MSG_GEN_BOOLEAN_GROUP_SCAN_BOOLEANS (  /* INTERNAL */
                                            GenScanItemsFlags flags  = cl,
                        word initialBoolean = dx,
                        word scanAmount = bp) = ax;

@message void MSG_GEN_BOOLEAN_GROUP_REDRAW_BOOLEANS (  /* INTERNAL */
                                            word offset = cx);  /*XXX*/

@prototype void GEN_BOOLEAN_GROUP_APPLY_MSG (word selectedBooleans = cx,
                          word indeterminateBooleans = dx,
                          word modifiedBooleans = bp);

@prototype void GEN_BOOLEAN_GROUP_STATUS_MSG (word selectedBooleans = cx,
                                 word indeterminateBooleans = dx,
                             word changedBooleans = bp);

    @instance word    GBGI_selectedBooleans = 0;
    @instance word    GBGI_indeterminateBooleans = 0;
    @instance word    GBGI_modifiedBooleans = 0;
    @instance optr    GBGI_destination;
    @instance Message GBGI_applyMsg = 0;
@endc

@endlib


gcnlist.goh

/******************************************************************************
 *
 *	Copyright (c) GeoWorks 1989 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gcnlist.goh
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	brianc	5/91		Initial version
 *	doug	1/92		Moved from CInclude/Objects to CInclude
 *
 * DESCRIPTION:
 *	This file contains the description of the general changed
 *	notification routines and data structures.
 *
 *      $Id: gcnlist.goh,v 1.46.1.8 98/05/22 18:10:41 mevissen Exp $
 *
 *****************************************************************************/
@optimize
@deflib ui

#include  <lmem.h> 	/* for LMemBlockHeader */
#include  <file.h> 	/* for PathName */
@include  <Objects/metaC.goh> 	/* for GCNMetaMessages */

/*
 *		Constants and Structures
 */

/*
 * NOTE:  All constants & structures common to both the Kernel GCN routines
 * & MetaClass's META_GCN_* messages are defined in metaC.goh
 */

/*
 * Structure at beginning of kernel's gcn list block
 */
typedef	struct {
    LMemBlockHeader	GCNLBH_lmemHeader;
    ChunkHandle 	GCNLBH_listOfLists;
} GCNListBlockHeader} ;

/*
 *		Routines
 */

extern Boolean
    _pascal GCNListAdd (optr OD, ManufacturerID manufID, word listType);

#define GCNListAddHandles (mh, ch, mid, lt) \
        GCNListAdd(ConstructOptr(mh, ch), mid, lt)

extern Boolean
    _pascal GCNListRemove (optr OD, ManufacturerID manufID, word listType);

#define GCNListRemoveHandles (mh, ch, mid, lt) \
        GCNListRemove(ConstructOptr(mh, ch), mid, lt)

extern word	/* XXX */
    _pascal GCNListSend (ManufacturerID manufID, word listType, EventHandle event,
        MemHandle dataBlock, GCNListSendFlags gcnListSendFlags);

/*
 *		Low-level Routines
 */

extern ChunkHandle
    _pascal GCNListCreateBlock (MemHandle mh);

extern Boolean
    _pascal GCNListAddToBlock (optr OD, ManufacturerID manufID, word listType,
              MemHandle mh, ChunkHandle listOfLists);

extern Boolean
    _pascal GCNListRemoveFromBlock (optr OD, ManufacturerID manufID, word listType,
               MemHandle mh, ChunkHandle listOfLists);

extern word
    _pascal GCNListSendToBlock (ManufacturerID manufID, word listType,
               EventHandle event, MemHandle dataBlock, MemHandle mh,
               ChunkHandle listOfLists, GCNListSendFlags flags);

extern ChunkHandle
    _pascal GCNListFindListInBlock (ManufacturerID manufID, word changeType,
               MemHandle mh, ChunkHandle listOfLists,
               Boolean createIfNotFound);

extern void
    _pascal GCNListDestroyBlock (MemHandle mh, ChunkHandle listOfLists);

extern void
    _pascal GCNListRelocateBlock (MemHandle mh, ChunkHandle listOfLists,
                MemHandle relocBlock);

extern Boolean
    _pascal GCNListUnRelocateBlock (MemHandle mh, ChunkHandle listOfLists,
                MemHandle relocBlock);

/***/

extern ChunkHandle
    _pascal GCNListCreateList (MemHandle mh);

extern Boolean
    _pascal GCNListAddToList (optr OD, optr list);

#define GCNListAddToListODHandles (mh, ch, list) \
        GCNListAddToList(ConstructOptr(mh, ch), list)

#define GCNListAddToListListHandles (OD, listmh, listch) \
        GCNListAddToList(OD, ConstructOptr(listmh, listch))

#define GCNListAddToListODListHandles (mh, ch, listmh, listch) \
        GCNListAddToList(ConstructOptr(mh, ch), ConstructOptr(listmh, listch))

extern Boolean
    _pascal GCNListRemoveFromList (optr OD, optr list);

#define GCNListRemoveFromListODHandles (mh, ch, list) \
        GCNListRemoveFromList(ConstructOptr(mh, ch), list)

#define GCNListRemoveFromListListHandles (OD, listmh, listch) \
        GCNListRemoveFromList(OD, ConstructOptr(listmh, listch))

#define GCNListRemoveFromListODListHandles (mh, ch, listmh, listch) \
        GCNListRemoveFromList(ConstructOptr(mh, ch), ConstructOptr(listmh, listch))

extern void
    _pascal GCNListSendToList (optr list, EventHandle event, MemHandle dataBlock,
              GCNListSendFlags flags);

#define GCNListSendToListHandles (mh, ch, ev, db, fl) \
        GCNListSendToList(ConstructOptr(mh, ch), ev, db, fl)

extern Boolean	/* XXX */
    _pascal GCNListFindItemInList (optr OD, optr list);

#define GCNListFindItemInListODHandles (mh, ch, list) \
        GCNListFindItemInList(ConstructOptr(mh, ch), list)

#define GCNListFindItemInListListHandles (OD, listmh, listch) \
        GCNListFindItemInList(OD, ConstructOptr(listmh, listch))

#define GCNListFindItemInListODListHandles (mh, ch, listmh, listch) \
        GCNListFindItemInList(ConstructOptr(mh, ch), ConstructOptr(listmh, listch))

extern void
    _pascal GCNListDestroyList (optr list);

#define GCNListDestroyListHandles (listmh, listch) \
        GCNListDestroyList(ConstructOptr(listmh, listch))

extern void
    _pascal GCNListRelocateList (optr list, MemHandle relocBlock);

extern void
    _pascal GCNListUnRelocateList (optr list, MemHandle relocBlock);

#define GCNListRelocateListHandles (lishmh, listch, rBlk) \
        GCNListRelocateList(ConstructOptr(listhmh, listhch, rBlk))

#define GCNListUnRelocateListHandles (lishmh, listch, rBlk) \
        GCNListUnRelocateList(ConstructOptr(listhmh, listhch, rBlk))

/* pre-defined Kernel GCN list types -- use with MANUFACTURER_ID_GEOWORKS */

typedef enum {
    GCNSLT_FILE_SYSTEM    =0,
    GCNSLT_APPLICATION    =2,
    GCNSLT_DATE_TIME    =4,
    GCNSLT_DICTIONARY    =6,
    GCNSLT_KEYBOARD_OBJECTS    =8,
    GCNSLT_EXPRESS_MENU_CHANGE    =10,
    GCNSLT_INSTALLED_PRINTERS    =12,
    GCNSLT_SHUTDOWN_CONTROL    =14,
    GCNSLT_TRANSFER_NOTIFICATION    =16,
    GCNSLT_EXPRESS_MENU_OBJECTS    =18,
    GCNSLT_TRANSPARENT_DETACH    =20,
    GCNSLT_TRANSPARENT_DETACH_DA    =22,
    GCNSLT_REMOVABLE_DISK    =24,
    GCNSLT_TRANSPARENT_DETACH_IN_PROGRESS    =26,
    GCNSLT_TRANSPARENT_DETACH_FULL_SCREEN_EXCL    =28,
    GCNSLT_EMAIL_DATABASE_CHANGE    =30,
    GCNSLT_FONT_CHANGES    =32,
    GCNSLT_INK    =34,
    GCNSLT_PRINT_JOB_STATUS    =36,
    GCNSLT_FOAM_DB_CHANGES    =38,
    GCNSLT_NOTIFY_SERIAL_LURKER    =40,
    GCNSLT_FAX_INFO_FILE_CHANGE    =42,
    GCNSLT_NOTIFY_INIT_FILE_CHANGE    =44,
    GCNSLT_NOTIFY_KEYBOARD_EVENT    =46,
    GCNSLT_NOTIFY_INDICATOR_EVENT    =48,
    GCNSLT_CONTACT_LIST_SELECTION    =50,
    GCNSLT_CONTACT_LOG_CHANGES    =52,
    GCNSLT_RESPONDER_NOTIFICATIONS    =54,
    GCNSLT_ACCESS_POINT_CHANGE    =56,
    GCNSLT_PCMCIA_NOTIFY_CARD_CHANGE    =58,
    GCNSLT_SECURITY_SETTINGS_NOTIFICATIONS    =60,
    GCNSLT_PENELOPE_HARDWARE_NOTIFICATIONS    =62,
    GCNSLT_PENELOPE_RADIO_STATUS_NOTIFICATIONS    =64,
    GCNSLT_UI_CHANGE    =66,
    GCNSLT_KEYBOARD_MAP_CHANGE    =68,
    GCNSLT_CONTACT_SIM_LIST_SELECTION    =70,
    GCNSLT_CONTACT_SIM_LIST_CONTACT_CHANGE    =72,
    GCNSLT_CONTACT_SIM_LIST_CHANGES    =74,
    GCNSLT_CONTACT_SIM_LIST_FDN_STATUS    =76,

} GCNStandardListType} ;

/* pre-defined change messages -- use with MANUFACTURER_ID_GEOWORKS */

typedef enum {
    FCNT_CREATE, FCNT_RENAME, , FCNT_OPEN, FCNT_DELETE, FCNT_CONTENTS,
    FCNT_ATTRIBUTES, FCNT_DISK_FORMAT, , FCNT_CLOSE, FCNT_BATCH,
    FCNT_ADD_SP_DIRECTORY, FCNT_DELETE_SP_DIRECTORY, FCNT_FILE_UNREAD, ,
    FCNT_FILE_READ    ,
} FileChangeNotificationType} ;

typedef struct {
    word    	    FCND_disk; 	/* Handle for disk on which change occurred */
    FileID  	    FCND_id;   	/* ID of affected file or containing dir,
                 * as appropriate to notification type */
    FileLongName    FCND_name;	/* Name of file, if appropriate (FCNT_CREATE,
                 * FCNT_RENAME, and FCNT_OPEN only) */
} FileChangeNotificationData} ;

typedef struct {
    FileChangeNotificationType	FCBNI_type;
    word    	    	    	FCBNI_disk;
    FileID  	    	    	FCBNI_id;
    FileLongName    	    	FCBNI_name; /* Only present if required, else
                         * next item is where this field
                         * would otherwise be */
} FileChangeBatchNotificationItem} ;

typedef struct {    /* Notification block for FCNT_BATCH */
    word    	    	    	    FCBND_end;   	/* First free byte in
                             * the block */
    FileChangeBatchNotificationItem FCBND_notifications[1]; /* First batched
                                 * notification */
} FileChangeBatchNotificationData} ;

typedef enum {
    GCNDCNT_CREATED    ,
    GCNDCNT_DESTROYED
} GCNDriveChangeNotificationType} ;

@importMessage	MetaGCNMessages, void MSG_NOTIFY_FILE_CHANGE (
                   FileChangeNotificationType notifyType = dx,
                   MemHandle data = bp);

@importMessage	MetaGCNMessages, void MSG_NOTIFY_DRIVE_CHANGE (
                GCNDriveChangeNotificationType type=cx,
                word driveNum=dx);

  /* This message is currently not supported and is never sent
   * out by the system. */
@importMessage	MetaGCNMessages, void MSG_NOTIFY_APP_STARTED ();

@importMessage	MetaGCNMessages, void MSG_NOTIFY_APP_EXITED (MemHandle
                            appExited = dx);

@importMessage	MetaGCNMessages, void MSG_NOTIFY_DATE_TIME_CHANGE ();

@importMessage	MetaGCNMessages, void MSG_NOTIFY_USER_DICT_CHANGE (
                    MemHandle sendingSpellBox = dx,
                    MemHandle userDictChanged = bp);

@importMessage	MetaGCNMessages, void MSG_NOTIFY_KEYBOARD_LAYOUT_CHANGE ();

typedef enum {
    GCNEMNT_CREATED    ,
    GCNEMNT_DESTROYED
} GCNExpressMenuNotificationTypes} ;

@importMessage	MetaGCNMessages, void MSG_NOTIFY_EXPRESS_MENU_CHANGE (
                GCNExpressMenuNotificationTypes type = bp,
                optr affectedExpressMenuControl = cx:dx);

@importMessage	MetaGCNMessages, void MSG_PRINTER_INSTALLED_REMOVED ();

typedef enum {
    GCNSCT_SUSPEND    ,
    GCNSCT_SHUTDOWN    ,
    GCNSCT_UNSUSPEND
} GCNShutdownControlType} ;

@importMessage	MetaGCNMessages, void MSG_META_CONFIRM_SHUTDOWN (
                word confirmed=cx,
                GCNShutdownControlType type=bp);

@alias(MSG_META_CONFIRM_SHUTDOWN) void MSG_META_CONFIRM_SHUTDOWN_QUERY(
                optr originator = cx:dx,
                GCNShutdownControlType type=bp);

@importMessage	MetaGCNMessages, void MSG_NOTIFY_INK_REDISPLAY ();
@importMessage	MetaGCNMessages, void MSG_PRINT_DIALOG_INITIALIZED ();
@importMessage	MetaGCNMessages, void MSG_PRINT_JOB_CANCELLED ();

typedef enum {
    PSCT_NEW_PAGE	,	/* Data is current physical page */
    PSCT_COMPLETE	,	/* Data is undefined */
    PSCT_CANCELED	,	/* Data is undefined */
    PSCT_ERROR		/* Data is undefined */
} PrintStatusChangeType} ;

@importMessage	MetaGCNMessages, void MSG_PRINT_STATUS_CHANGE (
            PrintStatusChangeType change = cx,
            word jobID = dx,
            word data = bp);

/*
 *	routine name aliases
 */
#ifdef __HIGHC__
pragma Alias(GCNListAdd, "GCNLISTADD");
pragma Alias(GCNListRemove, "GCNLISTREMOVE");
pragma Alias(GCNListSend, "GCNLISTSEND");

pragma Alias(GCNListAddToBlock, "GCNLISTADDTOBLOCK");
pragma Alias(GCNListRemoveFromBlock, "GCNLISTREMOVEFROMBLOCK");
pragma Alias(GCNListSendToBlock, "GCNLISTSENDTOBLOCK");
pragma Alias(GCNListFindListInBlock, "GCNLISTFINDLISTINBLOCK");
pragma Alias(GCNListCreateBlock, "GCNLISTCREATEBLOCK");
pragma Alias(GCNListDestroyBlock, "GCNLISTDESTROYBLOCK");
pragma Alias(GCNListRelocateBlock, "GCNLISTRELOCATEBLOCK");
pragma Alias(GCNListUnRelocateBlock, "GCNLISTUNRELOCATEBLOCK");

pragma Alias(GCNListAddToList, "GCNLISTADDTOLIST");
pragma Alias(GCNListRemoveFromList, "GCNLISTREMOVEFROMLIST");
pragma Alias(GCNListFindItemInList, "GCNLISTFINDITEMINLIST");
pragma Alias(GCNListSendToList, "GCNLISTSENDTOLIST");
pragma Alias(GCNListCreateList, "GCNLISTCREATELIST");
pragma Alias(GCNListDestroyList, "GCNLISTDESTROYLIST");
pragma Alias(GCNListRelocateList, "GCNLISTRELOCATELIST");
pragma Alias(GCNListUnRelocateList, "GCNLISTUNRELOCATELIST");
#endif

@endlib


Objects\gContC.goh

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gContC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenContentClass
 *
 *	$Id: gContC.goh,v 1.14.17.1 96/04/28 08:31:44 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <Objects/genC.goh>

@class	GenContentClass, GenClass;

@message byte MSG_GEN_CONTENT_GET_ATTRS () = cl;  /*XXX*/
@message void MSG_GEN_CONTENT_SET_ATTRS (byte attrsToSet = cl,
                    byte attrsToClear = ch);  /*XXX*/

@vardata void HINT_CONTENT_KEEP_FOCUS_VISIBLE;

    @instance byte	GCI_attrs = 0; /* VisContentAttrs */
    @instance optr 	GCI_genView;

@endc

@endlib


Objects\gCtrlC.goh

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gCtrlC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenControlClass
 *
 *	$Id: gCtrlC.goh,v 1.56.6.1 96/04/28 08:31:11 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <Objects/gInterC.goh>
@include  <gcnlist.goh>

@class	GenControlClass, GenInteractionClass;

@message void MSG_GEN_CONTROL_GET_INFO (GenControlBuildInfo *info = cx:dx);

typedef ByteFlags GenControlFeatureFlags ;

typedef struct {
    ChunkHandle			GCFI_object;
    optr			GCFI_name;
    GenControlFeatureFlags    	GCFI_flags;
} GenControlFeaturesInfo} ;

typedef ByteFlags GenControlChildFlags ;
#define GCCF_NOTIFY_WHEN_ADDING 		0x04
#define GCCF_ALWAYS_ADD 			0x02
#define GCCF_IS_DIRECTLY_A_FEATURE 	0x01

typedef struct {
    ChunkHandle			GCCI_object;
    WordFlags			GCCI_featureMask;
    GenControlChildFlags	GCCI_flags;
} GenControlChildInfo} ;

typedef WordFlags GenControlBuildFlags ;
#define GCBF_SUSPEND_ON_APPLY 			0x8000
#define GCBF_USE_GEN_DESTROY 			0x4000
#define GCBF_SPECIFIC_UI 			0x2000
#define GCBF_CUSTOM_ENABLE_DISABLE 		0x1000
#define GCBF_ALWAYS_UPDATE   	    		0x0800
#define GCBF_EXPAND_TOOL_WIDTH_TO_FIT_PARENT    	0x0400
#define GCBF_ALWAYS_INTERACTABLE     		0x0200
#define GCBF_ALWAYS_ON_GCN_LIST 	    		0x0100
#define GCBF_MANUALLY_REMOVE_FROM_ACTIVE_LIST  	0x0080
#define GCBF_IS_ON_ACTIVE_LIST     		0x0040
#define GCBF_IS_ON_START_LOAD_OPTIONS_LIST 	0x0020
#define GCBF_NOT_REQUIRED_TO_BE_ON_SELF_LOAD_OPTIONS_LIST  0x0010
#define GCBF_DO_NOT_DESTROY_CHILDREN_WHEN_CLOSED     0x0008

typedef struct {
    GenControlBuildFlags	GCBI_flags;
    const char			*GCBI_initFileKey;
    const GCNListType		*GCBI_gcnList;
    word			GCBI_gcnCount;
    const NotificationType	*GCBI_notificationList;
    word			GCBI_notificationCount;
    optr			GCBI_controllerName;

    MemHandle			GCBI_dupBlock;
    const GenControlChildInfo	*GCBI_childList;
    word			GCBI_childCount;
    const GenControlFeaturesInfo *GCBI_featuresList;
    word			GCBI_featuresCount;
    WordFlags			GCBI_features;

    MemHandle			GCBI_toolBlock;
    const GenControlChildInfo	*GCBI_toolList;
    word			GCBI_toolCount;
    const GenControlFeaturesInfo *GCBI_toolFeaturesList;
    word			GCBI_toolFeaturesCount;
    WordFlags			GCBI_toolFeatures;
    char			*GCBI_helpContext;

    byte			GCBI_reserved [8];
} GenControlBuildInfo} ;

@message void MSG_GEN_CONTROL_GENERATE_UI ();

@message void MSG_GEN_CONTROL_DESTROY_UI ();

@message void MSG_GEN_CONTROL_GENERATE_TOOLBOX_UI (optr parent = cx:dx);

@message void MSG_GEN_CONTROL_DESTROY_TOOLBOX_UI ();

@message void MSG_GEN_CONTROL_UPDATE_UI(@stack
                    MemHandle toolBlock,
                    MemHandle childBlock,
                    WordFlags toolboxFeatures,
                    WordFlags features,
                    MemHandle data,
                    word changeID,
                    ManufacturerID manufID);

@message void MSG_GEN_CONTROL_ENABLE_DISABLE (Message msg = cx,
                         VisUpdateMode updateMode = dl);

typedef enum /* word */ {
    GCUIT_NORMAL    ,
    GCUIT_TOOLBOX
} GenControlUIType} ;

typedef struct {
    WordFlags	GCSI_userAdded;
    WordFlags	GCSI_userRemoved;
    WordFlags	GCSI_appRequired;
    WordFlags	GCSI_appProhibited;
} GenControlScanInfo} ;

@message void MSG_GEN_CONTROL_SCAN_FEATURE_HINTS (GenControlUIType type = cx,
                 GenControlScanInfo *info = dx:bp);

@message void MSG_GEN_CONTROL_ADD_FEATURE (WordFlags featureToAdd);

@message void MSG_GEN_CONTROL_REMOVE_FEATURE (WordFlags featureToRemove);

@message void MSG_GEN_CONTROL_ADD_TOOLBOX_FEATURE (WordFlags featureToAdd = cx);

@message void MSG_GEN_CONTROL_REMOVE_TOOLBOX_FEATURE (
                    WordFlags featureToRemove = cx);

typedef WordFlags GenControlInteractableFlags ;
#define GCIF_CONTROLLER 	0x8000
#define GCIF_TOOLBOX_UI 	0x0002
#define GCIF_NORMAL_UI 	0x0001

@message void MSG_GEN_CONTROL_NOTIFY_INTERACTABLE (
                GenControlInteractableFlags flags);

@message void MSG_GEN_CONTROL_NOTIFY_NOT_INTERACTABLE (
                GenControlInteractableFlags flags);

@message void MSG_GEN_CONTROL_UNBUILD_NORMAL_UI_IF_POSSIBLE ();

@message void MSG_GEN_CONTROL_ADD_TO_GCN_LISTS ();

@message void MSG_GEN_CONTROL_REMOVE_FROM_GCN_LISTS ();

typedef struct {
    WordFlags    GCSR_features;
    WordFlags    GCSR_required;
    WordFlags    GCSR_prohibited;
    WordFlags    GCSR_supported;
} GenControlGetFeaturesReturn} ;

@message void MSG_GEN_CONTROL_GET_NORMAL_FEATURES (
            GenControlGetFeaturesReturn *return = axcxdxbp);

@message void MSG_GEN_CONTROL_GET_TOOLBOX_FEATURES (
            GenControlGetFeaturesReturn *return = axcxdxbp);

@message void MSG_GEN_CONTROL_ADD_APP_UI (optr appUI = cx:dx);
@message void MSG_GEN_CONTROL_ADD_APP_TOOLBOX_UI (optr appUI = cx:dx);

@message void MSG_GEN_CONTROL_REBUILD_NORMAL_UI ();

@message void MSG_GEN_CONTROL_REBUILD_TOOLBOX_UI ();

@message void MSG_GEN_CONTROL_ADD_TO_UI ();

@message void MSG_GEN_CONTROL_REMOVE_FROM_UI ();

@message void MSG_GEN_CONTROL_OUTPUT_ACTION (EventHandle event = bp);
@message void MSG_GEN_CONTROL_TWEAK_DUPLICATED_UI (
                    MemHandle childBlock = cx,
                    WordFlags features = dx);
@message void MSG_GEN_CONTROL_TWEAK_DUPLICATED_TOOLBOX_UI (
                    MemHandle toolBlock = cx,
                    WordFlags toolboxFeatures = dx);

@message void MSG_GEN_CONTROL_NOTIFY_ADDING_FEATURE (optr feature = cx:dx);
@message void MSG_GEN_CONTROL_FREE_OBJ_BLOCK (MemHandle blockToFree = cx);

typedef WordFlags GenControlStatusChange ;
#define GCSF_HIGHLIGHTED_TOOLGROUP_SELECTED 	0x0004
#define GCSF_TOOLBOX_FEATURES_CHANGED 		0x0002
#define GCSF_NORMAL_FEATURES_CHANGED 		0x0001

typedef struct {
    optr    			NGCS_controller;
    GenControlStatusChange	NGCS_statusChange;
} NotifyGenControlStatusChange} ;

/*
 * vardata
 */

typedef struct {
    GenControlInteractableFlags	TGCI_interactableFlags;
    MemHandle			TGCI_childBlock;
    MemHandle			TGCI_toolBlock;
    optr			TGCI_toolParent;
    WordFlags			TGCI_features;
    WordFlags			TGCI_toolboxFeatures;
    GCNListType	    	    	TGCI_activeNotificationList;
    GenControlInteractableFlags	TGCI_upToDate;
} TempGenControlInstance} ;

    @vardata TempGenControlInstance TEMP_GEN_CONTROL_INSTANCE;

typedef WordFlags GenControlUserFlags ;
#define GCUF_USER_TOOLBOX_UI 	0x0002
#define GCUF_USER_UI 	    	0x0001

typedef struct {
    GenControlUserFlags	GCUD_flags;
    word	    	GCUD_userAddedUI;
    word	    	GCUD_userRemovedUI;
    word	    	GCUD_userAddedToolboxUI;
    word	    	GCUD_userRemovedToolboxUI;
} GenControlUserData} ;

    @vardata GenControlUserData HINT_GEN_CONTROL_MODIFY_INITIAL_UI;
    @vardata GenControlUserData HINT_GEN_CONTROL_USER_MODIFIED_UI;

    @vardata void HINT_GEN_CONTROL_TOOLBOX_ONLY;

    @vardata WordFlags ATTR_GEN_CONTROL_REQUIRE_UI;
    @vardata WordFlags ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI;

    @vardata WordFlags ATTR_GEN_CONTROL_PROHIBIT_UI;
    @vardata WordFlags ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI;

    @vardata optr ATTR_GEN_CONTROL_APP_UI;
    @reloc ATTR_GEN_CONTROL_APP_UI, 0, optr;

    @vardata optr ATTR_GEN_CONTROL_APP_TOOLBOX_UI;
    @reloc ATTR_GEN_CONTROL_APP_TOOLBOX_UI, 0, optr;

typedef ByteEnum GenControlScalableUICommand ;
#define GCSUIC_SET_NORMAL_FEATURES_IF_APP_FEATURE_ON 	0
/*
 * if (GCSUIE_appFeature is ON)
 *     menu features = GCSUIE_newFeatures
 */
#define GCSUIC_SET_TOOLBOX_FEATURES_IF_APP_FEATURE_ON 	1
/*
 * if (GCSUIE_appFeature is ON)
 *     tool features = GCSUIE_newFeatures
 */
#define GCSUIC_SET_NORMAL_FEATURES_IF_APP_FEATURE_OFF 	2
/*
 * if (GCSUIE_appFeature is OFF)
 *     menu features = GCSUIE_newFeatures
 */
#define GCSUIC_SET_TOOLBOX_FEATURES_IF_APP_FEATURE_OFF 	3
/*
 * if (GCSUIE_appFeature is OFF)
 *     tool features = GCSUIE_newFeatures
 */
#define GCSUIC_SET_NORMAL_FEATURES_IF_APP_LEVEL     	4
/*
 * if (app level >= GCSUIE_appFeature)
 *     menu features = GCSUIE_newFeatures
 */
#define GCSUIC_SET_TOOLBOX_FEATURES_IF_APP_LEVEL     	5
/*
 * if (app level >= GCSUIE_appFeature)
 *     tool features = GCSUIE_newFeatures
 */
#define GCSUIC_ADD_NORMAL_FEATURES_IF_APP_FEATURE_ON 	6
/*
 * if (GCSUIE_appFeature is ON)
 *     menu features |= GCSUIE_newFeatures
 */
#define GCSUIC_ADD_TOOLBOX_FEATURES_IF_APP_FEATURE_ON 	7
/*
 * if (GCSUIE_appFeature is ON)
 *     tool features |= GCSUIE_newFeatures
 */

typedef struct {
    GenControlScalableUICommand		GCSUIE_command;
    WordFlags				GCSUIE_appFeature;
    WordFlags				GCSUIE_newFeatures;
} GenControlScalableUIEntry} ;

   @vardata GenControlScalableUIEntry HINT_GEN_CONTROL_SCALABLE_UI_DATA;

   @vardata void TEMP_GEN_CONTROL_OPTIONS_LOADED;

   @vardata void ATTR_GEN_CONTROL_DO_NOT_USE_LIBRARY_NAME_FOR_HELP;

   @vardata void HINT_GEN_CONTROL_DESTROY_CHILDREN_WHEN_NOT_INTERACTABLE;

/*
 * Instance data
 */

    @instance optr 	GCI_output;

    @default GI_states = (@default & ~GS_ENABLED);

@endc

#ifdef __HIGHC__
#endif

@endlib


Objects\gDCtrlC.goh

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gDCtrlC.goh
 * AUTHOR:	Tony Requist: September 3, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenFileSelectorClass
 *
 *	$Id: gDCtrlC.goh,v 1.28.4.1 96/04/28 08:30:56 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <Objects/genC.goh>

@class	GenDisplayGroupClass, GenClass;

@message void MSG_GEN_DISPLAY_GROUP_SET_FULL_SIZED ();
@message void MSG_GEN_DISPLAY_GROUP_SET_OVERLAPPING ();
@message Boolean MSG_GEN_DISPLAY_GROUP_GET_FULL_SIZED () = carry;

@message void MSG_GEN_DISPLAY_GROUP_TILE_DISPLAYS ();
@message void MSG_GEN_DISPLAY_GROUP_SELECT_DISPLAY (word displayNum = cx);

@message void MSG_GEN_DISPLAY_GROUP_SET_NUM_ITEMS ();   /* INTERNAL */
@message void MSG_GEN_DISPLAY_GROUP_SET_MONIKER ();   /* INTERNAL */

@protominor UINewForNike

@message void MSG_GEN_DISPLAY_GROUP_SWAP_DISPLAYS ();	/* INTERNAL */
@message void MSG_GEN_DISPLAY_GROUP_RESIZE_DISPLAYS ();	/* INTERNAL */

@protoreset

    @vardata void HINT_DISPLAY_GROUP_SEPARATE_MENUS;
    @vardata void HINT_DISPLAY_GROUP_ARRANGE_TILED;
    @vardata void HINT_DISPLAY_GROUP_FULL_SIZED_ON_STARTUP;
    @vardata void HINT_DISPLAY_GROUP_OVERLAPPING_ON_STARTUP;
    @vardata void HINT_DISPLAY_GROUP_FULL_SIZED_IF_TRANSPARENT_DOC_CTRL_MODE;

    @vardata void ATTR_GEN_DISPLAY_GROUP_NO_FULL_SIZED;
    @vardata void ATTR_GEN_DISPLAY_GROUP_NO_OVERLAPPING;
    @vardata void ATTR_GEN_DISPLAY_GROUP_OVERLAPPING_STATE;

    @vardata void HINT_DISPLAY_GROUP_TILE_HORIZONTALLY;
    @vardata void HINT_DISPLAY_GROUP_TILE_VERTICALLY;

    @vardata void HINT_DISPLAY_GROUP_SIZE_INDEPENDENTLY_OF_DISPLAYS;

    @default GI_attrs = @default | GA_TARGETABLE;

@endc

/****************/

@class GenDisplayControlClass, GenControlClass;

@message void MSG_GDC_SET_OVERLAPPING ();
@message void MSG_GDC_TILE ();
@message void MSG_GDC_LIST_APPLY ();
@message void MSG_GDC_LIST_QUERY ();

@protominor UINewForNike

@message void MSG_GDC_SWAP_DISPLAYS ();
@message void MSG_GDC_RESIZE_DISPLAYS ();

@protoreset

typedef ByteFlags GenDisplayControlAttributes ;
#define GDCA_MAXIMIZED_NAME_ON_PRIMARY 	0x80

#define MAX_DISPLAY_NAME_SIZE 	64

typedef WordFlags GDCFeatures ;
#define GDCF_OVERLAPPING_MAXIMIZED 	0x0004
#define GDCF_TILE 			0x0002
#define GDCF_DISPLAY_LIST 		0x0001

typedef WordFlags GDCToolboxFeatures ;
#define GDCTF_OVERLAPPING_MAXIMIZED 	0x0004
#define GDCTF_TILE 			0x0002
#define GDCTF_DISPLAY_LIST 		0x0001

#define GDC_DEFAULT_FEATURES   \
    (GDCF_OVERLAPPING_MAXIMIZED | GDCF_TILE | GDCF_DISPLAY_LIST)
#define GDC_DEFAULT_TOOLBOX_FEATURES   (GDCF_DISPLAY_LIST)

typedef struct {
    optr	NDC_display;
    TCHAR	NDC_name[MAX_DISPLAY_NAME_SIZE];
    byte	NDC_overlapping;
} NotifyDisplayChange} ;

typedef struct {
    word    	NDLC_counter;
    optr	NDLC_group;
} NotifyDisplayListChange} ;

typedef ByteFlags GenDisplayControlAttributes ;
#define GDCA_MAXIMIZED_NAME_ON_PRIMARY 	0x80

    @vardata void HINT_DISPLAY_CONTROL_NO_FEATURES_IF_TRANSPARENT_DOC_CTRL_MODE;

    @vardata void TEMP_GDC_CACHED_NAME;
    @vardata NotifyDisplayListChange TEMP_GDC_CACHED_LIST_DATA;
    @vardata NotifyDisplayListChange TEMP_GDC_CACHED_TOOL_LIST_DATA;
    @vardata word TEMP_GDC_CACHED_SELECTED_DISPLAY;

    @instance GenDisplayControlAttributes	GDCII_attrs =
                (GDCA_MAXIMIZED_NAME_ON_PRIMARY);

    @default GI_states = @default | GS_ENABLED;
    @default GCI_output = (TO_APP_TARGET);

@endc

@endlib


Objects\gDispC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gDispC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenDisplayClass
 *
 *	$Id: gDispC.goh,v 1.27.11.1 96/04/28 08:31:14 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <Objects/genC.goh>

@class GenDisplayClass, GenClass;

@message void MSG_GEN_DISPLAY_SET_MINIMIZED ();
@message void MSG_GEN_DISPLAY_SET_NOT_MINIMIZED ();
@message Boolean MSG_GEN_DISPLAY_GET_MINIMIZED () = carry;
@message void MSG_GEN_DISPLAY_SET_MAXIMIZED ();
@message void MSG_GEN_DISPLAY_SET_NOT_MAXIMIZED ();
@message Boolean MSG_GEN_DISPLAY_GET_MAXIMIZED () = carry;

@message void MSG_GEN_DISPLAY_SET_ATTRS (byte attrs = cl);
@message byte MSG_GEN_DISPLAY_GET_ATTRS () = cl;

@message void MSG_GEN_DISPLAY_UPDATE_FROM_DOCUMENT ();	/* NEEDS PROTOTYPE */

@message optr MSG_GEN_DISPLAY_GET_DOCUMENT () = cx:dx;

@message void MSG_GEN_DISPLAY_CLOSE ();

@message void MSG_GEN_DISPLAY_INTERNAL_SET_OVERLAPPING (byte updateMode = dl);
@message void MSG_GEN_DISPLAY_INTERNAL_SET_FULL_SIZED (byte updateMode = dl);

    @vardata	void HINT_DISPLAY_MINIMIZED_ON_STARTUP;
    @vardata	void HINT_DISPLAY_NOT_MINIMIZED_ON_STARTUP;
    @vardata	void HINT_DISPLAY_MAXIMIZED_ON_STARTUP;
    @vardata	void HINT_DISPLAY_NOT_MAXIMIZED_ON_STARTUP;

typedef struct {
    optr		TIR_travelingObject;
    ChunkHandle	TIR_parent;
    word		TIR_compChildFlags;
} TravelingObjectReference} ;

    @vardata	ChunkHandle ATTR_GEN_DISPLAY_TRAVELING_OBJECTS;

    @vardata	void ATTR_GEN_DISPLAY_NOT_MINIMIZABLE;
    @vardata	void ATTR_GEN_DISPLAY_NOT_MAXIMIZABLE;
    @vardata	void ATTR_GEN_DISPLAY_NOT_RESTORABLE;

    @vardata	void ATTR_GEN_DISPLAY_MINIMIZED_STATE;
    @vardata	void ATTR_GEN_DISPLAY_MAXIMIZED_STATE;

    @vardata	void HINT_DISPLAY_NOT_RESIZABLE;

    @vardata	void ATTR_GEN_DISPLAY_MENU_BAR_POPPED_OUT;

    /* Internal variable data.  Do not use. */
    @vardata GenSaveWindowInfo TEMP_GEN_DISPLAY_SAVE_POPOUT_MENU_BAR_INFO;

    @vardata	void HINT_DISPLAY_DEFAULT_ACTION_IS_NAVIGATE_TO_NEXT_FIELD;

    @vardata	void HINT_DISPLAY_USE_APPLICATION_MONIKER_WHEN_MINIMIZED;

    @vardata	void HINT_DISPLAY_MENU_BAR_HIDDEN_ON_STARTUP;

    @vardata	void TEMP_GEN_DISPLAY_MENU_BAR_HIDDEN;

    @vardata	void HINT_DISPLAY_USE_APPLICATION_MONIKER_WHEN_MENU_BAR_POPPED_OUT;

typedef ByteFlags GenDisplayAttrs ;
#define GDA_USER_DISMISSABLE 	0x80

    @instance GenDisplayAttrs	GDI_attributes = GDA_USER_DISMISSABLE;
    @instance optr		GDI_document;

    @default GI_attrs = (@default | GA_TARGETABLE | GA_KBD_SEARCH_PATH);
@endc

@endlib


Objects\gDListC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gDListC.goh
 * AUTHOR:	Chris Hawley: 1/23/92
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenDynamicListClass.
 *
 *	$Id: gDListC.goh,v 1.16.6.1 96/04/28 08:31:03 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <ui.goh>
@include  <Objects/genC.goh>

@class	GenDynamicListClass, GenItemGroupClass;

/* Flags passed to MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_MONIKER. */
typedef WordFlags ReplaceItemMonikerFlags ;
#define RIMF_NOT_ENABLED 	0x8000

/* Prototype for GDLI_queryMsg */
@prototype void GEN_DYNAMIC_LIST_QUERY_MSG (optr list = cx:dx,
                           word item = bp);

@message void MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_MONIKER(@stack
        word item, ReplaceItemMonikerFlags flags,
        word height, word width, word length,
        VisMonikerDataType dataType,
        VisMonikerSourceType sourceType,
        dword source);

@message void MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_MONIKER_OPTR (word item = bp,
                    optr moniker = cx:dx);
@message void MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_TEXT (word item = bp,
                              char *text = cx:dx);

@message void MSG_GEN_DYNAMIC_LIST_INITIALIZE (
            word numItems = cx);

#define GDLI_NO_CHANGE  	0xffff

@message word MSG_GEN_DYNAMIC_LIST_GET_NUM_ITEMS () = cx;

@message void MSG_GEN_DYNAMIC_LIST_ADD_ITEMS (word item = cx,
                         word numItems = dx);
@message void MSG_GEN_DYNAMIC_LIST_REMOVE_ITEMS (word item = cx,
                        word numItems = dx);

@message void MSG_GEN_DYNAMIC_LIST_REMOVE_ITEM_LIST (
                      word *deletionList = cx:dx,
                       word numItems = bp);

#define GDLP_FIRST 	0x0000
#define GDLP_LAST 	0xffff

/* Internal messages */

@message (GEN_DYNAMIC_LIST_QUERY_MSG) MSG_GEN_DYNAMIC_LIST_QUERY_ITEM_MONIKER;   /*XXX*/

@message ClassStruct * MSG_GEN_DYNAMIC_LIST_GET_ITEM_CLASS * () = cx:dx;  /*XXX*/

@message void MSG_GEN_DYNAMIC_LIST_TOP_ITEM_CHANGED (word topItem = cx,
                          word prevTopItem = dx,
                          word numVisibleItems = bp); /*XXX*/
@message void MSG_GEN_DYNAMIC_LIST_NUM_VISIBLE_ITEMS_CHANGED (
                     word numVisibleItems = cx,
                     word curTopItem = bp);  /*XXX*/
@message void MSG_GEN_DYNAMIC_LIST_NUM_ITEMS_CHANGED (word numItems = cx); /*XXX*/

    @instance 	word GDLI_numItems = 0;
    @instance	word GDLI_queryMsg = 0;

@endc

@endlib


Objects\gDocC.goh

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gDocC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenDocumentClass
 *
 *	$Id: gDocC.goh,v 1.41.1.1 96/04/28 08:31:16 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

#include  <file.h>
@include  <Objects/gContC.goh>

@class	GenDocumentClass, GenContentClass;

typedef WordFlags GenDocumentAttrs ;
#define GDA_READ_ONLY 	    	    0x8000
#define GDA_READ_WRITE 	    	    0x4000
#define GDA_FORCE_DENY_WRITE 	    0x2000
#define GDA_SHARED_MULTIPLE 	    0x1000
#define GDA_SHARED_SINGLE 	    0x0800
#define GDA_UNTITLED 	    	    0x0400
#define GDA_DIRTY 	    	    0x0200
#define GDA_CLOSING 	    	    0x0100
#define GDA_ATTACH_TO_DIRTY_FILE     0x0080
#define GDA_SAVE_FAILED 	    	    0x0040
#define GDA_OPENING 	    	    0x0020
#define GDA_AUTO_SAVE_STOPPED 	    0x0010
#define GDA_MODEL 		    0x0008
#define GDA_ON_WRITABLE_MEDIA 	    0x0004
#define GDA_BACKUP_EXISTS 	    0x0002
#define GDA_PREVENT_AUTO_SAVE 	    0x0001

typedef enum {
    GDT_NORMAL    ,
    GDT_READ_ONLY    ,
    GDT_TEMPLATE    ,
    GDT_READ_ONLY_TEMPLATE    ,
    GDT_PUBLIC    ,
    GDT_MULTI_USER
} GenDocumentType} ;

typedef enum /* word */ {
    GDO_NORMAL    ,
    GDO_SAVE_AS    ,
    GDO_REVERT    ,
    GDO_REVERT_QUICK    ,
    GDO_ATTACH    ,
    GDO_DETACH    ,
    GDO_NEW    ,
    GDO_OPEN    ,
    GDO_SAVE    ,
    GDO_CLOSE    ,
    GDO_AUTO_SAVE    ,
    GDO_REVERT_TO_AUTO_SAVE    ,
} GenDocumentOperation} ;

typedef WordFlags DocumentOpenFlags ;
#define DOF_CREATE_FILE_IF_FILE_DOES_NOT_EXIST 	0x8000
#define DOF_FORCE_TEMPLATE_BEHAVIOR 	    	0x4000
#define DOF_SAVE_AS_OVERWRITE_EXISTING_FILE 	0x2000
#define DOF_REOPEN 				0x1000
#define DOF_RAISE_APP_AND_DOC 			0x0800
#define DOF_NAME_HOLDS_FILE_ID 			0x0400
#define DOF_FORCE_REAL_EMPTY_DOCUMENT 		0x0200
#define DOF_OPEN_FOR_IACP_ONLY 			0x0100

typedef struct {
    FileLongName	DCP_name;
    DiskHandle		DCP_diskHandle;
    PathName		DCP_path;
    GenDocumentAttrs   	DCP_docAttrs;
    DocumentOpenFlags	DCP_flags;
    IACPConnection	DCP_connection;
} DocumentCommonParams} ;

@message Boolean MSG_GEN_DOCUMENT_INITIALIZE_DOCUMENT_FILE () = carry;
@message Boolean MSG_GEN_DOCUMENT_IMPORT (
        ImpexTranslationParams *params = ss:bp) = carry;
@message void MSG_GEN_DOCUMENT_CREATE_UI_FOR_DOCUMENT ();
@message void MSG_GEN_DOCUMENT_DESTROY_UI_FOR_DOCUMENT ();
@message void MSG_GEN_DOCUMENT_ATTACH_UI_TO_DOCUMENT ();
@message void MSG_GEN_DOCUMENT_DETACH_UI_FROM_DOCUMENT ();
@message void MSG_GEN_DOCUMENT_EXPORT (ImpexTranslationParams *params = ss:bp);
@message void MSG_GEN_DOCUMENT_READ_CACHED_DATA_FROM_FILE ();
@message void MSG_GEN_DOCUMENT_WRITE_CACHED_DATA_TO_FILE (Boolean isSave);
@message void MSG_GEN_DOCUMENT_DOCUMENT_HAS_CHANGED ();

@message Boolean MSG_GEN_DOCUMENT_PHYSICAL_SAVE (
             word *error = multipleax) = carry;

@message Boolean MSG_GEN_DOCUMENT_PHYSICAL_UPDATE (
             word *error = multipleax) = carry;

     /* params below *must* be a local variable */
@message Boolean MSG_GEN_DOCUMENT_PHYSICAL_SAVE_AS (
             word *fileOrError = multipleax,
             DocumentCommonParams *params = ss:bp) = carry;

@message Boolean MSG_GEN_DOCUMENT_PHYSICAL_SAVE_AS_FILE_HANDLE (
             word *error = multipleax,
                 FileHandle file = cx) = carry;

@message Boolean MSG_GEN_DOCUMENT_PHYSICAL_REVERT (
             word *error = multipleax) = carry;

@message Boolean MSG_GEN_DOCUMENT_UPDATE_EARLIER_COMPATIBLE_DOCUMENT ()
            = carry;

@message Boolean MSG_GEN_DOCUMENT_UPDATE_EARLIER_INCOMPATIBLE_DOCUMENT  ()
            = carry;

     /* params below *must* be a local variable */
@message Boolean MSG_GEN_DOCUMENT_PHYSICAL_CREATE (
             word *fileOrError = multipleax,
                 DocumentCommonParams *params = ss:bp) = carry;

     /* params below *must* be a local variable */
@message Boolean MSG_GEN_DOCUMENT_PHYSICAL_OPEN (
             word *fileOrError = multipleax,
                 DocumentCommonParams *params = ss:bp) = carry;

@message void MSG_GEN_DOCUMENT_PHYSICAL_CLOSE ();

@message void MSG_GEN_DOCUMENT_PHYSICAL_DELETE ();

@message Boolean MSG_GEN_DOCUMENT_PHYSICAL_CHECK_FOR_MODIFICATIONS () = carry;

@message Boolean MSG_GEN_DOCUMENT_PHYSICAL_COPY_TEMPLATE (
             word *fileOrError = multipleax) = carry;

@message void MSG_GEN_DOCUMENT_SAVE_AS_COMPLETED ();
@message void MSG_GEN_DOCUMENT_ATTACH_FAILED ();

@message void MSG_GEN_DOCUMENT_MARK_DIRTY ();

@message word MSG_GEN_DOCUMENT_GENERATE_NAME_FOR_NEW (
                      char *buffer = dx:bp, word retryCount = cx) = cx;

#define GEN_DOCUMENT_GENERATE_NAME_ERROR 	0xffff
#define GEN_DOCUMENT_GENERATE_NAME_CANCEL 	0xfffe

@message void MSG_GEN_DOCUMENT_SAVE_AS_CANCELLED ();

     /* params below *must* be a local variable */
@message byte MSG_GEN_DOCUMENT_COMPUTE_ACCESS_FLAGS (
                      DocumentCommonParams *params = ss:bp) = al;

@message GenDocumentAttrs MSG_GEN_DOCUMENT_GET_ATTRS () = ax;

@message void MSG_GEN_DOCUMENT_ENABLE_AUTO_SAVE ();

@message void MSG_GEN_DOCUMENT_DISABLE_AUTO_SAVE ();

@message void MSG_GEN_DOCUMENT_GET_FILE_NAME (TCHAR *buffer = cx:dx);

@message FileHandle MSG_GEN_DOCUMENT_GET_FILE_HANDLE () = ax;

@message GenDocumentOperation MSG_GEN_DOCUMENT_GET_OPERATION () = ax;

@message optr MSG_GEN_DOCUMENT_GET_DISPLAY () = cx:dx;

     /* params below *must* be a local variable */
@message Boolean MSG_GEN_DOCUMENT_NEW (
             word *fileOrError = multipleax,
                 DocumentCommonParams *params = ss:bp) = carry;

     /* params below *must* be a local variable */
@message Boolean MSG_GEN_DOCUMENT_OPEN (
             word *fileOrError = multipleax,
                 DocumentCommonParams *params = ss:bp) = carry;

@message word MSG_GEN_DOCUMENT_CLOSE (IACPConnection connection = bp) = cx;

@message void MSG_GEN_DOCUMENT_QUICK_BACKUP ();

@message void MSG_GEN_DOCUMENT_RECOVER_QUICK_BACKUP ();

@message Boolean MSG_GEN_DOCUMENT_SAVE () = carry;

     /* params below *must* be a local variable */
@message Boolean MSG_GEN_DOCUMENT_SAVE_AS (
             word *fileOrError = multipleax,
                 DocumentCommonParams *params = ss:bp) = carry;

     /* params below *must* be a local variable */
@message Boolean MSG_GEN_DOCUMENT_SAVE_AS_TEMPLATE (
             word *fileOrError = multipleax,
                 DocumentCommonParams *params = ss:bp) = carry;

     /* params below *must* be a local variable */
@message Boolean MSG_GEN_DOCUMENT_COPY_TO (
             DocumentCommonParams *params = ss:bp) = carry;

@message Boolean MSG_GEN_DOCUMENT_REVERT () = carry;

@message void MSG_GEN_DOCUMENT_EDIT_USER_NOTES ();
@message void MSG_GEN_DOCUMENT_CHANGE_TYPE (GenDocumentType type = cx);

     /* params below *must* be a local variable */
@message void MSG_GEN_DOCUMENT_CHANGE_PASSWORD (TCHAR *password = ss:bp);

@message void MSG_GEN_DOCUMENT_RENAME ();

@message void MSG_GEN_DOCUMENT_SET_EMPTY ();

@message void MSG_GEN_DOCUMENT_CLEAR_EMPTY ();

@message void MSG_GEN_DOCUMENT_SET_DEFAULT ();

@message void MSG_GEN_DOCUMENT_CLEAR_DEFAULT ();

@message void MSG_GEN_DOCUMENT_CLOSE_IF_CLEAN_UNNAMED ();

     /* params below *must* be a local variable */
@message Boolean MSG_GEN_DOCUMENT_SEARCH_FOR_DOC (
             DocumentCommonParams *params = ss:bp) = carry;

@message Boolean MSG_GEN_DOCUMENT_TEST_FOR_FILE (FileHandle file = cx,
                                    optr *docFound = dx:bp) = carry;

@message void MSG_GEN_DOCUMENT_AUTO_SAVE ();

@message Boolean MSG_GEN_DOCUMENT_UPDATE (word *error = multipleax) = carry;

@message void MSG_GEN_DOCUMENT_CHECK_FOR_MODIFICATIONS ();

@message void MSG_GEN_DOCUMENT_CLOSE_FILE (IACPConnection connection = bp);

@message void MSG_GEN_DOCUMENT_REOPEN_FILE ();

#define GEN_DOCUMENT_GET_VARIABLE_BUFFER_SIZE  100
@message void MSG_GEN_DOCUMENT_GET_VARIABLE(@stack VisTextGraphic *graphic, char *buffer);

@message void MSG_GEN_DOCUMENT_REVERT_NO_PROMPT ();

@message void MSG_GEN_DOCUMENT_FILE_CHANGED_REINITIALIZE_CREATED_UI ();

@message void MSG_GEN_DOCUMENT_CLOSE_IF_OPEN_FOR_IACP_ONLY ();

@protominor UINewFor21

     /* params below *must* be a local variable */
@message Boolean MSG_GEN_DOCUMENT_MOVE_TO (
             DocumentCommonParams *params = ss:bp) = carry;

@message Boolean MSG_GEN_DOCUMENT_REVERT_TO_AUTO_SAVE () = carry;
@message Boolean MSG_GEN_DOCUMENT_PHYSICAL_REVERT_TO_AUTO_SAVE () = carry;

@protoreset

    @vardata void ATTR_GEN_DOCUMENT_OPEN_FOR_IACP_ONLY;

    @instance GenDocumentAttrs	GDI_attrs = 0;
    @instance GenDocumentType	GDI_type = 0;
    @instance word		GDI_operation = 0;
    @instance FileHandle	GDI_fileHandle = 0;
    @instance FileLongName	GDI_fileName = _TEXT("");
    @instance MemHandle		GDI_display = 0;

    @default GI_attrs = (@default | GA_KBD_SEARCH_PATH);

@endc

@endlib


Objects\gDocCtrl.goh

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gDocCtrl.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenDocumentControlClass
 *
 *	$Id: gDocCtrl.goh,v 1.16.4.1 96/04/28 08:31:35 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

#include  <file.h>
#include  <geode.h>
@include  <Objects/genC.goh>
@include  <Objects/gCtrlC.goh>

@class	GenDocumentControlClass, GenControlClass;

@message void MSG_GEN_DOCUMENT_CONTROL_DISPLAY_DIALOG ();
@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_NEW_DOC ();
@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_USE_TEMPLATE_DOC ();
@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_OPEN_DOC ();
@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_IMPORT_DOC ();
@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_SAVE_DOC ();
@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_SAVE_AS_DOC ();
@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_SAVE_AS_TEMPLATE_DOC ();
@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_COPY_TO_DOC ();
@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_EXPORT_DOC ();
@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_SET_TYPE_DOC ();
@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_SET_PASSWORD_DOC ();

@message GenDocumentControlAttrs MSG_GEN_DOCUMENT_CONTROL_GET_ATTRS () = ax;
@message GenDocumentControlFeatures MSG_GEN_DOCUMENT_CONTROL_GET_FEATURES () = ax;

@message void MSG_GEN_DOCUMENT_CONTROL_GET_TOKEN (
                    GeodeToken *token = cx:dx);

@message void MSG_GEN_DOCUMENT_CONTROL_GET_CREATOR (
                    GeodeToken *token = cx:dx);

@message void MSG_GEN_DOCUMENT_CONTROL_GET_TEMPLATE_DIR (
                    char *buffer = cx:dx);

@message void MSG_GEN_DOCUMENT_CONTROL_SAVE_AS_CANCELLED ();

typedef struct {
    FileLongName    DFCP_name;
    DiskHandle	    DFCP_diskHandle;
    PathName	    DFCP_path;
    optr	    DFCP_display;
    optr	    DFCP_document;
} DocumentFileChangedParams} ;

@message void MSG_GEN_DOCUMENT_CONTROL_FILE_CHANGED (
                                        DocumentFileChangedParams dup = ss:bp);

@message void MSG_GEN_DOCUMENT_CONTROL_CONFIGURE_FILE_SELECTOR (
                    optr fileSelector = cx:dx, word flags = bp);

@message void MSG_GEN_DOCUMENT_CONTROL_OPEN_IMPORT_SELECTED (
            ImpexTranslationParams *params = ss:bp);

@message void MSG_GEN_DOCUMENT_CONTROL_FILE_EXPORTED ();

@message void MSG_GEN_DOCUMENT_CONTROL_OPEN_DEFAULT_DOC ();

@message void MSG_GEN_DOCUMENT_CONTROL_IMPORT_CANCELLED ();

@protominor UINewFor21

@message void MSG_GEN_DOCUMENT_CONTROL_INITIATE_MOVE_TO_DOC ();

@protoreset

/*** End of messages **/

    @vardata UIInterfaceLevel
        ATTR_GEN_DOCUMENT_CONTROL_NO_EMPTY_DOC_IF_NOT_ABOVE;

    @vardata void HINT_GEN_DOCUMENT_CONTROL_NO_PROGRESS_DIALOG_ON_UPDATE_MAJOR;
    @vardata void HINT_GEN_DOCUMENT_CONTROL_PROGRESS_DIALOG_ON_UPDATE_MINOR;

    @vardata lptr ATTR_GEN_DOCUMENT_CONTROL_FILE_LIST_TITLE;

/*** End of vardata **/

typedef WordFlags GDCFeatures ;
#define GDCF_NEW 			0x4000
#define GDCF_OPEN_CLOSE 			0x2000
#define GDCF_QUICK_BACKUP 		0x1000
#define GDCF_SAVE 			0x0800
#define GDCF_SAVE_AS 			0x0400
#define GDCF_COPY 			0x0200
#define GDCF_EXPORT 			0x0100
#define GDCF_REVERT 			0x0080
#define GDCF_RENAME 			0x0040
#define GDCF_EDIT_USER_NOTES 		0x0020
#define GDCF_SET_TYPE 			0x0010
#define GDCF_SET_PASSWORD 		0x0008
#define GDCF_SAVE_AS_TEMPLATE 		0x0004
#define GDCF_SET_EMPTY_DOCUMENT 		0x0002
#define GDCF_SET_DEFAULT_DOCUMENT 	0x0001

typedef WordFlags GDCToolboxFeatures ;
#define GDCTF_NEW_EMPTY 		0x0020
#define GDCTF_USE_TEMPLATE 	0x0010
#define GDCTF_OPEN 		0x0008
#define GDCTF_CLOSE 		0x0004
#define GDCTF_SAVE 		0x0002
#define GDCTF_QUICK_BACKUP 	0x0001

#define GDC_SUGGESTED_INTRODUCTORY_FEATURES 	(0)

#define GDC_SUGGESTED_BEGINNING_FEATURES 	\
        (GDC_SUGGESTED_INTRODUCTORY_FEATURES | \
         GDCF_QUICK_BACKUP | \
         GDCF_COPY | \
         GDCF_RENAME | \
         GDCF_EXPORT | \
         GDCF_EDIT_USER_NOTES)

#define GDC_SUGGESTED_INTERMEDIATE_FEATURES 	\
        (GDC_SUGGESTED_BEGINNING_FEATURES | \
         GDCF_SAVE_AS | \
         GDCF_REVERT | \
         GDCF_SET_PASSWORD)

#define GDC_SUGGESTED_ADVANCED_FEATURES 	\
        (GDC_SUGGESTED_INTERMEDIATE_FEATURES | \
         GDCF_SET_TYPE | \
         GDCF_SAVE_AS_TEMPLATE | \
         GDCF_SET_EMPTY_DOCUMENT | \
         GDCF_SET_DEFAULT_DOCUMENT)

typedef struct {
    word	NDC_attrs;	/* GenDocumentAttrs */
    word	NDC_type;	/* GenDocumentType */
    FileHandle	NDC_fileHandle;
    byte	NDC_emptyExists;
    byte	NDC_defaultExists;
} NotifyDocumentChange} ;

typedef ByteEnum GDCTask ;
#define GDCT_NONE  0
#define GDCT_NEW  1
#define GDCT_OPEN  2
#define GDCT_USE_TEMPLATE  3
#define GDCT_SAVE_AS  4
#define GDCT_COPY_TO  5
#define GDCT_DIALOG  6
#define GDCT_TYPE  7
#define GDCT_PASSWORD  8
#define GDCT_MOVE_TO  9

typedef ByteEnum GenDocumentControlMode ;
#define GDCM_VIEWER  0
#define GDCM_SHARED_SINGLE  1
#define GDCM_SHARED_MULTIPLE  2

typedef WordFlags GenDocumentControlAttrs ;
#define GDCA_MULTIPLE_OPEN_FILES 	0x8000
#define GDCA_MODE   	    	    	0x6000
#define GDCA_DOS_FILE_DENY_WRITE 	0x1000
#define GDCA_VM_FILE 	    	    	0x0800
#define GDCA_NATIVE 			0x0400
#define GDCA_SUPPORTS_SAVE_AS_REVERT 	0x0200
#define GDCA_DOCUMENT_EXISTS 	    	0x0100
#define GDCA_CURRENT_TASK 	    	0x00f0
#define GDCA_DO_NOT_SAVE_FILES 	    	0x0008

#define GDCA_MODE_OFFSET    	    	13
#define GDCA_CURRENT_TASK_OFFSET    	4

typedef WordFlags GenDocumentControlFeatures ;
#define GDCF_READ_ONLY_SUPPORTS_SAVE_AS_REVERT 	    	0x8000
#define GDCF_SINGLE_FILE_CLEAN_CAN_NEW_OPEN 	    	0x4000
#define GDCF_SUPPORTS_TEMPLATES 	    	    	    	0x2000
#define GDCF_SUPPORTS_USER_SETTABLE_EMPTY_DOCUMENT 	0x1000
#define GDCF_SUPPORTS_USER_SETTABLE_DEFAULT_DOCUMENT 	0x0800
#define GDCF_SUPPORTS_USER_MAKING_SHARED_DOCUMENTS 	0x0400
#define GDCF_NAME_ON_PRIMARY 	    	    	    	0x0200

typedef ByteEnum GenFileSelectorType ;
#define GFST_DOCUMENTS  0
#define GFST_EXECUTABLES  1
#define GFST_NON_GEOS_FILES  2
#define GFST_ALL_FILES  3

    @instance GeodeToken    	GDCI_documentToken = {"",0};

    @instance GenFileSelectorType	GDCI_selectorType = GFST_DOCUMENTS;

    @instance GenDocumentControlAttrs	GDCI_attrs =
            ((GDCM_SHARED_SINGLE << GDCA_MODE_OFFSET) |
             GDCA_VM_FILE |
             GDCA_SUPPORTS_SAVE_AS_REVERT |
             (GDCT_NEW << GDCA_CURRENT_TASK_OFFSET));

    @instance GenDocumentControlFeatures GDCI_features =
            (GDCF_READ_ONLY_SUPPORTS_SAVE_AS_REVERT |
             GDCF_SINGLE_FILE_CLEAN_CAN_NEW_OPEN |
             GDCF_SUPPORTS_TEMPLATES |
             GDCF_SUPPORTS_USER_SETTABLE_EMPTY_DOCUMENT |
             GDCF_SUPPORTS_USER_MAKING_SHARED_DOCUMENTS |
             GDCF_NAME_ON_PRIMARY);

    @instance word /* GenDocumentAttrs */ GDCI_docAttrs = 0;
    @instance word /* GenDocumentType */ GDCI_docType = 0;
    @instance FileHandle		GDCI_docFileHandle = 0;
    @instance byte		    	GDCI_emptyExists = 0;
    @instance byte		    	GDCI_defaultExists = 0;

    @instance ChunkHandle    		GDCI_enableDisableList;
    @instance optr 	    		GDCI_openGroup;
    @instance optr 	    		GDCI_importGroup;
    @instance optr 	    		GDCI_useTemplateGroup;
    @instance optr 	    		GDCI_saveAsGroup;
    @instance optr 	    		GDCI_exportGroup;
    @instance optr 	    		GDCI_dialogGroup;
    @instance optr 	    		GDCI_userLevelGroup;

    @instance ChunkHandle     		GDCI_noNameText;
    @instance ChunkHandle     		GDCI_defaultFile;
    @instance ChunkHandle    		GDCI_templateDir;
    @instance optr 	    		GDCI_documentGroup;
    @instance FileLongName		GDCI_targetDocName = _TEXT("");

    @instance ChunkHandle    		GDCI_dialogNewText;
    @instance ChunkHandle    		GDCI_dialogTemplateText;
    @instance ChunkHandle    		GDCI_dialogOpenDefaultText;
    @instance ChunkHandle    		GDCI_dialogImportText;
    @instance ChunkHandle    		GDCI_dialogOpenText;
    @instance ChunkHandle    		GDCI_dialogUserLevelText;

    @instance @visMoniker    		GDCI_dialogNewMoniker;
    @instance @visMoniker    		GDCI_dialogTemplateMoniker;
    @instance @visMoniker    		GDCI_dialogOpenDefaultMoniker;
    @instance @visMoniker    		GDCI_dialogImportMoniker;
    @instance @visMoniker    		GDCI_dialogOpenMoniker;
    @instance @visMoniker    		GDCI_dialogUserLevelMoniker;

    @default GI_states = @default | GS_ENABLED;
    @default GI_attrs = @default | GA_KBD_SEARCH_PATH;

@endc

@endlib


Objects\gDocGrpC.goh

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gDocGrpC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenDocumentGroupClass
 *
 *	$Id: gDocGrpC.goh,v 1.8.4.1 96/04/28 08:31:41 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <Objects/gDocC.goh>

@class	GenDocumentGroupClass, GenClass ;

@message optr MSG_GEN_DOCUMENT_GROUP_NEW_DOC (
                  DocumentCommonParams *params = ss:bp) = cx:dx;

@message optr MSG_GEN_DOCUMENT_GROUP_IMPORT_NEW_DOC (
                  ImpexTranslationParams *params = ss:bp) = cx:dx;

@message optr MSG_GEN_DOCUMENT_GROUP_OPEN_DOC (
                  DocumentCommonParams *params = ss:bp) = cx:dx;

@message void MSG_GEN_DOCUMENT_GROUP_MARK_DIRTY (optr document = cx:dx);

@message void MSG_GEN_DOCUMENT_GROUP_MARK_DIRTY_BY_FILE (
                  FileHandle file = cx);

@message void MSG_GEN_DOCUMENT_GROUP_OPEN_DEFAULT_DOC (
                  DocumentCommonParams *params = ss:bp) = cx:dx;

@message GenDocumentGroupAttrs MSG_GEN_DOCUMENT_GROUP_GET_ATTRS () = ax;

@message GenDocumentControlAttrs MSG_GEN_DOCUMENT_GROUP_GET_UI_ATTRS () = ax;

@message void MSG_GEN_DOCUMENT_GROUP_GET_TEMPLATE_DIR (char *buffer = cx:dx);

@message GenDocumentControlFeatures MSG_GEN_DOCUMENT_GROUP_GET_UI_FEATURES () = ax;

@message word MSG_GEN_DOCUMENT_GROUP_GET_DEFAULT_NAME (
                  char *buffer = cx:dx);

@message optr MSG_GEN_DOCUMENT_GROUP_GET_OUTPUT ();

@message void MSG_GEN_DOCUMENT_GROUP_SET_OUTPUT (optr output = cx:dx);

@message void MSG_GEN_DOCUMENT_GROUP_GET_TOKEN (
                  GeodeToken *token = cx:dx);

@message void MSG_GEN_DOCUMENT_GROUP_GET_CREATOR (
                  GeodeToken *token = cx:dx);

@message dword MSG_GEN_DOCUMENT_GROUP_GET_PROTOCOL () = dx.cx;

@message optr MSG_GEN_DOCUMENT_GROUP_GET_VIEW () = cx:dx;

@message optr MSG_GEN_DOCUMENT_GROUP_GET_DISPLAY () = cx:dx;

@message optr MSG_GEN_DOCUMENT_GROUP_GET_DISPLAY_GROUP () = cx:dx;

@message optr MSG_GEN_DOCUMENT_GROUP_GET_DOC_BY_FILE (
                  FileHandle file = cx) = cx:dx;

@message void MSG_GEN_DOCUMENT_GROUP_SAVE_AS_CANCELLED ();

@message Boolean MSG_GEN_DOCUMENT_GROUP_SEARCH_FOR_DOC (
                  DocumentCommonParams *params = ss:bp) = carry;

@message void MSG_GEN_DOCUMENT_GROUP_AUTO_SAVE_BY_FILE (FileHandle fh = cx);

@message void MSG_GEN_DOCUMENT_GROUP_SET_DIRTY_LIMIT_BY_FILE (FileHandle fh = cx);

/*** End of messages **/

@protominor UINewForZoomer

     @vardata void ATTR_GEN_DOCUMENT_GROUP_ALLOW_MULTIPLE_WRITE_ACCESS;

@protoreset

/*** End of vardata **/

typedef WordFlags GenDocumentGroupAttrs ;
#define GDGA_VM_FILE 		    	    	0x8000
#define GDGA_NATIVE 		    	    	0x4000
#define GDGA_SUPPORTS_AUTO_SAVE     	    	0x2000
#define GDGA_AUTOMATIC_CHANGE_NOTIFICATION   	0x1000
#define GDGA_AUTOMATIC_DIRTY_NOTIFICATION    	0x0800
#define GDGA_APPLICATION_THREAD 	    	    	0x0400
#define GDGA_VM_FILE_CONTAINS_OBJECTS 	    	0x0200
#define GDGA_CONTENT_DOES_NOT_MANAGE_CHILDREN 	0x0100
#define GDGA_LARGE_CONTENT   	    	    	0x0080
#define GDGA_AUTOMATIC_UNDO_INTERACTION 	    	0x0040

typedef enum /* word */ {
    DQS_OK    ,
    DQS_CANCEL    ,
    DQS_DELAYED    ,
    DQS_SAVE_ERROR
} DocQuitStatus} ;

    @instance GenDocumentGroupAttrs GDGI_attrs =
                (GDGA_VM_FILE |
                 GDGA_SUPPORTS_AUTO_SAVE |
                 GDGA_AUTOMATIC_CHANGE_NOTIFICATION |
                 GDGA_AUTOMATIC_DIRTY_NOTIFICATION |
                 GDGA_APPLICATION_THREAD |
                 GDGA_AUTOMATIC_UNDO_INTERACTION |
                 GDGA_CONTENT_DOES_NOT_MANAGE_CHILDREN);
    @instance ChunkHandle    	GDGI_untitledName;
    @instance ClassStruct *	GDGI_documentClass = (ClassStruct *)&GenDocumentClass;
    @instance optr		GDGI_genDocument;
    @instance optr 	    	GDGI_output;
    @instance optr  	    	GDGI_documentControl;
    @instance optr  	    	GDGI_genView;
    @instance optr  	    	GDGI_genDisplay;
    @instance optr  	    	GDGI_genDisplayGroup;
    @instance word  	    	GDGI_protocolMajor = 1;
    @instance word  	    	GDGI_protocolMinor = 0;

@endc

@endlib


Objects\gEditCC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	Text/tCtrlC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI / Text library
 *
 * DESCRIPTION:
 *	This file defines VisTextClass
 *
 *	$Id: gEditCC.goh,v 1.15.20.1 96/04/28 08:31:23 chris Exp $
 *
 ***********************************************************************/
@optimize

@deflib ui

@class GenEditControlClass, GenControlClass;

    @vardata NotifyUndoStateChange TEMP_UNDO_DESCRIPTION;
    @vardata word TEMP_CLIPBOARD_NOTIFICATION_LIST_COUNT;

typedef WordFlags GECFeatures ;
#define GECF_UNDO 	0x0020
#define GECF_CUT 	0x0010
#define GECF_COPY 	0x0008
#define GECF_PASTE 	0x0004
#define GECF_SELECT_ALL 	0x0002
#define GECF_DELETE 	0x0001

typedef WordFlags GECToolboxFeatures ;
#define GECTF_UNDO 		0x0020
#define GECTF_CUT 		0x0010
#define GECTF_COPY 		0x0008
#define GECTF_PASTE 		0x0004
#define GECTF_SELECT_ALL 	0x0002
#define GECTF_DELETE 		0x0001

#define GEC_DEFAULT_FEATURES  	(GECF_UNDO | GECF_CUT \
                | GECF_COPY | GECF_PASTE \
                | GECF_SELECT_ALL | GECF_DELETE)

#define GEC_DEFAULT_TOOLBOX_FEATURES  	(GECTF_UNDO | GECTF_CUT \
                | GECTF_COPY | GECTF_PASTE \
                | GECTF_SELECT_ALL | GECTF_DELETE)
typedef enum {
    SDT_TEXT    ,
    SDT_GRAPHICS    ,
    SDT_SPREADHSEET    ,
    SDT_INK    ,
    SDT_OTHER
} SelectionDataType} ;

typedef struct {
    SelectionDataType  	    	NSSC_selectionType;
    byte			NSSC_clipboardableSelection;
    byte			NSSC_selectAllAvailable;
    byte			NSSC_deleteableSelection;
    byte			NSSC_pasteable;
} NotifySelectStateChange} ;

typedef ByteEnum UndoDescription ;
#define	UD_UNDO		    	0
#define	UD_REDO		    	1
#define	UD_NOT_UNDOABLE		2

typedef struct {
    optr			NUSC_undoTitle;
    UndoDescription		NUSC_undoType;
} NotifyUndoStateChange} ;

    @default GCI_output = (TO_APP_TARGET);
    @default GI_states = (@default | GS_ENABLED);
    @default GI_attrs = (@default | GA_KBD_SEARCH_PATH);

@endc

@endlib


Objects\genC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	genC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenClass
 *
 *	$Id: genC.goh,v 1.141.1.5 98/02/25 19:05:33 kho Exp $
 *
 ***********************************************************************/

@optimize

#include     <file.h> 	/* XXX: until vardata can be exported */
#include     <disk.h> 	/* XXX: until vardata can be exported */
#include     <object.h>   /* for MessageFlags */

@deflib ui

@include  <Objects/visC.goh>

@class	GenClass, VisClass, master, variant;

/*
 *	Methods
 */

@define genParent @parent word_offsetof (GenBase, Gen_offset), word_offsetof), (GenInstance, GI_link)

@define genChildren @children word_offsetof(GenBase, Gen_offset), word_offsetof(GenInstance, GI_comp), word_offsetof(GenInstance, GI_link)

#define ObjDerefGen (obj) ObjDeref2(obj)

@exportMessages	GenSpecMessages, @DEFAULT_EXPORTED_MESSAGES_3;
@exportMessages	GenAppMessages,  @DEFAULT_EXPORTED_MESSAGES_5;

/*** State query and setting ***/

@message void MSG_GEN_SET_ENABLED(VisUpdateMode updateMode = dl);
@message void MSG_GEN_SET_NOT_ENABLED (VisUpdateMode updateMode = dl);
@message Boolean MSG_GEN_GET_ENABLED () = carry;
@message void MSG_GEN_SET_USABLE (VisUpdateMode updateMode = dl);
@message void MSG_GEN_SET_NOT_USABLE (VisUpdateMode updateMode = dl);
@message Boolean MSG_GEN_GET_USABLE () = carry;
@message Boolean MSG_GEN_CHECK_IF_FULLY_ENABLED () = carry;	/* XXX */
@message Boolean MSG_GEN_CHECK_IF_FULLY_USABLE () = carry;	/* XXX */

/*** Generic Attributes ***/

@message void MSG_GEN_SET_ATTRS (GenAttrs attrsToSet = cl,
                GenAttrs attrsToClear = ch); /* XXX */
@message GenAttrs MSG_GEN_GET_ATTRIBUTES () = cl;	/* XXX */

/*** Visual monikers ***/

@message ChunkHandle MSG_GEN_GET_VIS_MONIKER () = ax;
@message void MSG_GEN_USE_VIS_MONIKER (ChunkHandle moniker = cx,
                VisUpdateMode updateMode = dl);

@message ChunkHandle MSG_GEN_REPLACE_VIS_MONIKER(@stack
                VisUpdateMode updateMode,
                word height, word width, word length,
                VisMonikerDataType dataType,
                VisMonikerSourceType sourceType,
                dword source) = ax;

@message ChunkHandle MSG_GEN_REPLACE_VIS_MONIKER_OPTR (optr source = cx:dx,
                VisUpdateMode updateMode = bp) = ax;
@message ChunkHandle MSG_GEN_REPLACE_VIS_MONIKER_TEXT (
                const char *source = cx:dx,
                VisUpdateMode updateMode = bp) = ax;

@message ChunkHandle MSG_GEN_CREATE_VIS_MONIKER(@stack
                CreateVisMonikerFlags flags,
                word height, word width, word length,
                VisMonikerDataType dataType,
                VisMonikerSourceType sourceType,
                dword source) = ax;

@message void MSG_GEN_DRAW_MONIKER(@stack DrawMonikerFlags monikerFlags,
            word textHeight, GStateHandle gState, word yMaximum,
            word xMaximum, word yInset, word xInset); /* XXX */

/* Use DWORD_X and DWORD_Y to get x, y position */
@message XYValueAsDWord MSG_GEN_GET_MONIKER_POS(
                        @stack DrawMonikerFlags monikerFlags,
            word textHeight, GStateHandle gState, word yMaximum,
            word xMaximum, word yInset, word xInset) = bp.ax;
            /* XXX */

/* Use DWORD_WIDTH and DWORD_HEIGHT to get width, height */
@message SizeAsDWord MSG_GEN_GET_MONIKER_SIZE (word textHeight = dx,
            GStateHandle gState = bp) = dx.cx; /* XXX */

@message optr MSG_GEN_FIND_MONIKER (Boolean useAppMonikerList = dx,
                    VisMonikerSearchFlags searchFlags = bp,
                    MemHandle destBlock = cx) = cx:dx; /* XXX */
@message void MSG_GEN_RELOC_MONIKER_LIST (optr monikerList = dx:cx,
                    Boolean relocFlag = bp);    /* XXX */

/*** Keyboard accelerators ***/

@message void MSG_GEN_SET_KBD_ACCELERATOR (KeyboardShortcut accelerator = cx,
                VisUpdateMode updateMode = dl);	/* XXX */
@message KeyboardShortcut MSG_GEN_GET_KBD_ACCELERATOR () = cx;	/* XXX */
@message void MSG_GEN_CHANGE_ACCELERATOR (KeyboardShortcut bitsToClear = cx,
                     KeyboardShortcut bitsToSet = dx);	/* XXX */

/*** Help ***/

@message void MSG_GEN_GET_HELP ();	/* NEEDS PROTOTYPE */
@message void MSG_GEN_SET_HELP ();	/* NEEDS PROTOTYPE */

/*** Hints ***/

/*** Generic Composite Operations ***/

@message void MSG_GEN_ADD_CHILD (optr child = cx:dx,
                CompChildFlags flags = bp);
@message void MSG_GEN_REMOVE_CHILD (optr child = cx:dx,
                CompChildFlags flags = bp);	/* XXX */
@message void MSG_GEN_ADD_CHILD_UPWARD_LINK_ONLY (optr child = cx:dx); /* XXX */
@message void MSG_GEN_MOVE_CHILD (optr child = cx:dx,
                CompChildFlags flags = bp);	/* XXX */
@message word MSG_GEN_FIND_CHILD (optr child = cx:dx) = bp; /* XXX */
@message optr MSG_GEN_FIND_CHILD_AT_POSITION (word position = cx) = cx:dx;
@message optr MSG_GEN_FIND_PARENT () = cx:dx;	/* XXX */
@message word MSG_GEN_COUNT_CHILDREN () = dx;

/*** Generic Composite Communication ***/

@message void MSG_GEN_CALL_PARENT (EventHandle event = cx); /* XXX */
@message void MSG_GEN_SEND_TO_PARENT (EventHandle event = cx); /* XXX */
@message void MSG_GEN_SEND_TO_CHILDREN (EventHandle event = cx); /* XXX */

typedef enum /* word */ {
    TO_GEN_PARENT    =_FIRST_GenClass,
    TO_FOCUS    ,
    TO_TARGET    ,
    TO_MODEL    ,
    TO_APP_FOCUS    ,
    TO_APP_TARGET    ,
    TO_APP_MODEL    ,
    TO_SYS_FOCUS    ,
    TO_SYS_TARGET    ,
    TO_SYS_MODEL
} GenTravelOption} ;

@message void MSG_GEN_GUP_CALL_OBJECT_OF_CLASS (EventHandle event = cx); /* XXX */
@message void MSG_GEN_GUP_SEND_TO_OBJECT_OF_CLASS (EventHandle event = cx); /* XXX */
@message Boolean MSG_GEN_GUP_TEST_FOR_OBJECT_OF_CLASS (
                ClassStruct *class = cx:dx) = carry; /* XXX */
@message optr MSG_GEN_GUP_FIND_OBJECT_OF_CLASS (
                ClassStruct *class = cx:dx) = cx:dx; /* XXX */
@message void MSG_GEN_CALL_APPLICATION (EventHandle event = cx); /* XXX */
@message void MSG_GEN_SEND_TO_PROCESS (EventHandle event = cx); /* XXX */
@message void MSG_GEN_CALL_SYSTEM (EventHandle event = cx); /* XXX */
@message void MSG_GEN_OUTPUT_ACTION (EventHandle event = bp,
                        optr dest = cx:dx); /* XXX */

/*** Generic Branch Construction/Destruction ***/

@message optr MSG_GEN_COPY_TREE (MemHandle destBlock = cx,
                ChunkHandle parentChunk = dx,
                CompChildFlags flags = bp) = cx:dx;
@message void MSG_GEN_DESTROY (VisUpdateMode updateMode = dl,
                                CompChildFlags flags = bp); /* XXX */

typedef enum /* word */ {
    BRPT_OUTPUT_OPTR
} BranchReplaceParamType} ;

@message void MSG_GEN_BRANCH_REPLACE_PARAMS(@stack BranchReplaceParamType type,
            dword replaceParam, dword searchParam); /* XXX */
#define BRP_DUMMY_OPTR_START 	1
@message void MSG_GEN_BRANCH_REPLACE_OUTPUT_OPTR_CONSTANT (
                    optr replacementOptr = cx:dx,
                    word searchConstant = bp); /* XXX */

/*** Display/Interaction Control Methods ***/

@message void MSG_GEN_BRING_TO_TOP ();
@message void MSG_GEN_LOWER_TO_BOTTOM ();

/*** Other Focus/Target methods ***/

/* MSG_META_GET_TARGET_AT_TARGET_LEVEL defined in Objectgs/metaC.goh */

@message optr MSG_GEN_START_BROADCAST_FOR_DEFAULT_FOCUS () = cx:dx; /*INTERNAL*/
                                                                     /* XXX */

/*** Window Size and Position Methods ***/

#define GET_MM_AND_TYPE (M,T) 	((M) | (((word) (T)) << 8))
@message void MSG_GEN_SET_WIN_POSITION (WinPositionType modeAndType = dx,
                    SpecWinSizeSpec xPosSpec = cx,
                    SpecWinSizeSpec yPosSpec = bp);	/* XXX */
@message void MSG_GEN_SET_WIN_SIZE (WinPositionType modeAndType = dx,
                    SpecWinSizeSpec xSizeSpec = cx,
                    SpecWinSizeSpec ySizeSpec = bp);	/* XXX */
@message void MSG_GEN_RESET_TO_INITIAL_SIZE (VisUpdateMode updateMode = dl); /* XXX */
@message void MSG_GEN_SET_WIN_CONSTRAIN (VisUpdateMode updateMode = dl,
                    WinConstrainType constrainType = dh); /* XXX */

/*** Geometry Methods ***/

typedef struct {
    word		SSA_width;
    word		SSA_height;
    word		SSA_count;
    VisUpdateMode	SSA_updateMode;
} SetSizeArgs} ;

typedef struct {
    word	GSA_width;
    word	GSA_height;
    word	GSA_unused;
    word	GSA_count;
} GetSizeArgs} ;

@message void MSG_GEN_SET_INITIAL_SIZE(@stack VisUpdateMode updateMode,
            word count, SpecHeight height, SpecWidth width);	/* XXX */
@message void MSG_GEN_SET_MINIMUM_SIZE(@stack VisUpdateMode updateMode,
            word count, SpecHeight height, SpecWidth width);	/* XXX */
@message void MSG_GEN_SET_MAXIMUM_SIZE(@stack byte updateMode,
            word count, word height, word width);	/* XXX */
@message void MSG_GEN_SET_FIXED_SIZE(@stack byte updateMode,
            word count, word height, word width);	/* XXX */
@message void MSG_GEN_GET_INITIAL_SIZE (GetSizeArgs *initSize = cxdxbpax);	/* XXX */
@message void MSG_GEN_GET_MINIMUM_SIZE (GetSizeArgs *minSize = cxdxbpax);	/* XXX */
@message void MSG_GEN_GET_MAXIMUM_SIZE (GetSizeArgs *maxSize = cxdxbpax);	/* XXX */
@message void MSG_GEN_GET_FIXED_SIZE (GetSizeArgs *fixedSize = cxdxbpax);	/* XXX */

/*** Generic Visual Update Method ***/

@message void MSG_GEN_UPDATE_VISUAL (VisUpdateMode updateMode = dl); /* XXX */

/*** Gagdet Apply/Reset/Activation Methods ***/

@message void MSG_GEN_APPLY ();	/* XXX */
@message void MSG_GEN_RESET ();	/* XXX */
@message Boolean MSG_GEN_PRE_APPLY () = carry;
@message void MSG_GEN_POST_APPLY ();
@message void MSG_GEN_MAKE_APPLYABLE ();
@message void MSG_GEN_MAKE_NOT_APPLYABLE ();
@message void MSG_GEN_ACTIVATE ();	/* XXX */
@message Boolean MSG_GEN_ACTIVATE_INTERACTION_DEFAULT () = carry; /* XXX */

/*** Navigation Methods ***/

@message void MSG_GEN_NAVIGATE_TO_NEXT_FIELD ();	/* XXX */
@message void MSG_GEN_NAVIGATE_TO_PREVIOUS_FIELD ();	/* XXX */
@message Boolean MSG_GEN_NAVIGATION_QUERY (
        NavigationQueryParams *retValue = bpaxdxcx,
        optr queryOrigin = cx:dx,
        NavigationFlags navFlags = bp) = carry; /* XXX */

typedef struct {
    word	GRP_ax;
    word	GRP_bp;
    word	GRP_cx;
    word	GRP_dx;
} GenReturnParams} ;

/*** Generic Upward Queries ***/

typedef enum {
    GUQT_UI_FOR_APPLICATION    ,
    GUQT_UI_FOR_SCREEN    ,
    GUQT_UI_FOR_FIELD    ,
    GUQT_UI_FOR_MISC    ,
    GUQT_FIELD    ,
    GUQT_SCREEN    ,
    GUQT_DELAYED_OPERATION
} GenUpwardQueryType} ;

@message Boolean MSG_GEN_GUP_QUERY (
            GenReturnParams *retValue = axbpcxdx,
            GenUpwardQueryType queryType = cx) = carry; /* XXX */

typedef struct {
    optr	GGFI_optr;
    MemHandle	GGFI_window;
    word	GGFI_unused;
} GenGupFieldInfo} ;
@alias (MSG_GEN_GUP_QUERY) Boolean MSG_GEN_GUP_QUERY_FOR_FIELD(
                GenGupFieldInfo *retValue = cxdxbpax,
                GenUpwardQueryType queryType = cx) = carry;
typedef struct {
    optr	GGSI_optr;
    MemHandle	GGSI_window;
    word	GGSI_unused;
} GenGupScreenInfo} ;
@alias (MSG_GEN_GUP_QUERY) Boolean MSG_GEN_GUP_QUERY_FOR_SCREEN(
                GenGupScreenInfo *retValue = cxdxbpax,
                GenUpwardQueryType queryType = cx) = carry;

@message Boolean MSG_GEN_GUP_INTERACTION_COMMAND(InteractionCommand command = cx); /* XXX */

/*** Keyboard shortcut search methods (Internal) ***/

#define GET_CHAR_AND_SHIFT (C,S) 	((C) | (((word) (S)) << 8))
@message Boolean MSG_GEN_FIND_KBD_ACCELERATOR (word charValue = cx,
            word charFlagsAndShiftState = dx,
            word toggleStateAndScanCode = bp) = carry; /* XXX */
@message void MSG_GEN_SET_KBD_MKR_PATH ();	/* XXX */

/*** Enable notify methods (Internal) ***/

typedef ByteFlags NotifyEnabledFlags ;
#define NEF_STATE_CHANGING 	0x80

@message Boolean MSG_GEN_NOTIFY_ENABLED (VisUpdateMode updateMode = dl,
                byte flags = dh) = carry;	/* XXX */
@message Boolean MSG_GEN_NOTIFY_NOT_ENABLED (VisUpdateMode updateMode = dl,
                byte flags = dh) = carry;	/* XXX */

/*** GenView Utility Methods (Internal) ***/

typedef ByteEnum RequestedViewArea ;
#define RVA_NO_AREA_CHOICE  0
#define RVA_X_SCROLLER_AREA  1
#define RVA_Y_SCROLLER_AREA  2
#define RVA_LEFT_AREA  3
#define RVA_TOP_AREA  4
#define RVA_RIGHT_AREA  5
#define RVA_BOTTOM_AREA  6

typedef struct {
    byte	GFVRP_hViewArea;
    byte	GFVRP_vViewArea;
    ChunkHandle	GFVRP_hRange;
    ChunkHandle	GFVRP_vRange;
    word    	GFVRP_unused;
} GenFindViewRangesParams} ;

#define GET_VIEW_AREAS (H,V) 	((H) | (((word) (V)) << 8))
@message void MSG_GEN_FIND_VIEW_RANGES (
            GenFindViewRangesParams *retValue = cxdxbpax,
            word viewAreas = cx,
            ChunkHandle hRange = dx,
            ChunkHandle vRange = bp); /* XXX */
@message RequestedViewArea MSG_GEN_QUERY_VIEW_AREA (
            RequestedViewArea viewArea = cl) = cl;	/* XXX */

@message Boolean MSG_GEN_QUERY_NEED_TO_BE_ON_ACTIVE_LIST () = carry;

typedef struct {
    char    GOP_category[INI_CATEGORY_BUFFER_SIZE];
    char    GOP_key[INI_CATEGORY_BUFFER_SIZE];
} GenOptionsParams} ;

@message void MSG_GEN_LOAD_OPTIONS (GenOptionsParams *params = ss:bp);

@message void MSG_GEN_SAVE_OPTIONS (GenOptionsParams *params = ss:bp);

@message void MSG_GEN_ADD_GEOMETRY_HINT (word hint = cx, word hintArgument = bp,
                    VisUpdateMode updateMode = dl);

@message void MSG_GEN_REMOVE_GEOMETRY_HINT (word hint = cx,
                       VisUpdateMode updateMode = dl);

/*
 * Generic Directory Path Support
 */
typedef struct {
    DiskHandle	GFP_disk;   	/* Handle of disk on which the path resides;
                 * may be initialized to a StandardPath
                 * constant */
    PathName	GFP_path;   	/* Absolute path (relative if GFP_disk is
                 * a StandardPath constant) to the directory */
} GenFilePath} ;

    @vardata GenFilePath	ATTR_GEN_PATH_DATA;
    @vardata void		TEMP_GEN_PATH_SAVED_DISK_HANDLE;

@message Boolean MSG_GEN_PATH_SET (char *path = cx:dx, DiskHandle disk = bp) = carry;
@message Boolean MSG_GEN_PATH_GET (char *buffer = dx:bp, word bufSize = cx) = carry;
    /* Pass buffer as NULL; returned handle of 0 => error */
@alias (MSG_GEN_PATH_GET) MemHandle MSG_GEN_PATH_GET_BLOCK(char *buffer = dx:bp, word bufSize = cx) = dx;

@message DiskHandle MSG_GEN_PATH_GET_DISK_HANDLE() = cx;

@message optr MSG_GEN_FIND_OBJECT_WITH_TEXT_MONIKER (char *text = cx:dx,
                        GenFindObjectWithMonikerFlags flags = bp) = cx:dx;  /*XXX*/

typedef WordFlags GenFindObjectWithMonikerFlags ;
#define	GFTMF_EXACT_MATCH		0x8000
#define GFTMF_SKIP_THIS_NODE 	0x4000

@message void MSG_GEN_GROW_PARENTS ();	    	    /* INTERNAL */

@message void MSG_GEN_GUP_ENSURE_UPDATE_WINDOW (	    /* INTERNAL */
                    UpdateWindowFlags updateFlags = cx,
                    VisUpdateMode updateMode = dl);
@message void MSG_GEN_GUP_FINISH_QUIT (Boolean abortFlag = cx,
                    Boolean notifyParent = dx);

@message void MSG_GEN_REMOVE (VisUpdateMode updateMode = dl,
                             CompChildFlags flags = bp);

@message Boolean MSG_GEN_DESTROY_AND_FREE_BLOCK () = carry;

typedef enum {
        KO_NO_KEYBOARD    	,
    KO_KEYBOARD_REQUIRED	,
    KO_KEYBOARD_EMBEDDED
} KeyboardOverride} ;

@message void MSG_GEN_SET_KBD_OVERRIDE (KeyboardOverride override = cx);
@message void MSG_GEN_SET_KBD_POSITION (sword xCoord = cx, sword yCoord = dx);

@protominor NewForJediAndBeyond

@message optr MSG_GEN_FIND_OBJECT_WITH_TEXT_MONIKER_C (char *text = cx:dx,
                        GenFindObjectWithMonikerFlags flags = bp) = cx:dx;

@protoreset

@protominor NewForOmniGo200

@message void MSG_GEN_ROTATE_DISPLAY ();   /* Sent to primaries when screen
                         rotates. */

@protoreset

/** End of Messages **/

/*
 *	Hints
 */

typedef struct {
    ClassStruct *DCA_class;
} DestinationClassArgs} ;

    @vardata void HINT_DUMMY;
    @vardata void HINT_FREQUENTLY_USED;
    @vardata void HINT_INFREQUENTLY_USED;
    @vardata void HINT_AN_ADVANCED_FEATURE;
    @vardata void HINT_DEFAULT_DEFAULT_ACTION;
    @vardata void HINT_ENSURE_TEMPORARY_DEFAULT;
    @vardata void HINT_SAME_CATEGORY_AS_PARENT;
    @vardata void HINT_SYS_MENU;
    @vardata void HINT_USE_TEXT_MONIKER;
    @vardata void HINT_USE_ICONIC_MONIKER;
    @vardata void HINT_DEFAULT_FOCUS;
    @vardata void HINT_DEFAULT_TARGET;
    @vardata void HINT_DEFAULT_MODEL;
    @vardata void HINT_PREVENT_DEFAULT_OVERRIDES;
    @vardata void HINT_PRESERVE_FOCUS;
    @vardata void HINT_DO_NOT_PRESERVE_FOCUS;
    @vardata void HINT_GENERAL_CONSUMER_MODE;
    @vardata void HINT_NEVER_ADOPT_MENUS;
    @vardata void HINT_ALWAYS_ADOPT_MENUS;
    @vardata void HINT_ALLOW_CHILDREN_TO_WRAP;
    @vardata void HINT_BOTTOM_JUSTIFY_CHILDREN;
    @vardata void HINT_CENTER_CHILDREN_HORIZONTALLY;
    @vardata void HINT_CENTER_CHILDREN_ON_MONIKERS;
    @vardata void HINT_CENTER_CHILDREN_VERTICALLY;
    @vardata void HINT_CENTER_MONIKER;
    @vardata SpecSizeSpec HINT_CUSTOM_CHILD_SPACING;
    @vardata void HINT_DONT_ALLOW_CHILDREN_TO_WRAP;
    @vardata void HINT_DONT_FULL_JUSTIFY_CHILDREN;
    @vardata void HINT_DONT_INCLUDE_ENDS_IN_CHILD_SPACING;
    @vardata void HINT_DO_NOT_USE_MONIKER;
    @vardata void HINT_DRAW_IN_BOX;
    @vardata void HINT_EXPAND_HEIGHT_TO_FIT_PARENT;
    @vardata void HINT_EXPAND_WIDTH_TO_FIT_PARENT;
    @vardata CompSizeHintArgs HINT_FIXED_SIZE;
    @vardata void HINT_FULL_JUSTIFY_CHILDREN_HORIZONTALLY;
    @vardata void HINT_FULL_JUSTIFY_CHILDREN_VERTICALLY;
    @vardata void HINT_INCLUDE_ENDS_IN_CHILD_SPACING;
    @vardata CompSizeHintArgs HINT_INITIAL_SIZE;
    @vardata void HINT_LEFT_JUSTIFY_CHILDREN;
    @vardata void HINT_LEFT_JUSTIFY_MONIKERS;
    @vardata void HINT_MAKE_REPLY_BAR;
    @vardata CompSizeHintArgs HINT_MAXIMUM_SIZE;
    @vardata CompSizeHintArgs HINT_MINIMUM_SIZE;
    @vardata void HINT_NO_TALLER_THAN_CHILDREN_REQUIRE;
    @vardata void HINT_NO_WIDER_THAN_CHILDREN_REQUIRE;
    @vardata void HINT_ORIENT_CHILDREN_HORIZONTALLY;
    @vardata void HINT_ORIENT_CHILDREN_VERTICALLY;
    @vardata void HINT_PLACE_MONIKER_ABOVE;
    @vardata void HINT_ALIGN_LEFT_MONIKER_EDGE_WITH_CHILD;
    @vardata void HINT_PLACE_MONIKER_TO_LEFT;
    @vardata void HINT_PLACE_MONIKER_TO_RIGHT;
    @vardata void HINT_RIGHT_JUSTIFY_CHILDREN;
    @vardata void HINT_TOP_JUSTIFY_CHILDREN;
    @vardata word HINT_WRAP_AFTER_CHILD_COUNT;
    @vardata void HINT_DIVIDE_WIDTH_EQUALLY;
    @vardata void HINT_DIVIDE_HEIGHT_EQUALLY;
    @vardata void HINT_NO_BORDERS_ON_MONIKERS;
    @vardata word HINT_GADGET_TEXT_COLOR;
    @vardata void HINT_POPS_UP_TO_RIGHT;
    @vardata void HINT_POPS_UP_BELOW;
    @vardata void ATTR_GEN_PROPERTY;
    @vardata void ATTR_GEN_NOT_PROPERTY;
    @vardata void HINT_SEEK_MENU_BAR;
    @vardata void HINT_AVOID_MENU_BAR;
    @vardata void HINT_NAVIGATION_ID;
    @vardata void HINT_NAVIGATION_NEXT_ID;
    @vardata void HINT_DISMISS_WHEN_DISABLED;
    @vardata void HINT_SEEK_X_SCROLLER_AREA;
    @vardata void HINT_SEEK_Y_SCROLLER_AREA;
    @vardata void HINT_SEEK_LEFT_OF_VIEW;
    @vardata void HINT_SEEK_TOP_OF_VIEW;
    @vardata void HINT_SEEK_RIGHT_OF_VIEW;
    @vardata void HINT_SEEK_BOTTOM_OF_VIEW;
    @vardata void HINT_GEN_UNUSED;      /* INTERNAL */
    @vardata void HINT_USE_INITIAL_BOUNDS_WHEN_RESTORED;
    @vardata void HINT_KEEP_INITIALLY_ONSCREEN;
    @vardata void HINT_DONT_KEEP_INITIALLY_ONSCREEN;
    @vardata void HINT_KEEP_PARTIALLY_ONSCREEN;
    @vardata void HINT_KEEP_ENTIRELY_ONSCREEN;
    @vardata void HINT_KEEP_ENTIRELY_ONSCREEN_WITH_MARGIN;
    @vardata void HINT_DONT_KEEP_PARTIALLY_ONSCREEN;
    @vardata SpecWinSizePair HINT_POSITION_WINDOW_AT_RATIO_OF_PARENT;
    @vardata void HINT_STAGGER_WINDOW;
    @vardata void HINT_CENTER_WINDOW;
    @vardata void HINT_TILE_WINDOW;
    @vardata void HINT_POSITION_WINDOW_AT_MOUSE;
    @vardata void HINT_EXTEND_WINDOW_TO_BOTTOM_RIGHT;
    @vardata void HINT_EXTEND_WINDOW_NEAR_BOTTOM_RIGHT;
    @vardata void HINT_SIZE_WINDOW_AS_DESIRED;
    @vardata SpecWinSizePair HINT_SIZE_WINDOW_AS_RATIO_OF_PARENT;
    @vardata SpecWinSizePair HINT_SIZE_WINDOW_AS_RATIO_OF_FIELD;
    @vardata SpecWinSizePair HINT_POSITION_ICON_AS_RATIO_OF_FIELD;
    @vardata DestinationClassArgs ATTR_GEN_DESTINATION_CLASS;
    @reloc ATTR_GEN_DESTINATION_CLASS, 0, optr;
    @vardata void HINT_INITIATED;   	/* INTERNAL */
    @vardata char[] ATTR_GEN_INIT_FILE_KEY;
    @vardata char[] ATTR_GEN_INIT_FILE_CATEGORY;
    @vardata void ATTR_GEN_INIT_FILE_PROPAGATE_TO_CHILDREN;
    @vardata ChunkHandle ATTR_GEN_FEATURE_LINK;
    @vardata void HINT_TOOLBOX;
    @vardata void HINT_SAME_ORIENTATION_AS_PARENT;
    @vardata void HINT_SEEK_REPLY_BAR;
    @vardata MemHandle ATTR_GEN_WINDOW_CUSTOM_LAYER_ID;
    @reloc ATTR_GEN_WINDOW_CUSTOM_LAYER_ID, 0, handle;
    @vardata void HINT_SHOW_SHORTCUT;
    @vardata void HINT_DRAW_SHORTCUT_BELOW;
    @vardata void HINT_CAN_CLIP_MONIKER_WIDTH;
    @vardata void HINT_CAN_CLIP_MONIKER_HEIGHT;
    @vardata void HINT_SHOW_ENTIRE_MONIKER;
    @vardata Point ATTR_GEN_POSITION;
    @vardata sword ATTR_GEN_POSITION_X;
    @vardata sword ATTR_GEN_POSITION_Y;
    @vardata optr HINT_ALIGN_LEFT_EDGE_WITH_OBJECT;
    @reloc HINT_ALIGN_LEFT_EDGE_WITH_OBJECT, 0, optr;
    @vardata optr HINT_ALIGN_TOP_EDGE_WITH_OBJECT;
    @reloc HINT_ALIGN_TOP_EDGE_WITH_OBJECT, 0, optr;
    @vardata optr HINT_ALIGN_RIGHT_EDGE_WITH_OBJECT;
    @reloc HINT_ALIGN_RIGHT_EDGE_WITH_OBJECT, 0, optr;
    @vardata optr HINT_ALIGN_BOTTOM_EDGE_WITH_OBJECT;
    @reloc HINT_ALIGN_BOTTOM_EDGE_WITH_OBJECT, 0, optr;
    @vardata void HINT_DONT_SHOW_SHORTCUT;
    @vardata void ATTR_GEN_SEND_APPLY_MSG_ON_APPLY_EVEN_IF_NOT_MODIFIED;
    @vardata void ATTR_GEN_SEND_APPLY_MSG_ON_APPLY_EVEN_IF_NOT_ENABLED;
    @vardata dword ATTR_GEN_VISIBILITY_DATA;
    @vardata Message ATTR_GEN_VISIBILITY_MESSAGE;
    @vardata optr ATTR_GEN_VISIBILITY_DESTINATION;
    @reloc ATTR_GEN_VISIBILITY_DESTINATION, 0, optr;
    @vardata void HINT_IS_POPUP_LIST;	    /* INTERNAL */
    @vardata void HINT_MINIMIZE_CHILD_SPACING;
    @vardata BackgroundColors HINT_GADGET_BACKGROUND_COLORS;
    @vardata WinPriority ATTR_GEN_WINDOW_CUSTOM_WINDOW_PRIORITY;
    @vardata LayerPriority ATTR_GEN_WINDOW_CUSTOM_LAYER_PRIORITY;
    @vardata MemHandle ATTR_GEN_WINDOW_CUSTOM_PARENT;
    @vardata void TEMP_GEN_SAVE_WINDOW_INFO;	/* INTERNAL */
    @vardata void TEMP_GEN_SAVE_ICON_INFO;	/* INTERNAL */
    @vardata void ATTR_GEN_WINDOW_CUSTOM_WINDOW;
    @vardata void HINT_ORIENT_CHILDREN_ALONG_LARGER_DIMENSION;
    @vardata void HINT_PLACE_MONIKER_ALONG_LARGER_DIMENSION;
    @vardata void HINT_WRAP_AFTER_CHILD_COUNT_IF_VERTICAL_SCREEN;
    @vardata void HINT_NOT_MOVABLE;
    @vardata void HINT_SEEK_TITLE_BAR_LEFT;
    @vardata void HINT_SEEK_TITLE_BAR_RIGHT;

typedef enum {
    GDMT_LEVEL_0    ,
    GDMT_LEVEL_1    ,
    GDMT_LEVEL_2    ,
    GDMT_LEVEL_3    ,
    GDMT_HELP    ,
    GDMT_HELP_PRIMARY
} GenDefaultMonikerType} ;

    @vardata GenDefaultMonikerType ATTR_GEN_DEFAULT_MONIKER;

    @vardata char[] ATTR_GEN_HELP_FILE;
    @vardata HelpType ATTR_GEN_HELP_TYPE;
    @vardata void ATTR_GEN_HELP_FILE_FROM_INIT_FILE;
    @vardata optr ATTR_GEN_FOCUS_HELP;
    @vardata optr ATTR_GEN_FOCUS_HELP_LIB;
        @reloc ATTR_GEN_FOCUS_HELP_LIB, 0, optr;

    @vardata void HINT_UNUSED_G;

    @vardata char[] ATTR_GEN_HELP_CONTEXT;
    @vardata void HINT_WINDOW_NO_CONSTRAINTS;
    @vardata optr ATTR_GEN_OUTPUT_TRAVEL_START;
    @reloc ATTR_GEN_OUTPUT_TRAVEL_START, 0, optr;
    @vardata SpecSizeSpec HINT_CUSTOM_CHILD_SPACING_IF_LIMITED_SPACE;
    @vardata void HINT_WINDOW_NO_TITLE_BAR;
    @vardata void HINT_WINDOW_NO_SYS_MENU;
    @vardata void ATTR_GEN_USES_HIERARCHICAL_INIT_FILE_CATEGORY;
    @vardata void ATTR_GEN_WINDOW_ACCEPT_INK_EVEN_IF_NOT_FOCUSED;

typedef WordFlags SystemAttrs ;
#define SA_NOT 			0x8000
#define SA_TINY 			0x4000
#define SA_HORIZONTALLY_TINY 	0x2000
#define SA_VERTICALLY_TINY 	0x1000
#define SA_COLOR 		0x0800
#define SA_PEN_BASED 		0x0400
#define SA_KEYBOARD_ONLY 	0x0200
#define SA_NO_KEYBOARD 		0x0100

    @vardata SystemAttrs HINT_IF_SYSTEM_ATTRS;
    @vardata void HINT_ENDIF;
    @vardata void HINT_ELSE;

    @vardata word TEMP_GEN_EMC_PANEL_ITEM_PRIORITY;
    @vardata KeyboardOverride ATTR_GEN_WINDOW_KBD_OVERRIDE;
    @vardata Point ATTR_GEN_WINDOW_KBD_POSITION;
    @vardata void HINT_WINDOW_MINIMIZE_TITLE_BAR;
    @vardata void HINT_WINDOW_ALWAYS_DRAW_WITH_FOCUS;

@protoreset

@protominor	UINewForResponder
    @vardata void HINT_DRAW_SHADOW;
    @vardata word HINT_SEEK_SLOT;
    @vardata word HINT_INDENT_CHILDREN;
@protoreset

@protominor	PCVWindowHints
    /*
     * PCV Window hints.  Make sure that these hints are contiguous
     * and remain in order, as Legos will map "looks" as offsets
     * from the first of these hints, HINT_WINDOW_PCV_TOOL_DIALOG_LOOK
     */
    @vardata void HINT_WINDOW_PCV_TOOL_DIALOG_LOOK;
    /* Draw in the style of a PCV tool dialog window.  This is similar to
       the Stylus round thick dialog, but not quite so round or thick. */

    @vardata void HINT_WINDOW_PCV_FIT_NOTE_PAD_LOOK;
    /* Draw in the style of a PCV Fit Note pad window.  This has a corner
       folded up on the bottom right and looks as if it is sittin on top
       of a few other windows because of the border on the bottom right. */

    @vardata void HINT_WINDOW_PCV_FIT_NOTE_LOOK;
    /* Draw in the style of a PCV Fit Note window.  This has the bottom
       right corner folded up. */

    @vardata void HINT_WINDOW_PCV_ROLODEX_CARD_LOOK;
    /*  Draw in the style of a PCV rolodex card window. */
@protoreset

@protominor UINewForResponder_4
    @vardata SpecSizeSpec HINT_CUSTOM_CHILD_WRAP_SPACING;
    @vardata void HINT_ALIGN_WITH_CENTERED_MONIKERS;
    @vardata void HINT_DONT_INDENT_BOX;
@protoreset

@protominor PCVLooks_2
    @vardata void HINT_BLANK_WINDOW_STYLE;
    /* Draw the window as a blank white square, no UI. */

    @vardata void HINT_BLANK_GREY_WINDOW_STYLE;
    /* Draw the window as a blank grey square, no UI. */

    @vardata void HINT_BLANK_BLACK_GROUP_STYLE;
    /* Used with grouping objects.  Fill with black */

    @vardata void HINT_BORDERED_GROUP_STYLE;
    /* Draw with a rounded corner shadowed border (white filled) */
@protoreset

@protominor UINewForZooming

    @vardata void HINT_MINIMIZE_MARGINS;
    /*
     * If supported, this hint will cause an interaction to minimize it's
     * margins giving it's children maximum space.
     *
     * Currently only supported in N9110, and effective when
     * HINT_DRAW_IN_BOX is also used. Only the left and right margins
     * are decreased.
     */

typedef ByteEnum ZoomLevel ;
#define ZL_ZOOM_1 	0
#define ZL_ZOOM_2 	1
#define ZL_ZOOM_3 	2

    @vardata ZoomLevel HINT_MAXIMUM_ZOOM_LEVEL;
    /*
     * If supported, this hint will cause objects to be drawn in "zoomed" mode
     * whenever the system zoom level changes. The required parameter specifies
     * the maximum zoom-level to support.
     *
     * Currently, only supported in N9110.
     */

    @vardata Rectangle HINT_GEN_CUSTOM_EXTRA_MARGINS;
    /*
     *  Suggests additional margins for composites. This is really like
     *  HINT_CUSTOM_EXTRA_MARGINS, but is placed here so as not to confuse
     *  the ordering in the two source branches.
     *
     *  Currently, only supported in N9110
     */

@protoreset

@prototype void GEN_VISIBILITY_OUTPUT (optr obj = cx:dx, Boolean opening = bp);

typedef ByteEnum GCMIcon ;
#define GCMI_NONE  0
#define GCMI_EXIT  1
#define GCMI_HELP  2

typedef ByteFlags GeneralConsumerModeFlags ;
#define GCMF_LEFT_ICON 	0x38
#define GCMF_RIGHT_ICON  0x07

typedef struct {
    SpecWidth	CSHA_width;
    SpecHeight	CSHA_height;
    sword	CSHA_count;
} CompSizeHintArgs} ;

typedef struct {
    SpecWidth	GSHA_width;
    SpecHeight	GSHA_height;
} GadgetSizeHintArgs} ;

typedef struct {
    word	HE_type;
    word	HE_size;
} HintEntry} ;

typedef struct {
    Color	BC_unselectedColor1;
    Color	BC_unselectedColor2;
    Color 	BC_selectedColor1;
    Color 	BC_selectedColor2;
} BackgroundColors} ;

/***/

/*
 *	Utility routines
 */

extern word
    _pascal GenCopyChunk (MemHandle destBlock,
                MemHandle blk, ChunkHandle chnk,
                CompChildFlags flags); /* XXX */

extern void
    _pascal GenInsertChild (MemHandle mh, ChunkHandle chnk,
                optr childToAdd,
                optr referenceChild,
                CompChildFlags flags); /* XXX */

extern void
    _pascal GenSetUpwardLink (MemHandle mh, ChunkHandle chnk,
                optr parent); /* XXX */

extern void
    _pascal GenRemoveDownwardLink (MemHandle mh, ChunkHandle chnk,
                CompChildFlags flags); /* XXX */

extern void
    _pascal GenSpecShrink (MemHandle mh, ChunkHandle chnk); /* XXX */

extern void
    _pascal GenProcessGenAttrsBeforeAction (
                MemHandle mh, ChunkHandle chnk); /* XXX */

extern void
    _pascal GenProcessGenAttrsAfterAction (
                MemHandle mh, ChunkHandle chnk); /* XXX */

extern optr
    _pascal GenFindObjectInTree (optr startObject,
                    dword childTable); /* XXX */

#define GenFindParent (oself)	\
    ObjLinkFindParent(oself, word_offsetof(GenBase, Gen_offset), \
              word_offsetof(GenInstance, GI_link))

#ifdef __HIGHC__
pragma Alias(GenCopyChunk, "GENCOPYCHUNK");
pragma Alias(GenInsertChild, "GENINSERTCHILD");
pragma Alias(GenSetUpwardLink, "GENSETUPWARDLINK");
pragma Alias(GenRemoveDownwardLink, "GENREMOVEDOWNWARDLINK");
pragma Alias(GenSpecShrink, "GENSPECSHRINK");
pragma Alias(GenProcessGenAttrsBeforeAction, "GENPROCESSGENATTRSBEFOREACTION");
pragma Alias(GenProcessGenAttrsAfterAction, "GENPROCESSGENATTRSAFTERACTION");
pragma Alias(GenFindObjectInTree, "GENFINDOBJECTINTREE");
#endif

/*
 *	Constants and Structures
 */

typedef ByteFlags GenAttrs ;
#define GA_SIGNAL_INTERACTION_COMPLETE 	0x80
#define GA_INITIATES_BUSY_STATE 		0x40
#define GA_INITIATES_INPUT_HOLD_UP 		0x20
#define GA_INITIATES_INPUT_IGNORE 		0x10
#define GA_READ_ONLY 				0x08
#define GA_KBD_SEARCH_PATH 			0x04
#define GA_TARGETABLE 				0x02
#define GA_NOTIFY_VISIBILITY 			0x01

typedef ByteFlags GenStates ;
#define GS_USABLE 	0x80
#define GS_ENABLED 	0x40

    @instance @link GI_link;
    @instance @composite GI_comp = GI_link;
    @instance @visMoniker GI_visMoniker;
    @instance @kbdAccelerator GI_kbdAccelerator;
    @instance GenAttrs GI_attrs = 0;
    @instance GenStates GI_states = (GS_USABLE|GS_ENABLED);

@endc

@endlib


geode.h

/***********************************************************************

 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	geode.h
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines geode structures and routines.
 *
 *	$Id: geode.h,v 1.43.4.3 98/10/02 13:41:39 cthomas Exp $
 *
 ***********************************************************************/

#ifndef	__GEODE_H
#define __GEODE_H

/* Geode file attributes */

typedef WordFlags GeodeAttrs ;
#define GA_PROCESS 			0x8000
#define GA_LIBRARY 			0x4000
#define GA_DRIVER 			0x2000
#define GA_KEEP_FILE_OPEN 		0x1000
#define GA_SYSTEM 			0x0800
#define GA_MULTI_LAUNCHABLE 		0x0400
#define GA_APPLICATION 			0x0200
#define GA_DRIVER_INITIALIZED 		0x0100
#define GA_LIBRARY_INITIALIZED 		0x0080
#define GA_GEODE_INITIALIZED 		0x0040
#define GA_USES_COPROC 			0x0020
#define GA_REQUIRES_COPROC 		0x0010
#define GA_HAS_GENERAL_CONSUMER_MODE 	0x0008
#define GA_ENTRY_POINTS_IN_C 		0x0004

/* Errors returned by GeodeLoad() */

typedef enum /* word */ {
    GLE_PROTOCOL_IMPORTER_TOO_RECENT    ,
    GLE_PROTOCOL_IMPORTER_TOO_OLD    ,
    GLE_FILE_NOT_FOUND    ,
    GLE_LIBRARY_NOT_FOUND    ,
    GLE_FILE_READ_ERROR    ,
    GLE_NOT_GEOS_FILE    ,
    GLE_NOT_GEOS_EXECUTABLE_FILE    ,
    GLE_ATTRIBUTE_MISMATCH    ,
    GLE_MEMORY_ALLOCATION_ERROR    ,
    GLE_NOT_MULTI_LAUNCHABLE    ,
    GLE_LIBRARY_PROTOCOL_ERROR    ,
    GLE_LIBRARY_LOAD_ERROR    ,
    GLE_DRIVER_INIT_ERROR    ,
    GLE_LIBRARY_INIT_ERROR    ,
    GLE_DISK_TOO_FULL    ,
    GLE_FIELD_DETACHING    ,
    GLE_INSUFFICIENT_HEAP_SPACE    ,
    GLE_LAST_GEODE_LOAD_ERROR    	/* for iacp.goh... */
} GeodeLoadError} ;

/***/

extern GeodeHandle			/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal GeodeLoad (const char *name, GeodeAttrs attrMatch, GeodeAttrs attrNoMatch,
               word priority, dword appInfo, GeodeLoadError *err);

/***/

extern void
    _pascal GeodeAddReference (GeodeHandle gh);

/***/
extern Boolean
    _pascal GeodeRemoveReference (GeodeHandle gh);

/***/
extern GeodeHandle	/*XXX*/
    _pascal GeodeFind (const char *name, word numChars, GeodeAttrs attrMatch,
                        GeodeAttrs attrNoMatch);

/***/

extern word 		/*XXX*/
    _pascal GeodeFindResource (FileHandle file, word resNum, word resOffset,
              dword *base);

/***/

extern MemHandle        /*XXX*/
    _pascal GeodeSnatchResource (FileHandle file, word resNum, word resOffset);

/***/

extern Boolean 		/*XXX*/
    _pascal GeodeSetGeneralPatchPath ();

/***/

extern Boolean 	        /*XXX*/
    _pascal GeodeSetLanguagePatchPath ();

/***/

extern Boolean 	        /*XXX*/
    _pascal GeodeSetLanguageStandardPath (word stdPath);

/***/

extern Boolean 		/*XXX*/
    _pascal IsMultiLanguageModeOn ();

/***/

typedef enum /* word */ {
    GGIT_ATTRIBUTES    =0,
    GGIT_TYPE    =2,
    GGIT_GEODE_RELEASE    =4,
    GGIT_GEODE_PROTOCOL    =6,
    GGIT_TOKEN_ID    =8,
    GGIT_PERM_NAME_AND_EXT    =10,
    GGIT_PERM_NAME_ONLY    =12,
#ifdef DO_DBCS
    GGIT_PERM_NAME_AND_EXT_DBCS    =14,
    GGIT_PERM_NAME_ONLY_DBCS    =16,
    GGIT_GEODE_REF_COUNT    =18,
#else
    GGIT_GEODE_REF_COUNT=14,
#endif
} GeodeGetInfoType} ;

extern word	/*XXX*/
    _pascal GeodeGetInfo (GeodeHandle gh, GeodeGetInfoType info, void *buf);

/***/

extern GeodeHandle	/*XXX*/
    _pascal GeodeGetProcessHandle (void);

/***/

extern GeodeHandle
    _pascal GeodeGetCodeProcessHandle (void);

/***/

extern optr
    _pascal GeodeGetAppObject (GeodeHandle gh);

/***/

extern word	/*XXX*/
    _pascal GeodeGetUIData (GeodeHandle gh);

/***/

extern void	/*XXX*/
    _pascal GeodeSetUIData (GeodeHandle gh, word data);

/***/

extern ThreadHandle	/*XXX*/
    _pascal ProcInfo (GeodeHandle gh);

/***/

extern QueueHandle	/*XXX*/
    _pascal GeodeAllocQueue (void);

/***/

extern void	/*XXX*/
    _pascal GeodeFreeQueue (QueueHandle qh);

/***/

extern word	/*XXX*/
    _pascal GeodeInfoQueue (QueueHandle qh);

/***/

/*
 * Note: The messageFlags passed to GeodeFlushQueue are of type
 * MessageFlags, defined in object.h. They cannot be so specified
 * in this function declaration because object.h depends on this
 * file, geode.h, and so cannot be included by it. ""
 */
extern void	/*XXX*/
    _pascal GeodeFlushQueue (QueueHandle source, QueueHandle dest, optr obj,
            word messageFlags);

/***/

extern word 	/*XXX*/
    _pascal GeodePrivAlloc (GeodeHandle gh, word numWords);

/***/

extern void 	/*XXX*/
    _pascal GeodePrivFree (word offset, word numWords);

/***/

extern void 	/*XXX*/
    _pascal GeodePrivRead (GeodeHandle gh, word offset, word numWords, word *dest);

/***/

/*
 * GeodePrivWrite returns TRUE if the write succeeded and FALSE otherwise.
 */
extern Boolean 	/*XXX*/
    _pascal GeodePrivWrite (GeodeHandle gh, word offset, word numWords, word *src);

extern EventHandle /*XXX*/
    _pascal QueueGetMessage (QueueHandle qh);

extern void	/*XXX*/
    _pascal QueuePostMessage (QueueHandle qh, EventHandle event, word flags);

extern ReservationHandle
    _pascal GeodeRequestSpace (int amount, GeodeHandle gh);

extern void
    _pascal GeodeReturnSpace (ReservationHandle resv);

/*
 *	Constants for Geodes
 */

/* Sizes */

#define GEODE_NAME_SIZE 		8
#define GEODE_NAME_EXT_SIZE 	4

/*
 *	Tokens
 */

#define TOKEN_CHARS_LENGTH 	4
typedef char TokenChars [TOKEN_CHARS_LENGTH];

/* manufacturer's id in token */

typedef word ManufacturerID ;
#define MANUFACTURER_ID_GEOWORKS     	    0
#define MANUFACTURER_ID_APP_LOCAL    	    1
#define MANUFACTURER_ID_PALM_COMPUTING 	    2
#define MANUFACTURER_ID_WIZARD 	    	    3
#define MANUFACTURER_ID_CREATIVE_LABS 	    4
#define MANUFACTURER_ID_DOS_LAUNCHER 	    5
#define MANUFACTURER_ID_AMERICA_ONLINE 	    6
#define	MANUFACTURER_ID_INTUIT		    	    7
#define MANUFACTURER_ID_SDK 		    8
#define MANUFACTURER_ID_SHAREWARE 	    9
#define MANUFACTURER_ID_GENERIC              10
#define MANUFACTURER_ID_NOKIA                11
#define MANUFACTURER_ID_SOCKET_16BIT_PORT    12

/*
 * As of 10/29/93, Manufacturer ID's will be assigned automatically by
 * database, in the range indicated by the equates below.
 */

#define MANUFACTURER_ID_DATABASE_FIRST 		0x4000
#define MANUFACTURER_ID_DATABASE_LAST 		0x7fff

/*
 *  This is here to allow backward compatability.
 */
#define	MANUFACTURER_ID_TBD	 			MANUFACTURER_ID_NOKIA

typedef struct {
    TokenChars		GT_chars;
    ManufacturerID	GT_manufID;
} GeodeToken} ;

typedef struct {
    word		GHV_heapSpace;
} GeodeHeapVars} ;

/*
 *	Version control
 */

typedef struct {
    word	RN_major;
    word	RN_minor;
    word	RN_change;
    word	RN_engineering;
} ReleaseNumber} ;

typedef struct {
    word	PN_major;
    word	PN_minor;
} ProtocolNumber} ;

#ifdef __HIGHC__
pragma Alias(GeodeLoad, "GEODELOAD");
pragma Alias(GeodeAddReference, "GEODEADDREFERENCE");
pragma Alias(GeodeRemoveReference, "GEODEREMOVEREFERENCE");
pragma Alias(GeodeFind, "GEODEFIND");
pragma Alias(GeodeFindResource, "GEODEFINDRESOURCE");
pragma Alias(GeodeGetInfo, "GEODEGETINFO");
pragma Alias(GeodeGetProcessHandle, "GEODEGETPROCESSHANDLE");
pragma Alias(GeodeGetCodeProcessHandle, "GEODEGETCODEPROCESSHANDLE");
pragma Alias(GeodeGetAppObject, "GEODEGETAPPOBJECT");
pragma Alias(GeodeGetUIData, "GEODEGETUIDATA");
pragma Alias(GeodeSetUIData, "GEODESETUIDATA");
pragma Alias(GeodeSetGeneralPatchPath, "GEODESETGENERALPATCHPATH");
pragma Alias(GeodeSetLanguagePatchPath, "GEODESETLANGUAGEPATCHPATH");
pragma Alias(GeodeSetLanguageStandardPath, "GEODESETLANGUAGESTANDARDPATH");
pragma Alias(GeodeSnatchResource, "GEODESNATCHRESOURCE");
pragma Alias(ProcInfo, "PROCINFO");
pragma Alias(GeodeAllocQueue, "GEODEALLOCQUEUE");
pragma Alias(GeodeFreeQueue, "GEODEFREEQUEUE");
pragma Alias(GeodeInfoQueue, "GEODEINFOQUEUE");
pragma Alias(GeodeFlushQueue, "GEODEFLUSHQUEUE");
pragma Alias(GeodePrivAlloc, "GEODEPRIVALLOC");
pragma Alias(GeodePrivFree, "GEODEPRIVFREE");
pragma Alias(GeodePrivRead, "GEODEPRIVREAD");
pragma Alias(GeodePrivWrite, "GEODEPRIVWRITE");
pragma Alias(IsMultiLanguageModeOn, "ISMULTILANGUAGEMODEON");
pragma Alias(QueuePostMessage, "QUEUEPOSTMESSAGE");
pragma Alias(QueueGetMessage, "QUEUEGETMESSAGE");
pragma Alias(GeodeRequestSpace, "GEODEREQUESTSPACE");
pragma Alias(GeodeReturnSpace, "GEODERETURNSPACE");
#endif

#endif


Internal\geodeStr.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1995 -- All Rights Reserved
 *
 * PROJECT:	  PC GEOS
 * MODULE:	  Kernel
 * FILE:	  geodeStr.h
 *
 * AUTHOR:  	  Peter Trinh: Sep  5, 1995
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	PT	9/ 5/95   	Initial version
 *
 * DESCRIPTION:
 *	This file defines standard file structures.
 *
 *
 *	Sections of this file are #if'ed out because those sections
 *	have not been checked for correctness.
 *
 * 	$Id: geodeStr.h,v 1.2.2.1 96/04/28 08:32:52 chris Exp $
 *
 ***********************************************************************/
#ifndef _GEODESTR_H_
#define _GEODESTR_H_

#include  <geode.h>

/*
 *	Definitions for standard files
 */
#define NUMBER_OF_STANDARD_FILES  4

/*
 *      Geode file types (correspond to location in PCGEOS source tree)
 */

/* enum GeodeType */
typedef enum {
    GEODE_TYPE_APPLICATION     = 0x1,
    GEODE_TYPE_LIBRARY    ,
    GEODE_TYPE_DRIVER    ,
} GeodeType} ;

#if 0  /* This section has not been checked for correctness. */
/*
 *  Define the actual state variable structure
 */
typedef struct {		/* CHECKME */

/* *** Standard position for handle to segment */

    hptr.GeodeHeader	GH_geodeHandle; /* handle to this segment */

/* *** Variables from core data information (loaded from file) */

    /* *** Generic information *** */
    GeodeAttrs	<>	GH_geodeAttr;
/* GEODE file type, see GEODE spec */
    GeodeType	GH_geodeFileType;
/* release # */
    ReleaseNumber	<>	GH_geodeRelease;
/* protocol # */
    ProtocolNumber	<>	GH_geodeProtocol;
/* time stamp (SWAT uniqueness) */
    word	GH_geodeSerial;
/*
 * (permanent name
 * of GEODE)
 */
    char	GEODE_NAME_SIZE dup(?)	GH_geodeName;
/*  name extension */
    char	GEODE_NAME_EXT_SIZE dup(?)	GH_geodeNameExt;
    GeodeToken	<>	GH_geodeToken;
/* reference count for GEODE */
    sword	GH_geodeRefCount;

/* *** Driver variables */
    fptr.DriverInfoStruct	GH_driverTab;
    equ <GH_driverTab.offset>	GH_driverTabOff;
    equ <GH_driverTab.segment>	GH_driverTabSegment;

/* *** Exported library information */
/*
 * Library entry routine for kernel
 *  to call
 */
    fptr.far	GH_libEntry;
    equ <GH_libEntry.offset>	GH_libEntryOff;
    equ <GH_libEntry.segment>	GH_libEntrySegment;

/* Offset of entry point table */
    nptr.fptr	GH_exportLibTabOff;
/* number of exported entry points */
    sword	GH_exportEntryCount;

/* *** Imported library information *** */
/*
 * number of imported library table
 * entries
 */
    sword	GH_libCount;
/*
 * offset (in memory) of imported
 * library table
 */
    nptr.hptr	GH_libOffset;

/* *** Resource information *** */
/* number of resources */
    sword	GH_resCount;
/*
 * offset (in memory) to resource handle
 * table
 */
    nptr.hptr	GH_resHandleOff;
/*
 * offset (in memory) to resource
 * position table
 */
    nptr.dword	GH_resPosOff;
/*
 * offset (in memory) to resource
 * relocation size table
 */
    nptr.word	GH_resRelocOff;

/*
 *  NOTE: if you change anything above this label in GeodeHeader then
 *  be sure to to update the tools header file in
 *   /staff/pcgeos/include/geode.h or things like swat will be ""
 *  unhappy - jimmy 6/94
 */

    label	byte	GH_endOfVariablesFromFile;
/* *** END of variables loaded from file */

/* *** GEODE generic variables */

/* handle to GEODE's .geo file */
    hptr	GH_geoHandle;
/* handle of parent process */
    hptr.GeodeHeader	GH_parentProcess;
/* handle of next GEODE on list */
    hptr.GeodeHeader	GH_nextGeode;
/*
 * If this is not the kernel
 *  geode, then it contains data
 *  to be accessed via the
 *  GeodePrivXXXX routines.
 * If this *is* the kernel geode,
 *  then this contains a map of
 *  the allocated privData
 *  offsets.
 */
    hptr	GH_privData;
/*
 * Pointer to table of extra
 *  libraries (those imported
 *  by the libraries this geode
 *  imports, but not imported
 *  directly by this geode)
 */
    nptr.hptr	GH_extraLibOffset;
/*
 * Number of entries in the
 *  extraLib table.
 */
    word	GH_extraLibCount;
/*
 * Handle of memory
 *  block containing
 *  general patch data
 */
    hptr	GH_generalPatchData;
/*
 * Handle of memory
 *  block containing
 *  language patch data
 */
    hptr	GH_languagePatchData;

/*
 * *** The remaining state variables are only present if the GEODE is
 * *** a process
 */

} GeodeHeader;

typedef struct {		/* CHECKME */
    GeodeHeader <>	PH_geodePart;

/* *** User interface information */
/* Application object */
    optr	PH_appObject;
/* Handle of state file */
    hptr	PH_vmHandle;
/* First handle on "saved" chain */
    hptr	PH_savedBlockPtr;
/* One word of data for UI */
    word	PH_uiData;
/*
 * Second, "UI" thread for process, if
 * any.  Runs all "ui-object" blocks
 */
    hptr	PH_uiThread;

/* *** File system variables */
    hptr	NUMBER_OF_STANDARD_FILES dup (?)	PH_stdFileHandles;
} ProcessHeader;

typedef ByteEnum GeodeRelocationSource;		/* CHECKME */

/*
 *  Relocation to a kernel entry point.
 * 	GRE_extra - unused
 * 	word at relocation - kernel entry point number
 */
#define GRS_KERNEL 	0x0

/*
 *  Relocation to a library entry point.
 * 	GRE_extra - imported library number
 * 	word at relocation - library entry point number
 */
#define GRS_LIBRARY 	0x1

/*
 *  Relocation to a resource of the geode.  This is never used with
 *  GRT_OFFSET or GRT_FAR_PTR since the linker eliminates GRT_OFFSET and
 *  convert GRT_FAR_PTR to GRT_SEGMENT.
 * 	GRE_extra - unused
 * 	word at relocation - resource number
 * 	for GRT_CALL - word at relocation+2 - offset of call
 */
/* geode's resource */
#define GRS_RESOURCE 	0x2

typedef ByteEnum GeodeRelocationType;		/* CHECKME */

/*
 *  Relocation to a far pointer to an entry point (4 bytes).  If the
 *  target is movable then the segment is replaced by the handle>>4.  The
 *  second word of data at the target is not used.
 */
#define GRT_FAR_PTR 	0x0

/*  Relocation to the offset of an entry point (2 bytes). */
#define GRT_OFFSET 	0x1

/*
 *  Relocation to the segment of an entry point (2 bytes).  If the
 *  target is movable then the segment is replace by the handle>>4.
 */
#define GRT_SEGMENT 	0x2

/*  Relocation to the handle of an entry point (2 bytes). */
#define GRT_HANDLE 	0x3

/*
 *  Relocation to a call to a possibly movable routine (5 bytes).  The
 *  offset stored points to the byte AFTER the call opcode.  If the
 *  target is fixed, behavior is the same as GRT_FAR_PTR.  If the
 *  target is movable, the call opcode is replaced with a software
 *  interrupt and the other three bytes are replaced with data that
 *  defines the call:
 * 	Sixteen Software interrupts are used for geode resource and
 * 	library calls with the low four bits of the interrupt number
 * 	being the low byte of the handle to call (when shifted left
 * 	four bits).
 * 	bytes 0 and 1:INT RESOURCE_CALL_INT..RESOURCE_CALL_INT+15
 * 	byte 2: high byte of handle
 * 	byte 3 and 4: offset of call
 */
#define GRT_CALL 	0x4

/*  Relocation to the last handle in an XIP resource. */
#define GRT_LAST_XIP_RESOURCE 	0x5

typedef ByteFlags GeodeRelocationInfo;		/* CHECKME */
#define GeodeRelocationSource 	(0x80 | 0x40 | 0x20 | 0x10)
#define GeodeRelocationSource_OFFSET 	4
#define GeodeRelocationType 	(0x08 | 0x04 | 0x02 | 0x01)
#define GeodeRelocationType_OFFSET 	0

typedef struct {		/* CHECKME */
    GeodeRelocationInfo	GRE_info;
/* extra data depending on source */
    byte	GRE_extra;
/* offset of relocation */
    word	GRE_offset;
} GeodeRelocationEntry;

#endif /* End of section that has not been checked for correctness. */

/*---------------------------------------------------------------------------
 * 		Method parameter definition for C
 *---------------------------------------------------------------------------*/

/* 	Return parameter... */

typedef ByteEnum MethodReturnType ;
#define MRT_VOID 		0x0
#define MRT_BYTE_OR_WORD 	0x1
#define MRT_DWORD 		0x2
#define MRT_MULTIPLE 		0x3

typedef ByteEnum MethodReturnByteWordType ;
#define MRBWT_AL 	0x0
#define MRBWT_AH 	0x1
#define MRBWT_CL 	0x2
#define MRBWT_CH 	0x3
#define MRBWT_DL 	0x4
#define MRBWT_DH 	0x5
#define MRBWT_BPL 	0x6
#define MRBWT_BPH 	0x7
#define MRBWT_AX 	0x8
#define MRBWT_CX 	0x9
#define MRBWT_DX 	0xa
#define MRBWT_BP 	0xb

typedef ByteEnum MethodReturnDWordReg ;
#define MRDWR_AX 	0x0
#define MRDWR_CX 	0x1
#define MRDWR_DX 	0x2
#define MRDWR_BP 	0x3

typedef ByteEnum MethodReturnMultipleType ;
#define MRMT_AXBPCXDX 	0x0
#define MRMT_AXCXDXBP 	0x1
#define MRMT_CXDXBPAX 	0x2
#define MRMT_DXCX 	0x3
#define MRMT_BPAXDXCX 	0x4
#define MRMT_MULTIPLEAX 	0x5

typedef ByteFlags MethodReturnDWordInfo ;
#define MTDI_HIGH_REG 	0xc	/* MethodReturnDWordReg */
#define MTDI_LOW_REG 	0x3	/* MethodReturnDWordReg */

#define MTDI_HIGH_REG_OFFSET 	2
#define MTDI_LOW_REG_OFFSET 	0

typedef union {					/* MPD_RETURN_TYPE = */
    MethodReturnByteWordType	MRI_byteWord;	/*   MRT_BYTE_OR_WORD*/
    MethodReturnDWordInfo	MRI_dword;	/*   MRT_DWORD */
    MethodReturnMultipleType	MRI_multiple;	/*   MRT_MULTIPLE */
} MethodReturnInfo} ;

/* 	Passed parameters... */

typedef ByteFlags MethodStackInfo ;
#define MSI_STRUCT_AT_SS_BP 	0x80	/*
                     * if 1: Single C parameter is a far
                     *       pointer to a structure which
                     *       must be copied onto the stack,
                     *       passed in ss:bp and copied back
                     * if 0: Multiple paramters passed on
                     *       the stack because they don't
                     *       fit in regs.  Pass ss:bp
                     *       pointing to the parameters
                     */
#define MSI_PARAM_SIZE 		0x7f

#define MSI_PARAM_SIZE_OFFSET 	0

typedef union {					/* MPM_C_PARAMS = */
    byte		MMI_C_PARAM_SIZE;	/* 	1 */
    MethodStackInfo	MMI_STACK_INFO;		/* 	0 */
} MethodMemoryInfo} ;

typedef WordFlags MethodPassMemory ;
#define MPM_C_PARAMS 		0x0100
#define MPM_MEMORY_INFO 		0x00ff /* MethodMemoryInfo */

#define MPM_MEMORY_INFO_OFFSET 	0

typedef ByteEnum MethodPassReg ;
#define MPR_NONE 	0x0
#define MPR_CL 		0x1
#define MPR_CH 		0x2
#define MPR_DL 		0x3
#define MPR_DH 		0x4
#define MPR_CX 		0x5
#define MPR_DX 		0x6
#define MPR_BP 		0x7

typedef WordFlags MethodPassRegisters ;
/* Reg to put 3rd parameter in */
#define MPR_PARAM3 	0x01c0	/* MethodPassReg
/* Reg to put 2nd parameter in */
#define MPR_PARAM2 	0x0038	/* MethodPassReg */
/* Reg to put 1st parameter in */
#define MPR_PARAM1 	0x0007	/* MethodPassReg */

#define MPR_PARAM3_OFFSET 	6
#define MPR_PARAM2_OFFSET 	3
#define MPR_PARAM1_OFFSET 	0

typedef union {				/* MPD_REGISTER_PARAMS = */
    MethodPassRegisters	MPI_REGISTERS;	/*     1 */
    MethodPassMemory	MPI_MEMORY;	/*     0 */
} MethodPassInfo} ;

/* 	The full thing... */

typedef WordFlags MethodParameterDef ;

/*  Bits used to encode return type */

#define MPD_RETURN_TYPE 		0xc000	/* MethodReturnType */
#define MPD_RETURN_INFO 		0x3c00	/* MethodReturnInfo */

/*  Bits used to encode passed parameters */

#define MPD_REGISTER_PARAMS 	0x0200	/* Set if params passed in registers */
#define MPD_PASS_INFO 		0x01ff	/* MethodPassInfo */

#define MPD_RETURN_TYPE_OFFSET 	14
#define MPD_RETURN_INFO_OFFSET 	10
#define MPD_PASS_INFO_OFFSET 	0

#if 0  /* This section has not been checked for correctness. */

/* --------------- */

typedef ByteEnum HandlerModel;		/* CHECKME */
#define HM_FAR 	0x0
#define HM_NEAR 	0x1
#define HM_BASED 	0x2

typedef ByteFlags HandlerTypeDef;		/* CHECKME */
#define HandlerModel 	(0x80 | 0x40)
#define HandlerModel_OFFSET 	6
#define HTD_PROCESS_CLASS 	(0x20)
/* 5 bits unused */

/* ------------------------------------------------------------------------------
 * 		Relocation information
 * ------------------------------------------------------------------------------*/

/* INT 80h thru 8fh */
#define RESOURCE_CALL_INT_BASE 	(080h)

/* INT 80h vector */
#define RESOURCE_CALL_VECTOR_BASE 	(RESOURCE_CALL_INT_BASE * fptr)

/* opcode for INT XX */
#define INT_OPCODE 	(0cdh)

/* --------------------------------------------------------------------------
 * 			Executable file header
 * --------------------------------------------------------------------------*/

typedef struct {		/* CHECKME */
    GeodeAttrs	EFH_attributes;
    word	EFH_fileType;
    word	EFH_heapSpace;
/*
 *  Heap space requirement -- used for applications only.  Amout of space
 *  that will come out of the operating space of the heap if this application
 *  is launched.  Is a somewhat magical value, roughly equivalent to the #
 *  of paragraphs of non-Discardable memory req'd, used to determine whether
 *  the app may safely be loaded into the heap or not.  The exact value
 *  will be determined by running the "heapspace" TCL script on the
 *  application, the result of which will then be stored by the programmer
 *  in the .gp file.  glue will then store that value here.	-- Doug 3/2/93
 */

/* used to be 2nd word of kernel protocol */
    word	EFH_unused;
    word	EFH_resourceCount;
    word	EFH_importLibraryCount;
    word	EFH_exportEntryCount;
    word	EFH_udataSize;
    dword	EFH_classPtr;
    optr	EFH_appObj;
} ExecutableFileHeader;

/* 	Imported library entry */

typedef struct {		/* CHECKME */
    char	GEODE_NAME_SIZE dup(?)	ILE_name;
    word	ILE_attrs;
    ProtocolNumber <>	ILE_protocol;
} ImportedLibraryEntry;

/* --------------------------------------------------------------------------
 * 			Geode file header
 * --------------------------------------------------------------------------*/

typedef struct {		/* CHECKME */
    ExecutableFileHeader	GFH_execHeader;
    GeodeHeader	GFH_coreBlock;
} GeodeFileHeader;

#endif /* End of section that has not been checked for correctness. */

#endif /* _GEODESTR_H_ */


geoMisc.h

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) GeoWorks 1992 -- All Rights Reserved

PROJECT:	GEOS
MODULE:		AnsiC (NOTE: non ANSI C geos functions)
FILE:		geoMisc.h

AUTHOR:		Allen Schoonmaker, Jun  3, 1992

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    AS	6/ 3/92   	Initial version.

DESCRIPTION:
    This files contains many functions that are common under Unix
    and other operating systems that are not in Standard C.

    $Id: geoMisc.h,v 1.8.4.1 96/04/28 08:28:56 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef __STRMISC_H__
#define __STRMISC_H__

#include  <localize.h>

extern word
  _pascal strpos  (const TCHAR *__s, int __c);

extern word
  _pascal strrpos  (const TCHAR *__s, int __c);

#define strcmpi (a,b)	LocalCmpStringsNoCase((a),(b),0)
#define strlwr (a)	LocalDowncaseString((a),0)
#define strupr (a)	LocalUpcaseString((a),0)

extern void
  _pascal itoa (int __n, TCHAR *__s);

extern void
 _pascal strrev (TCHAR *__s);

extern void
  *_pascal memccpy (void *__dest, void *__src, word __c, word __n);

/*
 *	Notes about using the various malloc-esque routines:
 *
 *	There is no synchronization being done. If you will be calling
 *	malloc routines from multiple threads, you should provide your
 *	own synchronization around the calls.
 *
 *	malloc(), calloc(), realloc(), and free() all work on a heap associated
 *	with the Geode associated with the current process. If you want to
 *	use a heap associated with another geode, you should call _Malloc,
 *	_Realloc, and _Free, and explicitly pass in the geode whose
 *	heap you want to use (this is useful for libraries that want to
 *	perform mallocs).
 */
extern void
    *_pascal _Malloc (word blockSize, GeodeHandle geodeHan, word zeroInit);

#define GeoMalloc  _Malloc

/*
 *	Notes about GeoReAlloc()
 *
 *	1) If the space is resized larger, new space is *not* zero-initialized.
 *
 *	2) If realloc() is called to resize the memory *smaller*, it will
 *	   always succeed.
 *
 *	3) If realloc() does not succeed, it will return NULL, and the original
 *	   memory block will be unaffected.
 *
 *	4) If the passed blockPtr is NULL, realloc() acts like malloc().
 *
 *	5) If the passed newSize is 0, the passed blockPtr is freed, and
 *	   NULL is returned.
 *
 */
extern void
    *_pascal _ReAlloc (void *blockPtr, word newSize, GeodeHandle geodeHan);

#define GeoReAlloc  _ReAlloc

extern void
    _pascal _Free (void *blockPtr, GeodeHandle geodeHan);

#define GeoFree  _Free
#define cfree  _Free

#ifdef __HIGHC__

pragma Alias(_Malloc, "_MALLOC");
pragma Alias(strpos, "STRPOS");
pragma Alias(strrpos, "STRRPOS");
pragma Alias(itoa, "ITOA");
pragma Alias(strrev, "STRREV");
pragma Alias(memccpy, "MEMCCPY");

#endif

#endif


geos.h

/***********************************************************************
 *
 *      Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:     PC/GEOS
 * FILE:        geos.h
 * AUTHOR:      Tony Requist: February 11, 1991
 *
 * DECLARER:    Kernel
 *
 * DESCRIPTION:
 *      This file defines global constants and structures.
 *
 *      $Id: geos.h,v 1.66.4.2 96/05/23 13:35:20 jacob Exp $
 *
 ***********************************************************************/

#ifndef __GEOS_H
#define __GEOS_H

#include  <stddef.h>

/*
 ******************************************************************
 *
 * Compiler dependent definitions
 *
 ******************************************************************
 */

#ifdef __HIGHC__

/*
 *      *****   MetaWare HighC   *****
 */

    /* Standard Pascal Conventions */
pragma Calling_Convention( _CALLEE_POPS_STACK | _SAVE_REGS);

#define _pascal  _CC(_CALLEE_POPS_STACK | _SAVE_REGS)
#define _cdecl  _CC(_REVERSE_PARMS | _SAVE_REGS)

pragma Off (Prototype_conversion_warn);
pragma Static_segment("idata");
pragma On (Optimize_for_space);
pragma On (Optimize_FP);
pragma On (Optimize_xjmp);       /* -g turns this off, we always need -g */
pragma Off (Public_var_warnings);
pragma On (Long_enums);          /* to be compatible with MSC */

#define _pragma_const_in_code  pragma On(Const_in_code); \
                  pragma On(Literals_in_code); \
                  pragma On(Read_only_strings)
#define _pragma_end_const_in_code  pragma Off(Const_in_code); \
                  pragma Off(Literals_in_code); \
                  pragma Off(Read_only_strings)

#define _inline_byte (val) _inline(val)
#define _inline_word (val) do{ _inline_byte(val & 0xff); _inline_byte(val >> 8); } while(0)

#define _REVERSED_DISTANCE_SEMANTICS

/* Macro so set data segments (HighC screws up if we use this */

#define _pragma_set_data_segment (seg)
#define _pragma_default_data_segment

#define PCB (ret,name,args) ret _pascal (*name) args
#define CCB (ret,name,args) ret _cdecl (*name) args

#elif defined __BORLANDC__

/*
 *      *****   Borland C   *****
 */

#define _pascal  pascal
#define _cdecl  cdecl

#pragma options -zRidata
#define _inline_byte (val)  inline_doesn_exist_yet_for_borland
#define _inline_word (val)  inline_doesn_exist_yet_for_borland

#define _far  far

#define PCB (ret,name,args) ret (_pascal *name) args
#define CCB (ret,name,args) ret (_cdecl *name) args

#elif defined _MSDOS && _MSC_VER

/*
 *      *****   Microsoft C 6.0   *****
 */

#define __BASED_VARS

#define _pascal  __pascal
#define _cdecl  /* there is no cdecl */
#define _far  __far
#define _inline_byte (val) __asm{ _emit val }
#define _inline_word (val) do{ _inline_byte(val & 0xff); _inline_byte(val >> 8);}while (0)

/* Macro to set data segments */

#define _pragma_set_data_segment (seg)
#define _pragma_default_data_segment

#define PCB (ret,name,args) ret (_pascal *name) args
#define CCB (ret,name,args) ret (_cdecl *name) args

#else
/*
 *      *****   Generic C (useful for type checking)   *****
 */

#define _near
#define _far
#define _pascal
#define _cdecl

#define _inline_byte (val)
#define _inline_word (val)

#define PCB (ret,name,args) ret (*name) args
#define CCB (ret,name,args) ret (*name) args

#endif
/*
 * End of compiler dependent definitions
 *
 ******************************************************************
 */

/*
 * Error checking stuff
 */

#ifdef  DO_ERROR_CHECKING
#define ERROR_CHECK  (-1)
#else
#define ERROR_CHECK  0
#endif

/*
 * DBCS stuff
 */

#ifdef  DO_DBCS

#define DBCS_GEOS  (-1)
typedef wchar_t TCHAR ;
#define __T (x) L##x

#else

#define DBCS_GEOS  0
typedef char TCHAR ;
#define __T (x) x

#endif

#define _T (x) __T(x)
#define _TEXT (x) __T(x)

/*
 * Common constants
 */

#define FALSE  0
#define TRUE  (~0)           /* Use as a return value, *not* for comparisons */

/*
 *      The problem here is that <stddef.h> defines null to be "(void *) 0",
 *      and this can't be assigned to a function pointer, no matter how we
 *      cast it, so we change it to just be 0 here. If you want some other
 *      value of NULL, define it after including "geos.h".
 */
#undef  NULL
#define NULL  0

/*
 * Standard types
 */

typedef	unsigned char byte ;
typedef	signed char sbyte ;
typedef	unsigned short word ;
typedef	signed short sword ;
typedef	unsigned long dword ;
typedef	long sdword ;
typedef	byte ByteFlags ;
typedef	word WordFlags ;
typedef	dword DWordFlags ;
typedef	byte ByteEnum ;
typedef	sword Boolean ;
typedef unsigned int wchar ;

#if defined _MSDOS && _MSC_VER
typedef void __based(void)* ChunkHandle;
#else
typedef word ChunkHandle ;
#endif

typedef dword optr ;
typedef word Message ;
typedef word VardataKey ;

typedef word Handle ;
typedef Handle MemHandle ;
typedef Handle DiskHandle ;
typedef Handle FileHandle ;
typedef Handle ThreadHandle ;
typedef Handle QueueHandle ;
typedef Handle TimerHandle ;
typedef Handle GeodeHandle ;
typedef Handle GStateHandle ;
typedef Handle WindowHandle ;
typedef Handle SemaphoreHandle ;
typedef Handle EventHandle ;
typedef Handle ThreadLockHandle ;
typedef Handle VMFileHandle ;
typedef Handle hptr ;

typedef Handle ReservationHandle ;

typedef word VMBlockHandle ;
typedef dword VMChain ;
typedef word DBGroup ;
typedef word DBItem ;
typedef dword DBGroupAndItem ;
typedef word Segment ;

typedef struct _ClassStruct ClassStruct ;

#define NullChunk  ((ChunkHandle) 0)
#define NullHandle  ((Handle) 0)
#define NullOptr  ((optr) 0)

/*
 * Standard macros
 */

#define OptrToHandle (op) ((MemHandle) ((op) >> 16))
#define OptrToChunk (op) ((ChunkHandle) (op))

#define ConstructOptr (han,ch) ((((optr) (han)) << 16) | ((ChunkHandle) (ch)))

#define PtrToSegment (ptr) 	((Segment) (((dword) (ptr)) >> 16))
#define SegmentOf (ptr) 		((Segment) (((dword) (ptr)) >> 16))
#define PtrToOffset (ptr) 	((word) ((dword) (ptr)))

/* The following macros are obsolete. */
#define ChunkOf (optr)           OptrToChunk(optr)
#define HandleOf (optr)          OptrToHandle(optr)
#define HandleToOptr (han)       ConstructOptr(han,NullChunk)

#ifndef offsetof
#define offsetof (str, field)    ((word)&((str _near *)0)->field)
#endif

#define word_offsetof (str, field) ((word)&((str _near *)0)->field)

#define ARRAY_LEN (array, struct) (sizeof(array)/sizeof(struct))

/*
 * Standard fixed point types
 */

typedef struct {
    sword	WAAH_low;
    sbyte	WAAH_high;
} WordAndAHalf} ;

typedef word BBFixedAsWord ;

typedef struct {
    byte	BBF_frac;
    sbyte	BBF_int;
} BBFixed} ;

typedef struct {
    byte	WBF_frac;
    sword	WBF_int;
} WBFixed} ;

typedef dword WWFixedAsDWord ;

typedef struct {
    word	WWF_frac;
    sword	WWF_int;
} WWFixed} ;

#define MakeWWFixed (fl) ((dword) ((fl)*65536))

/* These are for getting portions of a WWFixedAsDWord value. */
#define IntegerOf (op) ((word) (((WWFixedAsDWord) (op)) >> 16))
#define FractionOf (op) ((word) ((WWFixedAsDWord) (op)))

/* These are for addressing portions of a WWFixed value in memory. */
#define WWFixedToFrac (op) ((*((WWFixed *)&(op))).WWF_frac)
#define WWFixedToInt (op) ((*((WWFixed *)&(op))).WWF_int)

typedef struct {
    word        DWF_frac;
    sdword      DWF_int;
} DWFixed} ;

typedef WordFlags CPUFlags ;
#define CPU_OVERFLOW_OFFSET      (11)
#define CPU_OVERFLOW             (0x01 << CPU_OVERFLOW_OFFSET)
#define CPU_DIRECTION_OFFSET     (10)
#define CPU_DIRECTION            (0x01 << CPU_DIRECTION_OFFSET)
#define CPU_INTERRUPT_OFFSET     (9)
#define CPU_INTERRUPT            (0x01 << CPU_INTERRUPT_OFFSET)
#define CPU_TRAP_OFFSET          (8)
#define CPU_TRAP                 (0x01 << CPU_TRAP_OFFSET)
#define CPU_SIGN_OFFSET          (7)
#define CPU_SIGN                 (0x01 << CPU_SIGN_OFFSET)
#define CPU_ZERO_OFFSET          (6)
#define CPU_ZERO                 (0x01 << CPU_ZERO_OFFSET)
#define CPU_AUX_CARRY_OFFSET     (4)
#define CPU_AUX_CARRY            (0x01 << CPU_AUX_CARRY_OFFSET)
#define CPU_PARITY_OFFSET        (2)
#define CPU_PARITY               (0x01 << CPU_PARITY_OFFSET)
#define CPU_CARRY_OFFSET         (0)
#define CPU_CARRY                (0x01 << CPU_CARRY_OFFSET)

/***/

#define NO_ERROR_RETURNED  0

extern word     /*XXX*/
    _pascal ThreadGetError (void);

extern void
    _pascal ThreadSetError (word errno);

#ifdef __HIGHC__
pragma Alias(ThreadGetError, "THREADGETERROR");
pragma Alias(ThreadSetError, "THREADSETERROR");
#endif

#endif


geoworks.h

/* ----------------------------------------------------------------------------

    Copyright (c) GeoWorks 1992 -- All Rights Reserved

PROJECT:	PC/GEOS
FILE:		geoworks.h

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    doug	1/92		Initial version

DESCRIPTION:

    Certain mechanisms within PC/GEOS utilize a two-word indentification
    scheme in which the first word is a ManufacturerID, & the second
    is an enumeration defined by the manufacturer identified by the
    first word.  This file contains the enumerations for Geoworks's
    own ManufacturerID of MANUFACTURER_ID_GEOWORKS.

    NOTE:  Any developer assigned a ManufacturerID should have a file
           similar to this one, named after their own company, for the
           purpose of defining the meaning of enumerations when that
           ManufacturerID is used.

    WARNING:
           When updating this file, it is imperative that the assemmbly
           equivalent, Include/geoworks.def, be updated as well.

    ONE MORE THING:
           NOTHING should be placed in this file that can be made to
           reside in a more specialized include file.  Yes, that includes ""
           Notification data block structures!  This is not a substitute
           for a library-specific definition file;  Constants & structures
           pertinent to a specific library belong in a specific include ""
           file for that library.

    $Id: geoworks.h,v 1.123.1.10 98/05/22 18:12:08 mevissen Exp $

----------------------------------------------------------------------------*/

#ifndef	__GEOWORKS
#define __GEOWORKS

/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    MSG_META_NOTIFY & MSG_META_NOTIFY_WITH_DATA_BLOCK NotificationTypes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    MSG_META_NOTIFY & MSG_META_NOTIFY_WITH_DATA_BLOCK are general purpose
    notification messages, whose data format & meaning are defined by
    the "NotificationType" passed in the messages.

    This section contains the enumerations of the NT_type field of
    NotificationType for the case of NT_manuf = MANUFACTURER_ID_GEOWORKS.

    Name	Date		Description
    ----	----		-----------
    doug	1/92		Initial version

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */

typedef enum /* word */ {
    GWNT_INK    ,

    GWNT_GEN_CONTROL_NOTIFY_STATUS_CHANGE    ,

    GWNT_SELECT_STATE_CHANGE    ,
    GWNT_UNDO_STATE_CHANGE    ,

    GWNT_STYLE_CHANGE    ,
    GWNT_STYLE_SHEET_CHANGE    ,

    GWNT_TEXT_CHAR_ATTR_CHANGE    ,
    GWNT_TEXT_PARA_ATTR_CHANGE    ,
    GWNT_TEXT_TYPE_CHANGE    ,
    GWNT_TEXT_SELECTION_CHANGE    ,
    GWNT_TEXT_COUNT_CHANGE    ,

    GWNT_TEXT_STYLE_CHANGE    ,
    GWNT_FONT_CHANGE    ,
    GWNT_POINT_SIZE_CHANGE    ,
    GWNT_FONT_ATTR_CHANGE    ,
    GWNT_JUSTIFICATION_CHANGE    ,
    GWNT_TEXT_FG_COLOR_CHANGE    ,
    GWNT_TEXT_BG_COLOR_CHANGE    ,
    GWNT_TEXT_PARA_COLOR_CHANGE    ,
    GWNT_TEXT_BORDER_COLOR_CHANGE    ,

    GWNT_SEARCH_REPLACE_ENABLE_CHANGE    ,
    GWNT_SPELL_ENABLE_CHANGE    ,

    GWNT_CHART_TYPE_CHANGE    ,
    GWNT_CHART_GROUP_FLAGS    ,
    GWNT_CHART_AXIS_ATTRIBUTES    ,

    GWNT_GROBJ_CURRENT_TOOL_CHANGE    ,
    GWNT_GROBJ_BODY_SELECTION_STATE_CHANGE    ,
    GWNT_GROBJ_AREA_ATTR_CHANGE    ,
    GWNT_GROBJ_LINE_ATTR_CHANGE    ,
    GWNT_GROBJ_TEXT_ATTR_CHANGE    ,
    GWNT_GROBJ_BODY_INSTRUCTION_FLAGS_CHANGE    ,
    GWNT_GROBJ_GRADIENT_ATTR_CHANGE    ,

    GWNT_RULER_TYPE_CHANGE    ,
    GWNT_RULER_GRID_CHANGE    ,
    GWNT_RULER_GUIDE_CHANGE    ,

    GWNT_BITMAP_CURRENT_TOOL_CHANGE    ,
    GWNT_BITMAP_CURRNET_FORMAT_CHANGE    ,

    GWNT_FLAT_FILE_FIELD_PROPERTIES_STATUS_CHANGE    ,
    GWNT_FLAT_FILE_FIELD_LIST_CHANGE    ,
    GWNT_FLAT_FILE_RCP_STATUS_CHANGE    ,
    GWNT_FLAT_FILE_FIELD_APPEARANCE_CHANGE    ,
    GWNT_FLAT_FILE_DUMMY_CHANGE_2    ,
    GWNT_FLAT_FILE_DUMMY_CHANGE_3    ,

    GWNT_SPOOL_DOC_OR_PAPER_SIZE    ,

    GWNT_VIEW_STATE_CHANGE    ,

    GWNT_INK_HAS_TARGET    ,

    GWNT_PAGE_STATE_CHANGE    ,

    GWNT_DOCUMENT_CHANGE    ,

    GWNT_DISPLAY_CHANGE    ,
    GWNT_DISPLAY_LIST_CHANGE    ,

    GWNT_SPLINE_MARKER_SHAPE    ,
    GWNT_SPLINE_POINT    ,
    GWNT_SPLINE_POLYLINE    ,
    GWNT_SPLINE_SMOOTHNESS    ,
    GWNT_SPLINE_OPEN_CLOSE_CHANGE    ,

    GWNT_UNUSED_1    ,

    GWNT_SPREADSHEET_ACTIVE_CELL_CHANGE    ,
    GWNT_SPREADSHEET_EDIT_BAR_CHANGE    ,
    GWNT_SPREADSHEET_SELECTION_CHANGE    ,
    GWNT_SPREADSHEET_CELL_WIDTH_HEIGHT_CHANGE    ,
    GWNT_SPREADSHEET_DOC_ATTR_CHANGE    ,
    GWNT_SPREADSHEET_CELL_ATTR_CHANGE    ,
    GWNT_SPREADSHEET_CELL_NOTES_CHANGE    ,
    GWNT_SPREADSHEET_DATA_RANGE_CHANGE    ,

    GWNT_FLOAT_FORMAT_CHANGE    ,

    GWNT_MAP_APP_CHANGE    ,
    GWNT_MAP_LIBRARY_CHANGE    ,

    GWNT_TEXT_NAME_CHANGE    ,
    GWNT_CARD_BACK_CHANGE    ,

    GWNT_TEXT_OBJECT_HAS_FOCUS    ,
    GWNT_TEXT_CONTEXT    ,
    GWNT_TEXT_REPLACE_WITH_HWR    ,

    GWNT_HELP_CONTEXT_CHANGE    ,
    GWNT_FLOAT_FORMAT_INIT    ,
    GWNT_HARD_ICON_BAR_FUNCTION    ,
    GWNT_STARTUP_INDEXED_APP    ,
    GWNT_SPOOL_PRINTING_COMPLETE    ,
    GWNT_MODAL_WIN_CHANGE    ,
    GWNT_SPREADSHEET_NAME_CHANGE    ,
    GWNT_DOCUMENT_OPEN_COMPLETE    ,
    GWNT_EMAIL_SCAN_INBOX    ,
    GWNT_FOCUS_WINDOW_KBD_STATUS    ,
    GWNT_TAB_DOUBLE_CLICK    ,
    GWNT_PAGE_INFO_STATE_CHANGE    ,
    GWNT_CURSOR_POSITION_CHANGE    ,

    GWNT_FAX_NEW_JOB_CREATED    ,
    GWNT_FAX_NEW_JOB_COMPLETED    ,

    GWNT_EMAIL_DATABASE_CHANGE    ,
    GWNT_EMAIL_STATUS_CHANGE    ,
    GWNT_EMAIL_PAGE_PANEL_UPDATE    ,

    GWNT_PCCOM_DISPLAY_CHAR    ,
    GWNT_PCCOM_DISPLAY_STRING    ,
    GWNT_PCCOM_EXIT    ,

    GWNT_FONTS_ADDED    ,
    GWNT_FONTS_DELETED    ,

    GWNT_INK_GESTURE    ,
    GWNT_TEXT_REPLACE_GESTURE    ,

    GWNT_MAILBOX_SEND_CONTEXT    ,
    GWNT_PAGE_NAME_CHANGE    ,
    GWNT_GAME_STATUS_CHANGE    ,
    GWNT_DELETE_VARIABLE_GRAPHIC    ,
    GWNT_TEXT_HYPERLINKABILITY_CHANGE    ,
    GWNT_CONTENT_CONTEXT_CHANGE    ,
    GWNT_CONTENT_BOOK_CHANGE    ,
    GWNT_HYPERLINK_STATUS_CHANGE    ,

    GWNT_BEGIN_FAX_CONNECTION    ,
    GWNT_BEGIN_DATA_CONNECTION    ,
    GWNT_END_SERIAL_CONNECTION    ,
    GWNT_LOST_SERIAL_CONNECTION    ,

    GWNT_FAX_DESTINATION_CHANGE    ,
    GWNT_FAX_DIAL_ASSIST_CHANGE    ,
    GWNT_FAX_LAST_DESTINATIONS_CHANGE    ,
    GWNT_COVER_PAGE_CHANGE    ,
    GWNT_FOAM_DB_CHANGE    ,

    GWNT_INIT_FILE_CHANGE    ,
    GWNT_KEYBOARD_EVENT    ,
    GWNT_NAVIGATE_ENTRY_CHANGE    ,
    GWNT_NAVIGATE_DELETE_ENTRY    ,

    GWNT_UNUSED_2    ,
    GWNT_UNUSED_3    ,
    GWNT_UNUSED_4    ,
    GWNT_UNUSED_5    ,

    GWNT_CURRENT_COMPONENT_CHANGE    ,
    GWNT_CONTACT_LIST_CUR_SELECTION    ,

    GWNT_CONTACT_LOG_CONTACT_LOG_CHANGE    ,
    GWNT_CONTACT_LOG_RECENT_CALLS_CHANGE    ,
    GWNT_CONTACT_LOG_RECENT_FAXES_CHANGE    ,
    GWNT_CONTACT_LOG_RECENT_MESSAGES_CHANGE    ,

    GWNT_INDICATOR_LOG_EVENT    ,

    GWNT_RESPONDER_NOTIFICATION    ,

    GWNT_FOAM_AUTO_SAVE    ,
    GWNT_FOAM_GAINED_FULL_SCREEN_EXCL    ,
    GWNT_FOAM_LOST_FULL_SCREEN_EXCL    ,

    GWNT_ACCESS_POINT_CHANGE    ,

    GWNT_INDICATOR_REPLACE_ICON_GLYPH    ,
    GWNT_INDICATOR_REPLACE_TEXT_GLYPH    ,
    GWNT_INDICATOR_SET_ACTIVE_CALL    ,
    GWNT_INDICATOR_SET_NUM_UNREAD_DOCUMENTS    ,
    GWNT_INDICATOR_CHANGE_NUM_UNREAD_DOCUMENTS    ,
    GWNT_INDICATOR_CLEAR_NUM_UNREAD_DOCUMENTS    ,
    GWNT_INDICATOR_SET_NUM_OUTGOING_DOCUMENTS    ,
    GWNT_INDICATOR_CHANGE_NUM_OUTGOING_DOCUMENTS    ,
    GWNT_INDICATOR_SET_CUSTOM_NOTE    ,
    GWNT_INDICATOR_SET_MAIN_WINDOW_VISIBILITY    ,

    GWNT_VIEWER_DOCUMENT_STATUS_CHANGE    ,
    GWNT_PCMCIA_CARD_CHANGE    ,

    GWNT_INDICATOR_REFRESH_NOTIFY    ,

    GWNT_SECURITY_PIN_CODE_REQUEST    ,
    GWNT_SECURITY_LOCK_TIME_OUT    ,
    GWNT_SECURITY_LEVEL    ,

    GWNT_DATASTORE_CHANGE    ,

    GWNT_VIEWER_SHUTTING_DOWN    ,

    GWNT_INDICATOR_SET_TERMINATE_HANDLING    ,
    GWNT_INDICATOR_PUT_UP_FLASHING_NOTE    ,
    GWNT_INDICATOR_PUT_UP_INFORMATION_NOTE    ,
    GWNT_INDICATOR_HANDLE_ECI_CMT_TERMINATE_STATUS    ,
    GWNT_INDICATOR_HANDLE_ECI_NETWORK_TERMINATE_STATUS    ,

    GWNT_SECURITY_SYSTEM_LOCKED    ,

    GWNT_FOAM_IGNORE_BRING_TO_TOP    ,

    GWNT_VIEWER_DOCUMENT_CHANGE    ,

    GWNT_INK_DIGITIZER_COORDS    ,

    GWNT_VIEWER_LOAD_UNREAD_DOCUMENT    ,

    GWNT_LOGIN_INITIALIZE    ,
    GWNT_LOGIN_ATTACH    ,
    GWNT_LOGIN_DETACH    ,
    GWNT_PENELOPE_HARDWARE_NOTIFICATION    ,
    GWNT_PENELOPE_RADIO_STATUS_NOTIFICATION    ,

    GWNT_UI_ZOOM_LEVEL    ,
    GWNT_KEYBOARD_MAP_CHANGE    ,

    GWNT_CONTACT_SIM_LIST_CUR_SELECTION    ,
    GWNT_CONTACT_SIM_LIST_CONTACT_CHANGE    ,
    GWNT_CONTACT_SIM_LIST_SELECTION_CHANGE    ,
    GWNT_CONTACT_SIM_LIST_FDN_STATUS    ,

} GeoWorksNotificationType} ;

/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    GenApplication GCNList enums
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    The UI library's GenApplicationClass supports its very own GCN
    (General Change Notification) system separate from the kernel's.
    Lists within this system are identified by a GCNListType, whose
    enumerations are seperate from that of the kernel's GCN system.

    This section contains the enumerations of the GCNLT_type field for
    GCNListType used within a GenApplication for the case of
    GCNLT_manuf = MANUFACTURER_ID_GEOWORKS.

    !!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!

    NOTE:	The entrys of the form PADDING_GAGCNLT_INVALID_ITEM_xxx
        (where xxx is a number) are there to make the compiler give
        the real items numbers that are multiples of two.  If you
        add an item but forget to add a padding/spacer item then
        you will be very, very unhappy.

    !!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!

    NOTE:  Be sure to update the "C" version of this file as
           well -- they should always match.

    Name	Date		Description
    ----	----		-----------
    doug	1/92		Initial version
    JDM	92.07.23	Added the padding entries to accomodate the
                need for valid entries having values that
                are multiples of two (2).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */

typedef enum /* word */ {
    GAGCNLT_SELF_LOAD_OPTIONS     = 0x6800,	/* hi mom */
    GAGCNLT_GEN_CONTROL_NOTIFY_STATUS_CHANGE     = 0x6802,

    GAGCNLT_APP_TARGET_NOTIFY_SELECT_STATE_CHANGE     = 0x6804,
    GAGCNLT_EDIT_CONTROL_NOTIFY_UNDO_STATE_CHANGE     = 0x6806,

    GAGCNLT_APP_TARGET_NOTIFY_TEXT_CHAR_ATTR_CHANGE     = 0x6808,
    GAGCNLT_APP_TARGET_NOTIFY_TEXT_PARA_ATTR_CHANGE     = 0x680a,
    GAGCNLT_APP_TARGET_NOTIFY_TEXT_TYPE_CHANGE     = 0x680c,
    GAGCNLT_APP_TARGET_NOTIFY_TEXT_SELECTION_CHANGE     = 0x680e,
    GAGCNLT_APP_TARGET_NOTIFY_TEXT_COUNT_CHANGE     = 0x6810,
    GAGCNLT_APP_TARGET_NOTIFY_STYLE_TEXT_CHANGE     = 0x6812,
    GAGCNLT_APP_TARGET_NOTIFY_STYLE_SHEET_TEXT_CHANGE     = 0x6814,

    GAGCNLT_APP_TARGET_NOTIFY_TEXT_STYLE_CHANGE     = 0x6816,
    GAGCNLT_APP_TARGET_NOTIFY_FONT_CHANGE     = 0x6818,
    GAGCNLT_APP_TARGET_NOTIFY_POINT_SIZE_CHANGE     = 0x681a,
    GAGCNLT_APP_TARGET_NOTIFY_FONT_ATTR_CHANGE     = 0x681c,
    GAGCNLT_APP_TARGET_NOTIFY_JUSTIFICATION_CHANGE     = 0x681e,
    GAGCNLT_APP_TARGET_NOTIFY_TEXT_FG_COLOR_CHANGE     = 0x6820,
    GAGCNLT_APP_TARGET_NOTIFY_TEXT_BG_COLOR_CHANGE     = 0x6822,
    GAGCNLT_APP_TARGET_NOTIFY_PARA_COLOR_CHANGE     = 0x6824,
    GAGCNLT_APP_TARGET_NOTIFY_BORDER_COLOR_CHANGE     = 0x6826,

    GAGCNLT_APP_TARGET_NOTIFY_SEARCH_SPELL_CHANGE     = 0x6828,
    GAGCNLT_APP_TARGET_NOTIFY_SEARCH_REPLACE_CHANGE     = 0x682a,

    GAGCNLT_APP_TARGET_NOTIFY_CHART_TYPE_CHANGE     = 0x682c,
    GAGCNLT_APP_TARGET_NOTIFY_CHART_GROUP_FLAGS     = 0x682e,
    GAGCNLT_APP_TARGET_NOTIFY_CHART_AXIS_ATTRIBUTES     = 0x6830,
    GAGCNLT_APP_TARGET_NOTIFY_CHART_MARKER_SHAPE     = 0x6832,

    GAGCNLT_APP_TARGET_NOTIFY_GROBJ_CURRENT_TOOL_CHANGE     = 0x6834,
    GAGCNLT_APP_TARGET_NOTIFY_GROBJ_BODY_SELECTION_STATE_CHANGE     = 0x6836,
    GAGCNLT_APP_TARGET_NOTIFY_GROBJ_AREA_ATTR_CHANGE     = 0x6838,
    GAGCNLT_APP_TARGET_NOTIFY_GROBJ_LINE_ATTR_CHANGE     = 0x683a,
    GAGCNLT_APP_TARGET_NOTIFY_GROBJ_TEXT_ATTR_CHANGE     = 0x683c,
    GAGCNLT_APP_TARGET_NOTIFY_STYLE_GROBJ_CHANGE     = 0x683e,
    GAGCNLT_APP_TARGET_NOTIFY_STYLE_SHEET_GROBJ_CHANGE     = 0x6840,
    GAGCNLT_APP_TARGET_NOTIFY_GROBJ_BODY_INSTRUCTION_FLAGS_CHANGE     = 0x6842,
    GAGCNLT_APP_TARGET_NOTIFY_GROBJ_GRADIENT_ATTR_CHANGE     = 0x6844,

    GAGCNLT_APP_TARGET_NOTIFY_RULER_TYPE_CHANGE     = 0x6846,
    GAGCNLT_APP_TARGET_NOTIFY_RULER_GRID_CHANGE     = 0x6848,
    GAGCNLT_TEXT_RULER_OBJECTS     = 0x684a,
    GAGCNLT_APP_TARGET_NOTIFY_RULER_GUIDE_CHANGE     = 0x684c,

    GAGCNLT_APP_TARGET_NOTIFY_BITMAP_CURRENT_TOOL_CHANGE     = 0x684e,
    GAGCNLT_APP_TARGET_NOTIFY_BITMAP_CURRENT_FORMAT_CHANGE     = 0x6850,

    GAGCNLT_APP_TARGET_NOTIFY_FLAT_FILE_FIELD_PROPERTIES_STATUS_CHANGE     = 0x6852,
    GAGCNLT_APP_TARGET_NOTIFY_FLAT_FILE_FIELD_LIST_CHANGE     = 0x6854,
    GAGCNLT_APP_TARGET_NOTIFY_FLAT_FILE_RCP_STATUS_CHANGE     = 0x6856,
    GAGCNLT_APP_TARGET_NOTIFY_FLAT_FILE_FIELD_APPEARANCE_CHANGE     = 0x6858,
    GAGCNLT_APP_TARGET_NOTIFY_FLAT_FILE_DUMMY_CHANGE_2     = 0x685a,
    GAGCNLT_APP_TARGET_NOTIFY_FLAT_FILE_DUMMY_CHANGE_3     = 0x685c,

    GAGCNLT_APP_NOTIFY_DOC_SIZE_CHANGE     = 0x685e,
    GAGCNLT_APP_NOTIFY_PAPER_SIZE_CHANGE     = 0x6860,

    GAGCNLT_APP_TARGET_NOTIFY_VIEW_STATE_CHANGE     = 0x6862,
    GAGCNLT_CONTROLLED_GEN_VIEW_OBJECTS     = 0x6864,

    GAGCNLT_APP_TARGET_NOTIFY_INK_STATE_CHANGE     = 0x6866,
    GAGCNLT_CONTROLLED_INK_OBJECTS     = 0x6868,

    GAGCNLT_APP_TARGET_NOTIFY_PAGE_STATE_CHANGE     = 0x686a,

    GAGCNLT_APP_TARGET_NOTIFY_DOCUMENT_CHANGE     = 0x686c,

    GAGCNLT_APP_TARGET_NOTIFY_DISPLAY_CHANGE     = 0x686e,
    GAGCNLT_APP_TARGET_NOTIFY_DISPLAY_LIST_CHANGE     = 0x6870,

    GAGCNLT_APP_TARGET_NOTIFY_SPLINE_MARKER_SHAPE     = 0x6872,
    GAGCNLT_APP_TARGET_NOTIFY_SPLINE_POINT     = 0x6874,
    GAGCNLT_APP_TARGET_NOTIFY_SPLINE_POLYLINE     = 0x6876,
    GAGCNLT_APP_TARGET_NOTIFY_SPLINE_SMOOTHNESS     = 0x6878,
    GAGCNLT_APP_TARGET_NOTIFY_SPLINE_OPEN_CLOSE_CHANGE     = 0x687a,

    GAGCNLT_APP_TARGET_NOTIFY_SPREADSHEET_ACTIVE_CELL_CHANGE     = 0x687c,
    GAGCNLT_APP_TARGET_NOTIFY_SPREADSHEET_EDIT_BAR_CHANGE     = 0x687e,
    GAGCNLT_APP_TARGET_NOTIFY_SPREADSHEET_SELECTION_CHANGE     = 0x6880,
    GAGCNLT_APP_TARGET_NOTIFY_SPREADSHEET_CELL_WIDTH_HEIGHT_CHANGE     = 0x6882,
    GAGCNLT_APP_TARGET_NOTIFY_SPREADSHEET_DOC_ATTR_CHANGE     = 0x6884,
    GAGCNLT_APP_TARGET_NOTIFY_SPREADSHEET_CELL_ATTR_CHANGE     = 0x6886,
    GAGCNLT_APP_TARGET_NOTIFY_SPREADSHEET_CELL_NOTES_CHANGE     = 0x6888,
    GAGCNLT_APP_TARGET_NOTIFY_SPREADSHEET_DATA_RANGE_CHANGE     = 0x688a,

    GAGCNLT_APP_TARGET_NOTIFY_TEXT_NAME_CHANGE     = 0x688c,

    GAGCNLT_FLOAT_FORMAT_CHANGE     = 0x688e,

    GAGCNLT_DISPLAY_OBJECTS_WITH_RULERS     = 0x6890,

    GAGCNLT_APP_TARGET_NOTIFY_APP_CHANGE     = 0x6892,
    GAGCNLT_APP_TARGET_NOTIFY_LIBRARY_CHANGE     = 0x6894,

    GAGCNLT_WINDOWS     = 0x6896,
    GAGCNLT_STARTUP_LOAD_OPTIONS     = 0x6898,

    GAGCNLT_APP_TARGET_NOTIFY_CARD_BACK_CHANGE     = 0x689a,

    /* *** TO BE MOVED LATER ***/

    GAGCNLT_NOTIFY_FOCUS_TEXT_OBJECT     = 0x689c,

    GAGCNLT_NOTIFY_TEXT_CONTEXT     = 0x689e,

    GAGCNLT_NOTIFY_HELP_CONTEXT_CHANGE     = 0x68a0,

    GAGCNLT_FLOAT_FORMAT_INIT     = 0x68a2,

    GAGCNLT_ALWAYS_INTERACTABLE_WINDOWS     = 0x68a4,
    GAGCNLT_USER_DO_DIALOGS     = 0x68a6,

    GAGCNLT_MODAL_WIN_CHANGE     = 0x68a8,
    GAGCNLT_APP_TARGET_NOTIFY_SPREADSHEET_NAME_CHANGE     = 0x68aa,
    GAGCNLT_CONTROLLERS_WITHIN_USER_DO_DIALOGS     = 0x68ac,
    GAGCNLT_FOCUS_WINDOW_KBD_STATUS     = 0x68ae,
    GAGCNLT_APP_TARGET_NOTIFY_PAGE_INFO_STATE_CHANGE     = 0x68b0,
    GAGCNLT_APP_TARGET_NOTIFY_CURSOR_POSITION_CHANGE     = 0x68b2,
    GAGCNLT_MAILBOX_SEND_CONTROL     = 0x68b4,
    GAGCNLT_APP_TARGET_NOTIFY_PAGE_NAME_CHANGE     = 0x68b6,
    GAGCNLT_GAME_STATUS_CHANGE     = 0x68b8,
    GAGCNLT_APP_TARGET_NOTIFY_TEXT_HYPERLINKABILITY_CHANGE     = 0x68ba,
    GAGCNLT_NOTIFY_CONTENT_CONTEXT_CHANGE     = 0x68bc,
    GAGCNLT_NOTIFY_CONTENT_BOOK_CHANGE     = 0x68be,
    GAGCNLT_APP_TARGET_NOTIFY_HYPERLINK_STATUS_CHANGE     = 0x68c0,
    GAGCNLT_NOTIFY_NAVIGATE_ENTRY_CHANGE     = 0x68c2,

    GAGCNLT_FOAM_NOTIFICATIONS     = 0x68c4,

    GAGCNLT_FULL_SCREEN_EXCL_CHANGE     = 0x68c6,

    GAGCNLT_VIEWER_NOTIFICATIONS     = 0x68c8,

    GAGCNLT_DATASTORE_CHANGE     = 0x68ca

} GeoWorksGenAppGCNListType} ;

typedef enum /* word */ {
    MGCNLT_ACTIVE_LIST    =0x0000,
    MGCNLT_APP_STARTUP    =0x0002
} GeoWorksMetaGCNListType} ;

typedef enum {
    VCGCNLT_TARGET_NOTIFY_TEXT_PARA_ATTR_CHANGE     = 0x4a00,
    PADDING_VCGCNLT_INVALID_ITEM_000
} GeoWorksVisContentGCNListType} ;
/*
 ****************************************************************************
 *	DESCRIPTION:	Transfer item types
 ****************************************************************************
 */

typedef enum /* word */ {
    CIF_TEXT    ,
    CIF_GRAPHICS_STRING    ,
    CIF_FILES    ,
    CIF_SPREADSHEET    ,
    CIF_INK    ,
    CIF_GROBJ    ,
    CIF_GEODEX    ,
    CIF_BITMAP    ,
    CIF_SOUND_SYNTH    ,
    CIF_SOUND_SAMPLE
} ClipboardItemFormat} ;

/*
 ****************************************************************************
 *	DESCRIPTION:	Text Object variable types
 ****************************************************************************
 */

typedef enum {
    VTVT_PAGE_NUMBER    ,
    VTVT_PAGE_NUMBER_IN_SECTION    ,
    VTVT_NUMBER_OF_PAGES    ,
    VTVT_NUMBER_OF_PAGES_IN_SECTION    ,
    VTVT_SECTION_NUMBER    ,
    VTVT_NUMBER_OF_SECTIONS    ,
    VTVT_CREATION_DATE_TIME    ,
    VTVT_MODIFICATION_DATE_TIME    ,
    VTVT_CURRENT_DATE_TIME    ,
    VTVT_STORED_DATE_TIME    ,
    VTVT_CONTEXT_PAGE    ,
    VTVT_CONTEXT_PAGE_IN_SECTION    ,
    VTVT_CONTEXT_SECTION    ,
    VTVT_CONTEXT_NAME    ,
    VTVT_HOTSPOT    ,
} VisTextVariableType} ;

/*
 ****************************************************************************
 *	DESCRIPTION:	Escape Codes for GR_ESCAPE GString Elements
 ****************************************************************************
 */

typedef enum /* word */ {
    GGSEC_HOTSPOT     = 0x4200, 	    	    	/* used by Condo */
} GeoworksGStringEscapeCode} ;

#endif


Objects\gFieldC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gFieldC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenFieldClass
 *
 *	    $Id: gFieldC.goh,v 1.26.6.1 96/04/28 08:31:26 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <Objects/metaC.goh>
@include  <ui.goh>

@class GenFieldClass, GenClass;

@message void MSG_GEN_FIELD_SET_VIS_PARENT ();		/* INTERNAL */
@message void MSG_GEN_FIELD_RESTORE_APPS ();		/* INTERNAL */
@message void MSG_GEN_FIELD_RESTORE_NEXT_APP ();		/* INTERNAL */
@message void MSG_GEN_FIELD_RESTORE_APP ();		/* INTERNAL */
@message void MSG_GEN_FIELD_SHUTDOWN_APPS ();		/* INTERNAL */
@message word MSG_GEN_FIELD_APP_STARTUP_NOTIFY () = cx;  /* INTERNAL */
@message void MSG_GEN_FIELD_APP_STARTUP_DONE ();		/* INTERNAL */
@message void MSG_GEN_FIELD_ADD_GEN_APPLICATION (	/* INTERNAL */
                            optr genApp = cx:dx,
                CompChildFlags flags = bp); /* XXX */
@message void MSG_GEN_FIELD_REMOVE_GEN_APPLICATION (	/* INTERNAL */
                            optr genApp = cx:dx); /* XXX */
@message void MSG_GEN_FIELD_MOVE_GEN_APPLICATION (	/* INTERNAL */
                            optr genApp = cx:dx,
                            CompChildFlags flags = bp); /* XXX */
@message void MSG_GEN_FIELD_ORDER_GEN_APPLICATION_LIST (); /* INTERNAL *//* XXX */
@message void MSG_GEN_FIELD_RESTORE_APP_ACK (	    	/* INTERNAL */
                            Handle geode = cx,
                Boolean errorFlag = dx,
                            /*
                             * The exact type of the ackID depends on the
                             * app. It will always be a word.
                             */
                word ackID = bp); /* XXX */
@message void MSG_GEN_FIELD_NO_APPS_RESTORED ();	    	/* INTERNAL *//* XXX */

@message void MSG_GEN_FIELD_ADD_APP_INSTANCE_REFERENCE (
                Handle appInstanceReference = dx,
                Handle appObjectBlock = bp);	/* XXX */
@message void MSG_GEN_FIELD_ADD_APP_INSTANCE_REFERENCE_HOLDER (
                Handle appObjectBlock = bp);	/* XXX */

@message void MSG_GEN_FIELD_PROCESS_EXIT (Handle process = cx); /* INTERNAL */
                                                    /* XXX */

@message void MSG_GEN_FIELD_RESET_BG ();			/* XXX */
@message void MSG_GEN_FIELD_ENABLE_BITMAP ();		/* XXX */

@message void MSG_GEN_FIELD_CREATE_EXPRESS_MENU ();	/* INTERNAL */

@message ChunkHandle MSG_GEN_FIELD_CREATE_SPECIFIC_EXPRESS_SUBGROUP (
                optr parent = cx:dx,
                CompChildFlags flags = bp) = dx; /* XXX */
@message void MSG_GEN_FIELD_DISABLE_EXPRESS_MENU ();
@message void MSG_GEN_FIELD_ENABLE_EXPRESS_MENU ();
@message void MSG_GEN_FIELD_UNUSED_3 ();
@message void MSG_GEN_FIELD_UNUSED_4 ();
@message void MSG_GEN_FIELD_EXIT_TO_DOS ();		/* XXX */

@message void MSG_GEN_FIELD_EXIT_TO_DOS_CONFIRMATION_RESPONSE (); /* INTERNAL */
@message void MSG_GEN_FIELD_LOAD_DEFAULT_LAUNCHER ();	/* INTERNAL */
@message void MSG_GEN_FIELD_ABOUT_TO_CLOSE ();	/* XXX */ /* INTERNAL */

@message void MSG_GEN_FIELD_UNUSED_5 ();

@message void MSG_GEN_FIELD_ABOUT_TO_DETACH_COMPLETE ();	/* INTERNAL */
@message void MSG_GEN_FIELD_OPEN_WINDOW_LIST ();

@message optr MSG_GEN_FIELD_GET_TOP_GEN_APPLICATION () = cx:dx;	/* XXX */
@message UILaunchModel MSG_GEN_FIELD_GET_LAUNCH_MODEL ();
@message void MSG_GEN_FIELD_SHUTDOWN_CONTROL_RESPONSE ();    /* INTERNAL */

                                /* INTERNAL */
@message void MSG_GEN_FIELD_ACTIVATE_UPDATE (	    	/* INTERNAL */
                                Handle geode = cx,
                Handle appLaunchBlock = dx);
@message void MSG_GEN_FIELD_ACTIVATE_DISMISS (	    	/* INTERNAL */
                                Handle geode = cx,
                Handle appLaunchBlock = dx);

@protominor UINewForZoomer

@message void MSG_GEN_FIELD_ACTIVATE_INITIATE (	    	/* INTERNAL */
                                Handle appLaunchBlock = dx);

@message void MSG_GEN_FIELD_APP_NO_LONGER_EXITING ();	/* INTERNAL */

@protoreset

@vardata void TEMP_GEN_FIELD_LOADING_DEFAULT_LAUNCHER;	/* INTERNAL */
@vardata void TEMP_GEN_FIELD_EXIT_TO_DOS_PENDING;	/* INTERNAL */
@vardata GeodeToken TEMP_GEN_FIELD_DEFAULT_LAUNCHER_ID;	/* INTERNAL */

typedef struct {
    optr	AD_dialog;
    Handle	AD_appLaunchBlock;
    Handle	AD_geode;
    ChunkHandle AD_savedBlankMoniker;
} ActivationData} ;

@vardata ActivationData TEMP_GEN_FIELD_ACTIVATION_DIALOG;	/* INTERNAL */
@vardata void TEMP_GEN_FIELD_OPEN_APP_ON_TOP;			/* INTERNAL */

typedef ByteFlags GenFieldFlags ;
#define GFF_DETACHING 	    	    0x80
#define GFF_LOAD_BITMAP 	    	    0x40
#define GFF_RESTORING_APPS 	    0x20
#define GFF_NEEDS_WORKSPACE_MENU     0x10
#define GFF_HAS_DEFAULT_LAUNCHER     0x08
#define GFF_NEED_DEFAULT_LAUNCHER    0x04
#define GFF_QUIT_ON_CLOSE    	    0x02
#define GFF_LOAD_DEFAULT_LAUNCHER_WHEN_NEXT_PROCESS_EXITS    	    0x01

    @instance GenFieldFlags	GFI_flags = 0;
    @instance optr		GFI_visParent = 0;
    @instance byte		GFI_numDetachedApps = 0;
    @instance byte		GFI_numRestartedApps = 0;
    @instance byte		GFI_numAttachingApps = 0;
    @instance ChunkHandle	GFI_apps = 0;
    @instance ChunkHandle	GFI_processes = 0;
    @instance ChunkHandle	GFI_genApplications = 0;
    @instance byte		GFI_numAppsToCheck = 0;
    @instance optr		GFI_notificationDestination = 0;

@endc

@endlib


Objects\gFSelC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gFSelC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenFileSelectorClass
 *
 *	$Id: gFSelC.goh,v 1.54.1.3 97/11/11 18:29:20 kertes Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

#include  <file.h>
#include  <geode.h>
@include  <ui.goh>
@include  <Objects/genC.goh>
#include  <fileEnum.h> 		/* for DosFileInfoStruct */

@class GenFileSelectorClass, GenClass;

typedef WordFlags FileSelectorFileCriteria ;

#define FSFC_DIRS 			0x8000
#define FSFC_NON_GEOS_FILES 		0x4000
#define FSFC_GEOS_EXECUTABLES 		0x2000
#define FSFC_GEOS_NON_EXECUTABLES 	0x1000
#define FSFC_MASK_CASE_INSENSITIVE 	0x0800
#define FSFC_FILE_FILTER 		0x0400
#define FSFC_FILTER_IS_C 		0x0200
#define FSFC_TOKEN_NO_ID 		0x0100
#define FSFC_USE_MASK_FOR_DIRS 		0x0080
#define FSFC_USE_FAKE_FILE_SYSTEM 	0x0040

/*
 *	general attributes for FileSelector
 */
typedef WordFlags FileSelectorAttrs ;

#define FSA_ALLOW_CHANGE_DIRS 		0x8000
/* note skipped bit here */
#define FSA_SHOW_FIXED_DISKS_ONLY 	0x2000
#define FSA_SHOW_FILES_DISABLED 		0x1000
#define FSA_HAS_CLOSE_DIR_BUTTON 	0x0800
#define FSA_HAS_OPEN_DIR_BUTTON 		0x0400
#define FSA_HAS_DOCUMENT_BUTTON 		0x0200
#define FSA_HAS_CHANGE_DIRECTORY_LIST 	0x0100
#define FSA_HAS_CHANGE_DRIVE_LIST 	0x0080
#define FSA_HAS_FILE_LIST 		0x0040
#define FSA_USE_VIRTUAL_ROOT 		0x0020
#define FSA_SHOW_WRITABLE_DISKS_ONLY 	0x0010

/*
 *	flags sent to AD as notification of new selection
 */

typedef ByteEnum GenFileSelectorEntryType ;
#define GFSET_FILE  0
#define GFSET_SUBDIR  1
#define GFSET_VOLUME  2

typedef WordFlags GenFileSelectorEntryFlags ;

#define GFSEF_TYPE 		0xc000
#define GFSEF_OPEN 		0x2000
#define GFSEF_NO_ENTRIES 	0x1000
#define GFSEF_ERROR 		0x0800
#define GFSEF_TEMPLATE 		0x0400
#define GFSEF_SHARED_MULTIPLE 	0x0200
#define GFSEF_SHARED_SINGLE 	0x0100
#define GFSEF_READ_ONLY 		0x0080
#define GFSEF_PARENT_DIR 	0x0040
#define GFSEF_DISABLED           0x0020 /* set if cur. selection is disabled */

#define GFSEF_TYPE_OFFSET 	14

#define GFS_GET_ENTRY_TYPE (A) (((A) & GFSEF_TYPE) >> GFSEF_TYPE_OFFSET)

/* common types */

typedef FileLongName GenFileSelectorMask ;
typedef VolumeName GenFileSelectorVolume ;
typedef FileLongName GenFileSelectorSelection ;

#define GFS_GET_ENTRY_NUMBER (A) ((word) ((A) >> 16))
#define GFS_GET_ENTRY_FLAGS (A)	((word) (A))

@message dword MSG_GEN_FILE_SELECTOR_GET_SELECTION (
                char *selection = cx:dx) = ax.bp;

@message Boolean MSG_GEN_FILE_SELECTOR_SET_SELECTION (
                char *selection = cx:dx) = carry;

#define GFS_GET_FULL_SELECTION_PATH_DISK_HANDLE (A) ((DiskHandle) ((A) >> 16))

@message dword MSG_GEN_FILE_SELECTOR_GET_FULL_SELECTION_PATH (
                char *selection = cx:dx) = ax.bp;

@message Boolean MSG_GEN_FILE_SELECTOR_SET_FULL_SELECTION_PATH (
                char *selection = cx:dx,
                    DiskHandle diskHandle = bp) = carry;

@message void MSG_GEN_FILE_SELECTOR_GET_MASK (char *mask = cx:dx);

@message void MSG_GEN_FILE_SELECTOR_SET_MASK (char *mask = cx:dx);

#define GET_MATCH_FILE_ATTRS (attr)	((byte) (attr))
#define GET_MISMATCH_FILE_ATTRS (attr)	((byte) ((attr) >> 8))
@message word MSG_GEN_FILE_SELECTOR_GET_FILE_ATTRS () = cx;

@message void MSG_GEN_FILE_SELECTOR_SET_FILE_ATTRS (
                                FileAttrs setAttrs = cl,
                                FileAttrs clearAttrs = ch);

typedef struct {
    GeodeToken	GTP_token;
    word	GTP_unused;
} GetTokenCreatorParams} ;

@message void MSG_GEN_FILE_SELECTOR_GET_TOKEN (		/* XXX */
            GetTokenCreatorParams *retValue = cxdxbpax);

/*
 *	use SET_TOKEN_CHARS macro to define "tokenChars" to pass
 *	example usage:
 *	@call myObj::MSG_GEN_FILE_SELECTOR_SET_TOKEN(
 *				SET_TOKEN_CHARS('D','E','S','K'),
 *				MANUFACTURER_ID_GEOWORKS);
 */
#define SET_TOKEN_CHARS (A, B, C, D) ((A) | ((B) << 8) | ((C) << 16) | ((D) << 24))

@message void MSG_GEN_FILE_SELECTOR_SET_TOKEN (dword tokenChars = cx:dx,
                    ManufacturerID manufacturerID = bp); /* XXX */

@message void MSG_GEN_FILE_SELECTOR_GET_CREATOR (	/* XXX */
            GetTokenCreatorParams *retValue = cxdxbpax);

@message void MSG_GEN_FILE_SELECTOR_SET_CREATOR (dword tokenChars = cx:dx,
                    ManufacturerID manufacturerID = bp); /* XXX */

#define GET_MATCH_ATTRS (attr) (((attr) >> 16) & 0xffff)
#define GET_MISMATCH_ATTRS (attr) ((attr) & 0xffff)
@message dword MSG_GEN_FILE_SELECTOR_GET_GEODE_ATTRS () = cx:dx; /* XXX */

@message void MSG_GEN_FILE_SELECTOR_SET_GEODE_ATTRS (	/* XXX */
                    GeodeAttrs matchGeodeAttrs = cx,
                    GeodeAttrs mismatchGeodeAttrs = dx);

typedef struct {
    Message		GAP_message;
    word		GAP_unused;
    optr		GAP_output;
} GetActionParams} ;

@message void MSG_GEN_FILE_SELECTOR_GET_ACTION (		/* XXX */
                    GetActionParams *retValue = bpaxdxcx);

@message void MSG_GEN_FILE_SELECTOR_SET_ACTION (
                                    optr actionOD = cx:dx,
                    Message actionMessage = bp); /* XXX */

@message FileSelectorAttrs MSG_GEN_FILE_SELECTOR_GET_ATTRS () = cx; /* XXX */

@message void MSG_GEN_FILE_SELECTOR_SET_ATTRS (
            FileSelectorAttrs attributes = cx); /* XXX */

@message FileSelectorFileCriteria
     MSG_GEN_FILE_SELECTOR_GET_FILE_CRITERIA	 () = cx;	/* XXX */

@message void MSG_GEN_FILE_SELECTOR_SET_FILE_CRITERIA (
            FileSelectorFileCriteria fileCriteria = cx); /* XXX */

@message void MSG_GEN_FILE_SELECTOR_RESCAN ();

@message void MSG_GEN_FILE_SELECTOR_UP_DIRECTORY ();

@message void MSG_GEN_FILE_SELECTOR_UNUSED ();	/* REMOVE */

@message Boolean MSG_GEN_FILE_SELECTOR_OPEN_ENTRY (word entryNumber = cx) = carry;

@message Boolean MSG_GEN_FILE_SELECTOR_SUSPEND () = carry;

@message Boolean MSG_GEN_FILE_SELECTOR_END_SUSPEND () = carry;

@message Boolean MSG_GEN_FILE_SELECTOR_GET_DESTINATION_PATH (char *buffer = dx:bp, word bufSize = cx) = carry;

typedef Boolean GenFileSelectorFilterRoutine  (optr oself,
                          FileEnumCallbackData *fecd,
                          word frame);
typedef struct {
    GenFileSelectorFilterRoutine *filterRoutine;
    const FileExtAttrDesc	*filterAttrs;
} GenFileSelectorGetFilterRoutineResults} ;

@message void MSG_GEN_FILE_SELECTOR_GET_FILTER_ROUTINE (GenFileSelectorGetFilterRoutineResults *filter = axcxdxbp);

@prototype void GEN_FILE_SELECTOR_NOTIFICATION_MSG (
                                word entryNum = cx,
                GenFileSelectorEntryFlags entryFlags = bp);

@protominor	NewForJediAndBeyond

@message void MSG_GEN_FILE_SELECTOR_DELETE_SELECTION ();

@protoreset

@protominor	UINewForResponder

@message vfptr MSG_GEN_FILE_SELECTOR_GET_FILE_ENUM_ROUTINE () = cx:ax;

@message void MSG_GEN_FILE_SELECTOR_FAKE_PATH_GET (char *buffer = cx:dx);
/*
 * Context:	Sent when we need the path of a fake FS..  mostly for
 * 		moniker purposes.
 *
 *		Will return a dummy volume name, "[Dummy]", for a
 *		RESPONDER pccom fake file selector.
 *
 * Source:	OLFileSelectorRequestMoniker
 * Destination: GenFileSelector object using fake file system
 * Interception:Don't call super class
 *
 * Pass:	buffer of size PATH_BUFFER_SIZE buffer
 *
 * Return:	buffer, null-terminated, includes full path and volume name ""
 *
 */

@message word MSG_GEN_FILE_SELECTOR_FAKE_VOLUME_NAME_GET (word drive number = cx,
                             char *buffer = dx:bp) = ax;
/*
 *
 * Context:	Sent when we need the volume name for a given drive
 *		either for the change drive popup or for the top
 *		moniker, mostly.
 *
 *		Will return a dummy string, "C:[Dummy]", for a
 *		RESPONDER pccom fake file selector.
 *
 * Source:	Global
 * Destination: GenFileSelector object using fake file system
 * Interception:Don't call super class
 *
 * Pass:	drive number or zero for current
 *		buffer to write it to
 *
 * Return:	non-zero on error
 *    		buffer, null-terminated, filled with drive and volume name
 */

@message word MSG_GEN_FILE_SELECTOR_FAKE_ASSERT_HAVE_VOLUME_DATA () = ax;

@message word MSG_GEN_FILE_SELECTOR_FAKE_DRIVE_CHANGE (word driveNumber = cx,
                              char *buffer = bp:dx ) = ax;
@message void MSG_GEN_FILE_SELECTOR_FAKE_FLUSH_CACHES ();

@message void MSG_GEN_FILE_SELECTOR_GET_SELECTION_TOKEN (GeodeToken *token = cx:dx);
/*
 *
 * Context:	Returns the GeodeToken of the selected file.  If the file is
 *              a DOS file the dos extension (including the dot) is returned.
 *
 * Source:	Global
 * Destination: GenFileSelector object
 * Interception:Don't call super class
 *
 * Pass:	GeodeToken buffer
 *
 * Return:	buffer, filled with GeodeToken or DOS extension.
 */

@protoreset

/*
 * 	VarData
 */
    @vardata void TEMP_GEN_FILE_SELECTOR_DATA; /* Not to be used in .goc file */

    @vardata GeodeToken	ATTR_GEN_FILE_SELECTOR_TOKEN_MATCH;
    @vardata GeodeToken	ATTR_GEN_FILE_SELECTOR_CREATOR_MATCH;

    typedef struct {
    FileAttrs GFSFA_match;
    FileAttrs GFSFA_mismatch;
    } GenFileSelectorFileAttrs    } ;
    @vardata GenFileSelectorFileAttrs ATTR_GEN_FILE_SELECTOR_FILE_ATTR;

    typedef struct {
    GeodeAttrs GFSGA_match;
    GeodeAttrs GFSGA_mismatch;
    } GenFileSelectorGeodeAttrs    } ;
    @vardata GenFileSelectorGeodeAttrs ATTR_GEN_FILE_SELECTOR_GEODE_ATTR;

    @vardata GenFileSelectorMask ATTR_GEN_FILE_SELECTOR_NAME_MASK;

    @vardata GenFilePath ATTR_GEN_FILE_SELECTOR_VIRTUAL_ROOT;

    @vardata word HINT_FILE_SELECTOR_NUMBER_OF_FILES_TO_SHOW;

typedef ByteEnum GenFileSelectorScalableUICommand ;
#define GFSSUIC_SET_FEATURES_IF_APP_FEATURE_ON  0
#define GFSSUIC_SET_FEATURES_IF_APP_FEATURE_OFF  1
#define GFSSUIC_ADD_FEATURES_IF_APP_FEATURE_ON  2
#define GFSSUIC_SET_FEATURES_IF_APP_LEVEL  3
#define GFSSUIC_ADD_FEATURES_IF_APP_LEVEL  4

typedef struct {
    GenFileSelectorScalableUICommand	GFSSUIE_command;
    WordFlags				GFSSUIE_appFeature;
    FileSelectorAttrs			GFSSUIE_fsFeatures;
} GenFileSelectorScalableUIEntry} ;

#define FLEXIBLE_ARRAY_SIZE  100

/*
 * Hints declared as taking arrays of FLEXIBLE_ARRAY_SIZE can
 * take any number of array elements up to 100.
 */
typedef GenFileSelectorScalableUIEntry
        GenFileSelectorScalableUIEntryArray		[FLEXIBLE_ARRAY_SIZE];

    @vardata GenFileSelectorScalableUIEntryArray
                    HINT_FILE_SELECTOR_SCALABLE_UI_DATA;
/*
 * Hints declared as taking arrays of FLEXIBLE_ARRAY_SIZE can
 * take any number of array elements up to 100.
 */
typedef FilePathID FilePathIDArray [FLEXIBLE_ARRAY_SIZE];

    @vardata FilePathIDArray TEMP_GEN_FILE_SELECTOR_DIR_IDS;

    @vardata word HINT_FILE_SELECTOR_FILE_LIST_WIDTH;

    @vardata void HINT_FILE_SELECTOR_USE_DESKTOP_HOME;

    @vardata PathName TEMP_GEN_FILE_SELECTOR_HOME_DIRECTORY;

    @vardata void HINT_FILE_SELECTOR_SINGLE_ACTION;

    @vardata void HINT_FILE_SELECTOR_SHOW_FILE_SIZE;

@protominor UINewForNike
    typedef struct {
    GeosFileHeaderFlags GFSFHF_match;
    GeosFileHeaderFlags GFSFHF_mismatch;
    } GenFileSelectorFileHeaderFlags    } ;

    @vardata GenFileSelectorFileHeaderFlags ATTR_GEN_FILE_SELECTOR_FILE_HEADER_FLAGS;
@protoreset

@protominor UINewForResponder_2

/*
 * Scrolling lists in some UI's (namely Rudy) don't show the selection
 * when the focus is not on the list.   This hint forces the selection
 * to be shown for some unusual cases, where objects take the focus from
 * the FS list, but the FS list still appears to the user to have the focus
 * and be navigable.
 */
    @vardata void HINT_FILE_SELECTOR_SHOW_SELECTION_EVEN_WHEN_NOT_FOCUS;

/*
 * Some specific (e.g., Rudy) UI's columnate file selector entries,
 * making entries too wide for some applications.  Use this hint to
 * keep entry widths minimal.
 */
    @vardata void HINT_FILE_SELECTOR_MINIMIZE_WIDTH;

@protoreset

@protominor UINewForResponder_3

/*
 * Some specific UI's (e.g., Rudy) cause file selectors to sort entries
 * based on date/time or other criteria.  This hint will ensure that
 * entries are alphabetically sorted (with directories appearing before
 * files).
 */
    @vardata void HINT_FILE_SELECTOR_ALWAYS_SORT_ALPHABETICALLY;

/*
 * Sometimes the user might not want any default sorting to be done by
 * the file selector.  For example, Motif defaults to sorting alpha-
 * betically.  Use this hint to avoid sorting at all.  Also, file
 * selectors using a fake file system (FSFC_USE_FAKE_FILE_SYSTEM) can
 * use this hint if they do some kind of sorting that they don't want
 * the regular file selector code to mess with.
 */
    @vardata void HINT_FILE_SELECTOR_DONT_SORT;

/*
 * Used to reverse the default sort order.  Directories remain at the top of
 * the list, reverse sorted.  Used only when sorting.
 */
    @vardata void HINT_FILE_SELECTOR_REVERSE_SORT;

@protoreset

@protominor UINewForResponder_4

/*
 * Used if the file selector should add an icon marking files and folders
 * that are on a removable media (like the MMC).
 */
    @vardata void HINT_FILE_SELECTOR_SHOW_REMOVABLE_MEDIA_ICON;

/*
 * Used if the file selector should group files that are on a removable
 * media apart from other files.
 */
    @vardata void HINT_FILE_SELECTOR_SEGREGATE_REMOVABLE_MEDIA_FILES;

@protoreset

/*
 *	Instance Data
 */

    @instance GenFileSelectorSelection	GFSI_selection = {0};

    @instance FileSelectorFileCriteria  GFSI_fileCriteria =
            FSFC_DIRS|FSFC_NON_GEOS_FILES|
           FSFC_GEOS_EXECUTABLES|FSFC_GEOS_NON_EXECUTABLES;

    @instance FileSelectorAttrs 	GFSI_attrs =
             FSA_ALLOW_CHANGE_DIRS|FSA_HAS_CLOSE_DIR_BUTTON|
         FSA_HAS_OPEN_DIR_BUTTON|FSA_HAS_DOCUMENT_BUTTON|
         FSA_HAS_CHANGE_DIRECTORY_LIST|FSA_HAS_CHANGE_DRIVE_LIST|
         FSA_HAS_FILE_LIST;

    @instance optr			GFSI_destination;
    @instance Message			GFSI_notificationMsg;
@endc

@endlib


Objects\gGadgetC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gGadgetC.goh
 * AUTHOR:	Chris Hawley 5/ 4/92
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenGadgetClass
 *
 *	$Id: gGadgetC.goh,v 1.4.10.1 96/04/28 08:31:20 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <ui.goh>

@class GenGadgetClass, GenClass;
    @uses VisCompClass;	/* So people can subclass VisComp messages
                     * that will be received if GGA_COMPOSITE */

typedef ByteFlags GenGadgetAttributes ;
#define GGA_COMPOSITE 	0x8000

    @instance GenGadgetAttributes GGI_attrs = 0;
@endc

@endlib


Objects\gInterC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gInterC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenInteractionClass
 *
 *	$Id: gInterC.goh,v 1.43.1.1 96/04/28 08:32:00 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <Objects/genC.goh>
#include  <Objects/gInterC.h>

@class GenInteractionClass, GenClass;

@message GenInteractionType MSG_GEN_INTERACTION_GET_TYPE () = cl;	/* XXX */
@message void MSG_GEN_INTERACTION_SET_TYPE (GenInteractionType type = cl);
@message GenInteractionVisibility MSG_GEN_INTERACTION_GET_VISIBILITY () = cl;	/* XXX */
@message void MSG_GEN_INTERACTION_SET_VISIBILITY (
                            GenInteractionVisibility visibility = cl);
@message GenInteractionAttrs MSG_GEN_INTERACTION_GET_ATTRS () = cl;	/* XXX */
@message void MSG_GEN_INTERACTION_SET_ATTRS (
                            GenInteractionAttrs setAttrs = cl,
                GenInteractionAttrs clearAttrs = ch);
@message void MSG_GEN_INTERACTION_ACTIVATE_COMMAND (InteractionCommand command = cx); /* XXX */
@message void MSG_GEN_INTERACTION_INITIATE ();	/* XXX */
@message void MSG_GEN_INTERACTION_INITIATE_NO_DISTURB ();	/* XXX */

@message void MSG_GEN_INTERACTION_INITIATE_BLOCKING_THREAD_ON_RESPONSE (UserDoDialogStruct *dialogInfo = dx:bp);	/* XXX */
                                                    /* INTERNAL */
@message void MSG_GEN_INTERACTION_RELEASE_BLOCKED_THREAD_WITH_RESPONSE (word *command = cx);	/* XXX */
                                                    /* INTERNAL */

@reserveMessages 1;
@message Boolean MSG_GEN_INTERACTION_TEST_INPUT_RESTRICTABILITY (
                            optr modalWindow = cx:dx) = carry;
@message void MSG_GEN_INTERACTION_POP_OUT ();
@message void MSG_GEN_INTERACTION_POP_IN ();
@message void MSG_GEN_INTERACTION_TOGGLE_POPOUT ();
@message void MSG_GEN_INTERACTION_DISABLE_DISCARDING ();

    @vardata void HINT_INTERACTION_SINGLE_USAGE;
    @vardata void HINT_INTERACTION_FREQUENT_USAGE;
    @vardata void HINT_INTERACTION_COMPLEX_PROPERTIES;
    @vardata void HINT_INTERACTION_SIMPLE_PROPERTIES;
    @vardata void HINT_INTERACTION_RELATED_PROPERTIES;
    @vardata void HINT_INTERACTION_UNRELATED_PROPERTIES;
    @vardata void HINT_INTERACTION_SLOW_RESPONSE_PROPERTIES;
    @vardata void HINT_INTERACTION_FAST_RESPONSE_PROPERTIES;
    @vardata void HINT_INTERACTION_REQUIRES_VALIDATION;
    @vardata void HINT_INTERACTION_MAKE_RESIZABLE;
    @vardata void HINT_INTERACTION_CANNOT_BE_DEFAULT;
    @vardata void HINT_INTERACTION_MODAL;
    @vardata void HINT_INTERACTION_UNUSED_1;
    @vardata void ATTR_GEN_INTERACTION_UNUSED_2;
    @vardata void ATTR_GEN_INTERACTION_UNUSED_3;

    /* Internal variable data.  Do not use. */
    @vardata ActionDescriptor TEMP_GEN_INTERACTION_WITH_ACTION_RESPONSE;

    @vardata void HINT_INTERACTION_NO_DISTURB;
    @vardata GenInteractionGroupType ATTR_GEN_INTERACTION_GROUP_TYPE;
    @vardata void ATTR_GEN_INTERACTION_UNUSED_4;
    @vardata void ATTR_GEN_INTERACTION_OVERRIDE_INPUT_RESTRICTIONS;
    @vardata void ATTR_GEN_INTERACTION_ABIDE_BY_INPUT_RESTRICTIONS;

    @vardata void HINT_INTERACTION_DEFAULT_ACTION_IS_NAVIGATE_TO_NEXT_FIELD;

    @vardata void HINT_INTERACTION_INFREQUENT_USAGE;
    @vardata word HINT_CUSTOM_SYS_MENU;

    @vardata void ATTR_GEN_INTERACTION_POPPED_OUT;

    /* Internal variable data.  Do not use. */
    @vardata GenSaveWindowInfo TEMP_GEN_INTERACTION_SAVE_POPOUT_INFO;

    @vardata void ATTR_GEN_INTERACTION_POPOUT_NOT_CLOSABLE;

    /* Unused variable data.  Do not use. */
    @vardata optr ATTR_GEN_INTERACTION_PEN_MODE_KEYBOARD_OBJECT;

    @vardata void HINT_INTERACTION_MAXIMIZABLE;
    @vardata void HINT_INTERACTION_POPOUT_HIDDEN_ON_STARTUP;
    @vardata void TEMP_GEN_INTERACTION_POPOUT_HIDDEN;
    @vardata void HINT_INTERACTION_DISCARD_WHEN_CLOSED;

    /* Internal vardata. Do not use */
    @vardata GenInteractionDiscardInfo TEMP_INTERACTION_DISCARD_INFO;

@protoreset

@protominor	UINewForResponder

    /* Currently only available in Responder */
    @vardata optr HINT_INTERACTION_ACTIVATED_BY;
    @reloc HINT_INTERACTION_ACTIVATED_BY, 0, optr;

    @vardata void HINT_INTERACTION_FOCUSABLE;
@protoreset

    @vardata void HINT_INTERACTION_FOLDER_TAB_DIALOG;

/* Instance data */

    @instance GenInteractionType	GII_type
            = GIT_ORGANIZATIONAL;
    @instance GenInteractionVisibility	GII_visibility
            = GIV_SUB_GROUP;
    @instance GenInteractionAttrs	GII_attrs
            = 0;

@endc

@endlib


Objects\gInterC.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gInterC.h
 * AUTHOR:	Jenny Greenwood, September 3, 1993
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	Constants and structures for GenInteractionClass
 *
 *	$Id: gInterC.h,v 1.1.8.1 96/04/28 08:30:57 chris Exp $
 *
 ***********************************************************************/

#ifndef __GINTERC_H
#define __GINTERC_H

/* Internal type. Do not use. */
typedef struct {
    ThreadHandle    	UDDS_callingThread;
    SemaphoreHandle 	UDDS_semaphore;
    word	    	UDDS_response;
    Boolean    	   	UDDS_complete;
    Boolean    	    	UDDS_boxRunByCurrentThread;
    optr    	    	UDDS_dialog;
    QueueHandle	    	UDDS_queue;
} UserDoDialogStruct} ;

typedef enum /* word */ {
    IC_NULL    ,
    IC_DISMISS    ,
    IC_INTERACTION_COMPLETE    ,
    IC_APPLY    ,
    IC_RESET    ,
    IC_OK    ,
    IC_YES    ,
    IC_NO    ,
    IC_STOP    ,
    IC_EXIT    ,
    IC_HELP
} InteractionCommand} ;

#define IC_CUSTOM_START  1000

typedef ByteEnum GenInteractionType ;
#define GIT_ORGANIZATIONAL  0
#define GIT_PROPERTIES  1
#define GIT_PROGRESS  2
#define GIT_COMMAND  3
#define GIT_NOTIFICATION  4
#define GIT_AFFIRMATION  5
#define GIT_MULTIPLE_RESPONSE  6

typedef ByteEnum GenInteractionVisibility ;
#define GIV_NO_PREFERENCE  0
#define GIV_POPUP  1
#define GIV_SUB_GROUP  2
#define GIV_CONTROL_GROUP  3
#define GIV_DIALOG  4
#define GIV_POPOUT  5

typedef ByteFlags GenInteractionAttrs ;
#define GIA_NOT_USER_INITIATABLE 		0x80
#define GIA_INITIATED_VIA_USER_DO_DIALOG 	0x40
#define GIA_MODAL 				0x20
#define GIA_SYS_MODAL 				0x10

typedef ByteEnum GenInteractionGroupType ;
#define GIGT_FILE_MENU  0
#define GIGT_EDIT_MENU  1
#define GIGT_VIEW_MENU  2
#define GIGT_OPTIONS_MENU  3
#define GIGT_WINDOW_MENU  4
#define GIGT_HELP_MENU  5
#define GIGT_PRINT_GROUP  6

#endif


Objects\gItemC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gItemC.goh
 * AUTHOR:	Chris Hawley: 1/23/92
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenItemClass.
 *
 *	$Id: gItemC.goh,v 1.8.6.1 96/04/28 08:31:39 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <ui.goh>
@include  <Objects/genC.goh>

@class	GenItemClass, GenClass;

@message word MSG_GEN_ITEM_GET_IDENTIFIER () = ax;
@message void MSG_GEN_ITEM_SET_IDENTIFIER (word identifier = cx);

@message void MSG_GEN_ITEM_SET_INTERACTABLE_STATE ( /* INTERNAL */
                                            Boolean interactable = cx);

    @instance word	  GII_identifier;

@endc

@endlib


Objects\gItemGC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gItemGC.goh
 * AUTHOR:	Chris Hawley: 1/23/92
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenItemGroupClass.
 *
 *	$Id: gItemGC.goh,v 1.24.1.4 97/05/08 16:35:25 cthomas Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <ui.goh>
@include  <Objects/genC.goh>

@class	GenItemGroupClass, GenClass;

typedef ByteEnum GenItemGroupBehaviorType ;
#define GIGBT_EXCLUSIVE  0
#define GIGBT_EXCLUSIVE_NONE  1
#define GIGBT_EXTENDED_SELECTION  2
#define GIGBT_NON_EXCLUSIVE  3

/* Returned from MSG_GEN_ITEM_GROUP_GET_SELECTION (unsigned value) */
#define  GIGS_NONE  	(0xffff)

@message void MSG_GEN_ITEM_GROUP_SET_NONE_SELECTED (Boolean indeterminate = dx);
@message void MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION (word identifier = cx,
                      Boolean indeterminate = dx);
@message void MSG_GEN_ITEM_GROUP_SET_MULTIPLE_SELECTIONS (
                      word *selectionList = cx:dx,
                       word numSelections = bp);

@message word MSG_GEN_ITEM_GROUP_GET_SELECTION () = ax;
@message word MSG_GEN_ITEM_GROUP_GET_NUM_SELECTIONS () = ax;
@message word MSG_GEN_ITEM_GROUP_GET_MULTIPLE_SELECTIONS (
                    word *selectionList = cx:dx,
                    word maxSelections = bp) = ax;

@message void MSG_GEN_ITEM_GROUP_SET_INDETERMINATE_STATE (
                    Boolean indeterminateState = cx);
@message Boolean MSG_GEN_ITEM_GROUP_IS_INDETERMINATE () = carry;

@message void MSG_GEN_ITEM_GROUP_SET_MODIFIED_STATE (
                    Boolean modifiedState = cx);
@message Boolean MSG_GEN_ITEM_GROUP_IS_MODIFIED () = carry;

@message void MSG_GEN_ITEM_GROUP_SEND_STATUS_MSG (
                    Boolean modifiedState = cx);

@message optr MSG_GEN_ITEM_GROUP_GET_ITEM_OPTR (word identifier = cx) = cx:dx;

@message void MSG_GEN_ITEM_GROUP_SET_ITEM_STATE (word identifier = cx,
                            Boolean state = dx);
@message Boolean MSG_GEN_ITEM_GROUP_IS_ITEM_SELECTED (word identifier = cx) = carry;

@message void MSG_GEN_ITEM_GROUP_MAKE_ITEM_VISIBLE (word identifier = cx); /*XXX*/

@message optr MSG_GEN_ITEM_GROUP_GET_DESTINATION () = cx:dx;
@message void MSG_GEN_ITEM_GROUP_SET_DESTINATION (optr dest = cx:dx);

@message Message MSG_GEN_ITEM_GROUP_GET_APPLY_MSG () = ax;
@message void MSG_GEN_ITEM_GROUP_SET_APPLY_MSG (Message message = cx);

@message GenItemGroupBehaviorType MSG_GEN_ITEM_GROUP_GET_BEHAVIOR_TYPE () = al;
@message void MSG_GEN_ITEM_GROUP_SET_BEHAVIOR_TYPE (
        GenItemGroupBehaviorType behaviorType = cl);

@message word MSG_GEN_ITEM_GROUP_GET_UNIQUE_IDENTIFIER () = ax;

/* Internal */

typedef ByteFlags GenScanItemsFlags ;
#define	GSIF_FROM_START					0x80
#define	GSIF_FORWARD					0x40
#define GSIF_WRAP_AROUND 			0x20
#define GSIF_INITIAL_ITEM_FOUND 			0x10
#define GSIF_USABLE_AND_ENABLED_ITEM_FOUND 	0x08
#define GSIF_EXISTING_ITEMS_ONLY 		0x04
#define GSIF_DYNAMIC_LIST 			0x02

@message word MSG_GEN_ITEM_GROUP_SCAN_ITEMS (GenScanItemsFlags flags  = cl,
                        word initialItem = dx,
                        word scanAmount = bp) = ax;

@message void MSG_GEN_ITEM_GROUP_REDRAW_ITEMS (word offset = cx);  /*XXX*/

@message void MSG_GEN_ITEM_GROUP_SET_MONIKER_SELECTION (char *text = cx:dx); /*XXX*/

@message void MSG_GEN_ITEM_GROUP_UPDATE_EXTENDED_SELECTION(@stack /* INTERNAL */
        word flags, word setSelMsg, word prevExtentItem,
            word extentItem, word anchorItem);  /*XXX*/

@protominor userExclAPI

@message word MSG_GEN_ITEM_GROUP_GET_FOCUS_ITEM () = cx;

@message void MSG_GEN_ITEM_GROUP_SET_FOCUS_ITEM (word identifier = cx);

@protoreset

/* GEI_state */

typedef ByteFlags GenItemGroupStateFlags ;
#define  GIGSF_INDETERMINATE  	0x80
#define  GIGSF_MODIFIED  		0x40

/* Output prototypes */

@prototype void GEN_ITEM_GROUP_APPLY_MSG (
                                    word selection = cx,
                        word numSelections = bp,
                    GenItemGroupStateFlags stateFlags = dl);

@prototype void GEN_ITEM_GROUP_STATUS_MSG (
                                    word selection = cx,
                    word numSelections = bp,
                    GenItemGroupStateFlags stateFlags = dl);

/* Variable data */

@vardata Message ATTR_GEN_ITEM_GROUP_STATUS_MSG;
@vardata void ATTR_GEN_ITEM_GROUP_SET_MODIFIED_ON_REDUNDANT_SELECTION;
@vardata Message ATTR_GEN_ITEM_GROUP_CUSTOM_DOUBLE_PRESS;
@vardata void HINT_ITEM_GROUP_SCROLLABLE;
@vardata void HINT_ITEM_GROUP_MINIMIZE_SIZE;
@vardata void HINT_ITEM_GROUP_RADIO_BUTTON_STYLE;
@vardata void HINT_ITEM_GROUP_TOOLBOX_STYLE;

@vardata void HINT_ITEM_GROUP_DISPLAY_CURRENT_SELECTION;
@vardata void HINT_ITEM_GROUP_MINIMIZE_SIZE_IF_VERTICAL_SCREEN;
@vardata optr ATTR_GEN_ITEM_GROUP_LINK;
@reloc ATTR_GEN_ITEM_GROUP_LINK, 0, optr;
@vardata void ATTR_GEN_ITEM_GROUP_INIT_FILE_BOOLEAN;
@vardata void HINT_ITEM_GROUP_SHOW_SELECTION_EVEN_WHEN_NOT_FOCUS;

@protominor PCVLooks_2
@vardata void HINT_ITEM_GROUP_LOWER_LEFT_STYLE;
@vardata void HINT_ITEM_GROUP_LOWER_RIGHT_STYLE;
    /* Draw in the lower left  or lower right style.  These draw only
       the top and right,or top and left edges of the button (rounded
       corner) to look like they are in the lower left or lower right
       of the screen */

@vardata void HINT_ITEM_GROUP_UPPER_TAB_STYLE;
@vardata void HINT_ITEM_GROUP_LOWER_TAB_STYLE;
    /* The lower and upper tab styles are meant to be used on items
       that are arranged horizontally.  When one is pressed it looses
       its top or bottom (according to being upper or lower) so it
       looks like it has been pressed. */

@vardata void HINT_ITEM_GROUP_BLANK_STYLE;
    /* As simple as it gets, draws no UI. */
@protoreset

/* Instance data */

    @instance GenItemGroupBehaviorType GIGI_behaviorType = GIGBT_EXCLUSIVE;
    @instance word    GIGI_selection = GIGS_NONE;
    @instance word    GIGI_numSelections = 0;
    @instance GenItemGroupStateFlags    GIGI_stateFlags = 0;
    @instance optr    GIGI_destination;
    @instance Message GIGI_applyMsg = 0;
@endc

@endlib


Objects\gPageCC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	Text/tCtrlC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI / Text library
 *
 * DESCRIPTION:
 *	This file defines GenPageControlClass
 *
 *	$Id: gPageCC.goh,v 1.8.6.1 96/04/28 08:31:29 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@class GenPageControlClass, GenControlClass;

@message void MSG_PC_GOTO_PAGE ();   	/* INTERNAL */
@message void MSG_PC_NEXT_PAGE ();   	/* INTERNAL */
@message void MSG_PC_PREVIOUS_PAGE ();   /* INTERNAL */

typedef WordFlags GPCFeatures ;
#define GPCF_GOTO_PAGE 		0x0004
#define GPCF_NEXT_PAGE 		0x0002
#define GPCF_PREVIOUS_PAGE 	0x0001

typedef WordFlags GPCToolboxFeatures ;
#define GPCTF_PREVIOUS_PAGE 	0x0004
#define GPCTF_GOTO_PAGE 		0x0002
#define GPCTF_NEXT_PAGE 		0x0001

#define GPC_DEFAULT_FEATURES   (GPCF_GOTO_PAGE | GPCF_NEXT_PAGE \
                   | GPCF_PREVIOUS_PAGE)
#define GPC_DEFAULT_TOOLBOX_FEATURES   (GPCTF_GOTO_PAGE | GPCTF_NEXT_PAGE \
                       | GPCTF_PREVIOUS_PAGE)

typedef struct {
    word	NPSC_firstPage;
    word	NPSC_lastPage;
    word	NPSC_currentPage;
} NotifyPageStateChange} ;

    @default GCI_output = (TO_APP_TARGET);

@endc

@endlib


Objects\gPenICC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	Text/tCtrlC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI / Text library
 *
 * DESCRIPTION:
 *	This file defines GenPenInputControlClass
 *
 *	$Id: gPenICC.goh,v 1.21.4.1 96/04/28 08:31:25 chris Exp $
 *
 ***********************************************************************/

@optimize

/* @include  <Objects/pen.goh>  */
@include  <Objects/vTextC.goh>
#include  <hwr.h>
@deflib ui

@class GenPenInputControlClass, GenControlClass;

@message void MSG_GEN_PEN_INPUT_CONTROL_SET_DISPLAY (PenInputDisplayType dispType = cx);

@message PenInputDisplayType MSG_GEN_PEN_INPUT_CONTROL_GET_DISPLAY () = cx;

@message int MSG_GEN_PEN_INPUT_CONTROL_SET_TO_DEFAULT_POSITION (word fieldWidth = cx);

/* in assembly this returns carry set if there is no main view but also	*/
/* a null optr, because in C we aren't able to return both the carry	*/
/* and the optr, so C has to check for a null optr.			*/
@message optr MSG_GEN_PEN_INPUT_CONTROL_GET_MAIN_VIEW () = cx:dx;

@message void MSG_GEN_PEN_INPUT_CONTROL_RESET_CONSTRAIN ();
typedef enum { /* word */
    PIDT_KEYBOARD    ,
    PIDT_CHAR_TABLE    ,
    PIDT_CHAR_TABLE_SYMBOLS    ,
    PIDT_CHAR_TABLE_INTERNATIONAL    ,
    PIDT_CHAR_TABLE_MATH    ,
    PIDT_CHAR_TABLE_CUSTOM    ,
    PIDT_HWR_ENTRY_AREA    ,
    PIDT_BIG_KEYS    ,
    PIDT_NUMBERS    ,
    PIDT_PUNCTUATION
} PenInputDisplayType} ;

typedef WordFlags GPICFeatures ;
#define GPICF_KEYBOARD 		    	0x0040
#define GPICF_CHAR_TABLE 	    	0x0020
#define GPICF_CHAR_TABLE_SYMBOLS 	0x0010
#define GPICF_CHAR_TABLE_INTERNATIONAL 	0x0008
#define GPICF_CHAR_TABLE_MATH 		0x0004
#define GPICF_CHAR_TABLE_CUSTOM 		0x0002
#define GPICF_HWR_ENTRY_AREA 	    	0x0001

typedef WordFlags GPICToolboxFeatures ;
#define GPICTF_INITIATE 	    	0x0001

#define GPIC_DEFAULT_FEATURES    (GPICF_KEYBOARD | GPICF_CHAR_TABLE \
             | GPICF_HWR_ENTRY_AREA | GPICF_CHAR_TABLE_SYMBOLS \
             | GPICF_CHAR_TABLE_INTERNATIONAL \
             | GPICF_CHAR_TABLE_MATH)

#define GPIC_DEFAULT_TOOLBOX_FEATURES    GPICTF_INITIATE

typedef struct {
    optr CTD_line1;
    optr CTD_line2;
    optr CTD_line3;
    optr CTD_line4;
    optr CTD_line5;
} CharTableData} ;

typedef struct {
    VisTextRange    RWHWRD_range;
    HWRContext	    RWHWRD_context;
} ReplaceWithHWRData} ;

@vardata	CharTableData	ATTR_GEN_PEN_INPUT_CONTROL_CUSTOM_CHAR_TABLE_DATA;
#define CHAR_TABLE_SPACE_FILLER_CHAR 	C_CTRL_A
@vardata    	optr	ATTR_GEN_PEN_INPUT_CONTROL_CUSTOM_CHAR_TABLE_MONIKER;
@reloc ATTR_GEN_PEN_INPUT_CONTROL_CUSTOM_CHAR_TABLE_MONIKER, 0, optr;
@reloc ATTR_GEN_PEN_INPUT_CONTROL_CUSTOM_CHAR_TABLE_DATA, (1,CharTableData), optr;

@vardata	PenInputDisplayType ATTR_GEN_PEN_INPUT_CONTROL_STARTUP_DISPLAY_TYPE;
@vardata    	void	ATTR_GEN_PEN_INPUT_CONTROL_IS_FLOATING_KEYBOARD;
@vardata    	void	ATTR_GEN_PEN_INPUT_CONTROL_MAKE_VISIBLE_ON_ALL_SYSTEMS;
@vardata	void	ATTR_GEN_PEN_INPUT_CONTROL_INITIATE_WHEN_ENABLED;

typedef struct {
    Boolean NFWKS_needsFloatingKbd;
    Point   NFWKS_kbdPosition;
    optr    NFWKS_focusWindow;
    Boolean NFWKS_sysModal;
} NotifyFocusWindowKbdStatus} ;
    @default GCI_output = (TO_APP_FOCUS);

@endc

@endlib


Objects\gPrimC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gPrimC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenPrimaryClass
 *
 *	$Id: gPrimC.goh,v 1.14.20.1 96/04/28 08:30:53 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <Objects/gDispC.goh>

@class GenPrimaryClass, GenDisplayClass;

@message ChunkHandle MSG_GEN_PRIMARY_GET_LONG_TERM_MONIKER () = ax;
@message void MSG_GEN_PRIMARY_USE_LONG_TERM_MONIKER (ChunkHandle moniker = cx);
@message ChunkHandle MSG_GEN_PRIMARY_REPLACE_LONG_TERM_MONIKER(@stack
                VisUpdateMode updateMode,
                word height, word width, word length,
                VisMonikerDataType dateType,
                VisMonikerSourceType sourceType,
                dword source);

    @vardata	void HINT_PRIMARY_FULL_SCREEN;
    @vardata	void HINT_PRIMARY_NO_FILE_MENU;
    @vardata	void HINT_PRIMARY_NO_EXPRESS_MENU;
    @vardata	Rectangle HINT_PRIMARY_OPEN_ICON_BOUNDS;
    @vardata	void HINT_PRIMARY_NO_HELP_BUTTON;

    @instance ChunkHandle GPI_longTermMoniker;

    @default GI_attrs = @default | GA_TARGETABLE;

@endc

@endlib


Objects\gProcC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gProcC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenProcessClass
 *

 *
 ***********************************************************************/

@optimize
@deflib ui

#include  <file.h>
#include  <vm.h>
@include  <ui.goh>
@include  <alb.goh>
@include  <Objects/processC.goh>

@class	GenProcessClass, ProcessClass;

@message void MSG_GEN_PROCESS_RESTORE_FROM_STATE (
                AppAttachFlags attachFlags = cx,
                MemHandle launchBlock = dx,
                MemHandle extraState = bp);	/* XXX */

typedef WordFlags AppAttachFlags ;
#define AAF_RESTORING_FROM_STATE 	0x8000
#define AAF_STATE_FILE_PASSED 		0x4000
#define AAF_DATA_FILE_PASSED 		0x2000
#define AAF_RESTORING_FROM_QUIT 		0x1000

@message void MSG_GEN_PROCESS_OPEN_APPLICATION (
                AppAttachFlags attachFlags = cx,
                MemHandle launchBlock = dx,
                MemHandle extraState = bp);

@message void MSG_GEN_PROCESS_OPEN_ENGINE (
                AppAttachFlags attachFlags = cx,
                 MemHandle launchBlock = dx);

@message MemHandle MSG_GEN_PROCESS_CLOSE_APPLICATION () = cx;

@message void MSG_GEN_PROCESS_CLOSE_ENGINE ();	/* XXX */
@message MemHandle MSG_GEN_PROCESS_CLOSE_CUSTOM ();	/* XXX */
@message MemHandle MSG_GEN_PROCESS_ATTACH_TO_PASSED_STATE_FILE (
                AppAttachFlags attachFlags = cx,
                 MemHandle launchBlock = dx) = ax; /* XXX */
@message VMFileHandle MSG_GEN_PROCESS_CREATE_NEW_STATE_FILE (
            MemHandle appInstanceReference = dx) = ax; /* XXX */
@message void MSG_GEN_PROCESS_INSTALL_TOKEN ();	/* XXX */
@reserveMessages    	1;
@message optr MSG_GEN_PROCESS_GET_PARENT_FIELD () = cx:dx;	/* XXX */
@message void MSG_GEN_PROCESS_SEND_TO_APP_GCN_LIST(@stack
                                GCNListSendFlags sendFlags,
                EventHandle event,
                MemHandle block,
                                /*
                                 * The exact type of manufListType depends
                                    * on the manufacturer. It will always
                                 * be a word.
                                 */
                word	manufListType,
                ManufacturerID manufID);
@message void MSG_GEN_PROCESS_REAL_DETACH ();	/* INTERNAL */
@message void MSG_GEN_PROCESS_FINAL_DETACH ();	/* INTERNAL */

/************************************************************************/
/*		    	    Undo messages	    	    	    	*/
/************************************************************************/
@message void MSG_GEN_PROCESS_UNDO_START_CHAIN(@stack optr title,
                           optr owner);
@message void MSG_GEN_PROCESS_UNDO_END_CHAIN (Boolean flushChainIfEmpty = cx);

typedef enum /* word */ {
    UADT_FLAGS	=0,
    UADT_PTR	=2,
    UADT_VM_CHAIN	=4
} UndoActionDataType} ;

typedef struct {
    dword   UADF_flags;
    word    UADF_extraflags;
} UndoActionDataFlags} ;

typedef struct {
    void    *UADP_ptr;
    word    UADP_size;
} UndoActionDataPtr} ;

typedef struct {
    VMChain UADVMC_vmChain;
    VMFileHandle UADVMC_file;
} UndoActionDataVMChain} ;

typedef union {
    UndoActionDataFlags	    UADU_flags;
    UndoActionDataPtr	    UADU_ptr;
    UndoActionDataVMChain   UADU_vmChain;
} UndoActionDataUnion} ;
#define NULL_UNDO_CONTEXT    0

typedef WordFlags AddUndoActionFlags ;
#define AUAF_NOTIFY_BEFORE_FREEING  0x8000
#define AUAF_NOTIFY_IF_FREED_WITHOUT_BEING_PLAYED_BACK  0x4000

typedef struct {
    UndoActionDataType	UAS_dataType;
    UndoActionDataUnion	UAS_data;
    dword   	    	UAS_appType;
} UndoActionStruct} ;

typedef struct {
    UndoActionStruct	AUAS_data;
    optr    	    	AUAS_output;
    AddUndoActionFlags	AUAS_flags;
} AddUndoActionStruct} ;

extern VMFileHandle _pascal GenProcessUndoGetFile (void);
extern Boolean _pascal GenProcessUndoCheckIfIgnoring (void);
#ifdef __HIGHC__
pragma Alias(GenProcessUndoGetFile, "GENPROCESSUNDOGETFILE");
pragma Alias(GenProcessUndoCheckIfIgnoring, "GENPROCESSUNDOCHECKIFIGNORING");
#endif

@message VMChain MSG_GEN_PROCESS_UNDO_ADD_ACTION (AddUndoActionStruct *data = ss:bp) = ax.bp;
@message VMFileHandle MSG_GEN_PROCESS_UNDO_GET_FILE () = ax;
@message void MSG_GEN_PROCESS_UNDO_FLUSH_ACTIONS ();
@message dword MSG_GEN_PROCESS_UNDO_SET_CONTEXT (dword context = cx.dx) = cx.dx;
@message dword MSG_GEN_PROCESS_UNDO_GET_CONTEXT () = cx.dx;
@message void MSG_GEN_PROCESS_UNDO_PLAYBACK_CHAIN ();
@message void MSG_GEN_PROCESS_UNDO_IGNORE_ACTIONS (Boolean flushActions = cx);
@message void MSG_GEN_PROCESS_UNDO_ACCEPT_ACTIONS ();
@message Boolean MSG_GEN_PROCESS_UNDO_CHECK_IF_IGNORING () = ax;
@message void MSG_GEN_PROCESS_UNDO_ABORT_CHAIN ();

@protominor UINewForZoomer

@message void MSG_GEN_PROCESS_TRANSITION_FROM_ENGINE_TO_APPLICATION_MODE (
                AppAttachFlags attachFlags = cx,
                MemHandle launchBlock = dx);

@protoreset

#define	AIRDN_DRIVE		0x80

@endc

@endlib


graphics.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	graphics.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines graphics structures and routines.
 *
 *	$Id: graphics.h,v 1.106.1.1 96/04/28 08:29:26 chris Exp $
 *
 ***********************************************************************/

#ifndef	__GRAPHICS_H
#define __GRAPHICS_H

#include  <fontID.h>
#include  <font.h>
#include  <color.h>

/* return info for GrGetCharInfo */
typedef ByteFlags CharInfo ;
#define CI_NEGATIVE_LSB  0x40	/* TRUE if negative left-side bearing */
#define	CI_ABOVE_ASCENT	 0x20	/* TRUE if very tall */
#define	CI_BELOW_DESCENT	 0x10	/* TRUE if very low */
#define	CI_NO_DATA	 0x08		/* TRUE if no data */
#define	CI_IS_FIRST_KERN	 0x04	/* TRUE if first of a kern pair */
#define	CI_IS_SECOND_KERN	 0x02	/* TRUE if second of a kern pair */

/* Maximum allowed values */

#define MIN_TRACK_KERNING 	(-150)
#define MAX_TRACK_KERNING 	500

#define MAX_KERN_VALUE 		0x7ff0
#define MIN_KERN_VALUE 		0x8001

/***/

typedef ByteEnum Justification ;
#define J_LEFT  0
#define J_RIGHT  1
#define J_CENTER  2
#define J_FULL  3

/***/

/* structure for a draw mask -- the default mask has all bits set */

typedef byte DrawMask [8];

/* constants for system patterns and draw masks */

typedef ByteEnum SystemDrawMask ;
#define SDM_TILE  0
#define SDM_SHADED_BAR  1
#define SDM_HORIZONTAL  2
#define SDM_VERTICAL  3
#define SDM_DIAG_NE  4
#define SDM_DIAG_NW  5
#define SDM_GRID  6
#define SDM_BIG_GRID  7
#define SDM_BRICK  8
#define SDM_SLANT_BRICK  9
#define SDM_0     89
#define SDM_12_5     81
#define SDM_25     73
#define SDM_37_5     65
#define SDM_50     57
#define SDM_62_5     49
#define SDM_75     41
#define SDM_87_5     33
#define SDM_100     25
#define SDM_CUSTOM  0x7f

#define SET_CUSTOM_PATTERN 	SDM_CUSTOM

/* record to pass to GrSetXXXXMask */

typedef ByteFlags SysDrawMask ;
#define SDM_INVERSE 	0x80
#define SDM_MASK 	0x7f

/* Bitmap / Raster Constants and Structures */

/* Record for ImageFlags */

typedef ByteFlags ImageFlags ;
#define	IF_BORDER	   0x08
#define IF_BITSIZE   0x07

/* Enum for GrDrawImage pixel sizes */
typedef ByteEnum ImageBitSize ;
#define	IBS_1		0
#define	IBS_2		1
#define	IBS_4		2
#define	IBS_8		3
#define	IBS_16		4

/* Enum for B_compact */

typedef ByteEnum BMCompact ;
#define BMC_UNCOMPACTED  0
#define BMC_PACKBITS  1
#define BMC_USER_DEFINED  0x80

/* Enum for BMT_FORMAT */

typedef ByteEnum BMFormat ;
#define BMF_MONO   0
#define BMF_4BIT   1
#define BMF_8BIT   2
#define BMF_24BIT  3
#define BMF_4CMYK  4
#define BMF_3CMY   5

/* Record for B_type */

typedef ByteFlags BMType ;
#define BMT_PALETTE 	0x40
#define BMT_HUGE 	0x20
#define BMT_MASK 	0x10
#define BMT_COMPLEX 	0x08
#define BMT_FORMAT 	0x07

/* Simple Bitmap Structure */

typedef struct {
    word	B_width;
    word	B_height;
    byte	B_compact;
    byte	B_type;
} Bitmap} ;

/* Complex Bitmap Structure */

typedef struct {
    Bitmap	CB_simple;
    word	CB_startScan;
    word	CB_numScans;
    word	CB_devInfo;
    word	CB_data;
    word	CB_palette;
    word	CB_xres;
    word	CB_yres;
} CBitmap} ;

/***/

#define PATTERN_SIZE 	8

/* different values for GS_mixMode */

typedef ByteEnum MixMode ;
#define MM_CLEAR  0
#define MM_COPY  1
#define MM_NOP  2
#define MM_AND  3
#define MM_INVERT  4
#define MM_XOR  5
#define MM_SET  6
#define MM_OR  7

#define LAST_MIX_MODE 	MM_OR

/* different values for color mapping modes */

typedef ByteEnum MapColorToMono ;
#define CMT_CLOSEST  0
#define CMT_DITHER  1

typedef ByteFlags ColorMapMode ;
#define CMM_ON_BLACK 	0x04
#define CMM_MAP_TYPE 	0x01

#define LAST_MAP_MODE 	mask CMM_MAP_TYPE or mask CMM_ON_BLACK

/* options for line style */

typedef ByteEnum LineStyle ;
#define LS_SOLID  0
#define LS_DASHED  1
#define LS_DOTTED  2
#define LS_DASHDOT  3
#define LS_DASHDDOT  4
#define LS_CUSTOM  5

#define MAX_DASH_ARRAY_PAIRS 	5

/* structure for a dash pair array */

typedef word	DashPairArray	[MAX_DASH_ARRAY_PAIRS*2];

/* constants for line join */

typedef ByteEnum LineJoin ;
#define LJ_MITERED  0
#define LJ_ROUND  1
#define LJ_BEVELED  2

#define LAST_LINE_JOIN_TYPE 	LJ_BEVELED

/* constants for line end */

typedef ByteEnum LineEnd ;
#define LE_BUTTCAP  0
#define LE_ROUNDCAP  1
#define LE_SQUARECAP  2

#define LAST_LINE_END_TYPE 	LE_SQUARECAP

/* text styles */

typedef ByteFlags TextStyle ;
#define TS_OUTLINE 	0x40
#define TS_BOLD 		0x20
#define TS_ITALIC 	0x10
#define TS_SUPERSCRIPT 	0x08
#define TS_SUBSCRIPT 	0x04
#define TS_STRIKE_THRU 	0x02
#define TS_UNDERLINE 	0x01

/* text modes */

typedef ByteFlags TextMode ;
#define TM_TRACK_KERN 			0x40
#define TM_PAIR_KERN 			0x20
#define TM_PAD_SPACES 			0x10
#define TM_DRAW_BASE 			0x08
#define TM_DRAW_BOTTOM 			0x04
#define TM_DRAW_ACCENT 			0x02
#define TM_DRAW_OPTIONAL_HYPHENS 	0x01

/* text misc modes */
typedef ByteFlags TextMiscMode ;
#define TMMF_CHARACTER_JUSTIFICATION 	0x80

/* Region Constants */

typedef word Region ;

#define EOREGREC 	0x8000
#define EOREG_HIGH 	0x80

/* structure of a rectangular region */

typedef struct {
    word	RR_y1M1;
    word	RR_eo1;		/* EOREGREC */
    word	RR_y2;
    word	RR_x1;
    word	RR_x2;
    word	RR_eo2;		/* EOREGREC */
    word	RR_eo3;		/* EOREGREC */
} RectRegion} ;

/* macro for creating rectangular regions */

#define MakeRectRegion (left, top, right, bottom) \
        {(left), (top), (right), (bottom), (top) - 1, (EOREGREC), \
             (bottom), (left), (right), (EOREGREC), (EOREGREC)}

/*
 * (x,y) values are often returned from functions.  To allow their easy return,
 * the type XYValueAsDWord is returned.  The DWORD_X() and DWORD_Y() macros
 * can be used to access the x and y components.
 * For functions returning 16-bit values, there is the possibility (with some
 * functions) that the return value for either X or Y cannot be expressed in
 * 16-bits.  This will happen most often if there is an extended (32-bit)
 * translation applied to the GState Transformation Matrix.  In those cases,
 * the value ERROR_COORD will be returned.
 */
typedef dword XYValueAsDWord ;

#define DWORD_X (val) ((sword)( (val) & 0xffff ))
#define DWORD_Y (val) ((sword)( ((val) >> 16) & 0xffff ))
#define ERROR_COORD  	0x8000

/* standard structure for an X,Y pair */

typedef struct {
    sword	P_x;
    sword	P_y;
} Point} ;

typedef struct {
    WWFixed	PF_x;
    WWFixed	PF_y;
} PointWWFixed} ;

typedef struct {
    WBFixed	PWBF_x;
    WBFixed	PWBF_y;
} PointWBFixed} ;

typedef struct {
    DWFixed	PDF_x;
    DWFixed	PDF_y;
} PointDWFixed} ;

typedef struct {
    sdword	PD_x;
    sdword	PD_y;
} PointDWord} ;

typedef struct {
    sword	XYO_x;
    sword	XYO_y;
} XYOffset} ;

typedef struct {
    word	XYS_width;
    word	XYS_height;
} XYSize} ;

/* standard structure for a rectangle */

typedef struct {
    sword	R_left;
    sword	R_top;
    sword	R_right;
    sword	R_bottom;
} Rectangle} ;

typedef struct {
    sdword	RD_left;
    sdword	RD_top;
    sdword	RD_right;
    sdword	RD_bottom;
} RectDWord} ;

/***/
/* constants for region fill rule */

typedef ByteEnum RegionFillRule ;
#define ODD_EVEN  0
#define WINDING  1

/* constants for GrNewPage */

typedef ByteEnum PageEndCommand ;
#define PEC_FORM_FEED  0
#define PEC_NO_FORM_FEED  1

/* constants for filled arcs */

typedef enum /* word */ {
    ACT_OPEN    ,              /* Illegal for filled arcs */
    ACT_CHORD    ,             /* draw/fill as a chord */
    ACT_PIE                    /* draw/fill as a pie */
} ArcCloseType} ;
/*
 * For backwards compatibility:
 */
#define OPEN   ACT_OPEN
#define CHORD  ACT_CHORD
#define PIE    ACT_PIE

typedef struct {
    ArcCloseType    TPAP_close;
    PointWWFixed    TPAP_point1;
    PointWWFixed    TPAP_point2;
    PointWWFixed    TPAP_point3;
} ThreePointArcParams} ;

typedef struct {
    ArcCloseType    TPATP_close;
    PointWWFixed    TPATP_point2;
    PointWWFixed    TPATP_point3;
} ThreePointArcToParams} ;

typedef struct {
    ArcCloseType    TPRATP_close;
    PointWWFixed    TPRATP_delta2;
    PointWWFixed    TPRATP_delta3;
} ThreePointRelArcToParams} ;

/* Structures & Constants for Patterns */

typedef ByteEnum PatternType ;
#define PT_SOLID  0
#define PT_SYSTEM_HATCH  1
#define PT_SYSTEM_BITMAP  2
#define PT_USER_HATCH  3
#define PT_USER_BITMAP  4
#define PT_CUSTOM_HATCH  5
#define PT_CUSTOM_BITMAP  6

typedef ByteEnum SystemHatch ;
#define SH_VERTICAL  0
#define SH_HORIZONTAL  1
#define SH_45_DEGREE  2
#define SH_135_DEGREE  3
#define SH_BRICK  4
#define SH_SLANTED_BRICK  5

typedef struct {
    PatternType	HP_type;
    byte	HP_data;
} GraphicPattern} ;

/* Structures & Constants for Hatch Patterns */

typedef struct {
    WWFixed 	HD_on;
    WWFixed 	HD_off;
} HatchDash} ;

typedef	struct {
    PointWWFixed HL_origin;
    WWFixed 	HL_deltaX;
    WWFixed 	HL_deltaY;
    WWFixed 	HL_angle;
    ColorQuad	HL_color;
    word    	HL_numDashes;
    /* array of HatchDash structures follows here */
} HatchLine} ;

typedef	struct {
    word    	HP_numLines;
    /* array of HatchLine structures follows here */
} HatchPattern} ;

#define	MAX_CUSTOM_PATTERN_SIZE		16384

/* Constants for DrawRegion and DrawString */

#define PARAM_0 		0x5000
#define PARAM_1 		0x7000
#define PARAM_2 		0x9000
#define PARAM_3 		0xb000

/* Structure passed to transformation matrix routines */

/*
 * This structure defines a 3x3 transformation matrix.  Since only six of the
 * nine elements are actually used, the structure only has six elements.
 *
 *		e11	e12	0
 *		e21	e22	0
 *		e31	e32	1
 */

typedef struct {
    WWFixed	TM_e11;
    WWFixed	TM_e12;
    WWFixed	TM_e21;
    WWFixed	TM_e22;
    DWFixed	TM_e31;
    DWFixed	TM_e32;
} TransMatrix} ;

#define LARGEST_POSITIVE_COORDINATE 	0x4000
#define LARGEST_NEGATIVE_COORDINATE 	0xc000

#define MAX_COORD 	LARGEST_POSITIVE_COORDINATE
#define MIN_COORD 	LARGEST_NEGATIVE_COORDINATE

/*
 *	Pointer Picture Definition Structure
 */

#define STANDARD_CURSOR_IMAGE_SIZE 	32
#define CURSOR_IMAGE_SIZE_32 	       128
#define CURSOR_IMAGE_SIZE_64 	       512

typedef struct {
    byte        PD_width;
    byte    	PD_height;
    sbyte	PD_hotX;
    sbyte	PD_hotY;
    byte	PD_mask[STANDARD_CURSOR_IMAGE_SIZE];
    byte	PD_image[STANDARD_CURSOR_IMAGE_SIZE];
} PointerDef16} ;

typedef struct {
    byte        PD_width;
    byte    	PD_height;
    sbyte	PD_hotX;
    sbyte	PD_hotY;
    byte	PD_mask[CURSOR_IMAGE_SIZE_32];
    byte	PD_image[CURSOR_IMAGE_SIZE_32];
} PointerDef32} ;

typedef struct {
    byte        PD_width;
    byte    	PD_height;
    sbyte	PD_hotX;
    sbyte	PD_hotY;
    byte	PD_mask[CURSOR_IMAGE_SIZE_64];
    byte	PD_image[CURSOR_IMAGE_SIZE_64];
} PointerDef64} ;

/***/

typedef ByteEnum GStringElement ;
#define GR_END_GSTRING  0
#define GR_COMMENT  1
#define GR_NULL_OP  2
#define GR_SET_GSTRING_BOUNDS  3
#define GR_MISC_4  4
#define GR_MISC_5  5
#define GR_MISC_6  6
#define GR_MISC_7  7
#define GR_MISC_8  8
#define GR_MISC_9  9
#define GR_MISC_A  10
#define GR_MISC_B  11
#define GR_MISC_C  12
#define GR_LABEL  13
#define GR_ESCAPE  14
#define GR_NEW_PAGE  15
#define GR_APPLY_ROTATION  16
#define GR_APPLY_SCALE  17
#define GR_APPLY_TRANSLATION  18
#define GR_APPLY_TRANSFORM  19
#define GR_APPLY_TRANSLATION_DWORD  20
#define GR_SET_TRANSFORM  21
#define GR_SET_NULL_TRANSFORM  22
#define GR_SET_DEFAULT_TRANSFORM  23
#define GR_INIT_DEFAULT_TRANSFORM  24
#define GR_SAVE_TRANSFORM  25
#define GR_RESTORE_TRANSFORM  26
#define GR_XFORM_1B  27
#define GR_XFORM_1C  28
#define GR_XFORM_1D  29
#define GR_XFORM_1E  30
#define GR_XFORM_1F  31
#define GR_DRAW_LINE  32
#define GR_DRAW_LINE_TO  33
#define GR_DRAW_REL_LINE_TO  34
#define GR_DRAW_HLINE  35
#define GR_DRAW_HLINE_TO  36
#define GR_DRAW_VLINE  37
#define GR_DRAW_VLINE_TO  38
#define GR_DRAW_POLYLINE  39
#define GR_DRAW_ARC  40
#define GR_DRAW_ARC_3POINT  41
#define GR_DRAW_ARC_3POINT_TO  42
#define GR_DRAW_REL_ARC_3POINT_TO  43
#define GR_DRAW_RECT  44
#define GR_DRAW_RECT_TO  45
#define GR_DRAW_ROUND_RECT  46
#define GR_DRAW_ROUND_RECT_TO  47
#define GR_DRAW_SPLINE  48
#define GR_DRAW_SPLINE_TO  49
#define GR_DRAW_CURVE  50
#define GR_DRAW_CURVE_TO  51
#define GR_DRAW_REL_CURVE_TO  52
#define GR_DRAW_ELLIPSE  53
#define GR_DRAW_POLYGON  54
#define GR_DRAW_POINT  55
#define GR_DRAW_POINT_CP  56
#define GR_BRUSH_POLYLINE  57
#define GR_DRAW_CHAR  58
#define GR_DRAW_CHAR_CP  59
#define GR_DRAW_TEXT  60
#define GR_DRAW_TEXT_CP  61
#define GR_DRAW_TEXT_FIELD  62
#define GR_DRAW_TEXT_PTR  63
#define GR_DRAW_TEXT_OPTR  64
#define GR_DRAW_PATH  65
#define GR_FILL_RECT  66
#define GR_FILL_RECT_TO  67
#define GR_FILL_ROUND_RECT  68
#define GR_FILL_ROUND_RECT_TO  69
#define GR_FILL_ARC  70
#define GR_FILL_POLYGON  71
#define GR_FILL_ELLIPSE  72
#define GR_FILL_PATH  73
#define GR_FILL_ARC_3POINT  74
#define GR_FILL_ARC_3POINT_TO  75
#define GR_FILL_BITMAP  76
#define GR_FILL_BITMAP_CP  77
#define GR_FILL_BITMAP_OPTR  78
#define GR_FILL_BITMAP_PTR  79
#define GR_DRAW_BITMAP  80
#define GR_DRAW_BITMAP_CP  81
#define GR_DRAW_BITMAP_OPTR  82
#define GR_DRAW_BITMAP_PTR  83
#define GSE_BITMAP_SLICE  84
#define GR_OUTPUT_55  85
#define GR_OUTPUT_56  86
#define GR_OUTPUT_57  87
#define GR_OUTPUT_58  88
#define GR_OUTPUT_59  89
#define GR_OUTPUT_5A  90
#define GR_OUTPUT_5B  91
#define GR_OUTPUT_5C  92
#define GR_OUTPUT_5D  93
#define GR_OUTPUT_5E  94
#define GR_OUTPUT_5F  95
#define GR_SAVE_STATE  96
#define GR_RESTORE_STATE  97
#define GR_SET_MIX_MODE  98
#define GR_MOVE_TO  99
#define GR_REL_MOVE_TO  100
#define GR_CREATE_PALETTE  101
#define GR_DESTROY_PALETTE  102
#define GR_SET_PALETTE_ENTRY  103
#define GR_SET_PALETTE  104
#define GR_SET_LINE_COLOR  105
#define GR_SET_LINE_MASK  106
#define GR_SET_LINE_COLOR_MAP  107
#define GR_SET_LINE_WIDTH  108
#define GR_SET_LINE_JOIN  109
#define GR_SET_LINE_END  110
#define GR_SET_LINE_ATTR  111
#define GR_SET_MITER_LIMIT  112
#define GR_SET_LINE_STYLE  113
#define GR_SET_LINE_COLOR_INDEX  114
#define GR_SET_CUSTOM_LINE_MASK  115
#define GR_SET_CUSTOM_LINE_STYLE  116
#define GR_SET_AREA_COLOR  117
#define GR_SET_AREA_MASK  118
#define GR_SET_AREA_COLOR_MAP  119
#define GR_SET_AREA_ATTR  120
#define GR_SET_AREA_COLOR_INDEX  121
#define GR_SET_CUSTOM_AREA_MASK  122
#define GR_SET_AREA_PATTERN  123
#define GR_SET_CUSTOM_AREA_PATTERN  124
#define GR_SET_TEXT_COLOR  125
#define GR_SET_TEXT_MASK  126
#define GR_SET_TEXT_COLOR_MAP  127
#define GR_SET_TEXT_STYLE  128
#define GR_SET_TEXT_MODE  129
#define GR_SET_TEXT_SPACE_PAD  130
#define GR_SET_TEXT_ATTR  131
#define GR_SET_FONT  132
#define GR_SET_TEXT_COLOR_INDEX  133
#define GR_SET_CUSTOM_TEXT_MASK  134
#define GR_SET_TRACK_KERN  135
#define GR_SET_FONT_WEIGHT  136
#define GR_SET_FONT_WIDTH  137
#define GR_SET_SUPERSCRIPT_ATTR  138
#define GR_SET_SUBSCRIPT_ATTR  139
#define GR_SET_TEXT_PATTERN  140
#define GR_SET_CUSTOM_TEXT_PATTERN  141
#define GR_ATTR_8E  142
#define GR_ATTR_8F  143
#define GR_ATTR_90  144
#define GR_ATTR_91  145
#define GR_ATTR_92  146
#define GR_ATTR_93  147
#define GR_ATTR_94  148
#define GR_ATTR_95  149
#define GR_ATTR_96  150
#define GR_ATTR_97  151
#define GR_ATTR_98  152
#define GR_ATTR_99  153
#define GR_ATTR_9A  154
#define GR_ATTR_9B  155
#define GR_ATTR_9C  156
#define GR_ATTR_9D  157
#define GR_ATTR_9E  158
#define GR_ATTR_9F  159
#define GR_BEGIN_PATH  160
#define GR_END_PATH  161
#define GR_SET_CLIP_RECT  162
#define GR_SET_WIN_CLIP_RECT  163
#define GR_CLOSE_SUB_PATH  164
#define GR_SET_CLIP_PATH  165
#define GR_SET_WIN_CLIP_PATH  166
#define GR_SET_STROKE_PATH  167
#define GR_PATH_A8  168
#define GR_PATH_A9  169
#define GR_PATH_AA  170
#define GR_PATH_AB  171
#define GR_PATH_AC  172
#define GR_PATH_AD  173
#define GR_PATH_AE  174
#define GR_PATH_AF  175
#define NUM_GSTRING_CMDS  176

/***/

extern dword		/* width << 16 */
    _pascal GrCharWidth (GStateHandle gstate, word ch);

/***/

extern word	/*XXX*/
    _pascal GrTextWidth (GStateHandle gstate, const char *str, word size);

/***/

extern CharInfo	/*XXX*/
    _pascal GrGetCharInfo (GStateHandle gstate, word ch);

/***/

extern dword		/* width << 16 */	/*XXX*/
    _pascal GrTextWidthWWFixed (GStateHandle gstate, const char *str, word size);

/***/

extern MemHandle	/*XXX*/
    _pascal GrGetBitmap (GStateHandle gstate, sword x, sword y, word width,
                word height, XYSize *sizeCopied);

/***/

extern RGBColorAsDWord	/*XXX*/
    _pascal GrGetPoint (GStateHandle gstate, sword x, sword y);

/***/

extern VMBlockHandle	/*XXX*/
    _pascal GrCreateBitmap (BMFormat initFormat, word initWidth, word initHeight,
        VMFileHandle vmFile, optr exposureOD, GStateHandle *bmgs);

/***/

extern GStateHandle	/*XXX*/
    _pascal GrEditBitmap (VMFileHandle vmFile, VMBlockHandle vmBlock, optr exposureOD);

/***/

extern VMBlockHandle	/*XXX*/
    _pascal GrCompactBitmap (VMFileHandle srcFile, VMBlockHandle srcBlock, VMFileHandle destFile);

/***/

extern VMBlockHandle	/*XXX*/
    _pascal GrUncompactBitmap (VMFileHandle srcFile, VMBlockHandle srcBlock, VMFileHandle destFile);

/***/

typedef ByteEnum BMDestroy ;
#define BMD_KILL_DATA  0
#define BMD_LEAVE_DATA  1

extern void	/*XXX*/
    _pascal GrDestroyBitmap (GStateHandle gstate, BMDestroy flags);

/***/

typedef WordFlags BitmapMode ;
#define	BM_EDIT_MASK		    0x0002
#define BM_CLUSTERED_DITHER  0x0001

extern void 	/*XXX*/
    _pascal GrSetBitmapMode (GStateHandle gstate, word flags, MemHandle colorCorr);

/***/

extern word  	/*XXX*/
    _pascal GrGetBitmapMode (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrSetBitmapRes (GStateHandle gstate, word xRes, word yRes);

/***/

extern XYValueAsDWord	/*XXX*/
    _pascal GrGetBitmapRes (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrClearBitmap (GStateHandle gstate);

/***/

extern XYValueAsDWord	/*XXX*/
    _pascal GrGetBitmapSize (const Bitmap *bm);

/***/

extern XYValueAsDWord
    _pascal GrGetHugeBitmapSize (VMFileHandle vmFile, VMBlockHandle vmBlk);

/***/

extern void	/*XXX*/
    _pascal GrDrawRegion (GStateHandle gstate, sword xPos, sword yPos,
            const Region *reg, word cxParam, word dxParam);

/***/

extern void	/*XXX*/
    _pascal GrDrawRegionAtCP (GStateHandle gstate, const Region *reg,
             word axParam, word bxParam, word cxParam, word dxParam);

/***/

extern void	/*XXX*/
    _pascal GrMoveReg (Region *reg, sword xOffset, sword yOffset);

/***/

extern word		/* returns region size */	/*XXX*/
    _pascal GrGetPtrRegBounds (const Region *reg, Rectangle *bounds);

/***/

extern Boolean	/*XXX*/
    _pascal GrTestPointInReg (const Region *reg, word xPos, word yPos,
             Rectangle *boundingRect);

/***/

typedef ByteEnum TestRectReturnType ;
#define TRRT_OUT  0
#define TRRT_PARTIAL  1
#define TRRT_IN  2

extern TestRectReturnType	/*XXX*/
    _pascal GrTestRectInReg (const Region *reg, sword left, sword top,
            sword right, sword bottom);

/***/

extern TestRectReturnType	/*XXX*/
    _pascal GrTestRectInMask (GStateHandle gstate, sword left, sword top,
            sword right, sword bottom);

/***/

#define WWFIXED_OVERFLOW  0x80000000

extern WWFixedAsDWord
    _pascal GrMulWWFixed (WWFixedAsDWord i, WWFixedAsDWord j);

/***/

extern void	/*XXX*/
    _pascal GrMulDWFixed (const DWFixed *i, const DWFixed *j, DWFixed *result);

/***/

extern WWFixedAsDWord	/*XXX*/
    _pascal GrSDivWWFixed (WWFixedAsDWord dividend, WWFixedAsDWord divisor);

/***/

extern WWFixedAsDWord
    _pascal GrUDivWWFixed (WWFixedAsDWord dividend, WWFixedAsDWord divisor);

/***/

extern WWFixedAsDWord	/*XXX*/
    _pascal GrSqrRootWWFixed (WWFixedAsDWord i);

/***/

extern void	/*XXX*/
    _pascal GrSDivDWFbyWWF (const DWFixed *dividend,
           const WWFixed *divisor,
           DWFixed *quotient);

/***/
extern WWFixedAsDWord	/*XXX*/
    _pascal GrQuickSine (WWFixedAsDWord angle);

/***/

extern WWFixedAsDWord	/*XXX*/
    _pascal GrQuickCosine (WWFixedAsDWord angle);

/***/

extern WWFixedAsDWord	/*XXX*/
    _pascal GrQuickTangent (WWFixedAsDWord angle);

/***/

extern WWFixedAsDWord	/*XXX*/
    _pascal GrQuickArcSine (WWFixedAsDWord deltaYDivDistance, word origDeltaX);

/***/

extern GStateHandle
    _pascal GrCreateState (WindowHandle win);

/***/

extern void
    _pascal GrDestroyState (GStateHandle gstate);

/***/

extern void /*XXX*/
    _pascal GrSetVMFile (GStateHandle gstate, VMFileHandle vmFile);

/***/

extern GStateHandle /*XXX*/
    _pascal GrGetExclusive (GeodeHandle videoDriver);

/***/

extern void /*XXX*/
    _pascal GrGrabExclusive (GeodeHandle videoDriver, GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrReleaseExclusive (GeodeHandle videoDriver, GStateHandle gstate,
                Rectangle *bounds);

/***/

extern void	/*XXX*/
    _pascal GrTransformWWFixed (GStateHandle gstate, WWFixedAsDWord xPos,
            WWFixedAsDWord yPos, PointWWFixed *deviceCoordinates);

/***/

extern void	/*XXX*/
    _pascal GrTransformDWFixed (GStateHandle gstate, PointDWFixed *coord);

/***/

extern void	/*XXX*/
    _pascal GrUntransformWWFixed (GStateHandle gstate,
             WWFixedAsDWord xPos,
             WWFixedAsDWord yPos,
             PointWWFixed *documentCoordinates);

/***/

extern void	/*XXX*/
    _pascal GrUntransformDWFixed (GStateHandle gstate, PointDWFixed *coord);

/***/

typedef enum /* word */ {
    BLTM_COPY    ,
    BLTM_MOVE    ,
    BLTM_CLEAR
} BLTMode} ;

extern void	/*XXX*/
    _pascal GrBitBlt (GStateHandle gstate, sword sourceX, sword sourceY, sword destX,
         sword destY, word width, word height, BLTMode mode);

/***/

extern XYValueAsDWord	/*XXX*/
    _pascal GrTransform (GStateHandle gstate, sword xCoord, sword yCoord);

/***/

extern void	/*XXX*/
    _pascal GrTransformDWord (GStateHandle gstate, sdword xCoord,
            sdword yCoord, PointDWord *deviceCoordinates);

/***/

extern XYValueAsDWord	/*XXX*/
    _pascal GrUntransform (GStateHandle gstate, sword xCoord, sword yCoord);

/***/

extern void	/*XXX*/
    _pascal GrUntransformDWord (GStateHandle gstate, sdword xCoord,
              sdword yCoord, PointDWord *documentCoordinates);

/***/

extern RGBColorAsDWord	/*XXX*/
    _pascal GrMapColorIndex (GStateHandle gstate, Color c);

/***/

extern RGBColorAsDWord	/*XXX*/
    _pascal GrMapColorRGB (GStateHandle gstate, word red, word green, word blue,
              Color _far *index);

/***/

typedef ByteEnum GetPalType ;
#define GPT_ACTIVE  0
#define GPT_DEFAULT  1

extern MemHandle	/*XXX*/
    _pascal GrGetPalette (GStateHandle gstate, GetPalType flag);

/***/

extern void	/*XXX*/
    _pascal GrSetPrivateData (GStateHandle gstate, word dataAX, word dataBX,
             word dataCX, word dataDX);

/***/

extern MixMode	/*XXX*/
    _pascal GrGetMixMode (GStateHandle gstate);

/***/

extern RGBColorAsDWord	/*XXX*/
    _pascal GrGetLineColor (GStateHandle gstate);

/***/

extern RGBColorAsDWord	/*XXX*/
    _pascal GrGetAreaColor (GStateHandle gstate);

/***/

extern RGBColorAsDWord	/*XXX*/
    _pascal GrGetTextColor (GStateHandle gstate);

/***/

typedef ByteEnum GetMaskType ;
#define GMT_ENUM  0
#define GMT_BUFFER  1

extern word	/* SysDrawMask */	/*XXX*/
    _pascal GrGetLineMask (GStateHandle gstate, DrawMask *dm);

/***/

extern word	/* SysDrawMask */	/*XXX*/
    _pascal GrGetAreaMask (GStateHandle gstate, DrawMask *dm);

/***/

extern word	/* SysDrawMask */	/*XXX*/
    _pascal GrGetTextMask (GStateHandle gstate, DrawMask *dm);

/***/

extern word	/* ColorMapMode */	/*XXX*/
    _pascal GrGetLineColorMap (GStateHandle gstate);

/***/

extern word	/* ColorMapMode */	/*XXX*/
    _pascal GrGetAreaColorMap (GStateHandle gstate);

/***/

extern word	/* ColorMapMode */	/*XXX*/
    _pascal GrGetTextColorMap (GStateHandle gstate);

/***/

extern WWFixedAsDWord	/*XXX*/
    _pascal GrGetTextSpacePad (GStateHandle gstate);

/***/

extern word	/* TextStyle */	/*XXX*/
    _pascal GrGetTextStyle (GStateHandle gstate);

/***/

extern word	/* TextDrawOffset */	/*XXX*/
    _pascal GrGetTextDrawOffset (GStateHandle gstate);

/***/

extern word	/* TextMode */	/*XXX*/
    _pascal GrGetTextMode (GStateHandle gstate);

/***/

extern WWFixedAsDWord	/*XXX*/
    _pascal GrGetLineWidth (GStateHandle gstate);

/***/

extern LineEnd	/*XXX*/
    _pascal GrGetLineEnd (GStateHandle gstate);

/***/

extern LineJoin	/*XXX*/
    _pascal GrGetLineJoin (GStateHandle gstate);

/***/

extern LineStyle	/*XXX*/
    _pascal GrGetLineStyle (GStateHandle gstate);

/***/

extern WWFixedAsDWord	/*XXX*/
    _pascal GrGetMiterLimit (GStateHandle gstate);

/***/

extern XYValueAsDWord
    _pascal GrGetCurPos (GStateHandle gstate);

/***/

extern void
    _pascal GrGetCurPosWWFixed (GStateHandle gstate,
                   PointWWFixed _far *cp);

/***/

typedef enum /* word */ {
    GIT_PRIVATE_DATA    =0,
    GIT_WINDOW    =2,
    GIT_PEN_POS    =4
} GrInfoType} ;

extern void	/*XXX*/
    _pascal GrGetInfo (GStateHandle gstate, GrInfoType type, void *data);

/***/

extern void	/*XXX*/
    _pascal GrGetTransform (GStateHandle gstate, TransMatrix *tm);

/***/

extern FontID	/*XXX*/
    _pascal GrGetFont (GStateHandle gstate, WWFixedAsDWord *pointSize);

/***/

extern word	/*XXX*/
    _pascal GrGetTrackKern (GStateHandle gstate);

/***/

extern Boolean	/*XXX*/
    _pascal GrTestPointInPolygon (GStateHandle gstate, RegionFillRule rule, Point *list,
               word numPoints, sword xCoord, sword yCoord);

/***/

typedef enum /* word */ {
    GSET_NO_ERROR    ,
    GSET_DISK_FULL
} GStringErrorType} ;

extern GStringErrorType	/*XXX*/
    _pascal GrEndGString (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrComment (GStateHandle gstate, const void *data, word size);

/***/

extern void	/*XXX*/
    _pascal GrNullOp (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrEscape (GStateHandle gstate, word code, const void *data, word size);

/***/

extern void	/*XXX*/
    _pascal GrSaveState (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrRestoreState (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrNewPage (GStateHandle gstate, PageEndCommand pageEndCommand);

/***/

extern void
    _pascal GrApplyRotation (GStateHandle gstate, WWFixedAsDWord angle);

/***/

extern void	/*XXX*/
    _pascal GrApplyScale (GStateHandle gstate, WWFixedAsDWord xScale,
         WWFixedAsDWord yScale);

/***/

extern void	/*XXX*/
    _pascal GrApplyTranslation (GStateHandle gstate, WWFixedAsDWord xTrans,
               WWFixedAsDWord yTrans);

/***/

extern void	/*XXX*/
    _pascal GrApplyTranslationDWord (GStateHandle gstate, sdword xTrans, sdword yTrans);

/***/

extern void	/*XXX*/
    _pascal GrSetTransform (GStateHandle gstate, const TransMatrix *tm);

/***/

extern void	/*XXX*/
    _pascal GrApplyTransform (GStateHandle gstate, const TransMatrix *tm);

/***/

extern void	/*XXX*/
    _pascal GrSaveTransform (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrRestoreTransform (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrSetNullTransform (GStateHandle gstate);

/***/

extern void
    _pascal GrDrawLine (GStateHandle gstate, sword x1, sword y1, sword x2, sword y2);

/***/

extern void	/*XXX*/
    _pascal GrDrawLineTo (GStateHandle gstate, sword x, sword y);

/***/

extern void
    _pascal GrDrawRect (GStateHandle gstate, sword left, sword top, sword right,
           sword bottom);

/***/

extern void	/*XXX*/
    _pascal GrDrawRectTo (GStateHandle gstate, sword x, sword y);

/***/

extern void	/*XXX*/
    _pascal GrDrawHLine (GStateHandle gstate, sword x1, sword y, sword x2);

/***/

extern void	/*XXX*/
    _pascal GrDrawHLineTo (GStateHandle gstate, sword x);

/***/

extern void	/*XXX*/
    _pascal GrDrawVLine (GStateHandle gstate, sword x, sword y1, sword y2);

/***/

extern void	/*XXX*/
    _pascal GrDrawVLineTo (GStateHandle gstate, sword y);

/***/

extern void	/*XXX*/
    _pascal GrDrawRoundRect (GStateHandle gstate, sword left, sword top, sword right,
            sword bottom, word radius);

/***/

extern void	/*XXX*/
    _pascal GrDrawRoundRectTo (GStateHandle gstate, sword bottom, sword right,
              word radius);

/***/

extern void	/*XXX*/
    _pascal GrDrawPoint (GStateHandle gstate, sword x, sword y);

/***/

extern void	/*XXX*/
    _pascal GrDrawPointAtCP (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrDrawBitmap (GStateHandle gstate, sword x, sword y, const Bitmap *bm,
         PCB(Bitmap *, callback, (Bitmap *bm)));

/***/

extern void	/*XXX*/
    _pascal GrDrawBitmapAtCP (GStateHandle gstate, const Bitmap *bm,
             PCB(Bitmap *, callback, (Bitmap *bm)));

/***/

extern void	/*XXX*/
    _pascal GrFillBitmap (GStateHandle gstate, sword x, sword y, const Bitmap *bm,
         PCB(Bitmap *, callback, (Bitmap *bm)));

/***/

extern void	/*XXX*/
    _pascal GrFillBitmapAtCP (GStateHandle gstate, const Bitmap *bm,
             PCB(Bitmap *, callback, (Bitmap *bm)));

/***/

extern void	/*XXX*/
    _pascal GrDrawHugeBitmap (GStateHandle gstate, sword x, sword y,
             VMFileHandle vmFile, VMBlockHandle vmBlk);

/***/

extern void	/*XXX*/
    _pascal GrDrawHugeBitmapAtCP (GStateHandle gstate,
             VMFileHandle vmFile, VMBlockHandle vmBlk);

/***/

extern void	/*XXX*/
    _pascal GrFillHugeBitmap (GStateHandle gstate, sword x, sword y,
             VMFileHandle vmFile, VMBlockHandle vmBlk);

/***/

extern void	/*XXX*/
    _pascal GrFillHugeBitmapAtCP (GStateHandle gstate,
             VMFileHandle vmFile, VMBlockHandle vmBlk);

/***/

extern void	/*XXX*/
    _pascal GrDrawImage (GStateHandle gstate, sword x, sword y, ImageFlags flags,
         const Bitmap *bm);

/***/

extern void	/*XXX*/
    _pascal GrDrawHugeImage (GStateHandle gstate, sword x, sword y, ImageFlags flags,
                 VMFileHandle vmFile, VMBlockHandle vmBlk);

/***/

extern void	/*XXX*/
    _pascal GrDrawChar (GStateHandle gstate, sword x, sword y, word ch);

/***/

extern void	/*XXX*/
    _pascal GrDrawCharAtCP (GStateHandle gstate, word ch);

/***/

extern void
    _pascal GrDrawText (GStateHandle gstate, sword x, sword y, const char *str,
           word size);

/***/

extern void
    _pascal GrDrawTextAtCP (GStateHandle gstate, const char *str, word size);

/***/

extern void	/*XXX*/
    _pascal GrDrawPolyline (GStateHandle gstate, const Point *points, word numPoints);
/***/

extern void	/*XXX*/
    _pascal GrBrushPolyline (GStateHandle gstate, const Point *points, word numPoints,
            word brushH, word brushW);

/***/

extern void	/*XXX*/
    _pascal GrDrawEllipse (GStateHandle gstate, sword left, sword top,
          sword right, sword bottom);

/***/

extern void	/*XXX*/
    _pascal GrDrawArc (GStateHandle gstate, sword left,
                        sword top, sword right, sword bottom,
                word startAngle, word endAngle,
                ArcCloseType closeType);

/***/

extern void	/*XXX*/
    _pascal GrDrawArc3Point  (GStateHandle gstate,
                     const ThreePointArcParams *params);

/***/

extern void	/*XXX*/
    _pascal GrDrawArc3PointTo  (GStateHandle gstate,
                     const ThreePointArcToParams *params);

/***/

extern void	/*XXX*/
    _pascal GrDrawRelArc3PointTo  (GStateHandle gstate,
                     const ThreePointRelArcToParams *params);

/***/

extern void	/*XXX*/
    _pascal GrDrawPolygon (GStateHandle gstate, const Point *points, word numPoints);
/***/

extern void 	/*XXX*/
    _pascal GrDrawSpline (GStateHandle gstate, const Point *points, word numPoints);

/***/
extern void 	/*XXX*/
    _pascal GrDrawSplineTo (GStateHandle gstate, const Point *points, word numPoints);

/***/

extern void 	/*XXX*/
    _pascal GrDrawCurve (GStateHandle gstate, const Point *points);

/***/

extern void 	/*XXX*/
    _pascal GrDrawCurveTo (GStateHandle gstate, const Point *points);

/***/

extern void
    _pascal GrFillRect (GStateHandle gstate, sword left, sword top, sword right,
           sword bottom);

/***/

extern void	/*XXX*/
    _pascal GrFillRectTo (GStateHandle gstate, sword x, sword y);

/***/

extern void	/*XXX*/
    _pascal GrFillRoundRect (GStateHandle gstate, sword left, sword top, sword right,
            sword bottom, word radius);

/***/

extern void	/*XXX*/
    _pascal GrFillRoundRectTo (GStateHandle gstate, sword right, sword bottom,
              word radius);

/***/

extern void	/*XXX*/
    _pascal GrFillArc (GStateHandle gstate, sword left,
                        sword top, sword right, sword bottom,
                word startAngle, word endAngle,
                ArcCloseType closeType);

/***/

extern void	/*XXX*/
    _pascal GrFillArc3Point  (GStateHandle gstate,
                     const ThreePointArcParams *params);

/***/

extern void	/*XXX*/
    _pascal GrFillArc3PointTo  (GStateHandle gstate,
                       const ThreePointArcToParams *params);

/***/

extern void
    _pascal GrFillPolygon (GStateHandle gstate, RegionFillRule windingRule,
          const Point *points, word numPoints);

/***/

extern void
    _pascal GrFillEllipse (GStateHandle gstate, sword left, sword top, sword right,
          sword bottom);

/***/

extern void	/*XXX*/
    _pascal GrSetMixMode (GStateHandle gstate, MixMode mode);

/***/

extern void	/*XXX*/
    _pascal GrRelMoveTo (GStateHandle gstate, WWFixedAsDWord x, WWFixedAsDWord y);

/***/

extern void	/*XXX*/
    _pascal GrMoveToWWFixed (GStateHandle gstate, WWFixedAsDWord x, WWFixedAsDWord y);

/***/

extern void	/*XXX*/
    _pascal GrDrawRelLineTo (GStateHandle gstate, WWFixedAsDWord x, WWFixedAsDWord y);

/***/

extern void
    _pascal GrMoveTo (GStateHandle gstate, sword x, sword y);

/***/

extern void
    _pascal GrSetLineColor (GStateHandle gstate, ColorFlag flag, word redOrIndex,
           word green, word blue);

/***/

extern void	/*XXX*/
    _pascal GrSetLineMaskSys (GStateHandle gstate, word sysDM);

extern void	/*XXX*/
    _pascal GrSetLineMaskCustom (GStateHandle gstate, const DrawMask *dm);

/***/

extern void	/*XXX*/
    _pascal GrSetLineColorMap (GStateHandle gstate, word colorMap);

/***/

extern void
    _pascal GrSetLineWidth (GStateHandle gstate, WWFixedAsDWord width);

/***/

extern void	/*XXX*/
    _pascal GrSetLineJoin (GStateHandle gstate, LineJoin join);

/***/

extern void	/*XXX*/
    _pascal GrSetLineEnd (GStateHandle gstate, LineEnd end);

/***/

typedef struct {
    byte    	    	LA_colorFlag;
    RGBValue	    	LA_color;
    SystemDrawMask  	LA_mask;
    ColorMapMode    	LA_mapMode;
    LineEnd 	    	LA_end;
    LineJoin	    	LA_join;
    LineStyle	    	LA_style;
    WWFixed 	    	LA_width;
} LineAttr} ;

extern void	/*XXX*/
    _pascal GrSetLineAttr (GStateHandle gstate, const LineAttr *la);

/***/

extern void	/*XXX*/
    _pascal GrSetMiterLimit (GStateHandle gstate, WWFixedAsDWord limit);

/***/

extern void	/*XXX*/
    _pascal GrSetLineStyle (GStateHandle gstate, LineStyle style, word skipDistance,
           const DashPairArray *dpa, word numPairs);

/***/

extern void
    _pascal GrSetAreaColor (GStateHandle gstate, ColorFlag flag, word redOrIndex,
           word green, word blue);

/***/

extern void	/*XXX*/
    _pascal GrSetAreaMaskSys (GStateHandle gstate, word sysDM);

extern void	/*XXX*/
    _pascal GrSetAreaMaskCustom (GStateHandle gstate, const DrawMask *dm);

/***/

extern void	/*XXX*/
    _pascal GrSetAreaColorMap (GStateHandle gstate, word colorMap);

/***/

typedef struct {
    byte    	    AA_colorFlag;
    RGBValue	    AA_color;
    SystemDrawMask  AA_mask;
    ColorMapMode    AA_mapMode;
} AreaAttr} ;

extern void	/*XXX*/
    _pascal GrSetAreaAttr (GStateHandle gstate, const AreaAttr *aa);

/***/

extern void
    _pascal GrSetTextColor (GStateHandle gstate, ColorFlag flag, word redOrIndex,
           word green, word blue);

/***/

extern void	/*XXX*/
    _pascal GrSetTextMaskSys (GStateHandle gstate, SysDrawMask sysDM);

extern void	/*XXX*/
    _pascal GrSetTextMaskCustom (GStateHandle gstate, const DrawMask *dm);

/***/

extern void	/*XXX*/
    _pascal GrSetTextColorMap (GStateHandle gstate, word colorMap);

/***/

extern void	/*XXX*/
    _pascal GrSetTextStyle (GStateHandle gstate, TextStyle bitsToSet,
           TextStyle bitsToClear);

/***/

extern void	/*XXX*/
    _pascal GrSetTextMode (GStateHandle gstate, TextMode bitsToSet,
          TextMode bitsToClear);

/***/

extern void	/*XXX*/
    _pascal GrSetTextDrawOffset (GStateHandle gstate, word numToDraw);

/***/

extern void	/*XXX*/
    _pascal GrSetTextSpacePad (GStateHandle gstate, WWFixedAsDWord padding);

/***/

typedef struct {
    ColorQuad		TA_color;
    SystemDrawMask	TA_mask;
    GraphicPattern	TA_pattern;
    TextStyle		TA_styleSet;
    TextStyle		TA_styleClear;
    TextMode		TA_modeSet;
    TextMode		TA_modeClear;
    WBFixed		TA_spacePad;
    FontID		TA_font;
    WBFixed		TA_size;
    sword		TA_trackKern;
    FontWeight	    	TA_fontWeight;
    FontWidth	    	TA_fontWidth;
} TextAttr} ;

extern void	/*XXX*/
    _pascal GrSetTextAttr (GStateHandle gstate, const TextAttr *ta);

/***/

extern void
    _pascal GrSetFont (GStateHandle gstate, FontID id, WWFixedAsDWord pointSize);

/***/

extern void	/*XXX*/
    _pascal GrSetGStringBounds (GStateHandle gstate, sword left, sword top,
              sword right, sword bottom);

/***/

extern word	/*XXX*/
    _pascal GrCreatePalette (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrDestroyPalette (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrSetPaletteEntry (GStateHandle gstate, word index, word red, word green,
              word blue);

/***/

extern void	/*XXX*/
    _pascal GrSetPalette (GStateHandle gstate, const RGBValue *buffer,
         word index, word numEntries);

/***/

extern void	/*XXX*/
    _pascal GrSetTrackKern (GStateHandle gstate, word tk);

/***/

extern void	/*XXX*/
    _pascal GrInitDefaultTransform (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal GrSetDefaultTransform (GStateHandle gstate);

/***/

/*
 * Should not be needed anymore
#define SACRF_REPLACE	0x8000
#define SACRF_NULL	0x2000
#define SACRF_RECT	0x1000
*/

typedef enum /* word */ {
    PCT_NULL    ,
    PCT_REPLACE    ,
    PCT_UNION    ,
    PCT_INTERSECTION
} PathCombineType} ;

extern void	/*XXX*/
    _pascal GrSetClipRect (GStateHandle gstate, PathCombineType flags,
              sword left, sword top,  sword right, sword bottom);

/***/

extern void	/*XXX*/
    _pascal GrSetWinClipRect (GStateHandle gstate, PathCombineType flags,
                 sword left, sword top, sword right, sword bottom);

/***/

extern void 	/*XXX*/
    _pascal GrBeginPath (GStateHandle gstate, PathCombineType params);

extern void 	/*XXX*/
    _pascal GrEndPath (GStateHandle gstate);

extern void 	/*XXX*/
    _pascal GrCloseSubPath (GStateHandle gstate);

extern void 	/*XXX*/
    _pascal GrSetClipPath (GStateHandle gstate, PathCombineType params,
          RegionFillRule rule);

extern void 	/*XXX*/
    _pascal GrSetWinClipPath (GStateHandle gstate,PathCombineType params,
             RegionFillRule rule);

extern void 	/*XXX*/
    _pascal GrFillPath (GStateHandle gstate, RegionFillRule rule);

extern void 	/*XXX*/
    _pascal GrDrawPath (GStateHandle gstate);

extern void 	/*XXX*/
    _pascal GrSetStrokePath (GStateHandle gstate);

typedef enum /* word */ {
    GPT_CURRENT    ,
    GPT_CLIP    ,
    GPT_WIN_CLIP
} GetPathType} ;

extern Boolean 	/*XXX*/
    _pascal GrGetPathBounds (GStateHandle gstate,GetPathType ptype,Rectangle *bounds);

extern Boolean 	/*XXX*/
    _pascal GrGetPathBoundsDWord (GStateHandle gstate,GetPathType ptype,RectDWord *bounds);

extern Boolean 	/*XXX*/
    _pascal GrTestPath (GStateHandle gstate,GetPathType ptype);

extern void 	/*XXX*/
    _pascal GrInvalRect (GStateHandle gstate, sword left, sword top, sword right,
        sword bottom);

extern void 	/*XXX*/
    _pascal GrInvalRectDWord (GStateHandle gstate, const RectDWord *bounds);

extern void 	/*XXX*/
    _pascal GrGetWinBoundsDWord (GStateHandle gstate, RectDWord *bounds);

extern void 	/*XXX*/
    _pascal GrGetMaskBoundsDWord (GStateHandle gstate, RectDWord *bounds);

extern void 	/*XXX*/
    _pascal GrGetWinBounds (GStateHandle gstate, Rectangle *bounds);

extern void 	/*XXX*/
    _pascal GrGetMaskBounds (GStateHandle gstate, Rectangle *bounds);

extern WindowHandle 	/*XXX*/
    _pascal GrGetWinHandle (GStateHandle gstate);

extern Handle 	/*XXX*/
    _pascal GrGetGStringHandle (GStateHandle gstate);

extern void 	/*XXX*/
    _pascal GrSetVMFile (GStateHandle gstate, VMFileHandle vmFile);

extern Boolean 	    	/*XXX*/
    _pascal GrTestPointInPath (GStateHandle gstate, word xPos, word yPos,
              RegionFillRule rule);

extern MemHandle 	/*XXX*/
    _pascal GrGetPath (GStateHandle gstate, GetPathType ptype);

extern Boolean 	    	/*XXX*/
    _pascal GrTestPath (GStateHandle gstate, GetPathType ptype);

extern MemHandle 	/*XXX*/
    _pascal GrGetPathPoints (GStateHandle gstate, word resolution);

extern MemHandle 	/*XXX*/
    _pascal GrGetPathRegion (GStateHandle gstate, RegionFillRule rule);

extern MemHandle 	/*XXX*/
    _pascal GrGetClipRegion (GStateHandle gstate, RegionFillRule rule);

extern void 	    	/*XXX*/
    _pascal GrSetAreaPattern  (GStateHandle gstate, GraphicPattern pattern);

extern void 	    	/*XXX*/
    _pascal GrSetCustomAreaPattern  (GStateHandle gstate, GraphicPattern pattern,
                const void *patternData, word patternSize);

extern void 	    	/*XXX*/
    _pascal GrSetTextPattern  (GStateHandle gstate, GraphicPattern pattern);

extern void 	    	/*XXX*/
    _pascal GrSetCustomTextPattern  (GStateHandle gstate, GraphicPattern pattern,
                const void *patternData);

extern GraphicPattern	/*XXX*/
    _pascal GrGetAreaPattern  (GStateHandle gstate,
              const MemHandle *customPattern, word *customSize);

extern GraphicPattern	/*XXX*/
    _pascal GrGetTextPattern  (GStateHandle gstate,
              const MemHandle *customPattern, word *customSize);

extern Boolean
    _pascal GrGetTextBounds (GStateHandle gstate, const char _far *str,
                word xpos, word ypos,
                word count, Rectangle *bounds);

#ifdef __HIGHC__
pragma Alias(GrCharWidth, "GRCHARWIDTH");
pragma Alias(GrTextWidth, "GRTEXTWIDTH");
pragma Alias(GrGetCharInfo, "GRGETCHARINFO");
pragma Alias(GrTextWidthWWFixed, "GRTEXTWIDTHWWFIXED");
pragma Alias(GrGetBitmap, "GRGETBITMAP");
pragma Alias(GrGetPoint, "GRGETPOINT");
pragma Alias(GrCreateBitmap, "GRCREATEBITMAP");
pragma Alias(GrEditBitmap, "GREDITBITMAP");
pragma Alias(GrCompactBitmap, "GRCOMPACTBITMAP");
pragma Alias(GrUncompactBitmap, "GRUNCOMPACTBITMAP");
pragma Alias(GrDestroyBitmap, "GRDESTROYBITMAP");
pragma Alias(GrSetBitmapMode, "GRSETBITMAPMODE");
pragma Alias(GrGetBitmapMode, "GRGETBITMAPMODE");
pragma Alias(GrSetBitmapRes, "GRSETBITMAPRES");
pragma Alias(GrGetBitmapRes, "GRGETBITMAPRES");
pragma Alias(GrClearBitmap, "GRCLEARBITMAP");
pragma Alias(GrGetBitmapSize, "GRGETBITMAPSIZE");
pragma Alias(GrGetHugeBitmapSize, "GRGETHUGEBITMAPSIZE");
pragma Alias(GrDrawRegion, "GRDRAWREGION");
pragma Alias(GrDrawRegionAtCP, "GRDRAWREGIONATCP");
pragma Alias(GrMoveReg, "GRMOVEREG");
pragma Alias(GrGetPtrRegBounds, "GRGETPTRREGBOUNDS");
pragma Alias(GrTestPointInReg, "GRTESTPOINTINREG");
pragma Alias(GrTestRectInReg, "GRTESTRECTINREG");
pragma Alias(GrTestRectInMask, "GRTESTRECTINMASK");
pragma Alias(GrMulWWFixed, "GRMULWWFIXED");
pragma Alias(GrMulDWFixed, "GRMULDWFIXED");
pragma Alias(GrSDivWWFixed, "GRSDIVWWFIXED");
pragma Alias(GrUDivWWFixed, "GRUDIVWWFIXED");
pragma Alias(GrSqrRootWWFixed, "GRSQRROOTWWFIXED");
pragma Alias(GrSDivDWFbyWWF, "GRSDIVDWFBYWWF");
pragma Alias(GrQuickSine, "GRQUICKSINE");
pragma Alias(GrQuickCosine, "GRQUICKCOSINE");
pragma Alias(GrQuickTangent, "GRQUICKTANGENT");
pragma Alias(GrQuickArcSine, "GRQUICKARCSINE");
pragma Alias(GrCreateState, "GRCREATESTATE");
pragma Alias(GrDestroyState, "GRDESTROYSTATE");
pragma Alias(GrSetVMFile, "GRSETVMFILE");
pragma Alias(GrGetExclusive, "GRGETEXCLUSIVE");
pragma Alias(GrGrabExclusive, "GRGRABEXCLUSIVE");
pragma Alias(GrReleaseExclusive, "GRRELEASEEXCLUSIVE");
pragma Alias(GrTransformWWFixed, "GRTRANSFORMWWFIXED");
pragma Alias(GrTransformDWFixed, "GRTRANSFORMDWFIXED");
pragma Alias(GrUntransformWWFixed, "GRUNTRANSFORMWWFIXED");
pragma Alias(GrUntransformDWFixed, "GRUNTRANSFORMDWFIXED");
pragma Alias(GrBitBlt, "GRBITBLT");
pragma Alias(GrTransform, "GRTRANSFORM");
pragma Alias(GrTransformDWord, "GRTRANSFORMDWORD");
pragma Alias(GrUntransform, "GRUNTRANSFORM");
pragma Alias(GrUntransformDWord, "GRUNTRANSFORMDWORD");
pragma Alias(GrMapColorIndex, "GRMAPCOLORINDEX");
pragma Alias(GrMapColorRGB, "GRMAPCOLORRGB");
pragma Alias(GrGetPalette, "GRGETPALETTE");
pragma Alias(GrSetPrivateData, "GRSETPRIVATEDATA");
pragma Alias(GrGetMixMode, "GRGETMIXMODE");
pragma Alias(GrGetLineColor, "GRGETLINECOLOR");
pragma Alias(GrGetAreaColor, "GRGETAREACOLOR");
pragma Alias(GrGetTextColor, "GRGETTEXTCOLOR");
pragma Alias(GrGetLineMask, "GRGETLINEMASK");
pragma Alias(GrGetAreaMask, "GRGETAREAMASK");
pragma Alias(GrGetTextMask, "GRGETTEXTMASK");
pragma Alias(GrGetLineColorMap, "GRGETLINECOLORMAP");
pragma Alias(GrGetAreaColorMap, "GRGETAREACOLORMAP");
pragma Alias(GrGetTextColorMap, "GRGETTEXTCOLORMAP");
pragma Alias(GrGetTextSpacePad, "GRGETTEXTSPACEPAD");
pragma Alias(GrGetTextStyle, "GRGETTEXTSTYLE");
pragma Alias(GrGetTextDrawOffset, "GRGETTEXTDRAWOFFSET");
pragma Alias(GrGetTextMode, "GRGETTEXTMODE");
pragma Alias(GrGetLineWidth, "GRGETLINEWIDTH");
pragma Alias(GrGetLineEnd, "GRGETLINEEND");
pragma Alias(GrGetLineJoin, "GRGETLINEJOIN");
pragma Alias(GrGetLineStyle, "GRGETLINESTYLE");
pragma Alias(GrGetMiterLimit, "GRGETMITERLIMIT");
pragma Alias(GrGetCurPos, "GRGETCURPOS");
pragma Alias(GrGetCurPosWWFixed, "GRGETCURPOSWWFIXED");
pragma Alias(GrGetInfo, "GRGETINFO");
pragma Alias(GrGetTransform, "GRGETTRANSFORM");
pragma Alias(GrGetFont, "GRGETFONT");
pragma Alias(GrTestPointInPolygon, "GRTESTPOINTINPOLYGON");
pragma Alias(GrEndGString, "GRENDGSTRING");
pragma Alias(GrComment, "GRCOMMENT");
pragma Alias(GrNullOp, "GRNULLOP");
pragma Alias(GrEscape, "GRESCAPE");
pragma Alias(GrSaveState, "GRSAVESTATE");
pragma Alias(GrRestoreState, "GRRESTORESTATE");
pragma Alias(GrNewPage, "GRNEWPAGE");
pragma Alias(GrApplyRotation, "GRAPPLYROTATION");
pragma Alias(GrApplyScale, "GRAPPLYSCALE");
pragma Alias(GrApplyTranslation, "GRAPPLYTRANSLATION");
pragma Alias(GrApplyTranslationDWord, "GRAPPLYTRANSLATIONDWORD");
pragma Alias(GrSetTransform, "GRSETTRANSFORM");
pragma Alias(GrApplyTransform, "GRAPPLYTRANSFORM");
pragma Alias(GrSaveTransform, "GRSAVETRANSFORM");
pragma Alias(GrRestoreTransform, "GRRESTORETRANSFORM");
pragma Alias(GrSetNullTransform, "GRSETNULLTRANSFORM");
pragma Alias(GrDrawLine, "GRDRAWLINE");
pragma Alias(GrDrawLineTo, "GRDRAWLINETO");
pragma Alias(GrDrawRelLineTo, "GRDRAWRELLINETO");
pragma Alias(GrDrawRect, "GRDRAWRECT");
pragma Alias(GrDrawRectTo, "GRDRAWRECTTO");
pragma Alias(GrDrawHLine, "GRDRAWHLINE");
pragma Alias(GrDrawHLineTo, "GRDRAWHLINETO");
pragma Alias(GrDrawVLine, "GRDRAWVLINE");
pragma Alias(GrDrawVLineTo, "GRDRAWVLINETO");
pragma Alias(GrDrawRoundRect, "GRDRAWROUNDRECT");
pragma Alias(GrDrawRoundRectTo, "GRDRAWROUNDRECTTO");
pragma Alias(GrDrawPoint, "GRDRAWPOINT");
pragma Alias(GrDrawPointAtCP, "GRDRAWPOINTATCP");
pragma Alias(GrDrawBitmap, "GRDRAWBITMAP");
pragma Alias(GrDrawBitmapAtCP, "GRDRAWBITMAPATCP");
pragma Alias(GrDrawChar, "GRDRAWCHAR");
pragma Alias(GrDrawCharAtCP, "GRDRAWCHARATCP");
pragma Alias(GrDrawText, "GRDRAWTEXT");
pragma Alias(GrDrawTextAtCP, "GRDRAWTEXTATCP");
pragma Alias(GrDrawPolyline, "GRDRAWPOLYLINE");
pragma Alias(GrDrawEllipse, "GRDRAWELLIPSE");
pragma Alias(GrDrawArc, "GRDRAWARC");
pragma Alias(GrDrawArc3Point, "GRDRAWARC3POINT");
pragma Alias(GrDrawArc3PointTo, "GRDRAWARC3POINTTO");
pragma Alias(GrDrawRelArc3PointTo, "GRDRAWRELARC3POINTTO");
pragma Alias(GrDrawSpline, "GRDRAWSPLINE");
pragma Alias(GrDrawSplineTo, "GRDRAWSPLINETO");
pragma Alias(GrDrawCurve, "GRDRAWCURVE");
pragma Alias(GrDrawCurveTo, "GRDRAWCURVETO");
pragma Alias(GrDrawPolygon, "GRDRAWPOLYGON");
pragma Alias(GrFillRect, "GRFILLRECT");
pragma Alias(GrFillRectTo, "GRFILLRECTTO");
pragma Alias(GrFillRoundRect, "GRFILLROUNDRECT");
pragma Alias(GrFillRoundRectTo, "GRFILLROUNDRECTTO");
pragma Alias(GrFillArc, "GRFILLARC");
pragma Alias(GrFillArc3Point, "GRFILLARC3POINT");
pragma Alias(GrFillArc3PointTo, "GRFILLARC3POINTTO");
pragma Alias(GrFillPolygon, "GRFILLPOLYGON");
pragma Alias(GrFillEllipse, "GRFILLELLIPSE");
pragma Alias(GrSetMixMode, "GRSETMIXMODE");
pragma Alias(GrRelMoveTo, "GRRELMOVETO");
pragma Alias(GrMoveTo, "GRMOVETO");
pragma Alias(GrSetLineColor, "GRSETLINECOLOR");
pragma Alias(GrSetLineMaskSys, "GRSETLINEMASKSYS");
pragma Alias(GrSetLineMaskCustom, "GRSETLINEMASKCUSTOM");
pragma Alias(GrSetLineColorMap, "GRSETLINECOLORMAP");
pragma Alias(GrSetLineWidth, "GRSETLINEWIDTH");
pragma Alias(GrSetLineJoin, "GRSETLINEJOIN");
pragma Alias(GrSetLineEnd, "GRSETLINEEND");
pragma Alias(GrSetLineAttr, "GRSETLINEATTR");
pragma Alias(GrSetMiterLimit, "GRSETMITERLIMIT");
pragma Alias(GrSetLineStyle, "GRSETLINESTYLE");
pragma Alias(GrSetAreaColor, "GRSETAREACOLOR");
pragma Alias(GrSetAreaMaskSys, "GRSETAREAMASKSYS");
pragma Alias(GrSetAreaMaskCustom, "GRSETAREAMASKCUSTOM");
pragma Alias(GrSetAreaColorMap, "GRSETAREACOLORMAP");
pragma Alias(GrSetAreaAttr, "GRSETAREAATTR");
pragma Alias(GrSetTextColor, "GRSETTEXTCOLOR");
pragma Alias(GrSetTextMaskSys, "GRSETTEXTMASKSYS");
pragma Alias(GrSetTextMaskCustom, "GRSETTEXTMASKCUSTOM");
pragma Alias(GrSetTextColorMap, "GRSETTEXTCOLORMAP");
pragma Alias(GrSetTextStyle, "GRSETTEXTSTYLE");
pragma Alias(GrSetTextMode, "GRSETTEXTMODE");
pragma Alias(GrSetTextDrawOffset, "GRSETTEXTDRAWOFFSET");
pragma Alias(GrSetTextSpacePad, "GRSETTEXTSPACEPAD");
pragma Alias(GrSetTextAttr, "GRSETTEXTATTR");
pragma Alias(GrSetFont, "GRSETFONT");
pragma Alias(GrSetGStringBounds, "GRSETGSTRINGBOUNDS");
pragma Alias(GrCreatePalette, "GRCREATEPALETTE");
pragma Alias(GrDestroyPalette, "GRDESTROYPALETTE");
pragma Alias(GrSetPaletteEntry, "GRSETPALETTEENTRY");
pragma Alias(GrSetPalette, "GRSETPALETTE");
pragma Alias(GrSetTrackKern, "GRSETTRACKKERN");
pragma Alias(GrInitDefaultTransform, "GRINITDEFAULTTRANSFORM");
pragma Alias(GrSetDefaultTransform, "GRSETDEFAULTTRANSFORM");
pragma Alias(GrSetClipRect, "GRSETCLIPRECT");
pragma Alias(GrSetWinClipRect, "GRSETWINCLIPRECT");
pragma Alias(GrBeginPath, "GRBEGINPATH");
pragma Alias(GrEndPath, "GRENDPATH");
pragma Alias(GrCloseSubPath, "GRCLOSESUBPATH");
pragma Alias(GrSetClipPath, "GRSETCLIPPATH");
pragma Alias(GrSetWinClipPath, "GRSETWINCLIPPATH");
pragma Alias(GrFillPath, "GRFILLPATH");
pragma Alias(GrDrawPath, "GRDRAWPATH");
pragma Alias(GrSetStrokePath, "GRSETSTROKEPATH");
pragma Alias(GrTestPointInPath, "GRTESTPOINTINPATH");
pragma Alias(GrGetPath, "GRGETPATH");
pragma Alias(GrTestPath, "GRTESTPATH");
pragma Alias(GrGetPathBounds, "GRGETPATHBOUNDS");
pragma Alias(GrGetPathBoundsDWord, "GRGETPATHBOUNDSDWORD");
pragma Alias(GrGetPathPoints, "GRGETPATHPOINTS");
pragma Alias(GrGetPathRegion, "GRGETPATHREGION");
pragma Alias(GrGetClipRegion, "GRGETCLIPREGION");
pragma Alias(GrInvalRect, "GRINVALRECT");
pragma Alias(GrInvalRectDWord, "GRINVALRECTDWORD");
pragma Alias(GrGetWinBoundsDWord, "GRGETWINBOUNDSDWORD");
pragma Alias(GrGetMaskBoundsDWord, "GRGETMASKBOUNDSDWORD");
pragma Alias(GrGetWinBounds, "GRGETWINBOUNDS");
pragma Alias(GrGetMaskBounds, "GRGETMASKBOUNDS");
pragma Alias(GrGetWinHandle, "GRGETWINHANDLE");
pragma Alias(GrBrushPolyline, "GRBRUSHPOLYLINE");
pragma Alias(GrFillBitmap, "GRFILLBITMAP");
pragma Alias(GrFillBitmapAtCP, "GRFILLBITMAPATCP");
pragma Alias(GrGetTrackKern, "GRGETTRACKKERN");
pragma Alias(GrSetAreaPattern, "GRSETAREAPATTERN");
pragma Alias(GrSetCustomAreaPattern, "GRSETCUSTOMAREAPATTERN");
pragma Alias(GrSetTextPattern, "GRSETTEXTPATTERN");
pragma Alias(GrSetCustomTextPattern, "GRSETCUSTOMTEXTPATTERN");
pragma Alias(GrGetAreaPattern, "GRGETAREAPATTERN");
pragma Alias(GrGetTextPattern, "GRGETTEXTPATTERN");
pragma Alias(GrGetTextBounds, "GRGETTEXTBOUNDS");
pragma Alias(GrDrawHugeBitmap, "GRDRAWHUGEBITMAP");
pragma Alias(GrDrawHugeBitmapAtCP, "GRDRAWHUGEBITMAPATCP");
pragma Alias(GrFillHugeBitmap, "GRFILLHUGEBITMAP");
pragma Alias(GrFillHugeBitmapAtCP, "GRFILLHUGEBITMAPATCP");
pragma Alias(GrDrawImage, "GRDRAWIMAGE");
pragma Alias(GrDrawHugeImage, "GRDRAWHUGEIMAGE");
pragma Alias(GrMoveToWWFixed, "GRMOVETOWWFIXED");
pragma Alias(GrGetGStringHandle, "GRGETGSTRINGHANDLE");

#endif

#endif


grobj.goh

/**************************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:		PC GEOS
 * FILE:		grobj.goh
 *
 * AUTHOR:		Allen Schoonmaker
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	Allen 	2/20/92		Inital version
 *	Allen	4/22/92		Updated for controllers
 *
 * DESCRIPTION:
 *	This file is the C header file for the GrObj library
 *
 *      $Id: grobj.goh,v 1.157.6.1 96/04/28 08:28:53 chris Exp $
 *
 **************************************************************************/
@optimize
@deflib grobj

/* #include  <graphics.h>  */

@include  <Objects/colorC.goh>
@include  <Objects/styles.goh>
@include  <Objects/vTextC.goh>
@include  <Objects/gCtrlC.goh>

/*-----------------------------------------------------------------------------
;	Structures and Constants (Added as needed)
-----------------------------------------------------------------------------*/

typedef WordFlags GrObjLocks ;
#define	GOL_COPY	 0x8000
#define	GOL_LOCK	 0x4000
#define	GOL_SHOW	 0x2000
#define	GOL_WRAP	 0x1000
#define	GOL_MOVE	 0x0800
#define	GOL_RESIZE	 0x0400
#define	GOL_ROTATE	 0x0200
#define GOL_SKEW  0x0100
#define	GOL_EDIT	 0x0080
#define	GOL_DELETE	 0x0040
#define	GOL_SELECT	 0x0020
#define	GOL_ATTRIBUTE	 0x0010
#define	GOL_GROUP	 0x0008
#define	GOL_UNGROUP	 0x0004
#define	GOL_DRAW	 0x0002
#define	GOL_PRINT	 0x0001

typedef struct {
    word	GOANS_suspendCount;
    optr	GOANS_optr;
    word	GOANS_message;
} GrObjActionNotificationStruct} ;

typedef enum {
    GOANT_NULL    ,
    GOANT_SELECTED    ,
    GOANT_UNSELECTED    ,
    GOANT_CREATED    ,
    GOANT_MOVED    ,
    GOANT_RESIZED    ,
    GOANT_ROTATED    ,
    GOANT_SKEWED    ,
    GOANT_TRANSFORMED    ,
    GOANT_ATTRED    ,
    GOANT_SPEC_MODIFIED    ,
    GOANT_DELETED    ,
    GOANT_PASTED    ,
    GOANT_WRAP_CHANGED
} GrObjActionNotificationType} ;

#define LINE_ATTR_COLOR_SIZE  3
#define LINE_ATTR_END_SIZE  1
#define LINE_ATTR_JOIN_SIZE  1
#define LINE_ATTR_MASK_SIZE  1
#define LINE_ATTR_DRAW_MODE_SIZE  1
#define LINE_ATTR_WIDTH_SIZE  4
#define LINE_ATTR_STYLE_SIZE  1
#define LINE_ATTR_MITER_LIMIT_SIZE  4
#define LINE_ATTR_TYPE_SIZE  1

typedef ByteFlags GrObjLineAttrInfoRecord ; /* XXX */
#define	GOLAIR_ARROWHEAD_ON_START				0x80
#define	GOLAIR_ARROWHEAD_ON_END					0x40
#define	GOLAIR_ARROWHEAD_FILLED					0x20
#define	GOLAIR_ARROWHEAD_FILL_WITH_AREA_ATTRIBUTES		0x10

typedef enum {
    GOLAET_BASE
} GrObjLineAttrElementType} ;

typedef struct {
    StyleSheetElementHeader    GOBGOBLAE_styleElement;
    byte GOBLAE_r;
    byte GOBLAE_g;
    byte GOBLAE_b;
    LineEnd GOBLAE_end;
    LineJoin GOBLAE_join;
    WWFixed GOBLAE_width;
    SystemDrawMask GOBLAE_mask;
    LineStyle GOBLAE_style;
    MixMode GOBLAE_drawMode;
    WWFixed GOBLAE_miterLimit;
    GrObjLineAttrElementType GOBLAE_laeType;
    GrObjLineAttrInfoRecord GOBLAE_lineInfo;
    byte	GOBLAE_arrowheadAngle;
    byte	GOBLAE_arrowheadLength;
    word GOBLAE_reserved;
} GrObjBaseLineAttrElement} ;

#define FUTURE_LINE_ATTR_ELEMENT_DATA_SIZE  50

typedef struct {
    GrObjBaseLineAttrElement	GOFLAE_base;
    byte 		GOFLAE_future[FUTURE_LINE_ATTR_ELEMENT_DATA_SIZE];
} GrObjFullLineAttrElement} ;

typedef ByteFlags GrObjAreaAttrInfoRecord ; /* XXX */ /* Untested structure */
#define 	GOAAIR_TRANSPARENT 	 	0x01  /* Don't draw object's BG */

typedef enum {
    GOAAET_BASE    ,
    GOAAET_GRADIENT
} GrObjAreaAttrElementType} ;

typedef struct {  /* XXX */ /* Untested structure */
    StyleSheetElementHeader 	GOBAAE_styleElement;
    byte				GOBAAE_r;
    byte 				GOBAAE_g;
    byte 				GOBAAE_b;
    SysDrawMask			GOBAAE_mask;
    MixMode 			GOBAAE_drawMode;
    GraphicPattern			GOBAEE_pattern;
    byte				GOBAEE_backR;
    byte				GOBAEE_backG;
    byte				GOBAEE_backB;
    GrObjAreaAttrElementType	GOBAEE_aaeType;
    GrObjAreaAttrInfoRecord 	GOBAAE_areaInfo;

        /* The following fields are unused, but must
         * be initialized to zero. */
    byte				GOBAAE_reservedByte;
    word 				GOBAAE_reserved;
} GrObjBaseAreaAttrElement} ;

typedef	enum {
    GOGT_NONE	,
    GOGT_LEFT_TO_RIGHT	,
    GOGT_TOP_TO_BOTTOM	,
    GOGT_RADIAL_RECT	,
    GOGT_RADIAL_ELLIPSE
} GrObjGradientType} ;

typedef	struct {
    GrObjBaseAreaAttrElement GOGAAE_base;
    GrObjGradientType	GOGAAE_type;
    byte			GOGAAE_endR;
    byte			GOGAAE_endG;
    byte			GOGAAE_endB;
    word			GOGAAE_numIntervals;
    word			GOGAAE_reserved;
} GrObjGradientAreaAttrElement} ;

typedef WordFlags GrObjStyleFlags ;		/* CHECKME */
#define GSF_AREA_COLOR_RELATIVE 	(0x8000)
#define GSF_AREA_MASK_RELATIVE 	(0x4000)
#define GSF_LINE_COLOR_RELATIVE 	(0x2000)
#define GSF_LINE_MASK_RELATIVE 	(0x1000)
#define GSF_LINE_WIDTH_RELATIVE 	(0x0800)

typedef struct {		/* CHECKME */
    GrObjStyleFlags	GSPD_flags;
    word		GSPD_unused;
} GrObjStylePrivateData} ;

typedef struct {		/* CHECKME */
    NameArrayElement		GSE_meta;
    word			GSE_baseStyle;
    StyleElementFlags		GSE_flags;
    byte			GSE_reserved[6];
    GrObjStylePrivateData	GSE_privateData;
    word			GSE_areaAttrToken;
    word			GSE_lineAttrToken;
} GrObjStyleElement} ;

#define DEFAULT_MAX_LINE_WIDTH 	7

#define SMALL_DESIRED_HANDLE_SIZE  5
#define MEDIUM_DESIRED_HANDLE_SIZE  8
#define LARGE_DESIRED_HANDLE_SIZE  12

#define DEFAULT_DESIRED_HANDLE_SIZE   MEDIUM_DESIRED_HANDLE_SIZE

typedef ByteFlags GrObjHandleSpecification ;
#define	GOHS_HANDLE_LEFT	 0x08
#define	GOHS_HANDLE_TOP	 0x04
#define	GOHS_HANDLE_RIGHT	 0x02
#define	GOHS_HANDLE_BOTTOM	 0x01

typedef WordFlags GrObjFunctionsActive ;		/* CHECKME */
/* 6 bits unused */
/*
 * This is true if the mouse event has
 * been sent to the ruler already. This
 * is used for cases like moving
 * multiple grobjs, where you only want
 * to snap the mouse once, and not a
 * kajillion times for each grobj
 */
#define GOFA_RULER_HAS_SEEN_EVENT 	(0x0200)
/*
 * If true do all drawing operations in
 * high resolution mode
 */
#define GOFA_VIEW_ZOOMED 	(0x0100)
/* If true, snap operation to grid */
#define GOFA_SNAP_TO 	(0x0080)
/*
 * If true then do resize/create
 * from center
 */
#define GOFA_FROM_CENTER 	(0x0040)
/* If true, rotate about opposite corner */
#define GOFA_ABOUT_OPPOSITE 	(0x0020)
/* If true constrain resize,rotate,etc */
#define GOFA_CONSTRAIN 	(0x0010)
/* Same as UIFA_ADJUST */
#define GOFA_ADJUST 	(0x0008)
/* Same as UIFA_EXTEND */
#define GOFA_EXTEND 	(0x0004)
/* needed for check hacks */
/* 2 bits unused */

typedef enum {
    GOWTT_DONT_WRAP	,
    GOWTT_WRAP_AROUND_RECT	,
    GOWTT_WRAP_AROUND_TIGHTLY	,
    GOWTT_WRAP_INSIDE
} GrObjWrapTextType} ;

#define GROBJ_DEFAULT_WRAP_TYPE  GOWTT_DONT_WRAP

typedef WordFlags GrObjAttrFlags ;		/* CHECKME */

/*
 *  When this object is written out to
 *  the transfer format, locks won't be
 *  copied.
 */
#define GOAF_DONT_COPY_LOCKS 	(0x0200)

/*
 * True if object contains paste
 * inside children. Currently
 * only relevant for groups
 */
#define GOAF_HAS_PASTE_INSIDE_CHILDREN 	(0x0100)

/*
 * Meaningless unless object is in
 * a group. If true then object
 * was pasted inside group and will
 * be drawn clipped to group's
 * normal children.
 */
#define GOAF_PASTE_INSIDE 	(0x0080)

/*
 * If true grobject can be
 * moved as a result of a
 * MSG_GO_INSERT_OR_DELETE_SPACE
 */
#define GOAF_INSERT_DELETE_MOVE_ALLOWED 	(0x0040)

/*
 * If true grobject can be
 * resized as a result of a
 * MSG_GO_INSERT_OR_DELETE_SPACE
 */
#define GOAF_INSERT_DELETE_RESIZE_ALLOWED 	(0x0020)

/*
 * If true grobject can be
 * deleted as a result of a
 * MSG_GO_INSERT_OR_DELETE_SPACE
 */
#define GOAF_INSERT_DELETE_DELETE_ALLOWED 	(0x0010)

/*
 * if true then this object is used
 * for instructions in a template.
 */
#define GOAF_INSTRUCTION 	(0x0008)

/*
 * if false, the resize deltas are
 * added to objects coordinates. if
 * true, a scale factor is calculated
 * and applied to objects transform
 */
#define GOAF_MULTIPLICATIVE_RESIZE 	(0x0004)

/*
 * enum describing how to wrap text
 * with respect to object
 */
#define GrObjWrapTextType 	(0x0002 | 0x0001)
#define GrObjWrapTextType_OFFSET 	0

typedef ByteFlags GrObjOptimizationFlags ;		/* CHECKME */
/*
 * Grobject has been added to body,
 * or the group it is in has been
 * added to the body
 */
#define GOOF_ADDED_TO_BODY 	(0x80)

/* If true, objects is in a group */
#define GOOF_IN_GROUP 	(0x40)

/*
 * If true, object is incomplete
 * and cannot be drawn, or invalidated
 * It may be missing
 * its normal transform or have
 * no attributes, etc.
 */
#define GOOF_GROBJ_INVALID 	(0x20)

/* True if object is an attribute manager */
#define GOOF_ATTRIBUTE_MANAGER 	(0x10)

/*
 * GrObj is floater. Don't need to
 * dirty the object when this
 * bit is set
 * because floater objects
 * are not actually in the document
 */
#define GOOF_FLOATER 	(0x08)

/*
 * True if object has an action
 * notification od in it's var
 * data.
 */
#define GOOF_HAS_ACTION_NOTIFICATION 	(0x04)

/*
 * If TRUE, object has vardata
 * ATTR_GO_PARENT_DIMENSIONS_OFFSET, which
 * holds offset from objects center to
 * center of parent dimensions
 */
#define GOOF_HAS_UNBALANCED_PARENT_DIMENSIONS 	(0x02)

typedef	WordFlags	GrObjMessageOptimizationFlags	;
#define	GOMOF_GET_DWF_SELECTION_HANDLE_BOUNDS	 0x200
#define	GOMOF_SPECIAL_RESIZE_CONSTRAIN		0x100
#define	GOMOF_INVALIDATE_LINE			0x80
#define	GOMOF_INVALIDATE_AREA			0x40
#define	GOMOF_INVALIDATE			0x20
#define	GOMOF_NOTIFY_ACTION			0x10
#define	GOMOF_SEND_UI_NOTIFICATION		0x08
#define	GOMOF_DRAW_FG_AREA			0x04
#define	GOMOF_DRAW_FG_LINE			0x02
#define	GOMOF_DRAW_BG				0x01

typedef ByteFlags GrObjActionModes ;
#define	GOAM_RESIZE	 0x0080
#define	GOAM_MOVE	 0x0040
#define	GOAM_ROTATE	 0x0020
#define	GOAM_CHOOSE	 0x0010
#define	GOAM_ACTION_ACTIVATED	 0x0008
#define	GOAM_ACTION_PENDING	 0x0004
#define	GOAM_ACTION_HAPPENING	 0x0002
#define	GOAM_CREATE	 0x0001

typedef ByteFlags GrObjActionEvent ;
#define	GOAE_RULER_CONSTRAIN	 0x40
#define	GOAE_IGNORING_CONSTRAIN	 0x20
#define	GOAE_GAE	 0x01

/*
 * 	Bits that will be lost if the object is discarded
 * 	Must be protected by incing in use count
 */

typedef ByteFlags GrObjTempModes ;		/* CHECKME */
/* GrObj is in the selectionList */
#define GOTM_SELECTED 	(0x80)

/*
 * GrObj is currently being edited
 * equivalent to having app target.
 */
#define GOTM_EDITED 	(0x40)

/*
 * If true the object has drawn
 * some indicator to show the
 * user that it is being edit
 */
#define GOTM_EDIT_INDICATOR_DRAWN 	(0x20)

/*
 * GrObjs selection handles have been
 * drawn
 */
#define GOTM_HANDLES_DRAWN 	(0x10)

/*
 * GrObjs handles are drawn in a
 * temporary state. Set by
 * DRAW_HANDLES_FORCE,
 * DRAW_HANDLES_OPPOSITE and cleared by
 * DRAW_HANDLES_MATCH and DRAW_HANDLES
 * and UNDRAW_HANDLES. Mainly used
 * when drag selecting with pointer
 * to cut down the number of objects
 * that methods must be sent to.
 */
#define GOTM_TEMP_HANDLES 	(0x08)

/*
 * True if the objects sprite has
 * been drawn
 */
#define GOTM_SPRITE_DRAWN 	(0x04)

/*
 * True if when the objects sprite
 * was drawn it was drawn at a
 * higher resolution. This bit
 * is meaningless if GOTM_SPRITE_DRAWN
 * is not set
 */
#define GOTM_SPRITE_DRAWN_HI_RES 	(0x02)

/*
 * True if body has the system target
 * Bit is meaningless unless
 * GOTM_SELECTED or GOTM_EDITED is
 * set. (body only updates objects
 * in selection list and with
 * app target.
 */
#define GOTM_SYS_TARGET 	(0x01)

typedef ByteFlags GrObjFileStatus ;
#define GOFS_MOUSE_GRAB  0x08
#define GOFS_SYS_TARGETED  0x04
#define GOFS_TARGETED  0x02
#define GOFS_OPEN  0x01

typedef WordFlags GrObjUINotificationTypes ;		/* CHECKME */
/* True if style notification needs to be sent */
#define GOUINT_STYLE 	(0x8000)
/* True if area notification needs to be sent */
#define GOUINT_AREA 	(0x4000)
/* True if line notification needs to be sent */
#define GOUINT_LINE 	(0x2000)
/* True if grobj specific selection state notification needs to be sent */
#define GOUINT_GROBJ_SELECT 	(0x1000)
/* True if style notification needs to be sent */
#define GOUINT_STYLE_SHEET 	(0x0800)
/* True if edit menu notification need be sent */
#define GOUINT_SELECT 	(0x0400)

/*-----------------------------------------------------------------------------
    GrObj Controller Definitions
-----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
    GrObjStyleSheetControlClass
-----------------------------------------------------------------------------*/
@class	GrObjStyleSheetControlClass, StyleSheetControlClass;

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default & ~GS_ENABLED);
    @default SSCI_targetClass = (ClassStruct *)&GrObjBodyClass;
    @default SSCI_styledClass = (ClassStruct *)&GrObjClass;
@endc

/*-----------------------------------------------------------------------------
    GrObjAreaColorSelector
-----------------------------------------------------------------------------*/
@class	GrObjAreaColorSelectorClass, ColorSelectorClass;

#define GOACS_DEFAULT_FEATURES  (CSF_INDEX | CSF_RGB | CSF_DRAW_MASK | \
                    CSF_PATTERN )

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default | GS_ENABLED);

@endc

/*-----------------------------------------------------------------------------
    GrObjBackgroundColorSelector
-----------------------------------------------------------------------------*/
@class	GrObjBackgroundColorSelectorClass, ColorSelectorClass;

#define GOBGCS_DEFAULT_FEATURES  (CSF_INDEX | CSF_RGB )

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default | GS_ENABLED);

@endc

/*-----------------------------------------------------------------------------
    GrObjStartingGradientColorSelector
-----------------------------------------------------------------------------*/
@class	GrObjStartingGradientColorSelectorClass, ColorSelectorClass;

#define GOSGCS_DEFAULT_FEATURES  (CSF_INDEX | CSF_RGB )

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default & ~GS_ENABLED);

@endc

/*-----------------------------------------------------------------------------
    GrObjEndingGradientColorSelector
-----------------------------------------------------------------------------*/
@class	GrObjEndingGradientColorSelectorClass, ColorSelectorClass;

#define GOSGCS_DEFAULT_FEATURES  (CSF_INDEX | CSF_RGB )

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default & ~GS_ENABLED);

@endc

/*-----------------------------------------------------------------------------
    GrObjObscureAttrControlClass
-----------------------------------------------------------------------------*/
@class GrObjObscureAttrControlClass, GenControlClass;

@message void MSG_GOOAC_SET_WRAP_TEXT_TYPE (GrObjObscureAttr wrapTextType = cl);
@message void MSG_GOOAC_CHANGE_OBSCURE_ATTRS (GrObjFlags obscureAttrs = cl);

typedef ByteFlags GrObjObscureAttrControlFeatures ;
#define GOOACF_INSTRUCTIONS 		0x80
#define GOOACF_INSERT_OR_DELETE_MOVE 	0x40
#define GOOACF_INSERT_OR_DELETE_RESIZE 	0x20
#define GOOACF_INSERT_OR_DELETE_DELETE 	0x10
#define GOOACF_DONT_WRAP 		0x08
#define GOOACF_WRAP_INSIDE 		0x04
#define GOOACF_WRAP_AROUND_RECT 		0x02
#define GOOACF_WRAP_TIGHTLY 		0x01

#define GOOAC_INSERT_OR_DELETE_FEATURES 	(GOOACF_INSERT_OR_DELETE_MOVE | \
                    GOOACF_INSERT_OR_DELETE_RESIZE | \
                    GOOACF_INSERT_OR_DELETE_DELETE)

#define GOOAC_WRAP_FEATURES 	(GOOACF_DONT_WRAP | GOOACF_WRAP_INSIDE | \
                GOOACF_WRAP_AROUND_RECT | GOOACF_WRAP_TIGHTLY)

#define GOOAC_DEFAULT_FEATURES  	(GOOACF_INSTRUCTIONS | GOOAC_WRAP_FEATURES | \
                 GOOAC_INSERT_OR_DELETE_FEATURES)

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default | GS_ENABLED);

@endc

/*-----------------------------------------------------------------------------
    GrObjInstructionControlClass
-----------------------------------------------------------------------------*/
@class GrObjInstructionControlClass, GenControlClass;

@message void MSG_GOIC_MAKE_INSTRUCTIONS_EDITABLE ();
@message void MSG_GOIC_MAKE_INSTRUCTIONS_UNEDITABLE ();
@message void MSG_GOIC_DELETE_INSTRUCTIONS ();
@message void MSG_GOIC_SET_INSTRUCTION_ATTRS (GrObjDrawFlags drawFlags = cx);

typedef ByteFlags GrObjInstructionControlFeatures ;		/* CHECKME */
/* 3 bits unused */
#define GOICF_DRAW 	(0x10)
#define GOICF_PRINT 	(0x08)
#define GOICF_MAKE_EDITABLE 	(0x04)
#define GOICF_MAKE_UNEDITABLE 	(0x02)
#define GOICF_DELETE 	(0x01)

#define GOICF_DEFAULT_FEATURES  	(GOICF_DRAW | GOICF_PRINT | \
                GOICF_MAKE_EDITABLE | GOICF_MAKE_UNEDITABLE | \
                GOICF_DELETE)

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjAreaAttrControlClass
-----------------------------------------------------------------------------*/
@class GrObjAreaAttrControlClass, GenControlClass;

@message void MSG_GOAAC_SET_MIX_MODE (MixMode mixMode = cl);
@message void MSG_GOAAC_SET_AREA_TRANSPARENCY (GrObjAreaAttrInfoRecord transparent = cl);

typedef ByteFlags GOAACFeatures ;
#define	GOAACF_MM_CLEAR			0x0100
#define	GOAACF_MM_COPY			0x0080
#define	GOAACF_MM_NOP			0x0040
#define	GOAACF_MM_AND			0x0020
#define	GOAACF_MM_INVERT		0x0010
#define	GOAACF_MM_XOR			0x0008
#define	GOAACF_MM_SET			0x0004
#define	GOAACF_MM_OR			0x0002
#define	GOAACF_TRANSPARENCY		0x0001

#define GOAAC_DEFAULT_FEATURES  (GOAACF_TRANSPARENCY | GOAACF_MM_COPY | \
                GOAACF_MM_INVERT | GOAACF_MM_XOR | \
                GOAACF_MM_AND | GOAACF_MM_OR)

#define GOAAC_DEFAULT_TOOLBOX_FEATURES 	0

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default | GS_ENABLED);

@endc

/*-----------------------------------------------------------------------------
    GrObjLineColorSelectorClass
-----------------------------------------------------------------------------*/
@class 	GrObjLineColorSelectorClass, ColorSelectorClass;

#define GOLCS_DEFAULT_FEATURES  (CSF_INDEX | CSF_RGB | CSF_DRAW_MASK |						CSF_PATTERN)

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default | GS_ENABLED);
@default CSI_toolboxPrefs = @default | (COO_LINE_ORIENTED << CTP_INDEX_ORIENTATION_OFFSET) | (COO_LINE_ORIENTED << CTP_DRAW_MASK_ORIENTATION_OFFSET);
@endc

/*-----------------------------------------------------------------------------
    GrObjLineAttrControlClass
-----------------------------------------------------------------------------*/
@class 	GrObjLineAttrControlClass, GenControlClass;

typedef WordFlags StandardArrowheadType ;		/* CHECKME */
#define SAT_LENGTH 	(0xfc00)
#define SAT_LENGTH_OFFSET 	10
#define SAT_FILLED 	(0x0200)
#define SAT_FILL_WITH_AREA_ATTRIBUTES 	(0x0100)
#define SAT_ANGLE 	(0x00ff)
#define SAT_ANGLE_OFFSET 	0

@message void MSG_GOLAC_SET_LINE_VALUE_FROM_INDEX (word lineWidth = cx);
@message void MSG_GOLAC_SET_LINE_INDEX_FROM_VALUE (WWFixed lineWidth = dx.cx);

@message void MSG_GOLAC_SET_INTEGER_LINE_WIDTH (word lineWidth = cx);
@message void MSG_GOLAC_SET_LINE_WIDTH (WWFixed lineWidth = dx.cx);
@message void MSG_GOLAC_SET_LINE_STYLE (LineStyle style = cl);
@message void MSG_GOLAC_SET_ARROWHEAD_TYPE (StandardArrowheadType type = cx);
@message void MSG_GOLAC_SET_ARROWHEAD_WHICH_END (GrObjLineAttrInfoRecord whichEnds = cl);

typedef WordFlags GOLACFeatures ;
#define	GOLACF_WIDTH_INDEX			0x0010
#define	GOLACF_WIDTH_VALUE			0x0008
#define	GOLACF_STYLE				0x0004
#define	GOLACF_ARROWHEAD_TYPE			0x0002
#define	GOLACF_ARROWHEAD_WHICH_END		0x0001

#define GOLAC_DEFAULT_FEATURES  (GOLACF_WIDTH_INDEX | GOLACF_WIDTH_VALUE | \
                GOLACF_STYLE | GOLACF_ARROWHEAD_TYPE | \
                GOLACF_ARROWHEAD_WHICH_END)

typedef WordFlags GOLACToolboxFeatures ;
#define	GOLACTF_WIDTH_INDEX			0x0002
#define	GOLACTF_STYLE				0x0001

#define GOLAC_DEFAULT_TOOLBOX_FEATURES  (GOLACTF_WIDTH_INDEX | GOLACF_STYLE)

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default | GS_ENABLED);

@endc

/*-----------------------------------------------------------------------------
    GrObjNudgeControlClass
-----------------------------------------------------------------------------*/
@class GrObjNudgeControlClass, GenControlClass;

typedef ByteFlags GrObjNudgeControlFeatures ;		/* CHECKME */
/* 3 bits unused */
#define GONCF_NUDGE_LEFT 	(0x10)
#define GONCF_NUDGE_RIGHT 	(0x08)
#define GONCF_NUDGE_UP 	(0x04)
#define GONCF_NUDGE_DOWN 	(0x02)
#define GONCF_CUSTOM_MOVE 	(0x01)

@message void MSG_GONC_NUDGE (sword xNudge = cx, sword yNudge = dx);
@message void MSG_GONC_CUSTOM_MOVE ();
@message void MSG_GONC_SET_DISPLAY_FORMAT (GenValueDisplayFormat format = cl);

#define GROBJ_NUDGE_CONTROL_DEFAULT_FEATURES  (GONCF_NUDGE_LEFT | \
                        GONCF_NUDGE_RIGHT | \
                        GONCF_NUDGE_UP | \
                        GONCF_NUDGE_DOWN | \
                        GONCF_CUSTOM_MOVE)

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjMoveInsideControlClass
-----------------------------------------------------------------------------*/
@class GrObjMoveInsideControlClass, GrObjNudgeControlClass;
@endc

/*-----------------------------------------------------------------------------
    GrObjGroupControlClass
-----------------------------------------------------------------------------*/
@class GrObjGroupControlClass, GenControlClass;

@message void MSG_GOGC_GROUP ();
@message void MSG_GOGC_UNGROUP ();

typedef ByteFlags GOGCFeatures ;
#define GOGCF_GROUP  0x02
#define GOGCF_UNGROUP  0x01

#define GOGC_DEFAULT_FEATURES  (GOGCF_GROUP | GOGCF_UNGROUP)
#define GOGC_DEFAULT_TOOLBOX_FEATURES  (GOGCF_GROUP | GOGCF_UNGROUP)

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjDefaultAttributesControlClass
-----------------------------------------------------------------------------*/
@class GrObjDefaultAttributesControlClass, GenControlClass;

@message void MSG_GODAC_SET_DEFAULT_ATTRIBUTES ();

typedef ByteFlags GODACFeatures ;
#define GODACF_SET_DEFAULT_ATTRIBUTES  0x01

#define GODAC_DEFAULT_FEATURES  (GODACF_SET_DEFAULT_ATTRIBUTES)
#define GODAC_DEFAULT_TOOLBOX_FEATURES  (GODACF_SET_DEFAULT_ATTRIBUTES)

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjPasteInsideControlClass
-----------------------------------------------------------------------------*/
@class GrObjPasteInsideControlClass, GenControlClass;

@message void MSG_GOPIC_PASTE_INSIDE ();
@message void MSG_GOPIC_BREAKOUT_PASTE_INSIDE ();

typedef ByteFlags GOPICFeatures ;
#define GOPICF_PASTE_INSIDE  		0x0002
#define GOPICF_BREAKOUT_PASTE_INSIDE 	0x0001

typedef ByteFlags GOPICToolboxFeatures ;
#define GOPICTF_PASTE_INSIDE  		0x0002
#define GOPICTF_BREAKOUT_PASTE_INSIDE 	0x0001

#define GOPIC_DEFAULT_FEATURES  (GOPICF_PASTE_INSIDE | GOPICF_BREAKOUT_PASTE_INSIDE)
#define GOPIC_DEFAULT_TOOLBOX_FEATURES  (GOPICTF_PASTE_INSIDE | GOPICTF_BREAKOUT_PASTE_INSIDE)

@default GCI_output = (TO_APP_TARGET);
@instance word GPICI_lastNumSelected = 0;

@endc

/*-----------------------------------------------------------------------------
    GrObjDuplicateControlClass
-----------------------------------------------------------------------------*/
@class GrObjDuplicateControlClass, GenControlClass;

@message void MSG_GROBJ_DUPLICATE_CONTROL_DUPLICATE ();
@message void MSG_GROBJ_DUPLICATE_CONTROL_DUPLICATE_IN_PLACE ();

typedef ByteFlags GrObjDuplicateControlFeatures ;
#define GODCF_DUPLICATE 			0x0002
#define GODCF_DUPLICATE_IN_PLACE 	0x0001

typedef ByteFlags GrObjDuplicateControlToolboxFeatures ;
#define GODCTF_DUPLICATE 		0x0002
#define GODCTF_DUPLICATE_IN_PLACE 	0x0001

#define GROBJ_DUPLICATE_CONTROL_DEFAULT_FEATURES  (GODCF_DUPLICATE | GODCF_DUPLICATE_IN_PLACE)
#define GROBJ_DUPLICATE_CONTROL_DEFAULT_TOOLBOX_FEATURES  (GODCTF_DUPLICATE | GODCTF_DUPLICATE_IN_PLACE)

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjConvertControlClass
-----------------------------------------------------------------------------*/
@class GrObjConvertControlClass, GenControlClass;

@message void MSG_GOCC_CONVERT_TO_BITMAP ();
@message void MSG_GOCC_CONVERT_TO_GRAPHIC ();
@message void MSG_GOCC_CONVERT_FROM_GRAPHIC ();

typedef ByteFlags GOCCFeatures ;
#define GOCCF_CONVERT_TO_BITMAP  0x0004
#define GOCCF_CONVERT_TO_GRAPHIC  0x0002
#define GOCCF_CONVERT_FROM_GRAPHIC  0x0001

#define GROBJ_CONVERT_CONTROL_DEFAULT_FEATURES  (GOCCF_CONVERT_TO_BITMAP | GOCCF_CONVERT_TO_GRAPHIC | GOCCF_CONVERT_FROM_GRAPHIC)
#define GROBJ_CONVERT_CONTROL_DEFAULT_TOOLBOX_FEATURES  (GOCCF_CONVERT_TO_BITMAP | GOCCF_CONVERT_TO_GRAPHIC | GOCCF_CONVERT_FROM_GRAPHIC)

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjCreateControlClass
-----------------------------------------------------------------------------*/
@class GrObjCreateControlClass, GenControlClass;

@message void MSG_GOCC_CREATE_GROBJ (ClassStruct *grobjClass = cx:dx);
@message void MSG_GOCC_CREATE_POLYGON (word nSides = cx);
@message void MSG_GOCC_CREATE_STAR (word nPoints = cx);

typedef ByteFlags GrObjCreateControlFeatures ;
#define GOCCF_RECTANGLE 			0x0200
#define GOCCF_ELLIPSE 			0x0100
#define GOCCF_LINE 			0x0080
#define GOCCF_ROUNDED_RECTANGLE 		0x0040
#define GOCCF_ARC 			0x0020
#define GOCCF_TRIANGLE 			0x0010
#define GOCCF_HEXAGON 			0x0008
#define GOCCF_OCTOGON 			0x0004
#define GOCCF_FIVE_POINTED_STAR 		0x0002
#define GOCCF_EIGHT_POINTED_STAR 	0x0001

#define GROBJ_CREATE_CONTROL_DEFAULT_FEATURES  		0x03fb
#define GROBJ_CREATE_CONTROL_DEFAULT_TOOLBOX_FEATURES 	0x03fb

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default | GS_ENABLED);

@endc

/*-----------------------------------------------------------------------------
    GrObjLocksControlClass
-----------------------------------------------------------------------------*/
@class GrObjLocksControlClass, GenControlClass;

@message void MSG_GOLC_CHANGE_LOCKS ();

#define GOLC_DEFAULT_FEATURES  (GOL_MOVE | GOL_RESIZE | GOL_ROTATE)
#define GOLC_DEFAULT_TOOLBOX_FEATURES  0

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjDepthControlClass
-----------------------------------------------------------------------------*/
@class GrObjDepthControlClass, GenControlClass;

@message void MSG_GODC_BRING_TO_FRONT ();
@message void MSG_GODC_SEND_TO_BACK ();
@message void MSG_GODC_SHUFFLE_UP ();
@message void MSG_GODC_SHUFFLE_DOWN ();

typedef ByteFlags GODepthCFeatures ;
#define	GODepthCF_BRING_TO_FRONT	 0x0008
#define	GODepthCF_SEND_TO_BACK		 0x0004
#define	GODepthCF_SHUFFLE_UP	 	 0x0002
#define	GODepthCF_SHUFFLE_DOWN		 0x0001

#define GODepthC_DEFAULT_FEATURES   (GODepthCF_BRING_TO_FRONT | \
                    GODepthCF_SEND_TO_BACK | \
                    GODepthCF_SHUFFLE_UP | \
                    GODepthCF_SHUFFLE_DOWN)

#define GODepthC_DEFAULT_TOOLBOX_FEATURES  (GODepthCF_BRING_TO_FRONT | \
                    GODepthCF_SEND_TO_BACK | \
                    GODepthCF_SHUFFLE_UP | \
                    GODepthCF_SHUFFLE_DOWN)

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjFlipControlClass
-----------------------------------------------------------------------------*/
@class GrObjFlipControlClass, GenControlClass;

@message void MSG_GOFC_FLIP_HORIZONTALLY ();
@message void MSG_GOFC_FLIP_VERTICALLY ();

typedef ByteFlags GOFCFeatures ;
#define	GOFCF_FLIP_HORIZONTALLY	 0x02
#define	GOFCF_FLIP_VERTICALLY	 0x01

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjHandleControlClass
-----------------------------------------------------------------------------*/

@class GrObjHandleControlClass, GenControlClass;

@message void MSG_GOHC_SET_HANDLES ();

typedef ByteFlags GOHCFeatures ;
#define	GOHCF_SMALL_HANDLES	 0x08
#define	GOHCF_MEDIUM_HANDLES	 0x04
#define	GOHCF_LARGE_HANDLES	 0x02
#define GOHCF_INVISIBLE_HANDLES 	0x01

#define GOHC_DEFAULT_FEATURES  (GOHCF_SMALL_HANDLES | GOHCF_MEDIUM_HANDLES | \
                 GOHCF_LARGE_HANDLES | GOHCF_INVISIBLE_HANDLES)
#define GOHC_DEFAULT_TOOLBOX_FEATURES  0

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default | GS_ENABLED);

@endc

/*-----------------------------------------------------------------------------
    GrObjRotateControlClass
-----------------------------------------------------------------------------*/
@class GrObjRotateControlClass, GenControlClass;

typedef ByteFlags GrObjRotateControlFeatures ;		/* CHECKME */
#define GORCF_45_DEGREES_CW 	(0x80)
#define GORCF_90_DEGREES_CW 	(0x40)
#define GORCF_135_DEGREES_CW 	(0x20)
#define GORCF_180_DEGREES 	(0x10)
#define GORCF_135_DEGREES_CCW 	(0x08)
#define GORCF_90_DEGREES_CCW 	(0x04)
#define GORCF_45_DEGREES_CCW 	(0x02)
#define GORCF_CUSTOM_ROTATION 	(0x01)

@message void MSG_GORC_ROTATE (WWFixed degrees = cx.dx);
/*
 * 	Outputs a MSG_GO_ROTATE to the target grobjs
 *
 * 	PASS:		degrees - WWFixed rotation
 */

@message void MSG_GORC_CUSTOM_ROTATE ();

#define GROBJ_ROTATE_CONTROL_DEFAULT_FEATURES  		0x00ff

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjScaleControlClass
-----------------------------------------------------------------------------*/
@class GrObjScaleControlClass, GenControlClass;

@message void MSG_GOSC_SCALE_HORIZONTALLY (WWFixed degrees = dx.cx);
@message void MSG_GOSC_SCALE_VERTICALLY (WWFixed degrees = dx.cx);
@message void MSG_GOSC_CUSTOM_SCALE ();

typedef ByteFlags GrObjScaleControlFeatures ;
#define GOSCF_HALF_WIDTH 	0x0010
#define GOSCF_HALF_HEIGHT 	0x0008
#define GOSCF_DOUBLE_WIDTH 	0x0004
#define GOSCF_DOUBLE_HEIGHT 	0x0002
#define GOSCF_CUSTOM_SCALE 	0x0001

#define GROBJ_SCALE_CONTROL_DEFAULT_FEATURES 	0x001f

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjSkewControlClass
-----------------------------------------------------------------------------*/
@class GrObjSkewControlClass, GenControlClass;

@message void MSG_GOSC_SKEW_HORIZONTALLY (WWFixed degrees = dx.cx);
@message void MSG_GOSC_SKEW_VERTICALLY (WWFixed degrees = dx.cx);
@message void MSG_GOSC_CUSTOM_SKEW ();

typedef ByteFlags GrObjSkewControlFeatures ;
#define GOSCF_LEFT 		0x0010
#define GOSCF_RIGHT 		0x0008
#define GOSCF_UP 		0x0004
#define GOSCF_DOWN 		0x0002
#define GOSCF_CUSTOM_SKEW 	0x0001

#define GROBJ_SKEW_CONTROL_DEFAULT_FEATURES 	0x001f

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjTransformControlClass
-----------------------------------------------------------------------------*/
@class GrObjTransformControlClass, GenControlClass;

@message void MSG_GOTC_UNTRANSFORM ();

typedef ByteFlags GOTransformCFeatures ;
#define GOTCF_UNTRANSFORM  0x01

#define GOTransformC_DEFAULT_FEATURES  (GOTCF_UNTRANSFORM)

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjHideShowControlClass
-----------------------------------------------------------------------------*/
@class GrObjHideShowControlClass, GenControlClass;

@message void MSG_GOHSC_HIDE ();
@message void MSG_GOHSC_SHOW ();

typedef ByteFlags GOHSCFeatures ;
#define GOHSCF_HIDE 	0x02
#define GOHSCF_SHOW 	0x01

#define GOHSC_DEFAULT_FEATURES  (GOHSCF_HIDE | GOHSCF_SHOW)

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default | GS_ENABLED);

@endc

/*-----------------------------------------------------------------------------
    GrObjDraftModeControlClass
-----------------------------------------------------------------------------*/
@class GrObjDraftModeControlClass, GenControlClass;

@message void MSG_GODMC_SET_DRAFT_MODE_STATUS (GrObjDrawFlags draftMode = cx);

typedef ByteFlags GODMCFeatures ;
#define GODMCF_DRAFT_MODE 	0x01

#define GODMC_DEFAULT_FEATURES  (GODMCF_DRAFT_MODE)

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjCustomShapeControlClass
-----------------------------------------------------------------------------*/
@class GrObjCustomShapeControlClass, GenControlClass;

@message void MSG_GOCSC_CREATE_POLYGON ();
@message void MSG_GOCSC_CREATE_STAR ();

typedef ByteFlags GOCSCFeatures ;		/* CHECKME */
/* 4 bits unused */
#define GOCSCF_NUM_POLYGON_SIDES 	(0x08)
#define GOCSCF_POLYGON_RADIUS 	(0x04)
#define GOCSCF_NUM_STAR_POINTS 	(0x02)
#define GOCSCF_STAR_RADII 	(0x01)

#define GOCSC_DEFAULT_FEATURES  (0x0f)

@default GCI_output = (TO_APP_TARGET);
@default GI_states = (@default | GS_ENABLED);

@endc

/*-----------------------------------------------------------------------------
    GrObjCustomDuplicateControlClass
-----------------------------------------------------------------------------*/
@class GrObjCustomDuplicateControlClass, GenControlClass;

@message void MSG_GOCDC_CUSTOM_DUPLICATE ();

typedef ByteFlags GOCDCFeatures ;
#define GOCDCF_REPETITIONS 	0x10
#define GOCDCF_MOVE 		0x08
#define GOCDCF_SCALE 		0x04
#define GOCDCF_ROTATE 		0x02
#define GOCDCF_SKEW 		0x01

#define GOCDC_DEFAULT_FEATURES  (GOCDCF_REPETITIONS | GOCDCF_MOVE | \
                GOCDCF_ROTATE | GOCDCF_SCALE | GOCDCF_SKEW)

@default GCI_output = (TO_APP_TARGET);
@default GII_type = GIT_PROPERTIES;
@default GII_visibility = GIV_DIALOG;

@endc

/*-----------------------------------------------------------------------------
    GrObjGradientFillControlClass
-----------------------------------------------------------------------------*/
@class GrObjGradientFillControlClass, GenControlClass;

@message void MSG_GOGFC_SET_GRADIENT_TYPE (GrObjGradientType gradientType = cl);
@message void MSG_GOGFC_SET_NUMBER_OF_GRADIENT_INTERVALS (word nIntervals = dx);

typedef ByteFlags GrObjGradientFillControlFeatures ;
#define GOGFCF_HORIZONTAL_GRADIENT 	0x0010
#define GOGFCF_VERTICAL_GRADIENT 	0x0008
#define GOGFCF_RADIAL_RECT_GRADIENT 	0x0004
#define GOGFCF_RADIAL_ELLIPSE_GRADIENT 	0x0002
#define GOGFCF_NUM_INTERVALS 		0x0001

#define GOGFC_DEFAULT_FEATURES  (GOGFCF_HORIZONTAL_GRADIENT | \
                GOGFCF_VERTICAL_GRADIENT | \
                GOGFCF_RADIAL_RECT_GRADIENT | \
                GOGFCF_RADIAL_ELLIPSE_GRADIENT | \
                GOGFCF_NUM_INTERVALS)

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjAlignToGridControlClass
-----------------------------------------------------------------------------*/
@class GrObjAlignToGridControlClass, GenControlClass;

@message void MSG_GOATGC_ALIGN_TO_GRID (AlignToGridType type = cl);

typedef ByteFlags GOATGCFeatures ;
#define GOATGCF_ALIGN_TO_GRID 	0x01

#define GOATGC_DEFAULT_FEATURES  (GOATGCF_ALIGN_TO_GRID)
#define GOATGC_DEFAULT_TOOLBOX_FEATURES  	0

@default GII_type = (GIT_COMMAND);
@default GCI_output = (TO_APP_TARGET);

@endc
/*------------------------------------------------------------------------
        GrObjAlignDistributeControlClass
------------------------------------------------------------------------*/
@class GrObjAlignDistributeControlClass, GenControlClass;

typedef WordFlags GrObjAlignDistributeControlFeatures ;
#define	GOADCF_ALIGN_LEFT	 0x8000
#define	GOADCF_ALIGN_CENTER_HORIZONTALLY	 0x4000
#define	GOADCF_ALIGN_RIGHT	 0x2000
#define	GOADCF_ALIGN_WIDTH	 0x1000

#define	GOADCF_ALIGN_TOP	 0x800
#define	GOADCF_ALIGN_CENTER_VERTICALLY	 0x400
#define	GOADCF_ALIGN_BOTTOM	 0x200
#define	GOADCF_ALIGN_HEIGHT	 0x100

#define	GOADCF_DISTRIBUTE_LEFT	 0x80
#define	GOADCF_DISTRIBUTE_CENTER_HORIZONTALLY	 0x40
#define	GOADCF_DISTRIBUTE_RIGHT	 0x20
#define	GOADCF_DISTRIBUTE_WIDTH	 0x10

#define	GOADCF_DISTRIBUTE_TOP	 0x8
#define	GOADCF_DISTRIBUTE_CENTER_VERTICALLY	 0x4
#define	GOADCF_DISTRIBUTE_BOTTOM	 0x2
#define	GOADCF_DISTRIBUTE_HEIGHT	 0x1

#define GOADC_DEFAULT_FEATURES 	(GrObjAlignDistributeControlFeatures)

@default GCI_output = (TO_APP_TARGET);
@default GII_type = GIT_PROPERTIES;
@default GII_visibility = GIV_DIALOG;

@endc
/*-----------------------------------------------------------------------------
    GrObjArcControlClass
-----------------------------------------------------------------------------*/
@class GrObjArcControlClass, GenControlClass;

@message void MSG_GOAC_SET_START_ANGLE (WWFixed degrees = dx.cx);
@message void MSG_GOAC_SET_END_ANGLE (WWFixed degrees = dx.cx);
@message void MSG_GOAC_SET_ARC_CLOSE_TYPE (ArcCloseType closeType = cx);

typedef ByteFlags GOArcCFeatures ;
#define GOACF_START_ANGLE 	0x8
#define GOACF_END_ANGLE 		0x4
#define GOACF_PIE_TYPE 		0x2
#define GOACF_CHORD_TYPE 	0x1

#define GOArcC_DEFAULT_FEATURES 	(GOACF_START_ANGLE | GOACF_END_ANGLE | \
                    GOACF_PIE_TYPE | GOACF_CHORD_TYPE)
#define GOArcC_DEFAULT_TOOLBOX_FEATURES  0

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjToolControlClass
-----------------------------------------------------------------------------*/
@class GrObjToolControlClass, GenControlClass;

@message void MSG_GOTC_SET_TOOL (word toolIndex = cx);

typedef WordFlags GOTCFeatures ;
#define	GOTCF_PTR	 		0x0800
#define	GOTCF_ROTATE_PTR		0x0400
#define	GOTCF_ZOOM			0x0200
#define	GOTCF_TEXT			0x0100
#define	GOTCF_LINE			0x0080
#define	GOTCF_RECT			0x0040
#define	GOTCF_ROUNDED_RECT		0x0020
#define	GOTCF_ELLIPSE			0x0010
#define	GOTCF_ARC			0x0008
#define	GOTCF_POLYLINE			0x0004
#define	GOTCF_POLYCURVE			0x0002
#define	GOTCF_SPLINE			0x0001

#define GOTC_DEFAULT_FEATURES  (GOTCF_PTR | GOTCF_ROTATE_PTR | GOTCF_ZOOM | \
                    GOTCF_TEXT | GOTCF_LINE | GOTCF_RECT | \
                    GOTCF_ROUNDED_RECT | GOTCF_ELLIPSE | \
                    GOTCF_ARC | GOTCF_POLYLINE | \
                    GOTCF_POLYCURVE | GOTCF_SPLINE)

#define GOTC_DEFAULT_TOOLBOX_FEATURES  (GOTC_DEFAULT_FEATURES)

    @vardata word ATTR_GROBJ_TOOL_CONTROL_POSITION_FOR_ADDED_TOOLS;

@default GCI_output = (TO_APP_TARGET);

@endc

/*-----------------------------------------------------------------------------
    GrObjToolItemClass
-----------------------------------------------------------------------------*/
@class GrObjToolItemClass, GenItemClass;

typedef struct {
    word 		TICASID_pad;
    ClassStruct	*TICASID_class;
    word		TICASID_specInitData;
} ToolItemClassAndSpecInitData} ;

@message ToolItemClassAndSpecInitData MSG_GOTI_GET_TOOL_CLASS (ToolItemClassAndSpecInitData *retValue = axcxdxbp);

@message void MSG_GOTI_SELECT_SELF_IF_MATCH (ClassStruct *curToolClass = cx:dx,
                        word specInitData = bp);
/*
 * 	Object selects itself as the exclusive if the passed data match
 * 	the entry's instance data.
 *
 * 	PASS:		cx:dx = class of tool
 * 			bp = MSG_GO_SPECIFIC_INITIALIZE data
 *
 * 	RETURN:		nothing
 */

@instance ClassStruct 	*GOTII_toolClass = NullClass;
@instance word 		GOTII_specInitData = 0;

@endc

/*-----------------------------------------------------------------------------
;	GrObjHead Class Definition
-----------------------------------------------------------------------------*/

@class	GrObjHeadClass, MetaClass;

/*----------------------------------------------------------------------------
;	GrObjHead Class Methods and Structures
-----------------------------------------------------------------------------*/

@message void MSG_GH_SET_CURRENT_TOOL (ClassStruct *toolClass = cx:dx,
                       word initData = bp);    /* XXX */
/*
 * 	Sets the current tool class and instantiates a tool of this
 * 	class for the floater object and sends the new object
 * 	MSG_GO_OBJECT_SPECIFIC_INIITIALIZE with the data passed in bp
 *
 *  Context:	Sent to head when user clicks on a tool in the tool
 * 		palette, or when app decides change the current tool
 *  Source:	Unrestricted. Generally application.
 *  Destination:	GrObjHead.
 *  Interception:	Unlikely
 *
 *
 * PASS
 * 	cx:dx - fptr to Class of tool
 * 	bp - MSG_GO_GROBJ_SPECIFIC_INITIALIZE data
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GH_SET_CURRENT_TOOL_WITH_DATA_BLOCK (ClassStruct *toolClass = cx:dx,
                       word initData = bp);    /* XXX */
/*
 * 	Sets the current tool class and instantiates a tool of this
 * 	class for the floater object and sends the new object
 * 	MSG_GO_OBJECT_SPECIFIC_INIITIALIZE with the data passed in bp
 *
 * 	* READ ME *
 * 	Sending this message will not update the UI to reflect the
 * 	current tool, so the specific guardian should be sure that
 * 	the UI is going to be updated otherwise.
 *
 *  Context:	Sent to head when user clicks on a tool in the tool
 * 		palette, or when app decides change the current tool
 *  Source:	Unrestricted. Generally application.
 *  Destination:	GrObjHead.
 *  Interception:	Unlikely
 *
 *
 * PASS
 * 	cx:dx - fptr to Class of tool
 * 	^hbp - MSG_GO_GROBJ_SPECIFIC_INITIALIZE_WITH_DATA_BLOCK data
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GH_SET_CURRENT_BODY (optr bodyOD = cx:dx);
/*
 *  	Set body to be current body under head.  This body will
 * 	remain the current on until another body sets itself as
 * 	the current or this body clears itself.
 *
 *  Context:	Sent to GrObjHead by a GrObjBody when that
 * 		body gains the target.
 *  Source:	GrObjBody.
 *  Destination:	GrObjHead.
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx:dx - OD of body
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GH_CLEAR_CURRENT_BODY (optr bodyOD = cx:dx);
/*
 *  	Clear the current body if it is the passed body od.
 *
 *  Context:	Sent to GrObjHead by a GrObjBody when the body
 * 		loses the target
 *  Source:	GrObjBody.
 *  Destination:	GrObjHead.
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx:dx - OD of body
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GH_CLASSED_EVENT_TO_FLOATER (hptr messageHandle = cx);
/*
 * 	Send the encapuslated method to the floater object
 *
 * PASS
 * 	cx - recorded message handle
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GH_CLASSED_EVENT_TO_FLOATER_IF_CURRENT_BODY (hptr messageHandle = cx, optr bodyOD = dx:bp);
/*
 * 	Send the encapuslated method to the floater object if
 * 	if passed body is the current one.
 *
 * PASS
 * 	cx - recorded message handle
 * 	dx:bp - od of body
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GH_FLOATER_FINISHED_CREATE ();
/*
 * 	Notify head that the current floater has just completed
 * 	creation of a new object
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {
    word	CTV_grObjSpecificData;
    word	CTV_unused;
    ClassStruct *CTV_toolClass;
} CurrentToolValues} ;

@message void MSG_GH_GET_CURRENT_TOOL (CurrentToolValues *retVal = bpaxdxcx);	/* XXX */
/*
 * 	Gets the current tool class.
 *
 *  Source:	Unrestricted.
 *  Destination:	GrObjHead.
 *  Interception:	Unlikely
 *
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	cx:dx - fptr to Class of tool
 * 	bp - MSG_GO_GROBJ_SPECIFIC_INITIALIZE data
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {		/* CHECKME */
    ClassStruct		*GONCT_toolClass;
    word		GONCT_specInitData;
} GrObjNotifyCurrentTool} ;

@message void MSG_GH_SEND_NOTIFY_CURRENT_TOOL ();
/*
 * 	Sends notification regarding the current tool
 *
 *  Source:	Unrestricted.
 *  Destination:	GrObjHead.
 *  Interception:	Unlikely
 *
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GH_CALL_FLOATER (EventHandle event = cx);
/*
 * 	Dispatch encapsulated message to floater and return the floaters
 * 	return values to the caller
 *
 *  Context:	Head Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjHead
 *  Interception: Unlikely
 *
 * PASS:
 * 		cx - encapsulated message
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GH_SET_TEXT_TOOL_FOR_SEARCH_SPELL ();
/*
 * 	When the user initiates a search or a spell check we must switch
 * 	to the text tool so that they can edit any text objects that
 * 	gain the target via the search or spell
 *
 *  Context:	On MSG_SEARCH and MSG_SPELL_CHECK
 *  Source:	GrObjBody
 *  Destination:  GrObjHead
 *  Interception: The default handler sets the tool to the MultTextGuardianClass.
 * 		If you wish differnent behaviour then subclass the message
 * 		and set a different tool class, but don't call the superclass.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

/*-----------------------------------------------------------------------------
    GrObjHeadClass Instance Data, INSTANCE DATA, instance data
-----------------------------------------------------------------------------*/

@instance ClassStruct 	*GH_currentTool = NullClass;
@instance word		GH_initializeFloaterData = 0;
@instance optr		GH_currentBody;
@instance optr		GH_floater;

@endc

/*-----------------------------------------------------------------------------
;	GrObj Class Definition
-----------------------------------------------------------------------------*/
#define ObjDerefGrObj (obj)    ObjDeref1(obj)

@class	GrObjClass, MetaClass, master;

/*
 * XXX: Doesn't really return void
 */
@importMessage MetaGrObjMessages, void MSG_GROBJ_ACTION_NOTIFICATION (
    optr grobjOD = cx:dx,
    GrObjActionNotificationType type = bp);

/*-----------------------------------------------------------------------------
;	GrObj Class Methods and Structures
-----------------------------------------------------------------------------*/

#define HANDLE_MOVE  		0
#define HANDLE_CENTER 		HANDLE_MOVE
#define HANDLE_LEFT_TOP 		(GOHS_HANDLE_LEFT | GOHS_HANDLE_TOP)
#define HANDLE_MIDDLE_TOP 	GOHS_HANDLE_TOP
#define HANDLE_RIGHT_TOP 	(GOHS_HANDLE_RIGHT | GOHS_HANDLE_TOP)
#define HANDLE_LEFT_MIDDLE 	GOHS_HANDLE_LEFT
#define HANDLE_RIGHT_MIDDLE 	GOHS_HANDLE_RIGHT
#define HANDLE_LEFT_BOTTOM 	(GOHS_HANDLE_LEFT | GOHS_HANDLE_BOTTOM)
#define HANDLE_MIDDLE_BOTTOM 	GOHS_HANDLE_BOTTOM
#define HANDLE_RIGHT_BOTTOM 	(GOHS_HANDLE_BOTTOM | GOHS_HANDLE_RIGHT)

typedef ByteFlags HandleUpdateMode ;
#define HUM_NOW 	    	    	0
#define HUM_MANUAL   	    	1

@message void MSG_GO_GAINED_SELECTION_LIST (HandleUpdateMode hum = dl);
/*
 * 	sent to an object when it gains the selection grab
 *
 * PASS:
 * 	hum - HandleUpdateMode
 */

@message void MSG_GO_LOST_SELECTION_LIST ();
/*
 * 	sent to an object when it loses the selection grab
 * PASS:
 * 	nothing
 * RETURNS:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_BECOME_SELECTED (HandleUpdateMode hum = dl);
/*
 * 	Tell object to join the selection list, draw it's handle ...
 * 	and otherwise become selected
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: If you wish to place additional restrictions
 * 		(beyond GrObjLocks) on when an object can be selected, then
 * 		subclass this message and only call your superclass if
 * 		you are allowing the object to be selected. Behaviour
 * 		that you wish to add when an object actually becomes selected
 * 		should be handle in a subclass of MSG_GO_GAINED_SELECTION_LIST.
 *
 * PASS:
 * 	dl - HandleUpdateMode
 *
 * RETURNS:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_TOGGLE_SELECTION ();
/*
 * 	Have object switch it selection status
 *
 *
 * PASS:
 * 	nothing
 *
 * RETURNS:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_BECOME_UNSELECTED ();
/*
 * 	Notify object that it is no longer selection
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_UNDRAW_SPRITE (GStateHandle gstate = dx);
/*
 * static
 * 	If the object's sprite is currently drawn, then erase it
 * 	Will use either quick sprite or tools specific sprite routine
 *
 * PASS
 * 	dx - gstate or 0
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_SPRITE (GStateHandle gstate = dx,
                 GrObjFunctionsActive funcs = bp);
/*
 * 	Draw the object's sprite unless the sprite is already drawn
 *
 *  Context:	While handling mouse events in move,resize,rotate modes
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: Unlikely. To change the image of the sprite subclass
 * 		MSG_GO_DRAW_SPRITE_LINE
 *
 * PASS:
 * 	dx - gstate or 0
 * 	bp - GrObjFunctionsActive (GOFA_VIEW_ZOOMED)
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_SPRITE_RAW (GStateHandle gstate = dx);
/*
 * static
 * 	Called to update sprite image during an expose event. Draws
 * 	the appropriate sprite if the spriteDrawn flag is set, otherwise
 * 	does nothing.
 *
 * PASS:
 * 	dx - gstate
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_HANDLES (GStateHandle gstate = dx);
/*
 * 	Draws handles to indicate object is selected. Only draws
 * 	the handles if the handlesDrawn flag is NOT set.
 *
 * PASS:
 * 	dx - gstate or 0
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_UNDRAW_HANDLES (GStateHandle gstate = dx);
/*
 * 	Erases the handles that indicate the object is selected.
 * 	Only erases the handles if the handlesDrawn flag IS set.
 *
 * PASS:
 * 	dx - gstate or 0
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_HANDLES_RAW (GStateHandle gstate = dx);
/*
 * 	Called to update the handles during an expose event. Draws
 * 	the handles if the handlesDraw flag is set, otherwise
 * 	does nothing
 *
 * PASS
 * 	dx - gstate
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_HANDLES_FORCE (GStateHandle gstate = dx);
/*
 * 	Draw handles of the object regardless of the state of the selected
 * 	bit. But don't draw them if the are already drawn
 *
 *
 * PASS:
 * 	dx - gstate or 0
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_HANDLES_MATCH (GStateHandle gstate = dx);
/*
 * 	Draws or undraws the handles of the object to reflect
 * 	the state of the selected bit
 *
 *
 * PASS:
 * 	dx - gstate or 0
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_HANDLES_OPPOSITE (GStateHandle gstate = dx);
/*
 * 	Draws or undraws the handles of the object to reflect
 * 	the opposite of the selected bit
 *
 *
 * PASS:
 * 	dx - gstate or 0
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_ACTIVATE_MOVE ();
/*
 * 	Sets up object for move. Does not actually start move.
 * 	Need to send a MSG_GO_START_MOVE for that
 *
 * PASS
 * 	nothing
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_ACTIVATE_RESIZE ();
/*
 * 	Sets up object for resize.
 *
 *  Context:	Usually called when user clicks on resize handle
 *  Source:	Unrestricted, generally pointer object
 *  Destination:	Any grobj object that is not within a group.
 *  Interception:	Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_ACTIVATE_ROTATE ();
/*
 * 	Sets up object for rotate. Does not actually start rotate
 * 	Need to send a MSG_GO_START_ROTATE for that
 *
 * PASS:
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef ByteFlags ActivateCreateFlags ;		/* CHECKME */
/*
 * notify selected objects that
 * tool is activating
 */
#define ACF_NOTIFY 	(0x01)

@message void MSG_GO_ACTIVATE_CREATE (ActivateCreateFlags flags = cl);
/*
 * 	Have object activate interactive create mode for the current body.
 * 	Object needs to set its modes bits, grab the mouse, set
 * 	its pointer image and notify the
 * 	selected and editable grobjects that there is a new tool.
 *
 * 	Create mode is the standard mode for the floater. A floater
 * 	in create mode is allowed to switch to edit mode whenever
 * 	it wants for editing objects in the document. Many
 * 	GrObjVisGuardians do this switch on MSG_GO_LARGE_START_SELECT.
 *
 *
 *  Context:	When a new floater is instantiated for a body or
 * 		when the floater already exists but a new body
 * 		becomes the current one.
 *  Source:	GrObjHead
 *  Destination:	Floater only
 *  Interception:	Likely. The default handler is intended for shapes.
 * 		Other grobjects such as guardians or pointers
 * 		will need to subclass this message.
 *
 *
 * PASS:
 * 	cl - ActivateCreateFlags
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_REACTIVATE_CREATE ();
/*
 * 	Prepare the floater for interactive create again. Similar
 * 	to MSG_GO_ACTIVATE_CREATE, but it doesn't need to notify
 * 	the selected and editable grobjects
 *
 *   Context:	Sent to the floater after it has already created
 * 		a grobject and needs to be ready to create
 * 		another one.
 *  Source:	GrObjHead
 *  Destination:	Floater only
 *  Interception:	Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURNS:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {		/* CHECKME */

    PointDWFixed	GOMD_point;

/* Copy of ButtonInfo */
    ButtonInfo	GOMD_buttonInfo;

/* Copy of UIFunctionsActive */
    UIFunctionsActive	GOMD_uiFA;

    GrObjFunctionsActive	GOMD_goFA;

    GStateHandle	GOMD_gstate;
} GrObjMouseData} ;

@message MouseReturnFlags MSG_GO_START_CHOOSE_ABS (GrObjMouseData *mouseData = ss:bp) = ax;
/*
 * 	Starts the object choosing (mainly for pointer objects)
 * 	Using absolute mouse coords
 *
 * PASS:
 * 	ss:bp - GrObjMouseData
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_START_MOVE_ABS (GrObjMouseData *mouseData = ss:bp) = ax;
/*
 * 	Starts the object moving (mainly for pointer objects)
 * 	Using absolute mouse coords
 *
 *
 * PASS:
 * 	ss:bp - GrObjMouseData
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_JUMP_START_MOVE (
        GrObjFunctionsActive funcs = bp,
        GStateHandle gstate = dx) = ax;
/*
 * 	Jump starts interactive move by doing an activate, start and drag stuff
 *
 *  Context:	Quickly start an interactive move. Usually called
 * 		when user clicks on move handle
 *  Source:	Unrestricted, generally pointer object
 *  Destination:	Any grobj object that is not within a group.
 *  Interception:	Unlikely
 *
 * PASS:
 * 	bp - GrObjFunctionsActive
 * 	dx - gstate or 0
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 * 	bp - same as passed, except GOFA_RULER_HAS_SEEN_EVENT set
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_JUMP_START_RESIZE (
        GrObjFunctionsActive funcs = bp,
        GStateHandle gstate = dx) = ax;
/*
 * 	Jump starts resize by doing an activate, start and drag stuff
 *
 *  Context:	Quickly start an interactive resize. Usually called
 * 		when user clicks on resize handle
 *  Source:	Unrestricted, generally pointer object
 *  Destination:	Any grobj object that is not within a group.
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	bp - GrObjFunctionsActive
 * 	dx - gstate or 0
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_JUMP_START_ROTATE (
        GrObjFunctionsActive funcs = bp,
        GStateHandle gstate = dx) = ax;
/*
 * 	Jump starts interactive rotate by doing an
 * 	activate, start and drag stuff
 *
 *  Context:	Quickly start an interactive rotate. Usually called
 * 		when user clicks on handle with rotate pointer
 *  Source:	Unrestricted, generally pointer object
 *  Destination:	Any grobj object that is not within a group.
 *  Interception:	Unlikely
 *
 * PASS:
 * 	bp - GrObjFunctionsActive
 * 	dx - Gstate or 0
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_PTR_CHOOSE_ABS (GrObjMouseData *mouseData = ss:bp) = ax;
/*
 * 	Called when a ptr event is received and the object is in choose mode
 *
 * PASS:
 * 	ss:bp - GrObjMouseData
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_PTR_MOVE (
    GrObjMouseData *mouseData = ss:bp) = ax;
/*
 * 	Sent to update position of mouse during an interactive move
 *
 *
 *  Context:	During an interactive resize. This message
 * 		cooresponds to an MSG_META_PTR when the object is
 * 		in move mode
 *  Source:	Unrestricted, generally pointer object
 *  Destination:	Any grobj object that is not within a group. If the
 * 		object is not currently being moved interactively
 * 		the message will be ignored.
 *  Interception:	Unlikely
 *
 * PASS:
 * 	ss:bp = GrObjMouseData
 * 		GOMD_point - deltas to move
 * 		GOMD_gstate - gstate to draw with
 * 		GOMD_goFA - GrObjFunctionsActive
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

typedef struct {		/* CHECKME */

    PointDWFixed	GORSMD_point;
/*
    CheckHack	< (offset GORSMD_point eq 0) >
*/

    GrObjHandleSpecification	GORSMD_anchor;
    GrObjHandleSpecification	GORSMD_grabbed;

    GrObjFunctionsActive	GORSMD_goFA;

    GStateHandle	GORSMD_gstate;

/*	align		word	*/

} GrObjResizeMouseData} ;

@message MouseReturnFlags MSG_GO_PTR_RESIZE (
    GrObjResizeMouseData *resizeMouseData = ss:bp) = ax;
/*
 * 	Sent to update position of mouse during an interactive resize
 *
 *
 *  Context:	During an interactive resize. This message
 * 		cooresponds to an MSG_META_PTR when the object is
 * 		in resize mode
 *  Source:	Unrestricted, generally pointer object
 *  Destination:	Any grobj object that is not within a group. If the
 * 		object is not currently being resized interactively
 * 		the message will be ignored.
 *  Interception:	Unlikely
 *
 *
 *
 * PASS:
 * 	ss:bp = GrObjResizeMouseData
 * 		GORSMD_point - deltas to resize
 * 		GORSMD_gstate - gstate to draw with
 * 		GORSMD_goFA - GrObjFunctionsActive
 * 		GORSMD_anchor - anchored handle
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

typedef struct {		/* CHECKME */

    WWFixed	GORMD_degrees;

    GrObjHandleSpecification	GORMD_anchor;

    GrObjFunctionsActive	GORMD_goFA;

    GStateHandle	GORMD_gstate;

/*	align word	*/

} GrObjRotateMouseData} ;

@message MouseReturnFlags MSG_GO_PTR_ROTATE(
    GrObjRotateMouseData *rotateMouseData ss:bp) = ax;
/*
 * 	Sent to update position of mouse during an interactive rotate
 *
 *
 *  Context:	During an interactive rotate. This message
 * 		cooresponds to an MSG_META_PTR when the object is
 * 		in rotate mode
 *  Source:	Unrestricted, generally pointer object
 *  Destination:	Any grobj object that is not within a group. If the
 * 		object is not currently being rotate interactively
 * 		the message will be ignored.
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	ss:bp - GrObjRotateMouseData
 * 		GORMD_degrees	- amount to rotate
 *  		GORMD_anchor	- handle to rotate about
 *  		GORMD_goFA	- GrObjFunctionsActive
 *  		GORMD_gstate	- gstate to draw sprite with..
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_PTR_MOVE_ABS (
    GrObjMouseData *mouseData = ss:bp) = ax;
/*
 * 	Sent when a ptr event is received and the object is in move mode.
 * 	Uses absolute mouse position.
 *
 * PASS:
 *  	ss:bp = GrObjMouseData
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_END_CHOOSE_ABS (
    GrObjMouseData *mouseData = ss:bp) = ax;
/*
 * 	Sent when an end select event is received and the object is in
 * 	choose mode.
 *
 * PASS:
 * 	ss:bp - GrObjMouseData
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_END_MOVE_ABS (
    GrObjMouseData *mouseData = ss:bp) = ax;
/*
 * 	Sent when an end move copy event is received and the object is in
 * 	move mode.
 *
 * PASS:
 * 	ss:bp - GrObjMouseData
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_END_MOVE (
    GrObjMouseData *mouseData = ss:bp) = ax;
/*
 * 	Sent when an end move copy event is received and the object is in
 * 	move mode.
 *
 * PASS:
 * 	ss:bp - GrObjMouseData
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_END_RESIZE (
    GrObjResizeMouseData *resizeMouseData = ss:bp) = ax;
/*
 * 	Sent to complete an interactive resize on an object
 *
 *
 *  Context:	At the end of an interactive resize. This message
 * 		cooresponds to an MSG_META_END_SELECT when the object is
 * 		in resize mode
 *  Source:	Unrestricted, generally pointer object
 *  Destination:	Any grobj object that is not within a group. If the
 * 		object is not currently being resized interactively
 * 		the message will be ignored.
 *  Interception:	Possible. Generally call superclass first then perform
 * 		additional action, such as vis guardians sending
 * 		a notify geometry valid to their vis wards.
 *
 *
 * PASS:
 * 	ss:bp = GrObjResizeMouseData
 * 		GORSMD_point - deltas to resize
 * 		GORSMD_anchor - anchored handle
 * 		GORSMD_grabbed - grabbed handle
 * 		GORSMD_gstate - gstate to draw with
 * 		GORSMD_goFA - GrObjFunctionsActive
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message MouseReturnFlags MSG_GO_END_ROTATE(
    GrObjRotateMouseData *rotateMouseData ss:bp) = ax;
/*
 * 	Sent to complete an interactive rotate of an object
 *
 *
 *  Context:	At the end of an interactive rotate. This message
 * 		cooresponds to an MSG_META_END_SELECT when the object is
 * 		in rotate mode
 *  Source:	Unrestricted, generally pointer object
 *  Destination:	Any grobj object that is not within a group. If the
 * 		object is not currently being rotated interactively
 * 		the message will be ignored.
 *  Interception:	Possible. Generally call superclass first then perform
 * 		additional action, such as vis guardians sending
 * 		a notify geometry valid to their vis wards.
 *
 * PASS:
 * 	ss:bp - GrObjRotateMouseData
 *
 * RETURN:
 * 	ax - MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message void MSG_GO_CLEAR ();
/*
 * 	Tell grobject to destroy itself in an undoable fashion.
 * 	It will remove itself from the body or group if necessary,
 * 	release grabs, etc. The object itself will not actually be
 * 	destroyed until its undo action is freed.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely. If grobject has any extra data that must be
 * 		freed it should do so on MSG_META_FINAL_OBJ_FREE
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_INVERT_HANDLES (GStateHandle gstate = dx);
/*
 * 	Invert of handles of selected object
 *
 * PASS:
 * 	dx - gstate
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {		/* CHECKME */
    WWFixed	GTM_e11;
    WWFixed	GTM_e12;
    WWFixed	GTM_e21;
    WWFixed	GTM_e22;
} GrObjTransMatrix} ;

typedef struct {		/* CHECKME */
    PointDWFixed	BI_center;
    WWFixed	BI_width;
    WWFixed	BI_height;
    GrObjTransMatrix	BI_transform;
/*	word	align	*/
} BasicInit} ;

@message void MSG_GO_INIT_BASIC_DATA (BasicInit *initData = ss:bp);
/*
 * 	Have object fill out its basic instance data from the
 * 	passed structure and calculate the remaining data
 * 	from it.
 *
 * PASS
 * 	ss:bp - BasicInit
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_FLIP_HORIZ ();
/*
 *	Flip object about its vertical axis.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 */

@message void MSG_GO_FLIP_VERT ();
/*
 * 	Flip object about its horizontal axis.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 */

@message void MSG_GO_ROTATE (	 		/* XXX */
    WWFixed 	angle = cx.dx,
    GrObjHandleSpecification center = bp);
/*
 *	Rotate object x degrees.
 *
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed:	angle		Angle of rotation, degrees counterclockwise
 *		center		Which corner of object is acting as center of rotation
 *
 */

@message void MSG_GO_UNTRANSFORM ();
/*
 *	Untransforms a grobj by setting its transformation matrix = I
 *
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 */

@message void MSG_GO_MOVE (	 		/* XXX */
    PointDWFixed 	_far *distance = ss:bp);
/*
 *	Move an object relative by the passed distance.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed:	distance	Amount to move object in parent's coordinates
 */

@message void MSG_GO_MOVE_CENTER_ABS (	 	/* XXX */
    PointDWFixed	_far *location = ss:bp);
/*
 *	Move object's center to the passed location.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: location 	Location to move object's center to w/in parent
 */

typedef ByteEnum CenterLeftRightWidth ;		/* CHECKME */
#define CLRW_CENTER 	0x0
#define CLRW_LEFT 	0x1
#define CLRW_RIGHT 	0x2
#define CLRW_WIDTH 	0x3

typedef ByteEnum CenterTopBottomHeight ;		/* CHECKME */
#define CTBH_CENTER 	0x0
#define CTBH_TOP 	0x1
#define CTBH_BOTTOM 	0x2
#define CTBH_HEIGHT 	0x3

typedef ByteFlags AlignType ;		/* CHECKME */
#define AT_ALIGN_X 	(0x80)
#define AT_DISTRIBUTE_X 	(0x40)
#define CenterLeftRightWidth 	(0x20 | 0x10)
#define CenterLeftRightWidth_OFFSET 	4

#define AT_ALIGN_Y 	(0x08)
#define AT_DISTRIBUTE_Y 	(0x04)
#define CenterTopBottomHeight 	(0x02 | 0x01)
#define CenterTopBottomHeight_OFFSET 	0

typedef struct {		/* CHECKME */
/* AP_x and AP_y should be first */
    DWFixed	AP_x;
    DWFixed	AP_y;
    DWFixed	AP_spacingX;
    DWFixed	AP_spacingY;
    AlignType	AP_type;
} AlignParams} ;

@message void MSG_GO_ALIGN (AlignParams *alignParams = ss:bp);
/*
 * 	???
 *
 * PASS
 * 	ss:bp = AlignParams
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef ByteFlags AlignToGridType ;		/* CHECKME */
#define ATGT_LEFT 	(0x20)
#define ATGT_H_CENTER 	(0x10)
#define ATGT_RIGHT 	(0x08)
#define ATGT_TOP 	(0x04)
#define ATGT_V_CENTER 	(0x02)
#define ATGT_BOTTOM 	(0x01)

@message void MSG_GO_ALIGN_TO_GRID (AlignToGridType type = cl);
/*
 * 	???
 *
 * PASS
 * 	cl = AlignToGridType
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SEND_ANOTHER_TOOL_ACTIVATED ();
/*
 * 	Sent to grobject to have it send MSG_GO_ANOTHER_TOOL_ACTIVATED
 * 	to selected grobjects and edit and mouse grab
 *
 *  Context:	Object generally sends this message when
 * 		handling MSG_GO_ACTIVATE_CREATE
 *  Source:	Floater
 *  Destination:	Floater
 *  Interception:	The default handler assumes the grobject is a shapes
 * 		Objects, such as guardians, pointer, whatever, need
 * 		to subclass this message and do the correct notification.
 * 		In this case the superclass should not be called
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

/*
 * Provides basic information about tool activating that most selected and
 * edited grobjects will be able to use to determine whether to remain
 * selected or edited.
 */

typedef ByteFlags AnotherToolActivatedFlags ;		/* CHECKME */
/*
 * A pointer tool intended to word
 * on the normal move and resize
 * handles of an object
 */
#define ATAF_STANDARD_POINTER 	(0x04)
/*
 * A shape drawing tool, rectangle
 * ellipse...
 */
#define ATAF_SHAPE 	(0x02)
/* A vis guardian object */
#define ATAF_GUARDIAN 	(0x01)

@message void MSG_GO_ANOTHER_TOOL_ACTIVATED (optr callerOD = cx:dx,
                    AnotherToolActivatedFlags flags = bp);
/*
 * 	Sent to selected grobjects when another tool is activated.
 * 	Receiving object decides whether to drop selection or
 * 	show an edit indicator based on tool activating
 *
 *  Context:	Object generally sends this message when
 * 		handling MSG_GO_ACTIVATE_CREATE
 *  Source:	Floater
 *  Destination:	Any grobj object
 *  Interception:	The default handler assumes the grobject is a shape
 * 		and drops the selection unless the activating
 * 		tool is a standardPointer. Objects that can be
 * 		edited, such as guardians, will want to subclass
 * 		this message.
 *
 * PASS:
 * 	cx:dx - od of caller
 * 	bp - AnotherToolActivatedFlags
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SPECIAL_RESIZE_CONSTRAIN (
        GrObjHandleSpecification grObjHandleSpec = cl);	/* XXX */
/*
 * 	Examines the information in the sprite instance data
 * 	which represents what the object will look like next.
 * 	If the resulting size,shape etc is not what we want
 * 	this routine should modify the sprite data appropriately
 *
 * 	NOTE: this message has an associated GrObjMessageOptimizationFlags
 * 	bit. If you wish to subclass this message, you will need to
 * 	set this bit in your object, otherwise the default handler
 * 	will be called directly.
 *
 *  Context:	Sent to object during handling of MSG_GO_PTR_RESIZE, just
 * 		before new sprite is to be drawn. Only sent if
 * 		GOAF_SPECIAL_RESIZE_CONSTRAIN bit is set.
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: There is no default handler
 *
 * PASS:
 * 	cl - GrObjHandleSpecification of anchor
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message optr MSG_GO_DUPLICATE_FLOATER (optr bodyOD = cx:dx) = cx:dx;
/*
 *  	Duplicate the floater in a block that is returned from the
 * 	body via MSG_GB_GET_BLOCK_FOR_ONE_GROBJ.
 *
 *
 *  Context:	When duplicate of floater is being added to the body.
 *  Source: 	Unrestricted, usually the body
 *  Destination:	The floater object
 *  Interception: If objects has instance data, chunks, other blocks that
 * 		need to be initialized or otherwise copied then
 * 		you must subclass this message and call your superclass
 * 		first.
 *
 * PASS
 * 	cx:dx - OD of body
 *
 * RETURN
 * 	cx:dx - OD of new object
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GRAB_MOUSE ();
/*
 * 	Grab the mouse
 *
 * PASS
 * 	nothing
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_RELEASE_MOUSE ();
/*
 * 	Release the mouse
 *
 * PASS
 * 	nothing
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message Boolean MSG_GO_UNGROUPABLE () = carry;
/*
 *       	Determine if object consists of collection of objects in a
 * 	group that can be broken up into the indivdual objects
 *
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	stc - ungroupable
 * 	clc - groupable
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {		/* CHECKME */
    DWFixed	RDWF_left;
    DWFixed	RDWF_top;
    DWFixed	RDWF_right;
    DWFixed	RDWF_bottom;
} RectDWFixed} ;

typedef struct {		/* CHECKME */
    RectDWFixed	BRD_rect;
/*
    CheckHack	< (offset BRD_rect eq 0) >
*/
    GStateHandle	BRD_destGState;
    GStateHandle	BRD_parentGState;
/*
 * if zero, the rectangle
 * has not been initialized
 * It is generally ignored
 * except by groups
 */
    word	BRD_initialized;

} BoundingRectData} ;

@message void MSG_GO_GET_BOUNDING_RECTDWFIXED (
    BoundingRectData *retValue = ss:bp);
/*
 *       	Calculate and return the RectDWFixed that bounds the object
 * 	in the destination gstate coordinate system.
 *
 * PASS
 * 	ss:bp - BoundingRectData
 * 		BRD_destGState
 * 		BRD_parentGState
 *
 * RETURN
 * 	ss:bp - BoundingRectData
 * 		BRD_rect
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_CALC_PARENT_DIMENSIONS ();
/*
 *       	Have object recalcutate it's document coord width and height
 * 	using normalTransform, line width and such
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	document dimensions set
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_INIT_CREATE (PointDWFixed *origin = ss:bp);
/*
 *   Have object initialize its instance data for interactive creation
 *
 *  Context:	Sent by object to itself in response to a receiving
 * 		a MSG_META_START_SELECT when in create mode.
 *  Source:	Generally sent by object to itself
 *  Destination:	Any grobj object that has yet to be created.
 *  Interception:	Unlikely.
 *
 * PASS
 * 	ss:bp - PointDWFixed - location to start create from
 *
 * RETURN
 *
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

/***************************************************************************/
@message void MSG_GO_NOTIFY_GROBJ_VALID (); 	/* XXX */
/*
 * Notify object that it is ready for action. It's got a normalTransform
 * with valid position, size, etc, info and it has any attributes it
 * needs.
 *
 */

typedef struct {
    WWFixed	RWWF_left;
    WWFixed RWWF_top;
    WWFixed RWWF_right;
    WWFixed RWWF_bottom;
} RectWWFixed} ;

typedef ByteEnum EvaluatePositionRating ;		/* CHECKME */
#define	EVALUATE_NONE			0x0
#define	EVALUATE_SUB_LOW		0x1
#define	EVALUATE_LOW			0x2
#define	EVALUATE_SUB_MEDIUM		0x3
#define	EVALUATE_MEDIUM			0x4
#define	EVALUATE_SUB_HIGH		0x5
#define	EVALUATE_HIGH			0x6

typedef struct {
    GrObjHandleSpecification hitHandle;
    EvaluatePositionRating	evaluation;
} PositEvalAndHitHandle} ;

@message PositEvalAndHitHandle MSG_GO_EVALUATE_PARENT_POINT_FOR_HANDLE (
    PointDWFixed *parentCoord = ss:bp) = ax;
/*
 * 	Determine if one of the handles of the object would be hit
 * 	by the passed point
 *
 *  Context:	Usually called as direct action of user clicking with
 * 		the pointer tool.
 *  Source:	Unrestricted, generally the floater
 *  Destination:	Any grobj object. The message will be ignored if the
 * 		object's GOTM_HANDLES_DRAWN flag is not set
 *  Interception:	Possible. If object doesn't have normal 9 handles, such
 * 		as a line with only 3, it should subclass this message
 * 		and not call its superclass
 *
 * PASS
 * 	ss:bp - PointDWFixed in PARENT
 *
 * RETURN
 * 	al - EVALUATE_NONE - handles not hit
 * 		ah - destroyed
 * 	al - EVALUATE_HIGH - handle hit
 * 		ah - GrObjHandleSpecification of hit handle
 *
 * 	dx - 0 ( blank EvaluatePositionNotes)
 *
 * DESTROYED:
 * 	nothing
 */

@message void MSG_GO_INVERT_GROBJ_SPRITE (GStateHandle gstate = dx);
/*
 * 	Invert objects sprite
 *
 * PASS
 * 	dx - gstate to draw or 0
 *
 * RETURN
 * 	nothing
 *
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_INVERT_GROBJ_NORMAL_SPRITE (GStateHandle gstate = dx);
/*
 * 	Invert normal image of object as if it were the sprite.
 * 	Used when interatively modifying groups
 *
 * PASS
 * 	dx - gstate or 0
 *
 * RETURN
 * 	nothing
 *
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_INVALIDATE ();
/*
 * 	Invalidate the bounding box of the object
 *
 * 	NOTE: this message has an associated GrObjMessageOptimizationFlags
 * 	bit. If you wish to subclass this message, you will need to
 * 	set this bit in your object, otherwise the default handler
 * 	will be called directly.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: If you subclass this message you must set
 * 		GOMOF_INVALIDATE in the GOI_msgOptFlags field in
 * 		the object's instance data
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GET_DW_PARENT_BOUNDS (RectDWord *bounds = ss:bp); /* XXX */
/*
 * 	Get RectDWord bounds of object in PARENT coord system
 *
 * 	NOTE: this message handler is not used internally so subclassing
 * 	it will do nothing. It is merely provided as an external interface
 *
 * PASS
 * 	ss:bp - RectDWord
 *
 * RETURN
 * 	ss:bp - RectDWord
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GET_DWF_PARENT_BOUNDS (RectDWFixed *bounds = ss:bp);
/*
 * 	Get DWFixed bounds of object in PARENT coordinate system
 *
 * 	NOTE: this message handler is not used internally so subclassing
 * 	it will do nothing. It is merely provided as an external interface
 *
 * PASS
 * 	ss:bp - RectDWFixed
 *
 * RETURN
 * 	ss:bp - RectDWFixed
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GET_DWF_SELECTION_HANDLE_BOUNDS_FOR_TRIVIAL_REJECT (
    RectDWord *retValue = ss:bp); /* XXX */
/*
 * 	Get extended DWFixed objects bounds in document coordinates.
 * 	The extension will cover things hanging off the object likes
 *        its handles. It is intended for trivially rejecting pointer
 * 	events and clicks over handles of selected objects
 *
 * 	For some objects, like rotated ellipses this bounds calculation
 * 	is non trivial, so they will just return the entire graphics system
 * 	as the bounds.
 *
 * 	This message can only be sent to objects not in groups. GrObjs
 * 	inside groups can't be selected, so they don't have handles. Even
 * 	if they did, this routine is not prepared to map the handle size
 * 	from DOCUMENT coords into PARENT coords.
 *
 * 	NOTE: this message has an associated GrObjMessageOptimizationFlags
 * 	bit. If you wish to subclass this message, you will need to
 * 	set this bit in your object.
 *
 * PASS
 * 	ss:bp - RectDWFixed
 *
 * RETURN
 * 	ss:bp - RectDWFixed
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GET_WWF_PARENT_BOUNDS (RectWWFixed *retValue = ss:bp);
/*
 * 	Returns the RectWWFixed that surrounds the children in
 * 	PARENT coordinate system.
 *
 * 	Only children in groups are guaranteed to have
 * 	bounds that can be expressed in WWFixed so this
 * 	message can only be sent to children in groups
 *
 * 	NOTE: this message handler is not used internally so subclassing
 * 	it will do nothing. It is merely provided as an external interface
 *
 * PASS
 * 	ss:bp - RectWWFixed
 *
 * RETURN
 * 	ss:bp - RectWWFixed
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GET_WWF_OBJECT_BOUNDS ( 	/* XXX */
                RectWWFixed *retValue = ss:bp);
/*
 * 	Returns the RectWWFixed that surrounds the children in
 * 	OBJECT coordinate system
 *
 * 	NOTE: this message handler is not used internally so subclassing
 * 	it will do nothing. It is merely provided as an external interface
 *
 * PASS
 * 	ss:bp - RectWWFixed
 *
 * RETURN
 * 	ss:bp - RectWWFixed
 *
 * DESTROYED:
 * 	ax
 */

typedef enum {
    DONT_SELECT_AFTER_EDIT	,
    SELECT_AFTER_EDIT
} AfterEditAction} ;		/* CHECKME */

@message void MSG_GO_BECOME_UNEDITABLE (AfterEditAction afterEditAction = cl);
/*
 * 	Tell object to release edit grab
 *
 *  Context:	Usually called as direct action of user. Either choosing
 * 		tool of another object, clicking on a different object to
 * 		edit.
 *  Source:	Unrestricted, often the floater or object being created
 *  Destination:	Any grobj object, in generally only GrObjVisGuardians
 * 		can actually become editable.
 *  Interception:	Unlikely
 *
 * PASS
 * 	cl - AfterEditAction
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef WordFlags EvaluatePositionNotes ;		/* CHECKME */
#define EPN_PADDING 	(0xfffc)
#define EPN_PADDING_OFFSET 	2
/* Objects selection lock is set. */
#define EPN_SELECTION_LOCK_SET 	(0x0002)
/*
 * GrObj blocks out, covers up or
 * otherwise completely obscures objects
 * underneath it at the position
 */
#define EPN_BLOCKS_LOWER_OBJECTS 	(0x0001)

typedef struct {
    EvaluatePositionRating	EPRAN_rating;
    byte			EPRAN_pad1;
    word			EPRAN_pad2;
    EvaluatePositionNotes	EPRAN_notes;
    word			EPRAN_pad3;
} EvaluatePositionRatingAndNotes} ;

@message void MSG_GO_EVALUATE_POSITION (EvaluatePositionRatingAndNotes *retVal = axcxdxbp, PointDWFixed *point = ss:bp);
/*
 * 	Have object evaluate the passed mouse position in terms
 * 	of selection
 *
 *
 * PASS
 * 	ss:bp - PointDWFixed
 *
 * RETURN
 * 	al - EvaluatePositionRating
 * 	dx - EvaluatePositionNotes
 *
 * DESTROYED:
 * 	ah
 */

@message void MSG_GO_EVALUATE_PARENT_POINT_FOR_SELECTION (EvaluatePositionRatingAndNotes *retVal = axcxdxbp, PointDWFixed *point = ss:bp);
/*
 * 	Have object evaluate the passed point in terms
 * 	of selection. The point is in the PARENT's coordinate system
 *
 *  Context:	Varied. Generally used when determine which object to
 * 		select from a mouse click
 *  Source:	Unrestricted
 *  Destination:	Any grobj object
 *  Interception:	Very likely. Most grobj object's are unique in their
 * 		rating of a point. It is unlikely that you will need
 * 		to call your superclass
 *
 *
 * PASS
 * 	ss:bp - PointDWFixed in PARENT coordinate system
 *
 * RETURN
 * 	al - EvaluatePositionRating
 * 	dx - EvaluatePositionNotes
 *
 *
 * DESTROYED:
 * 	ah
 */

@message void MSG_GO_GET_CENTER (PointDWFixed *center = dx:bp); /* XXX */
/*
 * 	Return center of object
 *
 * PASS
 * 	ss:bp - PointDWFixed
 *
 * RETURN
 * 	ss:bp - PointDWFixed with center in it
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_INIT_TO_DEFAULT_ATTRS (); 	/* XXX */
/*
 * Have object initialize its attributes to the current defaults
 */

@message void MSG_GO_DRAW (
    GStateHandle gstate = bp,
    DrawFlags drawFlags = cl,
    GrObjDrawFlags grObjDrawFlags = dx);

@message MouseReturnFlags MSG_GO_LARGE_START_SELECT (
    GrObjMouseData *mouseData = ss:bp) = ax;

@message MouseReturnFlags MSG_GO_LARGE_START_MOVE_COPY (
    GrObjMouseData *mouseData = ss:bp) = ax;

@message MouseReturnFlags MSG_GO_LARGE_END_SELECT (
    GrObjMouseData *mouseData = ss:bp) = ax;

@message MouseReturnFlags MSG_GO_LARGE_END_MOVE_COPY (
    GrObjMouseData *mouseData = ss:bp) = ax;

@message MouseReturnFlags MSG_GO_LARGE_DRAG_SELECT (
    GrObjMouseData *mouseData = ss:bp) = ax;

@message MouseReturnFlags MSG_GO_LARGE_DRAG_MOVE_COPY (
    GrObjMouseData *mouseData = ss:bp) = ax;

@message MouseReturnFlags MSG_GO_LARGE_PTR (
    GrObjMouseData *mouseData = ss:bp) = ax;

typedef struct {		/* CHECKME */
/* OD of group object */
    optr	AATGD_group;
/*
 * Value to subtract from center of child to position it correctly
 */
    PointDWFixed	AATGD_centerAdjust;

} AfterAddedToGroupData} ;

@message void MSG_GO_AFTER_ADDED_TO_GROUP (AfterAddedToGroupData *data = ss:bp);
/*
 * 	Sent to an object after it has been added to a group
 *
 * PASS:
 * 	ss:bp - AfterAddedToGroupData
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_BEFORE_REMOVED_FROM_GROUP ();
/*
 * 	Sent to an object just before it is removed from a group
 *
 * PASS:
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_AFTER_ADDED_TO_BODY (); 	/* XXX */
/*
 * Sent to an object after it has been added to the body.
 *
 *	Context:	Sent to object that has just been added to body.
 *	Source:		GrObjBody only.
 *	Destination:	Any GrObj.
 *	Interception:	Possible.  Call super class before doing own processing
 *
 */

@message void MSG_GO_BEFORE_REMOVED_FROM_BODY (); 	/* XXX */
/*
 * 	Sent to an object just before it is removed from the body
 *
 *  Context:	Sent to object that just before it is removed from body
 *  Source:	Body only
 *  Destination:	Any grobj object that has been added to body
 *  Interception:	Possible. Call super class after doing own processing.
 * 		Example, VisGuardian intercepts this message
 * 		to visually remove its ward from the body
 */

@message void MSG_GO_SET_AREA_ATTR ( 	/* XXX  */
    GrObjBaseAreaAttrElement 	_far *attr = ss:bp);
/*
 *	Set the area attributes of the object.
 *
 *	Context:	GrObjUtility
 *	Source:		Unrestricted
 *	Destination:	Any grobj.  If the object has no area attributes,
 *			ignore the message.
 *	Interception:	Unlikely
 */

@message void MSG_GO_SET_AREA_COLOR (	 	/* XXX  */
    byte 	red = cl,
    byte 	green = ch,
    byte 	blue = dl);
/*
 *	Set the area color of the object.
 *
 *	Context: 	GrObj Utility.
 *	Source:		Unrestricted.
 *	Destination:	Any GrObj.  If the object has no area atttributes
 *			it will ignore the message.
 *	Interception:	Unlikely.
 */

@message void MSG_GO_SET_AREA_MASK (	 	/* XXX */
    SysDrawMask 	mask = cl);
/*
 *	Set the area mask of the object.
 *
 *	Context:	GrObj Utility.
 *	Source:		Unrestricted.
 *	Destination:	Any GrObj.  If the object has no area attributes,
 *			then it will ignore this message.
 *	Interception: 	Unlikely.
 */

@message void MSG_GO_SET_AREA_DRAW_MODE ( 	/* XXX */
    MixMode 	mode = cl);
/*
 *	Set the draw mode of the object in the area structure. The
 *	draw mode is actually used for both the line and area
 *	drawing.
 *
 *	Context: 	GrObj Utility
 *	Source:		Unrestricted:
 *	Destination:	Any GrObj.  If the object has no area attributes,
 *			then it will ignore this message.
 *	Interception: 	Unlikely.
 */

@message void MSG_GO_SET_TRANSPARENCY (	 	/* XXX */
    byte 	transparent = cl );
/*
 *	Set the area info of the object.
 *
 *	Context: 	GrObj Utility
 *	Source:		Unrestricted:
 *	Destination:	Any GrObj.  If the object has no area attributes,
 *			then it will ignore this message.
 *	Interception: 	Unlikely.
 */

@message void MSG_GO_SET_LINE_ATTR (	 	/* XXX */
    GrObjBaseLineAttrElement 	_far *attr = ss:bp);
/*
 *	Set the line attributes of the object.
 *
 *	Context: 	GrObj Utility
 *	Source:		Unrestricted:
 *	Destination:	Any GrObj.  If the object has no line attributes,
 *			then it will ignore this message.
 *	Interception: 	Unlikely.
 */

@message void MSG_GO_SET_LINE_COLOR (	 	/* XXX */
    byte 	red = cl,
    byte	green = ch,
    byte 	blue = dl);
/*
 *	Set the line color of the object.
 *
 *	Context: 	GrObj Utility
 *	Source:		Unrestricted:
 *	Destination:	Any GrObj.  If the object has no line attributes,
 *			then it will ignore this message.
 *	Interception: 	Unlikely.
 */

@message void MSG_GO_SET_LINE_MASK (SystemDrawMask drawMask = cl); /* XXX */

@message void MSG_GO_SET_LINE_END (	 	/* XXX */
    LineEnd 	end = cl);
/*
 *	Set the line end of the object.
 *
 *	Context: 	GrObj Utility
 *	Source:		Unrestricted:
 *	Destination:	Any GrObj.  If the object has no line attributes,
 *			then it will ignore this message.
 *	Interception: 	Unlikely.
 */

@message void MSG_GO_SET_LINE_JOIN (	 	/* XXX */
    LineJoin 	join = cl);
/*
 *	Set the line join of the object.
 *
 *	Context: 	GrObj Utility
 *	Source:		Unrestricted:
 *	Destination:	Any GrObj.  If the object has no line attributes,
 *			then it will ignore this message.
 *	Interception: 	Unlikely.
 */

@message void MSG_GO_SET_LINE_STYLE (	 	/* XXX */
    LineStyle 	style = cl);
/*
 *	Set the line style of the object.
 *
 *
 *	Context: 	GrObj Utility
 *	Source:		Unrestricted:
 *	Destination:	Any GrObj.  If the object has no line attributes,
 *			then it will ignore this message.
 *	Interception: 	Unlikely.
 */

@message void MSG_GO_SET_LINE_WIDTH (	 	/* XXX */
    WWFixed 	width = dx.cx);
/*
 *	Set the line width of the object.
 *
 *	Context: 	GrObj Utility
 *	Source:		Unrestricted:
 *	Destination:	Any GrObj.  If the object has no area attributes,
 *			then it will ignore this message.
 *	Interception: 	Unlikely.
 */

@message void MSG_GO_SET_LINE_MITER_LIMIT ( 	/* XXX */
     WWFixed 	miterLimit = dx.cx);
/*
 *	Set the miter limit for the object's corners.
 *
 *	Context: 	GrObj Utility
 *	Source:		Unrestricted:
 *	Destination:	Any GrObj.  If the object has no line attributes,
 *			then it will ignore this message.
 *	Interception: 	Unlikely.
 */

@message word MSG_GO_GET_GROBJ_AREA_TOKEN () = cx;
/*
 * 	Return the index of the GrObjBaseAreaAttrElement for this object
 *
 *
 *  Context:	GrObj utility
 *  Source:	Unrestricted
 *  Destination:	Any grobj object. If the object has no area attributes
 * 		it will not respond to the message.
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	nothing
 *
 * RETURN
 * 	cx - token
 * 	must always return carry set
 *
 *
 * DESTROYED:
 * 	ax
 */

@message word MSG_GO_GET_GROBJ_LINE_TOKEN () = cx;
/*
 * 	Return the index of the GrObjBaseLineAttrElement for this object
 *
 *
 *  Context:	GrObj utility
 *  Source:	Unrestricted
 *  Destination:	Any grobj object. If the object has no line attributes
 * 		it will not respond to the message.
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	nothing
 *
 * RETURN
 * 	cx - token
 * 	must always return carry set
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_GROBJ_AREA_TOKEN (word token = cx);
/*
 * 	Set the area token for the object
 *
 *
 *  Context:	GrObj utility
 *  Source:	Unrestricted
 *  Destination:	Any grobj object.
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	cx - token (CA_NULL_ELEMENT for return to base style)
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_GROBJ_LINE_TOKEN (word token = cx);
/*
 * 	Set the line token for the object
 *
 *
 *  Context:	GrObj utility
 *  Source:	Unrestricted
 *  Destination:	Any grobj object.
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	cx - token (CA_NULL_ELEMENT for return to base style)
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SUBST_AREA_TOKEN (
    word oldToken = cx,
    word newToken = dx,
    Boolean updateReferenceCounts = bp);
/*
 * 	If GrObj's area token matches the passed "old" token, replace it
 * 	with the new token, updating the reference counts if specified
 *
 *  Context:	GrObj Utility
 *  Source:	Most likely from the style substitution callack
 *  Destination:	GrObj
 *  Interception:	Unlikely
 *
 * PASS:		cx - old area token
 * 		dx - new area token
 * 		bp - nonzero if GrObjs should update reference counts
 * 			to both the old and new tokens
 *
 * RETURN:	nothing
 *
 * DESTROYED:	ax
 */

@message void MSG_GO_SUBST_LINE_TOKEN (
    word oldToken = cx,
    word newToken = dx,
    Boolean updateReferenceCounts = bp);
/*
 * 	If GrObj's line token matches the passed "old" token, replace it
 * 	with the new token, updating the reference counts if specified
 *
 *  Context:	GrObjBody Utility
 *  Source:	Most likely from the style substitution callack
 *  Destination:	GrObjBody
 *  Interception:	Unlikely
 *
 * PASS:		cx - old line token
 * 		dx - new line token
 * 		bp - nonzero if GrObjs should update reference counts
 * 			to both the old and new tokens
 *
 * RETURN:	nothing
 *
 * DESTROYED:	ax
 */

typedef struct {		/* CHECKME */
    PointDWFixed	GOHAD_anchor;
/*
    CheckHack	< (offset GOHAD_anchor eq 0) >
*/
    GrObjHandleSpecification	GOHAD_handle;
} GrObjHandleAnchorData} ;

@message void MSG_GO_GET_ANCHOR_DOCUMENT (GrObjHandleAnchorData *data = ss:bp);
/*
 * :	Get coords of anchor point specified by
 * 	GrObjHandleSpecification in DOCUMENT coords
 *
 * PASS:
 * 	ss:bp - GrObjHandleAnchorData
 * 		GOHAD_handle - GrObjHandleSpecification
 *
 * RETURN
 * 	ss:bp - GrObjHandleAnchorData
 * 		GOHAD_anchor
 *
 * DESTROYED:
 * 	ax
 */

@message Boolean MSG_GO_BECOME_EDITABLE () = carry;
/*
 * 	Tell object to grab the edit grab
 *
 *  Context:	Usually called as direct action of user. Either clicking on
 * 		object with edit tool or hitting edit menu item when one
 * 		object is selected.
 *  Source:	Unrestricted, often the floater or the body.
 *  Destination:	Any grobj object, in generally only GrObjVisGuardians
 * 		can actually become editable.
 *  Interception:	Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURNS:
 * 	stc - became editable
 * 	clc - didn't become editable, most likely due to edit lock
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_EDIT_INDICATOR (GStateHandle gstate = dx);
/*
 * 	Draws something to indicate to the user that
 * 	this object is being edited
 *
 *  Context:	When the objects is becoming editable
 *  Source:	Unrestricted, often the object itself on MSG_GO_BECOME_EDITABLE
 *  Destination:	Any grobj object that can be edited. If the object
 * 		is not currently being edited the message will be
 * 		ignored
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	dx - gstate
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_UNDRAW_EDIT_INDICATOR (GStateHandle gstate = dx);
/*
 * 	Erase the something that indicates to the user that
 * 	this object is being edited
 *
 *  Context:	When the objects is becoming uneditable
 *  Source:	Unrestricted, often the object itself on MSG_GO_BECOME_UNEDITABLE
 *  Destination:	Any grobj object that can be edited. If the object's
 * 		edit marker is not currently drawn the message will be
 * 		ignored.
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	dx - gstate
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_EDIT_INDICATOR_RAW (GStateHandle gstate = dx);
/*
 * 	Called to update the something that indicates to the
 * 	user that this object is being edited during an expose event. Draws
 * 	the something if the indicatorDrawn flag is set, otherwise
 * 	does nothing
 *
 *  Context:	During an expose event
 *  Source:	Unrestricted, most often the graphic body
 *  Destination:	Any grobj object that is being edited. If the object
 * 		is not being edited the message is ignored
 *  Interception:	Unlikely.
 *
 * PASS
 * 	dx - gstate
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_INVERT_EDIT_INDICATOR (GStateHandle gstate = dx);
/*
 * 	Invert the edit indicator
 *
 *  Context:	When the edit indicator needs to be drawn/erased
 *  Source:	Unrestricted, most often the object itself
 *  Destination:	Any grobj object that can be edited.
 *  Interception:	Possible. If the object has its own special edit
 * 		indicator it should invert its indicator and not
 * 		call its superclass
 *
 * PASS:
 * 	dx - gstate
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GROBJ_SPECIFIC_INITIALIZE (word initData = bp);
/*
 * 	Do any initialization that is necessary after the object
 * 	has been instantiated.
 *
 *  Context:	Send to floater object immediately after it is
 * 		instantiated. Must be sent to object before
 * 		MSG_GO_ACTIVATE_CREATE
 *  Source:	GrObjHead
 *  Destination:	Only the floater
 *  Interception:	Likely. There is no default behaviour for this function.
 * 		Each object that expects special initialize data
 * 		must have a handler
 *
 * PASS:
 * 	bp - object specific initialization data
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GROBJ_SPECIFIC_INITIALIZE_WITH_DATA_BLOCK (hptr initData = bp);
/*
 * 	Do any initialization that is necessary after the object
 * 	has been instantiated.
 *
 *  Context:	Send to floater object immediately after it is
 * 		instantiated. Must be sent to object before
 * 		MSG_GO_ACTIVATE_CREATE
 *  Source:	GrObjHead
 *  Destination:	Only the floater
 *  Interception:	Likely. There is no default behaviour for this function.
 * 		Each object that expects special initialize data
 * 		must have a handler
 *
 * PASS:
 * 	^hbp - object specific initialization data
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_APPLY_ATTRIBUTES_TO_GSTATE (GStateHandle gstate = bp);
/*
 * 	Have object apply any attributes that is possess in its
 * 	instance data to the passed gstate
 *
 *  Context:	Unlimited
 *  Source:	Anything
 *  Destination:	Any grobj object
 *  Interception:	Likely. There is no default handler for this message. Any
 * 		object that adds new attributes to its instance dataa
 * 		should subclass this message
 *
 * PASS:
 * 	bp - gstate
 *
 * RETURN
 * 	bp - gstate with attributes applied
 *
 * DESTROYED:
 * 	ax
 */

@message word MSG_GO_SET_ACTION_NOTIFICATION_OUTPUT (	/* XXX */
    optr object = cx:dx,	/* Object which will receive notification */
    Message messageNumber = bp) = bp;
/*
 *	Specify the message and output descriptor for grobjects to
 * 	send notification to when an action is performed on them.
 * 	Many uses of the grobj will have no notification.
 *
 *	When a GrObj sends out a notification it will put its OD in cx:dx
 *	and an appropriate GrObjActionNotificationType in bp.
 *
 *	The object which will receive notification must either be in the
 * 	same VM file as this GrObj or in a resource, because the GrObj will
 *	need to relocate and unrelocate it.
 *
 *	Sending MSG_GO_SET_ACTION_NOTIFICATION will remove any suspension of
 *	action notifications.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	PASS:	object		optr of object to notify
 *				NULL to clear the output
 *		messageNumber 	message to send
 */

@message word MSG_GO_NOTIFY_ACTION (			/* XXX */
    GrObjActionNotificationType action = bp) = bp;
/*
 * 	Message that an object sends to itself to notify it that an action has
 *	been performed.The default handler sends the action notification output
 *	(see MSG_GO_SET_ACTION_NOTIFICATION_OUTPUT and
 *	MSG_GB_SET_ACTION_NOTIFICATION_OUTPUT).If the GrObj doesnt have its own
 *	output, it will attempt to use the GrObjBody's action output.
 *
 *	Context:	GrObj Utility
 *	Source:		Generally the object itself
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: action		What sort of action was performed
 */

@message void MSG_GO_NUDGE (				/* XXX */
    sword 	xDistance = cx,
    sword 	yDistance = dx);
/*
 *	Move an object a multipule of current device units (i.e. pixels).  This is
 *	generally used for moving an object one pixel on screen regardless of the
 *	scale factor in the view.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted, generally the UI or object itself.
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: xDistance	number of device units to move horizontally
 *		yDistance	number of device units to move vertically
 */

@message void MSG_GO_SET_SIZE (			/* XXX */
    PointWWFixed 	_far *size = ss:bp);
/*
 *	Set the width and height of the object in points. The dimensions are
 *	calculated by mapping the objects' corners into document coords and
 *	calculating the distances between them. The center of the selection
 *	handles of a rectangle represent the corners mapped into document
 *	coords. The line thickness is not included in this calculation. ""
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted, generally the UI or object itself.
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: size 		Desired size
 */

@message void MSG_GO_SET_POSITION (			/* XXX */
    PointDWFixed 	_far *location = ss:bp);
/*
 * 	Set the position of the upper left of a GrObj. The position set is in
 *	document coords unless the GrObj is in a group. Then the position is
 *	relative to the upper left of the group. I the GrObj has been rotated/
 *	skewed/transformed this sets the location of the selection handle that
 *	was originally at the upper left of the GrObj.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted, generally the UI or object itself.
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed:	location	New coordinates
 */

@message dword MSG_GO_CHANGE_LOCKS (GrObjLocks setBits = cx,
                   GrObjLocks clearBits = dx) = cx.dx;

typedef struct {
    WWFixed 	GOSD_xScale;
    WWFixed 	GOSD_yScale;
} GrObjScaleData} ;

typedef struct {
    GrObjScaleData		 GOASD_scale; 		/* Scale factors */
    GrObjHandleSpecification GOASD_scaleAnchor;	/* Center of scaling */
    /* align word */
} GrObjAnchoredScaleData} ;

@message void MSG_GO_SCALE ( 	/* XXX */
    GrObjAnchoredScaleData	_far *params = ss:bp);
/*
 *	Scale a GrObj.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: params		A structure containing scale factors, and which handle
 *				to use as the center of scaling.
 */

typedef WordFlags GrObjBaseAreaAttrDiffs ;
#define GOBAAD_MULTIPLE_ELEMENT_TYPES  		0x8000
#define GOBAAD_MULTIPLE_STYLE_ELEMENTS  		0x4000
#define GOBAAD_MULTIPLE_COLORS 			0x2000
#define GOBAAD_MULTIPLE_BACKGROUND_COLORS 	0x1000
#define GOBAAD_MULTIPLE_MASKS 			0x0800
#define GOBAAD_MULTIPLE_PATTERNS 		0x0400
#define GOBAAD_MULTIPLE_DRAW_MODES 		0x0200
#define GOBAAD_MULTIPLE_INFOS 			0x0100
#define	GOBAAD_MULTIPLE_GRADIENT_END_COLORS		0x0080
#define	GOBAAD_MULTIPLE_GRADIENT_TYPES			0x0040
#define	GOBAAD_MULTIPLE_GRADIENT_INTERVALS		0x0020
#define GOBAAD_FIRST_RECIPIENT  0x0001
                /* A grobj knows that it's the first one to
                 * receive this data buffer if this flag is
                 * set (and should clear it). */
#define FUTURE_AREA_ATTR_ELEMENT_SIZE 	50
typedef struct {
    GrObjBaseAreaAttrElement 	GOFAAE_base;
    byte 			GOFAAE_future[FUTURE_AREA_ATTR_ELEMENT_SIZE];
} GrObjFullAreaAttrElement} ;

typedef struct {
    GrObjBaseAreaAttrElement 	GNAAC_areaAttr;
    GrObjBaseAreaAttrDiffs		GNAAC_areaAttrDiffs;
} GrObjNotifyAreaAttrChange} ;

@message void MSG_GO_COMBINE_AREA_NOTIFICATION_DATA ( 	/* XXX */
    Handle /* GrObjNotifyAreaAttrChange */	change = cx);
/*
 *	Combine this GrObj's attributes with the passed structure.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: change		Handle of structure containing changes.
 */

typedef ByteFlags GrObjGradientAttrDiffs ;		/* CHECKME */
#define GGAD_MULTIPLE_END_COLORS 	(0x80)
#define GGAD_MULTIPLE_TYPES 	(0x40)
#define GGAD_MULTIPLE_INTERVALS 	(0x20)
/* 4 bits unused */
/*
 * A grobj knows that it's the first
 * one to receive this data buffer if
 * this flag is set (and should clear it)
 */
#define GGAD_FIRST_RECIPIENT 	(0x01)

typedef struct {		/* CHECKME */
    GrObjGradientType	GONGAC_type;
/* ending color red byte */
    byte	GONGAC_endR;
/* ending color green byte */
    byte	GONGAC_endG;
/* ending color blue byte */
    byte	GONGAC_endB;
    word	GONGAC_numIntervals;
    GrObjGradientAttrDiffs	GONGAC_diffs;
} GrObjNotifyGradientAttrChange} ;

@message void MSG_GO_COMBINE_GRADIENT_NOTIFICATION_DATA ( 	/* XXX */
    Handle /* GrObjNotifyGradientAttrChange */	change = cx);
/*
 *	Combine this GrObj's attributes with the passed structure.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: change		Handle of structure containing changes.
 */

typedef WordFlags GrObjBaseLineAttrDiffs ;		/* CHECKME */
#define GOBLAD_MULTIPLE_STYLE_ELEMENTS 	(0x8000)
#define GOBLAD_MULTIPLE_ELEMENT_TYPES 	(0x4000)
#define GOBLAD_MULTIPLE_COLORS 	(0x2000)
#define GOBLAD_MULTIPLE_ENDS 	(0x1000)
#define GOBLAD_MULTIPLE_JOINS 	(0x0800)
#define GOBLAD_MULTIPLE_WIDTHS 	(0x0400)
#define GOBLAD_MULTIPLE_MASKS 	(0x0200)
#define GOBLAD_MULTIPLE_STYLES 	(0x0100)
#define GOBLAD_ARROWHEAD_ON_START 	(0x0080)
#define GOBLAD_ARROWHEAD_ON_END 	(0x0040)
#define GOBLAD_ARROWHEAD_FILLED 	(0x0020)
#define GOBLAD_ARROWHEAD_FILL_WITH_AREA_ATTRIBUTES 	(0x0010)
#define GOBLAD_MULTIPLE_MITER_LIMITS 	(0x0008)
#define GOBLAD_MULTIPLE_ARROWHEAD_ANGLES 	(0x0004)
#define GOBLAD_MULTIPLE_ARROWHEAD_LENGTHS 	(0x0002)
#define GOBLAD_FIRST_RECIPIENT 	(0x0001)

typedef struct {		/* CHECKME */
    GrObjBaseLineAttrElement	GNLAC_lineAttr;
    GrObjBaseLineAttrDiffs	GNLAC_lineAttrDiffs;
} GrObjNotifyLineAttrChange} ;

@message void MSG_GO_COMBINE_LINE_NOTIFICATION_DATA ( 	/* XXX */
    Handle /*GrObjNotifyLineAttrChange */	change = cx);
/*
 *	Combine this GrObj's attributes with the passed structure.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: change		Handle of structure containing changes.
 */

@message void MSG_GO_COMBINE_SELECT_STATE_NOTIFICATION_DATA (	/* XXX */
    Handle /* NotifySelectStateChange*/ 	change = cx);
/*
 *	Combine this GrObj's attributes with the passed structure.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: change		Handle of structure containing changes.
 */

typedef ByteFlags GrObjSelectionStateFlags ;		/* CHECKME */
/* True if an object is being edited. */
#define GSSF_EDITING 	(0x20)
/*
 * True if at least one of the objects
 * selected can be ungrouped.
 */
#define GSSF_UNGROUPABLE 	(0x10)
/*
 * True if at least one of the objects
 * selected is some sort of text object
 */
#define GSSF_TEXT_SELECTED 	(0x08)
/*
 * True if at least one of the objects
 * selected is some sort of bitmap object
 */
#define GSSF_BITMAP_SELECTED 	(0x04)
/*
 * True if at least one of the objects
 * selected is some sort of spline object
 */
#define GSSF_SPLINE_SELECTED 	(0x02)
/*
 * True if at least one of the objects
 * selected is some sort of arc object
 */
#define GSSF_ARC_SELECTED 	(0x01)

typedef struct {
    word		GSS_numSelected;	/* Number of selected GrObjs */
    ClassStruct 	_far *GSS_classSelected; /* Class of selected GrObjs */
    GrObjSelectionStateFlags GSS_flags;
    GrObjAttrFlags	GSS_grObjFlags;
    GrObjLocks	GSS_locks;
} GrObjSelectionState} ;

typedef ByteFlags GrObjSelectionStateDiffs ; /* XXX */
#define GSSD_MULTIPLE_CLASSES  0x80
#define	GSSD_MULTIPLE_ARC_CLOSE_TYPES	 0x40
#define	GSSD_MULTIPLE_ARC_START_ANGLES	 0x20
#define	GSSD_MULTIPLE_ARC_END_ANGLES	 0x10

typedef struct {		/* CHECKME */
    GrObjSelectionState		GONSSC_selectionState;
    GrObjSelectionStateDiffs	GONSSC_selectionStateDiffs;
    GrObjAttrFlags		GONSSC_grObjFlagsDiffs;
    GrObjLocks			GONSSC_locksDiffs;
    ArcCloseType		GONSSC_arcCloseType;
    WWFixed			GONSSC_arcStartAngle;
    WWFixed			GONSSC_arcEndAngle;
} GrObjNotifySelectionStateChange} ;

@message void MSG_GO_COMBINE_SELECTION_STATE_NOTIFICATION_DATA ( /* XXX */
    Handle /* GrObjNotifySelectionStateChange */	change = cx);
/*
 *	Combine this GrObj's attributes with the passed structure.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: change		Handle of structure containing changes.
 */

@message void MSG_GO_COMBINE_STYLE_NOTIFICATION_DATA (		/* XXX */
    Handle /* NotifyStyleChange */		change = cx);
/*
 *	Combine this GrObj's attributes with the passed structure.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: change		Handle of structure containing changes.
 */

@message void MSG_GO_COMBINE_STYLE_SHEET_NOTIFICATION_DATA (	/* XXX */
    Handle /* NotifyStyleSheetChange */	change = cx);

@message void MSG_GO_SEND_UI_NOTIFICATION ( 	/* XXX */
    GrObjUINotificationTypes notifications = cx);

@message void MSG_GO_SUSPEND_ACTION_NOTIFICATION (); 	/* XXX */
/*	Prevent GrObj from sending out any action notifications. If the
 *	GrObj has no action suspension OD it will still record the
 *	suspension and the suspension will be in place when the
 *	action output is set.
 *	Nested suspend/unsuspend pairs are allowed.
 *	If a file is closed it will always reopen unsuspended.
 *
 *	Context: 	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObj
 *	Interception:	Unlikely
 */

@message void MSG_GO_UNSUSPEND_ACTION_NOTIFICATION (); 	/* XXX */
/*	Counterbalance a call to MSG_GO_SUSPEND_ACTION_NOTIFICATION.
 *	If all suspends have been balanced, the GrObj will be free
 *	to send out action notification. However, it will not send
 *	action notifications that were aborted during the suspended
 *	period.
 *	If the GrObj is not suspended, this message is ignored.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObj
 *	Interception:	Unlikely
 *
 */

typedef struct {
    WWFixed 	GOSD_xDegrees; /* counter-clockwise */
    WWFixed 	GOSD_yDegrees;
} GrObjSkewData} ;

typedef struct {
    GrObjSkewData			GOASD_degrees;
    GrObjHandleSpecification	GOASD_skewAnchor;
} GrObjAnchoredSkewData} ;

@message void MSG_GO_SKEW ( 	/* XXX */
    GrObjAnchoredSkewData 	_far *params = ss:bp);
/*
 *	Skew a GrObj.
 *
 *	Context:	GrObj Utility.
 *	Source:		Unrestricted.
 *	Destination:	Any GrObj.
 *	Interception:	Unlikely.
 *
 *	Passed:	params		Structure containing skew amount and anchor
 *				of skew.
 */

@message void MSG_GO_TRANSFORM ( 	/* XXX */
    TransMatrix	_far *transformation = ss:bp);
/*
 *	Transform the GrObj.
 *	This is generally used to apply a group's transformation to all
 *	the children in the group. Unlike MSG_GO_SCALE, ROTATE,...  a
 *	handle is not anchored for the transformation. Instead the center
 *	of the GrObj is also transformed by the transformation.

 *	Context:	GrObj Utility.
 *	Source:		Unrestricted.
 *	Destination:	Any GrObj.
 *	Interception:	Unlikely.
 *
 *	Passed:	transormation 	transformation matrix.
 *
 */

@message void MSG_GO_COMPLETE_CREATE ();
/*
 * 	Complete interative create of an object. An object sends this
 * 	message to itself once it has set up its geometry and generally
 * 	cleaned up the state of its instance data. Upon handling this
 * 	message an object is expected to.
 * 	Send notify grobj valid to itself.
 * 	Calculate its parent dimensions.
 * 	Draw itself to the screen
 * 	Notify head of completed create
 * 	Send action notification
 * 	Become selected or editable
 *
 *  Context:	Sent to object at completion of interactive create
 *  Source:	Unrestricted. Ususally sent by object to itself
 *  Destination:  Any grobject that has just finished being created.
 *  Interception: Highly likely. The default handler will not
 * 		cause the object to become selected or become editable.
 * 		Each object must subclass this message, call its super
 * 		and then make itself selected or edited. Guardians
 * 		may also wish to subclass this message so that
 * 		can reset their instance data to have the Identity matrix
 * 		in their OT_transform field
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_COMPLETE_TRANSFORM (GrObjActionNotificationType type = bp);
/*
 * 	Object sends this message to itself to complete
 * 	a resize, rotate, skew or other transformation.
 * 	Object needs to calculate its parent dimensions,
 * 	adjust its position to make sure it is on the document,
 * 	invalidate itself and redraw handles if necessary.
 * 	Then send out MSG_GO_NOTIFY_ACTION to themselves.
 *
 *  Context:	Sent at end of interactive resize, rotate, skew or
 * 		end of a static transformation ( eg.MSG_GO_ROTATE)
 *  Source:	Generally object itself
 *  Destination:  GrObject
 *  Interception: Objects, such as the SplineGuardian, needs to transform
 * 		their points when ever a tranformation is
 * 		performed. Upon subclassing these objects should perform
 * 		their special function and then call their superclass.
 *
 * PASS:
 * 	bp - GrObjActionNotificationType (to be sent with MSG_GO_NOTIFY_ACTION)
 *
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_COMPLETE_TRANSLATE (GrObjActionNotificationType type = bp);
/*
 * 	Object sends this message to itself to complete
 * 	a move or other translation.
 * 	Object needs to adjust its position to make sure
 * 	it is on the document, invalidate itself and redraw
 * 	handles if necessary. Then send out MSG_GO_NOTIFY_ACTION
 * 	to themselves.
 *
 *  Context:	Sent at end of interactive move or at the
 * 		end of a static transformation ( eg.MSG_GO_MOVE)
 *  Source:	Generally object itself
 *  Destination:  GrObject
 *  Interception: Objects such as the GrObjVisGuardian needs to have
 * 		their vis ward destroy any cached gstates when the
 * 		object is translated. They should call their superclass
 * .		and the destroy the gstate.
 *
 * PASS:
 * 	bp - GrObjActionNotificationType (to be sent with MSG_GO_NOTIFY_ACTION)
 *
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {
    WWFixed 	GOGSP_height;
    WWFixed 	GOGSP_width;
} GOGetSizeParams} ;

@message void MSG_GO_GET_SIZE ( 	/* XXX */
    GOGetSizeParams	_far *retValue = bpaxdxcx);
/*
 *	Return the width and height of the object in points. The dimensions
 *	are calculated by mapping the object's corners into document coords
 *	and calculating the distances between them. The center of the
 *	selection ahndles of a rectangle represent the corners mapped into
 *	document coords. The line thickness is not included in this ""
 *	calculation.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted, generally the UI or object itself.
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed:	retValue	Structure to hold return value
 *
 *	Return: retValue	Structure filled with size information.
 */

@message void MSG_GO_GET_POSITION ( 	/* XXX */
    PointDWFixed 	_far *retValue = ss:bp);
/*
 *	Get the position of the upper left of a GrObj. The position is in
 *	document coords unless the GrObj is in a group. Then the position is
 *	relative to the upper left of the group. If the GrObj has been
 *	rotated/skewed/transformed this gets the location of the selection
 *	handle that was originally at the upper left of the GrObj.
 *
 *	Context:	GrObj Utility
 *	Source:		Unrestricted, generally the UI or object itself.
 *	Destination:	Any GrObject
 *	Interception:	Unlikely
 *
 *	Passed: retValue	Structure to hold return value
 *
 *	Return: retValue	Structure filled with position information
 */

typedef struct {
    PointDWFixed 	GOID_position;
    WWFixed		GOID_width;
    WWFixed 	GOID_height;
} GrObjInitializeData} ;

@message void MSG_GO_INITIALIZE (GrObjInitializeData *data = ss:bp); /*XXX */
/*
 * Initialize position, size and default attributes of grobject
 *
 * Pass:
 *	GrObjInitializeData
 *
 * Return:
 *	nothing
 */

@message void MSG_GO_SCALE_ABOUT_PARENT_LEFT_TOP (GrObjScaleData *scaleData = ss:bp);
/*
 * 	Scales object [current matrix] [scale].
 *  	Obscure message which applies the scale along the PARENT axes
 * 	and keeps the left top of the PARENT bounds in the same place.
 * 	This is used in the handling of MSG_GO_INSERT_OR_DELETE_SPACE.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - GrObjScaleData
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_INSERT_OR_DELETE_SPACE (InsertOrDeleteSpaceParams *params = ss:bp);
/*
 * 	Insert or delete space in/from the grobject
 * 	MSG_VIS_LAYER_INSERT_OR_DELETE_SPACE for description of
 * 	parameters.
 *
 *  Context:	GrObj Utility. Generally called when the body
 * 		recieves MSG_VIS_LAYER_INSERT_OR_DELETE_SPACE
 *  Source:	Unrestricted
 *  Destination:	GrObj
 *  Interception:	Unlikely.
 *
 * PASS
 * 	ss:bp  - InsertDeleteSpaceParams
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_BEGIN_CREATE ();
/*
 * 	Basically puts object in create mode. Sets position and other
 * 	geometry. Object is now ready to receive a start,ptr and end
 * 	selects for use in creating itself. Undo will be turned off
 * 	until MSG_GO_END_CREATE is received. Undoing a create is
 * 	done by just deleting the object, so this prevent cluttering
 * 	up the undo chains with useless stuff
 *
 *  Context:	Sent to object after it has been duplicated from floater
 *  Source:	Floater
 *  Destination:  Duplicate of floater
 *  Interception: Possible. Call super class first
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef WordFlags EndCreatePassFlags ;		/* CHECKME */
/*
 * the UIFA_ADJUST flag was set in
 * start select that began object
 * creation.
 */
#define ECPF_ADJUSTED_CREATE 	(0x0001)

typedef WordFlags EndCreateReturnFlags ;		/* CHECKME */
#define ECRF_NOT_CREATING 	(0x0002)	/* object was not in create mode. */
#define ECRF_DESTROYED 	(0x0001)	/* object was destroyed */

@message EndCreateReturnFlags MSG_GO_END_CREATE (EndCreatePassFlags flags = cx) = cx;
/*
 * 	Bring creation to a screeching halt using whatever data
 * 	is currently stored in the object. Must turn undo back on,
 * 	it was ignored in MSG_GO_BEGIN_CREATE.
 *
 *  Context:	Force basic drag create shapes this message is sent
 * 		upon receiving an END_SELECT while being created.
 * 		For more complex objects, such as spline, this message
 * 		is sent on double clicks and right mouse clicks.
 *  Source:	Unrestricted. Usually object itself.
 *  Destination:  Grobject being created.
 *  Interception: Rects, ellipse,lines, etc can use the default handler, but
 * 		other objects will likely subclass this and not
 * 		call their superclass. Subclasses of this message
 * 		must send MSG_GO_SUSPEND_COMPLETE_CREATE to themselves unless
 * 		the object is destroyed.
 *
 * PASS:
 * 	cx - EndCreatePassFlags
 *
 * RETURN:
 * 	cx - EndCreateReturnFlags
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_EVALUATE_PARENT_POINT_FOR_EDIT (EvaluatePositionRatingAndNotes *retVal = axcxdxbp, PointDWFixed *point = ss:bp);
/*
 * 	Have object evaluate the passed point in terms
 * 	of editing. (ie could the object edit it self
 * 	at this point)(eg for a bitmap, anywhere within
 * 	its bounds, for a spline, somewhere along the spline
 * 	or drawn control points).
 *
 *  Context:	Varied. Generally used when determine which object to
 * 		select from a mouse click
 *  Source:	Unrestricted
 *  Destination:	Any grobj object
 *  Interception:	Very likely. Most grobj object's are unique in their
 * 		rating of a point. It is unlikely that you will need
 * 		to call your superclass
 *
 *
 * PASS
 * 	ss:bp - PointDWFixed in PARENT coordinate system
 *
 * RETURN
 * 	al - EvaluatePositionRating
 * 	dx - EvaluatePositionNotes
 *
 * DESTROYED:
 * 	ah
 */

typedef struct {		/* CHECKME */

/*
 * Center of the object in
 * PARENT coords
 */
    PointDWFixed	OT_center;

/*
 * width of object in the
 * OBJECT coordinate system
 */
    WWFixed	OT_width;

/*
 * height of object in OBJECT
 * coordinate system.
 */
    WWFixed	OT_height;

/*
 * width of object in PARENT
 * coord. includes line ""
 * width and such so can
 * be used for invalidation, etc
 */
    WWFixed	OT_parentWidth;

/*
 * height of object in PARENT
 * coord. includes line ""
 * width and such so can
 * be used for invalidation, etc
 */
    WWFixed	OT_parentHeight;

    GrObjTransMatrix	OT_transform;

} ObjectTransform} ;

/*
 * 	This structure represents the subset of GrObj instance data
 * 	required to recover the object from a transfer item
 */
typedef struct {		/* CHECKME */
    GrObjAttrFlags	GODD_attrFlags;
    GrObjLocks	GODD_locks;
    word	GODD_areaToken;
    word	GODD_lineToken;
    ObjectTransform	GODD_normalTransform;
} GrObjDefiningData} ;

typedef struct {
    StyleSheetParams 	GTP_ssp;
    VisTextSaveStyleSheetParams    	GTP_textSSP;
    PointDWFixed	    	GTP_selectionCenterDOCUMENT;
    Handle			GTP_optBlock;
    Handle			GTP_vmFile;
    word 			GTP_curSlot;
    dword 			GTP_id;
    word 			GTP_curSize;
    word 			GTP_curPos;
} GrObjTransferParams} ;

@message void MSG_GO_CREATE_TRANSFER (GrObjTransferParams _far *params = ss:bp); /* XXX */
/*
 * This message causes the GrObj to create either a VM block or a DB item in
 * the VM override file, write any data needed to recreate the GrObj, and
 * store a 32 bit identifier in the passed tree block.
 * Context:		Sent to object during Cut/Copy/Duplicate
 * Source:		Unrestricted
 * Destination:		Any grobj
 * Interception:	Any sublacss that requires more than just instance
 *			data to reconstruct itself will subclass this message
 *			to construct the VMChain necessary to do so.
 *
 * Note: The VM override file must be set: see VMSetThreadVMFile.
 *
 * Passed:	params	GrObjTransferParams structure
 *			VM override file set.
 * Return:	The GTP_curSlost field of params is updated to the next slot
 *			in the tree, specified by GTP_treeBlock.
 */

@message void MSG_GO_REPLACE_WITH_TRANSFER (GrObjTransferParams _far *params = ss:bp);
/*
 * This message causes an existing GrObj to read the passed transfer item and
 * "recreate" itself from that information.
 * Context: 		Sent to object during paste-type operations
 * Source:		Unrestricted
 * Destination:		Any GrObj
 * Interception: 	Any subclass that requires more than just instance data
 *			to reconstruct itself will subclass this message to
 *			parse the VMChain necessary to do so.
 *
 * Note: The VM override file must be set: see VMSetThreadVMFile.
 *
 * Passed:	params	GrObjTransferParams structure
 *			VM override file set.
 * Return:	nothing
 *
 */

/*
 * MSG_GO_WRITE_INSTANCE_TO_TRANSFER --
 *
 *	This message causes the grobj to write any data needed to
 *	recreate the grobj into a transfer item.
 *
 *	Context:	Sent to object during Cut/Copy/Duplicate
 *	Source:	    	Unrestricted
 *	Destination:  	Any grobj
 *	Interception: 	Any subclass with data necessary to recreate the object
 *	    	    	will subclass this message. The subclass will first call
 *	    	    	its superclass, then write in its extra data.
 *
 * 	Note: The VM override file must be set: see VMSetThreadVMFile.
 *
 * 	Passed:	    *params - GrObjTransferParams structure
 *		    VM override file set.
 *
 *	Return:	    params->GTP_curPos - updated to just past the last
 *	    	    	    	    	 written data (so superclass can
 *	    	    	    	    	 begin writing, etc.)
 */
@message void MSG_GO_WRITE_INSTANCE_TO_TRANSFER (GrObjTransferParams *params = ss:bp);

/*
 * MSG_GO_READ_INSTANCE_FROM_TRANSFER --
 *
 *	This message causes the grobj to read any data needed to
 *	recreate the grobj from a transfer item.
 *
 *	Context:	Sent to object during paste-type operations
 *	Source:	    	Unrestricted
 *	Destination:  	Any grobj
 *	Interception: 	Any subclass with data necessary to recreate the object
 *	    	    	will subclass this message. The subclass will first call
 *	    	    	its superclass, then read in its extra data.
 *
 * 	Note: The VM override file must be set: see VMSetThreadVMFile.
 *
 * 	Passed:	    *params - GrObjTransferParams structure
 *		    VM override file set.
 *
 *	Return:	    params->GTP_curPos - updated to just past the last
 *	    	     	    	    	 read data (so superclass can begin
 *	    	    	    	    	 reading, etc.)
 */
@message void MSG_GO_READ_INSTANCE_FROM_TRANSFER (GrObjTransferParams *params = ss:bp);

typedef struct {
    MouseReturnFlags MRFAMI_flags;
    optr		 MRFAMI_image;
} MouseReturnFlagsAndMouseImage} ;

@message void MSG_GO_GET_POINTER_IMAGE (MouseReturnFlagsAndMouseImage *retVal = axcxdxbp, PointDWFixed *point = ss:bp);
/*
 * 	Return the optr of the mouse image.
 *
 *  Context:	Sent to object at end of every mouse event.
 *  Source:	Usually object itself
 *  Destination:  Any grobject
 *  Interception: Likely. The default pointer image is a +, if you don't
 * 		like it,subclass this message and don't call your
 * 		super class
 *
 * PASS:
 * 	ss:bp - PointDWFixed
 *
 * RETURN:
 * 	ax - mask MRF_SET_POINTER_IMAGE
 * 	cx:dx - optr of mouse image
 * 	or
 * 	ax - mask MRF_CLEAR_POINTER_IMAGE
 * 	cx:dx - destroyed
 *
 * DESTROYED:
 * 	see RETURN
 */

@message GrObjLocks MSG_GO_GET_LOCKS () = ax;
/*
 * 	Retrieve the GrObjLocks for the object.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any GrObject
 *  Interception:	Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	ax - GrObjLocks
 *
 * DESTROYED:
 * 	nothing
 */

@message void MSG_GO_DRAW_FG_AREA (DrawFlags drawFlags = cl,
                GrObjDrawFlags grobjDrawFlags= bp,
                GStateHandle gstate = dx);
/*
 * 	Draw the foreground area components of an object.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: There is no default handler. Most likely every
 * 		object will subclass this and not call their superclass.
 *
 * PASS:
 * 		cl - DrawFlags
 * 		bp - GrObjDrawFlags
 * 		dx - gstate with the object's transform applied
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_BG_AREA (DrawFlags drawFlags = cl,
                GrObjDrawFlags grobjDrawFlags= bp,
                GStateHandle gstate = dx);
/*
 * 	Draw the background area component of an object.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: Default handler draws a background rectangle.Most objects
 * 		will subclass this and not call their superclass.
 *
 * PASS:
 * 		cl - DrawFlags
 * 		bp - GrObjDrawFlags
 * 		dx - gstate with object's transform applied
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_SPRITE_LINE (GStateHandle gstate = dx); /* XXX */
/*
 * 	Draw the sprite line image of an object using the
 * 	spriteTransform.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW_SPRITE
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: Most likely every object will subclass this and not
 * 		call their superclass.
 *
 * PASS:
 * 		dx - gstate
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_NORMAL_SPRITE_LINE (GStateHandle gstate = dx);
/*
 * 	Draw the sprite line image of an object using the
 * 	normalTransform.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW_SPRITE on objects
 * 		in a group.
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: Most likely every object will subclass this and not
 * 		call their superclass.
 *
 * PASS:
 * 		dx - gstate
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DO_NOTHING ();

@message void MSG_GO_ADD_POTENTIAL_SIZE_TO_BLOCK ();
/*
 * 	Increments the potential size of this grobj's object block by
 * 	the amount of size the grobj could potentially expand to.
 *
 *  Context:	Most likely the GrObj has just been instantiated
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely. You should subclass MSG_GO_GET_POTENTIAL_GROBJECT_SIZE
 * 		instead.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SUBTRACT_POTENTIAL_SIZE_FROM_BLOCK ();
/*
 * 	Decrements the potential size of this grobj's object block by
 * 	the amount of size the grobj could potentially expand to.
 *
 *  Context:	Most likely the GrObj is about to be destroyed
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely. You should subclass MSG_GO_GET_POTENTIAL_GROBJECT_SIZE
 * 		instead.
 *
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message ClassStruct *MSG_GO_GET_GROBJ_CLASS *() = cx:dx;
/*
 * 	Returns the class representing the object's "leaf" class
 * 	according to The GrObj.
 *
 * 	For example, if the Chart library subclassed EllipseClass,
 * 	the class tree would look like Meta->GrObj->Rect->Ellipse->ChartEllipse
 * 	This method would return EllipseClass, since that's the last
 * 	one known to GrObj.
 *
 *  Context:	Sent by the object to itself when writing to the transfer item
 * 		so that in case a subclassing library writes the transfer
 * 		item, then goes away, we still have some class we can paste.
 *  Source:	The object itself, probably in the MSG_GO_CREATE_TRANSFER
 * 		method.
 *  Destination:  Any clipboardable grobj.
 *
 *  Interception: DO NOT INTERCEPT THIS MESSAGE. That's the whole point,
 * 		isn't it?
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	cx:dx - a class ptr recognized by GrObj
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {		/* CHECKME */
    Message	GOUAT_freeMessage;
    Message	GOUAT_undoMessage;
} GrObjUndoAppType} ;

@message void MSG_GO_UNDO_REPLACE_GEOMETRY_INSTANCE_DATA (
    DBGroup group = dx,
    DBItem item = cx,
    VMFileHandle file = bp);
/*
 * 	Replace the objects instance data with the passed BasicInit data
 * 	as part of an undo operation. A new undo chain is generated first
 * 	so that this operation will be undoable.
 *
 *  Context:	Send by object to itself while handling MSG_META_UNDO
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	dx - DB group
 * 	cx - DB item
 * 	bp - VM file handle
 *
 * 	The referenced DBitem must contain a BasicInit structure
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GENERATE_UNDO_REPLACE_GEOMETRY_INSTANCE_DATA_ACTION ();
/*
 * 	Generate an undo action for the objects current geometry
 * 	instance data
 *
 *  Context:	Prior to any action that is undoable and changes the
 * 		objects geometry (ie MSG_GO_MOVE). Usually the object
 * 		calls MSG_GO_GENERATE_UNDO_REPLACE_GEOMETRY_INSTANCE_DATA_CHAIN
 * 		which sends this message sandwiched by MSG_GO_START_UNDO_CHAIN
 * 		and MSG_GO_END_UNDO_CHAIN
 *
 *  Source:	Generally object itself
 *  Destination:  Generally object itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GENERATE_UNDO_REPLACE_GEOMETRY_INSTANCE_DATA_CHAIN (
    optr undoTextOD = cx:dx);
/*
 * 	Generate an undo chain for the objects current geometry
 * 	instance data.
 *
 *  Context:	Prior to any action that is undoable and changes the
 * 		objects geometry (ie MSG_GO_MOVE)
 *  Source:	Generally object itself
 *  Destination:  Generally object itself
 *  Interception: Unlikely
 *
 * PASS:
 * 		cx:dx - optr of undo text
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_CLEAR_SANS_UNDO ();
/*
 * 	Tell grobject to destroy itself in an undoable fashion.
 * 	It will remove itself from the body or group if necessary,
 * 	release grabs, etc. Then the object will send MSG_META_OBJ_FREE
 * 	to complete its demise. This message will delete the object
 * 	even if it has the delete lock set.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely. If grobject has any extra data that must be
 * 		freed it should do so on MSG_META_FINAL_OBJ_FREE
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_REMOVE_FROM_BODY ();
/*
 * 	Object will release any exclusives, drop selection, edit,
 * 	remove itself from the body and generate an
 * 	undo chain to undo the removal.
 *
 *  Context:	Generally used as part of MSG_GO_CLEAR and as
 * 		undo action for MSG_GB_ADD_GROBJ
 *  Source:	Generally object itself
 *  Destination:  Object itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_REMOVE_FROM_GROUP ();
/*
 * 	Have object remove itself from the group and generate an
 * 	undo chain to undo the removal.
 *
 *  Context:	Generally used as part of MSG_GO_CLEAR
 *  Source:	Generally object itself
 *  Destination:  Object itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_RELEASE_EXCLS ();
/*
 * 	Release mouse grabs, target, focus, gadget, selection, edit, etc
 *
 *  Context:	GrObj Utilitity. Normal used when object is being cleared
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GENERATE_UNDO_CLEAR_CHAIN ();
/*
 * 	Generate an undo chain for undoing a clear.
 *
 *  Context:	Sent when handling MSG_GO_CLEAR and as a result
 * 		of undoing and undo of a delete
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: Don't. Trust me.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GENERATE_UNDO_UNDO_CLEAR_CHAIN ();
/*
 * 	Generate an undo chain for undoing an undo of a clear.
 *
 *  Context:	Sent as a result of undoing a delete
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: Don't. Trust me.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DEREF_A_GROBJ_AREA_TOKEN (word token = cx);
/*
 * 	Decrement the reference count for the passed area token
 *
 *  Context:	Generally used as freeing undo action message
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx - area token
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DEREF_A_GROBJ_LINE_TOKEN (word token = dx);
/*
 * 	Decrement the reference count for the passed line token
 *
 *  Context:	Generally used as freeing undo action message
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx - line token
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_INVALIDATE_AREA ();
/*
 * 	Invalidate object because of area attribute change.
 *
 * 	NOTE: this message has an associated GrObjMessageOptimizationFlags
 * 	bit. If you wish to subclass this message, you will need to
 * 	set this bit in your object, otherwise the default handler
 * 	will be called directly.
 *
 *  Context:	When objects area attributes change
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: Objects without area attributes, such as lines,
 * 		should subclass this message and eat it.
 *
 * PASS:
 * 		nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_INVALIDATE_LINE ();
/*
 * 	Invalidate object because of line attribute change.
 *
 * 	NOTE: this message has an associated GrObjMessageOptimizationFlags
 * 	bit. If you wish to subclass this message, you will need to
 * 	set this bit in your object, otherwise the default handler
 * 	will be called directly.
 *
 *  Context:	When objects line attributes change
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: Objects without line attributes
 * 		should subclass this message and eat it.
 *
 * PASS:
 * 		nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SUSPEND_COMPLETE_CREATE ();
/*
 * 	Sends a MSG_META_SUSPEND/MSG_META_UNSUSPEND to the body around
 * 	sending MSG_GO_COMPLETE_CREATE to itself.
 *
 *  Context:	Sent to object at completion of interactive create
 *  Source:	Unrestricted. Ususally sent by object to itself
 *  Destination:  Any grobject that has just finished being created.
 * 		i.e. After receiving MSG_GO_END_CREATE
 *  Interception: Don't. Please. Intercept MSG_GO_COMPLETE_CREATE if you
 * 		want to subclass something.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {
    GrObjOptimizationFlags	TSAOF_optFlags;
    GrObjTempModes		TSAOF_tempModes;
} GrObjTempStateAndOptFlags} ;

@message GrObjTempStateAndOptFlags MSG_GO_GET_TEMP_STATE_AND_OPT_FLAGS () = ax;
/*
 * 	Retrieve the GrObjTempModes for the object. Also returns
 * 	GrObjOptimizationFlags.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any GrObject
 *  Interception:	Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	al - GrObjTempModes
 * 	ah - GrObjOptimizationFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message void MSG_GO_MAKE_INSTRUCTION ();
/*
 * 	Make the grobject an instruction grobject. Instruction objects
 * 	are used mainly in templates. By default they do not print
 * 	and they generally are not selectable or editable
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_MAKE_NOT_INSTRUCTION ();
/*
 * 	Make the grobject not an instruction grobject.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_WRAP_TEXT_TYPE (GrObjWrapTextType type = cl);
/*
 * 	The GrObjWrapTextType for an object. The GrObjWrapTextType is
 * 	used by other applications, such as GeoWrite for wrapping text
 * 	around or inside objects
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 *
 * 	cl - GrObjWrapTextType
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_PASTE_INSIDE (Boolean setPaste = cl);
/*
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject.
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - TRUE or FALSE
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_INSERT_DELETE_MOVE_ALLOWED (Boolean allowed = cl);
/*
 * 	If true then during a MSG_GO_INSERT_OR_DELETE space the object
 * 	can be moved.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any GrObject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - TRUE/FALSE
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_INSERT_DELETE_RESIZE_ALLOWED (Boolean allowed = cl);
/*
 * 	If true then during a MSG_GO_INSERT_OR_DELETE space the object
 * 	can be resized.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any GrObject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - TRUE/FALSE
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_INSERT_DELETE_DELETE_ALLOWED (Boolean allowed = cl);
/*
 * 	If true then during a MSG_GO_INSERT_OR_DELETE space the object
 * 	can be deleted.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any GrObject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - TRUE/FALSE
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_PARENT_RECT (GStateHandle gstate = bp,
                      Boolean allowForWrap = cx);
/*
 * 	Draw the rectangle that bounds the object in PARENT coords..
 *
 *  Context:	Generally used for drawing rectangle for
 * 		wrapping text around when GOWTT_WRAP_AROUND_RECT is
 * 		set in object and GODF_DRAW_WRAP_TEXT_AROUND_ONLY
 * 		is passed with MSG_GO_DRAW
 *  Source:	Generally object itself
 *  Destination:  Generally object itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx - non-zero the kick the rectangle out by an ammount appropriate
 * 	     for wrapping around
 * 	bp - gstate with PARENT transformation in it
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_NUKE_DATA_IN_OTHER_BLOCKS ();
/*
 * 	Destroy any data the object stores in blocks other than its own.
 * 	Also object must decrement the interactible count to balance
 * 	all the incs is has done, otherwise the block it is in won't
 * 	get tossed.
 * 	Object MUST NOT send any message on the queue while
 * 	handling this.
 *
 *  Context:	Generally sent as handlers for MSG_GO_CLEAR and
 * 		MSG_GO_QUICK_TOTAL_BODY_CLEAR
 *  Source:	GrObject itself
 *  Destination:  Any grobject
 *  Interception: If object has data in other blocks or has mucked with
 * 		the interactible count is must subclass this message.
 * 		Do your own work first then call superclass.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_FG_AREA_HI_RES (DrawFlags drawFlags = cl,
                GrObjDrawFlags grobjDrawFlags= bp,
                GStateHandle gstate = dx); /*XXX*/
/*
 * 	Draw the foreground area component of an object at a higher
 * 	resolution than 72 dpi.
 *
 * 	Normally an grobject is drawn at 72 dpi because the
 * 	the graphics system is optimized for non scaled drawing and
 * 	the user is not viewing the image at a resolution higher
 * 	than 72 dpi. However, when printing or when the view is
 * 	zoomed in, we can display at a higher resolution. This
 * 	is often done by applying a 1/4 scale factor to the
 * 	gstate and multiplying the coordinates of the object
 * 	by 4, bring the resolution up to 288 dpi.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW during printing
 * 		or when the view is zoomed in.
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: There is no default behaviour. Most likely every
 * 		object will subclass this and not call their superclass.
 * 		Objects whose images are built out at the device level,
 * 		such as text and bitmaps, and objects where it is
 * 		impractical to modify the coordinates, such a gstrings,
 * 		should bind this message to the handler for
 * 		MSG_GO_DRAW_FG_AREA
 *
 * PASS:
 * 		cl - DrawFlags
 * 		bp - GrObjDrawFlags
 * 		dx - gstate with the object's transform applied
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_FG_LINE (DrawFlags drawFlags = cl,
                GrObjDrawFlags grobjDrawFlags= bp,
                GStateHandle gstate = dx); /*XXX*/
/*
 * 	Draw the foreground line components of an object.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: There is no default handler. Most likely every
 * 		object will subclass this and not call their superclass.
 *
 * PASS:
 * 		cl - DrawFlags
 * 		bp - GrObjDrawFlags
 * 		dx - gstate with the object's transform applied
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_FG_LINE_HI_RES (DrawFlags drawFlags = cl,
                GrObjDrawFlags grobjDrawFlags= bp,
                GStateHandle gstate = dx); /*XXX*/
/*
 * 	Draw the foreground line component of an object at a higher
 * 	resolution than 72 dpi.
 *
 * 	Normally an grobject is drawn at 72 dpi because the
 * 	the graphics system is optimized for non scaled drawing and
 * 	the user is not viewing the image at a resolution higher
 * 	than 72 dpi. However, when printing or when the view is
 * 	zoomed in, we can display at a higher resolution. This
 * 	is often done by applying a 1/4 scale factor to the
 * 	gstate and multiplying the coordinates of the object
 * 	by 4, bring the resolution up to 288 dpi.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW during printing
 * 		or when the view is zoomed in.
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: There is no default behaviour. Most likely every
 * 		object will subclass this and not call their superclass.
 * 		Objects whose images are built out at the device level,
 * 		such as text and bitmaps, and objects where it is
 * 		impractical to modify the coordinates, such a gstrings,
 * 		should bind this message to the handler for
 * 		MSG_GO_DRAW_FG_LINE
 *
 * PASS:
 * 		cl - DrawFlags
 * 		bp - GrObjDrawFlags
 * 		dx - gstate with the object's transform applied
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_CLIP_AREA (DrawFlags drawFlags = cl,
                GrObjDrawFlags grobjDrawFlags= bp,
                GStateHandle gstate = dx); /*XXX*/
/*
 * 	Draw the shape that can be used for clipping text and
 * 	other images.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW for wrapping
 * 		text tightly around the object and for clipping
 * 		gradient fills to the object.
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: There is no default handler. Most likely every
 * 		object will subclass this and not call their superclass.
 * 		Most objects can just bind this message to the
 * 		handler for MSG_GO_DRAW_FG_AREA.
 *
 * PASS:
 * 		cl - DrawFlags
 * 		bp - GrObjDrawFlags
 * 		dx - gstate with the object's transform applied
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_CLIP_AREA_HI_RES (DrawFlags drawFlags = cl,
                GrObjDrawFlags grobjDrawFlags= bp,
                GStateHandle gstate = dx); /*XXX*/
/*
 * 	Draw the shape that can be used for clipping text and
 * 	other images at a higher resolution and 72 dpi
 *
 * 	Normally an grobject is drawn at 72 dpi because the
 * 	the graphics system is optimized for non scaled drawing and
 * 	the user is not viewing the image at a resolution higher
 * 	than 72 dpi. However, when printing or when the view is
 * 	zoomed in, we can display at a higher resolution. This
 * 	is often done by applying a 1/4 scale factor to the
 * 	gstate and multiplying the coordinates of the object
 * 	by 4, bring the resolution up to 288 dpi.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW for wrapping
 * 		text tightly around the object and for clipping
 * 		gradient fills to the object during printing
 * 		or when the view is zoomed in.
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: There is no default behaviour. Most likely every
 * 		object will subclass this and not call their superclass.
 * 		Objects whose images are built out at the device level,
 * 		such as text and bitmaps, and objects where it is
 * 		impractical to modify the coordinates, such a gstrings,
 * 		should bind this message to the handler for
 * 		MSG_GO_DRAW_CLIP_AREA
 *
 * PASS:
 * 		cl - DrawFlags
 * 		bp - GrObjDrawFlags
 * 		dx - gstate with the object's transform applied
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_FG_GRADIENT_AREA (DrawFlags drawFlags = cl,
                GrObjDrawFlags grobjDrawFlags= bp,
                GStateHandle gstate = dx); /*XXX*/
/*
 * 	Draw a gradient fill for the foreground area components
 * 	of an object.
 *
 * 	NOTE: This handler does NOT need to apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: Unlikely. The default handler clips the gradient
 * 		fill to the shape drawn by MSG_GO_DRAW_CLIP_AREA
 *
 * PASS:
 * 		cl - DrawFlags
 * 		bp - GrObjDrawFlags
 * 		dx - gstate with the object's transform applied
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_FG_GRADIENT_AREA_HI_RES (DrawFlags drawFlags = cl,
                GrObjDrawFlags grobjDrawFlags= bp,
                GStateHandle gstate = dx); /*XXX*/
/*
 * 	Draw a gradient fill for the foreground area components
 * 	of an object at a higher resolution than 72 dpi.
 *
 * 	Normally an grobject is drawn at 72 dpi because the
 * 	the graphics system is optimized for non scaled drawing and
 * 	the user is not viewing the image at a resolution higher
 * 	than 72 dpi. However, when printing or when the view is
 * 	zoomed in, we can display at a higher resolution. This
 * 	is often done by applying a 1/4 scale factor to the
 * 	gstate and multiplying the coordinates of the object
 * 	by 4, bring the resolution up to 288 dpi.
 *
 * 	NOTE: This handler does NOT need to apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW during printing
 * 		or when the view is zoomed in.
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: There is no default behaviour. Most likely every
 * 		object will subclass this and not call their superclass.
 * 		Objects whose images are built out at the device level,
 * 		such as text and bitmaps, and objects where it is
 * 		impractical to modify the coordinates, such a gstrings,
 * 		should bind this message to the handler for
 * 		MSG_GO_DRAW_FG_GRADIENT_AREA
 *
 * PASS:
 * 		cl - DrawFlags
 * 		bp - GrObjDrawFlags
 * 		dx - gstate with the object's transform applied
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_BG_AREA_HI_RES (DrawFlags drawFlags = cl,
                GrObjDrawFlags grobjDrawFlags= bp,
                GStateHandle gstate = dx); /*XXX*/
/*
 * 	Draw the background area and line components of an object at
 * 	a higher resolution than 72 dpi.
 *
 * 	Normally an grobject is drawn at 72 dpi because the
 * 	the graphics system is optimized for non scaled drawing and
 * 	the user is not viewing the image at a resolution higher
 * 	than 72 dpi. However, when printing or when the view is
 * 	zoomed in, we can display at a higher resolution. This
 * 	is often done by applying a 1/4 scale factor to the
 * 	gstate and multiplying the coordinates of the object
 * 	by 4, bring the resolution up to 288 dpi.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW during printing
 * 		or when the view is zoomed in.
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: There is no default behaviour. Most likely every
 * 		object will subclass this and not call their superclass.
 * 		Objects whose images are built out at the device level,
 * 		such as text and bitmaps, and objects where it is
 * 		impractical to modify the coordinates, such a gstrings,
 * 		should bind this message to the handler for
 * 		MSG_GO_DRAW_BG_AREA
 *
 * PASS:
 * 		cl - DrawFlags
 * 		bp - GrObjDrawFlags
 * 		dx - gstate with the object's transform applied
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_BG_COLOR (	 	/* XXX  */
    byte 	red = cl,
    byte 	green = ch,
    byte 	blue = dl);
/*
 * 	Set the bg area and line color of the object
 *
 *  Context:	GrObj utility
 *  Source:	Unrestricted
 *  Destination:	Any grobj object. If the object has no area
 * 		attributes it will ignore the message
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	cl - r
 * 	ch - g
 * 	dl - b
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_AREA_PATTERN (GraphicPattern pattern = cx);
/*
 * 	Set the area pattern of the object
 *
 *  Context:	GrObj utility
 *  Source:	Unrestricted
 *  Destination:	Any grobj object. If the object has no area
 * 		attributes it will ignore the message
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	cx - GraphicPattern
 *
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_AREA_ATTR_ELEMENT_TYPE (GrObjAreaAttrElementType type = cl);
/*
 * 	Set the GrObjAreaAttrElementType of the object
 *
 *  Context:	GrObj utility
 *  Source:	Unrestricted
 *  Destination:	Any grobj object. If the object has no area
 * 		attributes it will ignore the message
 *  Interception:	If the object doesn't support one or more of the
 * 		GrObjAreaAttrElementTypes then it should subclass
 * 		this message and not call it's super if one of
 * 		the offending types has been passed. For instance
 * 		the bitmap doesn't support GOAAET_GRADIENT.
 *
 *
 * PASS:
 * 	cl - GrObjAreaAttrElementType
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_LINE_ATTR_ELEMENT_TYPE (GrObjLineAttrElementType type = cl);
/*
 * 	Set the GrObjLineAttrElementType of the object
 *
 *  Context:	GrObj utility
 *  Source:	Unrestricted
 *  Destination:	Any grobj object. If the object has no area
 * 		attributes it will ignore the message
 *  Interception:	If the object doesn't support one or more of the
 * 		GrObjAreaAttrElementTypes then it should subclass
 * 		this message and not call it's super if one of
 * 		the offending types has been passed.
 *
 * PASS:
 * 	cl - GrObjLineAttrElementType
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_STARTING_GRADIENT_COLOR (	 	/* XXX  */
    byte 	red = cl,
    byte 	green = ch,
    byte 	blue = dl);
/*
 * 	Set the starting color for a gradient fill. If the object's
 * 	area attributes are not GOAAET_GRADIENT then the
 * 	message will be ignored. See MSG_GO_AREA_ATTR_ELEMENT_TYPE
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - r
 * 	ch - g
 * 	dl - b
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_ENDING_GRADIENT_COLOR (	 	/* XXX  */
    byte 	red = cl,
    byte 	green = ch,
    byte 	blue = dl);
/*
 * 	Set the ending color for a gradient fill. If the object's
 * 	area attributes are not GOAAET_GRADIENT then the
 * 	message will be ignored. See MSG_GO_AREA_ATTR_ELEMENT_TYPE
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - r
 * 	ch - g
 * 	dl - b
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_NUMBER_OF_GRADIENT_INTERVALS (word nIntervals = cx);
/*
 * 	Set the number of gradient intervals for a gradient fill.
 * 	If the object's area attributes are not GOAAET_GRADIENT then the
 * 	message will be ignored. See MSG_GO_AREA_ATTR_ELEMENT_TYPE.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx - number of intervals
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_GRADIENT_TYPE (GrObjGradientType type = cl);
/*
 * 	Set the type of the gradient fill.
 * 	If the object's area attributes are not GOAAET_GRADIENT then the
 * 	message will be ignored. See MSG_GO_AREA_ATTR_ELEMENT_TYPE.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - GrObjGradientType
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_ARROWHEAD_ON_START (Boolean arrowOnStart = cl);
/*
 * 	If true then during object will draw an arrowhead at it's first
 * 	point. Not all objects support arrowheads.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any GrObject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - TRUE/FALSE
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_ARROWHEAD_ON_END (Boolean arrowOnEnd = cl);
/*
 * 	If true then during object will draw an arrowhead at it's final
 * 	point. Not all objects support arrowheads.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any GrObject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - TRUE/FALSE
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_ARROWHEAD_FILLED (Boolean filled = cl,
                      Boolean useAreaAttrs = ch);
/*
 * 	If true then arrowheads will be filled. If false then
 * 	they will be drawn with lines.
 * 	Not all objects support arrowheads.;
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any GrObject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - TRUE/FALSE
 * 	ch - nonzero to fill with area attributes,
 * 	     zero to fill with line attributes
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_ARROWHEAD_ANGLE (byte angle = cl);
/*
 * 	Set angle between the line and the arrowheads lines.
 *  	Not all objects support arrowheads.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any GrObject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - angle (0-90)
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_ARROWHEAD_LENGTH (byte length = cl);
/*
 * 	Set length of arrowhead line from line starting/ending point
 * 	Not all objects support arrowheads.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any GrObject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - length in 72 dpi
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_NOTIFY_GROBJ_INVALID ();
/*
 *  Notify the grobj that it is not valid.
 *
 *  Context:	GrObj utility
 *  Source:	Unrestricted
 *  Destination:  any GrObject
 *  Interception: unlikely
 *
 *  Pass:		nothing
 *
 *  Return:	nothing
 *
 *  Destroyed:	ax
 */

@message void MSG_GO_SET_GROBJ_ATTR_FLAGS (GrObjAttrFlags bitsToSet = cx,
                      GrObjAttrFlags bitsToReset = dx);
/*
 * 	Set and reset bits in the GOI_attrFlags field.
 *
 *  Context:	GrObj Utility. Generally used for undo.
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx - GrObjAttrFlags bit to set
 * 	dx - GrObjAttrFlags bit to clear
 *
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SET_SYS_TARGET (Boolean setTarget = cl);
/*
 * 	Set/Clear bit in object that reflects  the body's system
 * 	target excl status
 *
 *  Context:	When object is added to selection list or when object
 * 		receives MSG_META_GAINED/LOST_SYS_TARGET_EXCL
 *  Source:	GrObjBody/Object itself
 *  Destination:  Selected grobjects
 *  Interception: Unlikley
 *
 * PASS:
 * 	cl - TRUE/FALSE
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_SCALE_OBJECT ( 	/* XXX */
    GrObjAnchoredScaleData	_far *params = ss:bp);
/*
 * 	Scale a grobject in its own coordinate space. [current matrix][scale]
 * 	Anchors center of object.
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any GrObject
 *  Interception:	Unlikely
 *
 * PASS:
 * 	ss:bp - GrObjScaleData
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GENERATE_UNDO_CLEAR_CHAIN_WITH_ACTION_NOTIFICATION ();
/*
 * 	Generate an undo chain for undoing the redo of a clear and
 * 	send out a GOANT_REDO_DELETE action notification.
 *
 *  Context:	Sent when handling MSG_GO_GENERATE_UNDO_UNDO_CLEAR_CHAIN
 * 		( undoing an undo of a delete )
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: Don't. Trust me.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_RECREATE_CACHED_GSTATES ();
/*
 * 	Have objects destroy and recreate any cached gstates
 *
 *  Context:	Sent by body to target when body handles
 * 		MSG_VIS_RECREATE_CACHED_GSTATES
 *  Source:	Unrestricted. Generally GrObjBody
 *  Destination:  Any grobject. Generally target
 *  Interception: If object has any cached gstates it must subclass this
 * 		message and call superclass
 *
 * PASS:
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_QUICK_VIEW (DrawFlags drawFlags = cl,
                GrObjDrawFlags grobjDrawFlags= bp,
                GStateHandle gstate = dx); /*XXX*/
/*
 * 	Draw the basic shape of the objects as quickly as possible.
 * 	Most objects just draw their outline for this message
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW when GODF_DRAW_QUICK_VIEW
 * 		is set.
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: The default handler draws a rectangle. Many objects bind
 * 		the message to their MSG_GO_DRAW_FG_LINE handler
 *
 * PASS:
 * 		cl - DrawFlags
 * 		bp - GrObjDrawFlags
 * 		dx - gstate with the object's transform applied
 * 			line width = 0
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_SPRITE_LINE_HI_RES (GStateHandle gstate = dx);
/*
 * 	Draw the sprite line image of an object using the
 * 	spriteTransform at a higher resolution than 72 dpi.
 *
 * 	Normally an grobject is drawn at 72 dpi because the
 * 	the graphics system is optimized for non scaled drawing and
 * 	the user is not viewing the image at a resolution higher
 * 	than 72 dpi. However, when the view is
 * 	zoomed in, we can display at a higher resolution. This
 * 	is often done by applying a 1/4 scale factor to the
 * 	gstate and multiplying the coordinates of the object
 * 	by 4, bring the resolution up to 288 dpi.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW_SPRITE
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: Most likely every object will subclass this and not
 * 		call their superclass.
 *
 * PASS:
 * 		dx - gstate
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DRAW_NORMAL_SPRITE_LINE_HI_RES (GStateHandle gstate = dx);
/*
 * 	Draw the sprite line image of an object using the
 * 	normalTransform at a higher resolution than 72 dpi.
 *
 * 	Normally an grobject is drawn at 72 dpi because the
 * 	the graphics system is optimized for non scaled drawing and
 * 	the user is not viewing the image at a resolution higher
 * 	than 72 dpi. However, when the view is
 * 	zoomed in, we can display at a higher resolution. This
 * 	is often done by applying a 1/4 scale factor to the
 * 	gstate and multiplying the coordinates of the object
 * 	by 4, bring the resolution up to 288 dpi.
 *
 * 	NOTE: This handler does NOT set attributes or apply
 * 	the ObjectTransform. It is a mindless low level handler
 * 	that is concerned only with the shape to be drawn.
 *
 *  Context:	GrObjClass Utility. Generally called
 * 		during handling of MSG_GO_DRAW_SPRITE on objects
 * 		in a group.
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any grobject. Generally the object itself.
 *  Interception: Most likely every object will subclass this and not
 * 		call their superclass.
 *
 * PASS:
 * 		dx - gstate
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message GrObjAttrFlags MSG_GO_GET_GROBJ_ATTR_FLAGS () = cx;
/*
 * 	Retrieve bits in the GOI_attrFlags field.
 *
 *  Context:	GrObj Utility.
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	cx - GrObjAttrFlags
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_MAKE_ATTRS_DEFAULT ();
/*
 * 	Set the attributes of this object as the default attributes
 * 	in the GrObjAttributeManager.
 * 	Area,Line and GrObjAttrs
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef ByteEnum GrObjPointerImageSituation ;		/* CHECKME */
#define GOPIS_NORMAL 	0x0
#define GOPIS_EDIT 	0x1
#define GOPIS_CREATE 	0x2
#define GOPIS_MOVE 	0x3
#define GOPIS_RESIZE_ROTATE 	0x4

@message void MSG_GO_GET_SITUATIONAL_POINTER_IMAGE (MouseReturnFlagsAndMouseImage *retVal = axcxdxbp, GrObjPointerImageSituation situation = cl);
/*
 * 	Get pointer image for object for specific situations
 *
 *  Context:	GrObj Utility
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Likely. Call superclass for situations which your
 * 		object doesn't provide its own pointer image.
 *
 * PASS:
 * 		cl - GrObjPointerImageSituation
 *
 * RETURN:
 * 		ah - high byte of MouseReturnFlags
 * 			MRF_SET_POINTER_IMAGE or MRF_CLEAR_POINTER_IMAGE
 * 		if MRF_SET_POINTER_IMAGE
 * 		cx:dx - optr of mouse image
 * DESTROYED:
 * 	al
 */

/*
CheckHack <offset MRF_SET_POINTER_IMAGE gt 7 >
*/
/*
CheckHack <offset MRF_CLEAR_POINTER_IMAGE gt 7 >
*/

@message void MSG_GO_OBJ_FREE ();
/*
 * 	Free an object *now*. Used instead of MSG_META_OBJ_FREE to avoid
 * 	overflowing the handle table. MSG_META_OBJ_FREE puts a
 * 	MSG_META_FINAL_OBJ_FREE on the queue. With a large number of objects
 * 	all doing this at the same time the handle table can easily overflow.
 * 	MSG_GO_OBJ_FREE attempts to destroy the object without using the
 * 	queue.
 *
 *
 *  Context:	Low level utility for deleting objects when undo
 * 		actions are being ignored.
 *  Source:	Sent internally usually. You really shouldn't send
 * 		this yourself.
 *  Destination:  Any grobject
 *  Interception: The default handler increments the in use count of the
 * 		object and then sends MSG_META_FINAL_OBJ_FREE directly
 * 		to itself. This assumes that there are no messages in
 * 		the queue for the object. If your object may have messages
 * 		on the queue, such as the cursor flash messages
 * 		for the VisText, you should subclass this message,
 * 		send MSG_META_OBJ_FREE to yourself and don't call your
 * 		superclass.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_ADJUST_CREATE ();
/*
 * 	Bring creation to a screeching halt using whatever data
 * 	is currently stored in the object.
 *
 *  Context:	Force basic drag create shapes this message is sent
 * 		upon receiving an END_SELECT while being created.
 * 		For more complex objects, such as spline, this message
 * 		is sent on double clicks and right mouse clicks.
 *  Source:	Unrestricted. Usually object itself.
 *  Destination:  Grobject being created.
 *  Interception: Rects, ellipse,lines, etc can use the default handler, but
 * 		other objects will likely subclass this and not
 * 		call their superclass. Subclasses of this message
 * 		must send MSG_GO_SUSPEND_COMPLETE_CREATE to themselves unless
 * 		the object is destroyed.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GENERATE_UNDO_UNDO_CLEAR_CHAIN_WITH_ACTION_NOTIFICATION ();
/*
 * 	Generate an undo chain for undoing an undo of a clear and
 * 	send out a GOANT_UNDO_DELETE action notification.
 *
 *  Context:	Sent when handling MSG_GO_GENERATE_UNDO_CLEAR_CHAIN
 * 		( undoing an undo of a delete )
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: Don't. Trust me.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_NUDGE_INSIDE (sword xNudge = cx, sword yNudge = dx);
/*
 * 	Move the paste inside children of a group a multiple of current
 *        DEVICE units. As currently implemented this does not take
 *        into account transformations in the group, so the amount
 * 	moved may vary.
 *
 *
 *  Context:	GrObj Utiltity
 *  Source:	Unrestricted, generally UI or object itself
 *  Destination:	Any grobj object
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx - number of device units in x to move
 * 	dx - number of device units in y to move
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_MOVE_INSIDE (PointDWFixed *distance = ss:bp);
/*
 * 	Move only the paste inside children of a group relative
 * 	by the passed distance.
 *
 *
 *  Context:	GrObj Utiltity
 *  Source:	Unrestricted, generally UI or object itself
 *  Destination:	Any grobj object
 *  Interception:	Unlikely
 *
 * PASS
 * 	ss:bp = PointDWFixed amount to move object in PARENT coords
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_REPLACE_GEOMETRY_INSTANCE_DATA (BasicInit *initData = ss:bp);
/*
 * 	Replaces the objects geometry related instance data with the
 * 	passed data.
 *
 *  Context:	During undo of most geometry operations
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - BasicInit
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message GrObjActionModes MSG_GO_CHECK_ACTION_MODES () = cx;
/*
 * 	Retrieve the GOI_actionModes field.
 *
 *  Context:	GrObj Utility.
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	cx - GrObjActionModes
 *
 * DESTROYED:
 * 	ax
 */

@message PositEvalAndHitHandle MSG_GO_EVALUATE_PARENT_POINT_FOR_HANDLE_MOVE_RESIZE (
    PointDWFixed *parentCoord = ss:bp) = ax;
/*
 * 	Determine if one of the handles of the object would be hit
 * 	by the passed point. Will ignore move handles of objects with
 * 	GOL_MOVE lock set. Will ignore resize handles of objects with
 * 	GOL_RESIZE lock set.
 *
 *  Context:	Usually called as direct action of user clicking with
 * 		the pointer tool.
 *  Source:	Unrestricted, generally the floater
 *  Destination:	Any grobj object. The message will be ignored if the
 * 		object's GOTM_HANDLES_DRAWN flag is not set
 *  Interception:	Possible. If object doesn't have normal 9 handles, such
 * 		as a line with only 3, it should subclass this message
 * 		and not call its superclass
 *
 * PASS
 * 	ss:bp - PointDWFixed in PARENT
 *
 * RETURN
 * 	al - EVALUATE_NONE - handles not hit
 * 		ah - destroyed
 * 	al - EVALUATE_HIGH - handle hit
 * 		ah - GrObjHandleSpecification of hit handle
 *
 * 	dx - 0 ( blank EvaluatePositionNotes)
 *
 * DESTROYED:
 * 	nothing
 */

@message PositEvalAndHitHandle MSG_GO_EVALUATE_PARENT_POINT_FOR_HANDLE_MOVE_ROTATE (
    PointDWFixed *parentCoord = ss:bp) = ax;
/*
 * 	Determine if one of the handles of the object would be hit
 * 	by the passed point. Will ignore move handles of objects with
 * 	GOL_MOVE lock set. Will ignore rotate handles of objects with
 * 	GOL_ROTATE lock set.
 *
 *  Context:	Usually called as direct action of user clicking with
 * 		the pointer tool.
 *  Source:	Unrestricted, generally the floater
 *  Destination:	Any grobj object. The message will be ignored if the
 * 		object's GOTM_HANDLES_DRAWN flag is not set
 *  Interception:	Possible. If object doesn't have normal 9 handles, such
 * 		as a line with only 3, it should subclass this message
 * 		and not call its superclass
 *
 * PASS
 * 	ss:bp - PointDWFixed in PARENT
 *
 * RETURN
 * 	al - EVALUATE_NONE - handles not hit
 * 		ah - destroyed
 * 	al - EVALUATE_HIGH - handle hit
 * 		ah - GrObjHandleSpecification of hit handle
 *
 * 	dx - 0 ( blank EvaluatePositionNotes)
 *
 * DESTROYED:
 * 	nothing
 */

typedef struct {
    word 	CLS_pad1;
    word	CLS_locksSetSoFar;
    word	CLS_locksClearSoFar;
    word	CLS_pad2;
} CombineLocksStruct} ;

@message void MSG_GO_COMBINE_LOCKS (
    CombineLocksStruct *retVal = axcxdxbp,
    GrObjLocks setSoFar = cx,
    GrObjLocks clearSoFar = dx);
/*
 * 		This message or's the grobj's locks into the passed locks;
 * 		this is generally used in combination with other grobjs
 * 		(eg., all the selected grobjs) to find out what is
 * 		allowable and what is not for a set of grobjs
 *
 * PASS:
 * 	cx - locks set so far
 * 	dx - locks clear so far
 *
 * RETURN:
 * 	cx,dx - updated
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DESELECT_IF_GROUP_LOCK_SET ();
/*
 * 	If the object is selected and it has its group lock set it
 * 	will become unselected.
 *
 *  Context:	Used before grouping and paste inside to avoid lots
 * 		of problems.
 *  Source:	GrObjBody
 *  Destination:  Selected GrObjs
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GET_POTENTIAL_GROBJECT_SIZE (word byteSize = cx);
/*
 * 	Return the number of bytes that the grobject can use up in
 *  	its block. This includess instance data, chunks and vardata, but ""
 * 	not data in other blocks created by this object.
 *
 *  Context:	Used to keep track of which document blocks can
 * 		have more objects added to them.
 *  Source:	Object itself.
 *  Destination:  Object itself
 *  Interception: The default handler will calculate the instance data size,
 * 		but if your object allocates chunks or vardata in its
 * 		block it must subclass this message. Call the superclass
 * 		first and then add in your extra bytes
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	cx - size in bytes
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GROUP_GAINED_SELECTION_LIST ();
/*
 * 	Notify grobjects in a group that the group has been selected
 *
 *  Context:	Sent to grobjects in group when group receives
 * 		MSG_GO_GAINED_SELECTION_LIST
 *  Source:	Group
 *  Destination:  GrObject in a group
 *  Interception: There is no default handler. Only under special circumstances
 * 		will you need to intercept this message. For instance, the
 * 		text guardian intercepts this message and selects all text so
 * 		that text attribute changes can be applied correctly
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_GROUP_LOST_SELECTION_LIST ();
/*
 * 	Notify grobjects in a group that the group is no longer selected
 *
 *  Context:	Sent to grobjects in group when group receives
 * 		MSG_GO_LOST__SELECTION_LIST
 *  Source:	Group
 *  Destination:  GrObject in a group
 *  Interception: There is no default handler. Only under special circumstances
 * 		will you need to intercept this message. For instance, the
 * 		text guardian intercepts this message and deselects all text,
 * 		to counteract the selection of all the text in the handler
 * 		for MSG_GO_GROUP_GAINED_SELECTION_LIST.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_INVALIDATE_WITH_UNDO ();
/*
 * 	Do a normal invalidate but create an undo action that also does
 * 	an invalidate.
 *
 *  Context:	Obscure. Used currently so that when undoing a paste inside
 * 		the objects redraw without their insides.
 *  Source:	Unrestricted
 *  Destination:  Any grobject
 *  Interception: Not
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_AFTER_QUICK_PASTE ();
/*
 * 	Send to object after it has been created by a quick paste. (ie
 * 	from quick move or quick copy). Object should either become
 * 	selected or edited.
 *
 *  Context:	Sent to object after it has been created via a quick paste
 *  Source:	GrObjBody
 *  Destination:  GrObject
 *  Interception: Default handler selects object. Some objects will subclass
 * 		this and make themselves editable instead. Don't call
 * 		superclass in this case.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_QUICK_TOTAL_BODY_CLEAR ();
/*
 * 	The body is about to destroy all the blocks that its children are in.
 * 	The object must	destroy any data in blocks that the body doesn't
 * 	know about.
 * 	Object MUST NOT send any message on the queue while
 * 	handling this.
 * 	Object can assume that there are no messages in the queue for it.
 *
 *  Context:	Send by body when handling MSG_GO_CLEAR
 *  Source:	GrObjBody
 *  Destination:  Any grobject
 *  Interception: The default handler sends MSG_GO_NUKE_DATA_IN_OTHER_BLOCKS
 * 		to itself (in most cases you will be better off subclassing
 * 		that message). However, objects such as the guardians must
 * 		cause there wards to nuke any extra data, so they subclass
 * 		the message, send MSG_FINAL_OBJ_FREE to their wards and then
 * 		call their superclass.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message Boolean MSG_GO_CLEAR_IF_NOT_WITHIN_BODY_BOUNDS () = carry;
/*
 * 	Causes the GrObj to delete itself if its bounds do not overlap the
 * 	body's bounds
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	carry set if object nukes itself
 *
 * DESTROYED:
 * 	ax
 */

@message word MSG_GO_INC_CX_IF_COPYABLE (word iDunno = cx) = cx;
/*
 * 	Take a wild guess
 *
 * PASS:
 * 	cx - current count of copyable objects
 *
 * RETURN:
 * 	cx - incremented if copyable
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_DESELECT_IF_COPY_LOCK_SET ();
/*
 * 	If the object is selected and it has its copy lock set it
 * 	will become unselected.
 *
 *  Context:	Used before copying to avoid lots of problems.
 *  Source:	GrObjBody
 *  Destination:  Selected GrObjs
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GO_OBJ_FREE_GUARANTEED_NO_QUEUED_MESSAGES ();
/*
 * 	Free an object *now*, with the full knowledge that no messages
 * 	are in the queue for this object, or its ward if it is a guardian.
 * 	This is a tough guarantee to make. You really don't want to be
 * 	sending this message unless you are very sure about what you are
 * 	doing. Currently this message is only used when freeing the undo
 * 	action that an object created when it received MSG_GO_CLEAR. On
 * 	MSG_GO_CLEAR the object releases all excls, is taken out of the
 * 	selection list, is removed from the body and creates an undo
 * 	action. By the time that undo action can be freed there will be
 * 	no messages in the queue for the object. If that undo action
 * 	is freed the object send this message to itself.
 *
 * 	The object may not put any messages on any queues in the process
 * 	of handling this message.
 *
 *  Context:	Low level utility for deleting objects. See above
 *  Source:	Sent internally usually. You really shouldn't send
 * 		this yourself.
 *  Destination:  Any grobject
 *  Interception: Most objects use the same handler as MSG_GO_OBJ_FREE.
 * 		The guardian's subclass this message because they
 * 		normally free there wards with MSG_META_OBJ_FREE, which
 * 		results in a message on the queue. This is not allowed
 * 		when handling this message. So the guardians subclass
 * 		this message and destroy their wards by sending
 * 		MSG_META_FINAL_OBJ_FREE to the wards directly. The guardians
 * 		then call their superclass to destroy themselves.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

                    /* cannot be prototyped */
@message Boolean MSG_GO_QUICK_TRANSFER_TAKE_MOUSE_GRAB_IF_POSSIBLE () = carry;
/*
 *	INTERNAL USE ONLY
 *
 *	Checks to see if this object should take the mouse grab.  This
 *	should only be called while a quick transfer is taking place and
 *	the body currently has the mouse grab.  It will take back the
 *	mouse grab IF it is NOT the floater, if it is the owner of the
 *	quick transfer object, and if the mouse event pointer position is
 *	within its bounds.  This is a highly specialized message.
 *
 * Context:	Highly specialized message.  See explanation.
 * Source:	GrObjBodyLargePtr
 * Destination:  Any GrObject
 * Interception: The default handler in GrObjClass will do nothing and return
 *		carry clear.  This is intended to be subclassed only by
 *		GrObjVisGuardianClass.
 *
 * Pass:	(No MF_STACK)
 *	ss:bp	= LargeMouseData
 *	^lcx:dx	= optr to the owner of the Quick Transfer Object
 *
 * Return:
 *	carry:	SET	- Object was eligible and mouse was grabbed.
 *		CLEAR	- Object was not eligible, mouse grab was not changed.
 *
 *	cx, dx, bp - unchanged
 *	ax - destroyed
 *
 * WARNING:
 *	Do NOT send this message with MF_STACK because dx is not set to the
 *	size of the parameters on the stack.  As a result, this message must
 *	be sent and received by the same thread.
 *
 * GOC WARNING: THIS MESSAGE CANNOT BE SENT FROM GOC FOR THE REASON MENTIONED
 *              IN PREVIOUS WARNING.
 */

@protominor GrObjNewFor2_1

@message Boolean MSG_GO_IS_POINT_INSIDE_OBJECT_BOUNDS (PointDWFixed *coord =
                            ss:bp) = carry;
/*
 *	Checks to see if the passed point is inside the object's bounds
 *
 * Context:	Mostly used to check mouse position.
 * Source:	Anyone.
 * Destination:  Any GrObject (the floater always returns false)
 * Interception: The GrObjClass handler should work in all cases.
 *
 * Pass:
 *	ss:bp	= PointDWFixed
 *	dx	= size PointDWFixed
 *
 * Return:
 *	carry:	SET	- Point is inside bounds
 *		CLEAR	- Point is NOT inside bounds
 *
 *	cx, dx, bp - unchanged
 *	ax - destroyed
 *
 */

@message void MSG_GO_FLIP ( 	/* XXX */
    GrObjAnchoredScaleData	_far *params = ss:bp);
/*
 *	Same as MSG_GO_SCALE except the undo string is set correctly to
 *	flipString.
 *
 *	Scale a grobject. [current matrix][scale]
 *	Anchors center of object.
 *
 * Context:	 GrObj Utility
 * Source:	 Unrestricted
 * Destination:  Any GrObject
 * Interception: Unlikely
 *
 * Pass:
 *	ss:bp - GrObjScaleData
 *
 * Return:
 *	nothing
 *
 *	cx, dx, bp - unchanged
 *	ax - destroyed
 *
 */

@protoreset

/*-----------------------------------------------------------------------------
;	GrObjClass Instance Data
-----------------------------------------------------------------------------*/

@instance LinkPart GOI_drawLink;
@instance LinkPart GOI_reverseLink;
@instance GrObjAttrFlags GOI_attrFlags = (GOAF_INSERT_DELETE_MOVE_ALLOWED | 	GOAF_INSERT_DELETE_RESIZE_ALLOWED | GOAF_INSERT_DELETE_DELETE_ALLOWED );
@instance GrObjOptimizationFlags GOI_optFlags = ( GOOF_GROBJ_INVALID );
@instance GrObjMessageOptimizationFlags GOI_msgOptFlags =(0);
@instance GrObjLocks GOI_locks = 0;
@instance GrObjActionModes GOI_actionModes = 0;
@instance GrObjTempModes GOI_tempState = 0;
@instance ChunkHandle GOI_normalTransform = NullChunk;
@instance ChunkHandle GOI_spriteTransform = NullChunk;
@instance word GOI_areaAttrToken = CA_NULL_ELEMENT;
@instance word GOI_lineAttrToken = CA_NULL_ELEMENT;

/*-----------------------------------------------------------------------------
;	GrObjClass VarData
-----------------------------------------------------------------------------*/

typedef struct {		/* CHECKME */
    optr	GOOMD_actionGrObj;
    PointDWFixed	GOOMD_origMousePt;
    GrObjHandleSpecification	GOOMD_oppositeHandle;
    GrObjHandleSpecification	GOOMD_grabbedHandle;
    WWFixed	GOOMD_initialAngle;
    PointDWFixed	GOOMD_oppositeAnchor;
    WWFixed	GOOMD_oppositeInitialAngle;
} GrObjObjManipData} ;

@vardata GrObjObjManipData ATTR_GO_OBJ_MANIP_DATA;
@vardata GrObjActionNotificationStruct ATTR_GO_ACTION_NOTIFICATION;
@vardata PointWWFixed	ATTR_GO_PARENT_DIMENSIONS_OFFSET;
@endc

/*-----------------------------------------------------------------------------
;	GrObjAttributeManager Class Definition
-----------------------------------------------------------------------------*/

@class	GrObjAttributeManagerClass, GrObjClass;

/*-----------------------------------------------------------------------------
;	GrObjAttributeManager Class Methods
-----------------------------------------------------------------------------*/

/****************************************************************************/
@message void MSG_GOAM_CREATE_ALL_ARRAYS ();		/*XXX*/
/*
 * 	Have the attribute mannager create all the arrays it needs to
 * 	manage the attributes. See MSG_GOAM_ATTACH_AND_CREATE_ARRAYS for
 * 	contrast.
 *
 *  Context:	Sent shortly after the attribute manager has been
 * 		created and the user doesn't want to create and
 * 		intialize any of the arrays him/herself.
 *  Source:	Generally GenDocument while handling
 * 		MSG_GEN_DOCUMENT_INITIALIZE_DOCUMENT_FILE
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {		/* CHECKME */

/*
 * VM block handle of element array
 * for area attributes. Chunk must
 * be at GROBJ_VM_ELEMENT_ARRAY_CHUNK
 * If 0, area array will be created.
 */
    VMBlockHandle	GOAMAD_areaAttrArrayHandle;

/*
 * Element number of default attributes
 * in area array. Value ignored if
 * 0 passed for areaAttrArrayHandle
 */
    word		GOAMAD_areaDefaultElement;

/*
 * VM block handle of element array
 * for line attributes. Chunk must
 * be at GROBJ_VM_ELEMENT_ARRAY_CHUNK
 * If 0, text array will be created.
 */
    VMBlockHandle	GOAMAD_lineAttrArrayHandle;

/*
 * Element number of default attributes
 * in line array. Value ignored if
 * 0 passed for lineAttrArrayHandle
 */
    word	GOAMAD_lineDefaultElement;

/*
 * VM block handle of element array
 * for grobj styles. Chunk must
 * be at GROBJ_VM_ELEMENT_ARRAY_CHUNK
 * If 0, style array will be created.
 */
    VMBlockHandle	GOAMAD_grObjStyleArrayHandle;

/*
 * VM block handle of element array
 * for char attributes. Chunk must
 * be at GROBJ_VM_ELEMENT_ARRAY_CHUNK
 * If 0, char array will be created.
 */
    VMBlockHandle	GOAMAD_charAttrArrayHandle;

/*
 * Element number of default attributes
 * in char array. Value ignored if
 * 0 passed for charAttrArrayHandle
 */
    word		GOAMAD_charDefaultElement;

/*
 * VM block handle of element array
 * for paragraph attributes. Chunk must
 * be at GROBJ_VM_ELEMENT_ARRAY_CHUNK
 * If 0, text array will be created.
 */
    VMBlockHandle	GOAMAD_paraAttrArrayHandle;

/*
 * Element number of default attributes
 * in paragraph array. Value ignored if
 * 0 passed for paraAttrArrayHandle
 */
    word		GOAMAD_paraDefaultElement;

/*
 * VM block handle of element array
 * for types. Chunk must
 * be at GROBJ_VM_ELEMENT_ARRAY_CHUNK
 * If 0, text array will be created.
 */
    VMBlockHandle	GOAMAD_typeArrayHandle;

/*
 * Element number of default attributes
 * in type array. Value ignored if
 * 0 passed for paraAttrArrayHandle
 */
    word		GOAMAD_typeDefaultElement;

/*
 * VM block handle of element array
 * for graphics. Chunk must
 * be at GROBJ_VM_ELEMENT_ARRAY_CHUNK
 * If 0, graphic array will be created.
 */
    VMBlockHandle	GOAMAD_graphicArrayHandle;

/*
 * VM block handle of element array
 * for graphics. Chunk must
 * be at GROBJ_VM_ELEMENT_ARRAY_CHUNK
 * If 0, graphic array will be created.
 */
    VMBlockHandle	GOAMAD_nameArrayHandle;

/*
 * VM block handle of element array
 * for text styles. Chunk must
 * be at GROBJ_VM_ELEMENT_ARRAY_CHUNK
 * If 0, style array will be created.
 */
    VMBlockHandle	GOAMAD_textStyleArrayHandle;

} GrObjAttributeManagerArrayDesc} ;

@message void MSG_GOAM_ATTACH_AND_CREATE_ARRAYS (
    GrObjAttributeManagerArrayDesc *desc = ss:bp);
/*
 * 	Have the attribute manager use the passed arrays and
 * 	create the ones not passed.
 * 	See MSG_GOAM_CREATE_ARRAYS for contrast.
 *
 *  Context:	Sent shortly after the attribute manager has been
 * 		created and the user has created some or all of the
 * 		arrays need for attribute management
 *  Source:	Generally GenDocument while handling
 * 		MSG_GEN_DOCUMENT_INITIALIZE_DOCUMENT_FILE
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	ss:bp - GrObjAttributeManagerArrayDesc
 * 		For the three grobj arrays you must either pass all
 * 		three arrays or all three as 0
 * 		For the three text arrays you must either pass all
 * 		three arrays or all three as 0
 *
 *
 * RETURN
 * 	nothing
 *
 *
 * DESTROYED:
 * 	ax
 */

@message word MSG_GOAM_ADD_AREA_ATTR_ELEMENT (
    GrObjBaseAreaAttrElement *element = ss:bp) = ax; /* Needs better proto */
/*
 * 	Add an element (or a new reference to an existing element)
 * 	in the area attr element array
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Any grobject under a GrObjBody that is attached to
 * 		the GrObjAttributeManager
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	ss:bp - GrObjBaseAreaAttrElement
 *
 * RETURN
 * 	ax - area token
 * 	stc - if this element newly added
 *
 * DESTROYED:
 * 	nothing
 */

@message word MSG_GOAM_ADD_LINE_ATTR_ELEMENT (
    GrObjBaseLineAttrElement *element = ss:bp) = ax; /* Needs better proto */
/*
 * 	Add an element (or a new reference to an existing element)
 * 	in the line attr element array
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Any grobject under a GrObjBody that is attached to
 * 		the GrObjAttributeManager
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	ss:bp - GrObjBaseLineAttrElement
 *
 * RETURN
 * 	ax - line token
 * 	stc - if this element newly added
 *
 * DESTROYED:
 * 	nothing
 */

@message Boolean MSG_GOAM_DEREF_AREA_ATTR_ELEMENT_TOKEN (
    word token = cx) = carry;
/*
 * 	Dereference element in area attr array (remove if
 * 	reference count geos to zero)
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Any grobject under a GrObjBody that is attached to
 * 		the GrObjAttributeManager
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx - area token
 *
 * RETURN
 * 	stc  - if element actually removed
 */

@message Boolean MSG_GOAM_DEREF_LINE_ATTR_ELEMENT_TOKEN (
    word token = cx) = carry;
/*
 * 	Dereference element in line attr array (remove if
 * 	reference count geos to zero)
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Any grobject under a GrObjBody that is attached to
 * 		the GrObjAttributeManager
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx - line token
 *
 * RETURN
 * 	stc  - if element actually removed
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOAM_ADD_REF_AREA_ATTR_ELEMENT_TOKEN (word token = cx);
/*
 * 	Add reference to element in area attr array
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Any grobject under a GrObjBody that is attached to
 * 		the GrObjAttributeManager
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx - area token
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOAM_ADD_REF_LINE_ATTR_ELEMENT_TOKEN (word token = cx);
/*
 * 	Add reference to element in line attr array
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Any grobject under a GrObjBody that is attached to
 * 		the GrObjAttributeManager
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx - line token
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOAM_GET_FULL_AREA_ATTR_ELEMENT (); 	/* Needs Prototype */
/*
 * 	Get area attribute element from element array
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Unrestricted
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx - area token
 * 	ss:bp - GrObjFullAreaAttrElement - empty
 *
 * RETURN
 * 	carry set if passed token valid
 * 		ss:bp - GrObjFullAreaAttrElement - filled
 * 		ax - element size
 *
 * 	carry clear if no information retured
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOAM_GET_FULL_LINE_ATTR_ELEMENT (); 	/* Needs Prototype */
/*
 * 	Get line attribute element from element array
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Unrestricted
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx - line token
 * 	ss:bp - GrObjFullLineAttrElement - empty
 *
 * RETURN
 * 	carry set if passed token valid
 * 		ss:bp - GrObjFullLineAttrElement - filled
 * 		ax - element size
 *
 * 	carry clear if no information retured
 *
 * DESTROYED:
 * 	ax
 */

@message Boolean MSG_GOAM_GET_STYLE_ARRAY (word retVal = cx);
/*
 * 	Get the style array handle
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Unrestricted
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	carry set if valid value
 * 		cx - array block handle
 *
 * 	carry clear if no information retured
 *
 * DESTROYED:
 * 	nothing
 */

@message Boolean MSG_GOAM_GET_AREA_ATTR_ARRAY (word retVal = cx);
/*
 * 	Get the area array handle
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Unrestricted
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	carry set if valid value
 * 		cx - array block handle
 *
 * 	carry clear if no information retured
 *
 * DESTROYED:
 * 	nothing
 */

@message Boolean MSG_GOAM_GET_LINE_ATTR_ARRAY (word retVal = cx);
/*
 * 	Get the line array handle
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Unrestricted
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	carry set if valid value
 * 		cx - array block handle
 *
 * 	carry clear if no information retured
 *
 * DESTROYED:
 * 	nothing
 */

typedef struct {
    word	AALT_areaToken;
    word	AALT_pad1;
    word	AALT_message;
    word	AALT_pad2;
} AreaAndLineToken} ;

@message Boolean MSG_GOAM_GET_AREA_AND_LINE_TOKENS_FROM_STYLE (
    AreaAndLineToken *retVal = axcxdxbp,
    word token = cx) = carry;
/*
 * 	Returns the area and line tokens stored in the style
 * 	represented by the passed style token
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Unrestricted
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS
 * 		cx - style token
 *
 * RETURN
 * 		carry set if style not found, else
 *
 * 		carry clear
 * 		ax - area attr token
 * 		dx - line attr token
 *
 * DESTROYED:
 * 	nothing
 */

@message void MSG_GOAM_ATTACH_BODY (optr bodyOD = cx:dx);
/*
 * 	add the passed GrObjBody OD to the GOAM's body list
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Most likely from MSG_GB_ATTACH_GOAM method
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS:		^lcx:dx = GrObjBody object
 *
 * RETURN:	nothing
 *
 * DESTROYED:
 * 		ax
 */

@message void MSG_GOAM_INVALIDATE_BODIES ();
/*
 * 	send a MSG_GB_INVALIDATE to every GrObjBody in the GOAM's
 * 	body list. eg., if a style changes and they all need to know
 * 	about it.
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Unlimited
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS:		nothing
 *
 * RETURN:	nothing
 */

@message void MSG_GOAM_SUBST_AREA_TOKEN (
    word oldToken = cx,
    word newToken = dx,
    Boolean updateReferenceCounts = bp);
/*
 * 	Inform all the GrObjBodys in the GOAM's list that any GrObjs
 * 	with the passed "old" token should replace it with the new one,
 * 	updating the reference count if specified.
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Most likely from the style substitution callack
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS:		cx - old area token
 * 		dx - new area token
 * 		bp - nonzero if GrObjs should update reference counts
 * 			to both the old and new tokens
 *
 * RETURN:	nothing
 *
 * DESTROYED:	ax
 */

@message void MSG_GOAM_SUBST_LINE_TOKEN (
    word oldToken = cx,
    word newToken = dx,
    Boolean updateReferenceCounts = bp);
/*
 * 	Inform all the GrObjBodys in the GOAM's list that any GrObjs
 * 	with the passed "old" token should replace it with the new one,
 * 	updating the reference count if specified.
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Most likely from the style substitution callack
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS:		cx - old line token
 * 		dx - new line token
 * 		bp - nonzero if GrObjs should update reference counts
 * 			to both the old and new tokens
 *
 * RETURN:	nothing
 *
 * DESTROYED:	ax
 */

@message optr MSG_GOAM_GET_TEXT_OD () = cx:dx;
/*
 * 	Return the output descriptor of the text object that the
 * 	attribute manager uses to keep track of the default text
 * 	attributes.
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjAttributeManager
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	^lcx:dx - text od
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {		/* CHECKME */
    VMBlockHandle	GOTA_charAttrArray;
    VMBlockHandle	GOTA_paraAttrArray;
    VMBlockHandle	GOTA_typeArray;
    VMBlockHandle	GOTA_graphicArray;
    VMBlockHandle	GOTA_nameArray;
    VMBlockHandle	GOTA_textStyleArray;
} GrObjTextArrays} ;

@message void MSG_GOAM_GET_TEXT_ARRAYS (GrObjTextArrays *retVal = ss:bp);
/*
 * 	Return the vm block handles of the char, para and style arrays.
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjAttributeManager
 *  Interception: Unlikey
 *
 * PASS:
 * 	ss:bp - GrObjTextArrays
 *
 * RETURN:
 * 	ss:bp - structure filled
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOAM_LOAD_STYLE_SHEET_PARAMS ();	/* Needs Prototype */
/*
 * 	Fills out a StyleSheetParams struct
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjAttributeManager
 *  Interception: Unlikey
 *
 * PASS:
 * 	ss:[bp] - empty StyleSheetParams
 * 	cx - nonzero to preserve xfer arrays
 *
 * RETURN:
 * 	ss:[bp] - StyleSheetParams
 *
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOAM_DETACH_BODY (optr bodyOD = cx:dx);
/*
 * 	Remove the passed GrObjBody OD from the GOAM's body list
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Most likely from the body when it is handling MSG_GB_CLEAR
 *  Destination:	GrObjAttributeManager
 *  Interception:	Unlikely
 *
 * PASS:		^lcx:dx = GrObjBody object
 *
 * RETURN:	nothing
 *
 * DESTROYED:
 * 		ax
 */

@message void MSG_GOAM_SUBST_TEXT_ATTR_TOKEN (VisTextSubstAttrTokenParams *params = ss:bp);
/*
 * 	A text object has requested an attribute substitution, so we
 * 	need to relay the message to all text objects in all the bodies.
 *
 *  Context:	Unrestricted.
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - VisTextSubstAttrTokenParams
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOAM_RECALC_FOR_TEXT_ATTR_CHANGE (Boolean relayed = cx);
/*
 * 	A text object has requested an attribute substitution, so we
 * 	need to relay the message to all text objects in all the bodies
 *
 *  Context:	Unrestricted.
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx - nonzero if relayed to all text objects
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOAM_LOAD_STYLE_SHEET ();	/* Needs Prototype */
/*
 * 	Fills out a StyleSheetParams struct
 *
 *  Context:	GrObjAttributeManager Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjAttributeManager
 *  Interception: Unlikey
 *
 * PASS:
 * 	ss:[bp] - empty StyleSheetParams
 * 	cx - nonzero to preserve xfer arrays
 *
 * RETURN:
 * 	ss:[bp] - StyleSheetParams
 *
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOAM_SET_GROBJ_DRAW_FLAGS (GrObjDrawFlags flagsToSet = cx,
                      GrObjDrawFlags flagsToReset = dx); /* XXX */
/*
 * 	Sends a MSG_GB_SET_GROBJ_DRAW_FLAGS_NO_BROADCAST to all the GOAM's
 * 	bodies
 *
 *  Context:	GOAM Utility
 *  Source:	Unrestricted
 *  Destination:  GOAM
 *  Interception: Unlikely
 *
 * PASS:
 *
 * 	cx - GrObjDrawFlags to set
 * 	dx - GrObjDrawFlags to reset
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

/*-----------------------------------------------------------------------------
    GrObjAttributeManager Structures & Instance Data
-----------------------------------------------------------------------------*/
@default GOI_optFlags = ( /* GOI_optFlags*/ GOOF_GROBJ_INVALID | GOOF_ATTRIBUTE_MANAGER );

#define GROBJ_VM_ELEMENT_ARRAY_CHUNK 	(sizeof (LMemblockHeader))	/*???*/

@instance word    GOAMI_areaAttrArrayHandle = 0;

@instance word    GOAMI_lineAttrArrayHandle = 0;

@instance word    GOAMI_grObjStyleArrayHandle = 0;

@instance ChunkHandle    GOAMI_bodyList = 0;

@instance word    GOAMI_charAttrArrayHandle = 0;

@instance word    GOAMI_paraAttrArrayHandle = 0;

@instance word    GOAMI_typeArrayHandle = 0;

@instance word    GOAMI_graphicArrayHandle = 0;

@instance word    GOAMI_nameArrayHandle = 0;

@instance word    GOAMI_textStyleArrayHandle = 0;

@instance optr    GOAMI_text;

@endc

/*-----------------------------------------------------------------------------
    GrObjBodyClass
-----------------------------------------------------------------------------*/

@class GrObjBodyClass, VisCompClass;

/*-----------------------------------------------------------------------------
    GrObjBodyClass
-----------------------------------------------------------------------------*/

@message GStateHandle MSG_GB_CREATE_GSTATE () = bp;
/*
 * 	For speed purposes the grobj keeps a cached gstate.
 * 	When something in the grobj requests a gstate we
 * 	create a gstate and copy the cached gstates transform
 * 	into the new one. This prevent us from having
 * 	to vup up the vis linking several more levels.
 * 	We don't use the cached gstate so that the caller can
 * 	function just as if it called GrCreateState and
 * 	destroy the gstate when it is done.
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	bp - gstate
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_INVALIDATE ();
/*
 * 	Invalidate all the GrObjs under this body
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GIVE_ME_MOUSE_EVENTS (optr childOD = cx:dx);
/*
 * 	Tell body to send mouse events to a child
 *
 * PASS
 * 	cx:dx - od of child
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_DONT_GIVE_ME_MOUSE_EVENTS (optr childOD = cx:dx);
/*
 * 	Tell body to stop sending mouse events to a child
 *
 * PASS
 * 	cx:dx - od of child
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_ATTACH_HEAD (optr headOD = cx:dx);
/*
 * 	Set Head OD in instance data
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted. Generally the GenDocument on
 * 		MSG_GEN_DOCUMENT_ATTACH_UI
 *  Destination:	GrObjBody
 *  Interception:	Unlikely
 */

/****************************************************************************/
@message void MSG_GB_ATTACH_GOAM (optr GrObjAttrManager = cx:dx);	/*XXX*/
/*
 * 	Set GrObjAttributeManager OD in instance data and attach the
 * 	body to the GOAM's bodyList.
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted. Generally the GenDocument on
 * 		MSG_GEN_DOCUMENT_INITIALIZE_DOCUMENT_FILE
 *  Destination:	GrObjBody
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx:dx - OD of GrObjAttributeManager
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_ATTACH_RULER (optr rulerOD = cx:dx);
/*
 * 	Set Ruler OD in instance data
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted. Generally the GenDocument on
 * 		MSG_GEN_DOCUMENT_INITIALIZE_DOCUMENT_FILE
 *  Destination:	GrObjBody
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx:dx - OD of VisRuler
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef WordFlags GrObjBodyAddGrObjFlags ;
#define GOBAGOF_DRAW_LIST_POSITION  	0x8000
#define GOBAGOF_REFERENCE  		0x7fff
#define GOBAGOF_REFERENCE_OFFSET 	0
#define GOBAGOR_FIRST  CCO_FIRST
#define GOBAGOR_LAST   CCO_LAST

@message void MSG_GB_ADD_GROBJ (optr object = cx:dx,
                word flags = bp);	 	/* XXX */
/*
 * 	Add a graphic object to the GrObjbody and generate an
 * 	undo chain to undo the add. The object will be
 * 	notified via MSG_GO_AFTER_ADDED_TO_BODY that it has been added
 * 	to the body. The object will not be drawn. If the caller
 * 	wishes to have the object drawn at this time, then use
 * 	MSG_GB_ADD_GROBJ_THEN_DRAW insteads
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:	GrObjBody
 *  Interception:	Unlikely
 *
 * PASS
 * 	cx:dx - optr of child to add
 * 	bp - GrObjBodyAddGrObjFlags
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_REMOVE_GROBJ (optr childOD = cx:dx);
/*
 * 	Remove a grobject from the graphic body and generate
 * 	undo chain to undo remove. Warning, this message
 * 	will not cause the child to release exclusives, drop selection,
 * 	drop edit and such. In general you should use
 * 	MSG_GO_REMOVE_FROM_BODY which is sent to the child.
 *
 *
 *  Context:	GrObj Body Utility
 *  Source:	Unrestricted
 *  Destination:  Body
 *  Interception: Unlikely
 *
 * PASS:
 * 	^lcx:dx - child
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {
    word	DOARDO_reverseDrawOrder;
    word	DOARDO_drawOrder;
} DrawOrderAndReverseDrawOrder} ;

@message Boolean MSG_GB_FIND_GROBJ (
    DrawOrderAndReverseDrawOrder retVal = dxcx,
    optr childOD = cx:dx) = carry;
/*
 * 	Find the position in the draw list and reverse list of child
 * 	of the body
 *
 * PASS
 * 	cx:dx - optr of child to find
 *
 * RETURN
 * 	stc - found
 * 		cx - position in draw list (0 = first child)
 * 		dx - position in reverse list (0 = first child)
 * 	clc - not found
 * 		cx,dx - destroyed
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_PULL_SELECTED_GROBJS_TO_FRONT ();
/*
 * 	Bring the selected grobjs to the front of the document.
 * 	(i.e. move them to the end of the drawing list)
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricuted
 *  Destination:  GrObj Body
 *  Interception: Unlikely
 *  Undo:		Generates an undo chain with text
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_PUSH_SELECTED_GROBJS_TO_BACK ();
/*
 * 	Push the selected grobjs to the back of the document.
 * 	(i.e. move them to the begining of the drawing list)
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricuted
 *  Destination:  GrObj Body
 *  Interception: Unlikely
 *  Undo:		Generates an undo chain with text
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_SHUFFLE_SELECTED_GROBJS_UP ();
/*
 * 	Move selected grobjs one closer to end of the draw list
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObj Body
 *  Interception: Unlikely
 *  Undo:		Generates an undo chain with text
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_SHUFFLE_SELECTED_GROBJS_DOWN ();
/*
 * 	Move selected grobjs one closer to begining of the draw list
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObj Body
 *  Interception: Unlikely
 *  Undo:		Generates an undo chain with text
 *
 *
 * PASS
 * 	nothing
 * RETURN
 * 	even less
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_SET_DESIRED_HANDLE_SIZE (byte handleSize = cl); /* XXX */
/*
 * 	set desired handle width for selected objects
 *
 * PASS
 * 	cl - desired handle size (in DEVICE coords)
 * RETURN
 * 	nothing
 * DESTROYED:
 * 	ax
 */

@message byte MSG_GB_GET_DESIRED_HANDLE_SIZE () = al;
/*
 * 	set desired handle width for selected objects
 *
 * PASS
 * 	nothing
 * RETURN
 * 	al - desired handle size (in DEVICE coords)
 * DESTROYED:
 * 	nothing
 */

/****************************************************************************/
@message void MSG_GB_ATTACH_UI (optr GrObjHead = cx:dx);	/* XXX */
/*
 * 	Prepare GrObjBody for opening
 *
 *  Context:	MUST be sent to body after it has been added to the
 * 		document, which should be done on
 * 		MSG_GEN_DOCUMENT_ATTACH_UI
 *  Source:	Generally GenDocument object
 *  Destination:	GrObjBody
 *  Interception:	Unlikely.
 *
 * PASS
 * 	cx:dx - OD of GrObjHead
 *
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_DETACH_UI ();	 	/* XXX */
/*
 * 	Prepare GrObjBody for closing
 *
 *  Context:	MUST be sent to body before it is removed from the
 * 		document, which should be done on
 * 		MSG_GEN_DOCUMENT_DETACH_UI
 *  Source:	Generally GenDocument object
 *  Destination:	GrObjBody
 *  Interception:	Unlikely.
 *
 * PASS
 * 	nothing
 *
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_ADD_GROBJ_TO_SELECTION_LIST (optr grobjOD = cx:dx,
                         HandleUpdateMode mode = bp);
/*
 * 	Add passed child to selection list.
 *
 * 	NOTE: If you want to add a child to the body, send the child
 * 	MSG_GO_BECOME_SELECTED. DO NOT send this message to the body
 * 	with the child's od. The child may have its selection lock set
 * 	or other instance data that should prevent it from being selected.
 *
 *  Context:	When a grobject is handling MSG_GO_BECOME_SELECTED.
 *  Source:	GrObject
 *  Destination:	GrObjBody
 *  Interception:	Unlikely.
 *
 * PASS
 * 	cx:dx - OD of child
 * 	bp low - HandleUpdateMode
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_REMOVE_GROBJ_FROM_SELECTION_LIST (optr grobjOD = cx:dx);
/*
 * 	Remove passed child from selection list
 *
 * PASS
 * 	cx:dx - OD of child
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_REMOVE_ALL_GROBJS_FROM_SELECTION_LIST ();
/*
 * 	Removes all children from selection list
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_SEND_CLASSED_EVENT_TO_SELECTED_GROBJS (EventHandle event = cx);
/*
 * 	Sends encapsulated classed event to all
 * 	grobjects on selection list
 *
 * PASS
 * 	cx - event handle
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message word MSG_GB_GET_NUM_SELECTED_GROBJS () = bp;
/*
 * 	return number of children in selection list
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	bp - number of children
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GET_BOUNDS_OF_SELECTED_GROBJS (RectDWord *bounds = ss:bp);
/*
 * 	Returns the bounds that encompass all the selected objects
 *
 * PASS
 * 	ss:bp - RectDWord
 *
 * RETURN
 * 	ss:bp - RectDWord
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GET_DWF_BOUNDS_OF_SELECTED_GROBJS (RectDWFixed *bounds = ss:bp);
/*
 * 	Returns the bounds that encompass all the selected objects
 *
 * PASS
 * 	ss:bp - RectDWFixed
 *
 * RETURN
 * 	ss:bp - RectDWFixed
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GET_SUMMED_DWF_DIMENSIONS_OF_SELECTED_GROBJS (RectDWFixed *bounds = ss:bp);
/*
 * 	Returns the summed heights/widths of all the selected objects
 *
 * PASS
 * 	ss:bp - RectDWFixed
 *
 * RETURN
 * 	ss:bp - RectDWFixed
 * DESTROYED:
 * 	ax
 */

typedef ByteFlags GrObjsInRectSpecial ;		/* CHECKME */
/* 5 bits unused */
/*
 * don't send tempMessage to
 * objects with GOTM_TEMP_HANDLES
 * set
 */
#define GOIRS_IGNORE_TEMP 	(0x04)

/*
 * don't send inRectMessage to
 * objects in rect
 */
#define GOIRS_IGNORE_RECT 	(0x02)

/*
 * if both temp and inRect
 * conditions apply, send
 * neither. otherwise send
 * both. temp will always
 * be sent first.
 */
#define GOIRS_XOR_CHECK 	(0x01)

typedef struct {
    word GOIRD_tempMessage;
    word GOIRD_tempMessageDX;
    word GOIRD_inRectMessage;
    word GOIRD_inRectMessageDX;
    RectDWord	GOIRD_rect;
    GrObjsInRectSpecial GOIRD_special;
/*	word align;	*/
} GrObjsInRectData} ;

@message void MSG_GB_DELETE_SELECTED_GROBJS ();
/*
 * 	Delete all the children on the selected list
 *
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_PROCESS_ALL_GROBJS_IN_RECT (GrObjsInRectData *rectData = ss:bp);
/*
 * 		Compares the visBounds of each object with the rectangle
 * 		for some condition. If condition is met, send method
 * 		to object with stack frame. The rect and condition flags
 * 		are in the TestRectangleStruct
 *
 *
 * PASS
 * 	ss:bp - GrObjsInRectData
 * 	dx - size GrObjsInRectData
 *
 * RETURN
 * 	nothing
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_INCREASE_POTENTIAL_EXPANSION (word potentialExpansion = cx,
                          hptr block = dx);
/*
 * 	Notify the tree that an object just instantiated could
 * 	expand to a maximum of the amount passed
 *
 * PASS
 * 	cx - #bytes object may expand - may no be more than MAX_OBJ_EXPANSION
 * 	dx - handle of block
 *
 * RETURN
 * 	nothing
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_DECREASE_POTENTIAL_EXPANSION (word potentialExpansion = cx,
                          hptr block = dx);
/*
 * 	Notify the tree that an object about to be destroyed previously
 * 	increased the increased potential
 *
 * PASS
 * 	cx - #bytes object may expand - may no be more than MAX_OBJ_EXPANSION
 * 	dx - handle of block
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef ByteFlags PriorityListInstructions ;		/* CHECKME */
/*
 * Do trivial reject check on bounds
 * of objects that include the selection ""
 * handles, instead of the normal
 * PARENT bounds which are only guaranteed
 * to surround the image
 */
#define PLI_CHECK_SELECTION_HANDLE_BOUNDS 	(0x80)
/*
 * Only send messages to objects
 * that are in selection list
 */
#define PLI_ONLY_PROCESS_SELECTED 	(0x40)
/*
 * Only send messages to objects
 * of class
 */
#define PLI_ONLY_PROCESS_CLASS 	(0x20)
/*
 * Only insert items of class into
 * priority list
 */
#define PLI_ONLY_INSERT_CLASS 	(0x10)
/*
 * Stop processing children after
 * an object evaluates high
 */
#define PLI_STOP_AT_FIRST_HIGH 	(0x08)
/*
 * Only insert objects that evaluate
 * high
 */
#define PLI_ONLY_INSERT_HIGH 	(0x04)
/*
 * Don't insert objects that
 * have their selection lock set.
 * These objects must return
 * EPN_SELECTION_LOCK_SET
 */
#define PLI_DONT_INSERT_OBJECTS_WITH_SELECTION_LOCK 	(0x02)

typedef struct {		/* CHECKME */
    byte	PLI_align;
    word	PLI_message;
    PointDWFixed	PLI_point;
    PriorityListInstructions	PLI_instructions;
    word	PLI_maxElements;
    ClassStruct	*PLI_class;
} PLInit} ;

/*
CheckHack < offset PLI_class  eq (size PLInit-size PLI_class)>
*/

typedef struct {		/* CHECKME */
    optr	PLE_od;
    byte	PLE_priority;
    byte	PLE_other;
} PriorityListElement} ;

/*
 * If used as PriorityList message no message will actually be sent to object.
 * The bounds check will be considered sufficient for a high evaluation. No
 * other data or EvaluatePositionNotes will be set.
 */

#define PRIORITY_LIST_EVALUATE_PARENT_POINT_FOR_BOUNDS 	0

typedef struct {		/* CHECKME */
/*
 * Method to send to each
 * object
 */
    word	PL_message;

/*
 * Document coord to be
 * examined by object
 */
    PointDWFixed	PL_point;

/*
 * Instructions for processing
 * of objects
 */
    PriorityListInstructions	PL_instructions;

/*
 * Class of object to be used
 * based on
 * PriorityListInstructions
 */
    ClassStruct	*PL_class;

/*
 * Number of elements currently
 * in the list
 */
    word	PL_numElements;

/*
 * Maximum number of elements
 * allowed in list
 */
    word	PL_maxElements;

/*
 * Chunk handle of list
 * chunk array.
 */
    ChunkHandle	PL_list;
} PriorityList} ;

@message void MSG_GB_FILL_PRIORITY_LIST ();
/*
 * 	Fill the GrObjBody's priority list
 *
 * PASS
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_MESSAGE_TO_FLOATER_IF_PARENT (Message floaterMessage = cx,
                          word data1 = dx,
                          word data2 = bp);
/*
 * 	Send method to floater if this body is its parent
 *
 * PASS:
 * 	cx - method to send
 * 	dx,bp - method data
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef WordFlags GrObjUINotificationTypes ;		/* CHECKME */
/* True if style notification needs to be sent */
#define GOUINT_STYLE 	(0x8000)
/* True if area notification needs to be sent */
#define GOUINT_AREA 	(0x4000)
/* True if line notification needs to be sent */
#define GOUINT_LINE 	(0x2000)
/* True if grobj specific selection state notification needs to be sent */
#define GOUINT_GROBJ_SELECT 	(0x1000)
/* True if style notification needs to be sent */
#define GOUINT_STYLE_SHEET 	(0x0800)
/* True if edit menu notification need be sent */
#define GOUINT_SELECT 	(0x0400)

@message void MSG_GB_UPDATE_UI_CONTROLLERS (GrObjUINotificationTypes types = cx);
/*
 * 	Update the GrObj controllers
 *
 * PASS:
 * 	cx - GrObjUINotificationTypes
 * RETURN:
 * 	nothing
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_UPDATE_EXTENDED_AREA_ATTR_CONTROLLERS ();
/*
 * 	Update the GrObj dealing with area attributes not of
 * 	type GOAAET_BASE
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_UPDATE_EXTENDED_AREA_ATTR_CONTROLLERS_WITH_DEFAULTS ();
/*
 * 	Update the GrObj dealing with area attributes not of
 * 	type GOAAET_BASE
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_UPDATE_EXTENDED_LINE_ATTR_CONTROLLERS ();
/*
 * 	Update the GrObj dealing with line attributes not of
 * 	type GOLAET_BASE
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_UPDATE_EXTENDED_LINE_ATTR_CONTROLLERS_WITH_DEFAULTS ();
/*
 * 	Update the GrObj dealing with line attributes not of
 * 	type GOLAET_BASE
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_UPDATE_INSTRUCTION_CONTROLLERS ();
/*
 * 	Update the GWNT_GROBJ_BODY_INSTRUCTION_FLAGS_CHANGE controllers
 * 	based on the body's instance data
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 * DESTROYED:
 * 	ax
 */

@message optr MSG_GB_ADD_DUPLICATE_FLOATER (optr dupOD = cx:dx) = cx:dx;
/*
 * 	Add a duplicate of the passed object to the visual tree
 *
 * PASS
 * 	cx:dx - OD of object to duplicate and add
 *
 * RETURN
 * 	cx:dx - OD of new object
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_PRIORITY_LIST_RESET ();
/*
 * 	Set the priority list back to zero elements
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message word MSG_GB_PRIORITY_LIST_GET_NUM_ELEMENTS () = cx;
/*
 * 	Return number of elements in list
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	cx - number of elements
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {
    byte    PE_priority;
    byte    PE_otherData;
    optr	PE_optr;
} PriorityElement} ;

@message Boolean MSG_GB_PRIORITY_LIST_GET_ELEMENT (PriorityElement *retVal = axcxdxbp, word elemNum = cx) = carry;
/*
 * 	Return info about an element in list
 *
 * PASS
 * 	cx - element # (0 is first element)
 *
 * RETURN
 * 	stc - element doesn't exist
 * 	clc  - element exists
 * 		cx:dx - optr
 * 		al - priority
 * 		ah - other data
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_PRIORITY_LIST_INIT (PLInit *init = cx:dx);
/*
 * 	Initialize priority list data
 *
 * PASS
 * 	cx:dx - fptr to PLInit
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GROUP_SELECTED_GROBJS ();
/*
 * 	Form a group composed of the selected children
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_UNGROUP_SELECTED_GROUPS ();
/*
 * 	Ungroup any selected children which are groups
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message Boolean MSG_GB_TRANSFER_GROBJ_FROM_GROUP (CallBackMessageData *callbackData = ss:bp) = carry;
/*
 * 	Call back message for transfer children from group to
 * 	body during an ungroup
 *
 * PASS
 * 	ss:bp - CallBackMessageData
 *
 * RETURN
 * 	clc - keep processing children
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_CLOSE_FINISH_UP ();		 	/* Needs Prototype */

@message void MSG_GB_CLEAR ();
/*
 * 	Destroy the body, all its children, frees the blocks the
 * 	children are in but NOT the block the body is in.
 * 	More specifically, it releases all exclusives held by body,
 * 	disconnects if from the head and attribute manager and sends
 * 	MSG_META_OBJ_FREE to itself. On MSG_FINAL_OBJ_FREE the body
 * 	will send MSG_GO_QUICK_TOTAL_BODY_CLEAR to all its
 * 	children and the free all the children's blocks. This is done
 * 	instead of sending MSG_META_OBJ_FREE to each child because
 * 	that would flood the system queues with an alarming number
 * 	of messages.
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_ALIGN_SELECTED_GROBJS (AlignType type = cl);
/*
 * 	Aligns the selected objects according to the passed AlignType
 *
 * PASS
 * 	cl = AlignType
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_CREATE_SORTABLE_ARRAY ();
/*
 * 	Allocates a block for a sortable selected array, and changes the
 * 	graphic body's instance data to point to it. The original array's
 * 	descriptor is stored in the new array's header.
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_DESTROY_SORTABLE_ARRAY ();
/*
 * 	Frees the block previously allocated for a sortable selected array,
 * 	(in handler for MSG_GB_CREATE_SORTABLE_ARRAY) and changes the
 * 	graphic body's instance data to point back to the original array.
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_FILL_SORTABLE_ARRAY_USING_GO_DWF_BOUNDS (word keyOffset = dx);
/*
 * 	Fills the Sortable array from the original array contained in
 * 	its header. The sortable array element is the OD from the
 * 	original element, plus a DWFixed key from the object specified
 * 	by the OD. The caller passes an offset into RectDWFixed to
 * 	specify which parameter from the object's bounds is to be
 * 	the key.
 *
 * PASS
 * 	dx = offset into RectDWFixed of key
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_FILL_SORTABLE_ARRAY_USING_GO_CENTERS (word keyOffset = dx);
/*
 * 	Fills the Sortable array from the original array contained in
 * 	its header. The sortable array element is the OD from the
 * 	original element, plus a DWFixed key from the object specified
 * 	by the OD. The caller passes an offset into RectDWFixed to
 * 	specify which parameter from the object's bounds is to be
 * 	the key.
 *
 * PASS
 * 	dx = offset into RectDWFixed of key
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {		/* CHECKME */
    ChunkArrayHeader	SAH_CAH;
    optr		SAH_originalArray;
} SortableArrayHeader} ;

typedef struct {		/* CHECKME */
    optr	SAE_OD;
    DWFixed	SAE_key;
} SortableArrayElement} ;

@message void MSG_GB_SORT_SORTABLE_ARRAY ();
/*
 * 	Sort the sortable array based on each element's key.
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GET_CENTER_OF_SELECTED_GROBJS (PointDWFixed *center = ss:bp);
/*
 * 	Return the PointDWFixed center of the selected grobjs
 *
 * PASS:
 * 		ss:bp = PointDWFixed
 * 		dx >= size PointDWFixed
 *
 * RETURN:
 * 		ss:bp = PointDWFixed center
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GET_CENTER_OF_FIRST_SELECTED_GROBJ (PointDWFixed *center = ss:bp);
/*
 * 	Return the PointDWFixed center of the first object in
 * 	the selection list
 *
 * PASS:
 * 		ss:bp = PointDWFixed
 * 		dx >= size PointDWFixed
 *
 * RETURN:
 * 		ss:bp = PointDWFixed center
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GET_CENTER_OF_LAST_SELECTED_GROBJ (PointDWFixed *center = ss:bp);
/*
 * 	Return the PointDWFixed center of the last object in
 * 	the selection list
 *
 * PASS:
 * 		ss:bp = PointDWFixed
 * 		dx >= size PointDWFixed
 *
 * RETURN:
 * 		ss:bp = PointDWFixed center
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GET_DWF_BOUNDS_OF_FIRST_SELECTED_GROBJ (RectDWFixed *bounds = ss:bp);
/*
 * 	Return the RectDWFixed bounds of the first object in
 * 	the selection list
 *
 * PASS:
 * 		ss:bp = RectDWFixed
 * 		dx >= size RectDWFixed
 *
 * RETURN:
 * 		ss:bp = RectDWFixed center
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GET_DWF_BOUNDS_OF_LAST_SELECTED_GROBJ (RectDWFixed *bounds = ss:bp);
/*
 * 	Return the RectDWFixed bounds of the last object in
 * 	the selection list
 *
 * PASS:
 * 		ss:bp = RectDWFixed
 * 		dx >= size RectDWFixed
 *
 * RETURN:
 * 		ss:bp = RectDWFixed center
 *
 * DESTROYED:
 * 	ax
 */

@message hptr MSG_GB_GET_BLOCK_FOR_ONE_GROBJ () = cx;
/*
 * 	Return a block in the file that the caller may add one object to.
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	cx
 *
 * DESTROYED:
 * 	ax
 */

@message WindowHandle MSG_GB_GET_WINDOW () = cx;
/*
 * 	Return window that document draws through
 *
 *  Context:	Unlimited
 *  Source:	Anything
 *  Destination:	GrObjBody
 *  Interception:	Unlikely.
 *
 * PASS:
 * 	nothing
 *
 * RETURN
 * 	cx - window
 *
 * DESTROYED:
 * 	ax
 */

/****************************************************************************/
@message void MSG_GB_ADD_GROBJ_THEN_DRAW (optr object = cx:dx,
                     word flags = bp);  	/*XXX*/
/* 	Add a graphic object to the graphic body. The object will be
 *	notified via MSG_GO_AFTER_ADDED_TO_BODY that it has been added
 *	to the body. If the object was added at the top of the draw list
 *	it will be sent a message draw, otherwise it will be invalidated.
 *
 * Pass: OD of graphic object to add
 *       GrObjBodyAddGrObjFlags
 *
 * Return: nothing
 */

/****************************************************************************/
@message void MSG_GB_SET_BOUNDS (RectDWord *bounds = ss:bp );
/*
 * 	Sets the bounds of the graphic body
 *
 * Pass: RectDWord
 */

@message void MSG_GB_GET_BOUNDS (RectDWord *bounds = dx:bp); 	/* XXX */
/*
 * 	Returns the bounds that encompass all the selected objects
 *
 * PASS
 * 	ss:bp - RectDWord
 *
 * RETURN
 * 	ss:bp - RectDWord
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_SET_ACTION_NOTIFICATION_OUTPUT ( /* XXX */
        optr 	object = cx:dx,	/* Object which will receive notification */
        Message	messageNumber = bp);
/*
 *	Specify the message and OD for GrObjs to send notification to
 *	when an action is performed on them. GrObjs will use this notification
 *	in the body if they don't have one of their own. Many uses of the
 *	GrObj will have no notification.
 *
 *	When a GrObj sends out a notification, it will put its OD in
 *	cx:dx and a GrObjActionNotificationType in bp.
 *
 *	Context:	GrObjBody Utility
 *	Source:		Unrestricted
 *	Destination:	GrObjBody
 *	Interception:	Unlikely
 *
 *	PASS:	object		Optr of object to notify
 *		messageNumber	message to send
 *
 *	RETURN: Nothing
 */

@message void MSG_GB_SUSPEND_ACTION_NOTIFICATION (); /* XXX */
/* 	Prevent all GrObjs in the layer from sending out any action notifications,
 *	even if a given GrObj has its own output OD and message. If the body
 * 	has no action notification OD it will still record the suspension and the
 *	suspension will be in place when the action output is set.  Nested
 *	suspends and unsuspends are allowed.
 *	If a file is closed it will always reopen unsuspended.
 *
 *	Context:	GrObjBody Utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObjBody
 *	Interception:	Unlikely
 *
 */

@message void MSG_GB_UNSUSPEND_ACTION_NOTIFICATION (); /* XXX */
/* 	Counterbalance a call to MSG_GB_SUSPEND_ACTION_NOTIFICATION If all
 *	suspends have been balanced the GrObj will be free to send out
 *	action notifications that were aborted during the suspended period.
 *	If the body is not suspended, this message will be ignored.
 *
 *	Context:	GrObjBody utility
 *	Source:		Unrestricted
 *	Destination:	Any GrObjBody
 *	Interception:	Unlikely
 *
 */

@message optr MSG_GB_INSTANTIATE_GROBJ (ClassStruct *class = cx:dx) = cx:dx; /*XXX */
/*
 *	Instantiate a grobject of the passed class in a block managed
 *	by the body.
 *
 * Pass:
 *	fptr to class of object to instantiate
 *
 * Return:
 *	OD of new object
 *
 */

@message void MSG_GB_SUBST_AREA_TOKEN (
    word oldToken = cx,
    word newToken = dx,
    Boolean updateReferenceCounts = bp);
/*
 * 	Inform any GrObjs with the passed "old" token to replace it with
 * 	the new one, updating the reference count if specified.
 *
 *  Context:	GrObjBody Utility
 *  Source:	Most likely from the style substitution callack
 *  Destination:	GrObjBody
 *  Interception:	Unlikely
 *
 * PASS:		cx - old area token
 * 		dx - new area token
 * 		bp - nonzero if GrObjs should update reference counts
 * 			to both the old and new tokens
 *
 * RETURN:	nothing
 *
 * DESTROYED:	ax
 */

@message void MSG_GB_SUBST_LINE_TOKEN (
    word oldToken = cx,
    word newToken = dx,
    Boolean updateReferenceCounts = bp);
/*
 * 	Inform any GrObjs with the passed "old" token to replace it with
 * 	the new one, updating the reference count if specified.
 *
 *  Context:	GrObjBody Utility
 *  Source:	Most likely from the style substitution callack
 *  Destination:	GrObjBody
 *  Interception:	Unlikely
 *
 * PASS:		cx - old line token
 * 		dx - new line token
 * 		bp - nonzero if GrObjs should update reference counts
 * 			to both the old and new tokens
 *
 * RETURN:	nothing
 *
 * DESTROYED:	ax
 */

@message void MSG_GB_CREATE_GROBJ_TRANSFER_FORMAT (); /* Needs prototype */
/*
 * 	Creates a VMChain necessary to recontruct the current selection
 *
 *  Context:	GrObjBody Utility
 *  Source:	Most likely from a MSG_CLIPBOARD_[CUT|COPY]
 *  Destination:	GrObjBody
 *  Interception:	Unlikely
 *
 * PASS:		ss:[bp] - PointDWFixed origin
 * 		cx - VM file
 *
 * RETURN:	ax - vm block handle of VMChainTree root
 *
 * DESTROYED:	nothing
 */

typedef struct {
    VMBlockHandle    VMBHAD_vmBlockHandle;
    word		 VMBHAD_width;
    word		 VMBHAD_height;
} VMBlockHandleAndDims} ;

@message void MSG_GB_CREATE_GSTRING_TRANSFER_FORMAT (); /* Needs prototype */
/*
 * 	Creates a gstring representing the current selection
 *
 *  Context:	GrObjBody Utility
 *  Source:	Most likely from a MSG_CLIPBOARD_[CUT|COPY]
 *  Destination:	GrObjBody
 *  Interception:	Unlikely
 *
 * PASS:		ss:[bp] - PointDWFixed origin
 * 		cx - VM file
 *
 * RETURN:	ax - vm block handle of gstring
 * 		cx,dx - width/height of gstring
 *
 * DESTROYED:	nothing
 */

@message void MSG_GB_SEND_CLASSED_EVENT_SET_DEFAULT_ATTRS (EventHandle event = cx, TravelOption travelOption = dx);
/*
 * 	The body sends this message to itself when processing
 * 	MSG_META_SEND_CLASSED_EVENT so that it can use the
 * 	message for setting default attributes. This handler
 * 	must not damage the original message. If it decides
 * 	to use the message it must duplicated it
 *
 *  Context:	See Above
 *  Source:	GrObjBody
 *  Destination:  GrObjBody
 *  Interception: Possible. If you have subclassed the body to change
 * 		the default attribute setting behaviour then
 * 		you should subclass this message and not call
 * 		your superclass
 *
 * PASS:
 * 	cx - event handle
 * 	dx - TravelOption
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_CHANGE_GROBJ_DEPTH (optr grobjOD = cx:dx, GrObjBodyAddGrObjFlags flags = bp);
/*
 * 	Change grobjs position in the draw and reverse lists.
 * 	Note you can knock the selection array out of
 * 	draw order when using this message. You may
 * 	want to use MSG_GB_REORDER_SELECTION_ARRAY both before
 * 	and afterwards so that undo and redo work correctly.
 *
 *
 *  Context:	Unrestricted
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *  Undo:		Generates an undo chain with "Depth Change" text
 *
 * PASS:
 * 	cx:dx - od of grobj to change depth of
 * 	bp - GrObjBodyAddGrObjFlags
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef WordFlags GrObjDrawFlags ;		/* CHECKME */

/*
 * Have objects draw themselves with MSG_GO_DRAW_QUICK_VIEW which is much
 * faster but not WYSIWYG
 */
#define GODF_DRAW_QUICK_VIEW 	(0x0100)

/*
 * Draw the clip area only of the object
 */
#define GODF_DRAW_CLIP_ONLY 	(0x0080)

/*
 * if true, then only draw objects with GOAF_WRAP set to GOWTT_WRAP_INSIDE
 */
#define GODF_DRAW_WRAP_TEXT_INSIDE_ONLY 	(0x0040)

/*
 * if true, then only draw objects with GOAF_WRAP set to
 * GOWTT_WRAP_AROUND_RECT or GOWTT_WRAP_AROUND_TIGHTLY
 */
#define GODF_DRAW_WRAP_TEXT_AROUND_ONLY 	(0x0020)

/*
 * If the object is capable it
 * should draw with more resolution.
 * Used for printing and when view
 * is scaled.
 */
#define GODF_DRAW_WITH_INCREASED_RESOLUTION 	(0x0010)

/*
 * if true, then draw objects
 * with GOAF_INSTRUCTION bit set
 */
#define GODF_DRAW_INSTRUCTIONS 	(0x0008)

/*
 * if true, then only draw selected objects.
 */
#define GODF_DRAW_SELECTED_OBJECTS_ONLY 	(0x0004)

/*
 * if true, then don't draw grid lines
 * sprites, handles, etc.
 */
#define GODF_DRAW_OBJECTS_ONLY 	(0x0002)

/* if true then print instructions */
#define GODF_PRINT_INSTRUCTIONS 	(0x0001)

@message void MSG_GB_DRAW (				/* XXX */
            GStateHandle 	gstate = bp,
            DrawFlags 	visDrawFlags = cl,
            GrObjDrawFlags 	GODrawFlags = dx);

/* Draw the GrObjs, grids, etc.
 *
 * Warning:	You probably want to send a MSG_VIS_DRAW instead. You should only
 *		send _this_ message if you know what you are doing.
 *
 * Context:		GrObjBody Utility
 * Source:		Unrestricted. Generally the GrObjBody itself.
 * Destination:		GrObjBody
 * Interception:	Possible, but unlikely
 *
 */

@message void MSG_GB_EXPORT (ImpexTranslationParams *params = ss:bp);
/*
 * 	Create gstring in the vm file
 *
 *  Context:	Sent to body by impex when user chooses export
 *  Source:	Impex
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - ImpexTranslationParams
 *
 * RETURN:
 * 	ss:bp - ImpexTranslationParams
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GRAB_TARGET_FOCUS ();
/*
 * 	Have the body grab the target and the focus
 *
 *  Context:	Unrestricted. Generally sent by floater to body on
 * 		start selects.
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GENERATE_TEXT_NOTIFY (VisTextGenerateNotifyParams *params = ss:bp);
/*
 * 	Combine attrs from the selected text objects and send out notification
 *
 *  Context:	Unrestricted.
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - VisTextGenerateNotifyParams
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GENERATE_SPLINE_NOTIFY (SplineGenerateNotifyParams *params = ss:bp);
/*
 * 	Combine attrs from the selected splines and send out notification
 *
 *  Context:	Unrestricted.
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - SplineGenerateNotifyParams
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_DETACH_GOAM ();
/*
 * 	Clear GrObjAttributeManager OD in instance data and detach the
 * 	body from the GOAM's bodyList.
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted.
 *  Destination:	GrObjBody
 *  Interception:	Unlikely
 */

@message void MSG_GB_IMPORT (ImpexTranslationParams *params = ss:bp);
/*
 * 	Handle import via impex
 *
 *  Context:	Import
 *  Source:	Import Controller
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp -  ImpexTranslatoinParams
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_CONVERT_SELECTED_GROBJS_TO_BITMAP ();
/*
 * 	Replace any selected grobjs with an equivalent bitmap.
 *
 *  Context:	GrObjBodyUtility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_CONVERT_SELECTED_GROBJS_TO_GRAPHIC ();
/*
 * 	Replace any selected grobjs with an equivalent gstring object.
 *
 *  Context:	GrObjBodyUtility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_IGNORE_UNDO_ACTIONS_AND_SUSPEND ();
/*
 * 	An alternative to MSG_META_SUSPEND that will *not* generate
 * 	a new undo chain. This message is complemented by
 * 	MSG_GB_ACCEPT_UNDO_ACTIONS_AND_UNSUSPEND
 *
 *  Context:	GrObjBodyUtility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_UNSUSPEND_AND_ACCEPT_UNDO_ACTIONS ();
/*
 * 	An alternative to MSG_META_UNSUSPEND that will *not* generate
 * 	a new undo chain. This message is complemented by
 * 	MSG_GB_IGNORE_UNDO_ACTIONS_AND_SUSPEND
 *
 *  Context:	GrObjBodyUtility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_MAKE_INSTRUCTIONS_SELECTABLE_AND_EDITABLE ();
/*
 * 	Clear selection and edit locks on all instruction grobjects
 * 	currently in the document.
 *
 *  Context:	GrObj Body Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_MAKE_INSTRUCTIONS_UNSELECTABLE_AND_UNEDITABLE ();
/*
 * 	Set selection and edit locks on all instruction grobjects
 * 	currently in the document.
 *
 *  Context:	GrObj Body Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_SET_GROBJ_DRAW_FLAGS (GrObjDrawFlags flagsToSet = cx,
                      GrObjDrawFlags flagsToReset = dx); /* XXX */
/*
 * 	Set the GrObjDrawFlags that are used during the handling
 * 	of MSG_VIS_DRAW. This message will send a
 * 	MSG_GOAM_SET_GROBJ_DRAW_FLAGS to the attribute manager, which will
 * 	in turn send a MSG_GB_SET_GROBJ_DRAW_FLAGS_NO_BROADCAST to all
 * 	the relevant bodies
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 *
 * 	cx - GrObjDrawFlags to set
 * 	dx - GrObjDrawFlags to reset
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_DELETE_INSTRUCTIONS ();
/*
 * 	Delete all instruction objects in document
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_PASTE_INSIDE ();
/*
 * 	Paste the clipboard objects inside the currently selected objects
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_CLONE_SELECTED_GROBJS ();
/*
 * 	Clone the selected grobjs (copy/paste in place)
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:		nothing
 *
 * RETURN:	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message optr MSG_GB_CREATE_POLYGON (word polyPoints = bp, word polyWidth = cx, word polyHeight = dx) = cx:dx;
/*
 * 	Create a polygon with the passed number of points
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:		bp - number of points in the polygon
 * 		cx,dx - width, height of polygon
 *
 * RETURN:	^lcx:dx - new polygon
 *
 * DESTROYED:
 * 	ax
 */

@message optr MSG_GB_CREATE_STAR (SplineMakeStarParams *params = ss:bp) = cx:dx;
/*
 * 	Create a star with the passed number of points
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:		ss:[bp] - SplineMakeStarParams
 *
 * RETURN:	^lcx:dx - new star
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_SUBST_TEXT_ATTR_TOKEN (VisTextSubstAttrTokenParams *params = ss:bp);
/*
 * 	A text object has requested an attribute substitution, so we
 * 	need to relay the message to all text objects.
 *
 *  Context:	Unrestricted.
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - VisTextSubstAttrTokenParams
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_RECALC_FOR_TEXT_ATTR_CHANGE ();
/*
 * 	A text object has requested an attribute substitution, so we
 * 	need to relay the message to all text objects.
 *
 *  Context:	Unrestricted.
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_GET_BOUNDS_OF_GROBJS (RectDWord *retValue = dx:bp);
/*
 * 	Returns the bounds that encompass all the objects
 *
 *  Context:	Unrestricted.
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS
 * 	ss:bp - RectDWord
 *
 * RETURN
 * 	ss:bp - RectDWord
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {
    word    	    	     GBCDP_repetitions;
    PointDWFixed    	     GBCDP_move;
    WWFixed 	    	     GBCDP_rotation;
    GrObjHandleSpecification GBCDP_rotateAnchor;
    GrObjAnchoredSkewData    GBCDP_skew;
    GrObjAnchoredScaleData   GBCDP_scale;
} GrObjBodyCustomDuplicateParams} ;

@message void MSG_GB_CUSTOM_DUPLICATE_SELECTED_GROBJS (
                 GrObjBodyCustomDuplicateParams *cdParams = dx:bp);
/*
 * 	Custom duplicate the selected GrObjs.
 *
 *  Context:	Unrestricted.
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:[bp] - GrObjBodyCustomDuplicateParams
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_EXPORT_SELECTED_GROBJS (ImpexTranslationParams *params = ss:bp);
/*
 * 	Create gstring in the vm file
 *
 *  Context:	Sent to body by impex when user chooses export
 *  Source:	Impex
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - ImpexTranslationParams
 *
 * RETURN:
 * 	ss:bp - ImpexTranslationParams
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_HIDE_UNSELECTED_GROBJS ();
/*
 * 	Set the GOL_SHOW lock in all objects that are not in
 * 	the selection list.
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_SHOW_ALL_GROBJS ();
/*
 * 	Clear the GOL_SHOW lock in all objects
 *
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {		/* CHECKME */
    ClassStruct		*GBCGP_class;
    word		padding[4];
    WWFixed		GBCGP_width;
    WWFixed		GBCGP_height;
} GrObjBodyCreateGrObjParams} ;

@message optr MSG_GB_CREATE_GROBJ (GrObjBodyCreateGrObjParams *params = ss:bp) = cx:dx;
/*
 * 	Creates a VMChain necessary to recontruct the current selection
 *
 *  Context:	GrObjBody Utility
 *  Source:	Most likely from a MSG_CLIPBOARD_[CUT|COPY]
 *  Destination:	GrObjBody
 *  Interception:	Unlikely
 *
 * PASS:		ss:[bp] - PointDWFixed origin
 * 		cx - VM file
 *
 * RETURN:	ax - vm block handle of VMChainTree root
 *
 * DESTROYED:	nothing
 */

@message void MSG_GB_DUPLICATE_SELECTED_GROBJS ();
/*
 * 	Duplicate the selected grobjs (copy/paste to center of window)
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:		nothing
 *
 * RETURN:	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message optr MSG_GB_FIND_NEXT_GROBJ_THAT_OVERLAPS (optr childOD = cx:dx) = cx:dx;
/*
 * 	Get the od of the next object in the draw list that has parent
 * 	bounds that overlap the parent bounds of the passed object
 *
 *  Context:	Used as part of Pull Up/Push Down functionality
 *  Source:	Unrestricted. Generally GrObjBody
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	^lcx:dx - od of child
 *
 * RETURN:
 * 	cx = 0 - no such object
 * 	or
 * 	^lcx:dx - object that overlaps
 *
 * DESTROYED:
 * 	ax
 */

@message optr MSG_GB_FIND_PREV_GROBJ_THAT_OVERLAPS (optr childOD = cx:dx) = cx:dx;
/*
 * 	Get the od of the prev object in the draw list that has parent
 * 	bounds that overlap the parent bounds of the passed object
 *
 *  Context:	Used as part of Pull Up/Push Down functionality
 *  Source:	Unrestricted. Generally GrObjBody
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	^lcx:dx - od of child
 *
 * RETURN:
 * 	cx = 0 - no such object
 * 	or
 * 	^lcx:dx - object that overlaps
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_ZOOM_IN_ABOUT_POINT (PointDWFixed *point = ss:bp);
/*
 * 	Have the body scroll the point to the center of the screen
 * 	and zoom in.
 *
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: If you wish different view zoom increments then
 * 		subclass this message and don't call your superclass
 *
 * PASS:
 * 	ss:bp - PointDWFixed
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_ZOOM_OUT_ABOUT_POINT (PointDWFixed *point = ss:bp);
/*
 * 	Have the body scroll the point to the center of the screen
 * 	and zoom out.
 *
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: If you wish different view zoom increments then
 * 		subclass this message and don't call your superclass
 *
 * PASS:
 * 	ss:bp - PointDWFixed
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

/*
 *     The GrObjMouseReturnTypes are in the order in which they
 *     will be checked. As soon as one of the conditions is met
 *     the message returns without checking the remaining types.
 */

typedef enum {
    /*
     * Mouse position is over a handle of a selected object.
     */
    GOMRF_HANDLE	,

    /*
     * Mouse position is over the bounds of a GrObj
     */
    GOMRF_BOUNDS	,

    /*
     * Mouse position isn't over anything interesting
     */
    GOMRF_NOTHING
} GrObjMouseReturnType} ;

@message void MSG_GB_EVALUATE_MOUSE_POSITION (); /* Needs Prototype */
/*
 * 	Determine if the passed mouse position if over a
 * 	handle or the bounds of any object and return
 * 	the mouse cursor image if so. The middle handle of
 * 	objects with GOL_MOVE set and the perimeter handles of
 * 	objects with GOL_RESIZE set will be ignored.
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikley
 *
 * PASS:
 * 	ss:bp - PointDWFixed in GrObjBody's coordinate system
 *
 * RETURN:
 * 	ah - MouseReturnFlags high byte
 * 	nothing or MRF_SET_POINTER_IMAGE or MRF_CLEAR_POINTER_IMAGE
 * 		al - GrObjMouseReturnType
 * 	cx:dx - optr of cursor image if MRF_SET_POINTER_IMAGE
 * 		set in MouseReturnFlags
 *
 * DESTROYED:
 * 	nothing
 */

@message Boolean MSG_GB_EVALUATE_POINT_FOR_HANDLE (PointDWFixed *point = ss:bp) = carry; /* Needs Prototype */
/*
 * 	Determine if passed point is over a handle of a selected grobj
 *
 *  Context:	Unrestricted. Generally called from
 * 		MSG_GB_EVALUATE_MOUSE_POSITION handler
 *  Source:	Unrestricted. Generally GrObjBody
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - PointDWFixed
 *
 * RETURN:
 * 	stc - handle hit
 * 		al - GrObjHandleSpecification of hit handle
 *
 * 	clc - no handle hit
 *
 * DESTROYED:
 * 	ah
 */

@message Boolean MSG_GB_EVALUATE_POINT_FOR_BOUNDS (PointDWFixed *point = ss:bp) = carry;
/*
 * 	Determine if passed point is over PARENT bounds of a grobj
 *
 *  Context:	Unrestricted. Generally called from
 * 		MSG_GB_EVALUATE_MOUSE_POSITION handler
 *  Source:	Unrestricted. Generally GrObjBody
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - PointDWFixed
 *
 * RETURN:
 * 	stc - handle hit
 *
 * 	clc - no handle hit
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_SET_NORMAL_SIZE_ABOUT_POINT (PointDWFixed *point = ss:bp);
/*
 * 	Have the body scroll the point to the center of the screen
 * 	and set the view scale to 100%
 *
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: If you wish different view zoom increments then
 * 		subclass this message and don't call your superclass
 *
 * PASS:
 * 	ss:bp - PointDWFixed
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_DRAW_GROBJ (optr grobjOD = cx:dx);
/*
 * 	Draw the passed grobj.If the grobj is the highest child it will
 * 	just be drawn, otherwise it will be invalidated
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx:dx - optr of grobj
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_SEND_TO_SELECTED_GROBJS_SHARE_DATA (Message grobjMessage = cx, word data1 = dx, word data2 = bp);
/*
 * 	Sends encapsulated classed event to all
 * 	grobjects on selection list
 *
 * PASS
 * 	cx - grobj message #
 * 	dx, bp - other data
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_STANDARD_PASTE_CALL_BACK (optr grobjOD = cx:dx);
/*
 * 	The default handler adds the grobject to the body, draws it
 * 	and then adds the grobject to the selection list without
 * 	drawing the grobjects handles.
 *
 * 	For each object that is pasted in, the body either sends this
 * 	message to itself, or, if the body has ATTR_GB_PASTE_CALL_BACK
 * 	in its vardata, it sends the message stored in the vardata to the
 * 	object stored in the vardata.
 *
 * 	Upon handling MSG_META_CLIPBOARD_PASTE the body clears the
 * 	ATTR_GB_PASTE_CALL_BACK vardata.
 *
 *  	If wish to use your own ATTR_GB_PASTE_CALL_BACK back to perform
 * 	special paste functionality (like paste inside), then send
 * 	MSG_GB_PASTE which uses any existing vardata.
 *
 *  Context:	Sent once for each object being pasted if the body doesn't
 * 		have a ATTR_GB_PASTE_CALL_BACK vardata.
 *  Source:	GrObjBody
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	^lcx:dx - grobject not a child of anything
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_PASTE ();
/*
 * 	Paste the clipboard objects inside the currently selected objects
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_REORDER_SELECTION_ARRAY ();
/*
 * 	Nuke and rebuild the selection array so that it is in draw order.
 * 	The array is rebuilt from objects that have their GOTM_SELECTED
 * 	bit set.
 *
 * 	NOTE: for undo and redo to work correctly you will need to
 * 	use this message both before and after you muck with the
 * 	selection array.
 *
 *  Context:	GrObjBody Utility. Certain body functions such as
 * 		MSG_GB_SHUFFLE_SELECTED_GROBJS_DOWN and UP may
 * 		knock the selection array out of draw order, so the
 * 		body sends this message to itself. Also,
 * 		MSG_GB_CHANGE_GROBJ_DEPTH can muck the selection array
 * 		depending on how it is used. So be careful
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *  Undo:		Generates an undo chain with no text
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_ABORT_SEARCH_SPELL_MESSAGE (Message abortMessage = cx);
/*
 * 	Abort a search/spell message (because no text objects exist)
 *
 *  Context:	Sent by the GrObjBody to itsself when receiving a search/spell
 * 		message and no text objects exist
 *  Source:	GrObjBody
 *  Destination:  GrObjBody
 *  Interception: Possible
 *  Undo:		-
 *
 * PASS:
 * 	cx - message to abort
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_QUICK_PASTE (PointDWFixed *pasteAt = ss:bp);
/*
 * 	Does a paste, drawing from the quick part of the clipboard
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message GrObjDrawFlags MSG_GB_GET_GROBJ_DRAW_FLAGS (DrawFlags drawFlags = cl)
                                = dx; /* XXX */
/*
 * 	Get the GrObjDrawFlags that are used during the handling
 * 	of MSG_VIS_DRAW. This is mainly used by a caller of MSG_VIS_DRAW
 * 	who wants to modify the GrObjDrawFlags. To use the flags that
 * 	are returned you will need to call MSG_GB_DRAW instead of
 * 	MSG_VIS_DRAW .
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - DrawFlags
 *
 * RETURN:
 * 	dx - GrObjDrawFlags
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_SET_BOUNDS_WITHOUT_MARKING_DIRTY (RectDWord *bounds = ss:bp );
/*
 * 	Sets the bounds of the graphic body, but does not mark the object
 *	dirty.
 *
 * Pass: RectDWord
 */

@message void MSG_GB_SET_GROBJ_DRAW_FLAGS_NO_BROADCAST (GrObjDrawFlags flagsToSet = cx, GrObjDrawFlags flagsToReset = dx); /* XXX */
/*
 * 	This message sets the grobj draw flags without requesting that
 * 	the attribute manager update other bodies in its list.
 *
 *  Context:	GrObjBody Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 *
 * 	cx - GrObjDrawFlags to set
 * 	dx - GrObjDrawFlags to reset
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GB_QUICK_PASTE_CALL_BACK (optr grobjOD = cx:dx);
/*
 * 	The default handler adds the grobject to the body, draws it,
 * 	send MSG_GO_AFTER_QUICK_PASTE to the new object (generally
 * 	object will select itself, but some will go into edit mode), then
 * 	sends MSG_GO_SEND_ANOTHER_TOOL_ACTIVATED to the floater (this handles
 * 	problems of floater not matching mode the object goes into after quick
 * 	paste. eg. Doing quick move of spline with rectangle tool but can't
 * 	edit spline with rectangle tool).
 *
 *  Context:	Sent to body after an object has been quick pasted
 *  Source:	GrObjBody
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	^lcx:dx - grobject not a child of anything
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

/*----------------------------------------------------------------------------
    GrObjBody Constancs and Structures
----------------------------------------------------------------------------*/

typedef struct {		/* CHECKME */
    VMChainTree	GOTBH_meta;
    PointDWord	GOTBH_size;
    dword	GOTBH_areaAttrArray;
    dword	GOTBH_lineAttrArray;
    dword	GOTBH_styleArray;
    dword	GOTBH_charAttrRuns;
    dword	GOTBH_paraAttrRuns;
    dword	GOTBH_textStyleArray;
    dword	GOTBH_textGraphicElements;
    dword	GOTBH_textGraphicsTree;
} GrObjTransferBlockHeader} ;

typedef ByteFlags GrObjTiledDataFlags ;		/* CHECKME */
#define GOTDF_VAR_DATA 	(0x01)

typedef struct {		/* CHECKME */
    GrObjTiledDataFlags	GOTDD_tiledDataFlags;
    byte	GOTDD_protocol;
} GrObjTransferDataDirectory} ;

typedef struct {		/* CHECKME */
    EntryPointRelocation	GOEPR_fullRelocation;
    word	GOEPR_grObjEntryPoint;
} GrObjEntryPointRelocation} ;

typedef struct {		/* CHECKME */
    VMChainLink	VMLAGOR_link;
    GrObjEntryPointRelocation	VMLAGOR_relocation;
} VMLinkAndGrObjRelocation} ;

typedef ByteFlags GrObjBodyFlags ;		/* CHECKME */
/* 5 bits unused */
/*
 *  True if body has an action notification
 * od in its var data
 */
#define GBF_HAS_ACTION_NOTIFICATION 	(0x04)
/*
 * If true, GrObjBody will grab target
 * on vis open
 */
#define GBF_DEFAULT_TARGET 	(0x02)
/*
 * if true, GrObjBody will grab focus
 * on vis open
 */
#define GBF_DEFAULT_FOCUS 	(0x01)

typedef	WordFlags	GrObjBodyUnsuspendOps	;

/*-----------------------------------------------------------------------------
    GrObjBodyClass Defaults
-----------------------------------------------------------------------------*/

@default VI_optFlags = 0;
@default VI_typeFlags = ( VTF_IS_COMPOSITE | VTF_IS_INPUT_NODE );
@default VI_attrs = ( VA_DRAWABLE | VA_DETECTABLE | VA_FULLY_ENABLED );

/*-----------------------------------------------------------------------------
    GrObjBodyClass Instance Data, INSTANCE DATA, instance data
-----------------------------------------------------------------------------*/

@instance RectDWord GBI_bounds = {0,0,0,0};
@instance CompPart GBI_drawComp = {NullOptr};
@instance CompPart GBI_reverseComp = {NullOptr};
@instance word GBI_childCount;
@instance optr GBI_selectionArray;
@instance HierarchicalGrab GBI_targetExcl = {NullOptr, 0};
@instance HierarchicalGrab GBI_focusExcl = {NullOptr, 0};
@instance optr GBI_mouseGrab;
@instance word GBI_objBlockArray; /* = NullHandle;*/
@instance GrObjFunctionsActive GBI_defaultOptions;
@instance GrObjFunctionsActive GBI_currentModifiers;
@instance GrObjFunctionsActive GBI_currentOptions;
@instance GrObjBodyFlags GBI_flags = (GBF_DEFAULT_TARGET | GBF_DEFAULT_FOCUS);
@instance GrObjDrawFlags GBI_drawFlags = (GODF_DRAW_INSTRUCTIONS);
@instance GrObjFileStatus GBI_fileStatus;
@instance word GBI_graphicsState = 0;
@instance optr GBI_head;
@instance optr GBI_goam;
@instance optr GBI_ruler;
@instance word GBI_priorityList = 0;
@instance byte GBI_desiredHandleSize = DEFAULT_DESIRED_HANDLE_SIZE;
@instance byte GBI_curHandleWidth = 0;
@instance byte GBI_curHandleHeight = 0;
@instance BBFixed GBI_curNudgeX = {0, 0};
@instance BBFixed GBI_curNudgeY = {0, 0};
@instance PointWWFixed	GBI_curScaleFactor = {MakeWWFixed(1), MakeWWFixed(0)};
@instance PointDWFixed GBI_interestingPoint = {{0, -30000}, {0, -30000}};
@instance PointDWFixed GBI_lastPtr = {0,0};
@instance word	GBI_suspendCount = 0;
@instance GrObjBodyUnsuspendOps GBI_unsuspendOps = 0;
@instance VisTextNotificationFlags GBI_textUnsuspendOps = 0;
@instance word	GBI_reserved1 = 0;
@instance word	GBI_reserved2 = 0;

/*-----------------------------------------------------------------------------
;	GrObjBodyClass VarData
-----------------------------------------------------------------------------*/
@vardata GrObjActionNotificationStruct ATTR_GB_ACTION_NOTIFICATION;

typedef struct {
    word GOBPCBS_message;
    optr GOBPCBS_optr;
} GrObjBodyPasteCallBackStruct} ;

@vardata GrObjBodyPasteCallBackStruct ATTR_GB_PASTE_CALL_BACK;

@endc
/*-----------------------------------------------------------------------------
    GroupClass
-----------------------------------------------------------------------------*/

@class	GroupClass, GrObjClass;

/*-----------------------------------------------------------------------------
    GroupClass Methods
-----------------------------------------------------------------------------*/

typedef WordFlags GroupAddGrObjFlags ;		/* CHECKME */
/*
 * For Adding;
 * Position of center of object is
 * already relative to center of
 * group. Otherwise object center
 * is absolute and must be adjusted
 * when it is added.
 */
#define GAGOF_RELATIVE 	(0x8000)
#define GAGOF_REFERENCE 	(0x7fff)
#define GAGOF_REFERENCE_OFFSET 	0

#define GAGOF_FIRST  CCO_FIRST
#define GAGOF_LAST  CCO_LAST

@message void MSG_GROUP_ADD_GROBJ (optr grobjOD = cx:dx, GroupAddGrObjFlags flags = bp);
/*
 * 	Add a child to the group and generate an undo chain to undo the add
 *
 *  Context:	Group Utility
 *  Source:	Unrestricted
 *  Destination:  Group
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx:dx - optr of child to add
 * 	bp - GroupAddGrObjFlags
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GROUP_REMOVE_GROBJ (optr grobjOD = cx:dx);
/*
 * 	Remove the child from the group and generate and undo chain
 * 	for undoing the add.
 *
 *  Context:	Group Utility
 *  Source:	Unrestricted
 *  Destination:  Any group
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx:dx - optr of child to remove
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message GStateHandle MSG_GROUP_CREATE_GSTATE () = bp;
/*
 * 	Have a gstate created with the transformations of all groups
 * 	above it, plus its own
 *
 * PASS
 *  	nothing
 *
 * RETURN
 * 	bp - gstate
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {		/* CHECKME */
    optr	CBMD_callBackOD;
    word	CBMD_callBackMessage;
    optr	CBMD_groupOD;
    optr	CBMD_childOD;
    word	CBMD_extraData1;
    word	CBMD_extraData2;
} CallBackMessageData} ;

@message Boolean MSG_GROUP_PROCESS_ALL_GROBJS_SEND_CALL_BACK_MESSAGE (CallBackMessageData *data = ss:bp);
/*
 * 	For each child in group send call back message to
 * 	call back object with child's OD in cx:dx.
 * 	If call back message returns carry set it stops
 * 	processing children and returns ax,cx,dx,bp from call back.
 *
 * PASS
 * 	ss:bp - stack frame that starts with a CallBackMessageData structure
 *  	dx - size of struture on stack
 * 	     (dx must be passed even if using ObjCallInstanceNoLock or
 * 		calling from same thread)
 *
 * RETURN
 * 	clc - all children processed
 * 		ax,cx,dx,bp - same as passed
 * 	stc - not all children processed
 * 		ax,cx,dx,bp - from call back object message handler
 */

@message void MSG_GROUP_INITIALIZE ();
/*
 * 	Initialize the ObjectTransform of a group for expansion
 * 	The group is initialized with no width and height because these
 * 	will be calculated later based on the objects added
 * 	to it. The group's center is initialized a 0,0.
 * 	When the group is expanded (MSG_GROUP_EXPAND) the width and
 * 	height will be set so as to encompass all the children and
 * 	the group's center will be position correctly in the
 * 	middle of all the children.
 *
 *  Context:	Sent to group right after it has been instantiated
 *  Source:	Unrestricted
 *  Destination:  A newly instantiated group
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GROUP_EXPAND ();
/*
 * 	Expand and position a group to contain all its children.
 *
 *  Context:	Sent to group after children have been added. The
 * 		added children must have their positions relative to
 * 		the groups center. This message is usually used
 * 		in concert with MSG_GROUP_INITIALIZE.
 *  Source:	Unrestricted
 *  Destination:  A group
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message optr MSG_GROUP_INSTANTIATE_GROBJ (ClassStruct *class = cx:dx) = cx:dx; /*XXX */
/*
 *	Instantiate a grobject of the passed class in a block managed
 *	by the body that the group is associated with. This message
 *	is functionally equivalent to MSG_GB_INSTANTIATE_GROBJ, it merely
 *	simplies the creation of groups.
 *
 * Pass:
 *	fptr to class of object to instantiate
 *
 * Return:
 *	OD of new object
 *
 */
@message void MSG_GROUP_SET_HAS_PASTE_INSIDE_CHILDREN (Boolean bool = cl);
/*
 * 	Set whether group has paste inside children. Group uses it
 * 	to determine which drawing commands to send to its children.
 *
 *  Context:	Group Utility. Usually sent by body to newly
 * 		instantiated group while body is handling MSG_GB_PASTE_INSIDE
 *  Source:	Unrestricted
 *  Destination:  Any group
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - TRUE/FALSE
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GROUP_PASTE_CALL_BACK_FOR_PASTE_INSIDE (optr grobjOD = cx:dx);
/*
 * 	Add the child to the group as a paste inside child
 *
 *  Context:	Used with ATTR_GB_PASTE_CALL_BACK vardata in body. Each
 * 		object being pasted in will be sent to the group with
 * 		this message
 *  Source:	GrObjBody
 *  Destination:  Group
 *  Interception: Unlikely
 *
 * PASS:
 * 	^lcx:dx - od of new pasted grobject
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message GStateHandle MSG_GROUP_CREATE_GSTATE_FOR_BOUNDS_CALC () = bp;
/*
 * 	Create a gstate with no window and no body translation, but
 * 	includes the transformations of this group and all the ""
 * 	groups above it.
 *
 * PASS
 *  	nothing
 *
 * RETURN
 * 	bp - gstate
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GROUP_VIS_TEXT_GENERATE_NOTIFY (VisTextGenerateNotifyParams *params = ss:bp);
/*
 * 	Group equivalent of MSG_VIS_TEXT_GENERATE_NOTIFY, so that we
 * 	update the ui for text objects in selected group.
 *
 *  Context:	Sent to selected group when sending MSG_VIS_TEXT_GENERATE_NOTIFY
 * 		to the selected text objects
 *  Source:	Usually GrObjBody
 *  Destination:  Selected group
 *  Interception: Unlikely
 *
 * PASS:
 * 	same as MSG_VIS_TEXT_GENERATE_NOTIFY
 *
 * RETURN:
 * 	same as MSG_VIS_TEXT_GENERATE_NOTIFY
 *
 * DESTROYED:
 * 	same as MSG_VIS_TEXT_GENERATE_NOTIFY
 */

@message Boolean MSG_GROUP_CHECK_FOR_GROBJ_TEXTS ();
/*
 * 	Determine if there are any text objects in the group
 *
 *  Context:	Group Utility. Currently used as part of determining if there
 * 		are and selected text objects when deciding whether to
 * 		set the default text attrs.
 *  Source:	Unrestricted
 *  Destination:  Group
 *  Interception: unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	clc - no text objects in group
 * 	stc - at least one text object in group.
 *
 * DESTROYED:
 * 	ax
 */

typedef	ByteFlags GroupUnsuspendOps ;
#define GUO_EXPAND  0x01

@instance CompPart GI_drawHead;
@instance word GI_suspendCount;
@instance GroupUnsuspendOps GI_unsuspendOps;

@endc

/*-----------------------------------------------------------------------------
    PointerClass
-----------------------------------------------------------------------------*/

@class PointerClass, GrObjClass;

/*-----------------------------------------------------------------------------
    PointerClass Methods
-----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
    PointerClass Instance Data, INSTANCE DATA, instance data
-----------------------------------------------------------------------------*/

#define MIN_MARQUEE_DIMENSION  7
#define MAX_PRIORITY_LIST_ELEMENTS  5

typedef ByteFlags PointerModes ;
#define PM_HANDLES_RESIZE  0x04
#define PM_HANDLES_ROTATE  0x02
#define PM_POINTER_IS_ACTION_OBJECT  0x01

@instance PointerModes PTR_modes;

@endc

/*-----------------------------------------------------------------------------
    RotatePointerClass
-----------------------------------------------------------------------------*/

@class RotatePointerClass, PointerClass;
@endc

/*-----------------------------------------------------------------------------
    ZoomPointerClass
-----------------------------------------------------------------------------*/

@class ZoomPointerClass, PointerClass;
@endc

/*-----------------------------------------------------------------------------
    Rect Class
-----------------------------------------------------------------------------*/

@class RectClass, GrObjClass;
@endc

/*-----------------------------------------------------------------------------
    RoundedRect Class
-----------------------------------------------------------------------------*/

@class RoundedRectClass, RectClass;
@message void MSG_RR_SET_RADIUS (word radius = cx);
/*
 * 	Set the radius of the corner of the rounded rect in pts
 *
 *  Context:	RoundedRect Utility
 *  Source:	Unrestricted
 *  Destination:  RoundedRectClass
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx - radius
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message word MSG_RR_GET_RADIUS () = cx;
/*
 * 	Get the radius of the corner of the rounded rect in pts
 *
 *  Context:	RoundedRect Utility
 *  Source:	Unrestricted
 *  Destination:  RoundedRectClass
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	cx - radius
 *
 * DESTROYED:
 * 	ax
 */

@instance word RRI_radius;

@endc

/*-----------------------------------------------------------------------------
    Line Class
-----------------------------------------------------------------------------*/

@class LineClass, GrObjClass;

@endc

/*-----------------------------------------------------------------------------
    Arc Class
-----------------------------------------------------------------------------*/

@class ArcClass, GrObjClass;
@message void MSG_ARC_SET_START_ANGLE (WWFixed angle = dx.cx);
/*
 * 	Set the starting angle of the ellipse
 *
 *  Context:	Arc Utility
 *  Source:	Unrestricted
 *  Destination:  Unrestricted
 *  Interception: Unlikely
 *
 * PASS:
 * 	dx:cx - WWFixed angle
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_ARC_SET_END_ANGLE (WWFixed angle = dx.cx);
/*
 * 	Set the ending angle of the ellipse
 *
 *  Context:	Arc Utility
 *  Source:	Unrestricted
 *  Destination:  Unrestricted
 *  Interception: Unlikely
 *
 * PASS:
 * 	dx:cx - WWFixed angle
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_ARC_SET_ARC_CLOSE_TYPE (ArcCloseType type = cx);
/*
 * 	Set the ArcCloseType
 *
 *  Context:	Arc Utility
 *  Source:	Unrestricted
 *  Destination:  Unrestricted
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx - ArcCloseType
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_ARC_UNDO_REPLACE_ARC_GEOMETRY_INSTANCE_DATA (
    DBGroup group = dx,
    DBItem item = cx,
    VMFileHandle file = bp);
/*
 * 	Replace the arcs instance data with the passed ArcBasicInit data
 * 	as part of an undo operation. A new undo chain is generated first
 * 	so that this operation will be undoable.
 *
 *  Context:	Send by object to itself while handling MSG_META_UNDO
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	dx - DB group
 * 	cx - DB item
 * 	bp - VM file handle
 *
 * 	The referenced DBitem must contain a ArcBasicInit structure
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef struct {		/* CHECKME */
    ArcCloseType	ABI_arcCloseType;
    WWFixed		ABI_startAngle;
    WWFixed		ABI_endAngle;
    PointWWFixed	ABI_startPoint;
    PointWWFixed	ABI_endPoint;
    PointWWFixed	ABI_midPoint;
    WWFixed		ABI_radius;
} ArcBasicInit} ;

@message void MSG_ARC_REPLACE_ARC_GEOMETRY_INSTANCE_DATA (ArcBasicInit *initData = ss:bp);
/*
 * 	Replaces the arcs geometry related instance data with the
 * 	passed data.
 *
 *  Context:	During undo of most geometry operations
 *  Source:	Object itself
 *  Destination:  Object itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - ArcBasicInit
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@instance word AI_arcCloseType;
@instance WWFixed AI_startAngle;
@instance WWFixed AI_endAngle;
@instance PointWWFixed AI_startPoint;
@instance PointWWFixed AI_endPoint;
@instance PointWWFixed AI_midPoint;
@instance WWFixed AI_radius;

@endc

/*-----------------------------------------------------------------------------
    Gstring Class
-----------------------------------------------------------------------------*/

@class GStringClass, GrObjClass;

@message void MSG_GSO_SET_GSTRING (
    VMFileHandle	file = cx,
    VMBlockHandle	block = dx);
/*
 *  	Set the gstring object's gstring to the passed gstring.
 * 	Any existing gstring will be destroyed.
 *
 *
 *  Context:	Unrestricted
 *  Source:	Unrestricted
 *  Destination:  GString GrObject
 *  Interception: unlikely
 *
 *  PASS:
 * 	cx = VM file handle of gstring
 * 	dx = VM block handle of gstring
 *
 * 	If CX = 0,
 * 		The gstring MUST be in the vm file that the GString object
 * 		is in. The GString object will not make a copy of the
 * 		the gstring. The GString object will use the gstring directly
 * 		and will destroy the gstring and the gstrings data if a
 * 		new gstring is passed to the gstring object.
 * 		Make sure you fully understand the implications of this
 * 		before you do this.
 * 	ELSE
 * 		The passed gstring is copied into the GString objects
 * 		vm file and the GString object uses the copy
 *
 *  Return:
 * 	nothing
 *
 *  Destroyed:
 * 	ax
 */

@message void MSG_GSO_SET_GSTRING_FOR_1X_CONVERT ();
/*
 *  	Set the gstring object's gstring to the passed gstring.
 * 	Any existing gstring will be destroyed. This does special
 * 	geometry that is only required when converting a 1.x
 * 	gstring object
 *
 *
 *  Context:	Unrestricted
 *  Source:	Unrestricted
 *  Destination:  GString GrObject
 *  Interception: unlikely
 *
 *  PASS:
 * 	cx = VM file handle of gstring
 * 	dx = VM block handle of gstring
 *
 * 	If CX = 0,
 * 		The gstring MUST be in the vm file that the GString object
 * 		is in. The GString object will not make a copy of the
 * 		the gstring. The GString object will use the gstring directly
 * 		and will destroy the gstring and the gstrings data if a
 * 		new gstring is passed to the gstring object.
 * 		Make sure you fully understand the implications of this
 * 		before you do this.
 * 	ELSE
 * 		The passed gstring is copied into the GString objects
 * 		vm file and the GString object uses the copy
 *
 *  Return:
 * 	nothing
 *
 *  Destroyed:
 * 	ax
 */

@instance word GSI_vmemBlockHandle;
@instance PointWWFixed GSI_gstringCenterTrans;

@endc

/*-----------------------------------------------------------------------------
    GrObjVisGuardianClass
-----------------------------------------------------------------------------*/

@class GrObjVisGuardianClass, GrObjClass;

@message void MSG_GOVG_UPDATE_VIS_WARD_WITH_STORED_DATA ();
/*
 * 	Force the vis ward to reflect any attributes stored in
 * 	the guardian
 *
 *  Context:	Unrestricted. E.g., when the vis ward is created or
 * 		preparing to be edited.
 *  Source:	Unrestricted
 *  Destination:	Any GrObjVisGuardian
 *  Interception:	Must be intercepted by any GrObjVisGuardian with special
 * 		data. No default handler.
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_CONVERT_LARGE_MOUSE_DATA (); /* Needs prototype */
/*
 * 	Convert data in GrObjMouseData to LargeMouseData
 *
 * PASS
 * 		ss:cx - GrObjMouseData -
 * 				GOMD_point - in PARENT coords
 * 				GOMD_gstate - not used
 * 				GOMD_goFA -
 * 				GOMD_buttonInfo - from orig system mouse event
 * 		ss:bp - LargeMouseData - empty
 *
 * RETURN
 * 		ss:bp - LargeMouseData
 * 			LMD_point - in OBJECT coords of OVP
 * 			LMD_buttonInfo
 * 			LMD_uiFA
 *
 * WARNING: 	This routine takes data on two different areas
 * 		of the stack and it returns data on the stack so it
 * 		may only be called from the same thread
 * DESTROYED:
 * 	ax
 */

@message optr MSG_GOVG_CREATE_VIS_WARD (MemHandle wardBlock = cx) = cx:dx; 	/* XXX */
/*
 * 	Create vis object that is ward of guardian
 *
 *  Context:	Generally shortly after the guardian has been created
 *  Source:	The Guardian itself
 *  Destination:	The Guardian itself
 *  Interception:	Possible. If the ward has any special initialize that
 * 		needs to be done (eg MSG_SPLINE_INITIALIZE or setting
 * 		up the style arrays in the text object), it should
 * 		subclass this message, call its superclass and then
 * 		do any special initialization
 *
 * PASS
 * 	cx - block to put ward in
 *
 * RETURN
 * 	cx:dx - OD of ward
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_ADD_VIS_WARD (optr wardOD = cx:dx);
/*
 * 	Add vis object as ward of guardian
 *
 * PASS
 * 	cx:dx - od of ward
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_APPLY_OBJECT_TO_VIS_TRANSFORM (GStateHandle gstate = dx);
/*
 * 	Apply transformation from OBJECT coordinate system to
 * 	the VIS coordinate system
 *
 * 	This will transform VIS coordinates into OBJECT coordinates
 *
 * PASS
 * 	dx - gstate
 *
 * RETURN
 * 	dx - gstate
 *
 * DESTROYED:
 * 	ax
 */

@message GStateHandle MSG_GOVG_CREATE_GSTATE () = bp;
/*
 * 	Create a gstate for the ward with the transformation of the body,
 * 	all groups, and the guardian in it.
 *
 *
 *  Context:	Called when ward needs a gstate
 *  Source:	Vis ward
 *  Destination:	Any object vis guardian
 *  Interception:	Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURNS:
 * 	bp - gstate
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_VIS_BOUNDS_SETUP ();
/*
 * 	Time to initialize the bounds of the ward and perform any
 * 	related actions
 *
 *
 *  Context:	Usually called when guardian changes size.
 *  Source:	Unrestriced, usually the guardian itself
 *  Destination:	Any object vis guardian
 *  Interception:	Possibly. Probably will call the superclass first. The default
 * 		handler sets the ward's vis bounds to match the guardians
 * 		dimensions and then sends ward MSG_VIS_NOTIFY_GEOMETRY_VALID.
 * 		This causes the ward to do any recalculations, such as
 * 		rewrapping text	that it needs.
 *
 * PASS:
 * 	nothing
 *
 * RETURNS:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef ByteEnum VisWardMouseEventType ;		/* CHECKME */
#define VWMET_SMALL 	0x0
#define VWMET_LARGE 	0x1

@message void MSG_GOVG_SET_VIS_WARD_MOUSE_EVENT_TYPE (VisWardMouseEventTypes type = cl);
/*
 * 	Set type of mouse events that vis ward is interested in.
 *
 *
 *  Context:	Unrestricted. Generally sent when vis ward grabs mouse
 *  Source:	Unrestricted, usually vis ward
 *  Destination:	Any object vis guardian
 *  Interception:	Unlikely.
 *
 * PASS
 * 	cl - VisWardMouseEventTypes
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_UPDATE_EDIT_GRAB_WITH_STORED_DATA ();
/*
 * 	Send any stored data to the edit grab
 *
 *  Context:	Unrestricted. Usually sent to the floater by itself
 * 		when it gets a start select in an object to edit
 * 		preparing to be edited.
 *  Source:	Unrestricted
 *  Destination:	Any GrObjVisGuardian
 *  Interception:	Must be intercepted by any GrObjVisGuardian with special
 * 		data. No default handler.
 *
 * PASS
 * 	nothing
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_NORMALIZE ();
/*
 * 	Convert the object into a rectangle (not RectClass) and set
 * 	its GrObjTransMatrix as the Identity Matrix. The width
 * 	and height of the object will be rounded to the nearest integer
 *
 *  Context:	GrObjVisGuardian Utility. Generally only used during
 * 		handling of MSG_GO_COMPLETE_CREATE to remove the
 * 		scale from the GrObjTransMatrix and set the objects
 * 		width and height to the size of the rectangle the
 * 		user has created.
 *  Source:	Unrestricted. Generally the object itself.
 *  Destination:  Any GrObjVisGuardian
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_NOTIFY_VIS_WARD_CHANGE_BOUNDS (Rectangle *desiredBounds = ss:bp);
/*
 * 	Notify the guardian that the vis ward wishes to changes its
 * 	vis bounds.
 *
 *  Context:	Sent to guardian when some action if performed on
 * 		the ward that causes it to want to change its vis
 * 		bounds. Such as adding or deleting text or editing
 * 		spline bounds.
 *  Source:	Vis Ward
 *  Destination:  Guardian of ward changing bounds
 *  Interception: Possible. The default behaviour sets the OBJECT dimensions
 * 		to match the desired vis bounds. Sets the object's transform
 * 		to the identity matrix and moves the object the same amount
 * 		the center of the vis bounds moved by. Then it sets
 * 		the vis bounds of the ward to the desired size.
 *
 * PASS:
 * 	ss:bp - Rectangle, desired vis bounds
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message ClassStruct *MSG_GOVG_GET_EDIT_CLASS *() = cx:dx;
/*
 * 	Return the highest class that the guardian can be used to edit.
 * 	It is assumed that if a guardian can edit a class it can
 * 	edit all subclasses of that class. For example, MultTextGuardianClass
 * 	can edit both TextGuardianClass and MultTextGuardianClass.
 * 	TextGuardianClass class is the superclass of MultTextGuardianClass,
 * 	so the MultTextGuardianClass handler would return TextGuardianClass.
 *
 *
 *  Context:	GrObjVisGuardianUtility
 *  Source:	Unrestricted
 *  Destination:  GrObjVisGuardian
 *  Interception: The default handler returns the guardians class. If the
 * 		guardian can edit any of its superclasses, it needs to
 * 		intercept this message and not call its super class.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	cx:dx - fptr to class
 *
 * DESTROYED:
 * 	ax
 */

@message optr MSG_GOVG_GET_VIS_WARD_OD () = cx:dx;
/*
 * 	Return the output descriptor of the vis ward
 *
 *  Context:	GrObjVisGuardian Utility
 *  Source:	Unrestricted
 *  Destination:  Unrestricted
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	cx:dx - optr
 *
 * DESTROYED:
 * 	ax
 */

@message VMChain MSG_GOVG_GET_TRANSFER_BLOCK_FROM_VIS_WARD (GrObjTransferParams *params = ss:bp) = cx.dx;
/*
 * 	Request a transfer block from the ward
 *
 *  Context:	GrObjVisGuardian Utility
 *  Source:	Unrestricted
 *  Destination:  Unrestricted
 *  Interception: No default handler, so must handle for cut/copy/paste
 *
 * PASS:
 * 	VM override file set
 *
 * RETURN:
 * 	cx:dx - 32 bit identifier from ward
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_CREATE_WARD_WITH_TRANSFER ();
/*
 * 	Create a ward and pass it the passed 32 bit identifier
 *
 *  Context:	GrObjVisGuardian Utility
 *  Source:	Unrestricted
 *  Destination:  Unrestricted
 *  Interception: No default handler, so must handle for cut/copy/paste
 *
 * PASS:
 * 	VM override file set
 * 	cx:dx - 32 bit identifier from ward
 *
 * RETURN:	^lcx:dx - new ward
 *
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_SET_VIS_WARD_CLASS (ClassStruct _far *wardClass = cx:dx);
/*
 * 	Set the class of the vis ward. The class must be set before the
 * 	vis ward is created.
 *
 *  Context:	After creating guardian with MSG_GB_CREATE_GROBJ and
 * 		before sending MSG_GO_INITIALIZE to the guardian.
 *  Source:	Unrestricted.
 *  Destination:  Guardian
 *  Interception: Unlikely
 *
 * PASS:
 * 		cx:dx - fptr to class of vis ward
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message GStateHandle MSG_GOVG_APPLY_SPRITE_OBJECT_TO_VIS_TRANSFORM (GStateHandle gstate = dx) = dx;
/*
 * 	Apply transformation from Sprite OBJECT coordinate system to
 * 	the VIS coordinate system
 *
 * 	This will transform VIS coordinates into Sprite OBJECT coordinates
 *
 * PASS
 * 	dx - gstate
 *
 * RETURN
 * 	dx - gstate
 *
 * DESTROYED:
 * 	ax
 */

@message Boolean MSG_GOVG_CHECK_FOR_EDIT_WITH_FIRST_START_SELECT () = carry;
/*
 * 	Determine if floater should edit object with the start select that
 * 	selects the object for editing.
 *
 *  Context:	Sent to the floater that has just given the edit grab
 * 		to an object because the user clicked on the object.
 *  Source:	Floater
 *  Destination:  Floater
 *  Interception: The default hander returns carry set. If the floater
 * 		shouldn't edit the object with the start select then you
 * 		should return carry clear and not call the superclass.
 * 		For example, the beginner polyline and polycurve tools
 * 		normal add an anchor point when the user clicks on
 * 		the line of an existing spline.
 * 		But we don't want to add an anchor point
 * 		when the user is trying to choose the spline for editing.
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	carry set - edit object with the start select
 * 	carry clear - don't edit object with start select.
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_RULE_LARGE_START_SELECT_FOR_WARD (GrObjMouseData *data = ss:bp);
/*
 * 	Do any constrain/snap to grid of a start select before passing
 * 	the event to the Vis Ward
 *
 *  Context:	Sent to the guardian just before passing the mouse event
 * 		on the the vis ward.
 *  Source:	Self
 *  Destination:  Self
 *  Interception: The default handler does normal grobj constrain. Most classes
 * 		will subclass, since the desired mouse constraint behavior
 * 		across classes is apparently quite varied.
 *
 * PASS:
 * 	ss:[bp] - GrObjMouseData
 *
 * RETURN:
 * 	ss:[bp] - GrObjMouseData with ruled GOMD_point, if desired
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_RULE_LARGE_PTR_FOR_WARD (GrObjMouseData *data = ss:bp);
/*
 * 	Do any constrain/snap to grid of a ptr event before passing
 * 	the event to the Vis Ward
 *
 *  Context:	Sent to the guardian just before passing the mouse event
 * 		on the the vis ward.
 *  Source:	Self
 *  Destination:  Self
 *  Interception: The default handler does normal grobj constrain. Most classes
 * 		will subclass, since the desired mouse constraint behavior
 * 		across classes is apparently quite varied.
 *
 * PASS:
 * 	ss:[bp] - GrObjMouseData
 *
 * RETURN:
 * 	ss:[bp] - GrObjMouseData with ruled GOMD_point, if desired
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_RULE_LARGE_END_SELECT_FOR_WARD (GrObjMouseData *data = ss:bp);
/*
 * 	Do any constrain/snap to grid of an end select before passing
 * 	the event to the Vis Ward
 *
 *  Context:	Sent to the guardian just before passing the mouse event
 * 		on the the vis ward.
 *  Source:	Self
 *  Destination:  Self
 *  Interception: The default handler does normal grobj constrain. Most classes
 * 		will subclass, since the desired mouse constraint behavior
 * 		across classes is apparently quite varied.
 *
 * PASS:
 * 	ss:[bp] - GrObjMouseData
 *
 * RETURN:
 * 	ss:[bp] - GrObjMouseData with ruled GOMD_point, if desired
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GOVG_CLEAR_VIS_WARD_OD ();
/*
 * 	Set GOVGI_ward to zero
 *
 *  Context:	Sent by vis ward when it is handling MSG_META_FINAL_OBJ_FREE
 *  Source:	vis ward
 *  Destination:  vis ward's guardian
 *  Interception: No
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef ByteFlags GrObjVisGuardianFlags ;		/* CHECKME */
/*
 * If TRUE then the vis bounds of the
 * ward have changed since the last
 * time the bit was cleared. Each
 * guardian uses this bit differently
 * to help it determine when to
 * send out GOANT_RESIZE action notifs.
 */
#define GOVGF_VIS_BOUNDS_HAVE_CHANGED 	(0x80)

/*
 * if TRUE send large mouse
 * events to object. if FALSE send
 * small mouse events
 */
#define GOVGF_LARGE 	(0x40)

/* For future expansion */
#define GOVGF_UNUSED 	(0x20)

/* For future expansion */
#define GOVGF_ALSO_UNUSED 	(0x10)

/*
 * if True then you must send
 * MSG_GOVG_APPLY_OBJECT_TO_VIS_TRANSFORM
 * to the object, otherwise a utililty
 * routine can be used.
 */
#define GOVGF_APPLY_OBJECT_TO_VIS_TRANSFORM 	(0x08)

/*
 * if TRUE then floater can edit
 * existing objects in the document
 */
#define GOVGF_CAN_EDIT_EXISTING_OBJECTS 	(0x04)

typedef ByteEnum GrObjVisGuardianCreateMode ;		/* CHECKME */
/* New objects cannot be create with the guardian. */
#define GOVGCM_NO_CREATE 	0x0

/*
 * Creating a new object is handled by the guardian and
 * consists of dragging open a rectangular area. For example,
 * the text object.
 */
#define GOVGCM_GUARDIAN_CREATE 	0x0

/*
 * Creating a new object is handled by the ward and mouse
 * events during create should be sent to the ward. For example,
 * creating bitmap with pencil.
 */
#define GOVGCM_VIS_WARD_CREATE 	0x0

@instance optr GOVGI_ward;
@instance word *GOVGI_class;
@instance GrObjVisGuardianFlags   GOVGI_flags;

@endc

/*-----------------------------------------------------------------------------
    GrObjVisClass
-----------------------------------------------------------------------------*/
#define ObjDerefGrObjVis (obj) ObjDeref2(obj)

@class GrObjVisClass, VisClass, master, variant;

typedef struct {
    WWFixed    WWFC_y;
    WWFixed    WWFC_x;
} WWFixedCenter} ;

@message void MSG_GV_GET_WWFIXED_CENTER (WWFixedCenter retVal = bpaxdxcx);
/*
 * 	Get the WWFixed center of the visual bounds of the object
 *
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	dx:cx - WWFixed x of center
 * 	bp:ax - WWFixed y of center
 *
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GV_SET_GUARDIAN_LINK (optr guardianOD = cx:dx);
/*
 * 	Set guardian link to passed OD
 *
 *
 * PASS:
 * 	cx:dx - od of guardian
 *
 * RETURN:
 * 	nothing
 *
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GV_SET_VIS_BOUNDS (Rectangle *bounds = ss:bp);
/*
 * 	Set the visual bounds of the vis ward
 *
 *  Context:	Unrestricted.
 *  Source:	Unrestricted. Generally guardian
 *  Destination:  GrObjVis object
 *  Interception: Possible. The default handler sets the vis bounds using
 * 		standard VIS messages. Individual objects may have
 * 		an object specific message
 *
 * PASS:
 * 		ss:bp - Rectangle
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message ClassStruct *MSG_GV_GET_GROBJ_VIS_CLASS *() = cx:dx;
/*
 * 	Returns the class representing the object's "leaf" class
 * 	according to The GrObj.
 *
 *  Context:	Sent by the object to itself when writing to the transfer item
 * 		so that in case a subclassing library writes the transfer
 * 		item, then goes away, we still have some class we can paste.
 *  Source:	Likely the guardian of the object, probably in the
 * 		MSG_GO_CREATE_TRANSFER method.
 *  Destination:  Any clipboardable GrObjVis.
 *
 *  Interception: DO NOT INTERCEPT THIS MESSAGE. That's the whole point,
 * 		isn't it?
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	cx:dx - a class ptr recognized by GrObj
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GV_SET_REALIZED_AND_UPWARD_LINK (optr bodyOD = cx:dx);
/*
 * 	Set the object's realized bit and the upward link
 * 	to the body.
 *
 *  Context:	Sent when guardian is added to the body
 *  Source:	Guardian
 *  Destination:  Ward
 *  Interception: Unlikely
 *
 * PASS:
 * 		cx:dx - od of body
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_GV_CLEAR_REALIZED_AND_UPWARD_LINK ();
/*
 * 	Clear the object's realized bit and the upward link
 *
 *  Context:	Sent when guardian is removed from the body
 *  Source:	Guardian
 *  Destination:  Ward
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message optr MSG_GV_GET_GUARDIAN () = cx:dx;
/*
 * 	Return guardian of vis ward
 *
 *  Context:	GrObjVis Utility
 *  Source:	Unrestricted
 *  Destination:  GrObjVis
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	cx:dx - od of guardian
 */

@message word MSG_GV_GET_POTENTIAL_WARD_SIZE () = cx;
/*
 * 	Return the number of bytes that the ward can use up in
 *  	its block. This includess instance data, chunks and vardata, but ""
 * 	not data in other blocks created by this object.
 *
 *  Context:	Used to keep track of which document blocks can
 * 		have more objects added to them.
 *  Source:	Guardian
 *  Destination:  GrObjVis
 *  Interception: The default handler will calculate the instance data size,
 * 		but if your object allocates chunks or vardata in its
 * 		block it must subclass this message. Call the superclass
 * 		first and then add in your extra bytes
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	cx - size in bytes
 *
 * DESTROYED:
 * 	ax
 */

@instance optr GVI_guardian;

@endc

/*-----------------------------------------------------------------------------
    BitmapGuardianClass
-----------------------------------------------------------------------------*/

@class BitmapGuardianClass, GrObjVisGuardianClass;

@message void MSG_BG_SET_TOOL_CLASS (ClassStruct _far *toolClass = cx:dx);
/*
 * 	Store class of bitmap tool
 *
 *  Context:	BitmapGuardian Utility
 *  Source:	Unrestricted
 *  Destination:  BitmapGuardian
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx:dx - fptr to tool class
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef ByteEnum BitmapGuardianBitmapPointerActiveStatus ;		/* CHECKME */
#define BGBPAS_ACTIVE 	0x0
#define BGBPAS_INACTIVE 	0x0

@message void MSG_BG_SET_BITMAP_POINTER_ACTIVE_STATUS (
    BitmapGuardianBitmapPointerActiveStatus status = cl);
/*
 * 	Notify bitmap guardian whether there is an active BitmapPointer tool
 *
 *  Context:	When a BitmapPointer floater is created or destroyed,
 * 		it must notify the editing bitmap object,so the
 * 		bitmap knows whether to draw its real estate handles.
 * 		Also sent by object to itself when it loses the grab.
 *  Source: 	Unrestricted, usually the BitmapPointer or the object
 *  Destination:	Only BitmapGaurdians being edited
 *  Interception: Unlikely
 *
 *
 * PASS
 * 	cl - BitmapGuardianBitmapPointerActiveStatus
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_BG_REAL_ESTATE_HANDLE_HIT_DETECTION ();/* Needs Prototype */
/*
 * 	Determine if one of the real estate handles of the object would be hit
 * 	by the passed point
 *
 *  Context:	Usually called as direct action of user clicking with
 * 		the bitmap pointer tool.
 *  Source:	Unrestricted, generally the floater
 *  Destination:	Any BitmapGuardian object. The message will be ignored unless
 * 		both the GOTM_EDIT_INDICATOR_DRAWN and BGF_POINTER_ACTIVE
 * 		bits are set
 *  Interception:	Unlikely
 *
 * PASS
 * 	ss:bp - PointDWFixed in PARENT
 *
 * RETURN
 * 	al - EVALUATE_NONE - handles not hit
 * 		ah - destroyed
 * 	al - EVALUATE_HIGH - handle hit
 * 		ah - tranformFlags - only handle info applies
 *
 * 	dx - 0 ( blank EvaluatePositionNotes)
 *
 * DESTROYED:
 * 	see RETURN
 */

@message void MSG_BG_ACTIVATE_REAL_ESTATE_RESIZE (); 	/* Needs Prototype */
/*
 * 	Sets up object for real estate resize.
 *
 *  Context:	Usually called when user clicks on real estate resize handle
 *  Source:	Unrestricted, generally bitmap pointer object
 *  Destination:	BitmapGuardian that has edit grab
 *  Interception:	Unlikely
 */

@message void MSG_BG_JUMP_START_REAL_ESTATE_RESIZE (
    GrObjFunctionsActive fa = bp,
    GStateHandle gstate = dx);
/*
 * 	Jump starts resize by doing an activate, start and drag stuff
 *
 *  Context:	Quickly start an interactive resize. Usually called
 * 		when user clicks on resize handle
 *  Source:	Unrestricted, generally bitmap pointer object
 *  Destination:	BitmapGuardian that has edit grab
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	bp - GrObjFunctionsActive
 * 	dx - gstate or 0
 *
 * RETURN:
 *
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_BG_PTR_REAL_ESTATE_RESIZE (GrObjResizeMouseData *data = ss:bp);
/*
 * 	Sent to update position of mouse during an interactive resize
 *
 *
 *  Context:	During an interactive resize. This message
 * 		cooresponds to an MSG_META_PTR when the object is
 * 		in real estate resize mode
 *  Source:	Unrestricted, generally pointer object
 *  Destination:	BitmapGuardian that has edit grabbed and is being
 * 		real estate resized interactively
 *  Interception:	Unlikely
 *
 *
 *
 * PASS:
 * 	ss:bp = GrObjResizeMouseData
 * 		GORSMD_point - deltas to resize
 * 		GORSMD_gstate - gstate to draw with
 * 		GORSMD_goFA - GrObjFunctionsActive
 * 		GORSMD_anchor - anchored handle
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_BG_END_REAL_ESTATE_RESIZE (GrObjResizeMouseData *data = ss:bp);
/*
 * 	Sent to complete an interactive resize on an object
 *
 *
 *  Context:	At the end of an interactive resize. This message
 * 		cooresponds to an MSG_META_END_SELECT when the object is
 * 		in real estate resize mode
 *  Source:	Unrestricted, generally bitmap pointer object
 *  Destination:	BitmapGuardian with edit grab. If the
 * 		object is not currently being resized interactively
 * 		the message will be ignored.
 *  Interception:	Unlikely
 *
 *
 * PASS:
 * 	ss:bp = GrObjResizeMouseData
 * 		GORSMD_point - deltas to resize
 * 		GORSMD_anchor - anchored handle
 * 		GORSMD_grabbed - grabbed handle
 * 		GORSMD_gstate - gstate to draw with
 * 		GORSMD_goFA - GrObjFunctionsActive
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_BG_CREATE_VIS_BITMAP (
    word width = cx,
    word height = dx,
    GStateHandle gstring = bp);
/*
 * 	Sent to force the bitmap to allocate its vidmem
 *
 *
 * PASS:
 * 	cx,dx - width, height of bitmap to allocate
 * 	bp - gstring to initialize bitmap with (0 for none)
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message ClassStruct *MSG_BG_GET_TOOL_CLASS *() = cx:dx;
/*
 * 	Get stored class of bitmap tool
 *
 *  Context:	BitmapGuardian Utility
 *  Source:	Unrestricted
 *  Destination:  BitmapGuardian
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	cx:dx - fptr to tool class
 *
 * DESTROYED:
 * 	ax
 */

typedef ByteFlags BitmapGuardianFlags ;		/* CHECKME */
/*
 * if TRUE then the floater is a
 * BitmapPointer, so the bitmap
 * should display handles instead
 * of a dotted box for its edit indicator
 * and it should respond to clicks
 * on those handles. The BitmapPointer
 * is used for changing the bitmap
 * width and height.
 */
#define BGF_POINTER_ACTIVE 	(0x02)
/*
 * if TRUE then current resize
 * action is actually a real
 * estate resize
 */
#define BGF_REAL_ESTATE_RESIZE 	(0x01)

typedef ByteEnum VisWardToolActiveStatus ;		/* CHECKME */
#define VWTAS_ACTIVE 	0x0
#define VWTAS_INACTIVE 	0x0

typedef struct {		/* CHECKME */
    ClassStruct			*BGSID_toolClass;
    VisWardToolActiveStatus	BGSID_activeStatus;
} BitmapGuardianSpecificInitializationData} ;

@instance BitmapGuardianFlags BGI_flags;
@instance ClassStruct	*BGI_toolClass;

@endc

/*-----------------------------------------------------------------------------
    GrObjBitmapClass
-----------------------------------------------------------------------------*/

@class GrObjBitmapClass, GrObjVisClass;
/*	@uses VisBitmapClass;	when bitmap has C interface */
@endc

/*-----------------------------------------------------------------------------
    SplineGuardianClass
-----------------------------------------------------------------------------*/

@class SplineGuardianClass, GrObjVisGuardianClass;

@message void MSG_SG_SET_SPLINE_MODE (SplineGuardianMode mode = cl);
/*
 * 	Set the instance data in the guardian regarding Spline mode and
 * 	forward the info to the ward, if necessary.
 *
 *  Context:	Spline Guardian utility
 *  Source: 	Unrestricted
 *  Destination:	Any SplineGuardian
 *  Interception: Unlikely
 *
 *
 * PASS
 * 	cl - SplineGuardianMode
 *
 * RETURN
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_SG_GENERATE_SPLINE_NOTIFY (
    SplineGenerateNotifyParams *params = ss:bp);
/*
 * 	If relayed bit is set, then pass the message on down to the ward,
 * 	otherwise pass it up to the body.
 *
 *  Context:	Unrestricted.
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - SplineGenerateNotifyParams
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_SG_SWITCH_TO_SPLINE_CREATE_MODE ();
/*
 * 	Use SplineMode stored in SGI_splineCreateMode.
 *
 *  Context:	Unrestricted. Generally sent by object to itself when
 * 		handling MSG_GO_BEGIN_CREATE.
 *  Source:	Unrestricted
 *  Destination:  SplineGuardian
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_SG_SWITCH_TO_SPLINE_AFTER_CREATE_MODE ();
/*
 * 	Use SplineMode stored in SGI_splineAfterCreateMode if the
 * 	SGI_splineMode field is one of the splines create modes.
 *
 *
 *  Context:	Unrestricted. Generally sent by object to itself when it
 * 		receives a double click.
 *  Source:	Unrestricted
 *  Destination:  SplineGuardian
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_SG_SET_SPLINE_CREATE_AND_AFTER_CREATE_MODES ();
/*
 * 	Set SGI_splineAfterCreateMode and SGI_splineCreateMode.
 *
 *  Context:	Unrestricted. Generally sent to object by floater when
 * 		the floater is handling
 * 		MSG_GOVG_UPDATE_EDIT_GRAB_WITH_STORED_DATA
 *  Source:	Unrestricted
 *  Destination:  SplineGuardian
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@instance byte SGI_splineCreateMode;
@instance byte SGI_splineAfterCreateMode;
@instance byte SGI_splineMode;

@endc

/*-----------------------------------------------------------------------------
    GrObjSplineClass
-----------------------------------------------------------------------------*/

@class GrObjSplineClass, GrObjVisClass;
/*	@uses VisSplineClass;	when spline has C interface */
@endc

/*-----------------------------------------------------------------------------
    TextGuardianClass
-----------------------------------------------------------------------------*/

@class TextGuardianClass, GrObjVisGuardianClass;

@message void MSG_TG_CALC_DESIRED_MIN_HEIGHT ();	/* XXX */
/*
 * 	Calculate and set the TGI_desiredMinHeight field in the text guardian
 * 	object based on the current OBJECT height
 *
 *  Context:	TextGuardian Utility. Usually sent at the end of an
 * 		interactive resize or create.
 *  Source:	Unrestricted. Usually TextGuardian itself
 *  Destination:  Unrestricted. Usually TextGuardian itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_TG_SET_DESIRED_MIN_HEIGHT (word height = cx);
/*
 * 	Set the TGI_desiredMinHeight field in the text guardian object.
 *
 *  Context:	Unrestricted. Usually sent as result of
 * 		MSG_TG_CALC_DESIRED_MIN_HEIGHT
 *  Source:	Unrestricted. Usually TextGuardian itself
 *  Destination:  Unrestricted. Usually TextGuardian itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx - height in points
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_TG_HEIGHT_NOTIFY (word desiredHeight = dx);
/*
 * 	Adjust the height of the guardian and ward
 *
 *
 *  Context:	The ward received MSG_VIS_TEXT_HEIGHT_NOTIFY
 *  Source:	GrObjText vis ward
 *  Destination:  TextGuardian
 *  Interception: Unlikely
 *
 * PASS:
 * 		dx - height text object wants to be.
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_TG_GENERATE_TEXT_NOTIFY (
    VisTextGenerateNotifyParams *params = ss:bp);
/*
 * 	If relayed bit is set, then pass the message on down to the ward,
 * 	otherwise pass it up to the body.
 *
 *  Context:	Unrestricted.
 *  Source:	Unrestricted
 *  Destination:  GrObjBody
 *  Interception: Unlikely
 *
 * PASS:
 * 	ss:bp - VisTextGenerateNotifyParams
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_TG_CALC_DESIRED_MAX_HEIGHT ();	/* XXX */
/*
 * 	Calculate and set the TGI_desiredMaxHeight field in the text guardian
 * 	object based on the current OBJECT height
 *
 *  Context:	TextGuardian Utility. Usually sent at the end of an
 * 		interactive resize or create.
 *  Source:	Unrestricted. Usually TextGuardian itself
 *  Destination:  Unrestricted. Usually TextGuardian itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	nothing
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_TG_SET_DESIRED_MAX_HEIGHT (word desiredHeight = cx);
/*
 * 	Set the TGI_desiredMaxHeight field in the text guardian object.
 *
 *  Context:	Unrestricted. Usually sent as result of
 * 		MSG_TG_CALC_DESIRED_MAX_HEIGHT
 *  Source:	Unrestricted. Usually TextGuardian itself
 *  Destination:  Unrestricted. Usually TextGuardian itself
 *  Interception: Unlikely
 *
 * PASS:
 * 	cx - height in points
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@message void MSG_TG_SET_TEXT_GUARDIAN_FLAGS (
                TextGuardianFlags flagsToSet = cl,
                TextGuardianFlags flagsToReset = dl); /* XXX */
/*
 * 	Set the text guardian flags
 *
 *  Context:	Text Guardian Utility
 *  Source:	Unrestricted
 *  Destination:  Text Guardian
 *  Interception: Unlikely
 *
 * PASS:
 * 	cl - TextGuardianFlags to set
 * 	dl - TextGuardianFlags to reset
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

typedef ByteFlags TextGuardianFlags ;		/* CHECKME */
/* 3 bits unused */
/*
 * If TRUE then text object
 * will not shrink below
 * the desiredMinHeight while
 * it is being edited or when
 * some attribute changes
 */
#define TGF_ENFORCE_DESIRED_MIN_HEIGHT 	(0x10)

/*
 * If TRUE then text object
 * will not expand above
 * the desiredMaxHeight while
 * it is being edited or when
 * some attribute changes
 */
#define TGF_ENFORCE_DESIRED_MAX_HEIGHT 	(0x08)

/*
 * If TRUE, text object
 * can grow beyond
 * desiredMaxHeight during
 * editing, but when the
 * object stops be edited
 * it will shrink back to
 * desiredMaxHeight.
 * Meaningless if
 * TGF_ENFORCE_DESIRED_MAX_HEIGHT
 * is not set.
 */
#define TGF_DISABLE_ENFORCED_DESIRED_MAX_HEIGHT_WHILE_EDITING 	(0x04)

/*
 * If TRUE, then during resize
 * don't allow text
 * object to become shorter
 * than is necessary to display
 * all the text.
 */
#define TGF_ENFORCE_MIN_DISPLAY_SIZE 	(0x02)

/*
 * If TRUE then when the
 * text object loses the
 * edit grab shrink
 * the width to minimum
 * needed to
 * hold the text. Used when
 * user clicks and releases
 * in the same spot to
 * create.
 */
#define TGF_SHRINK_WIDTH_TO_MIN_AFTER_EDIT 	(0x01)

@instance TextGuardianFlags TGI_flags;
@instance word TGI_desiredMinHeight;
@instance word TGI_desiredMaxHeight;

@endc

/*-----------------------------------------------------------------------------
    MultTextGuardianClass
-----------------------------------------------------------------------------*/

@class MultTextGuardianClass, TextGuardianClass;
@endc

/*-----------------------------------------------------------------------------
    EditTextGuardianClass
-----------------------------------------------------------------------------*/

@class EditTextGuardianClass, TextGuardianClass;
@endc

/*-----------------------------------------------------------------------------
    GrObjTextClass
-----------------------------------------------------------------------------*/
@class GrObjTextClass, GrObjVisClass;

    @uses VisTextClass;

@message void MSG_GT_ADJUST_MARGINS_FOR_LINE_WIDTH (WWFixed thickness = dx.cx);
/*
 * 	Change the margins of the text object so that the test won't
 * 	collide with the line drawn around it.
 *
 *  Context:	Unrestricted. Usually sent when line attributes change
 *  Source:	Unrestricted. Generally TextGuardian
 *  Destination:  Any GrObjText
 *  Interception: Unlikely
 *
 * PASS:
 * 	dx:cx - WWFixed line thickness
 *
 * RETURN:
 * 	nothing
 *
 * DESTROYED:
 * 	ax
 */

@endc

/*-----------------------------------------------------------------------------
    GrObj External Declarations
-----------------------------------------------------------------------------*/
extern void
    _pascal GrObjBodyProcessAllGrObjsInDrawOrderCommon (optr grobjBody,
                           ObjCompCallType callType,
                           Message message,
                           word param1,
                           word param2,
                           word param3,
                           word *ax_return,
                           word *cx_return,
                           word *dx_return,
                           word *bp_return);

extern void
    _pascal GrObjBodyProcessSelectedGrObjsCommon (optr grobjBody,
                     Message message,
                     word param1,
                     word param2,
                     word param3,
                     word *ax_return,
                     word *cx_return,
                     word *dx_return,
                     word *bp_return);
extern void
    _pascal GrObjBodyProcessSelectedGrObjsCommonPassFlag (optr grobjBody,
                     Message message,
                     word param1,
                     word param2,
                     word param3,
                     ObjCompCallType flag,
                     word *ax_return,
                     word *cx_return,
                     word *dx_return,
                     word *bp_return);

extern void
    _pascal GrObjGetSpriteOBJECTDimensions (optr spriteObject,
                    WWFixed *spriteWidth,
                    WWFixed *spriteHeight);

extern void
    _pascal GrObjGetAbsSpriteOBJECTDimensions (optr spriteObject,
                    WWFixed *spriteWidth,
                    WWFixed *spriteHeight);

extern void
    _pascal GrObjGetNormalOBJECTDimensions (optr normalObject,
                    WWFixed *normalWidth,
                    WWFixed *normalHeight);

extern void
    _pascal GrObjCalcCorners (WWFixed objectWidth,
            WWFixed objectHeight,
            sword *negWidthOver2,
            sword *negHeightOver2,
            sword *posWidthOver2,
            sword *posHeightOver2,
            GStateHandle gstate);

extern void
    _pascal GrObjResizeSpriteRelativeToSprite (optr spriteObject,
                      word grObjHandleSpec,
                      PointDWFixed *objectDeltaResize);

extern optr
        _pascal GrObjGetBodyOD (Segment grobjSeg);

extern void
        _pascal GrObjMessageToBody (
            Segment grobjSeg,
            Message msg,
            word cx_param,
            word dx_param,
            word bp_param);

extern word
    _pascal GrObjBodySetGrObjDrawFlagsForDraw (
                optr grobjBody,
                word drawFlags);

typedef struct {
    word	LWAHD_maxLineWidth;
    byte	LWAHD_handleWidth;
    byte	LWAHD_handleHeight;
} LineWidthAndHandleDims} ;

extern LineWidthAndHandleDims
    _pascal GrObjGetCurrentHandleSize (Segment grobjSeg);
/*
 * Description:	Returns the current handle size and maximum line width
 *
 * Pass: 	grobjSeg - segment containing a GrObj
 *
 * Return:	current handle size and max line width
 */

extern void
    _pascal GrObjDrawOneHandle (
            optr grobjOD,
            GrObjHandleSpecification handleSpec,
            GStateHandle gstate,
            word handleWidth,
            word handleHeight);
/*
 * Description: Draw a selection/move handle
 *
 * Pass:	optr - OD of GrObj
 *		handleSpec - GrObjHandleSpecification for the handle you
 *			     wish to draw
 *		gstate - GState to draw handle to
 *		handleWidth - width of handle
 *		handleHeight - height of handle
 *
 * Return:	void
 */

typedef struct {
    word    NU_x;
    word    NU_y;
} NudgeUnits} ;

extern NudgeUnits
    _pascal GrObjGetCurrentNudgeUnits (Segment grobjSeg);
/*
 * Description:	Get the current nudge values. These represent the
 *		number of points that currently equal one screen pixel
 *		in x and y
 *
 * Pass:	grobjSeg - segment containing a GrObj
 *
 * Return:	Current amount to nudge in either direction
 */

extern void
    _pascal GrObjDraw32BitRect (
            RectDWord _far *rect,
            GStateHandle gstate);
/*
 * Description:	Draw a rectangle from 32 bit coordinates
 *
 * Pass:	rect - RectDWord to draw
 *		gstate - gstate to draw rectangle to
 *
 * Return:	void
 */

extern void
    _pascal GrObjBodyParseGString (
            optr bodyOD,
            VMFileHandle gstringFile,
            VMBlockHandle gstringBlock,
            PointDWFixed _far *origin);
/*
 * Description:	Just take the whole gstring and cram it into one gstring object
 *
 *	NOTE:******
 *	The caller must	have explicity set or cleared ATTR_GB_PASTE_CALL_BACK
 *	before calling this routine.
 *
 * Pass:	optr - OD of GrObjBody
 *		gstringFile - VMFileHandle of file containing GString
 *		gstringBlock - VMBlockHandle within gstringFile of GString
 *		origin - location to center GString
 *
 * Return:	void
 */

extern void
    _pascal SplineGuardianTransformSplinePoints (optr guardianOD);
/*
 * Description:	Transform spline points by the scale factor from the
 *		vis bounds to the object dimensions.
 *
 * Pass:	optr - OD of the SplineGuardian
 *
 * Return:	void
 */

extern Boolean
    _pascal GrObjApplyNormalTransform (optr grobjOD,	GStateHandle gstate);
/*
 * Description:	Apply normal transform information to passed gstate
 *
 * Pass:	optr - OD of GrObj
 *		gstate - gstate to apply transform to
 *
 * Return:	true if GrObjTransMatrix of passed GrObj was the
 *		identity matrix
 */

extern optr
    _pascal GrObjTestSupportedTransferFormats (ClipboardItemFlags cif);
/*
 * Description:	Tests for "pasteable" formats on the clipboard
 *
 * Pass:	cif - ClipboardItemFlags (CIF_QUICK is the important one)
 *
 * Return:	owner of transfer item (null if no compatible transfer format
 *		available
 */

#ifdef __HIGHC__

pragma Alias (GrObjBodyProcessAllGrObjsInDrawOrderCommon,
          "GROBJBODYPROCESSALLGROBJSINDRAWORDERCOMMON");
pragma Alias (GrObjBodyProcessSelectedGrObjsCommon,
          "GROBJBODYPROCESSSELECTEDGROBJSCOMMON");
pragma Alias (GrObjBodyProcessSelectedGrObjsCommonPassFlag,
          "GROBJBODYPROCESSSELECTEDGROBJSCOMMONPASSFLAG");
pragma Alias (GrObjGetSpriteOBJECTDimensions,
          "GROBJGETSPRITEOBJECTDIMENSIONS");
pragma Alias (GrObjGetAbsSpriteOBJECTDimensions,
          "GROBJGETABSSPRITEOBJECTDIMENSIONS");
pragma Alias (GrObjGetNormalOBJECTDimensions,
          "GROBJGETNORMALOBJECTDIMENSIONS");
pragma Alias (GrObjResizeSpriteRelativeToSprite,
          "GROBJRESIZESPRITERELATIVETOSPRITE");
pragma Alias (GrObjCalcCorners, "GROBJCALCCORNERS");
pragma Alias (GrObjGetBodyOD, "GROBJGETBODYOD");
pragma Alias (GrObjMessageToBody, "GROBJMESSAGETOBODY");
pragma Alias (GrObjBodySetGrObjDrawFlagsForDraw,
                "GROBJBODYSETGROBJDRAWFLAGSFORDRAW");
pragma Alias (GrObjGetCurrentHandleSize, "GROBJGETCURRENTHANDLESIZE");
pragma Alias (GrObjDrawOneHandle, "GROBJDRAWONEHANDLE");
pragma Alias (GrObjGetCurrentNudgeUnits, "GROBJGETCURRENTNUDGEUNITS");
pragma Alias (GrObjDraw32BitRect, "GROBJDRAW32BITRECT");
pragma Alias (GrObjBodyParseGString, "GROBJBODYPARSEGSTRING");
pragma Alias (SplineGuardianTransformSplinePoints,
        "SPLINEGUARDIANTRANSFORMSPLINEPOINTS");
pragma Alias (GrObjApplyNormalTransform, "GROBJAPPLYNORMALTRANSFORM");
pragma Alias (GrObjTestSupportedTransferFormats,
        "GROBJTESTSUPPORTEDTRANSFERFORMATS");

#endif /* __HIGHC__ */

@endlib


gstring.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gstring.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines graphics string structures and routines.
 *
 *	$Id: gstring.h,v 1.39.4.2 97/09/02 16:18:37 jwu Exp $
 *
 ***********************************************************************/

#ifndef	__GSTRING_H
#define __GSTRING_H

#include  <graphics.h>

typedef void GString ;

/***/

typedef WordFlags GSControl ;
#define GSC_PARTIAL 		0x0200
#define GSC_ONE 			0x0100
#define GSC_MISC 		0x0080
#define GSC_LABEL 		0x0040
#define GSC_ESCAPE 		0x0020
#define GSC_NEW_PAGE 		0x0010
#define GSC_XFORM 		0x0008
#define GSC_OUTPUT 		0x0004
#define GSC_ATTR 		0x0002
#define GSC_PATH 		0x0001

typedef enum /* word */  {
GSRT_COMPLETE 	=0,
GSRT_ONE    	=1,
GSRT_MISC   	=2,
GSRT_LABEL   	=3,
GSRT_ESCAPE 	=4,
GSRT_NEW_PAGE 	=5,
GSRT_XFORM  	=6,
GSRT_OUTPUT 	=7,
GSRT_ATTR 	=8,
GSRT_PATH 	=9,
GSRT_FAULT 	=0xffff
} GSRetType} ;

/***/

extern GSRetType	/*XXX*/
    _pascal GrDrawGString (GStateHandle gstate, GStateHandle gstringToDraw, sword x,
         sword y, GSControl flags, word *lastElement);

/***/

extern GSRetType	/*XXX*/
    _pascal GrDrawGStringAtCP (GStateHandle gstate, GStateHandle gstringToDraw,
             GSControl flags, word *lastElement);

/***/

extern void	/*XXX*/
    _pascal GrParseGString (GStateHandle gstate, GStateHandle gstringToDraw,
             GSControl flags, Boolean _pascal(*callback) /* TRUE to stop */
                              (void *element, GStateHandle gstate));

/***/

typedef ByteEnum GStringSetPosType ;
#define GSSPT_SKIP_1  0
#define GSSPT_RELATIVE  1
#define GSSPT_BEGINNING  2
#define GSSPT_END  3

extern void	/*XXX*/
    _pascal GrSetGStringPos (GStateHandle gstate, GStringSetPosType type, word skip);

/***/

extern GSRetType	/*XXX*/
    _pascal GrCopyGString (GStateHandle source, GStateHandle dest, GSControl flags);

/***/

extern Boolean	/*XXX*/
    _pascal GrGetGStringBounds (Handle gstring, GStateHandle gstate,
               GSControl flags, Rectangle _far *bounds);

/***/

extern void 	/*XXX*/
    _pascal GrGetGStringBoundsDWord (Handle gstring, GStateHandle gstate,
               GSControl flags, RectDWord _far *bounds);

/***/

typedef ByteEnum GStringKillType ;
#define GSKT_KILL_DATA  0
#define GSKT_LEAVE_DATA  1

extern void
    _pascal GrDestroyGString (GStateHandle gstring, GStateHandle gstate,
             GStringKillType type);

/***/

typedef ByteEnum GStringType ;
#define GST_CHUNK  0
#define GST_STREAM  1
#define GST_VMEM  2
#define GST_PTR  3
#define GST_PATH  4

extern GStateHandle	/*XXX*/
    _pascal GrLoadGString (Handle han, GStringType hanType, word vmBlock);

/***/

extern GStateHandle	/*XXX*/
    _pascal GrEditGString (Handle vmFile, word vmBlock);

/***/

extern GStateHandle	/*XXX*/
    _pascal GrCreateGString (Handle han, GStringType hanType, word _far *vmBlock);

/***/

extern GStringElement	/*XXX*/
    _pascal GrGetGStringElement (GStateHandle gstate, GStateHandle gstring, word bufSize, void *buffer, word *elSize);

/***/

extern void	/*XXX*/
    _pascal GrDeleteGStringElement (GStateHandle gstate, word count);

/***/

extern void	/*XXX*/
    _pascal GrLabel (GStateHandle gstate, word label);

/*
 *	Graphic String Constants
 */

#define GR_FIRST_SYSTEM_ESCAPE 		0x0000
#define GR_LAST_SYSTEM_ESCAPE 		0x3fff
#define GR_FIRST_GEOWORKS_ESCAPE 		0x4000
#define GR_LAST_GEOWORKS_ESCAPE 		0x7fff
#define GR_FIRST_APPLICATION_ESCAPE 	0x8000
#define GR_LAST_APPLICATION_ESCAPE 	0xffff

#ifdef __HIGHC__
pragma Alias(GrDrawGString, "GRDRAWGSTRING");
pragma Alias(GrDrawGStringAtCP, "GRDRAWGSTRINGATCP");
pragma Alias(GrSetGStringPos, "GRSETGSTRINGPOS");
pragma Alias(GrCopyGString, "GRCOPYGSTRING");
pragma Alias(GrDestroyGString, "GRDESTROYGSTRING");
pragma Alias(GrLoadGString, "GRLOADGSTRING");
pragma Alias(GrCreateGString, "GRCREATEGSTRING");
pragma Alias(GrEditGString, "GREDITGSTRING");
pragma Alias(GrGetGStringElement, "GRGETGSTRINGELEMENT");
pragma Alias(GrGetGStringBounds, "GRGETGSTRINGBOUNDS");
pragma Alias(GrGetGStringBoundsDWord, "GRGETGSTRINGBOUNDSDWORD");
pragma Alias(GrLabel, "GRLABEL");
pragma Alias(GrDeleteGStringElement, "GRDELETEGSTRINGELEMENT");
pragma Alias(GrParseGString, "GRPARSEGSTRING");
#endif

/* This is the first cut at the gstring macros.                        */
/* There are currently spurious warnings because several constants are */
/* redefined in decimal. This must be done because goc can't parse hex */

/*
 * 	NOTE TO FOLKS MAKING CHANGES/FIXES
 *
 * in general, if the macros generate too many or too few chars, the
 * graphics system will crash. This will happen if the macros do not
 * format their args as they should (e.g. formatting a word as a char).
 * If the thing comes up, but is strange looking,
 * it is probably due to the data being formatted incorectly -- e.g.
 * two fields being reversed.
 */

#define GOC_OR (a,b) 	((a)|(b))
#define GOC_WORD (a)   	((a)&0xff),(((a)&0xff00)>>8)
#define GOC_SW (a)   	GOC_WORD(a)

/* to truncate the fractional part, cast the float to an int.             */
/* to get the fractional part's representation, multiply the float by 256 */

/* only used for track kerning.        			    *NOT_TESTED* */
#define GOC_BBF (a)  (((int)(((a)-(int)(a))*256))&0xff),(((int)(a))&0xff)

/* 8 bits fraction, 16 bits integer 		TESTED in GSSetFont*/

#define GOC_WBF (a) (((int)(((a)-(int)(a))*256))&0xff),GOC_WORD(((int)(a))&0xffff)

/* 16 bits fraction, 16 bits integer.    	TESTED in GSApplyRotation  */

#define GOC_WWF (a) GOC_WORD(((int)(((a)-(int)(a))*65536))&0xffff),GOC_WORD(((int)(a))&0xffff)

/* 32 bits fraction, 16 bits integer.	    	    	    	    */
#define GOC_DWF (a) GOC_WORD(((int)(((a)-(int)(a))*65536))&0xffff),GOC_WORD(((int)(a))&0xffff), GOC_WORD(((long)(a))>>16)

/* Two word quantity. 			TESTED for GSApplyTranslationDWord */
#define GOC_SDW (a) GOC_WORD((a)&0xffff),GOC_WORD(((long)(a)>>16)&0xffff)

/* optr */        			               /*NOT_TESTED*/
#define GOC_OPTR (a) GOC_SDW(a)

#define GOC_PATTERN (a) GOC_WORD(a)

#define GOC_POINT (x,y) GOC_SW(x), GOC_SW(y)

/*  NOTE:  the gstring opcode structures defined below have
           *NOT* been tested yet */

/* this opcode is null */

typedef struct {
    GStringElement	OEGS_opcode;	/* GR_END_GSTRING */
} OpEndGString} ;

#define GSEndString () 					/*TESTED*/ 	\
    GR_END_GSTRING

typedef struct {
    GStringElement	OP_opcode;	/* GR_LABEL */
} OpLabel} ;

#define GSLabel (w) 							\
  GR_LABEL,GOC_WORD(w)

typedef struct {
    GStringElement	OSS_opcode;	/* GR_SAVE_STATE */
} OpSaveState} ;

#define GSSaveState ()  					/*TESTED*/	\
    GR_SAVE_STATE

typedef struct {
    GStringElement	ORS_opcode;
} OpRestoreState} ;			/* GR_RESTORE_STATE */

#define GSRestoreState ()				/*TESTED*/\
    GR_RESTORE_STATE

typedef struct {
    GStringElement	OST_opcode;	/* GR_SAVE_TRANSFORM */
} OpSaveTransform} ;

#define GSSaveTransform ()						\
    GR_SAVE_TRANSFORM

typedef struct {
    GStringElement	ORT_opcode;	/* GR_RESTORE_TRANSFORM */
} OpRestoreTransform} ;

#define GSRestoreTransform () 						\
    GR_RESTORE_TRANSFORM

typedef struct {
    GStringElement	ONP_opcode;	/* GR_NEW_PAGE */
    PageEndCommand  ONP_pageEnd;
} OpNewPage} ;

#define GSNewPage (pageEndCommand)					\
    GR_NEW_PAGE,(pageEndCommand)

typedef struct {
    GStringElement	OE_opcode;	/* GR_ESCAPE */
    word            OE_escCode;
    word            OE_escSize;
} OpEscape} ;

#define GSEscape (esc_w,size_w)						\
    GR_ESCAPE,GOC_WORD(esc_w),GOC_WORD(size_w)

typedef struct {
    GStringElement	OC_opcode;	/* GR_COMMENT */
    word            OC_size;
} OpComment} ;

#define GSComment (size_b)						\
     GR_COMMENT, GOC_WORD(size_b)

typedef struct {
    GStringElement	OSGSB_opcode;	/* GR_SET_GSTRING_BOUNDS */
    word            OSGSB_x1;
    word            OSGSB_y1;
    word            OSGSB_x2;
    word            OSGSB_y2;
} OpSetGStringBounds} ;

#define GSSetGStringBounds (x1_w,y1_w,x2_w,y2_w)				\
    GR_SET_GSTRING_BOUNDS,GOC_SW(x1_w),GOC_SW(y1_w),		\
    GOC_SW(x2_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	ONO_opcode;	/* GR_NULL_OP */
} OpNullOp} ;

#define GSNullOp () 					/*TESTED*/  	\
     GR_NULL_OP

typedef struct {
    GStringElement	OAR_opcode;	/* GR_APPLY_ROTATION */
    WWFixed         OAR_angle;
} OpApplyRotation} ;

#define GSApplyRotation (angle_f)			/*TESTED*/  	\
    GR_APPLY_ROTATION,GOC_WWF(angle_f)

typedef struct {
    GStringElement	OAS_opcode;	/* GR_APPLY_SCALE */
    WWFixed         OAS_xScale;
    WWFixed         OAS_yScale;
} OpApplyScale} ;

#define GSApplyScale (x_f,y_f)				/*TESTED*/  	\
            GR_APPLY_SCALE,GOC_WWF(x_f),GOC_WWF(y_f)

typedef struct {
    GStringElement	OAT_opcode;	/* GR_APPLY_TRANSLATION */
    WWFixed         OAT_x;
    WWFixed         OAT_y;
} OpApplyTranslation} ;

#define GSApplyTranslation (x_f,y_f)			/*TESTED*/  	\
    GR_APPLY_TRANSLATION,GOC_WWF(x_f),GOC_WWF(y_f)

typedef struct {
    GStringElement	OADT_opcode;	/* GR_APPLY_TRANSLATION_DWORD */
    sdword          OADT_x;
    sdword          OADT_y;
} OpApplyTranslationDWord} ;

#define GSApplyTranslationDWord (x_sdw,y_sdw)				\
    GR_APPLY_TRANSLATION_DWORD,GOC_SDW(x_sdw),			\
    GOC_SDW(y_sdw)

typedef struct {
    GStringElement	OST_opcode;	/* GR_SET_TRANSFORM */
    WWFixed         OST_elem11;
    WWFixed         OST_elem12;
    WWFixed         OST_elem21;
    WWFixed         OST_elem22;
    WWFixed         OST_elem31;
    WWFixed         OST_elem32;
} OpSetTransform} ;

#define GSSetTransform (e11_f,e12_f,e21_f,e22_f,e31_df,e32_df) 		\
    GR_SET_TRANSFORM,GOC_WWF(e11_f),				\
    GOC_WWF(e12_f),GOC_WWF(e21_f),					\
    GOC_WWF(e22_f),GOC_DWF(e31_df),GOC_DWF(e32_df)

typedef struct {
    GStringElement	OATr_opcode;	/* GR_APPLY_TRANSFORM */
    WWFixed         OATr_elem11;
    WWFixed         OATr_elem12;
    WWFixed         OATr_elem21;
    WWFixed         OATr_elem22;
    WWFixed         OATr_elem31;
    WWFixed         OATr_elem32;
} OpApplyTransform} ;

#define GSApplyTransform (e11_f,e12_f,e21_f,e22_f,e31_df,e32_df) 	\
    GR_APPLY_TRANSFORM,GOC_WWF(e11_f),GOC_WWF(e12_f),		\
    GOC_WWF(e21_f),GOC_WWF(e22_f), 					\
    GOC_DWF(e31_df), GOC_DWF(e32_df)

typedef struct {
    GStringElement	OSNT_opcode;	/* GR_SET_NULL_TRANSFORM */
} OpSetNullTransform} ;

#define GSSetNullTransform () 						\
    GR_SET_NULL_TRANSFORM

typedef struct {
    GStringElement	OSDT_opcode;	/* GR_SET_DEFAULT_TRANSFORM */
} OpSetDefaultTransform} ;

#define GSSetDefaultTransform ()						\
    GR_SET_DEFAULT_TRANSFORM

typedef struct {
    GStringElement	OIDT_opcode;	/* GR_INIT_DEFAULT_TRANSFORM */
} OpInitDefaultTransform} ;

#define GSInitDefaultTransform ()					\
    GR_INIT_DEFAULT_TRANSFORM

typedef struct {
    GStringElement	ODL_opcode;	/* GR_DRAW_LINE */
    word            ODL_x1;
    word            ODL_x2;
    word            ODL_y1;
    word            ODL_y2;
} OpDrawLine} ;

#define GSDrawLine (x1_w,y1_w,x2_w,y2_w)  				\
    GR_DRAW_LINE,GOC_SW(x1_w),GOC_SW(y1_w),			\
    GOC_SW(x2_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	ODLT_opcode;	/* GR_DRAW_LINE_TO */
    word            ODLT_x2;
    word            ODLT_y2;
} OpDrawLineTo} ;

#define GSDrawLineTo (x2_w,y2_w) 					\
    GR_DRAW_LINE_TO,GOC_SW(x2_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	ODR_opcode;	/* GR_DRAW_RECT */
    word            ODR_x1;
    word            ODR_y1;
    word            ODR_x2;
    word            ODR_y2;
} OpDrawRect} ;

#define GSDrawRect (x1_w,y1_w,x2_w,y2_w)  		/*TESTED*/ 	\
    GR_DRAW_RECT,GOC_SW(x1_w),GOC_SW(y1_w),			\
    GOC_SW(x2_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	ODRT_opcode;	/* GR_DRAW_RECT_TO */
    word            ODRT_x2;
    word            ODRT_y2;
} OpDrawRectTo} ;

#define GSDrawRectTo (x2_w,y2_w)  			/*TESTED*/ 	\
    GR_DRAW_RECT_TO,GOC_SW(x2_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	ODHL_opcode;	/* GR_DRAW_HLINE */
    word            ODHL_x1;
    word            ODHL_y1;
    word            ODHL_x2;
} OpDrawHLine} ;

#define GSDrawHLine (x1_w,y1_w,x2_w) 					\
    GR_DRAW_HLINE,GOC_SW(x1_w),					\
    GOC_SW(y1_w),GOC_SW(x2_w)

typedef struct {
    GStringElement	ODHLT_opcode;	/* GR_DRAW_HLINE_TO */
    word            ODHLT_x2;
} OpDrawHLineTo} ;

#define GSDrawHLineTo (x2_w) 						\
    GR_DRAW_HLINE_TO,GOC_SW(x2_w)

typedef struct {
    GStringElement	ODVL_opcode;	/* GR_DRAW_VLINE */
    word            ODVL_x1;
    word            ODVL_y1;
    word            ODVL_y2;
} OpDrawVLine} ;

#define GSDrawVLine (x1_w,y1_w,y2_w)					\
    GR_DRAW_VLINE,GOC_SW(x1_w),					\
    GOC_SW(y1_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	ODVLT_opcode;	/* GR_DRAW_VLINE_TO */
    word            ODVLT_y2;
} OpDrawVLineTo} ;

#define GSDrawVLineTo (y2_w) 						\
    GR_DRAW_VLINE_TO,GOC_SW(y2_w)

typedef struct {
    GStringElement	ODRR_opcode;	/* GR_DRAW_ROUND_RECT */
    word            ODRR_radius;
    word            ODRR_x1;
    word            ODRR_y1;
    word            ODRR_x2;
    word            ODRR_y2;
} OpDrawRoundRect} ;

#define GSDrawRoundRect (x1_w,y1_w,x2_w,y2_w,r_w) 			\
    GR_DRAW_ROUND_RECT,GOC_WORD(r_w),				\
    GOC_SW(x1_w),GOC_SW(y1_w),					\
    GOC_SW(x2_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	ODRRT_opcode;	/* GR_DRAW_ROUND_RECT_TO */
    word            ODRRT_radius;
    word            ODRRT_x2;
    word            ODRRT_y2;
} OpDrawRoundRectTo} ;

#define GSDrawRoundRectTo (x2_w,y2_w,r_w) 				\
    GR_DRAW_ROUND_RECT_TO,GOC_WORD(r_w),				\
    GOC_SW(x2_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	ODP_opcode;	/* GR_DRAW_POINT */
    word            ODP_x1;
    word            ODP_y1;
} OpDrawPoint} ;

#define GSDrawPoint (x1_w,y1_w) 						\
    GR_DRAW_POINT,GOC_SW(x1_w),GOC_SW(y1_w)

typedef struct {
    GStringElement	ODPCP_opcode;	/* GR_DRAW_POINT_CP */
} OpDrawPointAtCP} ;

#define GSDrawPointAtCP () 						\
    GR_DRAW_POINT_CP

typedef struct {
    GStringElement	ODB_opcode;	/* GR_DRAW_BITMAP */
    word            ODB_x;
    word            ODB_y;
    word            ODB_size;
} OpDrawBitmap} ;

typedef struct {
    GStringElement	OBS_opcode;	/* GSE_BITMAP_SLICE */
    word            OBS_size;
} OpBitmapSlice} ;

#define GSDrawBitmap (x_w,y_w,w_w) \
    GR_DRAW_BITMAP, GOC_SW(x_w), 					\
    GOC_SW(y_w), GOC_WORD(w_w)

#define GSDrawCBitmap (x_w,y_w,slice1size_w,totalSize) 			\
    GR_DRAW_BITMAP,GOC_SW(x_w), GOC_SW(y_w), 			\
    GOC_WORD(slice1size_w)

typedef struct {
    GStringElement	ODBCP_opcode;	/* GR_DRAW_BITMAP_CP */
    word            ODBCP_size;
} OpDrawBitmapAtCP} ;

#define GSDrawBitmapAtCP (bsize_w) 					\
    GR_DRAW_BITMAP_CP, GOC_WORD(bsize_w)

typedef struct {
    GStringElement	ODBP_opcode;	/* GR_DRAW_BITMAP_PTR */
    word            ODBP_x;
    word            ODBP_y;
    word            ODBP_ptr;
} OpDrawBitmapPtr} ;

/*NOT DONE-- PTR*/
#define GSDrawBitmapPtr (x_w,y_w,offptr) 				\
    GR_DRAW_BITMAP_PTR,GOC_SW(x_w),				\
    GOC_SW(y_w),GOC_PTR(offptr)

typedef struct {
    GStringElement	ODBOP_opcode;	/* GR_DRAW_BITMAP_OPTR */
    word		ODBOP_x;
    word		ODBOP_y;
    optr		ODBOP_bitmap;
} OpDrawBitmapOptr} ;

/* The GSDrawBitmapOptr macro will NOT work, since GOC cannot
   generate the high & low bytes of a segment */

#if 0
#define GSDrawBitmapOptr (x_w,y_w,o_ptr)  				\
    GR_DRAW_BITMAP_OPTR,GOC_SW(x_w),				\
    GOC_SW(y_w),GOC_OPTR(o_ptr)
#endif

typedef struct {
    GStringElement	OFB_opcode;	/* GR_FILL_BITMAP */
    word		OFB_x;
    word		OFB_y;
    word		OFB_size;
} OpFillBitmap} ;

#define GSFillBitmap (x_w,y_w,bsize_w) 					\
    GR_FILL_BITMAP,GOC_SW(x_w),					\
    GOC_SW(y_w),GOC_WORD(bsize_w)

typedef struct {
    GStringElement	OFBCP_opcode;	/* GR_FILL_BITMAP_CP */
    word		OFBCP_size;
} OpFillBitmapAtCP} ;

#define GSFillBitmapAtCP (bsize_w) 					\
    GR_FILL_BITMAP_CP, GOC_WORD(bsize_w)

typedef struct {
    GStringElement	OFBP_opcode;	/* GR_FILL_BITMAP_PTR */
    word		OFBP_x;
    word		OFBP_y;
    word		OFBP_ptr;
} OpFillBitmapPtr} ;

/*NOT DONE-- PTR*/
#define GSFillBitmapPtr (x_w,y_w,offptr) 					\
    GR_DRAW_BITMAP_PTR,GOC_SW(x_w),GOC_SW(y_w),GOC_PTR(offptr)

typedef struct {
    GStringElement	OFBOP_opcode;	/* GR_FILL_BITMAP_OPTR */
    word		OFBOP_x;
    word		OFBOP_y;
    optr		OFBOP_bitmap;
} OpFillBitmapOptr} ;

/* The GSFillBitmapOptr macro will NOT work, since GOC cannot
   generate the high & low bytes of a segment */

#if 0
#define GSFillBitmapOptr (x_w,y_w,o_ptr) 				\
    GR_FILL_BITMAP_OPTR,GOC_SW(x_w),GOC_SW(y_w),GOC_OPTR(o_ptr)

#endif

/*
 * XXX
 *
 * WARNING: all of the points must be converted to words with the
 * GOC_POINT macro -- if not, the program will compile, but crash geos
 * at runtime.
 */
typedef struct {
    GStringElement	ODPL_opcode;	/* GR_DRAW_POLYLINE */
    word		ODPL_count;
} OpDrawPolyline} ;

#define GSDrawPolyline (count_w)				/*TESTED*/	\
    GR_DRAW_POLYLINE,GOC_WORD(count_w)

typedef struct {
    GStringElement	OBPL_opcode;	/* GR_BRUSH_POLYLINE */
    word		OBPL_count;
    byte		OBPL_width;
    byte		OBPL_height;
} OpBrushPolyLine} ;

#define GSBrushPolyline (width_b,height_b,pts_b) \
    GR_BRUSH_POLYLINE, GOC_WORD(pts_b), (width_b), (height_b)

typedef struct {
    GStringElement	ODE_opcode;	/* GR_DRAW_ELLIPSE */
    word		ODE_x1;
    word		ODE_y1;
    word		ODE_x2;
    word		ODE_y2;
} OpDrawEllipse} ;

#define GSDrawEllipse (x1_w,y1_w,x2_w,y2_w) 		/*TESTED*/	\
    GR_DRAW_ELLIPSE,GOC_SW(x1_w),GOC_SW(y1_w),			\
            GOC_SW(x2_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	ODA_opcode;	/* GR_DRAW_ARC */
    ArcCloseType	ODA_close;
    word		ODA_x1;
    word		ODA_y1;
    word		ODA_x2;
    word		ODA_y2;
    word		ODA_ang1;
    word		ODA_ang2;
} OpDrawArc} ;

#define GSDrawArc (close_enum,x1_w,y1_w,x2_w,y2_w,ang1_w,ang2_w) /*TESTED*/\
    GR_DRAW_ARC,GOC_WORD(close_enum),				\
    GOC_SW(x1_w), GOC_SW(y1_w),					\
    GOC_SW(x2_w), GOC_SW(y2_w),					\
    GOC_SW(ang1_w),GOC_SW(ang2_w)

typedef struct {
    GStringElement	ODCV_opcode;	/* GR_DRAW_CURVE */
    sword		ODCV_x1;
    sword		ODCV_y1;
    sword		ODCV_x2;
    sword		ODCV_y2;
    sword		ODCV_x3;
    sword		ODCV_y3;
    sword		ODCV_x4;
    sword		ODCV_y4;
} OpDrawCurve} ;

#define GSDrawCurve (x1_sw,y1_sw,x2_sw,y2_sw,x3_sw,y3_sw,x4_sw,y4_sw) 	\
    GR_DRAW_CURVE,GOC_SW(x1_sw),GOC_SW(y1_sw),			\
    GOC_SW(x2_sw),GOC_SW(y2_sw), 					\
    GOC_SW(x3_sw),GOC_SW(y3_sw),GOC_SW(x4_sw),GOC_SW(y4_sw)

typedef struct {
    GStringElement	ODCVT_opcode;	/* GR_DRAW_CURVE_TO */
    sword		ODCVT_x2;
    sword		ODCVT_y2;
    sword		ODCVT_x3;
    sword		ODCVT_y3;
    sword		ODCVT_x4;
    sword		ODCVT_y4;
} OpDrawCurveTo} ;

#define GSDrawCurveTo (x2_sw,y2_sw,x3_sw,y3_sw,x4_sw,y4_sw)   		\
    GR_DRAW_CURVE_TO,GOC_SW(x2_sw),GOC_SW(y2_sw),			\
    GOC_SW(x3_sw),GOC_SW(y3_sw), 					\
    GOC_SW(x4_sw),GOC_SW(y4_sw)

typedef struct {
    GStringElement	ODRCVT_opcode;	/* GR_DRAW_REL_CURVE_TO */
    sword		ODRCVT_x2;
    sword		ODRCVT_y2;
    sword		ODRCVT_x3;
    sword		ODRCVT_y3;
    sword		ODRCVT_x4;
    sword		ODRCVT_y4;
} OpDrawRelCurveTo} ;

#define GSDrawRelCurveTo (x2_sw,y2_sw,x3_sw,y3_sw,x4_sw,y4_sw)   	\
    GR_DRAW_REL_CURVE_TO,GOC_SW(x2_sw),GOC_SW(y2_sw),		\
    GOC_SW(x3_sw),GOC_SW(y3_sw), 					\
    GOC_SW(x4_sw),GOC_SW(y4_sw)

typedef struct {
    GStringElement	ODS_opcode;	/* GR_DRAW_SPLINE */
    word		ODS_count;
} OpDrawSpline} ;

#define GSDrawSpline (count_w)  						\
    GR_DRAW_SPLINE,GOC_WORD(count_w)

typedef struct {
    GStringElement	ODST_opcode;	/* GR_DRAW_SPLINE_TO */
    word		ODST_count;
} OpDrawSplineTo} ;

#define GSDrawSplineTo (count_w) 					\
    GR_DRAW_SPLINE_TO,GOC_WORD(count_w)

typedef struct {
    GStringElement	OFFR_opcode;	/* GR_FILL_RECT */
    word		OFFR_x1;
    word		OFFR_y1;
    word		OFFR_x2;
    word		OFFR_y2;
} OpFillRect} ;

#define GSFillRect (x1_w,y1_w,x2_w,y2_w) 		/*TESTED*/  	\
    GR_FILL_RECT,GOC_SW(x1_w),GOC_SW(y1_w),			\
    GOC_SW(x2_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	OFFRT_opcode;	/* GR_FILL_RECT_TO */
    word		OFFRT_x2;
    word		OFFRT_y2;
} OpFillRectTo} ;

#define GSFillRectTo (x2_w,y2_w)  			/*TESTED*/  	\
    GR_FILL_RECT_TO ,GOC_SW(x2_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	OFRR_opcode;	/* GR_FILL_ROUND_RECT */
    word		OFRR_x1;
    word		OFRR_y1;
    word		OFRR_x2;
    word		OFRR_y2;
} OpFillRoundRect} ;

#define GSFillRoundRect (x1_w,y1_w,x2_w,y2_w,r_w) 			\
    GR_FILL_ROUND_RECT,GOC_WORD(r_w),GOC_SW(x1_w),			\
    GOC_SW(y1_w),GOC_SW(x2_w),					\
    GOC_SW(y2_w)

typedef struct {
    GStringElement	OFRRT_opcode;	/* GR_FILL_ROUND_RECT_TO */
    word		OFRRT_radius;
    word		OFRRT_x2;
    word		OFRRT_y2;
} OpFillRoundRectTo} ;

#define GSFillRoundRectTo (x2_w,y2_w,r_w) 				\
    GR_FILL_ROUND_RECT_TO,GOC_WORD(r_w),GOC_SW(x2_w),		\
    GOC_SW(y2_w)

typedef struct {
    GStringElement	OFA_opcode;	/* GR_FILL_ARC */
    word		OFA_close;
    word		OFA_x1;
    word		OFA_y1;
    word		OFA_x2;
    word		OFA_y2;
    word		OFA_ang1;
    word		OFA_ang2;
} OpFillArc} ;

/*TESTED*/
#define GSFillArc (close_enum,x1_w,y1_w,x2_w,y2_w,ang1_w,ang2_w)    	\
    GR_FILL_ARC,GOC_WORD(close_enum),				\
    GOC_SW(x1_w),GOC_SW(y1_w), 					\
    GOC_SW(x2_w),GOC_SW(y2_w),GOC_SW(ang1_w),			\
    GOC_SW(ang2_w)

typedef struct {
    GStringElement	OFP_opcode;	/* GR_FILL_POLYGON */
    word		OFP_count;
    RegionFillRule	OFP_rule;
} OpFillPolygon} ;

#define GSFillPolygon (count_w,fillrule_enum)  		/*TESTED*/	\
    GR_FILL_POLYGON,GOC_WORD(count_w),(fillrule_enum)

typedef struct {
    GStringElement	ODPG_opcode;	/* GR_DRAW_POLYGON */
    word		ODPG_count;
} OpDrawPolygon} ;

#define GSDrawPolygon (count_w) 						\
    GR_DRAW_POLYGON,GOC_WORD(count_w)

typedef struct {
    GStringElement	OFE_opcode;	/* GR_FILL_ELLIPSE */
    word		OFE_x1;
    word		OFE_y1;
    word		OFE_x2;
    word		OFE_y2;
} OpFillEllipse} ;

#define GSFillEllipse (x1_w,y1_w,x2_w,y2_w)  		/*TESTED*/ 	\
    GR_FILL_ELLIPSE,GOC_SW(x1_w),GOC_SW(y1_w), 			\
        GOC_SW(x2_w),GOC_SW(y2_w)

typedef struct {
    GStringElement	ODC_opcode;	/* GR_DRAW_CHAR */
    char		ODC_char;
    word		ODC_x1;
    word		ODC_y1;
} OpDrawChar} ;

#define GSDrawChar (c,x1_w,y1_w) 			/*TESTED*/	\
    GR_DRAW_CHAR,(c),GOC_SW(x1_w),GOC_SW(y1_w)

typedef struct {
    GStringElement	ODCCP_opcode;	/* GR_DRAW_CHAR_CP */
    char		ODCCP_char;
} OpDrawCharAtCP} ;

#define GSDrawCharAtCP (c) 				/*TESTED*/	\
    GR_DRAW_CHAR_CP,(c)

/*
 * Follow this macro immediately with a string -- goc will format the
 * the string as a two size bytes and a bunch of text bytes.
 */

typedef struct {
    GStringElement	ODT_opcode;	/* GR_DRAW_TEXT */
    word		ODT_x1;
    word		ODT_y1;
    word		ODT_len;
} OpDrawText} ;

#define GSDrawText (x1_w,y1_w)  		                                \
    GR_DRAW_TEXT,GOC_SW(x1_w),GOC_SW(y1_w)

typedef struct {
    GStringElement	ODTCP_opcode;	/* GR_DRAW_TEXT_CP */
    word		ODTCP_len;
} OpDrawTextAtCP} ;

/*
 * Follow this macro immediately with a string -- goc will format the
 * the string as a two size bytes and a bunch of text bytes.
 */

#define GSDrawTextAtCP ()    	    	    	GR_DRAW_TEXT_CP

typedef struct {
    GStringElement	ODTP_opcode;	/* GR_DRAW_TEXT_PTR */
    word		ODTP_x1;
    word		ODTP_y1;
    word		ODBOP_ptr;	/* near pointer to text */
} OpDrawTextPtr} ;

#define GSDrawTextPtr (x_w,y_w,off_ptr) 			/*NOT_DONE*/	\
        GR_DRAW_TEXT_PTR, GOC_SW(x_w),\
        GOC_SW(y_w),GOC_PTR(off_ptr)

typedef struct {
    GStringElement	ODTO_opcode;	/* GR_DRAW_TEXT_OPTR */
    word		ODTO_x1;
    word		ODTO_y1;
    optr		ODTO_optr;
} OpDrawTextOptr} ;

/*  The GSDrawXXXOptr macros will not work in GOC */

#if 0
#define GSDrawTextOptr (x_w,y_w,o_ptr) 			/*NOT_TESTED*/	\
    GR_DRAW_TEXT_OPTR, GOC_SW(x_w),				\
    GOC_SW(y_w),GOC_OPTR(o_ptr)
#endif

typedef struct {
    GStringElement	OMT_opcode;	/* GR_MOVE_TO */
    word		OMT_x1;
    word		OMT_y1;
} OpMoveTo} ;

#define GSMoveTo (x1_w,y1_w) 				/*TESTED*/	\
    GR_MOVE_TO, GOC_SW(x1_w), GOC_SW(y1_w)

typedef struct {
    GStringElement	ORMT_opcode;	/* GR_REL_MOVE_TO */
    word		ORMT_x1;
    word		ORMT_y1;
} OpRelMoveTo} ;

#define GSRelMoveTo (x1_wwf,y1_wwf) 			/*TESTED*/	\
    GR_REL_MOVE_TO, 						\
    GOC_WWF(x1_wwf),GOC_WWF(y1_wwf)

typedef struct {
    GStringElement	OSMM_opcode;	/* GR_SET_MIX_MODE */
    MixMode		OSMM_mode;
} OpSetMixMode} ;

#define GSSetMixMode (mode) GR_SET_MIX_MODE, (mode)

typedef struct {
    GStringElement	OSLC_opcode;	/* GR_SET_LINE_COLOR */
    RGBValue	OSLC_color;
} OpSetLineColor} ;

#define GSSetLineColor (r,g,b) 		    GR_SET_LINE_COLOR,(r),(g),(b)

typedef struct {
    GStringElement	OSLCI_opcode;	/* GR_SET_LINE_COLOR_INDEX */
    Color     	OSLCI_color;
} OpSetLineColorIndex} ;

#define GSSetLineColorIndex (color)  	    GR_SET_LINE_COLOR_INDEX, (color)

typedef struct {
    GStringElement	OSAC_opcode;	/* GR_SET_AREA_COLOR */
    RGBValue	OSAC_color;
} OpSetAreaColor} ;

#define GSSetAreaColor (r,g,b) 	    	    GR_SET_AREA_COLOR,(r),(g),(b)

typedef struct {
    GStringElement	OSACI_opcode;	/* GR_SET_AREA_COLOR_INDEX */
    Color		OSACI_color;
} OpSetAreaColorIndex} ;

#define GSSetAreaColorIndex (index)  	    GR_SET_AREA_COLOR_INDEX,(index)

typedef struct {
    GStringElement	OSTC_opcode;	/* GR_SET_TEXT_COLOR */
    RGBValue	OSTC_color;
} OpSetTextColor} ;

#define GSSetTextColor (r,g,b) 	    	    GR_SET_TEXT_COLOR,(r),(g),(b)

typedef struct {
    GStringElement	OSTCI_opcode;	/* GR_SET_TEXT_COLOR_INDEX */
    Color		OSTCI_color;
} OpSetTextColorIndex} ;

#define GSSetTextColorIndex (index)  	    GR_SET_TEXT_COLOR_INDEX,(index)

typedef struct {
    GStringElement	OLSM_opcode;	/* GR_SET_LINE_MASK */
    SysDrawMask	OLSM_mask;
} OpSetLineMask} ;

#define GSSetLineMask (index) 	    	    GR_SET_LINE_MASK, (index)

typedef struct {
    GStringElement	OSCLM_opcode;	/* GR_SET_CUSTOM_LINE_MASK */
    DrawMask	OSCLM_mask;
} OpSetCustomLineMask} ;

#define GSSetCustomLineMask (m1,m2,m3,m4,m5,m6,m7,m8)	    	    \
    GR_SET_CUSTOM_LINE_MASK, (m1), (m2), (m3), (m4), (m5), (m6), (m7), (m8)

typedef struct {
    GStringElement	OSAM_opcode;	/* GR_SET_AREA_MASK */
    SysDrawMask	OSAM_mask;
} OpSetAreaMask} ;

#define GSSetAreaMask (index) 	    	    GR_SET_AREA_MASK, (index)

typedef struct {
    GStringElement	OSCAM_opcode;	/* GR_SET_CUSTOM_AREA_MASK */
    DrawMask	OSCAM_mask;
} OpSetCustomAreaMask} ;

#define GSSetCustomAreaMask (m1,m2,m3,m4,m5,m6,m7,m8)	    	    \
    GR_SET_CUSTOM_AREA_MASK, (m1), (m2), (m3), (m4), (m5), (m6), (m7), (m8)

typedef struct {
    GStringElement	OSTM_opcode;	/* GR_SET_TEXT_MASK */
    SysDrawMask	OSTM_mask;
} OpSetTextMask} ;

#define GSSetTextMask (index) 	    	    GR_SET_TEXT_MASK, (index)

typedef struct {
    GStringElement	OSCTM_opcode;	/* GR_SET_CUSTOM_TEXT_MASK */
    DrawMask	OSCTM_mask;
} OpSetCustomTextMask} ;

#define GSSetCustomTextMask (m1,m2,m3,m4,m5,m6,m7,m8)	    	    \
    GR_SET_CUSTOM_TEXT_MASK, (m1), (m2), (m3), (m4), (m5), (m6), (m7), (m8)

typedef struct {
    GStringElement	OSLCM_opcode;	/* GR_SET_LINE_COLOR_MAP */
    ColorMapMode	OSLCM_mode;
} OpSetLineColorMap} ;

#define GSSetLineColorMap (mode)     	    	GR_SET_LINE_COLOR_MAP,(mode)

typedef struct {
    GStringElement	OSACM_opcode;	/* GR_SET_AREA_COLOR_MAP */
    ColorMapMode	OSACM_mode;
} OpSetAreaColorMap} ;

#define GSSetAreaColorMap (mode)			GR_SET_AREA_COLOR_MAP,(mode)

typedef struct {
    GStringElement	OSTCM_opcode;	/* GR_SET_TEXT_COLOR_MAP */
    ColorMapMode	OSTCM_mode;
} OpSetTextColorMap} ;

#define GSSetTextColorMap (mode)			GR_SET_TEXT_COLOR_MAP,(mode)

typedef struct {
    GStringElement	OSLW_opcode;	/* GR_SET_LINE_WIDTH */
    WWFixed		OSLW_width;
} OpSetLineWidth} ;

#define GSSetLineWidth (width_wwf) 					\
    GR_SET_LINE_WIDTH, GOC_WWF(width_wwf)

typedef struct {
    GStringElement	OSLS_opcode;	/* GR_SET_LINE_STYLE */
    LineStyle	OSLS_style;
    byte		OSLS_index;
} OpSetLineStyle} ;

#define GSSetLineStyle (style,index) 					\
    GR_SET_LINE_STYLE,(style),(index)

typedef struct {
    GStringElement	OSCLS_opcode;	/* GR_SET_CUSTOM_LINE_STYLE */
    word		OSCLS_index;
    word		OSCLS_count;
} OpSetCustomLineStyle} ;

#define GSSetCustomLineStyle (index,count) 				\
    GR_SET_CUSTOM_LINE_STYLE,(index),(count)

typedef struct {
    GStringElement	OSLE_opcode;	/* GR_SET_LINE_END */
    LineEnd		OSLE_mode;
} OpSetLineEnd} ;

#define GSSetLineEnd (end) 						\
    GR_SET_LINE_END,(end)

typedef struct {
    GStringElement	OSLJ_opcode;	/* GR_SET_LINE_JOIN */
    LineJoin	OSLJ_mode;
} OpSetLineJoin} ;

#define GSSetLineJoin (join) 						\
    GR_SET_LINE_JOIN,(join)

typedef struct {
    GStringElement	OSML_opcode;	/* GR_SET_MITER_LIMIT */
    WWFixed		OSML_mode;
} OpSetMiterLimit} ;

#define GSSetMiterLimit (limit_wwf) GR_SET_MITER_LIMIT, GOC_WWF(limit_wwf)

typedef struct {
    GStringElement	OSLA_opcode;	/* GR_SET_LINE_ATTR */
    LineAttr	OSLA_attr;
} OpSetLineAttr} ;

#define GSSetLineAttr (r,g,b,mode,mask,width,end,join,style) \
    GR_SET_LINE_ATTR,(CF_RGB),(r),(g),(b),(mask),(mode),(end),(join),(style),GOC_WWF(width)

typedef struct {
    GStringElement	OSAA_opcode;	/* GR_SET_AREA_ATTR */
    AreaAttr	OSAA_attr;
} OpSetAreaAttr} ;

#define GSSetAreaAttr (r,g,b,mode,mask) 					\
    GR_SET_AREA_ATTR,(CF_RGB),(r),(g),(b),(mask),(mode)

typedef struct {
    GStringElement	OSTS_opcode;	/* GR_SET_TEXT_STYLE */
    TextStyle	OSTS_set;
    TextStyle	OSTS_reset;
} OpSetTextStyle} ;

#define GSSetTextStyle (set,reset) 					\
    GR_SET_TEXT_STYLE,(set),(reset)

typedef struct {
    GStringElement	OSTMo_opcode;	/* GR_SET_TEXT_MODE */
    TextMode	OSTMo_set;
    TextMode	OSTMo_reset;
} OpSetTextMode} ;

#define GSSetTextMode (set,reset) 					\
    GR_SET_TEXT_MODE,(set),(reset)

typedef struct {
    GStringElement	OSTSP_opcode;	/* GR_SET_TEXT_SPACE_PAD */
    WBFixed		OSTSP_pad;
} OpSetTextSpacePad} ;

#define GSSetTextSpacePad (pad_wbf) 					\
    GR_SET_TEXT_SPACE_PAD, GOC_WBF(pad_wbf)

typedef struct {
    GStringElement	OSF_opcode;	/* GR_SET_FONT */
    WBFixed		OSF_size;
    FontID		OSF_id;
} OpSetFont} ;

#define GSSetFont (id,size_wbf) 				/*TESTED*/	\
    GR_SET_FONT,GOC_WBF(size_wbf),GOC_WORD(id)

typedef struct {
    GStringElement	OSTA_opcode;	/* GR_SET_TEXT_ATTR */
    TextAttr	OSTA_attr;
} OpSetTextAttr} ;

#define GSSetTextAttr (cflag,r,g,b,mask,sSet,sReset,mSet,mReset,sPad,id,pSize,trkKrn,fWeight,fWidth) \
    GR_SET_TEXT_ATTR,(cflag),(r),(g),(b),(mask),(sSet),	\
       (sReset),(mSet),(mReset),GOC_WWF(sPad),         \
    GOC_WORD(id), GOC_WWF(pSize),GOC_SW(trkKrn),(fWeight),(fWidth)

typedef struct {
    GStringElement	OSTK_opcode;	/* GR_SET_TRACK_KERN */
    sword		OSTK_degree;
} OpSetTrackKern} ;

#define GSSetTrackKern (degree) GR_SET_TRACK_KERN, GOC_SW(degree)

typedef struct {
    GStringElement	OSCR_opcode;	/* GR_SET_CLIP_RECT */
    PathCombineType	OSCR_flags;
    Rectangle	OSCR_rect;
} OpSetClipRect} ;

#define GSSetClipRect (path,rl_sw,rt_sw,rr_sw,rb_sw) 			\
    GR_SET_CLIP_RECT,GOC_SW(rl_sw), 				\
    GOC_SW(rt_sw),GOC_SW(rr_sw),GOC_SW(rb_sw)

typedef struct {
    GStringElement	OSWCR_opcode;	/* GR_SET_WIN_CLIP_RECT */
    PathCombineType	OSWCR_flags;
    Rectangle	OSWCR_rect;
} OpSetWinClipRect} ;

#define GSSetWinClipRect (path,rl_sw,rt_sw,rr_sw,rb_sw) 			\
    GR_SET_WIN_CLIP_RECT,GOC_SW(rl_sw), 				\
    GOC_SW(rt_sw),GOC_SW(rr_sw),GOC_SW(rb_sw)

typedef struct {
    GStringElement	OBP_opcode;	/* GR_BEGIN_PATH */
    PathCombineType	OBP_combine;
    byte		OBP_flags;
    byte		OBP_unused;
} OpBeginPath} ;

#define GSBeginPath (flags)  	    	    	GR_BEGIN_PATH,(flags)

typedef struct {
    GStringElement	OSCP_opcode;	/* GR_SET_CLIP_PATH */
    RegionFillRule	OSCP_rule;
    PathCombineType	OSCP_flags;
} OpSetClipPath} ;

#define GSSetClipPath (flags)			GR_SET_CLIP_PATH,(flags)

typedef struct {
    GStringElement	OSWCP_opcode;	/* GR_SET_WIN_CLIP_PATH */
    RegionFillRule	OSWCP_rule;
    PathCombineType	OSWCP_flags;
} OpSetWinClipPath} ;

#define GSSetWinClipPath (flags)			GR_SET_WIN_CLIP_PATH,(flags)

typedef struct {
    GStringElement	OEP_opcode;	/* GR_END_PATH */
} OpEndPath} ;

#define GSEndPath ()				GR_END_PATH

typedef struct {
    GStringElement	OCSP_opcode;	/* GR_CLOSE_SUB_PATH */
} OpCloseSubPath} ;

#define GSCloseSubPath ()			GR_CLOSE_SUB_PATH

typedef struct {
    GStringElement	OSNP_opcode;	/* GR_SET_NULL_PATH */
} OpSetNullPath} ;

#define GSSetNullPath ()				GR_SET_NULL_PATH

typedef struct {
    GStringElement	OFLP_opcode;	/* GR_FILL_PATH */
    RegionFillRule	OFLP_rule;
} OpFillPath} ;

#define GSFillPath (region_fill_rule) 					\
    GR_FILL_PATH,(region_fill_rule)

typedef struct {
    GStringElement	ODRP_opcode;	/* GR_DRAW_PATH */
} OpDrawPath} ;

#define GSDrawPath () 	    	    	    	GR_DRAW_PATH

typedef struct {
    GStringElement	OSSP_opcode;	/* GR_SET_STROKE_PATH */
} OpSetStrokePath} ;

#define GSSetStrokePath ()			GR_SET_STROKE_PATH

typedef struct {
    GStringElement	ODATP_opcode;	/* GR_DRAW_ARC_3POINT */
    ArcCloseType	ODATP_close;
    WWFixed		ODATP_x1;
    WWFixed		ODATP_y1;
    WWFixed		ODATP_x2;
    WWFixed		ODATP_y2;
    WWFixed		ODATP_x3;
    WWFixed		ODATP_y3;
} OpDrawArc3Point} ;

#define GSDrawArc3Point (close, x1, y1, x2, y2, x3, y3) 	    		\
    GR_DRAW_ARC_3POINT,GOC_WORD(close),GOC_WWF(x1),			\
    GOC_WWF(y1), GOC_WWF(x2), GOC_WWF(y2), 				\
    GOC_WWF(x3), GOC_WWF(y3)

typedef struct {
    GStringElement	ODATPT_opcode;	/* GR_DRAW_ARC_3POINT_TO */
    ArcCloseType	ODATPT_close;
    WWFixed		ODATPT_x2;
    WWFixed		ODATPT_y2;
    WWFixed		ODATPT_x3;
    WWFixed		ODATPT_y3;
} OpDrawArc3PointTo} ;

#define GSDrawArc3PointTo (close, x2, y2, x3, y3) \
    GR_DRAW_ARC_3POINT_TO,GOC_WORD(close), \
    GOC_WWF(x2), GOC_WWF(y2), GOC_WWF(x3), GOC_WWF(y3)

typedef struct {
    GStringElement	ODRATPT_opcode;	/* GR_DRAW_REL_ARC_3POINT_TO */
    ArcCloseType	ODRATPT_close;
    WWFixed		ODRATPT_x2;
    WWFixed		ODRATPT_y2;
    WWFixed		ODRATPT_x3;
    WWFixed		ODRATPT_y3;
} OpDrawRelArc3PointTo} ;

#define GSDrawRelArc3PointTo (close, x2, y2, x3, y3) \
    GR_DRAW_REL_ARC_3POINT_TO,GOC_WORD(close), \
    GOC_WWF(x2), GOC_WWF(y2), GOC_WWF(x3), GOC_WWF(y3)

typedef struct {
    GStringElement	OFATP_opcode;	/* GR_FILL_ARC_3POINT */
    ArcCloseType	OFATP_CLOSE;
    WWFixed		OFATP_x1;
    WWFixed		OFATP_y1;
    WWFixed		OFATP_x2;
    WWFixed		OFATP_y2;
    WWFixed		OFATP_x3;
    WWFixed		OFATP_y3;
} OpFillArc3Point} ;

#define GSFillArc3Point (close, x1, y1, x2, y2, x3, y3) \
    GR_FILL_ARC_3POINT,GOC_WORD(close),GOC_WWF(x1), GOC_WWF(y1),\
    GOC_WWF(x2), GOC_WWF(y2), \
    GOC_WWF(x3), GOC_WWF(y3)

typedef struct {
    GStringElement	OFATPT_opcode;	/* GR_FILL_ARC_3POINT_TO */
    ArcCloseType	OFATPT_close;
    WWFixed		OFATPT_x2;
    WWFixed		OFATPT_y2;
    WWFixed		OFATPT_x3;
    WWFixed		OFATPT_y3;
} OpFillArc3PointTo} ;

#define GSFillArc3PointTo (close, x2, y2, x3, y3) \
    GR_FILL_ARC_3POINT_TO,GOC_WORD(close), \
    GOC_WWF(x2), GOC_WWF(y2), GOC_WWF(x3), GOC_WWF(y3)

typedef struct {
    GStringElement	OSFW_opcode;	/* GR_SET_FONT_WEIGHT */
    FontWeight	OSFW_weight;
} OpSetFontWeight} ;

#define GSSetFontWeight (weight) GR_SET_FONT_WEIGHT,GOC_WORD(weight)

typedef struct {
    GStringElement	OSFWI_opcode;	/* GR_SET_FONT_WIDTH */
    FontWidth	OSFWI_width;
} OpSetFontWidth} ;

#define GSSetFontWidth (width) GR_SET_FONT_WIDTH,GOC_WORD(width)

typedef struct {
    GStringElement	OSSBA_opcode;	/* GR_SET_SUBSCRIPT_ATTR */
    byte		OSSBA_pos;
    byte		OSSBA_size;
} OpSetSubscriptAttr} ;

#define GSSetSubscriptAttr (pos,size) GR_SET_SUBSCRIPT_ATTR,(pos),(size)

typedef struct {
    GStringElement	OSSA_opcode;	/* GR_SET_SUPERSCRIPT_ATTR */
    byte		OSSA_pos;
    byte		OSSA_size;
} OpSetSuperscriptAttr} ;

#define GSSetSuperscriptAttr (pos,size) GR_SET_SUPERSCRIPT_ATTR,(pos),(size)

typedef struct {
    GStringElement	OSAP_opcode;	/* GR_SET_AREA_PATTERN */
    GraphicPattern	OSAP_pattern;
} OpSetAreaPattern} ;

#define GSSetAreaPattern (pattern) GR_SET_AREA_PATTERN,GOC_PATTERN(pattern)

typedef struct {
    GStringElement	OSTP_opcode;	/* GR_SET_TEXT_PATTERN */
    GraphicPattern	OSTP_pattern;
} OpSetTextPattern} ;

#define GSSetTextPattern (pattern) GR_SET_TEXT_PATTERN,GOC_PATTERN(pattern)

typedef struct {
    GStringElement	OSCAP_opcode;	/* GR_SET_CUSTOM_AREA_PATTERN */
    GraphicPattern	OSCAP_pattern;
    word		OSCAP_size;
} OpSetCustomAreaPattern} ;

#define GSSetCustomAreaPattern (pattern,size) GR_SET_CUSTOM_AREA_PATTERN, \
    GOC_PATTERN(pattern),GOC_WORD(size)

typedef struct {
    GStringElement	OSCTP_opcode;	/* GR_SET_CUSTOM_TEXT_PATTERN */
    GraphicPattern	OSCTP_pattern;
    word		OSCTP_size;
} OpSetCustomTextPattern} ;

#define GSSetCustomTextPattern (pattern,size)  				\
    GR_SET_CUSTOM_TEXT_PATTERN,GOC_PATTERN(pattern), 		\
    GOC_WORD(size)

typedef struct {
    GStringElement	OCP_opcode;	/* GR_CREATE_PALETTE */
} OpCreatePalette} ;

#define GSCreatePalette ()   	    	    	GR_CREATE_PALETTE

typedef struct {
    GStringElement	ODSP_opcode;	/* GR_DESTROY_PALETTE */
} OpDestroyPalette} ;

#define GSDestroyPalette ()			GR_DESTROY_PALETTE

typedef struct {
    GStringElement	OSPE_opcode;	/* GR_SET_PALETTE_ENTRY */
    word		OSPE_entry;
    RGBValue	OSPE_color;
} OpSetPaletteEntry} ;

#define GSSetPaletteEntry (entry,r,g,b) GR_SET_PALETTE_ENTRY GOC_WORD(entry),(r),(g),(b)

typedef struct {
    GStringElement	OSP_opcode;	/* GR_SET_PALETTE */
    byte		OSP_start;
    word		OSP_num;
} OpSetPalette} ;

#define GSSetPalette (entry, count) GR_SET_PALETTE,(entry),(count)

typedef struct {
    word		OB_width;
    word		OB_heigth;
    BMCompact	OB_compact;
    BMType		OB_type;
} OpBitmap} ;

#define Bitmap (wid,hei,compact,type) \
  GOC_WORD(wid),GOC_WORD(hei),(compact), (type)

#endif


Objects\gSysC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gSysC.goh
 * AUTHOR:	Doug Fults: July 7, 1992
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenSystemClass
 *
 *	$Id: gSysC.goh,v 1.9.4.1 96/04/28 08:31:31 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <ui.goh>
#include  <graphics.h>
#include  <win.h>

@class GenSystemClass, GenClass;

@message void MSG_GEN_SYSTEM_SET_SPECIFIC_UI ();		/* INTERNAL */
@message void MSG_GEN_SYSTEM_SET_DEFAULT_SCREEN ();	/* INTERNAL */
@message optr MSG_GEN_SYSTEM_GET_DEFAULT_SCREEN () = cx:dx;	/* XXX */
@message void MSG_GEN_SYSTEM_ADD_SCREEN_CHILD ();	/* INTERNAL */
@message void MSG_GEN_SYSTEM_REMOVE_SCREEN_CHILD ();	/* INTERNAL */
@message void MSG_GEN_SYSTEM_SET_DEFAULT_FIELD (
                optr defaultField = cx:dx);	/* XXX */
@message optr MSG_GEN_SYSTEM_GET_DEFAULT_FIELD () = cx:dx;	/* XXX */
@message void MSG_GEN_SYSTEM_SET_PTR_IMAGE (optr ptrImage = cx:dx,
                    PtrImageLevel level = bp);	/* XXX */
@message void MSG_GEN_SYSTEM_NOTIFY_SYS_MODAL_WIN_CHANGE ();	/* XXX */
@message void MSG_GEN_SYSTEM_GET_MODAL_GEODE ();		/* INTERNAL */
@message void MSG_GEN_SYSTEM_BRING_GEODE_TO_TOP (
                                GeodeHandle geode = cx,
                                /*
                                 * layerID is normally the geode handle, which
                                 *  is used for common windows of app
                                 */
                word layerID = dx,
                Handle parentWindow = bp);	/* XXX */
@message void MSG_GEN_SYSTEM_LOWER_GEODE_TO_BOTTOM (word geode = cx,
                word layerID = dx,
                Handle parentWindow = bp);	/* XXX */
@message void MSG_GEN_SYSTEM_FOREACH_FIELD ();		/* INTERNAL */
@message void MSG_GEN_SYSTEM_MARK_BUSY ();
@message void MSG_GEN_SYSTEM_MARK_NOT_BUSY ();

    @vardata void	TEMP_GEN_SYSTEM_FIELDS_DETACHED;	/* INTERNAL */

    /*
     * NOTE: the instance data for GenSystemClass is provided for informational
     * purposes only, and to keep checkclass from whining every night.
     * The instance data, like all other instance data, may not be directly
     * accessed, nor may GenSystemClass be subclassed. Instances of the class
     * may not be statically defined or instantiated by applications or
     * libraries other than the UI library itself.
     */

    @instance GeodeHandle   GSYI_specificUI;
    @instance GeodeHandle   GSYI_defaultUI;
    @instance optr  	    GSYI_defaultScreen;
    @instance optr  	    GSYI_defaultField;
    @instance @composite    GSYI_screenComp;
@endc

@endlib


gtelnet.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    (c) Copyright Geoworks 1996 -- All Rights Reserved
    GEOWORKS CONFIDENTIAL

PROJECT:	PC GEOS
MODULE:		GTelnet application
FILE:		gtelnet.goh

AUTHOR:		Simon Auyeung, Oct 28, 1996

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    simon	10/28/96   	Initial version.

DESCRIPTION:
    Defines the external methods (and internal private methods) that
    can be used by other applications to talk to gtelnet application.

    $Id: gtelnet.goh,v 1.1.1.1 96/11/18 15:34:06 simon Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@ifndef _GTELNET_GOH_
@define _GTELNET_GOH_

/*****************************************************************************
 *			Constants
 ****************************************************************************/

#define TELNET_DEFAULT_PORT 	        (23)

#define GTELNET_GEODE_TOKEN              { {'T', 'E', 'L', 'T'}, \
                                          MANUFACTURER_ID_GEOWORKS }

/*****************************************************************************
 *			Class definition
 ****************************************************************************/

@class	GTelnetClass, GenProcessClass;

/*
 * The result of opening the telnet connection via
 * MSG_GTELNET_OPEN_CONNECTION
 */
typedef enum {
    GTOCS_NORMAL     = 0x0,
    /* The connection is successfully established */

    GTOCS_CONNECTION_IN_USE    ,
    /* The connection fails because there is already a telnet
     * connection going on. */

    GTOCS_OUT_OF_MEMORY    ,
    /* The connection fails because of no more memory */

    GTOCS_OUT_OF_DISKSPACE    ,
    /* The connection fails because of no more diskspace */

    GTOCS_INTERNAL_ERROR
    /* The connection fails because of internal setup error */
} GTelnetOpenConnectionStatus} ;

/*
 * Parameter block passed to MSG_GTELNET_OPEN_CONNECTION
 */
typedef struct {
    optr	GTOCP_callbackObject;
    /* The object to send the callback message GTOCP_callbackMessag to
     * and receive the result of the requested connection. Pass
     * NullOptr if no object to notify
     *
     * The callback message will be in form of
     * @message void <my message>(GTelnetOpenConnectionStatus
     *                            status = cx);
     */

    Message     GTOCP_callbackMessage;
    /* The callback message sent to callback object specified in
     * GTOCP_callbackObject.
     */

    word        GTOCP_accpnt;
    /* The access point to use when opening telnet connection. If PPP
     * is connected, the access point must be the same as the one used
     * by the current connection.
     */

    word        GTOCP_portNum;
    /* The telnet port to connect to. To use default telnet port, set it
     * to TELNET_DEFAULT_PORT.*/

    TCHAR       *GTOCP_ipAddr;
    /* Null-terminated ASCII resolved or unresolved IP address. The
     * solved IP address is in numeric format like "123.123.11.22"
     * with ASCII characters or like "hello.world.com".
     */

    TCHAR       *GTOCP_connectionName;
    /* Null-terminated connection name to describe the telnet
     * connection host.
     */

} GTelnetOpenConnectionParams} ;

@message void
    MSG_GTELNET_OPEN_CONNECTION(@stack GTelnetOpenConnectionParams params);
/*
 * Desc:	Ask GTelnet application to open a telnet connection
 *
 * Pass:
 *	GTelnetOpenConnectionParams params
 *              Parameters to pass to GTelnet appl to specify the connection
 * Return:
 *	void
 *
 *      The result of the connection is returned in the callback
 *      message specified in GTOCP_callbackObject and
 *      GTOCP_callbackMessage in form of:
 *
 *      @message void <my message>(GTelnetOpenConnectionStatus
 *                            status = cx);
 */

@endc	/* GTelnetClass */

@endif  /* _GTELNET_GOH_ */


Objects\gTextC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gTextC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenTextClass
 *
 *	$Id: gTextC.goh,v 1.31.1.1 96/04/28 08:31:54 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

#include  <Objects/Text/tCommon.h>
@include  <Objects/genC.goh>
@include  <Objects/vTextC.goh>

/* GenTextEdit described below. */

@class GenTextClass, GenClass;

    @uses VisTextClass;	/* Always builds to a VisText object
                 * eventually */

@message void MSG_GEN_TEXT_SET_ATTRS (byte attrsToSet = cl,
                     byte attrsToClear = ch);  /*XXX*/
@message byte MSG_GEN_TEXT_GET_ATTRS () = al;

@message void MSG_GEN_TEXT_SET_INDETERMINATE_STATE (
                    Boolean indeterminateState = cx);
@message Boolean MSG_GEN_TEXT_IS_INDETERMINATE () = carry;

@message void MSG_GEN_TEXT_SET_MODIFIED_STATE (
                    Boolean modifiedState = cx);
@message Boolean MSG_GEN_TEXT_IS_MODIFIED () = carry;

@message void MSG_GEN_TEXT_SEND_STATUS_MSG (
                    Boolean modifiedState = cx);

@message optr MSG_GEN_TEXT_GET_DESTINATION () = cx:dx;
@message void MSG_GEN_TEXT_SET_DESTINATION (optr dest = cx:dx);

@message Message MSG_GEN_TEXT_GET_APPLY_MSG () = ax;
@message void MSG_GEN_TEXT_SET_APPLY_MSG (Message message = cx);
@message void MSG_GEN_TEXT_SET_FROM_ITEM_GROUP (word item = cx);

    @vardata Message ATTR_GEN_TEXT_STATUS_MSG;
    @vardata void ATTR_GEN_TEXT_UNUSED;
    @vardata void ATTR_GEN_TEXT_SELECTABLE;

    @vardata ColorQuad HINT_TEXT_WASH_COLOR;
    @vardata void HINT_TEXT_WHITE_WASH_COLOR;
    @vardata VisTextDefaultCharAttr ATTR_GEN_TEXT_DEFAULT_CHAR_ATTR;
    @vardata VisTextDefaultParaAttr ATTR_GEN_TEXT_DEFAULT_PARA_ATTR;
    @vardata ChunkHandle ATTR_GEN_TEXT_CHAR_ATTR;
    @vardata ChunkHandle ATTR_GEN_TEXT_MULTIPLE_CHAR_ATTR_RUNS;
    @vardata ChunkHandle ATTR_GEN_TEXT_PARA_ATTR;
    @vardata ChunkHandle ATTR_GEN_TEXT_MULTIPLE_PARA_ATTR_RUNS;

    @vardata void ATTR_GEN_TEXT_UNUSED_1;
    @vardata void HINT_TEXT_AUTO_HYPHENATE;
    @vardata void HINT_TEXT_SELECT_TEXT;
    @vardata void HINT_TEXT_CURSOR_AT_START;
    @vardata void HINT_TEXT_CURSOR_AT_END;
    @vardata void HINT_TEXT_FRAME;
    @vardata void HINT_TEXT_NO_FRAME;
    @vardata void HINT_TEXT_ALLOW_UNDO;
    @vardata void HINT_TEXT_ALLOW_SMART_QUOTES;
    @vardata void ATTR_GEN_TEXT_ALPHA;
    @vardata void ATTR_GEN_TEXT_NUMERIC;
    @vardata void ATTR_GEN_TEXT_SIGNED_NUMERIC;
    @vardata void ATTR_GEN_TEXT_SIGNED_DECIMAL;
    @vardata void ATTR_GEN_TEXT_FLOAT_DECIMAL;
    @vardata void ATTR_GEN_TEXT_ALPHA_NUMERIC;
    @vardata void ATTR_GEN_TEXT_LEGAL_FILENAMES;
    @vardata void ATTR_GEN_TEXT_LEGAL_DOS_FILENAMES;
    @vardata void ATTR_GEN_TEXT_LEGAL_DOS_PATH;
    @vardata void ATTR_GEN_TEXT_DATE;
    @vardata void ATTR_GEN_TEXT_TIME;
    @vardata void ATTR_GEN_TEXT_MAKE_UPPERCASE;
    @vardata void ATTR_GEN_TEXT_ALLOW_COLUMN_BREAKS;
    @vardata void ATTR_GEN_TEXT_DASHED_ALPHA_NUMERIC;
    @vardata void ATTR_GEN_TEXT_NORMAL_ASCII;
    @vardata void ATTR_GEN_TEXT_LEGAL_DOS_VOLUME_NAMES;
    @vardata void ATTR_GEN_TEXT_DOS_CHARACTER_SET;
    @vardata void ATTR_GEN_TEXT_NO_SPACES;
    @vardata void ATTR_GEN_TEXT_ALLOW_SPACES;
    @vardata word ATTR_GEN_TEXT_EXTENDED_FILTER;

    @vardata word ATTR_GEN_TEXT_TYPE_RUNS;
    @vardata word ATTR_GEN_TEXT_GRAPHIC_RUNS;
    @vardata word ATTR_GEN_TEXT_STYLE_ARRAY;
    @vardata word ATTR_GEN_TEXT_NAME_ARRAY;

    @vardata optr ATTR_GEN_TEXT_RUNS_ITEM_GROUP;
    @reloc ATTR_GEN_TEXT_RUNS_ITEM_GROUP, 0, optr

    @vardata void HINT_TEXT_DO_NOT_MAKE_LARGER_ON_PEN_SYSTEMS;
    @vardata void ATTR_GEN_TEXT_DO_NOT_INTERACT_WITH_SEARCH_CONTROL;
    @vardata optr ATTR_GEN_TEXT_SET_OBJECT_ENABLED_WHEN_TEXT_EXISTS;
    @reloc ATTR_GEN_TEXT_SET_OBJECT_ENABLED_WHEN_TEXT_EXISTS, 0, optr
    @vardata void ATTR_GEN_TEXT_NEVER_MAKE_SCROLLABLE;
    @vardata void ATTR_GEN_TEXT_DOES_NOT_ACCEPT_INK;
    @vardata ChunkHandle ATTR_GEN_TEXT_CUSTOM_FILTER;

@protominor UINewForZoomer

    @vardata void ATTR_GEN_TEXT_SEND_CONTEXT_NOTIFICATIONS_EVEN_IF_NOT_FOCUSED;

@protoreset

@protominor	UINewFor21

    @vardata void ATTR_GEN_TEXT_DONT_BEEP_ON_INSERTION_ERROR;

@protoreset

@protominor	GenValuePercentageFormat

@vardata void ATTR_GEN_TEXT_NO_FEP;
/*
 * This attribute causes the text object to not interact with the FEP,
 * if any.  This is useful for numeric-only text fields, such as in
 * a calculator.   Only implemented in DBCS/Pizza.
 * NOTE: care should be taken in adding / removing this dynamically,
 * as chaos will result if the text object already has the focus,
 * and already interacted with / didn't interact with the FEP.
 */

@protoreset

@protominor	UINewForResponder

@vardata void HINT_TEXT_UNDERLINE;
@vardata void HINT_TEXT_NO_UNDERLINE;
/* For specific UI's that support underlines, turns them on or off. */

@vardata void ATTR_GEN_TEXT_XOR_SELECTION;
/*
 *  This attribute sets the text object in a state where the selected text will
 *  be xor'ed with some product-specific value, rather than inverted.  This
 *  is currently only handled in Responder, for achieving the black-text-on-
 *  light-grey-background effect similar to selected gadgetry in the UI.
 */

@protoreset

@prototype void GEN_TEXT_APPLY_MSG (word stateFlags = bp);

@prototype void GEN_TEXT_STATUS_MSG (word stateFlags = bp);

typedef ByteFlags GenTextStateFlags ;
#define GTSF_INDETERMINATE 	0x80
#define	GTSF_MODIFIED			0x40

typedef ByteFlags GenTextAttrs ;
#define GTA_SINGLE_LINE_TEXT 		0x80
#define GTA_USE_TAB_FOR_NAVIGATION 	0x40
#define GTA_INIT_SCROLLING 		0x20
#define GTA_NO_WORD_WRAPPING 		0x10
#define GTA_ALLOW_TEXT_OFF_END 		0x08
#define GTA_TAIL_ORIENTED 		0x04
#define GTA_DONT_SCROLL_TO_CHANGES 	0x02

    @instance ChunkHandle	GTXI_text;
    @instance word		GTXI_maxLength = 32767;
    @instance GenTextAttrs	GTXI_attrs = GTA_USE_TAB_FOR_NAVIGATION;
    @instance GenTextStateFlags GTXI_stateFlags = 0;
    @instance optr		GTXI_destination;
    @instance word 		GTXI_applyMsg = 0;

@endc

@endlib


Objects\gToolCC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gToolCC.goh
 * AUTHOR:	Doug Fults: January 20, 1992
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenToolControlClass
 *
 *	$Id: gToolCC.goh,v 1.14.14.1 96/04/28 08:31:10 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <Objects/gCtrlC.goh>
@include  <gcnlist.goh>

@class	GenToolControlClass, GenControlClass;

/* Internal messages, here as place-holders only.  -- don't use! */

@message void MSG_GEN_TOOL_CONTROL_INTERNAL_GROUP_LIST ();
@message void MSG_GEN_TOOL_CONTROL_INTERNAL_GROUP_LIST_QUERY ();
@message void MSG_GEN_TOOL_CONTROL_INTERNAL_GROUP_LIST_VISIBILITY ();
@message void MSG_GEN_TOOL_CONTROL_INTERNAL_TOOLS_LIST ();
@message void MSG_GEN_TOOL_CONTROL_INTERNAL_RESET_TOOLS ();
@message void MSG_GEN_TOOL_CONTROL_INTERNAL_PLACEMENT_LIST ();
@message void MSG_GEN_TOOL_CONTROL_INTERNAL_PLACEMENT_LIST_QUERY ();
@message void MSG_GEN_TOOL_CONTROL_INTERNAL_RESET_PLACEMENT ();
@message void MSG_GEN_TOOL_CONTROL_INTERNAL_POSITION_VALUE ();
@message void MSG_GEN_TOOL_CONTROL_INTERNAL_NUDGE_BACK ();
@message void MSG_GEN_TOOL_CONTROL_INTERNAL_NUDGE_FORWARD ();
@message void MSG_GEN_TOOL_CONTROL_INTERNAL_RESET_POSITION ();

typedef WordFlags GTCFeatures ;
#define GTCF_TOOL_DIALOG 	0x0001

/* No tools provided. */

/* Maximum # of toolbox locations allowed */
#define MAX_NUM_TOOLBOXES 	25

typedef struct {
    optr	TI_object;
    optr	TI_name;
} ToolboxInfo} ;

typedef struct {
    optr	TGI_object;
} ToolGroupInfo} ;

/*
 * Variable instance data
 */

typedef struct {
    optr	TGTCI_curController;
    word	TGTCI_features;
    word    	TGTCI_required;
    word    	TGTCI_allowed;
} TempGenToolControlInstance} ;

    @vardata TempGenToolControlInstance TEMP_GEN_TOOL_CONTROL_INSTANCE;

/*
 * Instance data
 */

    @default GI_states = @default | GS_ENABLED;

    @instance ChunkHandle 	GTCI_toolboxList;
    @instance ChunkHandle 	GTCI_toolGroupList;

@endc

@endlib


Objects\gToolGC.goh

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gToolGC.goh
 * AUTHOR:	Doug Fults: July 15, 1992
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenToolGroupClass
 *
 *	$Id: gToolGC.goh,v 1.5.20.1 96/04/28 08:31:33 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <Objects/gInterC.goh>

@class	GenToolGroupClass, GenInteractionClass;
typedef ByteEnum ToolGroupHighlightType ;
#define TGHT_INACTIVE_HIGHLIGHT 	0
#define TGHT_ACTIVE_HIGHLIGHT 	1
#define TGHT_NO_HIGHLIGHT 	2

@message void MSG_GEN_TOOL_GROUP_SET_HIGHLIGHT (ToolGroupHighlightType hlType = cx);

/*
 * Variable instance data
 */

    @vardata Color TEMP_TOOL_GROUP_HIGHLIGHT;

/*
 * Instance data
 */

    @instance optr 	GTGI_controller;

    @default GI_states = (@default & ~GS_ENABLED);

@endc

#ifdef __HIGHC__
#endif

@endlib


Objects\gTrigC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gTrigC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenTriggerClass
 *
 *	$Id: gTrigC.goh,v 1.39.1.1 96/04/28 08:31:02 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <ui.goh>
@include  <Objects/genC.goh>

@class GenTriggerClass, GenClass;

@message void MSG_GEN_TRIGGER_SEND_ACTION (Boolean doublePressFlag = cl); /*XXX*/
@message Message MSG_GEN_TRIGGER_GET_ACTION_MSG () = cx;	/*XXX*/
@message void MSG_GEN_TRIGGER_SET_ACTION_MSG (Message message = cx);	/*XXX*/
@message void MSG_GEN_TRIGGER_SET_DESTINATION (optr dest = cx:dx);  /*XXX*/
@message optr MSG_GEN_TRIGGER_GET_DESTINATION () = cx:dx;   /*XXX*/
@message void MSG_GEN_TRIGGER_MAKE_DEFAULT_ACTION ();   /*XXX*/

    @vardata void HINT_TRIGGER_BRINGS_UP_WINDOW;
    @vardata void ATTR_GEN_TRIGGER_IMMEDIATE_ACTION;
    @vardata void HINT_TRIGGER_UNUSED;
    @vardata word ATTR_GEN_TRIGGER_ACTION_DATA;
    @vardata InteractionCommand ATTR_GEN_TRIGGER_INTERACTION_COMMAND;
    @vardata Message ATTR_GEN_TRIGGER_CUSTOM_DOUBLE_PRESS;
    @vardata void HINT_TRIGGER_UNUSED1;
    @vardata void HINT_TRIGGER_UNUSED2;
    @vardata void HINT_TRIGGER_UNUSED3;
    @vardata void HINT_TRIGGER_UNUSED4;
    @vardata void HINT_TRIGGER_DESTRUCTIVE_ACTION;

    @vardata void HINT_TRIGGER_BLANK_STYLE_BUTTON;
    @vardata void HINT_TRIGGER_TOOL_STYLE_BUTTON;
    @vardata void HINT_TRIGGER_WINDOW_CONTROL_BUTTON;
    @vardata void HINT_TRIGGER_EDGE_STYLE_UPPER_RIGHT;
    @vardata void HINT_TRIGGER_EDGE_STYLE_LOWER_RIGHT;

    @instance optr	GTI_destination;
    @instance Message	GTI_actionMsg;

    /* Standard prototype for action messages */

    @prototype void GEN_TRIGGER_ACTION (optr trigger = cx:dx);  /***/

    /* Alias for messages with "void (word foo, word foo2)" */

    typedef struct { word foo, foo2; } TwoWordArgs; } ;
    @vardataAlias (ATTR_GEN_TRIGGER_ACTION_DATA)
    TwoWordArgs ATTR_GEN_TRIGGER_ACTION_TWO_WORDS;

    /* Alias for messages with "void (word foo, word foo2, word foo3)" */

    typedef struct { word foo, foo2, foo3; } ThreeWordArgs; } ;
    @vardataAlias (ATTR_GEN_TRIGGER_ACTION_DATA)
     ThreeWordArgs ATTR_GEN_TRIGGER_ACTION_THREE_WORDS;

    /* Alias for messages with "void (optr output, word foo)" */

    typedef struct { optr output; word foo; } OptrWordArgs; } ;
    @vardataAlias (ATTR_GEN_TRIGGER_ACTION_DATA)
    OptrWordArgs ATTR_GEN_TRIGGER_ACTION_OPTR_AND_WORD;

@endc

@endlib


Objects\gValueC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gValueC.goh
 * AUTHOR:	Chris Hawley: 1/23/92
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenValueClass.
 *
 *	$Id: gValueC.goh,v 1.24.1.1 96/04/28 08:31:55 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <ui.goh>
@include  <Objects/genC.goh>

@class	GenValueClass, GenClass;

@message void MSG_GEN_VALUE_SET_VALUE (WWFixedAsDWord value = dx.cx,
                      Boolean indeterminate = bp);

@message void MSG_GEN_VALUE_SET_INTEGER_VALUE (word value = cx,
                          Boolean indeterminate = bp);

@message WWFixedAsDWord MSG_GEN_VALUE_GET_VALUE () = dx.cx;

@alias (MSG_GEN_VALUE_GET_VALUE) word MSG_GEN_VALUE_GET_INTEGER_VALUE() = dx;

@message void MSG_GEN_VALUE_SET_MINIMUM(WWFixedAsDWord value = dx.cx);

@message WWFixedAsDWord MSG_GEN_VALUE_GET_MINIMUM () = dx.cx;

@message void MSG_GEN_VALUE_SET_MAXIMUM (WWFixedAsDWord value = dx.cx);

@message WWFixedAsDWord MSG_GEN_VALUE_GET_MAXIMUM () = dx.cx;

@message void MSG_GEN_VALUE_SET_INCREMENT (WWFixedAsDWord value = dx.cx);

@message WWFixedAsDWord MSG_GEN_VALUE_GET_INCREMENT () = dx.cx;

@message void MSG_GEN_VALUE_SET_INDETERMINATE_STATE (
                    Boolean indeterminateState = cx);
@message Boolean MSG_GEN_VALUE_IS_INDETERMINATE () = carry;

@message void MSG_GEN_VALUE_SET_MODIFIED_STATE (
                    Boolean modifiedState = cx);
@message Boolean MSG_GEN_VALUE_IS_MODIFIED () = carry;

typedef ByteEnum GenValueDisplayFormat ;
/* Enum definitions at bottom of class description */

@message void MSG_GEN_VALUE_SET_DISPLAY_FORMAT (
                    GenValueDisplayFormat format = cl);

@message GenValueDisplayFormat MSG_GEN_VALUE_GET_DISPLAY_FORMAT () = al;

@message void MSG_GEN_VALUE_SEND_STATUS_MSG (
                    Boolean modifiedState = cx);

@message optr MSG_GEN_VALUE_GET_DESTINATION () = cx:dx;
@message void MSG_GEN_VALUE_SET_DESTINATION (optr dest = cx:dx);

@message Message MSG_GEN_VALUE_GET_APPLY_MSG () = ax;
@message void MSG_GEN_VALUE_SET_APPLY_MSG (Message message = cx);

typedef enum /* word */ {
    GVT_VALUE	,
    GVT_MINIMUM	,
    GVT_MAXIMUM	,
    GVT_INCREMENT	,
    GVT_LONG	,
    GVT_RANGE_LENGTH	,
    GVT_RANGE_END	,
    GVI_VALUE_AS_RATIO_OF_AVAILABLE_RANGE
} GenValueType} ;

#define GEN_VALUE_MAX_TEXT_LEN  30

@message void MSG_GEN_VALUE_SET_RANGE_LENGTH (WWFixedAsDWord value = dx.cx);
@message WWFixedAsDWord MSG_GEN_VALUE_GET_RANGE_LENGTH () = dx.cx;
@message void MSG_GEN_VALUE_ADD_RANGE_LENGTH ();
@message void MSG_GEN_VALUE_SUBTRACT_RANGE_LENGTH ();

@message void MSG_GEN_VALUE_GET_VALUE_TEXT (char *buffer = cx:dx,
                       GenValueType valueType = bp);

@message void MSG_GEN_VALUE_SET_VALUE_FROM_TEXT (char *text = cx:dx,
                            GenValueType valueType = bp);

@message WWFixedAsDWord MSG_GEN_VALUE_GET_VALUE_RATIO (GenValueType valueType = bp) = dx.cx;

@message void MSG_GEN_VALUE_SET_VALUE_FROM_RATIO (WWFixed ratio = dx.cx,
                         GenValueType valueType = bp);

@message void MSG_GEN_VALUE_INCREMENT ();
@message void MSG_GEN_VALUE_DECREMENT ();
@message void MSG_GEN_VALUE_SET_VALUE_TO_MINIMUM ();
@message void MSG_GEN_VALUE_SET_VALUE_TO_MAXIMUM ();
@message VisTextFilters MSG_GEN_VALUE_GET_TEXT_FILTER () = al;
@message byte MSG_GEN_VALUE_GET_MAX_TEXT_LEN () = al;
@message void MSG_GEN_VALUE_SET_OUT_OF_DATE ();
@message void MSG_GEN_VALUE_SELECT_TEXT ();

typedef ByteFlags GenValueStateFlags ;
#define GVSF_INDETERMINATE 	0x80
#define	GVSF_MODIFIED			0x40
#define GVSF_OUT_OF_DATE 	0x20

typedef struct {
    GenValueStateFlags	GVSFAW_flags;
    byte			GVSFAW_unused;
} GenValueStateFlagsAsWord} ;

@prototype void GEN_VALUE_APPLY_MSG (WWFixedAsDWord value = dx.cx,
                    GenValueStateFlagsAsWord stateFlags = bp);

@prototype void GEN_VALUE_STATUS_MSG (WWFixedAsDWord value = dx.cx,
                     GenValueStateFlagsAsWord stateFlags = bp);

@vardata Message ATTR_GEN_VALUE_STATUS_MSG;
@vardata word ATTR_GEN_VALUE_DECIMAL_PLACES;
@vardata WWFixed ATTR_GEN_VALUE_METRIC_INCREMENT;
@vardata void HINT_VALUE_NAVIGATE_TO_NEXT_FIELD_ON_RETURN_PRESS;
@vardata void HINT_VALUE_CUSTOM_RETURN_PRESS;
@vardata optr ATTR_GEN_VALUE_RUNS_ITEM_GROUP;
@reloc ATTR_GEN_VALUE_RUNS_ITEM_GROUP, 0, optr;
@vardata void ATTR_GEN_VALUE_SET_MODIFIED_ON_REDUNDANT_SELECTION;
@vardata void HINT_VALUE_INCREMENTABLE;
@vardata void HINT_VALUE_NOT_INCREMENTABLE;
@vardata void HINT_VALUE_X_SCROLLER;
@vardata void HINT_VALUE_Y_SCROLLER;
@vardata WWFixedAsDWord HINT_VALUE_DISPLAYS_RANGE;
@vardata void HINT_VALUE_ANALOG_DISPLAY;

typedef struct {
    word	GVI_numMajorIntervals;
    word	GVI_numMinorIntervals;
} GenValueIntervals} ;

@vardata GenValueIntervals HINT_VALUE_DISPLAY_INTERVALS;
@vardata void HINT_VALUE_CONSTRAIN_TO_INTERVALS;
@vardata void HINT_VALUE_SHOW_MIN_AND_MAX;
@vardata void HINT_VALUE_IMMEDIATE_DRAG_NOTIFICATION;
@vardata void HINT_VALUE_DELAYED_DRAG_NOTIFICATION;
@vardata void HINT_VALUE_ORIENT_HORIZONTALLY;
@vardata void HINT_VALUE_ORIENT_VERTICALLY;
@vardata void HINT_VALUE_DIGITAL_DISPLAY;
@vardata void HINT_VALUE_NO_DIGITAL_DISPLAY;
@vardata void HINT_VALUE_NO_ANALOG_DISPLAY;
@vardata void HINT_VALUE_NOT_DIGITALLY_EDITABLE;
@vardata void HINT_VALUE_DO_NOT_MAKE_LARGER_ON_PEN_SYSTEMS;
@vardata void HINT_VALUE_WRAP;
@vardata void HINT_VALUE_FRAME;
@vardata void HINT_VALUE_ITEM_GROUP_GADGET;
@vardata void HINT_VALUE_MERGE_ANALOG_AND_DIGITAL_DISPLAYS;
@vardata void HINT_VALUE_SEPARATE_ANALOG_AND_DIGITAL_DISPLAYS;

@protoreset

@protominor	UINewForResponder

@vardata void HINT_VALUE_UNDERLINE;
@vardata void HINT_VALUE_NO_UNDERLINE;

@protoreset

/* typedef ByteEnum GenValueDisplayFormat; */
#define GVDF_INTEGER  0
#define GVDF_DECIMAL  1
#define	GVDF_POINTS	 2
#define GVDF_INCHES  3
#define GVDF_CENTIMETERS  4
#define GVDF_MILLIMETERS  5
#define GVDF_PICAS  6
#define GVDF_EUR_POINTS  7
#define GVDF_CICEROS  8
#define GVDF_POINTS_OR_MILLIMETERS  9
#define GVDF_INCHES_OR_CENTIMETERS  10

@protominor GenValuePercentageFormat
#define GVDF_PERCENTAGE  11	/* supported in 3.0 and later, only */
@protoreset

@instance WWFixedAsDWord GVLI_value = MakeWWFixed(0.0);
@instance WWFixedAsDWord GVLI_minimum = MakeWWFixed(0.0);
@instance WWFixedAsDWord GVLI_maximum = MakeWWFixed(32766);
@instance WWFixedAsDWord GVLI_increment = MakeWWFixed(1.0);
@instance GenValueStateFlags GVLI_stateFlags = 0;
@instance GenValueDisplayFormat GVLI_displayFormat = GVDF_INTEGER;
@instance optr GVLI_destination;
@instance Message GVLI_applyMsg = 0;

@endc

@endlib


Objects\gViewC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gViewC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines GenViewClass
 *
 *	$Id: gViewC.goh,v 1.52.6.1 96/04/28 08:31:24 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

@include  <Objects/genC.goh>
#include  <win.h>

@class GenViewClass, GenClass;

#define GVCD_INDEX (val) 	((byte) (val))
#define GVCD_RED (val) 		((byte) (val))	/* If doing RGB */
#define GVCD_FLAGS (val) 	((byte) ((val) >> 8))
#define GVCD_BLUE_AND_GREEN (val)  ((word) ((val) >> 16))

#define GVCD_BLUE (val) 		((byte) ((val) >> 16))
#define GVCD_GREEN (val) 	((byte) ((val) >> 24))

typedef WordFlags MakeRectVisibleFlags ;
#define MRVF_ALWAYS_SCROLL 		0x0080
#define MRVF_USE_MARGIN_FROM_TOP_LEFT 	0x0040

typedef enum /* word */ {
    MRVM_0_PERCENT      	= 0,
    MRVM_25_PERCENT     	= 0xffff/4,
    MRVM_50_PERCENT     	= 0xffff/2,
    MRVM_75_PERCENT     	= 0xffff*3/4,
    MRVM_100_PERCENT    	= 0xffff
} MakeRectVisibleMargin} ;

typedef ByteEnum ScaleViewType ;
#define SVT_AROUND_UPPER_LEFT  0
#define SVT_AROUND_CENTER  1
#define SVT_AROUND_POINT  2

typedef struct {
    optr	TR_object;
    ClassStruct	*TR_class;
} TargetReference} ;

typedef struct {
    TargetReference	VTI_target;
    TargetReference	VTI_content;
} ViewTargetInfo} ;

typedef ByteEnum ScrollAction ;
#define SA_NOTHING  0
#define SA_TO_BEGINNING  1
#define SA_PAGE_BACK  2
#define SA_INC_BACK  3
#define SA_INC_FWD  4
#define SA_DRAGGING  5
#define SA_PAGE_FWD  6
#define SA_TO_END  7
#define SA_SCROLL  8
#define SA_SCROLL_INTO  9
#define SA_INITIAL_POS  10
#define SA_SCALE  11
#define SA_PAN  12
#define SA_DRAG_SCROLL  13
#define SA_SCROLL_FOR_SIZE_CHANGE  14

typedef ByteFlags ScrollFlags ;
#define SF_VERTICAL 		0x80
#define SF_ABSOLUTE 		0x40
#define SF_DOC_SIZE_CHANGE 	0x20
#define SF_WINDOW_NOT_SUSPENDED 	0x10
#define SF_SCALE_TO_FIT 		0x08
#define SF_SETUP_HAPPENED 	0x04
#define SF_EC_SETUP_CALLED 	0x02	/*Internal*/

typedef struct {
    ScrollAction	TSP_action;
    ScrollFlags		TSP_flags;
    optr		TSP_caller;
    PointDWord		TSP_change;
    PointDWord		TSP_newOrigin;
    PointDWord		TSP_oldOrigin;
    sword		TSP_viewWidth;
    sword		TSP_viewHeight;
} TrackScrollingParams} ;

#define VS_TYPICAL  0x8000
#define VS_SMALL  0x8001
#define VS_LARGE  0x8002

typedef WordFlags GenViewAttrs ;
#define GVA_CONTROLLED 				0x8000
#define GVA_GENERIC_CONTENTS 			0x4000
#define GVA_TRACK_SCROLLING 			0x2000
#define GVA_DRAG_SCROLLING 			0x1000
#define GVA_NO_WIN_FRAME 			0x0800
#define GVA_SAME_COLOR_AS_PARENT_WIN 		0x0400
#define GVA_VIEW_FOLLOWS_CONTENT_GEOMETRY 	0x0200
#define GVA_WINDOW_COORDINATE_MOUSE_EVENTS 	0x0100
#define GVA_DONT_SEND_PTR_EVENTS 		0x0080
#define GVA_DONT_SEND_KBD_RELEASES 		0x0040
#define GVA_SEND_ALL_KBD_CHARS 			0x0020
#define GVA_FOCUSABLE 				0x0010
#define GVA_SCALE_TO_FIT 			0x0008
#define GVA_ADJUST_FOR_ASPECT_RATIO 		0x0004

typedef ByteFlags GenViewDimensionAttrs ;
#define GVDA_SCROLLABLE 				0x80
#define GVDA_SPLITTABLE 				0x40
#define GVDA_TAIL_ORIENTED 			0x20
#define GVDA_DONT_DISPLAY_SCROLLBAR 		0x10
#define GVDA_NO_LARGER_THAN_CONTENT 		0x08
#define GVDA_NO_SMALLER_THAN_CONTENT 		0x04
#define GVDA_SIZE_A_MULTIPLE_OF_INCREMENT 	0x02
#define GVDA_KEEP_ASPECT_RATIO 			0x01

@message void MSG_GEN_VIEW_GET_ORIGIN (PointDWord *origin = cx:dx);

@message void MSG_GEN_VIEW_SET_ORIGIN(@stack sdword yOrigin, sdword xOrigin);

@message void MSG_GEN_VIEW_SCROLL(@stack sdword yOffset, sdword xOffset);

@message void MSG_GEN_VIEW_MAKE_RECT_VISIBLE(
                                @stack MakeRectVisibleFlags yFlags,
                                MakeRectVisibleMargin yMargin,
                MakeRectVisibleFlags xFlags,
                                MakeRectVisibleMargin xMargin,
                                sdword bottom, sdword right,
                                sdword top, sdword left);

@message void MSG_GEN_VIEW_SET_SCALE_FACTOR(@stack sdword yOrigin,
        sdword xOrigin, ScaleViewType scaleType,
        WWFixedAsDWord yScaleFactor,
        WWFixedAsDWord xScaleFactor);

typedef struct {
    WWFixedAsDWord GSP_yScaleFactor;
    WWFixedAsDWord GSP_xScaleFactor;
} GetScaleParams} ;

@message void MSG_GEN_VIEW_GET_SCALE_FACTOR (GetScaleParams *retValue
                                = axbpcxdx);

@message void MSG_GEN_VIEW_SET_CONTENT (optr content = cx:dx);

@message optr MSG_GEN_VIEW_GET_CONTENT () = cx:dx;

@message WindowHandle MSG_GEN_VIEW_GET_WINDOW () = cx;

@message void MSG_GEN_VIEW_GET_VISIBLE_RECT (RectDWord *rect = cx:dx);

@message void MSG_GEN_VIEW_GET_INCREMENT (PointDWord *increment = cx:dx);

@message void MSG_GEN_VIEW_SET_INCREMENT(@stack sdword yIncrement,
                            sdword xIncrement);

@message void MSG_GEN_VIEW_SUSPEND_UPDATE ();

@message void MSG_GEN_VIEW_UNSUSPEND_UPDATE ();

@message void MSG_GEN_VIEW_SET_DOC_BOUNDS(@stack sdword bottom, sdword right,
                        sdword top, sdword left);

@message void MSG_GEN_VIEW_GET_DOC_BOUNDS (RectDWord *bounds = cx:dx);

#define MAKE_HORIZ_ATTRS (val) ((byte) (val))
#define MAKE_VERT_ATTRS (val) ((byte) ((val) >> 8))
#define MAKE_SET_CLEAR_ATTRS (setAttrs, clrAttrs)	\
            ( (((word) (clrAttrs)) << 8) | (setAttrs))

@message GenViewAttrs MSG_GEN_VIEW_GET_ATTRS () = cx;

typedef struct {
    VisUpdateMode   VUMAW_mode;
    byte    	    VUMAW_unused;
} VisUpdateModeAsWord} ;

@message void MSG_GEN_VIEW_SET_ATTRS (
                                GenViewAttrs attrsToSet = cx,
                GenViewAttrs attrsToClear = dx,
                                VisUpdateModeAsWord updateMode = bp);

@message void MSG_GEN_VIEW_SET_COLOR (byte indexOrRed = cl, ColorFlag flags = ch,
                     word greenBlue = dx);

@message dword MSG_GEN_VIEW_GET_COLOR () = dx.cx;

@message SizeAsDWord MSG_GEN_VIEW_CALC_WIN_SIZE (word width = cx,
                        word height = dx) = dx.cx;

@message void MSG_GEN_VIEW_SET_PTR_IMAGE (optr pointerDef = cx:dx,
                     PtrImageLevel level = bp);  /*XXX*/

@message void MSG_GEN_VIEW_UPDATE_CONTENT_TARGET_INFO (ViewTargetInfo
                            *targetInfo = ss:bp);  /*XXX*/

@message void MSG_GEN_VIEW_INITIATE_DRAG_SCROLL ();

typedef struct {
    GenViewDimensionAttrs   DA_horizAttrs;
    GenViewDimensionAttrs   DA_verAttrs;
} DimensionAttrs} ;

@message DimensionAttrs MSG_GEN_VIEW_GET_DIMENSION_ATTRS () = cx;

typedef struct {
    GenViewDimensionAttrs   DATSC_attrsToSet;
    GenViewDimensionAttrs   DATSC_attrsToClear;
} DimensionAttrsToSetClear} ;

@message void MSG_GEN_VIEW_SET_DIMENSION_ATTRS (
            DimensionAttrsToSetClear horizAttrsToSetClear = cx,
            DimensionAttrsToSetClear vertAttrsToSetClear = dx,
            VisUpdateModeAsWord updateMode = bp);

@message void MSG_GEN_VIEW_SCROLL_TOP ();
@message void MSG_GEN_VIEW_SCROLL_PAGE_UP ();
@message void MSG_GEN_VIEW_SCROLL_UP ();
@message void MSG_GEN_VIEW_SCROLL_SET_Y_ORIGIN (sdword yOrigin = dx.cx);
@message void MSG_GEN_VIEW_SCROLL_DOWN ();
@message void MSG_GEN_VIEW_SCROLL_PAGE_DOWN ();
@message void MSG_GEN_VIEW_SCROLL_BOTTOM ();

#define VERTICAL_VIEW_BASE_MESSAGE   MSG_GEN_VIEW_SCROLL_TOP

@message void MSG_GEN_VIEW_SCROLL_LEFT_EDGE ();
@message void MSG_GEN_VIEW_SCROLL_PAGE_LEFT ();
@message void MSG_GEN_VIEW_SCROLL_LEFT ();
@message void MSG_GEN_VIEW_SCROLL_SET_X_ORIGIN (sdword xOrigin = dx.cx);
@message void MSG_GEN_VIEW_SCROLL_RIGHT ();
@message void MSG_GEN_VIEW_SCROLL_PAGE_RIGHT ();
@message void MSG_GEN_VIEW_SCROLL_RIGHT_EDGE ();

#define HORIZONTAL_VIEW_BASE_MESSAGE   MSG_GEN_VIEW_SCROLL_LEFT_EDGE

@message void MSG_GEN_VIEW_ALLOW_GLOBAL_TRANSFER ();   /*XXX*/

@message void MSG_GEN_VIEW_SET_DRAG_BOUNDS(@stack sdword bottom, sdword right,
                    sdword top, sdword left);

@message void MSG_GEN_VIEW_SETUP_TRACKING_ARGS (TrackScrollingParams *args = cx:dx);

@message void MSG_GEN_VIEW_TRACKING_COMPLETE (TrackScrollingParams *args = ss:bp);

@message optr MSG_GEN_VIEW_DETERMINE_VIS_PARENT (optr child = cx:dx) = cx:dx;

@message void MSG_GEN_VIEW_SEND_TO_LINKS (EventHandle event = bp, optr originator = cx:dx);

@message void MSG_GEN_VIEW_SEND_TO_VLINK (EventHandle event = bp, optr originator = cx:dx);

@message void MSG_GEN_VIEW_SEND_TO_HLINK (EventHandle event = bp, optr originator = cx:dx);

@message void MSG_GEN_VIEW_CALL_WITHOUT_LINKS (EventHandle event = bp, MessageFlags messageFlags = cx);

@message void MSG_GEN_VIEW_SET_ORIGIN_LOW(@stack sdword yOrigin, sdword xOrigin);
#define GVSOL_NO_CHANGE 		0x8000000

typedef ByteEnum GenViewInkType ;
#define GVIT_PRESSES_ARE_NOT_INK  0
#define GVIT_INK_WITH_STANDARD_OVERRIDE  1
#define GVIT_PRESSES_ARE_INK  2
#define GVIT_QUERY_OUTPUT  3
@message void MSG_GEN_VIEW_SET_INK_TYPE (GenViewInkType inkType = cl);
@message void MSG_GEN_VIEW_SET_EXTENDED_INK_TYPE (Boolean createGState, Color inkColor, word brushSize, optr destObj);
@message void MSG_GEN_VIEW_RESET_EXTENDED_INK_TYPE ();

@message void MSG_GEN_VIEW_SEND_NOTIFICATION ();

@message void MSG_GEN_VIEW_SCALE_LOW(@stack sdword yOrigin, sdword xOrigin,
                     ScaleViewType scaleType,
                     WWFixedAsDWord yScaleFactor,
                     WWFixedAsDWord xScaleFactor);

@message void MSG_GEN_VIEW_REDRAW_CONTENT ();

@message void MSG_GEN_VIEW_SET_CONTROLLED_ATTRS (
                GenViewControlAttrs controlAttrs = cx,
                word scaleFactor = dx);

/***/

@vardata void HINT_VIEW_LEAVE_ROOM_FOR_VERT_SCROLLER;
@vardata void HINT_VIEW_LEAVE_ROOM_FOR_HORIZ_SCROLLER;

typedef struct {
    optr    IDIP_dest;
    word    IDIP_brushSize;
    Color   IDIP_color;
    byte    IDIP_reserved1;	/* unused */
    Boolean IDIP_createGState;
} InkDestinationInfoParams} ;

@vardata InkDestinationInfoParams ATTR_GEN_VIEW_INK_DESTINATION_INFO;

@vardata XYSize ATTR_GEN_VIEW_PAGE_SIZE;

@vardata void ATTR_GEN_VIEW_SCALE_TO_FIT_BASED_ON_X;

@vardata void ATTR_GEN_VIEW_SCALE_TO_FIT_BOTH_DIMENSIONS;

@vardata void ATTR_GEN_VIEW_DO_NOT_WIN_SCROLL;

@vardata void HINT_VIEW_IMMEDIATE_DRAG_UPDATES;
@vardata void HINT_VIEW_DELAYED_DRAG_UPDATES;

@vardata void HINT_VIEW_REMOVE_SCROLLERS_WHEN_NOT_SCROLLABLE;
@vardata void HINT_VIEW_SHOW_SCROLLERS_WHEN_NOT_SCROLLABLE;

@vardata optr HINT_VIEW_SHARES_SPACE_WITH_VIEW_ABOVE;
@vardata optr HINT_VIEW_SHARES_SPACE_WITH_VIEW_BELOW;
@vardata optr HINT_VIEW_SHARES_SPACE_WITH_VIEW_TO_LEFT;
@vardata optr HINT_VIEW_SHARES_SPACE_WITH_VIEW_TO_RIGHT;
@vardata void ATTR_GEN_VIEW_DOES_NOT_ACCEPT_TEXT_INPUT;

/***/

    @instance PointDWFixed GVI_origin = {{0, 0}, {0, 0}};
    @instance RectDWord GVI_docBounds = {0, 0, 0, 0};
    @instance PointDWord GVI_increment = {20, 15};
    @instance PointWWFixed GVI_scaleFactor = {{0, 1}, {0, 1}};
    @instance ColorQuad GVI_color = {C_WHITE, 0, 0, 0};
    @instance GenViewAttrs GVI_attrs = (GVA_FOCUSABLE);
    @instance GenViewDimensionAttrs GVI_horizAttrs = 0;
    @instance GenViewDimensionAttrs GVI_vertAttrs = 0;
    @instance GenViewInkType GVI_inkType = GVIT_PRESSES_ARE_NOT_INK;
    @instance optr GVI_content;
    @instance optr GVI_horizLink;
    @instance optr GVI_vertLink;

    @default GI_attrs = @default | GA_TARGETABLE;

    @reloc ATTR_GEN_VIEW_INK_DESTINATION_INFO, word_offsetof, (InkDestinationInfoParams, IDIP_dest), optr;
@endc

@endlib


Objects\gViewCC.goh

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	gViewCC.goh
 * AUTHOR:	Tony Requist: February 1, 1991
 *
 * DECLARER:	User Interface
 *
 * DESCRIPTION:
 *	This file defines GenViewControlClass
 *
 *	$Id: gViewCC.goh,v 1.18.23.1 96/04/28 08:31:53 chris Exp $
 *
 ***********************************************************************/

#ifndef	__GVIEWCC_GOH
#define __GVIEWCC_GOH

@deflib ui

@class GenViewControlClass, GenControlClass;

@message void MSG_GEN_VIEW_CONTROL_SET_ATTRS (
                    GenViewControlAttrs attrsToSet = cx,
                    GenViewControlAttrs attrsToClear = dx);

@message void MSG_GEN_VIEW_CONTROL_SET_MINIMUM_SCALE_FACTOR (
                    word minimumScaleFactor = cx);
@message void MSG_GEN_VIEW_CONTROL_SET_MAXIMUM_SCALE_FACTOR (
                    word maximumScaleFactor = cx);

@message void MSG_GVC_SET_SCALE ();
@message void MSG_GVC_SET_SCALE_VIA_LIST ();
@message void MSG_GVC_SET_ATTRS ();
@message void MSG_GVC_REDRAW ();
@message void MSG_GVC_ZOOM_IN ();
@message void MSG_GVC_ZOOM_OUT ();
@message void MSG_GVC_PAGE_LEFT ();
@message void MSG_GVC_PAGE_RIGHT ();
@message void MSG_GVC_PAGE_UP ();
@message void MSG_GVC_PAGE_DOWN ();

    @vardata void ATR_GEN_VIEW_CONTROL_LARGE_ZOOM;

typedef WordFlags GVCFeatures ;
#define GVCF_MAIN_100 		0x4000
#define GVCF_MAIN_SCALE_TO_FIT 	0x2000
#define GVCF_ZOOM_IN 		0x1000
#define GVCF_ZOOM_OUT 		0x0800
#define GVCF_REDUCE 		0x0400
#define GVCF_100 		0x0200
#define GVCF_ENLARGE 		0x0100
#define GVCF_BIG_ENLARGE 	0x0080
#define GVCF_SCALE_TO_FIT 	0x0040
#define GVCF_ADJUST_ASPECT_RATIO  0x0020
#define GVCF_APPLY_TO_ALL 	0x0010
#define GVCF_SHOW_HORIZONTAL 	0x0008
#define GVCF_SHOW_VERTICAL 	0x0004
#define GVCF_CUSTOM_SCALE 	0x0002
#define GVCF_REDRAW 	    	0x0001

typedef WordFlags GVCToolboxFeatures ;
#define GVCTF_100 		0x1000
#define GVCTF_SCALE_TO_FIT 	0x0800
#define GVCTF_ZOOM_IN 		0x0400
#define GVCTF_ZOOM_OUT 		0x0200
#define GVCTF_REDRAW 		0x0100
#define GVCTF_PAGE_LEFT 		0x0080
#define GVCTF_PAGE_RIGHT 	0x0040
#define GVCTF_PAGE_UP 		0x0020
#define GVCTF_PAGE_DOWN 		0x0010
#define GVCTF_ADJUST_ASPECT_RATIO  0x0008
#define GVCTF_APPLY_TO_ALL 	0x0004
#define GVCTF_SHOW_HORIZONTAL 	0x0002
#define GVCTF_SHOW_VERTICAL 	0x0001

#define GVC_DEFAULT_FEATURES 	\
        (GVCF_MAIN_100 | \
         GVCF_MAIN_SCALE_TO_FIT | \
         GVCF_ZOOM_IN | \
         GVCF_ZOOM_OUT | \
         GVCF_REDUCE | \
         GVCF_100 | \
         GVCF_ENLARGE | \
         GVCF_SCALE_TO_FIT | \
         GVCF_ADJUST_ASPECT_RATIO | \
         GVCF_APPLY_TO_ALL | \
         GVCF_SHOW_HORIZONTAL | \
         GVCF_SHOW_VERTICAL | \
         GVCF_CUSTOM_SCALE)

#define GVC_DEFAULT_TOOLBOX_FEATURES 	\
        (GVCTF_100 | \
         GVCTF_ZOOM_IN | \
         GVCTF_ZOOM_OUT)

#define GVC_SUGGESTED_SIMPLE_FEATURES 	\
        (GVCF_MAIN_100 | \
         GVCF_MAIN_SCALE_TO_FIT | \
         GVCF_ZOOM_IN | \
         GVCF_ZOOM_OUT)

#define GVC_SUGGESTED_INTRODUCTORY_FEATURES 	\
        (GVCF_MAIN_100 | \
         GVCF_ZOOM_IN | \
         GVCF_ZOOM_OUT)

#define GVC_SUGGESTED_BEGINNING_FEATURES 	\
        (GVC_SUGGESTED_INTRODUCTORY_FEATURES | \
         GVCF_MAIN_SCALE_TO_FIT)

#define DEFAULT_ZOOM_MINIMUM 	25
#define DEFAULT_ZOOM_MAXIMUM 	200

typedef enum /* word */ {
    GVCSSF_TO_FIT    ,
} GenViewControlSpecialScaleFactor} ;

typedef struct {
    PointDWFixed	NVSC_origin;
    RectDWord		NVSC_docBounds;
    PointDWord		NVSC_increment;
    PointWWFixed	NVSC_scaleFactor;
    ColorQuad		NVSC_color;
    GenViewAttrs	NVSC_attrs;
    GenViewDimensionAttrs NVSC_horizAttrs;
    GenViewDimensionAttrs NVSC_vertAttrs;
    GenViewInkType	NVSC_inkType;
    XYSize		NVSC_contentSize;
    XYSize		NVSC_contentScreenSize;
    PointDWord		NVSC_originRelative;
    PointDWord		NVSC_documentSize;
} NotifyViewStateChange} ;

typedef struct {
    optr	NVO_view;
} NotifyViewOpening} ;

typedef WordFlags GenViewControlAttrs ;
#define GVCA_ADJUST_ASPECT_RATIO 	0x8000
#define GVCA_APPLY_TO_ALL 		0x4000
#define GVCA_SHOW_HORIZONTAL 		0x2000
#define GVCA_SHOW_VERTICAL 		0x1000

    @instance word			GVCI_minZoom = DEFAULT_ZOOM_MINIMUM;
    @instance word			GVCI_maxZoom = DEFAULT_ZOOM_MAXIMUM;
    @instance word			GVCI_scale = 100;
    @instance GenViewControlAttrs	GVCI_attrs =
        GVCA_SHOW_HORIZONTAL | GVCA_SHOW_VERTICAL | GVCA_APPLY_TO_ALL;
    @default GI_attrs = (@default | GA_KBD_SEARCH_PATH);

@endc

@endlib
#endif


heap.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	heap.h
 * AUTHOR:	Tony Requist: February 1, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines heap management structures and routines.
 *
 *	$Id: heap.h,v 1.28.26.2 97/03/28 02:46:12 joon Exp $
 *
 ***********************************************************************/

#ifndef	__HEAP_H
#define __HEAP_H

/*
 *	Constants for values to pass to heap routines
 */

typedef ByteFlags HeapFlags ;
#define HF_FIXED 	0x80
#define HF_SHARABLE 	0x40
#define HF_DISCARDABLE 	0x20
#define HF_SWAPABLE 	0x10
#define HF_LMEM 		0x08
#define HF_DISCARDED 	0x02
#define HF_SWAPPED 	0x01

#define HF_STATIC 	(HF_DISCARDABLE | HF_SWAPABLE)
#define HF_DYNAMIC 	(HF_SWAPABLE)

/* Flags for allocation type */

typedef ByteFlags HeapAllocFlags ;
#define HAF_ZERO_INIT 		0x80
#define HAF_LOCK 		0x40
#define HAF_NO_ERR 		0x20
#define HAF_UI 			0x10
#define HAF_READ_ONLY 		0x08
#define HAF_OBJECT_RESOURCE 	0x04
#define HAF_CODE 		0x02
#define HAF_CONFORMING 		0x01

/*
 * a few shortcuts for allocation flags
 */

/* standard block allocation flags */

#define HAF_STANDARD 		0
#define HAF_STANDARD_NO_ERR 	(HAF_NO_ERR)

/* allocation flags to allocate locked block */

#define HAF_STANDARD_LOCK 	(HAF_LOCK)
#define HAF_STANDARD_NO_ERR_LOCK  (HAF_NO_ERR | HAF_LOCK)

/***/

extern MemHandle
    _pascal MemAlloc (word byteSize, HeapFlags hfFlags, HeapAllocFlags haFlags);

/***/

extern MemHandle	/*XXX*/
    _pascal MemAllocSetOwner (GeodeHandle owner, word byteSize,
             HeapFlags hfFlags, HeapAllocFlags haFlags);

/***/

extern MemHandle	/*XXX*/
    _pascal MemReAlloc (MemHandle mh, word byteSize, HeapAllocFlags heapAllocFlags);

/***/

extern void
    _pascal MemFree (MemHandle mh);

/***/

extern void 	    	/*XXX*/
    _pascal MemDiscard (MemHandle mh);

/***/

#define MGI_LOCK_COUNT (val) ((byte) ((val) >> 8))
#define MGI_TYPE_FLAGS (val) ((byte) (val))

typedef enum /* word */ {
    MGIT_SIZE    =0,	/* size in bytes */
    MGIT_FLAGS_AND_LOCK_COUNT    =2,	/* use MGI_LOCK_COUNT and MGI_FLAGS */
    MGIT_OWNER_OR_VM_FILE_HANDLE    =4,
    MGIT_ADDRESS    =6,
    MGIT_OTHER_INFO    =8,
    MGIT_EXEC_THREAD    =10
} MemGetInfoType} ;

extern word
    _pascal MemGetInfo (MemHandle mh, MemGetInfoType info);

/***/

extern void
    _pascal MemModifyFlags (MemHandle mh,
           HeapFlags bitsToSet,
           HeapFlags bitsToClear);

/***/

extern void	/*XXX*/
    _pascal HandleModifyOwner (Handle mh, GeodeHandle owner);

/***/

extern void	/*XXX*/
    _pascal MemModifyOtherInfo (MemHandle mh, word otherInfo);

/***/

extern void *
    _pascal MemLock (MemHandle mh);

/***/

extern void
    _pascal MemUnlock (MemHandle mh);

/***/

extern void
    _pascal HandleP (MemHandle mh);

/***/

extern void
    _pascal HandleV (MemHandle mh);

/***/

extern void *
    _pascal MemPLock (MemHandle mh);

/***/

extern void
    _pascal MemUnlockV (MemHandle mh);

/***/

extern void *
    _pascal MemThreadGrab (MemHandle mh);

/***/

#define BLOCK_GRABBED  1

extern void *
    _pascal MemThreadGrabNB (MemHandle mh);

/***/

extern void
    _pascal MemThreadRelease (MemHandle mh);

/***/

extern void *
    _pascal MemDeref (MemHandle mh);

/***/

extern GeodeHandle	/*XXX*/
    _pascal MemOwner (MemHandle mh);

/***/

extern MemHandle	/*XXX*/
    _pascal MemPtrToHandle (void *ptr);

/***/	    	    	/*XXX*/

extern void
    _pascal MemInitRefCount (MemHandle mh, word count);

/***/	    	    	/*XXX*/

extern void
    _pascal MemIncRefCount (MemHandle mh);

/***/	    	    	/*XXX*/

extern void
    _pascal MemDecRefCount (MemHandle mh);

/***/
extern void *	    	/*XXX*/
    _pascal MemLockFixedOrMovable (void *ptr);

/***/

extern void 	    	/*XXX*/
    _pascal MemUnlockFixedOrMovable (void *ptr);

/***/
extern void *	    	/*XXX*/
    _pascal MemLockShared (MemHandle mh);

/***/

extern void 	    	/*XXX*/
    _pascal MemUnlockShared (MemHandle mh);

/***/

extern void *	    	/*XXX*/
    _pascal MemLockExcl (MemHandle mh);

/***/

#define MemUnlockExcl (mh) MemUnlockShared(mh)

/***/

extern void 	    	/*XXX*/
    _pascal MemDowngradeExclLock (MemHandle mh);

/***/

extern void *	    	/*XXX*/
    _pascal MemUpgradeSharedLock (MemHandle mh);

/***/

extern MemHandle
    _pascal LZGAllocCompressStack (GeodeHandle stackOwner);

/***/

extern void
    _pascal LZGFreeCompressStack (MemHandle compressStack);

/***/

extern int
    _pascal LZGCompress (byte *compressBuffer, byte *data,
            int dataSize, MemHandle compressStack);

/***/

extern int
    _pascal LZGUncompress (byte *dataBuffer, byte *compressedData);

/***/

extern int
    _pascal LZGGetUncompressedSize (byte *compressedData);

/*
 *	Argument for MSG_PROCESS_MEM_FULL
 */

typedef enum /* word */ {
    HC_SCRUBBING    ,
    HC_CONGESTED    ,
    HC_DESPERATE
} HeapCongestion} ;

#ifdef __HIGHC__
pragma Alias(MemAlloc, "MEMALLOC");
pragma Alias(MemAllocSetOwner, "MEMALLOCSETOWNER");
pragma Alias(MemReAlloc, "MEMREALLOC");
pragma Alias(MemFree, "MEMFREE");
pragma Alias(MemGetInfo, "MEMGETINFO");
pragma Alias(MemModifyFlags, "MEMMODIFYFLAGS");
pragma Alias(HandleModifyOwner, "HANDLEMODIFYOWNER");
pragma Alias(MemModifyOtherInfo, "MEMMODIFYOTHERINFO");
pragma Alias(MemLock, "MEMLOCK");
pragma Alias(MemUnlock, "MEMUNLOCK");
pragma Alias(HandleP, "HANDLEP");
pragma Alias(HandleV, "HANDLEV");
pragma Alias(MemPLock, "MEMPLOCK");
pragma Alias(MemUnlockV, "MEMUNLOCKV");
pragma Alias(MemThreadGrab, "MEMTHREADGRAB");
pragma Alias(MemThreadGrabNB, "MEMTHREADGRABNB");
pragma Alias(MemThreadRelease, "MEMTHREADRELEASE");
pragma Alias(MemDeref, "MEMDEREF");
pragma Alias(MemOwner, "MEMOWNER");
pragma Alias(MemPtrToHandle, "MEMPTRTOHANDLE");
pragma Alias(MemInitRefCount, "MEMINITREFCOUNT");
pragma Alias(MemIncRefCount, "MEMINCREFCOUNT");
pragma Alias(MemDecRefCount, "MEMDECREFCOUNT");
pragma Alias(MemLockFixedOrMovable, "MEMLOCKFIXEDORMOVABLE");
pragma Alias(MemUnlockFixedOrMovable, "MEMUNLOCKFIXEDORMOVABLE");
pragma Alias(MemLockExcl, "MEMLOCKEXCL");
pragma Alias(MemLockShared, "MEMLOCKSHARED");
pragma Alias(MemUnlockShared, "MEMUNLOCKSHARED");
pragma Alias(MemUpgradeSharedLock, "MEMUPGRADESHAREDLOCK");
pragma Alias(MemDowngradeExclLock, "MEMDOWNGRADEEXCLLOCK");
pragma Alias(MemDiscard, "MEMDISCARD");
pragma Alias(LZGAllocCompressStack, "LZGALLOCCOMPRESSSTACK");
pragma Alias(LZGFreeCompressStack, "LZGFREECOMPRESSSTACK");
pragma Alias(LZGCompress, "LZGCOMPRESS");
pragma Alias(LZGUncompress, "LZGUNCOMPRESS");
pragma Alias(LZGGetUncompressedSize, "LZGGETUNCOMPRESSEDSIZE");
#endif

#endif


Objects\helpCC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PC/GEOS
 * FILE:	  helpCC.goh
 *
 * AUTHOR:  	  Gene Anderson: Dec  8, 1992
 *
 * REVISION HISTORY:
 *	Name	  Date	    Description
 *	----	  ----	    -----------
 *	gene	  12/ 8/92  Initial version
 *
 * DESCRIPTION:
 *
 *
 *
 * 	$Id: helpCC.goh,v 1.20.4.1 96/04/28 08:31:47 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

#include  <file.h>
#include  <Objects/helpCC.h>

/******************************************************************************
 *	Utility routines exported by library
 *****************************************************************************/

extern void _far _pascal HelpSendHelpNotification (word HelpType, const char *contextname, const char *filename);

/******************************************************************************
 *	HelpControlClass
 *****************************************************************************/

@class HelpControlClass, GenControlClass;

typedef struct {
    word    	    	PI_unused;
    MouseReturnFlags	PI_mouseFlags;
    /*
     * PI_pointerImage is valid only
     * when PI_mouseFlags == MRF_SET_POINTER_IMAGE.
     */
    optr    	    	PI_pointerImage;
} PointerImage} ;

/*
 * Messages
 */
@message void MSG_HELP_CONTROL_FOLLOW_LINK (word nameToken = cx,
                                           word fileToken = dx);

@message void MSG_HELP_CONTROL_GET_POINTER_IMAGE (
                                PointerImage *retValue = bpaxdxcx,
                                word notLinkFlag = cx);

/*
 * Internal messages
 */
@message void MSG_HC_GO_BACK ();
@message void MSG_HC_FIRST_AID_GO_BACK ();
@message void MSG_HC_GET_HISTORY_LIST_MONIKER ();/* NEEDS PROTOTYPE */
@message void MSG_HC_GOTO_HISTORY ();	    	/* NEEDS PROTOTYPE *.
@message void MSG_HC_BRING_UP_TOC();
@message void MSG_HC_CHOOSE_FIRST_AID(VisTextContextType fatype = cx);
@message void MSG_HC_BRING_UP_HELP();

@protominor UINewFor21

typedef struct {
    word	    GLNP_linkToken;
    word	    GLNP_fileToken;
    ContextName	    GLNP_linkName;
    FileLongName    GLNP_fileName;
} GetLinkNameParams;

@message void MSG_HC_GET_LINK_NAME(GetLinkNameParams *params);

@protoreset

@protominor UINewForResponder

@message void MSG_HELP_CONTROL_SET_HELP_TYPE(HelpType helpType = cx);

typedef struct {
    ContextName	    GCCP_contextName;
    FileLongName    GCCP_fileName;
} GetCurrentContextParams;

@message void MSG_HELP_CONTROL_GET_CURRENT_CONTEXT(GetCurrrentContextParams *params cx:dx);

@message optr MSG_HELP_CONTROL_GET_CURRENT_TITLE(MemHandle allocHan = cx) = cx:dx;

@protoreset

/*
 *	attrs & hints
 */

    @vardata	void ATTR_HELP_SUPPRESS_INITIATE;
    @vardata	char[] ATTR_HELP_INITIAL_HELP;
    @vardata	optr ATTR_HELP_CUSTOM_POINTER_IMAGE;

    @vardata	CompSizeHintArgs HINT_HELP_TEXT_FIXED_SIZE;
    @vardata	void HINT_HELP_NOT_RESIZABLE;

    @vardata	char[] ATTR_HELP_INITIAL_HELP_FILE;

/*
 *	Internal vardata
 */
    @vardata	TCHAR[] TEMP_HELP_ERROR_FILENAME;
    @vardata	TCHAR[] TEMP_HELP_TOC_FILENAME;
    @vardata	void TEMP_HELP_DETACH_RECEIVED;
    @vardata	optr TEMP_HELP_HEAPSPACE_TOKEN;

/*
 *	Instance Data
 */
    @instance	HelpType    HCI_helpType;
    @instance	MemHandle   HCI_curFile;
    @instance   MemHandle   HCI_historyBuf;
    @instance	word	    HCI_nameArrayVM;
    @instance	GeodeHandle HCI_compressLib;

    @default GII_attrs = (@default | GIA_NOT_USER_INITIATABLE);
    @default GII_visibility = GIV_DIALOG;

@endc

@endlib


Objects\helpCC.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1993 -- All Rights Reserved
 *
 * PROJECT:	  GEOS
 * FILE:	  helpCC.h
 *
 * AUTHOR:  	  Jenny Greenwood, Sept 3, 1993
 *
 * REVISION HISTORY:
 *	Name	  Date	    Description
 *	----	  ----	    -----------
 *	jenny     9/03/93   Initial version (broke out of helpCC.goh)
 *
 * DESCRIPTION:
 *
 *      Constants and structures for the help library.
 *
 * 	$Id: helpCC.h,v 1.2.6.1 96/04/28 08:30:51 chris Exp $
 *
 ***********************************************************************/

#ifndef __HELPCC_H
#define __HELPCC_H

#include  <file.h>

/******************************************************************************
 *	HelpControlClass
 *****************************************************************************/

/*
 * Constants and structures
 */

typedef ByteEnum HelpType ;
#define HT_NORMAL_HELP  0
#define HT_FIRST_AID  1
#define HT_STATUS_HELP  2
#define HT_SIMPLE_HELP  3
#define HT_SYSTEM_HELP  4
#define HT_SYSTEM_MODAL_HELP  5

typedef WordFlags HPCFeatures ;
#define HPCF_HELP    	  	0x0100
#define HPCF_TEXT    	    	0x0080
#define HPCF_CONTENTS 	    	0x0040
#define HPCF_HISTORY 	    	0x0020
#define HPCF_GO_BACK 	    	0x0010
#define HPCF_CLOSE 	    	0x0008
#define HPCF_INSTRUCTIONS    	0x0004
#define HPCF_FIRST_AID_GO_BACK 	0x0002
#define HPCF_FIRST_AID 	    	0x0001

#define MAX_CONTEXT_NAME_SIZE 	20
#define CONTEXT_NAME_BUFFER_SIZE  22
/* allow for NULL, word-align */

typedef char ContextName [CONTEXT_NAME_BUFFER_SIZE];

typedef struct {
    HelpType	    NHCC_type;
    ContextName	    NHCC_context;
    FileLongName    NHCC_filename;
    FileLongName    NHCC_filenameTOC;
} NotifyHelpContextChange} ;

#endif


hugearr.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	hugearr.h
 * AUTHOR:	Jim DeFrisco: October 20, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines HugeArray structures and routines.
 *
 *	$Id: hugearr.h,v 1.18.4.1 96/04/28 08:27:56 chris Exp $
 *
 ***********************************************************************/

#ifndef	__HUGEARR_H
#define __HUGEARR_H

/*
 *	Constants and Structures
 */

typedef struct {
    LMemBlockHeader	HAD_header;
    VMBlockHandle	HAD_data;
    ChunkHandle		HAD_dir;
    VMBlockHandle	HAD_xdir;
    VMBlockHandle	HAD_self;
    word		HAD_size;
} HugeArrayDirectory} ;

/***/

extern VMBlockHandle	/*XXX*/
    _pascal HugeArrayCreate (VMFileHandle vmFile, word elemSize, word headerSpace);

/***/

extern void 		/*XXX*/
    _pascal HugeArrayDestroy (VMFileHandle vmFile, VMBlockHandle vmBlock);

/***/

#define	HAL_COUNT	(val) 	((word) (val))
#define	HAL_PREV	(val) 	((word) ((val)>>16))

extern dword		/*XXX*/
    _pascal HugeArrayLock (VMFileHandle vmFile, VMBlockHandle vmBlock,
              dword elemNum, void **elemPtr, word *elemSize);

/***/

extern void		/*XXX*/
    _pascal HugeArrayUnlock (void *elemPtr);

/***/

extern void		/*XXX*/
    _pascal HugeArrayLockDir (VMFileHandle vmFile, VMBlockHandle vmBlock,
             void **elemPtr);

/***/

extern void		/*XXX*/
    _pascal HugeArrayUnlockDir (void *elemPtr);

/***/

extern dword		/*XXX*/
    _pascal HugeArrayAppend (VMFileHandle vmFile, VMBlockHandle vmBlock,
            word numElem, const void *initData);

/***/

extern void 		/*XXX*/
    _pascal HugeArrayInsert (VMFileHandle vmFile, VMBlockHandle vmBlock,
            word numElem, dword elemNum, const void *initData);

/***/

extern void		/*XXX*/
    _pascal HugeArrayDelete (VMFileHandle vmFile, VMBlockHandle vmBlock,
            word numElem, dword elemNum);

/***/

extern dword		/*XXX*/
    _pascal HugeArrayGetCount (VMFileHandle vmFile, VMBlockHandle vmBlock);

/***/

extern void		/*XXX*/
    _pascal HugeArrayReplace (VMFileHandle vmFile, VMBlockHandle vmBlock,
             word numElem, dword elemNum, const void *initData);

/***/

extern word		/*XXX*/
    _pascal HugeArrayNext (void **elemPtr, word *size);

/***/

extern word		/*XXX*/
    _pascal HugeArrayPrev (void **elemPtr1, void **elemPtr2, word *size);

/***/

extern word		/*XXX*/
    _pascal HugeArrayExpand (void **elemPtr, word numElem,
                const void *initData);

/***/

extern word		/*XXX*/
    _pascal HugeArrayContract (void **elemPtr, word numElem);

/***/

extern void		/*XXX*/
    _pascal HugeArrayDirty (const void *elemPtr);

/***/

extern void		/*XXX*/
    _pascal HugeArrayResize (VMFileHandle vmFile, VMBlockHandle vmBlock,
                    dword elemNum, word newSize);

/***/

extern Boolean		/*XXX*/
    _pascal HugeArrayEnum (VMFileHandle vmFile, VMBlockHandle vmBlock,
            PCB(Boolean, callback,	/* TRUE to stop */
                (void *element, void *enumData)),
                dword startElement, dword count,
            void *enumData
          );

/***/

extern void		/*XXX*/
    _pascal ECCheckHugeArray (VMFileHandle vmFile, VMBlockHandle vmBlock);

/***/

extern void		/*XXX*/
    _pascal HugeArrayCompressBlocks (VMFileHandle vmFile,VMBlockHandle vmBlock);

/***/

#ifdef __HIGHC__
pragma Alias(HugeArrayCreate, "HUGEARRAYCREATE");
pragma Alias(HugeArrayDestroy, "HUGEARRAYDESTROY");
pragma Alias(HugeArrayLock, "HUGEARRAYLOCK");
pragma Alias(HugeArrayUnlock, "HUGEARRAYUNLOCK");
pragma Alias(HugeArrayLockDir, "HUGEARRAYLOCKDIR");
pragma Alias(HugeArrayUnlockDir, "HUGEARRAYUNLOCKDIR");
pragma Alias(HugeArrayAppend, "HUGEARRAYAPPEND");
pragma Alias(HugeArrayInsert, "HUGEARRAYINSERT");
pragma Alias(HugeArrayDelete, "HUGEARRAYDELETE");
pragma Alias(HugeArrayGetCount, "HUGEARRAYGETCOUNT");
pragma Alias(HugeArrayReplace, "HUGEARRAYREPLACE");
pragma Alias(HugeArrayNext, "HUGEARRAYNEXT");
pragma Alias(HugeArrayPrev, "HUGEARRAYPREV");
pragma Alias(HugeArrayExpand, "HUGEARRAYEXPAND");
pragma Alias(HugeArrayContract, "HUGEARRAYCONTRACT");
pragma Alias(HugeArrayDirty, "HUGEARRAYDIRTY");
pragma Alias(HugeArrayResize, "HUGEARRAYRESIZE");
pragma Alias(HugeArrayEnum, "HUGEARRAYENUM");
pragma Alias(ECCheckHugeArray, "ECCHECKHUGEARRAY");
pragma Alias(HugeArrayCompressBlocks, "HUGEARRAYCOMPRESSBLOCKS");
#endif

#endif


hwr.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	HWR Library
 * FILE:	hwr.h
 *
 *
 * REVISION HISTORY:
 *
 *	Name	Date		Description
 *	----	----		-----------
 *	atw	9/16/92		Initial revision
 *
 *
 * DESCRIPTION:
 *	Contains exported routines/structures for the HWR library.
 *
 *	$Id: hwr.h,v 1.15.4.1 96/04/28 08:28:16 chris Exp $
 *
 ***********************************************************************/

#ifndef	__HWR_H
#define	__HWR_H

/* Include "graphics.h" for definition of Rectangle */
#include  <graphics.h>

/***********************************************************************/
/* HWR Library Protocol
/***********************************************************************/
/*
 * All hwr libraries will need to have the following line in their
 * local.mk file:
 *	PROTOCONST	= HWRLIB
 */

#define HWRLIB_PROTO_MAJOR  2
#define HWRLIB_PROTO_MINOR  0
#define HWRLIB_PROTO_MAJOR_FOR_2_1  2

#define HWR_NUMBER_RESERVED_ENTRIES  16
/*
 * This is the number of library entry points reserved for future HWR Library
 * routines defined for geos.
 *
 * A HWR Library should use skip until HWRR_LAST_RESERVED_ENTRY in its
 * .gp file between the exported routines defined for geos, and any
 * exported routines specific to that Library.
 */

#ifdef DBCS_PCGEOS
#define HWR_STRING_ESCAPE_VALUE 	0xee01
#else
#define HWR_STRING_ESCAPE_VALUE  0xff01
#endif

typedef	enum {
    HWRR_BEGIN_INTERACTION    ,
    HWRR_END_INTERACTION    ,
/*
 *	Most HWR drivers can not handle multiple clients at once. Clients
 *	should call HWRR_BEGIN_INTERACTION before any other HWR calls, and
 *	HWRR_END_INTERACTION after their HWR calls.
 *
 *	NOTE: Assume that after you call HWRR_END_INTERACTION, all of the
 *	      parameters you've set up (points added, filters activated) will
 *	      be destroyed.
 *
 *	PROTOTYPES:
 *	    Boolean HWRBeginInteraction(void);
 *	    void HWREndInteraction(void);
 *
 *		 If HWRR_BEGIN_INTERACTION returns non-zero, do not call
 *		 HWRR_END_INTERACTION.
 */

    HWRR_RESET    ,
/*
 *	Resets the library in preparation of sending a new set of ink data
 *	to it. This nukes all old points, and re-enables the entire character
 *	set.
 *
 *	PROTOTYPE:
 *	    void HWRReset(void);
 */

    HWRR_DISABLE_CHAR_RANGE    ,
/*
 *	Disables the passed range of characters - this means that strokes
 *	will not be recognized as these characters.
 *
 *	PROTOTYPE:
 *	    void HWRDisableCharRange(wchar firstChar, wchar lastChar);
 */

    HWRR_ENABLE_CHAR_RANGE    ,
/*
 *	Enables the passed range of characters - this means that strokes
 *	can be recoginized by these characters.
 *
 *	PROTOTYPE:
 *	    void HWREnableCharRange(wchar firstChar, wchar lastChar);
 */

    HWRR_SET_CHAR_FILTER_CALLBACK    ,
/*
 *
 *	Calls the passed callback routine with characters.
 *
 *	PROTOTYPE:
 *	    void HWRSetCharFilterCallback(HWRCharFilter *callback,
 *	    	    	    	    	  void *callbackData);
 *
 *	Callback should return character chosen (it does not necessarily have
 *	    to be one of the characters in the passed array)
 *	If none of the choices are satisfactory, it can return 0, which means
 *	    to ignore the character.
 */

    HWRR_SET_STRING_FILTER_CALLBACK    ,
/*
 *	This allows the application to specify his own filter routine on
 *	an entire word basis (as opposed to a char by char basis)
 *
 *	NOTE: If the app specifies a "WHOLE_WORD" filter callback, it should
 *	      not also specify a "CHAR_FILTER" callback, as the "CHAR_FILTER"
 *	      callback will not be called.
 *
 *	PROTOTYPE:
 *	    void HWRSetWholeWordFilterCallback(HWRStringFilter *callback,
 *	    	    	    	    	       void *callbackData);
 *
 *	Callback routine returns:
 *
 *		Handle of block containing null-terminated
 *		     ink data
 */

    HWRR_ADD_POINT    ,
/*
 *	This allows the application to add one point at a time to the list of
 *	points being collected and recognized
 *
 *	PROTOTYPE:
 *	   void HWRAddPoint (InkXCoord xCoord, sword yCoord, dword timeStamp);
 *
 *	The time stamp is normally passed as 0 (many HWR drivers will ignore
 * 	it in any case), but it can be passed as an actual value for
 *	certain real-time applications, such as signature verification)
 */

    HWRR_ADD_POINTS    ,
/*
 *	This adds a bunch of points at once. No time stamp information is
 *	passed - if you need to pass time stamp information, use HWRR_ADD_POINT
 *	instead.
 *
 *	PROTOTYPE:
 *	    void HWRAddPoints (word numPoints, InkPoint *points);
 */

    HWRR_DO_GESTURE_RECOGNITION    ,
/*
 *	Checks to see if the points are a single gesture.
 *
 *	PROTOTYPE:
 *	    GestureType HWRDoGestureRecognition(void);
 */

    HWRR_DO_SINGLE_CHAR_RECOGNITION    ,
/*
 *	This tries to recognize the ink input as a single character. This is
 *	useful in situations where you know that the input should be just one
 *	character.
 *
 *	PROTOTYPE:
 *	    wchar HWRDoSingleCharRecognition(void);
 *
 *	    Returns 0 if the ink wasn't recognized.
 */

    HWRR_DO_MULTIPLE_CHAR_RECOGNITION    ,
/*
 *	This returns a null-terminated string that was recognized from the
 *	input.
 *
 *	PROTOTYPE:
 *	    MemHandle HWRDoMultipleCharRecognition(InkPoint *);
 *
 *	    Returns handle of block containing null-terminated data
 */

    HWRR_GET_HWR_MANUF_ID    ,
/*
 *	Returns the manufacturer of the HWR. This may be useful if you want
 *	to call certain special features that only exist in certain drivers.
 *	(For example, if one was writing a signature verification application
 *	that required a specific HWR driver).
 *
 *	PROTOTYPE:
 *	    ManufacturerID HWRGetHWRManufID (void)
 */

    HWRR_SET_CONTEXT    ,
/*
 *	Puts the hwr engine in line/grid/boxed mode.
 *
 *	PROTOTYPE:
 *	    void HWRSetContext(HWRContext *context);
 */

    HWRR_SET_LANGUAGE    ,
/*
 *	Sets the default hwr language
 *
 *	PROTOTYPE:
 *	    void HWRSetLanguage(StandardLanguage language);
 */

/*
 *  The following functions were added for release 2.1 and later
 */

    HWRR_GET_GESTURE_BOUNDS    ,
/*
 *	Returns a handle to a rectangle structure which contains the
 *      bounds of the last gesture recognized
 *
 *	PROTOTYPE:
 *	    MemHandle HWRGetGestureBounds(void);
 */

    HWRR_RESET_MACRO    ,
/*
 *
 *      Tells the HWR library that the current macro in progress must
 *	be cleared. Returns a handle to a HWRStringMacro that will
 *	clean up anything displayed for the current macro
 *
 *      PROTOTYPE:
 *          MemHandle HWRResetMacro(void);
 */

    HWRR_GET_CHAR_BOUNDS    ,
/*
 *      called from the custom char callback, returns a handle to a
 *      rectangle structure which contains the bounds of the last
 *      character recognized.
 *
 *      PROTOTYPE:
 *          MemHandle HWRGetCharBounds(void);
 */

} HWRRoutine} ;

#define HWRR_LAST_RESERVED_ENTRY  (HWRR_GET_CHAR_BOUNDS + HWR_NUMBER_RESERVED_ENTRIES)

typedef enum {
    HM_NONE	,
    /*
     * The user is writing in a multi-line object - no guidelines
     */

    HM_LINE	,
    /*
     * The user has a reference line to write on
     */

    HM_BOX	,
    /*
     * The user has a box to write into
     */

    HM_GRID
    /*
     * The user has a grid to write chars into (one char per box)
     */

} HWRMode} ;

typedef	struct {
    HWRMode	HWRND_mode;
} HWRNoneData} ;

typedef	struct {
    HWRMode	    	HWRLD_mode;
    sword	    	HWRLD_line;
} HWRLineData} ;

typedef struct {
    HWRMode	    	HWRBD_mode;
    sword	    	HWRBD_top;
    sword	    	HWRBD_bottom;
} HWRBoxData} ;

typedef	struct {
    HWRMode	    	HWRGD_mode;
    Rectangle   	HWRGD_bounds;
    /* Bounds of grid area (in same coords as ink data) */

    sword	    	HWRGD_xOffset;
    sword	    	HWRGD_yOffset;
    /* X/Y offsets between grid lines */
} HWRGridData} ;

typedef	union {
          HWRNoneData 	HWRC_none;
    HWRLineData 	HWRC_lined;
    HWRBoxData	HWRC_boxed;
    HWRGridData 	HWRC_grid;
} HWRContext} ;

typedef struct {
        word	CCI_numChoices;
    /*
     * The # choices for this character - note, this can be zero if the
     * user entered a blob of ink that was not recognized, but was also
     * parsed as being a separate character.
     */

    word	CCI_firstPoint;
    /*
     * Offset to the first point in the ink data corresponding to this char
     */

    word	CCI_lastPoint;
    /* Offset to the last point in the ink data in this char */

    wchar    *CCI_data;
    /* Ptr to characters */

} CharChoiceInformation} ;

typedef wchar _pascal HWRCharFilter  (word numChoices, word firstPoint, word lastPoint, wchar *charChoices, void *callbackData);
typedef MemHandle _pascal HWRStringFilter  (word numChars, CharChoiceInformation *data, void *callbackData);

typedef	WordFlags   InkXCoord   ;
#define IXC_TERMINATE_STROKE 	0x8000

typedef struct {
    InkXCoord   	IP_x;
    word	    	IP_y;
} InkPoint} ;

typedef enum {
    GT_NO_GESTURE	,
    GT_DELETE_SELECTION	,
    GT_SELECT_CHARS	,
    GT_V_CROSSOUT	,
    GT_H_CROSSOUT	,
    GT_BACKSPACE	,
/*
 *  The following gesture types were added for release 2.1 and later
 */
    GT_CHAR	,
    GT_STRING_MACRO	,
    GT_IGNORE_GESTURE	,
    GT_COPY	,
    GT_PASTE	,
    GT_CUT	,
    GT_MODE_CHAR	,
    GT_REPLACE_LAST_CHAR	,
} GestureType} ;

typedef struct {
        word            HWRSM_deleteCount;
} HWRStringMacro} ;

typedef	ByteFlags   HWRLockState   ;
#define HWRLS_EQN_LOCK 	0x04
#define HWRLS_NUM_LOCK 	0x02
#define HWRLS_CAP_LOCK 	0x01

typedef	ByteEnum    HWRTemporaryShiftState    ;
#define HWRTSS_NONE  0
#define	HWRTSS_PUNCTUATION	  1
#define HWRTSS_EXTENDED 	2
#define HWRTSS_CASE  3
#define HWRTSS_DOWNCASE  4

/*
 *	Macros to make it easier to call the HWR library
 */

#define	CallHWRLibrary_NoArgs	(libHan, callType) (ProcCallFixedOrMovable_pascal (ProcGetLibraryEntry(libHan, callType)))

#define	CallHWRLibrary_OneArg	(libHan, callType, arg) (ProcCallFixedOrMovable_pascal (arg, ProcGetLibraryEntry(libHan, callType)))

#define CallHWRLibrary_TwoArgs (libHan, callType, arg1, arg2) (ProcCallFixedOrMovable_pascal (arg1, arg2, ProcGetLibraryEntry(libHan, callType)))

#endif


iacp.goh

/******************************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	Include Files
 * MODULE:	IACP Specification
 * FILE:	iacp.goh
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	ardeb	10/12/92	Initial revision
 *
 *
 * DESCRIPTION:
 *	Definition of IACP structures, constants and routines
 *
 *	$Id: iacp.goh,v 1.11.1.1 96/04/28 08:28:46 chris Exp $
 *
 ******************************************************************************/
@optimize

@deflib	ui

/******************************************************************************
 *
 *		       Data Types and Constants
 *
 ******************************************************************************/

/*
 * The data type used to identify an active IACP connection.
 */
typedef word IACPConnection ;

#define IACP_NO_CONNECTION  	0	/* Returned by IACPConnect if it is
                     *  unable to establish a connection */

/*
 * The mode in which an IACP server is operating. A user-interactible server
 * is expected to cope with messages addressed to a non-user-interactible
 * server, but the reverse is not true.
 */
typedef ByteEnum IACPServerMode ;
#define IACPSM_NOT_USER_INTERACTIBLE 	0
#define IACPSM_IN_FLUX 	    	    	1
#define IACPSM_USER_INTERACTIBLE     	2

typedef ByteFlags IACPServerFlags ;
#define    IACPSF_MULTIPLE_INSTANCES     	0x80
    /* Set if application may have multiple instances of itself launched */
#define	   IACPSF_MAILBOX_DONT_NOTIFY_USER	    0x40
    /* Set if application should be immediately sent all new messages when it's
     * running in the foreground. */

typedef WordFlags IACPConnectFlags ;	/* Flags to pass to IACPConnect */
#define IACPCF_OBEY_LAUNCH_MODEL 	0x0020
    /* Set if IACP should obey any launch model for the field that would cause
     * it to ask the user whether an existing server should be used, or a new
     * one started. AppLaunchBlock must be passed w/ALB_appMode set to
     * OPEN_APPLICATION and IACPCF_SERVER_MODE set to IACPSM_USER_INTERACTIBLE.
     */
#define IACPCF_CLIENT_OD_SPECIFIED 	0x0010
    /* Set to indicate ^lcx:dx contains client OD for the IACP connection. If
     * not set, the client OD is set to the application object of the process on
     * whose thread the IACPConnect call is made.*/

#define IACPCF_FIRST_ONLY 		0x0008
    /* Set to connect only to the first server on the list, else connects to
     * all of them. */

#define IACPCF_SERVER_MODE   	    	0x0007
    /* Mode in which server is expected to be operating (IACPSM_IN_FLUX not
     * allowed). Higher-numbered modes are expected to support requests for
     * lower-numbered modes. */

#define IACPCF_SERVER_MODE_OFFSET 	0

typedef enum {				/* Specify which side of an IACP
                     *  connection is sending a message
                     *  via IACPSendMessage */
    IACPS_CLIENT    ,
    IACPS_SERVER
} IACPSide} ;

/*
 * Reason an IACPConnect failed. Note that if no server exists, and the
 * caller passed an AppLaunchBlock, and IACP was unable to load the server,
 * it will return a GeodeLoadError (defined in geode.def). IACPConnectError
 * codes purposely start after the highest GeodeLoadError
 */
typedef enum {
    IACPCE_CANNOT_FIND_SERVER    =GLE_LAST_GEODE_LOAD_ERROR,
    /* asked to start server w/o specifying location of app, and IACP was
     * unable to find an application with the same token as the list. */

    IACPCE_NO_SERVER
    /* didn't ask IACP to start server, and no server is registered for the
     * list. */
} IACPConnectError} ;

/******************************************************************************
 *
 *			Imported MetaMessages
 *
 ******************************************************************************/

@importMessage MetaIACPMessages,
           void MSG_META_IACP_PROCESS_MESSAGE (EventHandle msgToSend = cx,
                          TravelOption topt = dx,
                          EventHandle completionMsg=bp);
/* Dispatch an IACP message to its rightful destination, sending the
 * passed completion message back when that has finished.
 *
 * Context:	This is sent by the IACP system to get the processing
 *		of the two recorded messages to happen on someone else's
 *		time.
 * Source:	IACPSendMessage
 * Destination: Any object registered as an IACP server, or the GenApplication
 *		object of a geode who is a client of such.
 * Interception:If you have an object other than GenApplication that is an
 *		IACP server, you will need to intercept this message. You
 *		do not need to pass it to the superclass. Usually you will
 *		just want to call IACPProcessMessage.
 *
 * Pass:
 *		msgToSend = handle of recorded message the other side of the
 *			    connection is actually sending.
 *		topt = TravelOption or -1. If -1, msgToSend should be
 *		       dispatched via MessageDispatch, else it should be
 *		       delivered by sending MSG_META_SEND_CLASSED_EVENT to
 *		       yourself.
 *		completionMsg = handle of recorded message to send when the
 *				message in msgToSend has been handled. If 0,
 *				then there's no completion message to send.
 * Return:
 *		nothing
 */

@importMessage MetaIACPMessages,
           void MSG_META_IACP_NEW_CONNECTION (MemHandle appLaunchBlock=cx,
                         Boolean justLaunched=dx,
                         IACPConnection connection=bp);
/* Take note that another client has connected to you.
 *
 * Context:	Sent by the IACP system to every server to which a client
 *		connects when it calls IACPConnect
 * Source:	IACPConnect
 * Destination: Any object registered as an IACP server.
 * Interception:Must be intercepted if you want to do anything about receiving
 *		a new client, as there is no default handler for this message.
 *		If you don't intercept it, no harm done.
 *
 * Pass:
 *		appLaunchBlock = handle of AppLaunchBlock passed to
 *				 IACPConnect. DO NOT FREE THIS BLOCK.
 *		justLaunched = non-zero if recipient was just launched (i.e.
 *			       it received the AppLaunchBlock in its
 *			       MSG_META_ATTACH call)
 *		connection = IACPConnection that is now open.
 *
 * Return:
 *		nothing
 */

@importMessage MetaIACPMessages,
           void MSG_META_IACP_LOST_CONNECTION (IACPConnection connection=bp,
                          word serverNum = cx);

/* Take note that one of your clients has shutdown.
 *
 * Context:	Sent by the IACP system to the other side of a connection
 *		when one side shuts down.
 * Source:	IACPShutdown
 * Destination: Any object registered as an IACP server, or the GenApplication
 *		object of a geode who is a client of such.
 * Interception:Must be intercepted if you want to do anything about losing
 *		a client or server, as there is no default handler for this
 *		message. IACPLostConnection is a good routine for servers
 *		to call (and is called by GenApplication, for example) to ensure
 *		that connections don't hang around too long after the client
 *		has shut down its side.
 *
 * Pass:
 *		serverNum = server number that shut down, or 0 if it was
 *			    the client that shut down (and thus it's a server
 *			    object that's receiving this message).
 *		connection = IACPConnection being closed
 * Return:
 *		nothing
 */

@importMessage MetaIACPMessages,
           void MSG_META_IACP_SHUTDOWN_CONNECTION (IACPConnection connection=bp);
/* Shutdown the appropriate side of the indicated connection.
 *
 * Context:	Sent to server object after all relevant queues have been
 *		flushed following a call to IACPLostConnection.
 * Source:	IACPLostConnection, after a delay
 * Destination: Any IACP server object
 * Interception:Must be intercepted to finish the work of the call to
 *		IACPLostConnection. Call IACPShutdownConnection to
 *		get default handling of this message.
 *
 * Pass:
 *		connection = IACPConnection to shutdown
 * Return:
 *		nothing
 */

typedef struct {
    optr    	    IDOAP_docObj;	/* optr of the document object managing
                     *  the document */
    IACPConnection  IDOAP_connection;	/* connection over which open request
                     *  was received */
    word    	    IDOAP_serverNum;	/* server number the document object's
                     *  GenApplication object is for that
                     *  connection (0 if connection goes
                     *  through some other object) */
} IACPDocOpenAckParams} ;

@importMessage MetaIACPMessages,
           void MSG_META_IACP_DOC_OPEN_ACK (IACPDocOpenAckParams *params=ss:bp);
/* The document passed in the AppLaunchBlock when the IACP connection was
 * made has been opened. The optr of the GenDocument object managing the
 * document is passed so messages can be sent to it explicitly, though
 * these messages must always be sent via IACP (with a TravelOption of -1),
 * not using ObjMessage, to deal with the application being able to exit at
 * any time.
 *
 * Context:	Sent to the client of a new IACP connection if a document
 * 		was passed in the AppLaunchBlock.
 * Source:	GenDocumentGroup
 * Destination:	IACP client (usually the GenApplication object of client app)
 * Interception:No default handler defined.
 *
 * Pass:
 * 		params->IDOAP_docObj	= optr of GenDocument object
 * 		params->IDOAP_connection = IACPConnection that requested the
 *					   open
 *		params->IDOAP_serverNum = server number of the GenDocument
 *					  object's GenApplication object
 *					  for that connection. 0 if the
 *					  GenApplication object isn't actually
 *					  a server for that connection.
 * Return:
 * 		nothing
 */

typedef struct {
    optr	    IDCAP_docObj;	/* optr of the document object that was
                     * managing the document */
    IACPConnection  IDCAP_connection;	/* connection that requested the close
                     */
    word    	    IDCAP_serverNum;	/* server number the document object's
                     * GenApplication object is for that
                     * connection (0 if connection goes
                     * through some other object) */
    word    	    IDCAP_status;   	/* DocQuitStatus (gDocGrpC.goh) for
                     * the close. */
} IACPDocCloseAckParams} ;

@importMessage MetaIACPMessages,
        void MSG_META_IACP_DOC_CLOSE_ACK (IACPDocCloseAckParams *params=ss:bp);
/* This is the acknowledgement sent by GenDocument after processing
 * MSG_GEN_DOCUMENT_CLOSE telling if the close was successful. Documents opened
 * via IACP always operate in transparent mode, meaning if you close a dirty
 * document, it will be saved. If you don't want the changes saved, you
 * will have to send a message to revert the document.
 *
 * Context:	    Sent by GenDocument after processing MSG_GEN_DOCUMENT_CLOSE
 * Source:	    GenDocumentClass
 * Destination:     IACP client
 * Interception:    No default handler defined.
 *
 * Pass:
 * 		params->IDCAP_docObj	= optr of GenDocument object (for
 *					  identification purposes only, as
 *					  object may already be gone by the
 *					  time you receive this message)
 * 		params->IDCAP_connection = IACPConnection that requested the
 *					   close
 *		params->IDCAP_serverNum = server number of the GenDocument
 *					  object's GenApplication object
 *					  for that connection. 0 if the
 *					  GenApplication object isn't actually
 *					  a server for that connection.
 *	    	params->IDCAP_status	= result of the close. Usually DQS_OK.
 * Return:
 *		nothing
 */

@importMessage MetaIACPMessages,
           void MSG_META_IACP_ALLOW_FILE_ACCESS (IACPConnection connection=bp);
/*
 * This message is sent to the server of a file (as registered via
 * IACPRegisterDocument) when a client to a connection established via
 * IACPConnectToDocumentServer needs access to access the file being served
 * (e.g., do a FileOpen on it, denying read/write privilege to others).
 * The recipient of this message should do its best to release its grip on
 * the file in question (the 48-bit unique file identifier can be obtained
 * by passing the IACPConnection to IACPGetDocumentConnectionFileID) until
 * it receives notification that the client is finished with the file via
 * MSG_META_IACP_NOTIFY_FILE_ACCESS_FINISHED.
 *
 * Context:	Sent to server object by client requesting exclusive
 *		access to a file.
 * Source:	IACPSendMessage
 * Destination:  IACP server
 * Interception: The default GenApplicationClass behavior for this message is
 * 		to check for HINT_APPLICATION_QUIT_ON_IACP_ALLOW_FILE_ACCESS,
 *		and send itself a MSG_META_DETACH, if found. If not found,
 *		GenApplicationClass will send a MSG_GEN_DOCUMENT_CLOSE_FILE
 *		to its model exclusive. Applications which register as servers
 *		of files which are not governed by a GenDocument, and which
 *		don't wish to detach when they receive this message, should
 *		intercept this message to close the file in question.
 */

@importMessage MetaIACPMessages,
           void MSG_META_IACP_NOTIFY_FILE_ACCESS_FINISHED (IACPConnection connection=bp);
/*
 * This message is sent to the server of a file (as registered via
 * IACPRegisterDocument) when a client to a connection established via
 * IACPConnectToDocumentServer has released its hold on the file in question,
 * to inform the server that it may reopen the file. The 48-bit unique file
 * identifier can be obtained by passing the IACPConnection to
 * IACPGetDocumentConnectionFileID, but note that there is no direct way
 * to map the unique identifier to a path and filename, as such that you
 * might pass to FileOpen, VMOpen, et. al., so the server object may need
 * to maintain a record of which file identifiers are associated with which
 * filenames if there's to be any question about which is which.
 *
 * Context:	Sent to server object by client to inform the server that
 *		it may reopen the file in question, if desired.
 * Source:	IACPSendMessage
 * Destination:  IACP server
 * Interception: The default GenApplicationClass behavior for this message is
 * 		to check for HINT_APPLICATION_QUIT_ON_IACP_ALLOW_FILE_ACCESS,
 *		and do nothing, if found. If not found,	GenApplicationClass
 *		will send a MSG_GEN_DOCUMENT_REOPEN_FILE to its model
 *		exclusive. Applications which register as servers
 *		of files which are not governed by a GenDocument, and which
 *		don't wish to detach when they receive this message, should
 *		intercept this message to reopen the file in question.
 */

/******************************************************************************
 *
 *			  Exported Routines
 *
 ******************************************************************************/

extern void
    _pascal IACPRegisterServer (GeodeToken *list, optr server,
                   IACPServerMode mode,
                   IACPServerFlags flags);

extern void
    _pascal IACPUnregisterServer (GeodeToken *list, optr server);

extern void
    _pascal IACPRegisterDocument (optr server, word disk, dword fileID);

extern void
    _pascal IACPUnregisterDocument (optr server, word disk, dword fileID);

extern IACPConnection
    _pascal IACPConnect (GeodeToken *list,
        IACPConnectFlags flags,
        MemHandle appLaunchBlock,
        optr client,
        word *numServersPtr);

extern IACPConnection
    _pascal IACPConnectToDocumentServer (const char _far *pathname,
                    const char _far *filename,
                    DiskHandle disk,
                    IACPConnectFlags flags,
                    optr client);

extern void
    _pascal IACPFinishConnect (IACPConnection connection, optr server);

extern word
    _pascal IACPSendMessage (IACPConnection connection,
            EventHandle msgToSend,
            TravelOption topt,
            EventHandle completionMsg,
            IACPSide side);

extern word
    _pascal IACPSendMessageAndWait (IACPConnection connection,
            EventHandle msgToSend,
            TravelOption topt,
            IACPSide side);

extern word
    _pascal IACPSendMessageToServer (IACPConnection connection,
            EventHandle msgToSend,
            TravelOption topt,
            EventHandle completionMsg,
            word serverNum);
extern void
    _pascal IACPShutdown (IACPConnection connection, optr server);

extern void
    _pascal IACPShutdownAll (optr obj);

extern dword
    _pascal IACPGetDocumentID (const char _far *pathname,
                  const char _far *filename,
                  DiskHandle *disk);

/*
 * Not yet ready for prime-time.
 *
 * extern Boolean
 *    _pascal IACPGetDocumentConnectionFileID(IACPConnection connection,
 *					    DiskHandle *disk,
 *					    dword *fileID);
 */

extern void
    _pascal IACPProcessMessage (optr oself,
                   EventHandle msgToSend,
                   TravelOption topt,
                   EventHandle completionMsg);

extern void
    _pascal IACPLostConnection (optr oself, IACPConnection connection);

extern MemHandle
    _pascal IACPCreateDefaultLaunchBlock (word appMode);

extern word
    _pascal IACPGetServerNumber (IACPConnection connection, optr server);

extern MemHandle
    _pascal IACPLocateServer (const GeodeToken *token);

extern void
    _pascal IACPBindToken (const GeodeToken *token, const char *appPath);

extern void
    _pascal IACPUnbindToken (const GeodeToken *token);

#ifdef __HIGHC__

pragma Alias(IACPRegisterServer,           "IACPREGISTERSERVER");
pragma Alias(IACPUnregisterServer,         "IACPUNREGISTERSERVER");
pragma Alias(IACPConnect,                  "IACPCONNECT");
pragma Alias(IACPConnectToDocumentServer,  "IACPCONNECTTODOCUMENTSERVER");
pragma Alias(IACPSendMessage,              "IACPSENDMESSAGE");
pragma Alias(IACPSendMessageToServer,	   "IACPSENDMESSAGETOSERVER");
pragma Alias(IACPSendMessageAndWait,       "IACPSENDMESSAGEANDWAIT");
pragma Alias(IACPShutdown,                 "IACPSHUTDOWN");
pragma Alias(IACPShutdownAll,              "IACPSHUTDOWNALL");
pragma Alias(IACPGetDocumentID,            "IACPGETDOCUMENTID");
/*
pragma Alias(IACPGetDocumentConnectionFileID, "IACPGETDOCUMENTCONNECTIONFILEID");
*/
pragma Alias(IACPProcessMessage,           "IACPPROCESSMESSAGE");
pragma Alias(IACPLostConnection,           "IACPLOSTCONNECTION");
pragma Alias(IACPCreateDefaultLaunchBlock, "IACPCREATEDEFAULTLAUNCHBLOCK");
pragma Alias(IACPGetServerNumber,	   "IACPGETSERVERNUMBER");
pragma Alias(IACPRegisterDocument,  	   "IACPREGISTERDOCUMENT");
pragma Alias(IACPUnregisterDocument,  	   "IACPUNREGISTERDOCUMENT");
pragma Alias(IACPFinishConnect,		   "IACPFINISHCONNECT");
pragma Alias(IACPLocateServer,		   "IACPLOCATESERVER");
pragma Alias(IACPBindToken,		   "IACPBINDTOKEN");
pragma Alias(IACPUnbindToken,		   "IACPUNBINDTOKEN");
#endif

@endlib


Internal\icbuff.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1994 -- All Rights Reserved
 *
 * PROJECT:	  Spell library
 * FILE:	  icbuff.h
 *
 * AUTHOR:  	  Joon Song: Oct 11, 1994
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	Joon	10/11/94   	Initial version
 *
 * DESCRIPTION:
 *	This file contains a description of the ICBuff structure.
 *
 *
 * 	$Id: icbuff.h,v 1.2.6.1 96/04/28 08:32:41 chris Exp $
 *
 ***********************************************************************/
#ifndef _ICBUFF_H_
#define _ICBUFF_H_

typedef struct {
    word	WM_data[4];
} WordMap} ;

typedef WordFlags SpellInitFlags ;
    #define SIF_USER_DICT_ERR 	(0x8000)
    /* 1 bit unused */
    #define SIF_HYP_INIT_ERR 	(0x2000)
    #define SIF_MULTI_DIAL 		(0x1000)
    #define SIF_NO_DIAL 		(0x0800)
    #define SIF_BUS_FIN 		(0x0400)
    #define SIF_LEGAL_AVAIL 		(0x0200)
    #define SIF_MED_SCI_AVAIL 	(0x0100)
    #define SIF_INIT_OK 		(0x0080)
    #define SIF_SEEK_ERR 		(0x0040)
    #define SIF_READ_ERR 		(0x0020)
    #define SIF_HEAD_ERR 		(0x0010)
    #define SIF_ALLOC_ERR 		(0x0008)
    #define SIF_OPEN_ERR 		(0x0004)
    #define SIF_CLOSE_ERR 		(0x0002)
    #define SIF_LANG_ERR 		(0x0001)

typedef WordFlags SpellProcessFlags ;
    /* 7 bits unused */
    #define SPF_ODD_HARD_HYPHEN_COMPOUND 		(0x0100)
    #define SPF_FOUND_ACRONYM_WITHOUT_PERIODS 	(0x0080)
    #define SPF_FOUND_ALTERNATE_HYPHENATION 		(0x0040)
    #define SPF_IN_USER_DICT 			(0x0020)
    #define SPF_COMPOUND_SPELLING_CHANGE 		(0x0010)
    #define SPF_SOFT_HYPHEN 				(0x0008)
    #define SPF_MANDATORY_HYPHEN_ALTERNATIVE 	(0x0004)
    #define SPF_MANDATORY_HYPHEN_INPUT 		(0x0002)
    #define SPF_SPLIT_WORD 				(0x0001)

#define ICS_IPDICTIONARY 		(1)
#define ICS_CLITIC_PROCESS 		(1)
#define ICS_COMPOUND_PROCESS 		(1)

#define ICS_DOUBLE_WORD 			(1)
#define ICS_HYPHENATION 			(0)

#if NO_ANAGRAM_WILDCARD_IN_SPELL_LIBRARY
  #define ICS_ANAGRAM 			(0)
#else
  #define ICS_ANAGRAM 			(1)
#endif

#define ICS_VREFNUM 			(0)
#define ICS_ELECTRONIC_THESAURUS 	(0)

#define ICFNAMEMAX 			(64)
#define ICPREMAX 			(9)
#define ICPOSTMAX 			(12)
#define ICCORMAX 			(200)
#define ICMAX 				(64)
#define ICMAXALT 			(20)
#define SPELL_MAX_WORD_LENGTH 		(ICMAX+1)

typedef struct {
    SpellTask		ICB_task;
    StandardLanguage	ICB_language;
    LanguageDialect	ICB_dialect;
    char		ICB_masterFname[ICFNAMEMAX+1];

#if ICS_HYPHENATION
    char		ICB_hypmstFname[ICFNAMEMAX+1]l
#endif

    SpellInitFlags	ICB_initFlags;
    SpellProcessFlags	ICB_processFlags;
    SpellErrorFlags	ICB_errorFlags;
    SpellErrorFlagsHigh	ICB_errorFlagsHigh;
    SpellResult		ICB_retCode;
    word		ICB_hypFlag;
    word		ICB_parseFlag;
    WordMap		ICB_hypmap;
    WordMap		ICB_altmap;
    char		ICB_softHypChar;
    char		ICB_word[ICMAX+1];
    char		ICB_altWord[ICMAX+1];
    byte		ICB_periodFlag;
    byte		ICB_trailHyp;
    byte		ICB_leadHyp;
    byte		ICB_trailApostrophe;
    byte		ICB_leadApostrophe;

#if	ICS_CLITIC_PROCESS
    char		ICB_preClitic[ICPREMAX+1];
    char		ICB_postClitic[ICPOSTMAX+1];
#endif

#if	ICS_DOUBLE_WORD
    char		ICB_prevWord[ICMAX+1];
#endif

    word	ICB_len;
    word	ICB_lside;
    word	ICB_rside;

    /* ICB_maps */
    WordMap	ICB_slashMap;
    WordMap	ICB_hyphenMap;
    WordMap	ICB_emDashMap;
    WordMap	ICB_elDashMap;
    /* ICB_endMaps */

    word	ICB_numAlts;
    word	ICB_nextAlt;
    char	ICB_altList[ICCORMAX];
    word	ICB_correctPtr[ICMAXALT];

#if	ICS_ANAGRAM
    word	ICB_subsetAnagram;
#endif

#if	ICS_VREFNUM
    word	ICB_volRefNum;
    word	ICB_hypVolRefNum;
#endif

    void	*ICB_pctlBuff;
    MemHandle	ICB_hctlBuff;
    ChunkHandle	ICB_pwrdBuff;

#if	ICS_COMPOUND_PROCESS
    void	*ICB_pcmpBuff;
    void	*ICB_hcmpBuff;
#endif

#if	ICS_HYPHENATION
    MemHandle	ICB_hypBufHan;
#endif

#if	 ICS_IPDICTIONARY
    MemHandle	ICB_husrBuff;
    void	*ICB_pusrBuff;
    void	*ICB_udid;
#endif

#if	ICS_ELECTRONIC_THESAURUS
    char	ICB_definition[1024];
#endif

    ThreadHandle ICB_spellThread;
} ICBuff} ;

#endif /* _ICBUFF_H_ */


ieCommon.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	ieCommon.h
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	Impex
 *
 * DESCRIPTION:
 *	This file defines common Impex definitions
 *
 *	$Id: ieCommon.h,v 1.2.11.1 96/04/28 08:28:13 chris Exp $
 *
 ***********************************************************************/

#ifndef	__IECOMMON_H
#define __IECOMMON_H

typedef struct {
    optr	        ITP_impexOD;
    Message	        ITP_returnMsg;
    word	        ITP_dataClass;
    FileHandle	        ITP_transferVMFile;
    VMChain	        ITP_transferVMChain;
    dword	        ITP_internal;
    ManufacturerID      ITP_manufacturerID;
    ClipboardItemFormat ITP_clipboardFormat;
} ImpexTranslationParams} ;

#endif


Internal\Resp\imgctrl.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1995. Nokia Research Center
Copyright (c) 1997-1998. CCC.
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

     Constants and definitions internal to the image viewer control.

-----------------------------------------------------------------------------
*/

@ifndef  IMGCTRL_GOH
@define  IMGCTRL_GOH

#define MAX_WWW_IMAGE_WIDTH  540
#define MAX_EXTERNAL_IMAGE_WIDTH   570
#define EXTERNAL_VIEW_HEIGHT  200

#define MOUSE_CROSS_WIDTH  5
#define MAX_PIXELS_TO_MOVE  5

#define PROGRESS_BLACK_WIDTH  155
#define PROGRESS_BLACK_HEIGHT  25
#define PROGRESS_WHITE_WIDTH  153
#define PROGRESS_WHITE_HEIGHT  23
#define PROGRESS_GRAY_WIDTH   145
#define PROGRESS_GRAY_HEIGHT  15
#define INDICATOR_FREE_SPACE  7
#define BLACK_WIDTH   1
#define BLACK_WHITE_WIDTH  5

/* This is for printing and faxing setup */
#define LEFT_MARGIN  72
#define TOP_MARGIN  72
#define RIGHT_MARGIN  72
#define BOTTOM_MARGIN  72

typedef enum {
     IVDS_OK	 ,
     IVDS_SOURCE_FILE_ERROR	 ,
     IVDS_CREATE_TEMP_FILE_ERROR	 ,
     IVDS_TEMP_FILE_ERROR	 ,
     IVDS_OUT_OF_MEMORY	 ,
     IVDS_UNSUPPORTED_FORMAT	 ,
     IVDS_CORRUPTED_SOURCE_FILE
} ImageViewerDrawStatus} ;

typedef enum
{
    IMAGE_MENU_ADD_BOOKMARK	,
    IMAGE_MENU_MAX
} ImageMenuType} ;

/* Call first in export and callback routines. */

#define IMAGE_CHANGE_SEGMENT  word wTemp; \
                              _asm mov wTemp, ds; \
                              GeodeLoadDGroup (GeodeGetCodeProcessHandle ())

/* Call last before return in export and callback routines. */

#define IMAGE_RESET_SEGMENT  _asm mov ds, wTemp

struct  image_info
{
    word width;
    word height;
};

typedef struct {
     word IVII_width;
     word IVII_heigth;
} ImageViewerImageInfo} ;

/*  CLASS DEFINITIONS  */

@class ImageDialogClass, ViewerDialogClass;
    @message void MSG_IMAGE_CLOSE ();
    @message optr MSG_DIALOG_GET_PRINTTER_CONTROLLER ();
    @message byte MSG_DIALOG_GET_PRINTTER_INFO ();
    @message void MSG_DIALOG_SET_PRINTTER_INFO (byte info);
    @instance byte need_printer;
@endc

@class ImageInteractionClass, GenInteractionClass;
@endc

@class FirstLevelTriggerClass, TwoLevelTriggerClass;
@endc

@class SecondLevelTriggerClass, TwoLevelTriggerClass;
@endc

@class ImageViewerControlClass, ViewerControlClass;
    @message void MSG_IMAGE_COPY ();
    @message void MSG_IMAGE_DELETE ();
    @message word MSG_CONT_DRAW_LINE (word position,byte* line, word length);
    @message void MSG_IMAGE_ZOOMIN ();
    @message void MSG_IMAGE_ZOOMOUT ();
    @message void MSG_IMAGE_ROTATE ();
    @message word MSG_CONT_CLEAN_UP ();
    @message void MSG_CONT_SET_ERROR_FLAG (word value);
    @message void MSG_CONT_INIT_VIEWER (struct image_info *size_info, DocumentInfo *info, word inline_flag, word caller_app);
    @message void MSG_CONT_SET_SCALE (word zoom);
    @message void MSG_CONT_DIMM_ACTION (word dimm_state	);
    @message optr MSG_GET_PRINTTER_CONTROLLER ();
    @message void MSG_CONT_GET_IMAGE_INFO (DocumentInfo *info);
    /* JOM 120398 new messages last */
    @message void MSG_IM_APPLY  (word wId);
    /* AIV 120398 */
    @message void MSG_IMAGE_ZOOMLEVEL (word *pwZoom);
    @default GI_states = (@default | GS_ENABLED);
@endc

@class ImageViewClass, GenViewClass;
    @message void MSG_SET_SCALE (word scale);
    @instance sdword scroll_ratio;
@endc

@class ImageContentClass, GenContentClass;
@endc

@class ImageClass, GenGadgetClass;
    @message word MSG_DRAW_LINE (word x_offset, word y_offset,word position,byte* line, word length);
    @message void MSG_DRAW_GIF_BACKROUND ();
    @message void MSG_ROTATE ();
    @message void MSG_ZOOM_IN ();
    @message void MSG_ZOOM_OUT ();
    @message word MSG_GET_ZOOM ();
    @message word MSG_FREAD (byte* dest,word number_of_bytes);
    @message word MSG_CREATE_BITMAP (word width, word height);
    @message word MSG_CLEAN_UP ();
    @message void MSG_SET_IMAGE_SIZE (word width, word height);
    @message void MSG_GET_IMAGE_SIZE (struct image_info *info);
    @message dword MSG_GET_COMP_FILE_SIZE ();
    @message void MSG_GET_IMAGE_INFO (DocumentInfo *info);
    @message void MSG_SET_ERROR_FLAG (word value);
    @message void MSG_INIT_VIEWER (struct image_info *size_info, DocumentInfo *info, word inline_flag, word caller_app);
    @message void MSG_DRAW_MOUSE_CROSS (byte draw_once);
    @message void MSG_UPDATE_INDICATOR (word position, word progress, word total_width);
    /* HMI/CCC Fix #184 09/06/97 */
    /* Fix #184 removed.   Updating is too slow...
        Commented by HMI/CCC 12/06/97 */

@ifdef CLIMAP
    @message word MSG_SET_ACTIVE (/*void *cbClimapHandler*/);
@else
    @message word MSG_SET_ACTIVE ();
@endif
    @message word MSG_RELEASE_ACTIVE ();
    @message void MSG_IMAGE_COORDINATES (struct image_info *cross_coordinates);
    @message void MSG_IMAGE_GET_ZOOMED_COORDINATES  (struct image_info *cross_coordinates);
    @message word MSG_IMAGE_STATUS ();

    /* AIV added 090698 */
    @message word MSG_IMAGE_GET_CALLER ();

    /***************************************************************************
    * image class methods for WWW
    *
    * void MSG_INIT_VIEWER
    * (
    *	struct image_info	*size_info,
    *	DocumentInfo		*info,
    *	word					inline_flag,
    *	word					caller_app
    * )
    * size_info method sets images size in this struct, if it is 1,1
    * you can assume that something went wrong.
    * 19May97JOM: in error cases size is (0,0), 1x1 images can be shown.
    *
    * inline_flag 1 for inline and 2 for image map
    * caller_app 0 for WWW
    *
    * word MSG_IMAGE_STATUS
    * returns the status
    * 0 OK
    * 1 input_file problem
    * 2 temp_file problem
    * 3 temp_file problem
    * 4 memory problem
    * 5 unsupported format
    * 6 corrupted file
    * NOTE! cutted file is not an error
    *
    * MSG_SET_ACTIVE() draws mouse cross and activates it
    *
    * MSG_RELEASE_ACTIVE() deletes mouse cross
    *
    * MSG_CLEAN_UP(); destroys temporary file
    *
    *
    ***************************************************************************/

    @instance GStateHandle 			work_gstate;   		/* Temporary working gstate to draw to the screen*/
    @instance GStateHandle 			bitmap_gstate; 		/* Gstate to draw to the bitmap */

    @instance word 					image_type;      		/* 0 external other inline or image map*/
    @instance word						caller_type;			  /* 0 WWW, 1 NoteBook */

    @instance FileHandle				input_file_handle;  	/* JPEG or GIF file */
    @instance DocumentInfo        file_info;          	/* Name and directory */
    @instance dword 					input_file_size;     /* Size of the input file */
    @instance byte						file_format; 			/* 0 GIF and 1 JPEG */
    @instance word 					rotation;     			/* Coordinate rotation */
    @instance word 					translation_x;    	/* X translation */
    @instance word 					translation_y;    	/* Y translation */

    @instance word 					zoom;           		/* Zooming by UI scaling */
    @instance word 					decompress_zoom;  	/* Zooming by decompression */

    @instance word 					width;            	/* Image width */
    @instance word 					height;           	/* Image height */
    @instance word 					vert_pos;         	/* Next displayed row */
    @instance VMBlockHandle 		block_handle; 			/* Block handle of the bitmap */
    @instance VMFileHandle 			file_handle;  			/* File handle of the temporary
                                                                            file where the bitmap lies */
    @instance byte 					file_name[15]; 		/* Name of the temporary file in the same
                                                                            directory as the source file */

    @instance word 					error_flag;      		/* Current error state */
    @instance byte						temp_file_still_exist; /* This is a cerification to see that
                                                                              temp file exists in case of delete or
                                                                              close press during decompression 0 = no, 1 = yes*/

    /* Following are for the imagemap cross */

    @instance sword 					x_coordinate;         /* Current x position of the mouse cross */
    @instance sword 					y_coordinate;         /* Current y position of the mouse cross */
    @instance sword 					x_coordinate_old;     /* Previous x position of the mouse cross */
    @instance sword 					y_coordinate_old;     /* Previous y position of the mouse cross */
    @instance byte  					need_mouse_cross; 	 /* 1 indicates that mouse cross should be on the image
                                                                             0 indicates that it should note be */
    @instance byte						last_press;           /* 0 right, 1 down, 2 left 3 up */
    @instance byte						pixels_to_move;       /* amount of pixels to move in inline image */
    @instance byte 					first_draw;				 /* Indicates that VIS_DRAW should call decompressor */

    /* Following are for the progress indicator */
    @instance byte need_indicator;
    @instance word black_left;
    @instance word black_top;
    @instance word black_right;
    @instance word black_bottom;
    @instance word white_left;
    @instance word white_top;
    @instance word white_right;
    @instance word white_bottom;
    @instance word gray_left;
    @instance word gray_top;
    @instance word gray_right;
    @instance word gray_bottom;
    @instance word first_total_update;
    @instance word last_total_update;
    @instance word zoom_ratio;
/* HMI/CCC Fix #184 09/06/97 */
/*Fix #184 removed.   Updating is too slow...
Commented by HMI/CCC 12/06/97*/
/*
@ifdef CLIMAP
    @instance void * cbClimapHandler=NULL;
@endif*/

@endc

/******************************************************************/
/*
 * Fill in the DocumentInfo to point to JPEG or GIF you want to convert.
 * The funtion creates a new file to SP_TEMP_FILES, stores the bitmap
 * there. This file is left open.
 */
extern
ImageViewerDrawStatus _cdecl ImageViewerConvertToBitmap ( DocumentInfo *info,
                                 VMFileHandle *bitMapFile,
                                 VMBlockHandle *bitMapBlock);

extern
ImageViewerDrawStatus _cdecl ImageViewerConvertToBitmapAndGiveSize ( DocumentInfo *info,
                                 VMFileHandle *bitMapFile,
                                 TCHAR        *ptcVMFileName,
                                 VMBlockHandle *bitMapBlock,
                                 word *pwHeight,
                                 word *pwWidth,
                                 word *pwZoomValue);

extern
ImageViewerDrawStatus _cdecl ImageViewerDrawBitmapToGState (DocumentInfo *info,
                                GStateHandle gstate,
                                word	*pwHeight,
                                word	*pwWidth,
                                word	*pwZoomValue);
extern
void _cdecl ImageViewerCleanUp (void);

@endif

/******************************************************************
************************* End of file *****************************
*******************************************************************/


impex.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) GeoWorks 1992 -- All Rights Reserved

PROJECT:	PC GEOS
MODULE:
FILE:		impex.goh

AUTHOR:		Maryann Simmons, Jul 29, 1992

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    MS	7/29/92   	Initial version.

DESCRIPTION:
    C Include file for the impex library.

    $Id: impex.goh,v 1.24.4.1 96/04/28 08:29:17 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@optimize
@deflib  impex

#include  <ieCommon.h>
@include  <Objects/gFSelC.goh>
#include  <xlatLib.h>

 /*----------------------------------------------------------------------------
  *		General Information
  *----------------------------------------------------------------------------
  *
  * For an application to fully support importing and exporting, it will need
  * to have an instance each of ImportControlClass & ExportControlClass. The
  * documentation for each of these classes resides under the declaration of
  * that class.
  */

 /*----------------------------------------------------------------------------
  *		ImportExportClass declaration
  *----------------------------------------------------------------------------

  *
  * GenApplication GCN lists to be placed on:
  *	GAGCNLT_SELF_LOAD_OPTIONS
  */

@class ImportExportClass, GenControlClass, master, variant;
/*			uses	GenControlClass */

/*-----------------------------------
 *	Description
 *-----------------------------------

 * This is an internal class used as a parent class for the Import & Export
 * Class objects. No application nor library will ever want to use an object
 * of this class, so don't do it!
 */
/*-----------------------------------
 *	External messages
 *----------------------------------*/

/*-----------------------------------
 *	Internal messages
 *----------------------------------*/
@message void MSG_IMPORT_EXPORT_SELECT_FORMAT ( int formatNumber = cx, \
                           MemHandle formatInfo = dx, \
                           Boolean noIdeaChoice = bp );
/*
 * Notify the import or export controller that a format has been selected
 * by the user.
 *
 * Context:	Utility message sent out when the user selects a format
 *		in a displayed list.
 * Source:	FormatList object
 * Destination:	ImportExportClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	formatNumber = Selected format # (item in list)
 *		formatInfo   = FormatInfo block handle
 *		noIdeaChoice = TRUE if No Idea is there, FALSE otherwise
 *
 * Return:	Nothing
 *
 */

@message void MSG_IMPORT_EXPORT_SELECT_FILE( GenFileSelectorEntryFlags  \
                        entryFlags = bp );
/*
 * Sent to notify us that the user has selected a file for import
 *
 * Context:	Sent when user clicks on a file (or any other entry
 *		in the GenFileSelector).
 * Source:	GenFileSelectorClass object
 * Destination:	ImportExportClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	entryFlags = GenFileSelectorEntryFlags
 *
 * Return:	Nothing
 *
 */

@message void MSG_IMPORT_EXPORT_SHOW_ERROR ( char *string = cx:dx, \
                        ChunkHandle errStrHandle = bp );
/*
 * Display an error dialog box to notify the user of a "bad thing"
 *
 * Context:	Utility message sent out when an error is determined. The
 *		dialog will not block the execution thread, so there is
 *		no feedback from the user in response to these messages.
 * Source:	Anyone
 * Destination: ImportExportClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	string	= Optional argument string (NULL-terminated)
 *		errStrHandle = ChunkHandle of error string (in String resource)
 *
 * Return:	Nothing
 *
 */

@message void MSG_IMPORT_EXPORT_FILE_SELECTION_INFO( ImpexFileSelectionData \
                            *fileSelInfo = dx:bp );
/*
 * Sent whenever a selection is made in the file selector
 *
 * Context:	Utility message sent solely for the purpose of subclassing
 *		the ImportExportControl inside a translation library.
 *		Whenever a selection is made by the user in the file selector
 *		located in the Import or Export dialog boxes, this message is
 *		sent by the Import/ExportControlClass to itself.
 * Source:	ImportControlClass or ExportControlClass object
 * Destination:	Method for a sub-class of ImportExportClass in a
 *		translation library.
 * Interception: Generally intercepted by a translation library, which,
 *		when called to provide its Import or Export UI, has
 *		returned a ClassStruct which is a sub-class of GenControl.
 *		This ClassStruct has been stored as the superclass for
 *		the ImportExportClass, thereby allowing a translation
 *		library to get this message without actually having
 *		an object of class ImportExportClass. Upon intercepting
 *		this message, a translation library might open the
 *		currently selected file, if any, and enable/disable
 *		format options based on the data in the file. Please see
 *		the documentation for TR_GET_IMPORT_UI & TR_GET_EXPORT_UI.
 *		There is no need to pass this message on to your superclass.
 *
 * Pass:	fileSelInfo	= ImpexFileSelectionData
 *
 * Return:	Nothing
 *
 */

@message void MSG_IMPORT_EXPORT_FREE_LIBRARY ( GeodeHandle libraryHandle = cx );
/*
 * Perform a GeodeFreeLibrary on the passed library handle
 *
 * Context:	Utility message sent to avoid repeated loading of common
 *		libraries as user switches between formats.
 * Source:	Anyone
 * Destination:	ImportExportClass object
 * Interception: Should not be intercepted
 *
 * Pass:	libraryHandle	= Handle of library
 *
 * Return:	Nothing
 */

@message void MSG_IMPORT_EXPORT_FREE_LIBRARY_AND_FORMAT_UI( GeodeHandle \
                            libraryHandle = cx );
/*
 * Perform a GeodeFreeLibrary on the passed library handle and remove any
 * format UI.  (For ALLOW_FLOPPY_BASED_LIBS)
 *
 * Pass:	libraryHandle	= Handle of library
 * Return:	nothing
 */

/*--------------------------------------
 * 	Constants & Structures
 *--------------------------------------*/

/*
 * ImpexDataClasses allow an application to select which kinds of data
 * it will support. More than one kind of data can be selected.
 *
 * If you add any new data classes, you must add a structure to the
 * array defined in Impex/UI/uiImpexFormatListLow.asm under "tokenTable".
 */
typedef WordFlags ImpexDataClasses ;
#define	IDC_TEXT		0x8000
#define	IDC_GRAPHICS	    0x4000
#define	IDC_SPREADSHEET	 0x2000
#define	IDC_FONT	 	0x1000

#define NUMBER_IMPEX_DATA_CLASSES    4

/*
 *   The tokens expected for the various types of translation library:
 */

#define XLAT_TOKEN_TEXT_12  	( 'T' | ('L' << 8) )
#define XLAT_TOKEN_TEXT_34 	( 'T' | ('X' << 8) )

#define XLAT_TOKEN_GRAPHICS_12 	( 'T' | ('L' << 8) )
#define XLAT_TOKEN_GRAPHICS_34 	( 'G' | ('R' << 8) )

#define XLAT_TOKEN_SPREADSHEET_12 	( 'T' | ('L' << 8) )
#define XLAT_TOKEN_SPREADSHEET_34 	( 'S' | ('S' << 8) )

#define XLAT_TOKEN_FONT_12 	( 'T' | ('L' << 8) )
#define XLAT_TOKEN_FONT_34 	( 'F' | ('N' << 8) )

/*
 *   Structure passed with MSG_IMPORT_EXPORT_FILE_SELECTION_INFO:
 */

typedef  struct	{
    FileLongName		IFSD_selection;
    PathName			IFSD_path;
    word			IFSD_disk;
    GenFileSelectorEntryFlags	IFSD_type;
} ImpexFileSelectionData} ;

/*-----------------------------------
 *	Instance Data
 *---------------------------------*/
@default ImportExport = GenControlClass;
@default GII_attrs = GIA_MODAL;
@default GII_type = GIT_COMMAND;
@default GII_visibility = GIV_DIALOG;
@default GI_states = (GS_USABLE|GS_ENABLED);

/*-----------------------------------
 *	Variable Instance Data
 *---------------------------------*/

typedef struct {
    optr	TIED_formatUI;		/* OD of duplicated format UI */
    Handle	TIED_formatLibrary;	/* handle of library for above */
} TempImportExportData} ;

@vardata TempImportExportData TEMP_IMPORT_EXPORT_DATA;

/*-----------------------------------
 *	Attrs
 *-----------------------------------*/

/*-----------------------------------
 *	Hints
 *-----------------------------------*/

@endc

/*-----------------------------------------------------------------------------
 *		ImportClass declaration
 *-----------------------------------------------------------------------------

 *
 * GenApplication GCN lists to be placed on:
 *	GAGCNLT_SELF_LOAD_OPTIONS
 */
@class ImportControlClass, ImportExportClass;

/*-----------------------------------
 *	How importing works
 *-----------------------------------*/

/*-----------------------------------
 *    	Constants & Structures
 *-----------------------------------*/

typedef WordFlags ImportControlAttrs ;
#define ICA_IGNORE_INPUT 	0x8000	/* ignore input while import occurs */
#define ICA_NON_DOCUMENT_IMPORT  0x4000  /* doesn't import as a document     */

/*
 *   Features flags (used with ATTR_GEN_CONTROL_REQUIRE/PROHIBIT_UI)
 */
typedef ByteFlags ImportControlFeatures ;
#define IMPORTCF_PREVIEW_TRIGGER  0x0020	/* not currently used 		*/
#define	IMPORTCF_IMPORT_TRIGGER		0x0010	/* import trigger 		*/
#define IMPORTCF_FORMAT_OPTIONS 	0x0008	/* import format UI parent,
                     *  under which is placed any
                     *  UI specific to the
                     *  currently selected format	*/
#define IMPORTCF_FILE_MASK 	0x0004	/* import file mask 		*/
#define IMPORTCF_BASIC 		0x0002	/* import file selector,
                     *  import format list, and
                     *  import app UI parent, under
                     *  which is placed any UI
                     *  specific to the app 	*/
#define IMPORTCF_GLYPH 		0x0001	/* glyph at top of import
                     *  dialog box			*/

#define IMPORTC_DEFAULT_FEATURES  (IMPORTCF_GLYPH | \
                  IMPORTCF_BASIC | \
                  IMPORTCF_FILE_MASK | \
                  IMPORTCF_FORMAT_OPTIONS | \
                  IMPORTCF_IMPORT_TRIGGER)

/*
 *    Toolbox features flags used with
 *    ATTR_GEN_CONTROL_REQUIRE/PROHIBIT_TOOLBOX_UI
 */
typedef	ByteFlags ImportControlToolboxFeatures ;
#define IMPORTCTF_DIALOG_BOX 	0x01

#define IMPORTC_DEFAULT_TOOLBOX_FEATURES 	IMPORTCTF_DIALOG_BOX

/*-----------------------------------
 *	External messages
 *-----------------------------------*/

@message void MSG_IMPORT_CONTROL_SET_DATA_CLASSES( ImpexDataClasses \
                             dataClasses = cx );
/*
 * Sets the data classes for which import is possible. The names of
 * the file formats which belong to these data classes will be displayed
 * to the user in the Import dialog box. If the message is sent while
 * the Import dialog box is visible to the user, the list of formats
 * will be re-built.
 *
 * Context:	Utility message sent to change the formats the user can
 *		choose from
 * Source:	Anyone
 * Destination:	ImportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	dataClasses = ImpexDataClasses
 *
 * Return:	Nothing
 *
 */

@message ImpexDataClasses MSG_IMPORT_CONTROL_GET_DATA_CLASSES () = cx;
/*
 * Gets the data classes for which import is currently possible.
 *
 * Context:	Utility message sent to find state of the object
 * Source:	Anyone
 * Destination:	ImportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	ImpexDataClasses
 *
 */

@message void MSG_IMPORT_CONTROL_SET_ACTION ( optr destOD = cx:dx, \
                         word ICImsg = bp );
/*
 * Sets the message to be sent upon beginning an import and the
 * destination to send it to.
 *
 * Context:	Utility message sent to change the recipient of notification
 *		that an import has been requested by the user.
 * Source:	Anyone
 * Destination:	ImportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	destOD	= Destination OD
 *		ICImsg	= Message
 *			 (see parameter documentation for ICI_message below)
 *
 * Return:	Nothing
 *
 */

@message void MSG_IMPORT_CONTROL_SET_MSG ( word ECImsg = cx );
/*
 * Sets the message to be sent when an import is initiated.
 *
 * Context:	Utility message sent to change the recipient of
 *		notification that an import has be requested by
 *		the user.
 * Source:	Anyone
 * Destination:	ImportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	ECImsg	= Message
 *			 (see parameter documentation for ECI_message below)
 *
 * Return:	Nothing
 *
 */

typedef struct {
    word	message;
    word    	unused;
    optr	destOD;
} ImpexAction} ;

@message void MSG_IMPORT_CONTROL_GET_ACTION (
                                ImpexAction *retValue = bpaxdxcx);
/*
 * Gets the destination OD & message for import notification
 *
 * Context:	Utility message for finding out where notification
 *  	    	of beginning import is sent and what message is used.
 * Source:	Anyone
 * Destination:	ImportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	pointer to ImpexAction structure (empty)
 *
 * Return:	pointer to ImpexAction structure (filled)
 *
 */

@message void MSG_IMPORT_CONTROL_SET_ATTRS ( ImportControlAttrs attrs = cx );
/*
 * Sets the attributes for an ImportControl object.
 *
 * Context:	Utility message sent to change the attributes for this object
 * Source:	Anyone
 * Destination:	ImportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	attrs = ImportControlAttrs
 *
 * Return:	Nothing
 *
 */

@message ImportControlAttrs MSG_IMPORT_CONTROL_GET_ATTRS () = cx;
/*
 * Gets the attributes for an ImportControl object.
 *
 * Context:	Utility message sent to find state of the object
 * Source:	Anyone
 * Destination:	ImportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	ImportControlAttrs
 *
 */

@message word MSG_IMPORT_CONTROL_GET_FILE_SELECTOR_OFFSET (
                ImportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the import file selector
 *
 * Context:	The controller needs to know the import file selector offset.
 * Source:	ImportControlClass object
 * Destination:	ImportControlClass object
 * Interception:Should be intercepted by app if app has turned off the
 *		IMPORTCF_BASIC feature. Need not be passed to superclass.
 *
 * Pass:	ImportControlFeatures bitmask
 *
 * Return:	offset of import file selector
 *
 */

@message word MSG_IMPORT_CONTROL_GET_FORMAT_LIST_OFFSET (
                ImportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the import format list
 *
 * Context:	The controller needs to know the import format list offset.
 * Source:	ImportControlClass object
 * Destination:	ImportControlClass object
 * Interception:Should be intercepted by app if app has turned off the
 *		IMPORTCF_BASIC feature. Need not be passed to superclass.
 *
 * Pass:	ImportControlFeatures bitmask
 *
 * Return:	offset of import format list
 *
 */

@message word MSG_IMPORT_CONTROL_GET_FILE_MASK_OFFSET (
                ImportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the import file mask
 *
 * Context:	The controller needs to know the import file mask offset.
 * Source:	ImportControlClass object
 * Destination:	ImportControlClass object
 * Interception:May be intercepted by app if app has turned off the
 *		IMPORTCF_FILE_MASK feature. Need not be passed to superclass.
 *
 * Pass:	ImportControlFeatures bitmask
 *
 * Return:	offset of import file mask
 *
 */

@message word MSG_IMPORT_CONTROL_GET_FORMAT_UI_PARENT_OFFSET (
                ImportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the import format UI parent
 *
 * Context:	The controller needs to know the offset of the
 *		import format UI parent object.
 * Source:	ImportControlClass object
 * Destination:	ImportControlClass object
 * Interception:May be intercepted by app if app has turned off the
 *		IMPORTCF_FORMAT_OPTIONS feature. Need not be passed to
 *		superclass.
 *
 * Pass:	ImportControlFeatures bitmask
 *
 * Return:	offset of import format UI parent
 *
 */

@message word MSG_IMPORT_CONTROL_GET_APP_UI_PARENT_OFFSET (
                ImportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the import app UI parent
 *
 * Context:	The controller needs to know the offset of the
 *		import app UI parent object.
 * Source:	ImportControlClass object
 * Destination:	ImportControlClass object
 * Interception:May be intercepted by app if app has turned off the
 *		IMPORTCF_BASIC feature. Need not be passed to superclass.
 *
 * Pass:	ImportControlFeatures bitmask
 *
 * Return:	offset of import app UI parent
 *
 */

@message word MSG_IMPORT_CONTROL_GET_IMPORT_TRIGGER_OFFSET (
                ImportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the import trigger.
 *
 * Context:	The controller needs to know the import trigger offset.
 * Source:	ImportControlClass object
 * Destination:	ImportControlClass object
 * Interception:Should be intercepted by app if app has turned off the
 *		IMPORTCF_IMPORT_TRIGGER feature. Need not be passed to
 *		superclass.
 *
 * Pass:	ImportControlFeatures bitmask
 *
 * Return:	offset of import trigger
 *
 */

@message void MSG_IMPORT_CONTROL_IMPORT_COMPLETE( ImpexTranslationParams \
                         _far *itParams = ss:bp );
/*
 * Sent by the application when it has completed the import.
 *
 * Context:	Sent after an application has obtained all the data it
 *		requires from the transfer format passed to it in the
 *		ImpexTranslationParams struct sent out on import.
 * Source:	Anyone
 * Destination:	ImportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	itParams	= pointer to ImpexTranslationParams
 *					(structure passed to app earlier)
 * Return:	Nothing
 *
 */

/*-----------------------------------
 *    Internal messages
 *----------------------------------- */

@message void  MSG_IMPORT_CONTROL_SET_FILE_MASK  ();
/*
 *   Set the file mask string (eg. "*.FOO") to be used by the FileSelector
 *   in displaying file names to the user.
 *
 * Context:	Sent when the user hits return after editing the file
 *    		specification string, or when a new format is selected.
 * Source:	Text object of self
 * Destination:	ImportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 *
 */

@message void MSG_IMPORT_CONTROL_IMPORT ();
/*
 *    Initiate an import with the selected file.
 *
 * Context:	The user has clicked on the "Import" trigger
 * Source:	Import trigger
 * Destination:	ImportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 *
 */

@message void MSG_IMPORT_CONTROL_CANCEL ();
/*
 *    Cancel the import.
 *
 * Context:	The user has clicked on the "Cancel" trigger
 * Source:	Aforementioned GenTrigger
 * Destination:	ImportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 *
 */

@message void MSG_IMPORT_CONTROL_CONTINUE_IMPORT ();
/*
 * Redwood-only, called after all necessary files have been saved or closed,
 * to do the real meat of the import work.
 *
 * Pass:	nothing
 * Return:	nothing
 *
 */

@message void MSG_IMPORT_CONTROL_NEW_LIBRARY_DISK ();
/*
 * For ALLOW_FLOPPY_BASED_LIBS.
 *
 * Pass:	nothing
 * Return:	nothing
 *
 */

@message ChunkHandle MSG_IMPORT_CONTROL_GET_FORMAT_GROUP_OFFSET ();
/*
 * For ALLOW_FLOPPY_BASED_LIBS.
 *
 * Pass:	nothing
 * Return:	chunk handle of FormatGroup
 *
 */

@message ChunkHandle MSG_IMPORT_CONTROL_GET_FILE_SELECT_GROUP_OFFSET ();
/*
 * For ALLOW_FLOPPY_BASED_LIBS.
 *
 * Pass:	nothing
 * Return:	chunk handle of FileSelectGroup
 *
 */

@message void MSG_IMPORT_CONTROL_INSERT_LIBRARY_DISK_RESPONSE (
                        InteractionCommand ic = cx);
/*
 * For ALLOW_FLOPPY_BASED_LIBS.
 *
 * Pass:	InteractionCommand
 * Return:	nothing
 *
 */

/*-----------------------------------
 *    Instance Data
 *-----------------------------------*/

@instance ImportControlAttrs ICI_attrs;      /*attributes for the object*/
@instance ImpexDataClasses   ICI_dataClasses;/*data type avail for import*/
@instance optr		     ICI_destination;/*destination for import msg*/
@instance word		     ICI_message;    /* message sent for import */
        /*
          *    	Synopsis:	Perform the import of the passed data
          *
          *    	Pass:		ImpexTranslationParams
          *
          *    	Returns:	Nothing
         */

/*-----------------------------------
 *    Variable Instance Data
 *-----------------------------------*/

/*-----------------------------------
 *    	Attrs
 *-----------------------------------*/

/*
 *    Attribute to allow applications to add their own UI to the Import DB.
 *    The generic tree whose optr is stored here must *not* be set USABLE.
 *    Use this in lieu of ATTR_GEN_CONTROL_APP_UI.
 */
@vardata optr ATTR_IMPORT_CONTROL_APP_UI;
@reloc ATTR_IMPORT_CONTROL_APP_UI, 0, optr;

@vardata optr ATTR_IMPORT_CONTROL_CANCEL_DESTINATION;
@reloc ATTR_IMPORT_CONTROL_CANCEL_DESTINATION, 0, optr;
@vardata word ATTR_IMPORT_CONTROL_CANCEL_MESSAGE;

/*-----------------------------------
 *    	Hints
 *-----------------------------------*/

@endc

/*-----------------------------------------------------------------------------
 *    	ExportClass declaration
 *-----------------------------------------------------------------------------

 *
 *    GCN	GenApplication lists to be placed on:
 *    	GAGCNLT_SELF_LOAD_OPTIONS
 */
@class	ExportControlClass, ImportExportClass;

/*-----------------------------------
 *    How exporting works
 *-----------------------------------*/

/*-----------------------------------
 *	Constants
 *-----------------------------------*/

typedef WordFlags ExportControlAttrs ;
#define ECA_IGNORE_INPUT 	0x8000	/* ignore input while export occurs */

/*
 *   Features flags (used with ATTR_GEN_CONTROL_REQUIRE/PROHIBIT_UI)
 */
typedef ByteFlags ExportControlFeatures ;
#define EXPORTCF_EXPORT_TRIGGER 	0x0008	/* export trigger 		*/
#define EXPORTCF_FORMAT_OPTIONS 	0x0004	/* export format UI parent,
                     *  under which is placed any
                     *  UI specific to the
                     *  currently selected format	*/
#define EXPORTCF_BASIC 		0x0002	/* export file selector,
                     *  export format list,
                     *  export file name, and
                     *  export app UI parent, under
                     *  which is placed any UI
                     *  specific to the app 	*/
#define EXPORTCF_GLYPH 		0x0001	/* glyph at the top of the
                       export dialog box		*/

#define EXPORTC_DEFAULT_FEATURES  (EXPORTCF_GLYPH | \
                  EXPORTCF_BASIC | \
                  EXPORTCF_FORMAT_OPTIONS | \
                  EXPORTCF_EXPORT_TRIGGER)

/*
 *   Toolbox features flags used with ATTR_GEN_CONTROL_REQUIRE/PROHIBIT_TOOLBOX_UI
 */
typedef ByteFlags ExportControlToolboxFeatures ;
#define EXPORTCTF_DIALOG_BOX 	0x01

#define EXPORTC_DEFAULT_TOOLBOX_FEATURES  	EXPORTCTF_DIALOG_BOX

/*-----------------------------------
 *    External messages
 *-----------------------------------*/

@message void MSG_EXPORT_CONTROL_SET_DATA_CLASSES(ImpexDataClasses \
                            dataClass = cx );
/*
 * Sets the data classes for which export is possible. The names of
 * the file formats which belong to these data classes will be displayed
 * to the user in the Export dialog box. If the message is sent while
 * the Export dialog box is visible to the user, the list of formats
 * will be re-built.
 *
 * Context:	Utility message sent to change the formats the user can
 *    		choose from.
 * Source:	Anyone
 * Destination:	ExportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	dataClass = ImpexDataClasses
 *
 * Return:	Nothing
 *
 *
 */
@message  ImpexDataClasses MSG_EXPORT_CONTROL_GET_DATA_CLASSES () = cx;
/*
 * Gets the data classes for which export is currently possible.
 *
 * Context:	Utility message sent to find state of the object
 * Source:	Anyone
 * Destination:	ExportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	ImpexDataClasses
 *
 */

@message void MSG_EXPORT_CONTROL_SET_ACTION ( optr destOD = cx:dx, \
                         word ECImsg = bp );
/*
 * Sets the message to be sent upon beginning an export and the
 * destination to send it to.
 *
 * Context:	Utility message sent to change the recipient of
 *		notification that an export has be requested by
 *		the user.
 * Source:	Anyone
 * Destination:	ExportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	dest = Destination OD
 *    		ECImsg	= Message
 *			 (    see parameter documention for ECI_message below)
 *
 * Return:	Nothing
 *
 */

@message void MSG_EXPORT_CONTROL_SET_MSG ( word ECImsg = cx );
/*
 * Sets the message to be sent when an export is initiated.
 *
 * Context:	Utility message sent to change the recipient of
 *		notification that an export has been requested by
 *		the user.
 * Source:	Anyone
 * Destination:	ExportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	ECImsg	= Message
 *			 (    see parameter documention for ECI_message below)
 *
 * Return:	Nothing
 *
 */

@message void MSG_EXPORT_CONTROL_GET_ACTION (
                                ImpexAction *retValue = bpaxdxcx );
/*
 * Gets the destination OD & message for export notification.
 *
 * Context:	Utility message for finding out where notification
 *  	    	of beginning export is sent and what message is used.
 * Source:	Anyone
 * Destination:	ExportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	pointer to ImpexAction structure (empty)
 *
 * Return:	pointer to ImpexAction structure (filled)
 *
 */

@message void MSG_EXPORT_CONTROL_SET_ATTRS ( ExportControlAttrs attrs = cx );
/*
 * Sets the attributes for an ExportControl object.
 *
 * Context:	Utility message sent to change the attributes for this object
 * Source:	Anyone
 * Destination:	ExportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	attrs = ExportControlAttrs
 *
 * Return:	Nothing
 *
 */

@message ExportControlAttrs MSG_EXPORT_CONTROL_GET_ATTRS () = cx ;
/*
 * Gets the attributes for an ExportControl object.
 *
 * Context:	Utility message sent to find state of the object
 * Source:	Anyone
 * Destination:	ExportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	ExportControlAttrs
 *
 */

@message word MSG_EXPORT_CONTROL_GET_FILE_SELECTOR_OFFSET (
                ExportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the export file selector
 *
 * Context:	The controller needs to know the export file selector offset.
 * Source:	ExportControlClass object
 * Destination:	ExportControlClass object
 * Interception:Should be intercepted by app if app has turned off the
 *		EXPORTCF_BASIC feature
 *
 * Pass:	ExportControlFeatures bitmask
 *
 * Return:	offset of export file selector
 *
 */

@message word MSG_EXPORT_CONTROL_GET_FORMAT_LIST_OFFSET (
                ExportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the export format list
 *
 * Context:	The controller needs to know the export format list offset.
 * Source:	ExportControlClass object
 * Destination:	ExportControlClass object
 * Interception:Should be intercepted by app if app has turned off the
 *		EXPORTCF_BASIC feature
 *
 * Pass:	ExportControlFeatures bitmask
 *
 * Return:	offset of export format list
 *
 */

@message word MSG_EXPORT_CONTROL_GET_FILE_NAME_OFFSET (
                ExportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the export file name
 *
 * Context:	The controller needs to know the export file name offset.
 * Source:	ExportControlClass object
 * Destination:	ExportControlClass object
 * Interception:Should be intercepted by app if app has turned off the
 *		EXPORTCF_BASIC feature
 *
 * Pass:	ExportControlFeatures bitmask
 *
 * Return:	offset of export file name
 *
 */

@message word MSG_EXPORT_CONTROL_GET_FORMAT_UI_PARENT_OFFSET (
                ExportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the export format UI parent
 *
 * Context:	The controller needs to know the offset of the
 *		export format UI parent object.
 * Source:	ExportControlClass object
 * Destination:	ExportControlClass object
 * Interception:May be intercepted by app if app has turned off the
 *		EXPORTCF_FORMAT_OPTIONS feature
 *
 * Pass:	ExportControlFeatures bitmask
 *
 * Return:	offset of export format UI parent
 *
 */

@message word MSG_EXPORT_CONTROL_GET_APP_UI_PARENT_OFFSET (
                ExportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the export app UI parent
 *
 * Context:	The controller needs to know the offset of the
 *		export app UI parent object.
 * Source:	ExportControlClass object
 * Destination:	ExportControlClass object
 * Interception:May be intercepted by app if app has turned off the
 *		EXPORTCF_BASIC feature
 *
 * Pass:	ExportControlFeatures bitmask
 *
 * Return:	offset of export app UI parent
 *
 */

@message word MSG_EXPORT_CONTROL_GET_EXPORT_TRIGGER_OFFSET (
                ExportControlFeatures features = dx ) = cx;
/*
 * Get the offset of the export trigger.
 *
 * Context:	The controller needs to know the export trigger offset.
 * Source:	ExportControlClass object
 * Destination:	ExportControlClass object
 * Interception:Should be intercepted by app if app has turned off the
 *		EXPORTCF_EXPORT_TRIGGER feature
 *
 * Pass:	ExportControlFeatures bitmask
 *
 * Return:	offset of export trigger
 *
 */

@message void MSG_EXPORT_CONTROL_EXPORT_COMPLETE(ImpexTranslationParams \
                         _far *itParams = ss:bp );
/*
 * Sent by the application when it has completed the export.
 *
 * Context:	Sent after an application has created the transfer format
 *		to be exported to another data format.
 * Source:	Anyone
 * Destination:	ExportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	itParams= pointer to ImpexTranslationParams
 *
 *
 * Return:	Nothing
 *
 */

/*-----------------------------------
 *	Internal messages
 *-----------------------------------*/

@message void MSG_EXPORT_CONTROL_EXPORT ();
/*
 *  Initiate an export into the selected file.
 *
 * Context:	The user has clicked on the "Export" trigger
 * Source:	Export trigger
 * Destination:	ExportControlClass object
 * Interception:Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 *
 */

@message void MSG_EXPORT_CONTROL_NEW_LIBRARY_DISK ();
/*
 * For ALLOW_FLOPPY_BASED_LIBS.
 *
 * Pass:	nothing
 * Return:	nothing
 *
 */

@message void MSG_EXPORT_CONTROL_CANCEL ();
/*
 * For ALLOW_FLOPPY_BASED_LIBS.
 *
 * Pass:	nothing
 * Return:	nothing
 *
 */

@message ChunkHandle MSG_EXPORT_CONTROL_GET_FORMAT_GROUP_OFFSET ();
/*
 * For ALLOW_FLOPPY_BASED_LIBS.
 *
 * Pass:	nothing
 * Return:	chunk handle of FormatGroup
 *
 */

@message ChunkHandle MSG_EXPORT_CONTROL_GET_FILE_SELECT_GROUP_OFFSET ();
/*
 * For ALLOW_FLOPPY_BASED_LIBS.
 *
 * Pass:	nothing
 * Return:	chunk handle of FileSelectGroup
 *
 */

@message void MSG_EXPORT_CONTROL_INSERT_LIBRARY_DISK_RESPONSE (
                        InteractionCommand ic = cx);
/*
 * For ALLOW_FLOPPY_BASED_LIBS.
 *
 * Pass:	InteractionCommand
 * Return:	nothing
 *
 */

/*-----------------------------------
 *	Instance Data
 *-----------------------------------*/

@instance ExportControlAttrs   ECI_attrs;	/* attributes for the object */
@instance ImpexDataClasses     ECI_dataClasses; /* data type avail for import*/
@instance optr   	       ECI_destination;	/* dest for import message */
@instance word                 ECI_message;      /* message sent for import */
    /*
      * Synopsis:	Perform the export of the current data.
      *
      * Pass:	on stack, ImpexTranslationParams
         *
         * Returns:	xferFormat = VMChain containing transfer format
         *			    = 0:0 if error
         */

/*-----------------------------------
 *	Variable Instance Data
 *-----------------------------------*/

/*-----------------------------------
 *	Attrs
 *-----------------------------------*/

/*
 * Attribute to allow applications to add their own UI to the Export DB.
 * The generic tree whose optr is stored here nust *not* be set USABLE.
 * Use this in lieu of ATTR_GEN_CONTROL_APP_UI.
 */
@vardata optr ATTR_EXPORT_CONTROL_APP_UI;
/*@reloc ATTR_EXPORT_CONTROL_APP_UI, 0, optr;*/

/*-----------------------------------
 *	Hints
 *-----------------------------------*/

/*
 * Internal: Temporary storage for ImpexThreadInfo handle
 *	     (For ALLOW_FLOPPY_BASED_LIBS)
 */
@vardata MemHandle TEMP_EXPORT_CONTROL_IMPEX_THREAD_INFO;

@endc

/*-----------------------------------------------------------------------------
 *		ImpexMapControlClass declaration
 *-----------------------------------------------------------------------------

 *
 * GenApplication GCN lists to be placed on:
 *	GAGCNLT_SELF_LOAD_OPTIONS
 */
@class ImpexMapControlClass, GenControlClass;

/*-----------------------------------------------------------------------------
 *		Methods
 *---------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
 *		Internal methods
 *---------------------------------------------------------------------------*/
@message void MSG_IMC_UNMAP ();
/*
 * Remove a mapped entry from the map list
 *
 * Context:	The user has clicked on the "UnMap" trigger
 * Source:	UnMap trigger
 * Destination:	ImpexMapControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 */

@message void MSG_IMC_MAP_ENTRY ();
/*
 * Maps the currently selected source entry to
 * the currently selected destination entry
 *
 * Context:	The user has clicked on the "Map" trigger
 * Source:	Map trigger
 * Destination:	ImpexMapControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 */

@message void MSG_IMC_REQUEST_SOURCE_MONIKER ( word id = bp );
/*
 * Get the moniker for the source map list
 *
 * Context:	Sent when you initialize the source map list
 * Source:	ImpexMapSourceList
 * Destination:	ImpexMapControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	id = identifier of source map list
 *
 * Return:	Nothing
 */

@message void MSG_IMC_REQUEST_DEST_MONIKER ( word id = bp );
/*
 * Get the moniker for the destination map list
 *
 * Context:	Sent when you initialize the destination map list
 * Source:	ImpexMapDestList
 * Destination:	ImpexMapControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	id = identifier of destination map list
 *
 * Return:	Nothing
 */

@message void MSG_IMC_REQUEST_MAP_MONIKER ( word id = bp );
/*
 * Get the moniker for the map list
 *
 * Context:	Sent when you click on the "Map" button.
 * Source:	ImpexMapMapList
 * Destination:	ImpexMapControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	id = identifier of map list
 *
 * Return:	Nothing
 */

@message void MSG_IMC_MAP_DONE ();
/*
 * Put up a warning dialog box if no fields have been mapped
 *
 * Context:	Sent when you click on "Done" trigger
 * Source:	Done trigger
 * Destination:	ImpexMapControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 */

@message void MSG_IMC_MAP_CANCEL ();
/*
 * Deletes the map list block and re-init the map list
 *
 * Context:	The user has clicked on the "Cancel" trigger
 * Source:	Cancel trigger
 * Destination:	ImpexMapControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 */

@message MemHandle MSG_IMC_MAP_GET_MAP_DATA ();
/*
 * Return handle of map list block
 *
 * Context:	Import/export is about to commence.
 * Source:	Database Translation Library
 * Destination:	ImpexMapControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	handle of map list block
 */

/*-----------------------------------------------------------------------------
 *		Hints
 *---------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
 *		Constants & Structures
 *---------------------------------------------------------------------------*/

#define SOURCE  	0
#define DESTINATION  	1

/* Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 * ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef ByteFlags IMCFeatures ;
#define IMCF_MAP 	0x01

#define IMC_DEFAULT_FEATURES    IMCF_MAP

#define IMC_DEFAULT_TOOLBOX_FEATURES   0

#define IMC_MAP_MONIKER_SIZE  	1024

typedef ByteFlags ImpexMapFlags ;
#define IMF_IMPORT 	0x80
#define IMF_EXPORT 	0x40

typedef ByteEnum DefaultFieldNameUsage ;
#define DFNU_FIELD  	0      /* use "Field   " */
#define DFNU_COLUMN 	1      /* use "Column  " */
#define DFNU_FIXED 	2      /* use pre-defined field names  */

typedef struct {
    LMemBlockHeader		IMFIH_base;
    word			IMFIH_fieldChunk;
    word			IMFIH_numFields;
    DefaultFieldNameUsage	IMFIH_flag;
} ImpexMapFileInfoHeader} ;

typedef struct {
    LMemBlockHeader	MLBH_base;
    word		MLBH_numDestFields;
    word		MLBH_chunk1;
} MapListBlockHeader} ;

typedef struct {
    word	CML_source;
    word	CML_dest;
} ChunkMapList} ;

/*-----------------------------------------------------------------------------
 *		Instance Data
 *---------------------------------------------------------------------------*/

@instance word 		IMCI_dataBlock1;
@instance word 		IMCI_dataBlock2;
@instance word 		IMCI_childBlock;
@instance word 		IMCI_mapListBlock;
@instance ImpexMapFlags IMCI_flags;

@endc

/*-----------------------------------------------------------------------------
 *		Impex routines called by translation libraries
 *---------------------------------------------------------------------------*/

#define IMPEX_TEMP_VM_FILE  	0xffff
#define IMPEX_TEMP_NATIVE_FILE  	0x0000

/*
 * All Impex routines callable from a translation library written in C
 * return a value of type TransErrorInfo to the library.
 *
 * The following macros, defined in xlatLib.h, operate on values of
 * type TransErrorInfo:
 *
 * TRANS_ERROR_IS_NONE(val)
 * TRANS_ERROR_IS_CUSTOM(val)
 * GET_TRANS_ERROR(val)
 * GET_CUSTOM_MSG_HANDLE(val)
 */

extern TransErrorInfo
    _pascal ImpexCreateTempFile (char *buffer, word fileType, FileHandle *file);
/*
 * Utility routine to create and open a unique temporary file to be used by
 * a translation library for import or export.
 *
 * Pass:	buffer	   = pointer to file name buffer
 *		fileType   = IMPEX_TEMP_VM_FILE or IMPEX_TEMP_NATIVE_FILE
 *		file	   = pointer to new file handle
 *
 * Return:	TransErrorInfo
 *			returnValue.transError = 0 if no error;
 *			returnValue.customMsgHandle =
 *				memory handle of error text if
 *				returnValue.transError = TE_CUSTOM
 *		buffer	   = file name buffer filled
 *		file	   = new file handle (filled)
 *
 */

extern TransErrorInfo
    _pascal ImpexDeleteTempFile (const char *buffer, FileHandle tempfile,
                word fileType);
/*
 * Utility routine to close and delete a temporary file that was created by
 * calling ImpexCreateTempFile.
 *
 * Pass:	buffer	   = file name buffer
 *		tempfile   = file handle of open tempfile
 *		fileType   = IMPEX_TEMP_VM_FILE or IMPEX_TEMP_NATIVE_FILE
 *
 * Return:	TransErrorInfo
 *			returnValue.transError = 0 if no error;
 *			returnValue.customMsgHandle =
 *				memory handle of error text if
 *				returnValue.transError = TE_CUSTOM
 */

extern TransErrorInfo
    _pascal ImpexImportFromMetafile (Handle xlatLib, word routine,
                    VMFileHandle xferFile, FileHandle metafile,
                    dword *xferFormat, word arg1, word arg2);
/*
 * Convert a metafile to a transfer format by calling an intermediate
 * metafile conversion library. This is to be used by translation libraries
 * that use an intermediate metafile format.
 *
 * Pass:        xlatLib    = handle of metafile translation library to use
 *		routine	   = routine number of library routine to call
 *		xferFile   = handle of VM file to hold transfer format
 *		metafile   = handle of the metafile (open for read)
 *		arg1, arg2 = additional data for metafile library as needed
 *		xferFormat = pointer to VM chain which will hold
 *			     transfer format
 *
 * Return:	TransErrorInfo
 *			returnValue.transError = 0 if no error;
 *			returnValue.customMsgHandle =
 *				memory handle of error text if
 *				returnValue.transError = TE_CUSTOM
 *		xferFormat = pointer to VM chain containing transfer format
 *
 */

extern TransErrorInfo
    _pascal ImpexExportToMetafile (Handle xlatLib, word routine,
                  VMFileHandle xferFile, FileHandle metafile,
                  dword xferFormat, word arg1, word arg2);
/*
 * Convert a transfer format to a metafile by calling an intermediate
 * metafile conversion library. This is to be used by translation libraries
 * that use an intermediate metafile format.
 *
 * Pass:        xlatLib	   = handle of metafile translation library to use
 *		routine	   = entry point number of library routine to call
 *		xferFile   = VM file handle of transfer format
 *		metafile   = handle of the metafile (open for read/write)
 *		xferFormat = VM chain containing transfer format
 *		arg1, arg2 = additional data for metafile library as needed
 *
 * Return:	TransErrorInfo
 *			returnValue.transError = 0 if no error;
 *			returnValue.customMsgHandle =
 *				memory handle of error text if
 *				returnValue.transError = TE_CUSTOM
 *
 */

extern Boolean
    _pascal ImpexUpdateImportExportStatus (const char *msgStr, word percent);

/*
 * Apprise the user of the status of an import or export. This routine should
 * only be called by translation libraries, and can be called at any time
 * during the import/export process. If a translation library chooses not
 * to call this function, the default import/export message will be displayed.
 *
 * Pass:	msgStr	= pointer to tring to display to user
 *			  (NULL string to not display a new string)
 *		percent	= Percentage completed so far (0->100)
 *			  (-1 to not display any percentage)
 *
 * Return:	Boolean	= TRUE to continue import/export
 *				- or -
 *			= FALSE to discontinue import/export ASAP
 */

/*-----------------------------------------------------------------------------
 *		Impex routines called by applications
 *---------------------------------------------------------------------------*/

extern void
    _pascal ImpexImportExportCompleted (ImpexTranslationParams *itParams);
/*
 * A utility routine called by an application to send back notification to
 * an ImportControl or ExportControl object that the import or
 * export operation has been completed. For import, an application will
 * simply pass back a pointer to the passed ImpexTranslationParams. For export,
 * the application must complete the GTP_transferVMChain field, and then
 * pass the structure.
 *
 *    	Pass:		itParams = ImpexTranslationParams
 *
 *    	Return:		Nothing
 *
 */

#ifdef __HIGHC__

pragma Alias(ImpexCreateTempFile,     "IMPEXCREATETEMPFILE");
pragma Alias(ImpexDeleteTempFile,     "IMPEXDELETETEMPFILE");
pragma Alias(ImpexImportFromMetafile, "IMPEXIMPORTFROMMETAFILE");
pragma Alias(ImpexExportToMetafile,   "IMPEXEXPORTTOMETAFILE");
pragma Alias(ImpexUpdateImportExportStatus, "IMPEXUPDATEIMPORTEXPORTSTATUS");
pragma Alias(ImpexImportExportCompleted, "IMPEXIMPORTEXPORTCOMPLETED");

#endif

@endlib


Internal\Resp\indicato.goh

/*
---------------------------------------------------------------------------
Copyright (c) 1995-1998 Nokia Mobile Phones.
*/

#ifndef _INDICATOR_
#define _INDICATOR_

/*      C CONSTANTS     */

/* Maximum document string length */

#define INDICATOR_MAX_DOCUMENT_STRING_LENGTH          41

/*      DATA TYPES      */

/* Custom note */

typedef struct
     {
     GeodeToken ICN_geodeToken;
    word       ICN_monikerSize;
     union
       {
       byte               ICN_iconMoniker[1];
       VisMonikerWithText ICN_textMoniker;
       } ICN_monikerData;
    } IndicatorCustomNote    } ;

/* Data block */

typedef struct
     {
    word IDB_monikerSize;
    union
        {
        byte               IDB_iconMoniker[1];
        VisMonikerWithText IDB_textMoniker;
          } IDB_monikerData;
    } IndicatorDataBlock    } ;

typedef struct
    {
    word  IDBWD_monikerSize;
    union
        {
          byte  IDBWD_monikerData[1];
        VisMonikerWithText IDBWD_visMoniker;
    } IDBWD_data;
    } IndicatorDataBlockWithData    } ;

/* Document info */

typedef struct
    {
    GeodeToken IDI_geodeToken;
     TCHAR      IDI_singularText[INDICATOR_MAX_DOCUMENT_STRING_LENGTH];
    TCHAR      IDI_pluralText[INDICATOR_MAX_DOCUMENT_STRING_LENGTH];
     sdword     IDI_docCount;
    } IndicatorDocInfo    } ;

/* Document count info */

typedef struct
    {
     GeodeToken IDCI_geodeToken;
    sdword     IDCI_docCount;
    } IndicatorDocCountInfo    } ;

/* Call type  */

typedef word IndicatorCallType ;
#define    INCT_INDICATOR_CALL_TYPE_NONE                    1
#define    INCT_INDICATOR_CALL_TYPE_VOICE                   2
#define    INCT_INDICATOR_CALL_TYPE_FAX                     3
#define    INCT_INDICATOR_CALL_TYPE_DATA                    4

/* Refresh type */

typedef word IndicatorRefreshType ;
#define    INRT_INDICATOR_REFRESH_MISSED_CALLS    	        1

/* Flashing note type */

typedef enum
    {
    IFN_SMS_RECEIVED     = 0,
    IFN_FAX_RECEIVED    ,
    IFN_EMAIL_RECEIVED    ,
    } IndicatorFlashingNote    } ;

/* Information note type */

typedef enum
     {
    IIN_INVALID_PHONE_NUMBER     = 0,
     IIN_NUMBER_BUSY	 ,
     IIN_NO_ANSWER	 ,
     IIN_NUMBER_CHANGED	 ,
     IIN_SERVICE_NOT_PROVIDED_BY_NETWORK	 ,
     IIN_NETWORK_BUSY	 ,
     IIN_NETWORK_FAILURE	 ,
     IIN_OPERATION_NOT_ALLOWED_BY_NETWORK	 ,
     IIN_TEMPORARY_NETWORK_FAILURE	 ,
     IIN_INCOMING_CALLS_NOT_ALLOWED_BY_CUG	 ,
     IIN_ONLY_CALLS_WITHIN_CUG_ALLOWED	 ,
     IIN_CALL_CHARGE_LIMIT_REACHED	 ,
     IIN_DATA_CALL_CREATION_ERROR_BY_OTHER_CALL	 ,
     IIN_NUMBER_NOT_IN_FIXED_DIALLING_LIST	 ,
     IIN_SIM_CALL_COST_LIMIT_EXCEEDED	 ,
     IIN_PHONE_OFF	 ,
     IIN_NO_SERVICE	 ,
     IIN_CALL_BARRING_ACTIVE	 ,
     IIN_NO_SIM	 ,
     IIN_SIM_REJECTED	 ,
     IIN_CHECK_OPERATOR_SERVICES
     } InicatorInformationNote	 } ;

#endif

/*
     END OF FILE
     ===========
*/


initfile.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	initfile.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines .ini file structures and routines.
 *
 *	$Id: initfile.h,v 1.25.4.3 98/04/16 18:49:43 jwu Exp $
 *
 ***********************************************************************/

#ifndef	__INITFILE_H
#define __INITFILE_H

extern void	/*XXX*/
    _pascal InitFileWriteData (const char *category, const char *key,
              const void *buffer, word bufSize);

/***/

extern void	/*XXX*/
    _pascal InitFileWriteString (const char *category, const char *key, const char *str);

/***/

extern void	/*XXX*/
    _pascal InitFileWriteInteger (const char *category, const char *key, word value);

/***/

extern void	/*XXX*/
    _pascal InitFileWriteBoolean (const char *category, const char *key, Boolean bool);

/***/

extern void 	/*XXX*/
    _pascal InitFileWriteStringSection (const char *category,
                   const char *key,
                   const char *string);

/***/

extern Boolean		/* true if error */	/*XXX*/
    _pascal InitFileReadDataBuffer (const char *category,
               const char *key,
               void *buffer,
               word bufSize,
               word *dataSize);

extern Boolean		/* true if error */	/*XXX*/
    _pascal InitFileReadDataBlock (const char *category,
              const char *key,
              MemHandle *block,
              word *dataSize);

/***/

#define	MAX_INITFILE_CATEGORY_LENGTH	 64

typedef ByteEnum InitFileCharConvert ;
#define IFCC_INTACT  0
#define IFCC_UPCASE  1
#define IFCC_DOWNCASE  2

typedef WordFlags InitFileReadFlags ;
#define IFRF_CHAR_CONVERT 	0xc000
#define IFRF_READ_ALL 	        0x2000
#define IFRF_FIRST_ONLY 	    	0x1000
#define IFRF_SIZE 		0x0fff

#define IFRF_CHAR_CONVERT_OFFSET  14

/*
 *  An enumerated type for specifying a category/key
 *  combination in the INI-file.  Used in conjunction
 *  with the GCNSLT_NOTIFY_INIT_FILE_CHANGE GCN list;
 *  an etype is used because passing the actual key
 *  and category would force clients to do costly
 *  string comparisons, which would degrade system
 *  performance.
 */
typedef enum {
  IFE_DATE_TIME_FORMAT  =0,
  IFE_NUMBER_FORMAT  =1,
  IFE_SYSTEM_SOUND  =2,
  IFE_INK_THICKNESS  =3,
  IFE_CURRENCY_FORMAT  =4,
  IFE_PUNCTUATION  =5,
  IFE_OWNER_INFO  =6
} InitFileEntry} ;

extern Boolean		/* true if error */	/*XXX*/
    _pascal InitFileReadStringBuffer (const char *category, const char *key,
                 char *buffer,
                 InitFileReadFlags flags, word *dataSize);

extern Boolean		/* true if error */	/*XXX*/
    _pascal InitFileReadStringBlock (const char *category, const char *key,
               MemHandle *block, InitFileReadFlags flags,
               word *dataSize);

/***/

extern Boolean		/* true if error */	/*XXX*/
    _pascal InitFileReadStringSectionBuffer (const char *category,
                    const char *key,
                    word section,
                    char *buffer,
                    InitFileReadFlags flags,
                    word *dataSize);

extern Boolean		/* true if error */	/*XXX*/
    _pascal InitFileReadStringSectionBlock (const char *category, const char *key,
                  word section, MemHandle *block,
                  InitFileReadFlags flags, word *dataSize);

/***/

extern Boolean	    	/* true if error */ 	/*XXX*/
    _pascal InitFileEnumStringSection (const char *category,
                  const char *key,
                  InitFileReadFlags flags,
                  PCB(Boolean, callback,   /* TRUE to stop */
                            (const char *stringSection,
                       word sectionNum,
                       void *enumData)),
                  void *enumData);

   /*
    * DEVELOPER'S NOTE:
    *
    *   InitFileEnumStringSection has a known bug where the
    *   segment and offset words of the 'key' parameter are
    *	reversed.  Fixing this will break backwards compatibility.
    *	The developer's workaround for the bug is simple:
    *
    *  #define SWAT_PTR(ptr) ((char *)(((dword)ptr<<16) | ((dword)ptr>>16)))
    *
    *  InitFileEnumStringSection(iniCategoryString, SWAP_PTR(iniKeyString)...
    *
    */

/***/

extern Boolean		/* true if error */	/*XXX*/
    _pascal InitFileReadInteger (const char *category, const char *key, word *i);

/***/

extern Boolean	    	/* true if error */ 	/*XXX*/
    _pascal InitFileReadAllInteger (const char *category,
                  const char *key,
                  PCB(Boolean, callback,   /* TRUE to stop */
                            (word integerValue,
                       void *enumData)),
                  void *enumData);

/***/

extern Boolean		/* true if error */	/*XXX*/
    _pascal InitFileReadBoolean (const char *category, const char *key, Boolean *bool);

/***/

extern dword	/*XXX*/
    _pascal InitFileGetTimeLastModified (void);

/***/

extern Boolean		/* true if error */	/*XXX*/
    _pascal InitFileSave (void);

/***/

extern Boolean		/* true if error */	/*XXX*/
    _pascal InitFileRevert (void);

/***/

extern void	/*XXX*/
    _pascal InitFileCommit (void);

/***/

extern void 	/*XXX*/
    _pascal InitFileDeleteStringSection (const char *category,
                const char *key,
                word stringNum);

/***/

extern void	/*XXX*/
    _pascal InitFileDeleteEntry (const char *category, const char *key);

/***/

extern void	/*XXX*/
    _pascal InitFileDeleteCategory (const char *category);

extern word
    _pascal InitFileGrab (MemHandle mem,	FileHandle fh,	word size);

extern void
    _pascal InitFileRelease (void);

extern void
    _pascal InitFileMakeCanonicKeyCategory (char *keyCat, const TCHAR *src);

#ifdef __HIGHC__
pragma Alias(InitFileWriteData, "INITFILEWRITEDATA");
pragma Alias(InitFileWriteString, "INITFILEWRITESTRING");
pragma Alias(InitFileWriteInteger, "INITFILEWRITEINTEGER");
pragma Alias(InitFileWriteBoolean, "INITFILEWRITEBOOLEAN");
pragma Alias(InitFileWriteStringSection, "INITFILEWRITESTRINGSECTION");
pragma Alias(InitFileReadDataBuffer, "INITFILEREADDATABUFFER");
pragma Alias(InitFileReadDataBlock, "INITFILEREADDATABLOCK");
pragma Alias(InitFileReadStringBuffer, "INITFILEREADSTRINGBUFFER");
pragma Alias(InitFileReadStringBlock, "INITFILEREADSTRINGBLOCK");
pragma Alias(InitFileReadStringSectionBuffer, "INITFILEREADSTRINGSECTIONBUFFER");
pragma Alias(InitFileReadStringSectionBlock, "INITFILEREADSTRINGSECTIONBLOCK");
pragma Alias(InitFileEnumStringSection, "INITFILEENUMSTRINGSECTION");
pragma Alias(InitFileReadInteger, "INITFILEREADINTEGER");
pragma Alias(InitFileReadAllInteger, "INITFILEREADALLINTEGER");
pragma Alias(InitFileReadBoolean, "INITFILEREADBOOLEAN");
pragma Alias(InitFileGetTimeLastModified, "INITFILEGETTIMELASTMODIFIED");
pragma Alias(InitFileSave, "INITFILESAVE");
pragma Alias(InitFileRevert, "INITFILEREVERT");
pragma Alias(InitFileCommit, "INITFILECOMMIT");
pragma Alias(InitFileDeleteStringSection, "INITFILEDELETESTRINGSECTION");
pragma Alias(InitFileDeleteEntry, "INITFILEDELETEENTRY");
pragma Alias(InitFileDeleteCategory, "INITFILEDELETECATEGORY");
pragma Alias(InitFileGrab, "INITFILEGRAB");
pragma Alias(InitFileRelease, "INITFILERELEASE");
pragma Alias(InitFileMakeCanonicKeyCategory, "INITFILEMAKECANONICALKEYCATEGORY");
#endif

#endif


Objects\inkfix.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1993 -- All Rights Reserved
 *
 * PROJECT:	GEOS
 * FILE:	inkfix.goh
 *
 * DECLARER:	Pen Library
 *
 * DESCRIPTION:
 *	This file defines the two Ink classes needed to support
 *	non-origin offset ink objects
 *
 *	$Id: inkfix.goh,v 1.2.7.1 96/04/28 08:30:58 chris Exp $
 *
 ***********************************************************************/

@optimize
@deflib inkfix

@include  <pen.goh>

@class	FixedInkClass, InkClass;

@instance	Rectangle	FII_realBounds;
    /* Internal instance variable for use when tweaking
     * the bounds when the object is not at the origin.  */

@message void MSG_FIXED_INK_GET_REAL_BOUNDS (Rectangle *retVal = axbpcxdx);
    /* This is exactly like MSG_VIS_GET_BOUNDS, except that
     * it acts on FII_realBounds.  */

@endc

@class	InkParentClass, VisCompClass;

    @instance	byte	IPI_doNotTranslateGState;
    /* If non-zero, the GState will not be translated.
     * This is set internally.  */

@endc

@endlib


input.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	input.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines keyboard structures.
 *
 *	$Id: input.h,v 1.25.4.1 96/04/28 08:29:31 chris Exp $
 *
 ***********************************************************************/

#ifndef	__INPUT_H
#define __INPUT_H

#include  <char.h>
#include  <graphics.h> 		/* For
#include  <hwr.h>     	    	/* For

/*
 *	PC GEOS Character Value codes
 */

typedef ByteEnum CharacterSet ;
#define CS_BSW    	0x00
#define CS_CONTROL    	0xff
#define CS_UI_FUNCS    	0xfe
#define	CS_CALCULATOR		0xfd

#define VC_ISANSI 	CS_BSW
#define VC_ISCTRL 	CS_CONTROL
#define VC_ISUI 		CS_UI_FUNCS
#define	VC_ISCALC		CS_CALCULATOR

/***/

typedef ByteEnum VChar ;
#define VC_NULL    	0x0	/* NULL */
#define VC_CTRL_A    	0x1	/* <ctrl>-A */
#define VC_CTRL_B    	0x2	/* <ctrl>-B */
#define VC_CTRL_C    	0x3	/* <ctrl>-C */
#define VC_CTRL_D    	0x4	/* <ctrl>-D */
#define VC_CTRL_E    	0x5	/* <ctrl>-E */
#define VC_CTRL_F    	0x6	/* <ctrl>-F */
#define VC_CTRL_G    	0x7	/* <ctrl>-G */
#define VC_CTRL_H    	0x8	/* <ctrl>-H */
#define VC_CTRL_I    	0x9	/* <ctrl>-I */
#define VC_CTRL_J    	0xa	/* <ctrl>-J */
#define VC_CTRL_K    	0xb	/* <ctrl>-K */
#define VC_CTRL_L    	0xc	/* <ctrl>-L */
#define VC_CTRL_M    	0xd	/* <ctrl>-M */
#define VC_CTRL_N    	0xe	/* <ctrl>-N */
#define VC_CTRL_O    	0xf	/* <ctrl>-O */
#define VC_CTRL_P    	0x10	/* <ctrl>-P */
#define VC_CTRL_Q    	0x11	/* <ctrl>-Q */
#define VC_CTRL_R    	0x12	/* <ctrl>-R */
#define VC_CTRL_S    	0x13	/* <ctrl>-S */
#define VC_CTRL_T    	0x14	/* <ctrl>-T */
#define VC_CTRL_U    	0x15	/* <ctrl>-U */
#define VC_CTRL_V    	0x16	/* <ctrl>-V */
#define VC_CTRL_W    	0x17	/* <ctrl>-W */
#define VC_CTRL_X    	0x18	/* <ctrl>-X */
#define VC_CTRL_Y    	0x19	/* <ctrl>-Y */
#define VC_CTRL_Z    	0x1a	/* <ctrl>-Z */
#define VC_ESCAPE    	0x1b	/* ESC */

#define VC_BLANK    	0x20	/* space */

/* Numeric keypad keys */

#define VC_NUMPAD_ENTER  0xd	/* only on PS/2 keyboards */
#define VC_NUMPAD_DIV   	'/'	/* only on PS/2 keyboards */
#define VC_NUMPAD_MULT   '*'
#define VC_NUMPAD_PLUS   '+'
#define VC_NUMPAD_MINUS  '-'
#define VC_NUMPAD_PERIOD  '.'
#define VC_NUMPAD_0   	'0'
#define VC_NUMPAD_1   	'1'
#define VC_NUMPAD_2   	'2'
#define VC_NUMPAD_3   	'3'
#define VC_NUMPAD_4   	'4'
#define VC_NUMPAD_5   	'5'
#define VC_NUMPAD_6   	'6'
#define VC_NUMPAD_7   	'7'
#define VC_NUMPAD_8   	'8'
#define VC_NUMPAD_9   	'9'

/* Extended keyboard codes -- non-ASCII */

#define VC_F1    	0x80	/* Function keys */
#define VC_F2    	0x81
#define VC_F3    	0x82
#define VC_F4    	0x83
#define VC_F5    	0x84
#define VC_F6    	0x85
#define VC_F7    	0x86
#define VC_F8    	0x87
#define VC_F9    	0x88
#define VC_F10   	 0x89
#define VC_F11   	 0x8a	/* only on PS/2 keyboards */
#define VC_F12   	 0x8b	/* only on PS/2 keyboards */
#define VC_F13   	 0x8c	/* non-standard key */
#define VC_F14   	 0x8d	/* non-standard key */
#define VC_F15   	 0x8e	/* non-standard key */
#define VC_F16   	 0x8f	/* non-standard key */

#define VC_UP    	0x90	/* Cursor keys */
#define VC_DOWN    	0x91
#define VC_RIGHT    	0x92
#define VC_LEFT    	0x93
#define VC_HOME    	0x94	/* Scroll commands */
#define VC_END    	0x95
#define VC_PREVIOUS    	0x96
#define VC_NEXT    	0x97
#define VC_INS    	0x98	/* INS */
#define VC_DEL    	0x9a	/* DEL */

#define VC_PRINTSCREEN  	0x9b	/* from <shift>-NUMPAD_MULT */
#define VC_PAUSE    	0x9c	/* from <ctrl>-NUMLOCK */
#define VC_BREAK    	0x9e	/* from  <ctrl>- or <alt>-combo */
#define VC_SYSTEMRESET   0x9f	/* <ctrl>-<alt>-<del> combo */

/* Joystick control keys (0xa0 - 0xa9) */

#define	VC_JOYSTICK_0		0xa0	/* joystick 0 degrees */
#define	VC_JOYSTICK_45		0xa1	/* joystick 45 degrees */
#define	VC_JOYSTICK_90		0xa2	/* joystick 90 degrees */
#define	VC_JOYSTICK_135		0xa3	/* joystick 135 degrees */
#define	VC_JOYSTICK_180		0xa4	/* joystick 180 degrees */
#define	VC_JOYSTICK_225		0xa5	/* joystick 225 degrees */
#define	VC_JOYSTICK_270		0xa6	/* joystick 270 degrees */
#define	VC_JOYSTICK_315		0xa7	/* joystick 315 degrees */
#define	VC_FIRE_BUTTON_1	 0xa8	/* fire button #1 */
#define	VC_FIRE_BUTTON_2	 0xa9	/* fire button #2 */

#define VC_PREV_BUTTON   0xb0    /* Prev-key, if supported */
#define VC_NEXT_BUTTON   0xb1    /* Next-key, if supported */

/* Shift Keys  (0xe0 - 0xe7) */

#define VC_LALT    	0xe0
#define VC_RALT    	0xe1
#define VC_LCTRL    	0xe2
#define VC_RCTRL    	0xe3
#define VC_LSHIFT    	0xe4
#define VC_RSHIFT    	0xe5
#define VC_SYSREQ    	0xe6	/* Not on base PC keyboard */
#define VC_ALT_GR    	0xe7

/* Toggle state keys (0xe8 - 0xef) */

#define VC_CAPSLOCK    	0xe8
#define VC_NUMLOCK    	0xe9
#define VC_SCROLLLOCK  	0xea

/* Extended state keys (0xf0 - 0xf7) */

/* Invalid key */

#define VC_INVALID_KEY    0xff

#define VC_BACKSPACE 	VC_CTRL_H
#define VC_TAB 		VC_CTRL_I
#define VC_LF 		VC_CTRL_J
#define VC_ENTER 	VC_CTRL_M

/*
 *  Calculator functions.
 */

typedef ByteEnum CChar ;
#define	CC_SQRT			0x00
#define CC_INVERSE 	0x01
#define CC_DIFFER 	0x02
#define CC_STACK 	0x03
#define CC_LAST 		0x04
#define CC_STO 		0x05
#define CC_RCL 		0x06
#define CC_PLUS_MINUS 	0x07

/*
 *	CharFlags
 */

typedef ByteFlags CharFlags ;

#define CF_STATE_KEY    	 0x80   /* Set if state key (shift/toggle modifier) */
#define CF_EXTENDED     	 0x10   /* TRUE: extended key	    	      */
#define CF_TEMP_ACCENT  	 0x08   /* Set if temporary accent char	      */
#define CF_FIRST_PRESS  	 0x04   /* Set if initial key press    	      */
#define CF_REPEAT_PRESS 	 0x02   /* Set if repeated key press          */
#define CF_RELEASE  	 0x01   /* Set if key release (may be	      */
                    /* set in conjunction with the	      */
                                /* other two, by monitors or	      */
                                /* UI to lessen # of events)	      */

/* Toggle State	  */

typedef WordFlags ToggleState ;
#define TS_SHIFTSTICK    0x80
#define TS_ALTSTICK      0x40
#define TS_CTRLSTICK     0x20
#define TS_FNCTSTICK     0x10
#define TS_CAPSLOCK  	0x04
#define TS_NUMLOCK   	0x02
#define TS_SCROLLLOCK 	0x01

/* Format of a keyboard shortcut, as used by the keyboard driver.     	 */
/* KS_ALT, KS_CTRL and KS_SHIFT means the keypress must have the    	 */
/* corresponding modifiers held down. KS_PHYSICAL means match the key,   */
/* not the character value. (this basically means ignore CAPSLOCK and	 */
/* NUMLOCK, as the other modifiers still must match). KS_CHAR_SET is	 */
/* the lower four bits of the CharacterSet, specifying whether the	 */
/* character is a control character or a printable character. KS_CHAR	 */
/* is the character itself, either in Chars or VChar.	    	    	 */

/*typedef ByteFlags KeyboardShortcutFlags;*/

/*
typedef struct {
    unsigned int    	  KS_character : 12;
    unsigned int          KS_flags :4;
} KeyboardShortcut;
*/
typedef WordFlags KeyboardShortcut ;

#define KS_PHYSICAL      0x8000	/* TRUE: match key, not character   */
#define KS_ALT   	0x4000	/* TRUE: <ALT> must be pressed	    */
#define KS_CTRL  	0x2000	/* TRUE: <CTRL> must be pressed	    */
#define KS_SHIFT  	0x1000	/* TRUE: <SHIFT> must be pressed    */
#define KS_CHAR_MASK      0x0fff

#ifdef DO_DBCS
#define KS_CHAR_SET_PRINTABLE 	0
#define	KS_CHAR_SET_CONTROL	 0
#else
#define KS_CHAR_SET_PRINTABLE 	(CS_BSW     & 0x0f)
#define KS_CHAR_SET_CONTROL 	(CS_CONTROL & 0x0f)
#endif

typedef ByteEnum Button ;
#define BUTTON_0  0
#define BUTTON_1  1
#define BUTTON_2  2
#define BUTTON_3  3

typedef ByteFlags ButtonInfo ;
#define BI_PRESS 		0x80
#define BI_DOUBLE_PRESS 		0x40
#define BI_B3_DOWN 		0x20
#define BI_B2_DOWN 		0x10
#define BI_B1_DOWN 		0x08
#define BI_B0_DOWN 		0x04
#define BI_BUTTON 		0x03

/* State of modifiers */

typedef ByteFlags ShiftState ;
#define SS_LALT 	    		0x80
#define SS_RALT 		    	0x40
#define SS_LCTRL 	    	0x20
#define SS_RCTRL     		0x10
#define SS_LSHIFT 	    	0x08
#define SS_RSHIFT 	    	0x04
#define SS_FIRE_BUTTON_1 	0x02
#define SS_FIRE_BUTTON_2 	0x01

typedef struct {
    word    	IH_count;
    /* The # ink points collected */

    Rectangle	IH_bounds;
    /* Bounds of the ink on the screen */

    optr    	IH_destination;
    /* The object that the ink was sent to */

    dword   	IH_reserved;
    /* Reserved for future use */

    InkPoint	IH_data;
} InkHeader} ;

#define	GCF_FIRST_CALL		0x8000
/* If set in the numStrokes field of a GestureCallback function, this means
 * that this is the first time the gesture callback has been called for a
 * given set of user input */
#endif


Objects\inputC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	Objects/inputC.goh
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines input methods, as they are sent through the
 * 	InputManager's monitor chain, & on to the UI.  Note that the UI
 *	converts MSG_META_BUTTON, MSG_META_PTR & MSG_META_DRAG to more
 *	generic messages which are then sent on to applications. (See
 *	uiInputC.goh)
 *
 *	$Id: inputC.goh,v 1.17.15.1 96/04/28 08:31:09 chris Exp $
 *
 ***********************************************************************/
@optimize
@deflib ui

@include  <Objects/metaC.goh>

/*
 * These may be used to extract ButtonInfo or ShiftState information from
 * the "inputState" value passed in the following messages.
 */
#define GET_BUTTON_INFO (val) 	((byte) (val))
#define GET_SHIFT_STATE (val) 	((byte) ((val) >> 8))

@importMessage MetaInputMessages, void MSG_META_MOUSE_BUTTON (
        word xPosition = cx,
        word yPosition = dx,
            word inputState = bp);
/*
 * "inputState" for MSG_META_MOUSE_BUTTON is ButtonInfo in the low byte,
 * ShiftState in the high byte -- use GET_BUTTON_INFO and GET_SHIFT_STATE.
 */

@importMessage MetaInputMessages, void MSG_META_MOUSE_PTR (
        word xPosition = cx,
        word yPosition = dx,
        word inputState = bp);
/*
 * "inputState" for MSG_META_MOUSE_PTR is ButtonInfo in the low byte,
 * ShiftState in the high byte -- use GET_BUTTON_INFO and GET_SHIFT_STATE.
 */

@alias (MSG_META_MOUSE_PTR) void MSG_META_PTR(
        MouseReturnParams *retVal = bpaxdxcx,
        sword xPosition = cx,
        sword yPosition = dx,
        word inputState = bp);
/*
 * NOTE!! unlike the other mouse messages in this file, which are the low-
 * level messages used in the InputManager, this is the real beast that is
 * passed to applications.  As such, the data passed & returned are different
 * from the others -- "inputState" for MSG_META_PTR is ButtonInfo in the
 * low byte, UIFunctionsActive in the high byte -- use GET_BUTTON_INFO and
 * GET_UI_FUNCTIONS_ACTIVE to extract.
 *
 */

@importMessage MetaInputMessages, void MSG_META_KBD_CHAR (
        word character = cx, word flags = dx, word state = bp);

@importMessage MetaInputMessages, void MSG_META_PRESSURE ();	/* NEEDS PROTOTYPE */

@importMessage MetaInputMessages, void MSG_META_DIRECTION ();	/* NEEDS PROTOTYPE */

@importMessage MetaInputMessages, void MSG_META_MOUSE_TIMER ();/* NEEDS PROTOTYPE */

@importMessage MetaInputMessages, void MSG_META_MOUSE_DRAG (
        word xPosition = cx,
        word yPosition = dx,
        word inputState = bp);
/*
 * "inputState" for MSG_META_MOUSE_DRAG is ButtonInfo in the low byte,
 * ShiftState in the high byte -- use GET_BUTTON_INFO and GET_SHIFT_STATE.
 */

@endlib


Internal\irlapDr.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1996 -- All Rights Reserved
 *
 * PROJECT:	  Socket Project
 * MODULE:	  IrLAP driver
 * FILE:	  irlapDr.h
 *
 * AUTHOR:  	  Andy Chiu: Mar  7, 1996
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	AC	3/ 7/96   	Initial version
 *
 * DESCRIPTION:
 *	C definitions for the irlap driver
 *
 *
 * 	$Id: irlapDr.h,v 1.2.2.2 97/12/01 14:20:01 cthomas Exp $
 *
 ***********************************************************************/
#ifndef _IRLAPDR_H_
#define _IRLAPDR_H_

/*  -------------------------------------------------------------------------
 *  DISCOVERY
 *  ------------------------------------------------------------------------*/

typedef ByteEnum IrlapUserTimeSlot ;
#define IUTS_1_SLOT 	0x0
#define IUTS_6_SLOT 	0x1
#define IUTS_8_SLOT 	0x2
#define IUTS_16_SLOT 	0x3

typedef ByteEnum IrlapDiscoveryType ;
#define IDT_DISCOVERY 	        0x0   /*  normal discovery   */
#define IDT_ADDRESS_RESOLUTION 	0x1   /*  address resolution */

/*
 *  From IrLMP spec: "It should be noted that the total number of bytes in
 *  the deviceInfo field must not exceed 23 bytes even though the IrLAP
 *  specification allows up to 32 bytes.  This is to prevent the XID process
 *  from spilling over into the next slot.
 *
 * DiscoveryInfo	TYPE	32 dup (byte)
 */
typedef byte DiscoveryInfo [23];

typedef WordFlags DiscoveryLogFlags ;		/* CHECKME */
/*  1 if discovery success / 0 if failure */
#define DLF_VALID 	(0x8000)
/*  Solicited discovery? */
#define DLF_SOLICITED 	(0x4000)
/*  Sniffing device? */
#define DLF_SNIFF 	(0x2000)
/*  Discovery failed because media is busy */
#define DLF_MEDIA_BUSY 	(0x1000)
/*  Discovery aborted */
#define DLF_ABORTED 	(0x0800)
/*  See NII_DISCOVERY_INDICATION */
#define DLF_REMOTE 	(0x0400)
/* 1 bit unused */
/*  number of valid bytes in DL_info */
#define DLF_INFO_SIZE 	(0x0100 | 0x0080 | 0x0040 | 0x0020 | 0x0010)
#define DLF_INFO_SIZE_OFFSET 	4
/*  INTERNAL USE */
#define DLF_INDEX 	(0x0008 | 0x0004 | 0x0002 | 0x0001)
#define DLF_INDEX_OFFSET 	0

/*
 * 	DL_flags and DL_deviceAddr can only be filled in by the driver
 * 	(so the client should not worry about them)
 */
typedef struct {
    DiscoveryLogFlags	DL_flags;   /*  32 bit device address */
    dword         	DL_devAddr; /*  32 byte discovery information */
    DiscoveryInfo	DL_info;
} DiscoveryLog} ;

typedef ByteFlags DiscoveryBlockFlags ;
#define DBF_LOG_RCVD 	(0x80)  /*  is set if any log has been received */
/* 7 bits unused */

typedef struct {
    Handle               DLB_blockHandle;  /*  block handle */
    DiscoveryBlockFlags	 DLB_flags;
    byte	         DLB_lastIndex;    /*  last log index = numLogs */
} DiscoveryLogBlock} ;

/*  -----------------------------------------------------------------------
 *  QUALITY OF SERVICE
 *  ------------------------------------------------------------------------*/

/*  Baud rate negotiation param in bps */
typedef ByteFlags IrlapParamBaudRate ;
#define IPBR_RESERVED 	(0x80 | 0x40) /*  reserved and cleared */
#define IPBR_RESERVED_OFFSET 	6
#define IPBR_115200BPS 	(0x20)
#define IPBR_57600BPS 	(0x10)
#define IPBR_38400BPS 	(0x08)
#define IPBR_19200BPS 	(0x04)
#define IPBR_9600BPS 	(0x02)
#define IPBR_2400BPS 	(0x01)

/*  Maximum Turnaround time */
typedef ByteFlags IrlapParamMaxTurnAround ;
#define IPMTA_RESERVED 	(0x80)
#define IPMTA_5MS 	(0x40)   /*  Only valid at 115200 bps */
#define IPMTA_10MS 	(0x20)   /*  Only valid at 115200 bps */
#define IPMTA_25MS 	(0x10)   /*  Only valid at 115200 bps */
#define IPMTA_50MS 	(0x08)   /*  Only valid at 115200 bps */
#define IPMTA_100MS 	(0x04)
#define IPMTA_250MS 	(0x02)
#define IPMTA_500MS 	(0x01)

/*  Data size negotiation param in bytes */
typedef ByteFlags IrlapParamDataSize ;
#define IPDS_RESERVED 	(0x80 | 0x40) /*  reserved and cleared */
#define IPDS_RESERVED_OFFSET 	6
#define IPDS_2048BYTES 	(0x20)
#define IPDS_1024BYTES 	(0x10)
#define IPDS_512BYTES 	(0x08)
#define IPDS_256BYTES 	(0x04)
#define IPDS_128BYTES 	(0x02)
#define IPDS_64BYTES 	(0x01)

/*  Window size negotiation param in frames */
typedef ByteFlags IrlapParamWindowSize ;
#define IPWS_RESERVED 	(0x80)  /*  reserved and cleared */
#define IPWS_7FRAME 	(0x40)
#define IPWS_6FRAME 	(0x20)
#define IPWS_5FRAME 	(0x10)
#define IPWS_4FRAME 	(0x08)
#define IPWS_3FRAME 	(0x04)
#define IPWS_2FRAME 	(0x02)
#define IPWS_1FRAME 	(0x01)  /*  (lsb, transmitted first) */

/*  number of additional BOF at 115200  */
typedef ByteFlags IrlapParamNumBof ;
#define IPNB_0BOF 	(0x80)
#define IPNB_1BOF 	(0x40)
#define IPNB_2BOF 	(0x20)
#define IPNB_3BOF 	(0x10)
#define IPNB_5BOF 	(0x08)
#define IPNB_12BOF 	(0x04)
#define IPNB_24BOF 	(0x02)
#define IPNB_48BOF 	(0x01)

typedef ByteFlags IrlapParamMinTurnaround ;
#define IPMT_0MS 	(0x80)   /*  0ms    */
#define IPMT_001MS 	(0x40)   /*  0.01ms */
#define IPMT_005MS 	(0x20)   /*  0.05ms */
#define IPMT_01MS 	(0x10)   /*  0.1ms  */
#define IPMT_05MS 	(0x08)   /*  0.5ms  */
#define IPMT_1MS 	(0x04)
#define IPMT_5MS 	(0x02)
#define IPMT_10MS 	(0x01)

/*  Link Disconnect/threshold Time: 6.6.11  */
typedef ByteFlags IrlapParamLinkDisconnect ;		/* CHECKME */
#define IPLTT_40SEC 	(0x80)  /*  (thresholdequ3sec) */
#define IPLTT_30SEC 	(0x40)  /*  (thresholdequ3sec) */
#define IPLTT_25SEC 	(0x20)  /*  (thresholdequ3sec) */
#define IPLTT_20SEC 	(0x10)  /*  (thresholdequ3sec) */
#define IPLTT_16SEC 	(0x08)  /*  (thresholdequ3sec) */
#define IPLTT_12SEC 	(0x04)  /*  (thresholdequ3sec) */
#define IPLTT_8SEC 	(0x02)  /*  (thresholdequ3sec) */
#define IPLTT_3SEC 	(0x01)  /*  (thresholdequ0)    */

/*
 *  connection parameter structure within station structure
 *  NOTE: the ordering of fields is critical
 *
 *  ICP_baudRate and ICP_linkDisconnect are "type 0" parameters that must
 *  be negotiated to the same value for both stations involved in a connection.
 *  Other parameters are of "type 1", and are negotiated independently for
 *  both stations involved in a connection.
 */
typedef struct {
    IrlapParamBaudRate	        ICP_baudRate;
    IrlapParamMaxTurnAround	ICP_maxTurnAround;
    IrlapParamDataSize	        ICP_dataSize;
    IrlapParamWindowSize	ICP_windowSize;
    IrlapParamNumBof         	ICP_numBof;
    IrlapParamMinTurnaround	ICP_minTurnAround;
    IrlapParamLinkDisconnect	ICP_linkDisconnect;
    IrlapParamDataSize          ICP_dataSizeIn;
    IrlapParamWindowSize	ICP_windowSizeIn;
    byte                        ICP_unused;  /*	align	word */
    /* NOTE: This structure is slightly incorrect, missing
     *       two bytes of data.  It exists only for backward
     *       code compatibility.  Use IrlapConnectionParams1 instead.
     */
} IrlapConnectionParams} ;

typedef struct {
    IrlapParamBaudRate	        ICP_baudRate;
    IrlapParamMaxTurnAround	ICP_maxTurnAround;
    IrlapParamDataSize	        ICP_dataSize;
    IrlapParamWindowSize	ICP_windowSize;
    IrlapParamNumBof         	ICP_numBof;
    IrlapParamMinTurnaround	ICP_minTurnAround;
    IrlapParamLinkDisconnect	ICP_linkDisconnect;
    IrlapParamDataSize          ICP_dataSizeIn;
    IrlapParamWindowSize	ICP_windowSizeIn;
    byte                        ICP_unused;  /*	align	word */
} IrlapConnectionParams1} ;

typedef WordFlags QualityOfServiceFlags ;		/* CHECKME */
#define QOSF_DEFAULT_PARAMS 	(0x8000)
/* 15 bits unused */

typedef struct {
    IrlapConnectionParams   QOS_param;
    dword	            QOS_devAddr;  /*  address to connect to */
    QualityOfServiceFlags   QOS_flags;
    /* NOTE: This structure is slightly incorrect, missing
     *       two bytes of data.  It exists only for compatibility
     *       with old code.  Use QualityOfService1 instead.
     *       (see IrlapConnectionParams);
     */
} QualityOfService} ;

typedef struct {
    IrlapConnectionParams1   QOS_param;
    dword	            QOS_devAddr;  /*  address to connect to */
    QualityOfServiceFlags   QOS_flags;
} QualityOfService1} ;

/*  --------------------------------------------------------------------------
 *  STATUS
 *  -------------------------------------------------------------------------*/

typedef WordFlags ConnectionStatus ;
/*  connection is in jeopardy */
#define CS_IMPENDING_DISCONNECTION 	(0x8000)
/*  there are unacked data in send buffer */
#define CS_UNACKED_DATA 	(0x4000)
/* 14 bits unused */

typedef enum {
    ISIT_CONNECTED     = 0x01,
    ISIT_BLOCKED     = 0x02,
    ISIT_OK     = 0x03,
    ISIT_DISCONNECTED     = 0x04,
} IrlapStatusIndicationType} ;

#endif /* _IRLAPDR_H_ */


irlmp.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1996 -- All Rights Reserved
 *
 * PROJECT:	  GEOS
 * MODULE:	  Irlmp
 * FILE:	  irlmp.h
 *
 * AUTHOR:  	  Andy Chiu: Mar  5, 1996
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	AC	3/ 5/96   	Initial version
 *
 * DESCRIPTION:
 *
 *
 *
 * 	$Id: irlmp.h,v 1.2.2.3 97/12/01 14:12:31 cthomas Exp $
 *
 ***********************************************************************/
#ifndef _IRLMP_H_
#define _IRLMP_H_

/* ----------------------------------------------------------------------------
 * 			COMPILER DIRECTIVES
 * ----------------------------------------------------------------------------*/

#define GENOA_TEST 	(0)
#if GENOA_TEST
PrintMessage	<Turn this flag of before shipping...>
#endif

#include	 <Internal/irlapDr.h>

/* ---------------------------------------------------------------------------
 *
 * 				LSAP
 *
 * ---------------------------------------------------------------------------*/

typedef	byte IrlmpLsapSel ;

#define IRLMP_ANY_LSAP_SEL 	(0xFF)
/*
 *  Not a true LSAP-Sel.  Pass this to IrlmpRegister when no specific
 *  LSAP-Sel is requested.
 */

#define IRLMP_MONITOR_LSAP_SEL 	(0x82)
/*
 *  Register to this LSAP in order to receive IIC_STATUS_INDICATION only.
 */

#define IRLMP_PENDING_CONNECT 	(0x81)
/*
 *  Not a true LSAP-Sel.  This indicates that we are still waiting for
 *  a PDU to establish the IrLMP level connection, and the peer LSAP-Sel
 *  is still unknown.
 */

#define IRLMP_XID_DISCOVERY_SAP 	(0x80)
/*
 *  Not a true LSAP-Sel.  Pass this to IrlmpRegister to indicate that
 *  client wishes to bind to the XID_Discovery Service Access Point,
 *  in order to receive LM_DiscoverDevices.indication only.
 */

#define IRLMP_IAS_LSAP_SEL 	(0x00)
/*
 *  Reserved for IAS. Only a client prepared to respond to IAS queries
 *  should bind to this LSAP-Sel.
 */

#define IRLMP_CONNECTIONLESS_LSAP_SEL 	(0x70)
/*
 *  Reserved for Connectionless Data service, which is not currently
 *  supported in this implementation.
 */

#define IRLMP_BROADCAST_LSAP_SEL 	(0x7F)
/*  Reserved for broadcast data, which is not currently supported. */

#define IRLMP_MAX_LEGAL_LSAP_SEL 	(0x80)
/*  LSAPs with values above 0x6F are reserved. */

typedef struct {
/* 32-bit IrLAP device address */
    dword		ILI_irlapAddr;
    IrlmpLsapSel	ILI_lsapSel;
    byte		ILI_unused;	/* align word */
} IrlmpLsapID} ;

/* ------------------------------------------------------------------------
 *
 * 			Structs for requests
 *
 * ------------------------------------------------------------------------*/

#if GENOA_TEST

/*
 *  I added these options to make irlap handle data requests deterministically.
 *  For instance, Genoa test suite expects us to send multiple frames in
 *  response to a certain trigger data, but if we don't do anything special like
 *  this, data requests will be enqueued and there is no saying when they will
 *  be sent out.  Suspending irlap then enqueueing requests and then unsuspending
 *  irlap guarantees that the data requests enqueued in between suspending and
 *  unsuspending irlap will be sent out in one window( or as much of it as
 *  possible will be sent out in one window ).
 * 							- SJ
 */

typedef WordFlags IrlmpDataArgFlag ;
/*  suspend IrLAP thread before enqueueing data request */
#define IDAF_SUSPEND_IRLAP 	(0x8000)
/*  unsuspend IrLAP thread after enqueueing request */
#define IDAF_UNSUSPEND_IRLAP 	(0x4000)
/* 14 bits unused */

#endif

/*
 *  Data is passed to the Irlmp Library in a HugeLMem buffer allocated
 *  with the NetUtils Library.  The Irlmp Library will free the HugeLMem
 *  buffer when done transmitting the data.
 *
 *  The data buffer HugeLMem block must have IRLMP_HEADER_SIZE bytes of
 *  free space before the actual data (or TTP_HEADER_SIZE bytes, if using
 *  TinyTP.)  In other words, IDA_dataOffset must be equal or greater than
 *  IRLMP_HEADER_SIZE (or TTP_HEADER_SIZE).  This space is used by the Irlmp
 *  Library to place its (and TinyTP's) PDU header, before passing the data to
 *  the IrLAP Driver.
 */

typedef struct {
    word	IDA_dataSize;
/*
 *  IDA_dataOffset and IDA_data are only valid if IDA_dataSize > 0
 *  The maximum IDA_dataSize is ICA_QoS.QOS_param.ICP_dataSize minus
 *  either IRLMP_HEADER_SIZE or TTP_HEADER_SIZE.
 */

    word	IDA_dataOffset;
/*
 *  Offset into IDA_data where the real data starts.  IDA_dataOffset
 *  must be at least IRLMP_HEADER_SIZE (or TTP_HEADER_SIZE for TinyTP
 *  requests), providing room in IDA_data for the IrLMP and IrLAP
 *  (and TinyTP) packet headers.
 */

    optr	IDA_data;
/*
 *  HugeLMem data allocated with the NetUtils Library.  When passed
 *  to the Irlmp Library, the library frees the data when done using
 *  it.  When passed to a client callback, the callback routine is
 *  responsible for freeing this data by calling HugeLMemFree.
 */

#if GENOA_TEST
    IrlmpDataArgFlag	IDA_flags;
/*
 *  I am adding this flag to pass special information into IRDA stack
 *  see record definition
 */
#endif

} IrlmpDataArgs} ;

#define IRLMP_HEADER_SIZE 	(4)
#define TTP_HEADER_SIZE 	(IRLMP_HEADER_SIZE + 1)

typedef struct {
word		ICA_dataSize;
word		ICA_dataOffset;
optr		ICA_data;
IrlmpLsapID	ICA_lsapID;
QualityOfService	ICA_QoS;
    /* NOTE: This structure is incorrect, missing
     *       two bytes of data.  It exists only for compatibility
     *       with old code.  Use IrlmpConnectArgs1 instead.
     *       (see IrlapConnectionParams);
     */
} IrlmpConnectArgs} ;

typedef struct {
word		ICA_dataSize;
/*
 *  Maximum size is 60 bytes for IrLMP, and 53 bytes for TinyTP.
 *  ICA_dataOffset and ICA_data are only valid if ICA_dataSize > 0.
 */

word		ICA_dataOffset;
/*
 *  Offset into ICA_data where the real data starts.  IDA_dataOffset
 *  must be at least IRLMP_HEADER_SIZE (or TTP_HEADER_SIZE), providing
 *  room in ICA_data for the IrLMP and IrLAP (and TinyTP) packet
 *  headers.
 */

optr		ICA_data;
/*
 * HugeLMem data
 *  HugeLMem data allocated with the NetUtils Library.  When passed
 *  to the Irlmp Library, the library frees the data when done using
 *  it.  When passed to a client callback, the callback routine is
 *  responsible for freeing this data by calling HugeLMemFree.
 */

IrlmpLsapID	ICA_lsapID;
/*  LSAP-ID of remote device */

QualityOfService1	ICA_QoS;
/*
 *  QOS_devAddr field is always ignored; the IrLAP address should
 *  be passed in ICA_lsapID.  If QOSF_DEFAULT_PARAMS is set, then
 *  the QOS_param field is ignored, and default params are read in
 *  from the initfile.
 */

} IrlmpConnectArgs1} ;

/* ----------------------------------------------------------------------
 *
 *  			Error Codes
 *
 * ----------------------------------------------------------------------*/

/* enum IrlmpError */
typedef enum {

    IE_SUCCESS     = 0x0,

    IE_LSAP_SEL_IN_USE     = 0x2,
/*  The requested LSAP-Sel is already being used by another client */

    IE_NO_FREE_LSAP_SEL     = 0x4,
/*  All legal LSAP-Sel values are in use. */

    IE_LSAP_DISCONNECTED     = 0x6,
    IE_UNABLE_TO_LOAD_IRLAP_DRIVER     = 0x8,
    IE_ALREADY_CONNECTED     = 0xa,
    IE_INCOMING_CONNECTION     = 0xc,
    IE_RESPONSE_WITHOUT_INDICATION     = 0xe,
    IE_LSAP_NOT_DISCONNECTED     = 0x10,

    IE_IAS_CONNECTED_TO_ANOTHER_ADDRESS     = 0x12,
/*  The IAS Client FSM is already connected to a different IrLAP address. */

    IE_LSAP_NOT_CONNECTED_TO_IAS     = 0x14,
/*
 *  IrlmpDisconnectIas was called, but the endpoint did not make any IAS
 *  queries.
 */

    IE_DISCONNECT_INDICATION     = 0x16,
/*  Lost connection to peer IAS LSAP in the middle of IAS query. */

    IE_TTP_TX_QUEUE_FULL     = 0x18,
} IrlmpError} ;
/*
 *  The TinyTP TxQueue is full; therefore, no data requests can be accepted.
 *  Caller should try again later.
 */

/* ---------------------------------------------------------------------------
 *
 * 				IAS
 *
 * ---------------------------------------------------------------------------*/

/*
 *  Class and Attribute names are preceded by an 8-bit size byte.
 */
typedef struct {
    byte	IINH_size;
/*    label 	char	IINH_name; */
} IrlmpIasNameHeader} ;

/*
 *  Maximum size for a Class or Attribute name is 60 bytes.
 */
#define IRLMP_IAS_MAX_NAME_SIZE 	(60)

typedef struct {
    byte	IIMN_size;
    char	IIMN_name[IRLMP_IAS_MAX_NAME_SIZE];
} IrlmpIasMaxName} ;

/*
 *  Each object in the IAS database has an object ID.
 */
typedef word IrlmpIasObjectIdentifier ;

/*
 *  Values for attributes are encoded so that the first byte indicates the
 *  object type.
 */
typedef ByteEnum IrlmpIasValueType ;
#define IIVT_MISSING 		0x0
#define IIVT_INTEGER 		0x1
#define IIVT_OCTET_SEQUENCE 	0x2
#define IIVT_USER_STRING 	0x3

/*
 *  IIVT_INTEGER type object.
 */
typedef dword IrlmpIasIntegerValue ;

/*
 *  IIVT_OCTET_SEQUENCE type object.
 */
typedef struct {
    word	IIOSH_size;
/*    label	byte	IIOSH_value; */
} IrlmpIasOctetSequenceHeader} ;

/*
 *  Objects of type IIVT_USER_STRING have the character set encoded as part
 *  of the value.
 */
typedef ByteEnum IrlmpIasCharSetCode ;
#define IICSC_ASCII 		0x0
#define IICSC_ISO_8859_1 	0x1
#define IICSC_ISO_8859_2 	0x2
#define IICSC_ISO_8859_3 	0x3
#define IICSC_ISO_8859_4 	0x4
#define IICSC_ISO_8859_5 	0x5
#define IICSC_ISO_8859_6 	0x6
#define IICSC_ISO_8859_7 	0x7
#define IICSC_ISO_8859_8 	0x8
#define IICSC_ISO_8859_9 	0x9
#define IICSC_UNICODE 		0xff

/*
 *  Object of type IIVT_USER_STRING
 */
typedef struct {
    IrlmpIasCharSetCode	IIUSH_charSet;
    byte		IIUSH_size;
/*    label	char	IIUSH_value; */
} IrlmpIasUserStringHeader} ;

/*
 *  Union of the possible types for the IIAV_value field.
 */
typedef union {
    IrlmpIasIntegerValue	IIVU_integer;
    IrlmpIasOctetSequenceHeader	IIVU_octetSequence;
    IrlmpIasUserStringHeader	IIVU_userString;
} IrlmpIasValueUnion} ;

/*
 *  IAS attribute value, with value type.
 */
typedef struct {
    IrlmpIasValueType	IIAV_type;
    IrlmpIasValueUnion	IIAV_value;
} IrlmpIasAttributeValue} ;

/* -------------------------------------------------------------------------
 *
 * 	       Stuctures and types for Irlmp
 *
 * -------------------------------------------------------------------------*/
typedef Handle ClientHandle ;

/* -----------------------------------------------------------------------
 *
 *  	Indications and Confirmations For Client Callback Routine.
 *
 * -----------------------------------------------------------------------*/

/*
 *  The routine passed to IrlmpRegister will be called for Irlmp indications
 *  and confirmations.  The callback runs on the irlmp thread, so it should
 *  be as short as possible.  The arguments passed to the callback are not
 *  valid after the callback exits, so it should copy the needed information
 *  rather than storing pointers.
 */

/* enum IrlmpIndicationOrConfirmation */
typedef enum {

    IIC_DISCOVER_DEVICES_INDICATION     = 0x0,
/*
 *  Indication to clients bound to IRLMP_XID_DISOVERY_SAP that a remote
 *  machine discovered the local machine.
 *
 * 	Pass:		client	= client handle of requester
 * 			extra	= extra word passed to IrlmpRegister
 * 			data 	= optr of chunk array of DiscoveryLog.
 *                                Not valid
 * 				  after callback returns, so callback should
 * 			    	  copy whatever information it wants to keep.
 * 				  DL_info begins with IrlmpDiscoveryServiceA,
 * 				  possibly followed by IrlmpDiscoveryServiceB,
 * 				  possibly followed by other service hints.
 * 				  Following that is the device's name, as
 * 				  an IAS User String (without the type)
 * 	Return: 	nothing
 * 	Destroy:	nothing
 */

    IIC_DISCOVER_DEVICES_CONFIRMATION     = 0x2,
/*
 *  Results of discovery.
 *
 * 	Pass:		client	= client handle of requester
 * 			extra	= extra word passed to IrlmpRegister
 * 			status	= IrlmpDiscoveryStatus
 * 		        data 	= optr of chunk array of DiscoveryLog.
 *                                Not valid
 * 				  after callback returns, so callback should
 * 			    	  copy whatever information it wants to keep.
 * 				  DL_info begins with IrlmpDiscoveryServiceA,
 * 				  possibly followed by IrlmpDiscoveryServiceB,
 * 				  possibly followed by other service hints.
 * 				  Following that is the device's name, as
 * 				  an IAS User String (without the type)
 */

    IIC_CONNECT_INDICATION     = 0x4,
/*
 *  A remote LSAP wants to establish a connection to the LSAP that received
 *  this indication.  The callback should respond with either
 *  IrlmpConnectResponse or IrlmpDisconnectRequest.
 *
 * 	Pass:		client	= client handle
 * 			extra	= extra word passed to IrlmpRegister
 * 			data	= IrlmpConnectArgs.  If ICA_dataSize > 0, then
 * 				  callback must free the ICA_data.
 * 	Return:		nothing
 * 	Destroy:	nothing
 */

    IIC_CONNECT_CONFIRMATION     = 0x6,
/*
 *  Connect request was accepted.
 *
 * 	Pass:		client	= client handle
 * 			extra	= extra word passed to IrlmpRegister
 * 			data	= IrlmpConnectArgs.  If ICA_dataSize > 0, then
 * 				  callback must free the ICA_data.
 * 				  Note that ICA_QoS.QOS_param.ICP_dataSize
 * 				  provides the maximum data size for the
 * 				  IrLAP layer.  The client's maximum data
 * 				  size is this value minus IRLMP_HEADER_SIZE.
 */

    IIC_DISCONNECT_INDICATION     = 0x8,
/*
 *  Connection was terminated.
 *
 * 	Pass:		client	= client handle
 * 			extra	= extra word passed to IrlmpRegister
 * 			status	= IrlmpDisconnectReason
 * 			data 	= IrlmpDataArgs.  If IDA_dataSize > 0, then
 * 				  callback must free the data.
 * 	Return:		nothing
 * 	Destroy:	nothing
 */

    IIC_STATUS_INDICATION     = 0xa,
/*
 *  Remote device requested status, or current connection is in jeopardy.
 *
 * 	Pass:		client	= client handle
 * 			extra	= extra word passed to IrlmpRegister
 * 			status	= ConnectionStatus (from IrLAP)
 */

    IIC_STATUS_CONFIRMATION     = 0xc,
/*
 *  Received connection status from remote side.
 *
 * 	Pass:		client	= client handle
 * 			extra	= extra word passed to IrlmpRegister
 * 			status	= ConnectionStatus
 */

    IIC_DATA_INDICATION     = 0xe,
/*
 *  Incoming data indication.
 *
 * 	Pass:		client	= client handle
 * 			extra	= extra word passed to IrlmpRegister
 * 			data	= IrlmpDataArgs.  If IDA_dataSize > 0, then
 * 				  callback must free the data.
 */
    IIC_UDATA_INDICATION     = 0x10,
/*
 *  Incoming UData indication.
 *
 * 	Pass:           client  = ClientHandle
 * 			extra	= extra word passed to IrlmpRegister
 * 			data	= IrlmpDataArgs.  If IDA_dataSize > 0, then
 * 				  callback must free the data.
 *
 */

/* ----------------------------------------------------------------------
 *
 * 			IAS Confirmations
 *
 * ----------------------------------------------------------------------*/

    IIC_GET_VALUE_BY_CLASS_CONFIRMATION     = 0x12,

    IIC_LAST_VALUE     = 0x12,
} IrlmpIndicationOrConfirmation} ;
/*
 *  Results of IAS query.
 *
 * 	Pass:           client  = ClientHandle
 * 			extra	= extra word passed to IrlmpRegister
 *                      data    = optr to chunk array of IrlmpIasIdAndValue
 *                      status  = IrlmpGetValueByClassReturnCode
 *                      if error IrlmpError is returned by ThreadGetError
 *
 */

typedef ByteEnum IrlmpDisconnectReason ;
#define IDR_USER_REQUEST 				0x1
#define IDR_UNEXPECTED_IRLAP_DISCONNECT 			0x2
#define	IDR_FAILED_TO_ESTABLISH_IRLAP_CONNECTION	 	0x3
#define IDR_IRLAP_RESET 					0x4
#define IDR_LINK_MANAGEMENT_DISCONNECT 			0x5
#define IDR_DATA_ON_DISCONNECTED_LSAP 			0x6
#define	IDR_NON_RESPONSIVE_LM_MUX_CLIENT	 		0x7
#define IDR_NO_AVAILABLE_LM_MUX_CLIENT 			0x8
#define IDR_UNSPECIFIED 					0xff

/* This is slightly different from the assembly version */
typedef struct {
    dword	         IGVBCRA_irlapAddr;
    char                *IGVBCRA_className;
    char                *IGVBCRA_attributeName;
} IrlmpGetValueByClassRequestArgs} ;

typedef ByteEnum IrlmpDiscoveryStatus ;
#define IDS_DISCOVERY 	0x0  /*  Returning results of actual discovery. */
#define IDS_CACHED 	0x1  /*  Already connected.  Returning cached discovery log info. */
#define IDS_PASSIVE 	0x2  /*  Remote device discovered us.   */

typedef ByteFlags IrlmpDiscoveryServiceA ;
#define IDSA_EXTENDED 	(0x80)  /* set means IrlmpDiscoveryServiceB byte is */
                /*  present                                 */
#define IDSA_LAN_ACCESS 	(0x40)  /* set means device provides access to a LAN*/
#define IDSA_FAX 	(0x20)  /* set means device provides fax service */
#define IDSA_MODEM 	(0x10)  /* set means device provides data modem  */
                                /*  service                              */
#define IDSA_PRINTER 	(0x08)  /* set means device provides hardcopy (and */
                                /*   usually supports IrLPT protocol) */
#define IDSA_COMPUTER 	(0x04)  /* set means device is a personal computer */
                                /*   (desktop/laptop)                      */
#define IDSA_PDA 	(0x02)  /* set means device is a PDA or            */
                                /* palmtop computer                        */
#define IDSA_PNP_COMPATIBLE 	(0x01) /* set means device is Plug-N-Play */
                                       /*  compatible (contains all       */
                                       /*  required PnP attributes        */
                                       /*  in the IAS)                    */

typedef ByteFlags IrlmpDiscoveryServiceB ;		/* CHECKME */
#define IDSB_EXTENDED 	 (0x80)  /*  set means further service bytes whose */
                                 /*   meaning is unknown follow            */
/* 4 bits unused */
#define IDSB_IRCOMM 	 (0x04)  /*  set means device provides IrCOMM service */
#define IDSB_FILE_SERVER  (0x02)  /*  set means device is a file server */
#define IDSB_TELEPHONY 	(0x01)   /*  set means device is a telephone  */
                                 /* switch/PBX of some sort?          */

typedef struct {
    IrlmpIasObjectIdentifier	IIIAV_id;
    IrlmpIasAttributeValue	IIIAV_value;
} IrlmpIasIdAndValue} ;

typedef ByteEnum IrlmpGetValueByClassReturnCode ;
#define IGVBCRC_SUCCESS 	                0x0
#define IGVBCRC_NO_SUCH_CLASS 	        0x1
#define IGVBCRC_NO_SUCH_ATTRIBUTE 	0x2
#define IGVBCRC_IRLMP_ERROR 	        0xff
/*
 *  Not an IAS-defined return code.  This means that the request failed
 *  because of some IrLMP error, such as a lost connection.
 */

typedef void _pascal IrlmpCallbackType  (ClientHandle client,
               IrlmpIndicationOrConfirmation type,
               word extra,
               dword data,
               word status);

/* -------------------------------------------------------------------------
 *
 * 				TinyTP
 *
 *  Applications wishing to use the TinyTP flow control mechanism must
 *  use the routines below, instead of their IrLMP counterparts.
 *
 * -----------------------------------------------------------------------*/

IrlmpError
_pascal TTPRegister (IrlmpLsapSel *lsapSel, word extraData,
              PCB(void, callback, (ClientHandle client,
                       IrlmpIndicationOrConfirmation type,
                       word extra,
                       dword data,
                       word status)),
              ClientHandle *clientHandle);
/*
 * 	Desc:	Register to use TinyTP.  Client using TTPRegister must
 * 		use:
 * 			TTPConnectRequest
 * 			TTPConnectResponse
 * 			TTPDataRequest
 * 			TTPDisconnectRequest
 * 		instead of:
 * 			IrlmpConnectRequest
 * 			IrlmpConnectResponse
 * 			IrlmpDataRequest
 * 			IrlmpDisconnectRequest
 *
 * 		The client callback will receive:
 * 			TTPIC_CONNECT_INDICATION
 * 			TTPIC_CONNECT_CONFIRMATION
 * 			TTPIC_DATA_INDICATION
 * 			TTPIC_DISCONNECT_INDICATION
 * 		instead of:
 * 			IIC_CONNECT_INDICATION
 * 			IIC_CONNECT_CONFIRMATION
 * 			IIC_DATA_INDICATION
 * 			IIC_DISCONNECT_INDICATION
 *
 * 		Other functions and callbacks are the same as when using
 * 		IrlmpRegister.
 *
 * 	Pass:	same as IrlmpRegister
 * 	Return:	same as IrlmpRegister
 */

IrlmpError
_pascal TTPUnregister (ClientHandle client);
/*
 * 	Desc:	Same as IrlmpUnregister
 * 	Pass:	Same as IrlmpUnregister
 * 	Return:	Same as IrlmpUnregister
 */

IrlmpError
_pascal TTPConnectRequest (ClientHandle client, IrlmpConnectArgs1 *connectArgs);
/*
 * 	Desc:	Request that a TinyTP connection be established to a remote
 * 		IrlmpLsapID.
 * 	Pass:	Same as IrlmpConnectRequest
 * 	Return:	Same as IrlmpConnectRequest
 */

IrlmpError
_pascal TTPConnectResponse (ClientHandle client, IrlmpDataArgs *dataArgs);
/*
 * 	Desc:	Accept a TinyTP connection initiated by a remote device.
 * 		To reject a connection, use TTPDisconnectRequest.
 * 	Pass:	same as IrlmpConnectResponse
 * 	Return:	same as IrlmpConnectResponse
 */

IrlmpError
_pascal TTPDataRequest (ClientHandle client, IrlmpDataArgs *dataArgs);
/*
 * 	Desc:	Send data through the TinyTP connection.
 * 	Pass:	si	= client handle
 * 		cx:dx	= IrlmpDataArgs.  IDA_dataSize must not be larger than
 * 			(ICA_QoS.QOS_param.ICP_dataSize - TTP_HEADER_SIZE).
 * 	Return: carry clear if okay:
 * 			ax	= IE_SUCCESS
 * 		carry set if error:
 * 			ax	= IrlmpError
 * 					IE_LSAP_DISCONNECTED
 * 					IE_TTP_TX_QUEUE_FULL
 */

word
_pascal TTPTxQueueGetFreeCount (ClientHandle client);
/*
 * 	Desc:	Returns the number of calls to TTPDataRequest that can be
 *  		handled before TxQueue is full.
 * 	Pass:	si	= client handle
 *  	Return:	cx	= free count (send credits + free TxQueue entries)
 */

IrlmpError
_pascal TTPDisconnectRequest (ClientHandle client, IrlmpDataArgs *dataArgs);
/*
 * 	Desc:	Terminate TinyTP connection.
 * 	Pass:	si	= client handle
 * 		cx:dx	= IrlmpDataArgs
 * 	Return: carry clear if okay:
 *			ax	= IE_SUCCESS
 *		carry set if error:
 *			ax	= IrlmpError
 */

IrlmpError
_pascal TTPStatusRequest (ClientHandle client);
/*
 * 	Desc:	Check for unacked data
 * 	Pass:	si	= client handle
 *	Return:	carry clear if okay:
 *			ax	= IE_SUCCESS
 *		carry set if error:
 *			ax	= IrlmpError
 *
 * 	Return:
 */

void
_pascal TTPAdvanceCredit (ClientHandle client, word credits);
/*
 * 	Desc:	Increase available credit to advance to peer
 * 	Pass:	si	= client handle
 * 		cx	= # credits
 * 	Return:	nothing
 */

/* -------------------------------------------------------------------------
 *
 * 	 			Routines
 *
 * -------------------------------------------------------------------------*/

IrlmpError
_pascal IrlmpRegister (IrlmpLsapSel *lsapSel, word extraData,
              PCB(void, callback, (ClientHandle client,
                       IrlmpIndicationOrConfirmation type,
                       word extra,
                       dword data,
                       word status)),
              ClientHandle *clientHandle);
/*
 * 	Desc:	Client must call this function before any IrLMP requests,
 * 		so that indications and confirmations can be delivered.
 * 		A geode that uses the IrLMP Library can call this function
 * 		multiple times, if it is interested in registering for
 * 		more than one LSAP-Sel.
 *
 * 	Pass:	cl	= IrlmpLsapSel (could be IRLMP_ANY_LSAP_SEL)
 * 		dx:ax	= vfptr of callback for indications and confirmations
 * 		bx	= extra word to be passed to callback (could be
 * 			  caller's dgroup, process handle, or whatever is
 * 			  useful.)
 *
 * 	Return: carry clear if okay:
 * 			ax	= IE_SUCCESS
 * 			cl	= IrlmpLsapSel (actual LSAP-Sel, if
 * 				  IRLMP_ANY_LSAP_SEL was passed in.)
 * 			si	= client handle
 * 		carry set if error:
 * 			ax	= IrlmpError
 * 					IE_NO_FREE_LSAP_SEL
 * 					IE_UNABLE_TO_LOAD_IRLAP_DRIVER
 * 			cx, si destroyed
 * 	Callback:
 * 		Pass:	 di	= IrlmpIndicationOrConfirmation
 * 			 si	= client handle
 * 			 bx	= extra word passed to IrlmpRegister
 * 			 Other registers depend on di
 * 		Return:	 nothing
 * 		Destroy: nothing
 */

void
_pascal IrlmpUnregister (ClientHandle client);
/*
 * 	Desc:	Stop receiving callbacks for the LSAP-Sel.  This routine
 * 		may be called from the client's callback routine; however,
 * 		afterwards arguments passed to the callback become invalid.
 *
 * 	Pass:	si	= client handle
 * 	Return: carry clear if okay:
 *			ax	= IE_SUCCESS
 *		carry set if error:
 *			ax 	= IE_LSAP_NOT_DISCONNECTED
 *
 */

IrlmpError
_pascal IrlmpDiscoverDevicesRequest (ClientHandle client, word timeSlot);
/*
 * 	Desc:	Look for remote machines.  If link is currently in use, the
 * 		cached result of the last discovery operation is returned.
 * 		Otherwise, initiate IrLAP discovery. The callback is to
 * 		receive the confirmation for the discovery request.
 *
 * 	Pass:	si	= client handle, bound to IRLMP_XID_DISCOVERY_SAP
 * 		bl	= IrlapUserTimeSlot
 * 	Return: carry clear:
 * 		ax	= IE_SUCCESS
 */

IrlmpError
_pascal IrlmpConnectRequest (ClientHandle client, IrlmpConnectArgs1 *connectArgs);
/*
 * 	Desc:	Request that a connection be established to a remote
 * 		LSAP-ID.
 * 	Pass:	si	= client handle
 * 		cx:dx	= IrlmpConnectArgs.  Up to 60 bytes of data
 * 			may be transmitted along with the request.
 *
 * 	Return: carry clear if okay:
 * 			ax	= IE_SUCCESS
 * 		carry set if error:
 * 			ax	= IrlmpError
 * 					IE_ALREADY_CONNECTED
 */

IrlmpError
_pascal IrlmpConnectResponse (ClientHandle client, IrlmpDataArgs *dataArgs);
/*
 * 	Desc:	Accept a connection initiated by a remote device.
 * 		To reject a connection, use IrlmpDisconnectRequest.
 * 	Pass:	si	= client handle
 * 		cx:dx	= IrlmpDataArgs.
 *
 * 	Return: carry clear if okay:
 * 			ax	= IE_SUCCESS
 * 		carry set if error:
 * 			ax	= IrlmpError
 * 					IE_LSAP_DISCONNECTED
 */

IrlmpError
_pascal IrlmpDisconnectRequest (ClientHandle client, IrlmpDataArgs *dataArgs,
                   word reason);
/*
 * 	Desc:	Terminate a connection.
 * 	Pass:	si	= client handle
 * 		cx:dx	= IrlmpDataArgs.  There is no guarantee
 * 			  that the data will be delivered.
 * 		bl	= IrlmpDisconnectReason
 * 	Return: carry clear if okay:
 * 			ax	= IE_SUCCESS
 * 		carry set if error:
 * 			ax	= IrlmpError
 * 					IE_LSAP_DISCONNECTED
 */

IrlmpError
_pascal IrlmpStatusRequest (ClientHandle client);
/*
 * 	Desc:	Check if there is unacknowledged data in the IrLAP queue.
 * 	Pass:	si	= client handle
 * 	Return: carry clear if okay:
 * 			ax	= IE_SUCCESS
 * 		carry set if error:
 * 			ax	= IrlmpError
 * 					IE_LSAP_DISCONNECTED
 */

IrlmpError
_pascal IrlmpDataRequest (ClientHandle client, IrlmpDataArgs *dataArgs);
/*
 * 	Desc:	Send data through the connection.
 * 	Pass:	si	= client handle
 * 		cx:dx	= IrlmpDataArgs.  IDA_dataSize must not be larger than
 * 			(ICA_QoS.QOS_param.ICP_dataSize - IRLMP_HEADER_SIZE).
 * 	Return: carry clear if okay:
 * 			ax	= IE_SUCCESS
 * 		carry set if error:
 * 			ax	= IrlmpError
 * 					IE_LSAP_DISCONNECTED
 */

IrlmpError
_pascal IrlmpUDataRequest (ClientHandle client, IrlmpDataArgs *dataArgs);
/*
 * 	Desc: 	Send UI frame data.
 * 	Pass:	si	= client handle
 * 		cx:dx	= IrlmpDataArgs
 * 	Return: carry clear if okay:
 * 			ax	= IE_SUCCESS
 * 		carry set if error:
 * 			ax	= IrlmpError
 * 					IE_LSAP_DISCONNECTED
 */

word
_pascal IrlmpGetPacketSize (IrlapParamDataSize dataSize);
/*
 * 	Desc:	Converts IrlapParamDataSize to number of bytes
 * 	Pass:	ax	= IrlapParamDataSize
 * 	Return:	cx	= data size
 */

/* ------------------------------------------------------------------------------
 *
 * 			IAS Requests
 *
 * ------------------------------------------------------------------------------*/

IrlmpError
_pascal IrlmpDisconnectIas (ClientHandle client);
/*
 * 	Desc:	Terminate the IrLMP-level IAS connection to the remote peer.
 * 		The first IAS request to a remote peer implicity establishes
 * 		an IrLMP connection to the IRLMP_IAS_LSAP_SEL of the peer.
 *  		This connection is not automatically broken after the IAS
 * 		query is completed, because almost always the first IAS query
 *  		is followed by other IAS queries or an IrlmpConnectRequest.
 * 		This way the time-consuming step of terminating and
 * 		re-establishing the same IrLAP connection is avoided.  What
 * 		this all means is that the entity that performs an IAS query
 * 		is required to call IrlmpDisconnectIas in order to sign-off
 * 		from IAS.  This should preferrably be done *after* receiving
 * 		an IIC_CONNECT_CONFIRMATION, ensuring that at all times there
 * 		exists an IrLMP connection, and avoiding disconnecting and
 * 		reconnecting the IrLAP layer.
 *
 * 	Pass:	si	= client handle
 * 	Return: carry clear if okay:
 * 			ax	= IE_SUCCESS
 * 		carry set if error:
 * 			ax	= IrlmpError
 */

IrlmpError
_pascal IrlmpGetValueByClassRequest (ClientHandle client,
                    IrlmpGetValueByClassRequestArgs *dataArgs);
/*
 *  	Desc:	Get all the values of a named attribute in objects of a
 * 		given class name.
 * 	Pass:	si	= client handle
 * 		cx:dx	= IrlmpGetValueByClassRequestArgs
 *
 * 	Return: carry clear if okay:
 * 			ax	= IE_SUCCESS
 * 		carry set if error:
 * 			ax	= IrlmpError
 */

/* ----------------------------------------------------------------------
 *
 *  		TinyTP Indications and Confirmations
 *
 * ----------------------------------------------------------------------*/

/* enum TinyTPIndicationOrConfirmation */
typedef enum {		/* CHECKME */

    TTPIC_CONNECT_INDICATION     = IIC_LAST_VALUE + 2,

    TTPIC_CONNECT_CONFIRMATION     = IIC_LAST_VALUE + 4,
/*
 *  TinyTP connection request was accepted.
 *
 * 	Pass:		si	= client handle
 * 			bx	= extra word passed to IrlmpRegister
 * 			cx:dx	= IrlmpConnectArgs.  If ICA_dataSize > 0, then
 * 				  callback must free the ICA_data.
 * 				  Note that ICA_QoS.QOS_param.ICP_dataSize
 * 				  provides the maximum data size for the
 * 				  IrLAP layer.  The client's maximum data
 * 				  size is this value minus TTP_HEADER_SIZE.
 * 	Return:		nothing
 * 	Destroy:	nothing
 */

    TTPIC_DISCONNECT_INDICATION     = IIC_LAST_VALUE + 6,
    TTPIC_DATA_INDICATION     = IIC_LAST_VALUE + 8,
    TTPIC_STATUS_CONFIRMATION     = IIC_LAST_VALUE + 10,
} TinyTPIndicationOrConfirmation} ;

/* ----------------------------------------------------------------------
 *
 *  			Ias Database
 *
 * ----------------------------------------------------------------------*/

typedef ByteFlags IrdbCreateEntryFlags ;		/* CHECKME */

#define ICEF_PERMANENT 	(0x80)
/* 7 bits unused */

typedef enum {
    IET_OK			= 0,
    IET_OPEN_ERROR		= 2,
    IET_SHARE		= 4,
    IET_DISK_FULL		= 6,
    IET_MEM_ERROR		= 8,
        IET_NOT_FOUND           = 10,
} IrdbErrorType} ;

/*  ------------------------------------------------- */
sword
_pascal	IrdbOpenDatabase	();
/*  -------------------------------------------------
 *  Open the database so we can read/write information to it.
 *  Multiple clients can read/write to the database,
 *  This routine will block the thread if another is doing
 *  an access.
 *
 *  PASS:		nothing
 *  RETURN:	IrdbErrorType
 *  DESTROYED:	nothing
 */

/*  ------------------------------------------------- */
sword
_pascal IrdbCloseDatabase ();
/*  -------------------------------------------------
 *  Finished with the database.  Close it up.
 *
 *  PASS:		nothing
 *  RETURN:	IrdbErrorType
 *  DESTROYED:	nothing
 */

/*  ------------------------------------------------- */
sword
_pascal IrdbCreateEntry (char *classname, word length,
            word clientHandle, word flags);
/*  -------------------------------------------------
 *  Add an entry to the database.  The information needed
 *  to establish an entry is a class name.
 *  You can also pass in an lptr to an endpoint.  This will
 *  enable irlmp to delete your entry.  If you do not want this
 *  feature, then pass zero.
 *
 *  PASS:	class name
 * 		class name string length (0 for null terminated)
 * 		irlmp client handle (or 0)
 * 		IrdbCreateEntryFlags
 *  RETURN:	if successful
 * 			Object ID
 * 		if error,
 * 			-1.  Use ThreadGetError() to retrieve the
 *                              IrdbErrorType
 *
 *  DESTORYED:	nothing
 */

/*  ------------------------------------------------- */
sword
_pascal IrdbDeleteEntry (word objectID);
/*  -------------------------------------------------
 *  Delete an entry in the database.  Give only
 *  the object id that was returned in the
 *  IrdbCreateEntry function.
 *
 *  PASS:	Object ID to delete
 *
 *  RETURN:	IrdbErrorType
 *
 *  DESTORYED:	nothing
 */

/*  ------------------------------------------------- */
sword
_pascal IrdbAddAttribute (word objectID, char *attrName, word attrNameSize,
            word dataType, void *data, word dataLegth);

/*  -------------------------------------------------
 *  Add an attribute for an object.
 *  Note this keeps attributes like an array.  You
 *  are appending an attribute to the end of the list.
 *
 *  PASS:	Object ID to add attributes to
 *  		string containing attribute name
 * 		attribute name size (0 for null terminated)
 *              IrlmpIasValueType
 * 			if IIVT_MISSING
 * 				invalid
 * 			if IIVT_INTEGER
 * 				data = dword integer
 * 			if IIVT_OCTET_SEQUENCE
 * 				data = pointer to octet sequence
 * 				dataLength   	= length of sequence
 * 			if IIVT_USER_STRING
 * 				dataLength.low	= length of sequence
 * 				dataLength.high	= charset (0 is ascii)
 * 				data	= fptr to user string
 *
 *  RETURN:	Current number of attributes in the object.
 *              if 0, an error occurred.  Use ThreadGetError() to return
 *              the IrdbErrorType
 */

#if __HIGHC__

pragma Alias(IrlmpRegister, "IRLMPREGISTER");
pragma Alias(IrlmpUnregister, "IRLMPUNREGISTER");
pragma Alias(IrlmpDiscoverDevicesRequest, "IRLMPDISCOVERDEVICESREQUEST");
pragma Alias(IrlmpConnectRequest, "IRLMPCONNECTREQUEST");
pragma Alias(IrlmpConnectResponse, "IRLMPCONNECTRESPONSE");
pragma Alias(IrlmpDisconnectRequest, "IRLMPDISCONNECTREQUEST");
pragma Alias(IrlmpStatusRequest, "IRLMPSTATUSREQUEST");
pragma Alias(IrlmpDataRequest, "IRLMPDATAREQUEST");
pragma Alias(IrlmpUDataRequest, "IRLMPUDATAREQUEST");
pragma Alias(IrlmpGetPacketSize, "IRLMPGETPACKETSIZE");
pragma Alias(IrlmpDisconnectIas, "IRLMPDISCONNECTIAS");
pragma Alias(IrlmpGetValueByClassRequest, "IRLMPGETVALUEBYCLASSREQUEST");

pragma	Alias(IrdbOpenDatabase, "IRDBOPENDATABASE");
pragma	Alias(IrdbCloseDatabase, "IRDBCLOSEDATABASE");
pragma	Alias(IrdbCreateEntry, "IRDBCREATEENTRY");
pragma	Alias(IrdbDeleteEntry, "IRDBDELETEENTRY");
pragma	Alias(IrdbAddAttribute, "IRDBADDATTRIBUTE");

pragma	Alias(TTPRegister, "TTPREGISTER");
pragma	Alias(TTPUnregister, "TTPUNREGISTER");
pragma	Alias(TTPConnectRequest, "TTPCONNECTREQUEST");
pragma	Alias(TTPConnectResponse, "TTPCONNECTRESPONSE");
pragma	Alias(TTPDataRequest, "TTPDATAREQUEST");
pragma	Alias(TTPTxQueueGetFreeCount, "TTPTXQUEUEGETFREECOUNT");
pragma	Alias(TTPDisconnectRequest, "TTPDISCONNECTREQUEST");
pragma	Alias(TTPStatusRequest, "TTPSTATUSREQUEST");
pragma	Alias(TTPAdvanceCredit, "TTPADVANCECREDIT");

#endif

#endif /* _IRLMP_H */


Internal\Resp\irtrAPI.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1998.  All rights reserved.
    GEOWORKS CONFIDENTIAL

PROJECT:	GEOS
MODULE:		IR Transmit/Receive library(s)
FILE:		irtrAPI.goh

AUTHOR:		Chris Thomas, Feb 04, 1998

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name		Date		Description
    ----		----		-----------
    cthomas 	2/04/98   	Initial version.

DESCRIPTION:

        irtrAPI = IR Transmit/Receive API

    This defines the API of libraries that implement Infra-red
        protocols which replace or compliment the IrOBEX protocol for
        sending and receiving messages.

        For an sample implementation of such a library, see
        Library/SDK_C/IRTR.

        Since these libraries are intended to be used within the same
        framework as the OBEX library, you'll find the API to be
        similar.

        The routines that implement the prototypes defined in this
        header file must be exported from the library (the 'export'
        lines in the .gp file) in EXACTLY the same order that they
        are listed here (see the sample library).

        In order for a library to be used during IR send and receive,
        it must simplly be placed in the SYSTEM\IRTR directory.

    $Id: irtrAPI.goh,v 1.1.1.1 98/02/11 15:18:28 cthomas Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@ifndef _irtr_api_goh_
@define _irtr_api_goh_

/*
 * irtrAPI is defined in terms of the API of the OBEX library
 * and Transport drivers
 */
@include  <obex.goh>            /* OBEXRequestInfo */
#include  <Mailbox/obextd.h>    /* ObexTDMailboxTransAddr */
#include  <Mailbox/filedd.h>    /* FileDDAppRef */

/***********************************************************************

                       Transmit API

These functions are used by the Mailbox OBEX transport driver
to send a message.

If your library does not implment the transmission functions of this
API, the library's .gp file must contain 'skip 1' directives
where the 'export' for each function would be (or a 'skip 4' in
place of all the export lines).

************************************************************************/

extern Boolean _cdecl
IRTransmitInit(ObexTDMailboxTransAddr *transAddr);
/*
 *  Prepares a connection for sending a message using the
 *  protocol implemented by the library.  This routine
 *  may also decide that it does not want to send this message,
 *  based on factors such as:
 *
 *      - type of the message to be sent
 *      - availability of correct protocol on receiving end
 *
 *  Note: OBEX will get the first chance to send the message.
 *        This routine will only be called if the Obex transport
 *        driver could not initiate an OBEX connection.
 *
 * PASS: transAddr = The Obex transport address of the message
 *                   to be sent.
 *
 * RETURN: TRUE if the library should send the message,
 *         FALSE to let OBEX send the message.
 *
 */

extern Boolean _cdecl
IRTransmitSend(ObexTDMailboxTransAddr *transAddr,
               FileDDAppRef *appRef);
/*
 *  Sends the message over the connection initially
 *  created by IRTransmitInit.  The routine should not
 *  return until the message has completed being sent,
 *  or failed.
 *
 * PASS: transAddr = The Obex transport address of the message
 *                   to be sent.
 *       appRef = The file containing the message to be sent.
 *
 * RETURN: TRUE if the send succeeded.
 *
 */

extern void _cdecl
IRTransmitCancel(void);
/*
 *  Cancels a message currently being sent with IRTransmitSend,
 *  if the library supports it.
 *
 * PASS: nothing
 *
 * RETURN: nothing
 *
 */

extern void _cdecl
IRTransmitExit(void);
/*
 *  Closes the connection created by IRTransmitSend.
 *
 * PASS: nothing
 *
 * RETURN: nothing
 *
 */

/***********************************************************************

                       Receive API

These functions are called from the OBEX receive application to allow
messages to be received.

If your library does not implment the receive functions of this
API, the library's .gp file must contain 'skip 1' directives
where the 'export' for each function would be (or a 'skip 3' in
place of all the export lines).

************************************************************************/

extern Boolean _cdecl
IRReceiveInit(word token,
              optr notifyObject,
              Message recvStartMsg,
              Message recvMsg,
              Message stoppedMsg);
/*
 * Initializes the library for accepting & receiving
 * messages.
 *
 * PASS: token        = A value that should be passed back in the
 *                      notification messages.  Used by the notifyObject
 *                      to identify the library sending the message.
 *
 *       notifyObject = the object which should be sent the receive
 *                      notification messages (this is the OBEX receive
 *                      application)
 *
 *       recvStartMsg = the Message to send to notifyObject when
 *                      a message starts to be received.
 *                      This message should follow the IRTR_RECV_START_MSG
 *                      prototype defined below.
 *
 *       recvMsg      = the message to send to notifyObject when
 *                      a message has finished being received.
 *                      This message should follow the IRTR_RECV_MSG
 *                      prototype defined below.
 *
 *       stoppedMsg   = the message to send to notifyObject when
 *                      the receiver started with IRReceiveInit
 *                      shuts down, either in response to a call
 *                      to IRReceiveExit, or because the receiver
 *                      shut itself down (because of a timeout,
 *                      or other circumstance).
 *                      This message should follow the IRTR_STOPPED_MSG
 *                      prototype defined below.
 *
 * RETURN: TRUE if receiver initialized successfully.
 */

@prototype void IRTR_RECV_START_MSG (word token = cx,
                                    MemHandle who = dx);
/*
 *  Sent by the library when a message starts being received.
 *  The notifyObject responds by putting up a dialog:
 *  "Receiving data from xxx".
 *
 * PASS: token = the value that was passed to IRReceiveInit
 *       who = A memory block containing a null-terminated
 *             string to use for 'xxx', in the note above.
 *             The notifyObject will free this block.
 *             If 'who' is NullHandle, then a generic note
 *             like "Receiving data..." will be displayed instead.
 */

@prototype void IRTR_RECV_MSG (word token = cx,
                              MemHandle info  = dx,
                              Boolean success = bp);
/*
 *  Sent by the library when the entire message has been
 *  received.
 *  The notifyObject will hide the 'receiving data' note.
 *
 * PASS: token = the value that was passed to IRReceiveInit
 *     success = TRUE if the message was successfuly received.
 *               If it wasn't successful, the notifyObject
 *               will display an error note.  If FALSE, info parameter
 *               is ignored.
 *
 *     info    = If this is not NullHandle,
 *               then it is a memory block containing an OBEXRequestInfo
 *               structure.  The notifyObject will process
 *               the message in exactly the same way it would as if
 *               the message had been receivied from the OBEX server
 *               (i.e., delivered to particular apps via the INBOX,
 *                or deposited in Downloaded Files)
 */

@prototype void IRTR_STOPPED_MSG (word token = cx);
/*
 *  Sent by the library when the receive server has shut down,
 *  either because the library shut itself down in response to some
 *  event, or because IRReceiveExit was called.
 *
 * PASS: token = the value that was passed to IRReceiveInit
 */

extern void _cdecl
IRReceiveCancel(void);
/*
 *  Cancels any message that is in the process of being received,
 *  if the library supports cancelling.  If the library has sent
 *  the IRTR_RECV_START_MSG to notifyObject, it should send
 *  the IRTR_RECV_MSG (with success = FALSE), if it hasn't already.
 *
 *  NOTE: because the library receiver and the OBEX receive application
 *  are not perfectly synchronized, the library should be able to
 *  handle this call even when there is no message being received.
 *
 */

extern void _cdecl
IRReceiveExit(void);
/*
 *  Shuts down the receiver, preventing it from receiving any more
 *  messages.  After this call returns, it is not valid to reference
 *  the notifyObject passed in IRReceiveInit().
 *
 *  NOTE: because the library receiver and the OBEX receive application
 *  are not perfectly synchronized, the library should be able to
 *  handle this call even when there is a message being received,
 *  or after the library receiver has already shut down.
 */

/*
 *  Library Entry point indicies, of the above functions
 */
typedef enum {
    IRTRE_TRANSMIT_INIT     = 0,
    IRTRE_TRANSMIT_SEND    ,
    IRTRE_TRANSMIT_CANCEL    ,
    IRTRE_TRANSMIT_EXIT    ,
    IRTRE_RECEIVE_INIT    ,
    IRTRE_RECEIVE_CANCEL    ,
    IRTRE_RECEIVE_EXIT
} IRTREntry} ;

@endif /* _irtr_api_goh_ */


library.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	library.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines library structures and routines.
 *
 *	$Id: library.h,v 1.14.26.1 96/04/28 08:27:42 chris Exp $
 *
 ***********************************************************************/

#ifndef	__LIBRARY_H
#define __LIBRARY_H

#include  <geode.h>

/***/

extern GeodeHandle			/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal GeodeUseLibrary (const char *name, word protoMajor, word protoMinor,
                        GeodeLoadError	*err);

/***/

extern void	/*XXX*/
    _pascal GeodeFreeLibrary (GeodeHandle gh);

/***/

typedef enum /* word */ {
    LCT_ATTACH    ,
    LCT_DETACH    ,
    LCT_NEW_CLIENT    ,
    LCT_NEW_CLIENT_THREAD    ,
    LCT_CLIENT_THREAD_EXIT    ,
    LCT_CLIENT_EXIT    ,
} LibraryCallType} ;

/*
 *	Library entry point prototype:
 *
 *       extern Boolean		* TRUE if error *
 *	    _pascal LibraryEntry(LibraryCallType ty, GeodeHandle client);
 */

#ifdef __HIGHC__
pragma Alias(GeodeUseLibrary, "GEODEUSELIBRARY");
pragma Alias(GeodeFreeLibrary, "GEODEFREELIBRARY");
#endif

#endif


lmem.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	lmem.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines local memory structures and routines.
 *
 *	$Id: lmem.h,v 1.24.26.1 96/04/28 08:29:49 chris Exp $
 *
 ***********************************************************************/

#ifndef	__LMEM_H
#define __LMEM_H

/*
 *	Definitions for local memory block structures
 */

/* Types of local memory blocks */

typedef enum /* word */ {
    LMEM_TYPE_GENERAL    ,
    LMEM_TYPE_WINDOW    ,
    LMEM_TYPE_OBJ_BLOCK    ,
    LMEM_TYPE_GSTATE    ,
    LMEM_TYPE_FONT_BLK    ,
    LMEM_TYPE_GSTRING    ,
    LMEM_TYPE_DB_ITEMS
} LMemType} ;

/* Flags for a local memory block */

typedef WordFlags LocalMemoryFlags ;
#define LMF_HAS_FLAGS 		0x8000
#define LMF_IN_RESOURCE 		0x4000
#define LMF_DETACHABLE 		0x2000
#define LMF_DUPLICATED 		0x1000
#define LMF_RELOCATED 		0x0800
#define LMF_AUTO_FREE 		0x0400
#define LMF_IN_LMEM_ALLOC 	0x0200
#define LMF_IS_VM 		0x0100
#define LMF_NO_HANDLES 		0x0080
#define LMF_NO_ENLARGE 		0x0040
#define LMF_RETURN_ERRORS 	0x0020
#define LMF_DEATH_COUNT 		0x0007

/* Structure at the beginning of every local-memory block. */

typedef struct {
    MemHandle		LMBH_handle;
    word		LMBH_offset;
    LocalMemoryFlags	LMBH_flags;
    LMemType		LMBH_lmemType;
    word		LMBH_blockSize;
    word		LMBH_nHandles;
    word		LMBH_freeList;
    word		LMBH_totalFree;
} LMemBlockHeader} ;

/*
 * Constants and structures passed to local memory routines
 */

/* Standard values to pass to LMemInitHeap */

#define STD_INIT_HEAP 		256
#define STD_INIT_HANDLES 	16
#define STD_LMEM_OBJECT_FLAGS    (LMF_HAS_FLAGS | LMF_RELOCATED)

/***/

extern ChunkHandle	/*XXX*/
    _pascal LMemAlloc (MemHandle mh, word chunkSize);

/***/

extern MemHandle
    _pascal MemAllocLMem (LMemType type, word headerSize);

/***/

extern void
    _pascal LMemInitHeap (MemHandle mh,
         LMemType type,
         LocalMemoryFlags flags,
         word lmemOffset,
         word numHandles,
         word freeSpace);

/***/

extern void *
    _pascal LMemDeref (optr o);

#define LMemDerefHandles (mh, ch) \
    LMemDeref(ConstructOptr(mh, ch))

/***/

extern void	/*XXX*/
    _pascal LMemFree (optr o);

#define LMemFreeHandles (mh, ch) \
    LMemFree(ConstructOptr(mh, ch))

/***/

extern Boolean	/*XXX*/
    _pascal LMemReAlloc (optr o, word chunkSize);

#define LMemReAllocHandles (mh, ch, sz) \
    LMemReAlloc(ConstructOptr(mh, ch), sz)

/***/

extern Boolean	/*XXX*/
    _pascal LMemInsertAt (optr o, word insertOffset, word insertCount);

#define LMemInsertAtHandles (mh, ch, io, ic) \
    LMemInsertAt(ConstructOptr(mh, ch), io, ic)

/***/

extern void	/*XXX*/
    _pascal LMemDeleteAt (optr o, word deleteOffset, word deleteCount);

#define LMemDeleteAtHandles (mh, ch, do, dc) \
    LMemDeleteAt(ConstructOptr(mh, ch), do, dc)

/***/

extern void	/*XXX*/
    _pascal LMemContract (MemHandle mh);

/***/

extern word	/*XXX*/
    _pascal LMemGetChunkSize (optr o);

#define LMemGetChunkSizeHandles (mh, ch) \
    LMemGetChunkSize(ConstructOptr(mh, ch))

/*
 *	Macros for local memory chunks
 */

/* Offset from a pointer to a chunk to the size of that chunk. */
/* THIS SHOULD ONLY BE USED IN EXCEPTIONAL CIRCUMSTANCES. */

#define LMC_size 	(-2)

#define LMemGetChunkSizePtr (ptr) ((word) (*(((word *)ptr)-1)-2))

#ifdef __HIGHC__
pragma Alias(MemAllocLMem, "MEMALLOCLMEM");
pragma Alias(LMemInitHeap, "LMEMINITHEAP");
pragma Alias(LMemAlloc, "LMEMALLOC");
pragma Alias(LMemDeref, "LMEMDEREF");
pragma Alias(LMemFree, "LMEMFREE");
pragma Alias(LMemReAlloc, "LMEMREALLOC");
pragma Alias(LMemInsertAt, "LMEMINSERTAT");
pragma Alias(LMemDeleteAt, "LMEMDELETEAT");
pragma Alias(LMemContract, "LMEMCONTRACT");
pragma Alias(LMemGetChunkSize, "LMEMGETCHUNKSIZE");
#endif

#endif


localize.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	localize.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines localization structures and routines.
 *
 *	$Id: localize.h,v 1.42.1.5 98/06/29 17:32:15 kho Exp $
 *
 ***********************************************************************/

#ifndef	__LOCALIZE_H
#define __LOCALIZE_H

#include  <Ansi/ctype.h>
#include  <timedate.h> 		/* TimerDateAndTime */
#include  <file.h>    	    	/* FileDateAndTime */
#include  <sllang.h>

/*
 *	Country codes
 */

typedef enum /* word */ {
    CT_UNITED_STATES    =1,
    CT_CANADA    ,
    CT_UNITED_KINGDOM    ,
    CT_GERMANY    ,
    CT_FRANCE    ,
    CT_SPAIN    ,
    CT_ITALY    ,
    CT_DENMARK    ,
    CT_NETHERLANDS    ,
} CountryType} ;

/* Minimum mappable character (for use with DosCodePage) */

#define MIN_MAP_CHAR  0x80

#define CURRENCY_SYMBOL_LENGTH  	9

/* number formats */

typedef ByteFlags NumberFormatFlags ;
#define NFF_LEADING_ZERO 	0x01

/* currency formats */

typedef ByteFlags CurrencyFormatFlags ;
#define CFF_LEADING_ZERO 		0x20
#define CFF_SPACE_AROUND_SYMBOL 		0x10
#define CFF_USE_NEGATIVE_SIGN 		0x08
#define CFF_SYMBOL_BEFORE_NUMBER 	0x04
#define CFF_NEGATIVE_SIGN_BEFORE_NUMBER 	0x02
#define CFF_NEGATIVE_SIGN_BEFORE_SYMBOL 	0x01

/* measurement system */

typedef ByteEnum MeasurementType ;
#define MEASURE_US  0
#define MEASURE_METRIC  1

typedef ByteEnum DistanceUnit ;
#define DU_POINTS  0
#define DU_INCHES  1
#define DU_CENTIMETERS  2
#define DU_MILLIMETERS  3
#define DU_PICAS  4
#define DU_EUR_POINTS  5
#define DU_CICEROS  6
#define DU_POINTS_OR_MILLIMETERS  7
#define DU_INCHES_OR_CENTIMETERS  8

#define LOCAL_DISTANCE_BUFFER_SIZE  32

typedef WordFlags LocalDistanceFlags ;
#define LDF_FULL_NAMES 	    	    0x8000
#define LDF_PRINT_PLURAL_IF_NEEDED   0x4000

/***/

extern word	/* XXX */
    _pascal LocalDistanceToAscii (char *buffer, WWFixedAsDWord value,
                 DistanceUnit distanceUnits,
                 word measurementType,
                 LocalDistanceFlags flags);

/***/

extern WWFixedAsDWord	/* XXX */
    _pascal LocalDistanceFromAscii (const char *buffer, DistanceUnit distanceUnits,
               MeasurementType measurementType);

/***/

extern void	/* XXX */
    _pascal LocalFixedToAscii (char *buffer, WWFixedAsDWord value, word fracDigits);

/***/

extern WWFixedAsDWord	/* XXX */
    _pascal LocalAsciiToFixed (const char *buffer, char **parseEnd);

/* keyboard map types */

typedef enum /* word */ {
    KEYMAP_US_EXTD    =1,
    KEYMAP_US    ,
    KEYMAP_UK_EXTD    ,
    KEYMAP_UK    ,
    KEYMAP_GERMANY_EXTD    ,
    KEYMAP_GERMANY    ,
    KEYMAP_SPAIN_EXTD    ,
    KEYMAP_SPAIN    ,
    KEYMAP_DENMARK_EXTD    ,
    KEYMAP_DENMARK    ,
    KEYMAP_BELGIUM_EXTD    ,
    KEYMAP_BELGIUM    ,
    KEYMAP_CANADA_EXTD    ,
    KEYMAP_CANADA    ,
    KEYMAP_ITALY_EXTD    ,
    KEYMAP_ITALY    ,
    KEYMAP_LATIN_AMERICA_EXTD    ,
    KEYMAP_LATIN_AMERICA    ,
    KEYMAP_NETHERLANDS    ,
    KEYMAP_NETHERLANDS_EXTD    ,
    KEYMAP_NORWAY_EXTD    ,
    KEYMAP_NORWAY    ,
    KEYMAP_PORTUGAL_EXTD    ,
    KEYMAP_PORTUGAL    ,
    KEYMAP_SWEDEN_EXTD    ,
    KEYMAP_SWEDEN    ,
    KEYMAP_SWISS_FRENCH_EXTD    ,
    KEYMAP_SWISS_FRENCH    ,
    KEYMAP_SWISS_GERMAN_EXTD    ,
    KEYMAP_SWISS_GERMAN    ,
    KEYMAP_FRANCE_EXTD    ,
    KEYMAP_FRANCE    ,
} KeyMapType} ;

typedef ByteEnum KeyboardType ;
#define KT_NOT_EXTD    1
#define KT_EXTD  2
#define KT_BOTH  3

/* DOS code pages */

typedef enum /* word */ {
    CODE_PAGE_US    =437,
    CODE_PAGE_LATIN_1    =819,
    /* For Thai GEOS: Note the remark below
       CODE_PAGE_REAL_LATIN_1_IN_THAI_GEOS. */
    CODE_PAGE_MULTILINGUAL    =850,
    CODE_PAGE_PORTUGUESE    =860,
    CODE_PAGE_CANADIAN_FRENCH    =863,
    CODE_PAGE_NORDIC    =865,
    CODE_PAGE_SJIS    =932,
    CODE_PAGE_THAI_IN_THAI_GEOS    =CODE_PAGE_LATIN_1,
    CODE_PAGE_REAL_LATIN_1_IN_THAI_GEOS    =10874,
    /* In Thai GEOS, CODE_PAGE_LATIN_1 is actually the code page of
       Thai Windows (windows-874). This is so that apps don't have
       to be changed / compiled in Thai GEOS to talk to Thai
       windows.

       If a Thai-aware app wants to convert to/from the real
       Windows Latin-1 (windows-819) code page, use
       CODE_PAGE_REAL_LATIN_1_IN_THAI_GEOS. (Available in Thai
       GEOS only.) */

    CODE_PAGE_NON_THAI_GEOS    =65529
    /* For normal GEOS to/from Thai GEOS conversion. Not a real DOS
       code page, obviously. */

} DosCodePage} ;

/* Date / Time formatting */

typedef enum /* word */ {
    DTF_LONG    ,
    DTF_LONG_CONDENSED    ,
    DTF_LONG_NO_WEEKDAY    ,
    DTF_LONG_NO_WEEKDAY_CONDENSED    ,
    DTF_SHORT    ,
    DTF_ZERO_PADDED_SHORT    ,
    DTF_MD_LONG    ,
    DTF_MD_LONG_NO_WEEKDAY    ,
    DTF_MD_SHORT    ,
    DTF_MY_LONG    ,
    DTF_MY_SHORT    ,
    DTF_YEAR    ,
    DTF_MONTH    ,
    DTF_DAY    ,
    DTF_WEEKDAY    ,
    DTF_HMS    ,
    DTF_HM    ,
    DTF_H    ,
    DTF_MS    ,
    DTF_HMS_24HOUR    ,
    DTF_HM_24HOUR    ,
} DateTimeFormat} ;

/* Low level formatting */

#define TOKEN_DELIMITER 		'|'

#define TOKEN_TOKEN_DELIMITER 	"DD"
                        /* Weekday tokens. */
#define TOKEN_LONG_WEEKDAY 	"LW"
#define TOKEN_SHORT_WEEKDAY 	"SW"
                        /* Month tokens. */
#define TOKEN_LONG_MONTH 	"LM"
#define TOKEN_SHORT_MONTH 	"SM"
#define TOKEN_NUMERIC_MONTH 	"NM"
#define TOKEN_ZERO_PADDED_MONTH 	"ZM"
#define TOKEN_SPACE_PADDED_MONTH  "PM"
                        /* Date tokens. */
#define TOKEN_LONG_DATE 		"LD"
#define TOKEN_SHORT_DATE 	"SD"
#define TOKEN_ZERO_PADDED_DATE 	"ZD"
#define TOKEN_SPACE_PADDED_DATE 	"PD"
                        /* Year tokens. */
#define TOKEN_LONG_YEAR 		"LY"
#define TOKEN_SHORT_YEAR 	"SY"
                        /* 12-Hour tokens. */
#define TOKEN_12HOUR 		  "HH"
#define TOKEN_ZERO_PADDED_12HOUR   "ZH"
#define TOKEN_SPACE_PADDED_12HOUR  "PH"
                        /* 24-Hour tokens. */
#define TOKEN_24HOUR 		  "hh"
#define TOKEN_ZERO_PADDED_24HOUR   "Zh"
#define TOKEN_SPACE_PADDED_24HOUR  "Ph"
                        /* Minute tokens. */
#define TOKEN_MINUTE 		  "mm"
#define TOKEN_ZERO_PADDED_MINUTE   "Zm"
#define TOKEN_SPACE_PADDED_MINUTE  "Pm"
                        /* Second tokens. */
#define TOKEN_SECOND 		  "ss"
#define TOKEN_ZERO_PADDED_SECOND   "Zs"
#define TOKEN_SPACE_PADDED_SECOND  "Ps"
                        /* AM/PM tokens. */
#define TOKEN_AM_PM 		"ap"
#define TOKEN_AM_PM_CAP 		"Ap"
#define TOKEN_AM_PM_ALL_CAPS 	"AP"

#ifdef DO_THAI
                        /* Buddhist Year tokens
                        (Thai). */
#define TOKEN_LONG_BUDDHIST_YEAR_THAI 	"LB"
#define TOKEN_SHORT_BUDDHIST_YEAR_THAI 	"SB"
#define THAI_BUDDHIST_YEAR_BASE 		(2540-1997)

#endif

/* Maximum sizes */

#define MAX_MONTH_LENGTH 	32
#define MAX_DAY_LENGTH 		12
#define MAX_YEAR_LENGTH 		12
#define MAX_WEEKDAY_LENGTH 	32
#define MAX_SEPARATOR_LENGTH 	8
#define TOKEN_LENGTH 		4

/* Minimum size for buffer for formatted date/time strings */

#define DATE_TIME_BUFFER_SIZE 	(MAX_MONTH_LENGTH \
            + MAX_DAY_LENGTH \
            + MAX_YEAR_LENGTH \
            + MAX_WEEKDAY_LENGTH \
            + MAX_SEPARATOR_LENGTH*5 \
            + 1 + 1) / 2 * 2

#define DATE_TIME_FORMAT_SIZE 	(TOKEN_LENGTH \
            + TOKEN_LENGTH \
            + TOKEN_LENGTH \
            + TOKEN_LENGTH \
            + (MAX_SEPARATOR_LENGTH*TOKEN_LENGTH*5) \
            + 1 + 1) / 2 * 2

/***/

extern void	/*XXX*/
    _pascal LocalSetDateTimeFormat (const char *str, DateTimeFormat format);

/***/

extern void	/*XXX*/
    _pascal LocalGetDateTimeFormat (char *str, DateTimeFormat format);

/***/

extern word	/*XXX*/
    _pascal LocalFormatDateTime (char *str, DateTimeFormat format,
            const TimerDateAndTime *dateTime);

/***/

extern word	/*XXX*/
    _pascal LocalFormatFileDateTime (char *str, DateTimeFormat format,
            const FileDateAndTime *dateTime);

/***/

extern Boolean	/*XXX*/
    _pascal LocalParseDateTime (const char *str, DateTimeFormat format,
               TimerDateAndTime *dateTime);

extern word	/*XXX*/
    _pascal LocalCustomParseDateTime (const char *str, const char *format,
               TimerDateAndTime *dateTime);

extern word	/*XXX*/
    _pascal LocalCalcDaysInMonth (word year, word month);

/***/

extern word
    _pascal ToUpper (wchar ch);

#define LocalUpcaseChar  ToUpper

/***/
extern word
    _pascal ToLower (wchar ch);

#define LocalDowncaseChar  ToLower

/***/

extern void	/*XXX*/
    _pascal LocalUpcaseString (char *str, word size);

/***/

extern void	/*XXX*/
    _pascal LocalDowncaseString (char *str, word size);

/***/

extern sword	/*XXX*/
    _pascal LocalCmpStrings (const char *str1, const char *str2, word strSize);

/***/

extern sword	/*XXX*/
    _pascal LocalCmpStringsNoCase (const char *str1, const char *str2, word strSize);

/***/

extern sword	/*XXX*/
    _pascal LocalCmpStringsNoSpace (const char *str1, const char *str2, word strSize);

/***/

extern sword	/*XXX*/
    _pascal LocalCmpStringsNoSpaceCase (const char *str1, const char *str2, word strSize);

/***/

extern Boolean	/*XXX*/
    _pascal LocalIsSymbol (wchar ch);

/***/

extern Boolean	/*XXX*/
    _pascal LocalIsDateChar (wchar ch);

/***/

extern Boolean	/*XXX*/
    _pascal LocalIsTimeChar (wchar ch);

/***/

extern Boolean	/*XXX*/
    _pascal LocalIsNumChar (wchar ch);

/***/

extern Boolean	/*XXX*/
    _pascal LocalIsDosChar (wchar ch);

/* LocalIs[*] macros for is[*] functions defined in Ansi/ctype.h */

#define LocalIsUpper (ch)  isupper((ch))
#define LocalIsLower (ch)  islower((ch))
#define LocalIsAlpha (ch)  isalpha((ch))
#define LocalIsPunct (ch)  ispunct((ch))
#define LocalIsSpace (ch)  isspace((ch))
#define LocalIsCntrl (ch)  iscntrl((ch))
#define LocalIsDigit (ch)  isdigit((ch))
#define LocalIsXDigit (ch) isxdigit((ch))
#define LocalIsPrint (ch)  isprint((ch))
#define LocalIsGraph (ch)  isgraph((ch))

/***/

extern Boolean	/*XXX*/
    _pascal LocalDosToGeos (char *str, word strSize, wchar defaultChar);

/***/

extern Boolean	/*XXX*/
    _pascal LocalGeosToDos (char *str, word strSize, wchar defaultChar);

/***/

typedef struct {
    wchar	frontSingle;
    wchar	endSingle;
    wchar	frontDouble;
    wchar	endDouble;
} LocalQuotes} ;

extern void	/*XXX*/
    _pascal LocalGetQuotes (LocalQuotes *quotes);

/***/

extern void	/*XXX*/
    _pascal LocalSetQuotes (const LocalQuotes *quotes);

/***/

extern word	/*XXX*/
    _pascal LocalCustomFormatDateTime (char *str, const char *format,
                  const TimerDateAndTime *dateTime);

/***/

typedef struct {
    byte	numberFormatFlags;
    byte	decimalDigits;
    wchar	thousandsSeparator;
    wchar	decimalSeparator;
    wchar	listSeparator;
} LocalNumericFormat} ;

extern void	/*XXX*/
    _pascal LocalGetNumericFormat (LocalNumericFormat *buf);

/***/

extern void	/*XXX*/
    _pascal LocalSetNumericFormat (const LocalNumericFormat *buf);

/***/

typedef struct {
    byte	currencyFormatFlags;
    byte	currencyDigits;
    wchar	thousandsSeparator;
    wchar	decimalSeparator;
    wchar	listSeparator;
} LocalCurrencyFormat} ;

extern void	/*XXX*/
    _pascal LocalGetCurrencyFormat (LocalCurrencyFormat *buf, char *symbol);

/***/

extern void	/*XXX*/
    _pascal LocalSetCurrencyFormat (const LocalCurrencyFormat *buf, const char *symbol);

/***/

typedef ByteFlags LocalCmpStringsDosToGeosFlags ;
#define LCSDTG_NO_CONVERT_STRING_2 	0x02
#define LCSDTGF_NO_CONVERT_STRING_1 	0x01

extern sword	/*XXX*/
    _pascal LocalCmpStringsDosToGeos (const char *str1, const char *str2, word strSize,
                 wchar defaultChar,
                 LocalCmpStringsDosToGeosFlags flags);

/***/

extern Boolean /*XXX*/
    _pascal LocalIsCodePageSupported (DosCodePage codePage);

extern Boolean	/*XXX*/
    _pascal LocalCodePageToGeos (char *str, word strSize, DosCodePage codePage,
            wchar defaultChar);

/***/

extern Boolean	/*XXX*/
    _pascal LocalGeosToCodePage (char *str, word strSize, DosCodePage codePage,
            wchar defaultChar);

/***/

extern wchar	/*XXX*/
    _pascal LocalCodePageToGeosChar (wchar ch, DosCodePage codePage, wchar defaultChar);

/***/

extern wchar	/*XXX*/
    _pascal LocalGeosToCodePageChar (wchar ch, DosCodePage codePage, wchar defaultChar);

/***/

extern wchar	/*XXX*/
    _pascal LocalDosToGeosChar (wchar ch, wchar defaultChar);

/***/

extern wchar	/*XXX*/
    _pascal LocalGeosToDosChar (wchar ch, wchar defaultChar);

/***/

extern DosCodePage	/*XXX*/
    _pascal LocalGetCodePage (void);

/***/

/*
 * SYNOPSIS:	Set the code page used by the system as the "DOS" code page.
 *
 * PASS:        DosCodePage dcp - code page number.
 *
 * RETURNS:     Handle - Handle of selected code page.  Zero if code page not
 *                       known.
 */
extern Handle
    _pascal LocalSetCodePage (DosCodePage dcp);

/***/

extern MeasurementType	/*XXX*/
    _pascal LocalGetMeasurementType (void);

/***/

extern void	/*XXX*/
    _pascal LocalSetMeasurementType (MeasurementType meas);

/***/

extern word	/*XXX*/
    _pascal LocalLexicalValue (wchar ch);

/***/

extern word	/*XXX*/
    _pascal LocalLexicalValueNoCase (wchar ch);

/***/

extern word	/*XXX*/
    _pascal LocalStringSize (const char *str);

/***/

extern word	/*XXX*/
    _pascal LocalStringLength (const char *str);

/***/

extern word	/* StandardLanguage */
    _pascal LocalGetLanguage (void);

/***/

#define GENGO_LONG_NAME_LENGTH 	8
#define GENGO_SHORT_NAME_LENGTH 	4

/***/

extern Boolean
    _pascal LocalAddGengoName (const char *longGengo, const char *shortGengo,
                word year, word month, word day);

/***/

extern Boolean
    _pascal LocalRemoveGengoName (word year, word month, word day,
                    word *errorType);

/***/

typedef struct {
    word	year;
    byte	month;
    byte	date;
    wchar	longName[GENGO_LONG_NAME_LENGTH+1];
    wchar	shortName[GENGO_SHORT_NAME_LENGTH+1];
} GengoNameData} ;

extern Boolean	/*XXX*/
    _pascal LocalGetGengoInfo (word entryNum, GengoNameData *gengoInfo);

#ifdef __HIGHC__
pragma Alias(LocalSetDateTimeFormat, "LOCALSETDATETIMEFORMAT");
pragma Alias(LocalGetDateTimeFormat, "LOCALGETDATETIMEFORMAT");
pragma Alias(LocalFormatDateTime, "LOCALFORMATDATETIME");
pragma Alias(LocalFormatFileDateTime, "LOCALFORMATFILEDATETIME");
pragma Alias(LocalParseDateTime, "LOCALPARSEDATETIME");
pragma Alias(LocalCustomParseDateTime, "LOCALCUSTOMPARSEDATETIME");
pragma Alias(LocalCalcDaysInMonth, "LOCALCALCDAYSINMONTH");
pragma Alias(ToUpper, "TOUPPER");
pragma Alias(ToLower, "TOLOWER");
pragma Alias(LocalUpcaseString, "LOCALUPCASESTRING");
pragma Alias(LocalDowncaseString, "LOCALDOWNCASESTRING");
pragma Alias(LocalCmpStrings, "LOCALCMPSTRINGS");
pragma Alias(LocalCmpStringsNoCase, "LOCALCMPSTRINGSNOCASE");
pragma Alias(LocalCmpStringsNoSpace, "LOCALCMPSTRINGSNOSPACE");
pragma Alias(LocalCmpStringsNoSpaceCase, "LOCALCMPSTRINGSNOSPACECASE");
pragma Alias(LocalIsSymbol, "LOCALISSYMBOL");
pragma Alias(LocalIsDateChar, "LOCALISDATECHAR");
pragma Alias(LocalIsTimeChar, "LOCALISTIMECHAR");
pragma Alias(LocalIsNumChar, "LOCALISNUMCHAR");
pragma Alias(LocalIsDosChar, "LOCALISDOSCHAR");
pragma Alias(LocalDosToGeos, "LOCALDOSTOGEOS");
pragma Alias(LocalGeosToDos, "LOCALGEOSTODOS");
pragma Alias(LocalGetQuotes, "LOCALGETQUOTES");
pragma Alias(LocalSetQuotes, "LOCALSETQUOTES");
pragma Alias(LocalCustomFormatDateTime, "LOCALCUSTOMFORMATDATETIME");
pragma Alias(LocalGetNumericFormat, "LOCALGETNUMERICFORMAT");
pragma Alias(LocalSetNumericFormat, "LOCALSETNUMERICFORMAT");
pragma Alias(LocalGetCurrencyFormat, "LOCALGETCURRENCYFORMAT");
pragma Alias(LocalSetCurrencyFormat, "LOCALSETCURRENCYFORMAT");
pragma Alias(LocalCmpStringsDosToGeos, "LOCALCMPSTRINGSDOSTOGEOS");
pragma Alias(LocalIsCodePageSupported, "LOCALISCODEPAGESUPPORTED");
pragma Alias(LocalCodePageToGeos, "LOCALCODEPAGETOGEOS");
pragma Alias(LocalGeosToCodePage, "LOCALGEOSTOCODEPAGE");
pragma Alias(LocalCodePageToGeosChar, "LOCALCODEPAGETOGEOSCHAR");
pragma Alias(LocalGeosToCodePageChar, "LOCALGEOSTOCODEPAGECHAR");
pragma Alias(LocalDosToGeosChar, "LOCALDOSTOGEOSCHAR");
pragma Alias(LocalGeosToDosChar, "LOCALGEOSTODOSCHAR");
pragma Alias(LocalGetCodePage, "LOCALGETCODEPAGE");
pragma Alias(LocalSetCodePage, "LOCALSETCODEPAGE");
pragma Alias(LocalGetMeasurementType, "LOCALGETMEASUREMENTTYPE");
pragma Alias(LocalSetMeasurementType, "LOCALSETMEASUREMENTTYPE");
pragma Alias(LocalLexicalValue, "LOCALLEXICALVALUE");
pragma Alias(LocalLexicalValueNoCase, "LOCALLEXICALVALUENOCASE");
pragma Alias(LocalStringSize, "LOCALSTRINGSIZE");
pragma Alias(LocalStringLength, "LOCALSTRINGLENGTH");
pragma Alias(LocalDistanceToAscii, "LOCALDISTANCETOASCII");
pragma Alias(LocalDistanceFromAscii, "LOCALDISTANCEFROMASCII");
pragma Alias(LocalFixedToAscii, "LOCALFIXEDTOASCII");
pragma Alias(LocalAsciiToFixed, "LOCALASCIITOFIXED");
pragma Alias(LocalGetLanguage, "LOCALGETLANGUAGE");
pragma Alias(LocalAddGengoName, "LOCALADDGENGONAME");
pragma Alias(LocalRemoveGengoName, "LOCALREMOVEGENGONAME");
pragma Alias(LocalGetGengoInfo, "LOCALGETGENGOINFO");
#endif

#endif


log.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1995 -- All Rights Reserved
 *
 * PROJECT:	  GEOS
 * MODULE:	  logging utility
 * FILE:	  log.h
 *
 * AUTHOR:  	  Eric Weber: May 24, 1995
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	EW	5/24/95   	Initial version
 *
 * DESCRIPTION:
 *	definition file for log library
 *
 *
 * 	$Id: log.h,v 1.2.2.1 96/04/28 08:30:08 chris Exp $
 *
 ***********************************************************************/
#ifndef _LOG_H_
#define _LOG_H_

#endif /* _LOG_H_ */

#ifndef _LOG_H_
#define _LOG_H_  1

@deflib log

#define MAX_LOG_MODULE_NAME_LENGTH 	(32)

/*
 *  identifier of a module user can control logging for
 */
/* enum LogModuleID */
typedef enum {
    LMI_EMAIL     = 0x0,
    LMI_SOCKET     = 0x2,
    LMI_TCP     = 0x4,
    LMI_PPP     = 0x6,
    LMI_WWW     = 0x8,
    LMI_MAIL_EDITOR     = 0xa,
    LMI_MAIL_VIEWER     = 0xc,
    LMI_RBUS     = 0xe,
    LMI_SCM     = 0x10,
    LMI_TEST_MANAGER     = 0x12,
    LMI_TCP_ECHO     = 0x14,
    LMI_TEST_SCRIPT     = 0x16,
    LMI_SMS     = 0x18,
    LMI_SMS_RECV     = 0x1a,
    LMI_SMS_EDIT     = 0x1c,
    LMI_B_CARD     = 0x1e,
    LMI_SMSEND     = 0x20
} LogModuleID} ;
    /* when adding things here, add them to		  */
    /* log.def, and to Library/Foam/Log/logStrings.ui */

/*
 *  severity of a log event
 *
 */
typedef ByteEnum LogEventLevel ;
#define LEL_NONE 	0x0
#define LEL_INFO 	0x1
#define LEL_WARNING 	0x2
#define LEL_ERROR 	0x3
#define LEL_FATAL 	0x4

/*
 *  extended machine readable description of an event
 */
typedef DWordFlags LogEventMask ;
#define LEM_level 	(0xE0000000)   /* LogEventLevel */
#define LEM_level_OFFSET 	29
#define LEM_counter 	(0x10000000)   /* set to select counter info */
#define LEM_custom 	(0x0FFFFFFF)
#define LEM_custom_OFFSET 	0

/*
 *  information about an event to be logged
 */
typedef struct {
    LogModuleID	LEP_module;
    LogEventMask	LEP_mask;
    fptr.char	LEP_event;
    fptr.char	LEP_string1;
    fptr.char	LEP_string2;
} LogEventParams} ;

/*
 *  destination of log events
 */
typedef ByteFlags LogOutputType ;
#define LOT_FILE 	(0x80)
#define LOT_SERIAL 	(0x40)
/* 6 bits unused */

extern void _pascal LogEvent (LogEventParams lep);
/*
 *  Add an event record to the log
 *
 *  Pass:       lep - description of event to be logged
 *  Return:     nothing
 *
 *  string1 and string2 are substituted for ^A and ^B in LEP_event
 *  the strings can be discarded when LogEvent returns
 *
 *  The event will be logged if the level passed to LogEvent is not
 *  LEL_none and equals or exceeds the level in the mask set by
 *  LogSetModuleMask.  The event will also be logged if the custom
 *  masks supplied to LogEvent and LogSetModuleMask have any common
 *  set bits.
 *
 */

extern void _pascal IncrementCounters (LogModuleID lmi, long counters);
extern void _pascal DecrementCounters (LogModuleID lmi, long counters);
extern void _pascal ZeroCounters (LogModuleID lmi, long counters);
/*
 *  Increment/Decrement/Zero some of the counters for this module.
 *
 *  Pass:	counters - mask of counters to increment/decrement/zero
 * 		lmi	 - module id requesting log
 *
 *  Return:	nothing
 *
 *  Each module has access to 32 unsigned 32-bit counters.  At regular
 *  intervals, all of the counters for a module will be converted to
 *  hex and passed to LogEvent with a mask of LEM_counter.  Hence,
 *  they will be logged if and only if the LEM_counter bit is set in
 *  the module mask, irregardless of the LogEventLevel of the mask.
 *
 *  Increment and Decrement will not change the counter value if
 *  doing so would cause it to go below zero or above maxint.
 */

extern  LogOutputType _pascal LogSetOutput (LogOutputType lot,
                       SerialPortNum spn,
                       char *fname);
/*
 *  Direct the output of the log utility
 *
 *  Pass:	lot     = outputs on which to log (0 to disable logging)
 * 		spn	= which serial port to use (if LOT_SERIAL is set)
 * 		ds:dx	= filename relative to SP_PRIVATE_DATA (if LOT_FILE)
 *
 *  Return:	mask of sucessfully opened outputs
 */

extern Boolean _pascal LogSetCounterOutput (char *fname);
/*
 * Direct the output of the counters
 *
 * Pass:	fname  - filename relative to SP_PRIVATE_DATA
 * Return:	TRUE if unable to open file
 *
 * At fixed intervals, this file will be overwritten with the current
 * counter data for all the modules.  The file will also be
 * overwritten immediately in order to detect any errors.
 */

extern int _pascal LogGetModuleName(LogModuleID lmi, char *namebuf)
/*
 *  Get the name of an app
 *
 *  Pass:	lmi = module whose name should be fetched
 *              namebuf = buffer for null-terminated name
 *                        should be MAX_LOG_MODULE_NAME_LENGTH chars long
 *
 *  Return:	size of name, sans null
 */

extern LogEventMask _pascal LogGetModuleMask (LogModuleID lmi);
/*
 *  Get the currently enabled logging for a module
 *
 *  Pass:	lmi = module whose logging mask should be fetched
 *  Return:	LogEventMask assigned to lmi
 *
 *  See LogEvent for an explanation of how the mask is used.
 */

extern	void _pascal LogSetModuleMask (LogModuleID lmi, LogEventMask lem);
/*
 *  Set the currently enabled logging for a module
 *
 *  Pass:	lmi = module to modify
 * 		lem = new mask for lmi
 *
 *  Return:	nothing
 *
 *  See LogEvent for an explanation of how the mask is used.
 */

extern int _pascal LogGetLevelName(LogModuleID lmi, char *namebuf)
/*
 *  Get the level name.
 *
 *  Pass:	lmi = module whose name should be fetched
 *              namebuf = buffer for null-terminated name
 *                        should be MAX_LOG_MODULE_NAME_LENGTH chars long
 *
 *  Return:	size of name, sans null
 */

@endlib

#endif


mailbox.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1994 -- All Rights Reserved

PROJECT:	GEOS
MODULE:		System Inbox/Outbox
FILE:		mailbox.goh

AUTHOR:		Chung Liu, Nov 20, 1994

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    CL	11/20/94   	Initial version.

DESCRIPTION:
    Interface definition for system Mailbox library, which controls the
    System Inbox / Outbox.

    $Id: mailbox.goh,v 1.29.1.5 97/11/14 17:07:11 mevissen Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@optimize

@ifndef _MAILBOX_GOH_
@define _MAILBOX_GOH_

@include  <Objects/gItemGC.goh> 	/* for GenItemGroupStateFlags */

@deflib	mailbox

@include  <Objects/metaC.goh>  	/* MetaMailboxMessages */
#include  <medium.h> 		/* for MediumType */

/* The token for a mailbox message. */
typedef	dword	MailboxMessage	;

/*
 * MESSAGE BODY STORAGE
 */

/* Geoworks-defined storage types */

/* enum GeoworksMailboxStorageID */
typedef enum {
    GMSID_FILE     = 0x0,
    GMSID_VM_TREE    ,
} GeoworksMailboxStorageID} ;

#define GMSID_HUGE_ARRAY 	GMSID_VM_TREE

typedef struct {
    word		MS_id;
    ManufacturerID	MS_manuf;
} MailboxStorage} ;

/*
 *  MESSAGE BODY FORMAT
 */

/* enum GeoworksMailboxDataFormatID */
typedef enum {
    GMDFID_INVALID     = 0x0,
    GMDFID_STREAM_GSTRING    ,
    GMDFID_VM_GSTRING    ,
    GMDFID_TRANSFER_ITEM    ,
    GMDFID_TEXT_CHAIN    ,
    GMDFID_TEXT_FILE    ,
    GMDFID_DOCUMENT    ,
    GMDFID_ADDRESS_CARD    ,
    GMDFID_APPOINTMENT    ,
    GMDFID_INK    ,
    GMDFID_VM_COMPOSITE    ,
    GMDFID_FAX_FILE    ,
    GMDFID_SHORT_MESSAGE    ,
    GMDFID_FOAM_FILE    ,
    GMDFID_TEXT_ARRAY    ,
    GMDFID_OBEX
} GeoworksMailboxDataFormatID} ;

#define	GMDFID_END_OF_LIST		GMDFID_INVALID

typedef struct {
    word		MDF_id;
    ManufacturerID	MDF_manuf;
} MailboxDataFormat} ;

/*
 *  TRANSPORT MECHANISMS
 */

/* enum GeoworksMailboxTransportID */
typedef enum {
    GMTID_LOCAL     = 0x0,		/* Message goes in the inbox. Transport
                 * address may be a null pointer. */
    GMTID_NET_LIBRARY    ,
    GMTID_PRINT_SPOOLER    ,
    GMTID_FAX_SEND    ,
    GMTID_ZOOMER    ,
    GMTID_SM    ,
    GMTID_SKELETON    ,
    GMTID_SMTP    ,
    GMTID_OBEX
} GeoworksMailboxTransportID} ;

typedef struct {
    unsigned		MT_id;
    ManufacturerID	MT_manuf;
} MailboxTransport} ;

typedef	unsigned	MailboxTransportOption	;

typedef struct {
    MailboxTransport		MTAO_transport;
    MailboxTransportOption	MTAO_transOption;
} MailboxTransportAndOption} ;

#define MAILBOX_ANY_TRANSPORT_OPTION 	(-1)

typedef ByteEnum MailboxMessagePriority ;
#define MMP_EMERGENCY 	0x0
/*
 *  User should be notified immediately and not allowed to do anything but
 *  receive the message.
 */

#define MMP_URGENT 	0x1
/*
 *  User should be notified immediately, but does not need to read the message
 *  right away. The notification will mention the message's urgency, however.
 */

#define MMP_FIRST_CLASS 	0x2
/*
 *  User should be notified on next periodic check of the inbox. No
 *  constraints on when the user should read the message (other than the
 *  ending time-bound of the message itself).
 */

#define MMP_THIRD_CLASS 	0x3
/*
 *  User should not be notified of the message's arrival, except as required
 *  by the receiving application.
 */

typedef ByteEnum MailboxDeliveryVerb ;
#define MDV_DELIVER 	0x0
/*  Default, vanilla verb */

#define MDV_VIEW 	0x1
/*
 *  Message contains some sort of image that can be viewed. For example, a
 *  received fax.
 */

#define MDV_PLAY 	0x2
/*
 *  Message contains some sort of continuous something that has a definite
 *  starting point and a stopping point. Examples of this would be a voice
 *  recording or MPEG movie.
 */

#define MDV_ACCEPT 	0x3
/*  Another generic verb */

#define MDV_READ 	0x4
/*
 *  Closely related to MDV_VIEW, but useful for email and other things that
 *  are more textual (faxes can be graphical, you know...)
 */

#define MDV_FILE 	0x5
/*
 *  Message contains some unit that can be stored inside a document that
 *  holds multiple such units. For example, an address card or a notebook
 *  page.
 */

typedef WordFlags MailboxMessageFlags ;
/* 8 bits unused
 *  Bits used internally to the Mailbox library.
 */

#define MMF_BODY_DATA_VOLATILE 	(0x0080)
/*
 *  Set if the body data will be deleted by the registering geode once the
 *  message has been registered. The data driver must copy the message body
 *  to preserve it.
 *
 *  NOTE: IF THE MailboxStorage is MANUFACTURER_ID_GEOWORKS/GMSID_VM_TREE AND
 *  THE VM FILE USED IN THE BODY REFERENCE IS *NOT* A VM FILE RETURNED BY
 *  MailboxGetVMFile, YOU *MUST* PASS MMF_BODY_DATA_VOLATILE SET.
 */

#define MMF_SEND_WITHOUT_QUERY 	(0x0040)
/*
 *  Set if the message should be sent whenever possible, without asking the
 *  user about it. This means if a connection is available or could be
 *  created, it will be used (or created, if the medium is available, and
 *  then used).
 */

#define MMF_PRIORITY  		(0x0020 | 0x0010)
#define MMF_PRIORITY_OFFSET 	4
/*
 * type MailboxMessagePriority
 * The priority at which the message should travel.
 */

#define MMF_VERB 		(0x0008 | 0x0004 | 0x0002)
#define MMF_VERB_OFFSET 		1
/*
 * type MailboxDeliveryVerb
 * How the user will think of what happens when the message gets delivered
 */

#define MMF_DELETE_BODY_AFTER_TRANSMISSION 	(0x0001)
/*
 *  Set if the data driver should delete the message body after
 *  transmitting.  Note that if MMF_BODY_DATA_VOLATILE is set, then
 *  the data driver will always delete the copy of the body it made
 *  at the time the message was registered, and leave the body of the
 *  original app-ref alone, regardless of how MMF_DELETE_BODY_AFTER_
 *  TRANSMISSION is set.
 */

typedef struct {
    const void	*MTA_transAddr;		/* Data known to the transport driver
                     *   indicating the destination	 */
    unsigned	MTA_transAddrLen;	/*  Number of bytes in that address */
    const char	*MTA_userTransAddr;	/*  User-readable form of the address.
                     *  If 0:0, empty string is assumed. */
} MailboxTransAddr} ;

/*
 * EXPORTED ROUTINES
 */

/* enum MailboxError */
#define ME_UNRECOVERABLE 	0x8000
typedef enum {
    ME_SUCCESS     = 0x0,
    ME_NOT_ENOUGH_MEMORY    ,
    ME_CANNOT_LOAD_DATA_DRIVER    ,
    ME_CANNOT_LOAD_TRANSPORT_DRIVER    ,
    ME_UNABLE_TO_CREATE_TRANSMIT_THREAD    ,
    ME_CANNOT_ENQUEUE_MESSAGE    ,
    ME_USER_CANCELED    ,
    ME_LOST_CONNECTION    ,
    ME_CANNOT_CREATE_MESSAGE_FILE    ,
    ME_CANNOT_RESIZE_MBOX_REF    ,
    ME_CANNOT_SAVE_MESSAGE_FILE    ,
    ME_CANCELLED_BY_RECEIVER    ,
    ME_MESSAGE_BLOCKS_ARE_MISMATCHED    ,

/*
 *  The data driver could not store away its copy of the message body.
 *  Perhaps the MMF_BODY_DATA_VOLATILE flag was passed, indicating that
 *  the driver should copy the body to its storage area but the data could
 *  not be copied for some reason.  Another possibility is that the data
 *  driver could not store an incoming message during a DR_MBDD_WRITE_*
 *  call.
 */
    ME_DATA_DRIVER_CANNOT_STORE_MESSAGE_BODY    ,

/*  Not enough disk space to store the message. */
    ME_INSUFFICIENT_DISK_SPACE    ,

    /* Temporary failure to connect */
    ME_CANNOT_CONNECT    ,

/*-------------------- Start of Unrecoverable errors */

    ME_ADDRESS_INVALID    =ME_UNRECOVERABLE,
    ME_DATA_DRIVER_CANNOT_ACCESS_MESSAGE_BODY    ,
    ME_UNSUPPORTED_BODY_FORMAT    ,
    ME_MESSAGE_BODY_INVALID    ,
    ME_INVALID_MESSAGE    ,
    ME_REPLY_ADDRESS_NOT_AVAILABLE    ,
    ME_DESTINATION_APPLICATION_UNKNOWN    ,
    ME_UNKNOWN_DISK_ERROR    ,
    ME_APP_REF_BUF_TOO_SMALL    ,
    ME_CANNOT_OPEN_MESSAGE_FILE    ,
    ME_CANNOT_READ_MESSAGE_FILE    ,

    /* Permanent failure to connect */
    ME_CAN_NEVER_CONNECT    ,

} MailboxError} ;

typedef struct {
    MailboxStorage		MRA_bodyStorage;
    MailboxDataFormat		MRA_bodyFormat;
    const void 			*MRA_bodyRef;
    word			MRA_bodyRefLen;
    MailboxTransport		MRA_transport;
    MailboxTransportOption	MRA_transOption;
    MailboxTransAddr		*MRA_transAddrs;
    word			MRA_numTransAddrs;
    dword			MRA_transData;
    MailboxMessageFlags		MRA_flags;
    const char			*MRA_summary;
/* longest MRA_summary string allowed */
#define MAILBOX_MAX_SUBJECT 	(1024)

    GeodeToken			MRA_destApp;
    FileDateAndTime		MRA_startBound;
    FileDateAndTime		MRA_endBound;
} MailboxRegisterMessageArgs} ;

/*
 *  value to pass for MRA_endBound and MRTMA_endBound to have no deadline.
 */
#define MAILBOX_ETERNITY 	-1

/*
 * value to pass for MRA_startBound and MRTMA_standBound to have message
 * available for sending now.
 */
#define MAILBOX_NOW  		0

extern MailboxError
    _pascal MailboxRegisterMessage (MailboxRegisterMessageArgs *mrmArgs,
                    MailboxMessage *msg);
/* not implemented */
extern Boolean
    _pascal MailboxCheckStorageTypeSupported (MailboxStorage storage);

/* not implemented */
extern word /* returns FileError, or 0 if no errors */
    _pascal MailboxCreateStreamGString (FileLongName name,
                GStateHandle *gstate, GString *gs);
extern VMFileHandle
        _pascal MailboxGetAdminFile (void);

extern VMFileHandle /* If error, returns 0 and sets *vmStatusp */
    _pascal MailboxGetVMFile (word expectedNumBlocks, word *vmStatusp);

extern VMFileHandle /* If error, returns 0; *vmStatusp is always set. */
    _pascal MailboxOpenVMFile (FileLongName *namep, word *vmStatusp);

extern void
    _pascal MailboxGetVMFileName (VMFileHandle file, FileLongName *namep);

extern void
    _pascal MailboxDoneWithVMFile (VMFileHandle file);

extern Boolean
    _pascal MailboxCheckMediumAvailable (MediumType mediumType,
                word unitNum, MediumUnitType unitType);

extern Boolean
    _pascal MailboxCheckMediumConnected (MediumType mediumType,
                word unitNum, MediumUnitType unitType);

extern word
    _pascal MailboxGetFirstMediumUnit (MediumType mediumType,
                MediumUnitType *unitType);

@prototype void MAILBOX_CANCEL_NOTIFY  (MailboxCancelAction action = cx);

extern MailboxError
        _pascal MailboxGetUserTransAddrLMem (MailboxMessage msg,
                        word addrNumber,
                        MemHandle lmemBlock,
                        ChunkHandle *addrChunk);

extern MailboxError
    _pascal MailboxGetNumTransAddrs (MailboxMessage msg,
                word *numAddresses);

extern Boolean /* returns FALSE if error */
    _pascal MailboxGetTransAddr (MailboxMessage msg, word addrNumber,
                    void *addressBuffer,
                    word *bufSizePtr);

extern MailboxError
    _pascal	MailboxSetTransAddr	(MailboxMessage msg, word addrNumber,
                    const void *newAddress,
                    word addrSize);

extern MailboxError
    _pascal MailboxGetTransData (MailboxMessage msg, dword *transData);

extern MailboxError
    _pascal MailboxSetTransData (MailboxMessage msg, dword transData);

extern MailboxError
    _pascal MailboxGetStorageType (MailboxMessage msg,
                 MailboxStorage *storage);

/* not implemented */
extern MailboxError
    _pascal MailboxGetTransport (MailboxMessage msg,
                MailboxTransport *transport);

extern MailboxError
    _pascal MailboxGetBodyMboxRefBlock (MailboxMessage msg,
                MemHandle *mboxRefHandle);

extern MailboxError
    _pascal MailboxGetDestApp (MailboxMessage msg,
                GeodeToken *tokenBuf);

extern MailboxError
    _pascal MailboxGetStartBound (MailboxMessage msg,
                FileDateAndTime *dateTime);

extern MailboxError
    _pascal	MailboxGetEndBound	(MailboxMessage msg,
                FileDateAndTime *dateTime);

extern void
    _pascal MailboxAcknowledgeMessageReceipt (MailboxMessage msg);

extern void
    _pascal MailboxDeleteMessage (MailboxMessage msg);

extern MailboxError
    _pascal MailboxGetSubjectLMem (MailboxMessage msg,
                MemHandle lmemBlock, ChunkHandle *subjectChunk);
extern MailboxError
    _pascal MailboxGetSubjectBlock (MailboxMessage msg,
                MemHandle *subjHandle);

extern MailboxError
    _pascal MailboxGetMessageFlags (MailboxMessage msg,
                MailboxMessageFlags *flags);

extern MailboxError
    _pascal MailboxGetBodyFormat (MailboxMessage msg,
                MailboxDataFormat *dataFormat);

extern MailboxError
    _pascal MailboxGetBodyRef (MailboxMessage msg,
                void *appRefBuf, word *appRefBufSize);

typedef struct {
    MailboxStorage	MCBFA_bodyStorage;
    MailboxDataFormat	MCBFA_bodyFormat;
    const void		*MCBFA_bodyRef;
    unsigned		MCBFA_bodyRefLen;
    MailboxMessageFlags	MCBFA_newBodyFlags;
} MailboxChangeBodyFormatArgs} ;

extern MailboxError
    _pascal MailboxChangeBodyFormat (MailboxMessage msg,
                const MailboxChangeBodyFormatArgs *mcbfArgs);

extern MailboxError
    _pascal MailboxBodyReformatted (MailboxMessage msg,
                       MailboxDataFormat newFormat,
                       MailboxMessageFlags newBodyFlags);

extern MailboxError
    _pascal MailboxStealBody (MailboxMessage msg,
                void *appRefBuf, word *appRefBufSize);

extern void
    _pascal MailboxDoneWithBody (MailboxMessage msg,
                const void *appRef, word appRefSize);

extern GeodeHandle
    _pascal	MailboxLoadDataDriver	(MailboxStorage storage,
                GeodeLoadError *error);

extern GeodeHandle
    _pascal MailboxLoadDataDriverWithError (MailboxStorage storage,
                GeodeLoadError *error);

extern GeodeHandle
    _pascal MailboxLoadTransportDriver (MailboxTransport transport,
                GeodeLoadError *error);

extern void
    _pascal MailboxFreeDriver (GeodeHandle driverHandle);

extern void
    _pascal MailboxPushToMailboxDir (void);

extern void
    _pascal MailboxChangeToMailboxDir (void);

/* untested */
extern void
    _pascal MailboxConvertToMailboxTransferItem (VMFileHandle clipboardFile,
                VMBlockHandle clipboardBlock,
                VMFileHandle vmFile, word userID,
                MemHandle nameLMemBlock,
                ChunkHandle nameChunk,
                VMFileHandle *transferItemBlock);

/* untested */
extern void
    _pascal MailboxConvertToClipboardTransferItem (VMFileHandle mailboxFile,
                VMBlockHandle mailboxBlock,
                VMFileHandle clipboardFile,
                word userID,
                VMBlockHandle *clipboardBlock);

typedef struct {
    MailboxMessage		MRTMA_message;
    MailboxStorage		MRTMA_bodyStorage;
    MailboxDataFormat		MRTMA_bodyFormat;
    const void 			*MRTMA_bodyRef;
    word			MRTMA_bodyRefLen;
    dword			MRTMA_transData;
    MailboxMessageFlags		MRTMA_flags;
    const char			*MRTMA_summary;
    GeodeToken			MRTMA_destApp;
    FileDateAndTime		MRTMA_startBound;
    FileDateAndTime		MRTMA_endBound;
} MailboxReplyToMessageArgs} ;

/* untested */
extern MailboxError
    _pascal MailboxReplyToMessage (MailboxReplyToMessageArgs *mrtmArgs,
                    MailboxMessage *msg);

/*
 * SST_MAILBOX Notification Types
 */

/* enum MailboxSubsystemNotification */
typedef enum {

    MSN_APP_LOADED     = 0x0,
    MSN_NEW_FOCUS_APP    ,
    MSN_NEW_IACP_BINDING    ,
    MSN_REMOVE_IACP_BINDING    ,
} MailboxSubsystemNotification} ;

/*
 * EXPORTED OBJECT CLASSES
 */
@class  MailboxSendControlClass, GenControlClass;

typedef WordFlags MSCFeatures ;
#define MSCF_POOF_LIST 		(0x0002)
#define MSCF_TRANSPORT_LIST  	(0x0001)

#define MSC_DEFAULT_FEATURES 	(MSCF_POOF_LIST|MSCF_TRANSPORT_LIST)

typedef WordFlags MSCToolboxFeatures ;
#define MSCTF_SEND_DIALOG 	(0x0001)

#define MSC_DEFAULT_TOOLBOX_FEATURES 	(MSCTF_SEND_DIALOG)

/*
 * To define new object types in your application, use something like:
 *
 * typedef enum {
 *         MOT_CURRENT_CARD=_FIRST_GeoDexSendControlClass,
 *         MOT_WHOLE_SHEBANG,
 *         MOT_WHATEVER
 * } GeoDexMailboxObjectType;
 */

typedef enum {
    MOT_DOCUMENT     = _FIRST_MailboxSendControlClass,
    MOT_PAGE_RANGE    ,
    MOT_CURRENT_PAGE    ,
    MOT_SELECTION    ,
} MailboxObjectType} ;

/*  none of the above */
#define MOT_OTHER 		(MOT_SELECTION + 1)

#define MOT_FIRST_APP_TYPE  	(_FIRST_MAILBOX_OBJECT_TYPE + DEFAULT_CLASS_MESSAGES))

typedef struct {
    MailboxObjectType	MSCN_objectType;
    /* label byte		MSCN_data; */
} MailboxSendContextNotification} ;

@message void MSG_MAILBOX_SEND_CONTROL_OBJECT_TYPE_SELECTED
                (MailboxObjectType objType = cx);

@message void MSG_MAILBOX_SEND_CONTROL_ENABLE_DATA_OBJECT_UI
                 (optr treeRoot = cx:dx);  /* private */

@message dword MSG_MAILBOX_SEND_CONTROL_GET_PAGE_RANGE
     (word transHandle = bp) = cx:dx;

/* returns 0 if error */
@message MailboxDataFormat MSG_MAILBOX_SEND_CONTROL_CHOOSE_FORMAT
    (MailboxDataFormat *format = cx:dx, word transHandle = bp) = cx:dx;

@message void MSG_MAILBOX_SEND_CONTROL_CANCEL_MESSAGE (word transHandle = bp, word notifyFlag = dx);

/* returns 0 if error, or MSCTransaction */
@message optr MSG_MAILBOX_SEND_CONTROL_CREATE_TRANSACTION ();  /* private */

typedef struct {
    word		MSCPRD_start;
    word		MSCPRD_end;
} MSCPageRangeData} ;

typedef union {
    MSCPageRangeData	MSCOD_pageRange;
} MSCObjectData} ;

typedef WordFlags MSCTFlags ;
/* set if transport driver + option may not be used to create another
 * transaction until this one is complete.
 */
#define MSCTF_DIALOG_COMPLETE 	    (0x0008)
#define MSCTF_CREATION_PENDING 	    (0x0004)
#define MSCTF_NOTIFY_AFTER_REGISTER  (0x0002)
#define MSCTF_NON_REENTRANT 	    (0x0001)

typedef struct {
    ChunkHandle			MSCT_next;
    word			MSCT_size;
    MailboxTransport		MSCT_transport;
    MailboxTransportOption	MSCT_transOption;
    MemHandle			MSCT_dataBlock;
    word			MSCT_addresses;
    word			MSCT_addrControl;
    optr			MSCT_feedback;
    MSCTFlags			MSCT_flags;
    dword			MSCT_transData;
    MailboxObjectType		MSCT_objType;
    MSCObjectData		MSCT_objData;
    MailboxStorage  	    	MSCT_bodyStorage;
    MailboxDataFormat		MSCT_bodyFormat;
    MailboxMessageFlags		MSCT_messageFlags;
    GeodeToken			MSCT_destApp;
    FileDateAndTime		MSCT_startBound;
    FileDateAndTime		MSCT_endBound;
    ChunkHandle			MSCT_bodyRef;
    ChunkHandle			MSCT_summary;
} MSCTransaction} ;

@message void MSG_MAILBOX_SEND_CONTROL_TWEAK_PARAMS
            (MailboxRegisterMessageArgs *mrmArgs = cx:dx,
            ChunkHandle transChunk = bp);

@message void MSG_MAILBOX_SEND_CONTROL_TRANSACTION_FINISHED
                     (ChunkHandle transChunk = bp);

@importMessage MetaMailboxMessages, void MSG_META_MAILBOX_CREATE_MESSAGE
            (optr sendControl = cx:dx, word transHandle = bp);

/* MSCRegisterMessageArgs */
typedef struct {
    MailboxStorage		MSCRMA_bodyStorage;
    MailboxDataFormat		MSCRMA_bodyFormat;
    const void 			*MSCRMA_bodyRef;
    word			MSCRMA_bodyRefLen;
    MailboxMessageFlags		MSCRMA_flags;
    const char 			*MSCRMA_summary;
    GeodeToken			MSCRMA_destApp;
    FileDateAndTime		MSCRMA_startBound;
    FileDateAndTime		MSCRMA_endBound;
} MSCRegisterMessageArgs} ;

@message void MSG_MAILBOX_SEND_CONTROL_REGISTER_MESSAGE
             (MSCRegisterMessageArgs *mscRMArgs = cx:dx,
            word transHandle = bp) = dx:ax;

typedef struct {
    MailboxError	    MSCMRA_error;
    MailboxMessage	    MSCMRA_message;
    MailboxStorage	    MSCMRA_bodyStorage;
    MailboxDataFormat   MSCMRA_bodyFormat;
    word		    MSCMRA_bodyRefLen;
} MSCMessageRegisteredArgs} ;

#define MSCMRA_BODY_REF (argsPtr, refType) ((const refType *)((argsPtr)+1))

@importMessage MetaMailboxMessages, void MSG_META_MAILBOX_MESSAGE_REGISTERED
                   (MemHandle args = cx);

@message void MSG_MAILBOX_SEND_CONTROL_REPLY_TO_MESSAGE
                (MailboxMessage msg = cx:dx);

typedef struct {
    MailboxTransAddr		*MSCSAA_transAddrs;
    word			MSCSAA_numTransAddrs;
    MailboxTransportAndOption	MSCSAA_transportAndOption;
} MSCSetAddressesArgs} ;

@message void MSG_MAILBOX_SEND_CONTROL_SET_ADDRESSES
                (MSCSetAddressesArgs *mscsaArgs = cx:dx);

@message void MSG_MAILBOX_SEND_CONTROL_SET_AVAILABLE_FORMATS
                (const MailboxDataFormat *formats = cx:dx);

@message MailboxObjectType MSG_MAILBOX_SEND_CONTROL_GET_OBJECT_TYPE  (word transHandle = bp) = ax;

@message void MSG_MAILBOX_SEND_CONTROL_CREATE_BODY (ChunkHandle transHandle=
bp);
@message void MSG_MAILBOX_SEND_CONTROL_SET_DATA_OBJECT_VALID  (Boolean isValid = cx);
@message Boolean MSG_MAILBOX_SEND_CONTROL_SAVE_TRANSACTION (word *retVal = multipleax, VMFileHandle destFile = cx, word transHandle = bp) = carry;

@message void MSG_MAILBOX_SEND_CONTROL_COMPLETE_TRANSACTION (word transHandle = bp);

@reserveMessages 28;

/*
 *  Private Messages
 */
@message void MSG_MAILBOX_SEND_CONTROL_GET_ADDRESSES (); /* private */

@message void MSG_MAILBOX_SEND_CONTROL_TRANSPORT_SELECTED
                 (word transIndex = cx);	/* private */

typedef struct {
    MediumType			MMT_medium;
    MailboxTransport		MMT_transport;
    MailboxTransportOption	MMT_transOption;
} MailboxMediaTransport} ;

@message void MSG_MAILBOX_SEND_CONTROL_INITIATE_DIALOG_WITH_TRANSPORT
                (@stack MailboxMediaTransport mediaTransport);

@message void MSG_MAILBOX_SEND_CONTROL_GET_CONTENTS_MONIKER
                (word transIndex = cx); /* private */

@message optr MSG_MAILBOX_SEND_CONTROL_GET_CONTENTS_STRING (word index = cx,
                MemHandle lmemBlock = dx) = dx:ax;

@message void MSG_MAILBOX_SEND_CONTROL_SET_CONTENTS (word index = cx,
                word numSelections = bp,
                GenItemGroupStateFlags itemFlags = dl);

typedef enum {
    MDT_APPLICATION, MDT_FILE, MDT_CLIPBOARD, MDT_QUICK_MESSAGE,
} MailboxDialogType} ;

@message void MSG_MAILBOX_SEND_CONTROL_POOF_SELECTED (MailboxDialogType type=dx);

    @vardata void HINT_MAILBOX_SEND_CONTROL_INCORPORATE_ADDRESS_CONTROL;
    @vardata void HINT_MAILBOX_SEND_CONTROL_SEPARATE_ADDRESS_CONTROL;

typedef struct {
    MemHandle		TMDD_block;
    MailboxDialogType	TMDD_type;
} TempMailboxDialogData} ;

    @vardata TempMailboxDialogData TEMP_MAILBOX_SEND_CONTROL_CURRENT_DIALOG;
    @vardata void TEMP_MAILBOX_SEND_CONTROL_DESTROY_DIALOG_PENDING;
    @vardata void ATTR_MAILBOX_SEND_CONTROL_SEND_PAGES;
    @vardata void ATTR_MAILBOX_SEND_CONTROL_SEND_DOCUMENT;
    @vardata void ATTR_MAILBOX_SEND_CONTROL_SEND_SELECTION;
    @vardata MailboxTransportAndOption
                ATTR_MAILBOX_SEND_CONTROL_TRANSPORT_HINT;
    @vardata MailboxMediaTransport
                ATTR_MAILBOX_SEND_CONTROL_SINGLE_TRANSPORT;

typedef struct {
    ChunkHandle			MSCAAT_addresses;
                /* chunk array of MBACAddress entries */
    MailboxTransportAndOption	MSCAAT_transport;
                /* transport + option for addrs */
} MSCAddressesAndTransport} ;

    @vardata MSCAddressesAndTransport
            TEMP_MAILBOX_SEND_CONTROL_ADDRESSES_AND_TRANSPORT;

    @vardata MailboxDataFormat ATTR_MAILBOX_SEND_CONTROL_AVAILABLE_FORMATS[];

    @vardata void ATTR_MAILBOX_SEND_CONTROL_SAVES_TRANSACTIONS;

typedef struct {
    MailboxTransport              FTHD_transport;
        MailboxTransportOption        FTHD_transOption;
        optr                          FTHD_pc;
} MailboxTransportHintOptr} ;

        @vardataAlias (ATTR_MAILBOX_SEND_CONTROL_TRANSPORT_HINT)
        MailboxTransportHintOptr ATTR_MAILBOX_SEND_CONTROL_TRANSPORT_HINT_OPTR;

/* MailboxSendObjectType */
typedef struct {
    MailboxObjectType		MSOT_id;
    word			MSOT_feature;
    ChunkHandle			MSOT_desc;
} MailboxSendObjectType} ;

    @instance ChunkHandle MSCI_dataTypes = 0;
    @instance ChunkHandle MSCI_transactions	= 0;
    @instance MailboxObjectType MSCI_defBodyType;
    @instance MailboxObjectType MSCI_curBodyType;

    @default GI_states = (@default | GS_ENABLED);
    @default GII_type = GIT_ORGANIZATIONAL;
    @default GII_visibility = GIV_SUB_GROUP;

@endc	/* MailboxSendControlClass */

@importMessage	MetaMailboxMessages,
    Boolean MSG_META_MAILBOX_NOTIFY_MESSAGE_AVAILABLE
                    (MailboxMessage msg = cx:dx) = carry;

@class	MailboxOutboxControlClass, GenControlClass;

/*
 * Messages sent out:
 * 	none
 *
 * GenApplication GCN lists to be placed on (will add itself to these when
 * it's interactible):
 * 	none (adds itself to MGCNLT_OUTBOX_CHANGE on the Mailbox library's
 *	      application object, but you don't need to worry about that)
 *
 * Notification types responded to:
 * 	none
 */

/*
 * Constants
 */

typedef WordFlags MOCFeatures ;
#define    MOCF_DELETE_MESSAGE    	0x0004
#define    MOCF_STOP_SENDING    	0x0002
#define    MOCF_START_SENDING    	0x0001

#define MOC_DEFAULT_FEATURES 	(MOCF_DELETE_MESSAGE)

typedef WordFlags MOCToolboxFeatures ;

#define MOC_DEFAULT_TOOLBOX_FEATURES 	0

/*
 *	Messages sent by the controller's UI gadgetry. Not to be sent by
 *	anything else...
 */

@message void MSG_MAILBOX_OUTBOX_CONTROL_ENABLE_FEATURES
    (MOCFeatures normal = cx, MOCToolboxFeatures toolbox = dx);
/* Enables only those features currently defined whose feature flags are
 * passed. Any feature defined for the controller whose flag is not set in
 * the passed register is set not-enabled.
 *
 * Context:	Sent by message list as different items are selected.
 * Source:	message list
 * Destination:	MailboxOutboxControl
 * Interception:	no point
 *
 */

@endc;

#ifdef __HIGHC__

pragma Alias (MailboxRegisterMessage, "MAILBOXREGISTERMESSAGE");
pragma Alias (MailboxCheckStorageTypeSupported,
       "MAILBOXCHECKSTORAGETYPESUPPORTED");
pragma Alias (MailboxCreateStreamGString, "MAILBOXCREATESTREAMGSTRING");
pragma Alias (MailboxGetAdminFile, "MAILBOXGETADMINFILE");
pragma Alias (MailboxGetVMFile, "MAILBOXGETVMFILE");
pragma Alias (MailboxOpenVMFile, "MAILBOXOPENVMFILE");
pragma Alias (MailboxGetVMFileName, "MAILBOXGETVMFILENAME");
pragma Alias (MailboxDoneWithVMFile, "MAILBOXDONEWITHVMFILE");
pragma Alias (MailboxCheckMediumAvailable, "MAILBOXCHECKMEDIUMAVAILABLE");
pragma Alias (MailboxCheckMediumConnected, "MAILBOXCHECKMEDIUMCONNECTED");
pragma Alias (MailboxGetFirstMediumUnit, "MAILBOXGETFIRSTMEDIUMUNIT");
pragma Alias (MailboxGetNumTransAddrs, "MAILBOXGETNUMTRANSADDRS");
pragma Alias (MailboxGetTransAddr, "MAILBOXGETTRANSADDR");
pragma Alias (MailboxSetTransAddr, "MAILBOXSETTRANSADDR");
pragma Alias (MailboxGetTransData, "MAILBOXGETTRANSDATA");
pragma Alias (MailboxSetTransData, "MAILBOXSETTRANSDATA");
pragma Alias (MailboxGetStorageType, "MAILBOXGETSTORAGETYPE");
pragma Alias (MailboxGetTransport, "MAILBOXGETTRANSPORT");
pragma Alias (MailboxGetBodyMboxRefBlock, "MAILBOXGETBODYMBOXREFBLOCK");
pragma Alias (MailboxGetDestApp, "MAILBOXGETDESTAPP");
pragma Alias (MailboxGetStartBound, "MAILBOXGETSTARTBOUND");
pragma Alias (MailboxGetEndBound, "MAILBOXGETENDBOUND");
pragma Alias (MailboxAcknowledgeMessageReceipt,
       "MAILBOXACKNOWLEDGEMESSAGERECEIPT");
pragma Alias (MailboxDeleteMessage, "MAILBOXDELETEMESSAGE");
pragma Alias (MailboxGetSubjectLMem, "MAILBOXGETSUBJECTLMEM");
pragma Alias (MailboxGetSubjectBlock, "MAILBOXGETSUBJECTBLOCK");
pragma Alias (MailboxGetMessageFlags, "MAILBOXGETMESSAGEFLAGS");
pragma Alias (MailboxGetBodyFormat, "MAILBOXGETBODYFORMAT");
pragma Alias (MailboxGetBodyRef, "MAILBOXGETBODYREF");
pragma Alias (MailboxChangeBodyFormat, "MAILBOXCHANGEBODYFORMAT");
pragma Alias (MailboxBodyReformatted, "MAILBOXBODYREFORMATTED");
pragma Alias (MailboxStealBody, "MAILBOXSTEALBODY");
pragma Alias (MailboxDoneWithBody, "MAILBOXDONEWITHBODY");
pragma Alias (MailboxLoadDataDriver, "MAILBOXLOADDATADRIVER");
pragma Alias (MailboxLoadDataDriverWithError,
       "MAILBOXLOADDATADRIVERWITHERROR");
pragma Alias (MailboxLoadTransportDriver, "MAILBOXLOADTRANSPORTDRIVER");
pragma Alias (MailboxFreeDriver, "MAILBOXFREEDRIVER");
pragma Alias (MailboxPushToMailboxDir, "MAILBOXPUSHTOMAILBOXDIR");
pragma Alias (MailboxChangeToMailboxDir, "MAILBOXCHANGETOMAILBOXDIR");
pragma Alias (MailboxConvertToMailboxTransferItem,
       "MAILBOXCONVERTTOMAILBOXTRANSFERITEM");
pragma Alias (MailboxConvertToClipboardTransferItem,
       "MAILBOXCONVERTTOCLIPBOARDTRANSFERITEM");
pragma Alias (MailboxReplyToMessage, "MAILBOXREPLYTOMESSAGE");
#endif /* __HIGHC__ */

@endlib

@endif


math.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC/GEOS
 * FILE:	math.goh
 * AUTHOR:	Anna Lijphart: January, 1992
 *
 * DESCRIPTION:
 *	C version of math.def.
 *
 *	$Id: math.goh,v 1.12.6.1 96/04/28 08:28:35 chris Exp $
 *
 ***********************************************************************/

#ifndef	__MATH_GOH
#define __MATH_GOH

#include  <geos.h>
#include  <math.h>

@deflib math

@class	FloatFormatClass, GenControlClass;

/****************************************************
         Instance Data
*****************************************************/

@instance word formatInfoStrucHan = 0;

/****************************************************
         Internal Messages
*****************************************************/

@message void MSG_FC_REQUEST_MONIKER ();
@message void MSG_FORMAT_OPTION_STYLE_CHANGE ();
@message void MSG_FORMAT_OPTION_BOOLEAN_CHANGE ();
@message void MSG_FORMAT_SELECTED ();
@message void MSG_FORMAT_USER_DEF_INVOKE ();
@message void MSG_FORMAT_UPDATE_USER_DEF_SAMPLES ();
@message void MSG_FORMAT_USER_DEF_OK ();
@message void MSG_FORMAT_DELETE ();
@message void MSG_FORMAT_APPLY ();
@message void MSG_FORMAT_NUM_DECIMALS ();
@message void MSG_FORMAT_DECIMAL_OFFSET ();
@message void MSG_FORMAT_USER_DEF_CANCEL ();

/*
 * The notification data block for use with GWNT_FORMAT_CHANGE.
 */
typedef struct {
    VMFileHandle	NFFC_vmFileHan;
    VMBlockHandle	NFFC_vmBlkHan;
    FormatIdType	NFFC_format;
    word		NFFC_count;
} NotifyFloatFormatChange} ;

/****************************************************
         Variable data
*****************************************************/
@vardata void TEMP_FLOAT_CTRL_USER_DEFINE_ACTIVE;
/* internally used to indicate user format definition is in progress */

/****************************************************
         Meta Messages
*****************************************************/

@importMessage MetaFloatMessages, void MSG_FLOAT_CTRL_REQUEST_MONIKER (
                           MemHandle formatInfoStrucHan = cx);
@importMessage MetaFloatMessages, void MSG_FLOAT_CTRL_UPDATE_UI (
                           MemHandle formatInfoStrucHan = cx);
@importMessage MetaFloatMessages, void MSG_FLOAT_CTRL_FORMAT_SELECTED (
                           MemHandle formatInfoStrucHan = cx);
@importMessage MetaFloatMessages, void MSG_FLOAT_CTRL_USER_DEF_INVOKE (
                           MemHandle formatInfoStrucHan = cx);
@importMessage MetaFloatMessages, void MSG_FLOAT_CTRL_USER_DEF_OK (
                           MemHandle formatInfoStrucHan = cx);
@importMessage MetaFloatMessages, void MSG_FLOAT_CTRL_FORMAT_DELETE (
                           MemHandle formatInfoStrucHan = cx);
@importMessage MetaFloatMessages, void MSG_FLOAT_CTRL_REPLACE_NUM_FORMAT (
                           MemHandle formatInfoStrucHan = cx);
@importMessage MetaFloatMessages, void MSG_FLOAT_CTRL_FORMAT_APPLY (
                           MemHandle formatInfoStrucHan = cx);

@default GCI_output = (TO_APP_TARGET);

@endc

/********************************************************
          float format utility routines
*********************************************************/

extern VMBlockHandle _pascal FloatFormatInit (word userDefVMFileHan);

extern word _pascal
    FloatFormatGetFormatParamsWithListEntry    (FormatInfoStruc *formatInfoStruc);

extern void _pascal FloatFormatInitFormatList (FormatInfoStruc *formatInfoStruc);

extern void _pascal
    FloatFormatProcessFormatSelected    (FormatInfoStruc *formatInfoStruc);

extern void _pascal
    FloatFormatInvokeUserDefDB    (FormatInfoStruc *formatInfoStruc);

extern word _pascal FloatFormatUserDefOK (FormatInfoStruc *formatInfoStruc);

extern word _pascal
    FloatFormatGetFormatTokenWithName    (FormatInfoStruc *formatInfoStruc);

extern void _pascal
    FloatFormatGetFormatParamsWithToken    (FormatInfoStruc *formatInfoStruc,
                    FormatParams *buffer);

extern FormatIdType _pascal FloatFormatDelete (FormatInfoStruc *formatInfoStruc);

extern void _pascal FloatFormatIsFormatTheSame (FormatInfoStruc *formatInfoStruc,
                           FormatParams *formatParams);

extern word _pascal FloatFormatAddFormat (FormatInfoStruc *formatInfoStruc,
                     FormatParams *formatParams,
                     word formatToken);

#ifdef __HIGHC__
pragma Alias(FloatFormatInit, "FLOATFORMATINIT");
pragma Alias(FloatFormatGetFormatParamsWithListEntry, "FLOATFORMATGETFORMATPARAMSWITHLISTENTRY");
pragma Alias(FloatFormatInitFormatList, "FLOATFORMATINITFORMATLIST");
pragma Alias(FloatFormatProcessFormatSelected, "FLOATFORMATPROCESSFORMATSELECTED");
pragma Alias(FloatFormatInvokeUserDefDB, "FLOATFORMATINVOKEUSERDEFDB");
pragma Alias(FloatFormatUserDefOK, "FLOATFORMATUSERDEFOK");
pragma Alias(FloatFormatGetFormatTokenWithName, "FLOATFORMATGETFORMATTOKENWITHNAME");
pragma Alias(FloatFormatGetFormatParamsWithToken, "FLOATFORMATGETFORMATPARAMSWITHTOKEN");
pragma Alias(FloatFormatDelete, "FLOATFORMATDELETE");
pragma Alias(FloatFormatIsFormatTheSame, "FLOATFORMATISFORMATTHESAME");
pragma Alias(FloatFormatAddFormat, "FLOATFORMATADDFORMAT");
#endif

@endlib

#endif


math.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC/GEOS
 * FILE:	math.h
 * AUTHOR:	Anna Lijphart: January, 1992
 *
 * DESCRIPTION:
 *	C version of math.def.
 *
 *	$Id: math.h,v 1.33.4.2 96/05/09 23:22:45 jdashe Exp $
 *
 ***********************************************************************/

#ifndef	__MATH_H
#define __MATH_H

#define FPSIZE 			 	10
#define DECIMAL_EXPONENT_UPPER_LIMIT 	4932
#define DECIMAL_EXPONENT_LOWER_LIMIT 	(-4932)
#define FACTORIAL_LIMIT 			1754
#define DECIMAL_PRECISION  		18
#define SIGN_STR_LEN 	 		5
#define PAD_STR_LEN 	 		8

#define FP_DEFAULT_STACK_ELEMENTS 	25
#define FP_DEFAULT_STACK_SIZE 	(FP_DEFAULT_STACK_ELEMENTS*FPSIZE)
#define FP_MIN_STACK_ELEMENTS 	5
#define FP_MIN_STACK_SIZE    	(FP_MIN_STACK_ELEMENTS*FPSIZE)

#define	FP_NAN		    	    	0x7fff

#define MAX_DIGITS_FOR_NORMAL_NUMBERS 		DECIMAL_PRECISION
#define MAX_CHARS_FOR_COMMAS_IN_NORMAL_NUMBERS 	(DECIMAL_PRECISION / 3 + 1)
#define MAX_DIGITS_FOR_HUGE_NUMBERS 		64
#define MAX_CHARS_FOR_COMMAS_IN_HUGE_NUMBERS 	\
                (MAX_DIGITS_FOR_HUGE_NUMBERS / 3 + 1)
#define MAX_CHARS_FOR_DECIMAL_POINT 		1
#define MAX_CHARS_FOR_EXPONENT 			6
#define MAX_CHARS_FOR_PERCENATGE 		1
#define MAX_CHARS_FOR_NULL_TERM 			1

#define MAX_CHARS_FOR_FORMAT_STUFF_IN_NORMAL_NUMBERS 	 \
    (SIGN_STR_LEN * 2 + \
     PAD_STR_LEN * 2 + \
     MAX_CHARS_FOR_COMMAS_IN_NORMAL_NUMBERS + \
     MAX_CHARS_FOR_DECIMAL_POINT + \
     MAX_CHARS_FOR_EXPONENT + \
     MAX_CHARS_FOR_PERCENATGE)

#define MAX_CHARS_FOR_FORMAT_STUFF_IN_HUGE_NUMBERS 	 \
    (SIGN_STR_LEN * 2 + \
     PAD_STR_LEN * 2 + \
     MAX_CHARS_FOR_COMMAS_IN_HUGE_NUMBERS + \
     MAX_CHARS_FOR_DECIMAL_POINT + \
     MAX_CHARS_FOR_EXPONENT + \
     MAX_CHARS_FOR_PERCENATGE)

#define MAX_CHARS_FOR_NORMAL_NUMBER 	 \
    (MAX_DIGITS_FOR_NORMAL_NUMBERS + \
     DECIMAL_PRECISION + \
     MAX_CHARS_FOR_FORMAT_STUFF_IN_NORMAL_NUMBERS + \
     MAX_CHARS_FOR_NULL_TERM)

#define MAX_CHARS_FOR_HUGE_NUMBER 	\
    (MAX_DIGITS_FOR_HUGE_NUMBERS + \
     MAX_CHARS_FOR_FORMAT_STUFF_IN_HUGE_NUMBERS + \
     MAX_CHARS_FOR_NULL_TERM)

/******************************************************************************
;
;	NOTE!
;	For your buffers, you will need to use one of:
;	    a) FLOAT_TO_ASCII_NORMAL_BUF_LEN
;	    b) FLOAT_TO_ASCII_HUGE_BUF_LEN
;
;	The reason for having these two is as follows:
;	We normally switch formatting from fixed to scientific if the number
;	cannot fit.  Users can choose to override this automatic switching if
;	they use the FFAF_DONT_USE_SCIENTIFIC flag.  If they do this, numbers
;	will be padded with zeros on the right till the result is gotten.
;	Since the result is potentially huge, we still place a limit and
;	switch to scientific despite the request.
;
;	FLOAT_TO_ASCII_NORMAL_BUF_LEN is the size of the buffer that should be
;	passed to FloatFloatToAscii for "normal" operations.  Operations are
;	"normal" if the FFAF_DONT_USE_SCIENTIFIC flag is clear.  Operations
;	are "huge" otherwise.
;
;*****************************************************************************/

#define FLOAT_TO_ASCII_NORMAL_BUF_LEN 	\
    (((MAX_CHARS_FOR_NORMAL_NUMBER + 1) / 2) * 2)

#define FLOAT_TO_ASCII_HUGE_BUF_LEN 	\
    (((MAX_CHARS_FOR_HUGE_NUMBER + 1) / 2) * 2)

#define YEAR_LENGTH 	365
#define YEAR_MAX 	2099
#define YEAR_MIN 	1900
#define MONTH_MAX 	12
#define MONTH_MIN 	1
#define DAY_MAX 		31
#define DAY_MIN 		1

#define HOUR_MAX 	23
#define HOUR_MIN 	0
#define MINUTE_MAX 	59
#define MINUTE_MIN 	0
#define SECOND_MAX 	59
#define SECOND_MIN 	0

#define DATE_NUMBER_MIN 		1
#define DATE_NUMBER_MAX 		73049

/*
 *	FloatExponent	record
 */
typedef WordFlags FloatExponent ;
#define	FE_SIGN			0x8000
#define	FE_EXPONENT		0x7fff

typedef struct {
    word	F_mantissa_wd0;
    word	F_mantissa_wd1;
    word	F_mantissa_wd2;
    word	F_mantissa_wd3;
    FloatExponent	F_exponent;
} FloatNumStruct} ;
/*
 * This is just used for C stubs needed to have formal parameters
 * of 64 bits, the mantissa is bits 0-52 and exponent is 53-64
 */
typedef struct {
    word 	IEEE64F_word1;
    word 	IEEE64F_word2;
    word 	IEEE64F_word3;
    word 	IEEE64F_word4;
} IEEE64FloatNum} ;

#define FLOAT_EXPONENT (x) (((FloatNumStruct *)x)->F_exponent)

typedef double IEEE64Number ;
typedef long double FloatNumber ;
typedef long double FloatNum ;
/*
 *	FloatAsciiToFloatFlags	record
 */
typedef ByteFlags FloatAsciiToFloatFlags ;
#define	FAF_PUSH_RESULT			0x02
#define	FAF_STORE_NUMBER		0x01

/*
 * FloatFloatToAsciiFormatFlags	record
 */
typedef WordFlags FloatFloatToAsciiFormatFlags ;
#define	FFAF_FLOAT_RESERVED				0x8000
#define	FFAF_FROM_ADDR					0x4000
#define	FFAF_DONT_USE_SCIENTIFIC			0x0200
#define	FFAF_SCIENTIFIC					0x0100
#define	FFAF_PERCENT					0x0080
#define	FFAF_USE_COMMAS					0x0040
#define	FFAF_NO_TRAIL_ZEROS				0x0020
#define	FFAF_NO_LEAD_ZERO				0x0010
#define	FFAF_HEADER_PRESENT				0x0008
#define	FFAF_TRAILER_PRESENT				0x0004
#define	FFAF_SIGN_CHAR_TO_FOLLOW_HEADER			0x0002
#define	FFAF_SIGN_CHAR_TO_PRECEDE_TRAILER		0x0001

typedef	struct {
    FloatFloatToAsciiFormatFlags	formatFlags;
    byte	decimalOffset;
    byte	totalDigits;
    byte	decimalLimit;
#ifdef DO_DBCS
    wchar	preNegative[SIGN_STR_LEN+1];
    wchar	postNegative[SIGN_STR_LEN+1];
    wchar	prePositive[SIGN_STR_LEN+1];
    wchar	postPositive[SIGN_STR_LEN+1];
    wchar	header[PAD_STR_LEN+1];
    wchar	trailer[PAD_STR_LEN+1];
#else
    char	preNegative[SIGN_STR_LEN+1];
    char	postNegative[SIGN_STR_LEN+1];
    char	prePositive[SIGN_STR_LEN+1];
    char	postPositive[SIGN_STR_LEN+1];
    char	header[PAD_STR_LEN+1];
    char	trailer[PAD_STR_LEN+1];
#endif
    byte	FFTAP_unused;
} FloatFloatToAsciiParams} ;

typedef struct {
    FloatFloatToAsciiParams	FFA_params;
    word			FFA_startNumber;
    word			FFA_decimalPoint;
    word			FFA_endNumber;
    word			FFA_numChars;
    word			FFA_startExponent;
    word			FFA_bufSize;
    word			FFA_saveDI;
    word			FFA_numSign;
    byte			FFA_startSigCount;
    byte			FFA_sigCount;
    byte			FFA_noMoreSigInfo;
    byte			FFA_startDecCount;
    byte			FFA_decCount;
    word			FFA_decExponent;
    word			FFA_curExponent;
    byte			FFA_useCommas;
    byte			FFA_charsToComma;
#ifdef DO_DBCS
    wchar			FFA_commaChar;
    wchar			FFA_decimalChar;
#else
    char			FFA_commaChar;
    char			FFA_decimalChar;
#endif
} FloatFloatToAsciiData} ;

/*
 *	FloatFloatToDateTimeFlags	record
 */
typedef WordFlags FloatFloatToDateTimeFlags ;
#define	FFDT_DATE_TIME_OP		0x8000
#define	FFDT_FROM_ADDR			0x4000
#define	FFDT_FORMAT			0x3fff

typedef	struct {
    FloatFloatToDateTimeFlags	FFA_dateTimeFlags;
    word	FFA_year;
    byte	FFA_month;
    byte	FFA_day;
    byte	FFA_weekday;
    byte	FFA_hours;
    byte	FFA_minutes;
    byte	FFA_seconds;
} FloatFloatToDateTimeParams} ;

typedef struct {
    FloatFloatToDateTimeParams	FFA_dateTimeParams;
} FloatFloatToDateTimeData} ;

typedef union {
    FloatFloatToAsciiData	FFA_float;
    FloatFloatToDateTimeData	FFA_dateTime;
} FFA_stackFrame} ;

typedef union {
    FloatFloatToAsciiParams		FFAP_FLOAT;
    FloatFloatToDateTimeParams	FFAP_DATE_TIME;
} FloatFloatToAsciiParams_Union} ;

/*
 *	RandomGenInitFlags	record
 */
typedef ByteFlags RandomGenInitFlags ;
#define	RGIF_USE_SEED			0x80
#define	RGIF_GENERATE_SEED		0x40

#define	FLOAT_ERROR_CODES_ENUM_START		250

typedef ByteEnum FloatErrorType ;
#define FLOAT_POS_INFINITY    FLOAT_ERROR_CODES_ENUM_START
#define FLOAT_NEG_INFINITY  1
#define FLOAT_GEN_ERR  2

typedef ByteEnum    FloatStackType    ;
#define FLOAT_STACK_GROW  0
#define FLOAT_STACK_WRAP  1
#define FLOAT_STACK_ERROR  2

/****************************************************
         Format and Format Controller related
*****************************************************/

#define	MAX_FORMATS			10
#define	NUM_NUMBER_FORMATS		12
#define	NUM_DATE_TIME_FORMATS		19
#define	NUM_PRE_DEF_FORMATS		31
#define	FORMAT_NAME_LENGTH		40
#define	FORMAT_ID_PREDEF		0x8000
#define	FORMAT_ARRAY_HDR_SIG		(('y' << 8) | 'c')
#define	FORMAT_ENTRY_SIG		(('t' << 8) | 'c')
#define	FORMAT_PARAMS_ID		0x63
#define	FORMAT_INFO_STRUC_ID		(('y' << 8) | 'c')

typedef struct {
    word	FAH_signature;
    word	FAH_numFormatEntries;
    word	FAH_numUserDefEntries;
    word	FAH_formatArrayEnd;
} FormatArrayHeader} ;

/*
 * WARNING!  If you change the size of the FormatParams typedef,
 * be sure to update the enum values in the FormatIdType declaration
 * below.
 */
typedef struct {
    FloatFloatToAsciiParams_Union	FP_params;
#ifdef DO_DBCS
    wchar	FP_formatName[FORMAT_NAME_LENGTH+1];
#else
    char	FP_formatName[FORMAT_NAME_LENGTH+1];
#endif
    word	FP_nameHan;
    word	FP_nameOff;
    word	FP_listEntryNum;
    word	FP_signature;
} FormatParams} ;

typedef struct {
    FormatParams FE_params;
    word	FE_listEntryNumber;
    byte	FE_used;
    word	FE_sig;
} FormatEntry} ;

typedef struct {
    word	FIS_signature;
    FileHandle	FIS_userDefFmtArrayFileHan;
    VMBlockHandle FIS_userDefFmtArrayBlkHan;
    word	FIS_childBlk;
    word	FIS_chooseFmtListChunk;
    word	FIS_features;
    byte	FIS_editFlag;
    word	FIS_curSelection;
    word	FIS_curToken;
    FormatParams FIS_curParams;
} FormatInfoStruc} ;

#ifdef DO_DBCS
typedef enum {
    FORMAT_ID_GENERAL    	    	    	    = 0x8000,
    FORMAT_ID_FIXED    		    	    = 0x80b4,
    FORMAT_ID_FIXED_WITH_COMMAS    	    	    = 0x8168,
    FORMAT_ID_FIXED_INTEGER    	    	    = 0x821c,
    FORMAT_ID_CURRENCY    		    	    = 0x82d0,
    FORMAT_ID_CURRENCY_WITH_COMMAS     	    = 0x8384,
    FORMAT_ID_CURRENCY_INTEGER      	    = 0x8438,
    FORMAT_ID_PERCENTAGE     	    	    = 0x84ec,
    FORMAT_ID_PERCENTAGE_INTEGER     	    = 0x85a0,
    FORMAT_ID_THOUSANDS     	    	    = 0x8654,
    FORMAT_ID_MILLIONS      	    	    = 0x8708,
    FORMAT_ID_SCIENTIFIC     	    	    = 0x87bc,

    FORMAT_ID_DATE_LONG     	    	    = 0x8870,
    FORMAT_ID_DATE_LONG_CONDENSED     	    = 0x8924,
    FORMAT_ID_DATE_LONG_NO_WKDAY     	    = 0x89d8,
    FORMAT_ID_DATE_LONG_NO_WKDAY_CONDENSED      = 0x8a8c,
    FORMAT_ID_DATE_SHORT     	    	    = 0x8b40,
    FORMAT_ID_DATE_SHORT_ZERO_PADDED            = 0x8bf4,
    FORMAT_ID_DATE_LONG_MD     	    	    = 0x8ca8,
    FORMAT_ID_DATE_LONG_MD_NO_WKDAY             = 0x8d5c,
    FORMAT_ID_DATE_SHORT_MD         	    = 0x8e10,
    FORMAT_ID_DATE_LONG_MY     	    	    = 0x8ec4,
    FORMAT_ID_DATE_SHORT_MY         	    = 0x8f78,
    FORMAT_ID_DATE_YEAR     	    	    = 0x902c,
    FORMAT_ID_DATE_MONTH     	    	    = 0x90e0,
    FORMAT_ID_DATE_DAY      	    	    = 0x9194,
    FORMAT_ID_DATE_WEEKDAY     	    	    = 0x9248,

    FORMAT_ID_TIME_HMS    			    = 0x92fc,
    FORMAT_ID_TIME_HM    			    = 0x93b0,
    FORMAT_ID_TIME_H    			    = 0x9464,
    FORMAT_ID_TIME_MS    			    = 0x9518,
    FORMAT_ID_TIME_HMS_24HR    		    = 0x95cc,
    FORMAT_ID_TIME_HM_24HR    		    = 0x9680,

    FORMAT_ID_INDETERMINATE         	    = 0xffff
} FormatIdType} ;
#else
typedef enum {
    FORMAT_ID_GENERAL    	    	    	    = 0x8000,
    FORMAT_ID_FIXED    		    	    = 0x8061,
    FORMAT_ID_FIXED_WITH_COMMAS    	    	    = 0x80c2,
    FORMAT_ID_FIXED_INTEGER    	    	    = 0x8123,
    FORMAT_ID_CURRENCY    		    	    = 0x8184,
    FORMAT_ID_CURRENCY_WITH_COMMAS     	    = 0x81e5,
    FORMAT_ID_CURRENCY_INTEGER      	    = 0x8246,
    FORMAT_ID_PERCENTAGE     	    	    = 0x82a7,
    FORMAT_ID_PERCENTAGE_INTEGER     	    = 0x8308,
    FORMAT_ID_THOUSANDS     	    	    = 0x8369,
    FORMAT_ID_MILLIONS      	    	    = 0x83ca,
    FORMAT_ID_SCIENTIFIC     	    	    = 0x842b,

    FORMAT_ID_DATE_LONG     	    	    = 0x848c,
    FORMAT_ID_DATE_LONG_CONDENSED     	    = 0x84ed,
    FORMAT_ID_DATE_LONG_NO_WKDAY     	    = 0x854e,
    FORMAT_ID_DATE_LONG_NO_WKDAY_CONDENSED      = 0x85af,
    FORMAT_ID_DATE_SHORT     	    	    = 0x8610,
    FORMAT_ID_DATE_SHORT_ZERO_PADDED            = 0x8671,
    FORMAT_ID_DATE_LONG_MD     	    	    = 0x86d2,
    FORMAT_ID_DATE_LONG_MD_NO_WKDAY             = 0x8733,
    FORMAT_ID_DATE_SHORT_MD         	    = 0x8794,
    FORMAT_ID_DATE_LONG_MY     	    	    = 0x87f5,
    FORMAT_ID_DATE_SHORT_MY         	    = 0x8856,
    FORMAT_ID_DATE_YEAR     	    	    = 0x88b7,
    FORMAT_ID_DATE_MONTH     	    	    = 0x8918,
    FORMAT_ID_DATE_DAY      	    	    = 0x8979,
    FORMAT_ID_DATE_WEEKDAY     	    	    = 0x89da,

    FORMAT_ID_TIME_HMS    			    = 0x8a3b,
    FORMAT_ID_TIME_HM    			    = 0x8a9c,
    FORMAT_ID_TIME_H    			    = 0x8afd,
    FORMAT_ID_TIME_MS    			    = 0x8b5e,
    FORMAT_ID_TIME_HMS_24HR    		    = 0x8bbf,
    FORMAT_ID_TIME_HM_24HR    		    = 0x8c20,

    FORMAT_ID_INDETERMINATE         	    = 0xffff
} FormatIdType} ;
#endif

typedef ByteEnum SpreadsheetFormatError ;
#define FLOAT_FORMAT_NO_ERROR 			0
#define FLOAT_FORMAT_TOO_MANY_FORMATS 		1
#define FLOAT_FORMAT_CANNOT_ALLOC 		2

#define	FLOAT_FORMAT_FORMAT_NAME_NOT_FOUND		0x7fff
#define	FLOAT_FORMAT_PARAMS_MATCH			TRUE
#define	FLOAT_FORMAT_PARAMS_DONT_MATCH			FALSE

/****************************************************
         Initialization and shutdown routines
*****************************************************/
extern void _pascal FloatInit (word stackSize, FloatStackType stackType);
extern void _pascal FloatExit (void);

/*****************************************************
      comparison routines
******************************************************/
extern word _pascal FloatComp (void);
extern word _pascal FloatCompAndDrop (void);
extern word _pascal FloatCompESDI (FloatNum *);
extern word _pascal FloatEq0 (void);
extern word _pascal FloatLt0 (void);
extern word _pascal FloatGt0 (void);

/****************************************************
          stack manipulation routines
*****************************************************/
extern word _pascal FloatPushNumber (FloatNum *number);
extern word _pascal FloatPopNumber (FloatNum *number);
extern void _pascal FloatRoll (word num);
extern void _pascal FloatRollDown (word num);
extern void _pascal FloatPick (word num);
extern void _pascal FloatSwap (void);
extern void _pascal FloatOver (void);
extern void _pascal FloatSetStackPointer (word newValue);
extern int _pascal FloatGetStackPointer (void);

/***************************************************************
  conversion routines to and from different formats of numbers

  Geos80 : same as standard IEEE 80 bit format floatint point
  Float  : same as Geos80
  IEEE64 : standard 64 bit format floating point
  IEEE32 : standard 32 bit format floating point
  Dword  : 64 bit signed integer
  Word   : 32 bit signed integer
  (to go from FloatToWord just use FloatToDword and take low 32 bits)
****************************************************************/
extern void _pascal FloatGeos80ToIEEE64 (double *num);
extern void _pascal FloatGeos80ToIEEE32 (float *num);
extern void _pascal FloatIEEE64ToGeos80 (double *num);
extern void _pascal FloatIEEE32ToGeos80 (float *num);
extern void _pascal FloatDwordToFloat (long num);
extern void _pascal FloatWordToFloat (word num);
extern long _pascal FloatFloatToDword (void);

/******************************************************
          useful constants
*******************************************************/
extern void _pascal Float0 (void);
extern void _pascal Float1 (void);
extern void _pascal FloatMinus1 (void);
extern void _pascal FloatMinusPoint5 (void);
extern void _pascal FloatPoint5 (void);
extern void _pascal Float2 (void);
extern void _pascal Float5 (void);
extern void _pascal Float10 (void);
extern void _pascal Float3600 (void);
extern void _pascal Float16384 (void);
extern void _pascal Float86400 (void);
extern void _pascal FloatPi (void);
extern void _pascal FloatPiDiv2 (void);

/********************************************************
          miscellaneous math routines
*********************************************************/
extern void _pascal FloatAbs (void);
extern void _pascal FloatAdd (void);
extern void _pascal FloatArcCos (void);
extern void _pascal FloatArcCosh (void);
extern void _pascal FloatArcSin (void);
extern void _pascal FloatArcSinh (void);
extern void _pascal FloatArcTan (void);
extern void _pascal FloatArcTan2 (void);
extern void _pascal FloatArcTanh (void);
extern void _pascal FloatCos (void);
extern void _pascal FloatCosh (void);
extern word _pascal FloatDepth (void);
extern void _pascal FloatDIV (void);
extern void _pascal FloatDivide (void);
extern void _pascal FloatDivide2 (void);
extern void _pascal FloatDivide10 (void);
extern void _pascal FloatDrop (void);
extern void _pascal FloatDup (void);
extern void _pascal FloatExp (void);
extern void _pascal FloatExponential (void);
extern void _pascal FloatFactorial (void);
extern void _pascal FloatFrac (void);
extern void _pascal FloatInt (void);
extern void _pascal FloatIntFrac (void);
extern void _pascal FloatInverse (void);
extern void _pascal FloatLg (void);
extern void _pascal FloatLg10 (void);
extern void _pascal FloatLn (void);
extern void _pascal FloatLn1plusX (void);
extern void _pascal FloatLn2 (void);
extern void _pascal FloatLn10 (void);
extern void _pascal FloatLog (void);
extern void _pascal FloatMax (void);
extern void _pascal FloatMin (void);
extern void _pascal FloatMod (void);
extern void _pascal FloatMultiply (void);
extern void _pascal FloatMultiply2 (void);
extern void _pascal FloatMultiply10 (void);
extern void _pascal FloatNegate (void);
extern void _pascal FloatRandom (void);
extern void _pascal FloatRandomize (RandomGenInitFlags rgiflag, dword seed);
extern void _pascal FloatRandomN (void);
extern void _pascal FloatRot (void);
extern void _pascal FloatRound (byte numDecimalPlaces);
extern void _pascal FloatSin (void);
extern void _pascal FloatSinh (void);
extern void _pascal FloatSqr (void);
extern void _pascal FloatSqrt (void);
extern void _pascal FloatSqrt2 (void);
extern void _pascal FloatSub (void);
extern void _pascal FloatTan (void);
extern void _pascal FloatTanh (void);
extern void _pascal Float10ToTheX (void);
extern void _pascal FloatTrunc (void);
extern void _pascal FloatEpsilon  (void);

/********************************************************
          number string routines
*********************************************************/
extern Boolean 	/* XXX */
    _pascal FloatAsciiToFloat (word floatAtoFflags, word stringLength,
                void *string, void *resultLocation);

/******************************************************************************
;
;	NOTE!
;	For your buffers, you will need to use one of:
;	    a) FLOAT_TO_ASCII_NORMAL_BUF_LEN
;	    b) FLOAT_TO_ASCII_HUGE_BUF_LEN
;
;	The reason for having these two is as follows:
;	We normally switch formatting from fixed to scientific if the number
;	cannot fit.  Users can choose to override this automatic switching if
;	they use the FFAF_DONT_USE_SCIENTIFIC flag.  If they do this, numbers
;	will be padded with zeros on the right till the result is gotten.
;	Since the result is potentially huge, we still place a limit and
;	switch to scientific despite the request.
;
;	FLOAT_TO_ASCII_NORMAL_BUF_LEN is the size of the buffer that should be
;	passed to FloatFloatToAscii for "normal" operations.  Operations are
;	"normal" if the FFAF_DONT_USE_SCIENTIFIC flag is clear.  Operations
;	are "huge" otherwise.
;
;*****************************************************************************/
extern word /* XXX */
    _pascal FloatFloatToAscii_StdFormat (char *string, FloatNum *number,
                FloatFloatToAsciiFormatFlags format,
                word numDigits, word numFractionalDigits);
extern word /* XXX */
    _pascal FloatFloatToAscii (FFA_stackFrame *stackFrame, char *resultString,
                FloatNum *number);

extern word /* XXX */
    _pascal FloatFloatIEEE64ToAscii_StdFormat (char *string, IEEE64FloatNum number,
                FloatFloatToAsciiFormatFlags format,
                word numDigits, word numFractionalDigits);

extern void _pascal FloatTimeNumberGetSeconds (void);
extern word	/*XXX*/
    _pascal FloatStringGetDateNumber (char *dateString);
extern word	/*XXX*/
    _pascal FloatStringGetTimeNumber (char *timeString);
extern byte _pascal FloatGetDaysInMonth (word year, byte month);
extern void _pascal FloatTimeNumberGetMinutes (void);
extern void _pascal FloatTimeNumberGetHour (void);
extern FloatErrorType _pascal FloatGetDateNumber (word year, byte month, byte day);
extern FloatErrorType
        _pascal FloatGetTimeNumber (byte hours, byte minutes, byte seconds);
extern void _pascal FloatDateNumberGetWeekday (void);
extern word _pascal FloatDateNumberGetYear (void);
extern void _pascal FloatDateNumberGetMonthAndDay (byte *month, byte *day);
extern word _pascal FloatGetNumDigitsInIntegerPart (void);

extern void _pascal FloatFormatNumber (FormatIdType formatToken,
                      word userDefBlkHan,
                      word userDefFileHan,
                      FloatNum *floatNum,
                      char *resultLocation);

#ifdef __HIGHC__
pragma Alias(Float0, "FLOAT0");
pragma Alias(Float1, "FLOAT1");
pragma Alias(FloatAsciiToFloat, "FLOATASCIITOFLOAT");
pragma Alias(FloatComp, "FLOATCOMP");
pragma Alias(FloatCompAndDrop, "FLOATCOMPANDDROP");
pragma Alias(FloatCompESDI, "FLOATCOMPESDI");
pragma Alias(FloatEq0, "FLOATEQ0");
pragma Alias(FloatExit, "FLOATEXIT");
pragma Alias(FloatFloatIEEE64ToAscii_StdFormat,
         "FLOATFLOATIEEE64TOASCII_STDFORMAT");
pragma Alias(FloatFloatToAscii, "FLOATFLOATTOASCII");
pragma Alias(FloatFloatToAscii_StdFormat, "FLOATFLOATTOASCII_STDFORMAT");
pragma Alias(FloatInit, "FLOATINIT");
pragma Alias(FloatPopNumber, "FLOATPOPNUMBER");
pragma Alias(FloatPushNumber, "FLOATPUSHNUMBER");
pragma Alias(FloatRound, "FLOATROUND");
pragma Alias(FloatStringGetDateNumber, "FLOATSTRINGGETDATENUMBER");
pragma Alias(FloatStringGetTimeNumber, "FLOATSTRINGGETTIMENUMBER");
pragma Alias(FloatMinus1, "FLOATMINUS1");
pragma Alias(FloatMinusPoint5, "FLOATMINUSPOINT5");
pragma Alias(FloatPoint5, "FLOATPOINT5");
pragma Alias(Float2, "FLOAT2");
pragma Alias(Float5, "FLOAT5");
pragma Alias(Float10, "FLOAT10");
pragma Alias(Float3600, "FLOAT3600");
pragma Alias(Float16384, "FLOAT16384");
pragma Alias(Float86400, "FLOAT86400");
pragma Alias(FloatAbs, "FLOATABS");
pragma Alias(FloatAdd, "FLOATADD");
pragma Alias(FloatArcCos, "FLOATARCCOS");
pragma Alias(FloatArcCosh, "FLOATARCCOSH");
pragma Alias(FloatArcSin, "FLOATARCSIN");
pragma Alias(FloatArcSinh, "FLOATARCSINH");
pragma Alias(FloatArcTan, "FLOATARCTAN");
pragma Alias(FloatArcTan2, "FLOATARCTAN2");
pragma Alias(FloatArcTanh, "FLOATARCTANH");
pragma Alias(FloatCos, "FLOATCOS");
pragma Alias(FloatCosh, "FLOATCOSH");
pragma Alias(FloatDepth, "FLOATDEPTH");
pragma Alias(FloatDIV, "FLOATDIV");
pragma Alias(FloatDivide, "FLOATDIVIDE");
pragma Alias(FloatDivide2, "FLOATDIVIDE2");
pragma Alias(FloatDivide10, "FLOATDIVIDE10");
pragma Alias(FloatDwordToFloat, "FLOATDWORDTOFLOAT");
pragma Alias(FloatWordToFloat, "FLOATWORDTOFLOAT");
pragma Alias(FloatFloatToDword, "FLOATFLOATTODWORD");
pragma Alias(FloatDrop, "FLOATDROP");
pragma Alias(FloatDup, "FLOATDUP");
pragma Alias(FloatEpsilon, "FLOATEPSILON");
pragma Alias(FloatExp, "FLOATEXP");
pragma Alias(FloatExponential, "FLOATEXPONENTIAL");
pragma Alias(FloatFactorial, "FLOATFACTORIAL");
pragma Alias(FloatFrac, "FLOATFRAC");
pragma Alias(FloatGeos80ToIEEE64, "FLOATGEOS80TOIEEE64");
pragma Alias(FloatIEEE64ToGeos80, "FLOATIEEE64TOGEOS80");
pragma Alias(FloatGeos80ToIEEE32, "FLOATGEOS80TOIEEE32");
pragma Alias(FloatIEEE32ToGeos80, "FLOATIEEE32TOGEOS80");
pragma Alias(FloatInt, "FLOATINT");
pragma Alias(FloatIntFrac, "FLOATINTFRAC");
pragma Alias(FloatInverse, "FLOATINVERSE");
pragma Alias(FloatLg, "FLOATLG");
pragma Alias(FloatLg10, "FLOATLG10");
pragma Alias(FloatLn, "FLOATLN");
pragma Alias(FloatLn1plusX, "FLOATLN1PLUSX");
pragma Alias(FloatLn2, "FLOATLN2");
pragma Alias(FloatLn10, "FLOATLN10");
pragma Alias(FloatLog, "FLOATLOG");
pragma Alias(FloatMax, "FLOATMAX");
pragma Alias(FloatMin, "FLOATMIN");
pragma Alias(FloatMod, "FLOATMOD");
pragma Alias(FloatMultiply, "FLOATMULTIPLY");
pragma Alias(FloatMultiply2, "FLOATMULTIPLY2");
pragma Alias(FloatMultiply10, "FLOATMULTIPLY10");
pragma Alias(FloatNegate, "FLOATNEGATE");
pragma Alias(FloatOver, "FLOATOVER");
pragma Alias(FloatPi, "FLOATPI");
pragma Alias(FloatPiDiv2, "FLOATPIDIV2");
pragma Alias(FloatPick, "FLOATPICK");
pragma Alias(FloatRandom, "FLOATRANDOM");
pragma Alias(FloatRandomize, "FLOATRANDOMIZE");
pragma Alias(FloatRot, "FLOATROT");
pragma Alias(FloatSin, "FLOATSIN");
pragma Alias(FloatSinh, "FLOATSINH");
pragma Alias(FloatSqr, "FLOATSQR");
pragma Alias(FloatSqrt, "FLOATSQRT");
pragma Alias(FloatSqrt2, "FLOATSQRT2");
pragma Alias(FloatSub, "FLOATSUB");
pragma Alias(FloatSwap, "FLOATSWAP");
pragma Alias(FloatTan, "FLOATTAN");
pragma Alias(FloatTanh, "FLOATTANH");
pragma Alias(Float10ToTheX, "FLOAT10TOTHEX");
pragma Alias(FloatTrunc, "FLOATTRUNC");
pragma Alias(FloatGetStackPointer, "FLOATGETSTACKPOINTER");
pragma Alias(FloatGetDaysInMonth, "FLOATGETDAYSINMONTH");
pragma Alias(FloatTimeNumberGetHour, "FLOATTIMENUMBERGETHOUR");
pragma Alias(FloatTimeNumberGetMinutes, "FLOATTIMENUMBERGETMINUTES");
pragma Alias(FloatTimeNumberGetSeconds, "FLOATTIMENUMBERGETSECONDS");
pragma Alias(FloatGetDateNumber, "FLOATGETDATENUMBER");
pragma Alias(FloatGetTimeNumber, "FLOATGETTIMENUMBER");
pragma Alias(FloatDateNumberGetYear, "FLOATDATENUMBERGETYEAR");
pragma Alias(FloatDateNumberGetWeekday, "FLOATDATENUMBERGETWEEKDAY");
pragma Alias(FloatDateNumberGetMonthAndDay, "FLOAATDATENUMBERGETMONTHANDDAY");
pragma Alias(FloatGt0, "FLOATGT0");
pragma Alias(FloatLt0, "FLOATLT0");
pragma Alias(FloatSetStackPointer, "FLOATSETSTACKPOINTER");
pragma Alias(FloatRoll, "FLOATROLL");
pragma Alias(FloatRollDown, "FLOATROLLDOWN");
pragma Alias(FloatGetNumDigitsInIntegerPart, "FLOATGETNUMDIGITSININTEGERPART");
pragma Alias(FloatRandomN, "FLOATRANDOMN");
/******************
pragma Alias(FloatGenerateFormatStr, "FLOATGENERATEFORMATSTR");
******************/
pragma Alias(FloatFormatNumber, "FLOATFORMATNUMBER");

#undef abs
#undef labs
extern int _pascal abs (int __i);
extern long   _pascal labs (long);
#define abs (i) (_abs(i))
#define labs (i) (_abs(i))

#endif

typedef struct {double x, y;} complex;} ;

extern double _pascal cabs (complex __c);   /* non-ansi versions of cabs  and hypot */
extern double _pascal hypot (double __x, double __y);
extern double _pascal atof (const char *);
extern double _pascal sin (double __x);
extern double _pascal cos (double __x);
extern double _pascal asin (double __x);
extern double _pascal acos (double __x);
extern double _pascal tan (double __x);
extern double _pascal atan (double __x);
extern double _pascal sinh (double __x);
extern double _pascal cosh (double __x);
extern double _pascal tanh (double __x);
extern double _pascal asinh (double __x);
extern double _pascal acosh (double __x);
extern double _pascal atanh (double __x);
extern double _pascal sqrt (double __x);

#endif


Internal\mboxInt.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1995 -- All Rights Reserved
 *
 * PROJECT:
 * MODULE:
 * FILE:	  mboxInt.goh
 *
 * AUTHOR:  	  Adam de Boor: Jan 13, 1995
 *
 * REVISION HISTORY:
 *	Name	  Date	    Description
 *	----	  ----	    -----------
 *	ardeb	  1/13/95    Initial version
 *
 * DESCRIPTION:
 *	Internal mailbox definitions for use by transport and storage
 *	drivers.
 *
 *
 * 	$Id: mboxInt.goh,v 1.14.1.1 96/04/28 08:32:43 chris Exp $
 *
 ***********************************************************************/

@deflib mailbox

@class  MailboxAddressControlClass, GenControlClass;

typedef struct {
    MediumType		MACSMA_medium;
    MailboxTransportOption	MACSMA_transOption;
    Boolean			MACSMA_changed;
} MACSetMediumArgs} ;

@message void MSG_MAILBOX_ADDRESS_CONTROL_SET_MEDIUM
                (MACSetMediumArgs *args = ss:bp);

@message ChunkHandle MSG_MAILBOX_ADDRESS_CONTROL_GET_ADDRESSES
                (dword transData = cx:dx) = ax;

/* MBACAddress */
typedef struct {
    word			MBACA_opaqueSize;
 /* label byte			MBACA_opaque; */
} MBACAddress} ;

/*
 * Sets the addresses for the message, wiping out any other addresses the
 * controller might have on record for the message.
 */
@message void MSG_MAILBOX_ADDRESS_CONTROL_SET_ADDRESSES (optr addr = cx:dx);

@message dword MSG_MAILBOX_ADDRESS_CONTROL_GET_TRANS_DATA () = dx:ax;

@message void MSG_MAILBOX_ADDRESS_CONTROL_MESSAGE_CANCELED (dword transData = cx:dx);

@message void MSG_MAILBOX_ADDRESS_CONTROL_TWEAK_PARAMS
                 (MailboxRegisterMessageArgs *mrmArgs = cx:dx);

@message void MSG_MAILBOX_ADDRESS_CONTROL_ADD_REF ();

@message void MSG_MAILBOX_ADDRESS_CONTROL_DEL_REF ();

@message void MSG_MAILBOX_ADDRESS_CONTROL_SET_VALID_STATE (Boolean valid = cx);

@message Boolean MSG_MAILBOX_ADDRESS_CONTROL_CREATE_MESSAGE
                  (Boolean *reentrantPtr = multipleax,
                 MailboxObjectType objType = cx,
                 optr mscTransaction = dx:bp) = carry;

@message optr MSG_MAILBOX_ADDRESS_CONTROL_GET_TRANSMIT_MONIKER () = cx:dx;

@message void MSG_MAILBOX_ADDRESS_CONTROL_SET_VALID_ACTION
                 (optr notifOD = cx:dx,	Message mesg = bp);

@message void MSG_MAILBOX_ADDRESS_CONTROL_SET_TRANSPORT_DRIVER
                     (GeodeHandle driverHandle = cx);

/*
 *  Process the block of data stored under a HINT_MAILBOX_SEND_CONTROL_TRANS-
 *  PORT_DATA on the MailboxSendControl. The data in the body of the hint are
 *  completely under the address control's interpretation.
 *
 *  Context:	Called by MailboxSendControl when the transport has been
 * 		selected before the address control is set usable.
 *  Source:	MailboxSendControl
 *  Destination:  MailboxAddressControl subclass
 *  Interception: must be intercepted to be useful. Warning will result if
 * 		control reaches MailboxAddressControl, as it implies that
 * 		the programmer has specified data for a transport that
 * 		doesn't know what to do with them.
 *
 *  Pass:
 * 		cx:dx	= pointer to data following the MailboxTransportAnd-
 *			  Option token stored at the start of the hint.
 * 		bp	= handle of block holding the hint, in case it contains
 * 			  things that need to be relocated with ObjDoRelocation
 *  Return:
 * 		nothing
 * 		ax, cx, dx, bp - destroyed
 */
@message void MSG_MAILBOX_ADDRESS_CONTROL_PROCESS_TRANSPORT_HINT
             (const void *data = cx:dx, MemHandle hintBlock = bp);

/*
 * Note that a message has been successfully registered.
 *
 * Context:	Called once MailboxRegisterMessage has been successfully called,
 *		to allow the address control to clean up after itself, if
 *		it needs to.
 * Source:	MailboxSendDialogClass
 * Destination:  subclass of MailboxAddressControl
 * Interception: MailboxAddressControl method does nothing
 *
 * Pass:
 *		cxdx	= transData
 *		bp	= transaction chunk
 * Return:
 *		nothing
 *		ax, cx, dx, bp - destroyed
 */
@message void MSG_MAILBOX_ADDRESS_CONTROL_MESSAGE_REGISTERED
        (dword transData = cx:dx, ChunkHandle transHandle = bp);

/*
 * Check the current set of addresses and see if they are hunky-dory. This is
 * also a fine time to see if there's any point in allowing the message to
 * be created (e.g. if there's some essential system component missing that
 * needs to be installed at a service center, now would be a good time to tell
 * the user s/he's hosed).
 *
 * Context:	Called by MailboxSendDialog before calling GET_TRANS_DATA.
 *		The creation dialog remains on-screen
 * Source:	MailboxSendDialog
 * Destination:  MailboxAddressControl subclass
 * Interception: MailboxAddressControl returns carry clear. No point in calling
 *		your superclass
 *
 * Pass:
 *		nothing
 * Return:
 *		carry set if addresses not valid
 *			- this will prevent the dialog box from coming down.
 *			- address control should tell the user what is wrong
 *		carry clear if addresses are ok
 *		ax, cx, dx, bp - destroyed
 */
@message Boolean MSG_MAILBOX_ADDRESS_CONTROL_VALIDATE_ADDRESSES  () = carry;

/*
 * Take note that the body for the message is now available. This is normally
 * only of interest to transport drivers that set MBTC_NEED_MESSAGE_BODY
 *
 * Context:	Called when MSG_MAILBOX_SEND_CONTROL_REGISTER_MESSAGE
 *		has been called by whoever created the message body.
 * Source:	MailboxSendControl
 * Destination:  MailboxAddressControl subclass
 * Interception: must be subclassed to do anything
 *
 * Pass:
 *		*dx:bp	= MSCTransaction for which body is available.
 *			  MSCT_bodyFormat, MSCT_bodyStorage, and MSCT_bodyRef
 *			  are all filled in (*(dx:bp->MSCT_bodyRef) is the data
 *			  for the body reference)
 * Return:
 *		nothing
 *		ax, cx, dx, bp - destroyed
 */

@message void MSG_MAILBOX_ADDRESS_CONTROL_BODY_AVAILABLE  (MSCTransaction _near * _far *trans = dx:bp);

/* Convert the "trans" parameter for the above message into an optr */
#define MAC_TRANS_TO_OPTR (trans) (ConstructOptr(((LMemBlockHeader *)((dword)(trans)&0xffff0000L))->LMBH_handle, ((dword)(trans))&0xffff))

@message optr MSG_MAILBOX_ADDRESS_CONTROL_GET_FEEDBACK_STRING () = cx:dx;

@message optr MSG_MAILBOX_ADDRESS_CONTROL_GET_FEEDBACK_GLYPH () = cx:dx;

@message void MSG_MAILBOX_ADDRESS_CONTROL_CREATE_FEEDBACK (optr mscTransaction = dx:bp);

    @instance word MACI_refCount = 1;
    @instance optr MACI_validDest = 0;
    @instance Message MACI_validMsg = 0;
    @instance GeodeHandle MACI_driver = 0;
    @instance ChunkHandle MACI_defaultAddrs = 0;

@endc	/* MailboxAddressControlClass */

@class MailboxSpoolAddressControlClass, MailboxAddressControlClass;

@message void MSG_MSAC_PRINTING_COMPLETE  (MemHandle jobParams = cx,
                       optr printControl = dx:bp);

@message void MSG_MSAC_PRINTING_CANCELED  (optr printControl = dx:bp);

#define MSCA_FIRST_PAGE (range) (((range)>>16)&0xffff)
#define MSCA_LAST_PAGE (range) ((range)&0xffff)

@message dword MSG_MSAC_GET_PAGE_RANGE  () = cx:dx;

@message word MSG_MSAC_GET_OBJECT_TYPE  ();

/* XXX: MUST NOT DESTROY CX OR BP... */
@message void MSG_MSAC_ADJUST_ADDRESS  (MemHandle jobParams = cx);

@message PrinterDriverType MSG_MSAC_GET_DRIVER_TYPE  () = ax;

@message PrintControlAttrs MSG_MSAC_MODIFY_PRINT_CONTROL_ATTRS  (
                PrintControlAttrs attrs = cx) = cx;

@message word MSG_MSAC_GET_EXTRA_TOP_SPACE  () = dx;

@message void MSG_MSAC_ATTACH_PRINT_CONTROL  ();

    @instance optr MSACI_pc = 0;
    @instance word MSACI_pcAttrs = 0;
    @instance ChunkHandle MSACI_trans = 0;
@endc;

typedef enum {
    MPT_STRING	=0,		/* use MRP_STRING_OPTR_DATA() or
                 * MRP_STRING_HANDLE_DATA() to construct the
                 * "data" argument */
    MPT_PERCENTAGE	=2,   	/* use MRP_PERCENT_DATA() to construct the
                 * "data" argument */
    MPT_PAGES	=4, 	    	/* use MRP_PAGE_DATA() to construct the "data"
                 * argument */
     MPT_GRAPHIC 	=6,		/* Use MRP_GRAPHIC_OPTR_DATA() or
                 * MRP_GRAPHIC_HANDLE_DATA() to construct the
                 * "data" argument */
    MPT_BYTES	=8		/* use MRP_BYTES_DATA to construct the "data"
                 * argument */
} MailboxProgressType} ;

#define MRP_PAGE_DATA (cur,total)	(((dword)(total)<<16) | (cur))
#define MRP_PERCENT_DATA (pct)		(pct)
#define MRP_STRING_OPTR_DATA (str)	(str)
#define MRP_STRING_HANDLE_DATA (h,c)	(((dword)(h)<<16) | (c))
#define MRP_GRAPHIC_OPTR_DATA (str)	(str)
#define MRP_GRAPHIC_HANDLE_DATA (h,c)	(((dword)(h)<<16) | (c))
#define MRP_BYTES_DATA (bytes)		(bytes)

typedef WordFlags MailboxProgressAction ;

#define MPA_REPLACE_SHIFT    	2
#define MPA_UPDATE_MODE_SHIFT 	0

#define MRP_PROGRESS_ACTION (replace, updateMode) \
    (((replace) ? 1 << MPA_REPLACE_SHIFT : 0) | \
     (updateMode))

/* untested */
extern void
    _pascal MailboxReportProgress (MailboxProgressType type,
                      dword data,
                      MailboxProgressAction action);

/* untested */
extern word
    _pascal MailboxGetRemainingMessages (void);

/* untested */
extern dword
    _pascal MailboxGetRemainingDestinations (MailboxMessage msg);

/* Decompose result of MailboxGetRemainingDestinations to return the number of
 * destinations to be sent to "soon", i.e. that are currently queued for
 * transmission */
#define MGRD_QUEUED (val) ((word)(((val)>>16)&0xffff))

/* Decompose result of MailboxGetRemainingDestinations to return the number
 * of destinations that have yet to be sent to */
#define MGRD_TOTAL (val)	((word)((val)&0xffff))

/* untested */
extern word *
    _pascal MailboxGetCancelFlag (void);

/* untested */
extern void
    _pascal MailboxSetCancelAction (optr destination,
                    Message messageToSend);

@class MailboxProgressBoxClass, GenInteractionClass;

typedef enum {
    MCA_CANCEL_NONE	,
    MCA_CANCEL_MESSAGE	,
    MCA_CANCEL_CONNECT	,
    MCA_CANCEL_ALL
} MailboxCancelAction} ;

typedef struct {
    ThreadHandle 	MPBSA_thread;
    word		MPBSA_gen;
    byte            MPBSA_showProgress;           /* BooleanByte */
} MPBSetupArgs} ;

@message void MSG_MPB_SETUP (MPBSetupArgs *args = ss:bp);

@message ChunkHandle MSG_MPB_GET_MONIKER_STRING  (MPBSetupArgs *args = ss:bp);

typedef struct {
    MailboxProgressType MPBSPA_type;
    word		    MPBSA_cx;
    word		    MPBSA_dx;
    MailboxProgressAction MPBSA_action;
} MPBSetProgressArgs} ;

@message void MSG_MPB_SET_PROGRESS  (MPBSetProgressArgs *args = ss:bp);

@message void MSG_MPB_HIDE_THYSELF  ();

    @instance ChunkHandle MPBI_progressGauge = 0;

@message void MSG_MPB_DETACH_THREAD  ();

    @instance ThreadHandle MPBI_thread = 0;
    @instance word MPBI_gen = 0;

typedef enum {
    MPBT_INBOX	,
    MPBT_OUTBOX
} MPBType} ;

    @instance MPBType MPBI_type = MPBT_INBOX;
@endc;

@class MailboxProgressGaugeClass, GenInteractionClass;

@message void MSG_MPG_RESET  (Boolean destroy = cx);

@message void MSG_MPG_SET_PROGRESS  (MPBSetProgressArgs *args = ss:bp);

    @instance ChunkHandle MPGI_text = 0;
    @instance ChunkHandle MPGI_percent = 0;
    @instance ChunkHandle MPGI_pages = 0;
    @instance ChunkHandle MPGI_graphic = 0;
    @instance ChunkHandle MPGI_bytes = 0;

@endc;

@class MailboxPagesClass, GenTextClass;

@message void MSG_MP_SET_PAGE  (word currentPage = cx, word totalPages = dx);

@message void MSG_MP_SET_BYTES  (dword num = cx:dx);

@endc;

#ifdef __HIGHC__
pragma Alias (MailboxReportProgress, "MAILBOXREPORTPROGRESS");
pragma Alias (MailboxGetCancelFlag, "MAILBOXGETCANCELFLAG");
pragma Alias (MailboxSetCancelAction, "MAILBOXSETCANCELACTION");
pragma Alias (MailboxReportProgress, "MAILBOXREPORTPROGRESS");
pragma Alias (MailboxGetRemainingDestinations, "MAILBOXGETREMAININGDESTINATIONS");
pragma Alias (MailboxGetRemainingMessages, "MAILBOXGETREMAININGMESSAGES");
#endif

@endlib


Internal\mbTrnsDr.h

/******************************************************************************

    Copyright (c) GeoWorks 1994 -- All Rights Reserved

PROJECT:	PC GEOS
MODULE:
FILE:		mbTrnsDr.def

AUTHOR:		Adam de Boor, Mar 28, 1994

MACROS:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    ardeb	3/28/94		Initial revision

DESCRIPTION:
    Interface definition for Mailbox Transport drivers.

    $Id: mbTrnsDr.h,v 1.1.6.1 96/04/28 08:32:48 chris Exp $

******************************************************************************/

#ifndef __MBTRNSDR
#define __MBTRNSDR

#include  "medium.h"

typedef WordFlags MailboxTransportCapabilities ;		/* CHECKME */
#define MBTC_REPORTS_PROGRESS 	    	(0x8000)
/*
 *  Driver is capable of reporting the progress for a message that's being
 *  transmitted (via MailboxReportProgress). Mailbox library will add
 *  percentage to the UI components of the progress box for the transmission.
 */

#define MBTC_MESSAGE_RETRIEVE 	    	(0x4000)
/*  Driver can handle a call to DR_MBTD_RETRIEVE_MESSAGES */

#define MBTC_PREPARATION_NEEDS_FEEDBACK 	(0x2000)
/*
 *  Driver needs time to prepare each message, so the user should be alerted
 *  to it for each message. If MBTC_PERCENT_TRANSMITTED is set, driver may
 *  also periodically provide feedback on the percent of the message that's
 *  been prepared.
 */

#define MBTC_CAN_SEND_QUICK_MESSAGE 	(0x1000)
/*
 *  Indicates the driver can transmit a message body in TEXT_CHAIN or INK
 *  format, which are the two formats used to send a Quick Message. This bit
 *  is used to decide what transports show up in the Send Quick Message
 *  dialog box.
 */

#define MBTC_CAN_SEND_FILE 	    	(0x0800)
/*
 *  Indicates the driver can send an arbitrary file. This bit is used to
 *  decide what transports show up in the Send File dialog.
 */

#define MBTC_CAN_SEND_CLIPBOARD 	    	(0x0400)
/*
 *  Indicates the driver can send a clipboard transfer item. This bit is
 *  used to decide what transports show up in the Send Clipboard dialog.
 */

#define MBTC_REQUIRES_TRANSPORT_HINT 	(0x0200)
/*
 *  Set if driver's address control requires the MailboxSendControl to have
 *  an ATTR_MAILBOX_SEND_CONTROL_TRANSPORT_HINT for any transport option
 *  for this driver.
 */

#define MBTC_SINGLE_MESSAGE 	    	(0x0100)
/*
 *  Set if the driver sends only a single message for each connection. The
 *  Mailbox library will only issue one DR_MBTD_TRANSMIT_MESSAGE for each
 *  DR_MBTD_CONNECT call.
 */

#define MBTC_PICKY 	    	    	(0x0080)
/*
 *  Set if the driver accepts only messages in a particular format or limited
 *  number of formats. The list of acceptable formats is obtained by calling
 *  DR_MBTD_GET_FORMATS
 */

#define MBTC_CAN_PREPARE_WHILE_CONNECTED  (0x0040)
/*
 *  Set if the driver doesn't mind remaining connected while preparing
 *  messages. Causes the Mailbox library to look for other messages that
 *  might have been added that can be sent using the current connection.
 */

#define MBTC_NEED_MESSAGE_BODY 	    	(0x0020)
/*
 *  Set if the address control wishes to be given the message body as soon
 *  as possible. If the system supports it, the call will go out to the
 *  application to create the message body and the address control will
 *  receive a MSG_MAILBOX_ADDRESS_CONTROL_BODY_AVAILABLE call once the
 *  body has been created. Refer to that message for more info.
 */

/* 5 bits unused */

typedef struct {		/* CHECKME */
    DriverInfoStruct 	MBTDI_common;

    MailboxTransport	MBTDI_transport;
/*  32-bit token that identifies the driver */

    MailboxTransportCapabilities	MBTDI_capabilities;
/*  What optional services the transport driver provides. */

    word	MBTDI_maxAddressSize;
/*
 *  The largest address the driver uses. This allows the Mailbox library to
 *  allocate enough room for receiving the address when checking whether a
 *  connection-by-medium notification means this transport driver.
 */

} MBTDInfo} ;

#define MBTD_PROTO_MAJOR 	(DRIVER_PROTO_MAJOR+2)
#define MBTD_PROTO_MINOR 	(DRIVER_PROTO_MINOR+0)

typedef enum {
    MBTDPE_OK    ,
/*  the message is ready for transmission. */

    MBTDPE_UNSENDABLE    ,
/*
 *  the message cannot be prepared, due to a flaw in the message itself (e.g.
 *  part of the body is missing). The user will be notified of the problem and
 *  the message will be deleted.
 */

    MBTDPE_TRY_LATER    ,
/*
 *  the message cannot be prepared, due to a lack of resources that may
 *  become available later. The Mailbox library will retry the send at its
 *  discretion. The current connection *will* be severed before the new
 *  transmission is attempted.
 */

    MBTDPE_USER_CANCELED
/*
 *  the user canceled while the message was being prepared.  The Mailbox
 *  library will retry the send at its discretion.
 */
} MBTDPrepareError} ;

typedef struct {		/* CHECKME */
    MediumType	    	    MBTDMMA_medium;
    word	    	    MBTDMMA_unit;
    MediumUnitType	    MBTDMMA_unitType;
    MailboxTransportOption  MBTDMMA_transOption;
    word		    MBTDMMA_transAddrLen;
    void		    *MBTDMMA_transAddr;
} MBTDMediumMapArgs} ;

typedef struct {		/* CHECKME */
    MediumType	MBTDGMPA_medium;
    optr	MBTDGMPA_monikers;
    optr	MBTDGMPA_verb;
    optr	MBTDGMPA_abbrev;
    word	MBTDGMPA_significantAddrBytes;
/*
 *  The number of bytes of a message's transport address that should be
 *  compared when checking to see if a message can be sent via an established
 *  connection, or if two messages have the same address, or things like that.
 */

#define MBTD_ALL_BYTES_SIGNIFICANT 	0xffff
/*
 * use in MBTDGMPA_significantAddressBytes if all bytes of an address are
 * significant
 */

} MBTDGetMediumParamsArgs} ;

/* enum MailboxTransportDriverFunction */
typedef enum {		/* CHECKME */

    DR_MBTD_GET_ADDRESS_CONTROLLER     = 8,
/*
 * 	Desc:	Retrieves the object class of the controller object by means
 * 		of which the user selects the destination for a message.
 * 		The driver is told the medium by means of which the message
 * 		will travel. If the different media require different address
 * 		controllers, the driver can use this token to determine which
 * 		controller to return.
 *
 * 	Pass:	cxdx	= MediumType
 * 		ax	= MailboxTransportOption
 * 	Return:	cx:dx	= Class pointer for subclass of MailboxAddressControl
 * 			= 0 if no address needed for selected medium.
 */

    DR_MBTD_PREPARE_FOR_TRANSPORT     = 10,
/*
 * 	Desc:	Signals the driver that a message is going to be sent. The
 * 		driver should take whatever action is necessary to prepare
 * 		the message to be sent out. This function exists for the Fax
 * 		transport driver to convert the fax from a graphics string to
 * 		the appropriately-encoded fax image file.
 *
 * 		The Mailbox library will call the driver on a thread dedicated
 * 		to sending the batch of messages that it is attempting to
 * 		send, so the driver need have no worries about blocking
 * 		for extended periods of time.
 *
 * 		The driver can record the results of its preparation either
 * 		using the message's transData or using MailboxSetTransAddr to
 * 		adjust the non-significant bytes of the indicated transport
 * 		address.
 *
 * 		This function will always be called once for each address
 * 		about to be transmitted to before DR_MBTD_CONNECT.
 *
 * 	Pass:	cxdx	= MailboxMessage
 * 		ax	= address #
 * 	Return:	ax	= MBTDPrepareError
 * 		carry clear if it's ok for the message to be sent
 * 		carry set if the message cannot be sent now.
 */

    DR_MBTD_DONE_WITH_TRANSPORT     = 12,
/*
 * 	Desc:	Signals the driver that a message is done being sent for
 * 		now. If the driver allocated any resources for transmitting
 * 		the thing, it can free them now, safe in the knowledge that the
 * 		message won't be transmitted again unless it gets re-queued.
 *
 * 		NOTE: It is possible to receive this call for a message for
 * 		which you've never received a PREPARE_FOR_TRANSPORT. You
 * 		must be able to handle this.
 *
 * 		NOTE: None of the following functions may be called from this
 * 		routine: MailboxGetRemainingMessages, MailboxGetRemaining-
 * 		Destinations, MailboxGetCancelFlag, MailboxReportProgress,
 * 		MailboxSetCancelAction, MailboxRegisterReceiptThread,
 * 		MailboxUnregisterReceiptThread. Calling any of them will
 * 		yield internal deadlock.
 *
 * 	Pass:	cxdx	= MailboxMessage
 * 	Return:	nothing
 */

    DR_MBTD_CONNECT     = 14,
/*
 * 	Desc:	Asks the driver to create a connection to the indicated address.
 * 		The address is taken from a message in the outbox. The Mailbox
 * 		library will call the driver on a thread dedicated to sending
 * 		the batch of messages that it is attempting to send, so the
 * 		driver need have no worries about blocking for extended
 * 		periods of time.
 *
 * 		Upon successful connection, the driver is expected to allocate
 * 		state information for the connection and return a suitable
 * 		16-bit token that can be used in future calls to refer to the
 * 		connection.
 *
 * 		Before returning success, the driver is expected to notify
 * 		the Mailbox library that the connection is viable. The one
 * 		exception to this is when the transport driver knows that
 * 		some other entity that it is using to establish the connection
 * 		will be notifying the library.
 *
 * 		Note: if the medium required for the transmission is not
 * 		available, the driver is responsible for prompting the user
 * 		to make it available.
 *
 * 	Pass:	cx:dx	= pointer to transport address
 * 		bx	= address size
 * 		ax	= MailboxTransportOption
 * 	Return:	carry set if connection couldn't be established:
 * 			^lax:si	= reason for failure
 * 		carry clear if connection established:
 * 			si	= connection handle
 */

    DR_MBTD_TRANSMIT_MESSAGE     = 16,
/*
 * 	Desc:	Transmit a message. The Mailbox library will call the driver
 * 		on a thread dedicated to sending the batch of messages that it
 * 		is attempting to send, so the driver need have no worries about
 * 		blocking for extended periods of time.
 *
 * 		If a message has duplicate addresses, when compared up to the
 * 		number of significant bytes specified by the driver, the
 * 		Mailbox library will issue one DR_MBTD_TRANSMIT_MESSAGE call
 * 		for each such address.
 *
 * 	Pass:	cxdx	= MailboxMessage
 * 		ax	= address number
 * 		si	= connection handle returned by DR_MBTD_CONNECT
 * 	Return:	carry set if message could not be sent:
 * 			^lcx:dx	= reason for failure
 * 			ax[14..0] = MailboxError (ME_USER_CANCELED,
 * 				  ME_LOST_CONNECTION)
 * 			ax[15] set if error is a permanent error.
 * 		carry clear if message sent
 * 			ax, cx, dx = destroyed
 */

    DR_MBTD_END_CONNECT     = 18,
/*
 * 	Desc:	Close down a connection. If the driver is also receiving
 * 		messages, it will need to have established a reference to itself
 * 		(usually by spawning a thread) as the driver may be unloaded
 * 		at any time after this call returns. (The unloading is done
 * 		via GeodeFreeDriver, which unloads something only if there are
 * 		no more references to it.)
 *
 * 	Pass:	si	= connection handle returned by DR_MBTD_CONNECT
 * 	Return:	nothing
 */

    DR_MBTD_CHOOSE_FORMAT     = 20,
/*
 * 	Desc:	For those transport drivers that wish only to send certain
 * 		data formats, this function gives them a say in how the
 * 		application produces the body of a message. Those drivers
 * 		that use the generic read/write interface of the data
 * 		driver should simply select the first format from the
 * 		passed array.
 *
 * 	Pass:	cx:dx	= pointer to array of MailboxDataFormat tokens
 * 		bx	= number of formats from which to choose
 * 	Return:	ax	= index of format to use, or -1 if none of the formats
 * 			  is acceptable. (Use zero-origin index.)
 */

#define MBTD_NO_ACCEPTABLE_FORMAT    (-1)

    DR_MBTD_CHECK_MEDIUM     = 22,
/*
 * 	Desc:	Determine if the transport driver uses the passed medium to
 * 		transmit messages.
 *
 * 	Pass:	cxdx	= MediumType
 * 		ax	= MailboxTransportOption (zero-based index).
 * 	Return:	carry set if the transport option of this driver employs
 * 			the passed medium
 * 		carry clear if the transport option does *not* support
 * 			the passed medium
 */

    DR_MBTD_GET_MAX_ADDRESS_SIZE     = 24,
/*
 * 	Desc:	Fetch the number of bytes in the largest address used by
 * 		the transport driver for the given medium.
 *
 * 	Pass:	cxdx	= MediumType
 * 		ax	= MailboxTransportOption
 * 	Return:	ax	= # bytes
 */

    DR_MBTD_CHECK_MEDIUM_CONNECTION     = 26,
/*
 * 	Desc:	Determine if a connection over a particular medium can be used
 * 		by the transport driver, and if so, what the address of the
 * 		connected machine is (for purposes of comparison with
 * 		registered messages in the outbox destined for this driver)
 *
 * 	Pass:	cx:dx	= pointer to MBTDMediumMapArgs
 * 			  MBTDMMA_medium, MBTDMMA_unit, MBTDMMA_unitType
 * 			  	set for the medium
 * 			  MBTDMMA_transAddr pointing to as many bytes as
 * 				were indicated as necessary by previous call
 * 				to DR_MBTD_GET_MAX_ADDRESS_SIZE
 * 				(MBTDMMA_transAddrLen set to this value)
 * 	Return:	carry set if the transport driver can use the connection:
 * 			*cx:dx.MBTDMMA_transAddr filled in
 * 			cx:dx.MBTDMMA_transAddrLen set to actual address length
 * 		carry clear if transport driver can *not* use the connection.
 */

    DR_MBTD_GET_ADDRESS_MEDIUM     = 28,
/*
 * 	Desc:	Determine the medium and unit encoded in a particular address.
 *
 * 	Pass:	cx:dx	= pointer to MBTDMediumMapArgs
 * 			  MBTDMMA_transAddr points to address from a message
 * 			  MBTDMMA_transAddrLen holds the size of the address
 * 			  MBTDMMA_transOption holds the transport option
 * 	Return:	carry set if the address is invalid
 * 		carry clear if address is valid:
 * 			cx:dx.MBTDMMA_medium, MBTDMMA_unit, and
 * 			MBTDMMA_unitType filled in. unitType may be MMUT_ANY
 * 			to indicate any unit of the medium can be used to
 * 			transmit the message
 */

    DR_MBTD_GET_MEDIUM_PARAMS     = 30,
/*
 * 	Desc:	Fetches the monikers and verb for how a message is transmitted
 * 		to a particular medium through this transport driver.
 *
 * 		The monikers are in a moniker list and are used for a variety
 * 		of lists, both in the creation and the display of queued
 * 		messages. The moniker list must have at least a VMS_TEXT
 * 		moniker, and should also contain one or more VMS_TOOL monikers
 * 		(for various display classes) for use by the MailboxSendControl
 * 		when building its tool UI (on some systems).
 *
 * 		The verb is mixed-case and implies a message will be sent via
 * 		this transport driver using this medium. For example, a Fax
 * 		transport driver would return "Fax", while an America OnLine
 * 		Email transport driver would return "Mail".
 *
 * 		The mixed-case form is placed within various UI gadget monikers
 * 		(for example "<Verb> All" or "<Verb> Now"). It is completely
 * 		downcased to be used in sentences ("is ready to <verb>.
 * 		Would you like to <verb> it now or later?").
 *
 * 	Pass:	cx:dx	= MBTDGetMediumParamsArgs
 * 		ax	= MailboxTransportOption (zero-based index)
 * 	Return:	carry set on error.
 * 		carry clear if ok:
 * 			MBTDGMPA_monikers, MBTDGMPA_verb, and
 * 			MBTDGMPA_significantAddrBytes filled in
 */

    DR_MBTD_DELETE     = 32,
/*
 * 	Desc:	Notifies the driver that the message is being deleted. This
 * 		allows the transport driver to clean up after itself, if it
 * 		created anything for the message during its DR_MBTD_PREPARE_-
 * 		FOR_TRANSPORT call.
 *
 * 	Pass:	cxdx	= 32-bit transData for the message
 * 	Return:	nothing
 */

    DR_MBTD_RETRIEVE_MESSAGES     = 34,
/*
 * 	Desc:	Asks the driver to do whatever it needs to connect to the
 * 		service it uses for receiving (and usually transmitting)
 * 		messages. If the driver requires additional information (like
 * 		a login name and password), it will have to prompt the user
 * 		for the information itself.
 *
 * 		If it is capable of sending messages over the same connection,
 * 		it should notify the Mailbox library the connection exists,
 * 		when it exists. This will allow the library to piggyback
 * 		sending messages on the connection.
 *
 * 		The call is made on a thread dedicated to the receive, so
 * 		the driver need have no worries about blocking.
 *
 * 	Pass:	cxdx	= MediumType
 * 		ax	= MailboxTransportOption (zero-based index)
 * 	Return:	nothing
 */

    DR_MBTD_GET_TRANSPORT_OPTIONS_INFO     = 36,
/*
 * 	Desc:	Returns the number of transport options available for
 * 		this transport driver.  When referring to a transport
 * 		option, use a zero-based index.
 * 	Pass:	nothing
 * 	Return: cx	= number of transport options available for this
 * 			  driver.
 */
} MailboxTransportDriverFunction} ;

/*------------------------------------------------------------------------------
 *
 * 			     ESCAPE CODES
 *
 *----------------------------------------------------------------------------*/
typedef enum {

    DR_MBTD_ESC_GET_TRANSPORT_OPTION     = 0x8100,
/*
 * 	Desc:	Maps a string that has meaning to the driver into a transport
 * 		option for the driver. Originally implemented to map from
 * 		socket domains to transport options for the socket transport
 * 		driver when a connection comes in.
 *
 * 	Pass:	cx:dx	= null-terminated string to map
 * 	Return:	carry set if string is invalid or escape isn't supported:
 * 			ax	= destroyed
 * 		carry clear if string mapped:
 * 			ax	= MailboxTransportOption
 */

    DR_MBTD_ESC_GET_FORMATS    ,
/*
 * 	Desc:	Fetches the array of message body formats that are acceptable
 * 		to the driver.
 *
 * 	Pass:	cx:dx	= buffer for MailboxDataFormat descriptors
 * 		ax	= number of MailboxDataFormat descriptors that will
 * 			  fit in the buffer
 * 	Return:	carry set if escape not supported
 * 		carry clear if escape supported:
 * 			cx:dx	= filled in as much as possible
 * 			ax	= number of formats supported. This may be
 * 				  larger than the number passed in. It's
 * 				  up to the caller to detect this and reissue
 * 				  the call with a larger buffer if it wishes
 * 				  to have a complete list.
 */

    DR_MBTD_ESC_GET_DEADLINE_EXTENSION    ,
/*
 * 	Desc:	Gets the deadline extension for a message after when a
 * 		transmission has just failed or been cancelled by the user.
 *
 * 		If this escape is not supported, some system default will be
 * 		used.
 *
 * 	Pass:	cl	= number of failures
 * 	Return:	carry set if escape not supported
 * 		carry clear if escape supported:
 * 			cl	= # minutes extension
 * 			ch	= # hours extension
 */
} MailboxTransportEscape} ;

#endif	/* __MBTRNSDR */


medium.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1994 -- All Rights Reserved
 *
 * PROJECT:	  Geos
 * MODULE:	  Medium
 * FILE:	  medium.h
 *
 * AUTHOR:  	  Chung Liu: Nov 20, 1994
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	CL	11/20/94   	Initial version
 *
 * DESCRIPTION:
 *	Medium definitions
 *
 *
 * 	$Id: medium.h,v 1.4.1.1 96/04/28 08:30:14 chris Exp $
 *
 ***********************************************************************/
#ifndef _MEDIUM_H_
#define _MEDIUM_H_

typedef ByteEnum MediumUnitType ;
#define MUT_NONE       	    0x0
#define MUT_INT        	    0x1
#define MUT_MEM_BLOCK  	    0x2
#define MUT_ANY        	    0x3
#define MUT_REASON_ENCLOSED  0x4

typedef enum {
    GMID_INVALID     = 0x0,
    GMID_SERIAL_CABLE    ,
    GMID_INFRARED    ,
    GMID_DATA_MODEM    ,
    GMID_FAX_MODEM    ,
    GMID_PRINTER    ,
    GMID_PARALLEL_PORT    ,
    GMID_NETWORK    ,
    GMID_LOOPBACK    ,
    GMID_SM    ,
    GMID_CELL_MODEM
} GeoworksMediumID} ;

typedef struct {
    word            MET_id;
    ManufacturerID  MET_manuf;
} MediumType} ;

typedef struct {
    MediumType      MU_medium;
    MediumUnitType  MU_unitType;
    word            MU_unit;
} MediumAndUnit} ;

typedef struct {
    MediumUnitType  MUAR_type;
    word    	    MUAR_size;
} MediumUnitAndReason} ;

/*
 * The unit data follow immediately after the MediumUnitAndReason header
 */
#define MUAR_UNIT_DATA (muarPtr)	(void *)((muarPtr)+1)
/*
 * The reason for the status change follows immediately after the unit data
 */
#define MUAR_REASON (muarPtr) \
    (const TCHAR *)((byte *)MUAR_UNIT_DATA((muarPtr))+(muarPtr)->MUAR_size)
/*
 * SST_ Notification types
 */
typedef enum {
    MESN_MEDIUM_AVAILABLE     = 0x0,
    MESN_MEDIUM_NOT_AVAILABLE    ,
    MESN_MEDIUM_CONNECTED    ,
    MESN_MEDIUM_NOT_CONNECTED    ,
} MediumSubsystemNotification} ;

#endif /* _MEDIUM_H_ */


Objects\metaC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	metaC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines MetaClass
 *
 *	$Id: metaC.goh,v 1.98.4.2 97/12/23 17:53:17 reza Exp $
 *
 ***********************************************************************/

@optimize
@deflib ui

#include  <chunkarr.h>
@include  <object.goh>
#include  <object.h>
#include  <geode.h>
#include  <Objects/helpCC.h>

/***/

/*
 * Base structure defined so goc can build on it for all other classes. It
 * *must* be defined before the class is declared.
 */

typedef struct {
    ClassStruct	*MB_class;
} MetaBase} ;

typedef struct {
    word	ax;
    word	cx;
    word	dx;
    word	bp;
} AsmPassReturn} ;

/*
 ****************************************************************************
 *			MetaClass Declaration
 ****************************************************************************
 */

@class	MetaClass, meta;

@instance MetaBase	MI_base;

/*
 *		Messages
 */

@message void MSG_META_NULL ();

@message void MSG_META_INITIALIZE ();

@message void MSG_META_RESERVED_1 ();

@message void MSG_META_DUMMY ();

@message void MSG_META_APP_STARTUP (MemHandle appLaunchBlock);

@message void MSG_META_ATTACH ();	/* XXX */
@alias(MSG_META_ATTACH)
  void MSG_META_ATTACH_PROCESS(word value1 = cx, word value2 = dx);

@alias(MSG_META_ATTACH)
  void MSG_META_ATTACH_GENPROCESSCLASS(MemHandle appLaunchBlock = dx);

@alias(MSG_META_ATTACH)
  void MSG_META_ATTACH_OBJECT(word flags = cx, MemHandle appLaunchBlock = dx,
                  MemHandle extraState = bp);
@alias(MSG_META_ATTACH)
  void MSG_META_ATTACH_THREAD();

@message void MSG_META_DETACH (word callerID = cx, optr caller = dx:bp);

@message void MSG_META_DETACH_COMPLETE ();

@message void MSG_META_DETACH_ABORT ();

@message void MSG_META_ACK (word callerID = cx, optr caller = dx:bp);

@message void MSG_META_APP_SHUTDOWN (word callerID = cx, optr ackOD = dx:bp);
@message void MSG_META_SHUTDOWN_COMPLETE ();
@message void MSG_META_SHUTDOWN_ACK (word callerID = cx, optr ackOD = dx:bp);

@message ClassStruct * MSG_META_GET_CLASS * () = cx:dx;

@message Boolean MSG_META_IS_OBJECT_IN_CLASS (ClassStruct *class = cx:dx) = carry;

@message void MSG_META_BLOCK_FREE ();

@message void MSG_META_OBJ_FREE ();

@message void MSG_META_FINAL_OBJ_FREE ();	/* PRIVATE */

@message void MSG_META_DEC_BLOCK_REF_COUNT (MemHandle block1 = cx,
                        MemHandle block2 = dx);

/*
 *		Object management methods
 */

@message ClassStruct * MSG_META_RESOLVE_VARIANT_SUPERCLASS( \
  word MasterOffset = cx) = cx:dx;  /* XXX */

@message Boolean MSG_META_RELOCATE (word vmRelocType = dx, \
                       word frame = bp) = carry;  /* XXX */

@message Boolean MSG_META_UNRELOCATE (word vmRelocType = dx, \
                         word frame = bp) = carry;  /* XXX */
/*
 *		UI/IM Messages
 */
@message void MSG_META_LEAVE_CONSTRAIN ();	/* INTERNAL */

#define PTR_LEAVE_LEFT 		0x01
#define PTR_LEAVE_TOP 		0x02
#define PTR_LEAVE_RIGHT 		0x04
#define PTR_LEAVE_BOTTOM 	0x08

@message void MSG_META_SET_FLAGS (ChunkHandle objChunk = cx,
                ObjChunkFlags bitsToSet = dl,
                ObjChunkFlags bitsToClear = dh);

@message word MSG_META_GET_FLAGS (ChunkHandle ch = cx) = ax;

@message void MSG_META_VM_FILE_DIRTY (FileHandle file = cx);

@message void MSG_META_QUIT ();
/*
 * if quitLevel = QL_AFTER_DETACH
 *      SI:CX = Ack OD to be passed on to MSG_META_QUIT_ACK.   This is legal
 *              because this message is being sent to a process so SI can
 *              used for extra data.  SI must me set up by the programmer.
 */
@alias(MSG_META_QUIT) \
  void MSG_META_QUIT_PROCESS(word quitLevel = dx, ChunkHandle ackODChunk = cx);

@alias(MSG_META_QUIT) \
  void MSG_META_QUIT_OBJECT(optr obj = cx:dx);

@message void MSG_META_QUIT_ACK (word quitLevel = dx, word abortFlag = cx);

typedef enum /* word */ {
    QL_BEFORE_UI    ,
    QL_UI    ,
    QL_AFTER_UI    ,
    QL_DETACH    ,
    QL_AFTER_DETACH
} QuitLevel} ;

/*
ObjMessageParams	struct
    OMP_destination	optr
    OMP_messageFlags	word		; Flags for ObjMessage
    OMP_message	word
    OMP_eventWord0	word	; cx data
    OMP_eventWord1	word	; dx data
    OMP_eventWord2	word	; bp data
ObjMessageParams	ends
*/

@message Boolean MSG_META_DISPATCH_EVENT (AsmPassReturn *retVals = axcxdxbp, /* XXX */
                    EventHandle eventHandle = cx,
                    MessageFlags msgFlags = dx) = carry;

typedef enum {
    TO_NULL    ,
    TO_SELF    ,
    TO_OBJ_BLOCK_OUTPUT    ,
    TO_PROCESS
} TravelOption} ;

@message void MSG_META_SEND_CLASSED_EVENT (EventHandle event = cx,
                      TravelOption whereTo = dx);	/* XXX */

@message optr MSG_META_GET_OPTR () = cx:dx;	/* XXX */

typedef struct {
    ClassStruct		*GTP_class;
    optr		GTP_target;
} GetTargetParams} ;

@message void MSG_META_GET_TARGET_AT_TARGET_LEVEL (
            GetTargetParams *retValue = bpaxdxcx,
            TargetLevel level = cx);	/* XXX */

@message void MSG_META_ADD_VAR_DATA(@stack word dataType, word dataSize,
            void *data);

@message Boolean MSG_META_DELETE_VAR_DATA (word dataType = cx) = carry;

@message word MSG_META_INITIALIZE_VAR_DATA (word dataType = cx) = ax; /* XXX */

/*
 * General purpose notification messages
 */

/* Custom change types passed in MSG_META_NOTIFY and MSG_META_NOTIFY_WITH_DATA_BLOCK */

typedef struct {
    ManufacturerID	NT_manuf;
    word		NT_type;
} NotificationType} ;

@message void MSG_META_NOTIFY (ManufacturerID manufID = cx,
                word notificationType = dx,
                word data = bp);

@message void MSG_META_NOTIFY_WITH_DATA_BLOCK (ManufacturerID manufID = cx,
                word notificationType = dx,
                MemHandle data = bp);

/*
 *-------------------------------------------------------------------
 * General Notification System --
 * Common structures & equates (Used by MetaClass & Kernel GCN routines)
 *------------------------------------------------------------------------------
 * /

/* List types used with GCN routines & messages */
typedef	struct {
    word	GCNLT_manuf;
    word	GCNLT_type;
} GCNListType} ;

/* Flag used with GCNLT_type */
typedef WordFlags GCNListTypeFlags ;
#define GCNLTF_SAVE_TO_STATE 	0x0001

/* Structure of an element in a GCN list */
typedef struct {
    optr	GCNLE_item;
} GCNListElement} ;

/* Structure of a single GCN list (resides in a chunk) */
typedef struct {
    ChunkArrayHeader	GCNLH_meta;
    word			GCNLH_statusEvent;
    MemHandle		GCNLH_statusData;
    word			GCNLH_statusCount;
    /* Start of GCNListOfListElement's */
} GCNListHeader} ;

/* Structure of an element in the list of GCN Lists */
typedef struct {
    GCNListType		GCNLOLE_ID;
    ChunkHandle		GCNLOLE_list;
} GCNListOfListsElement} ;

/* Structure of the GCN list of lists (resides in a chunk) */

typedef struct {
    ChunkArrayHeader	GCNLOL_meta;
    /* Start of GCNListOfListsElement's */
} GCNListOfListsHeader} ;

/*
 *-------------------------------------------------------------------
 * General Notification System --
 * MetaClass structures & constants
 *------------------------------------------------------------------------------
 * /

/* Variable data storage area required for GCN implementation within
   MetaClass objects */

typedef ByteFlags TempMetaGCNFlags ;
#define TMGCNF_RELOCATED 	0x80

typedef	struct {
    ChunkHandle		TMGCND_listOfLists;
    TempMetaGCNFlags	TMGCND_flags;
} TempMetaGCNData} ;

@vardata TempMetaGCNData TEMP_META_GCN;
@vardata ChunkHandle TEMP_META_QUIT_LIST;

/* Stack structure passed to MSG_META_GCN_LIST_ADD & REMOVE */
typedef	struct {
    GCNListType		GCNLP_ID;
    optr		GCNLP_optr;
} GCNListParams} ;

@message Boolean MSG_META_GCN_LIST_ADD(@stack optr dest,
            word listType, ManufacturerID listManuf
            ) = carry; 				 /* XXX */
@message Boolean MSG_META_GCN_LIST_REMOVE(@stack optr dest,
            word listType, ManufacturerID listManuf
            ) = carry;  				/* XXX */

/* GCNListSendFlags, passed to all "Send" routines */

typedef WordFlags GCNListSendFlags ;
#define GCNLSF_SET_STATUS 			0x8000
#define GCNLSF_IGNORE_IF_STATUS_TRANSITIONING 	0x4000
#define GCNLSF_FORCE_QUEUE 			0x2000

@message void MSG_META_GCN_LIST_SEND(@stack GCNListSendFlags flags,
            EventHandle event, MemHandle block,
            word listType, ManufacturerID listManuf); /* XXX */

@message void MSG_META_GCN_LIST_DESTROY ();

@message void MSG_META_SAVE_OPTIONS ();

#define INI_CATEGORY_BUFFER_SIZE  64

@message void MSG_META_GET_INI_CATEGORY (char *buf = cx:dx);

@message void MSG_META_SUSPEND ();
@message void MSG_META_UNSUSPEND ();

@message void MSG_META_LOAD_OPTIONS ();

@message word MSG_META_GET_VAR_DATA(@stack word dataType, word bufSize,
            void *buf) = ax;	/* XXX */

@message void MSG_META_NOTIFY_OBJ_BLOCK_INTERACTIBLE (MemHandle objBlock = cx);
@message void MSG_META_NOTIFY_OBJ_BLOCK_NOT_INTERACTIBLE (MemHandle objBlock = cx); /* XXX */

typedef enum {
    OFIQNS_SYSTEM_INPUT_OBJ    =0,
    OFIQNS_INPUT_OBJ_OF_OWNING_GEODE    =2,
    OFIQNS_PROCESS_OF_OWNING_GEODE    =4,
    OFIQNS_DISPATCH    =6
} ObjFlushInputQueueNextStop} ;

@message void MSG_META_OBJ_FLUSH_INPUT_QUEUE (EventHandle event = cx,
            ObjFlushInputQueueNextStop nextStop = bp,
            MemHandle objBlock = dx);	/* XXX */

@message void MSG_META_WIN_DEC_REF_COUNT (MemHandle win = cx);

typedef WordFlags UpdateWindowFlags ;
#define UWF_ATTACHING 			0x8000;
#define UWF_DETACHING 			0x4000;
#define UWF_RESTORING_FROM_STATE 	0x2000;
#define UWF_TOP_LEVEL_WINDOW 		0x1000;

@message void MSG_META_UPDATE_WINDOW (UpdateWindowFlags updateFlags = cx,
                    VisUpdateMode updateMode = dl);

@message void MSG_META_FINISH_QUIT (Boolean abortFlag = cx);

@message void MSG_META_SET_OBJ_BLOCK_OUTPUT (optr output = cx:dx);

@message Boolean MSG_META_GET_HELP_FILE (char *buf = cx:dx) = carry;

typedef struct {
    HelpType	HTR_helpType;
    byte    	HTR_unused1;
    word    	HTR_unused2;
} HelpTypeReturn} ;

@message Boolean MSG_META_GET_HELP_TYPE  (
                        HelpTypeReturn *retValue = dxcx) = carry;

@message optr MSG_META_GET_OBJ_BLOCK_OUTPUT () = cx:dx;

@message void MSG_META_RESET_OPTIONS ();

@message void MSG_META_BRING_UP_HELP ();

@message void MSG_META_SET_HELP_FILE (char *buf = cx:dx);

@message Boolean MSG_META_GCN_LIST_FIND_ITEM(@stack optr dest,
            word listType, ManufacturerID listManuf
            ) = carry; 				 /* XXX */

@message void MSG_META_TRANSPARENT_DETACH ();

@message void MSG_META_REMOVING_DISK (DiskHandle disk = cx);

@message void MSG_META_VM_FILE_SET_INITIAL_DIRTY_LIMIT (FileHandle fh = cx);

@message void MSG_META_VM_FILE_AUTO_SAVE (FileHandle fh = cx);

/*
 *	Buffer to allow easy adding of
 *	methods to MetaClass. DECREASE
 *	IF YOU ADD A NEW MESSAGE.
 */
@reserveMessages	4;

/*
 * 	Messages exported for other uses
 */

/* Window methods */

@exportMessages	MetaWindowMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Input-related methods */

@exportMessages	MetaInputMessages, @DEFAULT_EXPORTED_MESSAGES;

/* UI-related methods (give 200) */

@exportMessages	MetaUIMessages, @DEFAULT_EXPORTED_MESSAGES_4;

/* Specific-UI related methods */

@exportMessages	MetaSpecificUIMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Application related methods */

@exportMessages	MetaApplicationMessages, @DEFAULT_EXPORTED_MESSAGES_3;

/* Messages for Graphic-Object library */

@exportMessages	MetaGrObjMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Messages for Spool/PrintControl library */

@exportMessages	MetaPrintMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Messages for Search/Replace/SpellCheck library */

@exportMessages	MetaSearchSpellMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Messages for General Change Notification mechanism */

@exportMessages	MetaGCNMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Messages for Text Object Library */

@exportMessages	MetaTextMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Messages for Styles Library */

@exportMessages	MetaStylesMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Messages for Color Library */

@exportMessages	MetaColorMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Messages for Float Library */

@exportMessages	MetaFloatMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Messages for Spreadsheet Library */

@exportMessages	MetaSpreadsheetMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Messages for IACP */

@exportMessages MetaIACPMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Messages for system inbox/outbox (Mailbox Library) */

@exportMessages MetaMailboxMessages, @DEFAULT_EXPORTED_MESSAGES;

/* Variable data storage area required detach within MetaClass objects */
typedef	struct {
    word		DDE_ackCount;
    word		DDE_callerID;
    optr		DDE_ackOD;
    word		DDE_completeMsg;
} DetachDataEntry} ;
@vardata DetachDataEntry DETACH_DATA;
@vardata word TEMP_EC_IN_USE_COUNT;
@vardata word TEMP_EC_INTERACTIBLE_COUNT;

                    /* INTERNAL */
typedef struct {
    word	EAFTPPD_priority;
    optr	EAFTPPD_avoidOptr;
} EnsureActiveFTPriorityPreferenceData} ;
@vardata EnsureActiveFTPriorityPreferenceData TEMP_META_ENSURE_ACTIVE_FT_LAYER_PRIORITY_PREFERENCE;

typedef struct {
        char            DODRI_tempOwner[GEODE_NAME_SIZE];
        word            DODRI_tempResource;
} DebugObjDuplicateResourceInfo} ;
@vardata DebugObjDuplicateResourceInfo DEBUG_META_OBJ_DUPLICATE_RESOURCE_INFO;

@endc

/*
 *		Detach
 */

extern void	/*XXX*/
    _pascal ObjInitDetach (MetaMessages msg, optr obj, word callerID, optr ackOD);

/***/

extern void	/*XXX*/
    _pascal ObjIncDetach (optr obj);

/***/

extern void	/*XXX*/
    _pascal ObjEnableDetach (optr obj);

/*
 *		Linkable
 */

typedef struct {
    optr	LP_next;	/* Low bit: clear for sibling optr, */
                /* 	    set for parent optr. */
                /*	    0 = object not in composite */
} LinkPart} ;

#define LP_IS_PARENT 	1		/* low bit is parent flag */

/***/

extern optr
    _pascal ObjLinkFindParent (optr obj, word masterOffset, word linkOffset);

/*
 *		Composite Routines and Constants
 */

typedef struct {
    optr	CP_firstChild;
} CompPart} ;

typedef WordFlags CompChildFlags ;
#define CCF_MARK_DIRTY 	0x8000
#define CCF_REFERENCE 	0x7fff

#define CCO_FIRST 	0x0000
#define CCO_LAST 	0x7FFF

#define CCF_REFERENCE_OFFSET  0

typedef ByteEnum InsertChildOption ;
#define ICO_FIRST  0
#define ICO_LAST  1
#define ICO_BEFORE_REFERENCE  2
#define ICO_AFTER_REFERENCE  3

typedef WordFlags InsertChildFlags ;
#define ICF_MARK_DIRTY 	0x8000
#define ICF_OPTIONS 	0x0003

/***/

extern word		/* -1 if not found */	/*XXX*/
    _pascal ObjCompFindChildByOptr (optr obj, optr childToFind, word masterOffset,
               word compOffset, word linkOffset);

extern optr	/*XXX*/
    _pascal ObjCompFindChildByNumber (optr obj, word childToFind, word masterOffset,
                 word compOffset, word linkOffset);

/***/

extern void	/*XXX*/
    _pascal ObjCompAddChild (optr obj, optr objToAdd, word flags, word masterOffset,
            word compOffset, word linkOffset);

/***/

extern void	/*XXX*/
    _pascal ObjCompRemoveChild (optr obj, optr objToRemove, word flags,
               word masterOffset, word compOffset, word linkOffset);

/***/

extern void	/*XXX*/
    _pascal ObjCompMoveChild (optr obj, optr objToMove, word flags, word masterOffset,
             word compOffset, word linkOffset);

/***/

typedef enum /* word */ {
    OCCT_SAVE_PARAMS_TEST_ABORT    =0,
    OCCT_SAVE_PARAMS_DONT_TEST_ABORT    =2,
    OCCT_DONT_SAVE_PARAMS_TEST_ABORT    =4,
    OCCT_DONT_SAVE_PARAMS_DONT_TEST_ABORT    =6,
    OCCT_ABORT_AFTER_FIRST    =8,
    OCCT_COUNT_CHILDREN    =10
} ObjCompCallType} ;

extern Boolean		/* TRUE if ended in the middle */	/*XXX*/
    _pascal ObjCompProcessChildren (optr obj, optr firstChild,
               ObjCompCallType stdCallback,
               void *cbData, word masterOffset,
               word compOffset, word linkOffset,
               PCB(Boolean, callback, (optr parent, optr child,
                        void *cbData)));

#ifdef __HIGHC__
pragma Alias(ObjInitDetach, "OBJINITDETACH");
pragma Alias(ObjIncDetach, "OBJINCDETACH");
pragma Alias(ObjEnableDetach, "OBJENABLEDETACH");
pragma Alias(ObjLinkFindParent, "OBJLINKFINDPARENT");
pragma Alias(ObjCompFindChildByOptr, "OBJCOMPFINDCHILDBYOPTR");
pragma Alias(ObjCompFindChildByNumber, "OBJCOMPFINDCHILDBYNUMBER");
pragma Alias(ObjCompAddChild, "OBJCOMPADDCHILD");
pragma Alias(ObjCompRemoveChild, "OBJCOMPREMOVECHILD");
pragma Alias(ObjCompMoveChild, "OBJCOMPMOVECHILD");
pragma Alias(ObjCompProcessChildren, "OBJCOMPPROCESSCHILDREN");
#endif

@endlib


Internal\Resp\mng.h

/*
Copyright (c) 1995-1998. Nokia Mobile Phones
*/

/*
     DESCRIPTION
     ===========

     External constants and function prototypes of image main engine
     library
*/

/*
     REFERENCES
     ==========

*/

#ifndef IMSG_MNG_H
#define _IMSG_MSG_H

/*
     C CONSTANTS
     ===========
*/

/* Values for IMSG_INPUT.operationMode */
#define IMSG_IMAGE_PROPERTIES  1
#define IMSG_OUTPUT_JPG        2
#define IMSG_OUTPUT_RGB        3
#define IMSG_OUTPUT_YUV        4

/* Values for IMSG_INPUT.cancelOperation */
#define IMSG_ENABLE_OPERATION  0
#define IMSG_CANCEL_OPERATION  1

/* Values for IMSG_INPUT.scalingMode */
#define IMSG_STEPLESS_SCALING  1
#define IMSG_IDCT_SCALING_8    2
#define IMSG_IDCT_SCALING_4    3
#define IMSG_IDCT_SCALING_2    4
#define IMSG_NO_SCALING        5

/* Values for IMSG_INPUT.inputFiletype */
#define IMSG_JPG               1
#define IMSG_RGB_BITMAP        2
#define IMSG_YUV_BITMAP        3

/* Values for IMSG_INPUT.targetSizeControl */
#define IMSG_Q_CONTROL         1
#define IMSG_SIZE_CONTROL      2
#define IMSG_NO_SIZE_CONTROL   3

/* Values for IMSG_INPUT.colorInformation */
#define IMSG_REMOVE_COLORS     1
#define IMSG_PRESERVE_COLORS   2

/* Values for IMSG_OUTPUT.status */
#define IMSG_OK                   1
#define IMSG_UNSUPPORTED          2
#define IMSG_BIT_ERROR            3
#define IMSG_OUT_OF_MEMORY        4
#define IMSG_READ_ERROR           5
#define IMSG_WRITE_ERROR          6
#define IMSG_CANCEL_OK            7
#define IMSG_INVALID_PARAMETER    8
#define IMSG_INVALID_COMBINATION  9

/* Values for IMSG_OUTPUT.colorInformation */
#define IMSG_COLORS_PRESENT  1
#define IMSG_COLORS_ABSENT   2

/* Grabbing select */
#define IMSG_GRABBING_UNUSED  -1

/*
     DATA TYPES
     ==========
*/

/* IMSG input interface object */
typedef struct {
/* Input and output files: */
  char *IMEI_inputFileName;
  char *IMEI_outputFileName;
  word IMEI_inputFiletype;
/* Message flag for canceling operation. */
  volatile word *IMEI_cancelOperation;
/* Manipulation parameters: */
  word IMEI_operationMode;
  word IMEI_scalingMode;
  word IMEI_rotationAngle;
  word IMEI_targetSizeControl;
  word IMEI_Q_Value;
  dword IMEI_targetSizeInBytes;
  word IMEI_colorInformation;
  word IMEI_outputDimX;
  word IMEI_outputDimY;
/* Grabbing coordinates. Set to IMSG_GRABBING_UNUSED if not used. */
  word IMEI_grabTopLeftX;
  word IMEI_grabTopLeftY;
  word IMEI_grabWidth;
  word IMEI_grabHeight;
/* Input image information for raw RGB and YUV bitmaps: */
  word IMEI_inputDimX;
  word IMEI_inputDimY;
/* Special information for YUV input: */
  word IMEI_nComp;
  word IMEI_samplingFactors[3][2];
} ImageMainEngineInput} ;

typedef ImageMainEngineInput * IMSG_INPUT_ptr * ;

/* IMSG output interface object */
typedef struct {
/* Status flag: */
  word IMEO_status;
/* Manipulation results: (or image properties) */
  word IMEO_usedQValue;
  dword IMEO_resultedSize;
  word IMEO_colorInformation;
  word IMEO_resultDimX;
  word IMEO_resultDimY;
/* Special information for YUV input: */
  word IMEO_nComp;
  word IMEO_samplingFactors[3][2];
} ImageMainEngineOutput} ;

typedef ImageMainEngineOutput * IMSG_OUTPUT_ptr * ;

/*
     ROUTINE PROTOTYPES
     ==================
*/

extern void _cdecl ImsgMainEngine  ( IMSG_INPUT_ptr imsgInput,
                                    IMSG_OUTPUT_ptr imsgOutput);

#endif  /* IMSG_MSG_H */


modemC.goh

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1996 -- All Rights Reserved
 *	GEOWORKS CONFIDENTIAL
 *
 * PROJECT:
 * MODULE:
 * FILE:	  modemC.goh
 *
 * AUTHOR:  	  Chris Thomas: Aug 27, 1996
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	CT	8/27/96   	Initial version
 *
 * DESCRIPTION:
 *
 * 	$Id: modemC.goh,v 1.1.1.2 96/09/25 11:37:53 cthomas Exp $
 *
 *	C interface for the modem driver.
 *
 *
 *
 * A client is any geode which is using the modem driver.  The modem driver
 * can only have one client at a time to prevent multiple clients from
 * sending conflicting commands to the modem during a single communications
 * session.
 *
 * Clients open the serial port by calling ModemOpen(), which also serves
 * to inform the modem driver that it has a client.  If the modem driver
 * already has a client, it will return an error.  Clients "unregister" by
 * calling ModemClose() which will also close the serial port.
 *
 * Clients are responsible for configuring the serial port.  Clients read
 * and write data directly to the port.  The modem driver receives all
 * serial data notifications.  Clients may register for data notification
 * through the modem driver, but only data arriving during data mode
 * will be passed to the client.
 *
 * Data mode can only occur after a CONNECT has been received.  The modem
 * driver's default mode is command mode.  Once a connection has been
 * established, the modem stays in data mode until the client has issued
 * a hangup command.  A modem driver cannot detect a NO CARRIER arriving
 * in the middle of data, so it does not know when to switch back to command
 * mode.
 *
 * If clients may use direct serial connections or the modem driver, the
 * code must handle both cases and set up data notitifications correctly.
 *
 * Normally, clients will not see any of the modem commands or response
 * strings.  If the client has registered to be notified of modem responses,
 * then each response will be passed to the client.
 *
 * Each modem driver function will not return until the command has been
 * completed.  The result of the command will be returned.  If no response
 * from the modem is received after a given amount of time, the driver will
 * return with a timeout error to avoid blocking the client forever.
 *
 ***********************************************************************/

@ifndef _MODEMC_GOH_
@define _MODEMC_GOH_

#include  <driver.h>
#include  <streamC.h>

/*
 * Error codes returned from modem functions
 */

typedef enum {
    MRC_NOT_SUPPORTED	 = 1,
    MRC_DRIVER_IN_USE	,
    MRC_TIMEOUT	,
    MRC_UNKNOWN_RESPONSE	,
    MRC_OK	,
    MRC_ERROR	,
    MRC_BUSY	,
    MRC_NO_DIALTONE	,
    MRC_NO_ANSWER	,
    MRC_NO_CARRIER	,
    MRC_CONNECT	,
    MRC_CONNECT_1200	,
    MRC_CONNECT_2400	,
    MRC_CONNECT_4800	,
    MRC_CONNECT_9600	,
    MRC_BLACKLISTED	,
    MRC_DELAYED	,
} ModemResultCode} ;

/*
 * ModemOpen()
 *
 * Opens the serial port to be used for a modem connection, and
 * places modem driver in command mode.
 *
 * Returns TRUE on error (port could not be opened)
 */

extern  Boolean
           _pascal ModemOpen (GeodeHandle driver,     /* Handle of serial driver */
              SerialPortNum port,	  /* Serial port number */
              StreamOpenFlags flags,  /* Flags for SerialOpen() */
              word inBuffSize,	  /* input buffer size */
              word outBuffSize,	  /* output buffer size */
              word timeout);	  /* timeout if SOF_TIMEOUT */

/*
 * ModemClose()
 *
 * Close the serial port being used for the modem connection.
 * Does not attempt to hang up an existing call.  Use
 * ModemHangup() for that.
 */

extern void
    _pascal ModemClose (SerialPortNum port,	  /* Serial port number */
               StreamLingerMode linger); /* StreamClose linger mode */

/*
 * ModemSetRoutineDataNotify()
 *
 * Registers a routine to be called when data is received
 * from the modem while a call is active.
 * As with the serial driver's data notification, further
 * notifications will not be sent until the serial port
 * has been read.
 */

typedef void _pascal
    (*ModemDataNotifyRoutinePtr	(*)(word data);

extern void
    _pascal ModemSetRoutineDataNotify (SerialPortNum port,
                      word data, /* data param passed
                            to callback */
                      ModemDataNotifyRoutinePtr callback);

/*
 * ModemSetMessageDataNotify()
 *
 * Registers a message to be sent when data is received
 * from the modem while a call is active.
 * As with the serial driver's data notification, further
 * notifications will not be sent until the serial port
 * has been read.
 */

@prototype void MODEM_DATA_NOTIFICATION ();
    /* Message prototype of the data notification message */

extern void
    _pascal ModemSetMessageDataNotify (SerialPortNum port,
                      Message msg,
                      optr destination);

/*
 * ModemSetRoutineResponseNotify()
 *
 * Registers a routine to be called when a response is received
 * from the modem (while in command mode).
 *
 */

typedef void _pascal
    (*ModemResponseNotifyRoutinePtr	(*)(word data,
                     word responseSize,
                     char *response);

extern void
    _pascal ModemSetRoutineResponseNotify (SerialPortNum port,
                          word data,
                          ModemResponseNotifyRoutinePtr callback);

/*
 * ModemSetMessageResponseNotify()
 *
 * Registers a message to be sent when a response is received
 * from the modem (while in command mode).  Response is passed
 * in a Memory block, which should be freed by the message handler.
 */

@prototype void MODEM_RESPONSE_NOTIFICATION (word responseSize = cx,
                        MemHandle response = dx);
    /* Message prototype of response notification */

extern void
    _pascal ModemSetMessageResponseNotify (SerialPortNum port,
                          Message msg,
                          optr destination);

/*
 * ModemDial()
 *
 * Sends the modem's dial command to dial a particular number, and
 * returns after a connection has been established, or an error has
 * occurred.
 *
 * Returns non-zero if an error occurred.
 * Modem response returned in result parameter.
 */

extern Boolean
    _pascal ModemDial (SerialPortNum port,
              word strLen,		/* length of dialStr (not
                         * including null	  */
              const char *dialStr,  /* Phone number to dial */
              ModemResultCode *result); /*

/*
 * ModemAnswerCall()
 *
 * Answers an incoming data call.
 * Returns after a connection has been established, or an error has
 * occurred.
 *
 * Returns non-zero if an error occurred.
 * Modem response returned in result parameter.
 */

extern Boolean
    _pascal ModemAnswerCall (SerialPortNum port, ModemResultCode *result);

/*
 * ModemHangup()
 *
 * Hangs up an existing data call.
 * Returns after successfuly hanging up, or an error has
 * occurred.
 *
 * Returns non-zero if an error occurred.
 * Modem response returned in result parameter.
 */

extern Boolean
    _pascal ModemHangup (SerialPortNum port, ModemResultCode *result);

/*
 * ModemReset()
 *
 * Switches to command mode, and resets the modem.
 * Returns after successfuly resetting, or an error has occurred.
 *
 * Returns non-zero if an error occurred.
 * Modem response returned in result parameter.
 */

extern Boolean
    _pascal ModemReset (SerialPortNum port, ModemResultCode *result);

/*
 * ModemFactoryReset()
 *
 * Restores the factory settings of the modem.  Must be in command mode
 * to use this function.
 * Returns after successfuly resetting, or an error has occurred.
 *
 * Returns non-zero if an error occurred.
 * Modem response returned in result parameter.
 */

extern Boolean
    _pascal ModemFactoryReset (SerialPortNum port, ModemResultCode *result);

/*
 * ModemInitModem()
 *
 * Initializes the modem with a modem command string.  A leading 'AT'
 * need not be supplied.  Must be in command mode to use this function.
 * Returns after successfuly initializing, or an error has occurred.
 *
 * Returns non-zero if an error occurred.
 * Modem response returned in result parameter.
 */

extern Boolean
    _pascal ModemInitModem (SerialPortNum port, word strLen,
                   const char *initStr,
                   ModemResultCode *result);
/*
 * ModemAutoAnswer()
 *
 * Sets up the mode to auto-answer future incoming calls.
 * Must be in command mode to use this function.
 * This function does not wait for a call to come in, but
 * returns immediately after successfuly setting the modem to auto-answer,
 * or an error occurrs doing so.
 *
 * Returns non-zero if an error occurred.
 * Modem response returned in result parameter.
 */

extern Boolean
    _pascal ModemAutoAnswer (SerialPortNum port, word numRings,
                ModemResultCode *result);

/*
 * ModemSetMessageEndCallNotify()
 *
 * Registers an object to receive a message if the call has been ended
 * for any reason.  This may not be supported on all platforms.
 * To unregister notification, pass optr=NullOptr.
 *
 * Returns non-zero if not supported
 *
 */

@prototype void MODEM_END_CALL_NOTIFICATION ();
    /* Message prototype of end-call notification */

extern Boolean
    _pascal ModemSetMessageEndCallNotify (SerialPortNum port,
                         Message msg,
                         optr destination);

#ifdef __HIGHC__

pragma	Alias (ModemOpen, "MODEMOPEN");
pragma	Alias (ModemClose, "MODEMCLOSE");
pragma	Alias (ModemSetRoutineDataNotify, "MODEMSETROUTINEDATANOTIFY");
pragma	Alias (ModemSetMessageDataNotify, "MODEMSETMESSAGEDATANOTIFY");
pragma	Alias (ModemSetRoutineResponseNotify, "MODEMSETROUTINERESPONSENOTIFY");
pragma	Alias (ModemSetMessageResponseNotify, "MODEMSETMESSAGERESPONSENOTIFY");
pragma	Alias (ModemDial, "MODEMDIAL");
pragma	Alias (ModemAnswerCall, "MODEMANSWERCALL");
pragma	Alias (ModemHangup, "MODEMHANGUP");
pragma	Alias (ModemReset, "MODEMRESET");
pragma	Alias (ModemFactoryReset, "MODEMFACTORYRESET");
pragma	Alias (ModemInitModem, "MODEMINITMODEM");
pragma	Alias (ModemAutoAnswer, "MODEMAUTOANSWER");
pragma	Alias (ModemSetMessageEndCallNotify, "MODEMSETMESSAGEENDCALLNOTIFY");
#endif /* __HIGHC__ */

@endif /* _MODEMC_GOH_ */


mouseDr.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	mouseDr.h
 *
 *
 * REVISION HISTORY:
 *
 *	Name	Date		Description
 *	----	----		-----------
 *	atw	9/23/92		Initial revision
 *
 *
 * DESCRIPTION:
 *	This file defines mouse driver information.
 *
 *	$Id: mouseDr.h,v 1.1.26.1 96/04/28 08:29:53 chris Exp $
 *
 ***********************************************************************/

#ifndef	__MOUSEDR_H
#define __MOUSEDR_H

#include  <driver.h>

#define	MOUSE_PROTO_MAJOR	   (DRIVER_PROTO_MAJOR+1)
#define	MOUSE_PROTO_MINOR	   (DRIVER_PROTO_MINOR+0)

typedef struct {
    DriverExtendedInfoStruct	MDIS_common;
    word    MDIS_numButtons;

    /*
     *	MDIS_xRes/MDIS_yRes are the resolution (in points per inch) of the
     *  points collected by the digitizer. Mouse drivers have this word set
     *	to 0.
     */

    word    MDIS_xRes;
    word    MDIS_yRes;
} MouseDriverInfoStruct} ;

#endif


Objects\SDK_C\msCalcC.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) GeoWorks 1993 -- All Rights Reserved

PROJECT:	PC SDK
MODULE:		Sample Library -- Mandelbrot Set Library
FILE:		msCalcC.goh

AUTHOR:		Paul DuBois, Aug 27, 1993

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    dubois	8/27/93   	Initial version.

DESCRIPTION:
    Class definitions for the Mandelbrot Set library.
    This file contains the definition of MSetCalcClass.

    $Id: msCalcC.goh,v 1.4.7.1 96/04/28 08:32:30 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef __MSET_CALC_CLASS_GOH
#define __MSET_CALC_CLASS_GOH

@deflib mset		/* See msetC.goh for a description of this keyword */

@include  <SDK_C/mset.goh>

/*
 * Since we are defining MSetCalc as a subset of Process,
 * we need to include the requisite .goh file ""
 */
@include  <Objects/processC.goh>
@class	MSetCalcClass, ProcessClass;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Since classes for threads can have no instance data, we must pass
 * in all the data that the MSetCalc object might need.  To ensure
 * consistency, we use this message prototype when defining our messages.
 */
@prototype void MSG_MSC_PROTO (optr		myMSet,
                  VMFileHandle	vmfh,
                  VMBlockHandle	mscpVM);

/*
 * Start calculating.  Exit when another message arrives for this object,
 * or when all the calculating is done.  Calculations may be re-started by
 * sending this message again.  Be sure to NOT use @call, because this
 * message will not return until the MSet is fully calculated, or
 * calculation is paused or restarted.
 *
 * Context:	 Calculation control
 * Source:	 MSet object
 * Destination:	 MSet object's associated MSetCalc
 * Interception: unlikely
 */
@message(MSG_MSC_PROTO) MSG_MSC_CALCULATE;

/*
 * Has an empty handler -- just here to cause MSG_MSC_CALCULATE to exit.
 *
 * Context:	 Calculation control
 * Source:	 MSet object
 * Destination:	 MSet object's associated MSetCalc
 * Interception: unlikely
 */
@message void MSG_MSC_PAUSE ();

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Instance data and defaults
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Object classes for threads aren't LMem objects; they don't
 * have instance data, or any other data storage other than the
 * stack itself.  If it needs a place to stick data, it will have
 * to create it itself (or be passed the handle of a newly created
 * block).
 */

@endc

@endlib

#endif	/* __MSET_CALC_CLASS_GOH */


Objects\SDK_C\msColCC.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) GeoWorks 1993 -- All Rights Reserved

PROJECT:	PC SDK
MODULE:		Sample Library -- Mandelbrot Set Library
FILE:		colorCtr.goh

AUTHOR:		Tom Lester, Aug  5, 1993

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    TL	8/ 5/93   	Initial version.

DESCRIPTION:
    This file defines the MSetColorControlClass.

    $Id: msColCC.goh,v 1.5.7.1 96/04/28 08:32:32 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef __MSET_COLOR_CONTROL_GOH
#define __MSET_COLOR_CONTROL_GOH

@deflib mset		/* See msetC.goh for a description of this keyword */

@include  <Objects/gCtrlC.goh> 		/* include GenControlClass */

/*
 * Define the MSetColorControllerClass
 */
@class	MSetColorControlClass, GenControlClass ;

/***********************************************************************
 *              Internal Messages
 ***********************************************************************/

/*
 * Context:	 send message to MSet object to set color scheme
 * Source:	 MSetColorControl object
 * Destination:	 output of the controller (a MSet object)
 * Interception: ok, but call superclass
 */
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_MSCC_SET_COLOR_SCHEME;

/*
 * The GCI_output field contains the optr of the object to which
 * the controller is currently sending its "apply" messages. This
 * field is typically set to a GenTravelOption (such as TO_APP_TARGET)
 * or to a TravelOption (such as TO_OBJ_BLOCK_OUTPUT).
 * We want to send the messages to the selected MSet object which
 * will be the application target.
 */
@default GCI_output = (TO_APP_TARGET);

/***********************************************************************
 *              Feature and Tool Sets
 ***********************************************************************/

/*
 * Define the Feature set of the controller class. To do this we define
 * a record type of type WordFlags and one flag for each feature. The
 * record type may be named anything but typically its name will consist
 * of the acronym of the controller class with the suffix "Features."
 * When a flag is set, the feature it represents is turned on; when
 * clear, its feature is off.
 *
 * note: The flags are numbered this way due to assembly language
 *       compatability. They can actually be numbered any way you
 *       like.
 */

/* MSCCFeatures */
typedef WordFlags MSCCFeatures ;
#define MSCCF_COUNT 		0x0010
#define MSCCF_BRIGHT 		0x0008
#define MSCCF_GREY 		0x0004
#define MSCCF_CONTRAST 		0x0002
#define MSCCF_DOUG 		0x0001

/*
 * Define the Tool set of the controller. The Tool set is similar to
 * the Feature set but since the tools are independent of the features,
 * two different sets of flags must be defined. The note about numbering
 * the Feature flags also applies to the Tool flags.
 */

/* MSCCToolboxFeatures */
typedef WordFlags MSCCTFeatures ;
#define MSCCTF_COUNT 		0x0010
#define MSCCTF_BRIGHT 		0x0008
#define MSCCTF_GREY 		0x0004
#define MSCCTF_CONTRAST 		0x0002
#define MSCCTF_DOUG 		0x0001

/*
 * Set the default feature and tool sets. These are used in the handler
 * for the controller message MSG_GEN_CONTROLER_GET_INFO
 */
#define MSCC_DEFAULT_FEATURES  (MSCCF_COUNT | MSCCF_BRIGHT | MSCCF_GREY | \
                   MSCCF_CONTRAST| MSCCF_DOUG)

#define MSCC_DEFAULT_TOOLBOX_FEATURES  (MSCCTF_COUNT | MSCCTF_BRIGHT | \
                       MSCCTF_GREY | MSCCTF_CONTRAST| \
                       MSCCTF_DOUG)

@endc  /* MSetColorControlClass */

@endlib
#endif  /* __MSET_COLOR_CONTROL_GOH */


SDK_C\mset.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) GeoWorks 1993 -- All Rights Reserved

PROJECT:	PC SDK
MODULE:		Sample Library -- Mandelbrot Set Library
FILE:		mset.goh

AUTHOR:		Paul DuBois, Aug  3, 1993

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    dubois	8/ 3/93   	Initial version

DESCRIPTION:
    Structures and definitions for the Mandelbrot Set library.

    NOTE:
    If any changes are made, make sure they are reflected in the .def
    file used by the assembly calculation routines!
    (pcgeos\Library\SDK_C\MSet\mset.def)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@optimize

#include  <geos.h>
#include  <thread.h>

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

            MSet Library
        MSetClass
        MSetCalcClass
        MSetColorControlClass
        MSetPrecisionControlClass

Contents
--------
    Contents
    Synopsis
    Terminology
    Limitations
    How to use
    Exported functions
    The rest of this file

Synopsis
--------

    The MSet library was designed to allow users to view and
    interactively explore the Mandelbrot set.  MSet objects are
    controller-aware (two controllers are included in this release) and ""
    spawn off their own thread to perform their calculations.  The MSet
    object supports zooming in and out, changing color schemes and
    calculation precision, and saving and restoring themselves from
    disk.

    MSetClass is a direct subclass of VisClass.  It subclasses these
    messages:

            MSG_VIS_DRAW
            MSG_VIS_SET_SIZE
            MSG_META_DETACH
            MSG_META_START_SELECT
            MSG_META_GAINED_TARGET_EXCL
            MSG_META_LOST_TARGET_EXCL

    The MSet uses a VM file provided by the user of the object to store
    its data.  Upon receiving the VM file, the MSet spawns off an
    event-driven thread to calculate the points in the Mandelbrot set.
    Clicking the MSet with the Select mouse button will select the point
    that will be used to zoom in on.  Double-clicking the Select button
    will actually zoom on the selected point.

    The MSet library comes with two controllers: one for setting the
    precision which will be used in the calculations, and one for
    changing the color schemes.

Terminology
-----------
    Mandelbrot Set --
        This explanation is not necessary to use the MSet object,
        but it might make things a bit clearer.

        The Mandelbrot set is calculated by taking a point C on the
        complex plane and performing the following iteration:

            Z[0]	:= (0,0)
            Z[i+1]	:= Z[i]^2 + C

        until |Z| (magnitude of Z, or the distance from the origin)
        is greater than the "escape radius" (usually 2).

        The value of i for which Z finally strays beyond the escape
        radius is called the "dwell" of that point, the analogy
        being that the point hangs around ("dwells in") the general
        vicinity of the origin for that many iterations.

        The set of points which always stay within the escape radius
        is called the Mandelbrot set after Benoit Mandelbrot, who
        popularized the famous bug-like image.  These points are
        said to have a dwell of infinity.

        From a practical standpoint, we always implement a cut-off
        point for the number of iterations.  The further one zooms
        in, the higher the cut-off needs to be to generate nice
        images; however, a maximum of 50-200 is usually quite
        sufficient for initial viewing.

        If some of the above escaped you, don't worry.  The main
        thing to remember is that each point has an associated
        dwell.  The higher the dwell, the longer it takes to
        calculate.  Because of this, we impose an arbitrary cut-off
        point which we use to stop calculations on points with very
        large (or infinite) dwells.

    Count --
        A synonym for dwell

    Color Scheme --
        This is the term used for a mapping between a point's dwell
        and a color.  By convention, points with dwells greater than
        or equal to the cut-off are assigned the color black.

    Calculation Thread --
        This is the event-driven thread which performs the
        iterations.  Usually, its existence can be ignored by the
        client of the MSet.  Its default priority is low so as not
        to impair the performance of other applications.  However,
        the MSet object defines the message MSG_MSET_SET_PRIORITY,
        should you ever wish to change it.

    Resolution --
        Each pixel on the screen represents a point on the
        complex plane.  The distance between the two points
        represented by two adjacent pixels is the resolution.  The
        MSet has both a horizontal and vertical resolution, although
        in practice the two are almost always equal.

    Precision --
        By default, the calculations use 16-bit fixed point
        arithmetic -- 4 bits of integer, and 12 bits of fraction.
        Once you start zooming in further, 12 bits won't be enough.
        Therefore, the MSet also supports 48-bit fixed-point
        arithmetic (4 bits integer, 44 bits fraction).

    Parameters Block --
        The MSet has very little instance data; most of the fields
        the MSet uses are stored in a struct MSetParameters, which
        resides in its own block.  This block is usually referred to
        as the parameters block.  Following this struct in the
        parameters block is an array of VMBlockHandles; these are
        the blocks which actually contain the calculated dwell
        values.

Limitations
-----------
    There is no provision for the MSet allocating a VM file for its own
    use; it must be provided by the application.

    The precision does not change automatically from 16 to 48 bits.  If
    you find that after a zoom the screen is filled with just one color,
    try switching to 48 bit precision.

    Resizing is clunky -- the MSet will always resize itself back to the
    default (100x100) when initialized.  This behavior will probably be
    changed in the future.

    Many MSG_MSET_SET... messages pause the calculation thread, and
    re-start it when they are done modifying the affected parameters.
    However, they re-start the thread regardless of whether or not it
    was already paused.  This will most likely change in the future;
    paused threads will remain paused.

How to use the MSet
-------------------
    Where to put the object --
        To use an MSet object, find a place for it in your Vis
        hierarchy; treat it like any other Vis object.  If you
        specify bounds for it, note that they will be altered upon
        initialization.  You should send MSet a MSG_MSET_INITIALIZE
        as soon as possible; an uninitialized MSet is pretty
        useless.

    Initializing a new MSet --
        If you're not opening up an old data file, pass
        MSG_MSET_INITIALIZE a valid VMFileHandle and a NULL
        VMBlockHandle.  The message handler will allocate an
        MSetParameters block and return its VMBlockHandle.  You will
        probably want to save this handle somewhere in the VM file
        for later use, if you wish to be able to re-use the MSet's
        stored data.

        Initializing the MSet spawns off a calculation thread.
        However, the thread will not actually begin calculating
        until you send the MSet a MSG_MSET_CONTINUE_CALCULATION.
        This is a convenient point to send a MSG_VIS_SET_SIZE.

    Initializing an MSet with a saved MSet file --
        Open up the VM file and extract the VMBlockHandle of the
        parameters block.  Pass MSG_MSET_INITIALIZE both of these
        values.

    Re-initializing an MSet --
        If you wish to re-initialize an MSet object, first send it a
        MSG_MSET_STOP_CALCULATION, which effectively
        "un-initializes" the MSet.

    Pausing/Continuing the thread --
        Many VM File functions (VMSave being a notable one) will not
        work if a block in that file is being locked by another
        thread.  Since the calculation thread will almost always
        have a block locked, you should use the
        MSG_MSET_PAUSE_CALCULATION message before calling any of
        these routines.  This is probably the only time you'll need
        to explicitly pause or continue the thread.

    Setting parameters --
        May MSG_MSET_SET... methods cause the calculation thread to
        start over from scratch; if they do, they will say so in the
        @message comment headers (in msetC.goh).

    Using the provided controllers --
        The controllers operate on the designated target.  All you
        need to do is drop the controllers into your UI, and have
        some mechanism for giving your MSets the target exclusive.

Exported functions
------------------

[see bottom of this file for function prototypes.
 FixNums are defined later in this file]

extern void _far _pascal
    FixNumUMult(FixNum _far* c, FixNum _far* a, FixNum _far* b);

extern void _far _pascal
    FixNumUMultTimes2(FixNum _far* c, FixNum _far* a, FixNum _far* b);

extern void _far _pascal
    FixNumAdd(FixNum _far* c, FixNum _far* a, FixNum _far* b);

extern void _far _pascal
    FixNumSub(FixNum _far* c, FixNum _far* a, FixNum _far* b);

extern void _far _pascal
    FixNumToAscii(FixNum _far* num, char _far* buffer, word bufSiz);

FixNumUMult		-- Multiply two FixNums
FixNumUMultTimes2	-- Multiply two FixNums, then double the result
FixNumAdd		-- Add two FixNums
FixNumSub		-- Subtract two FixNums
FixNumToAscii		-- Convert a FixNum to an ascii string.

The rest of this file
---------------------

    To use the MSet library, you do not need to be familiar with the
    contents of the rest of this file.  However, it would be useful if you
    wish to subclass any of the classes in the library.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
          Enumerated types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Floating-point is not currently supported
 */
typedef enum
{
    MSP_16BIT    		= 0x04,	/* 16-bit fixed-point */
    MSP_48BIT    		= 0x02,	/* 48-bit fixed-point */
    MSP_FLOATING    	= 0x01,	/* FPU-supported floating-point */
} MSetPrecision} ;

typedef enum
{
    MSC_COUNT    		= 0x10,	/* Use low 4 bits of dwell */
    MSC_BRIGHT    		= 0x08,	/* Use bright colors */
    MSC_GREY    		= 0x04,	/* Use pseudo-greyscale */
    MSC_CONTRAST    	= 0x02,	/* Use contrasting colors */
    MSC_DOUG    		= 0x01,	/* Use doug-chosen colors */
} MSetColor} ;

typedef ByteFlags MSetCalcReturnFlags ;
#define MSCRF_MESSAGE_WAITING 		0x80
#define MSCRF_BLOCK_DIRTIED 		0x40

/*
 * This is the return value for the routine which calculates the points
 * of the MSet.
 */
typedef enum
{
    MSCR_nominal     = 0,		/* Call completed normally */
    MSCR_messageWaiting    ,	/* Call stopped prematurely because a */
                /* message was waiting in the queue */
} MSetCalcReturn} ;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Structures
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * The following three structure declarations are here mostly for the C
 * compiler's benefit.  For more information on their usage, please see
 * mset.def.
 */

/*
 * 4 bits of integer, 44 bits of fraction.
 */
typedef struct
{
    word	FN_high;
    word	FN_middle;
    word	FN_low;
} FixNum} ;

typedef union
{
    word	MSN_16bit;
    FixNum	MSN_48bit;
/*    qword	MSN_Float;*/
} MSetNum} ;

typedef struct
{
    MSetNum	MN_A;
    MSetNum	MN_B;
    MSetNum	MN_X;
    MSetNum	MN_Y;
    MSetNum	MN_x2;
    MSetNum	MN_y2;
    MSetNum	MN_prod;
} MSetNumState} ;

/*
 * There is one MSetParameters struct associated with every MSet object.  It
 * is stored in its own VM block.
 *
 * MSP_calcBlock	VMHandle of a block which holds an MSetCalcParameters
 * MSP_dataMapBlock	VMHandle of a block which holds an array of
 * 			MSetDataHandles.  The MSetCalcParameters struct also
 *			has a copy of this handle.
 * MSP_colorScheme	Designates a map from scaled dwells to colors
 * MSP_precision	Precision with which calculations are performed
 *
 *** The following 3 fields are duplicated in the MSetCalcParameters struct
 *
 * MSP_maxDwell		Maximum # of iterations to perform per point**
 * MSP_pixelWidth	Width of the image in pixels**
 * MSP_pixelHeight	Height of the image in pixels**
 *
 ***
 *
 * MSP_threadPriority	Reflects the current priority of the calculation
 *			thread.  Placed here so the controllers can reflect
 *			the current setting.
 * MSP_selected[XY]	The coordinates of the last place the user clicked;
 *			stored as offsets from the top-left corner.
 * MSP_lastZoom		The last value of zoomVal passed to MSG_MSET_ZOOM;
 *			when the user double-clicks on the MSet, this value
 *			is passed to MSG_MSET_ZOOM.
 * MSP_lastLine		Last line that has been calculated, used for drawing
 *			purposes.  It is usually only increased, by sending
 *			a MSG_MSET_NEW_LINE; the handler then draws all
 *			points between the old and new value.  -1 implies no
 *			lines have been drawn yet.
 */
typedef struct
{
    VMBlockHandle	MSP_calcBlock;
    VMBlockHandle	MSP_dataMapBlock;

    MSetColor		MSP_colorScheme;
    MSetPrecision	MSP_precision;
    word		MSP_maxDwell;
    word		MSP_pixelWidth;
    word		MSP_pixelHeight;
    word		MSP_threadPriority;
    sword		MSP_selectedX;
    sword		MSP_selectedY;
    BBFixedAsWord	MSP_lastZoom;
    sword		MSP_lastLine;
} MSetParameters} ;

/*
 * There is one MSetInfoStruct associated with every MSet object.  It is
 * stored in a VM block, along with all the MSetDataHandles needed to store
 * the fully calculated MSet.  The block is shared with the calculation
 * thread, which will periodically check to see if it's been altered.
 *
 * MSP_pixelWidth	Width of the image in pixels
 * MSP_pixelHeight	Height of the image in pixels
 * MSCP_dataMapBlock
 * MSP_left		X (real) coordinate of the top-left corner
 * MSP_top		Y (imaginary) coordinate of the top-left corner
 * MSP_hRes		Distance between two X pixels
 * MSP_vRes		Distance between two Y pixels
 * MSP_maxDwell		Maximum # of iterations to perform per point
 *
 * MSP_count		Dwell value of the current point being calculated
 * MSP_vars		Temporary storage for variables during calculation
 *
 * MSP_calcPointVec	Local vector to a point calculation routine
 * MSP_copyVec		Local vector to a number copying routine
 * MSP_addVec		Local vector to a routine to add two numbers
 * MSP_subVec		Local vector to a routine to subtract two numbers
 *
 */
typedef struct
{
    VMBlockHandle	MSCP_dataMapBlock;
    word		MSCP_pixelWidth;
    word		MSCP_pixelHeight;
    FixNum		MSCP_left;
    FixNum		MSCP_top;
    FixNum		MSCP_hRes;
    FixNum		MSCP_vRes;
    word		MSCP_maxDwell;

    word		MSCP_count;
    MSetNumState	MSCP_vars;

    void _near 		(*MSCP_calcPointVec)();
    void _near 		(*MSCP_copyVec)();
    void _near		(*MSCP_addVec)();
    void _near		(*MSCP_subVec)();
} MSetCalcParameters} ;

/*
 * Any data which it might be convenient to store with the VMHandle goes
 * here.
 */
typedef struct
{
    VMBlockHandle	MSDH_blockHandle;
} MSetDataHandle} ;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Externally defined functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

extern void _far _pascal
    MSSetupCalcVectors    (MSetCalcParameters _far* mscpP,
               MSetPrecision		precision);

extern MSetCalcReturn _far _pascal
    MSLineBasedDoLine    (word lineNum,
              MSetCalcParameters _far* mscpP,
              word _far* dataP);

/*
 * For the following math routines, it is OK for a source and destination
 * pointer to be the same.
 *
 * FixNumUMult:		c = a * b		(unsigned)
 * FixNumUMultTimes2:	c = 2 * a * b		(unsigned)
 * FixNumAdd:		c = a + b
 * FixNumSub:		c = a - b
 *
 * FixNumToAscii:
 *	Convert a FixNum to a null-terminated, ascii string of the form
 *	-n.mmmm.  The buffer should be 18 characters long, but may be
 *	shorter.  bufSiz should be the size of the buffer - 1 (1 for the
 *	null byte).
 */

extern void _far _pascal
    FixNumUMult    (FixNum _far* c, FixNum _far* a, FixNum _far* b);

extern void _far _pascal
    FixNumUMultTimes2    (FixNum _far* c, FixNum _far* a, FixNum _far* b);

extern void _far _pascal
    FixNumAdd    (FixNum _far* c, FixNum _far* a, FixNum _far* b);

extern void _far _pascal
    FixNumSub    (FixNum _far* c, FixNum _far* a, FixNum _far* b);

extern void _far _pascal
    FixNumToAscii    (FixNum _far* num, char _far* buffer, word bufSiz);

#ifdef __HIGHC__
pragma Alias(MSSetupCalcVectors, "MSSETUPCALCVECTORS");
pragma Alias(MSLineBasedDoLine, "MSLINEBASEDDOLINE");
pragma Alias(FixNumUMult, "FIXNUMUMULT");
pragma Alias(FixNumUMultTimes2, "FIXNUMUMULTTIMES2");
pragma Alias(FixNumAdd, "FIXNUMADD");
pragma Alias(FixNumSub, "FIXNUMSUB");
pragma Alias(FixNumToAscii, "FIXNUMTOASCII");
#endif


Objects\SDK_C\msetC.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) GeoWorks 1993 -- All Rights Reserved

PROJECT:	PC SDK
MODULE:		Sample Library -- Mandelbrot Set Library
FILE:		msetC.goh

AUTHOR:		Paul DuBois, Aug  9, 1993

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    dubois	8/ 9/93   	Initial version.

DESCRIPTION:
    Class definitions for the Mandelbrot Set library.
    This file contains the definition of MSetClass.

    $Id: msetC.goh,v 1.26.7.1 96/04/28 08:32:31 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef __MSET_CLASS_GOH
#define __MSET_CLASS_GOH

/*
 * Any .goh files which define classes in a library should be delimited with
 * the @deflib and @endlib keywords.  Note that files which containe just
 * code and/or data do not require these keywords (though they are allowed).
 *
 * Do not forget to pass the -L <libname> to goc when compiling the library.
 * If you don't, you will most probably get compile errors in any file which
 * has a @classdecl for a class defined in the library.
 *
 * For more information on @deflib and @endlib, see Concepts section 5.4.3.1
 */
@deflib mset

@include  <SDK_C/mset.goh>

@include  <Objects/visC.goh>

@class	MSetClass, VisClass;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * This message sets up all the VM storage that the MSet object needs to
 * store the results of its calculations.  There are a couple possibilities:
 *
 * 1.	A new MSet is being calculated
 * 	Pass in the VMFileHandle, and a NULL VMBlockHandle.  The MSet will
 *	initialize a block for its own use and return its VMBlockHandle.
 *	Pass this VMBlockHandle when restoring from a VM File.
 *
 * 2.	The MSet is being restored from a VM File
 *	Pass in the VMFileHandle and the VMBlockHandle of the MSet data
 *	block, described above in #2.  The return value may be ignored
 *
 * Context:	 MSet initialization
 * Source:	 Any object (but probably the parent)
 * Destination:	 Any MSet object
 * Interception: unlikely; be sure to @callsuper().
 */
@message VMBlockHandle MSG_MSET_INITIALIZE (VMFileHandle vmfh,
                       VMBlockHandle vmbh);

/***********************************************************************
 *		Thread control messages
 ***********************************************************************/

/*
 * Causes the calculation thread to pause, with the side effect that after
 * it has stopped, it will not be locking any VM blocks in the MSet's
 * associated VM file.  Note that to be sure that calculation has stopped,
 * this message should be used with @call, not @send.
 *
 * This message is useful when you want to know that the calculation thread
 * will not be locking (and changing!) any VM blocks for a while.  You might
 * need this if the VM file being used by the thread is not marked for
 * multiple thread access, and you wish to perform some functions on the
 * file -- VMSave, for instance.
 *
 * Context:	 MSet calculation thread control
 * Source:	 any object
 * Destination:	 any MSet object
 * Interception: unlikely
 */
@message void MSG_MSET_PAUSE_CALCULATION ();

/*
 * Causes the calculation thread to begin running again.  May safely be sent
 * even if the thread is already calculating.  Most of the time, you will
 * only want to use this to resume a thread that has been paused with the
 * MSG_MSET_PAUSE_CALCULATION message.
 *
 * This message is also used for starting up newly-initialized MSet objects.
 *
 * Context:	 MSet calculation thread control
 * Source:	 any object
 * Destination:	 any MSet object
 * Interception: unlikely
 */
@message void MSG_MSET_CONTINUE_CALCULATION ();

/*
 * Stops the calculation thread, empties out all the data blocks.
 * Resets MSP_lastLine to its original value, and clears out any messages
 * from the MSetCalc object, since they will be out-of-date.
 *
 * Right now, the only messages the MSetCalc sends out are
 * MSG_MSET_NEW_LINEs.
 *
 * Context:	 MSet calculation thread control
 * Source:	 any object
 * Destination:	 any MSet object
 * Interception: unlikely
 */
@message void MSG_MSET_RESET_CALCULATION ();

/*
 * Causes the calculation thread to destroy itself.  This causes the MSet
 * object to become, in effect, uninitialized.  To start calculating again,
 * you must send another MSG_MSET_INITIALIZE message.
 *
 * Context:	 MSet calculation thread control
 * Source:	 any object
 * Destination:	 any MSet object
 * Interception: unlikely
 */
@message void MSG_MSET_STOP_CALCULATION ();

/***********************************************************************
 *		_GET_ and _SET_ messages
 ***********************************************************************
 *	These messages should only be sent to initialized MSets.
 ***********************************************************************/

/*
 * Modifies the priority of the calculation thread.  See ThreadCreate
 * documentation for a list of standard priorities, or pass a number between
 * 0 and 255.  The lower the number, the higher the priority.
 *
 * Context:	 MSet calculation thread control
 * Source:	 any object
 * Destination:	 any MSet object
 * Interception: unlikely
 */
@message void MSG_MSET_SET_PRIORITY (word newPriority);

/*
 * Changes the mapping between scaled dwell values and colors.
 *
 * Context:	 MSet visual display
 * Source:	 any object (probably an MSetColorControl object)
 * Destination:	 any MSet object
 * Interception: no
 */
@message void MSG_MSET_SET_COLOR_SCHEME (MSetColor newColorScheme);

/*
 * Sets the width and height of the MSet, and starts the calculations over
 * from scratch.
 *
 * Context:	 MSet parameter setting
 * Source:	 any object (probably a controller object)
 * Destination:	 any MSet object
 * Interception: unlikely
 */
@message void MSG_MSET_SET_SIZE (word newWidth, word newHeight);

/*
 * Sets the top-left corner of the MSet, and starts the calculations over
 * from scratch.
 *
 * Context:	 MSet parameter setting
 * Source:	 any object (probably a controller object)
 * Destination:	 any MSet object
 * Interception: unlikely
 */
@message void MSG_MSET_SET_POSITION (FixNum* newLeft, FixNum* newTop);

/*
 * Sets the resolution (magnification) of the MSet, and starts the
 * calculations over from scratch.
 *
 * Context:	 MSet parameter setting
 * Source:	 any object (possibly a controller object)
 * Destination:	 any MSet object
 * Interception: unlikely
 */
@message void MSG_MSET_SET_RESOLUTION (FixNum* newHRes, FixNum* newVRes);

/*
 * Sets the precision (16 bit or 48 bit fixed point) of the MSet, and
 * starts the calculations over from scratch.
 *
 * Context:	 MSet parameter setting
 * Source:	 any object (possibly a controller object)
 * Destination:	 any MSet object
 * Interception: unlikely
 */
@message void MSG_MSET_SET_PRECISION (MSetPrecision newPrecision);

/*
 * Sets the "selected point" of the MSet
 *
 * Context:	 MSet parameter setting
 * Source:	 any object (most likely as a result of a mouse event)
 * Destination:	 any MSet object
 * Interception: maybe
 */
@message void MSG_MSET_SET_SELECT_XY (sword newX, sword newY);

/*
 * Sets the maximum dwell of the MSet
 *
 * Context:	 MSet parameter setting
 * Source:	 any object (possibly a controller object)
 * Destination:	 any MSet object
 * Interception: maybe
 */
@message void MSG_MSET_SET_MAX_DWELL (word newMaxDwell);

/*
 * Causes the MSet to adjust itself to zoom in or out on the "selected
 * point".  This is by default the point in the very middle of the MSet.
 * It may also be set by left-clicking on the MSet.  zoomVal determines
 * how much to zoom in.  Values greater than 1.0 will cause the MSet to zoom
 * outward; values less than 1.0 will cause the MSet to zoom inward.
 * Passing 1.0 will not cause any zooming, but will still cause the image to
 * be re-centered on the selected point.
 *
 * The zoom is effected by scaling hRes and vRes by zoomVal.  Thus, passing
 * 2.0 will double the distance between calculated points; the image will
 * appear to have zoomed out by a factor of two.  Inversely, passing 0.5
 * halves the distance between points, and the image will appear to have
 * zoomed in by a factor of two.
 *
 * All the calculated points are thrown away during a zoom; the calculation
 * thread restarts from scratch.
 *
 * Do not pass values with an integer portion greater than 15 -- the high
 * bits will be truncated.
 *
 * Context:	 MSet parameter setting
 * Source:	 any object
 * Destination:	 any MSet object
 * Interception: possible, for keeping around data that will still be used.
 */
@message void MSG_MSET_ZOOM (BBFixedAsWord zoomVal);

/***********************************************************************
 *		Drawing-related messages
 ***********************************************************************/

/*
 * Signal from the MSetCalc object that new points have been calculated.
 * This causes the MSet object to draw all the lines between the previous
 * and current value of newLine.
 *
 * The values of newLine are expected to be strictly increasing; the only
 * exception is passing -1.  When one passes -1, this message will not try
 * to draw the MSet; it will just cache -1.  This is useful when restarting
 * a calculation.
 *
 * Note that MSG_MSET_RESTART_CALCULATION assumes that there is at most one
 * of this message in the MSet's event queue at any given time; furthermore,
 * the values of newLine are expected to be strictly increasing.  The only
 * exception is passing -1, in which case the MSet will not generate a
 * MSET_DRAW.  It is an error to try to draw a block of data that has not
 * yet been calculated.
 *
 * Context:	 MSet drawing
 * Source:	 MSet's associated MSetCalc object
 * Destination:	 MSetCalc's associated MSet object
 * Interception: Possible; could intercept to create a progress slider.
 */
@message void MSG_MSET_NEW_LINE (sword newLine);

/*
 * Code common to MSG_MSET_NEW_LINE and MSG_VIS_DRAW.
 * Draws all lines > lowLine and <= highLine.
 *
 * Context:	 MSet drawing
 * Source:	 Sent by an MSet to itself
 * Destination:	 Sent by an MSet to itself
 * Interception: Possible, for optimized drawing
 */
@message void MSG_MSET_DRAW (GStateHandle gstate, sword lowLine, sword highLine);

/***********************************************************************
 *		Controller support messages
 ***********************************************************************/

/*
 * To prevent _SET_COLOR_SCHEME messages from piling up if the user changes
 * them repeatedly, the controller will send this message to the MSet object
 * in lieu of sending MSG_MSET_SET_COLOR_SCHEME.  All this message does is
 * send a _SET_COLOR_SCHEME, but with the forceQueue, checkDuplicate, replace
 * flags.
 *
 * Context:	 Controller support
 * Source:	 MSetColorControl object
 * Destination:	 MSet object
 * Interception: no
 */
@message void MSG_MSET_CONTROLLER_SET_COLOR_SCHEME (MSetColor newColor);

/*
 * Copies the MSet object's info into a passed MSetParameters struct.
 *
 * Context:	 Controller support
 * Source:	 Any MSet controller
 * Destination:	 any MSet object
 * Interception: no
 */
@message void MSG_MSET_LOAD_PARAM_BLOCK (MSetParameters* infoPtr);

/*
 * Sends notification to the controllers of a change in parameters.
 * When the MSet changes any data that a controller reflects, it should
 * send this message to itself.
 *
 * Context:	 Controller support
 * Source:	 any object
 * Destination:	 any MSet object, ususally sent to itself
 * Interception: no
 */
@message void MSG_MSET_SEND_NOTIFICATION_OF_PARAM_CHANGE ();

/*
 * Sends NULL status notification to the GCN list.  Used when an MSet object
 * loses the target.
 *
 * Context:	 Controller support
 * Source:	 any object
 * Destination:	 any MSet object
 * Interception: no
 */
@message void MSG_MSET_SEND_NULL_STATUS_NOTIFICATION ();

/***********************************************************************
 *		Error detection and recovery
 ***********************************************************************/

/*
 * Message sent by the MSetCalc object when it has failed a memory
 * allocation, and has paused itself as a result.
 *
 * Context:	 Error handling
 * Source:	 MSetCalc object
 * Destination:	 MSet object
 * Interception: Possible, to provide notification to the application.
 */
@message void MSG_MSET_NO_CALC_MEMORY ();

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Instance data and defaults
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*
 * Context:	Initialization of MSet
 * Usage:	Set in MSG_MSET_INITIALIZE, when a VM File has been
 *		associated with the object.  When this is FALSE, MSI_vmFile
 *		and MSI_msetVMBlock may not be used.  This variable should
 *		be TRUE iff a calculation thread and vm file exist for the
 *		MSet.
 */
    @instance	Boolean		MSI_initialized;
    @default	MSI_initialized = 0;

/*
 * Context:	MSet point storage
 * Usage:	Set in MSG_MSET_INITIALIZE.  Use it but don't alter it.
 */
    @instance	VMFileHandle	MSI_vmFile;

/*
 * Context:	MSet point storage
 * Usage:	Set in MSG_MSET_INITIALIZE.  This block consists of an
 *		MSetParameters struct, followed by a series of
 *		MSetDataHandles.  Not to be changed.
 */
    @instance	VMBlockHandle	MSI_msetVMBlock;

/*
 * Context:	MSet calculation thread control
 * Usage:	Set in MSG_MSET_INITIALIZE, when the thread that will be
 *		calculating the MSet has been spawned.  Not much can be done
 *		with a ThreadHandle except for getting its CPU usage and
 *		modifying its priority.
 */
    @instance	ThreadHandle	MSI_calcThread;
    @default	MSI_calcThread = NullHandle;

@endc

@endlib

#endif	/* __MSET_CLASS_GOH */


Internal\Resp\msgclist.goh

/*
-----------------------------------------------------------------------------
Copyright (c) 1997. Nokia Mobile Phones
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

     Header file for SMS Msgcentre List

-----------------------------------------------------------------------------
*/

@ifndef  MSGCLIST_GOH
@define  MSGCLIST_GOH
@deflib  smsmc

/*  INCLUDE FILES  */

@include   <stdapp.goh>
@include   <internal/resp/vp.goh>
@include   <foamdb.h>
@include   <contdb.goh>

/*  C CONSTANTS  */

/*  GEOS CONSTANTS  */

/*  C MACROS  */

/*  GEOS MACROS  */

/*  DATA TYPES  */

typedef enum
    {
        MSGCENTRE_ITEM		,
      EMPTY_MSGCENTRE_ITEM
    } MsgCentreItemType	} ;

typedef struct {
     TCHAR           scName[SMS_MAX_MSGCENTRE_NAME_LEN];
     TCHAR           scNumber[SMS_ASCII_ADDRESS_MAX_LENGTH];
     MsgCentreItemType		type;
}SelectedScentreIdStruct};

/* MsgCentreListControlInformation in the header block of huge array*/
typedef struct
    {
        VMBlockHandle 	msgcentrelistArray;
        word	numOfIt; /* number of message centre list items. */
    } MsgCentreListControlInformation	} ;

/*  CLASS DEFINITIONS  */

@class ServiceCentreControlClass, GenDynamicListClass;

/* External messages. */
     @message Boolean MSG_MSGCENTRELIST_SELECTION_CREATE_MSGCENTRELIST ();

     @message void MSG_SCENTRE_CONTROL_SETTINGS_CLOSED ();

     @message MemHandle MSG_MSGCENTRELIST_SELECTION_OPEN_MSGCENTRELIST_FILE (TCHAR *mcfileName);

     @message MemHandle MSG_MSGCENTRELIST_SELECTION_CREATE_MSGCENTRELIST_FILE (TCHAR *mcfileName);

     @message void MSG_MSGCENTRELIST_SELECTION_CLOSE_MSGCENTRELIST_FILE ();

     @message void MSG_MSGCENTRELIST_SELECTION_CREATE_EMPTY_LIST_MONIKER_ITEM ();

     @message Boolean MSG_MSGCENTRELIST_SELECTION_GET_CENTER_NAME_AND_NUMBER (TCHAR *msgName,
                                                                                TCHAR *msgNumber);

     @message(GEN_DYNAMIC_LIST_QUERY_MSG) MSG_MSGCENTRE_SELECTION_MONIKER_QUERY;

     @message(GEN_DYNAMIC_LIST_QUERY_MSG) MSG_MSGCENTRE_SELECTION_MONIKER_QUERY_BUBBLE;

     @message void MSG_MSGCENTRE_SELECTION_BUBBLE_CLOSE ();

     @message Boolean MSG_MSGCENTRE_SELECTION_ADD_TO_MSGCENTRELIST (TCHAR *msgName,
                                                                                TCHAR *msgNumber,
                                                                                MsgCentreItemType itemType);

     @message void MSG_MSGCENTRELIST_SELECTION_ITEM_DELETE ();

     @message dword MSG_MSGCENTRE_GET_MSGCENTRELIST_SIZE ();

     @message Boolean MSG_MSGCENTRELIST_SELECTION_REMOVE_EMPTY_LIST_MONIKER_ITEM ();

     @message void MSG_MSGCENTRELIST_SELECTION_INITIALIZE_MSGCENTRELIST ();

     @message void MSG_APPLYMESSAGE_FOR_MSGCENTRELIST ();

     @message Boolean MSG_MSGCENTRELIST_SELECTION_MSGCENTRE_OK (TCHAR *msgName,
                                                                                TCHAR *msgNumber);

      /* Message notifying about closing of other settigs view. */
     @message void MSG_MSGCENTRE_SELECTION_NEW_ITEM_CLOSE ();

     @message void MSG_MSGCENTRE_SELECTION_EDIT_ITEM_CLOSE ();

     @message void MSG_MSGCENTRELIST_WRITE_TO_INI ();

    @message Boolean MSG_MSGCENTREINUSE_UPDATE_TRIGGER_FROM_INI_FILE ();

    @message void MSG_MSGCENTRELIST_SELECTION_MATCH_MSGCENTRENUMBER (TCHAR *nameString);

    @message void MSG_MSGCENTRE_ADD_TO_LIST_IN_SMSEND (TCHAR *numString);

    @message void MSG_MSGCENTRELIST_SELECTION_CLOSE_MSGCENTRELIST ();

    @message void MSG_MSGCENTREINUSE_UPDATE_MSGC_TRIGGER_IN_SMSEND (TCHAR *msgcString);

/* Internal messages. */

     /*none*/

/* Instance data. */

    @instance VMFileHandle MsgCentreVMHandle = NullHandle;
     @instance VMBlockHandle msgblock = NullHandle;
     @instance VMBlockHandle msgarrayBlock = NullHandle;

@endc

@class ServiceCentreControlEditClass, GenInteractionClass;

    @message void MSG_MSGCENTRE_OPEN_LIST_FOR_EDIT ();
    @message void MSG_MSGCENTRE_OPEN_LIST_FOR_CREATE ();
   @message void MSG_MSGCENTRELIST_BUBBLE_CLOSE ();
   @message void MSG_MSGCENTRELIST_BUBBLE_CANCEL ();
   @message (GEN_TRIGGER_ACTION) MSG_MSGCENTRELIST_BUBBLE_OPEN;
   @message byte MSG_GET_INSTANCE_DATA ();
   @message void MSG_SET_INSTANCE_DATA (byte from);
   @message void MSG_SET_INSTANCE_DATA_TRIGGER (dword trigger);
   @message dword MSG_GET_INSTANCE_DATA_TRIGGER ();
   @message void MSG_MSGCENTRELIST_CLOSE_EDITOR ();
   @message void MSG_MSGCENTRELIST_OPEN_EDITOR ();

@instance byte from              = 0;
@instance dword trigger          = 0;
@endc

@class ServiceCentreControllerClass, GenControlClass;

@default GI_states = ( @default | GS_ENABLED );
@default GII_visibility = GIV_DIALOG;
@default GII_attrs = ( @default | GIA_NOT_USER_INITIATABLE  | GIA_MODAL);

    @message Boolean MSG_MSGCENTRELIST_WAKE_MSGCENTRESELECTION ();
    @message void MSG_MSGCENTRELIST_KNOCK_MSGCENTRESELECTION_OUT ();
    @message void MSG_MSGCENTRE_INTERACTION_INITIATE ();
    @message (GEN_TRIGGER_ACTION) MSG_MSGCENTREBUBBLE_INTERACTION_INITIATE;
   @message void MSG_MSGCENTRELIST_FIND_MSGCNUMBER_FOR_SMSEND (TCHAR *nameString);
   @message void MSG_MSGCENTRELIST_SAVE_MSGCNUMBER_IN_SMSEND (TCHAR *numString);
   @message void MSG_MSGCENTRELIST_LOOSE_FOCUS_AND_CLOSE_BUBBLE ();
   @message void MSG_MSGCENTRELIST_GAIN_FOCUS_AND_CLOSE_BUBBLE ();
   @message void MSG_CLOSE_BUBBLE ();
   @message void MSG_MSGCENTRELIST_UPDATE_TRIGGER_IN_SMSEND (TCHAR *msgcString);

@endc

/*  EXTERNAL OBJECTS  */

/*  EXTERNAL DATA STRUCTURES  */

/*  GLOBAL FUNCTION PROTOTYPES  */
extern word _cdecl SMSAddServiceCentreNumber
                                      (TCHAR      *number, /*new message centre number*/
                                       TCHAR      *name);  /*new message centre name  */

extern word _cdecl SMSCheckServiceCentreName
                                      (TCHAR      *name);  /*new message centre name  */
@endlib /*smsmc*/
@endif  /* End of File */


Objects\SDK_C\msPrecCC.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) GeoWorks 1993 -- All Rights Reserved

PROJECT:	PC SDK
MODULE:		Sample Library -- Mandelbrot Set Library
FILE:		msPreCtr.goh

AUTHOR:		Tom Lester, Sept  9, 1993

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    TL	9/ 9/93   	Initial version.

DESCRIPTION:
    This file defines the MSetPrecisionControlClass.

    $Id: msPrecCC.goh,v 1.1.8.1 96/04/28 08:32:29 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef __MSET_PRECISION_CONTROL_GOH
#define __MSET_PRECISION_CONTROL_GOH

@deflib mset		/* See msetC.goh for a description of this keyword */

@include  <Objects/gCtrlC.goh> 		/* include GenControlClass */

/*
 * Define the MSetPrecisionControllerClass
 */
@class	MSetPrecisionControlClass, GenControlClass ;

/***********************************************************************
 *              Internal Messages
 ***********************************************************************/

/*
 * Context:	 send message to MSet object to set precision
 * Source:	 MSetPrecisionControl object
 * Destination:	 output of the controller (a MSet object)
 * Interception: ok, but call superclass
 */
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_MSPC_SET_PRECISION;

/*
 * The GCI_output field contains the optr of the object to which
 * the controller is currently sending its "apply" messages. This
 * field is typically set to a GenTravelOption (such as TO_APP_TARGET)
 * or to a TravelOption (such as TO_OBJ_BLOCK_OUTPUT).
 * We want to send the messages to the selected MSet object which
 * will be the application target.
 */
@default GCI_output = (TO_APP_TARGET);

/***********************************************************************
 *              Feature and Tool Sets
 ***********************************************************************/

/*
 * Define the Feature set of the controller class. To do this we define
 * a record type of type WordFlags and one flag for each feature. The
 * record type may be named anything but typically its name will consist
 * of the acronym of the controller class with the suffix "Features."
 * When a flag is set, the feature it represents is turned on; when
 * clear, its feature is off.
 *
 * note: The flags are numbered this way due to assembly language
 *       compatability. They can actually be numbered any way you
 *       like.
 */

/* MSPCFeatures */
typedef WordFlags MSPCFeatures ;
#define MSPCF_16BIT 		0x0004
#define MSPCF_48BIT 		0x0002
#define MSPCF_FLOATING 		0x0001

/*
 * Define the Tool set of the controller. The Tool set is similar to
 * the Feature set but since the tools are independent of the features,
 * two different sets of flags must be defined. The note about numbering
 * the Feature flags also applies to the Tool flags.
 */

/* MSPCToolboxFeatures */
typedef WordFlags MSPCTFeatures ;
#define MSPCTF_16BIT 		0x0004
#define MSPCTF_48BIT 		0x0002
#define MSPCTF_FLOATING 		0x0001

/*
 * Set the default feature and tool sets. These are used in the handler
 * for the controller message MSG_GEN_CONTROLER_GET_INFO
 *
 * NOTE: the floating point calculation is not implemented yet
 */
#define MSPC_DEFAULT_FEATURES  (MSPCF_16BIT | MSPCF_48BIT)

#define MSPC_DEFAULT_TOOLBOX_FEATURES  (MSPCTF_16BIT | MSPCTF_48BIT)

@endc  /* MSetPrecisionControlClass */

@endlib
#endif  /* __MSET_PRECISION_CONTROL_GOH */


nedit.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1995 -- All Rights Reserved

PROJECT:	GEOS
MODULE:		Notes Viewer Library
FILE:		nedit.goh

AUTHOR:		Skarpi Hedinsson, Mar 17, 1995

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    SH	3/17/95   	Initial version.

DESCRIPTION:

    $Id: nedit.goh,v 1.5.1.6 97/09/18 16:47:44 reza Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@optimize
@deflib	nedit

@include  <viewer.goh>

/****************************************************************************
*		Class & Message Definitions
****************************************************************************/
@class NotesEditControlClass, ViewerControlClass;

typedef WordFlags NotesEditControlFeatures ;
#define NECF_STYLES 	(0x0001) /* Include styles dialog*/

#define	NEC_DEFAULT_FEATURES	  (NECF_STYLES)

@message Boolean MSG_NEC_CREATE_NOTE_FROM_READ_ONLY_DOC () = ax;
/*
 *  This message is sent when a user wants to convert a native document into
 *  a NOTE document.
 *
 *  Returns: true if conversion failed
 */

@message void MSG_NEC_MARGINS_DIALOG_VISIBILITY (optr obj = cx:dx, Boolean opening = bp);
/*
 *  Visibility message sent when the margins dialog is opened and closed.
 *
 */

@vardata void ATTR_NOTES_EDITOR_USE_NOTEBOOK_SETTINGS;
/*
  If this attribute is set the notes editor will load the default
  font, font size and page margins from the .ini file.  These default
  settings are changed in the settings dialog of the notebook apps.
*/

@vardata ViewerControlState TEMP_VIEWER_CONTROL_STATE;
/*
  Used to store ViewerControlState of the notes editor between
  detach and attach.
*/

@vardata void ATTR_NOTES_EDITOR_SINGLE_TEXT_ATTRIBUTE;
/*
 *  When used the editor only supports the default font and point size.
 *  (URW Sans, 12 point).  The user cannot define multiple attributes
 *  on the text.  Multiple attributes are removed from text pasted into
 *  the editor.
 */

@vardata dword TEMP_NOTES_EDIT_OLD_UNDO_CONTEXT;
/*
 * Internal: The old undo context before our object set a new one.
 */

@vardata void HINT_NOTES_EDIT_NO_UNDO;
/*
 * If present, the document editor won't support undo. Useful
 * for dual-threaded apps which hang because of undo deadlock
 * synchronization.
 */

@vardata void ATTR_NOTES_EDIT_NO_COPY_DIALOG;
/*
 *  If present, when the user attempts to edit
 *  a read-only or native DOS document, instead of popping
 *  up a dialog offering to copy the document to a writable
 *  doc in Own Texts, the input will simply be thrown away.
 */

@vardata ZoomLevel TEMP_NOTES_EDIT_CURRENT_ZOOM_LEVEL;
/*
 * Internal: Stores the current zoom level of the text editor.
 */

@instance word NECI_largeTextInit = 0;
/*
  Flag the if TRUE indicates that the large text object used by the
  NotesEditControlClass has been initialized.
*/

@default GI_states = (@default | GS_ENABLED);

@endc

@endlib


Internal\netutils.h

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1996 -- All Rights Reserved

PROJECT:	socket
MODULE:		Network utilities library
FILE:		netutils.h

AUTHOR:		Eric Weber, Jul 24, 1995

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    EW	7/24/95   	Initial version.

DESCRIPTION:
        NOTE: Do not add goc keywords to this file as it is included ""
    by regular .h files.

    $Id: netutils.h,v 1.5.1.2 98/07/30 17:22:21 nfiedler Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 *  default max block number for a hugelmem
 */
#define DEFAULT_MAX_BLOCK_NUMBER 	(100)

/*
 *  RESERVED TIMEOUT VALUES
 *  : used in HugeLMemAllocLock, QueueEnqueueStart, QueueDequeueStart
 */
#define FOREVER_WAIT 	(0xffff)              /*  */
#define NO_WAIT 	        (0x0000)              /*  */
#define RESIZE_QUEUE 	(0x0001)              /*  HACK! this MUST be 1. */

/*
 *  HugeLMem errors
 */
/* enum HugeLMemErrors */
typedef enum {
/*  an optr not belonging to this hugelmem is passed */
    HLME_BLOCK_NOT_FOUND     = 0x0,

/*
 *  resizing the given chunk will make current data block in
 *  hugelmem too big( this will never happen in net lib )
 *  But, I will change this so that the hugelmem chunk can be
 *  relocated within the hugelmem later.
 */
    HLME_BLOCK_BECAME_TOO_BIG     = 0x2,

} HugeLMemErrors} ;

/*
 *  Queue errors
 */
/* enum QueueErrors */
typedef enum {
/*
 *  a queue operation could not be completed within the given
 *  time
 */

    QE_TIMEOUT     = 0x0,

/*
 *  tried to perform a queue operation on a dead queue.
 *  You can't do anything to a dead queue. But this comes in
 *  handy in shutdown sequence of an application where multiple
 *  threads are accessing a common queue.
 */
    QE_DEAD     = 0x2,

    QE_TOO_BIG     = 0x4,

} QueueErrors} ;

/*
 *  tried resize the queue beyond the max capacity of the queue.
 */

typedef Handle HugeLMemHandle ;

HugeLMemHandle
_pascal HugeLMemCreate (word maxBlocks, word minSize, word maxSize);
/* --------------------------------------------------------------------
SYNOPSIS:	Creates and initializes a HugeLMem.
PASS:		ax = maximum # of mem blocks to be used
             0 for default(maximum) value
        bx = minimum size for an optimal block
        cx = maximum size for an optimal block
RETURN:		bx = HugeLMem handle
        carry set on error( most likely to be "insufficient memory" )
        MemHandle null if error
DESTROYED:	ax, cx
------------------------------------------------------------------------*/

void
_pascal HugeLMemForceDestroy (HugeLMemHandle handle);
/* --------------------------------------------------------------------
SYNOPSIS:	Destroys a HugeLMem without checking if there are still
        chunks allocated in it.
PASS:		bx = HugeLMem handle
RETURN:		nothing
DESTROYED:	bx
SIDE EFFECTS:	none
-----------------------------------------------------------------------*/

Boolean
_pascal HugeLMemDestroy (HugeLMemHandle handle);
/* --------------------------------------------------------------------
SYNOPSIS:	Destroys a HugeLMem.  If there are still chunks around, return
        with error
PASS:		bx = HugeLMem handle
RETURN:		carry set if there are still chunks around on the heap.
DESTROYED:	bx
SIDE EFFECTS:	none
-----------------------------------------------------------------------*/

Boolean
_pascal HugeLMemAllocLock (HugeLMemHandle handle, word chunkSize, word timeout,
              optr *newBufferOptr);

/* -------------------------------------------------------------------
SYNOPSIS:	Allocates a chunk in HugeLMem, and returns optr & fptr to it.
        When this function returns, the block containing the newly
        allocated chunk is locked.  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PASS:		ax = size of chunk
        bx = HugeMemHandle
        cx = timeout value( ticks )
             0 means no wait
             FOREVER_WAIT means wait forever
        When there is not enough memory, wait for cx number of ticks
        to see if anything frees up.
RETURN:		^lax:cx = new buffer( optr )
        ds:di	= new buffer( fptr )
        If there is not enough memory, carry set.
IMPORTANT:	Memory block in which the chunk is allocated in is locked.
        One must unlock it after writing things into it.
DESTROYED:	nothing
SIDE EFFECTS:	none
----------------------------------------------------------------------*/

Boolean
_pascal HugeLMemFree (optr hugeLMemOptr);

/* -------------------------------------------------------------------
TESTED
SYNOPSIS:	frees a HugeMem chunk
PASS:		^lax:cx = huge mem chunk optr
RETURN:		none

        In EC version, invalid chunk optr is detected in
        ECValidateHugeLMemChunk.

        In non-EC version:
        if datablock(ax) belongs to this hugeLMem,
           if cx = illegal handle, then [fatal error from LMemFree]
           else [everything is fine]
        else
           carry = set.

DESTROYED:	ax, cx
SIDE EFFECTS:	none
----------------------------------------------------------------------*/

void *
_pascal HugeLMemLock (MemHandle hugeLMemOptr);

/* -------------------------------------------------------------------
TESTED
SYNOPSIS:	locks the block containing a hugelmem chunk
PASS:		bx = hptr part of hugelmem chunk
RETURN:		ax = segment address of the block
DESTROYED:	nothing
SIDE EFFECTS:	none
----------------------------------------------------------------------*/

void
_pascal HugeLMemUnlock (MemHandle handle);
/* -------------------------------------------------------------------
TESTED
SYNOPSIS:	Unlocks a memblock containing hugelmem chunk
PASS:		bx = hptr part of hugelmem chunk
RETURN:		none
DESTROYED:	nothing
SIDE EFFECTS:	none
----------------------------------------------------------------------*/

Boolean
_pascal HugeLMemRealloc (optr hugeLMemOptr, word size);
/* -------------------------------------------------------------------
SYNOPSIS:	Change the size of a chunk in a hugelmem
PASS:		*ds:ax = handle of the hugelmem chunk
        cx = size to resize chunk to
RETURN:		ds = segment address of same lmem heap (may have moved).
        es = unchanged, unless es and ds were the same on entry to the
             routine, in which case es and ds are the same on return.
        carry = set if error( couldn't realloc the chunk because of
                memory or max size limitation in which case the user
            is advised to create a new larger chunk rather than
            resizing this one. )

DESTROYED:	nothing
    WARNING:  This routine MAY resize the LMem block, moving it on the
          heap and invalidating stored segment pointers and current
          register or stored offsets to it.

IMPORTANT
NOTE:		Currently only downsizing a chunk is allowed.

SIDE EFFECTS:	none
----------------------------------------------------------------------*/

/* generate a 32 bit random number */
extern long _pascal NetGenerateRandom32 ();

/* generate an 8 bit random number between 0 and limit */
extern int _pascal NetGenerateRandom8 (int limit);

#ifdef __HIGHC__

pragma Alias(HugeLMemCreate, "HUGELMEMCREATE");
pragma Alias(HugeLMemForceDestroy, "HUGELMEMFORCEDESTROY");
pragma Alias(HugeLMemDestroy, "HUGELMEMDESTROY");
pragma Alias(HugeLMemAllocLock, "HUGELMEMALLOCLOCK");
pragma Alias(HugeLMemFree, "HUGELMEMFREE");
pragma Alias(HugeLMemLock, "HUGELMEMLOCK");
pragma Alias(HugeLMemUnlock, "HUGELMEMUNLOCK");
pragma Alias(HugeLMemRealloc, "HUGELMEMREALLOC");
pragma Alias(NetGenerateRandom32, "NETGENERATERANDOM32");
pragma Alias(NetGenerateRandom8, "NETGENERATERANDOM8");
#endif


Internal\Resp\nokia.h

/* COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    (c) Copyright Geoworks 1997.  All rights reserved.
            GEOWORKS CONFIDENTIAL

PROJECT:	GEOS
FILE:		nokia.def

AUTHOR:		Reza Hussein, Jan  2, 1997

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    reza	1/ 2/97   	Initial revision

DESCRIPTION:

    Certain mechanisms within PC/GEOS utilize a two-word indentification
    scheme in which the first word is a ManufacturerID, & the second
    is an enumeration defined by the manufacturer identified by the
    first word.  This file contains the enumerations for Nokia's
    own ManufacturerID of MANUFACTURER_ID_NOKIA.

    WARNING:
           When updating this file, it is imperative that the assembly
           equivalent, Include/Internal/Resp/nokia.def, be updated as well.

    ONE MORE THING:
           NOTHING should be placed in this file that can be made to
           reside in a more specialized include file.  Yes, that includes ""
           Notification data block structures!  This is not a substitute
           for a library-specific definition file;  Constants & structures
           pertinent to a specific library belong in a specific include ""
           file for that library.

    $Id: nokia.h,v 1.1.1.5 98/02/26 08:11:47 cthomas Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */

#ifndef	__NOKIA
#define __NOKIA

/* COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
         MSG_META_NOTIFY & MSG_META_NOTIFY_WITH_DATA_BLOCK NotificationTypes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    MSG_META_NOTIFY & MSG_META_NOTIFY_WITH_DATA_BLOCK are general purpose
    notification messages, whose data format & meaning are defined by
    the "NotificationType" passed in the messages.

    This section contains the enumerations of the NT_type field of
    NotificationType for the case of NT_manuf = MANUFACTURER_ID_NOKIA

    Name	Date		Description
    ----	----		-----------
    reza	1/2/97		Initial version

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */

typedef enum {
    NNT_WWW_HOTLIST_CHANGE    ,
/*
 * 	Sent to WWW via MSG_META_NOTIFY when there are new hotlist
 * 	items added.
 */

    NNT_RESTORE_BEGINNING    ,
    NNT_RESTORE_ENDING    ,
/*
 *	Sent by backup/restore application via MSG_META_NOTIFY
 *	when a Restore is beginning or ending.  Currently
 *	is sent only by the backup/restore app, and only to the
 *	SMS receive app.
 *
 *	Data type: DataGroup (connect.goh)
 */

    NNT_WWW_WAKE_UP    ,
    /*
     * Sent to WWW via MSG_META_NOTIFY.
     */

    NNT_WWW_FETCH    ,
    /*
     * Sent to WWW application via MSG_META_NOTIFY_WITH_DATA_BLOCK
     * to wake up WWW app or to have WWW fetch a URL.  Source of
     * notification may be any application.
     *
     * NNT_WWW_FETCH requires a parameter of IACPStruct, defined
     * in w3ext.goh.
     */

    NNT_OBEX_RECEIVE_STATUS    ,
    /*
     *  Sent to IR Activation app via NOKIA_GCNSLT_OBEX_RECEIVE_STATUS
     *  Kernel GCN list to notify it when OBEX receiving is active.
     *  These events are kept as the 'status' of the GCN list,
     *  so the IR activation app will be notified of the current
     *  status of OBEX as soon as it adds itself to the list.
     *
     *  extra word = TRUE if active, FALSE if not.
     */

} NokiaNotificationType} ;

/* ---------------------------------------------------------------------------
 * 		Kernel GCNList Types
 * ---------------------------------------------------------------------------
 *
 *  pre-defined list types and messages to send to them -- use with
 *  MANUFACTURER_ID_NOKIA
 */

typedef enum {
    NOKIA_GCNSLT_WWW_NOTIFICATIONS     = 0,
/*
 *  Notifications about WWW events.
 *
 *  Uses MSG_META_NOTIFY or MSG_META_NOTIFY_WITH_DATA_BLOCK
 *  and NokiaNotificationTypes.
 */

    NOKIA_GCNSLT_OBEX_RECEIVE_STATUS     = 2,
/*
 *  Notifications of the status of OBEX receiving.
 *  Uses MSG_META_NOTIFY and NokiaNotificationTypes.
 */

} NokiaGCNStandardListType} ;
#endif


obex.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1997.  All rights reserved.
    GEOWORKS CONFIDENTIAL

PROJECT:	IrOBEX Library
MODULE:		OBEX
FILE:		obex.goh

AUTHOR:		Chris Thomas, Sep 02, 1997

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name		Date		Description
    ----		----		-----------
    cthomas 	9/02/97   	Initial version.

DESCRIPTION:

    Defines the API for the IrOBEX library

    $Id: obex.goh,v 1.1.1.8 98/06/21 18:54:53 cthomas Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef __OBEX_GOH__
#define __OBEX_GOH__

@deflib obex

#if defined(__HIGHC__)
#define UNBOUNDED_ARRAY  0
#else
#define UNBOUNDED_ARRAY
#endif

/***********************************************************************
**
**              CONSTANTS
**
************************************************************************/

/*
 *  Server responses defined in IrOBEX 1.0
 */
typedef byte OBEXResponseCode ;
#define OBEXRC_CONTINUE                         0x10
#define OBEXRC_SWITCHING_PROTOCOLS              0x11
#define OBEXRC_SUCCESS                          0x20
#define OBEXRC_CREATED                          0x21
#define OBEXRC_ACCEPTED                         0x22
#define OBEXRC_NON_AUTHORITATIVE_INFO           0x23
#define OBEXRC_NO_CONTENT                       0x24
#define OBEXRC_RESET_CONTENT                    0x25
#define OBEXRC_PARTIAL_CONTENT                  0x26
#define OBEXRC_MULTIPLE_CHOICES                 0x30
#define OBEXRC_MOVED_PERMANENTLY                0x31
#define OBEXRC_MOVED_TEMPORARILY                0x32
#define OBEXRC_SEE_OTHER                        0x33
#define OBEXRC_NOT_MODIFIED                     0x34
#define OBEXRC_USE_PROXY                        0x35
#define OBEXRC_BAD_REQUEST                      0x40
#define OBEXRC_UNAUTHORIZED                     0x41
#define OBEXRC_PAYMENT_REQUIRED                 0x42
#define OBEXRC_FORBIDDEN                        0x43
#define OBEXRC_NOT_FOUND                        0x44
#define OBEXRC_METHOD_NOT_ALLOWED               0x45
#define OBEXRC_NOT_ACCEPTABLE                   0x46
#define OBEXRC_PROXY_AUTH_REQUIRED              0x47
#define OBEXRC_REQUEST_TIME_OUT                 0x48
#define OBEXRC_CONFLICT                         0x49
#define OBEXRC_GONE                             0x4a
#define OBEXRC_LENGTH_REQUIRED                  0x4b
#define OBEXRC_PRECONDITION_FAILED              0x4c
#define OBEXRC_REQUESTED_ENTITY_TOO_LARGE       0x4d
#define OBEXRC_REQUEST_URL_TOO_LARGE            0x4e
#define OBEXRC_UNSUPPORTED_MEDIA_TYPE           0x4f
#define OBEXRC_INTERNAL_SERVER_ERROR            0x50
#define OBEXRC_NOT_IMPLEMENTED                  0x51
#define OBEXRC_BAD_GATEWAY                      0x52
#define OBEXRC_SERVICE_UNAVAILABLE              0x53
#define OBEXRC_GATEWAY_TIMEOUT                  0x54
#define OBEXRC_HTTP_VERSION_NOT_SUPPORTED       0x55

#define OBEXRC_FINAL                            0x80

typedef byte OBEXLibraryError ;
#define OBEXLE_OK                        0x00
        /*
         *  Library call completed with no errors
         */
#define OBEXLE_OPERATION_ABORTED         0x01
        /*
         *  A GET or PUT operation was aborted by a client ABORT request.
         */
#define OBEXLE_NO_CONNECTION             0x02
        /*
         *  A Library call could not complete because a connection
         *  has not been established, or has been lost.
         */
#define OBEXLE_OPERATION_NOT_IN_PROGRESS  0x03
        /*
         *  A server reponse function was called, but the operation
         *  to which it corresponds is not currently ocurring
         */
#define OBEXLE_ALREADY_INITIALIZED       0x04
        /*
         *  Caller attempted to initialize an OBEX component
         *  (client or server) when it was already active.
         */
#define OBEXLE_BAD_SERVER_STATE          0x05
        /*
     * OBEX Server was not in the appropriate
     * SERVER_STATE to process the Server App command.
     */
#define OBEXLE_CANT_INITIALIZE_SERVER    0x06
        /*
     *  To be returned when OBEXInitServer fails.
     */
#define OBEXLE_FILE_ERROR                0x07
        /*
         *  When there is an error processing the file specified
         *  by OBEXAccpetGet or OBEXPut
         */

#define OBEXLE_NO_OBEX_SERVICE           0x08
        /*
         *  A successful low-level connection was created
         *  in OBEXInitClient, but there is no OBEX service on the
         *  remote end to connect with.
         */

/*
 *  OBEXError is used to indicate errors returned from the OBEX library.
 *  The high byte contains OBEXLibraryError.
 *  The low byte contains OBEXResponseCode.
 */
typedef word OBEXError ;

/*
 *  Macros to extract the response and library error codes from an
 *  OBEXError
 */
#define OBEXGetResponse (obexError) ((OBEXResponseCode)((obexError) & 0xff))
#define OBEXGetLibraryError (obexError) ((OBEXLibraryError)((obexError) >> 8))

/*
 *  The first byte of every header is an
 *  OBEXHeaderIdentifier | OBEXHeaderType
 */
typedef byte OBEXHeaderID ;
#define OBEXHI_COUNT                     0x00
#define OBEXHI_NAME                      0x01
#define OBEXHI_TYPE                      0x02
#define OBEXHI_LENGTH                    0x03
#define OBEXHI_TIME                      0x04
#define OBEXHI_DESCRIPTION               0x05
#define OBEXHI_TARGET                    0x06
#define OBEXHI_HTTP                      0x07
#define OBEXHI_BODY                      0x08
#define OBEXHI_END_OF_BODY               0x09
#define OBEXHI_WHO                       0x0A
#define OBEXHI_USER_DEFINED              0x30    /* 0x30 - 0x3f */

typedef byte OBEXHeaderType ;
#define OBEXHT_UNICODEZ                  0x00
#define OBEXHT_BINARY                    0x40
#define OBEXHT_BYTE                      0x80
#define OBEXHT_DWORD                     0xC0

/*
 *  Client request codes defined by the IrOBEX 1.0 standard
 */
typedef byte OBEXRequest ;
#define OBEXR_CONNECT                    0x00
#define OBEXR_DISCONNECT                 0x01
#define OBEXR_PUT                        0x02
#define OBEXR_GET                        0x03
#define OBEXR_SETPATH                    0x05
#define OBEXR_ABORT                      0x7F

/*
 *  Macros to extract the parts of the header byte
 */
#define OBEXGetHeaderType (headerByte) ((OBEXHeaderType)((headerByte) & 0xc0))
#define OBEXGetHeaderID (headerByte) ((OBEXHeaderID)((headerByte) & 0x3f))

/*
 *  Enum defining the transport protocol for OBEX.
 */
typedef enum
{
    OBEXT_TINYTP     = 0            /* Use IR TinyTP protocol for connection */
} OBEXTransport} ;

/***********************************************************************
**
**              STRUCTURES
**
************************************************************************/

/*
 *  Structure used to communicate headers and/or object bodies
 *  from the library to the library's user.  In certain contexts,
 *  some of these fields go unused.
 */
typedef struct tagOBEXRequestInfo
{
    OBEXRequest  ORI_request;
    PathName     ORI_currentPath;
    dword        ORI_bodyLen;
    PathName     ORI_bodyFile;
    word         ORI_headerLen;
    byte         ORI_headers[UNBOUNDED_ARRAY];
} OBEXRequestInfo} ;

/***********************************************************************
**
**              ROUTINES
**
************************************************************************/

/***********************************************************************
**
**              SERVER API
*/

/*
 *  Flags defining the behavior of the OBEX connection.
 */
typedef WordFlags OBEXInitServerFlags ;
/*
 * No flags defined
 */

OBEXError
    _pascal OBEXInitServer  (OBEXTransport transport,
                            OBEXInitServerFlags initFlags,
                            optr obexApp,
                            Message connectMsg,
                            Message putMsg,
                            Message getMsg,
                            Message disconnectMsg);

OBEXError
    _pascal OBEXInitServerWithWho  (OBEXTransport transport,
                                   OBEXInitServerFlags initFlags,
                                   optr obexApp,
                                   Message connectMsg,
                                   Message putMsg,
                                   Message getMsg,
                                   Message disconnectMsg,
                                   TCHAR *who);
/*
 *  Initiates the server portion of the OBEX protocol, awaiting
 *  a CONNECT request from a client.
 *
 *  PASS:
 *      transport:      The low-level transport layer to be used to
 *                      transmit OBEX data.
 *      initFlags:      flags controlling the behavior of the server
 *
 *      obexApp:        The object to which the request messages
 *                      (connect, put, get, cmd) should be sent.
 *      connectMsg:     sent when CONNECT is received
 *                        (see OBEX_CONNECT_MSG prototype).
 *                      If 0, no such message is sent.
 *      putMsg:         sent when PUT is received
 *                        (see OBEX_PUT_MSG prototype).
 *                      If 0, all PUT requests are rejected.
 *      getMsg:         sent when GET is received
 *                        (see OBEX_GET_MSG prototype).
 *                      If 0, all GET requests are rejected.
 *      disconnectMsg:  sent when DISCONNECT is received
 *                        (see OBEX_DISCONNECT_MSG prototype).
 *                      If 0, no such message is sent (although
 *                      supplying one is strongly recommended, so
 *                      that the app can decide to shut the server down).
 *
 *      who:            (OBEXInitServerWithWho only) A null-terminated
 *                      string to send in CONNECT response packets,
 *                      as a WHO field.
 *                      If who is NULL (or OBEXInitServer() is used),
 *                      no WHO header will be added to the CONNECT response
 *                      packets.
 *
 *
 * RETURN:
 *   Only the OBEXLibraryError portion of the OBEXError is signifigant
 */

OBEXError
    _pascal OBEXExitServer  (void);

  @prototype void OBEX_CONNECT_MSG  (MemHandle connectInfo = cx);

/*
 * Prototype for message sent to obexApp when a CONNECT request
 * has been received.
 *
 * PASS:
 *      connectInfo:    memory block containing OBEXRequestInfo
 *                      holding the headers of the request.
 *                      Should be freed by message handler.
 * RETURN:
 *   Only the OBEXLibraryError portion of the OBEXError is signifigant
 */

  @prototype void OBEX_DISCONNECT_MSG  (MemHandle disconnectInfo = cx);

/*
 * Prototype for message sent to obexApp when a DISCONNECT request
 * has been received.  obexApp can then terminate the server, if it
 * wants to.
 *
 * PASS:
 *      disconnectInfo: memory block containing OBEXRequestInfo
 *                      holding the headers of the request.
 *                      Should be freed by message handler.
 */

  @prototype void OBEX_GET_MSG  (MemHandle getInfo = cx);

/*  Prototype for message sent to obexApp when a GET request
 *  is received by the server.  The handler MUST cause one of
 *  OBEXAcceptGet or OBEXRejectGet to be called.
 *
 * PASS:
 *      getInfo:        Memory block containing an OBEXRequestInfo
 *                      structure, filled in with all the headers
 *                      contained in the first packet of the GET request.
 *                      The handler should not free this block.
 *
 * RETURN: nothing
 */

OBEXError
    _pascal OBEXAcceptGet  (byte *header,
                           word headerLen,
                           TCHAR *bodyFile);

/*
 *  Returns a successful response to a GET request, transmitting
 *  optional headers and body.  Will not return until
 *  bodyFile has completed transmission.
 *
 *  PASS:
 *      header:       buffer containing optional headers
 *      headerLen:    total length of headers
 *      bodyFile:     full path to file containing body of message.
 *                    May be NULL, in which case no body will be
 *                    sent.
 *
 *  RETURN:
 *      Return code:    if the GET completed,
 *                              OBEXLibraryError = OBEXLE_OK
 *                              OBEXResponseCode = The last response code
 *                                      sent to the client
 *                                      (OBEXRC_SUCCESS indicates successful
 *                                      completion)
 *
 */

OBEXError
    _pascal OBEXRejectGet  (OBEXResponseCode response,
                           byte *header,
                           word headerLen);

/*
 * Returns an unsuccessful response to a GET request, and terminates the
 * request.
 *
 * PASS:
 *      response:       the OBEX response code to send as the reason
 *                      for failure.
 *      header          = pointer to optional headers to transmit
 *      headerLen       = length of headers
 *
 *  RETURN:
 *      Return code:    Only the OBEXLibraryError is signifigant.
 */

  @prototype void OBEX_PUT_MSG  (MemHandle objInfo = cx);

/*  Prototype for message sent to obexApp when a PUT request
 *  is received by the server.  The handler MUST cause one of
 *  OBEXAcceptPut or OBEXRejectPut to be called.
 *
 * PASS:
 *      objInfo:        Memory block containing an OBEXRequestInfo
 *                      structure, filled in with all the headers
 *                      that preceede the body header.
 *                      The handler should not free this block.
 *
 * RETURN: nothing
 */

OBEXError
    _pascal OBEXAcceptPut  (MemHandle *objInfo);

/*
 *  Returns a successful response to a PUT request, transmitting
 *  optional headers.  Will not return until the PUT operation has
 *  completed.
 *
 *  RETURN:
 *      Return code:    if the PUT completed,
 *                              OBEXLibraryError = OBEXLE_OK
 *                              OBEXResponseCode = The last response code
 *                                      sent to the client
 *                                      (OBEXRC_SUCCESS indicates successful
 *                                      completion)
 *
 *      objInfo:        Memory block containing an OBEXRequestInfo struct
 *                      describing the received object.
 *                      If the operation was aborted by the client,
 *                      it will contain the headers received in the
 *                      ABORT request.
 *
 */

OBEXError
    _pascal OBEXRejectPut  (OBEXResponseCode response,
                           byte *header,
                           word headerLen);

/*
 * Returns an unsuccessful response to a PUT request, and terminates the
 * request.
 *
 * PASS:
 *      response:       the OBEX response code to send as the reason
 *                      for failure.
 *      header          = pointer to optional headers to transmit
 *      headerLen       = length of headers
 *
 * RETURN:
 *      return value:   OBEXLibraryError = OBEXLE_OK if response was sent
 *                              successfuly to client.
 */

OBEXError
    _pascal OBEXServerAbort  (OBEXResponseCode response,
                             byte *header,
                             word headerLen);
/*
 * Halts any GET or PUT operation currently in progress by sending
 * a failure response to the client.  This call has no effect before
 * OBEXAcceptGet or OBEXAcceptPut have been called.
 *
 * PASS:
 *      response:       OBEXResponseCode to send as the reason for
 *                      termination of GET/PUT
 *      header          Pointer to headers to send in the packet.
 *                      (NULL for no headers)
 *      headerLen       Length of header buffer.
 *
 * RETURN:
 *      return value:   If get or put was terminated,
 *                              OBEXLE_OK
 *                      if GET or PUT not in progress,
 *                              OBEXLE_OPERATION_NOT_IN_PROGRESS
 */

/***********************************************************************
**
**                  CLIENT API
**
*/

typedef WordFlags OBEXInitClientFlags ;

#define OICF_KEEP_IRDA_ALIVE  0x8000 /* If IrLMP connection succeeded,
                                     * even if the OBEX connect failed,
                                     * keep IrLMP connection
                                     * alive until OBEXExitClient() is
                                     * called. */

OBEXError
    _pascal OBEXInitClient  (OBEXTransport transport,
                            OBEXInitClientFlags initFlags,
                            TCHAR *who);
/*
 *  Initiates a connection to an OBEX server.
 *
 *  PASS:
 *      transport:      The low-level transport layer to be used to
 *                      transmit OBEX data.
 *      initFlags:      flags controlling the behavior of the client
 *      who             Optional string passed in the WHO field
 *                      of connect request.  If NULL, no WHO field
 *                      is sent.
 *
 *  RETURN:
 *      If connection was successful:
 *              LibraryError = OBEXLE_OK
 *              ResponseCode = OBEXRC_SUCCESS
 *      If OBEX server was contacted, but it rejected the connect,
 *              LibraryError = OBEXLE_OK
 *              ResponseCode = failure response code
 *      If low-level (example: IrLMP) connection was created, but
 *      the OBEX service could not be found on the remote device,
 *              LibraryError = OBEXLE_NO_OBEX_SERVICE
 *              ResponseCode = insignifigant
 *      If connection failed completely:
 *              LibraryError = OBEXLE_NO_CONNECTION
 *              ResponseCode = insignifigant
 */

OBEXError
    _pascal OBEXExitClient (void);
/*
 *  Terminates a connection to an OBEX server.
 *
 *  If OICF_KEEP_IRDA_ALIVE was passed to OBEXInitClient, you must call
 *  OBEXExitClient to terminate the IrDA connection.
 */

OBEXError
    _pascal OBEXPut  (byte *header,
                     word headerLen,
                     TCHAR *bodyFile,
                     MemHandle *response);
/*
 *  Sends an object to the server via a PUT request.
 *  Returns after PUT has been completed
 *
 *  PASS:
 *      header          pointer to headers to transmit in PUT.
 *      headerLen       length of header block.
 *      bodyFile        file containing the body of the PUT.
 *                      If NULL, body will be omitted.
 *  RETURN:
 *      Return value:   OBEXResponse byte: value returned from server.
 *			OBEXLibraryError byte: function call error code.
 *
 *			Note that OBEXLE_OK  does not mean that the
 *			transaction succeeded; it only means that the
 *			OBEX exchange completed normally.  The response
 *			code and headers may still indicate some kind of
 *			failure to complete the transaction.
 *
 *      response:       If error byte of return value == OBEXLE_OK and
 *			OBEXResponse != OBEXRC_SUCCESS,
 *                      this is a memory block of OBEXRequestInfo
 *                      containing the failure response headers from the
 *			server.
 *                      Caller is responsible for freeing block.
 *
 *			As good practice, the caller should always (regardless
 *			of error code) test "response" and free a non-NULL
 *			handle.
 */

OBEXError
    _pascal OBEXGet  (byte *header,
                     word headerLen,
                     MemHandle *recvInfo);

/*
 *  Requests an object from the server via a GET request.
 *
 *  PASS:
 *      header          pointer to headers to transmit in GET.
 *      headerLen       length of header block.
 *
 *  RETURN:
 *      Return value:   OBEXResponse byte: value returned from server.
 *			OBEXLibraryError byte: function call error code.
 *
 *      recvInfo:       memory block of OBEXRequestInfo
 *                      containing the returned object, or
 *                      failure response headers if OBEXLibraryError ==
 *			OBEXLE_OK and OBEXResponse != OBEXRC_SUCCESS.
 *                      Caller is responsible for freeing block.
 *
 *			Although no response block is returned if
 *			OBEXLibraryError != OBEXLE_OK, as good practice
 *			the caller should test "response" and free any
 *			non-NULL handle.
 */

OBEXError
    _pascal OBEXAbort  (byte *header,
                       word headerLen);

/*
 *  Terminates a GET or PUT operation that may be currently taking place.
 *  Note that because OBEXGet() and OBEXPut() both block the calling
 *  thread until the operation finishes, this routine is must be
 *  called from a different thread.
 *
 *  PASS:
 *      header          pointer to headers to transmit in GET.
 *      headerLen       length of header block.
 *
 *  RETURN:
 *      return value:   OBEXLE_OK and OBEXRC_SUCCESS if the operation was
 *                      aborted, or
 *                      OBEXLE_OPERATION_NOT_IN_PROGRESS if
 *                         no GET or PUT is taking place (the operation
 *                         may have just finished before the ABORT could
 *                         be sent)
 */

typedef ByteFlags OBEXSetPathFlags ;
#define OBEXSPF_PARENT   0x01

OBEXError
    _pascal OBEXSetPath  (OBEXSetPathFlags flags, TCHAR *path);
/*
 *  Send a SetPath request to the server.
 *
 *  PASS:
 *      flags           The SetPath flags to send in the request.
 *      path            The path to set
 *
 *  RETURN:
 *      Return value:   OBEXLE_OK & ResponseCode returned from Server
 */

/***********************************************************************
**
**                  UTILITY API
**
*/

byte* _pascal OBEXNextHeader (byte *header,
                             OBEXHeaderID *headerType,
                             word *headerLength,
                             dword *headerValue);
/*
 *  Utility routine for extracting header information from
 *  a packet, and converting to local type conventions.
 *
 * PASS:
 *      header = pointer to header to be extracted
 *
 * RETURN:
 *      Return value    = pointer to next header
 *
 *      headerType      = OBEXHeaderID, with the OBEXHeaderType information
 *                        included. ""
 *
 *      headerLength    = length of header value (minus any null-terminator
 *                        inherent in the header type.
 *
 *      headerValue     = 32 bit value appropriate for the header type:
 *              UNICODEZ: pointer to beginning of unicode string
 *              BINARY:   pointer to beginning of byte data
 *              BYTE:     value of byte (high 24 bits set to zero)
 *              DWORD:    value of dword (converted to LSB-first,
 *                        from OBEX's MSB-first order)
 */

byte* _pascal OBEXSetHeader  (byte *header,
                             OBEXHeaderID headerType,
                             word headerLength,
                             dword headerValue);
/*
 *  Utility routine for adding a header to the end of a block of headers.
 *
 * PASS:
 *      header = pointer to position to append new header.
 *
 *      headerType      = OBEXHeaderID (including the OBEXHeaderType)
 *
 *      headerLength    = length of header value (minus any null-terminator
 *                        inherent in the header type.
 *
 *      headerValue     = 32 bit value appropriate for the header type:
 *              UNICODEZ: pointer to beginning of GEOS string, which need
 *                        not be null-terminated.
 *                        Will be converted to Unicode in header.
 *                        headerLength should be the length of the
 *                        GEOS string (excluding null terminator),
 *                        not the resulting Unicode string.
 *              BINARY:   pointer to beginning of byte data
 *              BYTE:     value of byte
 *              DWORD:    value of dword
 *
 * RETURN:
 *      Return value    = pointer to byte just beyond added header.
 */

void _pascal
OBEXUnicodeToGeos (char *sbcsBuf, word *dbcsBuf, word length, char unrecognized);
/*
 *  Utility routine for converting a Unicode string to a GEOS string.
 *
 * PASS:
 *      sbcsBuf         = pointer to buffer to place the converted string
 *
 *      dbcsBuf         = pointer to unicode string
 *
 *      length          = length of unicode string (minus any null-terminator)
 *                        The same value returned from the headerLength parameter
 *                        of OBEXNextHeader()
 *
 *      unrecognized    = Character to use if a unicode character can't be converted.
 *
 * RETURN:
 *      nothing
 */

#ifdef __HIGHC__
#ifndef __OBEX_INTERNAL__
pragma Alias(OBEXInitServer, "OBEXINITSERVER");
pragma Alias(OBEXInitServerWithWho, "OBEXINITSERVERWITHWHO");
pragma Alias(OBEXExitServer, "OBEXEXITSERVER");
pragma Alias(OBEXAcceptGet, "OBEXACCEPTGET");
pragma Alias(OBEXRejectGet, "OBEXREJECTGET");
pragma Alias(OBEXAcceptPut, "OBEXACCEPTPUT");
pragma Alias(OBEXRejectPut, "OBEXREJECTPUT");
pragma Alias(OBEXInitClient, "OBEXINITCLIENT");
pragma Alias(OBEXExitClient, "OBEXEXITCLIENT");
pragma Alias(OBEXPut, "OBEXPUT");
pragma Alias(OBEXGet, "OBEXGET");
pragma Alias(OBEXAbort, "OBEXABORT");
pragma Alias(OBEXSetPath, "OBEXSETPATH");
pragma Alias(OBEXNextHeader, "OBEXNEXTHEADER");
pragma Alias(OBEXSetHeader, "OBEXSETHEADER");
pragma Alias(OBEXUnicodeToGeos, "OBEXUNICODETOGEOS");
pragma Alias(OBEXServerAbort, "OBEXSERVERABORT");
#endif
#endif /* __HIGHC__ */

@endlib

#endif /* __OBEX_GOH__ */


Mailbox\obextd.h

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1997.  All rights reserved.

PROJECT:
MODULE:
FILE:		obextd.def

AUTHOR:		John Mevissen, Nov 19, 1997

MACROS:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name		Date		Description
    ----		----		-----------
    mevissen	11/19/97   	Initial revision

DESCRIPTION:

    Definitions for the OBEX transport driver.

    $Id: obextd.h,v 1.1.1.2 97/12/12 16:40:18 mevissen Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _OBEXTD_H_
#define _OBEXTD_H_

#if defined(__HIGHC__)
#define _UNBOUNDED_ARRAY  0
#else
#define _UNBOUNDED_ARRAY
#endif

/*
*  OBEX address structure
*/

#define OBEX_MAX_TYPE_HEADER_LENGTH  64

typedef struct {

    TCHAR OMTA_fileName[FILE_LONGNAME_LENGTH+1];
    char  OMTA_dataType[OBEX_MAX_TYPE_HEADER_LENGTH+1];
    word  OMTA_userHeadersLength;
        byte  OMTA_userHeaders[_UNBOUNDED_ARRAY];

} ObexTDMailboxTransAddr} ;

#undef _UNBOUNDED_ARRAY

#endif /* _OBEXTD_H_ */


object.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	object.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines object structures and routines.
 *
 *	$Id: object.h,v 1.48.4.2 97/09/04 13:38:19 nfiedler Exp $
 *
 ***********************************************************************/

#ifndef	__OBJECT_H
#define __OBJECT_H

#include  <geode.h>
#include  <lmem.h>

/*
 *	Flags sent to ObjMessage
 */

typedef WordFlags MessageFlags ;
#define MF_CALL 				0x8000
#define MF_FORCE_QUEUE 			0x4000
#define MF_STACK 			0x2000
#define MF_CHECK_DUPLICATE 		0x0800
#define MF_CHECK_LAST_ONLY 		0x0400
#define MF_REPLACE 			0x0200
#define MF_CUSTOM 			0x0100
#define MF_FIXUP_DS 			0x0080
#define MF_FIXUP_ES 			0x0040
#define MF_DISCARD_IF_NO_MATCH 		0x0020
#define MF_MATCH_ALL 			0x0010
#define MF_INSERT_AT_FRONT 		0x0008
#define MF_CAN_DISCARD_IF_DESPERATE 	0x0004
#define MF_RECORD 			0x0002
#define MF_DISPATCH_DONT_FREE 		0x0002

/* Return values for ObjMessage */

typedef enum /* word */ {
    MESSAGE_NO_ERROR    ,
    MESSAGE_NO_HANDLES
} MessageError} ;

/* Return values for custom compare routine called when sending events */

#define PROC_SE_EXIT 		0x8000
#define PROC_SE_STORE_AT_BACK 	1
#define PROC_SE_CONTINUE 	0

/*
 *	Object Structures
 */

typedef void MessageMethod ();

typedef struct {
    LMemBlockHeader	OLMBH_header;
    word		OLMBH_inUseCount;
    word		OLMBH_interactibleCount;
    optr		OLMBH_output;
    word		OLMBH_resourceSize;
} ObjLMemBlockHeader} ;

/* Flags kept for each chunk in an object block */

typedef ByteFlags ObjChunkFlags ;
#define OCF_VARDATA_RELOC    	0x10
#define OCF_DIRTY 		0x08
#define OCF_IGNORE_DIRTY 	0x04
#define OCF_IN_RESOURCE 		0x02
#define OCF_IS_OBJECT 		0x01

/* Class structure */

typedef ByteFlags ClassFlags ;
#define CLASSF_HAS_DEFAULT 	0x80
#define CLASSF_MASTER_CLASS 	0x40
#define CLASSF_VARIANT_CLASS 	0x20
#define CLASSF_DISCARD_ON_SAVE 	0x10
#define CLASSF_NEVER_SAVED 	0x08
#define CLASSF_HAS_RELOC 	0x04
#define CLASSF_C_HANDLERS 	0x02

typedef struct _ClassStruct  {
    struct _ClassStruct	*Class_superClass;
    word		Class_masterOffset;
    word		Class_methodCount;
    word		Class_instanceSize;
    word    	    	Class_vdRelocTable;
    word		Class_relocTable;
    ClassFlags		Class_flags;
    byte		Class_masterMessages;
} ClassStruct} ;

#define NullClass  ((ClassStruct *)0)

typedef struct {
    word	methodParameterDef;
    byte	handlerTypeDef;
} CMethodDef} ;

/*
 *	Constants and Structures for Object Variable Storage Mechanism
 */

typedef struct {
    word	VDE_dataType;
    /* for data type with extra data, the following exist */
    word	VDE_entrySize;
} VarDataEntry} ;

/* offset to extra data */
#define VDE_extraData 	sizeof(VarDataEntry)

/* Offset from a pointer to extra data to the data type . */
/* THIS SHOULD ONLY BE USED IN EXCEPTIONAL CIRCUMSTANCES. */

#define VEDP_dataType 	(-4)	/* offset to data type */
#define VEDP_entrySize 	(-2)	/* offset to data size (valid only if   */
                /* VDF_EXTRA_DATA bit set in data type) */

typedef WordFlags VarDataFlags ;
#define VDF_TYPE 		0xfffc
#define VDF_EXTRA_DATA 		0x0002
#define VDF_SAVE_TO_STATE 	0x0001

/* Macro for fetching the type of a variable data entry given a pointer to
 * the extra data stored in it.
 */

#define VarDataTypePtr (ptr) ((*(((word *)ptr)-2))&VDF_TYPE)

#define VarDataFlagsPtr (ptr) ((*(((word *)ptr)-2))&~VDF_TYPE)

#define VarDataSizePtr (ptr) ((*(((word *)ptr)-2))&VDF_EXTRA_DATA \
                                ? (*(((word *)ptr)-1)) \
                                : 0)

typedef struct {
    word	VDCH_dataType;
    PCB    (void, 	VDCH_handler,(MemHandle mh, ChunkHandle chnk,
                VarDataEntry *extraData,
                word dataType, void *handlerData));
} VarDataCHandler} ;

#define DEFAULT_MASTER_MESSAGES 		8192
#define FIRST_MASTER_MESSAGE 		16384
#define DEFAULT_CLASS_MESSAGES 		512
#define DEFAULT_EXPORTED_MESSAGES 	48
#define DEFAULT_EXPORTED_MESSAGES_2 	96
#define DEFAULT_EXPORTED_MESSAGES_3 	144
#define DEFAULT_EXPORTED_MESSAGES_4 	192
#define DEFAULT_EXPORTED_MESSAGES_5 	240
#define DEFAULT_EXPORTED_MESSAGES_6 	288

/*
 *	Structures used when relocating objects
 */

typedef ByteEnum ObjRelocationType ;
#define RELOC_END_OF_LIST  0
#define RELOC_RELOC_HANDLE  1
#define RELOC_RELOC_SEGMENT  2
#define RELOC_RELOC_ENTRY_POINT  3

typedef struct {
    ObjRelocationType	OR_type;
    word		OR_offset;
} ObjRelocation} ;

typedef struct {
    char    	    EPR_geodeName[GEODE_NAME_SIZE];
    word    	    EPR_entryNumber;
} EntryPointRelocation} ;

typedef struct {
    VarDataFlags	VOR_type;   	/* type and tag */
    word		VOR_offset;
} VarObjRelocation} ;

/***/

typedef ByteEnum ObjRelocationSource ;
#define ORS_NULL  		0
#define ORS_OWNING_GEODE  	1
#define ORS_KERNEL  		2
#define ORS_LIBRARY  		3
#define ORS_CURRENT_BLOCK  	4
#define ORS_VM_HANDLE  		5
#define ORS_OWNING_GEODE_ENTRY_POINT  6
#define ORS_NON_STATE_VM  	7
#define ORS_UNKNOWN_BLOCK  	8
#define ORS_EXTERNAL  		9

#define RID_SOURCE_OFFSET  12

extern dword
    _pascal CObjMessage ();

extern dword
    _pascal CObjCallSuper ();

extern dword
    _pascal CMessageDispatch (EventHandle, MessageFlags, word);

extern void
    _pascal CObjSendToChildren (optr o, EventHandle message, word masterOffset,
                    word compOffset, word linkOffset);

extern Boolean
    _pascal ObjRelocOrUnRelocSuper (optr oself, ClassStruct *class, word frame);

/***/

extern void	/*XXX*/
    _pascal ObjProcBroadcastMessage (EventHandle event);

/***/

extern optr
    _pascal ObjInstantiate (MemHandle block, ClassStruct *class);

/***/

extern void *
    _pascal ObjLockObjBlock (MemHandle mh);

/***/

extern MemHandle	/*XXX*/
    _pascal ObjDuplicateResource (MemHandle blockToDup,
             GeodeHandle owner,
             ThreadHandle burdenThread);

/***/

extern void	/*XXX*/
    _pascal ObjFreeDuplicate (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal ObjFreeChunk (optr o);

#define ObjFreeChunkHandles (mh, ch) \
    ObjFreeChunk(ConstructOptr(mh, ch))

/***/

extern void	/*XXX*/
    _pascal ObjIncInUseCount (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal ObjDecInUseCount (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal ObjIncInteractibleCount (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal ObjDecInteractibleCount (MemHandle mh);

/***/

extern Boolean		/* TRUE if error */	/*XXX*/
    _pascal ObjDoRelocation (ObjRelocationType type,
            MemHandle block,
            void *sourceData,
            void *destData);

/***/

extern Boolean		/* TRUE if error */	/*XXX*/
    _pascal ObjDoUnRelocation (ObjRelocationType type,
              MemHandle block,
              void *sourceData,
              void *destData);

/***/

extern void *
    _pascal ObjRelocateEntryPoint (EntryPointRelocation *relocData);

/***/

extern void
    _pascal ObjUnRelocateEntryPoint (EntryPointRelocation *relocData,
                void *entryPoint);

/***/

extern void	/*XXX*/
    _pascal ObjResizeMaster (optr obj, word masterOffset, word newSize);

#define ObjResizeMasterHandles (mh, ch, mo, sz) \
    ObjResizeMaster(ConstructOptr(mh, ch), mo, sz)

/***/

extern void	/*XXX*/
    _pascal ObjInitializeMaster (optr obj, ClassStruct *class);

#define ObjInitializeMasterHandles (mh, ch, cl) \
    ObjInitializeMaster(ConstructOptr(mh, ch), cl)

/***/

extern void	/*XXX*/
    _pascal ObjInitializePart (optr obj, word masterOffset);

#define ObjInitializePartHandles (mh, ch, mo) \
    ObjInitializePart(ConstructOptr(mh, ch), mo)

/***/

extern ObjChunkFlags	/*XXX*/
    _pascal ObjGetFlags (optr o);

#define ObjGetFlagsHandles (mh, ch) \
    ObjGetFlags(ConstructOptr(mh, ch))

/***/

extern void	/*XXX*/
    _pascal ObjSetFlags (optr o,
        ObjChunkFlags bitsToSet,
        ObjChunkFlags bitsToClear);

#define ObjSetFlagsHandles (mh, ch, bs, bc) \
    ObjSetFlags(ConstructOptr(mh, ch), bs, bc)

/***/

extern void	/*XXX*/
    _pascal ObjMarkDirty (optr o);

#define ObjMarkDirtyHandles (mh, ch) \
    ObjMarkDirty(ConstructOptr(mh, ch))

/***/

extern Boolean	/*XXX*/
    _pascal ObjTestIfObjBlockRunByCurThread (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal ObjSaveBlock (MemHandle mh);

/***/

extern VMBlockHandle	/*XXX*/
    _pascal ObjMapSavedToState (MemHandle mh);

/***/

extern MemHandle	/*XXX*/
    _pascal ObjMapStateToSaved (VMBlockHandle vmbh, GeodeHandle gh);

/***/

extern Boolean	/*XXX*/
    _pascal ObjIsObjectInClass (optr obj, ClassStruct *class);

#define ObjIsObjectInClassHandles (mh, ch, cl) \
    ObjIsObjectInClass(ConstructOptr(mh, ch), cl)

/***/

/* Is class1 a subclass of class2? */

extern Boolean	/*XXX*/
    _pascal ObjIsClassADescendant (ClassStruct *class1, ClassStruct *class2);

/***/

extern void	/*XXX*/
    _pascal ObjFreeObjBlock (MemHandle block);

/***/

extern void	/*XXX*/
    _pascal ObjFreeMessage (EventHandle event);

/***/

extern Message	/*XXX*/
    _pascal ObjGetMessageInfo (EventHandle event, optr *dest);

/***/

typedef struct {
    word MDS_cx;
    word MDS_dx;
    word MDS_bp;
} MessageDataStruct} ;

extern Boolean  /*XXX*/
    _pascal ObjGetMessageData (EventHandle event, MessageDataStruct *data);

/***/

extern dword	/*XXX*/
    _pascal MessageSetDestination (EventHandle, optr);

/***/

extern EventHandle	/*XXX*/
    _pascal ObjDuplicateMessage (EventHandle msg);

/***/

        /* C cannot get return values from ObjDispatchMessage */
extern void	/*XXX*/
    _pascal ObjDispatchMessage (EventHandle event, Message replacementMessage,
                    optr replacementDest, MessageFlags flags);

/***/

extern void *	/*XXX*/
    _pascal ObjDeref (optr obj, word masterLevel);

#define ObjDerefHandles (mh, ch, ml) ObjDeref(ConstructOptr(mh, ch), ml)

extern void *	/*XXX*/
    _pascal ObjDeref1 (optr obj);

#define ObjDeref1Handles (mh, ch) ObjDeref1(ConstructOptr(mh, ch))

extern void *	/*XXX*/
    _pascal ObjDeref2 (optr obj);

#define ObjDeref2Handles (mh, ch) ObjDeref2(ConstructOptr(mh, ch))

/***/

extern void *
    _pascal ObjVarAddData (optr obj, VardataKey dataType, word dataSize);

#define ObjVarAddDataHandles (mh, ch, sz) \
        ObjVarAddData(ConstructOptr(mh, ch), sz)

/***/

extern Boolean
    _pascal ObjVarDeleteData (optr obj, VardataKey dataType);

#define ObjVarDeleteDataHandles (mh, ch, d) \
    ObjVarDeleteData(ConstructOptr(mh, ch), d)

/***/

extern void
    _pascal ObjVarDeleteDataAt (optr obj, word extraDataOffset);

#define ObjVarDeleteDataAtHandles (mh, ch, edo) \
    ObjVarDeleteDataAt(ConstructOptr(mh, ch), edo)

/***/

extern void
    _pascal ObjVarScanData (optr obj,
           word numHandlers,
           VarDataCHandler *handlerTable,
           void *handlerData);

#define ObjVarScanDataHandles (mh, ch, nh, ht, hd) \
    ObjVarScanData(ConstructOptr(mh, ch), nh, ht, hd)

/***/

extern void *
    _pascal ObjVarFindData (optr obj, VardataKey dataType);

#define ObjVarFindDataHandles (mh, ch, dt) \
    ObjVarFindData(ConstructOptr(mh, ch), dt)

/***/

extern void *
    _pascal ObjVarDerefData (optr obj, VardataKey dataType);

#define ObjVarDerefDataHandles (mh, ch, dt) \
    ObjVarDerefData(ConstructOptr(mh, ch), dt)

/***/

extern void
    _pascal ObjVarDeleteDataRange (optr obj,
              word rangeStart,
              word rangeEnd,
              Boolean useStateFlag);

#define ObjVarDeleteDataRangeHandles (mh, ch, rs, re, fl) \
    ObjVarDeleteDataRange(ConstructOptr(mh, ch), rs, re, fl)

/***/

extern void	/* XXX */
    _pascal ObjVarCopyDataRange (optr source,
            optr dest,
            word rangeStart,
            word rangeEnd);

/***/

extern void	/* XXX */
    _pascal ObjBlockSetOutput (MemHandle mh, optr o);

/***/

extern optr	/* XXX */
    _pascal ObjBlockGetOutput (MemHandle mh);

/***/

#ifdef __HIGHC__
pragma Alias(CObjMessage, "COBJMESSAGE");
pragma Alias(CObjCallSuper, "COBJCALLSUPER");
pragma Alias(CMessageDispatch, "CMESSAGEDISPATCH");
pragma Alias(CObjSendToChildren, "COBJSENDTOCHILDREN");
pragma Alias(ObjRelocOrUnRelocSuper, "OBJRELOCORUNRELOCSUPER");
pragma Alias(ObjProcBroadcastMessage, "OBJPROCBROADCASTMESSAGE");
pragma Alias(ObjInstantiate, "OBJINSTANTIATE");
pragma Alias(ObjLockObjBlock, "OBJLOCKOBJBLOCK");
pragma Alias(ObjDuplicateResource, "OBJDUPLICATERESOURCE");
pragma Alias(ObjFreeDuplicate, "OBJFREEDUPLICATE");
pragma Alias(ObjFreeChunk, "OBJFREECHUNK");
pragma Alias(ObjIncInUseCount, "OBJINCINUSECOUNT");
pragma Alias(ObjDecInUseCount, "OBJDECINUSECOUNT");
pragma Alias(ObjIncInteractibleCount, "OBJINCINTERACTIBLECOUNT");
pragma Alias(ObjDecInteractibleCount, "OBJDECINTERACTIBLECOUNT");
pragma Alias(ObjDoRelocation, "OBJDORELOCATION");
pragma Alias(ObjDoUnRelocation, "OBJDOUNRELOCATION");
pragma Alias(ObjRelocateEntryPoint, "OBJRELOCATEENTRYPOINT");
pragma Alias(ObjUnRelocateEntryPoint, "OBJUNRELOCATEENTRYPOINT");
pragma Alias(ObjResizeMaster, "OBJRESIZEMASTER");
pragma Alias(ObjInitializeMaster, "OBJINITIALIZEMASTER");
pragma Alias(ObjInitializePart, "OBJINITIALIZEPART");
pragma Alias(ObjGetFlags, "OBJGETFLAGS");
pragma Alias(ObjSetFlags, "OBJSETFLAGS");
pragma Alias(ObjMarkDirty, "OBJMARKDIRTY");
pragma Alias(ObjTestIfObjBlockRunByCurThread, "OBJTESTIFOBJBLOCKRUNBYCURTHREAD");
pragma Alias(ObjSaveBlock, "OBJSAVEBLOCK");
pragma Alias(ObjMapSavedToState, "OBJMAPSAVEDTOSTATE");
pragma Alias(ObjMapStateToSaved, "OBJMAPSTATETOSAVED");
pragma Alias(ObjIsObjectInClass, "OBJISOBJECTINCLASS");
pragma Alias(ObjIsClassADescendant, "OBJISCLASSADESCENDANT");
pragma Alias(ObjFreeObjBlock, "OBJFREEOBJBLOCK");
pragma Alias(ObjGetMessageInfo, "OBJGETMESSAGEINFO");
pragma Alias(ObjGetMessageData, "OBJGETMESSAGEDATA");
pragma Alias(MessageSetDestination, "MESSAGESETDESTINATION");
pragma Alias(ObjFreeMessage, "OBJFREEMESSAGE");
pragma Alias(ObjDeref, "OBJDEREF");
pragma Alias(ObjDeref1, "OBJDEREF1");
pragma Alias(ObjDeref2, "OBJDEREF2");

pragma Alias(ObjVarAddData, "OBJVARADDDATA");
pragma Alias(ObjVarDeleteData, "OBJVARDELETEDATA");
pragma Alias(ObjVarDeleteDataAt, "OBJVARDELETEDATAAT");
pragma Alias(ObjVarScanData, "OBJVARSCANDATA");
pragma Alias(ObjVarFindData, "OBJVARFINDDATA");
pragma Alias(ObjVarDerefData, "OBJVARDEREFDATA");
pragma Alias(ObjVarDeleteDataRange, "OBJVARDELETEDATARANGE");
pragma Alias(ObjVarCopyDataRange, "OBJVARCOPYDATARANGE");

pragma Alias(ObjBlockSetOutput, "OBJBLOCKSETOUTPUT");
pragma Alias(ObjBlockGetOutput, "OBJBLOCKGETOUTPUT");
pragma Alias(ObjDuplicateMessage, "OBJDUPLICATEMESSAGE");

#endif

#endif


parallDr.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1993 -- All Rights Reserved
 *
 * PROJECT:	  GEOS
 * MODULE:	  CInclude
 * FILE:	  parallDr.h
 *
 * AUTHOR:  	  Jenny Greenwood: Aug 31, 1993
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	jenny	8/31/93   	Initial version
 *	doug	1/27/94		Moved all parallel constants from StreamC here
 *				so as to mirror the original definition files
 *
 * DESCRIPTION:
 *	Header for users of the parallel port driver.
 *
 * 	$Id: parallDr.h,v 1.2.6.1 96/04/28 08:29:01 chris Exp $
 *
 ***********************************************************************/
#ifndef _PARALLDR_H_
#define _PARALLDR_H_

/*
 * Parallel driver only StreamError:  Requested interrupt level is already
 * in-use by another port.
 */

#define STREAM_INTERRUPT_TAKEN  = STREAM_FIRST_DEV_ERROR

/*
 * Constants for DR_STREAM_OPEN.
 * ParallelPortNum and ParallelUnit identify serial ports.  The only reason
 * for two names for the same this is for consistency with the ASM
 * documentation.
 */
typedef	enum /* word */
{
    PARALLEL_LPT1		= 0,
    PARALLEL_LPT2		= 2,
    PARALLEL_LPT3		= 4,
    PARALLEL_LPT4		= 6,
} ParallelPortNum, ParallelUnit, ;

/*
 * ParallelDeviceMap is the serial driver attribute mask returned by
 * ParallelGetDeviceMap.
 */
typedef	WordFlags ParallelDeviceMap ;
#define	PARALLEL_DEVICE_LPT4_OFFSET		(6)
#define	PARALLEL_DEVICE_LPT4			(0x01 << PARALLEL_DEVICE_LPT4_OFFSET)

#define	PARALLEL_DEVICE_LPT3_OFFSET		(4)
#define	PARALLEL_DEVICE_LPT3			(0x01 << PARALLEL_DEVICE_LPT3_OFFSET)

#define	PARALLEL_DEVICE_LPT2_OFFSET		(2)
#define	PARALLEL_DEVICE_LPT2			(0x01 << PARALLEL_DEVICE_LPT2_OFFSET)

#define	PARALLEL_DEVICE_LPT1_OFFSET		(0)
#define	PARALLEL_DEVICE_LPT1			(0x01 << PARALLEL_DEVICE_LPT1_OFFSET)

/*
 * ParallelError indicates the nature of parallel device-specific errors.
 * This is the "errorCode" returned by ParallelGetError.
 */
typedef	WordFlags ParallelError ;
#define	PARALLEL_ERROR_FATAL_OFFSET		(9)
#define	PARALLEL_ERROR_FATAL			(0x01 <<	\
                     PARALLEL_ERROR_FATAL_OFFSET)

#define	PARALLEL_ERROR_TIMEOUT_OFFSET		(8)
#define	PARALLEL_ERROR_TIMEOUT			(0x01 <<	\
                     PARALLEL_ERROR_TIMEOUT_OFFSET)

#define	PARALLEL_ERROR_NOPAPER_OFFSET		(5)
#define	PARALLEL_ERROR_NOPAPER			(0x01 <<	\
                     PARALLEL_ERROR_PAPER_OFFSET)

#define	PARALLEL_ERROR_OFFLINE_OFFSET		(4)
#define	PARALLEL_ERROR_OFFLINE			(0x01 <<	\
                     PARALLEL_ERROR_OFFLINE_OFFSET)

#define	PARALLEL_ERROR_ERROR_OFFSET		(3)
#define	PARALLEL_ERROR_ERROR			(0x01 <<	\
                     PARALLEL_ERROR_ERROR_OFFSET)

typedef enum
{
    PARALLEL_INT_THREAD		= 0,
    PARALLEL_INT_NORMAL		= 7,
    PARALLEL_INT_ALTERNATE		= 5
} ParallelInterrupt} ;

#endif /* _PARALLDR_H_ */


parse.h

/***********************************************************************
*
*      Copyright (c) GeoWorks 1992 -- All Rights Reserved
*
* PROJECT:     PC/GEOS
* FILE:        parse.h
* AUTHOR:      Anna Lijphart: January, 1992
*
* DESCRIPTION:
*	C version of parse.def
*
*      $Id: parse.h,v 1.32.5.1 96/04/28 08:28:25 chris Exp $
*
***********************************************************************/

#ifndef __PARSEC_GOH
#define __PARSEC_GOH

#include  <math.h>

typedef ByteEnum ScannerTokenType ;
#define SCANNER_TOKEN_NUMBER  0
#define SCANNER_TOKEN_STRING  1
#define SCANNER_TOKEN_CELL  2
#define SCANNER_TOKEN_END_OF_EXPRESSION  3
#define SCANNER_TOKEN_OPEN_PAREN  4
#define SCANNER_TOKEN_CLOSE_PAREN  5
#define SCANNER_TOKEN_IDENTIFIER  6
#define SCANNER_TOKEN_OPERATOR  7
#define SCANNER_TOKEN_LIST_SEPARATOR  8

typedef struct {
    FloatNum	STND_value;
} ScannerTokenNumberData} ;

typedef struct {
    word	STSD_start;
    word	STSD_length;
} ScannerTokenStringData} ;

/*
 * 	CellRowColumn	record
 */

typedef WordFlags CellRowColumn ;
#define    CRC_ABSOLUTE     	0x8000
#define    CRC_VALUE    		0x7fff

typedef struct {
    CellRowColumn	CR_row;
    CellRowColumn	CR_column;
} CellReference} ;

typedef struct {
    CellReference	CR_start;
    CellReference	CR_end;
} CellRange} ;

typedef	struct {
    CellReference	STCD_cellRef;
} ScannerTokenCellData} ;

typedef ByteEnum OperatorType ;
#define OP_RANGE_SEPARATOR  0
#define OP_NEGATION  1
#define OP_PERCENT  2
#define OP_EXPONENTIATION  3
#define OP_MULTIPLICATION  4
#define OP_DIVISION  5
#define OP_MODULO  6
#define OP_ADDITION  7
#define OP_SUBTRACTION  8
#define OP_EQUAL  9
#define OP_NOT_EQUAL  10
#define OP_LESS_THAN  11
#define OP_GREATER_THAN  12
#define OP_LESS_THAN_OR_EQUAL  13
#define OP_GREATER_THAN_OR_EQUAL  14
#define OP_STRING_CONCAT  15
#define OP_RANGE_INTERSECTION  16
#define OP_NOT_EQUAL_GRAPHIC  17
#define OP_DIVISION_GRAPHIC  18
#define OP_LESS_THAN_OR_EQUAL_GRAPHIC  19
#define OP_GREATER_THAN_OR_EQUAL_GRAPHIC  20

#define OP_PERCENT_MODULO  21
#define OP_SUBTRACTION_NEGATION  22

typedef struct {
    OperatorType	STOD_operatorID;
} ScannerTokenOperatorData} ;

typedef struct {
    word	STID_start;
} ScannerTokenIdentifierData} ;

typedef union {
    ScannerTokenNumberData	STD_number;
    ScannerTokenStringData	STD_string;
    ScannerTokenCellData	STD_cell;
    ScannerTokenIdentifierData	STD_identifier;
    ScannerTokenOperatorData	STD_operator;
} ScannerTokenData} ;

typedef struct {
    ScannerTokenType	ST_type;
    ScannerTokenData	ST_data;
} ScannerToken} ;

typedef ByteEnum ParserTokenType ;
#define PARSER_TOKEN_NUMBER  0
#define PARSER_TOKEN_STRING  1
#define PARSER_TOKEN_CELL  2
#define PARSER_TOKEN_END_OF_EXPRESSION  3
#define PARSER_TOKEN_OPEN_PAREN  4
#define PARSER_TOKEN_CLOSE_PAREN  5
#define PARSER_TOKEN_NAME  6
#define PARSER_TOKEN_FUNCTION  7
#define PARSER_TOKEN_CLOSE_FUNCTION  8
#define PARSER_TOKEN_ARG_END  9
#define PARSER_TOKEN_OPERATOR  10

typedef struct {
    FloatNum	PTND_value;
} ParserTokenNumberData} ;

typedef struct {
    word	PTSD_length;
} ParserTokenStringData} ;

typedef struct {
    CellReference	PTCD_cellRef;
} ParserTokenCellData} ;

typedef struct {
    word	PTFD_functionID;
} ParserTokenFunctionData} ;

typedef struct {
    OperatorType	PTOD_operatorID;
} ParserTokenOperatorData} ;

typedef	struct {
    word	PTND_name;
} ParserTokenNameData} ;

typedef union {
    ParserTokenNumberData	PTD_number;
    ParserTokenStringData	PTD_string;
    ParserTokenNameData		PTD_name;
    ParserTokenCellData		PTD_cell;
    ParserTokenFunctionData	PTD_function;
    ParserTokenOperatorData	PTD_operator;
} ParserTokenData} ;

typedef struct {
    ParserTokenType	PT_type;
    ParserTokenData	PT_data;
} ParserToken} ;

/*
 * 	ParserFlags	record
 */
typedef ByteFlags ParserFlags ;
#define	PF_HAS_LOOKAHEAD		    0x80
#define PF_CONTAINS_DISPLAY_FUNC     0x40
#define PF_OPERATORS 	    	    0x20
#define PF_NUMBERS   	    	    0x10
#define PF_CELLS    	    	    0x08
#define PF_FUNCTIONS 	    	    0x04
#define PF_NAMES     	    	    0x02
#define PF_NEW_NAMES 	    	    0x01

typedef ByteEnum ParserScannerEvaluatorError ;
/*
 * Scanner errors
 */
#define PSEE_BAD_NUMBER 	    	    	    0
#define PSEE_BAD_CELL_REFERENCE 	    	    1
#define PSEE_NO_CLOSE_QUOTE  	    	    2
#define PSEE_COLUMN_TOO_LARGE 	    	    3
#define PSEE_ROW_TOO_LARGE   	    	    4
#define PSEE_ILLEGAL_TOKEN   	    	    5
/*
 * Parser errors
 */
#define PSEE_GENERAL 	    	    	    6
#define PSEE_TOO_MANY_TOKENS 	    	    7
#define PSEE_EXPECTED_OPEN_PAREN     	    8
#define PSEE_EXPECTED_CLOSE_PAREN    	    9
#define PSEE_BAD_EXPRESSION  	    	    10
#define PSEE_EXPECTED_END_OF_EXPRESSION 	    11
#define PSEE_MISSING_CLOSE_PAREN     	    12
#define PSEE_UNKNOWN_IDENTIFIER 	    	    13
#define PSEE_NOT_ENOUGH_NAME_SPACE   	    14
/*
 * Serious evaluator errors
 */
#define PSEE_OUT_OF_STACK_SPACE 	    	    15
#define PSEE_NESTING_TOO_DEEP 	    	    16
/*
 * Evaluator errors that are returned as the result of formulas.
 * These are returned on the argument stack.
 */
#define PSEE_ROW_OUT_OF_RANGE 	    	    17
#define PSEE_COLUMN_OUT_OF_RANGE     	    18
#define PSEE_FUNCTION_NO_LONGER_EXISTS 	    19
#define PSEE_BAD_ARG_COUNT   	    	    20
#define PSEE_WRONG_TYPE 	    	    	    21
#define PSEE_DIVIDE_BY_ZERO  	    	    22
#define PSEE_UNDEFINED_NAME  	    	    23
#define PSEE_CIRCULAR_REF    	    	    24
#define PSEE_CIRCULAR_DEP    	    	    25
#define PSEE_CIRC_NAME_REF   	    	    26
#define PSEE_NUMBER_OUT_OF_RANGE     	    27
#define PSEE_GEN_ERR 	    	    	    28
#define PSEE_NA 	    	    	    	    29
/*
 * Dependency errors
 */
#define PSEE_TOO_MANY_DEPENDENCIES   	    30

#define PSEE_SSHEET_BASE  	0xc0
#define PSEE_FLOAT_BASE  	250
#define PSEE_APP_BASE 		230

#define PSEE_FLOAT_POS_INFINITY      	    PSEE_FLOAT_BASE
#define PSEE_FLOAT_NEG_INFINITY 	    	    (PSEE_FLOAT_BASE + 1)
#define PSEE_FLOAT_GEN_ERR 	    	    (PSEE_FLOAT_BASE + 2)

#define  PSEE_PARSER_ERRORS   PSEE_BAD_NUMBER, \
    PSEE_BAD_CELL_REFERENCE, \
    PSEE_NO_CLOSE_QUOTE, \
    PSEE_COLUMN_TOO_LARGE, \
    PSEE_ROW_TOO_LARGE, \
    PSEE_ILLEGAL_TOKEN, \
    PSEE_GENERAL, \
    PSEE_TOO_MANY_TOKENS, \
    PSEE_EXPECTED_OPEN_PAREN, \
    PSEE_EXPECTED_CLOSE_PAREN, \
    PSEE_BAD_EXPRESSION, \
    PSEE_EXPECTED_END_OF_EXPRESSION, \
    PSEE_MISSING_CLOSE_PAREN, \
    PSEE_UNKNOWN_IDENTIFIER, \
    PSEE_NOT_ENOUGH_NAME_SPACE, \
    PSEE_OUT_OF_STACK_SPACE, \
    PSEE_NESTING_TOO_DEEP, \
    PSEE_ROW_OUT_OF_RANGE, \
    PSEE_COLUMN_OUT_OF_RANGE, \
    PSEE_FUNCTION_NO_LONGER_EXISTS, \
    PSEE_BAD_ARG_COUNT, \
    PSEE_WRONG_TYPE, \
    PSEE_DIVIDE_BY_ZERO, \
    PSEE_UNDEFINED_NAME, \
    PSEE_CIRCULAR_REF, \
    PSEE_CIRCULAR_DEP, \
    PSEE_CIRC_NAME_REF, \
    PSEE_NUMBER_OUT_OF_RANGE, \
    PSEE_GEN_ERR, \
    PSEE_NA, \
    PSEE_TOO_MANY_DEPENDENCIES

#define PSEE_FLOAT_ERRORS 	\
    PSEE_PARSER_ERRORS, \
    PSEE_FLOAT_POS_INFINITY = PSEE_FLOAT_BASE, \
    PSEE_FLOAT_NEG_INFINITY, \
    PSEE_FLOAT_GEN_ERR

typedef struct {
    word        CP_row;
    word        CP_column;
    word        CP_maxRow;
    word        CP_maxColumn;
    void *      CP_callback;
    void *      CP_cellParams;	  /* ptr to an instance of SpreadsheetClass */
} CommonParameters} ;

typedef ByteEnum CallbackType ;
#define CT_FUNCTION_TO_TOKEN  0
#define CT_NAME_TO_TOKEN  1
#define CT_CHECK_NAME_EXISTS  2
#define CT_CHECK_NAME_SPACE  3
#define CT_EVAL_FUNCTION  4
#define CT_LOCK_NAME  5
#define CT_UNLOCK  6
#define CT_FORMAT_FUNCTION  7
#define CT_FORMAT_NAME  8
#define CT_CREATE_CELL  9
#define CT_EMPTY_CELL  10
#define CT_NAME_TO_CELL  11
#define CT_FUNCTION_TO_CELL  12
#define CT_DEREF_CELL  13
#define CT_SPECIAL_FUNCTION  14

/*
 * Don't use the ParserParameters structure if you're calling ParseString.
 * Use the CParserParameters structure instead.
 */
typedef struct {
    CommonParameters	PP_common;
    word		PP_parserBufferSize;
    ParserFlags		PP_flags;
    dword		PP_textPtr;
    ScannerToken	PP_currentToken;
    ScannerToken	PP_lookAheadToken;
    byte		PP_error;	/* ParserScannerEvaluatorError */
    word		PP_tokenStart;
    word		PP_tokenEnd;
} ParserParameters} ;

typedef enum  /* word */ {
    SF_FILENAME    ,
    SF_PAGE    ,
    SF_PAGES    ,
} SpecialFunctions} ;

/*
 * C Callback structures:
 *	All callback structures have as the first byte the CallbackType,
 *	then any passed values, then a set of variables that are
 *	filled with return values.
 */

/* CT_FUNCTION_TO_TOKEN --
 *
 * Description:
 *	Convert a function name to a function id token.
 * Pass:
 *	callbackType  	= CT_FUNCTION_TO_TOKEN
 *	params 	      	= Pointer to ParserParameters
 *	text   	    	= Pointer to the text of the identifier
 *	length 	    	= Length of the identifier
 * Return:
 *	isFunctionName 	= set this to non-zero if the text is a function name
 *	funcID	      	= The Function-ID for the identifier
 */
typedef struct {
    char *  	    	text;
    word    	    	length;
    byte 	    	isFunctionName;
    word    	    	funcID;
} CT_FTT_CallbackStruct} ;

/* CT_NAME_TO_TOKEN --
 *
 * Description:
 *	Convert a name to a name id token.
 * Pass:
 *	callbackType  	= CT_NAME_TO_TOKEN
 *	params 	    	= Pointer to ParserParameters
 *	text   	    	= Pointer to the text of the identifier
 *	length 	    	= Length of the identifier
 * Return:
 *	nameID	      	= Token for the name
 *	errorOccurred 	= set to non-zero if an error occurred.
 *	error	     	= error code
 */
typedef struct {
    char *  	    	text;
    word    	    	length;
    word    	    	nameID;
    byte 	    	errorOccurred;
    byte    	    	error;
} CT_NTT_CallbackStruct} ;

/* CT_CHECK_NAME_EXISTS --
 *
 * Description:
 *	Check to see if a name already exists
 * Pass:
 *	callbackType  	= CT_CHECK_NAME_EXISTS
 *	params 	    	= Pointer to ParserParameters
 *	text   	    	= Pointer to the text of the identifier
 *	length 	    	= Length of the identifier
 * Return:
 *	nameExists  	= non-zero if the name does exist
 */
typedef struct {
    char *  	    	text;
    word    	    	length;
    byte	    	nameExists;
} CT_CNE_CallbackStruct} ;

/* CT_CHECK_NAME_SPACE
 * Description:
 *	Signal the need to allocate a certain number of names.
 *	This is used to avoid the problem of getting part way through
 *	allocating names for an expression and then finding we don't
 *	have any more space for names.
 * Pass:
 *	callbackType  	= CT_CHECK_NAME_SPACE
 *	params 	    	= Pointer to ParserParameters
 *	numToAllocate 	= # of names we want to allocate
 * Return:
 *	enoughSpace 	= set to non-zero if there was enough space.
 *	errorOccurred 	= set to non-zero if an error occurred.
 *	error	     	= error code
 */
typedef struct {
    word    	    	numToAllocate;
    byte    	    	enoughSpace;
    byte 	    	errorOccurred;
    byte    	    	error;
} CT_CNS_CallbackStruct} ;

/* CT_EVAL_FUNCTION --
 *
 * Description:
 *	Evaluate a function with parameters.
 * Pass:
 *	callbackType  	= CT_CHECK_NAME_EXISTS
 *	params 	    	= Pointer to EvalParameters
 *	numArgs	    	= # of arguments
 *	funcID	    	= Function ID
 * Return:
 *	errorOccurred 	= set to non-zero if an error occurred.
 *	error	     	= error code
 */
typedef struct {
    word    	    	numArgs;
    word    	    	funcID;
    byte 	    	errorOccurred;
    byte    	    	error;
} CT_EF_CallbackStruct} ;

/* CT_LOCK_NAME
 *
 * Description:
 *	Lock a name definition.
 * Pass:
 *	callbackType  	= CT_LOCK_NAME
 *	params 	    	= Pointer to ParserParameters
 *	nameToken   	= Name token
 * Return:
 *	defPtr	    	= Far pointer to the definition
 *	errorOccurred 	= set to non-zero if an error occurred
 *	error	     	= error code
 */
typedef struct {
    word    	    	nameToken;
    byte *   	    	defPtr;
    byte 	    	errorOccurred;
    byte    	    	error;
} CT_LN_CallbackStruct} ;

/* CT_UNLOCK
 *
 * Description:
 *	Unlock a name/function definition.
 * Pass:
 *	callbackType  	= CT_UNLOCK
 *	params 	    	= Pointer to ParserParameters
 *	dataPtr	    	= Pointer to data to unlock
 * Return:
 *	nothing
 */
typedef struct {
    byte *       	    	dataPtr;
} CT_UL_CallbackStruct} ;

/* CT_FORMAT_FUNCTION
 *
 * Description:
 *	Format a function name into a buffer.
 * Pass:
 *	callbackType  	= CT_FORMAT_FUNCTION
 *	params	    	= Pointer to ParserParameters
 *	textPtr	    	= Pointer to place to store the text
 *	funcToken    	= Function token
 *	maxChars    	= Maximum number of characters that can be written
 * Return:
 *	resultPtr   	= Pointer past the inserted text
 *	numWritten  	= # of characters that were written
 */
typedef struct {
    char *  	    	textPtr;
    word    	    	funcToken;
    word    	    	maxChars;
    char *  	    	resultPtr;
    word    	    	numWritten;
} CT_FF_CallbackStruct} ;

/* CT_FORMAT_NAME
 *
 * Description:
 *	Format a name into a buffer.
 * Pass:
 *	callbackType  	= CT_FORMAT_NAME
 *	params	    	= Pointer to ParserParameters
 *	textPtr	    	= Pointer to place to store the text
 *	nameToken    	= Name token
 *	maxChars    	= Maximum number of characters that can be written
 * Return:
 *	resultPtr   	= Pointer past the inserted text
 *	numWritten  	= # of characters that were written
 */
typedef struct {
    char *  	    	textPtr;
    word    	    	nameToken;
    word    	    	maxChars;
    char *  	    	resultPtr;
    word    	    	numWritten;
} CT_FN_CallbackStruct} ;

/* CT_CREATE_CELL
 *
 * Description:
 *	Create a new empty cell. Used by the dependency code to
 *	create a cell to add dependencies to.
 * Pass:
 *	callbackType  	= CT_CREATE_CELL
 *	params 	    	= Pointer to ParserParameters
 *	row 	    	= Row of the cell to create
 *	column	    	= Column of the cell to create
 * Return:
 *	errorOccurred 	= set to non-zero if an error occurred
 *	error	     	= error code
 */
typedef struct {
    word    	    	row;
    word    	    	column;
    byte 	    	errorOccurred;
    byte    	    	error;
} CT_CC_CallbackStruct} ;

/* CT_EMPTY_CELL
 *
 * Description:
 *	Remove a cell if it's appropriate. This is called when a cell
 *	has its last dependency removed.
 * Pass:
 *	callbackType  	= CT_EMPTY_CELL
 *	params 	    	= Pointer to ParserParameters
 *	row 	    	= Row of the cell that now has no dependencies
 *	column	    	= Column of the cell that now has no dependencies
 * Return:
 *	errorOccurred 	= set to non-zero if an error occurred
 *	error	     	= error code
 */
typedef struct {
    word    	    	row;
    word    	    	column;
    byte 	    	errorOccurred;
    byte    	    	error;
} CT_EC_CallbackStruct} ;

/* CT_NAME_TO_CELL
 *
 * Description:
 *	Convert a name to a cell so we can add a dependency to it.
 * Pass:
 *	callbackType  	= CT_NAME_TO_CELL
 *	params 	    	= Pointer to ParserParameters
 *	nameToken   	= Name token
 * Return:
 *	row 	    	= Row of the cell containing the names dependencies
 *	column	    	= Column of the cell containing the names dependencies
 */
typedef struct {
    word    	    	nameToken;
    word    	    	row;
    word    	    	column;
} CT_NTC_CallbackStruct} ;

/* CT_FUNCTION_TO_CELL
 *
 * Description:
 *	Convert a function to a cell so we can add a dependencies to
 *	it.
 * Pass:
 *	callbackType  	= CT_FUNCTION_TO_CELL
 *	params 	    	= Pointer to ParserParameters
 *	funcID	    	= Function-ID
 * Return:
 *	row 	    	= Row of the cell containing the functions dependencies
 *	    	    	= 0 if no dependency is required
 *	column	    	= Column of the cell containing the functions
 */
typedef struct {
    word    	    	funcID;
    word    	    	row;
    word    	    	column;
} CT_FTC_CallbackStruct} ;

/* CT_DEREF_CELL
 *
 * Description:
 *	Get the contents of a cell. The callback is responsible for
 *	popping the cell reference off the stack.
 * Pass:
 *	callbackType  	= CT_DEREF_CELL
 *	params 	    	= Pointer to EvalParameters
 *	argStack    	= Pointer to the argument stack
 *	opFnStack   	= Pointer to operator/function stack
 *	row 	    	= Row of the cell to dereference
 *	column	    	= Column of the cell to dereference
 *	derefFlags  	= DerefFlags
 * Return:
 *	newArgStack 	= New pointer to the argument stack
 *	errorOccurred 	= set to non-zero if an error occurred
 *	error	     	= error code
 */
typedef struct {
    byte *  	    	argStack;
    byte *  	    	opFnStack;
    word    	    	row;
    byte    	    	column;
    byte    	    	derefFlags;
    byte *  	    	newArgStack;
    byte 	    	errorOccurred;
    byte    	    	error;
} CT_DC_CallbackStruct} ;

/* CT_SPECIAL_FUNCTION
 *
 * Description:
 *	Get the value of one of the special functions.
 * Pass:
 *	callbackType  	= CT_SPECIAL_FUNCTION
 *	params 	    	= Pointer to EvalParameters
 *	argStack    	= Pointer to the argument stack
 *	opFnStack   	= Pointer to operator/function stack
 *	specialFunction	= Special function
 * Return:
 *	newArgStack 	= New pointer to the argument stack
 *	errorOccurred 	= set to non-zero if an error occurred
 *	error	     	= error code
 */
typedef struct {
    byte *  	    	argStack;
    byte *  	    	opFnStack;
    SpecialFunctions	specialFunction;
    byte *  	    	newArgStack;
    byte 	    	errorOccurred;
    byte    	    	error;
} CT_SF_CallbackStruct} ;

#define FUNCTION_ID_FIRST_EXTERNAL_FUNCTION_BASE 	0x8000

typedef enum /* word */ {
    FUNCTION_ID_ABS    ,
    FUNCTION_ID_ACOS    ,
    FUNCTION_ID_ACOSH    ,
    FUNCTION_ID_AND    ,
    FUNCTION_ID_ASIN    ,
    FUNCTION_ID_ASINH    ,
    FUNCTION_ID_ATAN    ,
    FUNCTION_ID_ATAN2    ,
    FUNCTION_ID_ATANH    ,
    FUNCTION_ID_AVG    ,
    FUNCTION_ID_CHAR    ,
    FUNCTION_ID_CHOOSE    ,
    FUNCTION_ID_CLEAN    ,
    FUNCTION_ID_CODE    ,
    FUNCTION_ID_COLS    ,
    FUNCTION_ID_COS    ,
    FUNCTION_ID_COSH    ,
    FUNCTION_ID_COUNT    ,
    FUNCTION_ID_CTERM    ,
    FUNCTION_ID_DATE    ,
    FUNCTION_ID_DATEVALUE    ,
    FUNCTION_ID_DAY    ,
    FUNCTION_ID_DDB    ,
    FUNCTION_ID_ERR    ,
    FUNCTION_ID_EXACT    ,
    FUNCTION_ID_EXP    ,
    FUNCTION_ID_FACT    ,
    FUNCTION_ID_FALSE    ,
    FUNCTION_ID_FIND    ,
    FUNCTION_ID_FV    ,
    FUNCTION_ID_HLOOKUP    ,
    FUNCTION_ID_HOUR    ,
    FUNCTION_ID_IF    ,
    FUNCTION_ID_INDEX    ,
    FUNCTION_ID_INT    ,
    FUNCTION_ID_IRR    ,
    FUNCTION_ID_ISERR    ,
    FUNCTION_ID_ISNUMBER    ,
    FUNCTION_ID_ISSTRING    ,
    FUNCTION_ID_LEFT    ,
    FUNCTION_ID_LENGTH    ,
    FUNCTION_ID_LN    ,
    FUNCTION_ID_LOG    ,
    FUNCTION_ID_LOWER    ,
    FUNCTION_ID_MAX    ,
    FUNCTION_ID_MID    ,
    FUNCTION_ID_MIN    ,
    FUNCTION_ID_MINUTE    ,
    FUNCTION_ID_MOD    ,
    FUNCTION_ID_MONTH    ,
    FUNCTION_ID_N    ,
    FUNCTION_ID_NA    ,
    FUNCTION_ID_NOW    ,
    FUNCTION_ID_NPV    ,
    FUNCTION_ID_OR    ,
    FUNCTION_ID_PI    ,
    FUNCTION_ID_PMT    ,
    FUNCTION_ID_PRODUCT    ,
    FUNCTION_ID_PROPER    ,
    FUNCTION_ID_PV    ,
    FUNCTION_ID_RANDOM_N    ,
    FUNCTION_ID_RANDOM    ,
    FUNCTION_ID_RATE    ,
    FUNCTION_ID_REPEAT    ,
    FUNCTION_ID_REPLACE    ,
    FUNCTION_ID_RIGHT    ,
    FUNCTION_ID_ROUND    ,
    FUNCTION_ID_ROWS    ,
    FUNCTION_ID_SECOND    ,
    FUNCTION_ID_SIN    ,
    FUNCTION_ID_SINH    ,
    FUNCTION_ID_SLN    ,
    FUNCTION_ID_SQRT    ,
    FUNCTION_ID_STD    ,
    FUNCTION_ID_STDP    ,
    FUNCTION_ID_STRING    ,
    FUNCTION_ID_SUM    ,
    FUNCTION_ID_SYD    ,
    FUNCTION_ID_TAN    ,
    FUNCTION_ID_TANH    ,
    FUNCTION_ID_TERM    ,
    FUNCTION_ID_TIME    ,
    FUNCTION_ID_TIMEVALUE    ,
    FUNCTION_ID_TODAY    ,
    FUNCTION_ID_TRIM    ,
    FUNCTION_ID_TRUE    ,
    FUNCTION_ID_TRUNC    ,
    FUNCTION_ID_UPPER    ,
    FUNCTION_ID_VALUE    ,
    FUNCTION_ID_VAR    ,
    FUNCTION_ID_VARP    ,
    FUNCTION_ID_VLOOKUP    ,
    FUNCTION_ID_WEEKDAY    ,
    FUNCTION_ID_YEAR    ,
    FUNCTION_ID_FILENAME    ,
    FUNCTION_ID_PAGE    ,
    FUNCTION_ID_PAGES    ,
    FUNCTION_ID_DEGREES    ,
    FUNCTION_ID_RADIANS    ,
#ifdef DO_PIZZA
    FUNCTION_ID_DB    ,
#endif
    FUNCTION_ID_FIRST_EXTERNAL_FUNCTION    =FUNCTION_ID_FIRST_EXTERNAL_FUNCTION_BASE
} FunctionID} ;

typedef WordFlags FunctionType ;
#define FT_ALL 	    	    	0xffff
#define FT_PRINT     	    	0x0100
#define FT_TRIGONOMETRIC     	0x0080
#define FT_LOGICAL   	    	0x0040
#define FT_STATISTICAL 	    	0x0020
#define FT_STRING    	    	0x0010
#define FT_TIME_DATE 	    	0x0008
#define FT_FINANCIAL 	    	0x0004
#define FT_MATH 	    	    	0x0002
#define FT_INFORMATION 	    	0x0001

typedef ByteEnum EvalStackOperatorType ;
#define ESOT_OPERATOR  0
#define ESOT_FUNCTION  1
#define ESOT_OPEN_PAREN  2
#define ESOT_TOP_OF_STACK  3

typedef struct {
    FunctionID	EFD_functionID;
    word	EFD_nArgs;
} EvalFunctionData} ;

typedef struct {
    OperatorType	EOD_opType;
} EvalOperatorData} ;

typedef union {
    EvalOperatorData	ESOD_operator;
    EvalFunctionData	ESOD_function;
} EvalStackOperatorData} ;

typedef struct {
    EvalStackOperatorType	OSE_type;
    EvalStackOperatorType	OSE_data;
} OperatorStackElement} ;

typedef ByteEnum NumberType ;
#define NT_VALUE  0
#define NT_BOOLEAN  1
#define NT_DATE_TIME  2

/*
 *	EvalStackArgumentType	record
 */

typedef ByteFlags EvalStackArgumentType ;
#define	ESAT_EMPTY		0x80
#define ESAT_ERROR 	0x40
#define ESAT_RANGE 	0x20
#define ESAT_STRING 	0x10
#define ESAT_NUMBER 	0x08
#define ESAT_NUM_TYPE 	0x03

#define ESAT_TOP_OF_STACK   0
#define ESAT_NAME 	 (ESAT_RANGE  | ESAT_STRING)
#define ESAT_FUNCTION 	 (ESAT_NUMBER | ESAT_STRING)

typedef struct {
    word	END_name;
} EvalNameData} ;

typedef struct {
    word	ESD_length;
} EvalStringData} ;

#define	MAX_STRING_LENGTH		511

typedef struct {
    CellReference	ERD_firstCell;
    CellReference	ERD_lastCell;
} EvalRangeData} ;

typedef struct {
    byte	EED_errorCode;	/* ParserScannerEvaluatorError */
} EvalErrorData} ;

typedef union {
    EvalStringData	ESAD_string;
    EvalRangeData	ESAD_range;
    EvalErrorData	ESAD_error;
} EvalStackArgumentData} ;

typedef struct {
    EvalStackArgumentType	ASE_type;
    EvalStackArgumentData	ASE_data;
} ArgumentStackElement} ;

#define	MINIMUM_STACK_SPACE		((2 * size ArgumentStackElement) + \
                 (2 * size OperatorStackElement))

/*
 * 	EvalFlags	record
 */
typedef ByteFlags EvalFlags ;
#define EF_MAKE_DEPENDENCIES 	0x80
#define EF_ONLY_NAMES 		0x40
#define EF_KEEP_LAST_CELL 	0x20
#define EF_NO_NAMES 		0x10
#define EF_ERROR_PUSHED 		0x08

#define	EVAL_MAX_NESTED_LEVELS		32

typedef struct {
    CommonParameters	EP_common;
    EvalFlags		EP_flags;
    word		EP_fpStack;
    word		EP_depHandle;
    word		EP_nestedLevel;
    dword		EP_nestedAddresses[EVAL_MAX_NESTED_LEVELS];
    byte    	    	EP_align;
    /* align word */
} EvalParameters} ;

/*
 *	DerefFlags	record
 */
typedef ByteFlags DerefFlags ;
#define	DF_DONT_POP_ARGUMENT	 0x80

typedef struct {
    CommonParameters	FP_common;
    word		FP_nChars;
} FormatParameters} ;

typedef struct {
    CommonParameters	DP_common;
    dword		DP_dep;
    dword		DP_prev;
    byte		DP_prevIsCell;
    word		DP_chunk;
    /* align	word: */
    byte    	    	DP_align;
} DependencyParameters} ;

typedef struct {
    dword		DLH_next;
} DependencyListHeader} ;

typedef struct {
    word	D_row;
    byte	D_column;
} Dependency} ;

#define	DEPENDENCY_BLOCK_MAX_SIZE		(sizeof(DependencyListHeader) +	\
                     (1000 * sizeof(Dependency)))

typedef struct {
    word	DB_size;
} DependencyBlock} ;

/*
 * A pointer to this union is passed to the parse library stub to communicate
 * with the C callback routines.
 */
typedef union {
    CT_FTT_CallbackStruct   CT_ftt;
    CT_NTT_CallbackStruct   CT_ntt;
    CT_CNE_CallbackStruct   CT_cne;
    CT_CNS_CallbackStruct   CT_cns;
    CT_EF_CallbackStruct    CT_ef;
    CT_LN_CallbackStruct    CT_ln;
    CT_UL_CallbackStruct    CT_ul;
    CT_FF_CallbackStruct    CT_ff;
    CT_FN_CallbackStruct    CT_fn;
    CT_CC_CallbackStruct    CT_cc;
    CT_EC_CallbackStruct    CT_ec;
    CT_NTC_CallbackStruct   CT_ntc;
    CT_FTC_CallbackStruct   CT_ftc;
    CT_DC_CallbackStruct    CT_dc;
    CT_SF_CallbackStruct    CT_sf;
} C_CallbackUnion} ;

/*
 * The C_CallbackStruct is used by the C stub to call a C callback
 * function and return its results correctly to ParseString or whoever
 * made the callback.
 */
typedef struct {
    CallbackType    	    C_callbackType;
    union {
    ParserParameters     *CP_params;
    FormatParameters     *CF_params;
    EvalParameters	     *CE_params;
    DependencyParameters *DP_params;
    } C_params;
    word    	    	    C_returnDS;
    C_CallbackUnion    	    C_u;

    /* align word... so we need a throwaway byte. */
    byte    	    	    C_align;
} C_CallbackStruct} ;

/*
 * The CParserStruct is identical to the ParserParameters structure,
 * except that it has some extra information for assembly stub use.
 */
typedef struct {
    ParserParameters	C_parameters;
    PCB    (void,  	    	C_callbackPtr,(C_CallbackStruct *));
                        /* Points to a C callback function that returns void */
    C_CallbackStruct 	C_callbackStruct;
                        /* The callback structure defined above. */
} CParserStruct} ;

/*
 * The CFormatStruct is identical to the FormatParameters structure,
 * except that it has some extra information for assembly stub use.
 */
typedef struct {
    FormatParameters	CF_parameters;
    PCB    (void,  	    	CF_callbackPtr,(C_CallbackStruct *));
                        /* Points to a C callback function that returns void */
    C_CallbackStruct	CF_callbackStruct;
                        /* The callback structure defined above. */
} CFormatStruct} ;

/*
 * The CEvalStruct is identical to the EvalParameters structure,
 * except that it has some extra information for assembly stub use.
 */
typedef struct {
    EvalParameters	CE_parameters;
    PCB    (void,  	    	CE_callbackPtr,(C_CallbackStruct *));
                        /* Points to a C callback function that returns void */
    C_CallbackStruct	CE_callbackStruct;
                        /* The callback structure defined above. */
} CEvalStruct} ;

/*
 * The CDependencyStruct is identical to the DependencyParameters structure,
 * except that it has some extra information for assembly stub use.
 */
typedef struct {
    DependencyParameters DP_parameters;
    PCB    (void,  	    	 DP_callbackPtr,(C_CallbackStruct *));
                         /* Points to a C callback function that returns void */
    C_CallbackStruct	 DP_callbackStruct;
                         /* The callback structure defined above. */
} CDependencyStruct} ;

/* The CParserReturnStruct is used in the ParseString stub. */
typedef struct {
    byte    	    	PRS_errorCode;
    word    	    	PRS_textOffsetStart;
    word    	    	PRS_textOffsetEnd;
    byte *  	    	PRS_lastTokenPtr;
} CParserReturnStruct} ;

#define	YEAR_LENGTH		365
#define YEAR_MAX 	2099
#define YEAR_MIN 	1900
#define MONTH_MAX 	12
#define MONTH_MIN 	1
#define DAY_MAX 		31
#define DAY_MIN 		1

#define HOUR_MAX 	23
#define HOUR_MIN 	0
#define MINUTE_MAX 	59
#define MINUTE_MIN 	0
#define SECOND_MAX 	59
#define SECOND_MIN 	0

#define	MAX_REFERENCE_SIZE		6*sizeof(TCHAR)
#define MAX_RANGE_REF_SIZE   	16*sizeof(TCHAR)
/*
 * Maximum size for function argument descriptions for ParserGetFunctionArgs()
 */
#define	MAX_FUNCTION_ARGS_SIZE		    	256*sizeof(TCHAR)
#define	MAX_FUNCTION_NAME_SIZE		    	20*sizeof(TCHAR)
#define MAX_FUNCTION_DESCRIPTION_SIZE 	256*sizeof(TCHAR)

extern word
    _pascal ParserGetNumberOfFunctions (FunctionType funcType);

extern word
    _pascal ParserGetFunctionMoniker (FunctionID funcID,
                     FunctionType funcType,
                         char *textPtr);

extern word
    _pascal ParserGetFunctionArgs (FunctionID funcID,
                  FunctionType funcType,
                       char *textPtr);

extern word
    _pascal ParserGetFunctionDescription (FunctionID funcID,
                     FunctionType funcType,
                     char *textPtr);

extern void
    _pascal ParserFormatColumnReference  (word colNum,
               char *buffer,
               word bufferSize);

extern int
    _pascal ParserParseString  (char *textBuffer,
         byte *tokenBuffer,
         CParserStruct *parserParams,
         CParserReturnStruct *retval);

extern int
    _pascal ParserFormatExpression  (byte *tokenBuffer,
              char *textBuffer,
              CFormatStruct *formatParams);

extern int
    _pascal ParserEvalExpression  (byte *tokenBuffer,
            byte *scratchBuffer,
            byte *resultsBuffer,
            word bufSize,
            CEvalStruct *evalParams);

#ifdef __HIGHC__
pragma Alias (ParserGetNumberOfFunctions, "PARSERGETNUMBEROFFUNCTIONS");
pragma Alias (ParserGetFunctionMoniker, "PARSERGETFUNCTIONMONIKER");
pragma Alias (ParserGetFunctionArgs, "PARSERGETFUNCTIONARGS");
pragma Alias (ParserGetFunctionDescription, "PARSERGETFUNCTIONDESCRIPTION");
pragma Alias (ParserFormatColumnReference, "PARSERFORMATCOLUMNREFERENCE");
pragma Alias (ParserParseString, "PARSERPARSESTRING");
pragma Alias (ParserFormatExpression, "PARSERFORMATEXPRESSION");
pragma Alias (ParserEvalExpression, "PARSEREVALEXPRESSION");
/*
pragma Alias (ParserEvalPushArgument, "PARSEREVALPUSHARGUMENT");
pragma Alias (ParserEvalPopNArgs, "PARSEREVALPOPNARGS");
pragma Alias (ParserEvalForeachArg, "PARSEREVALFOREACHARG");
pragma Alias (ParserEvalPushNumericConstant, "PARSEREVALPUSHNUMERICCONSTANT");
pragma Alias (ParserEvalPushNumericConstantWord, "PARSEREVALPUSHNUMERICCONSTANTWORD");
pragma Alias (ParserEvalPushStringConstant, "PARSEREVALPUSHSTRINGCONSTANT");
pragma Alias (ParserEvalPushCellReference, "PARSEREVALPUSHCELLREFERENCE");
pragma Alias (ParserEvalPushRange, "PARSEREVALPUSHRANGE");
pragma Alias (ParserEvalRangeIntersection, "PARSEREVALRANGEINTERSECTION");
pragma Alias (ParserEvalPropagateEvalError, "PARSEREVALPROPAGATEEVALERROR");
pragma Alias (ParserAddDependencies, "PARSERADDDEPENDENCIES");
pragma Alias (ParserRemoveDependencies, "PARSERREMOVEDEPENDENCIES");
pragma Alias (ParserForeachReference, "PARSERFOREACHREFERENCE");
pragma Alias (ParserForeachToken, "PARSERFOREACHTOKEN");
pragma Alias (ParserForeachPrecedent, "PARSERFOREACHPRECEDENT");
pragma Alias (ParserFormatRowReference, "PARSERFORMATROWREFERENCE");
pragma Alias (ParserFormatWordConstant, "PARSERFORMATWORDCONSTANT");
*/
#endif
#endif


pccom.goh

/*****************************************************************************
 *
 *	Copyright (c) GeoWorks 1990 -- All Rights Reserved
 *
 * PROJECT:	GEOS
 * MODULE:	CInclude -- PCCom Library Definitions
 * FILE:	pccom.goh
 *
 * AUTHOR:		Cassie Hartzog, Nov 15, 1993
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 * 	Cassie	11/15/93	Initial revision
 *
 * DESCRIPTION:
 *	Description of the PCCom library interface.
 *
 *	$Id: pccom.goh,v 1.34.1.5 98/05/21 14:36:23 cthomas Exp $
 ***************************************************************************/

@deflib	pccom

#include  <serialDr.h>
#include  <fileEnum.h>

/* --------------------------------------------------------------------------
 * 		PCCOM FILE TRANSFER PROTOCOL
 * --------------------------------------------------------------------------*/

/****************************************************************************

  The PCCom Library utilizes a simple file transfer protocol.

  If you have a Windows or DOS program which you would like to add the
  ability to transfer files to or from a GEOS application on another device,
  (and that application uses the PCCom Library), you will use this protocol
  to implement the send and receive commands.

  For a more complete explanation, see the Tools documention section 10.8.3.

  These constants will be used in the explanation below.

  ACK		equ	0		; everything OK
  NAK		equ	1		; not OK, try again
  NAK_QUIT	equ	2		; not OK, give up
  SYNC		equ	0ffh

  BLOCK_START		equ	01h
  BLOCK_END		equ	02h
  BLOCK_QUOTE		equ	03h

  There can be at most 1K of data per block, and since BLOCK_START,
  BLOCK_END, and BLOCK_QUOTE are reserved values, any data with one of
  these values must be "quoted".

  The CRC value for a block of data is a word calculated using the
  algorithm described below, in CalcCRC().

  ------------------------------------------------------------------------
  SENDING A FILE
  ------------------------------------------------------------------------

  Sending a file to the remote machine involves the steps below. A file
  may be sent by any program that can access the serial port.

  Note that if the block is not received correctly the first time,
  the receiver will give up after 3 more attempts to receive it.

  If you want to make the sending of the filename more robust, you can
  send it in the first data block, which contains this data:

      !PCCom File Transfer Filename Block! <null-terminated file name>
    <optional: file size, expressed as a dword, low byte first>

  Calculate the CRC for this block in the usual manner, but send CRC+1.
  This special block should only be resent 1 time if it is not successfully
  received, instead of the normal 3 times.

send <Esc>XF<0x1>				(alert PCCom a file is coming )
send <null-terminated file name>     	    	(destination file name)
read byte
wait for SYNC
send <filesize dword, low byte first>
while (not EOF) {
  resend:
    if (first block) {	    	    	    	(this part is optional)
        send BLOCK_START
    send the special block
        send BLOCK_END
    send CRC + 1
    } else {
        send BLOCK_START
    while (more bytes in block) {
            get next byte in block
        if (byte == BLOCK_START, BLOCK_END, or BLOCK_QUOTE) {
            send BLOCK_QUOTE
        send (byte + BLOCK_QUOTE)
        }
        else
            send byte
        endif
    }
    send BLOCK_END
    send CRC (word value, send low byte first)
    read byte
    if (byte == NAK)
        goto resend
    elif (byte != SYNC)
        quit
    endif
    read next block from file
    }
send byte 0
send byte 0
wait for ACK

  ------------------------------------------------------------------------
  RETRIEVING A FILE
  ------------------------------------------------------------------------

  Retrieving a file from a machine running PCCom is straightforward
  and uses the same file transfer protocol shown above for sending a
  file. The sequence of commands is different, however, and is listed
  below.  There is no special first block for file retrieval analagous
  to that for file send.

  Note that if the PCCom library does not get a SYNC after sending a
  block of data, it will resend it 3 more times before giving up.

send <Esc>XF<0x4>			    (alert PCCom you want a file)
send <null-terminated file name>     	    (source file name, can contain
                                                  wildcard characters)
wait for SYNC 	    	    	    	    (PCCom must acknowledge receipt
                                                  of the file name)
while (read byte == SYNC)    	    	    (wait for PCCom to find next file)
  read <null-terminated file name>	    (the destination file name)
  send SYNC
  read filesize (dword)
  while (filesize > 0) {
    read byte
    if (byte = BLOCK_START) {
        while (read byte != BLOCK_END) {
        if (byte == BLOCK_QUOTE) {
            read byte
            byte = byte - BLOCK_QUOTE
        }
        write byte to output buffer
        filesize = filesize - 1
    }
    read CRC
    if (CRC = CalcCRC(buffer))
        send SYNC
        write buffer to destination file
    else
        send NAK
    endif
    else
        send NAK
    endif
    }
  read checksum (word)
  if (checksum == 0)
    send ACK
  else
    send NAK
  }

 *---------------------------------------------------------------------*
         CalcCRC
 *---------------------------------------------------------------------*
  SUMMARY:	Calculate the CRC on a block of data.
  PASS:		char *buf		Pointer to the data buffer
         short size		Size of the data buffer
         short checksum		Previous checksum (0 at first)
  RETURN:	CRC value (2 bytes)
 *---------------------------------------------------------------------*

short	crcTable[] = {
    0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
    0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
    0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
    0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
    0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
    0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
    0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
    0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
    0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
    0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
    0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
    0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
    0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
    0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
    0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
    0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
    0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
    0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
    0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
    0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
    0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
    0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
    0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
    0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
    0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
    0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
    0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
    0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
    0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
    0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
    0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
    0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
};

unsigned short		IncCRC(unsigned short crc, char c){
    return ((crc << 8) ^ crcTable[((crc >> 8) ^ c) & 0xff]);
}

short		CalcCRC(char *buf, short size, short checksum){
    for (;size >= 0; size--){
     checksum = IncCRC(checksum, *buf++);
    }
    return checksum;
}

****************************************************************************/

/* --------------------------------------------------------------------------
 * 			 CONSTANTS
 * --------------------------------------------------------------------------*/

/*
 * Flags to pass to PCComInit specifying what type of feedback should
 * be sent.
 */
typedef WordFlags PCComInitFlags ;

#define PCCIF_NOTIFY_OUTPUT 	0x8000
/* send notifications when text is available for display */

#define PCCIF_NOTIFY_EXIT 	0x4000
/* send notification when the remote machine shuts down the serial line */

#define PCCIF_IMMEDIATE_EXIT     0x2000
/* Disconnect immediately from client in PCComExit, instead of
 * negotiating it */

#define PCCIF_SERIAL_STREAM
#define PCCIF_IR_STREAM 		0x0001
/* use ircomm rather than the serial driver */
#define PCCIF_SERSOCK_STREAM 	0x0002
/* use sersock rather than ircomm or serial driver */

typedef ByteEnum PCComDirDetailLevel ;

#define PCCDDL_LOW_DETAIL 			'S'

#define PCCDDL_MID_DETAIL 			'M'

#define PCCDDL_FULL_DETAIL 			'L'

/*
 * Return values for PCComInit, PCComExit and the active commands
 */
typedef ByteEnum PCComReturnType ;

#define	PCCRT_NO_ERROR		    	    	    	0

#define	PCCRT_CANNOT_LOAD_SERIAL_DRIVER	  	1

#define	PCCRT_CANNOT_CREATE_THREAD		    	2

#define	PCCRT_CANNOT_ALLOC_STREAM	   	    	3

#define PCCRT_ALREADY_INITIALIZED    	    	4
/*
 * A connection has already been established.
 */

#define PCCRT_IN_USE 	    	    	    	5
/*
 * A different application has already initialized a connection,
 * and no other connections may be made until it exits PCCom.
 */

#define PCCRT_BUSY 				6
/*
 * The connection is busy, perhaps by a received command
 */

#define PCCRT_NOT_INITIALIZED 			7
/*
 * You tried to issue a command before the connection was initialized.
 */

#define PCCRT_MEMORY_ALLOC_ERROR 		8
/*
 * The library couldn't allocate a needed block
 */

#define PCCRT_BAD_DEST_PATH 			9
/*
 * The destination given didn't work..  it couldn't be found or was just
 * plain wacky!
 */

#define PCCRT_FILE_STARTING 			10
/*
 * A new file is starting its transfer.
 */

#define PCCRT_TRANSFER_CONTINUES 		11
/*
 * The transfer continues - you probably received a byte count with this one.
 */

#define PCCRT_FILE_COMPLETE 			12
/*
 * The file has completed.
 */

#define PCCRT_TRANSFER_COMPLETE 			13
/*
 * This unlucky number means everything worked..
 */

#define PCCRT_COMMAND_ABORTED 			14
/*
 * Either you aborted or something went wrong and the library gave up on it.
 */

#define PCCRT_TOO_MUCH_OUTPUT 			15
/*
 * We received more stuff than would fit in a 64K block
 */

typedef ByteEnum PCComAbortType ;
#define PCCAT_DEFAULT_ABORT 			0
/* Default value.  People shouldn't be using these abort
 * types unless they received a PCCRT_COMMAND_ABORTED return
 * type.
 */

#define PCCAT_CONNECTION_LOST 			1
/* We've lost connection after many time-outs and retries.
 */

#define PCCAT_FILE_NOT_FOUND 			2
/* Reasons: mispelling or the file just doesn't exist.
 */

#define PCCAT_PATH_NOT_FOUND 			3
/* Reasons: mispelling or the path just doesn't exist.
 */

#define PCCAT_INVALID_PATH_NAME 			4
/* Reasons: pathname doesn't conform to given standard.
 */

#define PCCAT_ACCESS_DENIED 			5
/* Reasons: couldn't access the volume/file, but the specific reason has
 * not been identified.
 */

#define PCCAT_INVALID_FILE_NAME 			6
/* Reasons: filename doesn't conform to given standard.
 */

#define PCCAT_FILE_IN_USE 			7
/* Reasons: file is currently opened by another application.
 */

#define PCCAT_VOLUME_OUT_OF_SPACE 		8
/* Reasons: no more space available on the volume.
 */

#define PCCAT_VOLUME_UNAVAILABLE 		9
/* Reasons: couldn't locate the target volume/disk has been
 * temporarily disabled; eg. the disk was removed from the disk
 * drive.
 */

#define PCCAT_FILE_READ_ONLY 			10
/* Reasons: file has read-only status, and an attempt has been
 * made to write to it.
 */

#define	PCCAT_SHORT_READ_WRITE				11
/* Reasons: a FileRead or FileWrite has failed to read/write
 * the given number of bytes.
 */

#define PCCAT_INVALID_DRIVE 			15
/* Reasons: target drive letter doesn't match with any
 * available active drives.
 */

#define PCCAT_VOLUME_WRITE_PROTECTED 		19
/* Reasons: the volume medium has been write-protected, and an
 * attempt to write to the medium failed.
 */

#define PCCAT_EXTERNAL_ABORT 			20
/* An abort was initiated due to external causes, eg. user
 * intervention.  It's not an internal abort as might be the
 * case of file system errors.
 */

#define PCCAT_INTERNAL_RESERVED_ABORT_TYPE 	21
/* The reserved abort is because we don't want to have to quote
 * abort type data (and 95h is the quote char).  This is a
 * placeholder to maintain symmetry.
 */
#define PCCAT_FILE_IS_VOLUME 			22
/* The filename is actually the label of the volume.
 */
#define PCCAT_FILE_IS_DIRECTORY 			23
/* The filename is actually the name of a directory.
 */
#define PCCAT_DIRECTORY_NAME_EXISTS 		24
/* An attempt to create a directory failed because the given
 * name is currently used: another file or directory with the
 * same name exists.
 */
#define PCCAT_TOO_MANY_DIRECTORIES 		25
/* An attemp to create a directory failed because there are
 * currently more directories in the root directory then DOS
 * can handle.
 */

/*
 * The following abort code are returned by the remote system.  They
 * are analogous to the above code.
 */

#define PCCAT_REMOTE_ABORT 			0x80
/* We couldn't get informative abort code from the remote.
 */

#define PCCAT_REMOTE_CONNECTION_LOST 		0x81
/* Yes, you're right.  We wouldn't actually receive this code, but we want
 * to be symmetric to simplify implementation - just mark the MSB for
 * abort code coming from the remote.
 */

#define PCCAT_REMOTE_FILE_NOT_FOUND 		0x82
#define PCCAT_REMOTE_PATH_NOT_FOUND 		0x83
#define PCCAT_REMOTE_INVALID_PATH_NAME 		0x84
#define PCCAT_REMOTE_ACCESS_DENIED 		0x85
#define PCCAT_REMOTE_INVALID_FILE_NAME 		0x86
#define PCCAT_REMOTE_FILE_IN_USE 		0x87
#define PCCAT_REMOTE_VOLUME_OUT_OF_SPACE 	0x88
#define PCCAT_REMOTE_VOLUME_UNAVAILABLE 		0x89
#define PCCAT_REMOTE_FILE_READ_ONLY 		0x8a
#define PCCAT_REMOTE_SHORT_READ_WRITE 		0x8b
#define PCCAT_REMOTE_INVALID_DRIVE 		0x8f
#define PCCAT_REMOTE_VOLUME_WRITE_PROTECTED 	0x93
#define PCCAT_REMOTE_EXTERNAL_ABORT 		0x94
#define PCCAT_REMOTE_RESERVED_ABORT_TYPE 	0x95
/* The reserved abort is because we don't want to have to quote
 * abort type data (and 95h is the quote char)
 */
#define PCCAT_REMOTE_FILE_IS_VOLUME 		0x96
#define PCCAT_REMOTE_FILE_IS_DIRECTORY 		0x97
#define PCCAT_REMOTE_DIRECTORY_NAME_EXISTS 	0x98
#define PCCAT_REMOTE_TOO_MANY_DIRECTORIES 	0x99

/*
 * PCComFullReturnType has two components, the low and high byte.
 * Low Byte: PCComReturnType - return value of an issued PCCom command.
 * High Byte: PCComAbortType - if return type == PCCRT_COMMAND_ABORTED,
 *            then this field will contain the reason for the abortion.
 *            The default value is PCCAT_DEFAULT_ABORT.
 */
typedef word PCComFullReturnType ;

#define PCCOM_RETURN_TYPE ( fullRT ) ( ((fullRT) & 0x00ff) )
#define PCCOM_ABORT_TYPE ( fullRT ) ( (((fullRT) >> 8) & 0x00ff) )

/*
 * If PCCom library is being loaded dynamically, with a call to
 * GeodeUseLibrary, you must use ProcCallFixedOrMovable(), passing
 * it the result of ProcGetLibraryEntry(), to call one of the library
 * routines defined below.  These entry point numbers are passed to
 * ProcGetLibraryEntry to find the offset of the desired routine.
 *
 * If you call PCCom in this manner, you *must* pass PCCIF_NOTIFY_EXIT
 * to PCComInit, and the object whose optr is passed to PCComInit
 * must handle MSG_META_NOTIFY and MSG_PROCESS_NOTIFY_THREAD_EXIT.
 * See the documentation for these messages below.  The PCCom2 sample
 * application shows how to dynamically load the PCCom library and use
 * these entry points.
 *
 */
typedef ByteEnum PCComEntryPoint ;
#define PCCEP_INIT   	    	0
#define PCCEP_EXIT   	    	1
#define PCCEP_ABORT   	    	2

@class	PCComFileSelectorClass, GenFileSelectorClass;

@instance	PathName	PCFSI_currentRemotePath;
@instance	hptr		PCFSI_driveListing;
@instance	FileLongName	PCFSI_currentVolume;

@endc

/* --------------------------------------------------------------------------
 * 			 INTERFACE DEFINITION
 * --------------------------------------------------------------------------*/

extern PCComReturnType _pascal PCComInit (SerialPortNum port,
                 SerialBaud baud,
                 word	timeout,
                 optr	callbackOptr,
                 PCComInitFlags	flags);
/*
 * 	Desc:	Initialize the serial port for communication with remote site.
 * 	Pass:	port - com port to use (-1 to use default, Com2)
 * 		baud - baud rate of serial port (-1 to use default, 9600)
 * 		timeout - amout of time to wait for port to initialize
 * 		callbackOptr - optr of object to send output notification
 * 	    	    	    	messages to, 0 if no ouput is desired.
 *
 * 	Return:	PCComReturnType
 *	Note: It is up to the caller to ensure that PCCOMEXIT is called
 *	      before exiting, so that the serial driver will be freed and
 *	      the extra thread destroyed.
 */

extern PCComReturnType _pascal PCComExit (void);
/*
 * 	Desc:	Close the stream and restore serial port to its previous state
 * 	Pass:	nothing
 * 	Return:	PCComReturnType
 */

extern void _pascal PCComAbort (void);
/*
 * 	Desc:	Abort the current file transfer operation.
 * 	Pass:	nothing
 * 	Return:	nothing
 */

extern PCComReturnType _pascal PCComReset (void);
/*
 * 	Desc:	Reset the current connection during no operation. This does
 *		*not* replace PCComAbort for terminating file transfer. When
 *		the IR or serial pccom connection is broken, the internal
 *		states of pccom library consider the connection
 *		dead. Subsequent attempts for any transfer commands will
 *		fail and return PCCRT_COMMAND_ABORTED. In this situation,
 *		PCComReset can reset the internal states of the library
 *		without calling PCComExit and PCComInit to reset the connection.
 * 	Pass:	nothing
 * 	Return:	PCComReturnType
 *			PCCRT_NO_ERROR
 *			PCCRT_IN_USE
 *			PCCRT_CANNOT_ALLOC_STREAM
 */

extern PCComFullReturnType _pascal PCComGet (hptr	dataBlock,
                        word	bytesPerStatus,
                        optr	statusDest,
                        word	statusMSG,
                        char	*destPathname);
/*
 * 	Desc:	Get the requested file/s from the remote.
 * 	Pass:	dataBlock - the handle of a block containing the dos-char
 *			source DOS pathname.  It contains null terminated filename
 *			(which may contain wildcard chars) to get.  This
 *			must contain a filename.  It may also contain
 *			a path.  If the path is absolute, it must
 *			start with a drive letter.  If the path is
 *			relative it is relative to the server's current
 *			working directory.  This directory may be
 *			changed via the PCComCD routine.  Examples:
 *			"*.*" - get everything from the server's cwd.
 *			"a:\temp\foo" - get the file foo from a:\temp
 *			"..\enstrunk\bar*" - get all files satisfing
 *				"bar*" from the cwd's parent's
 *				enstrunk directory.
 *			"\command.com" - this is undefined.  It may be
 *				relative, absolute, or it may result
 *				in an error.  Don't try it.
 *			After the transfer is complete, this block
 *			will contain a null terminated list of
 *			geos-char DOS filenames received.
 *
 *			The filename may include wildcard chars. ""
 *		bytesPerStatus - The number bytes between status reports, or 0
 *			for no reports.
 *		statusOptr - The object to send status reports to.
 *		statusMSG - See PCCOM_STATUS_MSG
 *		destPathname - fptr to a buffer containing the null terminated
 *			destination geos-char dos path/file name.  This is mainly
 *			a path	specifier.  The path must end with a slash
 *			char '\\'.  If the path is absolute, it must
 *			start with a drive letter.  If the path is
 *			relative it is relative to the cwd path of
 *			the newly-spawned pccom thread.  This is
 *			inherited from whatever thread called
 *			PCComInit.  If a filename is included  ""
 *			only the first file in a multi-file transfer
 *			will be renamed.  Wildcard characters are not
 *			allowed.  Examples:
 *			"" - put all files in the cwd with their normal
 *				names
 *			"a:\temp\" - put all files in a:\temp with
 *				their normal names
 *			"..\buddy" - put all files in the parent
 *				directory of the cwd, and rename the
 *				first file to "buddy"
 *			If a bad path is specified you will get a
 *			PCCRT_NO_ERROR back from this call, but you
 *			will get a PCCRT_COMMAND_ABORTED in your first
 *			status message.
 *
 * 	Return:	PCComReturnType
 *			PCCRT_NO_ERROR
 *			PCCRT_BUSY
 *			PCCRT_NOT_INITIALIZED
 *		Note that when the operation comletes (indicated by a status message)
 *		the dataBlock will be filled in with the filenames of files recieved
 *		separated by
 */

extern PCComFullReturnType _pascal PCComSend (char	*sourcePathname,
                                             word	bytesPerStatus,
                                             optr	statusOptr,
                                             word	statusMSG,
                                             char	*destPathname);
/*
 * 	Desc:	Send the requested file/s to the remote.
 * 	Pass:	sourcePathname - fptr to a buffer containing the null
 *			terminated geos-char dos filename (which may contain
 *			wildcard chars) to send.  This must contain
 *			a filename.  It may also contain a path.
 *			If the path is absolute, it must start with
 *			a drive letter.  If the path is relative
 *			it is relative to the CWD of the newly-
 *			spawned pccom thread.  This is inherited
 *			from whatever thread called PCComInit.
 *			Examples:
 *			"*.*" - send everything from pccom's cwd.
 *			"a:\temp\foo" - send the file foo from a:\temp
 *			"..\enstrunk\bar*" - send all files satisfing
 *				"bar*" from the cwd's parent's
 *				enstrunk directory.
 *			"\command.com" - this is undefined.  It may be
 *				relative, absolute, or it may result
 *				in an error.  Don't try it.
 *		bytesPerStatus - The number bytes between status reports,
 *			or 0 for
 *			no reports.
 *		statusOptr - The object to send status reports to.
 *		statusMSG - See PCCOM_STATUS_MSG
 *		destPathname - fptr to a buffer containing the null terminated
 *			dest geos-char dos path/file name.  This is primarily a
 *			path specifier.  The path must end with a slash
 *			char '\\'.  If the path is absolute, it must
 *			start with a drive letter.  If the path is
 *			relative it is relative to the server's cwd.
 *			This directory may be changed by using the
 *			PCComCD routine If a filename is included  ""
 *			only the first file in a multi-file transfer
 *			will be renamed.  Wildcard characters are not
 *			allowed.  Examples:
 *			"" - put all files in the cwd with their normal
 *				names
 *			"a:\temp\" - put all files in a:\temp with
 *				their normal names
 *			"..\buddy" - put all files in the parent
 *				directory of the cwd, and rename the
 *				first file to "buddy"
 *
 *			destination pathname.  Note that the path must
 *			conclude with a '\' character and that any filename
 *			given will only be used with the first file of the
 *			transfer.
 * 	Return:	PCComReturnType
 *			PCCRT_NO_ERROR
 *			PCCRT_BUSY
 *			PCCRT_NOT_INITIALIZED
 *			PCCRT_BAD_DEST_PATH
 */

extern PCComFullReturnType _pascal PCComStatus (struct StatusReply *statusBuffer,
                                               char *currentFilename);
/*
 * 	Desc:	Request information about the current transfer.
 * 	Pass:	statusBuffer - fptr to a buffer containing:
 *			dword 	- SR_fileSize
 *			dword	- SR_bytesXfrd
 *		currentFilename - fptr to a buffer at least PATH_BUFFER_SIZE
 *				  long
 * 	Return:	PCComReturnType
 *			PCCRT_FILE_STARTING
 *			PCCRT_TRANSFER_CONTINUES
 *			PCCRT_FILE_COMPLETE
 *			PCCRT_TRANSFER_COMPLETE
 *			PCCRT_COMMAND_ABORTED
 *
 */
struct StatusReply  {
    dword	SR_fileSize;
    dword	SR_bytesXfrd;
};

@prototype void PCCOM_STATUS_MSG (PCComFullReturnType	fullReturnType = cx,
                                  dword					bytesThisFile = dx:bp);
/* abortCode is only important if returnType = PCCRT_COMMAND_ABORTED.
 * bytesThisFile = number of bytes of this file that was transferred
 */

extern PCComFullReturnType _pascal PCComPWD (char *buffer);
/*
 *	Desc:	Retrieves the current path name on the remote
 *              machine.
 *	Pass:	on stack
 *		fptr - 	buffer (PATH_BUFFER_SIZE) for the null
 *		terminated upper-cased geos-char pathname.
 *
 * 	Return:	PCComReturnType
 *			PCCRT_NO_ERROR
 *			PCCRT_BUSY
 *			PCCRT_NOT_INITIALIZED
 *			PCCRT_COMMAND_ABORTED
 *			PCCRT_BAD_DEST_PATH
 *
 */

extern PCComFullReturnType _pascal PCComCD (const char *dirPathname);
/*
 * 	Desc:	Change the working directory on the remote machine.
 * 	Pass:	dirPathname - fptr to a buffer (PATH_BUFFER_SIZE) containing
 *			the null terminated geos-char pathname.  (A null
 *			string takes you to the server's startup directory.)
 *			It can be absolute or relative.  If it is
 * 			absolute it must begin with a drive
 *			specification.  If it is relative it is
 *			relative to the server's cwd. Examples:
 *			"c:\" - goes to the root dir of the C drive
 *			"" - goes to the server's startup directory
 *			"a:" - goes to the root dir of the A drive
 *
 * 	Return:	PCComReturnType
 *			PCCRT_NO_ERROR
 *			PCCRT_BUSY
 *			PCCRT_NOT_INITIALIZED
 *			PCCRT_COMMAND_ABORTED
 *			PCCRT_BAD_DEST_PATH
 *
 */

extern PCComFullReturnType _pascal PCComMkdir (char *dirPathname);
/*
 * 	Desc:	Make a new directory on the remote machine.
 * 	Pass:	dirPathname - fptr to a buffer which contains a null terminated
 *			geos-char pathname.  This must contain a dirname.  It
 *			may also contain a path.  If the path is
 *			absolute, it must start with a drive letter.
 *			If the path is relative it is relative to the
 *			server's current working directory.  This
 *			directory may be changed via the PCComCD
 *			routine.  Examples:
 *			"a:\temp\foo" - creates a directory "foo" in
 *				a:\temp
 *			"..\enstrunk\bar" - creates a directory "bar"
 *				in the cwd's parent's enstrunk
 *				directory.
 *			"\command.com" - this is undefined.  It may be
 *				relative, absolute, or it may result
 *				in an error.  Don't try it.
 *			If the directory already exists you will get a
 *			PCCRT_BAD_DEST_PATH
 *
 * 	Return:	PCComReturnType
 *			PCCRT_NO_ERROR
 *			PCCRT_BUSY
 *			PCCRT_NOT_INITIALIZED
 *			PCCRT_BAD_DEST_PATH
 *			PCCRT_COMMAND_ABORTED
 *
 */

extern PCComFullReturnType _pascal PCComListDrives (hptr dataBlock);
/*
 * 	Desc:	Fetch the list of availible drives from the Remote computer
 * 	Pass:	dataBlock - hptr of block to realloc and stuff the geos-char
            data into
 *
 * 	Return:	PCComReturnType
 *			PCCRT_NO_ERROR
 *			PCCRT_BUSY
 *			PCCRT_NOT_INITIALIZED
 *			PCCRT_COMMAND_ABORTED
 *			PCCRT_MEMORY_ALLOC_ERROR
 *
 */

extern PCComFullReturnType _pascal PCComGetFreeSpace (dword	*driveSpace,
                                                     word	driveLetter);
/*
 * 	Desc:	Get the space free on a given drive (or current drive)
 * 	Pass:	driveSpace - fptr to dword buffer to hold the requested
 *			drive space.
 *		driveLetter - a word whose low byte is the drive letter to you're
 *			interested in.  The high byte is ignored.  If the low byte
 *			is null, the current drive will be checked.
 *
 * 	Return:	PCComReturnType
 *			PCCRT_NO_ERROR
 *			PCCRT_BUSY
 *			PCCRT_NOT_INITIALIZED
 *			PCCRT_BAD_DEST_PATH
 *			PCCRT_COMMAND_ABORTED
 *
 */

extern PCComFullReturnType _pascal PCComRemark (char *remark);
/*
 * 	Desc:	Log a remark on the remote machine.
 * 	Pass:	remark - fptr to a buffer which contains a null terminated
 *			 geos-char remark, up to PATH_BUFFER_SIZE long.
 *	                 Use the '\r' escape code to get a carriage return.
 *
 * 	Return:	PCComReturnType
 *			PCCRT_NO_ERROR
 *			PCCRT_BUSY
 *			PCCRT_NOT_INITIALIZED
 *			PCCRT_COMMAND_ABORTED
 *
 */

extern PCComFullReturnType _pascal PCComGetFileSize (dword	*fileSize,
                                                    char	*filename);
/*
 * 	Desc:	Get the size of a specified file.
 * 	Pass:	fileSize - fptr to a dword buffer to hold the requested file
 *			size.
 *		filename - fptr to a buffer which contains a null terminated
 *			geos-char DOS pathname.  This must contain a filename.
 *			It may also contain a path.  If the path is
 *			absolute, it must start with a drive letter.
 *			If the path is relative it is relative to the
 *			server's current working directory.  This
 *			directory may be changed via the PCComCD
 *			routine.  Examples:
 *			"a:\temp\foo" - get the size of file foo from
 *				a:\temp
 *			"..\enstrunk\bar" - get the size of "bar"
 *				from the cwd's parent's enstrunk
 *				directory.
 *			"\command.com" - this is undefined.  It may be
 *				relative, absolute, or it may result
 *				in an error.  Don't try it.
 *
 * 	Return:	PCComReturnType
 *			PCCRT_NO_ERROR
 *			PCCRT_BUSY
 *			PCCRT_NOT_INITIALIZED
 *			PCCRT_COMMAND_ABORTED
 *			PCCRT_NO_ERROR
 *
 */

extern PCComFullReturnType _pascal PCComDir (hptr dataBlock,
                    PCComDirDetailLevel detailLevel,
                    char *fileSpec);
/*
 * 	Desc:	List a directory on the remote machine.
 * 	Pass:	dataBlock - hptr to a block we can stuff the dos-char
 *			listing into
 *		detailLevel - specifies the level of verbosity
 *		fileSpec - geos-char DOS filespec
 *
 * 	Return:	PCComReturnType
 *			PCCRT_NO_ERROR
 *			PCCRT_BUSY
 *			PCCRT_NOT_INITIALIZED
 *			PCCRT_COMMAND_ABORTED
 *			PCCRT_MEMORY_ALLOC_ERROR
 *			PCCRT_TOO_MUCH_OUTPUT
 *
 */

extern word _pascal PCComFileEnum (FileEnumParams *params,
                     MemHandle *bufCreated,
                     word *numNoFit);
/*
 * 	Desc:	Act like a limited FileEnum, but fetch the data over
 *		the serial line.
 *
 * 	Pass:	params - FileEnumParams
 *		bufCreated - repository for created block
 *		numNoFit - number of files that couldn't fit in the block.
 *
 * 	Return:	number of files that *did* fit in the block
 *			else
 *		-1 if error - use ThreadGetError to retrieve FileError
 */

/* --------------------------------------------------------------------------
 * 			 Methods sent by PCCom
 * --------------------------------------------------------------------------*/

/*
 *  See the PCCom sample applications for examples of how to handle
 *  the following messages.
 */

/*****************************************************************************
 *	Methods sent if PCCIF_NOTIFY_OUTPUT is passed to PCComInit
 *
 *	When PCCom starts or completes a file operation, it outputs
 *	textual information about that operation.  If you want your
 *	application to display that information, pass the PCCIF_NOTIFY_OUTPUT
 * 	flag to PCComInit, along with the optr of the object which should
 *	receive the notification.
 *
 * 	If the passed optr is non-zero, PCCom will send the following
 *	two methods to that object.  The data sent with the messages
 *	can be passed directly to a GenText or VisText object.  It
 *	consists of ASCII characters plus the carriage return control
 *	characters.
 *
 * 	Note that if the app is receiving output, it *MUST* intercept
 * 	MSG_META_NOTIFY_WITH_DATA_BLOCK and free the passed data block,
 *	even if it does nothing with the data block.
 *
 ****************************************************************************/
/*
 * @message void MSG_META_NOTIFY(ManufacturerID manufID = cx,
 *				word notificationType = dx,
 *				word data = bp);
 *
 *	notificationType = GWNT_PCCOM_DISPLAY_CHAR
 *	data = character to be displayed
 */

/*
 * @message void MSG_META_NOTIFY_WITH_DATA_BLOCK(ManufacturerID manufID = cx,
 *				word notificationType = dx,
 *				MemHandle data = bp);
 *
 *	notificationType = GWNT_PCCOM_DISPLAY_STRING
 * 	data = handle of block containing NULL-terminated string
 *
 * 		NOTE: The app must free this block, whether it uses it or not.
 *	    	Apps which have requested to receive output must handle this
 *	    	message, if only to free the block.
 */

/***************************************************************************
 *	Methods sent if PCCIF_NOTIFY_EXIT is passed to PCComInit
 *
 *	The serial connection may be closed and PCCom exited by sending
 *	a special escape sequence from the remote machine.  If you want
 *	to be notified of that event, pass the PCCIF_NOTIFY_EXIT flag
 *	to PCComInit.  Then MSG_META_NOTIFY will be sent to object whose
 *	optr was passed to PCComInit, with the handle of the thread that
 *	is about to be destroyed as data.
 *
 *	If you loaded the PCCom library dynamically, you must pass the
 *	PCCIF_NOTIFY_EXIT_FLAG and intercept the following two messages:
 *
 *	MSG_META_NOTIFY will be sent when PCCom is about to destroy the
 *	thread which was running the serial port.  The handle of that
 *	thread is passed as data.  You cannot free the PCCom library until
 *	you know that the thread has been destroyed. When the thread has
 *	been destroyed, MSG_PROCESS_NOTIFY_THREAD_EXIT is sent to your
 * 	process object. You must intercept this message, and if the thread
 * 	handle passed in dx is the same handle as was passed in bp for
 *	MSG_META_NOTIFY, you can now be certain that the thread has been
 *	destroyed and free the PCCom Library. If the library was not
 *	loaded dynamically, you need not intercept MSG_PROCESS_NOTIFY_
 *	THREAD_EXIT.
 *
 *	It is not necessary to pass MSG_PROCESS_NOTIFY_THREAD_EXIT to the
 *	superclass, as it is provided as a notification only, and there is
 *	no default handling of it. Note that it may also be sent in other
 *	situations, and in those cases exitProcess != data.
 *
 *
 **************************************************************************/
/*
 * @message void MSG_META_NOTIFY(ManufacturerID manufID = cx,
 *								 word			notificationType = dx,
 *								 word			data = bp);
 *
 *	notificationType = GWNT_PCCOM_EXIT_PCCOM
 *	data = handle of thread to be destroyed
 */

/*
 * @message void MSG_PROCESS_NOTIFY_THREAD_EXIT(ThreadHandle exitProcess = cx,
 *	    	    	    	    	    		word		 exitCode = dx);
 *
 */

@ifdef __HIGHC__
pragma Alias(PCComInit, "PCCOMINIT");
pragma Alias(PCComExit, "PCCOMEXIT");
pragma Alias(PCComAbort, "PCCOMABORT");
pragma Alias(PCComReset, "PCCOMRESET");
pragma Alias(PCComSend, "PCCOMSEND");
pragma Alias(PCComGet, "PCCOMGET");
pragma Alias(PCComPWD, "PCCOMPWD");
pragma Alias(PCComCD, "PCCOMCD");
pragma Alias(PCComStatus, "PCCOMSTATUS");
pragma Alias(PCComMkdir, "PCCOMMKDIR");
pragma Alias(PCComGetFileSize, "PCCOMGETFILESIZE");
pragma Alias(PCComDir, "PCCOMDIR");
pragma Alias(PCComFileEnum, "PCCOMFILEENUM");
pragma Alias(PCComRemark, "PCCOMREMARK");
pragma Alias(PCComGetFreeSpace, "PCCOMGETFREESPACE");
pragma Alias(PCComListDrives, "PCCOMLISTDRIVES");
@endif

@endlib


pen.goh

/*----------------------------------------------------------------------------

    Copyright (c) GeoWorks 1989-1992 -- All Rights Reserved

PROJECT:	PC GEOS
MODULE:		Include - Pen Library Definitions
FILE:		pen.goh

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    Schoon  6/18/92		Initial Version

DESCRIPTION:
    Definitions for users of the pen library, and the various object
    exported by the library.

    $Id: pen.goh,v 1.27.4.1 96/04/28 08:28:09 chris Exp $

----------------------------------------------------------------------------*/

@optimize
@deflib pen

#include  <print.h>

@class InkClass, VisClass;

/*-----------------------------------------------------------------------------
 *	Constants and structures
 *---------------------------------------------------------------------------*/

typedef struct {
        Rectangle    IDBF_bounds;
    /*
     * The bounds of the data to save out/the coords at which to load
     * the data.
     */
    VMFileHandle IDBF_VMFile;
    /* VM File to write to/read from */

    DBGroupAndItem IDBF_DBGroupAndItem;
    /* DB Item to save to/load from (or 0 to create a new one) */

    word IDBF_DBExtra;
    /* Extra space to skip at the start of the block */
} InkDBFrame} ;

typedef WordFlags InkFlags ;
#define IF_MOUSE_FLAGS 	0x8000
/* Set if this object has grabbed the mouse */
#define IF_SELECTING 	0x4000
/* Set if this object is doing a selection */
#define IF_HAS_TARGET 	0x2000
/* Set if this object has the target. */
#define IF_HAS_SYS_TARGET 	0x1000
/* Set if this object has the sys target. */
#define IF_DIRTY 	0x0800
/* Set when we are dirty */
#define IF_ONLY_CHILD_OF_CONTENT 	0x0400
/* Set if this is the only child of a VisContent, in which case it
 * should use some optimizations to reply to ink at the view level. */
#define IF_CONTROLLED 	0x0200
/* Set if this object is to be used in conjunction with an InkControl
 * object.*/
#define IF_INVALIDATE_ERASURES 	0x0100
/* Set if we should invalidate the bounds of all erasures, in case
 * there is a subclass that needs to redraw the background. */
#define IF_HAS_UNDO 	0x0080
/*  Set if this object should be undoable. */

typedef struct {
    word 	DBR_group;
    word	DBR_item;
    word	unused1;
    word 	unused2;
} DBReturn} ;

/*-----------------------------------------------------------------------------
 *		Methods
 *---------------------------------------------------------------------------*/

@message void MSG_INK_SAVE_TO_DB_ITEM (DBReturn *RetValue = axbpcxdx, \
                    InkDBFrame _far *ptr = ss:bp);
/* XXX */
/*
 *	Saves the data from the ink into the passed DB item (or creates a new
 *	one if none passed). This also marks the object as clean.
 *
 *	Pass: 	ptr 		- pointer to InkDBFrame structure
 *		RetValue	- pointer to DBReturn structure (empty)
 *
 *	Return: RetValue  	- pointer to DBReturn structure (filled),
 *	    			which contains DB group/item written to
 *				(VM Chain)
 */

@message void MSG_INK_LOAD_FROM_DB_ITEM (InkDBFrame _far *ptr = ss:bp);
/*
 *	Loads the data into the ink from the passed DB item.
 *	NOTE: This marks the object as clean.
 *
 *	Pass: ptr	- pointer to InkDBFrame structure
 */

@reserveMessages 1;

@message void MSG_INK_SET_TOOL (InkTool tool = cx);
/*
 *	Sets the current tool to be used when the user clicks on the ink obj.
 *
 *	Pass: cx - InkTool
 */

@message InkTool MSG_INK_GET_TOOL () = cx;
/*
 *	Gets the current tool to be used when the user clicks on the ink obj.
 *
 *	Return: InkTool
 */

@message void MSG_INK_SET_PEN_COLOR (Color clr = cl);
/*
 *	Sets the current pen color.
 *
 *	Pass: clr	- Color
 */

@message void MSG_INK_SET_DIRTY_AD (Message msg = bp, optr object = cx:dx);
/*
 *	Sets the AD to be activated when the user dirties the object
 *
 *	Pass: msg   	- message
 *	      object	- optr of object
 *
 */

@message void MSG_INK_SET_FLAGS (InkFlags setflags = cx, InkFlags clearflags = dx);
/*
 *	Sets the ink flags.
 *
 *	Pass: setflags 		- flags to set
 *	      clearflags	- flags to clear
 *
 *	Return: nothing
 */

@message InkFlags MSG_INK_GET_FLAGS () = cx;
/*
 * 	Gets the current ink flags
 *
 *	Pass: nothing
 *	Return: current InkFlags
 */

typedef enum /* word */ {
    IT_PENCIL	 = 0,
    IT_ERASER	 = 2,
    IT_SELECTOR	 = 4
} InkTool} ;

@message void MSG_INK_ADVANCE_SELECTION_ANTS ();
/*
 * Private message used internally by the ink object to update the selection
 * area.
 */

@message void MSG_INK_SET_STROKE_SIZE (byte width = cl, byte height = ch);
@message void MSG_INK_SET_MAX_POINTS (word maxPoints = cx);

@protominor	PostZoomerMessages
@message int MSG_INK_DELETE_LAST_GESTURE () = ax;
@protoreset

typedef struct {
    byte    ISS_width;
    byte    ISS_height;
} InkStrokeSize} ;

/*-----------------------------------------------------------------------------
 *		Instance Data
 *---------------------------------------------------------------------------*/

@instance InkFlags 		II_flags = IF_HAS_UNDO;
@instance InkTool		II_tool = 0;
@instance Color			II_penColor = 0;
@instance ChunkHandle 		II_segments = NullHandle;
@instance optr		 	II_dirtyOutput = NullOptr;
@instance Message	 	II_dirtyMsg;
@instance Rectangle	    	II_selectBounds;
@instance GStateHandle 	    	II_cachedGState;
@instance TimerHandle	    	II_antTimer;
@instance word		    	II_antTimerID;
@instance byte	    	    	II_antMask;

@vardata    InkStrokeSize   ATTR_INK_STROKE_SIZE;
@vardata    word    	    ATTR_INK_MAX_POINTS;
@endc

@class InkMPClass, InkClass;

@message void MSG_INKMP_CREATE_PASTE_BITMAP ();
/*
 *	Creates a bitmap to represent the paste while the user
 *	is dragging the thing around. The bitmap is allocated in
 *	the clipboard file, the block handle of which gets stored
 *	in IMPI_pasteBitmap, while a GState to the bitmap is stored
 *	to IMPI_pasteBitmapGState.
 *
 *	PASS:		nothing
 *
 *	RETURN:		nothing
 */

@message void MSG_INKMP_DRAW_PASTE_BITMAP (GStateHandle gstate = bp);
/*
 *	Draws the draggable paste bitmap (if any) to the passed GState.
 *
 *	PASS:		gstate - GStateHandle to draw the bitmap to
 *
 *	RETURN:		nothing
 */

@message void MSG_INKMP_FINISH_PASTE ();
/*
 *	Erases the paste bitmap drawn at IMPI_lastPos, frees the bitmap,
 *	and arranges the pasted points properly.
 *
 *	PASS:		nothing
 *
 *	RETURN:		nothing
 */

@protominor InkNewForDrag

@message void MSG_INKMP_ABORT_PASTE ();
/*
 * 	Erases the paste bitmap drawn at IMPI_lastPosition, frees
 * 	the bitmap, and gets rid of the pasted points.
 *
 * 	PASS:		nothing
 * 	RETURN:		nothing
 */

@message void MSG_INKMP_DRAG_BITMAP ();
/*
 * 	moves the paste bitmap to the passed position.
 *
 * 	PASS:		same as MSG_META_PTR
 *
 * 	RETURN:		nothing
 */

@protoreset

@instance	word	IMPI_pastedStart; /* First point of pasted region */
@instance	word	IMPI_pastedEnd;   /* Last point of pasted region  */
@instance	Rectangle	IMPI_pastedBounds;   /* Bounding box of */
                             /* dragged region  */
@instance	Point	IMPI_lastPos;   	  /* last pen position */
@instance	Point	IMPI_bitmapMouseOffset;   /*offset from the point at */
                          /* which the user clicked  */
                          /* to the upper left       */
                          /* of the paste bitmap.    */
@instance	byte		IMPI_flags;	/* internal state flags */
@instance	InkTool		IMPI_oldTool;	/* stores the old tool while */
                        /* dragging */
@instance	VMBlockHandle	IMPI_pasteBitmap; /* VMBlockHandle of bitmap */
@instance	GStateHandle	IMPI_pasteBitmapGState; /* GState to bitmap */

@endc

@class InkControlClass, GenControlClass;

/*-----------------------------------------------------------------------------
 *		Hints
 *---------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
 *		Constants & Structures
 *---------------------------------------------------------------------------*/

typedef WordFlags InkControlFeatures ;
#define ICF_PENCIL_TOOL 		0x04
#define ICF_ERASER_TOOL 		0x02
#define ICF_SELECTION_TOOL 	0x01

/* Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 * ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */

typedef WordFlags InkControlToolboxFeatures ;
#define ICTF_PENCIL_TOOL 	0x04
#define ICTF_ERASER_TOOL 	0x02
#define ICTF_SELECTION_TOOL 	0x01

#define IC_DEFAULT_FEATURES   (ICF_PENCIL_TOOL | ICF_ERASER_TOOL | ICF_SELECTION_TOOL)
#define IC_DEFAULT_TOOLBOX_FEATURES  (ICTF_PENCIL_TOOL | ICTF_ERASER_TOOL | ICTF_SELECTION_TOOL)

/*
 *	Structure sent with GWNT_INK_HAS_TARGET notification
 */

typedef struct {
    optr	NIHT_optr;
} NotifyInkHasTarget} ;

/*-----------------------------------------------------------------------------
 *		Messages
 *---------------------------------------------------------------------------*/

@message void MSG_IC_SET_TOOL_FROM_LIST (InkTool tool = cx);

@protominor InkNewForBullet

@vardata    InkTool TEMP_INK_CONTROL_SELECTED_TOOL;

@protoreset
/*-----------------------------------------------------------------------------
 *		Defaults
 *---------------------------------------------------------------------------*/

@default GCI_output = TO_APP_TARGET;

@endc

/*-----------------------------------------------------------------------------
 *	FILE ACCESS ROUTINES
 *---------------------------------------------------------------------------*/
#define INK_DB_PROTOCOL_MAJOR  	1
#define INK_DB_PROTOCOL_MINOR  	1

extern DBGroupAndItem _pascal InkCompress  (MemHandle inkData, VMFileHandle file, DBGroupAndItem destItem);

extern MemHandle _pascal InkDecompress  (VMFileHandle file, DBGroupAndItem srcItem);

extern void _pascal InkDBInit (VMFileHandle fh);
/* XXX */
/*
 * Takes a new Ink database file, and initializes it for use (creates all
 * needed map  and creates a top-level folder).
 *
 * Pass: 	fh = handle of file
 * Returns: 	nothing
 */

extern dword _pascal InkDBGetHeadFolder (VMFileHandle fh);
/* XXX */
/*
 * Gets the head folder for the DB file.
 *
 * Pass:	fh = file handle
 * Returns: 	opaque folder handle
 */

typedef struct {
    dword	IDBDI_dword1;	/* opaque folder handle */
        dword	IDBDI_dword2;	/* dword tag of note */
    word	IDBDI_word1; 	/* page number */
} InkDBDisplayInfo} ;

/*
 * More mnemonically named ways to get to the fields of the
 * InkDBDisplayInfo structure.
*/
#define IDBDI_folder 	0	    	    	 /* offset to IDBDI_dword1 */
#define IDBDI_note   	(sizeof(dword))  	 /* offset to IDBDI_dword2 */
#define IDBDI_page   	(2*(sizeof(dword)))  	 /* offset to IDBDI_word1  */

extern void _pascal InkDBGetDisplayInfo (InkDBDisplayInfo *RetValue, VMFileHandle fh);
/* XXX */
/*
 * Gets the current display info for the file
 *
 * Pass:	RetValue = ptr to InkDBDisplayInfo structure (empty)
 *		fh = file handle
 *
 * Returns: 	RetValue = ptr to InkDBDisplayInfo structure (filled)
 */

extern void _pascal InkDBSetDisplayInfo (VMFileHandle fh, dword ofh, dword note, \
                 word page);
/* XXX */
/*
 * Sets the current display info for the file
 *
 * Pass:	fh = file handle
 *       	ofh = opaque folder handle
 *		note = note
 *		page = page
 */

extern void _pascal InkSetDocPageInfo (PageSizeReport *psr, VMFileHandle fh);
/* XXX */
/*
 * Sets the current page info for the file
 *
 * Pass: 	psr =  pointer to PageSizeReport struct (empty)
 *		fh = database file handle
 *
 * Return: 	psr = pointer to PageSizeReport struct (filled)
 */

extern void _pascal InkGetDocPageInfo (PageSizeReport *psr, VMFileHandle fh);
/* XXX */
/*
 * Gets the current page info for the file
 *
 * Pass: 	psr = pointer to PageSizeReport struct (empty)
 *		fh = database file handle
 *
 * Return: 	psr = pointer to PageSizeReport struct (filled)
 */

typedef enum {
    IBT_NO_BACKGROUND	 = 0,
    IBT_NARROW_LINED_PAPER	 = 2,
    IBT_MEDIUM_LINED_PAPER	 = 4,
    IBT_WIDE_LINED_PAPER	 = 6,
    IBT_NARROW_STENO_PAPER	 = 8,
    IBT_MEDIUM_STENO_PAPER	 = 10,
    IBT_WIDE_STENO_PAPER	 = 12,
    IBT_SMALL_GRID	 = 14,
    IBT_MEDIUM_GRID	 = 16,
    IBT_LARGE_GRID	 = 18,
    IBT_SMALL_CROSS_SECTION	 = 20,
    IBT_MEDIUM_CROSS_SECTION	 = 22,
    IBT_LARGE_CROSS_SECTION	 = 24,
    IBT_TO_DO_LIST	 = 26,
    IBT_PHONE_MESSAGE	 = 28,
    IBT_CUSTOM_BACKGROUND	 = 30
} InkBackgroundType} ;

extern void _pascal InkSetDocGString (VMFileHandle dbfh, word type);
/* XXX */
/*
 * Sets the GString info for the file
 *
 * Pass: 	dbfh =  database file handle
 *		type = background type
 *
 * Return: 	nothing
 */

extern word _pascal InkGetDocGString (VMFileHandle dbfh);
/* XXX */
/*
 * Gets the GString for the file
 *
 * Pass: 	dbfh = database file handle
 *
 * Return: 	background type
 */

extern void _pascal InkSetDocCustomGString (VMFileHandle dbfh, Handle gh);
/* XXX */
/*
 * Sets the GString info for the file
 *
 * Pass: 	dbfh =  database file handle
 *	 	gh = custom Gstring handle
 *
 * Return: 	nothing
 */

extern Handle _pascal InkGetDocCustomGString (VMFileHandle dbfh);
/* XXX */
/*
 * Gets the custom GString for the file
 *
 * Pass: 	dbfh - database file handle
 *
 * Return: 	custom Gstring handle
 */

#define INK_DB_MAX_TITLE_SIZE  	128

extern void _pascal InkSendTitleToTextObject (dword tag, VMFileHandle fh, optr to);
/* XXX */
/*
 * Sets the passed text object with the name from the passed folder or note
 *
 * Pass: 	tag = dword tag of folder or note
 *		fh =  file handle
 *		to = optr of text object to set
 *
 * Returns: 	nothing
 */

extern word _pascal InkGetTitle (dword tag, VMFileHandle fh, char *dest);
/* XXX */
/*
 * Gets the name for the passed folder or note
 *
 * Pass: 	tag = dword tag of folder or note
 *		fh = file handle
 *		dest = destination to store null-terminated name
 *			(should be INK_DB_MAX_TITLE_SIZE + 1)
 * Return: 	size of name (including null terminator)
 */

extern dword _pascal InkGetParentFolder (dword tag, VMFileHandle fh);
/* XXX */
/*
 * Gets the parent of the passed folder or note
 *
 * Pass: 	tag = dword tag of folder/note
 *		fh = file handle
 *
 * Return: 	parent folder
 */

extern void
    _pascal InkFolderSetTitleFromTextObject (dword fldr, VMFileHandle fh,
                    optr text);
extern void
    _pascal InkNoteSetTitleFromTextObject (dword note, VMFileHandle fh,
                  optr text);
/* XXX */
/*
 * Sets the name for the passed folder or note
 *
 * Pass: 	fldr = dword handle of folder or note
 *		fh = file handle
 *		text = text object to get title from
 */

extern void
    _pascal InkFolderSetTitle (dword fldr, VMFileHandle fh, const char *name);
extern void
    _pascal InkNoteSetTitle (dword note, VMFileHandle fh, const char *name);
/* XXX */
/*
 * Sets the name for the passed folder or note
 *
 * Pass: 	fldr = dword handle of folder or note
 *		fh = file handle
 *		name = new null-terminated name
 *			(should be INK_DB_MAX_TITLE_SIZE + 1)
 */

extern dword _pascal InkFolderGetContents (dword tag, VMFileHandle fh,
                  DBGroupAndItem *subFolders);
/* XXX */
/*
 * Returns the group/item of a chunk array of subfolders (DB items) for the
 * passed folder.
 *
 * Pass: 	tag = dword tag of FolderInfo (empty)
 *		fh = file handle
 *		subFolders = pointer to DBGroupAndItem

 * Return: 	DBGroupAndItem of chunk array of notes
 *	  	AND
 *		*subFolders = DBGroupAndItem of chunk array of subfolders
 *
 * Note:	 Call DBLock to access chunk array
 */

extern dword
    _pascal InkFolderGetNumChildren (dword fldr, VMFileHandle fh);
/* XXX */
/*
 * Gets the # children of the folder.
 *
 * Pass: 	fldr = folder
 *		fh = file handle
 *
 * Return: 	high word = # sub folders
 *	  	low word  = # notes
 */

extern void
    _pascal InkFolderDisplayChildInList (dword fldr, VMFileHandle fh, optr list,\
                    word entry, Boolean displayFolders);
/* XXX */
/*
 * Routine to be called from the applications
 *	MSG_META_GEN_LIST_REQUEST_ENTRY_MONIKER handler.
 *
 * Pass: 	fldr = folder
 *		fh = file handle
 *		list = OD of GenDynamicList object
 *		entry = entry # of child we want to display
 *	    	displayFolders = TRUE if we want to display folders
 *
 * Return: nothing
 */

extern Boolean
    _pascal InkFolderGetChildInfo (dword fldr,
              VMFileHandle fh,
              word child,
              dword *childID);
/* XXX */
/*
 * Gets information for a numbered child.
 *
 * Pass: 	fldr = folder
 *		fh = file handle
 *		child = child number
 *		childID = pointer to dword
 *
 * Return: 	(Boolean) = set if folder / clear if item
 *	  	*childID = child's ID number
 */

extern word _pascal InkFolderGetChildNumber (dword fldr, VMFileHandle fh, dword note);
/* XXX */
/*
 * Gets the number of a child given its ID
 *
 * Pass: 	fldr = folder
 *		fh = file handle
 *		note = note or folder
 *
 * Return: 	(word) = number
 */

extern dword _pascal InkFolderCreateSubFolder (dword tag, VMFileHandle fh);
/* XXX */
/*
 * Creates a subfolder in the current folder. This automatically adds this
 * folder to the chunk array of children of the passed parent.
 *
 * Pass: 	tag = dword tag of parent Folder (0:0 if no parent)
 *		fh = file handle
 *
 * Return: 	(dword) = new child folder
 */

extern void _pascal InkFolderMove (dword fldr, dword pfldr);
/* XXX */
/*
 * Moves the passed folder.
 *
 * Pass: 	fldr = folder to move
 *		pfldr = new parent folder
 *
 * Return: nothing
 */

extern void _pascal InkFolderDelete (dword tag, VMFileHandle fh);
/* XXX */
/*
 * Deletes the passed folder. If there are children, it does a recursive
 * deletion.
 *
 * Pass: 	tag = dword tag of folder
 *		fh = file handle
 *
 * Return: nothing
 */

extern word _pascal InkFolderDepthFirstTraverse (dword rfldr, VMFileHandle fh, \
                    PCB(Boolean, callback,/* TRUE to stop */
                             (dword fldr,
                              VMFileHandle fh,
                              word *info)),
                    word *info);
/* XXX */
/*
 * Does a depth-first traversal of the folder tree.
 *
 * Pass: rfldr = folder at "root" of tree
 *	 fh = file handle
 *	 callback = far ptr to callback routine
 *	 info = ptr to extra data to pass to callback routine
 *
 * Return: (word) = data returned from callback routine
 *
 * Callback:
 *	Boolean callback(dword fldr, VMFileHandle fh, word *info);
 *
 *	Pass:	fldr = folder
 *		fh = file handle passed in
 *		info = ptr to data passed
 *
 *	Return: (Boolean) = TRUE to end traversal
 *		info = ptr to data to pass on
 *
 */

extern dword _pascal InkNoteCreate (dword tag, VMFileHandle fh);
/* XXX */
/*
 * Creates a new empty note.
 *
 * Pass: 	tag = dword tag of parent folder
 *		fh = file handle
 *
 * Return: 	dword tag of new note
 */

extern void _pascal InkNoteCopyMoniker (dword title, optr list, word type, word entry);
/* XXX */
/*
 * Copy the icon and folder/note name into the vis moniker
 *
 * Pass: 	title = title of the note or folder
 *		list = optr of output list
 *		type  = 1 if text note, 0 if ink note, -1 if folder
 *		entry = entry index
 *
 * Return: 	nothing
 */

extern dword _pascal InkNoteGetPages (dword tag, VMFileHandle fh);
/* XXX */
/*
 * Gets the page chunk array from the current note
 *
 * Pass: 	tag = dword tag of note
 *		fh = file handle
 *
 * Return: 	group/item of DB item containing chunk array of page info
 */

extern word _pascal InkNoteGetNumPages (dword item);
/* XXX */
/*
 * Gets the page chunk array from the current note
 *
 * Pass: 	item - group/item of DB item containing chunk array of page info
 *
 * Return: 	total number of pages in a note
 */

extern word _pascal InkNoteCreatePage (dword tag, VMFileHandle fh, word page);
/* XXX */
/*
 * Create a new page in a note
 *
 * Pass: 	tag = dword tag of note
 *		fh = file handle
 *		page = page number insert before (CA_NULL_ELEMENT to append)
 *
 * Return: 	(word) new page number
 */

extern void
    _pascal InkNoteLoadPage (dword tag, VMFileHandle fh, word page, optr obj,
            word type);
/* XXX */
/*
 * Load the ink object or the text object from a page of a note
 *
 * Pass: 	tag = dword tag of note
 *		fh = file handle
 *		page = page number
 *		obj = ink object or text object optr
 *		type = note type (0:ink, 1:text)
 *
 * Return: 	none
 */

extern void
    _pascal InkNoteSavePage (dword tag, VMFileHandle fh, word page, optr obj,
            word type);
/* XXX */
/*
 * Save the ink from a page of a note
 *
 * Pass: 	tag = dword tag of note
 *		fh = file handle
 *		page = page number
 *		obj = ink object or text object optr
 *		type = note type (0:ink, 1:text)
 *
 * Return: 	none
 */

#define INK_DB_MAX_NOTE_KEYWORDS_SIZE  	128

extern void
    _pascal InkNoteSetKeywordsFromTextObject (dword tag, VMFileHandle fh,
                     optr text);
/* XXX */
/*
 * Sets the keyword text for the note with text from the text object
 *
 * Pass: 	tag = dword tag of note
 *		fh = file handle
 *		text = optr of text object
 *
 * Return: 	nothing
 */

extern void _pascal InkNoteSetKeywords (dword tag, VMFileHandle fh, const char *text);
/* XXX */
/*
 * Sets the keyword text for the note
 *
 * Pass: 	tag = dword tag of note
 *		fh = file handle
 *		text = new keyword text, null-terminated
 *		(should be < INK_DB_MAX_NOTE_KEYWORDS_SIZE chars)
 *
 * Return: 	nothing
 */

extern word _pascal InkNoteGetKeywords (dword tag, VMFileHandle fh, char *text);
/* XXX */
/*
 * Gets the keyword text for the passed note
 *
 * Pass: 	tag = dword tag of note
 *		fh = file handle
 *		text = destination to store null-terminated text
 *			(should be INK_DB_MAX_NOTE_KEYWORDS_SIZE + 1)
 *
 * Return: 	size of name (excluding null terminator)
 */

extern void
    _pascal InkNoteSendKeywordsToTextObject (dword tag, VMFileHandle fh, \
                    optr text);
/* XXX */
/*
 * Puts the keyword text into a text object
 *
 * Pass: 	tag = dword tag of note
 *		fh = file handle
 *		text = optr of text object
 *
 * Return: nothing
 */

extern void
    _pascal InkNoteDelete (dword tag, VMFileHandle fh);
/* XXX */
/*
 * Deletes the note and all of the associated pages/information, and all
 * internal references to it.
 *
 * Pass: 	tag = dword tag of note
 *  		fh = file handle
 *
 * Return: nothing
 */

extern void
    _pascal InkNoteMove (dword tag, dword pfoldr, VMFileHandle fh);
/* XXX */
/*
 * Moves the passed note.
 *
 * Pass: 	tag = note to move
 *  		pfoldr = new parent folder
 *		fh = file handle
 *
 * Return: 	nothing
 */

extern void _pascal InkNoteSetModificationDate (word tdft1, word tdft2, dword note, \
                VMFileHandle fh);
/* XXX */
/*
 * Sets the modification date
 *
 * Pass:	tdft1 = 1st return value returned from TimerGetDateAndTime
 *		tdft2 = 2nd return value returned from TimerGetDateAndTime
 *		note = note
 *		fh = file handle
 *
 * Return: nothing
 */

extern dword
    _pascal InkNoteGetModificationDate (dword note, VMFileHandle fh);
extern dword
    _pascal InkNoteGetCreationDate (dword note, VMFileHandle fh);
/* XXX */
/*
 * Gets the modification/creation date
 *
 * Pass: 	note = note
 *  		fh = file handle
 *
 * Return: 	(dword)
 *		= high word = year
 *		= low word  = low byte is month (1-12), high byte is day (1-31)
 */

typedef ByteEnum NoteType ;
#define	NT_INK	 	0
#define	NT_TEXT	 1

extern NoteType
    _pascal InkNoteGetNoteType (dword note, VMFileHandle fh);
/* XXX */
/*
 * Gets the note type = text or ink
 *
 * Pass: 	note = note
 *  		fh = file handle
 *
 * Return: 	(word) NoteType
 */

extern void _pascal InkNoteSetNoteType (dword note, VMFileHandle fh, NoteType nt);
/* XXX */
/*
 * Sets the note type = text or ink
 *
 * Pass: 	note = note
 *  		fh = file handle
 *		nt = NoteType
 *
 * Return: 	nothing
 */

extern MemHandle _pascal InkNoteFindByTitle (	/* XXX */
                    char *string, byte opt, Boolean body, VMFileHandle fh);
/*
 * Finds notes by searching for the title
 *
 * Pass: 	string = string to match (can contain C_WILDCARD
 *					or C_SINGLE_WILDCARD)
 *		opt = SearchOptions
 *		body = TRUE if you want to look in the body of text notes
 *		fh = file handle
 *
 * Return: 	(MemHandle) =
 *			handle of block containing dword tags of matching notes
 *			in this format (or 0 if no match found).
 *			- OR -
 *			= 0 if none found
 *
 *		FindNoteHeader;
 * 		     -dword tag-
 *		     -dword tag-
 *		     -dword tag-
 *			etc...
 *
 * NOTE: Only returns first 20000 or so notes that match
 */

typedef struct {
    word	FNH_count;  	    /* the # of matching notes we've found. */
} FindNoteHeader} ;
#define FNH_data  (sizeof(FindNoteHeader))   /* start of series of dword tags */

extern MemHandle _pascal InkNoteFindByKeywords (     /* XXX */
                    VMFileHandle fh, const char *strings, word opt);
/*
 * Finds notes that contain the passed keywords
 *
 * Pass: 	fh = file handle
 *		strings = ptr to keyword strings (separated by whitespace
 *			  or commas)
 *		opt = TRUE if you only want notes that contain *all* passed
 *		      	keywords
 *	     	      FALSE if you want all notes that matched at least one
 *	       		keyword
 *
 * Return: 	(MemHandle) =
 *			handle of block containing dword tags of matching notes
 *			(same as InkNoteFindByTitle)
 *				- OR -
 *			= 0 if none found
 *
 *		FindNoteHeader:
 *  	    	     -number of tags-
 *		     -dword tag-
 * 		     -dword tag-
 *		     -dword tag-
 *			etc...
 *
 * NOTE: Only returns first 20000 or so notes that match
 */

#ifdef __HIGHC__

pragma Alias(InkDBInit, "INKDBINIT");
pragma Alias(InkDBGetHeadFolder, "INKDBGETHEADFOLDER");
pragma Alias(InkDBGetDisplayInfo, "INKDBGETDISPLAYINFO");
pragma Alias(InkDBSetDisplayInfo, "INKDBSETDISPLAYINFO");
pragma Alias(InkSetDocPageInfo, "INKSETDOCPAGEINFO");
pragma Alias(InkGetDocPageInfo, "INKGETDOCPAGEINFO");
pragma Alias(InkSetDocGString, "INKSETDOCGSTRING");
pragma Alias(InkGetDocGString, "INKGETDOCGSTRING");
pragma Alias(InkSetDocCustomGString, "INKSETDOCCUSTOMGSTRING");
pragma Alias(InkGetDocCustomGString, "INKGETDOCCUSTOMGSTRING");
pragma Alias(InkSendTitleToTextObject, "INKSENDTITLETOTEXTOBJECT");
pragma Alias(InkGetTitle, "INKGETTITLE");
pragma Alias(InkGetParentFolder, "INKGETPARENTFOLDER");
pragma Alias(InkFolderSetTitleFromTextObject, "INKFOLDERSETTITLEFROMTEXTOBJECT");
pragma Alias(InkNoteSetTitleFromTextObject, "INKNOTESETTITLEFROMTEXTOBJECT");
pragma Alias(InkFolderSetTitle, "INKFOLDERSETTITLE");
pragma Alias(InkNoteSetTitle, "INKNOTESETTITLE");
pragma Alias(InkFolderGetContents, "INKFOLDERGETCONTENTS");
pragma Alias(InkFolderGetNumChildren, "INKFOLDERGETNUMCHILDREN");
pragma Alias(InkFolderDisplayChildInList, "INKFOLDERDISPLAYCHILDINLIST");
pragma Alias(InkFolderGetChildInfo, "INKFOLDERGETCHILDINFO");
pragma Alias(InkFolderGetChildNumber, "INKFOLDERGETCHILDNUMBER");
pragma Alias(InkFolderCreateSubFolder, "INKFOLDERCREATESUBFOLDER");
pragma Alias(InkFolderMove, "INKFOLDERMOVE");
pragma Alias(InkFolderDelete, "INKFOLDERDELETE");
pragma Alias(InkFolderDepthFirstTraverse, "INKFOLDERDEPTHFIRSTTRAVERSE");
pragma Alias(InkNoteCreate, "INKNOTECREATE");
pragma Alias(InkNoteCopyMoniker, "INKNOTECOPYMONIKER");
pragma Alias(InkNoteGetPages, "INKNOTEGETPAGES");
pragma Alias(InkNoteGetNumPages, "INKNOTEGETNUMPAGES");
pragma Alias(InkNoteCreatePage, "INKNOTECREATEPAGE");
pragma Alias(InkNoteLoadPage, "INKNOTELOADPAGE");
pragma Alias(InkNoteSavePage, "INKNOTESAVEPAGE");
pragma Alias(InkNoteSetKeywordsFromTextObject, "INKNOTESETKEYWORDSFROMTEXTOBJECT");
pragma Alias(InkNoteSetKeywords, "INKNOTESETKEYWORDS");
pragma Alias(InkNoteGetKeywords, "INKNOTEGETKEYWORDS");
pragma Alias(InkNoteSendKeywordsToTextObject, "INKNOTESENDKEYWORDSTOTEXTOBJECT");
pragma Alias(InkNoteDelete, "INKNOTEDELETE");
pragma Alias(InkNoteMove, "INKNOTEMOVE");
pragma Alias(InkNoteSetModificationDate, "INKNOTESETMODIFICATIONDATE");
pragma Alias(InkNoteGetCreationDate, "INKNOTEGETCREATIONDATE");
pragma Alias(InkNoteGetModificationDate, "INKNOTEGETMODIFICATIONDATE");
pragma Alias(InkNoteGetNoteType, "INKNOTEGETNOTETYPE");
pragma Alias(InkNoteSetNoteType, "INKNOTESETNOTETYPE");
pragma Alias(InkNoteFindByTitle, "INKNOTEFINDBYTITLE");
pragma Alias(InkNoteFindByKeywords, "INKNOTEFINDBYKEYWORDS");
pragma Alias(InkCompress, "INKCOMPRESS");
pragma Alias(InkDecompress, "INKDECOMPRESS");

#endif

@endlib


print.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1993 -- All Rights Reserved
 *
 * PROJECT:	  GEOS
 * MODULE:	  CInclude
 * FILE:	  print.h
 *
 * AUTHOR:  	  Jenny Greenwood: Aug 31, 1993
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	jenny	8/31/93   	Initial version
 *
 * DESCRIPTION:
 *	Header containing externally visible printer driver definitions.
 *
 * 	$Id: print.h,v 1.3.1.1 96/04/28 08:29:32 chris Exp $
 *
 ***********************************************************************/
#ifndef _PRINT_H_
#define _PRINT_H_

/*
 * Different printer modes.
 */
typedef ByteEnum PrinterMode ;
#define PM_GRAPHICS_LOW_RES 	0       /* lowest quality...fastest... */
#define PM_GRAPHICS_MED_RES 	2	/* medium quality...slower... */
#define PM_GRAPHICS_HI_RES 	4	/* best quality...slowest... */
#define PM_TEXT_DRAFT 		6	/* fastest ascii output */
#define PM_TEXT_NLQ 		8	/* best quality ascii output */

#define PM_FIRST_TEXT_MODE 	PM_TEXT_DRAFT
                                        /* equate to make the code easier */
/*
 * Page type
 */
typedef enum /* word */ {
    PT_PAPER    	= 0,
    PT_ENVELOPE    	= 2,
    PT_LABEL    	= 4,
    PT_POSTCARD     = 6
} PageType} ;
#define PaperType 	PageType

/*
 * Page layout options for paper
 */
typedef ByteEnum PaperOrientation ;
#define PO_PORTRAIT   	0
#define PO_LANDSCAPE  	1

typedef WordFlags PageLayoutPaper ;
#define PLP_ORIENTATION 	0x0008	    	    	/* PaperOrientation */
#define	PLP_TYPE		0x0007	    	    	/* PageType: PT_PAPER */

/*
 * Page layout options for envelopes
 */
typedef ByteEnum EnvelopeOrientation ;
#define EO_PORTRAIT  	0
#define EO_LANDSCAPE 	1

typedef WordFlags PageLayoutEnvelope ;
#define PLE_ORIENTATION 	0x0008	    	    	/* EnvelopeOrientation */
#define PLE_TYPE 	0x0007			/* PageType: PT_ENVELOPE */

/*
 * Page layout options for labels
 */
typedef WordFlags PageLayoutLabel ;
#define PLL_ROWS 	0x7e00			/* labels down */
#define PLL_COLUMNS 	0x01f8			/* labels across */
#define PLL_TYPE 	0x0007			/* PageType: PT_LABEL */

/*
 * Page layout options for postcards
 */
typedef ByteEnum PostcardOrientation ;
#define PCO_PORTAIT  	0
#define PCO_LANDSCAPE 	1

typedef WordFlags PageLayoutPostcard ;
#define PLPC_ORIENTATION  0x0008	    	    	/* PostcardOrientation */
#define PLPC_TYPE    	 0x0007	    	    	/* PageType: PT_POSTCARD */

/*
 * A union of all the page layout options.
 */
typedef union {
    PageLayoutPaper 	PL_paper;
    PageLayoutEnvelope	PL_envelope;
    PageLayoutLabel	PL_label;
    PageLayoutPostcard	PL_postcard;
} PageLayout} ;

/*
 * Margin structure
 */
typedef struct {
    word	PCMP_left;	/* left margin */
    word	PCMP_top;	/* top margin */
    word	PCMP_right;	/* right margin */
    word	PCMP_bottom;	/* bottom margin */
} PCMarginParams} ;

/*
 * Dimensions structure
 */
typedef struct {
    dword	PCDSP_width;	/* width of the document */
    dword	PCDSP_height;	/* height of the document */
} PCDocSizeParams} ;

/*
 * PageSizeReport structure
 */
typedef struct {
    dword	    PSR_width;	        /* width of the page */
    dword	    PSR_height;		/* height of the page */
    PageLayout	    PSR_layout;	 	/* layout options */
    PCMarginParams  PSR_margins;	/* document margins */
} PageSizeReport} ;

/*
 * This enumerated type indicates the type of printer driver
 * that we are dealing with, as printer drivers are really a broad
 * class of output device drivers
 */
typedef ByteEnum PrinterDriverType ;
#define	PDT_PRINTER		0
#define	PDT_PLOTTER		1
#define	PDT_FACSIMILE		2
#define	PDT_CAMERA		3
#define	PDT_OTHER		4

#define	PDT_ALL		        (-1)	/* all printers of all types
                 * - do NOT pass to SpoolGetNumPrinters
                 */

#define	PDT_ALL_LOCAL_AND_NETWORK	 0x00ff
                                /* all printers of all types
                 * - CAN be passed to SpoolGetNumPrinters
                 */

#endif /* _PRINT_H_ */


Internal\printDr.h

/*********************************************************************

    Copyright (c) Geoworks 1995 -- All Rights Reserved

PROJECT:	GEOS
MODULE:
FILE:		printDr.h

AUTHOR:		Chris Boyke, Jan 19, 1995

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
       chrisb	1/19/95   	Initial version.

DESCRIPTION:
    Header file for accessing printer drivers from "C"
    No "wrapper" routines are provided here, just constant
    and data definitions

    $Id: printDr.h,v 1.3.4.1 96/04/28 08:32:44 chris Exp $

*********************************************************************/

/* ---------------------------------------------------------------------------
 * 		Print Driver Function Calls
 * ---------------------------------------------------------------------------*/

#include  <spoolInt.h>
/*
 *  Protocol number for this interface. Adjust the final numbers, below, if the
 *  interface is changed.
 */
#define PRINT_PROTO_MAJOR 	(DRIVER_EXT_PROTO_MAJOR+2)
#define PRINT_PROTO_MINOR 	(DRIVER_EXT_PROTO_MINOR+0)

/* enum PrintFunction */
typedef enum {

/*
 * 	These are the first four functions to be supported
 *  DR_INIT		0
 *  DR_EXIT		2
 *  DRE_TEST_DEVICE	4
 *  DRE_SET_DEVICE	6
 */

/*  functions that are resident in the Entry module */

/*
 *  return ptr to info blk
 * 	PASS: 		nothing
 * 	RETURN:		dx:si	= handle:offset to driver info structure
 * 			  	  (structure type DriverExtendedInfoTable)
 * 			          the structure PrintDriverInfo is located
 * 			          immediately after DriverExtendedInfoTable
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_DRIVER_INFO     = 0x0C,

/*
 *  return ptr to info blk
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		dx:si	= handle:offset to device info structure
 * 			  	  (structure type PrinterInfo)
 * 	DESTROYS: 	nothing
 *
 * 	This function assumes that a specific device type has already been
 * 	setup in the PState via a DR_PRINT_SET_DEVICE call
 */
    DR_PRINT_DEVICE_INFO     = 0x0E,

/*
 *  set printing mode
 * 	PASS: 		bx	= handle to PState
 * 			cl	= mode to print in
 * 			ax	= width of paper size (points)
 * 			si	= height of paper size (points)
 * 	RETURN:		nothing
 * 	DESTROYS: 	nothing
 *
 * 	This function is used to set the device printing mode and some
 * 	paper options
 */
    DR_PRINT_SET_MODE     = 0x10,

/*
 *  set final destination
 * 	PASS: 		bx	= handle to PState
 * 			cx	= stream token
 * 			dx	= stream device driver handle
 * 			si	= stream device type (PrinterPortType)
 * 	RETURN:		nothing
 * 	DESTROYS: 	nothing
 *
 * 	This function is used to set the final destination (some I/O driver)
 * 	of the data that passes through the printer driver
 */
    DR_PRINT_SET_STREAM     = 0x12,

/*
 *  reset current position
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		nothing
 * 	DESTROYS: 	nothing
 *
 * 	Sets the cursor back to 0,0
 */
    DR_PRINT_HOME_CURSOR     = 0x14,

/* ---------------------------------------------------------------------------
 * 		Functions normally resident in other modules
 * 	see the definition of DR_PRINT_LAST_RESIDENT
 * ---------------------------------------------------------------------------*/

/*
 *  get current position
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		WWFixed:
 * 			cx.bx	= current x position of cursor
 * 			dx.ax	= current y position of cursor
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_GET_CURSOR     = 0x16,

/*
 *  set current position
 * 	PASS: 		bx	= handle to PState
 * 			WWFixed:
 * 			cx.bx	= new x position of cursor
 * 			dx.ax	= new y position of cursor
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_SET_CURSOR     = 0x18,

/*
 *  reset current position
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		dx.ax	= line spacing, WWFixed, in points
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_GET_LINE_SPACING     = 0x1A,

/*
 *  reset current position
 * 	PASS: 		bx	= handle to PState
 * 			dx.ax	= line spacing, WWFixed, in points
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_SET_LINE_SPACING     = 0x1C,

/*
 *  set a new font to use
 * 	PASS: 		bx	= handle to PState
 * 			cx	= desired FontID
 * 			dx	= desired point size
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 *
 * 	This function will choose a default font (printer dependent) if the
 * 	desired font is not available.
 */
    DR_PRINT_SET_FONT     = 0x1E,

/*
 *  return the color format
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		al	= BitMap Format enum
 * 	DESTROYS: 	nothing
 *
 * 	Used for getting the format to send the bitmap to the print driver.
 */
    DR_PRINT_GET_COLOR_FORMAT     = 0x20,

/*
 *  set new color for output
 * 	PASS: 		bx	= handle to PState
 * 			al	= R byte
 * 			dl	= G byte
 * 			dh	= B byte
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_SET_COLOR     = 0x22,

/*
 *  get current mode settings
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		cx	= current text mode style bit settings
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_GET_STYLES     = 0x24,

/*
 *  set current mode settings
 * 	PASS: 		bx	= handle to PState
 * 			dx	= style word to set (PrinterTextStyles record)
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_SET_STYLES     = 0x26,

/*
 *  test for legal mode
 * 	PASS: 		bx	= handle to PState
 * 			dx	= style word to check (PrinterTextStyle record)
 * 	RETURN:		dx	= style word as it would be set
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_TEST_STYLES     = 0x28,

/*
 *  print an ascii string
 * 	PASS: 		bx	= handle to PState
 * 			dx:si	= pointer to string
 * 			cx	= character count, or 0 for NULL-terminated
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_TEXT     = 0x2A,

/*
 *  send unadulterated bytes
 * 	PASS: 		bx	= handle to PState
 * 			dx:si	= pointer to buffer
 * 			cx	= byte count
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_RAW     = 0x2C,

/*
 *  print a style run
 * 	PASS: 		bx	= handle to PState
 * 			ax	= X offset into the PAPER area to start this
 * 					tile. for most one tile pages ax will be
 * 					the left printer margin value.
 * 			cx	= Y offset into the PAPER area to start this
 * 					tile. for most one tile pages cx will be
 * 					the top printer margin value.
 * 			dx:si	= pointer to style run info structure
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_STYLE_RUN     = 0x2E,

/*
 *  print a page wide swath
 * 	PASS: 		bx	= handle to PState
 * 			dx:si	= pointer to bitmap to print
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_SWATH     = 0x30,

/*
 * start page stuff
 * 	PASS: 		bx	= handle to PState
 * 			cl	= flag to signal suppressformfeed mode
 * 					C_FF = normal form-feed at end of page;
 * 					else no form-feed, and cursor left at
 * 					next line down against the left margin.
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 *
 * 	Sets the cursor back to 0,0
 */
    DR_PRINT_START_PAGE     = 0x32,

/*
 * END page stuff
 * 	PASS: 		bx	= handle to PState
 * 			cl	= flag to signal suppressformfeed mode
 * 					C_FF = normal form-feed at end of page;
 * 					else no form-feed, and cursor left at
 * 					next line down against the left margin.
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 *
 * 	Does form-feed
 */
    DR_PRINT_END_PAGE     = 0x34,

/*
 *  get imageable area
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		ax	= left side coordinate   (points)
 * 			si	= top side coordinate    (points)
 * 			cx	= right side coordinate  (points)
 * 			dx	= bottom side coordinate (points)
 * 	DESTROYS: 	nothing
 *
 * 	This function is used to set the size of the bitmap needed to
 * 	render the page.
 */
    DR_PRINT_GET_PRINT_AREA     = 0x36,

/*
 *  get the margin info.
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		ax	= Left Margin
 * 			si	= Top Margin
 * 			cx	= Right Margin
 * 			dx	= Bottom Margin
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_GET_MARGINS     = 0x38,

/*
 *  get the paper path options.
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		al	= PaperInputOptions record
 * 			ah	= PaperOutputOptions record
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_GET_PAPER_PATH     = 0x3A,

/*
 *  get the paper path options.
 * 	PASS: 		bx	= handle to PState
 * 			al	= PaperInputOptions record
 * 			ah	= PaperOutputOptions record
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_SET_PAPER_PATH     = 0x3C,

/*
 *  do init for print job
 * 	PASS: 		bx	= handle to PState
 *
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 *
 * 	This function should be called when starting a print job.  It handles
 * 	any initialization required, and should be matched with a corresponding
 * 	DR_PRINT_END_JOB when the job is completed.  A job can span multiple
 * 	pages or documents (up to the caller to decide).
 */
    DR_PRINT_START_JOB     = 0x3E,

/*
 *  deal w/death for print job
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 *
 * 	This function should be called when ending a print job.  It handles
 * 	any shutting down required, and should be matched with a corresponding
 * 	DR_PRINT_START_JOB when the job is started.
 */
    DR_PRINT_END_JOB     = 0x40,

/*
 *  return OD for print DB
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		cx:dx	= OD of generic UI tree to place in print DB
 * 	DESTROYS: 	nothing
 *
 * 	Return the OD of a generic tree to be duplicated and placed into
 * 	the main print dialog box.
 */
    DR_PRINT_GET_MAIN_UI     = 0x42,

/*
 *  return OD for options
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		cx:dx	= OD of generic UI tree to place in options DB
 * 	DESTROYS: 	nothing
 *
 * 	Return the OD of a generic tree to be duplicated and placed into
 * 	the options print dialog box.
 */
    DR_PRINT_GET_OPTIONS_UI     = 0x44,

/*
 *  evaluate main print UI
 * 	PASS:		bx	= PState handle
 * 			cx	= Handle of the duplicated generic tree
 * 				  displayed in the main print dialog box.
 * 				  (= 0 to indicate do nothing)
 * 			dx	= Handle of the duplicated generic tree
 * 				  displayed in the options dialog box
 * 				  (= 0 to indicate do nothing)
 * 			es:si	= JobParameters structure
 * 			ax	= Handle of JobParameters block
 * 	RETURN: 	carry	= clear (success)
 * 				- or -
 * 			cx	= memory handle holding error message
 * 			carry	= set (failure)
 * 	DESTROYS:	nothing
 *
 * 	Evaluate the contents of the generic tree(s) holding print UI objects,
 * 	and write directly into the JobParameters storing any needed state.
 *
 * 	NOTE:		Data returned is internal to the print driver, and
 * 			is not read by the spooler or anyone else
 */
    DR_PRINT_EVAL_UI     = 0x46,

/*
 *  evaluate main print UI
 * 	PASS:		bx	= PState handle
 * 			cx	= Handle of the duplicated generic tree
 * 				  displayed in the main print dialog box.
 * 				  (= 0 to indicate do nothing)
 * 			dx	= Handle of the duplicated generic tree
 * 				  displayed in the options dialog box
 * 				  (= 0 to indicate do nothing)
 * 			es:si	= JobParameters structure
 * 			ax	= Handle of JobParameters block
 * 	RETURN: 	nothing
 * 	DESTROYS:	nothing
 *
 * 	Take the data written into JobParameters from a prior all to
 * 	DR_PRINT_EVAL_UI, and stuff it back into the UI object found
 * 	in the duplicated tree.
 */
    DR_PRINT_STUFF_UI     = 0x48,
} PrintFunction} ;

#define DR_PRINT_FIRST_PSTATE_NEEDED 	(DRE_SET_DEVICE)

/*
 * declared in each printer - specific constants file. DJD 9-11-90
 * DR_PRINT_LAST_RESIDENT  =	DR_PRINT_HOME_CURSOR
 */

#define DR_PRINT_FIRST_MOD 	(DR_PRINT_LAST_RESIDENT + 2)
#define DR_PRINT_LAST_GRAPHICS 	(DR_PRINT_SWATH)
#define DR_PRINT_LAST_TEXT 	(DR_PRINT_TEST_MODES)
#define DR_PRINT_LAST_FUNCTION 	(DR_PRINT_TEST_MODES)

/* ---------------------------------------------------------------------------
 * 		Printer driver standard escapes
 * ---------------------------------------------------------------------------*/

/*
 *  codes from 0x8000-0x80ff are standard escape codes common
 *  to all drivers (see geode.def)
 */

/*
 *      standard printer escapes range from 0x8100 to 0xbfff
 *  user-defined printer escapes range from 0xc000 to 0xffff
 */

/* enum PrintEscCode */
typedef enum {

/*
 *  print bitmap(LaserJet)
 * 	PASS:
 * 		bx	=	Handle to PState
 * 		dx:si	=	pointer to bitmap to print
 * 	RETURN:
 * 	DESTROYS:
 *
 * 	This call prints a bitmap out at the current cursor location. It is
 * 	used for printing a less than full page of graphics. The bitmap is
 * 	printed in the previously set resolution.
 */
    DR_PRINT_ESC_PRINT_BITMAP     = 0x8100,

/*
 *  for PDL printers
 *      PASS:           bx      = handle to PState
 *                      dx:si   = pointer to TransMatrix
 *      RETURN:         nothing
 *      DESTROYS:       nothing
 *
 *      This call establishes the transformation matrix that should be
 *      applied to all elements drawn on the current page.  This is used
 *      by the spooler to do rotation, thumbnails...
 */
    DR_PRINT_ESC_SET_PAGE_TRANSFORM    ,

/*
 *  for PDL printers
 *      PASS:           bx      = handle to PState
 *                      cx      = GString flags (record, type GSControl)
 *                      si      = GString handle
 *      RETURN:         ax      = GString return flags (enum GSRetType)
 *                      bx      = data returned with GSRetType
 *      DESTROYS:       nothing
 *
 *      This is the main drawing call for PDL printers.  The passed graphics
 *      string should be read and translated into the specific page
 *      description and passed onto the printer.  The GSControl flags
 *      that are passed are compatible with the flags expected by
 *      GrDrawGString and indicate when to stop drawing from the passed
 *      graphics string.  This may be called more than once per page.
 */
    DR_PRINT_ESC_PRINT_GSTRING    ,

/*
 *  color transfer func
 *      PASS:           bx      = handle to PState
 *      RETURN:         ax      = handle of block containing transfer tables
 *      DESTROYS:       nothing
 *
 *      This function allows the printer drivers to adjust the color mapping
 *      from RGB to RGB or to CMYK or to Gray.  A transfer function table is
 *      just an array of 256 bytes.  The mapping is done by a simple table
 *      lookup, using the raw component value.  The value in the array at that
 *      index is used in its place.  Thus there is one table for the grey
 *      mapping function (useful for monochrome printers), three tables for
 *      an RGB device (useful for film recorders), and four tables for a
 *      CMYK device (most color printers).
 */
    DR_PRINT_ESC_GET_COLOR_TRANSFER    ,

/*
 * set the number of copies
 * 	PASS:		bx	= handle of PState
 * 			ax	= number of copies desired
 * 	RETURN:		ax	= number of copies successfully set
 * 				(there may be a limit on the number of copies
 * 				available at the printer, and if the caller
 * 				tries to exceed that number, then ax will
 * 				reflect the max number available)
 * 			carry set by communication error.
 * 	DESTROYS:	nothing
 */
    DR_PRINT_ESC_SET_COPIES    ,

/*
 * prepend a page (or pages)
 * 	PASS:		bx	= handle of PState
 * 			ax	= handle of GState to draw to
 * 			cx	= handle of duplicated "Main" tree
 * 			dx	= handle of duplicated "Options" tree
 * 	RETURN:		nothing
 * 	DESTROYS:	nothing
 */
    DR_PRINT_ESC_PREPEND_PAGE    ,

/*
 * append a page (or pages)
 * 	PASS:		bx	= handle of PState
 * 			ax	= handle of GState to draw to
 * 			cx	= handle of duplicated "Main" tree
 * 			dx	= handle of duplicated "Options" tree
 * 	RETURN:		nothing
 * 	DESTROYS:	nothing
 */
    DR_PRINT_ESC_APPEND_PAGE    ,

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * 	following are Print Escapes that may only be applicable for
 * 	dedicated word processors
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*
 * initialize mechanism
 * 	PASS		bx	=  handle of PState
 *        RETURN:         nothing
 *        DESTROYS:       nothing
 *
 *        This function initializes the printer mechanism without starting a
 * 	print job. Called at boot time for captive printer devices.
 */
    DR_PRINT_ESC_INIT_PRINT_ENGINE    ,

/*
 * Set printer TOD.
 * 	PASS:		bx      = handle of PState
 * 	RETURN:		nothing
 * 	DESTROYS:	nothing
 *
 * 	This function sets the time and date in the printer using the DOS
 * 	(and GEOS) TOD values.
 */
    DR_PRINT_ESC_SET_TOD    ,

/*
 * cap the printhead.
 *        PASS:           bx      = handle of PState
 *        RETURN:         nothing
 *        DESTROYS:       nothing
 *
 *        This function caps the printhead immediately.
 */
    DR_PRINT_ESC_CAP_HEAD    ,

/*
 * clean the printhead.
 *        PASS:           bx      = handle of PState
 *        RETURN:         nothing
 *        DESTROYS:       nothing
 *
 *        This function cleans the printhead immediately.
 */
    DR_PRINT_ESC_CLEAN_HEAD    ,

/*
 * get any printer specific error
 * 	PASS		bx      = handle of PState
 * 	RETURNS:	(Printer specific)
 * 	DESTROYS:	(Printer specific)
 *
 * 	This escape returns any printer-specific error codes.
 */
    DR_PRINT_ESC_GET_ERRORS    ,

/*
 * wait for the printer
 * 						  mechanicals to stop
 * 	PASS		bx      = handle of PState
 * 	RETURNS:	nothing
 * 	DESTROYS:	nothing
 */
    DR_PRINT_ESC_WAIT_FOR_MECH    ,

/*
 * park the printhead off the
 * 						  printable area
 * 	PASS            bx      = handle of PState
 *        RETURNS:        nothing
 *        DESTROYS:       nothing
 */
    DR_PRINT_ESC_PARK_HEAD    ,

/*
 *  set current position
 * 	PASS: 		bx	= handle to PState
 * 			WWFixed:
 * 			cx.bx	= new x position of cursor
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_ESC_MOVE_IN_X_ONLY    ,

/*
 *  set current position
 * 	PASS: 		bx	= handle to PState
 * 			WWFixed:
 * 			dx.ax	= new y position of cursor
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_ESC_MOVE_IN_Y_ONLY    ,

/*
 *  Load paper
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_ESC_INSERT_PAPER    ,

/*
 *  Eject paper
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		carry set by communication error.
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_ESC_EJECT_PAPER    ,

/*
 *  return PrintJobLock
 * 	PASS: 		bx	= handle to PState
 * 	RETURN:		(Printer Specific)
 * 	DESTROYS: 	nothing
 *
 * 	This escape returns the state of a job (whether it is interruptable
 * 		or not)
 */
    DR_PRINT_ESC_GET_JOB_STATUS    ,

/*
 *  return PrintJobLock
 * 	PASS: 		bx	= handle to PState
 * 			al	- TRUE - job is in progress
 * 				- FALSE - job is not in progress
 * 	RETURN:		nothing
 * 	DESTROYS: 	nothing
 */
    DR_PRINT_ESC_SET_JOB_STATUS    ,
} PrintEscCode} ;

/* ---------------------------------------------------------------------------
 * 		Enums, Records and Structure Definitions
 * ---------------------------------------------------------------------------*/

/*
 *  PrintDevice enum
 *  This enum is filled out by each driver in its DriverInfo.asm file.
 *  It advances by two so that it can be used as an index into the
 *  various info tables maintained in the DriverInfo resource.
 */
/* enum PrintDevice */
typedef enum {		/* CHECKME */
/*  invalid enum */
    PD_INVALID_DEVICE     = 0xfffe,
} PrintDevice} ;

/*
 * ___________________________________________________________________________
 *
 * 	The following enums and structures are used in the specific device
 * 	info resources.
 * ___________________________________________________________________________
 */

typedef ByteEnum PrinterTech ;		/* CHECKME */
/*  raster technology */
#define PT_RASTER 	0x0
/*  vector technology */
#define PT_VECTOR 	0x1

typedef ByteFlags PrinterType ;		/* CHECKME */
/* 5 bits unused */
/* 4 bits unused */
#define PrinterTech 	(nil)
/* in graphics.def */
#define BMFormat 	(nil | nil | nil)
#define BMFormat_OFFSET 	-5

/*
 * Printer port information
 * These bits define how the PC/GEOS can communicate with
 * a device. The enums are defined to make things easier to
 * read in source code, and SWAT.
 */

/* IEEE-488 bus devices. */
typedef ByteEnum IEEE488Connection ;		/* CHECKME */
#define IC_NO_IEEE488 	0x0
#define IC_IEEE488 	0x1

/*
 * The print driver includes the port driver. This is useful for the  ""
 * FAX drivers, and anything that has its own custom interface.
 */
typedef ByteEnum CustomConnection ;		/* CHECKME */
#define CC_NO_CUSTOM 	0x0
#define CC_CUSTOM 	0x1

/* SCSI bus devices */
typedef ByteEnum SCSIConnection ;		/* CHECKME */
#define SC_NO_SCSI 	0x0
#define SC_SCSI 	0x1

/* Most common serial devices */
typedef ByteEnum RS232CConnection ;		/* CHECKME */
#define RC_NO_RS232C 	0x0
#define RC_RS232C 	0x1

/* Most common parallel devices */
typedef ByteEnum CentronicsConnection ;		/* CHECKME */
#define CC_NO_CENTRONICS 	0x0
#define CC_CENTRONICS 	0x1

/*
 * Output to a file. Most drivers will let you print to a file of
 * raw printer data, but the filesize for the high resolution bit-mapped
 * devices may be too large for some media.
 */
typedef ByteEnum FileConnection ;		/* CHECKME */
#define FC_NO_FILE 	0x0
#define FC_FILE 	0x1

/* Appletalk/flashtalk network devices. */
typedef ByteEnum AppletalkConnection ;		/* CHECKME */
#define AC_NO_APPLETALK 	0x0
#define AC_APPLETALK 	0x1

/*
 *  Printer Connection
 *  This record specifies the interfaces available for the device
 */
typedef ByteFlags PrinterConnections ;		/* CHECKME */
/* 7 bits unused */
/*  future bits */
/* 1 bit unused */
/*  IEEE-488 device */
#define IEEE488Connection 	(nil)
/*  printdriver custom port driver */
#define CustomConnection 	(nil)
/*  SCSI device */
#define SCSIConnection 	(nil)
/*  RS-232C serial device */
#define RS232CConnection 	(nil)
/*  Centronics parallel device */
#define CentronicsConnection 	(nil)
/*  raw output to a file */
#define FileConnection 	(nil)
/*  apple/flashtalk device */
#define AppletalkConnection 	(nil)

/*
 *  Printer Smarts
 *  determines whether driver takes gstrings or a built out bitmap
 */
typedef ByteEnum PrinterSmart ;		/* CHECKME */
/*  do everything for me */
#define PS_DUMB_RASTER 	0x0
/*  has scalable and downloadable fonts */
#define PS_DOES_FONTS 	0x1
/*  can deal with raw graphics strings */
#define PS_PDL 	0x2

typedef struct {
    word	PM_left;
    word	PM_top;
    word	PM_right;
    word	PM_bottom;
} PrinterMargins} ;

/*
 *  Paper Input
 *  This record specifies the type of paper path for the device.
 *  When used in the printer info structure, the
 *  fields of the record indicate the quantity of
 *  a given feature (for example, a "2" in the PIO_TRACTOR field
 *  would indicate the device has two tractor feed units).
 *  However, when being passed to the printer driver to set the
 *  desired paper path options for the current print job (see
 *  DR_PRINT_SET_MODE), the field indicates which one to select.  (for
 *  example, a "2" in the PIO_TRACTOR field would indicate that the
 *  driver should use tractor unit #2).
 */

typedef ByteEnum ManualFeed ;
#define MF_NO_MANUAL 		0x0	/* No Manual paper input. */
#define MF_MANUAL1 		0x1	/* manual feed path #1 */
#define MF_MANUAL2 		0x2	/* manual feed path #2 */
#define MF_MANUAL3 		0x3	/* manual feed path #3 */

typedef ByteEnum TractorFeed ;
#define TF_NO_TRACTOR 		0x0	/* No Tractor Feed. */
#define TF_TRACTOR1 		0x1	/* tractor feeder #1 */
#define TF_TRACTOR2 		0x2	/* tractor feeder #2 */
#define TF_TRACTOR3 		0x3	/* tractor feeder #3 */

typedef ByteEnum AutoSheetFeed ;
#define ASF_NO_TRAY 		0x0	/* No ASF trays */
#define ASF_TRAY1 		0x1	/* ASF tray #1 */
#define ASF_TRAY2 		0x2	/* ASF tray #2 */
#define ASF_TRAY3 		0x3	/* ASF tray #3 */
#define ASF_TRAY4 		0x4	/* ASF tray #4 */
#define ASF_TRAY5 		0x5	/* ASF tray #5 */
#define ASF_TRAY6 		0x6	/* ASF tray #6 */
#define ASF_TRAY7 		0x7	/* ASF tray #7 */

typedef ByteFlags PaperInputOptions ;
/* 1 bit unused */
#define ManualFeed 		0x60	/* manual feed paths */
#define ManualFeed_OFFSET 	5
#define AutoSheetFeed 		0x1c	/* cut-sheet feed bins */
#define AutoSheetFeed_OFFSET 	2
#define TractorFeed 		0x03	/* tractor feed paths */
#define TractorFeed_OFFSET 	0

/*
 *  Paper Output
 *  This record specifies the type of output path for the device
 *  It is very similar to the PaperInputOptions record in that the
 *  number of output bins works the same way. Additional information
 *  is included for duplex modes, and the normal way that paper is ""
 *  outputted from the printer (only relevant for printers with ASF
 *  or manual paper inputs)
 */

/*
 * Output Copies specifies that the printer can produce multiple copies
 * of the page by itself. Used by the spooler to see if a page needs to
 * be sent to the printer multiple times or not.
 */
typedef ByteEnum OutputCopies ;
#define OC_NO_COPIES 		0x0	/* no multiple copies */
#define OC_COPIES 		0x1	/* multiple copies */

/*
 *  Paper Sort Order
 *  This enum specifies how the paper is normally received in the
 *  output tray.
 */

typedef ByteEnum PaperSorted ;
#define PS_NORMAL 		0x0	/* face down on output */
#define PS_REVERSE 		0x1	/* face up on output */

typedef ByteEnum OutputDuplex ;
#define OD_SIMPLEX 		0x0	/* no duplex printing */
#define OD_DUPLEXLO 		0x1	/* duplex printing, long edge bd */
#define OD_DUPLEXSO 		0x2	/* duplex printing, short edge bd */

typedef ByteEnum StapledOutput ;
#define SO_NO_STAPLER 		0x0	/* no stapling the output */
#define SO_STAPLER 		0x1	/* Stapler #1 */

typedef ByteEnum OutputSorter ;
#define OS_NO_SORTER 		0x0	/* no sorting the output. */
#define OS_SORTER 		0x1	/* sorter #1 */

typedef ByteEnum OutputBin ;
#define OB_NO_OUTPUTBIN 		0x0	/* no bin (only for tractor only) */
#define OB_OUTPUTBIN1 		0x1	/* Output Bin #1 */
#define OB_OUTPUTBIN2 		0x2	/* Output Bin #2 */
#define OB_OUTPUTBIN3 		0x3	/* Output Bin #3 */

typedef ByteFlags PaperOutputOptions ;
/* 6 bits unused */
#define OutputCopies 		0x80
#define PaperSorted 		0x40	/* which way cut-sheets come out */
#define OutputDuplex 		0x30	/* duplex printing features. */
#define OutputDuplex_OFFSET 	0x04
#define StapledOutput 		0x08	/* Stapled? */
#define OutputSorter 		0x04	/* # of sorters */
#define OutputBin 		0x03	/* # of output bins */
#define OutputBin_OFFSET 	0x00

/* DO NOT CHANGE THE ORDER OF THESE! */
typedef ByteEnum PrinterCountryCode ;
#define PCC_FRANCE 	0x0
#define PCC_GERMANY 	0x1
#define PCC_UK 		0x2
#define PCC_DENMARK1 	0x3
#define PCC_SWEDEN 	0x4
#define PCC_ITALY 	0x5
#define PCC_SPAIN1 	0x6
#define PCC_JAPAN 	0x7
#define PCC_NORWAY 	0x8
#define PCC_DENMARK2 	0x9
#define PCC_SPAIN2 	0xa
#define PCC_LAT_AMERICA 	0xb
#define PCC_LEGAL 	0xc
#define PCC_USA 		0xff

/* ---------------------------------------------------------------------------
 * 		Printer driver info block
 * ---------------------------------------------------------------------------*/

/*
 * 	The printer device info table is a pretty gnarled beast.  We want to
 * 	be able to store the device info for as many actual devices as the
 * 	driver supports, allowing for the situation where a single driver
 * 	could support multiple devices that have slightly different device
 * 	info tables.  So the overall structure of the device info table is
 * 	a list of devices the driver supports, and an array of device info
 * 	structures that specify the info about each device.  Two devices can
 * 	use the same device info structure if they have the same attributes.
 *
 * 	The device info structures contain all the info about the device,
 * 	and includes info like what kind of paper is used, is it a color  ""
 * 	device, and the like.  This structure also describes which of the
 * 	PrinterMode (see above) the device supports, and the particular
 * 	attributes of those modes for that device.
 */

/*
 *  DEVICE INFO BLOCK
 *  This structure contains the info about a specific device.
 */

typedef struct {		/* CHECKME */

/*  device capabilities. */

    PrinterType	PI_type;
    PrinterConnections	PI_connect;
    PrinterSmart	PI_smarts;

/* custom start job routine. */
    word	PI_customEntry;
/* custom end job routine. */
    word	PI_customExit;

/*
 *  Offsets to mode property tables.
 *  O means the mode is not supported GraphicsProperties is a
 *  fixed structure, while TextProperties is an array of the
 *  TextProperties structure with a variable number of elements
 *  (depends on how many pitches are supported in that mode).
 */

/* 	NO_SCALE and TEXT_PROOF removed by Dave 4/3/90 */

/*  PM_GRAPHICS_LOW_RES */
    word    	PI_lowRes;
/*  PM_GRAPHICS_MED_RES */
    word	PI_medRes;
/*  PM_GRAPHICS_HI_RES */
    word	PI_hiRes;
/*  PM_TEXT_DRAFT */
    word	PI_draft;
/*  PM_TEXT_NLQ */
    word	PI_nlq;

/*  offset to the table of the font characteristics (geometries) */
/*
 *  offset of the list of font
 *  geometry information
 */
    word	PI_fontGeometries;

/*  offset to the table of the font Symbol Sets (code pages) */
/*
 *  offset of the list of font
 *  Symbol set setting codes
 *  there MUST be at least as
 *  many entries here in each
 *  device info as in the UI rtn.
 */
    word	PI_fontSymbolSets;

/*  margins (defines extent of printable area) */

/*  Tractor (continuous) margins */
    PrinterMargins	PI_marginTractor;
/*  ASF Margins. */
    PrinterMargins	PI_marginASF;

/*  paper path support */

/* paper input selections */
    PaperInputOptions	PI_paperInput;
/* paper Output selections */
    PaperOutputOptions	PI_paperOutput;
/*
 *  width of largest paper size
 *   accepted by the printer.
 *  (in points)
 */
    word	PI_paperWidth;

/*  user interface components to be displayed in the print dialog box */

/*  OD of gentree for main DB */
    optr	PI_mainUI;
/*  OD of gentree for options DB */
    optr	PI_optionsUI;

/*
 *  offset of the eval routine to call to get the data from the generic tree.
 */
    word	PI_evalRoutine;

} PrinterInfo} ;

/* offset to mode table. */
#define PI_firstMode 	(PI_lowRes)

/* ---------------------------------------------------------------------------
 *  GRAPHICS MODE INFO STRUCTURE
 * ---------------------------------------------------------------------------
 *  attributes stored for each graphics mode
 */

typedef struct {		/* CHECKME */
/*  x resolution, dpi */
    word	GP_xres;
/*  y resolution, dpi */
    word	GP_yres;
/*  height of each band */
    byte	GP_bandHeight;
/*  height of each buffer */
    byte	GP_buffHeight;
/*
 *  interleave factor.
 *  offset in scanlines to next
 *  scanline for buffer.
 */
    byte	GP_interleaveFactor;
/*  1,4,8 or 24 bits/pixel */
    byte	GP_colorFormat;

/* pointer to color correction table. */

    word	GP_colorCorrection;
} GraphicsProperties} ;

/* ---------------------------------------------------------------------------
 *  	FONT INFO STRUCTURE
 * ---------------------------------------------------------------------------*/

/*
 *  enum for the more normal pitch modes.  The value stored is actually
 *  10 times the pitch number
 */
typedef ByteEnum TextPitch ;		/* CHECKME */
/*  flag for prop font */
#define TP_PROPORTIONAL 	0x0
/*  5 cpi */
#define TP_5_PITCH 	0x1
/*  6 cpi */
#define TP_6_PITCH 	0x2
/*  10 cpi */
#define TP_10_PITCH 	0x3
/*  10.6 cpi */
#define TP_10_6_PITCH 	0x6a
/*  12 cpi */
#define TP_12_PITCH 	0x6b
/*  15 cpi */
#define TP_15_PITCH 	0x6c
/*  16 cpi */
#define TP_16_PITCH 	0x6d
/*  16.6 cpi */
#define TP_16_6_PITCH 	0xa6
/*  17 cpi */
#define TP_17_PITCH 	0xa7
/*  19.2 cpi */
#define TP_19_2_PITCH 	0xc0
/*  20 cpi */
#define TP_20_PITCH 	0xc1
/*  21.3 cpi */
#define TP_21_3_PITCH 	0xd5
/*  24 cpi */
#define TP_24_PITCH 	0xd6

/*
 *  PrinterSymbolSet
 *  This enum is stored with each font entry in the printer's device
 *  info table to indicate how the upper 128 characters of 8-bit ascii
 *  codes should be translated from the GEOS set to the printer's set.
 *
 *  NOTE: If you add another enumerated type to this table, you MUST
 * 	create a translation table and add it to the spool library.
 * 	See the routine UpdateTranslationTable in the file
 * 	Spool/Lib/libDriver.asm to see how this enum is used,
 * 	and one of the existing resources
 * 	(e.g. Spool/Lib/libIBM8bitTab.asm) for an example of how to
 * 	format the table.  thanks.
 */
/*   */
/* enum PrinterSymbolSet */
typedef enum {		/* CHECKME */
/*  7-bit ascii (no 8 bit codes) */
    PSS_ASCII7     = 0x0,
/*  IBM Code Page 437 set */
    PSS_IBM437     = 0x2,
/*  IBM Code Page 850 set */
    PSS_IBM850     = 0x4,
/*  IBM Code Page 860 set */
    PSS_IBM860     = 0x6,
/*  IBM Code Page 863 set */
    PSS_IBM863     = 0x8,
/*  IBM Code Page 865 set */
    PSS_IBM865     = 0xa,
/*  Roman-8 (HP LaserJet) */
    PSS_ROMAN8     = 0xc,
/*  MS Windows  */
    PSS_WINDOWS     = 0xe,
/*  Ventura (HP LaserJet) */
    PSS_VENTURA     = 0x10,
/*  Latin set (HP LaserJet) */
    PSS_LATIN1     = 0x12,
/*  PCGEOS encoding */
    PSS_PCGEOS     = 0x14,
} PrinterSymbolSet} ;

/*  bits for each type of settable attribute  */

typedef WordFlags PrintTextStyle ;
#define PTS_CONDENSED 	0x8000		/*  bit for condensed mode */
#define PTS_SUBSCRIPT 	0x4000		/*  bit for subscript */
#define PTS_SUPERSCRIPT 	0x2000		/*  bit for superscript */
#define PTS_NLQ 		0x1000		/*  bit for NLQ mode */
#define PTS_BOLD 	0x0800		/*  bit for bold */
#define PTS_ITALIC 	0x0400		/*  bit for italic */
#define PTS_UNDERLINE 	0x0200		/*  bit for underline */
#define PTS_STRIKETHRU 	0x0100		/*  bit for strike-thru */
#define PTS_SHADOW 	0x0080		/*  bit for shadowed */
#define PTS_OUTLINE 	0x0040		/*  bit for outlined */
#define PTS_REVERSE 	0x0020		/*  bit for reversed */
#define PTS_DBLWIDTH 	0x0010		/*  bit for extra wide */
#define PTS_DBLHEIGHT 	0x0008		/*  bit for extra high */
#define PTS_QUADHEIGHT 	0x0004		/*  bit for extra-extra high */
#define PTS_OVERLINE 	0x0002		/*  bit for over score (above) */
#define PTS_FUTURE 	0x0001		/*  bit for future features */

/*
 *  Internal Fonts
 *  This structure is used to build a table of the fonts that are
 *  available on the device.
 */

typedef struct {		/* CHECKME */
/*  value to pass to select font */
    FontID		FE_fontID;
/*  size in points, 0 for any size */
    word		FE_size;
/*  pitch (for non-prop fonts) */
    TextPitch	FE_pitch;
/*  enum to specify char set */
    PrinterSymbolSet	FE_symbolSet;
/*  offset of the control code */
    word	FE_command;
/*  legal style bits */
    PrintTextStyle	FE_styles;
/*  mandatory style bits */
    PrintTextStyle	FE_stylesSet;
} FontEntry} ;

/*
 *  Optional font data used by special print drivers to do *special*
 *  things.......
 *  NOTE: not present in the device specific structures.
 */

typedef struct {
/* RGB values */
    RGBValue	OFE_color;
/* integer space padding. */
    word	OFE_spacePad;
/* trackKerning. */
    sword	OFE_trackKern;
/* custom weight.... */
    byte	OFE_fontWeight;
/* custom weight... */
    byte	OFE_fontWidth;
} OptFontEntry} ;

/*
 *  This structure has a FontID, its size, and a pointer to a table
 *  of pitch values. There is one of these structures for each size
 *  of each available font.
 */

typedef struct {		/* CHECKME */
/* font enum. */
    FontID	FG_fontID;
/* size for this set of pitches */
    word	FG_pointSize;
/* pointer to table of pitches */
    word	FG_pitchTab;
} FontGeometry} ;

/*
 * ___________________________________________________________________________
 *
 *  Enummerated types, and structures used in the general driver info file.
 * ___________________________________________________________________________
 */

/* enum PrinterResend */
typedef enum {		/* CHECKME */
/*  dont resend char. after error. */
    PR_DONT_RESEND     = 0x0,
/*  do resend char. after error. */
    PR_RESEND    ,
} PrinterResend} ;

/*  OVERALL DRIVER INFO HEADER */
typedef struct {		/* CHECKME */
/*  # seconds to set for timeout */
    word	PDI_timeoutValue;
    PrinterResend	PDI_resendOrNot;
/*  ISO substitution char table */
    word	PDI_subISOTable;
/*  lower ascii translation table */
    word	PDI_asciiTransChars;
/*  what type of printer driver */
    PrinterDriverType	PDI_driverType;
/*  what UI should be displayed */
    word	PDI_uiFeatures;
} PrintDriverInfo} ;

/*
 * ___________________________________________________________________________
 *
 * 		PState Structure
 * ___________________________________________________________________________
 */

typedef struct {

/*  device variables */
/*  current printing mode */

    PrinterMode	PS_mode;

/* device enum (defined in each drivers DriverInfo.asm) */
    PrintDevice	PS_device;

/*  technology used by printer. */
    PrinterType	PS_printerType;

/*  printers capabilities. */
    PrinterSmart	PS_printerSmart;

/*  handle ptr to info block */
    word	PS_deviceInfo;

/*  handle ptr to info block */
    word	PS_expansionInfo;

/*  handle to the resource containing the printer fonts. */
    word	PS_fontInfo;

/*  input selections */
    PaperInputOptions 	PS_paperInput;

/*  output selections */
    PaperOutputOptions	PS_paperOutput;

/*  custom paper width */
    word	PS_customWidth;

/*  custom paper height */
    word	PS_customHeight;

/*  margins for this mode. */
    PrinterMargins	PS_currentMargins;

/*  current state variables */
/*  cursor position, points */
    Point	PS_cursorPos;

/*  buffer variables */
/*  handle of working block */
    word	PS_bufHan;

/*  segment of locked working blk */
    word	PS_bufSeg;

/*  size of allocated buffer */
    word	PS_bufSize;

/*  stream variables */
/*  stream interface token */
    word	PS_streamToken;

/*  PrinterPortType enum */
    word	PS_streamType;

/*  far address of i/o driver  */
    dword	PS_streamStrategy;

/*  graphics mode variables */

/*  error flag (0=no error) */
    byte	PS_error;

/*  height of band (scan lines) */
    word	PS_bandHeight;

/* height of band buffer (scan lines) */
    word	PS_buffHeight;

/*  pixel width of swath  */
    word	PS_bandWidth;

/*  byte width of swath  */
    word	PS_bandBWidth;

/* width of internal buffer Huge Bitmap variables */
    word	PS_intWidth;

/*  bitmap header for swath */
    Bitmap 	PS_swath;

/*  VM file and block handle */
    dword	PS_bitmap;

/*  number of interleaves. */
    word	PS_interleaveFactor;

/*  offset to current scan line */
    word	PS_curScanOffset;

/* number of current color in this scanline (from 0-3) */
    word	PS_curColorNumber;

/* new scan line number to be used by the HA stuff */
    word	PS_newScanNumber;

/*  current scan line number */
    word	PS_curScanNumber;

/*  starting scanline number in current block */
    word	PS_firstBlockScanNumber;

/* last scanline number in current block */
    word	PS_lastBlockScanNumber;

/*  text mode variables */
/*  text style bits */
    PrintTextStyle	PS_asciiStyle;

/*  line spacing  */
    word	PS_asciiSpacing;

/*  legal style/pitch combination table.  copied from dev info table */
/*  room for a font description */
    FontEntry	PS_curFont;

/*  rest of TextAttrs copied from GState.*/
    OptFontEntry	PS_curOptFont;

/*  number of the previous attr. */
    word	PS_previousAttribute;

/*  translation table for foreign ascii printing (normal 7-bit ascii) */
/*  room for all of ascii  */
    byte 	PS_asciiTrans[256];

/*  job parameters block. */
/** JobParameters	PS_jobParams; **/

/*
 *  WARNING! - because JobParameters is a variable-sized structure,
 *  using (size PState) is a potentially dangerous thing to do.
 *  You'll want to consult the size field JP_size when determining
 *  the overall size of JobParameters, and hence the PSTate
 */

} PState} ;

/* ------------------------------------------------------------------------------
 *        Internal structure used by the Print Driver UI code.
 * ------------------------------------------------------------------------------
 * this is stuck in the JobParamemters block at offset JP_printerData
 */

typedef struct {		/* CHECKME */
/* from options */
    PaperInputOptions	PUID_paperInput;
/* from main */
    PaperOutputOptions	PUID_paperOutput;
/* from options */
    word    PUID_amountMemory;
/* from options */
    byte    PUID_initMemory;
/* from options */
    byte    PUID_compressionMode;
/* from options */
    PrinterSymbolSet	PUID_symbolSet;
/* from options */
    PrinterCountryCode	PUID_countryCode;
} PrintDriverUIData} ;

/*
 * ___________________________________________________________________________
 *
 * 	Error and status codes
 * ___________________________________________________________________________

/* ---------------------------------------------------------------------------
 * 		Possible Returned Error Codes
 * ---------------------------------------------------------------------------*/

/* enum PrinterError */
typedef enum {		/* CHECKME */
/*  printer timeout error */
    PERROR_TIMEOUT     = 0x0,
/*  printer warming up */
    PERROR_WARMUP     = 0x2,
/*  printer needs servicing */
    PERROR_SERVICE     = 0x4,
/*  paper entry misfeed */
    PERROR_PAPER_MISFEED     = 0x6,
/*  no printer found */
    PERROR_NO_PRINTER     = 0x8,
/*  printer out of toner */
    PERROR_NO_TONER     = 0xa,
/*  printer out of paper */
    PERROR_NO_PAPER     = 0xc,
/*  printer off line */
    PERROR_OFF_LINE     = 0xe,
/*  some serial port error */
    PERROR_SERIAL_ERR     = 0x10,
/*  some parallel port error */
    PERROR_PARALLEL_ERR     = 0x12,
/*  some network error */
    PERROR_NETWORK_ERR     = 0x14,
/*  bogus BUSY condition */
    PERROR_SOME_PROBLEM     = 0x16,
/*
 *  some port error that says
 *   job must be canceled.
 */
    PERROR_FATAL     = 0x18,
/*  file system full */
    PERROR_FILE_SYSTEM_FULL     = 0x1a,
/*  file system error */
    PERROR_FILE_SYSTEM_ERROR     = 0x1c,
} PrinterError} ;

/*  no error detected */
#define PERROR_NO_ERROR 	(08000h)

/* ---------------------------------------------------------------------------
 * 		Possible Returned Status Codes
 * ---------------------------------------------------------------------------*/

/* enum PrinterStatus */
typedef enum {		/* CHECKME */
/*  printer not in use */
    PS_IDLE     = 0x0,
/*  printer in use */
    PS_BUSY     = 0x2,
/*  printer waiting for input */
    PS_WAITING     = 0x4,
/*  printer printing a page */
    PS_PRINTING     = 0x6,
/*  printer in warmup stage */
    PS_WARMING_UP     = 0x8,
} PrinterStatus} ;


Objects\processC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	processC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines ProcessClass
 *
 *      $Id: processC.goh,v 1.26.1.2 96/12/21 23:02:19 allen Exp $
 *
 ***********************************************************************/
@optimize
@deflib ui

@include  <Objects/metaC.goh>

@class	ProcessClass, MetaClass;

@message void MSG_PROCESS_NOTIFY_PROCESS_EXIT (GeodeHandle exitProcess = cx,
                      word exitCode = dx);

@message void MSG_PROCESS_NOTIFY_THREAD_EXIT (ThreadHandle exitProcess = cx,
                     word exitCode = dx);

@message void MSG_PROCESS_MEM_FULL (word type = cx);

@message Boolean MSG_PROCESS_CREATE_UI_THREAD (
            ThreadHandle*	newThread = multipleax,
            ClassStruct*	class = cx:dx,
            word		stackSize = bp) = carry;

@message Boolean MSG_PROCESS_CREATE_EVENT_THREAD (
            ThreadHandle*	newThread = multipleax,
            ClassStruct*	class = cx:dx,
            word		stackSize = bp) = carry;

/*
 *		INTERNAL methods
 */

@message void MSG_PROCESS_INSTANTIATE ();	/* INTERNAL */
@message void MSG_PROCESS_EXIT ();		/* INTERNAL */

@message Boolean MSG_PROCESS_STARTUP_UI_THREAD () = carry;	/* XXX */

@message void MSG_PROCESS_COPY_CHUNK_IN ();	/* XXX */
    /* do not use above, use one of these aliases: */
    @alias (MSG_PROCESS_COPY_CHUNK_IN) ChunkHandle MSG_PROCESS_COPY_CHUNK_IN_FROM_OPTR(@stack MemHandle destBlock, optr source, CopyChunkFlags copyFlags) = ax;
    @alias (MSG_PROCESS_COPY_CHUNK_IN) ChunkHandle MSG_PROCESS_COPY_CHUNK_IN_FROM_FPTR(@stack MemHandle destBlock, void *source, CopyChunkFlags copyFlags) = ax;
    @alias (MSG_PROCESS_COPY_CHUNK_IN) ChunkHandle MSG_PROCESS_COPY_CHUNK_IN_FROM_HPTR(@stack MemHandle destBlock, word srcBlockOffset, MemHandle srcBlock, CopyChunkFlags copyFlags) = ax;

/* macro to extract ChunkHandle and size from return value of the
   following COPY_CHUNK messages */
#define COPY_CHUNK_DWORD_TO_CHUNK (dw) 	((ChunkHandle) ((dw) & 0xffff))
#define COPY_CHUNK_DWORD_TO_SIZE (dw) 	((word) ((dw) >> 16))

@message void MSG_PROCESS_COPY_CHUNK_OVER();	/* XXX */
    /* do not use above, use one of these aliases: */
    @alias (MSG_PROCESS_COPY_CHUNK_OVER) dword MSG_PROCESS_COPY_CHUNK_OVER_OPTR(@stack optr dest, optr source, CopyChunkFlags copyFlags) = cx:ax;
    @alias (MSG_PROCESS_COPY_CHUNK_OVER) dword MSG_PROCESS_COPY_CHUNK_OVER_FPTR(@stack optr dest, void *source, CopyChunkFlags copyFlags) = cx:ax;
    @alias (MSG_PROCESS_COPY_CHUNK_OVER) dword MSG_PROCESS_COPY_CHUNK_OVER_HPTR(@stack optr dest, word srcBlockOffset, MemHandle srcBlock, CopyChunkFlags copyFlags) = cx:ax;

@message void MSG_PROCESS_COPY_CHUNK_OUT();	/* XXX */
    /* do not use above, use one of these aliases: */
    @alias (MSG_PROCESS_COPY_CHUNK_OUT) dword MSG_PROCESS_COPY_CHUNK_OUT_TO_OPTR(@stack optr dest, optr source, CopyChunkFlags copyFlags) = cx:ax;
    @alias (MSG_PROCESS_COPY_CHUNK_OUT) dword MSG_PROCESS_COPY_CHUNK_OUT_TO_FPTR(@stack void *dest, optr source, CopyChunkFlags copyFlags) = cx:ax;
    @alias (MSG_PROCESS_COPY_CHUNK_OUT) dword MSG_PROCESS_COPY_CHUNK_OUT_TO_HPTR(@stack word destBlockOffset, MemHandle destBlock, optr source, CopyChunkFlags copyFlags) = cx:ax;

@message void MSG_PROCESS_FLUSH_PROCESS_QUEUE(); /* XXX */

@message void MSG_PROCESS_FINAL_BLOCK_FREE (Handle block = cx);	/* XXX */

@message void MSG_PROCESS_CALL_ROUTINE(@stack word dataDI, word dataSI, word dataDX, word dataCX, word dataBX, word dataAX, void (*routine)());

@protominor KernelNewForZoomer

/*
 *	NOTE: You will need to construct an optr with the low word being
 *	      the handle of the owning geode to use this method:
 *
 *	    @send ConstructOptr(GeodeGetProcessHandle(),handleOfOwningGeode),
 *	    	MSG_PROCESS_CREATE_EVENT_THREAD_WITH_OWNER(...);
 */
@message void MSG_PROCESS_CREATE_EVENT_THREAD_WITH_OWNER (
            ThreadHandle*	newThread = multipleax,
            ClassStruct*	class = cx:dx,
            word		stackSize = bp) = carry;

@protominor DiscardObjBlock

@message void MSG_PROCESS_OBJ_BLOCK_DISCARD (MemHandle block = cx);

@protoreset

@endc

/*
 * Constants and Structures for copy chunk routines
 */

typedef ByteEnum CopyChunkMode ;
#define CCM_OPTR  0
#define CCM_HPTR  1
#define CCM_FPTR  2
#define CCM_STRING  3

typedef WordFlags CopyChunkFlags ;
#define CCF_DIRTY 	0x8000
#define CCF_MODE 	0x6000
#define CCF_SIZE 	0x1fff
#define CCF_MODE_OFFSET 	13

@endlib


resource.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	resource.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines driver structures and routines.
 *
 *	$Id: resource.h,v 1.17.1.1 96/04/28 08:27:47 chris Exp $
 *
 ***********************************************************************/

#ifndef	__RESOURCE_H
#define __RESOURCE_H

extern MemHandle	/*XXX*/
    _pascal GeodeDuplicateResource (MemHandle mh);

/***/

extern void *
    _pascal ProcGetLibraryEntry (GeodeHandle library, word entryNumber);

/***/

extern dword
    _pascal ProcCallFixedOrMovable_pascal ();

extern 	dword/*XXX*/
    _cdecl ProcCallFixedOrMovable_cdecl ();

/***/

extern void	/*XXX*/
    _pascal GeodeLoadDGroup (MemHandle mh);

/***/

extern optr
    _pascal GeodeGetOptrNS (optr obj);

#define GeodeGetCodeOptrNS (object) \
    ConstructOptr(GeodeGetGeodeResourceHandle(GeodeGetCodeProcessHandle(), \
                     OptrToHandle(object)), \
          OptrToChunk(object))

extern MemHandle
    _pascal GeodeGetGeodeResourceHandle (GeodeHandle geode, word resourceID);

#ifdef __HIGHC__
pragma Alias(GeodeDuplicateResource, "GEODEDUPLICATERESOURCE");
pragma Alias(ProcGetLibraryEntry, "PROCGETLIBRARYENTRY");
pragma Alias(ProcCallFixedOrMovable_pascal, "PROCCALLFIXEDORMOVABLE_PASCAL");
pragma Alias(ProcCallFixedOrMovable_cdecl, "_ProcCallFixedOrMovable_cdecl");
pragma Alias(GeodeLoadDGroup, "GEODELOADDGROUP");
pragma Alias(GeodeGetOptrNS, "GEODEGETOPTRNS");
pragma Alias(GeodeGetGeodeResourceHandle, "GEODEGETGEODERESOURCEHANDLE");
#endif

#endif


Internal\respondr.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1995 -- All Rights Reserved

PROJECT:	Responder
MODULE:		Responder library
FILE:		respondr.goh

AUTHOR:		Steve Jang, Aug  4, 1995

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    SJ	8/ 4/95   	Initial version.

DESCRIPTION:
    CApi for responder library

    $Id: respondr.goh,v 1.2.1.22 98/08/02 19:37:00 jang Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@deflib respondr

/*
  typedef WordEnum ResponderNotificationType;
  the values must correspond to the values of ResponderNotificationType
*/
#define RNT_LID_OPEN             0
#define RNT_LID_CLOSED           1
#define RNT_PHONE_ON 		2
#define RNT_PHONE_OFF 		3
#define RNT_BATT_LO 		4
#define RNT_BATT_OK 		5
#define RNT_SAVE_DATA 		6
#define RNT_WAKEUP 		7
#define RNT_SUSP_DISABLED    	8
#define RNT_SUSP_ENABLED    	9

/*
  mmc status flags: returned by RespGetMmcStatus
  ( these are bit masks )
*/					/*			BITMASK	*/
#define	MASK_MS_CARD			4	/* 1= present 0= absent	  0100b	*/
#define MASK_MS_LID 		2	/* 1= open    0= closed	  0010b	*/
#define MASK_MS_COVER 		1	/* 1= open    0= closed	  0001b	*/

typedef void _pascal RespNmiNotifyRoutine ( word notif );
/*
  The callback routine to be called by responder library when NMI happens
  Pass:   notif = ResponderNotificationType
*/

extern _pascal int RespRegisterForNmi ( RespNmiNotifyRoutine *callback );
/*
  Register a callback to recieve NMI notifications
  pass:   callback = client callback
  return: registration ID
          return value = 0 if error occured
*/

extern _pascal void RespUnregisterForNmi ( word client );
/*
  Unregister a client callback from NMI notification list
  pass:   client = registration ID for the client
*/

extern _pascal void RespDisableSusp (void);
/*
  Disables machine suspend
*/

extern _pascal void RespEnableSusp (void);
/*
  Enables machine suspend
*/

/* typedef WordEnum ResponderBatteryEvent; */
#define RBE_BATTERY_LOW       0x00
#define RBE_BATTERY_OK        0x02
#define RBE_RECHARGE_START    0x04
#define RBE_RECHARGE_END      0x06

extern _pascal void RespNotifyBatteryStatus ( word battStat );
/*
  Notify power driver of battery event
  battStat: ResponderBatteryEvent
*/

extern _pascal int RespGetPhoneModuleStatus (void);
/*
  Get current status of phone module
  returns -1 if phone is on
  returns 0 if phone is off
*/

extern _pascal void RespSetPhoneModuleStatus (void);
/*
  Turns phone module on
*/

extern _pascal int RespGetLidStatus (void);
/*
  Get current status of lid
  returns -1 if lid is open
  returns 0 if lid is closed
*/

extern _pascal void RespReloadSuspTimer (void);
/*
  Reload suspend timer to initial value
*/

extern _pascal Boolean RespGetCMOSBatteryStatus (void);
/*
 * Returns non-zero if CMOS values (RTC clock) are not valid, because the
 * battery was/is dead.
 */

extern _pascal int RespReadRTCCMOS (int address);
/*
 * Reads the value in RTC CMOS RAM
 */

extern _pascal int RespWriteRTCCMOS (int address, int data);
/*
 * Writes the value in RTC CMOS RAM
 */

extern _pascal void RespDriveRBUS (void);
/*
 * Activate the RBUS TxD line (the line now gets driven by the chip)
 */

extern _pascal void RespSetBacklightState (Boolean state);
/*
 * Turn on or off the backlight. True to turn it on, False for off.
 */

extern _pascal int RespGetBacklightState (void);
/*
 * Returns current state of backlight.
 *     non-zero if on, zero if off
 */

extern _pascal int RespGetMmcDrive (void);
/*
 * Get 0 based drive number for MMC card
 */

extern _pascal int RespGetMmcStatus (void);
/*
 * Get status of mmc hardware.
 * Returns a bit mask containing:
 * 	MASK_MS_CARD, MASK_MS_LID, MASK_MS_COVER ( defined above )
 */

extern _pascal void RespMmcEvent ( int status );
/*
 * Simulate cover opening/closing, card insertion/removal
 *
 * NOTE:
 *   On prototypes, card presence is checked from HW so card insertion/removal
 *   flag is ignored.
 *
 * status	= use masks defined for RespGetMmcStatus
 *                namely MASK_MS_CARD, MASK_MS_COVER
 *
 * returns nothing
 *
 */

#define MMC_NOT_PRESENT 		0x00
#define	MMC_FORMATTED	 		0x01
#define MMC_UNFORMATTED  	0x02

extern _pascal int RespMmcCheckFormat (void);
/*
 * Check whether the card in slot is formatted
 *
 * Returns:
 *     0 card is not in the slot( same as MMC_NOT_PRESENT )
 *     otherwise returns MMC_FORMATTED or MMC_UNFORMATTED
 *
 */

extern _pascal int RespGetMmcName (char *buf, int *bufSize);
/*
 * Get name of mmc card
 *
 * returns 0 and contents of bufSize changed to 0
 *           this means that card is not in slot or cover is open
 *
 * returns 0 and contents of bufSize is non-zero
 *	     this means buffer is not big enough
 *
 * returns non-zero if buffer was successfully filled with name
 *
 */

extern _pascal int RespSetMmcName (char *buf, int bufSize);
/*
 * Set name of mmc card
 *
 * returns 0 if cannot access mmc card
 *
 * returns non-zero if successfully updated name
 */

extern _pascal DiskHandle RespGetMmcDisk (void);
/*
 * Get disk handle of mmc card ( A:\ )
 *
 * returns 0 if failed to get disk handle
 *
 * otherwise returns disk handle
 *
 */

extern _pascal DiskHandle RespGetRealDisk ( word hdisk, char *buffer );
/*
 * Given a file path representation( StandardPath + partial path string ),
 * return disk handle of the disk where the file reside.
 *
 * PASS:	hdisk  = disk handle ( or StandardPath )
 *		buffer = ptr to a null terminated partial path
 *
 * RETURN:	returns a disk handle
 */

extern _pascal DiskHandle RespGetMainDisk (void);
/*
 * Get disk handle of main disk
 *
 * returns disk handle
 *
 */

#define MMC_CIN_LENGTH 		12		; MMC cards have 96-bit ID
extern _pascal int RespGetMmcCIN ( byte *buffer );
/*
 * Return unique card id number for mmc card in the slot
 * ( buffer size must be at least MMC_CIN_LENGTH )
 *
 * returns 0 if MMC card is not accessible
 *    otherwise the buffer is filled in with 96-bit Card Id number
 *
 */

extern _pascal int RespCheckMmcPath ( word hdisk, char *buffer );
/*
 *
 * Given a file path representation( StandardPath + partial path string ),
 * check whether the file is on MMC card or on Maindisk
 *
 * PASS:	hdisk  = disk handle ( or StandardPath )
 *		buffer = ptr to a null terminated partial path
 *
 * RETURN:	0 if the file is not on MMC
 *		-1 if the file is on MMC
 */

typedef ByteEnum PDAType ;
#define PDAT_PC_EMULATOR 	0x0
#define PDAT_N9000 		0x1
#define PDAT_N9000i 		0x2
#define PDAT_N9110 		0x3

typedef ByteFlags PDAHardwareInfo ;
/* 5 bits unused */
#define PDAHI_BACKLIGHT_AVAILABLE 	(0x04)
#define PDAHI_PDA_TYPE 			(0x02 | 0x01)	; = PDAType

extern _far _pascal PDAHardwareInfo RespGetPDAHardwareInfo (void);
/*
 * Gets the PDA Hardware info.
 */

#ifdef __HIGHC__
pragma Alias(RespRegisterForNmi, "RESPREGISTERFORNMI");
pragma Alias(RespUnregisterForNmi, "RESPUNREGISTERFORNMI");
pragma Alias(RespDisableSusp, "RESPDISABLESUSP");
pragma Alias(RespEnableSusp, "RESPENABLESUSP");
pragma Alias(RespNotifyBatteryStatus, "RESPNOTIFYBATTERYSTATUS");
pragma Alias(RespGetPhoneModuleStatus, "RESPGETPHONEMODULESTATUS");
pragma Alias(RespSetPhoneModuleStatus, "RESPSETPHONEMODULESTATUS");
pragma Alias(RespGetLidStatus, "RESPGETLIDSTATUS");
pragma Alias(RespReloadSuspTimer, "RESPRELOADSUSPTIMER");
pragma Alias(RespGetCMOSBatteryStatus, "RESPGETCMOSBATTERYSTATUS");
pragma Alias(RespReadRTCCMOS, "RESPREADRTCCMOS");
pragma Alias(RespWriteRTCCMOS, "RESPWRITERTCCMOS");
pragma Alias(RespDriveRBUS, "RESPDRIVERBUS");
pragma Alias(RespSetBacklightState, "RESPSETBACKLIGHTSTATE");
pragma Alias(RespGetPDAHardwareInfo, "RESPGETPDAHARDWAREINFO");
pragma Alias(RespGetMmcDrive, "RESPGETMMCDRIVE");
pragma Alias(RespGetMmcStatus, "RESPGETMMCSTATUS");
pragma Alias(RespGetMmcName, "RESPGETMMCNAME");
pragma Alias(RespSetMmcName, "RESPSETMMCNAME");
pragma Alias(RespGetMmcDisk, "RESPGETMMCDISK");
pragma Alias(RespGetBacklightState, "RESPGETBACKLIGHTSTATE");
pragma Alias(RespMmcEvent, "RESPMMCEVENT");
pragma Alias(RespMmcCheckFormat, "RESPMMCCHECKFORMAT");
pragma Alias(RespGetMmcCIN, "RESPGETMMCCIN");
pragma Alias(RespGetMainDisk, "RESPGETMAINDISK");
pragma Alias(RespGetRealDisk, "RESPGETREALDISK");
pragma Alias(RespCheckMmcPath, "RESPCHECKMMCPATH");
#endif

@endlib


Internal\rspcolor.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1995 -- All Rights Reserved
 *			GEOWORKS CONFIDENTIAL
 *
 * PROJECT:	GEOS
 * FILE:	rspcolor.h
 *
 *
 * REVISION HISTORY:
 *
 *	Name	Date		Description
 *	----	----		-----------
 *	atw	4/ 6/95		Initial revision
 *
 *
 * DESCRIPTION:
 *	Responder color values
 *
 *	$Id: rspcolor.h,v 1.2.1.4 98/06/01 12:37:50 jwu Exp $
 *
 ***********************************************************************/
#ifndef	_RSPCOLOR_H
#define _RSPCOLOR_H

typedef ByteEnum RespColor ;
#define RC_BLACK  	0 		/*black color index*/
#define RC_GRAY_7 	1 		/*looks like dark blue on VGA*/
#define RC_GRAY_13 	2 		/*looks like dark green on VGA*/
#define RC_GRAY_20 	3 		/*looks like dark cyan on VGA*/
#define RC_GRAY_27 	4 		/*looks like dark red on VGA*/
#define RC_GRAY_33 	5 		/*looks like dark violet on VGA*/
#define RC_GRAY_40 	6 		/*looks like brown  on VGA*/
#define RC_GRAY_47 	7 		/*looks like light gray on VGA*/
#define RC_GRAY_53 	8 		/*looks like dark gray on VGA*/
#define RC_GRAY_60 	9 		/*looks like light blue on VGA*/
#define RC_GRAY_68 	10 		/*looks like light green on VGA*/
#define RC_GRAY_73 	11		/*looks like light cyan on VGA*/
#define RC_GRAY_80 	12 		/*looks like light red on VGA*/
#define RC_GRAY_88 	13 		/*looks like light violet on VGA*/
#define RC_GRAY_93 	14 		/*looks like yellow on VGA*/
#define RC_WHITE  	15 		/*white color index*/

#define RC_GREY_7 	1 		/*looks like dark blue on VGA*/
#define RC_GREY_13 	2 		/*looks like dark green on VGA*/
#define RC_GREY_20 	3 		/*looks like dark cyan on VGA*/
#define RC_GREY_27 	4 		/*looks like dark red on VGA*/
#define RC_GREY_33 	5 		/*looks like dark violet on VGA*/
#define RC_GREY_40 	6 		/*looks like brown  on VGA*/
#define RC_GREY_47 	7 		/*looks like light gray on VGA*/
#define RC_GREY_53 	8 		/*looks like dark gray on VGA*/
#define RC_GREY_60 	9 		/*looks like light blue on VGA*/
#define RC_GREY_68 	10 		/*looks like light green on VGA*/
#define RC_GREY_73 	11		/*looks like light cyan on VGA*/
#define RC_GREY_80 	12 		/*looks like light red on VGA*/
#define RC_GREY_88 	13 		/*looks like light violet on VGA*/
#define RC_GREY_93 	14 		/*looks like yellow on VGA*/

#define RC_LIGHT_GRAY 	11
#define RC_DARK_GRAY 	9

#define RC_LIGHT_GREY 	11
#define RC_DARK_GREY 	9

#endif /* _RSPCOLOR_H */


rtcm.goh

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1994 -- All Rights Reserved
 *	GEOWORKS CONFIDENTIAL
 *
 * PROJECT:	  PCGEOS
 * MODULE:	  RTCM lib
 * FILE:	  rtcm.h
 *
 * AUTHOR:  	  Chris Thomas: Oct 10, 1994
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	CT	10/10/94   	Initial version
 *
 * DESCRIPTION:
 *	The C API for the Real Time Clock Manager
 *
 *
 * 	$Id: rtcm.goh,v 1.6.1.1 96/04/28 08:30:11 chris Exp $
 *
 ***********************************************************************/
#ifndef _RTCM_H_
#define _RTCM_H_

@deflib	rtcm

#include  <geode.h>
#include  <timer.h>

/* ----------------------------------------------------------------------------
 * 		Constants & Enumerated Types
 * --------------------------------------------------------------------------*/

typedef enum {
    RTCMGLM_APPLICATION     = 0x0,
    RTCMGLM_ENGINE     = 0x2,
    RTCMGLM_DRIVER     = 0x4,
    RTCMGLM_LIBRARY     = 0x6,
    RTCMGLM_APPLICATION_IN_BACK     = 0x8,
} RTCMGeodeLaunchMode} ;

typedef enum {
    RTCME_OK     = 0x0,
    RTCME_EVENT_NOT_FOUND     = 0x2,
    RTCME_REGISTER_FAILED     = 0x4,
    RTCME_INVALID_EVENT     = 0x6,
} RTCMError} ;

#define ANY_YEAR    0
#define ANY_MONTH   0
#define ANY_DAY     0

#define ANY_DATE  ((ANY_YEAR << TCD_YEAR_OFFSET) | \
          (ANY_MONTH << TCD_MONTH_OFFSET) | \
          (ANY_DAY << TCD_DAY_OFFSET))

#define ANY_HOUR    0xffff
#define ANY_MINUTE  0xffff

#define WHEN_DATE_TIME_CHANGE   (15 << TCD_MONTH_OFFSET)

/* -----------------------------------------------------------------------------
 * 		Exported Routines
 * -----------------------------------------------------------------------------*/

@prototype void RTCM_EVENT_MSG  (unsigned int eventToken = cx,
                unsigned int eventID = dx,
                Boolean expired = bp);

#ifdef __BORLANDC__
#define RTCMRegisterEvent  RTCMREGISTEREVENT
#endif

extern RTCMError
    _cdecl RTCMRegisterEvent (TimerCompressedDate date,
                 unsigned int hour,
                 unsigned int minute,
                 word eventMsg,
                 RTCMGeodeLaunchMode mode,
                 GeodeToken geodeToken,
                 char *geodePath,
                 unsigned int *eventToken,
                 unsigned int *eventID);

extern RTCMError
    _pascal RTCMUnregisterEvent (unsigned int eventToken,
                unsigned int eventID);

extern RTCMError
    _pascal RTCMCheckEvent (unsigned int eventToken,
               unsigned int eventID);

#ifdef __HIGHC__

pragma Alias(RTCMRegisterEvent, "RTCMREGISTEREVENT");
pragma Alias(RTCMUnregisterEvent, "RTCMUNREGISTEREVENT");
pragma Alias(RTCMCheckEvent, "RTCMCHECKEVENT");

#endif /* __HIGHC__ */

@endlib

#endif /* _RTCM_H_ */


ruler.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:     PC GEOS
 * FILE:        ruler.goh
 * AUTHOR:      Anna Lijphart: January, 1992
 *
 * DESCRIPTION:
 *	C version of ruler.def
 *
 *      $Id: ruler.goh,v 1.11 93/12/05 18:32:49 dubois Exp $
 *
 ***********************************************************************/
@optimize
#ifndef __RULERC_GOH
#define __RULERC_GOH

@deflib    ruler

#include  <geos.h>
#include  <graphics.h>

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %		Types and Constants
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

 /* default # of pixels within which guidelines are active */
#define DEFAULT_GUIDE_INFLUENCE 	10

#define VIS_RULER_HEIGHT 	10
#define MAX_TICK_HEIGHT 		8

 /* = 65536/2 * root 2 */
#define HALF_ROOT_2 		46341

typedef ByteFlags GridOptions ;					/* XXX */
#define GO_SHOW_GRID 	0x80
#define GO_SNAP_TO_GRID 	0x40
/* 6 bits unused */

typedef ByteFlags VisRulerAttributes ;				/* XXX */
#define VRA_IGNORE_ORIGIN 	0x80
#define VRA_SHOW_GUIDES 		0x40
#define VRA_SHOW_GRID  		0x20
#define VRA_SHOW_MOUSE  		0x10
#define VRA_HORIZONTAL  		0x08
#define VRA_MASTER  		0x04
/* 2 bits unused */

typedef WordFlags VisRulerConstrainStrategy ;			/* XXX */
#define VRCS_OVERRIDE 				0x8000
/* 1 bit unused */
#define VRCS_SET_REFERENCE 			0x2000
#define VRCS_SNAP_TO_GRID_X_ABSOLUTE 		0x1000
#define VRCS_SNAP_TO_GRID_Y_ABSOLUTE 		0x0800
#define VRCS_SNAP_TO_GRID_X_RELATIVE 		0x0400
#define VRCS_SNAP_TO_GRID_Y_RELATIVE 		0x0200
#define VRCS_SNAP_TO_GUIDES_X 			0x0100
#define VRCS_SNAP_TO_GUIDES_Y 			0x0080
#define VRCS_CONSTRAIN_TO_HORIZONTAL_AXIS 	0x0040
#define VRCS_CONSTRAIN_TO_VERTICAL_AXIS 		0x0020
#define VRCS_CONSTRAIN_TO_UNITY_SLOPE_AXIS 	0x0010
#define VRCS_CONSTRAIN_TO_NEGATIVE_UNITY_SLOPE_AXIS 	0x0008
#define VRCS_CONSTRAIN_TO_VECTOR 		0x0004
#define VRCS_CONSTRAIN_TO_VECTOR_REFLECTION 	0x0002
#define VRCS_INTERNAL 				0x0001

#define VRCS_SNAP_TO_GRID_ABSOLUTE  \
(VRCS_SNAP_TO_GRID_X_ABSOLUTE | VRCS_SNAP_TO_GRID_Y_ABSOLUTE)

#define VRCS_SNAP_TO_GRID_RELATIVE  \
(VRCS_SNAP_TO_GRID_X_RELATIVE | VRCS_SNAP_TO_GRID_Y_RELATIVE)

#define VRCS_SNAP_TO_GUIDES  \
(VRCS_SNAP_TO_GUIDES_X | VRCS_SNAP_TO_GUIDES_Y)

#define VRCS_SNAP_FLAGS  \
(VRCS_SNAP_TO_GRID_ABSOLUTE | VRCS_SNAP_TO_GRID_RELATIVE | VRCS_SNAP_TO_GUIDES)

#define VRCS_CONSTRAIN_TO_HV_AXES  \
(VRCS_CONSTRAIN_TO_HORIZONTAL_AXIS | VRCS_CONSTRAIN_TO_VERTICAL_AXIS)

#define VRCS_CONSTRAIN_TO_DIAGONALS  \
(VRCS_CONSTRAIN_TO_UNITY_SLOPE_AXIS | \
 VRCS_CONSTRAIN_TO_NEGATIVE_UNITY_SLOPE_AXIS)

#define VRCS_VECTOR_CONSTRAIN  \
(VRCS_CONSTRAIN_TO_VECTOR | VRCS_CONSTRAIN_TO_VECTOR_REFLECTION)

#define VRCS_CONSTRAIN_FLAGS  \
(VRCS_CONSTRAIN_TO_HV_AXES | VRCS_CONSTRAIN_TO_DIAGONALS | \
 VRCS_VECTOR_CONSTRAIN)

#define VRCS_MOUSE_TWEAKING_FLAGS  \
(VRCS_SNAP_FLAGS | VRCS_CONSTRAIN_FLAGS)

 /* Constants for VisRulerType ByteEnum */
#define CUSTOM_RULER_DEFINITION 	0xfd
#define NO_RULERS 		0xfe
#define SYSTEM_DEFAULT 		0xff

typedef ByteEnum VisRulerType ;					/* XXX */
#define VRT_INCHES 		0x0
#define VRT_CENTIMETERS 		0x1
#define VRT_POINTS 		0x2
#define VRT_PICAS 		0x3
#define VRT_CUSTOM 		CUSTOM_RULER_DEFINITION
#define VRT_NONE 		NO_RULERS
#define VRT_DEFAULT 		SYSTEM_DEFAULT

typedef struct {						/* XXX */
    WWFixed	G_x;		/* Pixels between horizontal gridlines */
    WWFixed	G_y;		/* Pixels between vertical gridlines */
} Grid} ;

typedef struct {						/* XXX */
    DWFixed	Guide_location;
} Guide} ;

typedef ByteEnum MinUSMeasure ;					/* XXX */
#define MUSM_EIGHTH_INCH 	0x0
#define MUSM_QUARTER_INCH 	0x1
#define MUSM_HALF_INCH 		0x2
#define MUSM_ONE_INCH 		0x3

typedef ByteEnum MinMetricMeasure ;				/* XXX */
#define MMM_MILLIMETER 		0x0
#define MMM_HALF_CENTIMETER 	0x1
#define MMM_CENTIMETER 		0x2

typedef ByteEnum MinPointMeasure ;				/* XXX */
#define MPM_25_POINT 		0x0
#define MPM_50_POINT 		0x1
#define MPM_100_POINT 		0x2

typedef ByteEnum MinPicaMeasure ;				/* XXX */
#define MPM_PICA 		0x0
#define MPM_INCH 		0x1

typedef union {							/* XXX */
   MinUSMeasure		MIT_US;
   MinMetricMeasure	MIT_METRIC;
   MinPointMeasure	MIT_POINT;
   MinPicaMeasure	MIT_PICA;
} MinIncrementType} ;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %		Classes
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 *	UI CONTROLLERS
 */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %	RulerTypeControlClass
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*
 * GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */
@class  RulerTypeControlClass, GenControlClass;

/*
 *	Sent from the "RulerType" list on any change
 */
@message void MSG_RTC_TYPE_CHANGE (VisRulerType rulerType = cl);	/* XXX */

typedef WordFlags RTCFeatures ;					/* XXX */
/* 10 bits unused */
#define RTCF_DEFAULT 		(0x20)
#define RTCF_SPREADSHEET 	(0x10)
#define RTCF_INCHES 		(0x08)
#define RTCF_CENTIMETERS 	(0x04)
#define RTCF_POINTS 		(0x02)
#define RTCF_PICAS 		(0x01)

typedef struct RulerTypeNotificationBlock  {			/* XXX */
    VisRulerType	RTNB_type;
} RulerTypeNotificationBlock} ;

typedef WordFlags RTCToolboxFeatures ;				/* XXX */
/* 10 bits unused */
#define RTCTF_DEFAULT 		(0x20)
#define RTCTF_SPREADSHEET 	(0x10)
#define RTCTF_INCHES 		(0x08)
#define RTCTF_CENTIMETERS 	(0x04)
#define RTCTF_POINTS 		(0x02)
#define RTCTF_PICAS 		(0x01)

#define RTC_DEFAULT_FEATURES  \
(RTCF_INCHES | RTCF_CENTIMETERS | RTCF_POINTS | RTCF_PICAS | RTCF_DEFAULT)

#define RTC_DEFAULT_TOOLBOX_FEATURES  (RTCF_INCHES | RTCF_CENTIMETERS)

    @default GCI_output = (TO_APP_TARGET);

@endc	/* RulerTypeControlClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %	GuideCreateControlClass
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*
 * GenApplication GCN lists to be placed on:
 *	GAGCNLT_SELF_LOAD_OPTIONS
 */
@class  GuideCreateControlClass, GenControlClass;

/*
 *	Create a guide
 */
@message void MSG_GCC_CREATE_VERTICAL_GUIDELINE ();		/* XXX */
@message void MSG_GCC_CREATE_HORIZONTAL_GUIDELINE ();		/* XXX */

typedef WordFlags GCCFeatures ;					/* XXX */
/* 14 bits unused */
#define GCCF_HORIZONTAL_GUIDES 	(0x02)
#define GCCF_VERTICAL_GUIDES 	(0x01)

#define GCC_DEFAULT_FEATURES  \
(GCCF_HORIZONTAL_GUIDES | GCCF_VERTICAL_GUIDES)

#define GCC_DEFAULT_TOOLBOX_FEATURES  (0)

    @default GCI_output = (TO_APP_TARGET);

@endc	/* GuideCreateControlClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %	RulerGuideControlClass
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

typedef struct {
    LMemBlockHeader	VRNGCBH_header;
    word		VRNGCBH_vertGuideArray;
    word		VRNGCBH_horizGuideArray;
} VisRulerNotifyGuideChangeBlockHeader} ;

@class  RulerGuideControlClass, GenControlClass;

@message void MSG_RGC_SELECT_GUIDE 				/* XXX */
    (word guideIndex = cx,
     GenItemGroupStateFlags stateFlags = dx,
     word numSelections = bp);
@message void MSG_RGC_QUERY_GUIDE 				/* XXX */
    (optr list = cx:dx, word itemNum = bp);
@message void MSG_RGC_DELETE_GUIDE ();				/* XXX */
@message void MSG_RGC_UPDATE_UI 					/* XXX */
    (GenControlUpdateUIParams _far *ptr = ss:bp);

typedef WordFlags RulerGuideControlFeatures ;			/* XXX */
/* 12 bits unused */
#define RGCF_HV 		(0x08)
#define RGCF_LIST 	(0x04)
#define RGCF_POSITION 	(0x02)
#define RGCF_DELETE 	(0x01)

#define RULER_GUIDE_CONTROL_DEFAULT_FEATURES  \
(RGCF_HV | RGCF_LIST | RGCF_POSITION | RGCF_DELETE)

    @default GCI_output = (TO_APP_TARGET);
    @default GII_type = GII_PROPERTIES;
    @default GII_visibility = GIV_DIALOG;

    @instance Handle		RGCI_dataBlock = NullHandle;
    @instance VisRulerType	RGCI_rulerType = 0;

@endc	/* RulerGuideControlClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %	RulerGridControlClass
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

typedef struct {
    WWFixed	RGNB_gridSpacing;
    GridOptions	RGNB_gridOptions;
} RulerGridNotificationBlock} ;

@class  RulerGridControlClass, GenControlClass;

/*
 *	Set the grid spacing.
 * 	PASS:	spacing		- horizontal and vertical grid spacing
 */
@message void MSG_RGC_SET_GRID_SPACING (WWFixed points = dx.cx);	/* XXX */

/*
 * 	Set the grid spacing based on the UI.
 *
 *  Pass:	opts	- These flags will replace the current GridOptions
 */
@message void MSG_RGC_SET_GRID_OPTIONS (GridOptions opts = cl);	/* XXX */

typedef WordFlags RGCFeatures ;					/* XXX */
/* 13 bits unused */
#define RGCF_GRID_SPACING 	(0x04)
#define RGCF_SNAP_TO_GRID 	(0x02)
#define RGCF_SHOW_GRID 		(0x01)

#define RGC_DEFAULT_FEATURES  \
(RGCF_GRID_SPACING | RGCF_SNAP_TO_GRID | RGCF_SHOW_GRID)

#define RGC_DEFAULT_TOOLBOX_FEATURES  (0)

    @default GCI_output = (TO_APP_TARGET);

@endc	/* RulerGridControlClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %	RulerShowControlClass
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*
 *  This controller *does not* get notifications from the text rulers.  The
 *  controller maintains the state.
 *
 *  Message(s) sent out:
 *  The message in RSCI_message is sent out when changes are made.
 *  The objects that are to receive this message need to be on the active
 *  list specifed in RSCI_gcnList (default GAGCNLT_DISPLAY_OBJECTS_WITH_RULERS)
 *  For example, your GenDisplay class could add displays to this list on:
 * 	MSG_SPEC_BUILD_BRANCH
 * 	MSG_VIS_OPEN
 *  and remove them on:
 * 	MSG_SPEC_UNBUILD_BRANCH
 * 	MSG_VIS_CLOSE
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */
@class  RulerShowControlClass, GenControlClass;

/*----------------------------------------------------------------------
 *		Methods
 *----------------------------------------------------------------------*/

/*----------------------------------------------------------------------
 * 		Internal methods
 *----------------------------------------------------------------------*/

@message void MSG_RSCC_CHANGE_STATE 				/* XXX */
    (RulerShowControlAttributes flags = cx);
/*----------------------------------------------------------------------
 *		Hints
 *----------------------------------------------------------------------*/

/*----------------------------------------------------------------------
 * 		Constants & Structures
 *----------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */

typedef WordFlags RSCCFeatures ;					/* XXX */
/* 13 bits unused */
#define RSCCF_SHOW_VERTICAL 	(0x04)
#define RSCCF_SHOW_HORIZONTAL 	(0x02)
#define RSCCF_SHOW_RULERS 	(0x01)

/*
 *  Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */

typedef WordFlags RSCCToolboxFeatures ;
/* 16 bits unused */

#define RSCC_DEFAULT_FEATURES 	(RSCCF_SHOW_VERTICAL | RSCCF_SHOW_HORIZONTAL)
#define RSCC_DEFAULT_TOOLBOX_FEATURES 	(0)

/* ----------------------------------------------------------------------
 * 		Instance Data
 * ----------------------------------------------------------------------*/

typedef WordFlags RulerShowControlAttributes ;
#define RSCA_SHOW_VERTICAL 	0x8000
#define RSCA_SHOW_HORIZONTAL 	0x4000
/* 14 bits unused */

    @instance RulerShowControlAttributes RSCI_attrs =
    (RSCA_SHOW_VERTICAL | RSCA_SHOW_HORIZONTAL);

    @instance GCNListType	RSCI_gcnList =
    {MANUFACTURER_ID_GEOWORKS,
     GAGCNLT_DISPLAY_OBJECTS_WITH_RULERS};
    /* objects to notify */

    @instance Message		RSCI_message = 0;
    /* message to notify with */
    /* pass: cx - RulerShowControlAttributes */

@prototype void RULER_SHOW_CONTROL_NOTIFY
    (RulerShowControlAttributes attrs = cx);

    @default GCI_output = (TO_APP_TARGET);
    @default GI_states = (@default | GS_ENABLED);

@endc	/* RulerShowControlClass */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %	VisRulerClass
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@class  VisRulerClass, VisClass;
/*----------------------------------------------------------------------
 *		Methods and prototypes
 *----------------------------------------------------------------------*/

/*
 * This prototype is used for the snap messages
 */
@prototype void VIS_RULER_SNAP (PointDWFixed _far* point=ss:bp);

/*
 * This prototype is used for messages that take a PointDWFixed on the
 * stack (but do not alter it).
 */
@prototype void VIS_RULER_POINT
    (@stack sdword yInt, word yFrac, sdword xInt, word xFrac);

/*
 * This prototype is used for messages that take a DWFixed on the stack
 * (but do not alter it).
 */
@prototype void VIS_RULER_DWFIXED				/* XXX */
    (@stack sdword dwfInt, word dwfFrac);

/*
 * 	Notify the ruler that its ruled object is "selected" and that the
 * 	ruler should update the UI to reflect its own attributes
 *
 * 	Also registers the passed invalAD as the AD it should send out
 * 	whenever the ruled object needs to redraw itself (as a result
 * 	of a change in grid spacing, addition of a guideline, etc.)
 *
 * 	PASS:		dest = Object to send inval messages to
 */
@message void MSG_VIS_RULER_GAINED_SELECTION 			/* XXX */
    (optr dest = cx:dx);

/*
 * 	Notify the ruler that its ruled object is no longer "selected".
 */
@message void MSG_VIS_RULER_LOST_SELECTION ();			/* XXX */

@message void MSG_VIS_RULER_UPDATE_CONTROLLERS ();		/* XXX */
@message void MSG_VIS_RULER_UPDATE_TYPE_CONTROLLER ();		/* XXX */
@message void MSG_VIS_RULER_UPDATE_GRID_CONTROLLER ();		/* XXX */
@message void MSG_VIS_RULER_UPDATE_GUIDE_CONTROLLER ();		/* XXX */
@message void MSG_VIS_RULER_COMBINE_GUIDE_INFO 			/* XXX */
    (MemHandle data = cx);

@message void MSG_VIS_RULER_RULE_LARGE_PTR ();			/* XXX */
/* Doesn't work -- Kernel can't pass stack and register args at the same time. */
/* (PointDWFixed _far *point = ss:bp, VisRulerConstrainStrategy strat = cx); */

/*
 *  Set type of ruler (eg. inches, centimeters)
 *
 * 	PASS:	VisRulerType type
 */
@message void MSG_VIS_RULER_SET_TYPE (VisRulerType type = cl);	/* XXX */

/*
 *  Get type of ruler (eg. inches, centimeters)
 *
 * 	RETURN:	VisRulerType
 */
@message VisRulerType MSG_VIS_RULER_GET_TYPE () = cl;		/* XXX */

/*
 * 	Get default constrain strategy for the ruler
 *
 * 	RETURN:		VisRulerConstrainStrategy
 */
@message VisRulerConstrainStrategy
    MSG_VIS_RULER_GET_CONSTRAIN_STRATEGY    () = cx;		/* XXX */

/*
 * 	Set default constrain strategy for the ruler
 *
 * 	PASS:	setflags	- flags to set
 *		clearflags	- flags to clear
 * 	RETURN:	none
 */
@message void MSG_VIS_RULER_SET_CONSTRAIN_STRATEGY 		/* XXX */
    (VisRulerConstrainStrategy setflags = cx,
     VisRulerConstrainStrategy clearflags = dx);

/*
 * 	Set the "ignore origin" state
 *
 * 	PASS:	ignore	- non-FALSE to ignore the origin.
 */
@message void MSG_VIS_RULER_SET_IGNORE_ORIGIN (Boolean ignore = cx); /* XXX */

/*
 * 	Draw the mouse tick in the ruler on ptr events
 */
@message void MSG_VIS_RULER_SHOW_MOUSE ();			/* XXX */

/*
 * 	Don't dnraw the mouse tick in the ruler on ptr events
 */
@message void MSG_VIS_RULER_HIDE_MOUSE ();			/* XXX */

/*
 * 	Draw a line on the ruler indicating the mouse position
 *
 * 	PASS:	point	- PointDWFixed location of mouse
 */
@message(VIS_RULER_POINT) MSG_VIS_RULER_DRAW_MOUSE_TICK;

/*
 * 	Set the default VisRulerConstrainStrategy to include grid snapping ""
 */
@message void MSG_VIS_RULER_TURN_GRID_SNAPPING_ON ();		/* XXX */

/*
 * 	Set the default VisRulerConstrainStrategy to not include grid snapping ""
 */
@message void MSG_VIS_RULER_TURN_GRID_SNAPPING_OFF ();		/* XXX */

/*
 * 	Set the default VisRulerConstrainStrategy to include guides snapping ""
 */
@message void MSG_VIS_RULER_TURN_GUIDES_SNAPPING_ON ();		/* XXX */

/*
 * 	Set the default VisRulerConstrainStrategy to not include guides snapping ""
 */
@message void MSG_VIS_RULER_TURN_GUIDES_SNAPPING_OFF ();		/* XXX */

/*
 *  Set minimum increment (eg. 1/8",1/4",1/2",1")
 *
 * 	PASS: 	type		- MinIncrementType
 */
@message void MSG_VIS_RULER_SET_MIN_INCREMENT 			/* XXX */
    (MinIncrementType min = cl);

/*
 *  Set scale factor
 *
 * 	PASS:	ss:bp - ScaleChangedParams
 * 	RETURN:	none
 */
@message void MSG_VIS_RULER_VIEW_SCALE_FACTOR_CHANGED		/* XXX */
    (@stack WindowHandle viewWindow,
     WWFixedAsDWord yScaleFactor,
     WWFixedAsDWord xScaleFactor);

/*
 *  Set scale factor
 *
 * 	PASS:	scale	- scale factor
 */
@message void MSG_VIS_RULER_SET_SCALE
    (WWFixedAsDWord scale = dx.cx);

/*
 * 	Set the grid increments for this ruler
 *
 * 	PASS:	spacing		- horizontal and vertical grid spacing
 */
@message void MSG_VIS_RULER_SET_GRID_SPACING
    (WWFixedAsDWord spacing = dx.cx);

/*
 * 	Set the grid increments for this ruler
 *
 * 	PASS:	spacing		- horizontal grid spacing
 */
@message void MSG_VIS_RULER_SET_HORIZONTAL_GRID_SPACING
    (WWFixedAsDWord spacing = dx.cx);

/*
 * 	Set the grid increments for this ruler
 *
 * 	PASS:	spacing		- vertical grid spacing
 */
@message void MSG_VIS_RULER_SET_VERTICAL_GRID_SPACING
    (WWFixedAsDWord spacing = dx.cx);

/*
 * 	Draw the grid to a gstate
 *
 * 	PASS:	gstate		- handle to a GState
 */
@message void MSG_VIS_RULER_DRAW_GRID (GStateHandle gstate = bp); /* XXX */

/*
 * 	Snap the passed coordinate to the grid
 *
 * 	PASS:	*point		- point to snap to grid
 * 	RETURN:	*point		- point, snapped to grid
 */
@message(VIS_RULER_SNAP) MSG_VIS_RULER_SNAP_TO_GRID;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_SNAP_TO_GRID_X;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_SNAP_TO_GRID_Y;

/*
 * 	Define the ruler's reference point
 *
 * 	PASS:	*point		- new reference point
 */
@message(VIS_RULER_POINT) MSG_VIS_RULER_SET_REFERENCE;

/*
 * 	Returns the point closest to the passed point that is an
 * 	integral number of grid spacings from the reference point
 *
 * 	PASS:	*point		- the point
 * 	RETURN:	*point		- the snapped point
 */
@message(VIS_RULER_SNAP) MSG_VIS_RULER_SNAP_RELATIVE_TO_REFERENCE;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_SNAP_RELATIVE_TO_REFERENCE_X;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_SNAP_RELATIVE_TO_REFERENCE_Y;

/*
 * 	Returns a grid spacing that will look nice on the screen at
 * 	the current scale factor.
 *
 * 	RETURN:	dx:cx = WWFixed horizontal grid spacing
 * 		bp:ax = WWFixed vertical grid spacing
 *
 * The GridSpacing struct is like the Grid struct, except the two fields are
 * reversed.  It is only used with this message; especially note that the
 * ruler's instance data contains a Grid, _not_ a GridSpacing.
 */
typedef struct {
    WWFixed	GS_y;
    WWFixed	GS_x;
} GridSpacing} ;
@message void MSG_VIS_RULER_GET_GRID_SPACING
    (GridSpacing* gridspace = axbpcxdx);
@message void MSG_VIS_RULER_GET_STRATEGIC_GRID_SPACING
    (GridSpacing* gridspace = axbpcxdx);

@message void MSG_VIS_RULER_CREATE_GUIDE_ARRAY ();		/* XXX */
@message(VIS_RULER_DWFIXED) MSG_VIS_RULER_ADD_HORIZONTAL_GUIDE;	/* XXX */
@message(VIS_RULER_DWFIXED) MSG_VIS_RULER_ADD_VERTICAL_GUIDE;	/* XXX */

@message void MSG_VIS_RULER_DRAW_GUIDES 				/* XXX */
    (GStateHandle gstate = bp);

/* The following message has no handler... */
@message void MSG_VIS_RULER_DRAW_GUIDE_INDICATORS ();

/*
 * 	Snap the passed coordinate to the guides
 *
 * 	PASS:	*point	= PointDWFixed to snap to guides
 * 	RETURN:	*point	= PointDWFixed snapped to guides
 */
@message(VIS_RULER_SNAP) MSG_VIS_RULER_SNAP_TO_GUIDES;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_SNAP_TO_GUIDES_X;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_SNAP_TO_GUIDES_Y;

/*
 * 	Constrain the passed coordinate to the indicated axis(axes)
 *
 * 	PASS:	*point	= PointDWFixed to constrain
 * 	RETURN:	*point	= PointDWFixed (constrained)
 */
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_TO_AXES;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_TO_HORIZONTAL_AXIS;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_TO_VERTICAL_AXIS;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_TO_DIAGONALS;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_X_TO_UNITY_SLOPE_AXIS;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_Y_TO_UNITY_SLOPE_AXIS;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_X_TO_NEGATIVE_UNITY_SLOPE_AXIS;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_Y_TO_NEGATIVE_UNITY_SLOPE_AXIS;

/*
 * 	Set the origin.
 *
 * 	PASS:	pointInt, pointFrac: integer and fraction fields of a DWFixed.
 * 	RETURN:	none
 */
typedef struct {
    word	unused;
    word	DWFR_frac;
    sdword	DWFR_int;
} DWFixedReturn} ;
@message void MSG_VIS_RULER_SET_ORIGIN
    (sdword pointInt = dx:cx, word pointFrac = bp);

@message void MSG_VIS_RULER_GET_ORIGIN
    (DWFixedReturn *retval = axbpcxdx);

/*
 * 	Set the vector.
 *
 * 	PASS:	*point	- *point and the reference point define the vector.
 */
@message(VIS_RULER_POINT) MSG_VIS_RULER_SET_VECTOR;

/*
 * 	Constrain the passed point to the current vector.
 *
 * 	PASS:	*point	- point to constrain
 * 	RETURN:	*point	- the constrained point
 */
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_TO_VECTOR;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_X_TO_VECTOR;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_Y_TO_VECTOR;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_X_TO_VECTOR_REFLECTION;
@message(VIS_RULER_SNAP) MSG_VIS_RULER_CONSTRAIN_Y_TO_VECTOR_REFLECTION;

/*
 * Return:	Position at which to draw the dividing line for the ruler.
 */
@message word MSG_VIS_RULER_GET_DESIRED_SIZE () = cx;		/* XXX */

/*
 * Return:	Number of pixels within which a guideline will attract the
 *		mouse point.
 */
@message word MSG_VIS_RULER_GET_GUIDE_INFLUENCE () = cx;		   /* XXX */
@message void MSG_VIS_RULER_SET_GUIDE_INFLUENCE (word influence=cx);  /* XXX */
@message(VIS_RULER_DWFIXED) MSG_VIS_RULER_SELECT_HORIZONTAL_GUIDE; /* XXX */
@message(VIS_RULER_DWFIXED) MSG_VIS_RULER_SELECT_VERTICAL_GUIDE;   /* XXX */
@message void MSG_VIS_RULER_DESELECT_ALL_HORIZONTAL_GUIDES ();	   /* XXX */
@message void MSG_VIS_RULER_DESELECT_ALL_VERTICAL_GUIDES ();	   /* XXX */
@message(VIS_RULER_DWFIXED) MSG_VIS_RULER_DELETE_HORIZONTAL_GUIDE; /* XXX */
@message(VIS_RULER_DWFIXED) MSG_VIS_RULER_DELETE_VERTICAL_GUIDE;   /* XXX */

@message void MSG_VIS_RULER_SHOW_GRID ();			   /* XXX */
@message void MSG_VIS_RULER_HIDE_GRID ();			   /* XXX */

/*
 * 	Invalidates the ruler and its slave. This is provided 'cause
 * 	if this were done via MSG_VIS_INVALIDATE, multiple invalidations
 * 	would pile up for the slave on other messages that also call
 * 	MSG_VIS_INVALIDATE.
 */
@message void MSG_VIS_RULER_INVALIDATE_WITH_SLAVES ();		/* XXX */

/*
 *   MSG_VIS_RULER_SET_CONSTRAIN_TRANSFORM is sent to the ruler so that it can
 *   properly constrain mouse events when the events are taken as happening
 *   within some transformed coordinate system (eg. a rotated/skewed GrObj)
 *
 *  Context:	Likely a transformed object is about to request a series
 * 		of constrains, so it passes in the appropriate transform.
 *  Source:	Any transformed object sending MSG_VIS_RULER_RULE_LARGE_PTR
 * 		to the ruler with VRCS_VECTOR_CONSTRAIN set.
 *  Destination:	Any VisRuler
 *  Interception:	Unlikely
 *
 *  Pass: 	*tm	- TransMatrix representing the transform
 *  Return: 	nothing
 */
@message void MSG_VIS_RULER_SET_CONSTRAIN_TRANSFORM 		/* XXX */
    (TransMatrix* tm = ss:bp);

/*
 *   MSG_VIS_RULER_CLEAR_CONSTRAIN_TRANSFORM is sent to the ruler to clear
 *   any transform that it may have been using for transformed vector constrains.
 *
 *  Context:	Likely an untransformed object wants to ensure that no
 * 		transform is being used to constrain it.
 *  Source:	Any untransformed object sending MSG_VIS_RULER_RULE_LARGE_PTR
 * 		to the ruler with VRCS_VECTOR_CONSTRAIN set.
 *  Destination:	Any VisRuler
 *  Interception:	Unlikely
 */
@message void MSG_VIS_RULER_CLEAR_CONSTRAIN_TRANSFORM ();	/* XXX */

/*----------------------------------------------------------------------
 *		Instance Data
 *----------------------------------------------------------------------*/

    @instance VisRulerAttributes VRI_rulerAttrs =
        (VRA_SHOW_GUIDES | VRA_SHOW_GRID | VRA_HORIZONTAL | VRA_MASTER);

    @instance VisRulerType	VRI_type =
        (VRT_DEFAULT);			/* measurement type */

    @instance VisRulerConstrainStrategy VRI_constrainStrategy = 0;

    @instance MinIncrementType	VRI_minIncrement = (MUSM_EIGHTH_INCH);
                    /* minimum increment displayed */

    @instance WWFixed		VRI_scale = {0,1};
                    /* scale factor */

    @instance DWFixed		VRI_origin = {0,0};
                    /* 0,0 of the ruler in doc coords */

    @instance PointDWFixed	VRI_reference = {0,0,0,0};

    @instance sdword		VRI_mouseMark = 0;

    @instance word		VRI_window = NullHandle;
                    /* actually a noreloc WindowHandle */

    @instance optr		VRI_slave = NullOptr;

    @instance Grid		VRI_grid = {0,0,0,0};

    @instance WWFixed		VRI_vectorSlope = {0,0};
                    /* slope of vector */

    @instance optr		VRI_guideArray = NullOptr;

    @instance word		VRI_guideInfluence = DEFAULT_GUIDE_INFLUENCE;
                    /* influence of guides in pixels */

    @instance word		VRI_desiredSize = VIS_RULER_HEIGHT;

    @instance word		VRI_reserved = 0;

    @instance dword		VRI_invalOD = NullOptr;
                    /* actually a noreloc optr */

    @instance word		VRI_transformGState = NullHandle;
                    /* actually a noreloc GStateHandle */

    @default VI_bounds = {0,0,2000,VIS_RULER_HEIGHT};

@endc	/* VisRulerClass */

/* ----------------------------------------------------------------------
 * 		RulerContentClass
 * ----------------------------------------------------------------------*/

@class  RulerContentClass, VisContentClass;
@endc	/* RulerContentClass */

/* ----------------------------------------------------------------------
 * 		RulerViewClass
 * ----------------------------------------------------------------------*/

typedef ByteFlags RulerViewAttributes ;
#define RVA_HORIZONTAL 	0x80
/* 7 bits unused */

@class  RulerViewClass, GenViewClass;
    @instance RulerViewAttributes	RVI_attrs = (RVA_HORIZONTAL);

    @default GI_attrs = (@default & ~GA_TARGETABLE);

    @default GVI_attrs = ((@default & ~GVA_FOCUSABLE) |
              GVA_WINDOW_COORDINATE_MOUSE_EVENTS |
              GVA_SAME_COLOR_AS_PARENT_WIN);

@endc	/* RulerViewClass */

/* ----------------------------------------------------------------------
 * 		Exported library routines
 * ----------------------------------------------------------------------*/

/*
 *  Utility routine for ruler subclasses to scale for drawing
 *
 * 	PASS:		*ds:si - ptr to VisRuler instance
 * 			dx:cx.ax - point to scale (DWFixed)
 * 	RETURN:		dx:cx.ax - scaled point (DWFixed)
 */
extern void
    _pascal RulerScaleDocToWinCoords (VisRulerInstance* pself, DWFixed* point);

extern void
    _pascal RulerScaleWinToDocCoords (VisRulerInstance* pself, DWFixed* point);

#ifdef __HIGHC__

pragma Alias(RulerScaleDocToWinCoords, "RULERSCALEDOCTOWINCOORDS");
pragma Alias(RulerScaleWinToDocCoords, "RULERSCALEWINTODOCCOORDS");

#endif /* __HIGHC__ */

@endlib

#endif		/* RULERC_GOH */


sac.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1995 -- All Rights Reserved

PROJECT:	GEOS
MODULE:		Socket
FILE:		sac.goh

AUTHOR:		Jennifer Wu, Apr  4, 1995

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    jwu	4/ 4/95   	Initial version.

DESCRIPTION:
          SocketAddressControlClass definition.

    $Id: sac.goh,v 1.4.1.1 96/04/28 08:30:34 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _SAC_GOH_
#define _SAC_GOH_

@deflib	netutils

@include  <medium.h>  	/* for MediumType */

@class	SocketAddressControlClass, GenControlClass;

/*
 * Inform the subclass of the type of medium selected by the user
 * so it can customize its appearance appropriately, should the controller
 * handle media that have different ways of addressing.
 */
@message void MSG_SOCKET_ADDRESS_CONTROL_SET_MEDIUM
                        (MediumType mediumType = cx:dx);

/*
 * Build the block of data that holds the addresses selected by the user
 * to pass to the transport driver.  If OK, returns ChunkArray of SACAddress
 * structures in same block as controller.  Else, returns 0.
 */
@message word MSG_SOCKET_ADDRESS_CONTROL_GET_ADDRESSES () = ax;

/* SACAddress */
typedef struct {
    word    	    	SACA_opaqueSize;
 /* label byte	    	SACA_opaque;	*/
} SACAddress} ;

/*
 * Sets the current user-editable address to the passed address.
 */
@message void MSG_SOCKET_ADDRESS_CONTROL_SET_ADDRESSES (optr addr = cx:dx);

/*
 * Inform the controller of the message and target it should use to
 * notify the invoker that a valid address exists.
 */
@message void MSG_SOCKET_ADDRESS_CONTROL_SET_ACTION
                                (optr dest = cx:dx,
                 word actionMsg = bp);

/*
 * Let the containing dialog know whether the address we've got is a
 * valid one, so it can decide whether to allow the user to send the
 * message.
 */
@message void MSG_SOCKET_ADDRESS_CONTROL_SET_VALID_STATE (Boolean valid = cx);

        @instance word 	    SACI_actionMsg = 0;
        @instance word	    SACI_geode	= 0;

@endc   /* SocketAddressControlClass */

@endlib
#endif	/* _SAC_GOH_ */


Internal\Resp\scep.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1997. Nokia Mobile Phones
*/
/* DESCRIPTION
      SCEP library interface
*/

@ifndef SCEP_GOH
@define SCEP_GOH

@deflib SCEPLIB

/* INCLUDE FILES */

@include  <stdapp.goh>

/* CONSTANTS */

#define FILENAME_LENGTH   31
#define MACHINEID_LENGTH  8
#define PID_LENGTH        2

#define SCEP_REASON_UNSPECIFIED   0x0000
#define SCEP_REASON_USER_DIS      0x0001
#define SCEP_REASON_PROVIDER_DIS  0x0002

/* DATATYPES */

typedef byte MachineID [MACHINEID_LENGTH];
typedef byte PID [PID_LENGTH];

/*
 * This values are used to inform of the current status of SCEP in cases of:
 * 1. connection establishment (SCEP_ConnectInit())
 * 2. disconnection with client notification (MSG_APP_S_DISCONNECT_IND)
 */
typedef enum {
   SCEP_IF_OK                  = 0,
   SCEP_IF_DRIVER_ERROR        = 1,
   SCEP_IF_OPEN_ERROR          = 2,
   SCEP_IF_DEVICE_NOT_FOUND    = 3,
   SCEP_IF_INTERNAL_ERROR      = 4,
   SCEP_IF_FILESYSTEM_FULL     = 5,
   SCEP_IF_STREAM_ERROR        = 6,
   SCEP_IF_CORRUPTED_DATA      = 7
} SCEP_IF_Status} ;

/*
 * Role of the local SCEP machine
 */
typedef enum {
   SCEP_ROLE_RECEIVER    = 0,
   SCEP_ROLE_SENDER
} SCEP_ROLE} ;

/*
 * Possible states of the SCEP state machine
 */
typedef enum {
   SCEP_CLOSED    = 0,
   SCEP_WFCC   ,
   SCEP_WFCR   ,
   SCEP_OPEN   ,
   SCEP_SREQ   ,
   SCEP_WRSP   ,
   SCEP_RRSP   ,
   SCEP_IRSP   ,
   SCEP_RREQ   ,
   SCEP_EXEC   ,
   SCEP_SRSP   ,
   SCEP_IREQ
} SCEP_STATE} ;

/*
 * This structure describes the data available in the memory block mhConnectData of
 * methods MSG_APP_S_CONNECT_IND and MSG_SCEP_S_CONNECT_RSP, in the memory block
 * mhConnectReqData of MSG_SCEP_S_CONNECT_REQ and in the memory block mhConnectCnfData of
 * MSG_APP_S_CONNECT_CNF.
 */
typedef struct {
   MachineID  primary;
   MachineID  secondary;
   byte       CFLG;
   word       wOffset_PDU_Size;  /* IN  offset to null-terminated PDU size string
                                        from beginning of memory block              */
   word       wOffset_ProdID;    /* IN  offset to null-terminated Prod ID string
                                        from beginning of memory block              */
   word       wOffsetUserName;   /* IN  offset to null-terminated user name string
                                        from beginning of memory block              */
   word       wOffsetPassword;   /* IN  offset to null-terminated password string
                                        from beginning of memory block              */
} S_Connect_dataStruct} ;

typedef S_Connect_dataStruct S_Connect_indStruct ;
typedef S_Connect_dataStruct S_Connect_rspStruct ;
typedef S_Connect_dataStruct S_Connect_reqStruct ;
typedef S_Connect_dataStruct S_Connect_cnfStruct ;

/*
 * This structure describes the data available in the memory block mhCommandIndData of
 * method MSG_APP_S_COMMAND_IND
 */
typedef struct {
   MachineID RequestorMID;
   MachineID ResponderMID;
   word      RequestorPID;
   word      ResponderPID;
   word      CmdID;
   TCHAR     UserDataFile[FILENAME_LENGTH+1];   /* the name of the file where the user
                                                   data of the command is stored. The
                                                   file is located in SP_TEMP_FILES    */
} S_Command_indStruct} ;

/*
 * This structure describes the data available in the memory block mhCommandReqData of
 * method MSG_SCEP_S_COMMAND_REQ
 */
typedef struct {
   MachineID RequestorMID;
   MachineID ResponderMID;
   word      RequestorPID;
   word      ResponderPID;
   TCHAR     UserDataFile[FILENAME_LENGTH+1];   /* the name of the user data file which
                                                   is sent to the remote device. The
                                                   file should be located in
                                                   FDD_DOWNLOADED_FILES                */
   word      wHeaderDataLength;                 /* the length of additional header data
                                                   that is to be send before the user
                                                   data file. The header data is located
                                                   in the same block mhCommandReqData
                                                   starting with offset
                                                   sizeof(S_Command_reqStruct) from the
                                                   beginning of the block              */
} S_Command_reqStruct} ;

/*
 * These structures describe the data available in the memory block mhCommandRspData
 * of method MSG_SCEP_S_COMMAND_RSP and in the memory block mhCommandCnfData of method
 * MSG_APP_S_COMMAND_CNF
 */
typedef struct {
   MachineID RequestorMID;
   MachineID ResponderMID;
   word      RequestorPID;
   word      ResponderPID;
   word      CmdID;
   word      wUserDataLength; /* length in bytes of user data; user data is located
                                 in the same memory block with offset
                                 sizeof(S_Command_responseStruct) from the beginning
                                 of the block                                          */
} S_Command_responseStruct} ;

typedef S_Command_responseStruct S_Command_rspStruct ;
typedef S_Command_responseStruct S_Command_cnfStruct ;

/*
 * These structures describe the data available in the memory block mhAbortIndData of
 * method MSG_APP_S_ABORT_IND and in the memory block mhAbortReqData of method
 * MSG_SCEP_S_ABORT_REQ
 */
typedef struct {
   MachineID RequestorMID;
   MachineID ResponderMID;
   word      RequestorPID;
   word      ResponderPID;
   word      CmdID;
} S_Abort_dataStruct} ;

typedef S_Abort_dataStruct S_Abort_indStruct ;
typedef S_Abort_dataStruct S_Abort_reqStruct ;

/* CLASSES */

/*
 * This class defines the interface from the clients of the SCEP library
 * to the process object of the library.
 */
@class SCEP_CommunicationClass, ProcessClass;
   @message void MSG_SCEP_S_CONNECT_RSP
   (
      const Boolean AckOrNackFlag,     /* IN TRUE if client accepts the connection
                                             request, FALSE otherwise               */
      MemHandle     mhConnectData      /* IN see S_Connect_dataStruct for further
                                             information about the data available;
                                             block is freed by this method          */
   );
   @message void MSG_SCEP_S_COMMAND_RSP
   (
      const Boolean AckOrNackFlag,     /* IN TRUE if client accepts the command
                                             request, FALSE otherwise               */
      MemHandle     mhCommandRspData   /* IN see S_Command_rspStruct for further
                                             information about the data available;
                                             block is freed by this method          */
   );
   @message void MSG_SCEP_S_DISCONNECT_REQ
   (
      const word wReasonLength,        /* IN length in bytes of reason code         */
      MemHandle  mhDIS_req             /* IN contains the reason of disconnect
                                             (byte array); block is freed by this
                                             method                                 */
   );
   @message SCEP_STATE  MSG_SCEP_GET_STATE  ();

   @message void  MSG_SCEP_S_COMMAND_REQ
   (
      const MemHandle mhCommandReqData /* IN see S_Command_reqStruct for a
                                             description of data; block is freed
                                             by this method                         */
   );
   @message void  MSG_SCEP_S_CONNECT_REQ
   (
      const MemHandle mhConnectReqData /* IN see S_Connect_dataStruct for a
                                             description of data; block is freed
                                             by this method                         */
   );
   @message void  MSG_SCEP_S_ABORT_REQ
   (
      const MemHandle mhAbortReqData   /* IN see S_Abort_dataStruct for a
                                             description of data; block is freed
                                             by this method                         */
   );

@endc

/*
 * This class defines the interface from the SCEP library to the client object
 * receiveing notifications from the library. The class of the client
 * object must be SCPEPClientClass or a subclass of it.
 */
@class SCEPClientClass, GenClass;
   @message void MSG_APP_S_CONNECT_IND
   (
      MemHandle mhConnectData             /* IN see S_Connect_dataStruct for further
                                                information about the data available;
                                                block should be freed by this method   */
   );
   @message void MSG_APP_S_DISCONNECT_IND
   (
      const word           wReasonLength, /* IN length in bytes of reason code         */
      MemHandle            mhDIS_ind,     /* IN contains the reason of disconnect
                                                (byte array) specified in IrTran-P;
                                                block should be freed by this method   */
      const SCEP_IF_Status ifStatus,      /* IN internal reason code                   */
      const dword          dwBytesRequired/* IN space needed (in bytes) if
                                                ifStatus == SCEP_IF_FILESYSTEM_FULL    */
   );
   @message void MSG_APP_S_ABORT_IND
   (
      MemHandle mhAbortIndData            /* IN see S_Abort_indStruct for further
                                                information about the data available;
                                                block should be freed by this method   */
   );
   @message void MSG_APP_S_COMMAND_IND
   (
      MemHandle mhCommandIndData          /* IN see S_Command_indStruct for further
                                                information about the data available;
                                                block is freed by this method          */
   );
   @message void MSG_APP_RECEIVING_DATA ();
   @message void MSG_APP_S_COMMANDID_IND
   (
      const word wCmdID
   );
   @message void MSG_APP_S_CONNECT_CNF
   (
      const Boolean  BAckOrNack,
      MemHandle      mhConnectCnfData
   );
   @message void MSG_APP_S_COMMAND_CNF
   (
      const Boolean  BAckOrNack,
      MemHandle      mhCommandCnfData
   );
@endc

/* GLOBAL FUNCTIONS */

/*
 * This function MUST be called by the application in order to establish a connection
 * to a remote SCEP machine. The parameter srRole determines whether the local SCEP
 * acts actively or passively during a connection establisment. The function passes
 * the optrs and geode handles needed in the client - SCEP library communication.
 *
 * Returns the status of the IR connection establishment: SCEP_IF_OK, if succesfull.
 */
extern SCEP_IF_Status SCEP_ConnectInit
(
   const optr        AppOptr,            /* IN the optr to the communication object of
                                               the client. The object must be of
                                               (sub)type SCEPClientClass.              */
   const GeodeHandle hAppProcessHandle,  /* IN The handle of the client geode which is
                                               used when changing the ownership of the
                                               memory blocks sent from SCEP library to
                                               the client.                             */
   const SCEP_ROLE   srRole,             /* IN role of the local SCEP machine
                                               (SCEP_ROLE_RECEIVER or SCEP_ROLE_SENDER)*/
   optr*             pSCEOOptr,          /* OUT The optr of the object of the SCEP library
                                                with which the client should communicate.
                                                The object is of subtype
                                                SCEP_CommunicationClass                */
   GeodeHandle*      phSCEPProcessHandle /* OUT handle of the SCEP geode which the client
                                                should use when changing the ownership of
                                                memory blocks that are sent from client
                                                to the SCEP library.                   */
);

/*
 * This function MUST be called by the client, if it wishes to disconnect from the remote
 * SCEP machine and/or to close the IR connection (client sends MSG_SCEP_S_DISCONNECT_REQ).
 * The client thread is blocked until the SCEP thread closes the IR port.
 * If disconnection occurs due to action of remote or local SCEP, this functions needs
 * not to be called.
 */
extern void SCEP_CloseInit (void);

@endlib
@endif


SDK_C\SDK.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1993 -- All Rights Reserved
 *
 * PROJECT:	  PC SDK
 * FILE:	  SDK.h
 *
 * AUTHOR:  	  Tom Lester: Aug  9, 1993
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	TL	8/ 9/93   	Initial version
 *
 * DESCRIPTION:
 *
 *	Certain mechanisms within PC/GEOS utilize a two-word indentification
 *	scheme in which the first word is a ManufacturerID, & the second
 *	is an enumeration defined by the manufacturer identified by the
 *	first word.  This file contains the enumerations for the Geoworks
 *	Software Development Kit`s ManufacturerID of MANUFACTURER_ID_SDK.
 *
 *	NOTE:  Any developer assigned a ManufacturerID should have a file
 *	       similar to this one, named after their own company, for the
 *	       purpose of defining the meaning of enumerations when that
 *	       ManufacturerID is used. Please contact GeoWorks ISV support
 *             to have a constant assigned for your company if you do not
 *             already have one.
 *
 *	WARNING:
 *	       When updating this file, it is imperative that the assembly
 *	       equivalent, Include/SDK_C/SDK.def, be updated as well.
 *
 *	ONE MORE THING:
 *	       NOTHING should be placed in this file that can be made to
 *             reside in a more specialized include file.  Yes, that includes ""
 *	       Notification data block structures!  This is not a substitute
 *	       for a library-specific definition file;  Constants & structures
 *	       pertinent to a specific library belong in a specific include ""
 *	       file for that library.
 *
 * 	$Id: SDK.h,v 1.6.8.1 96/04/28 08:33:12 chris Exp $
 *
 ***********************************************************************/
#ifndef _SDK_H_
#define _SDK_H_

#include  <geode.h>        /* definition of MANUFACTURER_ID_SDK */

/*
 * This is the base value for the GenApplication GCN list types.
 * The base list type value must match the base message value of
 * the GenApplication class.
 */
#define FIRST_GEN_APP_GCN_LIST_TYPE  0x6800

/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    MSG_META_NOTIFY & MSG_META_NOTIFY_WITH_DATA_BLOCK NotificationTypes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    MSG_META_NOTIFY & MSG_META_NOTIFY_WITH_DATA_BLOCK are general purpose
    notification messages, whose data format & meaning are defined by
    the "NotificationType" passed in the messages.

    This section contains the enumerations of the NT_type field of
    NotificationType for the case of NT_manuf = MANUFACTURER_ID_SDK.

    NOTE: needs to be word sized enums

    Name	Date		Description
    ----	----		-----------
    TL	8/ 9/93   	Initial version

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */

typedef enum /* word */ {
    /*
     * This notification type is used for the MSet library with the
     * GAGCN list SDK_GAGCNLT_APP_TARGET_NOTIFY_MSET_ATTR_CHANGE.
     * The data block that is send along with this notification type
     * with the message MSG_META_NOTIFY_WITH_DATA_BLOCK is a
     * MSetParameters structure (defined in mset.goh).
     */
    SDK_NT_MSET_ATTR_CHANGE     = 0x0000,

} SDKNotificationType} ;

/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    GenApplication GCNList enums
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    The UI library's GenApplicationClass supports its very own GCN
    (General Change Notification) system separate from the kernel's.
    Lists within this system are identified by a GCNListType, whose
    enumerations are seperate from that of the kernel's GCN system.

    This section contains the enumerations of the GCNLT_type field for
    GCNListType used within a GenApplication for the case of
    GCNLT_manuf = MANUFACTURER_ID_SDK.

    !!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!

    NOTE:	The GenApplication GCN list types must have values that
            are multiples of two (2) and the base value for the
        list types must match the base message value of the
        GenApplication class. So assign values to the list
        types as shown below.

    !!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!!!WARNING!!

    NOTE:
           When updating this file, it is imperative that the assembly
           equivalent, Include/SDK_C/SDK.def, be updated as well.

    Name	Date		Description
    ----	----		-----------
    TL	8/ 9/93   	Initial version

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */

typedef enum /* word */ {
    /*
     * List for keeping the MSet controllers up to date on the
     * status of the MSet object that is the current target.
     * The data block that is send to this list with the message
     * MSG_META_NOTIFY_WITH_DATA_BLOCK is a MSetParameters structure
     * (defined in mset.goh).
     */
    SDK_GAGCNLT_APP_TARGET_NOTIFY_MSET_ATTR_CHANGE
                               = FIRST_GEN_APP_GCN_LIST_TYPE,
    /*
     * This is just a dummy list type to show how to number the lists.
     */
    SDK_GAGCNLT_DUMMY_LIST_TYPE
                              = FIRST_GEN_APP_GCN_LIST_TYPE + 2,

} SDKGenAppGCNListType} ;

#endif /* _SDK_H_ */


security.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1995 -- All Rights Reserved

PROJECT:	Security Library
MODULE:
FILE:		security.goh

AUTHOR:		Reza Hussein, May 16, 1995

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    RH	5/16/95   	Initial version.

DESCRIPTION:

    $Id: security.goh,v 1.7.1.8 98/06/17 16:48:04 kho Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@optimize
@deflib	security

/* ----------------------------------------------------------------------------
 *   Constants
 * ----------------------------------------------------------------------------*/
#define MAX_LOCK_CODE_LENGTH 		(10)	/*  10 digits */
#define MAX_LOCK_CODE_LENGTH_WITH_NULL 	(MAX_LOCK_CODE_LENGTH + 1)
#define MIN_LOCK_CODE_LENGTH 		(5)	/*  5 digits */
#define MAX_NEW_LOCK_CODE_LENGTH 	(5)	/*  5 digits */
#define	MAX_NEW_LOCK_CODE_LENGTH_WITH_NULL	 (MAX_NEW_LOCK_CODE_LENGTH + 1)

#define MAX_PIN_CODE_LENGTH 		(8)	/*  8 digits */
#define MAX_PIN_CODE_LENGTH_WITH_NULL 	(MAX_PIN_CODE_LENGTH + 1)
#define MIN_PIN_CODE_LENGTH 		(4)	/*  4 digits */

#define MAX_PUK_CODE_LENGTH 		(8)	/*  8 digits */
#define MAX_PUK_CODE_LENGTH_WITH_NULL 	(MAX_PUK_CODE_LENGTH + 1)
#define MIN_PUK_CODE_LENGTH 		(8)	/*  8 digits */

#define MAX_PIN2_CODE_LENGTH 		(8)	/*  8 digits */
#define MAX_PIN2_CODE_LENGTH_WITH_NULL 	(MAX_PIN2_CODE_LENGTH + 1)
#define MIN_PIN2_CODE_LENGTH 		(4)	/*  4 digits */

#define MAX_PUK2_CODE_LENGTH 		(8)	/*  8 digits */
#define MAX_PUK2_CODE_LENGTH_WITH_NULL 	(MAX_PUK2_CODE_LENGTH + 1)
#define MIN_PUK2_CODE_LENGTH 		(8)	/*  8 digits */

#define MAX_NETWORK_CODE_LENGTH 		(4)	/*  4 digits */
#define MAX_NETWORK_CODE_LENGTH_WITH_NULL  (MAX_NETWORK_CODE_LENGTH + 1)
#define MIN_NETWORK_CODE_LENGTH 		(4)	/*  4 digits */

/*
 *  User changeable settings
 */
#define DEFAULT_PIN_CODE_REQUEST 	(BB_TRUE)	/*  On */
#define DEFAULT_LOCK_TIME_OUT 		(15)		/*  15 minutes */
#define DEFAULT_SECURITY_LEVEL 		(BB_TRUE)	/*  Phone */
#define DEFAULT_LOCKED_STATE 		(BB_TRUE)	/*  On */

/* ----------------------------------------------------------------------------
 *   Enumerated types
 * ----------------------------------------------------------------------------*/
typedef enum {
    SCT_LOCK_CODE     = 0x0,
    SCT_PIN_CODE     = 0x2,
    SCT_NETWORK_CODE     = 0x4,
    SCT_PIN2_CODE     = 0X6,
} SecurityCodeType} ;

typedef enum {
    CPMS_OK     = 0x0,
    CPMS_CODE_REQUIRED     = 0x2,
    CPMS_RADIO_UNIT_OFF     = 0x4,
    CPMS_SIM_ERROR     = 0x6,
    CPMS_NO_SERVICE     = 0x8
} CellPhoneMediaStatus} ;

typedef enum {
    SCST_OK    		= 0x0,
    SCST_PIN_REQUIRED    	= 0x2,
    SCST_BLOCKED    	= 0x4,
    SCST_REJECTED    	= 0x6,
    SCST_MISSING_CARD    	= 0x8,
    SCST_LOCKED    		= 0xa
} SIMCardStatusType} ;

/* ----------------------------------------------------------------------------
 *   Classes
 * ----------------------------------------------------------------------------*/
typedef WordFlags SecuritySettingsControlFeatures ;
/* 15 bits unused */
#define SSCF_UI 	(0x01)

#define	SSCF_DEFAULT_FEATURES		SSCF_UI

@class  SecuritySettingsControlClass, GenControlClass;
/*
 *  Controller to handle user changeable security settings.
 */

/*
 *  Internal: Message sent out when PIN code request trigger is pressed to
 *  initiate changing of PIN code request state on phone power ups.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_PIN_CODE_REQUEST ();

/*
 *  Internal: PIN code dialog sends this to us when user has entered
 *  correct PIN code, so we can put try to set the PIN code status.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_PIN_CODE_REQUEST_APPROVED ();

/*
 *  Internal: PIN code dialog sends this to us when PIN code request
 *  change suceeds.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_PIN_CODE_REQUEST_CHANGED ();

/*
 *  Internal: Sent to us when change Lock time-out trigger is pressed.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_LOCK_TIME_OUT ();

/*
 *  Internal: Lock code dialog sends this to us when user has entered
 *  the correct lock code, so we can put up a lock time out list.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_LOCK_TIME_OUT_APPROVED ();

/*
 *  Internal: Lock time-out list sends this to us when user has selected
 *  a new lock time-out value.
 *
 *  Pass: cx = lock time-out value (in mins)
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_LOCK_TIME_OUT_CHANGED ();

/*
 *  Internal: Sent to us when Change Security level trigger is pressed.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_SECURITY_LEVEL ();

/*
 *  Internal: Lock code dialog sends this to us when user has entered
 *  correct lock code before allowing user to change security levels.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_SECURITY_LEVEL_APPROVED ();

/*
 *  Internal: Sent to us when Change PIN code trigger is pressed.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_PIN_CODE ();

/*
 *  Internal: PIN code dialog sends this to us when user has entered
 *  correct PIN code...
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_PIN_CODE_APPROVED ();

/*
 *  Internal: Sent to us when Change Lock code trigger is pressed.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_LOCK_CODE ();

/*
 *  Internal: Lock code dialog sends this to us when user has entered
 *  correct lock code, so we can change to new lock code.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_LOCK_CODE_APPROVED ();

/*
 *  Internal: Sent to us when change Network passwd trigger is pressed.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_NETWORK_PASSWORD ();

/*
 *  Internal: Sent to us when change user has entered correct PUK code.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_NETWORK_PASSWORD_APPROVED ();

/*********************************************************************
 * The followings are the new messages for Communicator released after
 * November 1997.
 *********************************************************************/

/*
 *  Internal: Sent to us when Change PIN2 code trigger is pressed.
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_PIN2_CODE ();

/*
 *  Internal: PIN2 code dialog sends this to us when user has entered
 *  correct PIN2 code...
 */
@message void MSG_SECURITY_SETTINGS_CONTROL_CHANGE_PIN2_CODE_APPROVED ();

@endc	/* SecuritySettingsControlClass */

/* ----------------------------------------------------------------------------
 *   Exported functions
 * --------------------------------------------------------------------------*/
extern void _far _pascal \
       SecurityEnterLockMode   	(void);
extern Boolean _far _pascal \
    SecurityDoPasswordDialog	(SecurityCodeType code,
        optr notifyObj, word notifyMsg);
extern Boolean _far _pascal \
         SecurityCheckCellPhoneMediaAvailable     	(void);
extern CellPhoneMediaStatus _far _pascal \
    SecurityTryToMakeCellPhoneMediaAvailable	(void);
extern word _far _pascal \
    SecurityGetLockTimeOutTime	(void);
extern word _far _pascal \
        SecurityCheckSIMCardAndPhone        (void);

#define SecurityCheckSIMCard  SecurityTryToMakeCellPhoneMediaAvailable

extern void _far _pascal \
        SecuritySuspendAutoLock        (void);
extern void _far _pascal \
        SecurityResumeAutoLock        (void);

/* added for SIM handling, March 1998 (v30) */

extern Boolean _far _pascal \
    SecurityGetSIMAndPhoneStatus	(SIMCardStatusType *simCardStatus);

extern Boolean _far _pascal \
    SecurityGetFDNStatus	(void);

extern Boolean _far _pascal \
    SecurityGetLockStatus	(void);

#ifdef __HIGHC__
pragma  Alias(SecurityEnterLockMode, "SECURITYENTERLOCKMODE");
pragma  Alias(SecurityDoPasswordDialog, "SECURITYDOPASSWORDDIALOG");
pragma	Alias(SecurityCheckCellPhoneMediaAvailable, "SECURITYCHECKCELLPHONEMEDIAAVAILABLE");
pragma	Alias(SecurityTryToMakeCellPhoneMediaAvailable, "SECURITYTRYTOMAKECELLPHONEMEDIAAVAILABLE");
pragma	Alias(SecurityGetLockTimeOutTime, "SECURITYGETLOCKTIMEOUTTIME");
pragma  Alias(SecurityCheckSIMCardAndPhone, "SECURITYCHECKSIMCARDANDPHONE");
pragma  Alias(SecuritySuspendAutoLock, "SECURITYSUSPENDAUTOLOCK");
pragma  Alias(SecurityResumeAutoLock, "SECURITYRESUMEAUTOLOCK");
pragma	Alias(SecurityGetSIMAndPhoneStatus, "SECURITYGETSIMANDPHONESTATUS");
pragma	Alias(SecurityGetFDNStatus, "SECURITYGETFDNSTATUS");
pragma	Alias(SecurityGetLockStatus, "SECURITYGETLOCKSTATUS");
#endif

@endlib


sem.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	sem.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines semaphore structures and routines.
 *
 *	$Id: sem.h,v 1.13.26.1 96/04/28 08:28:57 chris Exp $
 *
 ***********************************************************************/

#ifndef	__SEM_H
#define __SEM_H

typedef enum /* word */ {
    SE_NO_ERROR    ,
    SE_TIMEOUT    ,
    SE_PREVIOUS_OWNER_DIED
} SemaphoreError} ;

extern SemaphoreHandle	/*XXX*/
    _pascal ThreadAllocSem (word value);

/***/

extern void	/*XXX*/
    _pascal ThreadFreeSem (SemaphoreHandle sem);

/***/

extern SemaphoreError	/*XXX*/
    _pascal ThreadPSem (SemaphoreHandle sem);

/***/

extern void	/*XXX*/
    _pascal ThreadVSem (SemaphoreHandle sem);

/***/

extern SemaphoreError	/*XXX*/
    _pascal ThreadPTimedSem (SemaphoreHandle sem, word timeout);

/***/

extern ThreadLockHandle	/*XXX*/
    _pascal ThreadAllocThreadLock (void);

/***/

extern void	/*XXX*/
    _pascal ThreadFreeThreadLock (ThreadLockHandle sem);

/***/

extern void	/*XXX*/
    _pascal ThreadGrabThreadLock (ThreadLockHandle sem);

/***/

extern void	/*XXX*/
    _pascal ThreadReleaseThreadLock (ThreadLockHandle sem);

#ifdef __HIGHC__
pragma Alias(ThreadAllocSem, "THREADALLOCSEM");
pragma Alias(ThreadFreeSem, "THREADFREESEM");
pragma Alias(ThreadPSem, "THREADPSEM");
pragma Alias(ThreadVSem, "THREADVSEM");
pragma Alias(ThreadPTimedSem, "THREADPTIMEDSEM");
pragma Alias(ThreadAllocThreadLock, "THREADALLOCTHREADLOCK");
pragma Alias(ThreadFreeThreadLock, "THREADFREETHREADLOCK");
pragma Alias(ThreadGrabThreadLock, "THREADGRABTHREADLOCK");
pragma Alias(ThreadReleaseThreadLock, "THREADRELEASETHREADLOCK");
#endif

#endif


serialDr.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1993 -- All Rights Reserved
 *
 * PROJECT:	  GEOS
 * MODULE:	  CInclude
 * FILE:	  serialDr.h
 *
 * AUTHOR:  	  Jenny Greenwood: Aug 31, 1993
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	jenny	8/31/93   	Initial version
 *	doug	1/27/94		Moved all serial constants here from StreamC,
 *				so as to mirror original definition files
 *
 * DESCRIPTION:
 *	Header for users of the serial port driver.
 *
 * 	$Id: serialDr.h,v 1.4.1.1 96/04/28 08:28:49 chris Exp $
 *
 ***********************************************************************/
#ifndef _SERIALDR_H_
#define _SERIALDR_H_

/*
 * Serial driver only StreamError:  Attempting to  define a new port, but
 * the driver has no room in its internal tables to keep track of it.
 */
#define	STREAM_NO_FREE_PORTS	 = STREAM_FIRST_DEV_ERROR

/*
 * SerialError indicates the nature of serial device-specific errors.
 * This is the "errorCode" returned by SerialGetError.
 */
typedef WordFlags SerialError ;

/* Break condition detected on line */
#define	SERIAL_ERROR_BREAK_OFFSET		(4)
#define	SERIAL_ERROR_BREAK			(0x01 <<	\
                     SERIAL_ERROR_BREAK_OFFSET)

/* Framing error (improper # stop bits, e.g.) */
#define	SERIAL_ERROR_FRAME_OFFSET		(3)
#define	SERIAL_ERROR_FRAME			(0x01 <<	\
                     SERIAL_ERROR_FRAME_OFFSET)

/* Parity error received in character (may be garbage) */
#define	SERIAL_ERROR_PARITY_OFFSET		(2)
#define	SERIAL_ERROR_PARITY			(0x01 <<	\
                     SERIAL_ERROR_PARITY_OFFSET)

/* New byte received before old byte read -- old byte discarded. */
#define	SERIAL_ERROR_OVERRUN_OFFSET		(1)
#define	SERIAL_ERROR_OVERRUN			(0x01 <<	\
                     SERIAL_ERROR_OVERRUN_OFFSET)

/*
 * Constant for SerialDefinePort
 */
#define SERIAL_PORT_DOES_NOT_EXIST 	-1

/*
 * Constants for DR_STREAM_OPEN and everyone else.
 */
typedef enum /* word */ {
    SERIAL_COM1             = 0,
    SERIAL_COM2     	= 2,
    SERIAL_COM3    	        = 4,
    SERIAL_COM4     	= 6,
    SERIAL_COM5     	= 8,	/* only on exceptional systems */
    SERIAL_COM6     	= 10,	/* only on exceptional systems */
    SERIAL_COM7     	= 12,	/* only on exceptional systems */
    SERIAL_COM8     	= 14	/* only on exceptional systems */
} SerialPortNum} ;

typedef SerialPortNum SerialUnit ;

/*
 * Definitions for DR_SERIAL_SET_FORMAT and DR_SERIAL_GET_FORMAT
 */

/*
 * SerialParity describes the parity settings.
 */
typedef	enum
{
    SERIAL_PARITY_NONE		= 0,
    SERIAL_PARITY_ODD		= 1,
    SERIAL_PARITY_EVEN		= 3,
    SERIAL_PARITY_ONE		= 5,
    SERIAL_PARITY_MARK		= 5,
    SERIAL_PARITY_ZERO		= 7,
    SERIAL_PARITY_SPACE		= 7
} SerialParity} ;

/*
 * SerialLength specifies the number of data bits per frame.
 */
typedef	enum
{
    SERIAL_LENGTH_5	,
    SERIAL_LENGTH_6	,
    SERIAL_LENGTH_7	,
    SERIAL_LENGTH_8
} SerialLength} ;

/*
 * SerialExtraStopBits specifies the number of additional stop bits per
 * frame.
 */
typedef enum
{
    SERIAL_XSTOP_NONE		= 0,
    SERIAL_XSTOP_HALF		= 1,	/* iff SerialLength == 5.	*/
    SERIAL_XSTOP_ONE		= 1	/* iff SerialLength == 6,7,8.	*/
} SerialExtraStopBits} ;

typedef ByteFlags SerialFormat ;
#define	   SF_DLAB	   	0x80	/* FOR INTERNAL USE ONLY (MUST BE ZERO) */
#define	   SF_BREAK	       	0x40	/* If set, causes a BREAK condition to be
                     *  asserted on the line. The bit must be cleared
                     *  again to return to normal function. */
#define	   SF_PARITY	      	0x38    /* SerialParity: parity to expect on receive
                 *  and use on transmit */
#define    SF_EXTRA_STOP     0x04	/* Set if should generate an extra stop bit. One
                 *  stop bit is always generated. If this bit is
                 *  set, however, an extra 1/2 bit is generated
                 *  when the word-length is 5 bits, while a whole
                 *  extra stop bit is generated when the word-
                 *  length is 6, 7 or 8 */

#define SF_LENGTH    	0x03	/* SerialLength: Word-length specifier */

/* Duplicate defintions, but slightly different names */
typedef	ByteFlags SerialFormat ;
#define	SERIAL_FORMAT_DLAB_OFFSET		(7)
#define	SERIAL_FORMAT_DLAB			(0x01 << SERIAL_FORMAT_DLAB_OFFSET)

#define	SERIAL_FORMAT_BREAK_OFFSET		(6)
#define	SERIAL_FORMAT_BREAK			(0x01 << SERIAL_FORMAT_BREAK_OFFSET)

#define	SERIAL_FORMAT_PARITY_OFFSET		(3)
#define	SERIAL_FORMAT_PARITY			(0x07 << SERIAL_FORMAT_PARITY_OFFSET)

#define	SERIAL_FORMAT_EXTRA_STOP_OFFSET		(2)
#define	SERIAL_FORMAT_EXTRA_STOP		(0x01 <<	\
                     SERIAL_FORMAT_EXTRA_STOP_OFFSET)

#define	SERIAL_FORMAT_LENGTH_OFFSET		(0)
#define	SERIAL_FORMAT_LENGTH			(0x03 << SERIAL_FORMAT_LENGTH_OFFSET)

typedef ByteEnum SerialMode ;
#define    SM_RAW    	0	/* Pass input through untouched */
#define    SM_RARE    	1	/* Ditto, but obey XON/XOFF flow-control
                      *  and use it on input */
#define    SM_COOKED    	2	/* Flow-control, 7-bit input bytes. */

typedef enum /* word */ {
    SB_115200       = 1,
    SB_57600        = 2,
    SB_38400     	= 3,
    SB_19200    	= 6,
    SB_14400    	= 8,
    SB_9600    	= 12,
    SB_7200    	= 16,
    SB_4800    	= 24,
    SB_3600    	= 32,
    SB_2400    	= 48,
    SB_2000    	= 58,
    SB_1800    	= 64,
    SB_1200    	= 96,
    SB_600    	= 192,
    SB_300    	= 384
} SerialBaud} ;

/* Duplicate defintions, but slightly different names */
#define SERIAL_BAUD_115200   	SB_115200
#define SERIAL_BAUD_57600    	SB_57600
#define SERIAL_BAUD_38400    	SB_38400
#define SERIAL_BAUD_19200    	SB_19200
#define SERIAL_BAUD_14400    	SB_14400
#define SERIAL_BAUD_9600     	SB_9600
#define SERIAL_BAUD_7200     	SB_7200
#define SERIAL_BAUD_4800 	SB_4800
#define SERIAL_BAUD_2400 	SB_2400
#define SERIAL_BAUD_1800 	SB_1800
#define SERIAL_BAUD_1200 	SB_1200
#define SERIAL_BAUD_600 	    	SB_600
#define SERIAL_BAUD_300 	    	SB_300

#define SERIAL_MODE_RAW 	    	SM_RAW
#define SERIAL_MODE_RARE     	SM_RARE
#define SERIAL_MODE_COOKED     	SM_COOKED

/*
 * Parameter for DR_SERIAL_SET_MODEM/DR_SERIAL_GET_MODEM
 */
typedef ByteFlags SerialModem ;
#define    SMC_OUT2     	0x08	/* INTERNAL TO DRIVER */
#define    SMC_OUT1     	0x04	/* INTERNAL TO DRIVER */
#define    SMC_RTS      	0x02	/* Request-To-Send (1 asserts it) */
#define    SMC_DTR      	0x01	/* Data-Terminal Ready (1 asserts it) */

/* For DCE role: */
#define SMC_RI 		0x08	/* Ring Indicator */
#define SMC_DCD 		0x04	/* Data-Carrier Detect */
#define SMC_CTS 		0x02	/* Clear-to-send */
#define SMC_DSR 		0x01	/* Data-Set Ready */

/* Duplicate defintions, but slightly different names */
#define	SERIAL_MODEM_OUT2_OFFSET		(3)
#define	SERIAL_MODEM_OUT2			(0x01 << SERIAL_MODEM_OUT2_OFFSET)

#define	SERIAL_MODEM_OUT1_OFFSET		(2)
#define	SERIAL_MODEM_OUT1			(0x01 << SERIAL_MODEM_OUT1_OFFSET)

#define SERIAL_MODEM_RTS_OFFSET 		(1)
#define SERIAL_MODEM_RTS 		(0x01 << SERIAL_MODEM_RTS_OFFSET)

#define SERIAL_MODEM_DTR_OFFSET 		(0)
#define SERIAL_MODEM_DTR 		(0x01 << SERIAL_MODEM_DTR_OFFSET)

/* For DCE role: */
#define	SERIAL_MODEM_RI_OFFSET		        (3)
#define	SERIAL_MODEM_RI	                 (0x01 << SERIAL_MODEM_RI_OFFSET)

#define	SERIAL_MODEM_DCD_OFFSET		        (2)
#define	SERIAL_MODEM_DCD			(0x01 << SERIAL_MODEM_DCD_OFFSET)

#define SERIAL_MODEM_CTS_OFFSET 		(1)
#define SERIAL_MODEM_CTS 		(0x01 << SERIAL_MODEM_CTS_OFFSET)

#define SERIAL_MODEM_DSR_OFFSET 		(0)
#define SERIAL_MODEM_DSR 		(0x01 << SERIAL_MODEM_DSR_OFFSET)

/*
 * Additional StreamNotifyEvent defined for the serial driver.
 * May be passed in a StreamNotifyType record to DR_STREAM_SET_NOTIFY.
 */
#define	SNE_MODEM		2	    	/* Notify when modem input
                         * signals change. */
typedef ByteFlags SerialModemStatus ;	/* Passed in CX when SNE_MODEM
                                         * notifier is triggered. */
    /*
     * Current state of signals
     */
#define    SMS_DCD     	0x80		/* Carrier Detect */
#define    SMS_RING    	0x40		/* Ring Detect */
#define    SMS_DSR     	0x20		/* Data-Set Ready (modem is happy) */
#define    SMS_CTS     	0x10		/* Clear to send (modem will accept
                                         * data) */
    /*
     * Signal-change indicators. Notification will occur whenever one of these
     * becomes set. They are set when the corresponding signal has changed since
     * the last notification.
     */
#define    SMS_DCD_CHANGED     	0x08	/* Carrier Detect changed */
#define    SMS_RING_CHANGED    	0x04	/* Activated only when the SMS_RING
                                * indicator changes from active to
                            * inactive (signals the end of a RING
                                         * signal on the incoming phone line)*/
#define    SMS_DSR_CHANGED     	0x02	/* Data-Set Ready changed */
#define    SMS_CTS_CHANGED     	0x01	/* Clear to send changed */

/* For DCE role: */
#define SMS_DTR 		0x20
#define SMS_RTS 		0x10
#define SMS_DTR_CHANGED 	0x02
#define SMS_RTS_CHANGED 	0x01

/*
 * SerialFlowControl specifies the type of flow control for the stream.
 */
typedef ByteFlags SerialFlowControl ;
#define    SFC_SOFTWARE    	    0x02    /* If set, obey XON/XOFF characters */
#define    SFC_HARDWARE    	    0x01    /* If set, obey hardware signals passed
                                     * in cl and ch */

/* Duplicate defintions, but slightly different names */
typedef	ByteFlags SerialFlowControl ;
#define	SERIAL_FLOW_SOFTWARE_OFFSET		(1)
#define	SERIAL_FLOW_SOFTWARE			(0x01 << SERIAL_FLOW_SOFTWARE_OFFSET)

#define	SERIAL_FLOW_HARDWARE_OFFSET		(0)
#define	SERIAL_FLOW_HARDWARE			(0x01 << SERIAL_FLOW_HARDWARE_OFFSET)

/*
 * SerialDeviceMap is the serial driver attribute mask returned by
 * SerialGetDeviceMap.
 */
typedef	WordFlags SerialDeviceMap ;
#define	SERIAL_DEVICE_COM8_OFFSET		(14)
#define	SERIAL_DEVICE_COM8			(0x01 << SERIAL_DEVICE_COM8_OFFSET)

#define	SERIAL_DEVICE_COM7_OFFSET		(12)
#define	SERIAL_DEVICE_COM7			(0x01 << SERIAL_DEVICE_COM7_OFFSET)

#define	SERIAL_DEVICE_COM6_OFFSET		(10)
#define	SERIAL_DEVICE_COM6			(0x01 << SERIAL_DEVICE_COM6_OFFSET)

#define	SERIAL_DEVICE_COM5_OFFSET		(8)
#define	SERIAL_DEVICE_COM5			(0x01 << SERIAL_DEVICE_COM5_OFFSET)

#define	SERIAL_DEVICE_COM4_OFFSET		(6)
#define	SERIAL_DEVICE_COM4			(0x01 << SERIAL_DEVICE_COM4_OFFSET)

#define	SERIAL_DEVICE_COM3_OFFSET		(4)
#define	SERIAL_DEVICE_COM3			(0x01 << SERIAL_DEVICE_COM3_OFFSET)

#define	SERIAL_DEVICE_COM2_OFFSET		(2)
#define	SERIAL_DEVICE_COM2			(0x01 << SERIAL_DEVICE_COM2_OFFSET)

#define	SERIAL_DEVICE_COM1_OFFSET		(0)
#define	SERIAL_DEVICE_COM1			(0x01 << SERIAL_DEVICE_COM1_OFFSET)

#define	STREAM_STATUS_UNKNOWN_OFFSET		(15)
#define	STREAM_STATUS_UNKNOWN			(0x01 << STREAM_STATUS_UNKNOWN_OFFSET)

#define	SERIAL_STATUS_DCD_OFFSET		(7)
#define	SERIAL_STATUS_DCD			(0x01 << SERIAL_STATUS_DCD_OFFSET)

#define	SERIAL_STATUS_RING_OFFSET		(6)
#define	SERIAL_STATUS_RING			(0x01 << SERIAL_STATUS_RING_OFFSET)

#define	SERIAL_STATUS_DSR_OFFSET		(5)
#define	SERIAL_STATUS_DSR			(0x01 << SERIAL_STATUS_DSR_OFFSET)

#define	SERIAL_STATUS_CTS_OFFSET		(4)
#define	SERIAL_STATUS_CTS			(0x01 << SERIAL_STATUS_CTS_OFFSET)

#define	SERIAL_STATUS_DCD_CHANGED_OFFSET		(3)
#define	SERIAL_STATUS_DCD_CHANGED		(0x01 <<	\
                     SERIAL_STATUS_DCD_CHANGED_OFFSET)

#define	SERIAL_STATUS_RING_CHANGED_OFFSET		(2)
#define	SERIAL_STATUS_RING_CHANGED		(0x01 <<	\
                     SERIAL_STATUS_RING_CHANGED_OFFSET)

#define	SERIAL_STATUS_DSR_CHANGED_OFFSET		(1)
#define	SERIAL_STATUS_DSR_CHANGED		(0x01 <<	\
                     SERIAL_STATUS_DSR_CHANGED_OFFSET)

#define	SERIAL_STATUS_CTS_CHANGED_OFFSET		(0)
#define	SERIAL_STATUS_CTS_CHANGED		(0x01 <<	\
                     SERIAL_STATUS_CTS_CHANGED_OFFSET)

typedef ByteEnum SerialRole ;
#define    SR_DTE    	0	/* computer; transmit on 2 receive on 3 */
#define    SR_DCE    	1	/* modem; transmit on 3 receive on 2 */

#endif /* _SERIALDR_H_ */


sllang.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	  PCGEOS
 * MODULE:	  sllang.h
 * FILE:	  sllang.h
 *
 * AUTHOR:  	  Gene Anderson: Sep 20, 1992
 *
 * REVISION HISTORY:
 *	Date	  Name	    Description
 *	----	  ----	    -----------
    3/ 7/91	  atw	    Initial revision
 *	9/20/92	  gene	    Initial C version
 *
 * DESCRIPTION:
 *	This file contains language values.
 *
 *
 * 	$Id: sllang.h,v 1.3.6.4 98/08/11 15:27:12 jwu Exp $
 *
 ***********************************************************************/
#ifndef _SLLANG_H_
#define _SLLANG_H_

typedef ByteEnum StandardLanguage ;
    #define SL_UNIVERSAL 	0

    #define SL_FRENCH 		5
    #define SL_GERMAN 		6
    #define SL_SWEDISH 		7
    #define SL_SPANISH 		8
    #define SL_ITALIAN 		9
    #define SL_DANISH 		10
    #define SL_DUTCH 		11
    #define SL_PORTUGUESE 	12
    #define SL_NORWEGIAN 	13
    #define SL_FINNISH 		14
    #define SL_SWISS 		15
    #define SL_ENGLISH 		16

    #define SL_ARABIC 		20
    #define SL_AUSTRALIAN 	21
    #define SL_CHINESE 		22
    #define SL_GAELIC 		23
    #define SL_GREEK 		24
    #define SL_HEBREW 		25
    #define SL_HUNGARIAN 	26
    #define SL_JAPANESE 		27
    #define SL_POLISH 		28
    #define SL_SERBO_CROATN 	29
    #define SL_SLOVAK 		30
    #define SL_RUSSIAN 		31
    #define SL_TURKISH 		32
    #define SL_URDU 		33
    #define SL_AFRIKAANS 	34
    #define SL_BASQUE 		35
    #define SL_CATALAN 		36
    #define SL_CANADIAN 		37
    #define SL_FLEMISH 		38
    #define SL_HAWAIIAN 		39
    #define SL_KOREAN 		40
    #define SL_LATIN 		41
    #define SL_MAORI 		42
    #define SL_NZEALAND 		43
    #define SL_BRITISH 		44

    /*
     * SL_ENGLISH was mis-used as the UK English in responder, and now
     * we need to differentiate (N9000V20) UK and US English.
     */
    #define SL_US_ENGLISH 	45
    #define SL_UK_SCANDINAVIAN 	46

    #define SL_MALAY 		47
    #define SL_INDONESIAN        48

    #define SL_DEFAULT 		SL_ENGLISH

/*
#ifdef ANSI_HACK

struct {
  WordFlags LD_DUMMY_SPACE;
} LanguageDialect;

#else

typedef WordFlags LanguageDialect;

#endif

*/
    #define LD_DEFAULT 		0x0080
    #define LD_ISE_BRITISH 	0x0040
    #define LD_IZE_BRITISH 	0x0020
    #define LD_AUSTRALIAN 	0x0010
    #define LD_FINANCIAL 	0x0008
    #define LD_LEGAL 		0x0004
    #define LD_MEDICAL 		0x0002
    #define LD_SCIENCE 		0x0001

#endif /* _SLLANG_H_ */


Internal\Resp\smdefine.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1994-1998. Nokia Mobile Phones
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

    SMS specific constants and structures

-----------------------------------------------------------------------------
*/

@ifndef  SMDEFINE_GOH
@define  SMDEFINE_GOH

/*  INCLUDE FILES  */

/*  C CONSTANTS  */

#define SMS_RECEIVED_MESSAGE_TOKEN       "RSMS"
#define SMS_RECEIVED_BUSINESS_CARD       "RBCD"
#define SMS_RECEIVED_SERVICE_CARD        "RSCD"
#define SMS_STANDARD_MESSAGE             "SMST"
#define SMS_BUSINESS_CARD_KEYWORD        "Business Card"
#define SMS_SERVICE_CARD_KEYWORD         "Service Card"

#define SMS_ASCII_ADDRESS_MAX_LENGTH     22
#define SMS_GSM_0340_ADDRESS_MAX_LENGTH  20
#define SMS_INTERNATIONAL_NUMBER         0x91
#define MAX_ADDRESS_SIZE                 22
#define SMS_GSM_MAX_USER_DATA_LENGTH     160
#define SMS_GSM_MAX_8BIT_USER_DATA       140

#define SMS_MAX_MSGCENTRE_NAME_LEN             30
#define SMS_MAX_MSGCENTRE_EMPTY_LIST_ITEM_LEN  30
#define SMS_MSGCENTREFILE_NAME_SIZE             8

#define SIM_MESSAGE                      0x49

#define SMS_CONTACT_DEVICE_DB            -1

#define SMS_MESSAGE_IS_IN_SIM            0x8000
#define SMS_MESSAGE_REPLACETYPE_MASK     0xFF

/* .INI-file constants */
#define SMS_CATEGORY                     "SMS"
#define SMS_OPTIONS_REPLY_PATH           "replyPath"
#define SMS_OPTIONS_VAL_PERIOD           "validityPeriod"
#define SMS_OPTIONS_MSG_CONVERSION       "messageConversion"
#define SMS_OPTIONS_SC_NUMBER            "scNumber"
#define SMS_OPTIONS_SC_NAME              "scName"
#define SMS_TEMP_SC_NUMBER               "tempScNumber"
#define SMS_TEMP_REPLY_PATH_SET          "tempReplySet"

/*  GEOS CONSTANTS  */

@define    SMS_BITS_IN_WORD                     16    /*added 4.11.97*/
/*  C MACROS  */

#define CHANGE_SEGMENT   word wTemp; \
                        _asm mov wTemp, ds; \
                        GeodeLoadDGroup (GeodeGetCodeProcessHandle ())

#define RESET_SEGMENT    _asm mov ds, wTemp

/*  GEOS MACROS  */

/*  DATA TYPES  */

#define SMDCS_EIGHT_BIT_MASK  0x3d
#define SMDCS_EIGHT_BIT_OFFSET  2

#define SMS_DO_EIGHT_BIT_MASK   0x8000

typedef ByteFlags MessageParameters ;
#define SMS_MTI_SMS_SUBMIT  0x01
#define SMS_VPF_INTEGER     0x10

typedef enum {
     SMRP_NO	  = 0x0,
     SMRP_YES	  = 0x80,
     SMRP_USED	  = 0xFF
} SMReplyPath} ;

typedef enum {
     SMVP_ONE_HOUR	   = 11,
     SMVP_SIX_HOURS	  = 71,
     SMVP_ONE_DAY	    = 167,
     SMVP_ONE_WEEK	   = 173,
     SMVP_MAX	        = 255
} SMValidityPeriod} ;

typedef enum {
     SMMC_NORMAL	           = 0x0,
     SMMC_FAX_GROUP_3	      = 0x22,
     SMMC_FAX_GROUP_4	      = 0x23,
     SMMC_VOICE	            = 0x24,
     SMMC_ERMES	            = 0x25,
     SMMC_PAGING	           = 0x26,
     SMMC_EMAIL	            = 0x2D,
     SMMC_X400	             = 0x31
} SMMessageConversion} ;

typedef enum {
     SM_TYPE_0	                        = 0x40,
     SM_REPLACE_TYPE_1	                = 0x41,
     SM_REPLACE_TYPE_2	                = 0x42,
     SM_REPLACE_TYPE_3	                = 0x43,
     SM_REPLACE_TYPE_4	                = 0x44,
     SM_REPLACE_TYPE_5	                = 0x45,
     SM_REPLACE_TYPE_6	                = 0x46,
     SM_REPLACE_TYPE_7	                = 0x47,
     SM_RETURN_CALL_MESSAGE	           = 0x5F
} SMProtocolId} ;

typedef struct {
     byte  msg_status;
     byte  msg_ref;
     byte  msg_params;
#ifdef FACELIFT
     byte  type_of_address;
#else
     byte  address_format;
#endif
     TCHAR address[22];
     TCHAR sc_address[22];
     byte  protocol_id;
     byte  dcs;
     byte  time_stamp[7];
} SMAddressInfo} ;

@ifdef FACELIFT
typedef enum {
     SMBC_ON	  = 0x1,
     SMBC_OFF	  = 0x31,
     SMBC_INDEX	  = 0x32
} SMShowBroadcastMessages} ;

typedef enum {
     SMBC_DISPLAY_AND_STORE	  = 0x33,
     SMBC_STORE_ONLY	  = 0x34,
     SMBC_DISPLAY_ONLY	  = 0x35
} SMBroadcastMessagesMode} ;

typedef enum {
    SMDRR_NO     = 0x0,
    SMDRR_YES     = 0x20,
    SMDRR_SHOWIMMEDIATELY     = 0x40
} SMDeliveryReportRequest} ;

typedef enum {
     SMCM_OFF	  = 0x0,
     SMCM_ON	  = 0x1
} SMConcatenatedMessages} ;

typedef ByteFlags SMSInfoServiceLanguage ;
#define SMS_ISL_ALL                  0x0001
#define SMS_ISL_FINNISH              0x0002
#define SMS_ISL_NORWEGIAN            0x0004
#define SMS_ISL_SWEDISH              0x0008
#define SMS_ISL_DANISH               0x0010
#define SMS_ISL_DUTCH                0x0020
#define SMS_ISL_GERMAN               0x0040
#define SMS_ISL_ENGLISH              0x0080
#define SMS_ISL_FRENCH               0x0100
#define SMS_ISL_ITALIAN              0x0200
#define SMS_ISL_SPANISH              0x0400
#define SMS_ISL_PORTUGUESE           0x0800
#define SMS_ISL_GREEK                0x1000
#define SMS_ISL_TURKISH              0x2000

@endif

/*  CLASS DEFINITIONS  */

/*  EXTERNAL OBJECTS  */

/*  EXTERNAL DATA STRUCTURES  */

typedef struct {
    SMReplyPath	        SMSO_replyPath;
    SMValidityPeriod	SMSO_validityPeriod;
    SMMessageConversion	SMSO_messageConversion;
    TCHAR               SMSO_scAddress[ MAX_ADDRESS_SIZE ];
    byte                SMSO_dataCodingScheme;
    word                SMSO_userDataLength;
    Boolean             SMSO_userDataHeader;
} SMSendingOptions} ;

typedef struct {
    VMChainLink  SMSTH_meta;
    TCHAR        SMSTH_text;
} SMSTextHeader} ;

/*  GLOBAL FUNCTION PROTOTYPES  */

@endif /* End of File */


Internal\Resp\smreg.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1996-1997. Nokia Mobile Phones
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

    Using this library applications can register themselves to be a
    receiver of a short message.

-----------------------------------------------------------------------------
*/

@ifndef  SMREG_GOH
@define  SMREG_GOH

/*  INCLUDE FILES  */

@include  <internal/resp/smdefine.goh>

/*  C CONSTANTS  */

/*  GEOS CONSTANTS  */

/*  C MACROS  */

/*  GEOS MACROS  */

/*  DATA TYPES  */

typedef enum {
    SMRR_FAIL    ,
    SMRR_OK    ,
    SMRR_APPLICATION_NOT_REGISTERED
} SMRegResult} ;

typedef ByteFlags SMRegIntegerToHexFlags ;
#define SMRITH_NULL_TERMINATE  0x80
#define SMRITH_WORD_LENGTH     0x40
#define SMRITH_BYTE_LENGTH     0x20

typedef enum {
    SMREG_ERROR_INVALID_MESSAGE_PROTOCOL    ,
    SMREG_ERROR_INVALID_NUMBER_OF_MESSAGES
} SMRegErrors} ;

#define SMREG_PROTOCOL_LENGTH_WORD  4
#define SMREG_PROTOCOL_LENGTH_BYTE  2
/*  CLASS DEFINITIONS  */

/*  EXTERNAL OBJECTS  */

/*  EXTERNAL DATA STRUCTURES  */

/*  GLOBAL FUNCTION PROTOTYPES  */

SMRegResult SMRegRegisterApplication ( GeodeToken appl,
                                      TCHAR *messageProtocol,
                                      word numOfMessages);
SMRegResult SMRegUnregisterApplication ( GeodeToken appl,
                                        TCHAR *messageProtocol,
                                        word numOfMessages);
TCHAR *     SMRegIntegerToHex *     ( word value,
                               TCHAR *buffer,
                               SMRegIntegerToHexFlags flags);

@endif /* End of File */


Internal\Resp\smsconf.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1996-1997. Nokia Mobile Phones
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

    Header file for Supplementary Service Settings controller library.

-----------------------------------------------------------------------------
*/

@ifndef SMSCONF_GOH
@define SMSCONF_GOH

@deflib smsconf

/*  INCLUDE FILES  */

@include   <stdapp.goh>
#include   <library.h>

/*  C CONSTANTS  */

/*  GEOS CONSTANTS  */

/* message states */
#define SMSC_PENDING    0x20
#define SMSC_FAILED     0x40
#define SMSC_DELIVERED  0

/*  C MACROS  */
#define CW_DEFAULT_FEATURES      (NULL)
#define SMSC_SENT                99

/*  GEOS MACROS  */

/*  DATA TYPES  */
typedef int RetVal ;

/*  CLASS DEFINITIONS  */

/* CDivertingClass */
/*  7.1. SMSConfProcessClass */

    /* External messages. */

/*    GI_visMoniker = list { @SMSConfText };*/
/*    GI_comp = @SMSConfPrimary;*/

 /*   GAI_states = @default;*/

@class SMSConfDynamicListClass, GenDynamicListClass;
    @message void MSG_SMSC_LIST_UPDATE ();
@endc

 /*  7. CLASS DEFINITIONS */
/*  7.2. SMSConfApplicationClass */

/*  7.3. SMSConfInteractionClass */

@class  SMSConfViewClass, GenViewClass;
    @message void MSG_SMSC_INVALIDATE ();
@endc

/*  7.4  SMSConfD*/

@class SMSConfControlClass, GenControlClass;

typedef WordFlags CSMSFeatures ;
#define SMSC_DYN_LIST        (0x0001)
#define SMSC_VIEW            (0x0002)
#define SMSC_CLOSE           (0x0004)
#define SMSC_DELETE          (0x0008)
#define SMSC_CLEAR_LIST      (0x0010)

#define CSMS_DEFAULT_FEATURES  (SMSC_VIEW | SMSC_CLEAR_LIST | SMSC_DELETE | SMSC_CLOSE | SMSC_DYN_LIST )

/* Internal messages. */
    /* messages for UI buttons */
    @message void MSG_SMSC_CLEAR ();
    @message void MSG_SMSC_DELETE ();
    @message void MSG_SMSC_CLOSE ();

    /* for adding and deletin */
    @message void MSG_SMSC_VM_ADD ();
    @message void MSG_SMSC_VM_REMOVE ();

    /* Sent by dynamic list when list is scrolled */
    @message (GEN_DYNAMIC_LIST_QUERY_MSG) MSG_SMSC_LIST_QUERY;

    /* Sent by dynamic list when user makes a selection. */
    @message (GEN_ITEM_GROUP_APPLY_MSG) MSG_SMSC_LIST_APPLY;

    /* sent for alternating trigger states */
    @message void  SMSC_MSG_DISABLE_TRIGGERS  ();
    @message void  SMSC_MSG_ENABLE_TRIGGERS  ();

    /* creates header field for UI */
    @message void MSG_SMSC_HEADER_CREATE ();

    /* initiates empty list */
    @message void MSG_SMSC_LIST_INITIATE ();

    @message void MSG_SMSC_LIST_SET ();

/*    @message void MSG_SMSC_LIST_UPDATE();*/

/*    @message (MSG_NOTIFY_FILE_CHANGE)MSG_SMSC_NOTIFY_FILE_CHANGE; */

    /* creates empty VM file */
    @message void MSG_SMSC_VM_CREATE ();

    /* destroys VM file */
    @message void MSG_SMSC_VM_DELETE ();

    @instance optr SMSControlObj = NULL;

    @default GI_states = ( @default | GS_ENABLED );
/*    @default GII_type = GIT_PROPERTIES;*/
    @default GII_visibility = GIV_DIALOG;
    @default GII_attrs = ( @default | GIA_NOT_USER_INITIATABLE  | GIA_MODAL);
/*  EXTERNAL OBJECTS  */

/*  EXTERNAL DATA STRUCTURES  */

@endc

@endlib /* ssset */
/*
typedef struct
    {
    char Number[40];
    char Message[ 20];
    } SMSConfData;

*/

/* for delivering form and to this library */

#define SMSC_ADDRESS_LEN     23
#define SMSC_TIME_STAMP      7
#define SMSC_MSG_LEN         11
#define SMSC_NAME_LEN        31

typedef struct
    {
    byte msg_ref;                    /* reference number */
    byte msg_status;               /* status NOTE meaning is not same always*/
    byte typeOfAddress;
    char address[ SMSC_ADDRESS_LEN]; /* phone number */
    byte time_stamp[ SMSC_TIME_STAMP];    /*  */
    char msg_data[ SMSC_MSG_LEN];      /* message data */
    char name[ SMSC_NAME_LEN];      /* name of target */

    Boolean msg_showimmediately; /* TRUE if show note when message is sent */

    } SMSCData    } ;

/*RetVal _cdecl SMSConfAddMsg(STR_ECI_SMS_DELIV_STATUS* Deliv_status,
                SMSConfData* MessageData);*/

extern RetVal _cdecl SMSConfAddMsg ( SMSCData* MessageData);

#define SMSC_GET_NEXT    1
#define SMSC_GET_PREV    2
#define SMSC_SET_INIT    0   /* set current item as 0 */

/* return values for get function*/
#define SMSC_NO_MSG          -1
#define SMSC_NO_MORE_MSG     2
#define SMSC_OK              0

extern RetVal _cdecl SMSConfGetMsg ( SMSCData*, byte);

@endif /* End of File */


Internal\Resp\smsedit.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1995-1997. Nokia Mobile Phones
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

    SMS editor library

-----------------------------------------------------------------------------
*/
@ifndef _SMSEDIT_GOH
@define _SMSEDIT_GOH

@optimize
@deflib    smsed

/*  INCLUDE FILES  */

@include  <viewer.goh>

/*  C CONSTANTS  */

/*  GEOS CONSTANTS  */

/*  C MACROS  */

/*  GEOS MACROS  */

/*  DATA TYPES  */

typedef enum {
    SEFC_COPY     = 0x0,
    SEFC_EDIT    ,
    SEFC_CREATE_NEW    ,
    SEFC_CLOSE_VIEWER    ,
    SEFC_CANCEL
} SMSEditFormattingCommands} ;

/*  CLASS DEFINITIONS  */

@class SMSEditClass, ViewerControlClass;

/*  Returns the text content of the text object
 */
@message word MSG_SMS_EDIT_GET_TEXT_CONTENT (TCHAR *buffer);

/*  Sets the focus to the text object and highlights wanted range of text
 */
@message void MSG_SMS_EDIT_HIGLIGHT_TEXT (word begin, word end);

/*  Sets the focus to the first adress line and highlights the whole address
 */
@message void MSG_SMS_EDIT_HIGLIGHT_ADDRESS ();

/*  Sets the focus to the text object and places the cursor at the start of
 *  text.
 */
@message void MSG_SMS_EDIT_NORMAL_TEXT ();

/*  Returns the text in the first address line.
 */
@message word MSG_SMS_EDIT_GET_ADDRESS1_TEXT (TCHAR *buffer);

/*  Returns the text in the second address line.
 */
@message word MSG_SMS_EDIT_GET_ADDRESS2_TEXT (TCHAR *buffer);

/*  Set text in the first address line.
 */
@message void MSG_SMS_EDIT_SET_ADDRESS1_TEXT (TCHAR *buffer);

/*  Set text in the second address line.
 */
@message void MSG_SMS_EDIT_SET_ADDRESS2_TEXT (TCHAR *buffer);

/* Returns the user modified state of the text object
 */
@message word MSG_SMS_EDIT_GET_MODIFIED_STATE ();

/* Checks if the text to be opened is formatted in notebook.
 * If so, opens a dialog asking the user what to do
 */
@message void MSG_SMS_EDIT_CHECK_TEXT_FORMATTING ();

/* Handles the output of the dialog opened with message above.
 */
@message void MSG_SMS_EDIT_HANDLE_FORMATTING_OUTPUT
                                  ( SMSEditFormattingCommands command );

/* Returns Accept reply costs bit in received message that is currently
 * open in editor.
 */
@message SMReplyPath MSG_SMS_EDIT_GET_REPLY_PATH ();

/* Returns the size of the text in text object.
 */
@message dword MSG_SMS_EDIT_GET_TEXT_SIZE ();

/* Grabs the focus to first address line.
 */
@message void MSG_SMS_EDIT_SET_FOCUS_TO_ADDRESS ();

@message void MSG_SMS_EDIT_APPEND_ADDRESS1_TEXT ( TCHAR *buffer);

/* JM */
/*  Returns length of the text in the first address line.
 */
@message dword MSG_SMS_EDIT_GET_ADDRESS1_TEXT_SIZE ();

typedef WordFlags SMSEditFeatures ;
#define SMSF_STAMP_BOX     (0x0100) /* Is there empty stamp box   */
#define SMSF_TEMPLATE      (0x0080) /* Is there word TEMPLATE     */
#define SMSF_CHAR_COUNTER  (0x0040) /* Is there a char counter    */
#define SMSF_REPLY_PATH    (0x0020) /* Is there a reply path      */
#define SMSF_STAMP         (0x0010) /* Is there a stamp           */
#define SMSF_POSTMARK      (0x0008) /* Is there a postmark        */
#define SMSF_TO            (0x0004) /* Is there a to field        */
#define SMSF_FROM          (0x0002) /* Is there a from field      */
#define SMSF_DEST_NUMBER   (0x0001) /* Is there a dest num field  */

#define    SMS_DEFAULT_FEATURES      (SMSF_STAMP_BOX | SMSF_CHAR_COUNTER)

@vardata void ATTR_TEXT_READ_ONLY;
/* Set the text object read only so the user can not interact with it */

@vardata void ATTR_TEXT_SELECTABLE;
/* If set the user can select and copy text, but otherwise text cannot be
 * changed.
 */

@vardata ChunkHandle ATTR_SMS_EDIT_SET_OBJECT_ENABLED_WHEN_ADDRESS_EXISTS;
/* Keeps the given generic object enabled as long as there is a valid
   character in the first address line. */

@vardata void ATTR_SMS_EDIT_ONE_ADDRESS_LINE;

@default GI_states = (@default | GS_ENABLED);

@endc

/*  EXTERNAL OBJECTS  */

/*  EXTERNAL DATA STRUCTURES  */

/*  GLOBAL FUNCTION PROTOTYPES  */

@endlib

@endif


Internal\Resp\smsend.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1995-1998. Nokia Mobile Phones
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

    Short Message address and send control library

-----------------------------------------------------------------------------
*/
@ifndef _SMSEND_GOH
@define _SMSEND_GOH

@deflib	smsend

/*  INCLUDE FILES  */

@include  <foamdb.h>
@include  <contdb.goh>
@include  <contlog.goh>
@include  <Internal/mboxInt.goh>
@include  <Internal/Resp/smdefine.goh>

/*  C CONSTANTS  */

typedef ByteFlags SMNumberSelectedFrom ;
#define SNSF_MANUAL      0x80
#define SNSF_CONTACTS    0x40
#define SNSF_RECENT      0x20
#define SNSF_NO_ADDRESS  0x10

/*  GEOS CONSTANTS  */

/*  C MACROS  */

/*  GEOS MACROS  */

/*  DATA TYPES  */

/*  CLASS DEFINITIONS  */

@class SMAddressControlClass, MailboxAddressControlClass;

typedef WordFlags SMAddressFeatures ;
#define SACF_RECENT 		(0x0002)
#define SACF_MANUAL 		(0x0001)

#define	SAC_DEFAULT_FEATURES	  (SACF_MANUAL | SACF_RECENT)

@default GI_states = (@default | GS_ENABLED);
@default GII_type = GIT_COMMAND;
@default GII_visibility = GIV_DIALOG;
@default GII_attrs = (GIA_MODAL | GIA_NOT_USER_INITIATABLE);

@prototype void SMAC_GET_DOCUMENT_INFO_MSG (DocumentInfo *docInfo=cx:dx);
/* Message used only for casting */

@message void MSG_SMAC_MANUAL_DIALING ();
/* User pressed the "manual dialing" trigger in the address control */

@message (CONTACT_LIST_NOTIFY_CONTACT_SELECTED_MSG) MSG_SMAC_CONTACT_SELECTED;
/* User pressed the "select" trigger in the address control */

@message (CONTACTS_CONTROL_NOTIFY_ENTRY_SELECTED_MSG) MSG_SMAC_RECENT_NUMBER_SELECTED;
/* User pressed the "Recent numbers" trigger in the address control */

@message void MSG_SMAC_CANCEL ();
/* User pressed the "cancel" trigger in the address control */

@message void MSG_SMAC_MSD_CANCEL ();
/* User pressed the "cancel" trigger in the send dialog */

@message (CONTACT_LIST_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG) MSG_SMAC_MULTIPLE_CONTACTS_SELECTED;
/* User pressed the "select" trigger in the address control */

@message (CONTACTS_CONTROL_NOTIFY_MULTIPLE_ENTRIES_SELECTED_MSG) MSG_SMAC_MULTIPLE_RECENT_NUMBER_SELECTED;

@message void MSG_SMAC_ADD_RECIPIENT ();

/* JM 18.02.1998 */
@message void MSG_SMAC_CHANGE_SIM_VIEW ();
@message void MSG_SMAC_CHANGE_DEVICE_MEMORY ();

/* JM 23.03.1998 */
@message (CONTACT_SIM_LIST_NOTIFY_MULTIPLE_CONTACTS_SELECTED_MSG) MSG_SMAC_MULTIPLE_SIM_CONTACTS_SELECTED;
/* User pressed the "select" trigger in the sim contact view */

@message void MSG_SMAC_OPEN_SEND_OPTIONS_DIALOG (); /*30.10*/

@instance DocumentInfo SMACI_docInfo;
/* DocumentInfo of document to send */

@instance ChunkHandle SMACI_postcard;
/* ChunkHandle of postcard used to display the document content */

@instance optr SMACI_transaction;
/* The current transaction, once we're told the body is available */

@vardata void ATTR_SMAC_REPLY_ACTIVATED;

@instance MemHandle SMACI_addressBlock;
/* Selected addresses are stored in this block */

@instance word      SMACI_numAddresses;
/* Number of selected addresses */

@instance byte      SMACI_addressSelectedFrom;
/* Indicates what kind of structures are stored in block
   SNSF_MANUAL: address read from address lines
   SNSF_CONTACTS: struct ContactListSelectedEntry
   SNSF_RECENT: struct RecentContactsData
 */

@vardata void ATTR_SMAC_MULTISELECT_ENABLED;
/*
 * Set this attribute, if you want to select multiple addresses.
 */

@endc;

/*  EXTERNAL OBJECTS  */

/*  EXTERNAL DATA STRUCTURES  */

/*  GLOBAL FUNCTION PROTOTYPES  */

extern _far _pascal MailboxError
    SMTransmitMessage    (TCHAR *address,
              const GeodeToken *destApp,
              const TCHAR *messsageText,
              SMSendingOptions *smSendingOptions,
              optr *errorText);

@endlib

@endif


Internal\Resp\smsfunc.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1995-1998. Nokia Mobile Phones
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

    Business card contoller

-----------------------------------------------------------------------------
*/

@ifndef _SMSFUNC_GOH
@define _SMSFUNC_GOH

@optimize
@deflib smsfunc

/*  INCLUDE FILES  */
#include  <geos.h>

/*  C CONSTANTS  */
#define SMS_MAX_VOICE_NUMBER  31

#define SMS_VCARD_DEFAULT_PORT_NUMBER    0xE2
#define SMS_VCARD_LONG_PORT_NUMBER_SIZE  4
/* max string size of port number is 4 */

/*  GEOS CONSTANTS  */

/*  C MACROS  */

/*  GEOS MACROS  */

/*  DATA TYPES  */
typedef struct {
    FieldID  BCF_fieldID;   /* FieldID */
    Boolean  BCF_selection; /* TRUE if field is selected */
} BusinessCardFields} ;

typedef ByteFlags SMSPrintDateAndTimeFlags ;
#define SPDATF_SECONDS            (0x80)
#define SPDATF_TIME_BEFORE_DATE   (0x40)

/*  CLASS DEFINITIONS  */

/*  EXTERNAL OBJECTS  */

/*  EXTERNAL DATA STRUCTURES  */

/*  GLOBAL FUNCTION PROTOTYPES  */

/*
 * Desc: Creates vCard from passed contact (dbHandle and record).
 *       Pass chunk array which includes all the fields you want to  ""
 *       add to vCard (BusinessCardFields).
 *       If bufferHandle is NullHandle then only length of the vCard is counted
 *       and nothing is written to buffer.
 *
 * Return: length of the vCard string
 */
extern word _cdecl ContactCardToVCardLen  (
    VMFileHandle    dbHandle,
    MemHandle       record,
    optr            fields, /* Chunk array which includes fieldIDs to add to */ ""
    MemHandle       bufferHandle,  /* Buffer for string */
    word            bufferLen );

/*
 * Desc: Parses passed vCard and creates contact card to passed dbHandle
 *
 * Return: optr of chunk array which includes handles of created contacts. ""
 */
extern optr _cdecl VCardParseVCard  (
    VMFileHandle    dbHandle,
    MemHandle       msgTextHandle );

extern void _cdecl VCardParseVCardToText  (
    MemHandle       targetHandle,
    MemHandle       sourceHandle );

extern Boolean _cdecl SMSFindURL  (
    MemHandle       sourceHandle,
    MemHandle       urlHandle,
    dword           *startPoint,
    dword           sourceLength );

extern Boolean _cdecl SMSFindPhoneNumber (
    MemHandle       sourceHandle,
    MemHandle       numberHandle,
    word            *startPoint,
    word            *endPoint,
    word            sourceLength );

extern void _cdecl SMSDocStoreText  (
    DocumentHandle  docHandle,   /* document to store the text */
    void            *buffer,     /* the text to be stored      */
    word            bufferLen ); /* text length or 0 if null term. */

extern word _cdecl SMSDocGetText  (
    DocumentHandle  docHandle, /* document to get the text */
    void            *buffer,   /* buffer to store the text */
    word            count );   /* num of characters to get */

extern void _cdecl SMSDateAndTimeToString  (
    TCHAR                    *buffer,    /* in/out  Buffer for result string. */
    TimerDateAndTime         dateAndTime,/* in      date and time             */
    SMSPrintDateAndTimeFlags printFlags  /* in      printing flags            */
    );

extern TCHAR * _cdecl SMSUnicodeToGeos  (
    TCHAR           *target,
    void            *source,
    word            length ); /* length of source */

extern word _cdecl SMSCountMessageParts (
    MemHandle       sourceHandle,
    word            length ); /* length of source */

@endlib

@endif


Mailbox\smtd.goh

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1995 -- All Rights Reserved
 *
 * PROJECT:	  Clavin
 * MODULE:	  Small Message Transprot Driver
 * FILE:	  smtd.h
 *
 * AUTHOR:  	  Skarpi Hedinsson: Feb  3, 1995
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	SH	2/ 3/95   	Initial version
 *
 * DESCRIPTION:
 *	C definitions for smtd.def
 *
 *
 * 	$Id: smtd.goh,v 1.3.6.1 96/04/28 08:33:15 chris Exp $
 *
 ***********************************************************************/
#ifndef _SMTD_H_
#define _SMTD_H_

#endif


socket.goh

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1994 -- All Rights Reserved
 *
 * PROJECT:	  Socket
 * MODULE:	  socket library
 * FILE:	  socket.goh
 *
 * AUTHOR:  	  Eric Weber: Dec  5, 1994
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	EW	12/ 5/94   	Initial version
 *
 * DESCRIPTION:
 *	Socket library C interface
 *
 *
 * 	$Id: socket.goh,v 1.22.1.7 97/09/18 16:11:48 jwu Exp $
 *
 ***********************************************************************/
#ifndef _SOCKET_GOH_
#define _SOCKET_GOH_

#include  <medium.h>

@deflib	socket

/* ############################################################################
 * 		       Socket data types
 * ##########################################################################*/

typedef	word	Socket	; /* 16-bit handle for socket */

/*
 *  A port identifies a source or destination for a packet within a machine
 */
typedef struct {
    word		SP_port;	/*  16-bit port number */
    ManufacturerID	SP_manuf;	/*  16-bit manufacturer's ID */
} SocketPort} ;

/*
 *  Some domains only allow the use of 16 bit port numbers.  For these domains
 *  the SP_manuf field should be set to the value
 *  MANUFACTURER_ID_SOCKET_16BIT_PORT
 */

/*
 *  A SocketAddress identifies a particular remote machine
 *
 *  SA_domainSize need be initialized only if the library will write to the
 *  buffer pointed to by SA_domain (i.e. when a domain name is a return value)
 *  It is ignored otherwise.
 *
 *  The actual address follows this structure.
 */

typedef struct {
    SocketPort	SA_port;

/*  size in bytes of SA_domain buffer */
    word	SA_domainSize;

/*  null terminated domain name */
    TCHAR	*SA_domain;

/*  size in bytes of address data */
    word	SA_addressSize;

} SocketAddress} ;

/*
 *  A SocketCondition indicates either the current or desired state of
 *  a socket, for use with SocketCheckReady
 */
typedef ByteEnum SocketCondition ;
#define SC_READ 	0x0				/*  data arrived */
#define SC_WRITE 	0x1			/*  data can be written */
#define SC_ACCEPT 	0x2			/*  connect request arrived */
#define SC_EXCEPTION 	0x3			/*  an exception occurred */
#define SC_URGENT 	0x4			/*  urgent data arrived */

/*
 *  A SocketCheckRequest indicates a desired condition on some socket
 */
typedef struct {
    word		SCR_socket;
    SocketCondition	SCR_condition;
    byte                SCR_reserved;
} SocketCheckRequest} ;

/*
 *  Sockets can use either of two different conventions for delivering data:
 *    datagram sockets give high performance, but may be delivered out of
 * 	order or not delivered at all, without the user's knowledge
 *    stream sockets guarantee that all data will be delivered in order
 * 	and correctly, but doesn't preserve packet boundries
 */
typedef ByteEnum SocketDeliveryType ;
#define SDT_DATAGRAM 	0x0		/*  unreliable packets */
#define SDT_SEQ_PACKET 	0x1		/*  reliable packets */
#define SDT_STREAM 	0x2		/*  reliable bytes */

/*
 *  SocketLoadType controls how geodes are loaded when invoked via
 *  LoadOnMsg
 */
/* enum SocketLoadType */
typedef enum {
    SLT_USER_LOAD_APPLICATION     = 0x0,
    SLT_GEODE_LOAD    ,
} SocketLoadType} ;

/*
 *  The SocketBindFlags influence the behavior of SocketBind
 */
typedef WordFlags SocketBindFlags ;
#define SBF_REUSE_PORT 	(0x8000) /* allow bind even if port is already bound */
/* 15 bits unused */

/*
 *  SocketSendFlags control options for sending
 */
typedef WordFlags SocketSendFlags ;
#define SSF_ADDRESS 	(0x8000)	/*  an address is supplied in es:di */
#define SSF_URGENT 	(0x4000)	/*  this is urgent data */
#define	SSF_OPEN_LINK		(0x2000)    	/*  this datagram should open the */
                                        /*    link, if it is closed       */
/* 13 bits unused */

/*
 *  SocketRecvFlags control options for receiving
 */
typedef WordFlags SocketRecvFlags ;
#define SRF_ADDRESS 	(0x8000)	/*  return source address of data */
#define SRF_URGENT 	(0x4000)	/*  return urgent data, if any */
#define SRF_PEEK 	(0x2000)	/*  leave data in socket */
/* 13 bits unused */

/*
 * Options which can be set for sockets
 */
typedef enum {
    SO_RECV_BUF     = 0x0,                   /* receive buffer size     */
    SO_SEND_BUF     = 0x2,                   /* send buffer size        */
    SO_INLINE     = 0x4,                     /* inline urgent data      */
    SO_NODELAY     = 0x6,                    /* send data immediately   */
    SO_OWNER     = 0x8,                      /* which app owns socket   */
} SocketOption} ;

/*
 *  Functions which expect timeout values can be passed -1, which causes them
 *  to wait forever.
 */
#define SOCKET_NO_TIMEOUT 	(-1)

/* ############################################################################
 * 			     Error Codes
 * ##########################################################################*/

/*
 * Functions defined as returning type SocketError actually return a word
 * whose low byte is one the SocketError enum values defined below, and
 * the high byte is a SpecSocketDrError defined in sockmisc.h, or possibly
 * something else specific to the driver being used.
 */

#define SOCKET_GENERIC_ERROR (ecode)  ((ecode)&0x00ff)
#define SOCKET_SPECIFIC_ERROR (ecode) ((ecode)&0xff00)

typedef enum {
    SE_NORMAL     = 0x0,
/*  operation completed successfully */

    SE_OUT_OF_MEMORY    ,
/*
 *  the net library was unable to allocate memory
 *  either there is no more system memory available, or a net-library
 *  specific upper bound on memory usage has been exceeded
 */

    SE_PORT_IN_USE    ,
/*
 *  Another socket is already bound to this port, and the SBF_REUSE_PORT
 *  flag was not set.
 */

    SE_PORT_ALREADY_LISTENING    ,
/*  Another socket is already listening on this port. */

    SE_SOCKET_IN_USE    ,
/*
 *  The socket is already being used in a way inconsistent with the
 *  requested operation
 */

    SE_SOCKET_ALREADY_BOUND    ,
/*  The socket is already bound to a port. */

    SE_SOCKET_NOT_BOUND    ,
/*  The socket must be bound to a port for the requested operation. */

    SE_SOCKET_NOT_LISTENING    ,
/*  The socket must be listening on a port for the requested operation. */

    SE_SOCKET_LISTENING    ,
/*  A listening socket cannot be used for outgoing connections */

    SE_CONNECTION_REFUSED    ,
/*  Nobody is listening on the remote port. */

    SE_CONNECTION_FAILED    ,
/*  The connection is no longer valid, probably due to a link failure. */

    SE_CONNECTION_CLOSED    ,
/*  The connection has been closed from the other end. */

    SE_NON_UNIQUE_CONNECTION    ,
/*  Another connection with the same endpoint addresses and ports exists. */

    SE_TIMED_OUT    ,
/*
 *  The timeout period expired before the operation completed.  In some
 *  cases the protocol may enforce a shorter timeout then the user-specified
 *  value, so this is possible even where SOCKET_NO_TIMEOUT is used.
 */

    SE_CANT_LOAD_DRIVER    ,
/*  A driver required to establish the connection could not be loaded. */

    SE_UNKNOWN_DOMAIN    ,
/*  The requested domain is not known to the libarary. */

    SE_SYSTEM_SHUTDOWN    ,
/*  The operation was aborted because GEOS is exiting */

    SE_SOCKET_NOT_CONNECTED    ,
/*  The operation requires a connected socket */

    SE_SOCKET_ALREADY_CLOSED    ,
/*  The send side of the socket is already closed */

    SE_SOCKET_BUSY    ,
/*  Another thread is operating on the socket */

    SE_IMPROPER_CONDITION    ,
/*
 *  The requested condition for SocketCheckReady is not valid
 *  for a socket in the current state
 */

    SE_INFO_NOT_AVAILABLE    ,
/*  The driver could not provide the requested information */

    SE_DOMAIN_REQUIRES_16BIT_PORTS    ,
/*
 *  The requested domain only allows 16 bit port numbers.  The SP_manuf field
 *  must be set to MANUFACTURER_ID_SOCKET_16BIT_PORT
 */

    SE_CONNECTION_ERROR    ,
/*
 *  The connection was not made for some reason which does not have
 *  it's own specific SocketError
 */

    SE_MEDIUM_BUSY    ,
/*  The medium required for the connection is not available */

    SE_DESTINATION_UNREACHABLE    ,
/*  The requested destination is not available */

    SE_LINK_FAILED    ,
/*
 *  The low level link used for this connection failed or could not be
 *  established
 */

    SE_INTERNAL_ERROR    ,
/*
 *  The socket library received an impossible error code from the driver.
 *  Either the library or the driver has a bug.
 */

    SE_CLOSE_SEND_NOT_SUPPORTED    ,
/*
 *  It is not possible to close only the send side of a socket in this
 *  domain.  Use SocketClose instead.
 */

    SE_BIND_CONFLICT    ,
/*
 *  The same port cannot have both domain restricted and domain unrestricted
 *  bindings.
 */

    SE_ALL_PORTS_BUSY    ,
/*
 *  SocketConnect attempted to implicitly bind a socket, but failed because
 *  all port numbers in the range used by implicit binds were in use
 */

    SE_SOCKET_NOT_INTERRUPTIBLE    ,
/*
 *  An operation which cannot be interrupted is in in progress on the
 *  socket
 */

    SE_INTERRUPT    ,
/*  The operation was interrupted with SocketInterrupt */

    SE_PORT_NOT_LISTENING    ,
/* No listening socket or LoadOnMsg request exists for this port */

    SE_LISTEN_QUEUE_EMPTY    ,
/* No connections are pending for this port */

    SE_SOCKET_CLOSED    ,
/* The socket must be open for sending to call either SocketGetSocketName
   or SocketGetPeerName */

    SE_BUFFER_TOO_SMALL    ,
/* Returned by SocketResolve to mean that buffer for resolved address is
   too small */

    SE_TEMPORARY_ERROR    ,
/* Returned by SocketResolve to indicate that address resolution is temporarily
   unavailable for external reasons( such as network down or server failure )*/

    SE_EXCEPTION    ,
    SE_URGENT     = SE_EXCEPTION,
/* Returned by SocketRecv to indicate that some urgent data arrived on
   a reliable socket or an exception was received for a datagram socket */

    SE_NOT_IMPLEMENTED    ,
/* Returned by API functions which are not yet implemented */

    SE_CONNECTION_RESET
/* The connection was reset by the peer, by the local driver (perhaps in
 * response to SocketCloseDomainMedium, or by the socket library because
 * the socket is about to be freed when it's owner exits.
 */
} SocketError} ;

/* ############################################################################
 * 			       User API
 * ##########################################################################*/

/* create and return a  socket */
/* delivery is the type of socket to create */
/* socket will be owned by app whose thread calls SocketCreate  */
extern Socket
    _pascal SocketCreate (SocketDeliveryType delivery);

/* bind a socket s to a port p */
extern SocketError
    _pascal SocketBind (Socket s,
               SocketPort p,
               SocketBindFlags flags);

/* bind a socket s to a port p, but only for connections in domain */
extern SocketError
    _pascal SocketBindInDomain (Socket s,
                   SocketPort p,
                   SocketBindFlags flags,
                   TCHAR *domain);

/* allow up to qSize incoming connections to be queued for socket s */
extern SocketError
    _pascal SocketListen (Socket s,
             int qSize);

/* when a connection request is made to port p, invoke the program at
   disk:path using the method of slt.  See also UserLoadApplication and
   GeodeLoad. */
extern SocketError
    _pascal SocketAddLoadOnMsg (SocketPort p,
                  SocketLoadType slt,
                  word disk,
                  TCHAR *path);

/* same as above, but only for connections in one domain */
extern SocketError
    _pascal SocketAddLoadOnMsgInDomain (SocketPort p,
                       SocketLoadType slt,
                       word disk,
                       TCHAR *path,
                       TCHAR *domain);

/* cancel a general LoadOnMsg */
extern SocketError
    _pascal SocketRemoveLoadOnMsg (SocketPort p);

/* cancel a domain-specific LoadOnMsg */
extern SocketError
    _pascal SocketRemoveLoadOnMsgInDomain (SocketPort p,
                      TCHAR *domain);

/* interrupt a socket operation (connect, send, recv, accept) */
extern SocketError
    _pascal	SocketInterrupt	(Socket s);

/*
 * interrupt resolution of the specified address
 *
 * WARNING:	This function is unreliable.  It may not interrupt
 *		the desired resolve call,if it executes before the
 *		resolve call has begun to be processed.  If may also
 *		cause other, parallel resolve in the same domain
 *		to also be interrupted.
 */
extern SocketError
    _pascal	SocketInterruptResolve	(TCHAR *domain,
                    byte *address,
                    int  addrSize);

/* connect to a remote machine */
extern SocketError
    _pascal SocketConnect (Socket s,
              SocketAddress *addr,
              int timeout);

/* set an option on the socket.  This must be done AFTER SocketConnect. */
extern void
    _pascal SocketSetIntSocketOption (Socket skt,
                     SocketOption opt,
                     int newval);

/* read an option from a socket */
extern int
    _pascal SocketGetIntSocketOption (Socket skt,
                     SocketOption opt);

/* set up a queue for incoming connection requests on this socket */
extern int
    _pascal SocketCheckListen (SocketPort p,
                  TCHAR *domain,
                  int bufsize);

/* take first connect request out of queue and assign it to a new
   socket, which will be returned */
/* if return value is 0, error is in TPD_error */
extern Socket
    _pascal SocketAccept (Socket s,
             int timeout);

/* get the address of the remote side of the connection on a socket */
/* addr must be pointing to a pre-allocated structure with SA_domainSize
   and SA_addressSize initialized.  If SA_domainSize is nonzero, SA_domain
   must point to another pre-allocted buffer.  On return from this call,
   SA_domainSize and SA_addressSize will be set to the original size of the
   domain and address, and as much data as will fit will be copied into
   the domain buffer and address buffer. */
extern SocketError
    _pascal SocketGetPeerName (Socket s,
                  SocketAddress *addr);

/* get the address another machine would use to connect to a socket */
/* see above for notes on addr parameter */
extern SocketError
    _pascal SocketGetSocketName (Socket s,
                SocketAddress *addr);

/* send some data over a socket */
/* If the socket is of type SDT_SEQ_PACKET or SDT_STREAM it must already
   be connected, and the addr parameter is ignored.
   If the socket is of type SDT_DATAGRAM the addr parameter will be used
   if SSF_ADDRESS is set in the flags, otherwise the address to which
   the socket was connected (if any) will be used.
*/
extern SocketError
    _pascal SocketSend (Socket s,
               void *buffer,
               int bufSize,
               SocketSendFlags flags,
               SocketAddress *addr);

/* read some data from a socket */
/* buffer must point to a buffer of at lesat bufSize bytes */
/* If SRF_PEEK is set, the data is read nondestructively, and the return
   value is the total number of bytes available for reading.  Otherwise
   any data read is removed from the queue and the return value is the
   number of bytes actually read.   If the return value is 0, an error
   may have occured; if ThreadGetError reports SE_NORMAL, then there was
   no error but there was a zero sized packet in the queue. */
/* If SRF_ADDRESS is set, addr will be set to the address from which
   the data originated.  The parameter is handled in the manner described
   under SocketGetPeerName */
extern int
    _pascal SocketRecv (Socket s,
               void *buffer,
               int bufSize,
               int timeout,
               SocketRecvFlags flags,
               SocketAddress *addr);

/* signal that no more data will be sent over this socket */
extern SocketError
    _pascal SocketCloseSend (Socket s);

/* completely close and destroy a socket */
/* No further data can be sent, and any unread data will be destroyed.  This
   function may wait for the remote application to close it's socket also. */
extern SocketError
    _pascal SocketClose (Socket s);

/* close a connection with extreme predjudice */
/* Bypasses all normal protocol-level handshaking and unilaterally kills
   the connection.  Use with caution. */
/* you should still call SocketClose to free the socket data structures
   and flush unread data */
extern SocketError
    _pascal SocketReset (Socket s);

/*
 * Ask a domain to stop using a medium.
 *
 * The domain will close the desired medium if there are no connect
ions
 * using it, or if "force" is nonzero.
 *
 * The return value is nonzero if an error ocurred.  This could either be
 * that there is no link in the given domain and medium, or that the
 * link was not closed because it was in use.
 */

extern int
    _pascal SocketCloseDomainMedium (char *domain,
                    MediumAndUnit *mau,
                    Boolean force);

/*
 * Ask a domain to connect a medium.
 *
 * The precise interpretation of this depends on the medium and protocols
 * being used.  For example, in the TCPIP domain, the physical phone
 * line connection will be made, and so will the PPP connection, but
 * no TCP connection will be made.
 */
extern SocketError
    _pascal SocketOpenDomainMedium (SocketAddress *addr,
                   int timeout);

/* see if any socket meets a condition */
/* if return value is negative, error is in TPD_error */
/* otherwise return value is index of some socket meeting condition */
extern int
    _pascal SocketCheckReady (SocketCheckRequest *requests,
                 int numRequests,
                 int timeout);

/* return a chunk array of domain names known to the socket library */
/* error is in TPD_error if return value is zero */
extern ChunkHandle
    _pascal SocketGetDomains (optr domainList);

/* return a chunk array of MediumType with the media supported by
   this domain */
/* error is in TPD_error if return value is zero */
extern ChunkHandle
    _pascal SocketGetDomainMedia (char *domain,
                 optr mediaList);

/* store into mau the medium which would be used to establish a connection
   to a given address */
extern SocketError
    _pascal SocketGetAddressMedium (SocketAddress *sa,
                   MediumAndUnit *mau);

/*
 * Check if there is an active connection through the
 * specified unit of the medium.  If a point-to-point connection
 * exists (e.g., an IRLAP connection), then return the address
 * to which the connection exists.  If the connection is not
 * to a specific address (e.g., TCP/IP), then return a null
 * address (zero-sized.)
 *
 * PASS:
 *      domain = domain name (null-terminated string)
 *      buffer = buffer for address, large enough to accomodate
 * 			  the expected address.
 *      bufsize = size of address buffer, in bytes.
 *      mau     = medium of interest
 *
 * RETURN:
 *      SocketError of the operation (SE_NORMAL if none)
 *      buffer filled in with as much of the address as possible
 *      bufsize set to the total size of the address.  If this is
 *        larger then the passed value, the address was truncated to
 *        fit into the buffer
 */
extern SocketError
     _pascal SocketCheckMediumConnection (char *domain,
                     byte *buffer,
                     int *bufsize,
                     MediumAndUnit *mau);

/*
 * Get the local address of the connection using a particular medium.
 * This is the address another machine would use to connect to us
 * via that medium.
 *
 * PASS:
 *      domain = domain name (null-terminated string)
 *      buffer = buffer for address, large enough to accomodate
 * 			  the expected address.
 *      bufsize = size of address buffer, in bytes.
 *      mau     = medium of interest
 *
 * RETURN:
 *      SocketError of the operation (SE_NORMAL if none)
 *      buffer filled in with as much of the address as possible
 *      bufsize set to the total size of the address.  If this is
 *        larger then the passed value, the address was truncated to
 *        fit into the buffer
 */
extern SocketError
     _pascal SocketGetMediumAddress (char *domain,
                    byte *buffer,
                    int *bufsize,
                    MediumAndUnit *mau);

/* get the class of a controller which can be used to have the user
   enter an address in the correct format for some domain */
/* error in TPD_error if return val is 0 */
extern ClassStruct *
    _pascal SocketGetAddressController (char *domain);

/* get the maximum size of an address which could be returned from
   SocketGetSocketName or SocketGetPeerName for a socket connected
   in this domain */
/* error in TPD_error if return value is negative */
extern int
    _pascal SocketGetAddressSize (char *domain);

/*
 * Transform an address as returned by the address controller or constructed
 * according to the rules published for a domain, into an internal form
 * which can be used as part of a SocketAddress.
 *
 * Return value is the actual size of the resolved address.  If this
 * exceeds the size of the output buffer, the contents of output buffer
 * are undefined and the required size is returned.  If some other error
 * occurs, the return value is 0 and TPD_error has the SocketError.
 */
extern int
    _pascal SocketResolve ( char *domainName,
               byte *rawAddr,
               int addrSize,
               byte *result,
               int resultBuffSize );

/*
 * SocketCreateResolvedAddress is a convenience function that performs
 * a SocketResolve, and builds a complete SocketAddress into a temporary
 * block.
 */
extern MemHandle
    _pascal SocketCreateResolvedAddress (const char *domainName,
               byte *rawAddr,
               int addrSize);

/*
 * SocketSetMediumBusy sets whether the medium should appear busy
 * even when there are no active connections.  Medium should be
 * restored to normal as soon as medium may be allowed to close.
 *
 * NOTES:
 *	Should only be used by applications wishing to prevent
 *	non-forcing SocketCloseDomainMedium from closing the
 *	medium when there are no active connections.  An
 *	example would be an application which makes a series
 *	of connections with pauses between each connection
 *	and doesn't want the medium closed during a pause.
 *
 * Returns false if error.  This could be because there is
 * no link in the given domain and medium.
 */
extern Boolean
    _pascal SocketSetMediumBusy (char *domain,
                MediumAndUnit *mau,
                Boolean busy);

#ifdef __HIGHC__
pragma Alias(SocketCreate, "SOCKETCREATE");
pragma Alias(SocketBind, "SOCKETBIND");
pragma Alias(SocketBindInDomain, "SOCKETBINDINDOMAIN");
pragma Alias(SocketListen, "SOCKETLISTEN");
pragma Alias(SocketAddLoadOnMsg, "SOCKETADDLOADONMSG");
pragma Alias(SocketAddLoadOnMsgInDomain, "SOCKETADDLOADONMSGINDOMAIN");
pragma Alias(SocketRemoveLoadOnMsg, "SOCKETREMOVELOADONMSG");
pragma Alias(SocketRemoveLoadOnMsgInDomain, "SOCKETREMOVELOADONMSGINDOMAIN");
pragma Alias(SocketInterrupt, "SOCKETINTERRUPT");
pragma Alias(SocketConnect, "SOCKETCONNECT");
pragma Alias(SocketCheckListen, "SOCKETCHECKLISTEN");
pragma Alias(SocketAccept, "SOCKETACCEPT");
pragma Alias(SocketGetPeerName, "SOCKETGETPEERNAME");
pragma Alias(SocketGetSocketName, "SOCKETGETSOCKETNAME");
pragma Alias(SocketSend, "SOCKETSEND");
pragma Alias(SocketRecv, "SOCKETRECV");
pragma Alias(SocketCloseSend, "SOCKETCLOSESEND");
pragma Alias(SocketClose, "SOCKETCLOSE");
pragma Alias(SocketReset, "SOCKETRESET");
pragma Alias(SocketCloseDomainMedium, "SOCKETCLOSEDOMAINMEDIUM");
pragma Alias(SocketCheckReady, "SOCKETCHECKREADY");
pragma Alias(SocketGetDomains, "SOCKETGETDOMAINS");
pragma Alias(SocketGetDomainMedia, "SOCKETGETDOMAINMEDIA");
pragma Alias(SocketGetAddressMedium, "SOCKETGETADDRESSMEDIUM");
pragma Alias(SocketCheckMediumConnection, "SOCKETCHECKMEDIUMCONNECTION");
pragma Alias(SocketGetAddressController, "SOCKETGETADDRESSCONTROLLER");
pragma Alias(SocketGetAddressSize, "SOCKETGETADDRESSSIZE");
pragma Alias(SocketResolve, "SOCKETRESOLVE");
pragma Alias(SocketCreateResolvedAddress, "SOCKETCREATERESOLVEDADDRESS");
pragma Alias(SocketGetIntSocketOption, "SOCKETGETINTSOCKETOPTION");
pragma Alias(SocketSetIntSocketOption, "SOCKETSETINTSOCKETOPTION");
pragma Alias(SocketInterruptResolve, "SOCKETINTERRUPTRESOLVE");
pragma Alias(SocketOpenDomainMedium, "SOCKETOPENDOMAINMEDIUM");
pragma Alias(SocketGetMediumAddress, "SOCKETGETMEDIUMADDRESS");
pragma Alias(SocketSetMediumBusy, "SOCKETSETMEDIUMBUSY");
#endif

/* ############################################################################
 * 			  Error Checking
 * ##########################################################################*/

@endlib
#endif /* _SOCKET_GOH_ */


Internal\socketDr.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1994 -- All Rights Reserved
 *
 *			GEOWORKS CONFIDENTIAL
 *
 * PROJECT:	  PCGEOS
 * MODULE:	  socketDr.h
 * FILE:	  socketDr.h
 *
 * AUTHOR:  	  Jennifer Wu: Jul 25, 1994
 *
 * REVISION HISTORY:
 *	Date	  Name	    Description
 *	----	  ----	    -----------
 *	7/25/94	  jwu	    Initial version
 *
 * DESCRIPTION:
 *	C definitions for SocketDr.def.
 *
 *
 * 	$Id: socketDr.h,v 1.12.1.4 97/01/19 16:42:59 jwu Exp $
 *
 ***********************************************************************/
#ifndef _SOCKETDR_H_
#define _SOCKETDR_H_

#include  "sockmisc.h"

/*---------------------------------------------------------------------------*
 *
 * MbufHeader is identical to the PacketHeader structure defined in
 * Internal/socketInt.def.
 *
 *---------------------------------------------------------------------------*/

#define IF_BCAST     0x01
#define	IF_MCAST	    0x02

typedef struct {
    word    	MH_dataSize;
    word    	MH_dataOffset;   	/* offset in bytes */
    byte    	MH_flags;
    word    	MH_domain;
    byte    	MH_reserved;
} MbufHeader} ;	    	    /* different name from ASM to satisfy glue */

typedef struct {
    MbufHeader 	DH_common;
    byte    	DH_addrSize;
    byte    	DH_addrOffset;	    	/* offset in bytes */
    word    	DH_lport;   	    	/* local port */
    word    	DH_rport;   	    	/* remote port */
} DatagramHeader} ;

/*
 * Get the ptr to the data in a data buffer.  Works for datagram buffers
 * also if cast to MbufHeader.
 */
#if ERROR_CHECK
#define mtod (x)   (ECCheckBounds(x), \
           ECCheckBounds((byte *)(x) + ((x)->MH_dataOffset)), \
           ((byte *)(x) + ((x)->MH_dataOffset)))
#else
#define mtod (x)   ((byte *)(x) + ((x)->MH_dataOffset))
#endif

/*
 * Get the ptr to the address in a datagram buffer.
 * Analogous to mtod definition above.
 */
#if ERROR_CHECK
#define mtoa (x)	(ECCheckBounds(x), \
         ECCheckBounds((byte *)(x) + ((x)->DH_addrOffset)), \
         ((byte *)(x) + ((x)->DH_addrOffset)))
#else
#define mtoa (x)     ((byte *)(x) + ((x)->DH_addrOffset))
#endif

/*------------------------------------------------------------------------ *
 *
 *	SocketCloseType
 *
 *------------------------------------------------------------------------ */

typedef word SocketCloseType ;
#define SCT_FULL 	0x0
#define SCT_HALF 	0x1

/*------------------------------------------------------------------------ *
 *
 *	SocketSendMode
 *
 *------------------------------------------------------------------------ */
typedef word SocketSendMode ;
#define SSM_NORMAL   	0x0
#define SSM_URGENT   	0x1

/*------------------------------------------------------------------------
 *
 *	SocketOptionType
 *
 *------------------------------------------------------------------------ */
typedef word SocketOptionType ;
#define SOT_RECV_BUF 	0x0
#define SOT_SEND_BUF 	0x1
#define SOT_INLINE   	0x2
#define SOT_NODELAY  	0x3

/*------------------------------------------------------------------------
 *
 *	MediumOptionType
 *
 *------------------------------------------------------------------------ */
typedef word MediumOptionType ;
#define MOT_ALWAYS_BUSY  0x0

/*------------------------------------------------------------------------ *
 *
 *	SocketDrError
 *
 *------------------------------------------------------------------------ */

typedef enum /*word*/ {
    SDE_NO_ERROR    ,   	    	   /* must be first */
    SDE_CONNECTION_REFUSED    ,        /* remote refuse to connect */
    SDE_CONNECTION_TIMEOUT    , 	    /* remote does not respond  */
    SDE_MEDIUM_BUSY    ,                 /* active connection outside */
    SDE_INSUFFICIENT_MEMORY    ,
    SDE_NOT_REGISTERED    ,               /* client has not reg with drvr */
    SDE_ALREADY_REGISTERED    ,           /* same client registering twice */
    SDE_CONNECTION_EXISTS    ,  	      /* opening duplicate connection */
    SDE_LINK_OPEN_FAILED    ,   	      /* couldn't open any links */
    SDE_DRIVER_NOT_FOUND    ,
    SDE_DESTINATION_UNREACHABLE    ,
    SDE_CONNECTION_RESET_BY_PEER    ,
    SDE_CONNECTION_RESET    ,
    SDE_UNSUPPORTED_FUNCTION    ,
    SDE_INVALID_CONNECTION_HANDLE    ,
    SDE_INVALID_ADDR_FOR_LINK    ,
    SDE_INVALID_ADDR    ,
    SDE_TEMPORARY_ERROR    ,
    SDE_INTERRUPTED
} SocketDrError} ;

#endif /* _SOCKETDR_H_ */


sockmisc.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1995 -- All Rights Reserved
 *
 *			GEOWORKS CONFIDENTIAL
 *
 * PROJECT:	  Socket
 * MODULE:
 * FILE:	  sockmisc.h
 *
 * AUTHOR:  	  Jennifer Wu: Dec  7, 1995
 *
 * REVISION HISTORY:
 *	Date	  Name	    Description
 *	----	  ----	    -----------
 *	12/ 7/95	  jwu	    Initial version
 *
 * DESCRIPTION:
 *	Miscellaneous socket definitions.
 *
 * 	$Id: sockmisc.h,v 1.5.2.4 97/01/20 17:18:00 cthomas Exp $
 *
 ***********************************************************************/
#ifndef _SOCKMISC_H_
#define _SOCKMISC_H_

/*
 * Specific Socket Driver Errors
 *
 * These go in the high byte of SocketDrError for the application to
 * interpret.
 *
 */
typedef enum /*word*/ {
    SSDE_DEVICE_BUSY     = 0x0100,	    /* serial port or modem driver in use */
    SSDE_DIAL_ERROR     = 0x0200,
    SSDE_LINE_BUSY     = 0x0300,   	    /* modem got a busy signal */
    SSDE_NO_DIALTONE     = 0x0400,
    SSDE_NO_ANSWER     = 0x0500,
    SSDE_NO_CARRIER     = 0x0600,
    SSDE_BLACKLISTED     = 0x0700,	    /* used in GSM network */
    SSDE_DELAYED     = 0x0800,  	    /* used in GSM network */
    SSDE_CALL_FAILED     = 0x0900, 	    /* couldn't dial for some strange reason */
    SSDE_NEG_FAILED     = 0x0a00,
    SSDE_AUTH_REFUSED     = 0x0b00,
    SSDE_AUTH_FAILED     = 0x0c00,
    SSDE_LQM_FAILURE     = 0x0d00,
    SSDE_LOOPED_BACK     = 0x0e00,
    SSDE_IDLE_TIMEOUT     = 0x0f00,
    SSDE_DEVICE_NOT_FOUND     = 0x1000,
    SSDE_DEVICE_TIMEOUT     = 0x1100,
    SSDE_DEVICE_ERROR     = 0x1200,
    SSDE_NO_USERNAME     = 0x1300,	    /* no username and password prompting used */
    SSDE_CANCEL     = 0x1400,    	    /* user cancelled */
    SSDE_INVALID_ACCPNT     = 0x1500,   /* invalid access point */
    SSDE_LOGIN_FAILED     = 0x1600,	    /* manual login application */
                                    /* not configured correctly */
    SSDE_LOGIN_FAILED_NO_NOTIFY     = 0x1700,
                    /* manual login application
                     * encountered an error, but doesn't
                     * wish the client app to inform
                     * the user */
} SpecSocketDrError} ;

/*--------------------------------------------------------------------------
 *
 *	Socket Exceptions
 *
 ------------------------------------------------------------------------- */

typedef enum /*word*/ {
    SDX_NO_ERROR    ,   	    	    /* must be first */
    SDX_SOURCE_QUENCH    ,
    SDX_PARAM_PROBLEM    ,
    SDX_TIME_EXCEEDED    ,
    SDX_UNREACHABLE
} SocketDrException} ;

/*--------------------------------
 *
 * 	    IP Constants
 *
 ------------------------------- */

#define IP_ADDR_SIZE 	4

/*
 * Maximum size of IP address in dotted-decimal notation: 255.255.255.255
 */
#define MAX_IP_DECIMAL_ADDR_LENGTH   	15
#define MAX_IP_DECIMAL_ADDR_LENGTH_ZT 	16

/*
 * Maximum size of a domain name is 255.  (RFC 1034, section 3.1)
 *  "To simplify implementations, the total number of octets that represent
 *  a domain name is limited to 255."
 */
#define MAX_IP_ADDR_STRING_LENGTH    	255
#define	MAX_IP_ADDR_STRING_LENGTH_ZT		256

#define LOOPBACK_NET  	127

/* -------------------------------------------------------------------
         Extended Socket Address Control Address

  The opaque part of the Socket Address Control Address structure
  contains an extended address with the following information:
   1) size of link parameters, including link type
   2) link type	    	    	    (optional)
   3) link parameters	    	    (optional)
   4) connection address
  where the nature of the link parameters depends on the link type.

  In the ExtendedSACAddress structure, the connection address
  immediately follows the opaque link parameters.

  The user readable link and connection addresses follow the
  opaque connection address.  The link address will be appended
  to the user readable connection address string, surrounded by
  parenthesis.  (This assumes the connection address has no
  parenthesis, which is true for IP.)

  For more information about the SocketAddressControlClass, and
  the context in which it will use an ExtendedSACAddress, see
  the file sac.goh

 ------------------------------------------------------------------- */

typedef word	LinkID	;   	   /* permanent identifier for a link
                      in the link database */

typedef byte	LinkType	;
#define LT_ADDR 	    0x00	   /* link params = link address */
#define	LT_ID		    0x01    	   /* link params = LinkID */

typedef struct {
    LinkType        LP_type;
 /* label byte	    LP_params;  */
} LinkParams} ;

typedef struct {
    word    	    ESACA_linkSize;
 /* label byte	    ESACA_opaque;   Start of LinkParams, immediately followed
                                    by the connection address */
} ExtendedSACAddress} ;

/* -------------------------------------------------------------------------
 *
 *	    TCP Extended Address Structures
 *
 *	These structures are defined here to give an example of the
 *	different forms a TCP address may take.  While the
 *	ExtendedSACAddress given above is common to all drivers, these
 *	declarations are specific to TCP.  The resolved forms assume
 *	the link driver will not change the link paramters during
 *	resolution, which is true of PPP and SLIP, but not necessarily
 *	of future drivers.
 *
 ------------------------------------------------------------------------ */

/*
 * A TCP extended address using an access point ID as the link address.
 */

typedef struct {
    word    TAPEA_linkSize; 	    	/* 3 */
    byte    TAPEA_linkType; 	    	/* LinkType (LT_ID) */
    word    TAPEA_accPntID;
} TcpAccPntExtendedAddress} ;

/*
 * A TCP extended address with no link address.
 */

typedef struct {
    word    TOEA_linkSize;  	    	/* 0 */
/*  label byte TOEA_ipAddr; 	    	IP address  */
} TcpOnlyExtendedAddress} ;

/*
 * The resolved form of the previous two structures.  A resolved
 * IP address is always 4 bytes.
 */
typedef struct {
    word    TAPRA_linkSize; 	    	/* 3 */
    byte    TAPRA_linkType; 	    	/* LinkType (LT_ID) */
    word    TAPRA_accPntID;
    byte    TAPRA_ipAddr[4];     	/*  IP address */
} TcpAccPntResolvedAddress} ;

typedef struct {
    word    TORA_linkSize;  	    	/* 0 */
    byte    TORA_ipAddr[4]; 	    	/* IP address  */
} TcpOnlyResolvedAddress} ;

/*
 * A TCP extended address with a non-accpnt link address.
 */

typedef struct {
    word    TNAPEA_linkSize;
    byte    TNAPEA_linkType;	    	/* LinkType (LT_ADDR) */
/*  label byte TNAPEA_addr;    	link address immed. followed by IP addr */
} TcpNonAccPntExtendedAddress} ;

/*---------------------------------------------------------------------------
 *
 *	    PPP server and client IP addresses
 *
 * Server and client addresses for use when our PPP is called by another.
 * We will be the server and the peer will be assigned the client address.
 *
 * From rfc1597:
 *	The Internet Assigned Numbers Authority (IANA) has reserved the
 *	following three blocks of the IP address space for private networks:
 *
 *	10.0.0.0    	-   10.255.255.255
 * 	172.16.0.0  	-   172.31.255.255
 *	192.168.0.0 	-   192.168.255.255
 *
 * We're using two addresses from this range, chosen completely at random. ;)
 ------------------------------------------------------------------------- */

# define CLIENT_IP_ADDR      0x0a455057	/* 10.69.80.87 in host byte order */
# define SERVER_IP_ADDR 	    0x0a4a5755	/* 10.74.87.85 in host byte order */

#define DEFAULT_SERVER_IP_ADDR 	0x55574a0a  /* 10.74.87.85 in network order */
#define DEFAULT_CLIENT_IP_ADDR 	0x5750450a  /* 10.69.80.87 in network order */

/*---------------------------------------------------------------------------
 *
 *	    	UDP/TCP assigned ports
 *
 -------------------------------------------------------------------------- */

#define	    ECHO	        	    7   	    	    /* TCP/UDP */
#define	    DISCARD	     	    9   	    	    /* TCP/UDP */
#define	    FTP_DATA	    	    20  	    	    /* TCP */
#define	    FTP	    	    	    21  	    	    /* TCP */
#define	    TELNET_SERVER	       23  	    	    /* TCP */
#define	    NAME_SERVER	         42  	    	    /* UDP */
#define	    WHOIS	       	    43  	    	    /* TCP */
#define	    DOMAIN_SERVER	       53  	    	    /* TCP/UDP */
#define	    FINGER	      	    79  	    	    /* TCP */

/*--------------------------------------------------------------------------
 *
 * 	SocketSubsystemNotification types
 *
 -------------------------------------------------------------------------- */
typedef enum {
    SSN_LINK_CONNECTED     = 0x0,
    SSN_LINK_NOT_CONNECTED    ,
} SocketSubsystemNotification} ;

#endif /* _SOCKMISC_H_ */


sound.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC/GEOS
 * FILE:	sound.h
 * AUTHOR:	Todd Stumpf, Sept. 1992
 *
 * DESCRIPTION:
 *	C version of sound.def
 *
 *	$Id: sound.h,v 1.27.1.3 97/07/21 18:31:38 nfiedler Exp $
 *
 ***********************************************************************/

#ifndef	__SOUND_H
#define __SOUND_H

#include  <driver.h>

/* EndOfSongFlags */
typedef ByteFlags EndOfSongFlags ;
#define EOSF_UNLOCK        0x0080               /* unlock block at EOS ?  */
#define EOSF_DESTROY       0x0040               /* destroy block at EOS ? */

#define UNLOCK_ON_EOS      EOSF_UNLOCK
#define DESTROY_ON_EOS     EOSF_DESTROY

/* SoundPrioritys */
typedef enum {
    SP_SYSTEM_LEVEL    =10,                        /* most urgent  */
    SP_ALARM    =20,
    SP_STANDARD    =30,
    SP_GAME    =40,
    SP_BACKGROUND    =50                           /* least urgent */
} SoundPriority} ;

#define SP_IMMEDIATE                   -1       /* really important */
#define SP_THEME                       +1       /* not quite so important */

/* SoundStreamSizes     */
typedef word SoundStreamSize ;
#define SSS_ONE_SHOT                    128    /* 128 bytes (very small)   */
#define SSS_SMALL                       256    /* 256 bytes                */
#define SSS_MEDIUM                      512    /* 512 bytes (nice size)    */
#define SSS_LARGE                       1024   /* 1024 bytes (a bit large) */

/* SoundStreamEvents */
typedef enum {
    SSE_VOICE_ON    =0,                           /* turn on voice event      */
    SSE_VOICE_OFF    =2,                          /* turn off voice event     */
    SSE_CHANGE    =4,                             /* change instrument        */
    SSE_GENERAL    =6                             /* system-specific event    */
} SoundStreamEvents} ;

/* SoundStreamDeltaTimeTypes */
typedef enum {
    SSDTT_MSEC    =8,                             /* wait for N mili seconds */
    SSDTT_TICKS    =10,                           /* wait for N ticks        */
    SSDTT_TEMPO    =12,                           /* wait for N beats        */
} SoundStreamDeltaTimeType} ;

/* Sound Stream General Events */
typedef enum {
    GE_NO_EVENT    =0,                            /* dummy event (NOP)        */
    GE_END_OF_SONG    =2,                         /* marks end of song        */
    GE_SET_PRIORITY    =4,                        /* changes sound priority   */
    GE_SET_TEMPO    =6,                           /* changes sound tempo      */
    GE_SEND_NOTIFICATION    =8,                   /* sends encoded message    */
    GE_V_SEMAPHORE    =10                         /* V's a specified semaphore*/
} GeneralEvent} ;

/*	Note frequencies.  For actual frequencies, see sound.def. */
#define	REST	 		 0

#define	LOW_C_b			 247
#define	MIDDLE_C_b		 494
#define	HIGH_C_b		 988

#define	LOW_C	 		 262
#define	MIDDLE_C	 	 523
#define	HIGH_C	 		 1047

#define	LOW_C_SH	 	 277
#define	MIDDLE_C_SH	 	 554
#define	HIGH_C_SH	 	 1109

#define	LOW_D_b	 	 LOW_C_SH
#define	MIDDLE_D_b	 	 MIDDLE_C_SH
#define	HIGH_D_b	 	 HIGH_C_SH

#define	LOW_D	 		 294
#define	MIDDLE_D		 587
#define	HIGH_D	 		 1175

#define	LOW_D_SH	 	 311
#define	MIDDLE_D_SH	 	 622
#define	HIGH_D_SH	 	 1245

#define	LOW_E_b	 	 LOW_D_SH
#define	MIDDLE_E_b	 	 MIDDLE_D_SH
#define	HIGH_E_b	 	 HIGH_D_SH

#define	LOW_E	 		 330
#define	MIDDLE_E	 	 659
#define	HIGH_E	 		 1319

#define	LOW_E_SH		 349
#define	MIDDLE_E_SH		 698
#define	HIGH_E_SH		 1397

#define	LOW_F_b			 LOW_E
#define	MIDDLE_F_b		 MIDDLE_E
#define	HIGH_F_b		 HIGH_E

#define	LOW_F	 		 LOW_E_SH
#define	MIDDLE_F	 	 MIDDLE_E_SH
#define	HIGH_F	 		 HIGH_E_SH

#define	LOW_F_SH	 	370
#define	MIDDLE_F_SH	 	740
#define	HIGH_F_SH	 	1480

#define	LOW_G_b	 	LOW_F_SH
#define	MIDDLE_G_b	 	MIDDLE_F_SH
#define	HIGH_G_b	 	HIGH_F_SH

#define	LOW_G	 		392
#define	MIDDLE_G	 	784
#define	HIGH_G	 		1568

#define	LOW_G_SH	 	415
#define	MIDDLE_G_SH	 	831
#define	HIGH_G_SH	 	1661

#define	LOW_A_b	 	LOW_G_SH
#define	MIDDLE_A_b	 	MIDDLE_G_SH
#define	HIGH_A_b	 	HIGH_G_SH

#define	LOW_A	 		440
#define	MIDDLE_A	 	880
#define	HIGH_A	 		1760

#define	LOW_A_SH	 	466
#define	MIDDLE_A_SH	 	932
#define	HIGH_A_SH	 	1865

#define	LOW_B_b	 	LOW_A_SH
#define	MIDDLE_B_b	 	MIDDLE_A_SH
#define	HIGH_B_b	 	HIGH_A_SH

#define	LOW_B	 		MIDDLE_C_b
#define	MIDDLE_B	 	HIGH_C_b
#define	HIGH_B	 		(2 * MIDDLE_B)

#define	LOW_B_SH		MIDDLE_C
#define	MIDDLE_B_SH		HIGH_C
#define	HIGH_B_SH		(2 * MIDDLE_B_SH)

/*  Double-sharp & double-flat frequencies */

#define LOW_C_DSH 	LOW_D
#define MIDDLE_C_DSH 	MIDDLE_D
#define HIGH_C_DSH 	HIGH_D

#define LOW_C_bb 	LOW_B_b/2
#define MIDDLE_C_bb 	LOW_B_b
#define HIGH_C_bb 	MIDDLE_B_b

#define LOW_D_DSH 	LOW_E
#define MIDDLE_D_DSH 	MIDDLE_E
#define HIGH_D_DSH 	HIGH_E

#define LOW_D_bb 	LOW_C
#define MIDDLE_D_bb 	MIDDLE_C
#define HIGH_D_bb 	HIGH_C

#define LOW_E_DSH 	LOW_F_SH
#define MIDDLE_E_DSH 	MIDDLE_F_SH
#define HIGH_E_DSH 	HIGH_F_SH

#define LOW_E_bb 	LOW_D
#define MIDDLE_E_bb 	MIDDLE_D
#define HIGH_E_bb 	HIGH_D

#define LOW_F_DSH 	LOW_G
#define MIDDLE_F_DSH 	MIDDLE_G
#define HIGH_F_DSH 	HIGH_G

#define LOW_F_bb 	LOW_E_b
#define MIDDLE_F_bb 	MIDDLE_E_b
#define HIGH_F_bb 	HIGH_E_b

#define LOW_G_DSH 	LOW_A
#define MIDDLE_G_DSH 	MIDDLE_A
#define HIGH_G_DSH 	HIGH_A

#define LOW_G_bb 	LOW_F
#define MIDDLE_G_bb 	MIDDLE_F
#define HIGH_G_bb 	HIGH_F

#define LOW_A_DSH 	LOW_B
#define MIDDLE_A_DSH 	MIDDLE_B
#define HIGH_A_DSH 	HIGH_B

#define LOW_A_bb 	LOW_G
#define MIDDLE_A_bb 	MIDDLE_G
#define HIGH_A_bb 	HIGH_G

#define LOW_B_DSH 	MIDDLE_C_SH
#define MIDDLE_B_DSH 	HIGH_C_SH
#define HIGH_B_DSH 	HIGH_C_SH*2

#define LOW_B_bb 	LOW_A
#define MIDDLE_B_bb 	MIDDLE_A
#define HIGH_B_bb 	HIGH_A

/* Volume Settings */

#define DYNAMIC_FFFF     0xffff               /* Very, Very loud   */
#define DYNAMIC_FFF      0xe800
#define DYNAMIC_FF       0xd000               /* Pretty darn loud  */
#define DYNAMIC_F        0xb800
#define DYNAMIC_MF       0xad00               /* Nice accent       */
#define DYNAMIC_MP       0x9800               /* Ahhh....          */
#define DYNAMIC_P        0x8000
#define DYNAMIC_PP       0x6800               /* Whatwasthat?      */
#define DYNAMIC_PPP      0x5000
#define DYNAMIC_PPPP     0x3800               /* Is this thing on? */

/* Duration Settings */
#define WHOLE                    128
#define HALF                      64
#define QUARTER                   32
#define EIGHTH                    16
#define SIXTEENTH                  8
#define THIRTYSECOND               4
#define SIXTYFOURTH                2
#define ONE_HUNDRED_TWENTY_EIGHTH  1
#define DOUBLE_DOT_WHOLE       WHOLE + HALF + QUARTER
#define DOUBLE_DOT_HALF        HALF + QUARTER + EIGHTH
#define DOUBLE_DOT_QUARTER     QUARTER + EIGHTH + SIXTEENTH
#define DOUBLE_DOT_EIGHTH      EIGHTH + SIXTEENTH + THIRTYSECOND
#define DOUBLE_DOT_SIXTEENTH   SIXTEENTH + THIRTYSECOND + SIXTYFOURTH
#define DOTTED_WHOLE           WHOLE + HALF
#define DOTTED_HALF            HALF + QUARTER
#define DOTTED_QUARTER         QUARTER + EIGHTH
#define DOTTED_EIGHTH          EIGHTH + SIXTEENTH
#define DOTTED_SIXTEENTH       SIXTEENTH + THIRTYSECOND
#define DOTTED_THIRTYSECOND    THIRTYSECOND + SIXTYFOURTH

/* Instrument Tables */
typedef enum {
    IT_STANDARD_TABLE    =0                           /* default table */
} InstrumentTable} ;

#define DEFAULT_INSTRUMENT     IP_ACOUSTIC_GRAND_PIANO

/* Instrument Patches */
typedef enum {
    IP_ACOUSTIC_GRAND_PIANO    ,
    IP_BRIGHT_ACOUSTIC_PIANO    ,
    IP_ELECTRIC_GRAND_PIANO    ,
    IP_HONKY_TONK_PIANO    ,
    IP_ELECTRIC_PIANO_1    ,
    IP_ELECTRIC_PIANO_2    ,
    IP_HARPSICORD    ,
    IP_CLAVICORD    ,
    IP_CELESTA    ,
    IP_GLOCKENSPIEL    ,
    IP_MUSIC_BOX    ,
    IP_VIBRAPHONE    ,
    IP_MARIMBA    ,
    IP_XYLOPHONE    ,
    IP_TUBULAR_BELLS    ,
    IP_DULCIMER    ,
    IP_DRAWBAR_ORGAN    ,
    IP_PERCUSSIVE_ORGAN    ,
    IP_ROCK_ORGAN    ,
    IP_CHURCH_ORGAN    ,
    IP_REED_ORGAN    ,
    IP_ACCORDION    ,
    IP_HARMONICA    ,
    IP_TANGO_ACCORDION    ,
    IP_ACOUSTIC_NYLON_GUITAR    ,
    IP_ACOUSTIC_STEEL_GUITAR    ,
    IP_ELECTRIC_JAZZ_GUITAR    ,
    IP_ELECTRIC_CLEAN_GUITAR    ,
    IP_ELECTRIC_MUTED_GUITAR    ,
    IP_OVERDRIVEN_GUITAR    ,
    IP_DISTORTION_GUITAR    ,
    IP_GUITAR,_HARMONICS,,
    IP_ACOUSTIC_BASS    ,
    IP_ELECTRIC_FINGERED_BASS    ,
    IP_ELECTRIC_PICKED_BASS    ,
    IP_FRETLESS_BASS    ,
    IP_SLAP_BASS_1    ,
    IP_SLAP_BASS_2    ,
    IP_SYNTH_BASS_1    ,
    IP_SYNTH_BASS_2    ,
    IP_VIOLIN    ,
    IP_VIOLA    ,
    IP_CELLO    ,
    IP_CONTRABASS    ,
    IP_TREMOLO_STRINGS    ,
    IP_PIZZICATO_STRINGS    ,
    IP_ORCHESTRAL_HARP    ,
    IP_TIMPANI    ,
    IP_STRING_ENSAMBLE_1    ,
    IP_STRING_ENSAMBLE_2    ,
    IP_SYNTH_STRINGS_1    ,
    IP_SYNTH_STRINGS_2    ,
    IP_CHOIR_AAHS    ,
    IP_VOICE_OOHS    ,
    IP_SYNTH_VOICE    ,
    IP_ORCHESTRA_HIT    ,
    IP_TRUMPET    ,
    IP_TROMBONE    ,
    IP_TUBA    ,
    IP_MUTED_TRUMPET    ,
    IP_FRENCH_HORN    ,
    IP_BRASS_SECTION    ,
    IP_SYNTH_BRASS_1    ,
    IP_SYNTH_BRASS_2    ,
    IP_SOPRANO_SAX    ,
    IP_ALTO_SAX    ,
    IP_TENOR_SAX    ,
    IP_BARITONE_SAX    ,
    IP_OBOE    ,
    IP_ENGLISH_HORN    ,
    IP_BASSOON    ,
    IP_CLARINET    ,
    IP_PICCOLO    ,
    IP_FLUTE    ,
    IP_RECORDER    ,
    IP_PAN_FLUTE    ,
    IP_BLOWN_BOTTLE    ,
    IP_SHAKUHACHI    ,
    IP_WHISTLE    ,
    IP_OCARINA    ,
    IP_LEAD_SQUARE    ,
    IP_LEAD_SAWTOOTH    ,
    IP_LEAD_CALLIOPE    ,
    IP_LEAD_CHIFF    ,
    IP_LEAD_CHARANG    ,
    IP_LEAD_VOICE    ,
    IP_LEAD_FIFTHS    ,
    IP_LEAD_BASS_LEAD    ,
    IP_PAD_NEW_AGE    ,
    IP_PAD_WARM    ,
    IP_PAD_POLYSYNTH    ,
    IP_PAD_CHOIR    ,
    IP_PAD_BOWED    ,
    IP_PAD_METALLIC    ,
    IP_PAD_HALO    ,
    IP_PAD_SWEEP    ,
    IP_FX_RAIN    ,
    IP_FX_SOUNDTRACK    ,
    IP_FX_CRYSTAL    ,
    IP_FX_ATMOSPHERE    ,
    IP_FX_BRIGHTNESS    ,
    IP_FX_GOBLINS    ,
    IP_FX_ECHOES    ,
    IP_FX_SCI_FI    ,
    IP_SITAR    ,
    IP_BANJO    ,
    IP_SHAMISEN    ,
    IP_KOTO    ,
    IP_KALIMBA    ,
    IP_BAG_PIPE    ,
    IP_FIDDLE    ,
    IP_SHANAI    ,
    IP_TINKLE_BELL    ,
    IP_AGOGO    ,
    IP_STEEL_DRUMS    ,
    IP_WOODBLOCK    ,
    IP_TAIKO_DRUM    ,
    IP_MELODIC_TOM    ,
    IP_SYNTH_DRUM    ,
    IP_REVERSE_CYMBAL    ,
    IP_GUITAR_FRET_NOISE    ,
    IP_BREATH_NOISE    ,
    IP_SEASHORE    ,
    IP_BIRD_TWEET    ,
    IP_TELEPHONE_RING    ,
    IP_HELICOPTER    ,
    IP_APPLAUSE    ,
    IP_GUNSHOT    ,
    IP_ACOUSTIC_BASS_DRUM    ,
    IP_BASS_DRUM_1    ,
    IP_SIDE_STICK    ,
    IP_ACOUSTIC_SNARE    ,
    IP_HAND_CLAP    ,
    IP_ELECTRIC_SNARE    ,
    IP_LOW_FLOOR_TOM    ,
    IP_CLOSED_HI_HAT    ,
    IP_HIGH_FLOOR_TOM    ,
    IP_PEDAL_HI_HAT    ,
    IP_LOW_TOM    ,
    IP_OPEN_HI_HAT    ,
    IP_LOW_MID_TOM    ,
    IP_HI_MID_TOM    ,
    IP_CRASH_CYMBAL_1    ,
    IP_HIGH_TOM    ,
    IP_RIDE_CYMBAL_1    ,
    IP_CHINESE_CYMBAL    ,
    IP_RIDE_BELL    ,
    IP_TAMBOURINE    ,
    IP_SPLASH_CYMBAL    ,
    IP_COWBELL    ,
    IP_CRASH_CYMBAL_2    ,
    IP_VIBRASLAP    ,
    IP_RIDE_CYMBAL_2    ,
    IP_HI_BONGO    ,
    IP_LOW_BONGO    ,
    IP_MUTE_HI_CONGA    ,
    IP_OPEN_HI_CONGA    ,
    IP_LOW_CONGA    ,
    IP_HI_TIMBALE    ,
    IP_LOW_TIMBALE    ,
    IP_HIGH_AGOGO    ,
    IP_LOW_AGOGO    ,
    IP_CABASA    ,
    IP_MARACAS    ,
    IP_SHORT_WHISTLE    ,
    IP_LONG_WHISTLE    ,
    IP_SHORT_GUIRO    ,
    IP_LONG_GUIRO    ,
    IP_CLAVES    ,
    IP_HI_WOOD_BLOCK    ,
    IP_LOW_WOOD_BLOCK    ,
    IP_MUTE_CUICA    ,
    IP_OPEN_CUICA    ,
    IP_MUTE_TRIANGLE    ,
    IP_OPEN_TRIANGLE
} InstrumentPatch} ;

/*	Some of the patches were spelled improperly...	*/
#define		IP_ACCORDIAN				IP_ACCORDION
#define 	IP_STRING_ENSEMBLE_1 		IP_STRING_ENSAMBLE_1
#define 	IP_STRING_ENSEMBLE_2 		IP_STRING_ENSAMBLE_2

/*	This one started life correctly (tremolo) and got
    changed to "tremelo" somehow, and then back.  */
#define		IP_TREMELO_STRINGS			IP_TREMOLO_STRINGS

/*
    ;
    ;  In the midi standard, all the percussion instruments
    ;  have only one "note" they play.  To get the instrument
    ;  patch to sound correct, pass the following constant as
    ;  the "frequency" for the specific patch to play.
    ;
    ;  Example:
    ;		ChangeEnvelope	0, IP_OPEN_HI_HAT, IT_STANDARD_TABLE
    ;		VoiceOn		0, FR_OPEN_HI_HAT, DYNAMIC_FF
    ;		DeltaTick	2
    ;		VoiceOff	0
    ;		DeltaTick	10
    ;		VoiceOn		0, FR_OPEN_HIT_HAT, DYNAMIC_FF
    ;		...
    ;
    ;  You can pass any note, of course, and things will still
    ;	work, but it probably won't sound correct if you don't
    ;	pass this constant.
    ;
    ;  These note values (by the way) are provided
    ;	so that our OPL2 driver works correctly.
    ;
*/
#define FR_ACOUSTIC_BASS_DRUM 			LOW_C_b
#define FR_BASS_DRUM_1 				( LOW_C / 2 )
#define FR_SIDE_STICK 				MIDDLE_G_SH
#define FR_ACOUSTIC_SNARE 			MIDDLE_C
#define FR_HAND_CLAP 				MIDDLE_C
#define FR_ELECTRIC_SNARE 			MIDDLE_C
#define FR_LOW_FLOOR_TOM 			LOW_C
#define FR_CLOSED_HI_HAT 			MIDDLE_C
#define FR_HIGH_FLOOR_TOM 			LOW_F
#define FR_PEDAL_HI_HAT 				MIDDLE_C
#define FR_LOW_TOM 				LOW_G_SH
#define FR_OPEN_HI_HAT 				MIDDLE_C
#define FR_LOW_MID_TOM 				MIDDLE_C
#define FR_HI_MID_TOM 				MIDDLE_F
#define FR_CRASH_CYMBAL_1 			MIDDLE_C
#define FR_HIGH_TOM 				MIDDLE_G_SH
#define FR_RIDE_CYMBAL_1 			MIDDLE_C
#define FR_CHINESE_CYMBAL 			MIDDLE_C
#define FR_RIDE_BELL 				MIDDLE_C
#define FR_TAMBOURINE 				MIDDLE_C
#define FR_SPLASH_CYMBAL 			MIDDLE_C
#define FR_COWBELL 				LOW_C
#define FR_CRASH_CYMBAL_2 			MIDDLE_C
#define FR_VIBRASLAP 				MIDDLE_C
#define FR_RIDE_CYMBAL_2 			MIDDLE_C
#define FR_HI_BONGO 				MIDDLE_G_SH
#define FR_LOW_BONGO 				MIDDLE_E
#define FR_MUTE_HI_CONGA 			MIDDLE_G_SH
#define FR_OPEN_HI_CONGA 			MIDDLE_G_SH
#define FR_LOW_CONGA 				MIDDLE_C
#define FR_HI_TIMBALE 				MIDDLE_C
#define FR_LOW_TIMBALE 				LOW_G_SH
#define FR_HIGH_AGOGO 				LOW_F_SH
#define FR_LOW_AGOGO 				LOW_C
#define FR_CABASA 				MIDDLE_C
#define FR_MARACAS 				MIDDLE_C
#define FR_SHORT_WHISTLE 			HIGH_G_SH
#define FR_LONG_WHISTLE 				HIGH_G_SH
#define FR_SHORT_GUIRO 				MIDDLE_C
#define FR_LONG_GUIRO 				MIDDLE_C
#define FR_CLAVES 				( HIGH_G_SH * 2 )
#define FR_HI_WOOD_BLOCK 			MIDDLE_C
#define FR_LOW_WOOD_BLOCK 			LOW_F_SH
#define FR_MUTE_CUICA 				MIDDLE_C
#define FR_OPEN_CUICA 				MIDDLE_C
#define FR_MUTE_TRIANGLE 			MIDDLE_G_SH
#define FR_OPEN_TRIANGLE 			MIDDLE_G_SH
/*---------------------------------------------------------------------------
                Sound Buffer Construction Macros
---------------------------------------------------------------------------*/

#define DeltaTick (time) \
    SSDTT_TICKS, time
#define DeltaMS (time) \
    SSDTT_MSEC, time
#define DeltaTempo (time) \
    SSDTT_TEMPO, time

#define General (command) \
    SSE_GENERAL, command

#define Rest (duration) \
    General(GE_NO_EVENT), DeltaTick(duration)

#define VoiceOn (voice,freq,attack) \
    SSE_VOICE_ON, voice, freq, attack
#define VoiceOff (voice) \
    SSE_VOICE_OFF, voice
#define ChangeEnvelope (voice, instrument, table) \
    SSE_CHANGE, voice, instrument, table

#define SoundNote (voice,freq,duration,attack) \
    VoiceOn(voice, freq, attack), DeltaTempo(duration), VoiceOff(voice)
#define Staccato (voice,freq,duration,attack) \
    VoiceOn(voice, freq, attack), DeltaTempo(((duration*0x03)/0x04)), \
    VoiceOff(voice), DeltaTempo((duration/0x4))
#define Natural (voice,freq,duration,attack) \
    VoiceOn(voice, freq, attack), DeltaTempo(((duration*0x07)/0x08)), \
    VoiceOff(voice), DeltaTempo((duration/0x8))
#define Legato (voice,freq,duration,attack) \
    SoundNote(voice, freq, duration, attack)

/*-----------------------------------------------------------------------------
                SOUND ERROR CODES
-----------------------------------------------------------------------------*/

#define SOUND_ERROR_NO_ERRORS                          0
#define SOUND_ERROR_EXCLUSIVE_ACCESS_GRANTED           2
#define SOUND_ERROR_OUT_OF_MEMORY                      4
#define SOUND_ERROR_UNABLE_TO_ALLOCATE_STREAM          6
#define SOUND_ERROR_HARDWARE_NOT_AVAILABLE             8
#define SOUND_ERROR_FAILED_ATTACH_TO_HARDWARE         10
#define SOUND_ERROR_HARDWARE_DOESNT_SUPPORT_FORMAT    12
#define SOUND_ERROR_DAC_UNATTACHED                    14
#define SOUND_ERROR_STREAM_DESTROYED                  16
#define SOUND_ERROR_STREAM_FULL                       18

/*--------------------------------------------------------------------------
        DAC MANUFACTURER FORMAT
  --------------------------------------------------------------------------

    ;
    ;  DAC sounds can be stored in a variety of formats.
    ;
    ;  The ADPCM data can either have a reference byte at
    ;	the start of the data, or not.  Only the 1st
    ;	block in a song will have a reference byte.
    ; 	That byte is the starting value for the DAC.
*/

typedef unsigned DACSampleFormat ;
#define    DACSF_8_BIT_PCM          0x0
#define    DACSF_2_TO_1_ADPCM       0x1
#define    DACSF_3_TO_1_ADPCM       0x2
#define    DACSF_4_TO_1_ADPCM       0x3

typedef unsigned DACReferenceByte ;
#define    DACRB_NO_REFERENCE_BYTE          0x0
#define    DACRB_WITH_REFERENCE_BYTE        0x1

/* SampleFormat record */
typedef struct {
    DACSampleFormat     SMID_format:15;
    DACReferenceByte    SMID_reference:1;
} SampleFormat} ;

/* DACPlayFlags	record */
typedef ByteFlags DACPlayFlags ;
#define	DACPF_CATENATE		0x0080

typedef struct {
    word            SFD_manufact;       /* Manufacturer ID for sample format */
    SampleFormat    SFD_format;         /* Sample format of buffer           */
    word            SFD_rate;           /* Sampling rate for buffer          */
    DACPlayFlags    SFD_playFlags;      /* DAC Play flags for buffer         */
} SampleFormatDescription} ;

/*---------------------------------------------------------------------------
                   Envelope Format Information
  ---------------------------------------------------------------------------*/

/* SupportedEnvelopeFormat */
typedef enum {
    SEF_NO_FORMAT    ,                 /* No envelope processing available */
    SEF_SBI_FORMAT    ,                /* SoundBlaster envelope format     */
    SEF_CTI_FORMAT                     /* Casio/Tandy envelope format      */
} SupportedEnvelopeFormat} ;

/* SoundDriverNoiseCapability */
typedef WordFlags SoundDriverNoiseCapability ;
#define SDNC_NO_NOISE     0x0000
#define SDNC_WHITE_NOISE  0x8000

/* SoundDriverWaveFormCapability */
typedef WordFlags SoundDriverWaveFormCapability ;
#define SDWFC_NONE      0x0000
#define SDWFC_SELECT    0x2000
#define SDWFC_GENERATE  0x4000

/* SoundDriverTimbreCapability */
typedef WordFlags SoundDriverTimbreCapability ;
#define SDTC_TONE_GENERATOR  0x0000
#define SDTC_ADDITIVE        0x0800
#define SDTC_MODULATOR       0x1000
#define SDTC_SELECTIVE       0x1800

/* SoundDriverEnvelopeCapability */
typedef WordFlags SoundDriverEnvelopeCapability ;
#define SDEC_NONE       0x0000
#define SDEC_ADSR       0x0200
#define SDEC_DSP        0x0400

/* SoundDriverCapability */
typedef WordFlags SoundDriverCapability ;
#define SDC_NOISE       0x8000
#define SDC_WAVEFORM    0x6000
#define SDC_TIMBRE      0x1800
#define SDC_ENVELOPE    0x0600

/*           */
/* Functions */
/*           */

extern void
 _pascal SoundGetExclusive (void);

extern Boolean
 _pascal SoundGetExclusiveNB (void);

extern void
 _pascal SoundReleaseExclusive (void);

/*                      */
/* Basic music routines */
/*                      */

extern word
 _pascal SoundAllocMusic (const word _far *song, word voices,
             MemHandle _far *control);

extern word
 _pascal SoundPlayMusic (MemHandle mh, word priority, word tempo,
             EndOfSongFlags flags);

extern word
 _pascal SoundStopMusic (MemHandle mh);

extern word
 _pascal SoundPlayMusicLMem (MemHandle mh, word priority, word tempo,
                EndOfSongFlags flags);
extern word
 _pascal SoundStopMusicLMem (MemHandle mh);

extern word
 _pascal SoundReallocMusic (MemHandle mh, const word _far *song);

extern word
 _pascal SoundReallocMusicLMem (MemHandle mh, optr song);

extern void
 _pascal SoundFreeMusic (MemHandle mh);

extern void
 _pascal SoundInitMusic (MemHandle mh, word voices);

/*                     */
/* Basic note routines */
/*                     */

extern word
 _pascal SoundAllocMusicNote (InstrumentPatch instrument, word instTable,
                 word frequency, word volume,
                 SoundStreamDeltaTimeType DeltaType, word duration,
                 MemHandle _far *control);

extern word
 _pascal SoundPlayMusicNote (MemHandle mh, SoundPriority priority, word tempo,
                EndOfSongFlags flags);

extern word
 _pascal SoundStopMusicNote (MemHandle mh);

extern word
 _pascal SoundReallocMusicNote (MemHandle mh, word freq, word vol,
                   SoundStreamDeltaTimeType timer,
                   word durat, InstrumentPatch instrument,
                   word instTable);

extern void
 _pascal SoundFreeMusicNote (MemHandle mh);

/*                             */
/* Basic music stream Routines */
/*                             */

extern word
 _pascal SoundAllocMusicStream (SoundStreamSize streamSize,
                   SoundPriority priority, word voices,
                   word tempo, MemHandle _far *control);

extern word
 _pascal SoundPlayToMusicStream (MemHandle mh, const word _far *song,
                word size);

extern word
 _pascal SoundPlayToMusicStreamNB (MemHandle mh, const word _far *song,
                      word size, word _far *bytesWritten);

extern word
 _pascal SoundStopMusicStream (MemHandle mh);

extern void
 _pascal SoundFreeMusicStream (MemHandle mh);

/*                        */
/* Sample stream routines */
/*                        */

extern word
 _pascal SoundAllocSampleStream (MemHandle _far *control);

extern word
 _pascal SoundEnableSampleStream (MemHandle mh, SoundPriority priority,
                 word rate, word manufacturerID,
                 DACSampleFormat sampleFormat);

extern void
 _pascal SoundDisableSampleStream (MemHandle mh);

extern word
 _pascal SoundPlayToSampleStream (MemHandle mh, const word _far *sample,
                 word size,
                 const SampleFormatDescription _far *format);

extern void
 _pascal SoundFreeSampleStream (MemHandle mh);

/*               */
/* Misc commands */
/*               */

extern void
 _pascal SoundChangeOwnerSimple (MemHandle mh, MemHandle owner);

extern void
 _pascal SoundChangeOwnerStream (MemHandle mh, MemHandle owner);

/*                      */
/* Driver Info commands */
/*                      */

extern void
 _pascal SoundSynthDriverInfo (word _far *voices,
                  SupportedEnvelopeFormat _far *format,
                  SoundDriverCapability  _far *capability);

extern void
 _pascal SoundSampleDriverInfo (word _far *voices,
                   SoundDriverCapability _far *capability);

/*                         */
/*  Voice Manager Routines */
/*                         */

extern word
 _pascal SoundVoiceManagerGetFree (SoundPriority priority);

extern void
 _pascal SoundVoiceManagerFree (word voice);

extern word
 _pascal SoundDACManagerGetFree (SoundPriority priority);

extern void
 _pascal SoundDACManagerFree (word voice);

#ifdef __HIGHC__
pragma Alias(SoundGetExclusive, "SOUNDGETEXCLUSIVE");
pragma Alias(SoundGetExclusiveNB, "SOUNDGETEXCLUSIVENB");
pragma Alias(SoundReleaseExclusive, "SOUNDRELEASEEXCLUSIVE");

pragma Alias(SoundAllocMusic, "SOUNDALLOCMUSIC");
pragma Alias(SoundPlayMusic, "SOUNDPLAYMUSIC");
pragma Alias(SoundStopMusic, "SOUNDSTOPMUSIC");
pragma Alias(SoundPlayMusicLMem, "SOUNDPLAYMUSICLMEM");
pragma Alias(SoundStopMusicLMem, "SOUNDSTOPMUSICLMEM");
pragma Alias(SoundReallocMusic, "SOUNDREALLOCMUSIC");
pragma Alias(SoundReallocMusicLMem, "SOUNDREALLOCMUSICLMEM");
pragma Alias(SoundFreeMusic, "SOUNDFREEMUSIC");
pragma Alias(SoundInitMusic, "SOUNDINITMUSIC");

pragma Alias(SoundAllocMusicNote, "SOUNDALLOCMUSICNOTE");
pragma Alias(SoundPlayMusicNote, "SOUNDPLAYMUSICNOTE");
pragma Alias(SoundStopMusicNote, "SOUNDSTOPMUSICNOTE");
pragma Alias(SoundReallocMusicNote, "SOUNDREALLOCMUSICNOTE");
pragma Alias(SoundFreeMusicNote, "SOUNDFREEMUSICNOTE");

pragma Alias(SoundAllocMusicStream, "SOUNDALLOCMUSICSTREAM");
pragma Alias(SoundPlayToMusicStream, "SOUNDPLAYTOMUSICSTREAM");
pragma Alias(SoundPlayToMusicStreamNB, "SOUNDPLAYTOMUSICSTREAMNB");
pragma Alias(SoundStopMusicStream, "SOUNDSTOPMUSICSTREAM");
pragma Alias(SoundFreeMusicStream, "SOUNDFREEMUSICSTREAM");

pragma Alias(SoundAllocSampleStream, "SOUNDALLOCSAMPLESTREAM");
pragma Alias(SoundEnableSampleStream, "SOUNDENABLESAMPLESTREAM");
pragma Alias(SoundDisableSampleStream, "SOUNDDISABLESAMPLESTREAM");
pragma Alias(SoundPlayToSampleStream, "SOUNDPLAYTOSAMPLESTREAM");
pragma Alias(SoundFreeSampleStream, "SOUNDFREESAMPLESTREAM");

pragma Alias(SoundChangeOwnerSimple, "SOUNDCHANGEOWNERSIMPLE");
pragma Alias(SoundChangeOwnerStream, "SOUNDCHANGEOWNERSTREAM");

pragma Alias(SoundSynthDriverInfo, "SOUNDSYNTHDRIVERINFO");
pragma Alias(SoundSampleDriverInfo, "SOUNDSAMPLEDRIVERINFO");

pragma Alias(SoundVoiceManagerGetFree, "SOUNDVOICEMANAGERGETFREE");
pragma Alias(SoundVoiceManagerFree, "SOUNDVOICEMANAGERFREE");
pragma Alias(SoundDACManagerGetFree, "SOUNDDACMANAGERGETFREE");
pragma Alias(SoundDACManagerFree, "SOUNDDACMANAGERFREE");
#endif

#endif


spell.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	Spell Library
 * FILE:	spell.goh
 *
 *
 * REVISION HISTORY:
 *
 *	Name	Date		Description
 *	----	----		-----------
 *	atw	9/27/92		Initial revision
 *
 *
 * DESCRIPTION:
 *	Contains controllers for the spell library
 *
 *	$Id: spell.goh,v 1.21.4.1 96/04/28 08:29:55 chris Exp $
 *
 ***********************************************************************/
@optimize

@deflib	spell

@include  <Objects/gCtrlC.goh>
@include  <Objects/vTextC.goh>

#define SPELL_MAX_WORD_LENGTH 	65 	/* 64 chars + 1 null */

@class	SpellControlClass, GenControlClass;

typedef ByteEnum SpellCheckStartOption ;
#define SCSO_BEGINNING_OF_DOCUMENT  0
#define SCSO_BEGINNING_OF_SELECTION  1
#define SCSO_WORD_BOUNDARY_BEFORE_SELECTION  2
#define SCSO_END_OF_SELECTION  3

typedef WordFlags SpellCheckOptions ;

#define SCO_CHECK_SELECTION  0x08
#define SCO_CHECK_NUM_CHARS  0x04

@importMessage MetaSearchSpellMessages, void MSG_SPELL_CHECK(@stack
                          optr replyObj,
                          dword numCharsToCheck,
                          SpellCheckOptions options,
                          MemHandle ICbuff);

typedef struct {
    dword   UWI_numChars;
    word    UWI_charOffset;
    char    UWI_unknownWord[SPELL_MAX_WORD_LENGTH];
} UnknownWordInfo} ;

@message void MSG_SC_UNKNOWN_WORD_FOUND (UnknownWordInfo *infoPtr = ss:bp);

typedef enum {	/* word */
    SCR_ONE_WORD_CHECKED    ,
    SCR_SELECTION_CHECKED    ,
    SCR_DOCUMENT_CHECKED
} SpellCheckResult} ;

@message void MSG_SC_SPELL_CHECK_COMPLETED (SpellCheckResult result = cx);

/* Internal messages that should not be sent by external objects */

@message void MSG_SC_UPDATE_REPLACEMENT_WORD ();
@message void MSG_SC_SUGGEST_SPELLING ();
/*
 * @message void MSG_SC_SUGGEST_SPELLING_FROM_USER_DICT_VIA_QUEUE();
 * @message void MSG_SC_SUGGEST_SPELLING_FROM_USER_DICT();
 */
@message void MSG_SC_CHECK_ENTIRE_DOCUMENT ();
@message void MSG_SC_CHECK_TO_END ();
@message void MSG_SC_CHECK_SELECTION ();

@message void MSG_SC_REPLACE_WORD ();
@message void MSG_SC_REPLACE_ALL ();

@message void MSG_SC_IGNORE_WORD ();
@message void MSG_SC_SKIP_WORD ();
@message void MSG_SC_ADD_UNKNOWN_WORD_TO_USER_DICTIONARY ();
@message void MSG_SC_SPELL_CHECK_ABORTED ();

@message void MSG_SC_GET_IC_BUFF ();

/*
 *	Structure sent out with GWNT_SPELL_ENABLE_CHANGE
 */

typedef struct {
    Boolean	NSEC_spellEnabled;
    /* Non-zero if spell should be enabled */
} NotifySpellEnableChange} ;

typedef WordFlags SpellFeatures ;
#define	SF_CLOSE	  	 	    	0x2000
#define	SF_CONTEXT	  	 	    	0x1000
#define	SF_SIMPLE_MODAL_BOX	 	    	0x0800
#define	SF_SUGGESTIONS			    	0x0400
#define	SF_CHECK_ALL		    	    	0x0200
#define	SF_CHECK_TO_END		    	    	0x0100
#define	SF_CHECK_SELECTION	  	    	0x0080
#define	SF_SKIP		    	    	    	0x0040
#define	SF_SKIP_ALL	 	    	    	0x0020
#define	SF_REPLACE_CURRENT	  	    	0x0010
#define	SF_REPLACE_ALL		    	    	0x0008
#define	SF_ADD_TO_USER_DICTIONARY	   	0x0004
#define	SF_EDIT_USER_DICTIONARY		    	0x0002
#define	SF_STATUS	   	    	    	0x0001

typedef WordFlags SpellToolboxFeatures ;
#define STF_SPELL     0x01

#define SC_DEFAULT_FEATURES    (SF_STATUS | SF_EDIT_USER_DICTIONARY | SF_ADD_TO_USER_DICTIONARY | SF_REPLACE_ALL | SF_REPLACE_CURRENT | SF_SKIP_ALL | SF_SKIP | SF_CHECK_SELECTION | SF_CHECK_TO_END | SF_CHECK_ALL | SF_SUGGESTIONS | SF_CLOSE | SF_CONTEXT)

#define SC_SUGGESTED_INTRODUCTORY_FEATURES  (SF_SIMPLE_MODAL_BOX | SF_CONTEXT | SF_SUGGESTIONS | SF_SKIP | SF_REPLACE_CURRENT | SF_STATUS)

#define SC_DEFAULT_TOOLBOX_FEATURES    STF_SPELL

typedef ByteEnum SpellBoxState ;
#define     SBS_NO_SPELL_ACTIVE      0
#define     SBS_CHECKING_DOCUMENT      1
#define     SBS_CHECKING_SELECTION      2

@vardata void ATTR_SPELL_CONTROL_INTERACT_ONLY_WITH_TARGETED_TEXT_OBJECTS;
@vardata void ATTR_SPELL_CONTROL_HAS_USER_DICT;  /* Currently Redwood only */
@vardata void ATTR_SPELL_CONTROL_NEVER_PROMPT_FOR_USER_DICT;

    @instance MemHandle	    	    	    SCI_ICBuffHan;
    @instance SpellBoxState    	    SCI_spellState;
    @instance byte	    	    	    SCI_haveSelection;
    @instance dword	    	    	    SCI_charsLeft;
    @instance word  	            SCI_enableFlags;
    @default GII_visibility = GIV_DIALOG;
    @default GCI_output = (TO_APP_TARGET);

@endc

@class	EditUserDictionaryControlClass, GenControlClass;

@message void MSG_EUDC_GET_USER_DICTIONARY_LIST_MONIKER ();
@message void MSG_EUDC_DELETE_SELECTED_WORD_FROM_USER_DICTIONARY ();
@message void MSG_EUDC_ADD_NEW_WORD_TO_USER_DICTIONARY ();
@message void MSG_EUDC_UPDATE_SELECTED_WORD ();
@message void MSG_EUDC_CLOSE_EDIT_BOX ();
@importMessage MetaSearchSpellMessages, void MSG_META_EDIT_USER_DICTIONARY_COMPLETED ();
@message void MSG_EUDC_LOAD_DICTIONARY ();

typedef WordFlags EditUserDictionaryFeatures ;
#define	EUDF_EDIT_USER_DICTIONARY	 0x01

typedef WordFlags EditUserDictionaryToolboxFeatures ;
#define	EUDTF_EDIT_USER_DICTIONARY	 0x01

#define	EUDC_DEFAULT_FEATURES		    	EUDF_EDIT_USER_DICTIONARY
#define	EUDC_DEFAULT_TOOLBOX_FEATURES		EUDTF_EDIT_USER_DICTIONARY

    @instance MemHandle	    EUDCI_userDictList;
    @instance MemHandle	    EUDCI_icBuff;

    @default GII_attrs = (@default | GIA_MODAL);
    @default GII_type = GIT_COMMAND;
    @default GII_visibility = GIV_DIALOG;

@endc;

@class ThesControlClass, GenControlClass;

@importMessage MetaSearchSpellMessages, void MSG_THES_REPLACE_SELECTED_WORDS (@stack
                        MemHandle RSWP_string,
                        word 	RSWP_numChars);
typedef struct {
    word		RSWP_numChars;
    MemHandle	RSWP_string;
} ReplaceSelectedWordParameters} ;

@importMessage MetaSearchSpellMessages, void MSG_THES_SELECT_WORD (@stack
                        optr	output,
                        Message message,
                        word	numChars,
                        word	type);
typedef struct {
    word	SWP_type;
    word 	SWP_numChars;
    word	SWP_message;
    optr	SWP_output;
} SelectWordParameters} ;

/* Internal messages that should not be sent by external objects */

@message void MSG_TC_LOOKUP ();
@message void MSG_TC_GET_TEXT ();
@message void MSG_TC_REPLACE ();
@message void MSG_TC_GET_BACKUP_MONIKER ();
@message void MSG_TC_GET_SYNONYM_MONIKER ();
@message void MSG_TC_GET_MEANING_MONIKER ();
@message void MSG_TC_BACKUP_SELECTED ();
@message void MSG_TC_MEANING_SELECTED ();
@message void MSG_TC_MEANING_DOUBLE_CLICK ();
@message void MSG_TC_SYNONYM_SELECTED ();
@message void MSG_TC_SYNONYM_DOUBLE_CLICK ();
@message void MSG_TC_REPLACE_DONE ();
@message void MSG_TC_COPY_DONE ();
@message void MSG_TC_SELECT_DONE ();

#define MAX_BACKUP_LIST_SIZE  30
#define MAX_ENTRY_LENGTH  26 	/* 25 chars + null */
#define MAX_GRAMMAR_STRING  7

#define MAX_DEFINITIONS  30
#define MAX_DEFINITION_SIZE  200
#define MAX_MEANINGS_ARRAY_SIZE  3000
#define MAX_SYNONYM_SIZE  26
#define MAX_SYNONYMS  80
#define MAX_SYNONYMS_ARRAY_SIZE  500

typedef WordFlags ThesDictFeatures ;
#define TDF_THESDICT  0x01
#define TC_GCM_FEATURES  TDF_THESDICT

typedef WordFlags ThesDictToolboxFeatures ;
#define TDTF_THESDICT  0x01
#define TD_GCM_TOOLBOX_FEATURES  TDTF_THESDICT

@vardata void ATTR_THES_CONTROL_INTERACT_ONLY_WITH_TARGETED_TEXT_OBJECTS;

    @instance void *TCI_meanings;
    @instance void *TCI_synonyms;
    @instance void *TCI_grammars;
    @instance void *TCI_backups;
    @instance word	TCI_status;
    @instance TCHAR TCI_lastWord[MAX_ENTRY_LENGTH];
         @default GCI_output = (TO_APP_TARGET);
    @default GII_visibility = GIV_DIALOG;
    @default GI_states = (@default | GS_ENABLED);

@endc

@endlib


Internal\spelllib.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1994 -- All Rights Reserved

PROJECT:	Spell library
FILE:		spelllib.goh

AUTHOR:		Joon Song, Sep 22, 1994

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    Joon	9/22/94   	Initial version.

DESCRIPTION:

    $Id: spelllib.goh,v 1.3.6.1 96/04/28 08:32:38 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@optimize

@deflib	spell

#include  <sllang.h>

/* enum SpellRoutine */
typedef enum {
    SROUT_CHECK_WORD     = 0x0,
    SROUT_GET_TEXT_OFFSETS    ,
    SROUT_GET_ERROR_FLAGS    ,
    SROUT_RESET_SPELL_CHECK    ,
} SpellRoutine} ;

/* enum SpellResult */
typedef enum {
    IC_RET_OK     = 0x0,
    IC_RET_ALTERNATE     = 0x2,
    IC_RET_INVALID    ,
    IC_RET_PRE_PROC    ,
    IC_RET_ERR     = 0x8,
    IC_RET_FOUND     = 0xa,
    IC_RET_NOT_FOUND    ,
    IC_RET_USR_BRK     = 0xe,
    IC_RET_NOMEM    ,
    IC_RET_NO_OPEN    ,
    IC_RET_WILD    ,
    IC_RET_HYP_ALT     = 0x13,
    IC_RET_IGNORED    ,
    IC_RET_NO_USER_DICT    ,
    IC_RET_BAD_LANG    ,
} SpellResult} ;

#define	ERRET		IC_RET_ERR

extern SpellResult
    _pascal ICCheckWord (MemHandle icBuff, char *lookupWord);
/*
 *	Spell checks the passed word
 *
 *	Pass:	*lookupWord	= ptr to word to spell check
 *		icBuff		= handle of ICBuff
 *
 *	Return:	SpellResult
 */

extern void
    _pascal ICGetTextOffsets (MemHandle icBuff,
                 word *firstOffset,
                 word *lastOffset);
/*
 *	Gets the left/right offsets into the text string that was spell-checked
 *	where the word actually began/ended (basically returns offsets past
 *	parsed-out junk).
 *
 *	Pass:	icBuff		= handle of ICBuff
 *
 *	Return:	*firstOffset	= offset to first char of word (0-based)
 *		*lastOffset	= offset to last char of word
 *
 */

typedef WordFlags SpellErrorFlagsHigh ;
    /* 13 bits unused */
    #define SEFH_INVALID_PUNCTUATION 	(0x0004)
    #define SEFH_A_ERROR 			(0x0002)
    #define SEFH_AN_ERROR 			(0x0001)

typedef WordFlags SpellErrorFlags ;
    #define SEF_DOUBLE_WORD_ERROR 		(0x8000)
    #define SEF_ORDINAL_NUMBER_ERROR 	(0x4000)
    #define SEF_APOSTROPHY_ALTERNATIVE 	(0x2000)
    #define SEF_FINAL_CHAR 			(0x1000)
    #define SEF_INIT_ERROR 			(0x0800)
    #define SEF_CAPITALIZATION_ERROR 	(0x0400)
    #define SEF_COMPOUNDING_ERROR 		(0x0200)
    /* 1 bit unused */
    #define SEF_INVALID_PRE_CHARS 		(0x0080)
    #define SEF_INVALID_TRAILING_CHARS 	(0x0040)
    #define SEF_NEGATIVE_WORD 		(0x0020)
    #define SEF_NOT_FREE_STANDING_WORD 	(0x0010)
    #define SEF_SOFT_HYPHEN_ERROR 		(0x0008)
    #define SEF_ACCENT_ERROR 		(0x0004)
    #define SEF_INVALID_POST_CLITIC 		(0x0002)
    #define SEF_INVALID_PRE_CLITIC 		(0x0001)

extern void
    _pascal ICGetErrorFlags (MemHandle icBuff,
                SpellErrorFlags *errorFlags,
                SpellErrorFlagsHigh *errorFlagsHigh);
/*
 *	Gets the error flags.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *
 *	Return:	*errorFlags	= SpellErrorFlags
 *		*errorFlagsHigh	= SpellErrorFlagsHigh
 *
 */

extern void
    _pascal ICResetSpellCheck (MemHandle icBuff);
/*
 * 	Resets internal spell check flags (used for a/an checking, etc).
 *
 * 	Pass:	icBuff		= handle of ICBuff
 *
 * 	Return:	nothing
 *
 */

/*
 * 	ROUTINES THAT ARE CALLED EXTERNALLY ONLY IN RARE INSTANCES
 * 	(Most of the functionality that they provide is provided by
 * 	 the SpellControl object)
 */

extern Boolean
    _pascal ICCheckForEmbeddedPunctuation (MemHandle icBuff);
/*
 *	Checks to see if the word that was spell checked had embedded
 *	punctuation.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *
 *	Return:	Boolean		= FALSE if no embedded punctuation
 *
 */

extern StandardLanguage
    _pascal ICGetLanguage (MemHandle iCBuff);
/*
 *	Gets the current language.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *
 *	Return: StandardLanguage
 *
 */

extern SpellResult
    _pascal ICInit (MemHandle *icBuff);
/*
 *	Inits a ICBuff for the spell checking library.
 *
 *	Pass: 	icBuff		= location to store handle of ICBuff
 *
 *	Return: SpellResult	= error code
 *		icBuff		= handle of ICBuff structure (null if error)
 *
 *
 */

extern SpellResult
    _pascal ICExit (MemHandle icBuff);
/*
 *	Exits/frees up memory associated with this client of the spooler.
 *
 *	Pass:	icBuff		= handle of ICBuff structure returned by ICInit
 *				  (this gets freed if no error)
 *
 *	Return: SpellResult	= error code
 *
 */

extern void
    _pascal ICStopCheck (MemHandle icBuff);
/*
 *	Called when a spell check has been completed/aborted. This allows the
 *	spell checker to do some nice things, like kill the spell thread.
 *
 *	Pass:	icBuff		= handle of ICBuff structure returned by ICInit
 *
 *	Return: nothing
 *
 */

extern word
    _pascal ICSpl (MemHandle icBuff, char *string);
/*
 *	extern void _pascal ICGEOSPL();
 *
 *	This is the standard entry point to the spell check library. The
 *	passing parameters are all set in the ICBuff structure. The passed
 *	string is assumed to be in the GEOS character set and so is converted
 *	to the DEC character set.
 *
 *	Pass:	icBuff		= handle of ICBuff structure returned by ICInit
 *		string		= ptr to null terminated string.
 *
 *	Return:	word		= error code
 *
 */

extern word
    _pascal ICGetNumAlts (MemHandle icBuff);
/*
 *	Get the # alternate spellings
 *
 *	Pass:	icBuff		= handle of ICBuff
 *
 *	Return:	word		= # alternate spellings
 *
 */

extern void
    _pascal ICGetAlternate (MemHandle icBuff, word index,
               char *original, char *alternate);
/*
 *	Get an alternate spelling string.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *		index		= index of alternate spelling entry we desire
 *				  (0 <- 1st entry)
 *		*original	= source string to get alternates for
 *		*alternate	= ptr to store alternate spelling
 *
 *	Return:	nothing
 *
 */

extern void
    _pascal ICIgnore (MemHandle icBuff, char *ignoreWord);
/*
 *	Ignores the passed string for the remainder of the session.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *		ignoreWord	= null terminated string to ignore
 *
 *	Return:	nothing
 *
 */

/* enum UserResult */
typedef enum {
    UR_OK     = 0x0,
    UR_ADD    ,
    UR_NFD    ,
    UR_FND    ,
    UR_CER    ,
    UR_WORD_ALREADY_ADDED    ,
    UR_IER    ,
    UR_DER    ,
    UR_LER    ,
    UR_PER    ,
    UR_SER    ,
    UR_UER    ,
    UR_USER_DICT_FULL    ,
    UR_GER    ,
    UR_DNE    ,
    UR_INV    ,
    UR_FER    ,
    UR_HER
} UserResult} ;

extern void
    _pascal ICAddUser (MemHandle icBuff, char *addWord,
              SpellResult *spellResult, UserResult *userResult);
/*
 *	Adds the passed string to the user dictionary.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *		*addWord	= null terminated string to add
 *
 *	Return:	*spellResult	= SpellResult (0 if no error)
 *		*userResult	= UserResult
 *
 */

extern void
    _pascal ICDeleteUser (MemHandle icBuff, char *deleteWord,
             SpellResult *spellResult, UserResult *userResult);
/*
 * 	Deletes the passed string from the user dictionary.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *		*deleteWord	= null terminated string to delete
 *
 *	Return:	*spellResult	= SpellResult
 *		*userResult	= UserResult
 *
 */

typedef struct {
/*
 * DON'T CHANGE THIS STRUCTURE WITHOUT CHANGING ASSOCIATED C DECLARATION
 *  IN "icgeospl.c".
 */

    /* # words in the user dictionary */
    word	UDLI_numEntries;

    /* Total size of associated block (including this structure) */
    word	UDLI_totalSize;

    /* The index of the word that the lastFoundPtr points to (starts at 0) */
    word	UDLI_lastFoundIndex;

    /* near ptr to word indexed above. */
    word	UDLI_lastFoundPtr;

} UserDictionaryListInfo} ;

extern MemHandle
    _pascal ICBuildUserList (MemHandle icBuff);
/*
 *	Builds out a list of words in the user dictionary.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *
 *	Return:	MemHandle	= handle of block containing
 *				  UserDictionaryListInfo + words.
 *
 */

extern void
    _pascal ICResetIgnore (MemHandle icBuff);
/*
 *	Resets the ignore buffer.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *
 *	Return:	nothing
 *
 */

extern void
    _pascal ICUpdateUser (MemHandle icBuff);
/*
 *	Saves the user dictionary out to disk.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *
 *	Return:	nothing
 *
 */

/* enum SpellTask */
typedef enum {
    ST_INIT     = 0x1,
    ST_TERMINATE    ,
    ST_VERIFY    ,
    ST_WILDCARD     = 0x5,
    ST_ANAGRAM    ,
    ST_HYPHENATE    ,
    ST_DEFINITION    ,
    ST_CORRECT     = 0x64,
} SpellTask} ;

extern void
    _pascal ICSetTask (MemHandle icBuff, SpellTask spellTask);
/*
 *	Sets the task for the next ICSpl call.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *		spellTask	= SpellTask
 *
 *	Return:	nothing
 *
 */

extern MemHandle
    _pascal Hyphenate (char *wordToHyphenate, word shortest);
/*
 *	Returns hyphenation points for the passed word
 *
 *	Pass:	wordToHyphenate	= null terminated string to hyphenate
 *		shortest	= length of shortest word to hyphenate
 *
 *	Return:	MemHandle	= handle of block containing HyphenationPoints
 *				  structure (in vTextC.def)
 *
 * 				  NULL if error or no hyphenation points
 *
 */

#ifdef PRODUCT_REDWOOD

extern word
    _pascal ICFreeUserDict (void);
/*
 *	Currently used in Redwood only, frees the user dictionary.
 *
 *	Pass:	nothing
 *
 *	Return:	word		= error code
 *
 */

#endif

typedef struct {
    MemHandle	MRP_meaningsBlock;
    ChunkHandle	MRP_meaningsChunk;
    ChunkHandle MRP_grammarsChunk;
} MeaningsRetParams} ;

extern word
    _pascal ThesaurusGetMeanings (char *lookupWord, MeaningsRetParams *params);
/*
 *	Given a word, returns a chunk array of meaning strings and
 *	an array of parts of speech (1 per meaning)
 *
 *	Pass:	*lookupWord	= word to look up
 *
 *	Return:	params->MRP_meaningsBlock =
 *			MemHandle of block containing meanings chunk array
 *			and partsOfSpeech array
 *
 *		params->MRP_meaningsChunk =
 *			ChunkHandle of chunk array of null terminated strings,
 *			each of which is one meaning.
 *			Note if size = 0, word not found
 *
 *			NOTE: in the REDWOOD case, this is returned as an
 *				array of synonyms which correspond to that
 *				meaning, instead of the definition for the
 *				meaning.  EDS 1/7/94
 *
 *		params->MRP_grammarsChunk =
 *			ChunkHandle of integer array chunk (0..25).  Integers
 *			range from 0 to 3, and represent the part of speech of
 *			the corresponding meaning (if that meaning exists).
 *			0 = adj, 1 = noun, 2 = adverb, 3 = verb.
 *
 *		word	= success/failure indicator:
 *		         	number of synonyms/meanings found = success
 *				0 = word not found
 *				negative = error
 *
 */

extern word
    _pascal ThesaurusGetSynonyms (char *lookupWord,
                 word senseNumber,
                 optr *synonyms);
/*
 *	Takes the number of the sense that is desired (see
 *	ThesaurusGetMeanings) and returns a chunk array of null
 *	terminated strings, one per synonym.
 *
 *	Pass:	*lookupWord	= word to lookup
 *		senseNumber	= sense number corresponding to sense to get
 *				  synonyms for (1.. )
 *
 *	Return:	*synonyms	= chunk array of null-terminated synonym
 *				  strings
 *		word		= success/failure indicator:
 *					number of senses = success
 *					0 = word not found
 *					negative = error
 *
 */

extern SpellResult
    _pascal ICGetAnagrams (MemHandle icBuff,
              char *lookupWord,
              word minimumLength);
/*
 *	Find anagrams for the passed word.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *		*lookupWord	= ptr to word to spell check
 *		minimumLength	= minimum length of anagram
 *
 *	Return:	SpellResult
 */

extern SpellResult
    _pascal ICGetWildcards (MemHandle icBuff, char *lookupWord);
/*
 *	Find words that match the passed wildcard.
 *
 *	Pass:	icBuff		= handle of ICBuff
 *		*lookupWord	= ptr to wildcard string
 *
 *	Return:	SpellResult
 */

#ifdef __HIGHC__
pragma Alias(ICCheckWord, "ICCHECKWORD");
pragma Alias(ICGetTextOffsets, "ICGETTEXTOFFSETS");
pragma Alias(ICGetErrorFlags, "ICGETERRORFLAGS");
pragma Alias(ICResetSpellCheck, "ICRESETSPELLCHECK");
pragma Alias(ICCheckForEmbeddedPunctuation, "ICCHECKFOREMBEDDEDPUNCTUATION");
pragma Alias(ICGetLanguage, "ICGETLANGUAGE");
pragma Alias(ICInit, "ICINIT");
pragma Alias(ICExit, "ICEXIT");
pragma Alias(ICStopCheck, "ICSTOPCHECK");
pragma Alias(ICSpl, "ICSPL");
pragma Alias(ICGetNumAlts, "ICGETNUMALTS");
pragma Alias(ICGetAlternate, "ICGETALTERNATE");
pragma Alias(ICIgnore, "ICIGNORE");
pragma Alias(ICAddUser, "ICADDUSER");
pragma Alias(ICDeleteUser, "ICDELETEUSER");
pragma Alias(ICBuildUserList, "ICBUILDUSERLIST");
pragma Alias(ICResetIgnore, "ICRESETIGNORE");
pragma Alias(ICUpdateUser, "ICUPDATEUSER");
pragma Alias(ICSetTask, "ICSETTASK");
pragma Alias(Hyphenate, "HYPHENATE");
pragma Alias(ThesaurusGetMeanings, "THESAURUSGETMEANINGS");
pragma Alias(ThesaurusGetSynonyms, "THESAURUSGETSYNONYMS");
pragma Alias(ICGetAnagrams, "ICGETANAGRAMS");
pragma Alias(ICGetWildcards, "ICGETWILDCARDS");
#endif

@endlib


Objects\splineC.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1993 -- All Rights Reserved

PROJECT:	PCGEOS
MODULE:		splineC.goh
FILE:		splineC.goh

AUTHOR:		Joon Song, Nov 16, 1993

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    Joon	11/16/93   	Initial version.

DESCRIPTION:
    This is the main Include file for users of the spline library.

    $Id: splineC.goh,v 1.5.6.1 96/04/28 08:31:43 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@optimize

@include  <Objects/gInterC.goh>

@deflib	spline

typedef ByteEnum SplineReturnType ;

    #define SRT_OK 				0x0

    #define SRT_NULL_OPERATION 		0x2
    /*
     *  The requested operation was not necessary, and therefore,
     *  was not performed (ie, closing an already closed spline, or
     *  adding controls to a point that already has control points,
     *  etc.)
     */

    #define SRT_TOO_MANY_POINTS 		0x4
    /*
     *  The desired operation could not be performed, since the
     *  result would create an illegal number of points
     */

/*  returned from MSG_SPLINE_REPLACE_WITH_TRANSFER_FORMAT */
typedef ByteEnum SplinePasteReturnType ;

    #define SPRT_OK 				0x0
    /*  data was read correctly. */

    #define SPRT_TOO_OLD 			0x1
    /*
     *  transfer item's protocol was too old to work with this
     *  version of the VisSpline
     */

    #define SPRT_TOO_NEW 			0x2
    /*
     *  transfer item's protocol was too new to work with this
     *  version of the VisSpline
     */

typedef struct {
    optr	SJP_otherSpline;
    /*
     *  OD of spline to join with this one.  This other spline will
     *  be nuked after this call.
     */

    word	SJP_deltaX;
    /*
     *  Deltas are the distance between the upper left-hand corners
     *  of the 2 splines.
     */

    word	SJP_deltaY;
} SplineJoinParams} ;

typedef ByteFlags SplineUnSuspendFlags ;
    /* 6 bits unused */

    #define SUSF_GEOMETRY 			(0x02)
    /*  Size needs to be recalculated */

    #define SUSF_UPDATE_UI 			(0x01)
    /*  Notification should be sent to the controllers. */

typedef WordFlags SplineGenerateNotifyFlags ;
    #define SGNF_MARKER_SHAPE 		(0x8000)
    #define SGNF_SPLINE_POINT 		(0x4000)
    #define SGNF_POLYLINE 			(0x2000)
    #define SGNF_SMOOTHNESS 			(0x1000)
    #define SGNF_OPEN_CLOSE 			(0x0800)
    #define SGNF_EDIT 			(0x0400)

    /* 10 bits unused */

typedef ByteEnum MarkerShape ;
    #define MS_NONE 				0x0
    #define MS_SQUARE 			0x2
    #define MS_CROSS1 			0x4
    #define MS_DIAMOND 			0x6
    #define MS_CROSS2 			0x8
    #define MS_TRIANGLE 			0xa
    #define MS_BAR1 				0xc
    #define MS_BAR2 				0xe
    #define MS_CIRCLE 			0x10

/*
 *  Dumb hack:  SIF_DONT_ALLOC_ATTR_CHUNKS and SS_HAS_ATTR_CHUNKS are
 *  both at the same position in their respective records.  This
 *  minimizes shifting during MSG_SPLINE_COPY
 */

typedef ByteFlags SplineInitFlags ;		/* CHECKME */
    /* 3 bits unused */

    #define SIF_MANAGE_ATTRIBUTES 		(0x10)
    /*
     *  If set, then the spline is to manage its attributes.
     *  Otherwise, the spline will assume that a subclass is
     *  managing them.
     */

    #define SIF_INTERNAL 			(0x08)
    /*  Don't set this flag unless you want to visit the yang-man! */

    #define SIF_RESET_LINKAGES 		(0x04)
    /*
     *  This flag is set if the spline should clear its link data
     *  (ie, data may contain garbage).  This flag is used during
     *  SplineCopy  (MSG_SPLINE_COPY).
     */

    /* 2 bits unused */

/* ****************************************************************************
 *  SplineInitParams - parameters passed when sending a
 *  MSG_SPLINE_INTIALIZE.	If you change this, please change the
 *  SplineCopy procedure
 * ****************************************************************************
 */

typedef struct {
    MemHandle	SIP_lmemBlock;
    /*
     *  block handle of lmem block containing points.  MUST be in
     *  same VM file as the spline object.  Pass 0 if you want the
     *  spline to create and manage its own lmem block.
     */

    SplineInitFlags	SIP_flags;
} SplineInitParams} ;

/* ****************************************************************************
 *  This structure is used to get lengths/percentages along spline copies
 * ****************************************************************************
 */

typedef struct {
    word		LS_pointNum;
    word		LS_length;
    word		LS_percent;
} LengthStruct} ;

/* ****************************************************************************
 * 	SmoothType - Different types of smoothness that an anchor point
 * 	can have.
 * ****************************************************************************
 */

typedef ByteEnum SmoothType ;
    #define ST_NONE 				0x0
    /*
     *  there is no interaction between the control points.  If one
     *  control point is moved, the other stays where it is.
     */

    #define ST_SEMI_SMOOTH 			0x1
    /*
     *  Control points stay on opposite sides of their anchor, but
     *  their distances to the anchor are unrelated.  Thus, if the
     *  user moves one control point, the other control point will
     *  modify its position so that it remains on the opposite side
     *  of the anchor from the control being edited, but will NOT
     *  change its distance to the anchor.  This is the default
     *  behavior for all points in SM_ADVANCED_EDIT mode.
     */

    #define ST_VERY_SMOOTH 			0x2
    /*
     *  control points are on opposite sides and identical distances
     *  from the anchor.  This is the behavior in SM_ADVANCED_CREATE.
     */

    #define ST_AUTO_SMOOTH 			0x3
    /*
     *  Positioning of controls is determined automatically based on
     *  the position of the anchor relative to its two closest
     *  neighbors.  The controls will always remain equidistant and
     *  on opposite sides from their anchor.
     */

    #define ST_MAX_SMOOTHNESS 		ST_AUTO_SMOOTH

/* ****************************************************************************
 *  ActionType - describes what sort of action the spline is currently
 *  undergoing.
 * ****************************************************************************
 */

typedef ByteEnum ActionType ;
    /*  nothing going on */
    #define AT_NONE 				0x0

/*  selection actions: */
    #define AT_SELECT_ANCHOR 		0x1
    #define AT_SELECT_SEGMENT 		0x2
    #define AT_SELECT_CONTROL 		0x3
    #define AT_SELECT_NOTHING 		0x4

/*  move actions: */
    /*  anchor point(s) being moved */
    #define AT_MOVE_ANCHOR 			0x5

    /*  a segment is being moved */
    #define AT_MOVE_SEGMENT 			0x6

    /*  controls  */
    #define AT_MOVE_CONTROL 			0x7

    /*  a rectangle being dragged around */
    #define AT_MOVE_RECTANGLE 		0x8

/*  Mouse buttons are UP, but we want to follow the mouse around anyway. */
    #define AT_CREATE_MODE_MOUSE_UP 		0x9

/* ****************************************************************************
 *  SplineSelectType - describes type of "thing" being selected in a spline.
 * ****************************************************************************
 */

typedef ByteEnum SplineSelectType ;
    #define SST_NONE 			0x0
    #define SST_ANCHOR_POINT 		0x1
    #define SST_SEGMENT 			0x2
    #define SST_CONTROL_POINT 		0x3
    #define SST_INSIDE_CLOSED_CURVE 		0x4
    #define SST_INSIDE_VIS_BOUNDS 		0x5

/* ****************************************************************************
 *  Spline modes -- The basic editing modes of the spline object.  Many
 *  jump tables rely on the order of these, so don't rearrange them
 *  unnecessarily! (see splineData.asm)
 * ****************************************************************************
 */

typedef ByteEnum SplineMode ;
    #define SM_BEGINNER_POLYLINE_CREATE 	0x0
    /*
     *  Mouse clicks place new anchor points.  All segments are
     *  straight lines -- the user has no way of making curves in
     *  this mode.
     */

    #define SM_BEGINNER_SPLINE_CREATE 	0x1
    /*
     *  Mouse clicks place new anchor points.  All segments are
     *  curvy -- the curviness of the PREVIOUS anchor is
     *  automatically determined by the position of the mouse.
     */

    #define SM_ADVANCED_CREATE 		0x2
    /*
     *  Mouse click (START_SELECT) place anchors, and the user may
     *  then DRAG the mouse to place control points.
     */

    #define SM_BEGINNER_EDIT 		0x3
    /*
     *  Mouse clicks either select anchors or segments -- if a
     *  segment is selected, a new anchor will be created at the
     *  mouse position.  Clicking and dragging causes anchors to
     *  move, with curviness of neighboring points being adjusted
     *  automatically.
     */

    #define SM_ADVANCED_EDIT 		0x4
    /*  The user can click on and edit anchor and control points. */

    #define SM_INACTIVE 			0x5
    /*
     *  Mouse events have no effect -- points are generally not
     *  drawn.
     */

/* ****************************************************************************
 *  SplineState - general state attributes of the spline object
 * ****************************************************************************
 */

typedef ByteFlags SplineState ;
    #define SS_VIS_BOUNDARY_DRAWN 		(0x80)
    /*  Set if a rectangle is drawn around the vis bounds */

    #define SS_CLOSED 			(0x40)
    /*  Set if the spline is a closed curve */

    #define SS_FILLED 			(0x20)
    /*  spline is FILLED with area fill stuff */

    #define SS_HAS_ATTR_CHUNKS 		(0x10)
    /*
     *  if set, spline has lmem chunks for its line/area attributes.
     *  If false, attributes are managed (in a subclass) in an
     *  element array or other structure.
     */

    #define SS_CREATED_BLOCK 		(0x08)
    /*
     *  If set, spline is the creator of the lmem block containing
     *  its points and must free it upon being freed.
     */

    #define SS_MODE 				(0x04 | 0x02 | 0x01)
    #define SS_MODE_OFFSET 			0
    /*  SplineMode  */

/* ****************************************************************************
 *  Spline Edit State -- additional state information.
 * ****************************************************************************
 */

typedef ByteFlags SplineEditState ;
    #define SES_SELECT_STATE_CHANGED 	(0x80)
    /*
     *  If set, then the selection state has changed, and the UI
     *  needs to be updated (will happen on EndSelect/EndMoveCopy)
     */

    #define SES_FOCUS 			(0x40)
    /*  Set if we have the (app) focus -- not used. */

    #define SES_TARGET 			(0x20)
    /*
     *  Set if we have the (app) target. If not set, won't draw
     *  selection.
     */

    #define SES_SELECTED 			(0x10)
    /*  Set if the spline or any of its points are selected */

    #define SES_ACTION 			(0x08 | 0x04 | 0x02 | 0x01)
    #define SES_ACTION_OFFSET 		0
    /*  ActionType  */

@class  VisSplineClass, VisClass;

/* COMMENT --------------------------------------------------------------------
    INHERITANCE
   ----------------------------------------------------------------------------

VisClass:
    MSG_VIS_OPEN - sends itself MSG_VIS_RECREATE_CACHED_GSTATES

    MSG_VIS_DRAW - calls MSG_SPLINE_DRAW_BASE_OBJECT followed by
    MSG_SPLINE_DRAW_EVERYTHING_ELSE (handles, etc).

    MSG_VIS_RECALC_SIZE - recalculates bounds based on positions of
    points, etc.

   ------------------------------------------------------------------------- */

/* ----------------------------------------------------------------------------
 * 	Messages
 * ----------------------------------------------------------------------------
 */

@message SplineReturnType MSG_SPLINE_INSERT_ANCHORS () = al;
/*
 * 	Add anchor points to all of the currently selected SEGMENTS
 *
 *  Pass:	nothing
 *
 * 	the Spline must have its SEGMENT mode bit set for this operation
 * 	to work.  Anchor points will be placed in the (parametric) MIDDLE
 * 	of each selected segment, so as to not change the shape of any
 *  	of the segments.
 *
 *  Return:	SplineReturnType
 */

@message SplineReturnType MSG_SPLINE_INSERT_CONTROLS () = al;
/*
 * 	Add control points (if possible) to all of the selected ANCHOR
 * 	points.  Control points will be placed in such a way as to make
 *  	the curve "very smooth".
 *
 *  Pass:	nothing
 *  Return:	SplineReturnType
 */

@message SplineReturnType MSG_SPLINE_DELETE_ANCHORS () = al;
/*
 * 	Delete all of the selected anchor points (and all of their control
 * 	points)
 *
 *  Pass: 	nothing
 *  Return:	SplineReturnType
 */

@message SplineReturnType MSG_SPLINE_DELETE_CONTROLS () = al;
/*
 * 	Delete all of the control points for all of the selected anchor
 * 	points
 *
 *  Pass:	nothing
 *  Return:	SplineReturnType
 */

/* ****************************************************************************
 *  	LINE AND AREA ATTRIBUTES
 * ****************************************************************************
 */

@message void MSG_SPLINE_APPLY_ATTRIBUTES_TO_GSTATE (GState gstate = bp);
/*
 *  Set the line/area attributes of a gstate with the spline's
 *  attributes.
 *
 *  Pass:	GState handle
 *  Return:	nothing -- gstate updated
 */

@message void MSG_SPLINE_SET_DEFAULT_LINE_ATTRS ();
/*
 *  Initialize the default line attributes data structure for this
 *  spline.
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_SPLINE_SET_DEFAULT_AREA_ATTRS ();
/*
 *  Set the default area attributes for the spline
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_SPLINE_SET_LINE_ATTRS (LineAttr *lineAttr = cx:dx);
/*
 *  Set the line attributes for the spline
 *
 *  Pass:	lineAttr - fptr to a LineAttr structure
 *  Return:	nothing
 */

@message void MSG_SPLINE_GET_LINE_ATTRS (LineAttr *lineAttr = cx:dx);
/*
 *  Get the line attributes for a vis spline
 *
 *  Pass:	lineAttr - fptr to a LineAttr structure
 *  Return: 	nothing -- buffer filled in
 */

@message void MSG_SPLINE_SET_AREA_ATTRS (AreaAttr *areaAttr = cx:dx);
/*
 *  Set the area attributes
 *
 *  Pass:	areaAttr - fptr to an AreaAttr structure
 *  Return:	nothing
 */

@message void MSG_SPLINE_GET_AREA_ATTRS (AreaAttr *areaAttr = cx:dx);
/*
 *  Get the area attributes for a vis spline
 *
 *  Pass:	areaAttr - fptr to an AreaAttr structure
 *  Return:	nothing -- buffer filled in
 */

@message void MSG_SPLINE_SET_LINE_WIDTH (WWFixedAsDWord lineWidth = dx.cx);
/*
 * 	Set line width
 *  Pass:	lineWidth  dx.cx - line width (WWFixed)
 *  Return:	nothing
 *
 *  See NOTE 1 on Line/Area attributes
 */

@message WWFixedAsDWord MSG_SPLINE_GET_LINE_WIDTH () = dx.cx;
/*
 *  Pass:	nothing
 *  Return:	dx.cx - line width (WWFixed)
 *
 *  See NOTE 1 on Line/Area attributes
 */

@message void MSG_SPLINE_SET_LINE_STYLE (LineStype lineStyle = cl);
/*
 *  Pass:	lineStype
 *  Return:	nothing
 *
 *  See NOTE 1 on Line/Area attributes
 */

@message LineStyle MSG_SPLINE_GET_LINE_STYLE () = cl;
/*
 *  Pass:	nothing
 *  Return:	LineStyle enum
 *
 *  See NOTE 1 on Line/Area attributes
 */

@message void MSG_SPLINE_SET_LINE_COLOR (byte red = cl,
                    byte green = ch,
                    byte blue = dl);
/*
 *  Pass:	red
 * 		green
 * 		blue
 *  Return:	nothing
 *
 *  See NOTE 1 on Line/Area attributes
 */

typedef struct {
    byte	RGBQ_blue;
    byte	RGBQ_blank;
    byte	RGBQ_red;
    byte	RGBQ_green;
} RGBQuad} ;

@message void MSG_SPLINE_GET_LINE_COLOR (RGBQuad *retVal = dxcx);
/*
 *  Pass:	retVal - address of RGBQuad
 *  Return: 	RGBQuad fill in with red, blue, and green.
 * 		(CQR_rgb = ???)
 *
 *  See NOTE 1 on Line/Area attributes
 */

@message void MSG_SPLINE_SET_LINE_MASK (SystemDrawMask sysDrawMask = cl);
/*
 *  Pass:	SystemDrawMask
 *  Return:	nothing
 */

@message SystemDrawMask MSG_SPLINE_GET_LINE_MASK () = cl;
/*
 *  return the spline's line mask
 *
 *  Pass:	nothing
 *  Return:	SystemDrawMask
 */

@message void MSG_SPLINE_SET_AREA_COLOR (byte red = cl,
                    byte green = ch,
                    byte blue = dl);
/*
 *  Pass:  	red
 * 	 	green
 * 	 	blue
 *  Return:	nothing
 *
 *  See NOTE 1 on Line/Area attributes
 */

@message void MSG_SPLINE_GET_AREA_COLOR (RGBQuad *retVal = dxcx);
/*
 *  Pass:	retVal - address of RGBQuad
 *  Return: 	RGBQuad fill in with red, blue, and green.
 * 		(CQR_rgb = ???)
 *
 *  See NOTE 1 on Line/Area attributes
 */

@message void MSG_SPLINE_SET_AREA_MASK (word areaMask = cx);
/*
 *  Pass:	areaMask
 *  Return:	nothing
 *
 *  See NOTE 1 on Line/Area attributes
 */

@message word MSG_SPLINE_GET_AREA_MASK () = cx;
/*
 *  Pass:	nothing
 *  Return:	area mask
 *
 *  See NOTE 1 on Line/Area attributes
 */

/*
 *  NOTE 1:  The spline uses the above messages when setting the
 *  gstate's area attributes to draw -- thus, just subclass them to
 *  provide different behavior (ie, for the GrObj spline)
 */

@message void MSG_SPLINE_SET_MODE (SplineMode splineMode = cl);
/*
 *  Pass:	SplineMode
 *  Return:	nothing
 */

@message SplineMode MSG_SPLINE_GET_MODE () = cl;
/*
 *  Pass:	nothing
 *  Return:	SplineMode
 */

@message void MSG_SPLINE_SET_SMOOTHNESS (SmoothType smoothType = cl);
/*
 * 	Set the smoothness of the currently selected anchor points
 *
 *  Pass:	SmoothType
 *  Return:	nothing
 */

@message void MSG_SPLINE_OPEN_CURVE ();
/*
 *  	Make the spline an open curve
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_SPLINE_CLOSE_CURVE ();
/*
 *  	Close the spline curve
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_SPLINE_DRAW_VIS_BOUNDARY ();
/*
 * 	Draw the visual boundary of the spline object
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_SPLINE_ERASE_VIS_BOUNDARY ();
/*
 * 	I'm not going to tell you what this does!
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_SPLINE_SET_VIS_BOUNDS(@stack Rectangle rect);
/*
 *  	Set new Vis bounds for the spline object without moving any of
 *  its points relative to the screen.
 *
 *  Pass: 	rect - a Rectangle structure containing the new Vis bounds.
 *  Return:	nothing
 */

@message void MSG_SPLINE_DELTA_VIS_BOUNDS(@stack Rectangle rect);
/*
 * 	Change the Vis bounds of the spline object by the amount
 *  specified in the passed Rectangle structure.
 *
 *  Pass: 	rect	- a Rectangle structure containing deltas to
 *   			  the new Vis bounds
 *  Return:	nothing
 */

@message void MSG_SPLINE_NOTIFY_CHANGE_BOUNDS(@stack Rectangle rect);
/*
 *  	This message does nothing.  It is sent from the VisSplineClass
 *  object to itself when it senses that its Vis bounds should change
 *  (when control/anchor points are moved outside the Vis bounds, or, on
 *  an END_SELECT, when the Vis Bounds should shrink.)  Application
 *  writers may want to subclass the VisSpline to examine the passed
 *  rectangle, modify it, and send a MSG_SPLINE_SET_VIS_BOUNDS to
 *  itself.
 *
 *  Pass:	rect - A Rectangle structure containing (desired)
 * 		       new Vis Bounds
 *  Return:	nothing
 */

@message void MSG_SPLINE_INITIALIZE(@stack SplineInitParams params);
/*
 *  Initialize the instance data of the VisSplineClass object. NOT
 *  THE SAME AS MSG_META_INITIALIZE, which is NOT subclassed.
 *
 *  Pass:	params	- SplineInitParams
 *  Return:	nothing
 */

@message void MSG_SPLINE_ABORT_CURRENT_OPERATION ();
/*
 *  	Tell the spline to end a MOVE or DRAG operation -- happens if
 *  the user selects another object, etc.
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_SPLINE_TRANSFORM_POINTS (GState gstate = bp);
/*
 * 	Transform the spline's points by the TMatrix contained in the
 *  passed GSTATE
 *
 *  Pass:	gstate handle containing transformation matrix
 *  Return:	nothing
 */

@message void MSG_SPLINE_READ_GSTRING (GState gstate = bp);
/*
 * 	Read a graphics string, adding points to the spline object
 *  from the string.
 *
 *  Pass:	gstring handle
 *  Return:	nothing
 */

typedef struct {
    SplineSelectType	SHDP_selectType;
    byte			SHDP_nothing;
    word			SHDP_pointNumber;
} SplineHitDetectParams} ;

@message void MSG_SPLINE_HIT_DETECT (SplineHitDetectParams *retValue = dxcx,
                    word xcoord = cx,
                    word ycoord = dx);
/*
 * 	See if a point in document coordinates correlates with any
 * point or segment of the spline object.
 *
 *  Pass:	retValue	 - address of SplineHitDetectParams
 *  		(xcoord, ycoord) - point coordinates
 *  Return: 	SplineHitDetectParams filled in
 *  		    SHDP_selectType  - SplineSelectType
 * 		    SHDP_pointNumber - (if applicable) - point # that was hit
 */

@message void MSG_SPLINE_SELECT (word pointNumber = cx,
                SplineSelectType splineSelectType = dl);
/*
 * 	Select a point of the spline object
 *
 *  Pass:	point number
 * 		SplineSelectType
 *  Return:	nothing
 */

@message void MSG_SPLINE_SELECT_AT_COORDS (word xcoord = cx,
                      word ycoord = dx);
/*
 * 	Select whatever happens to be at the passed coordinates
 *
 *  Pass:	(xcoord,ycoord) - coordinates
 *  Return:	nothing
 */

@message void MSG_SPLINE_BEGIN_MOVE ();
/*
 * 	Begin a MOVE of the currently selected point(s)
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_SPLINE_MOVE (word deltaX = cx,
                  word deltaY = dx);
/*
 * 	Move points of the spline
 *
 *  Pass:	deltaX, deltaY to move selected points
 *  Return:	nothing
 */

@message void MSG_SPLINE_END_MOVE ();
/*
 * 	End a move operation
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_SPLINE_SUBDIVIDE_CURVE (word anchorPoint = cx,
                     word subdivision = dx);
/*
 *  	Subdivide a spline curve based on the passed parameter
 *
 *  Pass:	anchorPoint - current anchor point
 * 		subdivision - subdivision parameter (between 0 and 1)
 *  Return:	nothing
 */

@message void MSG_SPLINE_GET_ALL_LENGTHS (void *chunkArray = cx:dx);
/*
 * 	Get the lengths of ALL spline curves
 *
 *  Pass: 	chunkArray - chunk array which must be initialized to
 * 			     contain elements of AT LEAST size LengthStruct.
 *  Return:	array filled in
 */

@message void MSG_SPLINE_INSERT_ALL_CONTROLS ();
/*
 * 	Insert control points around EVERY anchor point that doesn't
 * already have them, putting them at distance zero from their owner
 * anchors.
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message ChunkHandle MSG_SPLINE_COPY (MemHandle objBlock = cx,
                     MemHandle lmemBlock = dx) = cx;
/*
 * 	Make a copy of the current spline object
 *
 *  Pass:	objBlock	- handle of object block to copy object to
 * 		lmemBlock	- handle of lmem block in which to place points
 * 				  array (or 0 if copy is supposed to create its
 *				  own internal mem block)
 *  Return:	chunk handle of new spline (copy)
 */

@message void MSG_SPLINE_UNSELECT_ALL_POINTS ();
/*
 *  	Unselect all selected spline points
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

typedef struct {
    Rectangle		SSRP_rect;
    UIFunctionsActive	SSRP_flags;
} SplineSelectRectangleParams} ;

@message void
    MSG_SPLINE_SELECT_RECTANGLE(@stack SplineSelectRectangleParams params);
/*
 * 	This message is sent to cause the spline object to visually
 *  update its anchor points based their location in relation to a
 *  passed rectangle.  Update is performed based on the UIFA flags
 *  passed in cl.  If no flags are passed, any points INSIDE the
 *  rectangle are drawn with FILLED handles.
 *
 *
 *  If the UIFA_ADJUST flag is passed:
 * 	If anchor was previously selected:
 * 		anchor is drawn with a HOLLOW handle
 * 	else
 * 		anchor is drawn with a FILLED handle
 *
 *  Any points that are OUTSIDE the rectangle will have their handles
 *  drawn in accordance to whether they're selected.
 *
 *  	This message DOES NOT change the selection of any points (it
 *  can't since otherwise UIFA_ADJUST wouldn't work!), it merely changes
 *  their visual representation.  In order to have the changes take
 *  effect, the caller must pass a MSG_SPLINE_END_SELECT_RECTANGLE after
 *  the last MSG_SPLINE_SELECT_RECTANGLE.
 *
 *  	For normal selection operations, the caller may wish to pass a
 *  MSG_SPLINE_UNSELECT_ALL before passing the first
 *  MSG_SPLINE_SELECT_RECTANGLE.
 *
 *  Pass:	SplineSelectRectangleParams
 *  Return:	nothing
 */

@message void MSG_SPLINE_END_SELECT_RECTANGLE ();
/*
 * 	Selects any anchor points with FILLED HANDLES.  To be called
 *  after sending a series of MSG_SPLINE_SELECT_RECTANGLE messages in
 *  order for the selection list to correspond with what appears
 *  on-screen.  Should have no effect if called any other time (one
 *  would hope!).
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_SPLINE_SET_HANDLE_SIZE (BBFixed handleSize = cx);
/*
 * 	Set the spline's handle size
 *
 *  Pass:	handle size (BBFixed)
 *  Return:	nothing
 */

@message BBFixed MSG_SPLINE_GET_HANDLE_SIZE () = cx;
/*
 * 	Get the spline's handle size
 *
 *  Pass:	nothing
 *  Return:	handle size (BBFixed)
 */

@message void MSG_SPLINE_DRAW_BASE_OBJECT (GState gstate = bp);
/*
 * 	Draw the permanent parts of the spline
 *
 *  Pass:	gstate handle
 *  Return:	nothing
 */

@message void MSG_SPLINE_DRAW_EVERYTHING_ELSE (GState gstate = bp);
/*
 * 	Draw all handles, invert-mode curves, etc.
 *
 *  Pass:	gstate handle
 *  Return:	nothing
 */

@message void MSG_SPLINE_REMOVE_EXTRA_CONTROL_POINTS (word tolerance = cx);
/*
 * 	Remove any control points that are very close to their owner
 *  anchor points.  This operation may affect the shape of the spline,
 *  depending on the parameter passed (if tolerance value = 0, this will
 *  NOT change the shape).
 *
 *  Pass:	tolerance value.  The x and y deltas between each control
 * 		     point and its anchor are summed and compared with the
 * 		     tolerance value.  If they are equal or below, then the
 * 		     control will be deleted.  If the tolerance value = 0,
 * 		     then only controls that are EXACTLY on the anchor are
 * 		     deleted.
 *  Return:	nothing
 */

@message void MSG_SPLINE_SET_MARKER_SHAPE (MarkerShape markerShape = cl);
/*
 * 	Set the shape of the markers drawn at each point
 *
 *  Pass:	MarkerShape
 *  Return:	nothing
 */

@message MarkerShape MSG_SPLINE_GET_MARKER_SHAPE () = al;
/*
 * 	Return the marker shape for this spline
 *
 *  Pass:	nothing
 *  Return:	MarkerShape
 */

typedef WordFlags SplineNotifySendFlags ;
    /* 1 bit unused */

    #define SNSF_UPDATE_APP_TARGET_GCN_LISTS 	(0x4000)
    /*
     *  Set if pertinent Application Target GCN Lists should be updated
     *  with changes in status
     */

    #define SNSF_NULL_STATUS 			(0x2000)
    /*
     *  Send notification of null status, for all notification types
     *  (used only to notify GCN Lists of loss of eligibility to update,
     *  i.e. lost target)
     */

    #define SNSF_STRUCTURE_INITIALIZED 		(0x1000)
    /*
     *  Set if the rest of the SplineGenerateNotifyParams structure is
     *  initialized
     */

    #define SNSF_SEND_AFTER_GENERATION 		(0x0800)
    /*  Set to send the notifications after generating them */

    #define SNSF_SEND_ONLY 				(0x0400)
    /*  Set to send the notifications *only* */

    #define SNSF_RELAYED_TO_LIKE_OBJECTS 		(0x0200)
    /*
     *  Set if the message has been registered with the object responsible
     *  for relaying the message to multiple text objects.
     */

    /* 9 bits unused */

@message void MSG_SPLINE_BEGIN_UPDATE_UI (SplineGenerateNotifyFlags flags = cx);
/*
 *  Cause the spline object to send itself a MSG_SPLINE_GENERATE_NOTIFY
 *  message, with the SplineGenerateNotifyParams structure filled in.
 *
 *  Pass:	flags	- SplineGenerateNotifyFlags
 *  Return:	nothing
 */

typedef struct {
    SplineGenerateNotifyFlags	SGNP_notificationFlags;
    SplineNotifySendFlags		SGNP_sendFlags;
    MemHandle			SGNP_notificationBlocks[16];
} SplineGenerateNotifyParams} ;

@message void
    MSG_SPLINE_GENERATE_NOTIFY(@stack SplineGenerateNotifyParams params);
/*
 *  Generate the notifications for this spline object
 *
 *  Pass:	SplineGenerateNotifyParams on stack
 *  Return:	nothing
 */

@message optr MSG_SPLINE_SPLIT (MemHandle splineBlock = cx,
                   MemHandle pointsBlock = dx) = cx:dx;
/*
 *  Split the spline at its first selected anchor point.  Create a new
 *  spline, and stick all points starting from the (duplicated) first
 *  selected anchor to the end of the spline in the newly created
 *  object.
 *
 *  Pass:   	splineBlock: Handle of object block in which to place new
 *			     spline.
 * 		pointsBlock: lmem block in which to place new points.
 * 			     pass pointsBlock=0 to create new block
 *  Return:	OD of new spline
 */

@message void MSG_SPLINE_DELETE_RANGE (word begin = cx, word end = dx);
/*
 *  Delete a range of spline points
 *
 *  Pass:	beginning of range to delete
 * 		end of range to delete
 *  Return:	nothing
 */

@message void MSG_SPLINE_REVERSE_POINTS ();
/*
 *  Reverse the order of the spline's points
 *
 *  Pass:	nothing
 *  Return:	nothing
 *
 *  NOTE:  This method copies the points to a new chunk -- invalidating
 *  stored references to the existing chunk array of spline points.
 */

@message void MSG_SPLINE_SET_FIRST_POINT (word anchor = cx);
/*
 *  Rotate the points so that the passed point is the first
 *  point in the array.
 *
 *  Pass:	anchor point number to move to head of list
 *  Return:	nothing
 *
 *  NOTE:  This method copies the points to a new chunk -- invalidating
 *  stored references to the existing chunk array of spline points.
 */

@message SplineReturnType MSG_SPLINE_JOIN(@stack SplineJoinParams params) = al;
/*
 *  Join the passed spline with this one.  The passed spline acquires all
 *  the attributes of the first spline -- its attributes are thus
 *  destroyed.
 *
 *  Pass:	SplineJoinParams
 *  Return:	SplineReturnType
 */

@message optr MSG_SPLINE_GET_POINTS () = cx:dx;
/*
 *  Return the OD of the chunk array of spline points.
 *
 *  Pass:	nothing
 *  Return:	OD of the chunk array of spline points.
 */

@message void MSG_SPLINE_REPLACE_POINTS (optr chunkArray = cx:dx);
/*
 *  Set the points of the spline.  The passed points MUST be a valid
 *  chunkArray of SplinePointStruct structures.  The spline's existing
 *  points are tossed out/nuked/destroyed, and the new ones copied in.
 *  Note that the original points are COPIED into the spline's lmem block.
 *
 *  Pass:	chunkArray
 *  Return:	nothing
 */

@message word MSG_SPLINE_GET_NUMBER_OF_POINTS () = cx;
/*
 *  Return the number of points this spline has
 *
 *  Pass:	nothing
 *  Return:	# points
 */

@message word MSG_SPLINE_CREATE_TRANSFER_FORMAT (word fileHandle = cx) = ax;
/*
 *  Pass:	fileHandle - VM file handle in which to create transfer data
 *  Return:	VM block
 */

@message SplinePasteReturnType
    MSG_SPLINE_REPLACE_WITH_TRANSFER_FORMAT    (word fileHandle = cx,
                        word blockHandle = dx) = ax;
/*
 *  Replace all spline data with that passed in the vm chain.
 *
 *  Context:	Sent to a vis spline object by its "manager"
 *		(a GrObject, most likely).
 *
 *  Pass:	fileHandle	- vm file handle of transfer file
 * 		blockHandle	- vm block handle (same as that returned by
 *  				  MSG_SPLINE_CREATE_TRANSFER_FORMAT)
 *  Return:	SplinePasteReturnType
 */

typedef ByteEnum SplineSetPointType ;
    #define SSPT_POINT 			(sizeof(Point))
    #define SSPT_WWFIXED 			(sizeof(PointWWFixed))

typedef ByteFlags SplineSetPointFlags ;
    /* 2 bits unused */

    #define SSPF_HAS_CONTROLS 		(0x20)
    /*  If set, then the array contains control points. */

    #define SSPF_FIRST_POINT_IS_CONTROL 	(0x10)
    /*
     *  If set, then the first point is a control point.  The points
     *  are assumed to be of the form:
     *  	C, A, C, C, A, C, C, A, C, C, A...
     *  If this is not set, and SSPF_CONTAINS_CONTROL_POINTS is set,
     *  then the points are of the form:
     * 	A, C, C, A, C, C, A...
     *
     *  It is an error to set this flag if SSPF_HAS_CONTROLS  is
     *  not set.
     */

    #define SSPF_TYPE 			(0x08 | 0x04 | 0x02 | 0x01)
    #define SSPF_TYPE_OFFSET 		0
    /*  Data type of passed points */

typedef struct {
    void			*SSPP_points;
    word			SSPP_numPoints;
    SplineSetPointFlags	SSPP_flags;
} SplineSetPointParams} ;

@message void MSG_SPLINE_SET_POINTS(@stack SplineSetPointParams params);
/*
 *  Replace the spline's points with the passed set of points.
 *
 *  Pass:	SplineSetPointParams
 *  Return:	nothing
 */

@message void MSG_SPLINE_MAKE_POLYGON (word halfWidth = cx,
                      word halfHeight = dx,
                      word numPoints = bp);
/*
 *  Replace the spline's points with a regular polygon
 *
 *  Pass:	half width, half height of polygon
 * 		number of polygon points
 *  Return:	nothing
 */

typedef struct {
    word	SMSP_starPoints;
    Point	SMSP_innerRadius;
    Point	SMSP_outerRadius;
} SplineMakeStarParams} ;

@message void MSG_SPLINE_MAKE_STAR(@stack SplineMakeStarParams params);
/*
 *  Replace the spline's points with a regular polygon
 *
 *  Pass:	SplineMakeStarParams
 *  Return:	nothing
 */

@message void MSG_SPLINE_SET_MARKER_FLAGS (byte setFlags = cl,
                      byte clearFlags = ch);
/*
 *  Set the flags for how the spline draws its markers.
 *
 *  Pass:	flags to set
 * 		flags to clear
 *  Return:	nothing
 */

@message void MSG_SPLINE_INVERT_HOLLOW_HANDLES ();
/*
 *  Draw hollow handles along the spline.  THIS FUNCTION IS SOLELY FOR
 *  USE BY THE CHART LIBRARY -- DO NOT USE.
 *
 *  Pass:	???
 *  Return:	nothing
 */

typedef ByteFlags SplineMarkerFlags ;
    /* 7 bits unused */

    #define SMKF_DONT_DRAW_ENDPOINTS 	(0x01)

@message void
    MSG_SPLINE_DRAW_USING_PASSED_GSTATE_ATTRIBUTES    (GState gstate = bp);
/*
 *  Draw the spline using the passed gstate attributes, rather than its own.
 *
 *  Pass:	gstate handle
 *  Return:	nothing
 */

typedef ByteEnum GetEndpointType ;
    #define GET_FIRST 			0x0
    #define GET_LAST 			0x1

typedef struct {
    Point	SEIP_endPoint;
    Point	SEIP_adjacentPoint;
} SplineEndPointInfoParams} ;

@message Boolean
    MSG_SPLINE_GET_ENDPOINT_INFO    (SplineEndPointInfoParams *retVal = axbpcxdx,
                 GetEndpointType type = cl) = carry;
/*
 *  Return data about the endpoints
 *
 *  Pass:	retVal	- address of SplineEndPointInfoParams
 *		type	- GetEndpointType
 *  Return:	IF spline has the requested points:
 * 			zero
 *				SplineEndPointInfoParams filled in with
 * 					x,y coords of endpoint
 * 					x,y coords of adjacent point
 * 		ELSE
 * 			non-zero
 */

@message void MSG_SPLINE_DRAW_LINE_ONLY (GState gstate = bp);
/*
 *  Draw the "LINE" part of the spline only -- using the passed Gstate
 *  attributes
 *
 *  Pass:	gstate handle
 *  Return:	nothing
 */

@message void MSG_SPLINE_DRAW_AREA_ONLY (GState gstate = bp);
/*
 *  Draw the AREA part of the spline only -- using the passed Gstate
 *  attributes.
 *
 *  Pass:	gstate handle
 *  Return:	nothing
 */

@message void MSG_SPLINE_SET_MINIMAL_VIS_BOUNDS ();
/*
 *  This message causes the spline to calculate and set (using
 *  MSG_SPLINE_NOTIFY_CHANGE_BOUNDS) a tight-fitting VisBounds by
 *  drawing to a path and then getting the path bounds.  This is much
 *  slower than than the normal method, which is to calculate the
 *  bounding box of all spline anchor and control points.
 *
 *  Pass:	nothing
 *  Return:	nothing
 */

@message void MSG_SPLINE_NOTIFY_CREATE_MODE_DONE ();
/*
 * 	Spline notifies itself that the user is ending create mode
 *
 *  Context:		When spline wishes to leave create mode. Usually when
 * 			user clicks on the first or last anchor point.
 *  Source:		Spline itself
 *  Destination:  	Spline itself
 *  Interception:	The default handler puts the spline in inactive mode.
 * 			If you wish to switch to a differnt mode then intercept
 * 			this message, set the desired mode and don't call your
 * 			superclass. If you just have some additional
 * 			functionality that wish to perform at this time, then
 * 			you may do that before or after calling	the superclass.
 *
 *  Pass:		nothing
 *  Return:		nothing
 */

@message byte MSG_SPLINE_GET_CLOSED_STATE () = cl;
/*
 * 	Return if the spline is closed or not
 *
 *  Context:		Spline Utility
 *  Source:		Unrestricted
 *  Destination:	VisSpline
 *  Interception:	Nope
 *
 *  Pass:		nothing
 *  Return:		non zero - spline closed
 * 			zero - spline open
 */

/* ----------------------------------------------------------------------------
 * 	INSTANCE DATA
 * ----------------------------------------------------------------------------
 */

@instance	SplineState		VSI_state;
    /*  State of the spline object */

@instance	SplineEditState		VSI_editState;
    /*  State of the various edit operations of the spline */

@instance	MemHandle		VSI_lmemBlock;
    /*
     *  block handle of a local-memory heap where all the
     *  variable-sized instance data of the VisSpline object are
     *  stored. -- contains the points array, the selection list,
     *  undo data, and the scratch chunk.
     */

@instance	ChunkHandle		VSI_points;
    /*  chunk where the spline's points are stored in the lmemBlock. */

@instance	ChunkHandle		VSI_selectedPoints;
    /*
     *  selectedPoints is a list of points that are currently
     *  "selected" by the user.
     */

@instance	ChunkHandle		VSI_lineAttr;

@instance	ChunkHandle		VSI_areaAttr;

@instance	ChunkHandle		VSI_undoPoints;

@instance	ChunkHandle		VSI_newPoints;

@instance	word			VSI_actionPoint;
    /*  point number of the current "action point" */

@instance	word			VSI_gstate;

@instance	byte			VSI_gstateRefCount;

@instance	ChunkHandle		VSI_scratch;

@instance	BBFixed			VSI_handleSize;
@instance	BBFixed			VSI_handleHeight;

@instance	MarkerShape		VSI_markerShape;

@instance	SplineMarkerFlags	VSI_markerFlags;

@instance	byte			VSI_suspendCount;

@instance	SplineUnSuspendFlags	VSI_unSuspendFlags;
    /*  actions to be performed when suspend count reaches zero */

@endc	/* VisSplineClass */

/* ----------------------------------------------------------------------------
 * 	CONTROLLERS
 * ----------------------------------------------------------------------------
 */

/* ----------------------------------------------------------------------------
 * 	Marker control
 * ----------------------------------------------------------------------------
 */

@class  SplineMarkerControlClass, GenControlClass;

@message void MSG_SMC_SET_MARKER_SHAPE (MarkerShape markerShape = cl);
/*
 *  Pass:	MarkerShape
 *  Return:	nothing
 */

@default GCI_output = (TO_APP_TARGET);

@endc	/* SplineMarkerControlClass */

typedef ByteFlags SplineMarkerControlFeatures ;
    /* 7 bits unused */

    #define SMCF_MARKER_SHAPE 	(0x01)

/* ----------------------------------------------------------------------------
 * 	Point control -- insert/delete anchors/controls.
 * ----------------------------------------------------------------------------
 */

@class  SplinePointControlClass, GenControlClass;

@default GCI_output = (TO_APP_TARGET);

@endc	/* SplinePointControlClass */

typedef ByteFlags SplinePointControlFeatures ;
    /* 4 bits unused */
    #define SPCF_INSERT_ANCHORS 	(0x08)
    #define SPCF_DELETE_ANCHORS 	(0x04)
    #define SPCF_INSERT_CONTROLS 	(0x02)
    #define SPCF_DELETE_CONTROLS 	(0x01)

typedef ByteFlags SplinePointControlToolFeatures ;
    /* 4 bits unused */
    #define SPCTF_INSERT_ANCHORS 	(0x08)
    #define SPCTF_DELETE_ANCHORS 	(0x04)
    #define SPCTF_INSERT_CONTROLS 	(0x02)
    #define SPCTF_DELETE_CONTROLS 	(0x01)

#define SPC_DEFAULT_FEATURES 		(SPCF_INSERT_ANCHORS | \
                     SPCF_DELETE_ANCHORS | \
                     SPCF_INSERT_CONTROLS | \
                     SPCF_DELETE_CONTROLS)

#define SPC_DEFAULT_TOOLBOX_FEATURES 	(SPCTF_INSERT_ANCHORS | \
                     SPCTF_DELETE_ANCHORS | \
                     SPCTF_INSERT_CONTROLS | \
                     SPCTF_DELETE_CONTROLS)

/* ----------------------------------------------------------------------------
 * 	Polyline control -- straight/curvy
 * ----------------------------------------------------------------------------
 */

@class  SplinePolylineControlClass, GenControlClass;

@default GCI_output = (TO_APP_TARGET);

@endc	/* SplinePolylineControlClass */

typedef ByteFlags SplinePolylineControlFeatures ;
    /* 5 bits unused */
    #define SPLCF_MAKE_CURVY 	(0x04)
    #define SPLCF_MAKE_STRAIGHT 	(0x02)
    #define SPLCF_DELETE 		(0x01)

typedef ByteFlags SplinePolylineControlToolFeatures ;
    /* 5 bits unused */
    #define SPLCTF_MAKE_CURVY 	(0x04)
    #define SPLCTF_MAKE_STRAIGHT 	(0x02)
    #define SPLCTF_DELETE 		(0x01)

#define SPLC_DEFAULT_FEATURES 	\
        (SPLCF_MAKE_CURVY | SPLCF_MAKE_STRAIGHT | SPLCF_DELETE)

#define SPLC_DEFAULT_TOOLBOX_FEATURES 	\
        (SPLCTF_MAKE_CURVY | SPLCTF_MAKE_STRAIGHT | SPLCTF_DELETE)

/* ----------------------------------------------------------------------------
 * 	Smoothness control
 * ----------------------------------------------------------------------------
 */

@class  SplineSmoothnessControlClass, GenControlClass;

@default GCI_output = (TO_APP_TARGET);

@endc	/* SplineSmoothnessControlClass */

typedef ByteFlags SplineSmoothnessControlFeatures ;
    /* 4 bits unused */
    #define SSCF_NONE 		(0x08)
    #define SSCF_SEMI_SMOOTH 	(0x04)
    #define SSCF_VERY_SMOOTH 	(0x02)
    #define SSCF_AUTO_SMOOTH 	(0x01)

typedef ByteFlags SplineSmoothnessControlToolFeatures ;
    /* 4 bits unused */
    #define SSCTF_NONE 		(0x08)
    #define SSCTF_SEMI_SMOOTH 	(0x04)
    #define SSCTF_VERY_SMOOTH 	(0x02)
    #define SSCTF_AUTO_SMOOTH 	(0x01)

/*  SSC is already used by the style control, so using SSMC instead. */

#define SSMC_DEFAULT_FEATURES 	\
    (SSCF_NONE | SSCF_SEMI_SMOOTH | SSCF_VERY_SMOOTH | SSCF_AUTO_SMOOTH)

#define SSMC_DEFAULT_TOOLBOX_FEATURES 	\
    (SSCTF_NONE|SSCTF_SEMI_SMOOTH|SSCTF_VERY_SMOOTH|SSCTF_AUTO_SMOOTH)

/* ----------------------------------------------------------------------------
 * 	SplineOpenCloseControl
 * ----------------------------------------------------------------------------
 */

@class  SplineOpenCloseControlClass, GenControlClass;

@message void MSG_OPEN_CLOSE_CONTROL_CHANGE (word message = cx);
/*
 *  Pass:	message to send to spline object
 */

@default GCI_output = (TO_APP_TARGET);

@endc	/* SplineOpenCloseControlClass */

typedef ByteFlags SplineOpenCloseControlFeatures ;
    /* 6 bits unused */
    #define SOCF_OPEN 		(0x02)
    #define SOCF_CLOSE 		(0x01)

#define SOCF_DEFAULT_FEATURES 		(SOCF_OPEN | SOCF_CLOSE)

#define SOCF_DEFAULT_TOOLBOX_FEATURES 	(SOCF_OPEN | SOCF_CLOSE)

/* ----------------------------------------------------------------------------
 * 	BLEND
 * ----------------------------------------------------------------------------
 */

typedef struct {
    /*  VM file handle that contains both splines */
    word		BP_vmFileHandle;

    /*  OD of first spline */
    optr		BP_firstOD;

    /*  OD of second spline */
    optr		BP_secondOD;

    /*  OD of destination object */
    optr		BP_outputOD;

    /*
     *  When a new spline is created by BLEND, this message will be sent to
     *  the output OD, which should know what to do with it.  ^lcx:dx will
     *  be the spline's OD
     */
    word		BP_outputMessage;
    word		BP_firstPct;
    word		BP_lastPct;

    /*  number of steps */
    word		BP_numSteps;
} BlendParams} ;

extern void _pascal Blend (BlendParams *params);

#ifdef __HIGHC__

pragma Alias(Blend, "BLEND");

#endif

@endlib


spool.goh

/*----------------------------------------------------------------------------

    Copyright (c) GeoWorks 1989-1992 -- All Rights Reserved

PROJECT:	PC GEOS
MODULE:		CInclude - Spool Library Definitions
FILE:		spool.goh

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    Schoon  4/30/92		Initial Version
    jenny	8/31/93		Completed

DESCRIPTION:
    Definitions for users of the spool library, and the various object
    exported by the library (PrintControl and  PageSizeControl).

    $Id: spool.goh,v 1.50.4.5 97/09/18 16:16:57 jimw Exp $

----------------------------------------------------------------------------*/
@optimize
@deflib spool

@include  <object.goh>
#include  <driver.h>
#include  <thread.h>
#include  <print.h>

/* To remove warning on PC SDK using BCC4.5.
 * 7/17/96 - ptrinh
 */
#include  <Internal/spoolInt.h>

/*
 * GenApplication GCN lists to be placed on:
 *	GAGCNLT_SELF_LOAD_OPTIONS
 */

/*--------------------------------------------------------------------------*
 *			PrintControlClass
 *--------------------------------------------------------------------------*/

@class PrintControlClass, GenControlClass;

/*--------------------------------------------------------------------------*
 *			How printing works
 *--------------------------------------------------------------------------*/

/* MSG_PRINT_CONTROL_INITIATE_PRINT initiates the user interface to
 * printing. This is normally sent from the "Print" trigger in the file menu
 * The user interface normally consists of a dialog box containing printing
 * options.  Some of these options can be specified by the attributes
 * PrintControlAttrs.  The application can also add its own UI components
 * to the print dialog box.
 *
 * When the user interface for printing finishes successfully (usually
 * pressing a "Print" button), MSG_PRINT_CONTROL_PRINT is invoked.  This
 * method creates a graphics string (stored in a VM file) and then sends the
 * following messages:
 *
 *	MSG_PRINT_VERIFY_PRINT_REQUEST	to PCI_output
 *	MSG_PRINT_GET_DOC_NAME 		to PCI_docNameOutput
 *	MSG_PRINT_START_PRINTING	to PCI_output
 *
 * While the application is printing, it might want to send back to the PC
 * an indication of progress (MSG_PRINT_CONTROL_REPORT_PROGRESS).
 * This is done to notify the user of what is occurring, and to allow the
 * user to interrupt a print request before the spooler take control
 * of the print job. See the method description below, and the
 * PrintControlFlags documentation.
 *
 * After all these methods have been responded to (as appropriate), the
 * PrintControl object will clean up some details, and pass the print
 * job request onto the spool library.
 */

/*--------------------------------------------------------------------------
        What every application writer should know...
----------------------------------------------------------------------------*/

/* Using the PrintControl is a relatively easy thing to do, provided some
 * simple rules are followed.  First, some terms:
 *
 *	Printing:	The creation of a GString by an application, which
 *			is stored in a file in the SYSTEM\SPOOL directory.
 *	Spooling:	This file is the spooled, by being queued (if
 *			necessary) on a print queue; and then has several
 *			page width x certain height swath bitmaps generated
 *			and printed.
 *	PrintControl:	The UI object that controls all the UI
 *				aspects of the problem
 *	The Spool Process:	The thread that controls all of the spooling
 *				aspects of the problem.
 *	Spool Threads:		Individual print queues for every printer
 *				active (with jobs) on a system
 *	Print Dialog Box:	The pretty dialog box that appears (usaually)
 *				when you press the "Print..." trigger.
 *	User Print Group:	The application-defined group of UI objects
 *				that can be incorporated into the Print Dialog
 *				Box. NOTE: The root of this UI-tree must be
 *				be set NOT_USABLE!!!!
 *	User Print Trigger:	The application-defined trigger or other UI
 *				objects that can be used in place of the
 *				usual "Print..." trigger. Again, these must
 *				set NOT_USABLE in the .UI file.
 */
/* How to set up your PrintControl object:
 *	* Determine if you want a dialog box. Default:YES
 *	* Determine if you want page controls. Default:YES
 *	* Determine if the application can output text or graphics or both,
 *	  and possibly, what level of detail. Default:ALL outputs possible
 *	* Determine if you want a special print trigger. If so, create the
 *	  object(s), and set the correct instance data. Default:NONE
 *	  Note: The AD of the application-defined trigger should be:
 *		action = MSG_PRINT_CONTROL_INITIATE_PRINT, FooObj;
 *	  where FooObj is of type PrintControl.
 *	* Determine if you want special UI object in the Print Dialog Box.
 *	  If so, create the object, and set the instance data. Default:NONE
 *	* Make the PrintControl a generic child of something (probably
 *		the GenPrimary).
 *	* Add the PrintControl to your Active List!
 *
 *	*  How to use your PrintControl object:
 *	* If working with a multiple page document, use the provided methods
 *	  to allow the PC to display the full range of pages available. Use
 *	  the USER page range to select intelligent default page ranges.
 *	* The document size must be set prior to the time the document is
 *	  spooled. Do this by either setting the document size in the
 *	  .UI file, or sending the approriate method BEFORE send a
 *	  MSG_PRINT_CONTROL_PRINTING_COMPLETED back to the PC.
 *	* MSG_PRINT_START_PRINTING will be send to PCI_output as
 *	  notification for the application to start printing.
 *	* MSG_PRINT_NOTIFY_PRINT_DB is sent to PCI_output evertime the print
 *	  dialog box comes on/off screen.
 *	* MSG_PRINT_VERIFY_PRINT_REQUEST is sent to PCI_output if the
 *	  attribute is
 *	  is set in PCI_attrs. See the method declaration for more
 *	  information.
 *
 * When printing:
 *	* The printMethod (MSG_PRINT_START_PRINTING) is received by
 *	  PCI_output
 *	* Send MSG_PRINT_CONTROL_REPORT_PROGRESS to allow visual
 *	  feedback to the user
 *	* Send MSG_PRINT_CONTROL_PRINTING_COMPLETED back to the PC's
 *	  OD when you have completed printing. MAKE SURE THE DOCUMENT SIZE
 *	  HAS BEEN SET CORRECTLY.
 */
/* Check the individual method declarations for additional information... */

/*--------------------------------------------------------------------------*
 *		Constants & Structures
 *--------------------------------------------------------------------------*/

typedef ByteFlags PrintControlFeatures ;
#define PRINTCF_PRINT_TRIGGER 	0x02 	 /* wants a print trigger */
#define PRINTCF_FAX_TRIGGER 	0x01	 /* wants a fax trigger */

typedef ByteFlags PrintControlToolboxFeatures ;
#define PRINTCTF_PRINT_TRIGGER 	0x02	/* wants a print tool trigger */
#define PRINTCTF_FAX_TRIGGER 	0x01	/* wants a fax tool trigger */

#define PRINTC_DEFAULT_FEATURES  (PRINTCF_PRINT_TRIGGER | \
                 PRINTCF_FAX_TRIGGER)

#define PRINTC_DEFAULT_TOOLBOX_FEATURES 	(PRINTCTF_PRINT_TRIGGER | \
                     PRINTCTF_FAX_TRIGGER)

#define MAXIMUM_NUMBER_OF_PRINTERS 	255
#define MAXIMUM_PRINTER_NAME_LENGTH	64	; includes NULL terminator ""

typedef ByteFlags PrinterOutputModes ;
#define POM_unused   	    	0xe0 /* leave these bits alone!!! */
#define POM_GRAPHICS_LOW 	0x10 /* Graphics mode low quality available */
#define POM_GRAPHICS_MEDIUM 	0x08 /* Graphics mode medium quality available*/
#define POM_GRAPHICS_HIGH 	0x04 /* Graphics mode high quality available */
#define POM_TEXT_DRAFT 		0x02 /* Character mode draft quality available */
#define POM_TEXT_NLQ 		0x01 /* Character mode NLQ quality available  */

#define PRINT_GRAPHICS 	(POM_GRAPHICS_LOW | \
             POM_GRAPHICS_MEDIUM |  POM_GRAPHICS_HIGH )

#define PRINT_TEXT 	(POM_TEXT_DRAFT | POM_TEXT_NLQ)

/*
 * The default quality chosen by an application
 */
typedef ByteEnum PrintQualityEnum ;
#define	PQT_HIGH		0	/* default to high */
#define	PQT_MEDIUM		1	/* default to medium */
#define	PQT_LOW			2	/* default to low */
/* More mnemonically named equivalents for the PrintQualityEnum values. */
#define PQE_HIGH     PQT_HIGH	/* default to high */
#define PQE_MEDIUM   PQT_MEDIUM	/* default to medium */
#define PQE_LOW 	    PQT_LOW	/* default to low */

typedef WordFlags PrintControlAttrs ;
#define PCA_NO_PRINTER_CONTROLS 	0x8000	/* No printer controls are available */
#define PCA_SEE_IF_DOC_WILL_FIT 	0x4000	/* check, before printing, if the
                       document will fit on the paper */
#define PCA_MARK_APP_BUSY 	0x2000	/* mark busy while application is
                       printing */
#define PCA_VERIFY_PRINT 	0x1000	/* indicate we want to verify before
                       printing */
#define PCA_SHOW_PROGRESS 	0x0800	/* show the print progress dialog box */
#define PCA_PROGRESS_PERCENT 	0x0400	/* show progress by percentage
                       completed */
#define PCA_PROGRESS_PAGE 	0x0200	/* show progress by page completed */
#define PCA_FORCE_ROTATION 	0x0100	/* Force rotation of output */
#define PCA_COPY_CONTROLS 	0x0080	/* Copy controls are available */
#define PCA_PAGE_CONTROLS 	0x0040	/* Page range controls are available */
#define PCA_QUALITY_CONTROLS 	0x0020	/* Print quality controls are
                       available */
#define PCA_USES_DIALOG_BOX 	0x0010	/* A print dialog box should appear */
#define PCA_GRAPHICS_MODE 	0x0008	/* Supports graphics mode output */
#define PCA_TEXT_MODE 		0x0004	/* Supports text mode output */
#define PCA_DEFAULT_QUALITY 	0x0003	/* default print quality */

typedef enum /* word */ {
    PCS_PRINT_BOX_VISIBLE    ,  	    /* Print DB is onscreen */
    PCS_PRINT_BOX_NOT_VISIBLE           /* Print DB not onscreen */
} PrintControlStatus} ;

typedef enum /* word */ {
    PCPT_PAGE    	    = 0,	/* change page number */
    PCPT_PERCENT        = 2,	/* change percent done */
    PCPT_TEXT    	    = 4		/* change text message */
} PCProgressType} ;

/*--------------------------------------------------------------------------*
        Messages
 *--------------------------------------------------------------------------*/

/***************************************************************************/
@message void MSG_PRINT_CONTROL_INITIATE_PRINT ();
/*
 * Initiate printing. This will normally cause the print dialog box to
 * come up on screen.
 *
 * Context:	Invoked by the user wanting to print a document, by
 *		(usually) clicking on the print trigger in the file menu.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_PRINT ();

/* Requests the printing process to actually begin.
 *
 * Context:	Invoked by the user clicking on the "Print" trigger in the
 *		print dialog box.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_VERIFY_COMPLETED ( Boolean continue = cx);

/* Tells the PrintControl that the print verify has been completed,
 * and either printing will ensure, or it will be cancelled.
 *
 * Context:	Sent in response to MSG_PRINT_VERFIY_PRINTING
 * Source:	Anyone, but most likely the PCI_output object
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	continue = TRUE to continue print job
 *			 = FALSE to cancel printing
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_SET_DOC_NAME ( char *string = cx:dx );

/* Sets the document name, which is displayed in the Printer Control Panel
 * If this message in not received by the PrintControl object, the print
 * job will never be released to the spooler.
 *
 * Context:	Sent in response to MSG_PRINT_GET_DOC_NAME
 * Source:	Anyone, but most likely the GenAppDocumentControl object
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	string	= Null-terminated string of length no greater
 *			  than FILE_LONGNAME_LENGTH + 1.
 * Return:	Nothing
 */

/***************************************************************************/
@message Boolean MSG_PRINT_CONTROL_REPORT_PROGRESS (
                    PCProgressType progress = cx,
                    word pageOrPercent = dx );

/* Sent to display the progress of the application spooling a (generally)
 * large or complex image as an integer value.
 *
 * Context:	Sent by application while printing.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	 Progress 	 	PageOrPercent
 *		 --------		-------------
 *		 PCPT_PAGE 		Page number
 *		 PCPT_PERCENT 	 	Percentage completed
 *
 *			  NOTE: You must have the PCI_attrs field set
 *			  properly for any progress dialog box to appear!
 *
 * Return:	 TRUE (to continue printing)
 *		 FALSE (to abort printing)
 *		  	An application should stop drawing to the
 *			provided GState immediately, and send a
 *			MSG_PRINT_CONTROL_PRINTING_CANCELLED
 *			to the PrintControl object.
 */

/***************************************************************************/
@alias(MSG_PRINT_CONTROL_REPORT_PROGRESS) \
Boolean MSG_PRINT_CONTROL_REPORT_STRING( PCProgressType progress = cx, \
                     char *progressString = dx:bp );

/* Sent to display the progress of the application spooling a (generally)
 * large or complex image as a string.
 *
 * Context:	Sent by application while printing.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	progress = PCPT_TEXT
 *		progressString = Text message to display
 *
 * Return:	 TRUE (to continue printing)
 *		 FALSE (to abort printing)
 *		  	An application should stop drawing to the
 *			provided GState immediately, and send a
 *			MSG_PRINT_CONTROL_PRINTING_CANCELLED
 *			to the PrintControl object.
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_PRINTING_CANCELLED();

/* Cancel the print job currently being spooled by the application. Do *not*
 * send both this method and a MSG_PRINT_CONTROL_PRINTING_COMPLETED for
 * a single print job.
 *
 * Context:	Sent by an application to stop spooling a document once
 *		spooling has begun, possibly due to an error. The application
 *		may not use the GState handle it was drawing to once this
 *		message has been sent.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_PRINTING_COMPLETED ();

/* Indicate that the application has finished spooling the document
 *
 * Context:	Sent by the application once it is done "drawing" the
 *		document.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_SET_ATTRS ( PrintControlAttrs attributes = cx );

/* Set the attributes for a PrintControl object.
 *
 * Context:	Utility message sent to set the PrintControlAttrs
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	attributes	= PrintControlAttrs
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message PrintControlAttrs MSG_PRINT_CONTROL_GET_ATTRS () = cx;

/* Get the attributes for a PrintControl object
 *
 * Context:	Utility message sent to get PrintControlAttrs
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Return:	PrintControlAttrs
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_SET_TOTAL_PAGE_RANGE ( word firstPage = cx, \
                              word lastPage = dx );

/* Sets the first & last page numbers that are in the document
 *
 * Context:	Sent whenever the number of pages in a document changes, or
 *		a new document is opened. Must be correct prior to sending
 *		MSG_PRINT_CONTROL_PRINTING_COMPLETED
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	firstPage = First page (usually 0 or 1)
 *		lastPage = Last page
 *
 * Return:	Nothing
 */

/***************************************************************************/
typedef struct {
    word	PCPR_lastPage;
    word	PCPR_firstPage;
} PCPageRange} ;

@message PCPageRange MSG_PRINT_CONTROL_GET_TOTAL_PAGE_RANGE () = cx.dx;
/*
 * Gets the first & last page numbers in a document
 *
 * Context:	Utility message sent to get the number of pages
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	PCPageRange structure containing first and last
 *		page numbers
 *
 * Note: This is not the range of pages the user has selected to be
 *       printed. That is the SELECTED page range.
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_SET_SELECTED_PAGE_RANGE (word firstPage = cx, \
                            word lastPage = dx );

/* Sets the (initial) first & last pages to be printed in a document
 *
 * Context:	Utility message sent to set a common default page range
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	firstPage = First page (usually 0 or 1)
 *		lastPage = Last page
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message PCPageRange MSG_PRINT_CONTROL_GET_SELECTED_PAGE_RANGE () = cx.dx;
/*
 * Returns the user-selected range of pages to be printed
 *
 * Context:	Sent to obtain the range of pages to be printed, usually
 *		right after the application received MSG_PRINTING_PRINT.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	PCPageRange structure containing first and last
 *		page numbers
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_SET_DOC_SIZE (word width = cx,
                                             word height = dx);

/* Sets the dimensions of the document to be printed.
 *
 * Context:	Sent (generally) whenever a new document is opened, or when
 *		the existing document changes size. The size must be accurate
 *		prior to MSG_SPOOL_PRINT_COONTROL_PRINTING_COMPLETED is sent.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	width 	= Width (in points)
 *		height 	= Height (in points)
 *
 * Return:	Nothing
 *
 * Note: For 32-bit document sizes, use MSG_SPOOL_PRINT_CONTROL_SET_
 *	 EXTENDED_DOC_SIZE
 */

/***************************************************************************/

/*
 * Use the DWORD_WIDTH and DWORD_HEIGHT macros to get the width and
 * height from the returned value.
 */
@message SizeAsDWord MSG_PRINT_CONTROL_GET_DOC_SIZE () = dx.cx;

/* Returns the dimensions of the document to be printed.
 *
 * Context:	Utility message sent to get the size of a document
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	DocSize structure: DS_width = Width (in points)
 *		    	    	   DS_height = Height (in points)
 *
 * Note: For 32-bit document sizes, use MSG_SPOOL_
 *	 PRINT_CONTROL_GET_EXTENDED_DOC_SIZE
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_SET_EXTENDED_DOC_SIZE( \
                    PCDocSizeParams *ptr = dx:bp );

/* Sets the dimensions of the document to be printed.
 *
 * Context:	Sent (generally) whenever a new document is opened, or when
 *		the existing document changes size. The size must be accurate
 *		prior to MSG_SPOOL_PRINT_COONTROL_PRINTING_COMPLETED is sent.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	*ptr	= PCDocSizeParams structure.
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_GET_EXTENDED_DOC_SIZE( \
                    PCDocSizeParams *ptr = dx:bp );

/* Returns the dimensions of the document to be printed.
 *
 * Context:	Utility message sent to get the size of a document
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	ptr = pointer to PCDocSizeParams (empty)
 *
 * Return:	ptr = pointer to PCDocSizeParams (filled)
 *
 * Note: This will return the correct result, regardless
 *       of whether 16-bit or 32-bit size were set.
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_SET_DOC_MARGINS ( PCMarginParams *ptr = dx:bp );

/* Sets the margins the user has selected for the current document.
 *
 * Context:	Sent when a new document is opened, or when the margins for
 *		the current document are changed. The margins *must* be set
 *		prior to MSG_PRINT_CONTROL_PRINTING_COMPLETED is sent.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	ptr = pointer to PCMarginParams structure
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_GET_DOC_MARGINS ( PCMarginParams *ptr = dx:bp );

/* Gets the margins the user has selected for the current document.
 *
 * Context:	Utility message sent to the PrintControl object
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	ptr = pointer to PCMarginParams structure (empty)
 *
 * Return:	ptr = pointer to PCMarginsParams structure (filled)
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_SET_DOC_SIZE_INFO (PageSizeReport *ptr = dx:bp);

/* Set all of the information about the document size & orientation
 *
 * Context:	Sent (generally) whenever a new document is opened, or when
 *		the existing document changes size. The size must be accurate
 *		prior to MSG_SPOOL_PRINT_CONTROL_PRINTING_COMPLETED is sent.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	ptr = pointer to PageSizeReport structure
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_GET_DOC_SIZE_INFO (PageSizeReport *ptr = dx:bp);

/* Gets the data about the size & orientation of the document to be printed.
 *
 * Context:	Utility message sent to get the size of a document
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	ptr = pointer to PageSizeReport structure (empty)
 *
 * Return:	ptr = pointer to PageSizeReport structure (filled)
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_SET_OUTPUT ( optr objectPtr = cx:dx );

/* Sets the output of the PrintControl object, the object which receives
 * all the printing-related messages.
 *
 * Context:	Sent whenever a different object in an application needs to
 *		communicate with the PrintControl object. Rarely used.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	objectPtr = OD of object
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message optr MSG_PRINT_CONTROL_GET_OUTPUT () = cx:dx;

/* Get the output object's OD of the PrintControl object
 *
 * Context:	Utility message sent to get the output of the PrintControl
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	OD of the output object
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_SET_DOC_NAME_OUTPUT ( optr document = cx:dx );

/* Sets the document name output of the PrintControl object, the object
 * which receives MSG_PRINT_GET_DOC_NAME.
 *
 * Context:	Sent whenever a different object in an application needs to
 *		communicate with the PrintControl object. Rarely used.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	document = OD of document name object
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message optr MSG_PRINT_CONTROL_GET_DOC_NAME_OUTPUT () = cx:dx;

/* Get the document name output OD of the PrintControl object
 *
 * Context:	Utility message sent to get the output of the PrintControl
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	OD of the document name object
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_SET_DEFAULT_PRINTER ( word printerNum = cx );

/* Sets the application-default printer, to be used the next time the
 * print dialog box appears.
 *
 * Context:	Used by system utilities or other applications that want
 *		override the user-set default printer.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	printerNum	= Printer number (zero-based)
 *				= -1 indicates we should use the system's
 *				  default
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message word MSG_PRINT_CONTROL_GET_DEFAULT_PRINTER () = cx;

/* Returns the application-default printer. Donot* expect that this indeed
 * is the printer that the user in printing to, as he/she may have been able
 * to change to a new printer. This method is included for orthogonality. ""
 *
 * Context:	Utility message to get the application-default printer.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Printer number (zero-based)  OR
 *		-1 indicates we should use the system's default
 */

/***************************************************************************/
@message PrinterMode MSG_PRINT_CONTROL_GET_PRINT_MODE () = cl;

/* Returns the print-mode selected by the user for printing.
 *
 * Context:	This may be used by applications to adjust their output
 *		depending what type of output has been selected by the user.
 *		It is only useful between the time MSG_PRINTING_PRINT is
 *		received & MSG_PRINT_CONTROL_PRINTING_COMPLETED is sent.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	PrinterMode (0 if no mode is yet selected)
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_GET_PAPER_SIZE_INFO (
                PageSizeReport *ptr = dx:bp);

/* Get the current paper size & orientation selected by the user
 *
 * Context:	Utility message sent to the PrintControl object
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass: 	ptr = pointer to PageSizeReport structure (empty)
 *
 * Return:	ptr = pointer to PageSizeReport structure (filled)
 */

/***************************************************************************/
typedef struct {
        word	PD_widthHigh;	/* paper width, in points - high word */
    word	PD_widthLow;	/* paper width, in points - low word */
    dword	PD_height;  	/* paper height, in points */
} PaperDimensions} ;

/*
 * To make a dword from the values returned in PD_widthHigh and PD_widthLow,
 * use the PAPER_WIDTH macro.
 */
#define PAPER_WIDTH (pd) (((pd).PD_widthHigh << 16) | (pd).PD_widthLow)
#define PAPER_HEIGHT (pd) ((pd).PD_height)

@message void MSG_PRINT_CONTROL_GET_PAPER_SIZE (
                PaperDimensions *retValue = axcxdxbp);

/* Return the dimensions of the paper selected for the current printer.
 *
 * Context:	Utility message sent to the PrintControl object
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:     	Nothing
 *
 * Return:	*retValue->PD_height= Paper height (in points)
 *		*retValue->PD_widthLow	= low word of paper width (in points)
 *		*retValue->PD_widthHigh	= high word of paper height (in points)
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_GET_PRINTER_MARGINS (
                PCMarginParams *retValue = axcxdxbp,
                Boolean setMargins = dx);

/* Returns the margins enforced by the current printer.
 *
 * Context:	Utility message sent when setting default margins for a
 *		document, or possibly when printing for a non-WYSIWYG app.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:    	*retValue	= empty PCMarginParams structure
 *
 *	    	setMargins	= TRUE  - to set the document margins to be
 *		    	          the same as the printer's margins
 *  			    	= FALSE - to leave the document margins the same
 *
 * Return: 	*retValue	= filled PCMarginParams structure
 */

/***************************************************************************/

@message void MSG_PRINT_CONTROL_CALC_DOC_DIMENSIONS (
                PageSizeReport *ptr = dx:bp);

/* Calculates and returns the dimensions of the document, based on the
 * currently selected paper size, the printer's margins, and the
 * PCA_FORCE_ROTATION bit. The document size & margins will also be set by
 * this message.
 *
 * Context:	Used by non-WYSIWYG applications who want to ensure that
 *		the document created will exactly fit on the paper the user
 *		has selected for the printer, called after MSG_PRINTING_
 *		PRINT has been received.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass: 	*ptr	= empty PageSizeReport structure
 *
 * Return:	*ptr	= filled PageSizeReport structure with the
 *			  margins already subtracted from the
 *			  dimensions of the page and the orientation
 *			  taken into account.
 */

/***************************************************************************/
@message Boolean MSG_PRINT_CONTROL_CHECK_IF_DOC_WILL_FIT (Boolean warning = cx);

/* Test to see if the document will fit with the currently selected paper
 *
 * Context:	Possibly sent when a user selects new margins or document size
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted
 *
 * Pass: 	warning	= Boolean (display a warning to the user)
 *
 * Return:	TRUE  - if the document will fit
 *				OR
 *		FALSE - if the document will not fit
 */

/*--------------------------------------------------------------------------*
        Internal Messages
--------------------------------------------------------------------------*/

/* Do *NOT* send any of the following three methods to the PrintControl.
 * They are for internal use only, but must be declared here so that this
 * class  may use them
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_VERIFY_PRINT ();

/* Sent to allow printing "anyway" after the verification dialog box has
 * appeared.
 *
 * Context:	The user has selected to ignore the warning about the
 *		margins or the document size, and wants to print anyway.
 * Source:	GenTrigger in verify dialog box
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_VERIFY_SCALE ();

/* Sent to allow printing by scaling the document to ensure it fits on the
 * paper selected by the user.
 *
 * Context:	The user has selected to have the document automatically
 *		scaled to fit, after a warning appeared.
 * Source:	GenTrigger in verify dialog box
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_VERIFY_CANCEL ();

/* Sent to stop printing, because of a document/paper margin size conflict
 *
 * Context:	The user selected to Cancel printing after the warning
 *		from the PrintControl appeared.
 * Source:	GenTrigger in verify dialog box
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PRINT_CONTROL_ABORT_PRINT_JOB ();

/* Sent to eventually stop printing.
 *
 * Context:	The user selected to Cancel printing while the print
 *		progress dialog box was onscreen.
 * Source:	GenTrigger in progress dialog box
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 */

/*-----------------------------------------------------------------------------
        Post-2.0 Messages
  ---------------------------------------------------------------------------*/

@protominor	PostZoomerMessages

@message void MSG_PRINT_CONTROL_INITIATE_OUTPUT_UI (PrinterDriverType type = cl);

/* Display the output (print or fax, currently) dialog box.
 *
 * Context:	Invoked by the user wanting to print a document, by
 *		(usually) clicking on the print trigger in the file menu.
 *		Generally used just internally, as the PrintControl provides
 *		all the UI one should need for printing.
 * Source:	Anyone
 * Destination:	PrintControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	CL	= PrinterDriverType
 *
 * Return:	Nothing
 *		AX, CX, DX, BP - destroyed
 */

@message void MSG_PRINT_SET_PRINT_CONTROL_PAGE_SIZE (PageSizeReport *psr = dx:bp);

/*
 * Sets the page size to be displayed by the print control.  Internal only,
 * and currently Redwood-only.
 *
 * Context:	Utility message sent to set the page dimensions
 * Source:	Anyone
 * Destination:	PageSizeControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	DX:BP	= PageSizeReport structure
 *
 * Return:	Nothing
 */

@protominor	SpoolMailboxSupport;

@message Boolean MSG_PRINT_GET_MAILBOX_OBJECT_TYPE (word *dataType = multipleax) = carry;
/* Fetch the MailboxObjectType the caller should render, if the print request
 * came via a MailboxSendControl
 *
 * Context:	Called by the recipient of MSG_PRINT_START_PRINTING if the
 *		application supports the MailboxSendControl. It allows
 *		the caller to print things other than the current document.
 * Source:	Anyone
 * Destination:  PrintControlClass
 * Interception: not useful
 *
 * Pass:
 *		nothing
 * Return:
 *		1 if print request didn't come from the
 *		    MailboxSendControl, so there's no MailboxObjectType to
 *		    return
 *			*dataType = destroyed
 *		0 if MailboxObjectType returned:
 *			*dataType = MailboxObjectType to render
 */

@message void MSG_PRINT_CANNOT_PRINT (word error = cx);
/* Internal message sent by the print dialog box when it finds it cannot
 * fulfill its purpose.
 *
 * Context:	Called by the SpoolSummons object when it initializes and
 *		finds it is hosed.
 * Source:	SpoolSummonsClass
 * Destination:	PrintControlClass
 * Interception: probably not useful
 */

@message word MSG_PRINT_GET_FIRST_PAGE_OFFSET () = dx;
/* Return the height of the last page of the  currently selected cover page.
 * Returns zero if no cover page is being used.
 *
 * Context:     Called by an application after receiving a
 *              MSG_PRINT_START_PRINING and before drawing to the print
 *              gstate.
 * Source:      Any application that has a PrintControl
 * Destination: PrintConrtolClass
 * Interception: probably not useful
 */

@message word MSG_PRINT_SET_PRINT_HEADER_OPTION (FoamPrintHeaderState state = cx);
/* Sets the option for adding a print header to each printed page.
 * Added Sept 1997.
 *
 * Context:     Sent by an application when setting up the print control
 *		for a print job.
 *
 * Source:      Any application that has a PrintControl
 * Destination: PrintConrtolClass
 * Interception: probably not useful
 */

@protoreset

/*--------------------------------------------------------------------------*
        Methods imported from MetaClass
--------------------------------------------------------------------------*/

/***************************************************************************/
@importMessage MetaPrintMessages, void MSG_PRINT_VERIFY_PRINT_REQUEST(   \
                    optr printCtrlOD = cx:dx );

/* Sent to request the application to verfiy that state of the
 * application-supplied UI is indeed valid for printing to ensue.
 *
 * Context:	Once printing is requested by the user, this message is
 *		sent
 *		out, giving the application a chance to cancel the print job.
 * Source:	PrintControl object
 * Destination:	PCI_output
 * Interception: May be intercepted by any object. To obtain the root of the
 *		generic tree to analyze, an application may want to use
 *		MSG_PRINT_CONTROL_GET_APP_PRINT_UI
 *
 * 		The interceptor must send back to the passed OD a
 *		MSG_PRINT_CONTROL_VERIFY_COMPLETED with the
 *		applicable arguments. Failure to do so will cause the
 *		print job to never be completed.
 *
 * Pass:	printCtrlOD = OD of the PrintControlClass object
 *
 * Return:	Nothing
 */

/***************************************************************************/
@importMessage MetaPrintMessages, void MSG_PRINT_START_PRINTING(           \
                    optr printCtrlOD = cx:dx,  \
                    GStateHandle gstate = bp );

/* Sent to tell the application to begin printing
 *
 * Context:	Once the user has clicked on the Print trigger in the
 *		Print dialog box, a spool file will be created, and this
 *		message will be sent.
 * Source:	PrintControl object
 * Destination:	PCI_output
 * Interception: May be intercepted by any object
 *
 * Pass: 	printCtrlOD = OD of the PrintControlClass object
 *	 	gstate      = GState handle to print (draw) to
 *
 * Return:	Nothing
 */

/***************************************************************************/
@importMessage MetaPrintMessages, void MSG_PRINT_GET_DOC_NAME (
                    optr printCtrlOD = cx:dx);

/* Sent to request the name of the document being printed.
 *
 * Context:	Once printing is requested by the user, this message
 * 		is sent
 *		out, and the document will not be handed off to the spooler
 *		until it is returned.
 * Source:	PrintControl object
 * Destination:	PCI_docNameOutput
 * Interception: Intercepted by the AppDocumentControlClass, which will then
 *    	    	return the name of the current document. The recipient of
 *		this messagemust* respond with MSG_PRINT_CONTROL_SET
 *		DOC_NAME.
 *
 * Pass:	printCtrlOD = OD of the PrintControlClass object
 *
 * Return:	Nothing
 */

/***************************************************************************/
@importMessage MetaPrintMessages, void MSG_PRINT_NOTIFY_PRINT_DB( \
                     optr printCtrlOD = cx:dx, \
                     PrintControlStatus pcs = bp );

/* Sent to indicate that the print dialog box will either soon be coming
 * onto the screen, or has left the screen.
 *
 * Context:	Used so application may keep UI gadgetry up-to-date only
 *		when necessary.
 * Source:	PrintControl object
 * Destination:	PCI_output
 * Interception: May be intercepted by any object.
 *
 * Pass:	printCtrlOD = OD of the PrintControlClass object
 *		pcs         = PrintControlStatus
 *
 * Return:	Nothing
 */

/***************************************************************************/
@importMessage MetaPrintMessages, void MSG_PRINT_NOTIFY_PRINT_JOB_CREATED( \
                    optr printCtrlOD = cx:dx, \
                    word jobID = bp);

/* Sent to indicate that a print job has been created by the spooler in
 * response to an application's request.
 *
 * Context:	Send out by the PrintControl after a successful call to
 *		SpoolAddJob
 * Source:	PrintControl object
 * Destination:	PCI_output
 * Interception: May be intercepted by any object. Applications will need
 *		the passed ID if they want to modify any part of the job's
 *		status, though this behavior is not encouraged. Rather,
 *		let the user manipulate the print jobs by using the
 *		Printer Control Panel.
 *
 * Pass:	printCtrlOD = OD of PrintControl object originating job
 *		jobID	= Print job ID
 *
 * Return:	Nothing
 */

/*--------------------------------------------------------------------------*
        Instance Data

 Note: Please refer to the documentation under PrintControlClass
       for more information on all of the following instance data
--------------------------------------------------------------------------*/

@instance PrintControlAttrs   	PCI_attrs =  \
    (PCA_COPY_CONTROLS | PCA_PAGE_CONTROLS | PCA_QUALITY_CONTROLS |
     PCA_USES_DIALOG_BOX | PCA_GRAPHICS_MODE | PCA_TEXT_MODE );

@instance word	PCI_startPage = 1;	  /* first possible page to print */
@instance word  PCI_endPage = 1;	  /* last possible page to print */
@instance word  PCI_startUserPage = 0;	  /* start of page range to print */
@instance word  PCI_endUserPage = 0x7fff; /* end of page range to print */
@instance word  PCI_defPrinter = -1;	  /* the default printer to use */
                                       /* the document size data: */
@instance PageSizeReport PCI_docSizeInfo = {0, 0, 0, {0, 0, 0, 0}};
@instance optr  PCI_output;		  /* destination for methods sent out */
@instance optr  PCI_docNameOutput;	  /* OD for MSG_PRINT_GET_DOC_NAME */

@default GII_visibility = GIV_SUB_GROUP;
@default GII_type = GIT_ORGANIZATIONAL;
@default GI_attrs = @default | GA_KBD_SEARCH_PATH;

#define	PRINT_TRIGGER_VALUES	  		'GI_visMoniker = "Print";'
#define	FAX_TRIGGER_VALUES	 		'GI_visMoniker = "Fax";'

/*--------------------------------------------------------------------------*
        Variable instance data
--------------------------------------------------------------------------*/

typedef ByteFlags PrintStatusFlags ;
#define PSF_FAX_AVAILABLE 	0x80	/* set if a fax driver is available */
#define PSF_ABORT 		0x08	/* user wants to abort printing */
#define PSF_RECEIVED_COMPLETED 	0x04	/* MSG_PC_PRINTING_COMPLETED received */
#define PSF_RECEIVED_NAME 	0x02	/* MSG_PC_SET_DOC_NAME received */
#define PSF_VERIFIED 		0x01	/* PSG_PC_VERIFY_? received */

typedef struct {
    optr	TPCI_currentSummons;	/* currently active summons */
    optr	TPCI_progressBox;	/* OD of progress dialog box */
    ChunkHandle	TPCI_jobParHandle;	/* memory handle to JobParamters */
    word	TPCI_fileHandle;	/* file handle (if printing) */
    word	TPCI_gstringHandle;	/* gstring handle (if printing) */
    word	TPCI_printBlockHan;	/* the printer block handle */
    PrintControlAttrs	TPCI_attrs;
    PrintStatusFlags	TPCI_status;
    byte	TPCI_holdUpCompletionCount; /* # of things not wanting the
                         * message stored in
                         * TEMP_PRINT_COMPLETION_EVENT to
                         * be sent out just yet. */
} TempPrintCtrlInstance} ;

@vardata TempPrintCtrlInstance TEMP_PRINT_CONTROL_INSTANCE;

/*---------------------------------------------------------------------------
        Attrs
---------------------------------------------------------------------------*/

/*
 * Attribute to allow applications to add their own UI to the Print DB.
 * The generic tree whose optr is stored here must *not* be set USABLE.
 * This is different from ATTR_GEN_CONTROL_APP_UI, which would add
 * triggers into the menu where your PrintControl object is a child.
 */
@vardata optr ATTR_PRINT_CONTROL_APP_UI;
@reloc ATTR_PRINT_CONTROL_APP_UI, 0, optr;

typedef struct {
    MemHandle	TPCED_event;
    MessageFlags	TPCED_messageFlags;
} TempPrintCompletionEventData} ;
@vardata TempPrintCompletionEventData TEMP_PRINT_COMPLETION_EVENT;

typedef struct {
    optr			TPACD_addrControl;
    PrinterDriverType	TPACD_driverType;
} TempPrintAddressControlData} ;

@vardata TempPrintAddressControlData TEMP_PRINT_CONTROL_ADDRESS_CONTROL;
/* Attribute set when the print control is used by the MailboxSendControl
 * DO NOT SET IT YOURSELF */

@endc 	/* end PrintControlClass */

/*--------------------------------------------------------------------------*
        PageSizeControlClass definition
--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
     If your application maintains the document size information, then
 you want your PageSizeControl object to act like any other controller.
 This is the default behavior.

    If, instead, you have a simpler application, you will want to use
 your PageSizeControl object as you would any other generic object. To do
 this, set the PZCA_ACT_LIKE_GADGET flag. To have the object initialize
 itself to the default system values, all you must do is set the
 PZCA_INITIALIZE flag. Use this instead of stuffing the instance data
 of the object with pre-defined paper size values, as these values are
 probably not appropriate for foreign users.
-------------------------------------------------------------------------*/

/*
 * GenApplication GCN lists to be placed on:
 *	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class PageSizeControlClass, GenControlClass;

/*--------------------------------------------------------------------------*
            Constants
--------------------------------------------------------------------------*/

#define MINIMUM_PAGE_WIDTH_VALUE 	36		 /* 1/2 inch */
#define MINIMUM_PAGE_HEIGHT_VALUE 	36		 /* 1/2 inch */

#ifdef DO_PIZZA
#define MAXIMUM_PAGE_WIDTH_VALUE 	3189	 /* 112.5 cm */
#define MAXIMUM_PAGE_HEIGHT_VALUE 	3189	 /* 112.5 cm */
#else
#define MAXIMUM_PAGE_WIDTH_VALUE 	(72*45)	 /* 45 inches */
#define MAXIMUM_PAGE_HEIGHT_VALUE 	(72*45)	 /* 45 inches */
#endif

#define MAXIMUM_LABELS_ACROSS 		63
#define MAXIMUM_LABELS_DOWN 		63

/* PageSize attributes */

typedef WordFlags PageSizeCtrlAttrs ;
/* External */
#define PZCA_ACT_LIKE_GADGET 	0x8000	/* Use like gadget, not controller */
#define PZCA_PAPER_SIZE  	0x4000	/* Show paper size, not document size */
#define PZCA_INITIALIZE 		0x2000	/* Initialize to default value - can
                     only be passed if a gadget */
#define PZCA_LOAD_SAVE_OPTIONS 	0x1000	/* Load/Save options to/from INI file */

/* Internal */
#define PZCA_NEW_PAGE_TYPE 	0x0080
#define PZCA_SWAP_WIDTH_HEIGHT   0x0040
#define PZCA_INITIALIZED 	0x0020
#define PZCA_IGNORE_UPDATE 	0x0010
#define PZCA_PORTRAIT_VALID 	0x0008
#define PZCA_LANDSCAPE_VALID 	0x0004

/* Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI &
 *                           ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags PageSizeControlFeatures ;
#define PSIZECF_MARGINS 		0x0010	/* not part of default features! */
#define PSIZECF_CUSTOM_SIZE 	0x0008
#define PSIZECF_LAYOUT 		0x0004
#define PSIZECF_SIZE_LIST 	0x0002
#define PSIZECF_PAGE_TYPE 	0x0001

#define PSIZEC_DEFAULT_FEATURES  (PSIZECF_PAGE_TYPE | \
                 PSIZECF_SIZE_LIST | \
                 PSIZECF_LAYOUT | \
                 PSIZECF_CUSTOM_SIZE)

/* Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI &
 *                                   ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */
typedef WordFlags PageSizeControlToolboxFeatures ;
#define PSIZECTF_DIALOG_BOX  	0x0001

#define PSIZECT_DEFAULT_TOOLBOX_FEATURES 	PSIZECTF_DIALOG_BOX

/*--------------------------------------------------------------------------*
        Messages
--------------------------------------------------------------------------*/

/***************************************************************************/
@message void MSG_PZC_SET_PAGE_SIZE ( PageSizeReport *psr = dx:bp );

/* Sets the page size to be displayed by the list
 *
 * Context:	Utility message sent to set the page dimensions
 * Source:	Anyone
 * Destination:	PageSizeControlClass object
 * Interception: Generally should not be intercepted.
 *
 * 	If your application maintains the document size information, then
 * you want your PageSizeControl object to act like any other controller.
 * This is the default behaviour.
 *
 * 	If, instead you have a simplier application, you will want to use
 * your PageSixeControl object as you would any other generic object.  To do
 * this, set the PZCA_ACT_LIKE_GADGET flag.  To have the object initialize
 * itself to the default system values, all you must do is set the
 * PZCA_INITIALIZE flag.  Use this instead of stuffing the instance data
 * of the object with pre-defined paper size values, as these values are
 * probably not appropriate for foreign users.
 *
 * Pass:	psr 	= pointer to PageSizeReport
 *
 * Return:	Nothing
 */

/***************************************************************************/
@message void MSG_PZC_GET_PAGE_SIZE ( PageSizeReport *psr = dx:bp );

/* Returns the page size that the user has selected.
 *
 * Context:	Utility message sent to get the page dimensions
 * Source:	Anyone
 * Destination:	PageSizeControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	psr = pointer to PageSizeReport structure (empty)
 *
 * Return: 	psr = pointer to PageSizeReport structure (filled);
 */

/*---------------------------------------------------------------------------*
        Internal messages
---------------------------------------------------------------------------*/

/***************************************************************************/
@message void MSG_PZC_REQUEST_PAGE_SIZE_MONIKER ();
@message void MSG_PZC_SET_PAGE_TYPE ();
@message void MSG_PZC_SET_PAGE_SIZE_ENTRY ();
@message void MSG_PZC_SET_PAGE_WIDTH ();
@message void MSG_PZC_SET_PAGE_HEIGHT ();
@message void MSG_PZC_SET_PAPER_ORIENTATION ();
@message void MSG_PZC_SET_ENVELOPE_ORIENTATION ();
@message void MSG_PZC_SET_LABEL_COLUMNS ();
@message void MSG_PZC_SET_LABEL_ROWS ();
@message void MSG_PZC_SET_MARGIN_LEFT ();
@message void MSG_PZC_SET_MARGIN_TOP ();
@message void MSG_PZC_SET_MARGIN_RIGHT ();
@message void MSG_PZC_SET_MARGIN_BOTTOM ();

/*---------------------------------------------------------------------------*
        More external messages
---------------------------------------------------------------------------*/

/***************************************************************************/
@message void MSG_PZC_SET_MAXIMUM_WIDTH (dword width = dx.cx);
/*
 * Sets the maximum width for a page
 *
 * Context:	Utility message sent to set the maximum width
 * Source:	Anyone
 * Destination:	PageSizeControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	width	= Width (in points)
 *
 * Return: 	Nothing
 */

/***************************************************************************/
@message void MSG_PZC_SET_MAXIMUM_HEIGHT (dword height = dx.cx);
/*
 * Sets the maximum height for a page
 *
 * Context:	Utility message sent to set the maximum width
 * Source:	Anyone
 * Destination:	PageSizeControlClass object
 * Interception: Generally should not be intercepted.
 *
 * Pass:	height	= Height (in points)
 *
 * Return: 	Nothing
 */

/*---------------------------------------------------------------------------*
        MetaMessages
---------------------------------------------------------------------------*/

/***************************************************************************/
@importMessage MetaPrintMessages, void MSG_PRINT_REPORT_PAGE_SIZE (
                        PageSizeReport *psr = ss:bp);

/* Sent to report the page size & layout options the user has selected.
 *
 * Context:	Sent out after a user has clicked on the apply trigger
 *		in the Page Setup DB.
 * Source:	PageSizeControl object
 * Destination:	GCI_output (of GenControlClass)
 * Interception: May be intercepted by any object.
 *
 * Pass:	psr =	Pointer to PageSizeReport structure
 *
 * Return:	Nothing
 */

/*--------------------------------------------------------------------------*
        Instance Data
--------------------------------------------------------------------------*/

@instance PageSizeCtrlAttrs PZCI_attrs;

@instance dword PZCI_width;		/* current width */
@instance dword PZCI_height;		/* current height */
@instance PageLayout PZCI_layout;	/* current page layout information*/
@instance PCMarginParams PZCI_margins;	/* current document margins */

@default GII_type = GIT_PROPERTIES;
@default GII_visibility = GIV_DIALOG;

#define	PAGE_SETUP_CONTROL_VALUES	 	'GI_visMoniker = "Page Setup";'

/*--------------------------------------------------------------------------*
        Variable instance data
--------------------------------------------------------------------------*/

typedef struct {
    dword	PZCMD_width;		/* maximum width */
    dword	PZCMD_height;		/* maximum height */
} PageSizeControlMaxDimensions} ;

@vardata PageSizeControlMaxDimensions TEMP_PAGE_SIZE_CONTROL_MAX_DIMENSIONS;

/*--------------------------------------------------------------------------*
        Attrs
--------------------------------------------------------------------------*/

@prototype void PAGE_SIZE_UI_CHANGES_MSG (PageSizeReport *psr = ss:bp);

typedef struct {
    optr	PSCC_destination;	/* destination for message */
    Message	PSCC_message;		/* message to be sent */
} PageSizeControlChanges} ;

@vardata PageSizeControlChanges ATTR_PAGE_SIZE_CONTROL_UI_CHANGES;

/* Attribute to allow applications to be made aware of every change made
 to gadgetry in the PageSizeControl. This is especially useful for apps
 that want to add UI that will be dependent upon the state of this
 controller. No effort is made to eliminate the redundant output of data. */

/*--------------------------------------------------------------------------*
        Hints
--------------------------------------------------------------------------*/

@endc	/* end PageSizeControlClass */

/*------------------------------------------------------------------------------
        Process class
---------------------------------------------------------------------------*/

@class	SpoolProcClass,	GenProcessClass;

/*-----------------------------------------------------------------------------
    MESSAGES
-----------------------------------------------------------------------------*/

@message void MSG_SPOOL_SHOW_PRINTER_CONTROL_PANEL ();
/*
 * Brings up the Printer Control Panel.  This message is defined here
 * so that other apps can initiate the control panel.  NO OTHER
 * messages should be sent to the spool's process from outside the
 * spool library.
 *
 * Context:	Sent to the SpoolApplicationClass from the UI
 * Source:	UI (Express Menu)
 * Destination:	SpoolerClass (process) object
 * Interception: Should not be intercepted.
 *
 * Pass:	Nothing
 *
 * Return:	Nothing
 */

@exportMessages SpoolProcInternalMessages, @DEFAULT_EXPORTED_MESSAGES;

@endc	/* end SpoolProcClass */

/*--------------------------------------------------------------------------*
        Constants and Structure Definitions
--------------------------------------------------------------------------*/

#define DWhigh (x) ((word) ((x) >> 16))
#define DWlow (x) ((word) (x))

/*
 * For dealing with paper sizes, use a buffer this big
 */
#define MAX_PAPER_STRING_LENGTH 	48	/* includes NULL-terminator */ ""

/*
 * Total number of paper sizes for each PageType
 */
#define MAX_PRE_DEFINED_PAPER_SIZES 	128
#define MAX_USER_DEFINED_PAPER_SIZES 	128
#define MAX_PAPER_SIZES 			(MAX_PRE_DEFINED_PAPER_SIZES + \
                     MAX_USER_DEFINED_PAPER_SIZES)

/*
 * Operation status codes returned by some spool library routines
 */
typedef enum /* word */ {
    SPOOL_OPERATION_SUCCESSFUL    ,
    SPOOL_JOB_NOT_FOUND    ,
    SPOOL_QUEUE_EMPTY    ,
    SPOOL_QUEUE_NOT_EMPTY    ,
    SPOOL_QUEUE_NOT_FOUND    ,
    SPOOL_CANT_VERIFY_PORT    ,
    SPOOL_OPERATION_FAILED    ,
} SpoolOpStatus} ;

/*
 * Structure for the time stamp of a print job spool
 */
typedef struct {
    byte	STS_second;		/* second of the minute (0-59) */
    byte	STS_minute;		/* minute of the hour (0-59) */
    byte	STS_hour;		/* hour of the day (0-23) */
} SpoolTimeStruct} ;

/*
 * Structure for names of spool files.
 */
typedef struct {
    char SFN_base[5];
    char SFN_num[3];
    char SFN_ext[5];
} SpoolFileName} ;

/*
 * Passed to SpoolInfo.
 */
typedef enum /* word */ {
    SIT_JOB_INFO        	= 0,
    SIT_QUEUE_INFO      	= 2,
    SIT_JOB_PARAMETERS    	= 4
} SpoolInfoType} ;

/*
 * When SpoolInfo is passed SIT_JOB_INFO, it returns a JobStatus structure.
 */
typedef struct {
    char JS_fname[13]; 			/* std DOS (8.3) spool filename */
    char JS_parent[FILE_LONGNAME_LENGTH+1];	    /* parent app's name */
    char JS_documentName[FILE_LONGNAME_LENGTH+1];   /* document name */
    word JS_numPages;			/* # pages in document */
    SpoolTimeStruct JS_time; 	 	/* time spooled */
    byte JS_printing;			/* TRUE/FALSE if we are printing */
} JobStatus} ;

/*--------------------------------------------------------------------------*
        Library routines
--------------------------------------------------------------------------*/

extern void
    _pascal SpoolGetDefaultPageSizeInfo (PageSizeReport *psr);
/*
 *  Pass:	*psr	= empty PageSizeReport structure
 *
 *  Return:	*psr filled with the default page size info
 *
 * 	Gets the system default PageSizeReport structure.
 */

extern void
    _pascal SpoolSetDefaultPageSizeInfo (PageSizeReport *psr);
/*
 *  Pass:   	*psr	= PageSizeReport structure specifying
 *    	    	    	  document width, height, layout, and margins
 *
 *  Return:	nothing
 *
 * 	Set the system default PageSizeReport structure.
 */

typedef struct {
    word	NPSI_numSizes;
    word	NPSI_defaultSize;
} NumPaperSizesInfo} ;

extern void
    _pascal SpoolGetNumPaperSizes (NumPaperSizesInfo *sizesInfo,
                  PageType pageType);
/*
 *  Pass:   	*sizesInfo  = empty NumPaperSizesInfo structure
 *  	    	pageType    = page type (paper, envelope, label...)
 *
 *  Return: 	*sizesInfo filled with the number of paper sizes
 *		and the default size. Currently, the default size
 *		returned is always 0.
 *
 *    	Use this routine to find the number of paper sizes, both
 *    	pre-defined & user-defined, that should appear in a paper size list
 */

extern word
    _pascal SpoolGetPaperString (char *stringBuf,
                word paperSizeNum,
                PageType pageType);
/*
 *  Pass:   	*stringBuf  = empty char buffer of size MAX_PAPER_STRING_LENGTH
 *    	    	paperSizeNum = a paper size number between 0 and the
 *   	    	    	       value returned by SpoolGetNumPaperSizes()
 *   	    	    	       (paperSizeNum is not a PaperSizes enum)
 *   	    	pageType    = page type (paper, envelope, label...)
 *
 *  Return:	length (not counting final null) of null-terminated
 *		string now stored in *stringBuf
 *
 *    	Use this routine to determine the strings to be displayed for
 *	a specific paper size.
 */

typedef struct {
    word    	PSI_width;  	    /* width, in points */
    word    	PSI_height; 	    /* height, in points */
    PageLayout	PSI_defaultLayout;
} PaperSizeInfo} ;

extern void
     _pascal SpoolGetPaperSize (PaperSizeInfo *sizeInfo,
                   word paperSizeNum,
                    PageType pageType);
/*
 *  Pass:   	*sizeInfo   = empty PaperSizeInfo structure
 *    	    	paperSizeNum = a paper size number between 0 and the
 *   	    	    	       value returned by SpoolGetNumPaperSizes()
 *   	    	    	       (paperSizeNum is not a PaperSizes enum)
 *   	    	pageType    = page type (paper, envelope, label...)
 *
 *  Return:	*sizeInfo filled with the width and height (in points)
 *		of the paper size, plus the default page layout
 *
 *	Use this routine for determining the dimensions of a paper
 *	size.
 */

extern word
    _pascal SpoolConvertPaperSize (word width,
                  word height,
                  PageType pageType);
/*
 *  Pass:   	width	    = paper width, in points
 *  	    	height	    = paper height, in points
 *   	    	pageType    = page type (paper, envelope, label...)
 *
 *  Return:	on success returns paper size number
 *		on failure returns -1
 *
 *	Converts a width and height to a paper size number according to the
 *	type of paper.
 */

typedef struct {
    word    PSOI_numOrdered;	/* number of ordered sizes */
    word    PSOI_numUnused; 	/* number of unused sizes */
} PaperSizeOrderInfo} ;

extern void
    _pascal SpoolGetPaperSizeOrder (byte *orderBuf,
                   byte *userDefBuf,
                   PaperSizeOrderInfo *numBuf,
                   PageType pageType);
/*
 *  Pass:   	*orderBuf   = empty buffer of size MAX_PAPER_SIZES
 *  	    	*userDefBuf = empty buffer of size MAX_PAPER_SIZES
 *  	    	*numBuf	    = empty PaperSizeOrderInfo structure
 *		pageType    = page type (paper, envelope, label...)
 *
 *  Return:	*orderBuf filled with the current paper size order array,
 *		*userDefBuf filled with the user-defined paper size array,
 *	    	*numBuf holding the number of ordered sizes and the
 *  	    	    number of unused sizes
 *
 *	Gets the current paper size order array.
 */

extern void
    _pascal SpoolSetPaperSizeOrder (byte *orderArray,
                   word numEntries,
                   PageType pageType);
/*
 *  Pass:   	*orderArray = array of paper sizes. Each element is a
 *  	    	    	      byte signifying:
 *    	    	    	      	0-127: a predefined paper size
 *  	    	    	      	128-255: a user-defined paper size
 *  	    	numEntries  = number of entries in *orderArray
 *   	    	pageType    = page type (paper, envelope, label...)
 *
 *  Return:	nothing
 *
 *	Resets the order in which paper sizes are displayed to the user.
 */

extern word
    _pascal SpoolCreatePaperSize (char *paperSizeString,
                                 word width,
                                 word height,
                                 PageLayout layout,
                                 PageType pageType);
/*
 *  Pass:   	*paperSizeString    =
 *  	    	width	    = paper width, in points
 *  	    	height	    = paper height, in points
 *  	    	layout      = layout (orientation, rows, columns...)
 *   	    	pageType    = page type (paper, envelope, label...)
 *
 *  Return:    	on success, returns the new paper size (between 128 and 255)
 *		on failure, returns 0
 *
 *	Create a new paper size and store it in the .INI file.
 */

extern Boolean
    _pascal SpoolDeletePaperSize (word paperSizeNum,
                                 PageType pageType);
/*
 *  Pass:   	paperSizeNum = a paper size number between 0 and the
 *   	    	    	       value returned by SpoolGetNumPaperSizes()
 *   	    	    	       (paperSizeNum is not a PaperSizes enum)
 *   	    	pageType    = page type (paper, envelope, label...)
 *
 *  Return:	on success returns 0
 *		on failure returns non-zero
 *
 *	This routine deletes a user-defined paper size
 */

extern word
    _pascal SpoolGetNumPrinters (PrinterDriverType driverType,
                byte localOnlyFlag);
/*
 *  Pass:   	driverType  	= a PrinterDriverType or PDT_ALL
 *   	    	localOnlyFlag	= non-zero if only locally-defined
 *  	    	    	    	  printers should be counted
 *
 *  Return:	number of printers
 *
 *	Return the number of printers of the passed type currently installed
 *	in the system.
 */

typedef struct {
    char     	    	PSI_stringBuf[GEODE_MAX_DEVICE_NAME_SIZE];
    word    	    	PSI_stringLength;
    PrinterDriverType	PSI_driverType;
} PrinterStringInfo} ;

extern Boolean
    _pascal SpoolGetPrinterString (PrinterStringInfo *retInfo,
                                  word printerNum);
/*
 *  Pass:   	*retInfo    =	empty PrinterStringInfo structure
 *  	    	printerNum  =	number of printer to get the string for
 *
 *  Return:	on success, returns 0 plus *retInfo filled with
 *    	    	  the desired name, the length of the name
 *    	    	  (excluding final null), and the driver type.
 *		on failure, returns non-zero
 *
 *	Fills a buffer with the requested null-terminated printer name string.
 */

extern word
    _pascal SpoolCreatePrinter (char *printerName,
                               PrinterDriverType driverType);
/*
 *  Pass:   	*printerName    = null-terminated printer name
 *  	    	driverType      = a PrinterDriverType or PDT_ALL
 *
 *  Return: 	number of new printer
 *		or -1 if printer already exists
 *
 *	Add a new printer to the end of the current printer list.
 *
 *	This routine is normally called from within the PrefMgr.
 */

extern void
    _pascal SpoolDeletePrinter (word printerNum);
/*
 *  Pass:   	printerNum  = number of printer to delete
 *
 *  Return:	nothing
 *
 *	Delete a printer from the current printer list.
 *
 *	This routine is normally called from within the PrefMgr.
 */

extern int
    _pascal SpoolGetDefaultPrinter (void);
/*
 *  Pass:   	nothing
 *
 *  Return: 	number of default printer
 *
 *	Return the system-default printer, which is used (for example)
 *	by the PrintControlClass as the default printer to print to.
 *
 *	This routine is normally called from within the PrefMgr.
 */

extern void
    _pascal SpoolSetDefaultPrinter (word printerNum);
/*
 *  Pass:   	printerNum	= number of printer to use as default
 *
 *  Return: 	nothing
 *
 *	Sets the system-default printer, used (for example) by the
 *	PrintControlClass as the default printer to print to.
 *
 *	This routine is normally called from within the PrefMgr.
 */

extern FileHandle
    _pascal SpoolCreateSpoolFile (char *fileNameBuf);
/*
 *  Pass:   	*fileNameBuf	= an empty buffer of size
 *  	    	    	    	  DOS_DOT_FILE_NAME_LENGTH_ZT
 *
 *  Return:	on success, returns handle of new file plus new
 *		  null-terminated file name stored in *fileNameBuf
 *    	    	on failure, returns 0
 *
 *	Creates a uniquely-named empty spool file in the SP_SPOOL
 *  	standard directory. The file name is of the form SPOOLXXX.DAT.
 */

extern SpoolOpStatus
    _pascal SpoolDelJob (word jobID);
/*
 *  Pass:   	jobID	= ID number of job to delete
 *
 *  Return: 	status of operation, one of:
 *		    SPOOL_OPERATION_SUCCESSFUL
 *		    SPOOL_JOB_NOT_FOUND
 *		    SPOOL_QUEUE_EMPTY
 *
 *  	Use this routine to delete a job from a queue.
 */

/*
 * Parameters for SpoolInfoQueue (called by SpoolInfo).
 */
typedef struct {
    Boolean	    	SIQP_activityQuery;
    struct _PrintPortInfo  *SIQP_portInfo;
    MemHandle	    	SIQP_retBlock;
    word	    	SIQP_retNumJobs;
} SpoolInfoQueueParams} ;

/*
 * Parameters for SpoolInfoJob (called by SpoolInfo).
 */
typedef struct {
    word	SIJP_jobID;
    MemHandle	SIJP_retBlock;
} SpoolInfoJobParams} ;

/*
 * Parameters to pass to SpoolInfo.
 */
typedef union {
    SpoolInfoQueueParams    SIP_queueParams;
    SpoolInfoJobParams	    SIP_jobParams;
} SpoolInfoParams} ;

extern SpoolOpStatus
    _pascal SpoolInfo (SpoolInfoType infoType,
              SpoolInfoParams *params);
/*
 *  Pass:   	infoType    = SIT_QUEUE_INFO to check for active queues or
 *   	    	    	      get a list of all job ID's in a queue.
 *   	    	    	    = SIT_JOB_INFO to get the JobStatus structure
 *  	    	    	      for a job.
 *
 *  	    	*************************************************************
 *
 *  	    	If infoType is SIT_QUEUE_INFO,
 *   	    	    (params->SIP_queueParams).SIQP_activityQuery
 *  	            	    	    		= non-zero to check whether
 *    	    	    	    	       	    	  any print queues are active
 *  	    	    	    	    	    	= 0 to get list of all
 *   	    	    	    	    	    	  job ID's in a queue
 *
 *   	    	    (params->SIP_queueParams).SIQP_portInfo
 *  	    	    	    	        	= pointer to port info of a
 *   	    	    	    	      	    	  queue if activityQuery = 0
 *  	    	    	    	    	    	= NULL if activityQuery != 0
 *
 *  	    	*************************************************************
 *
 *  	    	If infoType is SIT_JOB_INFO,
 *   	    	    (params->SIP_jobParams).SIJP_jobID
 *  	    	    	    	          	= ID of relevant job
 *
 *  	    	*************************************************************
 *
 *  Return:	If infoType is SIT_QUEUE_INFO
 *      	    if SIQP_activityQuery != 0, returns
 *		    	SPOOL_QUEUE_NOT_EMPTY if at least one queue is active
 *		    	SPOOL_QUEUE_EMPTY if no queues are active
 *
 *  	    	    if SIQP_activityQuery = 0, then on success returns
 *		    	SPOOL_OPERATION_SUCCESSFUL and
 *   	    	    	(params->SIP_queueParams).SIQP_retBlock
 *		    	    	    	 	= handle of block holding
 *			    	    	      	  ID's of all jobs in queue,
 *  	    	    	    	    	    	  listed in the order they
 *  	    	    	    	    	    	  sit in the queue, currently
 *  	    	    	    	    	    	  active job first.
 *
 *   	    	    	(params->SIP_queueParams).SIQP_retNumJobs
 *		    	    	    		= # ID's in block
 *
 *		    if SIQP_activityQuery = 0, then on failure returns one of
 *			SPOOL_QUEUE_NOT_FOUND
 *			SPOOL_QUEUE_EMPTY
 *
 *  	    	*************************************************************
 *
 *	    	If infoType is SIT_JOB_INFO,
 *	    	    on success returns
 *   	    	    	SPOOL_OPERATION_SUCCESSFUL and
 *   	    	    	(params->SIP_jobParams).SIJP_retBlock
 *    	    	    	    	    	    	 = handle of block holding
 *				    	    	   JobStatus structure
 *		    on failure, returns one of
 *			SPOOL_JOB_NOT_FOUND
 *			SPOOL_QUEUE_EMPTY
 *
 *	Check for active queues or get a list of all job ID's in a queue
 *	*OR* get the JobStatus structure for a job.
 */

extern SpoolOpStatus
    _pascal SpoolHurryJob (word jobID);
/*
 *  Pass:   	jobID	=   ID number of job to hurry
 *
 *  Return:	status of operation
 *
 *	Use this routine to push a job to the front of its print queue.  It
 *	will not replace the currently active job, but be placed as the next
 * 	job in line.
 */

extern SpoolOpStatus
    _pascal SpoolDelayJob (word jobID);
/*
 *  Pass:   	jobID	=   ID number of job to delay
 *
 *  Return:	status of operation
 *
 *	Use this routine to push a job to the end of its print queue.
 */

extern SpoolOpStatus
    _pascal SpoolModifyPriority (word jobID,
                                    ThreadPriority priority);
/*
 *  Pass:   	jobID	    =   ID number of job whose thread's priority
 *  	    	    	    	should be modified
 *    	    	priority    =	new ThreadPriority to set
 *  	    	    	    	(PRIORITY_STANDARD or lower priority)
 *
 *  Return:	status of operation
 *
 *	Use this routine to modify the priority of the thread that is
 *	processing a queue.  All print queue threads start out with
 *	PRIORITY_LOW.  The highest priority you can set is
 *	PRIORITY_STANDARD.
 */

extern SpoolOpStatus
    _pascal SpoolVerifyPrinterPort (struct _PrintPortInfo *portInfo);
/*
 *  Pass:	*portInfo    = port info for queue
 *
 *  Return:	status of operation, one of:
 *		    SPOOL_OPERATION_SUCCESSFUL
 *		    SPOOL_CANT_VERIFY_PORT
 *  	    	For custom ports, this routine currently always returns success.
 *
 *   Use this routine to check for the existence of a printer port.
 *   This function will also change the port to be thread driven instead
 *   of interrupt driven (and change the .ini file) if it finds that
 *   interrupt operation is not possible with the port (because of a faulty
 *   port or a damaged printer, for example).  Currently, this only affects
 *   parallel ports.  Serial ports are not tested in this way.
 */

extern void
    _pascal SpoolSetDocSize (Boolean openFlag,
                            PageSizeReport *psr);
/*
 *  Pass:	openFlag    = TRUE if document is open
 *  	    	    	      FALSE if document is closed
 *		*psr 	    = if document is open, PageSizeReport structure
 *			      else null
 *
 *  Return:	nothing
 *
 *  	Performs the work of telling the PageSizeControl object in the
 *  	application the document size.
 */

#ifdef __HIGHC__

pragma Alias(SpoolGetNumPaperSizes, "SPOOLGETNUMPAPERSIZES");
pragma Alias(SpoolGetPaperString, "SPOOLGETPAPERSTRING");
pragma Alias(SpoolGetPaperSize, "SPOOLGETPAPERSIZE");
pragma Alias(SpoolConvertPaperSize, "SPOOLCONVERTPAPERSIZE");
pragma Alias(SpoolGetPaperSizeOrder, "SPOOLGETPAPERSIZEORDER");
pragma Alias(SpoolSetPaperSizeOrder, "SPOOLSETPAPERSIZEORDER");
pragma Alias(SpoolCreatePaperSize, "SPOOLCREATEPAPERSIZE");
pragma Alias(SpoolDeletePaperSize, "SPOOLDELETEPAPERSIZE");

pragma Alias(SpoolGetNumPrinters, "SPOOLGETNUMPRINTERS");
pragma Alias(SpoolGetPrinterString, "SPOOLGETPRINTERSTRING");
pragma Alias(SpoolCreatePrinter, "SPOOLCREATEPRINTER");
pragma Alias(SpoolDeletePrinter, "SPOOLDELETEPRINTER");
pragma Alias(SpoolGetDefaultPrinter, "SPOOLGETDEFAULTPRINTER");
pragma Alias(SpoolSetDefaultPrinter, "SPOOLSETDEFAULTPRINTER");

pragma Alias(SpoolCreateSpoolFile, "SPOOLCREATESPOOLFILE");
pragma Alias(SpoolSetDocSize, "SPOOLSETDOCSIZE");

pragma Alias(SpoolDelJob, "SPOOLDELJOB");
pragma Alias(SpoolInfo, "SPOOLINFO");
pragma Alias(SpoolHurryJob, "SPOOLHURRYJOB");
pragma Alias(SpoolDelayJob, "SPOOLDELAYJOB");
pragma Alias(SpoolModifyPriority, "SPOOLMODIFYPRIORITY");
pragma Alias(SpoolVerifyPrinterPort, "SPOOLVERIFYPRINTERPORT");

pragma Alias(SpoolGetDefaultPageSizeInfo, "SPOOLGETDEFAULTPAGESIZEINFO");
pragma Alias(SpoolSetDefaultPageSizeInfo, "SPOOLSETDEFAULTPAGESIZEINFO");

#endif

@endlib


Internal\spoolInt.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1993 -- All Rights Reserved
 *
 * PROJECT:	  GEOS
 * MODULE:	  CInclude
 * FILE:	  spoolInt.h
 *
 * AUTHOR:  	  Jenny Greenwood: Aug 31, 1993
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	jenny	8/31/93   	Initial version
 *
 * DESCRIPTION:
 *	Header containing internal spool library definitions.
 *
 * 	$Id: spoolInt.h,v 1.4.1.1 96/04/28 08:32:36 chris Exp $
 *
 ***********************************************************************/
#ifndef _SPOOLINT_H_
#define _SPOOLINT_H_

#include     <serialDr.h>
#include     <parallDr.h>

/*-----------------------------------------------------------------------------
 *		Port-dependent structures
 *---------------------------------------------------------------------------*/

/*
 * maximum # of characters for device in a printer driver
 */
#define MAX_DEVICE_NAME_SIZE  40

/*
 * what type of port is the printer hooked to
 */
typedef enum /* word */ {
    PPT_SERIAL      	= 0,
    PPT_PARALLEL    	= 2,
    PPT_FILE        	= 4,
    PPT_NOTHING     	= 6,
    PPT_CUSTOM      	= 8
} PrinterPortType} ;

/*
 * serial port parameters
 */
typedef struct {
    SerialPortNum   	SPP_portNum;	/* which port number */
    SerialFormat    	SPP_format;	/* #stop bits, parity, word length...*/
    SerialMode	    	SPP_mode;	/* XON/XOFF, ...*/
    SerialBaud	    	SPP_baud;   	/* baud rate enum */
    SerialFlowControl	SPP_flow;	/* hardware, software */
    SerialModem	    	SPP_stopRem;	/* signal received that indicates STOP */
    SerialModemStatus	SPP_stopLoc;	/* signal to send that indicates STOP */
} SerialPortParams} ;

/*
 * parallel port parameters
 */
typedef struct {
    ParallelPortNum PPP_portNum;    	/* which port number */
} ParallelPortParams} ;

/*
 * print to file parameters
 */
typedef struct {
    char    FPP_fileName[FILE_LONGNAME_BUFFER_SIZE];
    char    FPP_path[PATH_BUFFER_SIZE];	    	/* allow complete path */
    word    FPP_diskHandle;			/* disk handle */
    word    FPP_file;			    	/* file handle to close it */
    word    FPP_unit;				/* unit number w/filestr driver */
} FilePortParams} ;

/*
 * custom port parameters
 */
typedef struct {
    word    CPP_null;
} CustomPortParams} ;

/*
 * union of port parameters
 */
typedef union {
    SerialPortParams	PP_serial;	/* if serial port is used */
    ParallelPortParams	PP_parallel;	/* if parallel port is used */
    FilePortParams  	PP_file;	/* if file is used */
    CustomPortParams	PP_custom;	/* if custom is used */
} PortParams} ;

/*
 * Printer port info.
 * This structure is used to specify the attributes of the
 * port the printer is hooked up to.
 */
typedef struct _PrintPortInfo  {
    PrinterPortType PPI_type;		/* serial, parallel... */
    PortParams	    PPI_params;	    	/* initializing info */
} PrintPortInfo} ;

/*
 *  this enum is stored in the JobParameters block by the
 *  caller of SpoolAddJob and determines what the spooler
 *  should do with the file when its finished
 */
typedef ByteEnum SpoolFileType ;
/*  save the spool file when done */
#define SFT_SAVE_FILE 	0x0
/*  delete the spool file when done */
#define SFT_DELETE_FILE 	0x1

/*
 *  this enum is stored in the JobParameters block by the
 *  caller of SpoolAddJob and determines how the spooler
 *  should order multiple copies.  It is ignored if there
 *  is only one copy to produce
 */
typedef ByteEnum SpoolCollate ;
/*  save the spool file when done */
#define SC_DONT_COLLATE 	0x0
/*  delete the spool file when done */
#define SC_COLLATE 	0x1

/*
 *  this enum is stored in the JobParameters block by the
 *  caller of SpoolAddJob and forces the output to be
 *  rotated if set.  The spooler normally determines if the
 *  output should be rotated by seeing if the document is in
 *  landscape mode.  This flag can be used to force the output
 *  to be printed (and perhaps tiled) in landscape fashion, and
 *  might be used by a spreadsheet program to do sideways
 *  printing, for example.
 */
typedef ByteEnum SpoolRotate ;
/*  leave the output as is */
#define SC_DONT_ROTATE 	0x0
/*  force rotation of output */
#define SC_ROTATE 	0x1

/*
 *  this enum indicates whether the normal order of printing
 *  should be followed (0->n), or whether a custom page ordering
 *  should take place
 */
typedef ByteEnum SpoolOrder ;
#define SO_NORMAL_ORDER 	0x0
#define SO_CUSTOM_ORDER 	0x1

/*
 *  this enum indicated whether or not the document should
 *  be "scaled-to-fit"
 */
typedef ByteEnum SpoolScale ;
#define SS_TILE 	0x0
#define SS_SCALE_TO_FIT 	0x1

/*
 *  this record is stored in the job parameters block and hold
 *  various pieces of info about the job.
 */
typedef ByteFlags SpoolOptions ;		/* CHECKME */
/*  what to do with the file when done */
#define SO_DELETE 	(0x80)
/*  how to organize multiple copies */
#define SO_COLLATE 	(0x40)
/*  force rotation of output */
#define SO_FORCE_ROT 	(0x20)
/*  print pages in reverse order */
#define SO_REVERSE_ORDER 	(0x10)
/*  print odd, then even pages */
#define SO_ODD_EVEN 	(0x08)
/*  scale to fit or not */
#define SO_SCALE 	(0x04)
/* 2 bits unused */

/*  this is the info passed to SpoolAddJob */
typedef struct {		/* CHECKME */
/*  DO NOT CHANGE THE ORDER OF THESE FIRST FOUR ITEMS */
/*  std DOS (8.3) spool file name */
    char 	JP_fname[13];
/*  name of par. app */
    char JP_parent[FILE_LONGNAME_LENGTH+1];
/*  name of document */
    char JP_documentName[FILE_LONGNAME_LENGTH+1];
/*  # pages in document */
    word	JP_numPages;
    char JP_printerName[GEODE_MAX_DEVICE_NAME_SIZE+16+1];
/*  INI file category holding the printer name */
/*  name of device */
    char JP_deviceName[MAX_DEVICE_NAME_SIZE];
/*  union for type of port info */
    PrintPortInfo   JP_portInfo;
/*  what mode we're printing in */
    PrinterMode	    JP_printMode;
/*  paper size information */
    PageSizeReport	JP_paperSizeInfo;
/*  document size information */
    PageSizeReport	JP_docSizeInfo;
/*  delete file or not  */
    SpoolOptions 	JP_spoolOpts;
/*  how many to print */
    byte	JP_numCopies;
/*  timeout value to use */
    word	JP_timeout;
/*  maximum number of retries */
    byte	JP_retries;
/*  size of the JobParameters */
    word	JP_size;
/*  printer-specific data */
    word JP_printerData[10];
} JobParameters} ;

/* -----------------------------------------------------------------------------
 *  Text printing structures.  The text printing code builds
 *  out a list of strings that it needs to send to the driver,
 *  sorted in y order.  An LMem block is allocated to hold
 *  the strings, and the whole page is scanned (using DrawString
 *  before any text is sent.  This allows the text strings to
 *  be placed anywhere on the page at any point in the gstring.
 *
 *
 *        New style run info structure. The text is accumulated in ordered
 *        chunks along with the position, and a pointer to the TextAttributes
 *        elememt that matches it. The structure is called the StyleRunInfo
 *        structure, and it follows:
 */

typedef struct {		/* CHECKME */
/* Yposition of this text. */
    word	SRI_yPosition;
/* Xposition of this text. */
    word	SRI_xPosition;
/* number of characters in this run */
    word	SRI_numChars;
/* width of characters in this run */
    WBFixed	SRI_stringWidth;
/*
 * element number of this text's
 * attibute.
 */
    word	SRI_attributes;
/* text follows (DO NOT USE SIZE OF THIS */
    byte	SRI_text;
} StyleRunInfo} ;

/*
 *        The Attributes structure includes anything that the printer can use for ""
 *        setting fonts and styles at the printer. It is an element array pointed
 *        into from the StyleRunInfo array. Most of these are out of the TextAttr
 *        structure defined in the kernal graphics.def. The important difference
 *        is the ommision of the clearing fields for style and text mode.
 */
typedef struct {		/* CHECKME */
/*  doo for the element array */
    RefElementHeader	TAI_meta;
/*  RGB values or index */
    RGBValue 	TAI_color;
/*  draw mask */
    SystemDrawMask	TAI_mask;
/*
 *  text style bits to set
 *  (printer format)
 */
    word	TAI_style;
/*  text mode bits to set */
    TextMode	TAI_mode;
/*  space padding */
    WBFixed	TAI_spacePad;
/*  typeface */
    FontID	TAI_font;
/*  point size */
    WBFixed	TAI_size;
/*  track kerning */
    sword	TAI_trackKern;
/*  weight of font */
    FontWeight	TAI_fontWeight;
/*  width of font */
    FontWidth	TAI_fontWidth;
} TextAttrInfo} ;

/*
 *        These two structures , built out in the same lmem segment
 *	  are all that are needed to format the page from the
 *	  spooler point of view. The print driver now has the
 *	  responsibility of positioning them, and setting the font
 *	  info in the printer.
 *
 */

/*  structure for entire block */
typedef struct {		/* CHECKME */
/*  required header part */
    LMemBlockHeader 	TS_header;
/*  text attribute element to add */
    TextAttrInfo	TS_testAttribute;
/*  offset past gstring struc */
    word	TS_textOffset;
/*  handle of gstring buffer */
    word	TS_gsBuffer;
/*  handle of Text strings buffer */
    word	TS_styleRunInfo;
/*  handle of attributes buffer */
    word	TS_textAttributeInfo;
} TextStrings} ;
/* ----------------------------------------------------------------------------- */

#endif /* _SPOOLINT_H_ */


ssheet.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC/GEOS
 * FILE:	ssheet.goh
 * AUTHOR:	Anna Lijphart: November, 1991
 *
 * DESCRIPTION:
 *	This file defines the Spreadsheet class.
 *
 *	$Id: ssheet.goh,v 1.86.1.1 96/04/28 08:29:46 chris Exp $
 *
 ***********************************************************************/
@optimize

@deflib	ssheet

#include  <graphics.h>
#include  <vm.h>
@include  <Objects/vCompC.goh>
@include  <Objects/genC.goh>
#include  <parse.h>
#include  <cell.h>
@include  <ruler.goh>

typedef struct {
    optr     	SSD_output;
    Message   	SSD_message;
    optr	SSD_chartBody;
} SpreadsheetSetupData} ;

/* define this flag for cell protection */
@ifndef _PROTECT_CELL
#define	_PROTECT_CELL		=	0
@endif

@class SpreadsheetClass, VisCompClass, master;

@message void MSG_SPREADSHEET_READ_CACHED_DATA (FileHandle fileHandle = dx,
                        word mapBlockHandle = cx);  /*XXX*/
@message void MSG_SPREADSHEET_WRITE_CACHED_DATA (FileHandle fileHandle = dx);	/*XXX*/
@message void MSG_SPREADSHEET_ATTACH_UI (word handle = cx, 	/*XXX*/
                    FileHandle fileHandle = dx);
@message void MSG_SPREADSHEET_ATTACH_FILE (word handle = cx,
                    FileHandle fileHandle = dx);	/*XXX*/
@message void MSG_SPREADSHEET_MOVE_ACTIVE_CELL (word row = bp, 		/*XXX*/
                        word column = cx);
@message void MSG_SPREADSHEET_GOTO_CELL ();				/*XXX*/
@message word MSG_SPREADSHEET_ENTER_DATA (word textBlk = dx,
                     word textLen = cx)=cx;		/*XXX*/

@message void MSG_SPREADSHEET_SET_ROW_HEIGHT (word rowHeight = cx);	/*XXX*/
@message void MSG_SPREADSHEET_SET_COLUMN_WIDTH (word rowWidth = cx);	/*XXX*/
@message word MSG_SPREADSHEET_GET_ROW_HEIGHT (word rowNum = cx) = dx;	/*XXX*/
@message word MSG_SPREADSHEET_GET_COLUMN_WIDTH (word colNum = cx)= dx;	/*XXX*/

@reserveMessages    	1;
@message word MSG_SPREADSHEET_MAKE_FOCUS ();				/*XXX*/

typedef struct {
    word	GNI_token;
    word	GNI_entryNum;
    word	GNI_numDefinedNames;
    word	GNI_numUndefinedNames;
} GetNameInfo} ;

typedef ByteFlags NameFlags ;
#define NF_UNDEFINED 	0x80

#define	MAX_NAME_LENGTH		128

#ifdef DO_DBCS
#define	MAX_NAME_DEF_LENGTH		280
#else
#define	MAX_NAME_DEF_LENGTH		512
#endif

typedef struct {
    byte		SNP_flags;	/* NameAccessFlags */
    word		SNP_listEntry;
    word		SNP_textLength;
    TCHAR 		SNP_text[MAX_NAME_LENGTH];
    word		SNP_defLength;
/*
 * Note:  Under DBCS, 2*MAX_NAME_LENGTH in
 *        SpreadsheetNameParameters.SNP_definition results in
 *        stack overflow, uses "4+MAX_NAME_LENGTH" instead.
 */
#ifdef DO_DBCS
    wchar_t 		SNP_definition[4 + MAX_NAME_DEF_LENGTH];
#else
    char 		SNP_definition[MAX_NAME_DEF_LENGTH * 2];
#endif

    word		SNP_token;
    byte		SNP_unused;	/* align word */
} SpreadsheetNameParams} ;

@message void MSG_SPREADSHEET_ADD_NAME_WITH_PARAM_BLK (); /*NEEDS PROTOTYPE*/

@message void MSG_SPREADSHEET_ADD_NAME (					/*XXX*/
                GetNameInfo *retValue = axcxdxbp,
                SpreadsheetNameParams *ssNameParams = dx:bp);
@message void MSG_SPREADSHEET_VALIDATE_NAME (				/*XXX*/
                GetNameInfo *retValue = axcxdxbp,
                SpreadsheetNameParams *ssNameParams = dx:bp);
@message void MSG_SPREADSHEET_DELETE_NAME_WITH_LIST_ENTRY (); /*NEEDS PROTOTYPE*/

@message void MSG_SPREADSHEET_DELETE_NAME (				/*XXX*/
                GetNameInfo *retValue = axcxdxbp,
                SpreadsheetNameParams *ssNameParams = dx:bp);
@message void MSG_SPREADSHEET_CHANGE_NAME_WITH_PARAM_BLK (); /*NEEDS PROTOTYPE*/

@message void MSG_SPREADSHEET_CHANGE_NAME (				/*XXX*/
                GetNameInfo *retValue = axcxdxbp,
                SpreadsheetNameParams *ssNameParams = dx:bp);

typedef struct {
    word	GNI_unused;
    word	GNI_unused2;
    word	GNI_numDefinedNames;
    word	GNI_numUndefinedNames;
} GetNumNamesInfo} ;

@message void MSG_SPREADSHEET_GET_NAME_COUNT (				/*XXX*/
                GetNumNamesInfo *retValue = axcxdxbp);
@message void MSG_SPREADSHEET_GET_NAME_INFO (				/*XXX*/
                SpreadsheetNameParams *ssNameParams = dx:bp);
@message void MSG_SPREADSHEET_FORMAT_EXPRESSION (			/*XXX*/
                SpreadsheetFormatParams *ssFormatParams = ss:bp);
@message byte MSG_SPREADSHEET_PARSE_EXPRESSION (				/*XXX*/
                SpreadsheetParserParams *ssParserParams = ss:bp) = al;
@message byte MSG_SPREADSHEET_EVAL_EXPRESSION ();	/* NEEDS PROTOTYPE */

@message void MSG_SPREADSHEET_ERROR ();					/*XXX*/
@message void MSG_SPREADSHEET_SET_NOTE (word *textBlockHandle = cx,
                word row = dx, word column = bp);
@message void MSG_SPREADSHEET_SET_NOTE_FOR_ACTIVE_CELL (			/*XXX*/
                word *textBlockHandle = cx);

typedef struct {
    word	GNI_blockHandle;
    word	GNI_textSize;
} GetNoteInfo} ;

@message void MSG_SPREADSHEET_GET_NOTE (					/*XXX*/
                GetNoteInfo *retValue = dxcx,
                word row = dx, word column = bp);
@message void MSG_SPREADSHEET_GET_NOTE_FOR_ACTIVE_CELL (			/*XXX*/
                GetNoteInfo *retValue = dxcx);

typedef struct {
    optr 	GTO_textObject;
} GetTextObject} ;

typedef ByteFlags SpreadsheetDoubleClickFlags ;
#define SDCF_NOTE_EXISTS     	    0x02
#define SDCF_CELL_EXISTS     	    0x01
@message void MSG_SPREADSHEET_DISPLAY_NOTE (word data = dx);/*XXX*/
@message void MSG_SPREADSHEET_CHANGE_RECALC_PARAMS (			/*XXX*/
                SpreadsheetRecalcParams *ssRecalcParams = ss:bp);

/*
 *	SpreadsheetFlags record
 */
typedef WordFlags SpreadsheetFlags ;
#define SF_MANUAL_RECALC 		0x8000
#define SF_ALLOW_ITERATION 		0x4000
#define SF_SUPPRESS_REDRAW 		0x2000
#define SF_APPLICATION_FUNCTIONS 	0x1000
#define SF_QUICK_TRANS_IN_PROGRESS 	0x0800
#define SF_DOING_FEEDBACK 		0x0400
#define SF_IN_VIEW 			0x0200
#define SF_IS_SYS_TARGET     	    	0x0008
#define SF_HAVE_GRAB 	    	    	0x0004
#define SF_IS_APP_TARGET 		0x0002
#define SF_IS_SYS_FOCUS 		    	0x0001

#define	SRP_FLAGS		(SF_MANUAL_RECALC | SF_ALLOW_ITERATION)

typedef struct {
    SpreadsheetFlags	SRP_flags;
    word		SRP_circCount;
    FloatNum		SRP_converge;
} SpreadsheetRecalcParams} ;

@message void MSG_SPREADSHEET_GET_RECALC_PARAMS (			/*XXX*/
                SpreadsheetRecalcParams *ssRecalcParams = ss:bp);
@message void MSG_SPREADSHEET_RECALC ();					/*XXX*/
@message void MSG_SPREADSHEET_CLEAR_SELECTED (				/*XXX*/
                SpreadsheetClearFlags ssClearFlags = cx);
/*
 *	SpreadsheetClearFlags record
 */
typedef ByteFlags SpreadsheetClearFlags ;
#define SCF_CLEAR_ATTRIBUTES 	    0x80
#define SCF_CLEAR_DATA 	    	    0x40
#define SCF_CLEAR_NOTES 	    	    0x20

/*
 *	SpreadsheetInsertFlags record
 */

typedef ByteFlags SpreadsheetInsertFlags ;
#define SIF_COLUMNS 		0x80
#define SIF_COMPLETE 		0x40
#define SIF_DELETE 		0x20

@message void MSG_SPREADSHEET_INSERT_SPACE (				/*XXX*/
                SpreadsheetInsertFlags ssInsertFlags = cx);

typedef struct {
    word	GFC_unused;
    word	GFC_unused2;
    word	GFC_numPreDefined;
    word	GFC_numUserDefined;
} GetFormatCount} ;

@message void MSG_SPREADSHEET_SET_NUM_FORMAT (word formatToken = cx);	/*XXX*/

@message void MSG_SPREADSHEET_DRAW_RANGE (				/*XXX*/
                SpreadsheetDrawParams *ssDrawParams = ss:bp);

/*
 *	SpreadsheetDrawFlags record
 */
typedef WordFlags SpreadsheetDrawFlags ;
#define SDF_DRAW_GRAPHICS 		0x0008	;app flag
#define SDF_DRAW_NOTE_BUTTON 		0x0004
#define SDF_DRAW_HEADER_FOOTER_BUTTON 	0x0002
#define SDF_DRAW_GRID 			0x0001

typedef WordFlags SpreadsheetPrintFlags ;
#define SPF_PRINT_TO_SCREEN 		0x4000
#define SPF_PRINT_SIDEWAYS 		0x2000	;app flag
#define SPF_SCALE_TO_FIT 		0x1000
#define SPF_PRINT_ROW_COLUMN_TITLES 	0x0800
#define SPF_SKIP_DRAW 			0x0400
#define SPF_CENTER_VERTICALLY 		0x0200
#define SPF_CENTER_HORIZONTALLY 		0x0100
#define SPF_CONTINUOUS 			0x0080	;app flag
#define SPF_PRINT_HEADER 		0x0040
#define SPF_PRINT_FOOTER 		0x0020
#define SPF_PRINT_DOCUMENT 		0x0010	;app flag
#define SPF_PRINT_NOTES 			0x0008	;app flag
#define SPF_PRINT_GRAPHICS   	    	0x0004	;app flag
#define SPF_DONE 			0x0002	;return flag
#define SPF_PRINT_GRID 	    	    	0x0001

typedef struct {
    SpreadsheetPrintFlags	SDP_flags;
    word		SDP_gstate;
    CellReference	SDP_topLeft;
    RectDWord		SDP_drawArea;
    CellRange		SDP_limit;
    Point		SDP_margins;
    PointDWord		SDP_translation;
    PointDWord	    	SDP_titleTrans;
    WWFixed		SDP_scale;
    CellRange		SDP_range;
    RectDWord	    	SDP_rangeArea;
    /* align word */
} SpreadsheetDrawParams} ;

typedef struct {
    word	GC_unused;
    word	GC_unused2;
    word	GC_cellRow;
    word	GC_cellColumn;
} GetActiveCell} ;

@message void MSG_SPREADSHEET_GET_EXTENT (				/*XXX*/
                CellRange *retValue = axcxdxbp,
                SpreadsheetExtentType ssExtentType = cx);

typedef enum /* word */ {
    SET_ENTIRE_SHEET     = 0,
    SET_NO_EMPTY_CELLS     = 2,
    SET_NO_EMPTY_CELLS_NO_HDR_FTR     = 4,
    SET_NEXT_DATA_CELL     = 6,
    SET_LAST_DATA_CELL     = 8,
    SET_PREV_DATA_CELL     = 10,
    SET_FIRST_DATA_CELL     = 12
} SpreadsheetExtentType} ;

@message void MSG_SPREADSHEET_GET_RANGE_BOUNDS ();	/*NEEDS PROTOTYPE*/
@message void MSG_SPREADSHEET_SET_HEADER_RANGE (word flag = cx);		/*XXX*/
@message void MSG_SPREADSHEET_SET_FOOTER_RANGE (word flag = cx);		/*XXX*/
@message void MSG_SPREADSHEET_GET_HEADER_RANGE (				/*XXX*/
                CellRange *retValue = axcxdxbp);
@message void MSG_SPREADSHEET_GET_FOOTER_RANGE (				/*XXX*/
                CellRange *retValue = axcxdxbp);
@message void MSG_SPREADSHEET_COMPLETE_REDRAW ();			/*XXX*/
/*** NOTE: CALLBACK ROUTINE. DO LATER ***/
@message void MSG_SPREADSHEET_NOTES_ENUM ();	/** NEEDS PROTOTYPE **/
@message void MSG_SPREADSHEET_ALTER_DRAW_FLAGS (				/*XXX*/
                word bitsToSet = cx, word bitsToClear = dx);
@message SpreadsheetDrawFlags MSG_SPREADSHEET_GET_DRAW_FLAGS ();/*XXX*/

@message word MSG_SPREADSHEET_HANDLE_SPECIAL_FUNCTION (			/* NEEDS PROTOTYPE */
                /* word specialFunction = cx,
                char *bufferPtr = ss:dx */) /* = cx */;		/*XXX*/
@message void MSG_SPREADSHEET_CHANGE_COLUMN_WIDTH (word change = cx,
                          word column = dx);	/*XXX*/
@message void MSG_SPREADSHEET_CHANGE_ROW_HEIGHT (word change = cx,
                          word row = dx);	/*XXX*/

/*
 *	SpreadsheetSearchFlags record
 */
typedef ByteFlags SpreadsheetSearchFlags ;
#define SSF_MATCH_CASE 		0x80
#define SSF_MATCH_PARTIAL_WORDS 	0x40
#define SSF_SEARCH_FORMULAS 	0x20
#define SSF_SEARCH_VALUES 	0x10
#define SSF_SEARCH_NOTES 	0x08
#define SSF_SEARCH_TEXT_OBJECTS 	0x04
#define SSF_SEARCH_BY_ROWS 	0x02

#define SPREADSHEET_MAX_SEARCH_STRING_LENGTH  128;

typedef struct {
    SpreadsheetSearchFlags	SSP_flags;
    char 		SSP_string[128];
    SpreadsheetSearchFlags	SSP_found;
    Point		SSP_cell;
    word		SSP_startPos;
    word		SSP_endPos;
} SpreadsheetSearchParams} ;

@message FileHandle MSG_SPREADSHEET_GET_FILE () = cx;			/*XXX*/
@message word MSG_SPREADSHEET_SORT_RANGE (				/*XXX*/
                RangeSortFlags rangeSortFlags = cl) = cx;

@message Boolean MSG_SPREADSHEET_FUNCTION_TO_TOKEN ();	/* NEEDS PROTOTYPE */

typedef struct {
    word	GC_unused;
    word	GC_errorCode;
    word	GC_row;
    word	GC_column;
} GetCell} ;

@message Boolean MSG_SPREADSHEET_FUNCTION_TO_CELL ();	/*NEEDS PROTOTYPE*/

@message word MSG_SPREADSHEET_FORMAT_FUNCTION ();	/*NEEDS PROTOTYPE*/
@message Boolean MSG_SPREADSHEET_EVAL_FUNCTION ();	/*NEEDS PROTOTYPE*/

typedef struct {
    word	SEFP_stacksSeg;
    word	SEFP_opStackPtr;
    word	SEFP_argStackPtr;
    word	SEFP_funcID;
    word	SEFP_nArgs;
} SpreadsheetEvalFuncParams} ;

typedef ByteEnum SpreadsheetChartReturnType ;
#define SCRT_TOO_MANY_CHARTS 	    0
#define SCRT_INSUFFICIENT_MEMORY     2
#define SCRT_NO_DATA 	    	    4

@message void MSG_SPREADSHEET_CHART_RANGE (word chartNum = cx);		/*XXX*/
@message void MSG_SPREADSHEET_DELETE_CHART (word chartNum = cx);	    	/*XXX*/
@message void MSG_SPREADSHEET_START_MOVE_COPY ();			/*XXX*/
@message void MSG_SPREADSHEET_END_MOVE_COPY ();				/*XXX*/
@message void MSG_SSHEET_INIT_FOR_EXPORT ();				/*XXX*/

typedef struct
{
  CellRange	SRP_selection;		/* (r,c), (r,c) of selection.	*/
  CellReference	SRP_active;		/* (r,c) of active cell.	*/
} SpreadsheetRangeParams} ;

typedef enum /* word */ {
    SPREADSHEET_ADDRESS_ON_SCREEN     = 0xf000,
    SPREADSHEET_ADDRESS_IN_SELECTION     = 0xf001,
    SPREADSHEET_ADDRESS_DATA_AREA     = 0xf100,
    SPREADSHEET_ADDRESS_PAST_END     = 0xf101,
    SPREADSHEET_ADDRESS_USE_SELECTION     = 0xf200,
    SPREADSHEET_ADDRESS_NIL     = 0xffff
} SpreadsheetAddress} ;

@message void MSG_SPREADSHEET_SET_SELECTION (
                SpreadsheetRangeParams *ssRangeParams=ss:bp); /*XXX*/

/*
 * SRP_active ignored
 */
@message void MSG_SPREADSHEET_EXTEND_CONTRACT_SELECTION (
                SpreadsheetRangeParams *ssRangeParams=ss:bp); /*XXX*/

@message void MSG_SPREADSHEET_GET_SELECTION (
            SpreadsheetRangeParams *ssRangeParams=ss:bp); /*XXX*/

@message void MSG_SSHEET_PASTE_FROM_DATA_FILE ();	    	    /*XXX*/
@message void MSG_SSHEET_EXPORT_FROM_DATA_FILE ();	    	    /*XXX*/

@message void MSG_SPREADSHEET_INIT_NAME_LIST (); /*NEEDS PROTOTYPE*/
@message void MSG_SPREADSHEET_INIT_CHOOSE_NAME_LIST (); /*NEEDS PROTOTYPE*/
@message void MSG_SPREADSHEET_NAME_REQUEST_ENTRY_MONIKER (); /*NEEDS PROTOTYPE*/
@message void MSG_SPREADSHEET_NAME_UPDATE_DEFINITION (); /*NEEDS PROTOTYPE*/
@message void MSG_SPREADSHEET_NAME_UPDATE_NAME (); /*NEEDS PROTOTYPE*/
@message void MSG_SPREADSHEET_GET_NAME_WITH_LIST_ENTRY (); /*NEEDS PROTOTYPE*/

@importMessage MetaSpreadsheetMessages, void MSG_SPREADSHEET_REPLACE_TEXT_SELECTION (); /*NEEDS PROTOTYPE*/

@message void MSG_SPREADSHEET_GET_ROW_AT_POSITION (sdword yPos=dxcx); /*XXX*/
@message void MSG_SPREADSHEET_GET_COLUMN_AT_POSITION (sdword xPos=dxcx); /*XXX*/
@message void MSG_SPREADSHEET_SET_CELL_BORDERS (CellBorderInfo border=cl); /*XXX*/
@message void MSG_SPREADSHEET_SET_CELL_BORDER_COLOR (ColorQuad color=dxcx); /*XXX*/
@message void MSG_SPREADSHEET_SET_CELL_BORDER_GRAY_SCREEN (SystemDrawMask drawMask=cl); /*XXX*/
@message void MSG_SPREADSHEET_SET_CELL_BORDER_PATTERN (GraphicPattern pattern=cx); /*XXX*/

typedef enum /* word */ {
    SSFT_NUMBER    ,
    SSFT_DAY    ,
    SSFT_WEEKDAY    ,
    SSFT_MONTH    ,
    SSFT_YEAR
} SpreadsheetSeriesFillType} ;

typedef ByteFlags SpreadsheetSeriesFillFlags ;
#define SSFF_ROWS    	    	0x02
#define SSFF_GEOMETRIC 	    	0x01

typedef struct {
    SpreadsheetSeriesFillType	SRP_type;
    SpreadsheetSeriesFillFlags	SRP_flags;
    FloatNum	    	    	SRP_stepValue;
} SpreadsheetSeriesFillParams} ;

typedef ByteEnum SpreadsheetFillError ;
#define	SFE_NO_ERROR		    0
#define SFE_NOT_DATE_NUMER   2
#define SFE_DATE_STEP_TOO_LARGE   4

#define SPREADSHEET_MAX_DATE_FILL_STEP 		90
#define SPREADSHEET_MIN_DATE_FILL_STEP 		-90

@message SpreadsheetFillError MSG_SPREADSHEET_FILL_SERIES (SpreadsheetSeriesFillParams *fillParams=ss:bp)=al; /*XXX*/
@message void MSG_SPREADSHEET_FILL_RANGE (SeriesFillFlags flags=cl); /*XXX*/

typedef struct {
    TCHAR    	SSFPRP_text[MAX_RANGE_REF_SIZE / sizeof(TCHAR)];
    CellRange	SSFPRP_range;
} SpreadsheetFormatParseRangeParams} ;

@message void MSG_SPREADSHEET_PARSE_RANGE_REFERENCE (SpreadsheetFormatParseRangeParams *params=ss:bp); /*XXX*/
@message void MSG_SPREADSHEET_FORMAT_RANGE_REFERENCE (SpreadsheetFormatParseRangeParams *params=ss:bp); /*XXX*/

@message void MSG_SPREADSHEET_ENTER_DATA_WITH_EVENT (word textBlk = dx,
                     word textLen = cx,
                    EventHandle event = bp);  /*XXX*/

@protominor	SSheetNewForRedwood

@message SpreadsheetInsertSpaceError MSG_SPREADSHEET_CHECK_INSERT_SPACE (SpreadsheetInsertFlags ssInsertFlags = cx) = al;

@message void MSG_SPREADSHEET_INVERT_RANGE_LAST (GStateHandle gstate=bp); /*XXX*/

@message void MSG_SPREADSHEET_SET_DOC_ORIGIN (PointDWord *origin=ss:bp);
/*
 * Set the document origin.  The spreadsheet won't be scrollable above
 * or to the left of this origin.
 *
 */

@if _PROTECT_CELL
/* This part is for cell protection feature. */
typedef ByteEnum SpreadsheetProtectionOptions ;
#define	SPO_SELECTED_CELLS		0
#define	SPO_ALL_CELLS			2
@endif

@message void MSG_SPREADSHEET_PROTECT_RANGE (
                SpreadsheetProtectionOptions option = cl);

@message void MSG_SPREADSHEET_UNPROTECT_RANGE (
                SpreadsheetProtectionOptions option = cl);

@message void MSG_SPREADSHEET_LOCKED_CELL_RECALC (word row = dx,
                         word column = cx);

@message Boolean MSG_SPREADSHEET_CHECK_PROTECTED_CELLS(
                              @stack CellRange cellRange) = carry;

typedef enum /* byte */ {
    SISE_NO_ERROR    ,
    SISE_TOO_MANY_ROWS    ,
    SISE_TOO_MANY_COLUMNS    ,
    SISE_DELETE_ROW_DATA    ,
    SISE_DELETE_COLUMN_DATA

} SpreadsheetInsertSpaceError} ;

/* SpreadsheetAttributes record */
typedef ByteFlags SpreadsheetAttributes ;

#define SA_TARGETABLE 		0x80
#define SA_ENGINE_MODE 		0x40
#define SA_SPREADSHEET_IS_LAYER 	0x20

/* Constants and Structures */

#define	MAX_ROW			(8191+MIN_ROW)
#define	MAX_COLUMN		(255+MIN_ROW)

/*
 *	SSRefCountAndFlags record
 */

#define	SSRCAF_TRANSFORM_VALID		0x80
#define SSRCAF_REF_COUNT 	0x7f
#define MAX_GSTATE_REF_COUNT 	(SSRCAF_REF_COUNT)

/*
 * 	Instance Data
*/
    @instance CellFunctionParameters	SSI_cellParams = {0, 0, {0}};
    @instance word			SSI_chunk = 0;
    @instance optr			SSI_chartBody;

    @instance word			SSI_mapBlock = 0;
    @instance word			SSI_styleArray = 0;
    @instance word			SSI_rowArray = 0;
    @instance word			SSI_formatArray = 0;
    @instance word			SSI_nameArray = 0;

    @instance word			SSI_maxRow = MAX_ROW;
    @instance word			SSI_maxCol = MAX_COLUMN;

    @instance PointDWord		SSI_offset = {0, 0};
    @instance CellRange			SSI_visible = {{0, 0}, {0, 0}};
    @instance CellReference		SSI_active = {0, 0};

    @instance CellRange			SSI_quickSource = {{0, 0}, {0, 0}};
    @instance CellRange			SSI_selected = {{0, 0}, {0, 0}};
    @instance word    	    		SSI_curAttrs = 0;
    @instance word     			SSI_gstate = NullHandle;
    @instance byte   			SSI_gsRefCount = 0;	/* SSRefCountAndFlags */

    @instance SpreadsheetFlags		SSI_flags = 0;
    @instance SpreadsheetDrawFlags	SSI_drawFlags = 0;
    @instance byte			SSI_attributes = 0;

    @instance CellRange   		SSI_header = {{-1, -1}, {-1, -1}};
    @instance CellRange   		SSI_footer = {{-1, -1}, {-1, -1}};
    @instance word	   		SSI_circCount = 0;
    @instance FloatNum	   		SSI_converge = 0;
    @instance word	   		SSI_ancestorList = 0;
    @instance word	   		SSI_childList = 0;
    @instance word	   		SSI_finalList = 0;
    @instance optr			SSI_ruler;
    @instance RectDWord	    	    	SSI_bounds = {0, 0, 0, 0};

/*
 * VARDATA
 */

typedef struct {
    CellReference SDO_rowCol;
} SpreadsheetDocOrigin} ;

@vardata SpreadsheetDocOrigin	TEMP_SPREADSHEET_DOC_ORIGIN;
/*
 * contains the document origin if it's nonzero.  Used for
 * "locking rows and columns"
 *
 */

@endc

typedef struct {
    word    SIFD_file;
    word    SIFD_numRows;
    word    SIFD_numCols;
    SpreadsheetDrawFlags    SIFD_drawFlags;
} SpreadsheetInitFileData} ;

extern VMBlockHandle
    _pascal SpreadsheetInitFile (SpreadsheetInitFileData *ifd);

extern void
    _pascal SpreadsheetParseNameToToken (C_CallbackStruct *cb_s);

extern void
    _pascal SpreadsheetParseCreateCell (C_CallbackStruct *cb_s);

extern void
    _pascal SpreadsheetParseEmptyCell (C_CallbackStruct *cb_s);

extern void
    _pascal SpreadsheetParseDerefCell (C_CallbackStruct *cb_s);

extern word
    _pascal SpreadsheetNameTextFromToken (SpreadsheetInstance *ssheet,
                 word nameToken,
                 char *destinationPtr,
                 word maxCharsToWrite);

extern Boolean
    _pascal SpreadsheetNameTokenFromText (SpreadsheetInstance *ssheet,
                 char *nameText,
                 word nameLen,
                 word *tokenDest,
                 NameFlags *flagsDest);

extern word
    _pascal SpreadsheetNameLockDefinition (SpreadsheetInstance *ssheet,
                  word nameToken,
                  void **defaddr);

extern void
    _pascal SpreadsheetCellAddRemoveDeps (SpreadsheetInstance *spreadsheetInstance,
                 dword cellParams,
                 PCB(void, callback,(C_CallbackStruct *)),
                 word addOrRemoveDeps,
                 word eval_flags,
                 word row,
                 word column,
                 word maxRow,
                 word maxColumn);

extern void
    _pascal SpreadsheetRecalcDependents (SpreadsheetInstance *spreadsheetInstance,
                 PCB(void, callback,(optr oself,
                         word row, word column)),
                 word row,
                 word column);

#ifdef __HIGHC__
pragma Alias (SpreadsheetInitFile, "SPREADSHEETINITFILE");
pragma Alias (SpreadsheetParseNameToToken, "SPREADSHEETPARSENAMETOTOKEN");
pragma Alias (SpreadsheetParseDerefCell, "SPREADSHEETPARSEDEREFCELL");
pragma Alias (SpreadsheetParseCreateCell, "SPREADSHEETPARSECREATECELL");
pragma Alias (SpreadsheetParseEmptyCell, "SPREADSHEETPARSEEMPTYCELL");
pragma Alias (SpreadsheetNameTextFromToken, "SPREADSHEETNAMETEXTFROMTOKEN");
pragma Alias (SpreadsheetNameTokenFromText, "SPREADSHEETNAMETOKENFROMTEXT");
pragma Alias (SpreadsheetNameLockDefinition, "SPREADSHEETNAMELOCKDEFINITION");
pragma Alias (SpreadsheetCellAddRemoveDeps, "SPREADSHEETCELLADDREMOVEDEPS");
pragma Alias (SpreadsheetRecalcDependents, "SPREADSHEETRECALCDEPENDENTS");
/*
pragma Alias (SpreadsheetCheckShortcut, "SPREADSHEETCHECKSHORTCUT");
pragma Alias (SpreadsheetGetTokenByStyle, "SPREADSHEETGETTOKENBYSTYLE");
pragma Alias (SpreadsheetDeleteStyleByToken, "SPREADSHEETDELETESTYLEBYTOKEN");
pragma Alias (SpreadsheetGetStyleByToken, "SPREADSHEETGETSTYLEBYTOKEN");
pragma Alias (SpreadsheetGetAttrByToken, "SPREADSHEETGETATTRBYTOKEN");
*/
#endif

/*
 * Visual Cell Attributes
 */

/* Color/Mask Info */
typedef struct {
    ColorQuad	    AI_color;
    SystemDrawMask  AI_grayScreen;
} AreaInfo} ;

/* Border Info record */
typedef ByteFlags CellBorderInfo ;
#define CBI_OUTLINE   	0x80
#define	CBI_LEFT		0x08
#define	CBI_TOP			0x04
#define	CBI_RIGHT		0x02
#define	CBI_BOTTOM		0x01

/* Cell Info record */
typedef ByteFlags CellInfo ;
#define	CI_LOCKED		0x04
#define	CI_JUSTIFICATION		0x03

#define	J_GENERAL	       J_FULL

/*
 * Common Cell Attributes
 */

typedef struct {
    RefElementHeader	CA_refCount;
    AreaInfo	CA_textAttrs;
    AreaInfo	CA_bkgrndAttrs;
    FontID	CA_font;
    word	CA_pointsize;	/* pointsize*8 */
    byte	CA_style;	/* TextStyle */
    CellBorderInfo	CA_border;
    AreaInfo	CA_borderAttrs;
    CellInfo	CA_info;
    word	CA_format;
    BBFixed 	CA_trackKern;
    byte    	CA_fontWeight;
    byte    	CA_fontWidth;
    byte	CA_reserved[9];
} CellAttrs} ;

/* assert word align */

#define	ROW_HEIGHT_AUTOMATIC		0x8000
#define	MIN_ROW				0
#define	COLUMN_WIDTH_MIN		0
#define	COLUMN_WIDTH_MAX		512
#define	ROW_HEIGHT_MIN			0
#define	ROW_HEIGHT_MAX			(792*5/4)

typedef struct {
    word	NH_blockSize;
    word	NH_definedCount;
    word	NH_undefinedCount;
    word	NH_nextToken;
} NameHeader} ;

/*
 * NameFlags record
*/
typedef ByteFlags NameFlags ;
#define	NF_UNDEFINED		0x80

typedef struct {
    byte	NS_flags;	/* NameFlags */
    word	NS_token;
    word	NS_length;
} NameStruct} ;

#ifdef DO_DBCS
#define	MAX_NAMES		170
#else
#define	MAX_NAMES		255
#endif

#define	MAX_NAME_BLOCK_SIZE		(sizeof(NameHeader) + \
                (MAX_NAMES * (sizeof(NameStruct) + \
                (sizeof(TCHAR) * MAX_NAME_LENGTH))))

/*
 *	NameAccessFlags record
 */
typedef ByteFlags NameAccessFlags ;
#define NAF_NAME 			0x80
#define NAF_DEFINITION 			0x40
#define NAF_BY_TOKEN 			0x20
#define NAF_TOKEN_DEFINITION 		0x10

typedef struct {
    byte	SNP_flags;	/* NameAccessFlags */
    word	SNP_listEntry;
    word	SNP_textLength;
    TCHAR	SNP_text[MAX_NAME_LENGTH];
    word	SNP_defLength;
#ifdef DO_DBCS
    byte	SNP_definition[MAX_NAME_DEF_LENGTH*2];
#else
    byte	SNP_definition[MAX_NAME_DEF_LENGTH+4];
#endif
    word	SNP_token;
    byte	SNP_nameFlags;
    byte	SNP_unused;
} SpreadsheetNameParameters} ;

typedef struct {
    FormatParameters	SFP_formatParams;
    dword		SFP_expression;
    dword		SFP_text;
    word		SFP_length;
} SpreadsheetFormatParams} ;

typedef struct {
    ParserParameters	SPP_parserParams;
    dword		SPP_text;
    dword		SPP_expression;
    word		SPP_exprLength;
} SpreadsheetParserParams} ;

typedef struct {
    EvalParameters	SEP_evalParams;
    dword		SEP_expression;
    dword		ArgumentStackElement;
} SpreadsheetEvalParams} ;

#define	NAME_ROW		(LARGEST_ROW - 4)
#define CHART_ROW 	(LARGEST_ROW - 3)
#define FORMATTED_RANGE_BUFFER_SIZE 	14

/* ParserScannerEvaluatorError enum types */
#define PSEE_RESULT_SHOULD_BE_CELL_OR_RANGE   PSEE_SSHEET_BASE
#define PSEE_NO_NAME_GIVEN   	    	    (PSEE_SSHEET_BASE + 1)
#define PSEE_NO_DEFINITION_GIVEN     	    (PSEE_SSHEET_BASE + 2)
#define PSEE_NAME_ALREADY_DEFINED     	    (PSEE_SSHEET_BASE + 3)
#define PSEE_BAD_NAME_DEFINITION     	    (PSEE_SSHEET_BASE + 4)
#define PSEE_REALLOC_FAILED 	    	    (PSEE_SSHEET_BASE + 5)
#define PSEE_CELL_OR_RANGE_IS_LOCKED 	    (PSEE_SSHEET_BASE + 6)
#define PSEE_LAST_SPREADSHEET_ERROR  	    230

#define PSEE_SSHEET_ERRORS 	\
    PSEE_PARSER_ERRORS,	\
    PSEE_RESULT_SHOULD_BE_CELL_OR_RANGE, \
    PSEE_NO_NAME_GIVEN,	\
    PSEE_NO_DEFINITION_GIVEN,	\
    PSEE_NAME_ALREADY_DEFINED,	\
    PSEE_BAD_NAME_DEFINITION,	\
    PSEE_REALLOC_FAILED,    \
    PSEE_CELL_OR_RANGE_IS_LOCKED

typedef struct {
    word	NLH_endOfData;
    word	NLH_blockSize;
} NameListHeader} ;

typedef struct {
    word	NLE_token;
    byte	NLE_flags;
    byte	NLE_unused;
    word	NLE_textLength;
    word	NLE_defLength;
} NameListEntry} ;

#define	NAME_LIST_INCREMENT		2048

/*** FORMAT stuff ***/

#define CELL_GOTO_MAX_TEXT 	    15
#define	CELL_MAX_TEXT			    511
#define CELL_TEXT_BUFFER_SIZE  	    (CELL_MAX_TEXT + size CellText)
#define CELL_MAX_FORMULA 	    512
#define CELL_FORMULA_BUFFER_SIZE     (CELL_MAX_FORMULA + size CellFormula)

/* adding to existing FunctionID (from parse library) enum at this point...*/

#define SPREADSHEET_LIB_FUNCTIONID_ERRORS  \
    FUNCTION_ID_SPREADSHEET_CELL, \
    FUNCTION_ID_LAST_SPREADSHEET_FUNCTION

#define	SPREADSHEET_RULER_WIDTH			40
#define	SPREADSHEET_RULER_HEIGHT		12

typedef ByteFlags SpreadsheetRulerFlags ;
#define SRF_SSHEET_IS_FOCUS  	    0x8
#define	SRF_NO_INTERACTIVE_RESIZE	   0x4
#define SRF_SSHEET_IS_TARGET 	    0x2
#define SRF_HAVE_GRAB 	    	    0x1

@class	SpreadsheetRulerClass,VisRulerClass;

@message void MSG_SPREADSHEET_RULER_DRAW_RANGE (		/*XXX*/
                SpreadsheetDrawParams *ssDrawParams);
@message void MSG_SPREADSHEET_RULER_SET_FLAGS (
                SpreadsheetRulerFlags setFlags = dl,
                    SpreadsheetRulerFlags clearFlags = dh);

@instance   	SpreadsheetRulerFlags	SRI_flags;
@instance	optr	SRI_spreadsheet;
@instance   	word	SRI_resizeRC;
@instance   	dword	SRI_startRCPos;

@endc

typedef ByteEnum CellError ;
#define CE_NO_ERROR  0
#define CE_TOO_COMPLEX  1
#define CE_REF_OUT_OF_RANGE  2
#define CE_NAME  3
#define CE_ARG_COUNT  4
#define CE_TYPE 	 5
#define CE_DIVIDE_BY_ZERO  6
#define CE_CIRCULAR_REF  7
#define CE_GEN_ERR  8
#define CE_NA  9
#define CE_FLOAT_POS_INF  10
#define CE_FLOAT_NEG_INF  11
#define CE_FLOAT_GEN_ERR  12
#define CE_CIRC_NAME_REF  13
#define CE_CIRC_DEPEND  14
#define	CE_NUM_OUT_OF_RANGE	 15

typedef ByteEnum CellType ;
#define CT_TEXT 			0
#define CT_CONSTANT 		2
#define CT_FORMULA 		4
#define CT_NAME 			6
#define CT_CHART 		8
#define CT_EMPTY 		10
#define CT_DISPLAY_FORMULA 	12

/*
 *	CellRecalcFlags record
 */
typedef ByteFlags CellRecalcFlags ;
#define CRF_IN_PARENT_LIST 	0x80
#define CRF_IN_FINAL_LIST 	0x40
@if _PROTECT_CELL
#define CRF_PROTECTION 		0x01
@else
#define	CRF_RESERVED			0x01
@endif

typedef struct {
    dword	CC_dependencies;
    byte	CC_type;
    byte	CC_recalcFlags;	/* CellRecalcFlags */
    word	CC_attrs;
    dword	CC_notes;
} CellCommon} ;

typedef struct {
    CellCommon	CT_common;
} CellText} ;

typedef struct {
    CellCommon	CC_common;
    FloatNum	CC_current;
} CellConstant} ;

typedef ByteEnum ReturnType ;
#define RT_VALUE  0
#define RT_TEXT  1
#define	RT_ERROR	 2

typedef union {
    FloatNum	RV_VALUE;
    word	RV_TEXT;
    CellError	RV_ERROR;
} ReturnValue} ;

typedef struct {
    CellCommon	CF_common;
    ReturnType	CF_return;
    ReturnValue	CF_current;
    word	CF_formulaSize;
} CellFormula} ;

typedef struct {
    CellCommon	CN_common;
} CellName} ;

typedef struct {
    CellFormula	CG_formula;
} CellChart} ;

typedef struct {
    CellCommon	CUF_common;
} CellUserFunction} ;

typedef struct {
    CellCommon	CE_common;
} CellEmpty} ;

@endlib


ssmeta.h

/*******************************************************************************

    Copyright (c) Geoworks 1992 -- All Rights Reserved

PROJECT:	PC GEOS
MODULE:
FILE:		ssmeta.def

AUTHOR:		Cheng, 8/92

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    Cheng	8/92		Initial revision

DESCRIPTION:
    Definitions for the Spreadsheet Meta library. This library manages
    the meta file for the spreadsheet.

    $Id: ssmeta.h,v 1.15.11.1 96/04/28 08:28:15 chris Exp $

*******************************************************************************/

#ifndef __SSMETA_H
#define __SSMETA_H

/*******************************************************************************

    SSMETA DATA ARRAY STRUCTURES

    Use by the spreadsheet's cut/copy/paste code as well as for the spreadsheet
    translation library.

    NAMES OF THINGS:

    The clipboard transfer item header will have a handle to a SSMETA
    HEADER BLOCK.

    The ssmeta header block is a VM blk containing the size of the scrap
    (number of rows and columns) and five SSMETA DATA ARRAY RECORDS.

    Each ssmeta data typedef ByteWordFlags array;

    One data array is used to store the cell data, one for the styles, one
    for the formats, and another for the names. The fifth data array is
    for use by the database. Any data array can be empty.

    A data array is an array of SSMETA ENTRIES.

    Each ssmeta entry will have an ENTRY HEADER which is followed by the
    ENTRY DATA. The entry header will contain a field for a token, and
    fields for the coordinate (row, column) that the cell data processing
    code needs. Entry tokens are optional. You may use them if you XXXX
    to use them to search for entries.

    NOTES:
    The VM file handle is stored in the SSMetaHeader and each of the
    SSMetaDataArrayRecords. This duplication is for convenience - it
    lessens the amount of separate data that needs to be passed around.

*******************************************************************************/

typedef ByteEnum DataArraySpecifier ;
#define		DAS_CELL			0
#define		DAS_STYLE			1
#define		DAS_FORMAT			2
#define		DAS_NAME			3
#define		DAS_FIELD			4

typedef ByteEnum SSMetaAddEntryFlags ;
#define		SSMAEF_ADD_IN_TOKEN_ORDER			0
#define		SSMAEF_ADD_IN_ROW_ORDER				1
#define		SSMETA_ADD_TO_END				2
#define		SSMAEF_ENTRY_POS_PASSED				3

/*
 * SSMetaDataArrayRecord:
 * used to track a data array
 */
typedef struct {
    word	SSMDAR_signature;
    word	SSMDAR_numEntries;	/* num entries in the data array */
    word	SSMDAR_dataArrayLinkOffset;
} SSMetaDataArrayRecord} ;

/*
 *    	SSMetaHeaderBlock;
 */
typedef	struct {
    VMChainTree			SSMHB_vmChainTree;
    dword			SSMHB_cellLink;
    dword			SSMHB_styleLink;
    dword			SSMHB_formatLink;
    dword			SSMHB_nameLink;
    dword			SSMHB_fieldLink;
    SSMetaDataArrayRecord	SSMHB_cellData;
    SSMetaDataArrayRecord	SSMHB_styleData;
    SSMetaDataArrayRecord	SSMHB_formatData;
    SSMetaDataArrayRecord	SSMHB_nameData;
    SSMetaDataArrayRecord	SSMHB_fieldData;
    word			SSMHB_scrapRows;
    word			SSMHB_scrapCols;
} SSMetaHeaderBlock} ;

/*
 * SSMetaEntry
 */
typedef struct {
    word	SSME_signature;		/* sig for error checking */
    word	SSME_entryDataSize;	/* size of entry data */
    word	SSME_token;		/* token (if there is one) */
    word	SSME_coordRow;
    word	SSME_coordCol;
    word	SSME_newToken;		/* for use when pasting */
} SSMetaEntry} ;

typedef struct {
    dword	SSMED_ptr;
    word	SSMED_size;
} SSMetaEntryDescriptor} ;

/*
 * SSMetaStruc:
 */
typedef struct {
    /*
     *    user	library; usually passes info in these fields:
     */
    ClipboardItemFlags	SSMDAS_transferItemFlags;
    DataArraySpecifier	SSMDAS_dataArraySpecifier;
    word	SSMDAS_row;
    word	SSMDAS_col;
    word	SSMDAS_token;
    word	SSMDAS_handle;	 	/* for routines that need it, */
                    /* handle to a mem block */
    /*
     * Library user gets info back in these fields:
     */
    word	SSMDAS_newEntrySeg;
    word	SSMDAS_vmFileHan;	/* transfer VM file han */
    word	SSMDAS_hdrBlkVMHan;	/* SSMetaHeaderBlock VM blk han */

    /*
     * Fields containing info about the scrap (initialized by
     * SSMetaInitForPaste)
     * Once initialized, library users should not change these.
     */
    word	SSMDAS_tferItemHdrVMHan;/* TransferItemHeader VM blk han */
    word	SSMDAS_tferItemMemHan;	/* TransferItemHeader mem han */
    word	SSMDAS_hdrBlkMemHan;	/* SSMetaHeaderBlock mem han */
    dword	SSMDAS_sourceID;	/* sourceID of transfer item */
    word	SSMDAS_scrapRows;	/* number of rows */
    word	SSMDAS_scrapCols;	/* number of columns */

    /*
     * fields for library's own use - don't touch these
     */
    word	SSMDAS_signature;	/* for error checking */
    dword	SSMDAS_dataArrayRecordPtr;
    word	SSMDAS_dataArrayBlkHan;	/* huge array handle for data array */

    /*
    * SSMDAS_dataArrayEntryTable - tracks the position of the last accessed
    * entry in each of the data arrays.
    */

    SSMetaEntryDescriptor	SSMDAS_cellEntry;
    SSMetaEntryDescriptor	SSMDAS_styleEntry;
    SSMetaEntryDescriptor	SSMDAS_formatEntry;
    SSMetaEntryDescriptor	SSMDAS_nameEntry;
    SSMetaEntryDescriptor	SSMDAS_fieldEntry;

    dword	SSMDAS_entryDataAddr;	/* user passes this to library */
    word	SSMDAS_entryDataSize;	/* user passes this to library */
    word	SSMDAS_entryMemHan;
    byte	SSMDAS_flag;		/* user passes this to library */
    dword	SSMDAS_entryPos;	/* tracks array traversal */

    /*
     * used for binary search in AddEntryBinarySearch, touch these not
     */
    word    	SSMDAS_startIndex;
    word	SSMDAS_endIndex;
    word	SSMDAS_checkIndex;
    byte    	SSMDAS_compFlag;	/* SSMetaBinSearchConditionType */

} SSMetaStruc} ;

/*
 * initialization routines
 */
extern void
        _pascal SSMetaInitForStorage (SSMetaStruc *ssmStruc,
        VMFileHandle vmFileHan,
        dword sourceID);				/* XXX */
extern void
        _pascal SSMetaInitForRetrieval (SSMetaStruc *ssmStruc,
        VMFileHandle vmFileHan,
        word ssmHdr);					/* XXX */
extern void
        _pascal SSMetaInitForCutCopy (SSMetaStruc *ssmStruc,
        ClipboardItemFlags flags,
        dword sourceID);				/* XXX */
extern void
        _pascal SSMetaDoneWithCutCopy (SSMetaStruc *ssmStruc);	/* XXX */
extern void
        _pascal SSMetaDoneWithCutCopyNoRegister (SSMetaStruc *ssmStruc);

extern Boolean
        _pascal SSMetaInitForPaste (SSMetaStruc *ssmStruc,
        ClipboardItemFlags flags);			/* XXX */
extern void
        _pascal SSMetaDoneWithPaste (SSMetaStruc *ssmStruc);		/* XXX */
/*
 * storage routines
 */
extern void _pascal SSMetaSetScrapSize (SSMetaStruc *ssmStruc,
        word numCols,
        word numRows);					/* XXX */
extern Boolean
        _pascal SSMetaDataArrayLocateOrAddEntry (SSMetaStruc *ssmStruc,
        word token,
        word entryDataSize,
        void *entryData);				/* XXX */
extern void
        _pascal SSMetaDataArrayAddEntry (SSMetaStruc *ssmStruc,
        SSMetaAddEntryFlags flag,
        word entryDataSize,
        void *entryData);				/* XXX */
/*
 * retrieval routines
 */
extern Boolean
        _pascal SSMetaSeeIfScrapPresent (ClipboardItemFlags flags); /* XXX */
extern void
        _pascal SSMetaGetScrapSize (SSMetaStruc *ssmStruc);	/* XXX */
extern word
        _pascal SSMetaDataArrayGetNumEntries (SSMetaStruc *ssmStruc); /* XXX */

extern void	_pascal SSMetaDataArrayResetEntryPointer (SSMetaStruc *ssmStruc);

extern SSMetaEntry
        *_pascal SSMetaDataArrayGetFirstEntry (SSMetaStruc *ssmStruc); /* XXX */
extern SSMetaEntry
        *_pascal SSMetaDataArrayGetNextEntry (SSMetaStruc *ssmStruc);

extern SSMetaEntry
        *_pascal SSMetaDataArrayGetEntryByToken (SSMetaStruc *ssmStruc,
        word token);					/* XXX */
extern SSMetaEntry
        *_pascal SSMetaDataArrayGetEntryByCoord (SSMetaStruc *ssmStruc);
extern SSMetaEntry
        *_pascal SSMetaDataArrayGetNthEntry (SSMetaStruc *ssmStruc,
        word N);					/* XXX */
extern void _pascal SSMetaDataArrayUnlock (SSMetaStruc *ssmStruc);	/* XXX */
extern word _pascal SSMetaGetNumberOfDataRecords (SSMetaStruc *ssmStruc);	/* XXX */
extern void _pascal SSMetaResetForDataRecords (SSMetaStruc *ssmStruc); /* XXX */
extern char *_pascal SSMetaFieldNameLock (SSMetaStruc *ssmStruc,
                     MemHandle *mHandle,
                     word *dataLength);	/* XXX */
extern char *_pascal SSMetaDataRecordFieldLock (SSMetaStruc *ssmStruc,
                     MemHandle *mHandle,
                     word *dataLength);	/* XXX */
extern void _pascal SSMetaFieldNameUnlock (SSMetaStruc *ssmStruc,
                      word mHandle);	/* XXX */
extern void _pascal SSMetaDataRecordFieldUnlock (SSMetaStruc *ssmStruc,
                        word mHandle);	/* XXX */
extern char *_pascal SSMetaFormatCellText (SSMetaStruc *ssmStruc,
                     MemHandle *mHandle,
                     word *dataLength);	/* XXX */
#ifdef __HIGHC__

pragma Alias(SSMetaInitForStorage, "SSMETAINITFORSTORAGE");
pragma Alias(SSMetaInitForRetrieval, "SSMETAINITFORRETRIEVAL");
pragma Alias(SSMetaInitForCutCopy, "SSMETAINITFORCUTCOPY");
pragma Alias(SSMetaDoneWithCutCopy, "SSMETADONEWITHCUTCOPY");
pragma Alias(SSMetaDoneWithCutCopyNoRegister,"SSMETADONEWITHCUTCOPYNOREGISTER");
pragma Alias(SSMetaInitForPaste, "SSMETAINITFORPASTE");
pragma Alias(SSMetaDoneWithPaste, "SSMETADONEWITHPASTE");
pragma Alias(SSMetaSetScrapSize, "SSMETASETSCRAPSIZE");
pragma Alias(SSMetaDataArrayLocateOrAddEntry, "SSMETADATAARRAYLOCATEORADDENTRY");
pragma Alias(SSMetaDataArrayAddEntry, "SSMETADATAARRAYADDENTRY");
pragma Alias(SSMetaSeeIfScrapPresent, "SSMETASEEIFSCRAPPRESENT");
pragma Alias(SSMetaGetScrapSize, "SSMETAGETSCRAPSIZE");
pragma Alias(SSMetaDataArrayGetNumEntries, "SSMETADATAARRAYGETNUMENTRIES");
pragma Alias(SSMetaDataArrayResetEntryPointer, "SSMETADATAARRAYRESETENTRYPOINTER");
pragma Alias(SSMetaDataArrayGetFirstEntry, "SSMETADATAARRAYGETFIRSTENTRY");
pragma Alias(SSMetaDataArrayGetNextEntry, "SSMETADATAARRAYGETNEXTENTRY");
pragma Alias(SSMetaDataArrayGetEntryByToken, "SSMETADATAARRAYGETENTRYBYTOKEN");
pragma Alias(SSMetaDataArrayGetEntryByCoord, "SSMETADATAARRAYGETENTRYBYCOORD");
pragma Alias(SSMetaDataArrayGetNthEntry, "SSMETADATAARRAYGETNTHENTRY");
pragma Alias(SSMetaDataArrayUnlock, "SSMETADATAARRAYUNLOCK");

pragma Alias(SSMetaGetNumberOfDataRecords, "SSMETAGETNUMBEROFDATARECORDS");
pragma Alias(SSMetaResetForDataRecords, "SSMETARESETFORDATARECORDS");
pragma Alias(SSMetaFieldNameLock, "SSMETAFIELDNAMELOCK");
pragma Alias(SSMetaDataRecordFieldLock, "SSMETADATARECORDFIELDLOCK");
pragma Alias(SSMetaFieldNameUnlock, "SSMETAFIELDNAMEUNLOCK");
pragma Alias(SSMetaDataRecordFieldUnlock, "SSMETADATARECORDFIELDUNLOCK");
pragma Alias(SSMetaFormatCellText, "SSMETAFORMATCELLTEXT");

#endif
#endif


Internal\Resp\ssset.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1995 - 1997. Nokia Mobile Phones
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

    Header file for Supplementary Service Settings controller library.

-----------------------------------------------------------------------------
*/

@ifndef SSSET_GOH
@define SSSET_GOH

@deflib ssset

/*  INCLUDE FILES  */

@include   <stdapp.goh>
#include   <library.h>

/*  C CONSTANTS  */

/* Applications type that activates the controller. The type of calls
 * that are diverted/barred are determined by this. */
typedef byte SSSetCallType ;
    #define SCT_PHONE                11
    #define SCT_FAX                  13
    #define SCT_DATA                 20
    #define SCT_DATA_CIRCUIT_ASYNC   25

/*  GEOS CONSTANTS  */

/*  C MACROS  */

/*  GEOS MACROS  */

/*  DATA TYPES  */

/*  CLASS DEFINITIONS  */

/* CDivertingClass */
@class CDivertingClass, GenControlClass;

/* CDivertingClass feature flags */
typedef WordFlags CDivertingFeatures ;
#define CDF_DIVERT_UNCOND_TO_VBM             (0x0040)
#define CDF_DIVERT_BUSY_TO_VBM               (0x0020)
#define CDF_DIVERT_NO_REPLY_TO_VBM           (0x0010)
#define CDF_DIVERT_NOT_REACHABLE_TO_VBM      (0x0008)
#define CDF_CLEAR_ALL_BUTTON                 (0x0004)
#define CDF_STATUS_BUTTON                    (0x0002)
#define CDF_OPTIONS_LIST                     (0x0001)

#define	CD_DEFAULT_FEATURES	  (CDF_OPTIONS_LIST | CDF_STATUS_BUTTON | CDF_CLEAR_ALL_BUTTON)

/* External messages. */

/* Internal messages. */
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_DIVERTING_APPLY_UNCOND;
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_DIVERTING_APPLY_BUSY;
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_DIVERTING_APPLY_NO_REPLY;
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_DIVERTING_APPLY_NOT_REACHABLE;

@message void MSG_DIVERTING_CANCEL_UNCOND ();
@message void MSG_DIVERTING_CANCEL_BUSY ();
@message void MSG_DIVERTING_CANCEL_NO_REPLY ();
@message void MSG_DIVERTING_CANCEL_NOT_REACHABLE ();

@message void MSG_DIVERTING_APPLY_GET_STATUS ();
@message void MSG_DIVERTING_APPLY_CLEAR_ALL ();
@message void MSG_DIVERTING_APPLY_CLOSE ();
@message void MSG_DIVERTING_APPLY_CANCEL_REQUEST ();

@message void MSG_DIVERTING_GET_VMB_NUMBER ();
@message void MSG_DIVERTING_APPLY_VMB_NUMBER  ( byte command);

@message void MSG_DIVERTING_VMB_STATUS ( word      messageId,
                                        MemHandle structure);
@message void MSG_DIVERTING_ECI_STATUS ( word      messageId,
                                        MemHandle structure);
@message void MSG_DIVERTING_UPDATE_TITLE ();
@message Boolean MSG_DIVERTING_ALTERNATE_LINE_SELECTED ();
@message SSSetCallType MSG_DIVERTING_GET_CALL_TYPE ();

/* Instance data. */

@vardata    SSSetCallType   ATTR_DIVERTING_CALL_TYPE;
@vardata    void            ATTR_DIVERTING_SHOW_VMBX_ERROR_NOTE;

@instance   TCHAR           CDI_vmbNumber[31];
@instance   Boolean         CDI_queryActive = FALSE;
@instance   Boolean         CDI_vmbxQueryActive = FALSE;

@instance   byte            CDI_requestId;

@instance   optr            CDCI_controlObj = NULL;

@default GI_states = ( @default | GS_ENABLED );
@default GII_type = GIT_PROPERTIES;
@default GII_visibility = GIV_DIALOG;
@default GII_attrs = ( @default | GIA_NOT_USER_INITIATABLE  | GIA_MODAL);

@endc

/* CBarringClass */

@class CBarringClass, GenControlClass;

/* CBarringClass feature flags */
typedef WordFlags CBarringFeatures ;
#define CBF_CLEAR_ALL_BUTTON     (0x0004)
#define CBF_STATUS_BUTTON        (0x0002)
#define CBF_OPTIONS_LIST         (0x0001)

#define	CB_DEFAULT_FEATURES	 	(CBF_OPTIONS_LIST | CBF_STATUS_BUTTON | CBF_CLEAR_ALL_BUTTON)

/* External messages. */

/* Internal messages. */
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_BARRING_APPLY_ALL_OUT;
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_BARRING_APPLY_INT_OUT;
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_BARRING_APPLY_INT_X_HOME_OUT;
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_BARRING_APPLY_ALL_IN;
@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_BARRING_APPLY_IN_IF_ABROAD;

@message void MSG_BARRING_APPLY_GET_STATUS ();
@message void MSG_BARRING_APPLY_CLEAR_ALL ();
@message void MSG_BARRING_APPLY_CLOSE ();
@message void MSG_BARRING_APPLY_CANCEL_REQUEST ();

@message void MSG_BARRING_GET_NETWORK_PASSWD ();
@message void MSG_BARRING_APPLY_NETWORK_PASSWD  ( byte command);
@message void MSG_BARRING_ECI_STATUS ( word      messageId,
                                      MemHandle structure);
@message void MSG_BARRING_UPDATE_TITLE ();
@message Boolean MSG_BARRING_ALTERNATE_LINE_SELECTED ();
@message SSSetCallType MSG_BARRING_GET_CALL_TYPE ();

/* Instance data. */

@vardata    SSSetCallType	ATTR_BARRING_CALL_TYPE;
@vardata    Boolean         ATTR_BARRING_QUERY_ANSWERED;

@instance   Boolean         CBI_queryActive = FALSE;
@instance   byte            CBI_requestId;
@instance   optr            CBCI_controlObj = NULL;

@default GI_states = ( @default | GS_ENABLED );
@default GII_type = GIT_PROPERTIES;
@default GII_visibility = GIV_DIALOG;
@default GII_attrs = ( @default | GIA_NOT_USER_INITIATABLE  | GIA_MODAL);

@endc

/* CWaitingClass */

@class CWaitingClass, GenControlClass;

/* CWaitingClass feature flags */
typedef WordFlags CWaitingFeatures ;
#define CWF_STATUS_BUTTON        (0x0002)
#define CWF_OPTIONS_LIST         (0x0001)

#define	CW_DEFAULT_FEATURES	 	(CWF_OPTIONS_LIST | CWF_STATUS_BUTTON)

/* External messages. */

/* Internal messages. */

@message (GEN_ITEM_GROUP_APPLY_MSG) MSG_WAITING_APPLY;

@message void MSG_WAITING_APPLY_GET_STATUS ();
@message void MSG_WAITING_APPLY_CLOSE ();

@message void MSG_WAITING_APPLY_CANCEL_REQUEST ();

@message void MSG_WAITING_ECI_STATUS ( word       messageId,
                                      MemHandle  structure);

/* Instance data. */

@vardata    SSSetCallType	ATTR_WAITING_CALL_TYPE;

@instance   Boolean         CWI_queryActive = FALSE;

@instance   optr            CWCI_controlObj = NULL;

@default GI_states = ( @default | GS_ENABLED );
@default GII_type = GIT_PROPERTIES;
@default GII_attrs = ( @default | GIA_NOT_USER_INITIATABLE  | GIA_MODAL);

@endc

/*  EXTERNAL OBJECTS  */

/*  EXTERNAL DATA STRUCTURES  */

@endlib /* ssset */

@endif /* End of File */


Ansi\stdio.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	stdio.h
 * AUTHOR:	Tony Requist: February 1, 1991
 *
 * DECLARER:	AnsiC
 *
 * DESCRIPTION:
 *	This file defines standard stdio.h functions
 *
 *	$Id: stdio.h,v 1.18.4.1 96/04/28 08:30:45 chris Exp $
 *
 ***********************************************************************/

#ifndef	__STDIO_H
#define __STDIO_H

#include  <geos.h>
#include  <stdarg.h>

/*----------------------------------------------------------------------
      Constants & Structures
----------------------------------------------------------------------*/

#define _IOFBF 		0
#define	_IOLBF			1
#define	_IONBF			2
#define EOF  		(-1)
#define FILENAME_MAX 	32
#define FOPEN_MAX 	8

/* the following define the File Position modes used by fseek */
#define  SEEK_SET   FILE_POS_START
#define  SEEK_CUR   FILE_POS_RELATIVE
#define  SEEK_END   FILE_POS_END

#ifndef NULL
#define NULL  0
#endif

typedef void FILE ;

/*----------------------------------------------------------------------
    Declarations
----------------------------------------------------------------------*/

extern sword
    _pascal vsprintf (TCHAR *__buf, const TCHAR *__format, va_list __args);

extern sword
    _cdecl sprintf (TCHAR *__buf, const TCHAR *__format, ...);

/*----------------------------------------------------------------------
    General information on streams:
        Applications wanting to use streams for buffered input
        are welcome to, but must be careful not to intermix
        calls to the C stdio library & the PC/GEOS file system.
        If one would like to convert a PC/GEOS file handle to a
        buffered stream, used fdopen() & fdclose().

    modeString:
              Read/Write modes - [r, w, a], +, b - (no default)
              ----------------
              r:		open for reading
              w:		open for writing (create/truncate)
              a:		append mode (currently not supported)
              b:		binary mode (currently not supported)
              +:		allow both r/w

              Deny modes - [E, N, R, W] - (E is default)
              ----------
              E		deny everyone (exclusive access)
              N		deny none
              R		deny read
              W		deny write

              Other modes - V - (PC/GEOS file is default)
              -----------
              V		native file
----------------------------------------------------------------------*/

/*
  FOPEN: opens the file whose name is the string pointed to by filename.
         The file is opened in the mode indicated by the modeString.
     Returns a stream fptr if successful, or NULL if not.
*/
extern FILE *
  _pascal fopen (const char *_filename, const char * _modeString);

/*
  FDOPEN: opens the file whose handle is passed in fileHan. The stream
          is opened in the mode indicated by the modeString. Returns
      a stream fptr if successful, or NULL if not.
*/
extern FILE *
  _pascal fdopen (FileHandle _fileHan, const char * _modeString);

/*
  FCLOSE: closes the file. Returns zero if the file was successfully closed,
          EOF if any errors were detected.
*/
extern int
  _pascal fclose (FILE *_stream);

/*
  FDCLOSE: closes the stream. Returns the PC/GOEOS file handle associated
           with the stream (the opposite of fdopen).
*/
extern FileHandle
  _pascal fdclose (FILE *_stream);

/*
  FSEEK: sets the file position indicator for the file. Returns nonzero for
         a request that can't be satisfied.
*/
extern int
  _pascal fseek (FILE *_stream,dword _posOrOffset, word _mode);

/*
  FTELL: obtains the current position of the file position indicator for the
          file. Returns the current value of the position indicator if
          successful, if unsuccessful, returns -1L.
*/
extern dword
  _pascal ftell (FILE *_stream);

/*
  FWRITE: writes from the array pointed to by buf, up to nmemb elements of
          elSize. Returns the number of elements successfuly written, this
          will be less than nmemb if there was an error.
*/
extern word
  _pascal fwrite (const void * _buf,word _elSize, word _nmemb, FILE *_stream);

/*
  FREAD: reads into the array pointed to by buf, nmemb elements of elSize from
         the file. Returns the number of elements successfully read.
*/
extern word
  _pascal fread (void * _buf, word _elSize, word _nmemb, FILE *_stream);

/*
  FGETC: reads one char from the file associated with the stream.
         Returns char as an integer or EOF if error.
 */
extern int
  _pascal fgetc (FILE *_stream);

/*
  FGETS: reads in a string ending in a newline of EOF and adds a NULL
       terminateor to the end.
     Returns the buffer passed in
*/

extern char *
  _pascal fgets (char *buffer, int buflength, FILE *_stream);

/*
  FEOF:	returns non-zero if the EOF (end-of-file) has been reached
*/
extern int
  _pascal feof (FILE *_stream);

/*
  FFLUSH: flushes stream buffer to file (if required).
 */

extern int
  _pascal fflush (FILE *_stream);

/*
  RENAME:
        renames the file named by old name to new name. Returns zero if the
        operation succeeds, nonzero if it fails
*/
extern int
  _pascal rename (const char * _oldName, const char * _newName);

#ifdef __HIGHC__
pragma Alias(vsprintf, "VSPRINTF");
pragma Alias(sprintf, "_sprintf");
pragma Alias(fopen, "FOPEN");
pragma Alias(fdopen, "FDOPEN");
pragma Alias(fclose, "FCLOSE");
pragma Alias(fdclose, "FDCLOSE");
pragma Alias(fseek, "FSEEK");
pragma Alias(ftell, "FTELL");
pragma Alias(fwrite, "FWRITE");
pragma Alias(fread, "FREAD");
pragma Alias(fgetc, "FGETC");
pragma Alias(fgets, "FGETS");
pragma Alias(feof, "FEOF");
pragma Alias(fflush, "FFLUSH");
pragma Alias(rename, "RENAME");
#endif

#endif  /* __STDIO_H  */


Ansi\stdlib.h

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) GeoWorks 1992 -- All Rights Reserved

PROJECT:	Ansi C Library
MODULE:		AnsiC
FILE:		stdlib.h

AUTHOR:		Allen Schoonmaker, Jun 11, 1992

METHODS:

Name			Description
----			-----------

FUNCTIONS:

Scope	Name			Description
-----	----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    AS	6/11/92   	Initial version.

DESCRIPTION:
    This is the header file for the ANSI C stdlib.h header file

    $Id: stdlib.h,v 1.7.6.1 96/04/28 08:30:49 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef __STDLIB_H
#define __STDLIB_H

#include  <geos.h>
extern int
    _pascal atoi  (const TCHAR *__s);

/*
 *	Notes about using the various malloc-esque routines:
 *
 *	There is no synchronization being done. If you will be calling
 *	malloc routines from multiple threads, you should provide your
 *	own synchronization around the calls.
 *
 *	malloc(), calloc(), realloc(), and free() all work on a heap associated
 *	with the Geode associated with the current process. If you want to
 *	use a heap associated with another geode, you should call _Malloc,
 *	_Realloc, and _Free, and explicitly pass in the geode whose
 *	heap you want to use (this is useful for libraries that want to
 *	perform mallocs).
 */
extern void
    *_pascal _Malloc (word blockSize, GeodeHandle geodeHan, word zeroInit);

#define malloc (blockSize) _Malloc(blockSize,NullHandle,0)

#define calloc (n, size) _Malloc(n*size,NullHandle,1)

/*
 *	Notes about realloc()/_ReAlloc():
 *
 *	1) If the space is resized larger, new space is *not* zero-initialized.
 *
 *	2) If realloc() is called to resize the memory *smaller*, it will
 *	   always succeed.
 *
 *	3) If realloc() does not succeed, it will return NULL, and the original
 *	   memory block will be unaffected.
 *
 *	4) If the passed blockPtr is NULL, realloc() acts like malloc().
 *
 *	5) If the passed newSize is 0, the passed blockPtr is freed, and
 *	   NULL is returned.
 *
 */
extern void
    *_pascal _ReAlloc (void *blockPtr, word newSize, GeodeHandle geodeHan);

#define realloc (blockPtr,newSize) _ReAlloc(blockPtr, newSize, NullHandle)

extern void
    _pascal _Free (void *blockPtr, GeodeHandle geodeHan);

#define free (blockPtr) _Free(blockPtr, NullHandle);

extern void
    _pascal qsort (void *array, word count, word elementSize,
          PCB(int, compare, (const void *, const void *)));

extern void
    *_pascal bsearch (const void *key, const void *array,
             word count, word elementSize,
             PCB(int, compare, (const void *, const void *)));

#ifdef __HIGHC__
pragma Alias(atoi, "ATOI");
pragma Alias(_Malloc, "_MALLOC");
pragma Alias(_ReAlloc, "_REALLOC");
pragma Alias(_Free, "_FREE");
pragma Alias(qsort, "QSORT");
pragma Alias(bsearch, "BSEARCH");
#endif

#endif

/* This stuff has gotta go ! *

#define cfree free
*/


streamC.h

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) GeoWorks 1993 -- All Rights Reserved

PROJECT:	GEOS
MODULE:		Include
FILE:		streamC.h

AUTHOR:		John D. Mitchell

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    JDM	93.07.08	Initial version.
    JDM	93.07.25	Mask/offset value switch.

DESCRIPTION:
    This file contains all of the interface information for using the
    GEOS C Stream Driver library.

    $Id: streamC.h,v 1.9.1.2 96/09/07 16:12:24 cthomas Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _STREAMC_H_
#define _STREAMC_H_

#include  <serialDr.h> 		/* serial specific definitions */
#include  <parallDr.h> 		/* parallel specific definitions */

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Stream Types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * StreamRoles indicates which side of the connection one is interested in.
 */
typedef	enum
{
    STREAM_ROLES_WRITER		= 0,
    STREAM_ROLES_READER		= -1,
    STREAM_ROLES_BOTH		= -2
} StreamRoles} ;

/*
 * StreamBlocker indicates whether the read/write should block or not.
 */
typedef	enum
{
    STREAM_BLOCK		= 2,
    STREAM_NO_BLOCK		= 0
} StreamBlocker} ;

typedef enum
{
        STREAM_DISCARD    	 = 0,
    STREAM_LINGER	 = -1
} StreamLingerMode} ;

/*
 * StreamError indicates the nature of errors common to all stream drivers.
 * This is the error returned from most all Stream*, Serial* & Parallel*
 * routines.  Note that this will not indicate device-specific errors. Use
 * StreamGetError/SerialGetError/ParallelGetErorr for this purpose.
 */
typedef	enum
{
    STREAM_NOT_IMPLEMENTED	 = -1,
    /* Used only in functions not implemented */

    STREAM_NO_ERROR	 = 0,
    /* Returned if no StreamError */

    STREAM_WOULD_BLOCK		= 1,
    /* Operation would block when  no blocking is allowed. This
       is only returned if no part of the request could be
       satisfied. */

    STREAM_CLOSING			= 2,
    /* Cannot write -- stream is being closed */

    STREAM_CANNOT_ALLOC		= 3,
    /* Cannot create -- unable to allocate buffer */

    STREAM_BUFFER_TOO_LARGE		= 4,
    /* Cannot create -- buffer size is too large (32K max) */

    STREAM_CLOSED			= 5,
    /* Cannot access -- stream is not open */

    STREAM_SHORT_READ_WRITE	 = 6,
    /* Read or write with STREAM_BLOCK and stream closed before
       operation could complete.  */

    STREAM_NO_DEVICE	 	= 7,
     /* Attempting to open a device-based stream (e.g. parallel
        or serial port) when the device requested doesn't exist.  */

    STREAM_DEVICE_IN_USE	 	= 8,
    /* SOF_NOBLOCK or SOF_TIMEOUT given and device is in-use.  */

    STREAM_POWER_ERROR	 	= 9
    /* Tried to open the requested port, but couldn't due to
       some error in the power driver */

} StreamError} ;

#define STREAM_FIRST_DEV_ERROR      256	/* Start of range stream-based drivers
                       can use for their StreamErrors */

/*
 * StreamToken identifies a stream.
 */
typedef	Handle	StreamToken	;

/*
 * StreamOpenFlags indicate the manner in which the stream should be
 * opened.
 */
typedef	enum
{
    STREAM_OPEN_NO_BLOCK		= 0x01,
    STREAM_OPEN_TIMEOUT		= 0x02
} StreamOpenFlags} ;

/*
 * StreamNotifyMode indicates the way of notification.
 */
typedef	enum
{
    STREAM_MODE_NONE	,
    STREAM_MODE_ROUTINE	,
    STREAM_MODE_MESSAGE		/* This is *not* supported in C.	*/
} StreamNotifyMode} ;

/*
 * StreamNotifyEvent specifies which notifications we're interested in.
 */
typedef	enum
{
    STREAM_EVENT_ERROR	,
    STREAM_EVENT_DATA	,
    SERIAL_EVENT_MODEM
} StreamNotifyEvent} ;

/*
 * StreamNotifyType is how we tell the driver all about what notifications
 * we're interested in.
 */
typedef	ByteFlags StreamNotifyType ;
#define	STREAM_TYPE_READER_OFFSET		(5)
#define	STREAM_TYPE_READER			(0x01 << STREAM_TYPE_READER_OFFSET)

#define	STREAM_TYPE_EVENT_OFFSET		(2)
#define	STREAM_TYPE_EVENT			(0x07 << STREAM_TYPE_EVENT_OFFSET)

#define	STREAM_TYPE_HOW_OFFSET			(0)
#define	STREAM_TYPE_HOW				(0x01 << STREAM_TYPE_HOW_OFFSET)

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Driver Types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * DriverPassParams is used to pass arguments into DriverCallEntryPoint.
 */
typedef	struct
{
    word	ax;
    word	bx;
    word	cx;
    word	dx;
    word	si;
    word	bp;
    word	ds;
    word	es;
} DriverPassParams} ;

/*
 * DriverPassParams is used to return results from DriverCallEntryPoint.
 */
typedef	struct
{
    word	ax;
    word	bx;
    word	cx;
    word	dx;
    word	si;
    word	di;
    word	bp;
    word	ds;
    word	es;
    CPUFlags	flags;
} DriverReturnParams} ;

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Prototypes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

/*
 * Generic Driver routines.
 */
extern	void
    _pascal DriverCallEntryPoint  (Handle driver,
                      word func,
                      DriverPassParams *passParams,
                      DriverReturnParams *returnParams);

/*
 * Stream Driver routines.
 *
 * NOTE:  StreamError == 0 indicates that no StreamError has occurred.
 *
 */
extern	StreamError
    _pascal StreamGetDeviceMap  (Handle driver, word *retInfo);

extern	StreamError
    _pascal StreamOpen  (Handle driver,
                word buffSize,
                GeodeHandle owner,
                HeapFlags heapFlags,
                StreamToken *stream);

extern	StreamError
    _pascal StreamClose  (Handle driver,
                 StreamToken stream,
                 StreamLingerMode linger);

extern	StreamError	/* NOT implemented.	*/
    _pascal StreamSetNotify  (Handle driver,
                      StreamToken stream,
                 word *status);

extern  StreamError
           _pascal StreamSetMessageNotify  (Handle driver,
                        StreamToken stream,
                    StreamNotifyType type,
                    Message msg,
                    optr destination);
     /* Message should be defined as follows:

        STREAM_EVENT_DATA:
        @message void NAME(word numAvail = cx, StreamToken stream = dx,
                   StreamRoles side = bp);

        STREAM_EVENT_ERROR:
        @message void NAME(ErrorType error = cx, StreamToken stream = dx);

        SERIAL_EVENT_MODEM:
        @message void NAME(SerialModemStatus status = cx,
                           StreamToken stream = dx);

        Note that "stream" will *not* be the unit number for the parallel
        or serial drivers.
      */

/*
 * Prototype for the notification routine to be passed to StreamSetRoutineNotify
 * for the SNE_ERROR, SNE_MODEM, SNE_PASSIVE events, and the SNE_DATA event
 * when the notification threshold is any value other than 1. For all events,
 * the "data" parameter is the same as the "data" parameter passed to
 * StreamSetRoutineNotify. The cxValue and bpValue parameters are as follows:
 *
 *	SNE_DATA:   	cxValue = # bytes available for reading or writing
 *		    	bpValue = STREAM_READ or STREAM_WRITE
 *	SNE_ERROR:  	cxValue = the error word (driver-specific)
 *	       	    	bpValue = undefined
 *	SNE_PASSIVE:	cxValue	= SerialPassiveNotificationStatus
 *	    	    	bpValue	= the port number
 *	SNE_MODEM:  	cxValue	= SerialModemStatus
 *	    	    	bpValue = undefined
 */
typedef void _pascal StreamGeneralNotifyRoutine (word data,
                        word cxValue,
                        word bpValue);

/*
 * Prototype for the notification routine to be passed to StreamSetRoutineNotify
 * for the SNE_DATA event when the notification threshold is 1. In this case,
 * the routine acts as an extension of the interrupt code, allowing it to see
 * each byte as it's received, or to fill each byte in the stream as space
 * becomes available.
 *
 * For the reading side:
 *	    cxValue = the byte just read
 *	    bpValue = STREAM_READ
 *	    return  = non-zero if the byte was consumed, 0 if the byte should
 *		      be placed into the input stream
 * For the writing side:
 *	    cxValue = undefined
 *	    bpValue = STREAM_WRITE
 *	    return  = formed using the STREAM_SPECIAL_WRITE_VALUE indicating
 *		      whether a byte to be written is being returned.
 */
typedef word _pascal StreamSpecialDataNotifyRoutine (word data,
                            word cxValue,
                            word bpValue);

#define STREAM_SPECIAL_WRITE_VALUE (addByte, value) \
        ((((addByte)&0xff)<<8) | ((value) & 0xff))

extern  StreamError
           _pascal StreamSetRoutineNotify  (Handle driver,
                        StreamToken stream,
                    StreamNotifyType type,
                    word data,
                    StreamGeneralNotifyRoutine *callback);

extern	StreamError
    _pascal StreamSetDataRoutineNotify  (Handle driver,
                        StreamToken stream,
                        StreamNotifyType type,
                        word data,
                        StreamGeneralNotifyRoutine *callback,
                        word threshold);

extern  StreamError
           _pascal StreamSetNoNotify  (Handle driver,
                   StreamToken stream,
                   StreamNotifyType type);

extern	StreamError
    _pascal StreamGetError  (Handle driver,
                StreamToken stream,
                StreamRoles roles,
                word *errorCode);
    /* NOTE:  errorCode is a device-specific code, such as SerialError
       or ParallelError */

extern	StreamError
    _pascal StreamSetError  (Handle driver,
                StreamToken stream,
                StreamRoles roles,
                word errorCode);
    /* NOTE:  errorCode is a device-specific code, such as SerialError
       or ParallelError */

extern	StreamError
    _pascal StreamFlush  (Handle driver,
                 StreamToken stream);

extern	StreamError
    _pascal StreamSetThreshold  (Handle driver,
                    StreamToken stream,
                    StreamRoles roles,
                    word threshold);

extern	StreamError
    _pascal StreamRead  (Handle driver,
                StreamToken stream,
                StreamBlocker blocker,
                word buffSize,
                byte *buffer,
                word *numBytesRead);

extern	StreamError
    _pascal StreamReadByte  (Handle driver,
                StreamToken stream,
                StreamBlocker blocker,
                byte *dataByte);

extern	StreamError
    _pascal StreamWrite  (Handle driver,
                 StreamToken stream,
                 StreamBlocker blocker,
                 word buffSize,
                 byte *buffer,
                 word *numBytesWritten);

extern	StreamError
    _pascal StreamWriteByte  (Handle driver,
                 StreamToken stream,
                 StreamBlocker blocker,
                 byte dataByte);

extern	StreamError
    _pascal StreamQuery  (Handle driver,
                 StreamToken stream,
                 StreamRoles role,
                 word *bytesAvailable);

extern	StreamError
    _pascal StreamEscLoadOptions  (Handle driver,
                      const char *category);

/*
 * Serial Driver routines.
 *
 * NOTE:  StreamError == 0 indicates that no StreamError has occurred.
 */
extern	Handle
    _pascal SerialLoadDriver (void);

#define SerialGetDeviceMap (driver, retInfo) \
        StreamGetDeviceMap((driver), (retInfo))

extern	StreamError
    _pascal SerialOpen  (Handle driver,
                SerialUnit unit,
                StreamOpenFlags flags,
                word inBuffSize,
                word outBuffSize,
                    word timeout);

extern	StreamError
    _pascal SerialClose  (Handle driver,
                 SerialUnit unit,
                 StreamLingerMode linger);

extern	StreamError
    _pascal SerialSetNotify  (Handle driver,
                      StreamToken stream,
                 SerialModemStatus *status);

#define SerialGetError (driver, unit, roles, errorCode) \
        StreamGetError((driver), (unit), (roles), (errorCode))

#define SerialSetError (driver, unit, roles, errorCode) \
        StreamSetError((driver), (unit), (roles), (errorCode))

extern	StreamError
    _pascal SerialFlush  (Handle driver,
                 SerialUnit unit,
                 StreamRoles roles);

#define SerialSetThreshold (driver, unit, roles, threshold) \
        StreamSetThreshold((driver), (unit), (roles), (threshold))

#define SerialRead (driver, unit, blocker, buffSize, buffer, numBytesRead) \
        StreamRead((driver), (unit), (blocker), (buffSize), (buffer), \
                    (numBytesRead))

#define SerialReadByte (driver, unit, blocker, dataByte) \
        StreamReadByte((driver), (unit), (blocker), (dataByte))

#define SerialWrite (driver, unit, blocker, buffSize, buffer, numWritten) \
        StreamWrite((driver), (unit), (blocker), (buffSize), (buffer), \
            (numWritten))

#define SerialWriteByte (driver, unit, blocker, dataByte) \
        StreamWriteByte((driver), (unit), (blocker), (dataByte))

#define SerialQuery (driver, unit, role, bytesAvailable) \
        StreamQuery((driver), (unit), (role), (bytesAvailable))

#define SerialEscLoadOptions (driver, category) \
        StreamEscLoadOptions((driver), (category))

extern	StreamError
    _pascal SerialSetFormat  (Handle driver,
                 SerialUnit unit,
                 SerialFormat format,
                 SerialMode mode,
                 SerialBaud baud);

extern	StreamError
    _pascal SerialGetFormat  (Handle driver,
                 SerialUnit unit,
                 SerialFormat *format,
                 SerialMode *mode,
                 SerialBaud *baud);

extern	StreamError
    _pascal SerialSetModem  (Handle driver,
                SerialUnit unit,
                SerialModem modem);

extern	StreamError
    _pascal SerialGetModem  (Handle driver,
                SerialUnit unit,
                SerialModem *modem);

extern	StreamError
    _pascal SerialOpenForDriver  (Handle driver,
                     SerialUnit unit,
                     StreamOpenFlags flags,
                     word inBuffSize,
                     word outBuffSize,
                     word timeout,
                     GeodeHandle owner);

extern	StreamError
    _pascal SerialSetFlowControl  (Handle driver,
                      SerialUnit unit,
                      SerialFlowControl flow,
                      SerialModem modem,
                      SerialModemStatus status);

extern	StreamError
    _pascal SerialDefinePort  (Handle driver,
                  word basePort,
                  byte interruptLevel,
                  SerialUnit *unit);

extern	StreamError
    _pascal SerialStatPort  (Handle driver,
                SerialUnit unit,
                word *interruptLevel,
                Boolean *portOpen);

extern	StreamError
    _pascal SerialCloseWithoutReset  (Handle driver,
                     SerialUnit unit,
                     StreamLingerMode linger);

extern  StreamError
        _pascal SerialSetRole  (Handle driver,
                   SerialUnit unit,
                   SerialRole role);

/*
 * Parallel Driver routines.
 *
 * NOTE:  StreamError == 0 indicates that no StreamError has occurred.
 *
 */
extern	Handle
    _pascal ParallelLoadDriver (void);

#define ParallelGetDeviceMap (driver, retInfo) \
        StreamGetDeviceMap((driver), (retInfo))

extern	StreamError
    _pascal ParallelOpen  (Handle driver,
                  ParallelUnit unit,
                  StreamOpenFlags flags,
                  word outBuffSize,
                  word timeout);

#define	ParallelClose	(driver, unit, linger) \
        StreamClose((driver), (unit), (linger))

#define	ParallelGetError	(driver, unit, roles, errorCode) \
        StreamGetError((driver), (unit), (roles), (errorCode))

extern	StreamError
    _pascal ParallelSetError  (Handle driver,
                  ParallelUnit unit,
                  StreamRoles roles,
                  ParallelError errorCode);

#define	ParallelFlush	(driver, unit, roles) SerialFlush((driver),(unit),(roles))

#define ParallelSetThreshold (driver, unit, roles, threshold) \
        StreamSetThreshold((driver), (unit), (roles), (threshold))

#define ParallelWrite (driver, unit, blocker, buffSize, buffer, numWritten) \
        StreamWrite((driver), (unit), (blocker), (buffSize), (buffer), \
                    (numWritten))

#define ParallelWriteByte (driver, unit, blocker, dataByte) \
        StreamWriteByte((driver), (unit), (blocker), (dataByte))

extern	StreamError
    _pascal ParallelQuery  (Handle driver,
                   ParallelUnit unit,
                   Boolean *printerBusy);

#define ParallelEscLoadOptions (driver, category) \
        StreamEscLoadOptions((driver), (category))

extern	StreamError
    _pascal ParallelMaskError  (Handle driver,
                   ParallelUnit unit,
                   ParallelError errorMask);

extern	StreamError
    _pascal ParallelTimeout  (Handle driver,
                 ParallelUnit unit,
                 word waitSeconds);

extern	StreamError
    _pascal ParallelRestart  (Handle driver,
                 ParallelUnit unit,
                 Boolean resendPending);

extern	StreamError
    _pascal ParallelVerify  (Handle driver,
                ParallelUnit unit,
                ParallelError *error);

extern	StreamError
    _pascal ParallelSetInterrupt  (Handle driver,
                      ParallelUnit unit,
                      ParallelInterrupt pInt);

extern	StreamError
    _pascal ParallelStatPort  (Handle driver,
                  ParallelUnit unit,
                  byte *interruptLevel,
                  byte *portOpen);

#ifdef	__HIGHC__
pragma	Alias (DriverCallEntryPoint,	"DRIVERCALLENTRYPOINT");

pragma	Alias (StreamGetDeviceMap,	"STREAMGETDEVICEMAP");
pragma	Alias (StreamOpen,		"STREAMOPEN");
pragma	Alias (StreamClose,		"STREAMCLOSE");
pragma	Alias (StreamSetMessageNotify, 	"STREAMSETMESSAGENOTIFY");
pragma	Alias (StreamSetRoutineNotify, 	"STREAMSETROUTINENOTIFY");
pragma	Alias (StreamSetDataRoutineNotify, "STREAMSETDATAROUTINENOTIFY");
pragma	Alias (StreamSetNoNotify, 	"STREAMSETNONOTIFY");
pragma	Alias (StreamSetNotify,		"STREAMSETNOTIFY");
pragma	Alias (StreamGetError,		"STREAMGETERROR");
pragma	Alias (StreamSetError,		"STREAMSETERROR");
pragma	Alias (StreamFlush,		"STREAMFLUSH");
pragma	Alias (StreamSetThreshold,	"STREAMSETTHRESHOLD");
pragma	Alias (StreamRead,		"STREAMREAD");
pragma	Alias (StreamReadByte,		"STREAMREADBYTE");
pragma	Alias (StreamWrite,		"STREAMWRITE");
pragma	Alias (StreamWriteByte,		"STREAMWRITEBYTE");
pragma	Alias (StreamQuery,		"STREAMQUERY");
pragma	Alias (StreamEscLoadOptions,	"STREAMESCLOADOPTIONS");

pragma	Alias (SerialLoadDriver,    	"SERIALLOADDRIVER");
pragma	Alias (SerialOpen,		"SERIALOPEN");
pragma	Alias (SerialClose,		"SERIALCLOSE");
pragma	Alias (SerialSetNotify,		"SERIALSETNOTIFY");
pragma	Alias (SerialFlush,		"SERIALFLUSH");
pragma	Alias (SerialSetFormat,		"SERIALSETFORMAT");
pragma	Alias (SerialGetFormat,		"SERIALGETFORMAT");
pragma	Alias (SerialSetModem,		"SERIALSETMODEM");
pragma	Alias (SerialGetModem,		"SERIALGETMODEM");
pragma	Alias (SerialOpenForDriver,	"SERIALOPENFORDRIVER");
pragma	Alias (SerialSetFlowControl,	"SERIALSETFLOWCONTROL");
pragma	Alias (SerialDefinePort,	"SERIALDEFINEPORT");
pragma	Alias (SerialStatPort,		"SERIALSTATPORT");
pragma	Alias (SerialCloseWithoutReset,	"SERIALCLOSEWITHOUTRESET");
pragma  Alias (SerialSetRole,           "SERIALSETROLE");

pragma	Alias (ParallelLoadDriver,    	"PARALLELLOADDRIVER");
pragma	Alias (ParallelOpen,		"PARALLELOPEN");
pragma	Alias (ParallelQuery,		"PARALLELQUERY");
pragma	Alias (ParallelMaskError,	"PARALLELMASKERROR");
pragma	Alias (ParallelTimeout,		"PARALLELTIMEOUT");
pragma	Alias (ParallelRestart,		"PARALLELRESTART");
pragma	Alias (ParallelVerify,		"PARALLELVERIFY");
pragma	Alias (ParallelSetInterrupt,	"PARALLELSETINTERRUPT");
pragma	Alias (ParallelStatPort,	"PARALLELSTATPORT");
#endif /* __HIGHC__ */

#endif /* _STREAMC_H_ */


Ansi\string.h

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) GeoWorks 1991 -- All Rights Reserved

PROJECT:        GEOS
MODULE:         Standard C Library
FILE:           string.h

AUTHOR:         Tony Requist

REVISION HISTORY:
    Name    Date            Description
    ----    ----            -----------
    Tony    91.02.01        Initial version.
    JDM     93.03.23        Updated.

DESCRIPTION:
    This file contains the GEOS implementation of the Standard C
    library string.h file.

    $Id: string.h,v 1.25.6.1 96/04/28 08:30:48 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef __STRING_H
#define __STRING_H

/* Define NULL if it hasn't been already.       */
#ifndef NULL
#define NULL     (0)
#endif

#include  <geos.h>

/* Define size_t.	*/
typedef	unsigned int size_t ;

extern void
  *_pascal memchr  (const void *__s, int __c, size_t __n);

extern int
  _pascal memcmp  (const void *__dest, const void *__src, size_t __n);

extern void
  *_pascal memcpy  (void *__dest, const void *__src, size_t __n);

extern void
  *_pascal memmove  (void *__dest, const void *__src, size_t __n);

extern void
  *_pascal memset  (void *__dest, int __c, size_t __n);

extern word
  _pascal strlen  (const TCHAR *__str);
extern word
  _pascal STRLEN  (const TCHAR *__str);

extern TCHAR
  *_pascal strchr  (const TCHAR *__s, int __c);

extern TCHAR
  *_pascal strrchr  (const TCHAR *__s, int __c);

/*
 * WARNING: Only use "strcmp()" and "strncmp()" if:
 *
 *      a) You only want to know if the 2 strings are equal or not
 *
 *              - or -
 *
 *      b) You are sure that the 2 strings consist entirely of standard
 *         ASCII characters.
 *
 *      If you need to know the lexicographical order of the strings, and if
 *      the strings can contain extended-ASCII characters (values > 0x80), you
 *      should be calling "LocalCmpStrings()".
 *
 *      Also, you may not make any assumptions as to whether a character is
 *      a byte, or a word.
 *
 */
extern int
  _pascal strncmp  (const TCHAR *__s, const TCHAR *__t, const size_t __n);

extern int
  _pascal strcmp  (const TCHAR *__s, const TCHAR *__t);

extern TCHAR
  *_pascal strcat  (TCHAR *__s, const TCHAR *__t);
extern TCHAR
  *_pascal strncat  (TCHAR *__s, const TCHAR *__t, const size_t __n);

extern TCHAR
  *_pascal strcpy (TCHAR *__s, const TCHAR *__t);
extern TCHAR
  *_pascal strncpy  (TCHAR *__s, const TCHAR *__t, const size_t __n);

extern word
  _pascal strcspn  (const TCHAR *__s, const TCHAR *__set);

extern word
  _pascal strspn  (const TCHAR *__s, const TCHAR *__set);

extern TCHAR
  *_pascal strpbrk  (const TCHAR *__s, const TCHAR *__set);

extern TCHAR
  *_pascal strstr (const TCHAR *__s, const TCHAR *__t);

#define strcoll (s,t) LocalCmpStrings((s),(t),0)

#ifdef __HIGHC__
pragma Alias(memchr,    "MEMCHR");
pragma Alias(memcmp,    "MEMCMP");
pragma Alias(memcpy,    "MEMCPY");
pragma Alias(memmove,   "MEMMOVE");
pragma Alias(memset,    "MEMSET");
pragma Alias(strlen,    "STRLEN");
pragma Alias(strchr,    "STRCHR");
pragma Alias(strrchr,   "STRRCHR");
pragma Alias(strncmp,   "STRNCMP");
pragma Alias(strcmp,    "STRCMP");
pragma Alias(strcat,    "STRCAT");
pragma Alias(strncat,   "STRNCAT");
pragma Alias(strcpy,    "STRCPY");
pragma Alias(strncpy,   "STRNCPY");
pragma Alias(strcspn,   "STRCSPN");
pragma Alias(strspn,    "STRSPN");
pragma Alias(strpbrk,   "STRPBRK");
pragma Alias(strstr,    "STRSTR");

#endif

#endif


Objects\styles.goh

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	styles.goh
 * AUTHOR:	Tony Requist: February 1, 1991
 *
 * DECLARER:	Style Library
 *
 * DESCRIPTION:
 *	This file defines style sheet stuff.
 *
 *	$Id: styles.goh,v 1.21.20.1 96/04/28 08:31:01 chris Exp $
 *
 ***********************************************************************/
@optimize

@deflib styles

extern void			/* Not yet implemented */
    _pascal StyleSheetCopyElement ();

extern void			/* Not yet implemented */
    _pascal StyleSheetImportStyles ();

extern void			/* Not yet implemented */
    _pascal StyleSheetDescribeStyle ();

extern void			/* Not yet implemented */
    _pascal StyleSheetDescribeAttrs ();

extern void			/* Not yet implemented */
    _pascal StyleSheetGetStyle ();

extern void			/* Not yet implemented */
    _pascal StyleSheetGetStyleCounts ();

extern void			/* Not yet implemented */
    _pascal StyleSheetRequestEntryMoniker ();

extern void			/* Not yet implemented */
    _pascal StyleSheetUpdateModifyBox ();

extern void			/* Not yet implemented */
    _pascal StyleSheetModifyStyle ();

extern void			/* Not yet implemented */
    _pascal StyleSheetDeleteStyle ();

extern void			/* Not yet implemented */
    _pascal StyleSheetDefineStyle ();

extern void			/* Not yet implemented */
    _pascal StyleSheetRedefineStyle ();

extern void			/* Not yet implemented */
    _pascal StyleSheetGetStyleToApply ();

extern void			/* Not yet implemented */
    _pascal StyleSheetGetNotifyCounter ();

extern void			/* Not yet implemented */
    _pascal StyleSheetIncNotifyCounter ();

extern void			/* Not yet implemented */
    _pascal StyleSheetOpenFileForImport ();

typedef struct {
    word	SSDWE_value;
    ChunkHandle	SSDWE_name;
} SSDescribeWordEntry} ;

typedef ByteFlags SSDiffFlags ;
#define SSDF_NEW_CATEGORY 	0x80

typedef struct {
    byte	SSDE_offset;
    word	SSDE_mask;
    word	SSDE_routine;
    SSDiffFlags	SSDE_flags;
} SSDiffEntry} ;

typedef struct {
    byte	SSME_offset;
    word	SSME_mask;
    word	SSME_routine;
    word	SSME_data;
} SSMergeEntry} ;

typedef WordFlags SSDescribeDistanceFlags ;
#define SSDDF_RELATIVE 				0x8000
#define SSDDF_PLURAL_FOR_NON_RELATIVE_IF_NEEDED 	0x4000

extern void
    _pascal StyleSheetCallDescribeRoutines ();

extern void				/* Not yet implemented */
    _pascal StyleSheetCallMergeRoutines ();

extern void				/* Not yet implemented */
    _pascal StyleSheetDescribeExclusiveWord ();

extern void				/* Not yet implemented */
    _pascal StyleSheetDescribeNonExclusiveWord ();

extern void				/* Not yet implemented */
    _pascal StyleSheetDescribeWWFixed ();

extern void				/* Not yet implemented */
    _pascal StyleSheetDescribeDistance ();

extern void				/* Not yet implemented */
    _pascal StyleSheetAddNameFromChunk ();

extern void				/* Not yet implemented */
    _pascal StyleSheetAddCharToDescription ();

extern void				/* Not yet implemented */
    _pascal StyleSheetAddAttributeHeader ();

extern void				/* Not yet implemented */
    _pascal StyleSheetLockStyleChunk ();

extern void				/* Not yet implemented */
    _pascal StyleSheetUnlockStyleChunk ();

extern void				/* Not yet implemented */
    _pascal StyleSheetGenerateChecksum ();

extern void				/* Not yet implemented */
    _pascal StyleSheetAddNameFromPtr ();

extern void				/* Not yet implemented */
    _pascal StyleSheetAddWord ();

typedef struct {
    optr	SSCLIP_list;
    word	SSCLIP_defaultEntries;
    word	SSCLIP_toolboxFlag;
    word	SSCLIP_entryNumber;
} SSCListInteractionParams} ;

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_REQUEST_ENTRY_MONIKER ();

typedef struct {
    word	SSCUMP_usedIndex;
    optr	SSCUMP_textObject;
    optr	SSCUMP_attrList;
    optr	SSCUMP_baseList;
    optr	SSCUMP_extraUI;
} SSCUpdateModifyParams} ;

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_UPDATE_MODIFY_BOX ();

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_MODIFY_STYLE ();

typedef struct {
    optr	SSCDAP_textObject;
    optr	SSCDAP_attrList;
    word	SSCDAP_attrTokens[MAX_STYLE_SHEET_ATTRS];
    optr	SSCDAP_extraUI;
} SSCDescribeAttrsParams} ;

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_DESCRIBE_ATTRS ();

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_DESCRIBE_STYLE ();

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_APPLY_STYLE ();

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_DELETE_STYLE ();

typedef struct {
    word	SSCDSP_attrTokens[MAX_STYLE_SHEET_ATTRS];
    word	SSCDSP_baseStyle;
    optr	SSCDSP_attrList;
    optr	SSCDSP_textObject;
    optr	SSCDSP_extraUI;
    byte	SSCDSP_reserved[6];
} SSCDefineStyleParams} ;

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_DEFINE_STYLE ();

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_REDEFINE_STYLE ();

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_RETURN_TO_BASE_STYLE ();

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_LOAD_STYLE_SHEET ();

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_SAVE_STYLE ();

@importMessage MetaStylesMessages, void MSG_META_STYLED_OBJECT_RECALL_STYLE ();

/*****************/

@class StyleSheetControlClass, GenControlClass;

@message void MSG_STYLE_SHEET_GET_MODIFY_UI ();
@message void MSG_STYLE_SHEET_GET_DEFINE_UI ();
@message void MSG_STYLE_SHEET_SET_SAVED_STYLE ();

@message void MSG_SSC_SELECT_STYLE ();
@message void MSG_SSC_STATUS_STYLE ();
@message void MSG_SSC_QUERY_STYLE ();
@message void MSG_SSC_QUERY_BASE_STYLE ();
@message void MSG_SSC_APPLY_STYLE ();
@message void MSG_SSC_APPLY_BOX_STYLE ();
@message void MSG_SSC_APPLY_TOOLBOX_STYLE ();
@message void MSG_SSC_INITIATE_MODIFY_STYLE ();
@message void MSG_SSC_MODIFY_STYLE ();
@message void MSG_SSC_DELETE_STYLE ();
@message void MSG_SSC_DELETE_REVERT_STYLE ();
@message void MSG_SSC_DEFINE_STYLE ();
@message void MSG_SSC_REDEFINE_STYLE ();
@message void MSG_SSC_RETURN_TO_BASE_STYLE ();
@message void MSG_SSC_LOAD_STYLE_SHEET ();
@message void MSG_SSC_LOAD_STYLE_SHEET_FILE_SELECTED ();
@message void MSG_SSC_SAVE_STYLE ();
@message void MSG_SSC_RECALL_STYLE ();

typedef WordFlags SSCFeatures ;
#define SSCF_DEFINE 		0x0080
#define SSCF_REDEFINE 		0x0040
#define SSCF_RETURN_TO_BASE 	0x0020
#define SSCF_APPLY 		0x0010
#define SSCF_MANAGE 		0x0008
#define SSCF_LOAD 		0x0004
#define SSCF_SAVE_STYLE 		0x0002
#define SSCF_RECALL_STYLE 	0x0001

typedef WordFlags SSCToolboxFeatures ;
#define SSCTF_REDEFINE 		0x0010
#define SSCTF_RETURN_TO_BASE 	0x0008
#define SSCTF_STYLE_LIST 	0x0004
#define SSCTF_SAVE_STYLE     	0x0002
#define SSCTF_RECALL_STYLE   	0x0001

#define SSC_DEFAULT_FEATURES   (SSCF_DEFINE | SSCF_REDEFINE \
                | SSCF_RETURN_TO_BASE \
                | SSCF_APPLY | SSCF_MANAGE | SSCF_LOAD \
                                | SSCF_SAVE_STYLE | SSCF_RECALL_STYLE)
#define SSC_DEFAULT_TOOLBOX_FEATURES   (SSCTF_STYLE_LIST | SSCTF_SAVE_STYLE \
                                       | SSCTF_RECALL_STYLE)

typedef struct {
    NameArrayMaxElement	NSC_style;
    word		NSC_styleToken;
    word		NSC_usedIndex;
    word		NSC_usedToolIndex;
    word		NSC_styleSize;
    word		NSC_attrTokens[MAX_STYLE_SHEET_ATTRS];
    dword		NSC_attrChecksums[MAX_STYLE_SHEET_ATTRS];
    byte		NSC_indeterminate;
    byte		NSC_differsFromBase;
    byte		NSC_canReturnToBase;
    word		NSC_styleCounter;
} NotifyStyleChange} ;

typedef struct {
    StyleChunkDesc	NSSHC_styleArray;
    word		NSSHC_counter;
    word		NSSHC_styleCount;
    word		NSSHC_toolStyleCount;
} NotifyStyleSheetChange} ;

    @vardata GenFilePath ATTR_STYLE_SHEET_LOAD_STYLE_SHEET_PATH;

    @vardata GeodeToken ATTR_STYLE_SHEET_LOAD_STYLE_SHEET_TOKEN;

    @vardata optr TEMP_STYLE_SHEET_MANAGE_UI;
    @vardata optr TEMP_STYLE_SHEET_DEFINE_UI;

typedef struct {
    word	SSCTAI_attrTokens[MAX_STYLE_SHEET_ATTRS];
    word	SSCTAI_baseStyle;
    byte	SSCTAI_differsFromBase;
    byte	SSCTAI_indeterminate;
} SSCTempAttrInfo} ;

    @vardata SSCTempAttrInfo TEMP_SYTLE_SHEET_ATTR_TOKENS;

    @vardata MemHandle TEMP_SYTLE_SHEET_SAVED_STYLE;

    @default GCI_output = (TO_APP_TARGET);

@instance ClassStruct 	*SSCI_targetClass = NullClass;
@instance ClassStruct 	*SSCI_styledClass = NullClass;

@endc

@endlib


stylesh.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	stylesh.h
 * AUTHOR:	Tony Requist: February 1, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines style sheet structures
 *
 *	$Id: stylesh.h,v 1.5.22.1 96/04/28 08:28:01 chris Exp $
 *
 ***********************************************************************/

#ifndef	__STYLESH_H
#define __STYLESH_H

#include  "chunkarr.h"

typedef struct {
    RefElementHeader	SSEH_meta;
    word		SSEH_style;
} StyleSheetElementHeader} ;

typedef WordFlags StyleElementFlags ;
#define SEF_DISPLAY_IN_TOOLBOX 	0x8000

typedef struct {
    NameArrayElement	SEH_meta;
    word		SEH_baseStyle;
    StyleElementFlags	SEH_flags;
    byte		SEH_reserved[6];
    dword		SEH_privateData;
} StyleElementHeader} ;

typedef struct {
    VMFileHandle	SCD_vmFile;
    word		SCD_vmBlockOrMemHandle;
    ChunkHandle		SCD_chunk;
} StyleChunkDesc} ;

#define MAX_STYLE_SHEET_ATTRS 		4

typedef struct {
    void		*SSP_descriptionCallbacks[MAX_STYLE_SHEET_ATTRS];
    void		*SSP_specialDescriptionCallback;
    void		*SSP_mergeCallbacks[MAX_STYLE_SHEET_ATTRS];
    void		*SSP_substitutionCallbacks[MAX_STYLE_SHEET_ATTRS];
    StyleChunkDesc	SSP_styleArray;
    StyleChunkDesc	SSP_attrArrays[MAX_STYLE_SHEET_ATTRS];
    word		SSP_attrTokens[MAX_STYLE_SHEET_ATTRS];
    StyleChunkDesc	SSP_xferStyleArray;
    StyleChunkDesc	SSP_xferAttrArrays[MAX_STYLE_SHEET_ATTRS];
} StyleSheetParams} ;

#endif


Foam\sysapp.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    (c) Copyright Geoworks 1997.  All rights reserved.
            GEOWORKS CONFIDENTIAL

PROJECT:
MODULE:
FILE:		sysapp.goh

AUTHOR:		Steve Kertes, Mar  3, 1997

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    SK	3/ 3/97   	Initial version.

DESCRIPTION:

    .goh file for the system app that lives in Apps/FApps/System

    MSG_SP_SILENT_FOR_TIMER_EXPIRED needs to be known by the phone
    app so we put the declaration of the SystemProcessClass in a
    global place.

    Be sure to update the .def file as well!

    $Id: sysapp.goh,v 1.1.1.1 97/03/03 15:55:25 kertes Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@class SystemProcessClass, GenProcessClass;
/*------------------------------
 Messages
------------------------------*/
@message	void MSG_SP_SILENT_FOR_TIMER_EXPIRED  (word eventFlag = bp);
/*

     RTCM notification that the Silent_for timer has expired
     and we should turn sounds back on

     Pass:		bp = flag, non-zero if timer is late
     Return:	nothing
     Destroy:	everything

*/

@endc;


sysstats.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	sysstats.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines system statistics structures and routines.
 *
 *	$Id: sysstats.h,v 1.13.8.1 96/04/28 08:27:57 chris Exp $
 *
 ***********************************************************************/

#ifndef	__SYSSTATS_H
#define __SYSSTATS_H

typedef struct {
    word	SSI_paragraphs;
    word	SSI_blocks;
} SysSwapInfo} ;

typedef struct {
    dword	SS_idleCount;
    SysSwapInfo	SS_swapOuts;
    SysSwapInfo	SS_swapIns;
    word	SS_contextSwitches;
    word	SS_interrupts;
    word	SS_runQueue;
} SysStats} ;

extern void	/*XXX*/
    _pascal SysStatistics (SysStats *stats);

/***/

typedef enum /* word */ {
    SGIT_TOTAL_HANDLES    =0,
    SGIT_HEAP_SIZE    =2,
    SGIT_LARGEST_FREE_BLOCK    =4,
    SGIT_TOTAL_COUNT    =6,
    SGIT_NUMBER_OF_VOLUMES    =8,
    SGIT_TOTAL_GEODES    =10,
    SGIT_NUMBER_OF_PROCESSES    =12,
    SGIT_NUMBER_OF_LIBRARIES    =14,
    SGIT_NUMBER_OF_DRIVERS    =16,
    SGIT_CPU_SPEED    =18,
    SGIT_SYSTEM_DISK    =20,
    SGIT_UI_PROCESS    =22,
} SysGetInfoType} ;

extern dword	/*XXX*/
    _pascal SysGetInfo (SysGetInfoType info);

#ifdef __HIGHC__
pragma Alias(SysStatistics, "SYSSTATISTICS");
pragma Alias(SysGetInfo, "SYSGETINFO");
#endif

#endif


system.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	system.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines system related structures and routines.
 *
 *	$Id: system.h,v 1.34.1.4 97/07/15 13:59:33 eballot Exp $
 *
 ***********************************************************************/

#ifndef	__SYSTEM_H
#define __SYSTEM_H

#include  <geode.h> 	/* ProtocolNumber, ReleaseNumber */

/***/

typedef ByteFlags DosExecFlags ;
#define DEF_PROMPT 		0x80
#define DEF_FORCED_SHUTDOWN 	0x40
#define DEF_INTERACTIVE 		0x20

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _cdecl DosExec (const char *prog, DiskHandle progDisk, const char *arguments,
        const char *execDir, DiskHandle execDisk, DosExecFlags flags);

/***/

extern DiskHandle			/* Sets value for ThreadGetError() */	/*XXX*/
    _cdecl SysLocateFileInDosPath (const char *fname, char *buffer);

/***/

extern Boolean		/* true if error (not found) */	/*XXX*/
    _pascal SysGetDosEnvironment (const char *variable, char *buffer, word bufSize);

/***/

typedef WordFlags SysNotifyFlags ;
#define SNF_RETRY 	0x8000
#define SNF_EXIT 	0x4000
#define SNF_ABORT 	0x2000
#define SNF_CONTINUE 	0x1000
#define SNF_REBOOT 	0x0800
#define SNF_BIZARRE 	0x0400

extern word	/*XXX*/
    _pascal SysNotify (SysNotifyFlags flags, const char *string1, const char *string2);

/***/

extern void	/*XXX*/
    _pascal SysRegisterScreen (GeodeHandle driver, WindowHandle root);

/***/

typedef enum /* word */ {
    SST_CLEAN    ,
    SST_CLEAN_FORCED    ,
    SST_DIRTY    ,
    SST_PANIC    ,
    SST_REBOOT    ,
    SST_RESTART    ,
    SST_FINAL    ,
    SST_SUSPEND    ,
    SST_CONFIRM_START    ,
    SST_CONFIRM_END    ,
    SST_CLEAN_REBOOT
} SysShutdownType} ;

extern Boolean _cdecl	/*XXX*/
    SysShutdown    (SysShutdownType type, ...);

/***/

typedef ByteFlags ExitFlags ;
#define EF_PANIC 	0x80
#define EF_RUN_DOS 	0x40
#define EF_OLD_EXIT 	0x20
#define EF_RESET 	0x10
#define EF_RESTART 	0x08

extern word	/*XXX*/
    _pascal SysSetExitFlags (ExitFlags bitsToSet, ExitFlags bitsToClear);

/***/

typedef ByteFlags SysConfigFlags ;
#define SCF_UNDER_SWAT 		0x80
#define SCF_2ND_IC 		0x40
#define SCF_RTC 			0x20
#define SCF_COPROC 		0x10
#define SCF_RESTARTED 		0x80
#define SCF_CRASHED 		0x04
#define SCF_MCA 			0x02
#define SCF_LOGGING              0x01

typedef ByteEnum SysProcessorType ;
#define SPT_8088    0
#define SPT_8086    0
#define SPT_80186  1
#define SPT_80286  2
#define SPT_80386  3
#define SPT_80486  4

typedef ByteEnum SysMachineType ;
#define SMT_UNKNOWN  0
#define SMT_PC  1
#define SMT_PC_CONV  2
#define SMT_PC_JR  3
#define SMT_PC_XT  4
#define SMT_PC_XT_286  5
#define SMT_PC_AT  6
#define SMT_PS2_30  7
#define SMT_PS2_50  8
#define SMT_PS2_60  9
#define SMT_PS2_80  10
#define SMT_PS1  11
#define SMT_PRODUCT_SPECIFIC_1 	12
#define SMT_PRODUCT_SPECIFIC_2 	13
#define SMT_PRODUCT_SPECIFIC_3 	14
#define SMT_PRODUCT_SPECIFIC_4 	15

#define SGC_PROCESSOR (val) 	((byte) ((val) >> 16))
#define SGC_MACHINE (val) 	((byte) ((val) >> 24))

extern dword	/*XXX*/
    _pascal SysGetConfig (void);

extern Boolean
    _pascal SysGetPenMode (void);

/***/

typedef WordFlags  UtilHexToAsciiFlags  ;
#define UHTAF_SBCS_STRING    	    	0x0010
#define UHTAF_THOUSANDS_SEPARATORS   	0x0008
#define UHTAF_SIGNED_VALUE   	    	0x0004
#define UHTAF_INCLUDE_LEADING_ZEROS 	0x0002
#define UHTAF_NULL_TERMINATE 		0x0001

#define UHTA_NO_NULL_TERM_BUFFER_SIZE    10

/* Non DBCS buffer sizes must be word aligned */
#if !DBCS_GEOS
#define UHTA_NULL_TERM_BUFFER_SIZE       11 + 1
#define UHTA_SPACE_FOR_SIGN              1  + 1
#define UHTA_SPACE_FOR_SEPARATORS        3  + 1
#define UHTA_ALL_BUFFER_SIZE             10 + 1 +1 + 3 + 1
#else
#define UHTA_NULL_TERM_BUFFER_SIZE       11
#define UHTA_SPACE_FOR_SIGN              1
#define UHTA_SPACE_FOR_SEPARATORS        3
#define UHTA_ALL_BUFFER_SIZE             10 + 1 +1 + 3

#endif

typedef enum /* word */ {
    UATH_NON_NUMERIC_DIGIT_IN_STRING    ,
    UATH_CONVERT_OVERFLOW    ,
} UtilAsciiToHexError} ;

extern word 	/* Returns the length of the string (w/o NULL) */
    _pascal UtilHex32ToAscii (char *buffer, dword value, UtilHexToAsciiFlags flags);

extern Boolean	/*XXX*/
    _pascal UtilAsciiToHex32 (const char *string, sdword *value);

/***/

extern void
    _pascal SysLockBIOS (void);

extern void
    _pascal SysUnlockBIOS (void);

/***/
typedef WordFlags   SysNotificationType   ;
#define SNF_WORD1_MEM 	    0x8000  /* set if first param word is MemHandle */
#define	SNF_WORD2_MEM		    0x4000  /* set if second param word is MemHandle */
#define SNF_WORD3_MEM 	    0x2000  /* set if third param word is MemHandle */
#define SNF_WORD4_MEM 	    0x1000  /* set if fourth param word is MemHandle */
#define SNF_NOTIFICATION     0x0fff  /* field for notification number (specific
                     * to subsystem being notified) */

typedef enum {	    /* Steps by 9... */
    SST_MAILBOX     = 0,
    SST_MEDIUM     	= 9,
    SST_DEVICE_POWER     = 18,
    SST_INDICATOR     = 27,
    SST_IRDA     = 36,
    SST_SOCKET     = 45,
    SST_TERMINAL     = 54	    /* use with TerminalSubsystemNotification */
}	SysSubsystemType}	;

typedef enum {
    TSN_TERM_CONNECTED     = 0,
    /*  Pass one word containing the message the recipient of the
        notification should use to terminate the connection. The
        message does not need to be known by the recipient.  The
        only restriction is that the message not expect any parameters
        and be a process class message. */
    TSN_TERM_NOT_CONNECTED    ,
} TerminalSubsystemNotification} ;

extern void
    _pascal SysSendNotification (SysSubsystemType subsys,
                SysNotificationType notif,
                word	word1,
                word	word2,
                word	word3,
                word	word4);

extern Boolean
    _pascal SysHookNotification (SysSubsystemType subsys,
                PCB(void, routine,
                    (SysSubsystemType subsys,
                     SysNotificationType notif,
                     word word1,
                     word word2,
                     word word3,
                     word word4)));

extern void
    _pascal SysUnhookNotification (SysSubsystemType subsys,
                  PCB(void, routine,
                      (SysSubsystemType subsys,
                       SysNotificationType notif,
                       word word1,
                       word word2,
                       word word3,
                       word word4)));

extern Boolean
    _pascal SysIgnoreNotification (SysSubsystemType subsys);

extern void
    _pascal SysEnableAPO (void);

extern void
    _pascal SysDisableAPO (void);

extern word
    _pascal SysGetInkWidthAndHeight (void);

extern void
    _pascal SysSetInkWidthAndHeight (word WidthAndHeight);

#ifdef __HIGHC__
pragma Alias(DosExec, "_DosExec");
pragma Alias(SysLocateFileInDosPath, "SYSLOCATEFILEINDOSPATH");
pragma Alias(SysGetDosEnvironment, "SYSGETDOSENVIRONMENT");
pragma Alias(SysNotify, "SYSNOTIFY");
pragma Alias(SysRegisterScreen, "SYSREGISTERSCREEN");
pragma Alias(SysShutdown, "_SysShutdown");
pragma Alias(SysSetExitFlags, "SYSSETEXITFLAGS");
pragma Alias(SysGetPenMode, "SYSGETPENMODE");
pragma Alias(SysGetConfig, "SYSGETCONFIG");
pragma Alias(UtilHex32ToAscii, "UTILHEX32TOASCII");
pragma Alias(UtilAsciiToHex32, "UTILASCIITOHEX32");
pragma Alias(SysLockBIOS, "SYSLOCKBIOS");
pragma Alias(SysUnlockBIOS, "SYSUNLOCKBIOS");
pragma Alias(SysSendNotification, "SYSSENDNOTIFICATION");
pragma Alias(SysHookNotification, "SYSHOOKNOTIFICATION");
pragma Alias(SysUnhookNotification, "SYSUNHOOKNOTIFICATION");
pragma Alias(SysIgnoreNotification, "SYSIGNORENOTIFICATION");
pragma Alias(SysEnableAPO, "SYSENABLEAPO");
pragma Alias(SysDisableAPO, "SYSDISABLEAPO");
pragma Alias(SysGetInkWidthAndHeight, "SYSGETINKWIDTHANDHEIGHT");
pragma Alias(SysSetInkWidthAndHeight, "SYSSETINKWIDTHANDHEIGHT");
#endif

#endif


Objects\Text\tCommon.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	Text/tCommon.h
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI / Text library
 *
 * DESCRIPTION:
 *	This file defines VisTextClass
 *
 *	$Id: tCommon.h,v 1.50.4.2 96/05/23 13:34:48 jacob Exp $
 *
 ***********************************************************************/

#ifndef	__TCOMMON_H
#define __TCOMMON_H

#include  <stylesh.h>
#include  <sllang.h>

/*---------------------------------------------------------------------------
 * 	Text Ranges
 *--------------------------------------------------------------------------*/

/*
 * The VisTextRange structure is passed to many routines to indicate the
 * range of text to act on.
 */
typedef struct {
    dword   VTR_start;
    dword   VTR_end;
} VisTextRange} ;

/*
 * This constant can be placed in either VTR_start or VTR_end
 */
#define TEXT_ADDRESS_PAST_END 		0x00ffffff
#define TEXT_ADDRESS_PAST_END_HIGH 	0x00ff
#define TEXT_ADDRESS_PAST_END_LOW 	0xffff
    /* Special value for VTR_start.high */

#define	VIS_TEXT_RANGE_SELECTION_HIGH		0xffff
#define	VIS_TEXT_RANGE_SELECTION_LOW		0x0000
#define	VIS_TEXT_RANGE_SELECTION		0xffff0000
/* Description:
 *	Indicates that the current selected area will be used.  Note that
 *	for some operations (like paraAttr changes), the affected text will
 *	actually be larger than the selection.
 */

#define VIS_TEXT_RANGE_PARAGRAPH_SELECTION 	0xfffe0000
#define VIS_TEXT_RANGE_PARAGRAPH_SELECTION_HIGH 	0xfffe
#define VIS_TEXT_RANGE_PARAGRAPH_SELECTION_LOW   0x0000
/* Description:
 *	Indicates that the current selected area will be used after being
 *	adjusted to a paragraph boundry.
 */

/*---------------------------------------------------------------------------
 * 	Tabs, Fields and Lines
 *--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
 *  An array of line structures is kept (one for every line of text).
 *  For updates we need to know if a line has changed (so we can redraw it).
 *  For calculations we need to know if a line is the start of a paragraph (so
 *  we can apply the paragraph margin).
 *--------------------------------------------------------------------------*/

typedef WordFlags LineFlags ;

/*  Set if line starts a paragraph */
#define LF_STARTS_PARAGRAPH 	(0x8000)

/*  Set if line ends a paragraph */
#define LF_ENDS_PARAGRAPH 	(0x4000)

/*  Set if field ends in CR. */
#define LF_ENDS_IN_CR 	(0x2000)

/*  Set if line ends in a column break */
#define LF_ENDS_IN_COLUMN_BREAK 	(0x1000)

/*  Set if line ends in a section break */
#define LF_ENDS_IN_SECTION_BREAK 	(0x0800)

/*  Set if line ends in NULL, last one in document */
#define LF_ENDS_IN_NULL 	(0x0400)

/*  Set if line needs redrawing */
#define LF_NEEDS_DRAW 	(0x0200)

/*  Set if line needs calculating */
#define LF_NEEDS_CALC 	(0x0100)

/*  Set if line ends in a generated hyphen */
#define LF_ENDS_IN_AUTO_HYPHEN 	(0x0080)

/*  Set if line ends in an optional hyphen */
#define LF_ENDS_IN_OPTIONAL_HYPHEN 	(0x0040)

/*
 *  Sometimes characters in a line will extend outside the top and bottom
 *  bounds of the line. We mark these lines with these bits.
 */
/*  Set if line interacts with line above it */
#define LF_INTERACTS_ABOVE 	(0x0020)

/*  Set if line interacts with line below it */
#define LF_INTERACTS_BELOW 	(0x0010)

/*
 *  When doing an optimized redraw of a line we draw the last field in the
 *  line if the field got longer. If the field got shorter we just clear
 *  from beyond the right edge of the field. There are a few situations
 *  where we can't really do this:
 * 	- Current last character on line extended to the right of its font
 * 	  box. (Italic characters are a good example of this).
 * 	- The last character on the line was negatively kerned before we
 * 	  made the modification and is that is no longer the case (this
 * 	  character was removed).
 *  We flag these two cases separately.
 */

/*
 *  Set if the last character on the line extends
 *   to the right of its font box.
 */
#define LF_LAST_CHAR_EXTENDS_RIGHT 	(0x0008)

/*
 *  Set if the last character on the line is
 *  kerned. The only time we use this is to copy
 *  it into the next field...
 */
#define LF_LAST_CHAR_KERNED 	(0x0004)

/*
 *  Set if the line contains styles which are not supported by the kernel.
 *  This allows applications to optimize line redraw by skipping over code
 *  which may attempt to draw attributes which don't exist for the line.
 */
#define LF_CONTAINS_EXTENDED_STYLE 	(0x0002)

/*
 * 	Structure of a tab
 */
typedef ByteEnum TabLeader ;
#define TL_NONE 	    0x0
#define TL_DOT 	    0x1
#define TL_LINE 	    0x2
#define TL_BULLET    0x3

typedef ByteEnum TabType ;
#define TT_LEFT 	    	0x0
#define TT_CENTER 	0x1
#define TT_RIGHT 	0x2
#define TT_ANCHORED 	0x3

typedef ByteFlags TabAttributes ;
/* 3 bits unused */
#define TabLeader 	(0x10 | 0x08 | 0x04)
#define TabLeader_OFFSET 	2
#define TabType 	    	(0x02 | 0x01)
#define TabType_OFFSET 	    	0

typedef ByteEnum TabReferenceType ;
#define TRT_RULER 	0x0 	    /*  Reference is into the ruler. */
#define TRT_OTHER 	0x1

typedef ByteFlags TabReference ;
#define TabReferenceType     0x80    /*  Type of reference. */

/*  Reference number */
#define TR_REF_NUMBER 	(0x40 | 0x20 | 0x10 | 0x08 | 0x04 | 0x02 | 0x01)
#define TR_REF_NUMBER_OFFSET 	0

/*
 *  Reference number that means no tab, use left edge of line.
 *  MUST BE 0x7f (-1 in 7 binary digits).
 */
#define	RULER_TAB_TO_LINE_LEFT		    	0x7f

/*
 *  Reference number that means use the left margin value.
 */
#define RULER_TAB_TO_LEFT_MARGIN 	0x7e

/*
 *  Reference number that means use the para margin value.
 */
#define RULER_TAB_TO_PARA_MARGIN 	0x7d

/*
 *  Reference number that means tab has an intrinsic width and
 *  is not associated with any tabstop.
 */
#define OTHER_INTRINSIC_TAB 		0x7f

/*
 *  Reference number that means that the tab is zero width. This is a special
 *  case that is reserved for really horrible situations.
 */
#define OTHER_ZERO_WIDTH_TAB 		0x7e

typedef struct {
    word	    T_position;     	/*  Position of tab (pixels * 8) */
    TabAttributes   T_attr;	        /*  Tab attributes. */
    SysDrawMask	    T_grayScreen; 	/*  Gray screen for tab lines */
    byte	    T_lineWidth;    	/*  Width of line before (after) tab
                     *  0 = none, units are pixels * 8  */
    byte	    T_lineSpacing;  	/*  Space between tab and line
                     *  0 = none, units are pixels * 8  */
    word	    T_anchor; 	    	/*  Anchor character. */
} Tab} ;

#define TAB_POS_TYPE_LEADER_ANCHOR_GRAY_WIDTH_SPACING (pos, type, leander, anchor, gray, width, spacing) { \
    {(pos)*PIXELS_PER_INCH, {leader, type}, gray, width, spacing, anchor}

#define TAB_POS_TYPE (pos, type)  \
    TAB_POS_TYPE_LEADER_ANCHOR_GRAY_WIDTH_SPACING(pos, type, TL_NONE, '.', SDM_100, 0, 0)

/*
 *  A line is made up of a list of fields...
 */
typedef struct {
    word	FI_nChars;  	/*  Number of characters in the field */
    word	FI_position; 	/*  X position of field on line */
    word	FI_width;   	/*  Width of the field */
    TabReference FI_tab;    	/*  Reference to a tab in the ruler */
} FieldInfo} ;

/*
 *  A line...
 */
typedef	struct {
    LineFlags 	LI_flags;
    WBFixed 	LI_hgt;			/* Height of line */
    WBFixed 	LI_blo;			/* Baseline offset */
    word    	LI_adjustment;	   	/* Adjustment for justification */
    WordAndAHalf LI_count;	    	/* Number of characters in the line.
                     * This is the total of the field
                     * counts.
                     */
    WBFixed 	LI_spacePad;		/* Amount to pad last field to
                     * get full justification
                     */
    word    	LI_lineEnd; 	    	/* The rounded end-of-line position
                     * which indicates the end of the
                     * last non-white-space character.
                     */
    FieldInfo	LI_firstField;	        /* Contains the always present
                     * first field .
                     */

} LineInfo} ;

/*--------------------------------------------------------------------------
 *		CharAttrs
 *-------------------------------------------------------------------------*/

typedef WordFlags VisTextExtendedStyles ;
#define VTES_BOXED   		0x8000
#define VTES_BUTTON   		0x4000
#define VTES_INDEX   		0x2000
#define VTES_ALL_CAP   		0x1000
#define VTES_SMALL_CAP  		0x0800
#define VTES_HIDDEN  		0x0400
#define VTES_CHANGE_BAR 		0x0200
#define VTES_BACKGROUND_COLOR 	0x0100

/*
 * 	Definition of a text CharAttr element
 */
typedef struct {
    StyleSheetElementHeader VTCA_meta;
    FontID	    	    VTCA_fontID;
    WBFixed	    	    VTCA_pointSize;
    TextStyle 	    	    VTCA_textStyles;
    ColorQuad     	    VTCA_color;
    sword	     	    VTCA_trackKerning;
    byte	    	    VTCA_fontWeight;
    byte	    	    VTCA_fontWidth;
    VisTextExtendedStyles   VTCA_extendedStyles;
    SystemDrawMask	    VTCA_grayScreen;
    GraphicPattern    	    VTCA_pattern;
    ColorQuad	    	    VTCA_bgColor;
    SystemDrawMask	    VTCA_bgGrayScreen;
    GraphicPattern    	    VTCA_bgPattern;
    byte	    	    VTCA_reserved[7];
} VisTextCharAttr} ;

typedef ByteEnum VisTextDefaultSize ;
#define     VTDS_8       0
#define     VTDS_9       1
#define     VTDS_10      2
#define     VTDS_12      3
#if DBCS_GEOS
#define     VTDS_16      4
#else
#define     VTDS_14      4
#endif
#define     VTDS_18      5
#define     VTDS_24      6
#define     VTDS_36      7

/*
 *	Default CharAttr record (incorporates the default sizes
 *	and color map modes).
 */

/*
 *	There are are maximum of 32 default fonts (since the bitfield is
 *	five bits wide).  Do not add fonts without consulting font people!
 */
typedef ByteEnum VisTextDefaultFont ;
#define     VTDF_BERKELEY        	    0
#define     VTDF_CHICAGO         	    1
#define     VTDF_BISON      	    	    2
#define     VTDF_WINDOWS         	    3
#define     VTDF_LED      	    	    4
#define     VTDF_ROMA      	    	    5
#define     VTDF_UNIVERSITY      	    6
#define     VTDF_URW_ROMAN       	    7
#define     VTDF_URW_SANS        	    8
#define     VTDF_URW_MONO        	    9
#define     VTDF_URW_SYMBOLS      	    10
#define     VTDF_CENTURY_SCHOOLBOOK      11
#define     VTDF_JSYS                    12

typedef WordFlags VisTextDefaultCharAttr ;
#define VTDCA_UNDERLINE 	0x8000
#define VTDCA_BOLD 	0x4000
#define VTDCA_ITALIC 	0x2000
#define VTDCA_COLOR 	0x0f00	/* ColorQuad */
#define VTDCA_SIZE 	0x00e0	/* VisTextDefaultSize */
#define VTDCA_FONT 	0x001f	/* VisTextDefaultFont */

#define VTDCA_COLOR_OFFSET 	8
#define VTDCA_SIZE_OFFSET 	5
#define VTDCA_FONT_OFFSET 	0

/*
 *	The initial CharAttr for a text object
 */
#define VIS_TEXT_INITIAL_CHAR_ATTR  \
             ((VTDS_12 << VTDCA_SIZE_OFFSET) | VTDF_BERKELEY)

#define VIS_TEXT_DEFAULT_POINT_SIZE  12

/*---------------------------------------------------------------------------
 *	Macros for defining VisTextCharAttr structures
 */

#define CHAR_ATTR_STYLE_FONT_SIZE_STYLE_COLOR (ref, style, font, psize, tstyle, color) { \
    {{{ref, 0}}, style}, font, {0, psize}, tstyle, \
    {color, CF_INDEX, 0, 0}, 0, FWI_MEDIUM, FW_NORMAL, 0, SDM_100, {0}, \
    {C_WHITE, CF_INDEX, 0, 0}, SDM_0, {0}, {0,0,0,0,0,0,0}}
#if 0
     {{{ref, 0}}, style}, \      	/* StyleSheetElementHeader  	  */
     font, \	    	    	    	/* FontID   	    	    	  */
    {0, psize}, \	    	    	/* point size - WBFixed     	  */
    tstyle, \   	    	    	/* TextStyle 	    	    	  */
    {color, CF_INDEX, 0, 0},    	/* text ColorQuad   	    	  */
    0, \	    	    	    	/* Track kerning    	    	  */
    FWI_MEDIUM, FW_NORMAL, \    	/* Font weight, font width  	  */
    0, \	    	    	    	/* VisTextExtendedStyles    	  */
    SDM_100, {0}, \  	    	/* SystemDrawMask, GraphicPattern */
    {C_WHITE, CF_INDEX, 0, 0}, \  	/* background ColorQuad     	  */
    SDM_0, \ 	    	    	/* background SystemDrawMask 	  */
    {0}, \	    	    	    	/* background GraphicPattern 	  */
    {0,0,0,0,0,0,0}}    	    	/* reserved 	    	    	  */
#endif

#define CHAR_ATTR_FONT_SIZE_STYLE (font, psize, tstyle) \
        CHAR_ATTR_STYLE_FONT_SIZE_STYLE_COLOR(2, CA_NULL_ELEMENT, font, \
                        psize, tstyle, C_BLACK)

#define CHAR_ATTR_FONT_SIZE (font, psize) \
        CHAR_ATTR_STYLE_FONT_SIZE_STYLE_COLOR(2, CA_NULL_ELEMENT, font, \
                        psize, 0, C_BLACK)

/*
 *	Macros for typical default attribute structures
 */

#define DEF_CHAR_ATTR_FONT_SIZE (font, psize) (((psize) << VTDCA_SIZE_OFFSET) | \
                          ((font) << VTDCA_FONT_OFFSET))

/*--------------------------------------------------------------------------
 *		ParaAttrs
 *-------------------------------------------------------------------------*/

/*
 *	Limits for various ParaAttr components
 */
#ifdef DO_PIZZA
#define VIS_TEXT_MAX_PARA_WIDTH 	    	    	3926	/* 138.5 cm */
#else
#define VIS_TEXT_MAX_PARA_WIDTH 			4000
#endif

#define VIS_TEXT_MIN_NON_ZERO_LINE_SPACING  	((0 << 8) + 128)
    /* BBFixed constant */

#define VIS_TEXT_MIN_NON_ZERO_LINE_SPACING_INT  	0
#define VIS_TEXT_MIN_NON_ZERO_LINE_SPACING_FRAC  32768
    /* WWFixed constants */

#define VIS_TEXT_MAX_LINE_SPACING 	(12 << 8)
    /* BBFixed constant */

#define VIS_TEXT_MAX_LINE_SPACING_INT 	12
#define VIS_TEXT_MAX_LINE_SPACING_FRAC 	0
    /* WWFixed constants */

#define VIS_TEXT_MIN_TEXT_FIELD_WIDTH 	47
#define VIS_TEXT_MIN_NON_ZERO_LEADING 	1
#define VIS_TEXT_MAX_LEADING 		MAX_POINT_SIZE
#define VIS_TEXT_MAX_TABS 		25

#define TEXT_ONE_LINE_RIGHT_MARGIN  	VIS_TEXT_MAX_PARA_WIDTH
    /* Right margin used by right justified single line objects */

/*
 *	Structure of a paraAttr
 *
 * The size of a paraAttr can be computed by:
 *
 *	size = (size VisTextParaAttr) + (VTPA_numberOfTabs * (size Tab))
 */

/*
 *	Different types of borders on a paragraph
 */
typedef ByteEnum ShadowAnchor ;
#define     SA_TOP_LEFT      	0
#define     SA_TOP_RIGHT      	1
#define     SA_BOTTOM_LEFT      	2
#define     SA_BOTTOM_RIGHT      	3

typedef WordFlags VisTextParaBorderFlags ;
#define VTPBF_LEFT 		0x8000	/* set if border on the left */
#define VTPBF_TOP 		0x4000	/* set if border on the top */
#define VTPBF_RIGHT 		0x2000	/* set if border on the right */
#define VTPBF_BOTTOM 		0x1000	/* set if border on the bottom */
#define VTPBF_DOUBLE 		0x0800	/* draw two line border */
#define VTPBF_DRAW_INNER_LINES 	0x0400	/* draw lines between bordered para. */
#define VTPBF_SHADOW  	    	0x0200	/* set to use shadow */
#define VTPBF_ANCHOR 		0x0003	/* ShadowAnchor */

#define VTPBF_ANCHOR_OFFSET 	0

typedef ByteEnum VisTextNumberType ;
#define     VTNT_NUMBER         	    	0
#define     VTNT_LETTER_UPPER_A         	1
#define     VTNT_LETTER_LOWER_A         	2
#define     VTNT_ROMAN_NUMERAL_UPPER      	3
#define     VTNT_ROMAN_NUMERAL_LOWER      	4

typedef WordFlags VisTextParaAttrAttributes ;
#define VTPAA_JUSTIFICATION  	    	0xc000
#define VTPAA_KEEP_PARA_WITH_NEXT 	0x2000
#define VTPAA_KEEP_PARA_TOGETHER 	0x1000	/* don't break up paragraph */
#define VTPAA_ALLOW_AUTO_HYPHENATION 	0x0800  /* use VisTextHyphenationInfo*/
#define VTPAA_DISABLE_WORD_WRAP 	    	0x0400
#define VTPAA_COLUMN_BREAK_BEFORE     	0x0200
#define VTPAA_PARA_NUMBER_TYPE 	    	0x01c0
#define VTPAA_DROP_CAP 	    	    	0x0020  /* use VisTextDropCapInfo */
#define VTPAA_KEEP_LINES     	    	0x0010  /* use VisTextKeepInfo */

#define VTPAA_JUSTIFICATION_OFFSET  	14
#define VTPAA_PARA_NUMBER_TYPE_OFFSET   	5

typedef WordFlags VisTextHyphenationInfo ;
#define VTHI_HYPHEN_MAX_LINES 	    	0xf000
#define VTHI_HYPHEN_SHORTEST_WORD    	0x0f00
#define VTHI_HYPHEN_SHORTEST_PREFIX  	0x00f0
#define VTHI_HYPHEN_SHORTEST_SUFFIX  	0x000f

#define VTHI_HYPHEN_MAX_LINES_OFFSET 	    	12
#define VTHI_HYPHEN_SHORTEST_WORD_OFFSET    	8
#define VTHI_HYPHEN_SHORTEST_PREFIX_OFFSET  	4
#define VTHI_HYPHEN_SHORTEST_SUFFIX_OFFSET  	0

#define VIS_TEXT_DEFAULT_HYPHENATION  (2 << VTHI_HYPHEN_MAX_LINES_OFFSET)|\
                     (4 << VTHI_HYPHEN_SHORTEST_WORD_OFFSET)|\
                     (2 << VTHI_HYPHEN_SHORTEST_PREFIX_OFFSET)|\
                     (2 << VTHI_HYPHEN_SHORTEST_SUFFIX_OFFSET)

typedef ByteFlags VisTextKeepInfo ;
#define VTKI_TOP_LINES 	    0xf0  /* # lines at start of PP to keep together */
#define VTKI_BOTTOM_LINES    0x0f  /* # lines at end of PP to keep together */

#define VTKI_TOP_LINES_OFFSET 	    4
#define VTKI_BOTTOM_LINES_OFFSET     0

typedef WordFlags VisTextDropCapInfo ;
#define VTDCI_CHAR_COUNT     0xf000	/* # chars for drop cap CharAttr */
#define VTDCI_LINE_COUNT     0x0f00	/* # lines for drop cap */
#define VTDCI_POSITION 	    0x00f0	/* 0 is full drop cap
                       * lineCount - 1 is full tall cap */

#define VTDCI_CHAR_COUNT_OFFSET 	    12
#define VTDCI_LINE_COUNT_OFFSET 	    8
#define	VTDCI_POSITION_OFFSET		    4

#define VIS_TEXT_DEFAULT_DROP_CAP  (0 << VTDCI_CHAR_COUNT_OFFSET)|\
                  (2 << VTDCI_LINE_COUNT_OFFSET)|\
                  (0 << VTDCI_POSITION_OFFSET)

#define VIS_TEXT_MIN_STARTING_NUMBER 		-1000
#define VIS_TEXT_MAX_STARTING_NUMBER 		60000
#define VIS_TEXT_DEFAULT_STARTING_NUMBER 	62000

/*
 *	Default ParaAttrs
 */

#define PIXELS_PER_INCH 		72

/*
 * Intrinsic width for a tab character if there are no tabstops which apply
 * to it.
 */
#define TAB_INTRINSIC_WIDTH  	18		/* 1/4 inch */

typedef ByteEnum VisTextDefaultDefaultTab ;
#define     VTDDT_NONE      		0
#define     VTDDT_HALF_INCH      	1
#define     VTDDT_INCH      		2
#define     VTDDT_CENTIMETER      	3

typedef WordFlags VisTextDefaultParaAttr ;
#define VTDPA_JUSTIFICATION 	0xc000	/* Justification */
#define VTDPA_DEFAULT_TABS 	0x3000	/* VisTextDefaultDefaultTab */
#define VTDPA_LEFT_MARGIN 	0x0f00	/* in units of half inches */
#define VTDPA_PARA_MARGIN 	0x00f0	/* in units of half inches */
#define VTDPA_RIGHT_MARGIN 	0x000f	/* in units of half inches -- 0 means
                     * VIS_TEXT_MAX_PARA_ATTR_SIZE */

#define VTDPA_JUSTIFICATION_OFFSET 	14
#define VTDPA_DEFAULT_TABS_OFFSET 	12
#define VTDPA_LEFT_MARGIN_OFFSET 	8
#define VTDPA_PARA_MARGIN_OFFSET 	4
#define VTDPA_RIGHT_MARGIN_OFFSET 	0

/*
 *	Structure of a ParaAttr
 */
typedef struct {
    StyleSheetElementHeader VTPA_meta;
    VisTextParaBorderFlags  VTPA_borderFlags;	/* border type */
    ColorQuad    	    VTPA_borderColor;	/* color for border */
    VisTextParaAttrAttributes VTPA_attributes;
    word	    	    VTPA_leftMargin;	/* margins - unsigned */
    word	    	    VTPA_rightMargin;	/* right margin is an offset
                         * from the RIGHT edge of the
                         * object */
    word	    	    VTPA_paraMargin;
                        /* ** See note on line height
                         * ** calculation below */
    BBFixedAsWord    	    VTPA_lineSpacing;	/* line spacing - unsigned
                         * 1.0 is normal  */

    /* extra space above/below paragraph, in points (13.3) */

    word	    	    VTPA_leading;	/* unsigned, 13.3	*/
    BBFixedAsWord    	    VTPA_spaceOnTop;	/* unsigned, 0.0 is normal */
    BBFixedAsWord	    VTPA_spaceOnBottom; /* spacing */

    ColorQuad	    	    VTPA_bgColor;
    byte	    	    VTPA_numberOfTabs;	/* # of tabs in ParaAttr */

    byte	    	    VTPA_borderWidth;	/* (pixels * 8)	*/
    byte	    	    VTPA_borderSpacing;	/* (pixels * 8)	*/
    byte	    	    VTPA_borderShadow;	/* (pixels * 8)	*/
    SystemDrawMask	    VTPA_borderGrayScreen;
    SystemDrawMask	    VTPA_bgGrayScreen;
    GraphicPattern    	    VTPA_borderPattern;
    GraphicPattern    	    VTPA_bgPattern;
    word	    	    VTPA_defaultTabs;	/* spacing for default tabs */
    word	    	    VTPA_startingParaNumber;
    char	    	    VTPA_prependChars[4];	/* chars to prepend at
                        * start of each paragraph */
    VisTextHyphenationInfo  VTPA_hyphenationInfo;
    VisTextKeepInfo   	    VTPA_keepInfo;
    VisTextDropCapInfo 	    VTPA_dropCapInfo;
    word		    VTPA_nextStyle;
    StandardLanguage	    VTPA_language;
#if DBCS_PCGEOS
    TextMiscModeFlags	    VTPA_miscMode;
    byte	    	    VTPA_reserved[14];
#else
    byte	    	    VTPA_reserved[15];
#endif
} VisTextParaAttr} ;

typedef struct {
    VisTextParaAttr	VTMPA_paraAttr;
    Tab	    	    	VTMPA_tabs[VIS_TEXT_MAX_TABS];
} VisTextMaxParaAttr} ;

/*
 *	The initial ParaAttr for a text object
 */
#define VIS_TEXT_INITIAL_PARA_ATTR  (VisTextDefaultParaAttr) ( (0*2) << VTDPA_LEFT_MARGIN_OFFSET ) | \
                ( (0*2) << VTDPA_PARA_MARGIN_OFFSET ) | \
                ( (0*2) << VTDPA_RIGHT_MARGIN_OFFSET ) | \
                ( VTDDT_HALF_INCH << VTDPA_DEFAULT_TABS_OFFSET ) | \
                ( J_LEFT << VTDPA_JUSTIFICATION_OFFSET )

/*---------------------------------------------------------------------------
 *	Macros for defining default ParaAttrs
 */
#define DEF_PARA_ATTR_JUST_TABS (just, tabs) \
                (( (0*2) << VTDPA_LEFT_MARGIN_OFFSET ) | \
                ( (0*2) << VTDPA_PARA_MARGIN_OFFSET ) | \
                ( (0*2) << VTDPA_RIGHT_MARGIN_OFFSET ) | \
                ( (tabs) << VTDPA_DEFAULT_TABS_OFFSET ) | \
                ( (just) << VTDPA_JUSTIFICATION_OFFSET ))

#define DEF_PARA_ATTR_CENTER  \
    DEF_PARA_ATTR_JUST_TABS(J_CENTER, VTDDT_INCH)

#define DEF_PARA_ATTR_RIGHT  \
    DEF_PARA_ATTR_JUST_TABS(J_RIGHT, VTDDT_INCH)

#define PARA_ATTR_STYLE_JUST_LEFT_RIGHT_PARA (ref, style, just, left, right, para) { \
        {{{ref, 0}}, style}, 0, {C_BLACK, CF_INDEX, 0, 0}, \
    just << VTPAA_JUSTIFICATION_OFFSET, (left)*PIXELS_PER_INCH, \
     (right)*PIXELS_PER_INCH,  (para)*PIXELS_PER_INCH, \
    1<<8, 0, 0, 0, {C_WHITE, CF_INDEX, 0, 0}, \
    0, 1*8, 2*8, 1*8, SDM_100, SDM_0, {0}, {0}, \
    PIXELS_PER_INCH/2*8, VIS_TEXT_DEFAULT_STARTING_NUMBER, "", \
    0, 0, 0, CA_NULL_ELEMENT, SL_ENGLISH, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}

/*---------------------------------------------------------------------------
 *		 Attributes
 *--------------------------------------------------------------------------*/

/*
 * VisTextStorageFlags reflect the type of data structures used to store
 * the text object's data
 */
typedef ByteFlags VisTextStorageFlags ;
#define VTSF_LARGE 	    	    	0x80
    /* If set: this object uses the large storage format and the bits below
     * 	       are unused.
     * If clear: this object uses the model storage format and the bits below
     *	    	  are unused.
     */

#define VTSF_MULTIPLE_CHAR_ATTRS 	0x40
    /* If set: VTI_charAttrRuns = chunk handle of charAttr runs
     * If clear:  if (VTTF_defaultCharAttr)
     *	    	    	VTI_charAttrRuns is a VisTextDefaultCharAttr
     *	    	  else
     *	    	    	VTI_charAttrRuns = chunk handle of charAttr
     */

#define VTSF_MULTIPLE_PARA_ATTRS 	0x20
    /* If set: VTI_paraAttrRuns = chunk handle of paraAttr runs
     * If clear:  if (VTI_paraAttrRuns != 0)
     *	    	    	VTI_paraAttrRuns = chunk handle of charAttr
     *	    	  else
     *	    	    	use default paraAttr
     */

#define VTSF_TYPES 	    	    	0x10
#define VTSF_GRAPHICS 	    	    	0x08
#define VTSF_DEFAULT_CHAR_ATTR 	    	0x04
#define VTSF_DEFAULT_PARA_ATTR 	    	0x02
#define VTSF_STYLES  		    	0x01

/*
 * We need an additional flag for passing to MSG_VIS_TEXT_CHANGE_ELEMENT_ARRAY.
 * Since VTSF_DEFAULT_CHAR_ATTR can't be passed to this routine, we use it
 * to represent VTSF_NAMES.
 */
#define	VTSF_NAMES	  VTSF_DEFAULT_CHAR_ATTR

#endif


Objects\Text\tCtrlC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	Text/tCtrlC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI / Text library
 *
 * DESCRIPTION:
 *	This file defines VisTextClass
 *
 *	$Id: tCtrlC.goh,v 1.66.4.1 96/04/28 08:32:02 chris Exp $
 *
 ***********************************************************************/

@ifndef	__TCTRLC
@define __TCTRLC

@include  <ruler.goh>
@include  <Objects/colorC.goh>
@include  <Objects/styles.goh>

@deflib text

/******************************************************************************
 *		TextStyleControlClass
 *****************************************************************************/

@class	TextStyleControlClass, GenControlClass;

/*
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_TEXT_STYLE (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_STYLE_CHANGE: NotifyTextStyleChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

/*--------------------------------------------------------------------------
 * 		Methods
 *--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
 * 		Internal methods
 *--------------------------------------------------------------------------*/

@message void MSG_TSC_PLAIN_TEXT_CHANGE ();
/*
 *  Sent from "Plain" list entry on any change
 *
 *  Pass:   nothing
 */

@message void MSG_TSC_STYLE_CHANGE (word selectedBooleans = cx,
                   word changedBooleans = bp);
/*
 *  Sent from non-exclusive "Style" list on any change
 *
 *  Pass:
 * 	selectedBooleans - new state of style list
 * 	changedBooleans - changed bits in style list
 */

@message void MSG_TSC_EXTENDED_STYLE_CHANGE (word selectedBooleans = cx,
                        word changedBooleans = bp);
/*
 *  Sent from non-exclusive "Extended Style" list on any change
 *
 *  Pass:
 * 	selectedBooleans - new state of style list
 * 	changedBooleans - changed bits in style list
 */

/* -------------------------------------------------------------------------
 * 		Hints
 * -------------------------------------------------------------------------*/

/* -------------------------------------------------------------------------
 * 		Constants & Structures
 * -------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags TSCFeatures ;
#define TSCF_PLAIN 		0x0800
#define TSCF_BOLD 		0x0400
#define TSCF_ITALIC 		0x0200
#define TSCF_UNDERLINE 		0x0100
#define TSCF_STRIKE_THRU 	0x0080
#define TSCF_SUBSCRIPT 		0x0040
#define TSCF_SUPERSCRIPT 	0x0020
#define TSCF_BOXED 		0x0010
#define TSCF_BUTTON 		0x0008
#define TSCF_INDEX 		0x0004
#define TSCF_ALL_CAP 		0x0002
#define TSCF_SMALL_CAP 		0x0001

/*
 *  Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */
typedef WordFlags TSCToolboxFeatures ;
#define TSCTF_PLAIN 		0x0800
#define TSCTF_BOLD 		0x0400
#define TSCTF_ITALIC 		0x0200
#define TSCTF_UNDERLINE 		0x0100
#define TSCTF_STRIKE_THRU 	0x0080
#define TSCTF_SUBSCRIPT 		0x0040
#define TSCTF_SUPERSCRIPT 	0x0020
#define TSCTF_BOXED 		0x0010
#define TSCTF_BUTTON 		0x0008
#define TSCTF_INDEX 		0x0004
#define TSCTF_ALL_CAP 		0x0002
#define TSCTF_SMALL_CAP 		0x0001

#define TSC_DEFAULT_FEATURES  (TSCF_PLAIN | TSCF_BOLD \
            | TSCF_ITALIC | TSCF_UNDERLINE \
            | TSCF_SUBSCRIPT | TSCF_SUPERSCRIPT \
            | TSCF_STRIKE_THRU | TSCF_BOXED | TSCF_BUTTON \
            | TSCF_INDEX | TSCF_ALL_CAP | TSCF_SMALL_CAP)
#define TSC_DEFAULT_TOOLBOX_FEATURES  (TSCTF_PLAIN | TSCTF_BOLD \
            | TSCTF_ITALIC | TSCTF_UNDERLINE)
/*
 *  Notification structure
 */
typedef struct {
    TextStyle			NTSC_styles;		/* TextStyle */
    TextStyle			NTSC_indeterminates;	/* TextStyle */
} NotifyTextStyleChange} ;

/*---------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/

    @default GCI_output = (TO_APP_TARGET);
    @default GI_attrs = (@default | GA_KBD_SEARCH_PATH);

@endc

/******************************************************************************
 * 		FontControlClass
 ******************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_FONT_ID (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_FONT_CHANGE: NotifyFontChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class	FontControlClass, GenControlClass;

/*---------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *---------------------------------------------------------------------------*/

@message void MSG_FC_SET_FONT (word fontID = cx);
/*
 *  Handle a font set via the short list
 *
 *  Pass:
 * 	fontID - font ID
 */

@message void MSG_FC_SET_FONT_FROM_LIST (word fontID = cx);
/*
 *  Handle a font set via the long list
 *
 *  Pass:
 * 	fontID - font ID
 */

@message void MSG_FC_USER_CHANGED_FONT_FROM_LIST (word fontID = cx);
/*
 *  Handles user change of a font in the long list
 *
 *  Pass:
 * 	fontID - font ID
 */

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

    @vardata FontEnumFlags ATTR_FONT_CONTROL_SHORT_LIST_FONT_TYPE;
    /*
     *  This attribute sets the legal font types for the short font list
     */

    @vardata FontEnumFlags ATTR_FONT_CONTROL_LONG_LIST_FONT_TYPE;
    /*
     *  This attribute sets the legal font types for the long font list
     */

/*--------------------------------------------------------------------------
 * 		Constants & Structures
 *--------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags FCFeatures ;
#define FCF_SHORT_LIST 	0x0002
#define FCF_LONG_LIST 	0x0001

/*
 *  Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */
typedef WordFlags FCToolboxFeatures ;
#define FCTF_TOOL_LIST 	0x0001

#define FC_DEFAULT_FEATURES  	    (FCF_SHORT_LIST | FCF_LONG_LIST)
#define FC_DEFAULT_TOOLBOX_FEATURES  FCTF_TOOL_LIST

/*
 * 	Notification structure
 */
typedef struct {
    FontID			NFC_fontID;
    byte			NFC_diffs;
} NotifyFontChange} ;

/*--------------------------------------------------------------------------
 * 		Instance Data
 *--------------------------------------------------------------------------*/
    @default GCI_output = (TO_APP_TARGET);

@endc

/******************************************************************************
 * 		PointSizeControlClass
 ******************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_POINT_SIZE (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_POINT_SIZE_CHANGE: NotifyPointSizeChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class	PointSizeControlClass, GenControlClass;

@message void MSG_PSC_SET_POINT_SIZE (WWFixed size = dx:cx);
/*
 *  Pass:   size - WWFixed
 */

@message void MSG_PSC_SET_POINT_SIZE_FROM_LIST (word size = cx);
/*
 *  Pass:   size - word
 */

@message void MSG_PSC_SMALLER_POINT_SIZE ();

@message void MSG_PSC_LARGER_POINT_SIZE ();

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags PSCFeatures ;
#define PSCF_9 			0x0800
#define PSCF_10 			0x0400
#define PSCF_12 			0x0200
#define PSCF_14 			0x0100
#define PSCF_18 			0x0080
#define PSCF_24 			0x0040
#define PSCF_36 			0x0020
#define PSCF_54 			0x0010
#define PSCF_72 			0x0008
#define PSCF_SMALLER 		0x0004
#define PSCF_LARGER 		0x0002
#define PSCF_CUSTOM_SIZE 	0x0001

/*
 *  Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */
typedef WordFlags PSCToolboxFeatures ;
#define PSCTF_9 			0x0400
#define PSCTF_10 		0x0200
#define PSCTF_12 		0x0100
#define PSCTF_14 		0x0080
#define PSCTF_18 		0x0040
#define PSCTF_24 		0x0020
#define PSCTF_36 		0x0010
#define PSCTF_54     		0x0008
#define PSCTF_72 		0x0004
#define PSCTF_SMALLER 		0x0002
#define PSCTF_LARGER 		0x0001

#define PSC_DEFAULT_FEATURES  (PSCF_9 | PSCF_10 | PSCF_12 | PSCF_14 \
            | PSCF_18 | PSCF_24 | PSCF_36 \
            | PSCF_72 | PSCF_CUSTOM_SIZE \
            | PSCF_SMALLER | PSCF_LARGER)
#define PSC_DEFAULT_TOOLBOX_FEATURES  (PSCTF_9 | PSCTF_10 | PSCTF_12 \
            | PSCTF_14 | PSCTF_18 | PSCTF_24 \
            | PSCTF_36 | PSCTF_72 \
            | PSCTF_SMALLER | PSCTF_LARGER)
/*
 *	Notification structure
 */
typedef struct {
    WWFixedAsDWord		NPSC_pointSize;
    byte			NPSC_diffs;
} NotifyPointSizeChange} ;

/*---------------------------------------------------------------------------
 * 		Instance Data
 *--------------------------------------------------------------------------*/
    @default GCI_output = (TO_APP_TARGET);
    @default GI_attrs = (@default | GA_KBD_SEARCH_PATH);

@endc

/*****************************************************************************
 * 		CharFGColorControlClass
 *****************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_CHAR_FG_COLOR (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_CHAR_FG_COLOR_CHANGE: NotifyColorChange
 */

@class	CharFGColorControlClass, ColorSelectorClass;

/*---------------------------------------------------------------------------
 * 		Methods
 *--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
 * 		Internal methods
 *--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
 * 		Hints
 *--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
 * 		Constants & Structures
 *--------------------------------------------------------------------------*/

/*  For now text patterns are not supported */

#define CFGCC_DEFAULT_FEATURES  (CSF_INDEX | CSF_RGB | CSF_DRAW_MASK | CSF_PATTERN)
#define CFGCC_DEFAULT_TOOLBOX_FEATURES  (CSTF_INDEX | CSTF_DRAW_MASK | CSTF_PATTERN)

typedef union {
    VisTextCharAttrFlags	NCCFU_char;
    VisTextParaAttrFlags	NCCFU_paragraph;
    VisTextParaAttrBorderFlags	NCCFU_border;
} NCCFlagsUnion} ;

typedef struct {
    ColorQuad		NCC_color;
    SystemDrawMask	NCC_grayScreen;
    GraphicPattern	NCC_pattern;
    word		NCC_flags;
    /*
     * VTCAF_MULTIPLE_COLORS
     * VTCAF_MULTIPLE_GRAY_SCREENS
     * VTCAF_MULTIPLE_PATTERNS
     * 	-or-
     * VTCAF_MULTIPLE_BG_COLORS
     * VTCAF_MULTIPLE_BG_GRAY_SCREENS
     * VTCAF_MULTIPLE_BG_PATTERNS
     * 	-or-
     * VTPAF_MULTIPLE_BG_COLORS
     * VTPAF_MULTIPLE_BG_GRAY_SCREENS
     * VTPAF_MULTIPLE_BG_PATTERNS
     * 	-or-
     * VTPABF_MULTIPLE_BORDER_COLORS
     * VTPABF_MULTIPLE_BORDER_GRAY_SCREENS
     * VTPABF_MULTIPLE_BORDER_PATTERNS
     */
} NotifyColorChange} ;

/*--------------------------------------------------------------------------
 * 		Instance Data
 *--------------------------------------------------------------------------*/

    @default GI_states = @default & ~GS_ENABLED;
    @default GCI_output = (TO_APP_TARGET);
    @default CSI_toolboxPrefs = @default | (COO_LINE_ORIENTED << CTP_INDEX_ORIENTATION_OFFSET) | (COO_LINE_ORIENTED << CTP_DRAW_MASK_ORIENTATION_OFFSET) | (COO_LINE_ORIENTED << CTP_PATTERN_ORIENTATION_OFFSET);

@endc

/*****************************************************************************
 * 		CharBGColorControlClass
 *****************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_CHAR_BG_COLOR (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_CHAR_BG_COLOR_CHANGE: NotifyColorChange
 * 							-or-
 * 						VisTextNotifyCharAttrChange
 */

@class	CharBGColorControlClass, ColorSelectorClass;

/*---------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *--------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

#define CBGCC_DEFAULT_FEATURES  (CSF_INDEX | CSF_RGB | CSF_DRAW_MASK | CSF_PATTERN)

#define CBGCC_DEFAULT_TOOLBOX_FEATURES  (CSTF_INDEX | CSTF_DRAW_MASK | CSTF_PATTERN)

/*----------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/

    @default GI_states = @default & ~GS_ENABLED;
    @default GCI_output = (TO_APP_TARGET);

@endc

/*****************************************************************************
 * 		FontAttrControlClass
 *****************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_FONT_WEIGHT (a MetaTextMessage)
 *  MSG_VIS_TEXT_SET_FONT_WIDTH (a MetaTextMessage)
 *  MSG_VIS_TEXT_SET_TRACK_KERNING (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_FONT_ATTR_CHANGE: NotifyFontAttrChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class	FontAttrControlClass, GenControlClass;

/*---------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *---------------------------------------------------------------------------*/

@message void MSG_FAC_SET_FONT_WEIGHT (word weight = dx);
/*
 *  Handle a font weight setting
 *
 *  Pass:
 * 	 weight - font weight
 */

@message void MSG_FAC_SET_FONT_WIDTH (word width = dx);
/*
 *  Handle a font width setting
 *
 *  Pass:
 * 	 width - font width
 */

@message void MSG_FAC_SET_TRACK_KERNING (word kern = dx);
/*
 *  Handle a track kerning setting
 *
 *  Pass:
 * 	kern - track kerning
 */

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
 * 		Constants & Structures
 *--------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags FACFeatures ;
#define FACF_FONT_WEIGHT 	0x0004
#define FACF_FONT_WIDTH 		0x0002
#define FACF_TRACK_KERNING 	0x0001

/*
 *  Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */
typedef WordFlags FACToolboxFeatures ;

#define FAC_DEFAULT_FEATURES  (FACF_FONT_WEIGHT | FACF_FONT_WIDTH \
                        | FACF_TRACK_KERNING)
#define FAC_DEFAULT_TOOLBOX_FEATURES  0

/*	Notification structure */
typedef struct {
    byte	NFAC_fontWeight;
    byte	NFAC_fontWeightDiffs;
    byte	NFAC_fontWidth;
    byte	NFAC_fontWidthDiffs;
    word	NFAC_trackKerning;
    byte	NFAC_trackKerningDiffs;
} NotifyFontAttrChange} ;

/*---------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/
    @default GCI_output = (TO_APP_TARGET);

@endc

/*****************************************************************************
 * 		JustificationControlClass
 *****************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_PARA_ATTRIBUTES (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_JUSTIFICATION_CHANGE: NotifyJustificationChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class JustificationControlClass, GenControlClass;

/*----------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *---------------------------------------------------------------------------*/

@message void MSG_JC_SET_JUSTIFICATION ();

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags JCFeatures ;
#define JCF_FULL_CHAR 	0x0010	    /* DBCS only */
#define JCF_LEFT 	0x0008
#define JCF_RIGHT 	0x0004
#define JCF_CENTER 	0x0002
#define JCF_FULL 	0x0001

/*
 *  Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */
typedef WordFlags JCToolboxFeatures ;
#define JCTF_FULL_CHAR 	0x0010	    /* DBCS only */
#define JCTF_LEFT 	0x0008
#define JCTF_RIGHT 	0x0004
#define JCTF_CENTER 	0x0002
#define JCTF_FULL 	0x0001

#define JC_DEFAULT_FEATURES   (JCF_LEFT | JCF_RIGHT | JCF_CENTER | JCF_FULL)
#define JC_DEFAULT_TOOLBOX_FEATURES   (JCTF_LEFT | JCTF_RIGHT | \
                    JCTF_CENTER | JCTF_FULL)

/* 	Notification structure */
typedef struct {
    Justification	NJC_justification;
    byte		NJC_diffs;

    /*
     * if non-zero then use "general" in place
     * of "full"
     */
    byte		NJC_useGeneral;
} NotifyJustificationChange} ;

    @default GCI_output = (TO_APP_TARGET);
    @default GI_attrs = (@default | GA_KBD_SEARCH_PATH);

@endc

/*****************************************************************************
 * 		ParaSpacingControlClass
 *****************************************************************************
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class ParaSpacingControlClass, GenControlClass;

/*---------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *---------------------------------------------------------------------------*/

@message void MSG_PASC_SET_SPACE_ON_TOP (word spacing = dx);
@message void MSG_PASC_SET_SPACE_ON_BOTTOM (word spacing = dx);

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags PASCFeatures ;
#define PASCF_SPACE_ON_TOP 	0x0002
#define PASCF_SPACE_ON_BOTTOM 	0x0001

/*
 *  Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */
typedef WordFlags PASCToolboxFeatures ;

#define PASC_DEFAULT_FEATURES   (PASCF_SPACE_ON_TOP | PASCF_SPACE_ON_BOTTOM)
#define PASC_DEFAULT_TOOLBOX_FEATURES   0

/*---------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/
    @default GCI_output = (TO_APP_TARGET);

@endc

/*****************************************************************************
 * 		LineSpacingControlClass
 *****************************************************************************
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class LineSpacingControlClass, GenControlClass;

/*---------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *---------------------------------------------------------------------------*/

@message void MSG_LASC_SET_LINE_SPACING (BBFixed spacing = cx);

@message void MSG_LASC_SET_LINE_SPACING_WW_FIXED (WWFixed spacing = dx:cx);

@message void MSG_LASC_SET_LEADING_TYPE (word leadingType = cx);

@message void MSG_LASC_USER_CHANGED_LEADING_TYPE ();

@message void MSG_LASC_SET_MANUAL_LEADING (word leadingType = cx);

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags LASCFeatures ;
#define LASCF_SINGLE 		0x0010
#define LASCF_ONE_AND_A_HALF 	0x0008
#define LASCF_DOUBLE 		0x0004
#define LASCF_TRIPLE 		0x0002
#define LASCF_CUSTOM    		0x0001

/*
 *  Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */
typedef WordFlags LASCToolboxFeatures ;
#define LASCTF_SINGLE 	    	0x0008
#define LASCTF_ONE_AND_A_HALF 	0x0004
#define LASCTF_DOUBLE 	    	0x0002
#define LASCTF_TRIPLE 	    	0x0001

#define LASC_DEFAULT_FEATURES   (LASCF_SINGLE | LASCF_ONE_AND_A_HALF | \
                LASCF_DOUBLE | LASCF_TRIPLE | LASCF_CUSTOM)

#define LASC_DEFAULT_TOOLBOX_FEATURES   (LASCTF_SINGLE | LASCTF_ONE_AND_A_HALF \
                    | LASCTF_DOUBLE | LASCTF_TRIPLE)

/*---------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/

    @default GCI_output = (TO_APP_TARGET);

@endc

/*****************************************************************************
 * 		DefaultTabsControlClass
 *****************************************************************************
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class DefaultTabsControlClass, GenControlClass;

/*---------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *---------------------------------------------------------------------------*/

/* check on dx:cx - dx.cx XXX */
@message void MSG_DTC_SET_DEFAULT_TABS (WWFixed spacing = dx:cx);

@message void MSG_DTC_SET_DEFAULT_TABS_VIA_LIST (word tabs = cx);

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags DTCFeatures ;
#define DTCF_LIST 	0x0002
#define DTCF_CUSTOM 	0x0001

/*
 *  Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */
typedef WordFlags DTCToolboxFeatures ;

#define DTC_DEFAULT_FEATURES   (DTCF_LIST | DTCF_CUSTOM)
#define DTC_DEFAULT_TOOLBOX_FEATURES   0

/*---------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/

    @default GCI_output = (TO_APP_TARGET);

@endc

/*****************************************************************************
 * 		ParaBGColorControlClass
 *****************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_PARA_BG_COLOR (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_PARA_BG_COLOR_CHANGE: NotifyColorChange
 */

@class ParaBGColorControlClass, ColorSelectorClass;

/*---------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

#define PBGCC_DEFAULT_FEATURES   (CSF_INDEX | CSF_RGB | CSF_DRAW_MASK | CSF_PATTERN)

#define PBGCC_DEFAULT_TOOLBOX_FEATURES  (CSTF_INDEX | CSTF_DRAW_MASK | CSTF_PATTERN)

/*---------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/

    @default GI_states = @default & ~GS_ENABLED;
    @default GCI_output = (TO_APP_TARGET);

@endc

/*****************************************************************************
 * 		ParaAttrControlClass
 *****************************************************************************
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class ParaAttrControlClass, GenControlClass;

/*---------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *---------------------------------------------------------------------------*/

@message void MSG_PAC_SET_PARA_ATTR ();

@message void MSG_PAC_SET_KEEP (word selectedBooleans = cx,
                   word changedBooleans = bp);

@message void MSG_PAC_USER_CHANGED_KEEP ();
@message void MSG_PAC_SET_KEEP_FIRST (word value = dx);
@message void MSG_PAC_SET_KEEP_LAST (word value = dx);

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

/*
 *  Features flags (used with ATTR_GEN_CONTROL_REQUIRE_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_UI)
 */
typedef WordFlags PACFeatures ;
#define PACF_WORD_WRAP 	    	    0x0010
#define PACF_HIDDEN_TEXT 	    0x0008
#define PACF_KEEP_PARA_WITH_NEXT     0x0004
#define PACF_KEEP_PARA_TOGETHER 	    0x0002
#define PACF_KEEP_LINES 		    0x0001

/*
 *  Toolbox features flags (used with ATTR_GEN_CONTROL_REQUIRE_TOOLBOX_UI and
 *  ATTR_GEN_CONTROL_PROHIBIT_TOOLBOX_UI)
 */
typedef WordFlags PACToolboxFeatures ;

#define PAC_DEFAULT_FEATURES   (PACF_WORD_WRAP | PACF_HIDDEN_TEXT | \
                PACF_KEEP_PARA_WITH_NEXT | \
                PACF_KEEP_PARA_TOGETHER | PACF_KEEP_LINES)
#define PAC_DEFAULT_TOOLBOX_FEATURES   0

/*---------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/

    @default GCI_output = (TO_APP_TARGET);

@endc

/*****************************************************************************
 * 		BorderControlClass
 *****************************************************************************
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class BorderControlClass, GenControlClass;

/*---------------------------------------------------------------------------
 * 		Methods
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Internal methods
 *---------------------------------------------------------------------------*/

@message void MSG_BC_SET_SIMPLE_BORDER ();
@message void MSG_BC_SET_BORDER_BITS ();
@message void MSG_BC_SET_BORDER_WIDTH ();
@message void MSG_BC_SET_BORDER_SPACING ();
@message void MSG_BC_SET_BORDER_TYPE ();
@message void MSG_BC_BORDER_TYPE_STATUS ();
@message void MSG_BC_SET_BORDER_ANCHOR ();
@message void MSG_BC_SET_SHADOW_WIDTH ();
@message void MSG_BC_BORDER_SIDES_STATUS ();

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

typedef WordFlags BCFeatures ;
#define BCF_LIST 	0x0002
#define BCF_CUSTOM 	0x0001

typedef WordFlags BCToolboxFeatures ;

#define BC_DEFAULT_FEATURES   (BCF_LIST | BCF_CUSTOM)
#define BC_DEFAULT_TOOLBOX_FEATURES   0

    @default GCI_output = (TO_APP_TARGET);

@endc

/******************************************************************************
 * 		DropCapControlClass
 ******************************************************************************
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class DropCapControlClass, GenControlClass;

@message void MSG_DCC_SET_DROP_CAP (word spacing = cx);
@message void MSG_DCC_USER_CHANGED_DROP_CAP ();
@message void MSG_DCC_SET_DROP_CHARS (word value = dx);
@message void MSG_DCC_SET_DROP_LINES (word value = dx);
@message void MSG_DCC_SET_DROP_POSITION (word value = dx);

typedef WordFlags DCCFeatures ;
#define DCCF_DROP_CAP 	0x0001

typedef WordFlags DCCToolboxFeatures ;

#define DCC_DEFAULT_FEATURES   DCCF_DROP_CAP
#define DCC_DEFAULT_TOOLBOX_FEATURES   0

    @default GCI_output = (TO_APP_TARGET);

@endc

/*****************************************************************************
 * 		HyphenationControlClass
 *****************************************************************************
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class HyphenationControlClass, GenControlClass;

@message void MSG_HC_SET_HYPHENATION (word spacing = cx);
@message void MSG_HC_USER_CHANGED_HYPHENATION ();
@message void MSG_HC_SET_MAX_RANGE (word max = dx);
@message void MSG_HC_SET_MIN_WORD (word min = dx);
@message void MSG_HC_SET_MIN_PREFIX (word min = dx);
@message void MSG_HC_SET_MIN_SUFFIX (word min = dx);

typedef WordFlags HCFeatures ;
#define HCF_LIST 	0x0001

typedef WordFlags HCToolboxFeatures ;
#define HCTF_TOGGLE 	0x0001

#define HC_DEFAULT_FEATURES   HCF_LIST
#define HC_DEFAULT_TOOLBOX_FEATURES   HCTF_TOGGLE

    @default GCI_output = (TO_APP_TARGET);

@endc

/*****************************************************************************
 * 		BorderColorControlClass
 *****************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_PARA_BG_COLOR (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *  MANUFACTURER_ID_GEOWORKS.GWNT_PARA_BG_COLOR_CHANGE: NotifyColorChange
 */

@class BorderColorControlClass, ColorSelectorClass;

typedef WordFlags BCCToolboxFeatures ;

#define BCC_DEFAULT_FEATURES   (CSF_INDEX | CSF_RGB | CSF_DRAW_MASK | CSF_PATTERN)
#define BCC_DEFAULT_TOOLBOX_FEATURES   0

    @default GI_states = @default & ~GS_ENABLED;
    @default GCI_output = (TO_APP_TARGET);
    @default CSI_toolboxPrefs = (@default | (COO_LINE_ORIENTED << CTP_INDEX_ORIENTATION_OFFSET) | (COO_LINE_ORIENTED << CTP_DRAW_MASK_ORIENTATION_OFFSET));

@endc

/*****************************************************************************
 * 		MarginControlClass
 *****************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_LEFT_MARGIN
 *  MSG_VIS_TEXT_SET_PARA_MARGIN
 *  MSG_VIS_TEXT_SET_RIGHT_MARGIN
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: NotifyTextChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class MarginControlClass, GenControlClass;

@message void MSG_MC_SET_LEFT_MARGIN (WWFixed margin = dx:cx);
@message void MSG_MC_SET_PARA_MARGIN (WWFixed margin = dx:cx);
@message void MSG_MC_SET_RIGHT_MARGIN (WWFixed margin = dx:cx);

typedef WordFlags MCFeatures ;
#define MCF_LEFT_MARGIN 		0x0004
#define MCF_PARA_MARGIN 		0x0002
#define MCF_RIGHT_MARGIN 	0x0001

typedef WordFlags MCToolboxFeatures ;

#define MC_DEFAULT_FEATURES   (MCF_LEFT_MARGIN | MCF_PARA_MARGIN \
                | MCF_RIGHT_MARGIN)
#define MC_DEFAULT_TOOLBOX_FEATURES   0

    @default GCI_output = (TO_APP_TARGET);

@endc

/******************************************************************************
 * 		TabControlClass
 ******************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_VIS_TEXT_SET_LEFT_MARGIN
 *  MSG_VIS_TEXT_SET_PARA_MARGIN
 *  MSG_VIS_TEXT_SET_RIGHT_MARGIN
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_CHANGE: VisTextNotifyParaAttrChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class TabControlClass, GenControlClass;

@message void MSG_TC_SELECT_TAB ();
@message void MSG_TC_QUERY_TAB ();
@message void MSG_TC_SET_TAB_LINE ();
@message void MSG_TC_CLEAR_TAB ();
@message void MSG_TC_CLEAR_ALL_TABS ();
@message void MSG_TC_SET_TAB_TYPE ();

typedef WordFlags TCFeatures ;
#define TCF_LIST 	0x0080
#define TCF_POSITION 	0x0040
#define TCF_GRAY_SCREEN 	0x0020
#define TCF_TYPE 	0x0010
#define TCF_LEADER 	0x0008
#define TCF_LINE 	0x0004
#define TCF_CLEAR 	0x0002
#define TCF_CLEAR_ALL 	0x0001

typedef WordFlags TCToolboxFeatures ;

#define TC_DEFAULT_FEATURES   (TCF_LIST | TCF_POSITION | TCF_GRAY_SCREEN \
                | TCF_TYPE  | TCF_LEADER | TCF_LINE \
                | TCF_CLEAR | TCF_CLEAR_ALL)
#define TC_DEFAULT_TOOLBOX_FEATURES   0

/*---------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/

    @instance word	TCI_numberOfTabs;
    @instance Tab	TCI_tabList[VIS_TEXT_MAX_TABS];
    @instance word	TCI_selectedTab;

    @default GCI_output = (TO_APP_TARGET);

@endc

/*****************************************************************************
 * 		TextStyleSheetControlClass
 *****************************************************************************/

@class TextStyleSheetControlClass, StyleSheetControlClass;

    @default SSCI_styledClass = (ClassStruct *)&VisTextClass;
    @default SSCI_targetClass = (ClassStruct *)&VisTextClass;

@endc

/*****************************************************************************
 * 		SearchReplaceControlClass
 *****************************************************************************
 *
 *  Message(s) sent out:
 *  MSG_SEARCH (a MetaTextMessage)
 *  MSG_REPLACE_CURRENT (a MetaTextMessage)
 *  MSG_REPLACE_ALL_OCCURRENCES (a MetaTextMessage)
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_SEARCH_SPELL_ENABLE_CHANGE
 *  MANUFACTURER_ID_GEOWORKS.GWNT_SELECT_STATE_CHANGE
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class SearchReplaceControlClass, GenControlClass;

/*
 * The following messages are internal to the SearchReplaceControl object...
 */

@message void MSG_SRC_SEND_EVENT_TO_SEARCH_TEXT (EventHandle event=bp);
@message void MSG_SRC_SEND_EVENT_TO_REPLACE_TEXT (EventHandle event=bp);
/*
 * 	These messages send the passed events to the search/replace text objs
 *
 * 	Pass: Event handle
 * 	Return: from message
 */

@message void MSG_SRC_REPLACE_ALL_OCCURRENCES_QUERY_RESPONSE ();
/*
 * 	This method is sent out by the standard dialog box put up when we are
 * 	confirming a global delete.
 */

@message void MSG_SRC_REPLACE_ALL_OCCURRENCES_NO_QUERY ();
/*
 * 	Same as MSG_REPLACE_ALL_OCCURRENCES, but doesn't query the user if the
 * 	replace string is empty.
 */

@message void MSG_SRC_FIND_NEXT ();
@message void MSG_SRC_FIND_PREV ();
/*
 * 	Initiates a forward or backward search.
 */

typedef enum {
    SC_WILDCARD     = 0x0,
    SC_WILDCHAR     = 0x2,
    SC_GRAPHIC     = 0x4,
    SC_CR     = 0x6,
    SC_PAGE_BREAK     = 0x8,
    SC_TAB     = 0xa,
} SpecialChar} ;

@message void MSG_SRC_ADD_SPECIAL_CHAR_TO_FOCUS_TEXT (SpecialChar specialChar = cl);
/*
 * 	Adds a graphic representing the associated char to the search text.
 *
 * 	Pass: cl - SpecialChar
 */

@message void MSG_SRC_UPDATE_SPECIAL_CHARS_BY_FOCUS_INFO ();
/*
 * 	Updates various UI elements via the queue.
 *
 * 	This is useful if we have found out that an object has lost the
 * 	focus or target, and we want to wait to see what the new focus/target
 * 	object is before updating the UI.
 *
 * 	Pass: nothing
 */

@message void MSG_SRC_SEARCH_ABORTED ();
/*
 * 	Method sent out if the search is aborted by a user action.
 *
 * 	Pass: nothing
 */

@message void MSG_SRC_SEARCH_STRING_NOT_FOUND_FOR_SEARCH ();
@message void MSG_SRC_SEARCH_STRING_NOT_FOUND_FOR_REPLACE_ALL ();
@message void MSG_SRC_SEARCH_STRING_NOT_FOUND_FOR_REPLACE_ALL_IN_SELECTION ();
/*
 * 	These methods are sent to the SearchReplaceController if the search
 * 	string is not found in the document.
 *
 * 	Pass: nothing
 */

@protominor TextNewForJedi
@message void MSG_SRC_FIND_FROM_TOP ();
/*
 * 	Initiates a search starting from top.
 */

@message  SearchNoteOptionType MSG_SRC_GET_NOTE_SEARCH_STATE () = cl;
/*
 *	Find out what note option is currently used
 *	(ie include/exclude notes or note only). ""
 */
@protoreset

/*---------------------------------------------------------------------------
 * 		Hints
 *---------------------------------------------------------------------------*/

@vardata ChunkHandle	ATTR_SEARCH_CONTROL_SET_FIND_NEXT_MONIKER;
@vardata ChunkHandle	ATTR_SEARCH_CONTROL_SET_FIND_PREV_MONIKER;
@vardata ChunkHandle	ATTR_SEARCH_CONTROL_SET_REPLACE_CURRENT_MONIKER;
@vardata ChunkHandle	ATTR_SEARCH_CONTROL_SET_REPLACE_ALL_MONIKER;
@vardata ChunkHandle	ATTR_SEARCH_CONTROL_SET_REPLACE_ALL_IN_SELECTION_MONIKER;
/*
 * 	Vardata types that allow the app to change the name of these default
 * 	triggers.
 */

@vardata void  	ATTR_SEARCH_CONTROL_INTERACT_ONLY_WITH_TARGETED_TEXT_OBJECTS;
/*
 * 	When this is present, the search controller will update its UI
 * 	depending on whether or not there is a targeted text object.
 */

@vardata SelectionDataType  	ATTR_SEARCH_CONTROL_SELECTION_TYPE;
/*
 * 	When this is present, the search controller will use this type to
 * 	enable and disable the "Replace All in Selection" trigger whenever
 * 	a targeted object of the type has a selection.
 */

@protominor TextNewForJedi
@vardata ChunkHandle	ATTR_SEARCH_CONTROL_SET_FIND_FROM_TOP_MONIKER;
@vardata ChunkHandle	ATTR_SEARCH_CONTROL_SET_INCLUDE_NOTE_MONIKER;
@vardata ChunkHandle	ATTR_SEARCH_CONTROL_SET_EXCLUDE_NOTE_MONIKER;
@vardata ChunkHandle	ATTR_SEARCH_CONTROL_SET_NOTE_ONLY_MONIKER;
/*
 * Vardata types that allow the app to change the name of these default
 * monikers.
 */
@protoreset

/*---------------------------------------------------------------------------
 * 		Constants & Structures
 *---------------------------------------------------------------------------*/

#define SEARCH_REPLACE_MAX_WORD_LENGTH 	65 	/* 64 chars + 1 null */

typedef ByteFlags   SearchReplaceEnableFlags   ;
#define	SREF_SEARCH	 	0x2	/* Set if the object can handle searches */
#define	SREF_REPLACE		0x1	/* Set if the object can handle replaces */

typedef ByteEnum SearchReplaceFocusInfo ;
#define     SRFI_SEARCH_TEXT      	0
#define     SRFI_REPLACE_TEXT      	1

/*	Structure sent out with GWNT_SEARCH_REPLACE_ENABLE_CHANGE */
typedef struct {
    SearchReplaceEnableFlags	flags;
} NotifySearchReplaceEnableChange} ;

/* XXX */
extern void
    _pascal TextSendSearchNotification  (SearchReplaceEnableFlags flags);

typedef WordFlags   SRCFeatures   ;
#define    SRCF_NOTES_OPTIONS    			    0x0800
#define    SRCF_FIND_FROM_TOP    			    0x0400
#define	   SRCF_CLOSE	   	    	    	    	    0x0200
#define    SRCF_FIND_NEXT       	    	   	    0x0100
#define    SRCF_FIND_PREV       	    	    	    0x0080
#define    SRCF_REPLACE_CURRENT    	    		    0x0040
#define    SRCF_REPLACE_ALL_IN_SELECTION     	    0x0020
#define    SRCF_REPLACE_ALL     	    	 	    0x0010
#define    SRCF_PARTIAL_WORDS    	    	    	    0x0008
#define    SRCF_IGNORE_CASE     	    	 	    0x0004
#define    SRCF_WILDCARDS       	    	   	    0x0002
#define    SRCF_SPECIAL_CHARS    	    		    0x0001

typedef	WordFlags   SRCToolboxFeatures   ;
#define	SRCTF_SEARCH_REPLACE		0x0001

#define	SRC_DEFAULT_FEATURES	    (SRCF_FIND_NEXT |  SRCF_FIND_PREV |  SRCF_REPLACE_CURRENT |  SRCF_REPLACE_ALL |  SRCF_PARTIAL_WORDS |  SRCF_IGNORE_CASE |  SRCF_WILDCARDS |  SRCF_SPECIAL_CHARS | SRCF_REPLACE_ALL_IN_SELECTION | SRCF_CLOSE)

#define SRC_SUGGESTED_BEGINNING_FEATURES     (SRCF_FIND_NEXT | SRCF_REPLACE_CURRENT | SRCF_REPLACE_ALL | SRCF_CLOSE)

#define	SRC_DEFAULT_TOOLBOX_FEATURES	   SRCTF_SEARCH_REPLACE

/*---------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/

    /* Which object most recently had the focus */
    @instance	SearchReplaceFocusInfo	SRCI_focusInfo = SRFI_SEARCH_TEXT;

    /* Which options the current target handles */
    @instance	SearchReplaceEnableFlags    SRCI_enableFlags = SREF_SEARCH | SREF_REPLACE;

    /* 0 if no selection */
    @instance	byte	SRCI_haveSelection = 0;

    @default GCI_output = (TO_APP_TARGET);
@endc

/*****************************************************************************
 * 		TextRulerClass
 *****************************************************************************/

@class TextRulerClass, VisRulerClass;

#define TEXT_RULER_HEIGHT  	VIS_RULER_HEIGHT + 12
#define TEXT_POS_INVALID  	0x80000000

@message void MSG_TEXT_RULER_SET_GCN_CONTENT (optr content = cx:dx);
/*
 *  Set the content to attach to GCN lists for
 *
 *  Pass:
 * 	content - optr of content to attach
 *  Return:
 * 	none
 */

@message void MSG_TEXT_RULER_SET_CONTROLLED_ATTRS (
                TextRulerControlAttributes attrs = cx);
/*
 *  Set the controlled bits
 *
 *  Pass:
 * 	attrs - TextRulerControlAttributes
 *  Return:
 * 	none
 */

typedef ByteFlags TextRulerFlags ;
#define TRF_ALWAYS_MOVE_BOTH_MARGINS 	0x10
#define TRF_ROUND_COORDINATES 		0x08
#define TRF_OBJECT_SELECTED 		0x04
#define TRF_SELECTING 			0x02
#define TRF_DRAGGING 			0x01

typedef ByteEnum TextRulerAction ;
#define     TRA_NULL      0
#define     TRA_MOVE_TAB      1
#define     TRA_COPY_TAB      2
#define     TRA_MOVE_MARGIN      3

/*---------------------------------------------------------------------------
 * 		Instance Data
 *---------------------------------------------------------------------------*/

    @instance optr			TRI_tabControl;
    @instance byte			TRI_valid;
    @instance TextRulerFlags		TRI_flags;
    @instance TextRulerAction		TRI_action;
    @instance word			TRI_regionWidth;
    @instance optr			TRI_gcnContent;
    /*  Content to attach GCN list.
     *	0 to go up the visual tree, 1 to use application list.
     */

    @instance word			TRI_selectedTab;
    /*  Position of selected tab */

    @instance word			TRI_selectedObject;
    /*  Structure offset */

    @instance sword			TRI_selectX;
    /*  X position of start select */

    @instance VisTextParaAttrDiffs	TRI_diffs;

    @instance VisTextMaxParaAttr	TRI_paraAttr;
    /*  current attributes */

@endc

/******************************************************************************
 *		TextHelpControlClass
 ******************************************************************************
 *
 * Message(s) sent out:
 * MSG_VIS_TEXT_SET_CONTEXT
 * MSG_VIS_TEXT_DEFINE_CONTEXT
 *
 * Notification type(s) responded to:
 * MANUFACTURER_ID_GEOWORKS.NSNT_TEXT_TYPE_CHANGE: VisTextNotifyTypeChange
 *
 * GenApplication GCN lists to be placed on:
 *	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class TextHelpControlClass, GenControlClass;

/******************************************************************************
 *		Methods
 *****************************************************************************/

/******************************************************************************
 *		Internal Methods
 *****************************************************************************/

@message void MSG_THC_ADD_CONTEXT ();
/*
 *	Add a new context name.
 */

@message void MSG_THC_DELETE_CONTEXT ();
/*
 *	Delete a context name.
 */

@message void MSG_THC_RENAME_CONTEXT ();
/*
 *	Rename a context
 */

@message void MSG_THC_SET_CONTEXT (word curSelection = cx);
/*
 *	User did a "Set Context"
 */

@message void MSG_THC_DC_GET_MONIKER (optr list = cx:dx);
/*
 *	Get a moniker for the Define Context list
 */

@message void MSG_THC_SC_GET_MONIKER (optr list = cx:dx);
/*
 *	Get a moniker for the Set Context list
 */

@message void MSG_THC_ADD_FILE ();
/*
 *	Add a new file name
 */

@message void MSG_THC_DELETE_FILE ();
/*
 *	Delete a file name
 */

@message void MSG_THC_RENAME_FILE ();
/*
 *	Rename a file
 */

@message void MSG_THC_DF_GET_MONIKER (optr list = cx:dx);
/*
 *	Get a moniker for the Define File list
 */

@message void MSG_THC_DF_FILE_CHANGED (word curSelection = cx);
/*
 *	The user changed the file in the Define File box
 */

@message void MSG_THC_SH_FILE_CHANGED (word curSelection = cx);
/*
 *	The user changed the file in the Set Hyperlink box
 */

@message void MSG_THC_SET_HYPERLINK (word curSelection = cx);
/*
 *	User did a "Set Hyperlink"
 */

@message void MSG_THC_FOLLOW_HYPERLINK ();
/*
 *	User did a "Follow Hyperlink"
 */

@message void MSG_THC_SH_GET_MONIKER (optr list = cx:dx);
/*
 *	Get a moniker for the context list in the Set Hyperlink box
 */

@message void MSG_THC_DC_CONTEXT_CHANGED (word curSelection = cx);
/*
 *	The user change the context in the Define Context box
 */

@protominor TextNewForHelpEditor
@message void MSG_THC_DELETE_ALL_HYPERLINKS ();
/*
 *	Delete all hyperlinks in the document.
 *	User pressed the Delete All Hyperlinks trigger.
 */

@message void MSG_THC_UNSET_ALL_CONTEXTS ();
/*
 *	Unset all contexts in the document.
 *	User pressed the Unset All Contexts trigger.
 */
@protoreset

/******************************************************************************
 *		Hints
 *****************************************************************************/

    @vardata	word TEMP_CURRENT_CONTEXT_INDEX;    /* internal */

/******************************************************************************
 *		Constants & Structures
 *****************************************************************************/

typedef WordFlags   THCFeatures   ;
#define THCF_CLEAR_ALL_CONTEXTS      0x0040
#define THCF_CLEAR_ALL_HYPERLINKS    0x0020
#define THCF_FOLLOW_HYPERLINK 	    0x0010
#define	THCF_SET_HYPERLINK	  	    0x0008
#define	THCF_SET_CONTEXT	    	    0x0004
#define	THCF_DEFINE_FILE	    	    0x0002
#define	THCF_DEFINE_CONTEXT	 	    0x0001

#define THC_DEFAULT_FEATURES  equ (THCF_DEFINE_CONTEXT | THCF_DEFINE_FILE | \
                  THCF_SET_HYPERLINK | THCF_SET_CONTEXT | \
                    THCF_FOLLOW_HYPERLINK | \
                  THCF_CLEAR_ALL_CONTEXTS | \
                  THCF_CLEAR_ALL_HYPERLINKS)

#define THC_DEFAULT_TOOLBOX_FEATURES  equ 0

/******************************************************************************
 *		Instance Data
 *****************************************************************************/

    @instance	word	THCI_file;

@endc

/*****************************************************************************
 * 		TextRulerControlClass
 *****************************************************************************
 *
 *  This controller *does not* get notifications from the text rulers.  The
 *  controller maintains the state.
 *
 *  Message(s) sent out:
 *  MSG_TEXT_RULER_SET_CONTROLLED_ATTRS
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 * 	MGCNLT_ACTIVE_LIST
 */

@class TextRulerControlClass, GenControlClass;

@message void MSG_TRCC_CHANGE_STATE (word selectedBooleans = cx,
                    word changedBooleans = bp);

typedef WordFlags TRCCFeatures ;
#define TRCCF_ROUND 		0x8000
#define TRCCF_IGNORE_ORIGIN 	0x4000

typedef WordFlags TRCCToolboxFeatures ;

#define TRCC_DEFAULT_FEATURES   (TRCCF_ROUND | TRCCF_IGNORE_ORIGIN)
#define TRCC_DEFAULT_TOOLBOX_FEATURES   0

typedef WordFlags TextRulerControlAttributes ;
#define TRCA_ROUND 		0x8000
#define TRCA_IGNORE_ORIGIN 	0x4000

    @instance TextRulerControlAttributes	TRCI_attrs = TRCA_ROUND;

@endc;

/******************************************************************************
 * 		TextCountControlClass
 ******************************************************************************
 *
 *  Notification type(s) responded to:
 *  MANUFACTURER_ID_GEOWORKS.GWNT_TEXT_COUNT_CHANGE: NotifyTextChange
 *
 *  GenApplication GCN lists to be placed on:
 * 	GAGCNLT_SELF_LOAD_OPTIONS
 */

@class TextCountControlClass, GenControlClass;

@message void MSG_TCC_RECALC ();

typedef WordFlags TCCFeatures ;
#define TCCF_CHARACTER 	0x0010
#define TCCF_WORD    	0x0008
#define TCCF_LINE    	0x0004
#define TCCF_PARAGRAPH 	0x0002
#define TCCF_RECALC  	0x0001

typedef WordFlags TCCToolboxFeatures ;

#define TCC_DEFAULT_FEATURES  (TCCF_CHARACTER | TCCF_WORD | \
                  TCCF_LINE | TCCF_PARAGRAPH | TCCF_RECALC)

#define TCC_DEFAULT_TOOLBOX_FEATURES  0

@endc;

/****************************************************************************
 *	Macro for a Character menu
 ****************************************************************************/

#define CHARACTER_MENU_SELF_LOAD_OPTIONS  \
    MyFontControl, MyTextStyleControl, MyPointSizeControl,\
    MyCharFGColorControl, MyCharBGColorControl, MyFontAttrControl

@define CHARACTER_MENU_TOP \
@object GenInteractionClass CharacterMenu = {\
    GI_visMoniker = 'C', "Character";\
    GI_comp = MyFontControl, MyTextStyleControl, MyPointSizeControl,\
           MyCharFGColorControl, MyCharBGColorControl,\
           MyFontAttrControl;\
    GII_visibility = GIV_POPUP;\
}

@define CHARACTER_MENU_BODY \
@object FontControlClass MyFontControl = {\
    GI_visMoniker = 'F', "Fonts";\
    GII_visibility = GIV_POPUP;\
    HINT_GEN_CONTROL_USE_DEFAULT_TOOLS = -1;\
}\
\
@object TextStyleControlClass MyTextStyleControl = {\
    GI_visMoniker = 'S', "Styles";\
    GII_visibility = GIV_POPUP;\
    HINT_GEN_CONTROL_USE_DEFAULT_TOOLS = -1;\
}\
\
@object PointSizeControlClass MyPointSizeControl = {\
    GI_visMoniker = 'z', "Sizes";\
    GII_visibility = GIV_POPUP;\
    HINT_GEN_CONTROL_USE_DEFAULT_TOOLS = -1;\
}\
\
@object CharFGColorControlClass MyCharFGColorControl = {\
    GI_visMoniker = 'T', "Text Color";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_POSITION_WINDOW_AT_RATIO_OF_PARENT = {\
    SWSS_RATIO | PCT_25,\
    SWSS_RATIO | PCT_65\
    };\
}\
\
@object CharBGColorControlClass MyCharBGColorControl = {\
    GI_visMoniker = 'B', "Text Background Color";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_POSITION_WINDOW_AT_RATIO_OF_PARENT = {\
    SWSS_RATIO | PCT_35,\
    SWSS_RATIO | PCT_65\
    };\
}\
\
@object FontAttrControlClass MyFontAttrControl = {\
    GI_visMoniker = 'A', "Attributes";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_CENTER_WINDOW;\
}

/****************************************************************************
 *	Macro for a Paragraph menu
 ****************************************************************************/

@define PARAGRAPH_MENU_ACTIVE \
    MyTabControl

@define PARAGRAPH_MENU_SELF_LOAD_OPTIONS \
    MyJustificationControl, MyParaSpacingControl, MyParaBGColorControl,\
    MyParaAttrControl, MyMarginControl, MyTabControl, MyDefaultTabsControl,\
    MyBorderControl, MyBorderColorControl, MyDropCapControl,\
    MyHyphenationControl

@define PARAGRAPH_MENU_TOP \
@object GenInteractionClass ParagraphMenu = {\
    GI_visMoniker = 'P', "Paragraph";\
    GI_comp = MyJustificationControl, MyParaSpacingControl,\
          MyParaBGColorControl, MyParaAttrControl, MyMarginControl,\
          MyTabControl, MyDefaultTabsControl, BorderSubMenu,\
          MyDropCapControl, MyHyphenationControl;\
    GII_visibility = GIV_POPUP;\
}

@define PARAGRAPH_MENU_BODY \
@object JustificationControlClass MyJustificationControl = {\
    GII_visibility = GIV_SUB_GROUP;\
    HINT_SAME_CATEGORY_AS_PARENT;\
    HINT_GEN_CONTROL_USE_DEFAULT_TOOLS = -1;\
}\
\
@object ParaSpacingControlClass MyParaSpacingControl = {\
    GI_visMoniker = 'S', "Paragraph Spacing";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_CENTER_WINDOW;\
}\
\
@object ParaBGColorControlClass MyParaBGColorControl = {\
    GI_visMoniker = 'P', "Paragraph Color";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_CENTER_WINDOW;\
}\
\
@object ParaAttrControlClass MyParaAttrControl = {\
    GI_visMoniker = 'A', "Paragraph Attributes";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_CENTER_WINDOW;\
}\
\
@object MarginControlClass MyMarginControl = {\
    GI_visMoniker = 'M', "Margins";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_CENTER_WINDOW;\
}\
\
@object TabControlClass MyTabControl = {\
    GI_visMoniker = 'T', "Tabs";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_CENTER_WINDOW;\
}\
\
@object DefaultTabsControlClass MyDefaultTabsControl = {\
    GI_visMoniker = 'D', "Default Tabs";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_CENTER_WINDOW;\
}\
\
@object GenInteractionClass BorderSubMenu = {\
    GI_visMoniker = 'B', "Border";\
    GI_comp = MyBorderControl, MyBorderColorControl;\
    GII_visibility = GIV_POPUP;\
}\
\
@object BorderControlClass MyBorderControl = {\
}\
\
@object BorderColorControlClass MyBorderColorControl = {\
    GI_visMoniker = 'B', "Border Color";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_CENTER_WINDOW;\
}\
\
@object DropCapControlClass MyDropCapControl = {\
    GI_visMoniker = 'D', "Drop Cap";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_CENTER_WINDOW;\
}\
\
@object HyphenationControlClass MyHyphenationControl = {\
    GI_visMoniker = 'H', "Hyphenation";\
    GII_type = GIT_PROPERTIES;\
    GII_visibility = GIV_DIALOG;\
    HINT_CENTER_WINDOW;\
}

@ifdef __HIGHC__

pragma Alias (TextSendSearchNotification, "TEXTSENDSEARCHNOTIFICATION");

@endif

@endlib

@endif


thai.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1997.  All rights reserved.
    GEOWORKS CONFIDENTIAL

PROJECT:	PC GEOS
MODULE:		Thai Library
FILE:		thai.goh

AUTHOR:		Jason Ho, Oct 31, 1997

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name		Date		Description
    ----		----		-----------
    kho     	10/31/97   	Initial version.

DESCRIPTION:

    Contains description of the Thai Library.

    $Id: thai.goh,v 1.1.1.1 97/11/03 15:42:43 kho Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@ifndef __THAI_GOH
@define __THAI_GOH

@deflib thai

typedef enum {

  /* English */
  TKMT_ENGLISH   = 0x0,

  /* Thai */
  TKMT_THAI   = 0x2,

} ThaiKeyboardMapType} ;

/* ------------------------------------------------------------------------
 *   Exported functions
 * ----------------------------------------------------------------------*/

extern Boolean _far _pascal \
    ThaiSwitchToKeymap	(ThaiKeyboardMapType map);
/*
 *  Switch the keyboard mapping of the system keyboard driver to
 *  the specified keymap.
 *
 *  Pass:	ThaiKeyboardMapType map
 *  Return:	-1 if error (the system keyboard doesn't support keymap
 *		switching)
 *		0 otherwise
 */

extern ThaiKeyboardMapType _far _pascal \
    ThaiGetKeyboardMap	();
/*
 *  Gets the keymap being used in the keyboard driver.
 *
 *  Pass:	nothing
 *  Return:	ThaiKeyboardMapType
 * 		-1 if error (the system keyboard doesn't support keymap
 *		switching)
 */

extern ThaiKeyboardMapType _far _pascal \
    ThaiChangeKeyboardMap	();
/*
 *  Change the keymap being used in the keyboard driver. e.g. if Thai is
 *  being used right now, the driver would switch to English.
 *
 *  Pass:	nothing
 *  Return:	cx	= ThaiKeyboardMapType being switchd to.
 * 		-1 if error (the system keyboard doesn't support keymap
 *		switching)
 */

@endlib

#ifdef __HIGHC__
pragma Alias(ThaiGetKeyboardMap, "THAIGETKEYBOARDMAP");
pragma Alias(ThaiSwitchToKeymap, "THAISWITCHTOKEYMAP");
pragma Alias(ThaiChangeKeyboardMap, "THAICHANGEKEYBOARDMAP");
#endif

@endif


thaichar.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1997.  All rights reserved.
 *	GEOWORKS CONFIDENTIAL
 *
 * PROJECT:	  PC GEOS
 * MODULE:
 * FILE:	  thaichar.h
 *
 * AUTHOR:  	  Jason Ho: Sept 11, 1997
 *
 * REVISION HISTORY:
 *	Name		Date		Description
 *	----		----		-----------
 *	kho     	10/15/97   	Initial version
 *
 * DESCRIPTION:
 *
 *
 *
 *	$Id: thaichar.h,v 1.1.1.4 98/06/29 17:32:59 kho Exp $
 *
 ***********************************************************************/
#ifndef	__THAICHAR_H
#define __THAICHAR_H

#if DBCS_PCGEOS

#include  <unicode.h>

#else

/*
 *  The following represent the low byte of the character value
 *  only when the high byte is CS_BSW, in a Thai-enabled device:
 */
typedef ByteEnum ThaiChars ;

#define TC_NULL    0x0	/* NULL */
#define TC_CTRL_A    0x1	/* <ctrl>-A */
#define TC_CTRL_B    0x2	/* <ctrl>-B */
#define TC_CTRL_C    0x3	/* <ctrl>-C */
#define TC_CTRL_D    0x4	/* <ctrl>-D */
#define TC_CTRL_E    0x5	/* <ctrl>-E */
#define TC_CTRL_F    0x6	/* <ctrl>-F */
#define TC_CTRL_G    0x7	/* <ctrl>-G */
#define TC_CTRL_H    0x8	/* <ctrl>-H */
#define TC_TAB    0x9	/*  TAB */
#define TC_LINEFEED    0xa	/*  LINE FEED */
#define TC_CTRL_K    0xb	/* <ctrl>-K */
#define TC_CTRL_L    0xc	/* <ctrl>-L */
#define TC_ENTER    0xd	/*  ENTER or CR */
#define TC_SHIFT_OUT    0xe	/* <ctrl>-N */
#define TC_SHIFT_IN    0xf	/* <ctrl>-O */
#define TC_CTRL_P    0x10	/* <ctrl>-P */
#define TC_CTRL_Q    0x11	/* <ctrl>-Q */
#define TC_CTRL_R    0x12	/* <ctrl>-R */
#define TC_CTRL_S    0x13	/* <ctrl>-S */
#define TC_CTRL_T    0x14	/* <ctrl>-T */
#define TC_CTRL_U    0x15	/* <ctrl>-U */
#define TC_CTRL_V    0x16	/* <ctrl>-V */
#define TC_CTRL_W    0x17	/* <ctrl>-W */
#define TC_CTRL_X    0x18	/* <ctrl>-X */
#define TC_CTRL_Y    0x19	/* <ctrl>-Y */
#define TC_CTRL_Z    0x1a	/* <ctrl>-Z */
#define TC_ESCAPE    0x1b	/* ESC */

/* common shortcuts for low 32 codes */
#define TC_NUL 		TC_NULL
#define TC_STX 		TC_CTRL_B
#define TC_ETX 		TC_CTRL_C
#define TC_BEL 		TC_CTRL_G
#define TC_BS 		TC_CTRL_H
#define TC_HT 		TC_CTRL_I
#define TC_VT 		TC_CTRL_K
#define TC_FF 		TC_CTRL_L
#define TC_SO 		TC_CTRL_N
#define TC_SI 		TC_CTRL_O
#define TC_DC1 		TC_CTRL_Q
#define TC_DC2 		TC_CTRL_R
#define TC_DC3 		TC_CTRL_S
#define TC_DC4 		TC_CTRL_T
#define TC_CAN 		TC_CTRL_X
#define TC_EM 		TC_CTRL_Y
#define TC_ESC 		TC_ESCAPE

/* some alternative names: */

#define TC_CR 		TC_ENTER
#define TC_CTRL_M 	TC_ENTER
#define TC_CTRL_I 	TC_TAB
#define TC_CTRL_J 	TC_LINEFEED
#define TC_LF 		TC_LINEFEED
#define TC_CTRL_N 	TC_SHIFT_OUT
#define TC_CTRL_O 	TC_SHIFT_IN

#define TC_NULL_WIDTH 	0x19	/* null width character */
#define TC_GRAPHIC 	0x1a	/* Graphic in text. */

#define TC_THINSPACE 	0x1b	/* 1/4 width space */
#define TC_ENSPACE 	0x1c	/* En-space, fixed width */
#define TC_EMSPACE 	0x1d	/* Em-space, fixed width. */

#define TC_SECTION_BREAK 	TC_CTRL_K

#define TC_PAGE_BREAK 		TC_CTRL_L
#define TC_COLUMN_BREAK 		TC_PAGE_BREAK

#define TC_NONBRKHYPHEN 	0x1e	/* Non breaking hyphen. */
#define TC_OPTHYPHEN 	0x1f	/* Optional hyphen, only drawn at
                   end of line. */

#define TC_FS 		C_ENSPACE
#define TC_FIELD_SEP 	C_FS

/*
 * the standard ASCII chars:
 */
#define TC_SPACE   ' '
#define TC_EXCLAMATION   '!'
#define TC_QUOTE   '"'
#define TC_NUMBER_SIGN   '#'
#define TC_DOLLAR_SIGN   '$'
#define TC_PERCENT   '%'
#define TC_AMPERSAND   '&'
#define TC_SNG_QUOTE    0x27
#define TC_LEFT_PAREN   '('
#define TC_RIGHT_PAREN   ')'
#define TC_ASTERISK   '*'
#define TC_PLUS   '+'
#define TC_COMMA   ','
#define TC_MINUS   '-'
#define TC_PERIOD   '.'
#define TC_SLASH   '/'
#define TC_ZERO   '0'
#define TC_ONE   '1'
#define TC_TWO   '2'
#define TC_THREE   '3'
#define TC_FOUR   '4'
#define TC_FIVE   '5'
#define TC_SIX   '6'
#define TC_SEVEN   '7'
#define TC_EIGHT   '8'
#define TC_NINE   '9'
#define TC_COLON   ':'
#define TC_SEMICOLON   ';'
#define TC_LESS_THAN   '<'
#define TC_EQUAL   '='
#define TC_GREATER_THAN   '>'
#define TC_QUESTION_MARK   '?'
/* #define TC_AT_SIGN  '@' */
/* GOC doesn't like this */
#define TC_AT_SIGN    0x40
#define TC_CAP_A   'A'
#define TC_CAP_B   'B'
#define TC_CAP_C   'C'
#define TC_CAP_D   'D'
#define TC_CAP_E   'E'
#define TC_CAP_F   'F'
#define TC_CAP_G   'G'
#define TC_CAP_H   'H'
#define TC_CAP_I   'I'
#define TC_CAP_J   'J'
#define TC_CAP_K   'K'
#define TC_CAP_L   'L'
#define TC_CAP_M   'M'
#define TC_CAP_N   'N'
#define TC_CAP_O   'O'
#define TC_CAP_P   'P'
#define TC_CAP_Q   'Q'
#define TC_CAP_R   'R'
#define TC_CAP_S   'S'
#define TC_CAP_T   'T'
#define TC_CAP_U   'U'
#define TC_CAP_V   'V'
#define TC_CAP_W   'W'
#define TC_CAP_X   'X'
#define TC_CAP_Y   'Y'
#define TC_CAP_Z   'Z'
#define TC_LEFT_BRACKET   '['
#define TC_BACKSLASH    0x5c
#define TC_RIGHT_BRACKET   ']'
#define TC_ASCII_CIRCUMFLEX   '^'
#define TC_UNDERSCORE   '_'
#define TC_BACKQUOTE   '`'
#define TC_SMALL_A   'a'
#define TC_SMALL_B   'b'
#define TC_SMALL_C   'c'
#define TC_SMALL_D   'd'
#define TC_SMALL_E   'e'
#define TC_SMALL_F   'f'
#define TC_SMALL_G   'g'
#define TC_SMALL_H   'h'
#define TC_SMALL_I   'i'
#define TC_SMALL_J   'j'
#define TC_SMALL_K   'k'
#define TC_SMALL_L   'l'
#define TC_SMALL_M   'm'
#define TC_SMALL_N   'n'
#define TC_SMALL_O   'o'
#define TC_SMALL_P   'p'
#define TC_SMALL_Q   'q'
#define TC_SMALL_R   'r'
#define TC_SMALL_S   's'
#define TC_SMALL_T   't'
#define TC_SMALL_U   'u'
#define TC_SMALL_V   'v'
#define TC_SMALL_W   'w'
#define TC_SMALL_X   'x'
#define TC_SMALL_Y   'y'
#define TC_SMALL_Z   'z'
#define TC_LEFT_BRACE   '{'
#define TC_VERTICAL_BAR   '|'
#define TC_RIGHT_BRACE   '}'
#define TC_ASCII_TILDE   '~'
#define TC_DELETE    0x7f

/* some alternative names: */

#define TC_HYPHEN 	TC_MINUS
#define TC_GRAVE 		TC_BACKQUOTE

/*
 * Some characters are dropped because they are rarely or never used in
 * modern Thai.
 */
#define TC_CHARACTER_KO_KAI 			0xa1
#define TC_CHARACTER_KHO_KHAI 			0xa2
/* #define TC_CHARACTER_KHO_KHUAT		0xa3 dropped */
#define TC_CHARACTER_KHO_KHWAI 			0xa4
#define TC_CHARACTER_KHO_KHON 			0xa5
#define TC_CHARACTER_KHO_RAKHANG 		0xa6
#define TC_CHARACTER_NGO_NGU 			0xa7
#define TC_CHARACTER_CHO_CHAN 			0xa8
#define TC_CHARACTER_CHO_CHING 			0xa9
#define TC_CHARACTER_CHO_CHANG 			0xaa
#define TC_CHARACTER_SO_SO 			0xab
#define TC_CHARACTER_CHO_CHOE 			0xac
#define TC_CHARACTER_YO_YING 			0xad
#define TC_CHARACTER_DO_CHADA 			0xae
#define TC_CHARACTER_TO_PATAK 			0xaf
#define TC_CHARACTER_THO_THAN 			0xb0
#define TC_CHARACTER_THO_NANGMONTHO 		0xb1
#define TC_CHARACTER_THO_PHUTHAO 		0xb2
#define TC_CHARACTER_NO_NEN 			0xb3
#define TC_CHARACTER_DO_DEK 			0xb4
#define TC_CHARACTER_TO_TAO 			0xb5
#define TC_CHARACTER_THO_THUNG 			0xb6
#define TC_CHARACTER_THO_THAHAN 			0xb7
#define TC_CHARACTER_THO_THONG 			0xb8
#define TC_CHARACTER_NO_NU 			0xb9
#define TC_CHARACTER_BO_BAIMAI 			0xba
#define TC_CHARACTER_PO_PLA 			0xbb
#define TC_CHARACTER_PHO_PHUNG 			0xbc
#define TC_CHARACTER_FO_FA 			0xbd
#define TC_CHARACTER_PHO_PHAN 			0xbe
#define TC_CHARACTER_FO_FAN 			0xbf
#define TC_CHARACTER_PHO_SAMPHAO 		0xc0
#define TC_CHARACTER_MO_MA 			0xc1
#define TC_CHARACTER_YO_YAK 			0xc2
#define TC_CHARACTER_RO_RUA 			0xc3
#define TC_CHARACTER_RU 				0xc4
#define TC_CHARACTER_LO_LING 			0xc5
#define TC_CHARACTER_LU 				0xc6
#define TC_CHARACTER_WO_WAEN 			0xc7
#define TC_CHARACTER_SO_SALA 			0xc8
#define TC_CHARACTER_SO_RUSI 			0xc9
#define TC_CHARACTER_SO_SUA 			0xca
#define TC_CHARACTER_HO_HIP 			0xcb
#define TC_CHARACTER_LO_CHULA 			0xcc
#define TC_CHARACTER_O_ANG 			0xcd
#define TC_CHARACTER_HO_NOKHUK 			0xce
#define TC_CHARACTER_PAIYANNOI 			0xcf
#define TC_CHARACTER_SARA_A 			0xd0
#define TC_CHARACTER_MAI_HAN_AKAT 		0xd1
#define TC_CHARACTER_SARA_AA 			0xd2
#define TC_CHARACTER_SARA_AM 			0xd3
#define TC_CHARACTER_SARA_I 			0xd4
#define TC_CHARACTER_SARA_II 			0xd5
#define TC_CHARACTER_SARA_UE 			0xd6
#define TC_CHARACTER_SARA_UEE 			0xd7
#define TC_CHARACTER_SARA_U 			0xd8
#define TC_CHARACTER_SARA_UU 			0xd9
#define TC_CHARACTER_PHINTHU 			0xda
#define TC_CURRENCY_SYMBOL_BAHT 			0xdf
#define TC_CHARACTER_SARA_E 			0xe0
#define TC_CHARACTER_SARA_AE 			0xe1
#define TC_CHARACTER_SARA_O 			0xe2
#define TC_CHARACTER_SARA_AI_MAIMUAN 		0xe3
#define TC_CHARACTER_SARA_AI_MAIMALAI 		0xe4
/* #define TC_CHARACTER_LAKKHANGYAO		0xe5 dropped */
#define TC_CHARACTER_MAIYAMOK 			0xe6
#define TC_CHARACTER_MAITAIKHU 			0xe7
#define TC_CHARACTER_MAI_EK 			0xe8
#define TC_CHARACTER_MAI_THO 			0xe9
#define TC_CHARACTER_MAI_TRI 			0xea
#define TC_CHARACTER_MAI_CHATTAWA 		0xeb
#define TC_CHARACTER_THANTHAKHAT 		0xec
#define TC_CHARACTER_NIKHAHIT 			0xed
/* #define TC_CHARACTER_YAMAKKAN		0xee dropped */
/* #define TC_CHARACTER_FONGMAN			0xef dropped */
#define TC_DIGIT_ZERO 				0xf0
#define TC_DIGIT_ONE 				0xf1
#define TC_DIGIT_TWO 				0xf2
#define TC_DIGIT_THREE 				0xf3
#define TC_DIGIT_FOUR 				0xf4
#define TC_DIGIT_FIVE 				0xf5
#define TC_DIGIT_SIX 				0xf6
#define TC_DIGIT_SEVEN 				0xf7
#define TC_DIGIT_EIGHT 				0xf8
#define TC_DIGIT_NINE 				0xf9
/* #define TC_CHARACTER_ANGKHANKHU		0xfa dropped */
/* #define TC_CHARACTER_KHOMUT			0xfb dropped */

/*
 * Variations of characters.
 */
#define TC_CHARACTER_MAI_EK_LEFT_DOWN 		0x83
#define TC_CHARACTER_MAI_THO_LEFT_DOWN 		0x84
#define TC_CHARACTER_MAI_TRI_LEFT_DOWN 		0x85
#define TC_CHARACTER_MAI_CHATTAWA_LEFT_DOWN 	0x86
#define TC_CHARACTER_THANTHAKHAT_LEFT_DOWN 	0x87

#define TC_CHARACTER_MAI_EK_DOWN 		0x88
#define TC_CHARACTER_MAI_THO_DOWN 		0x89
#define TC_CHARACTER_MAI_TRI_DOWN 		0x8a
#define TC_CHARACTER_MAI_CHATTAWA_DOWN 		0x8b
#define TC_CHARACTER_THANTHAKHAT_DOWN 		0x8c

#define TC_CHARACTER_NIKHAHIT_LEFT 		0x8f

#define TC_CHARACTER_YO_YING_NO_DESCENT 		0x90

#define TC_CHARACTER_SARA_AM_SPLIT 		0x91

#define TC_CHARACTER_MAI_HAN_AKAT_LEFT 		0x92
#define TC_CHARACTER_MAITAIKHU_LEFT 		0x93
#define TC_CHARACTER_SARA_I_LEFT 		0x94
#define TC_CHARACTER_SARA_II_LEFT 		0x95
#define TC_CHARACTER_SARA_UE_LEFT 		0x96
#define TC_CHARACTER_SARA_UEE_LEFT 		0x97

#define TC_CHARACTER_MAI_EK_LEFT 		0x98
#define TC_CHARACTER_MAI_THO_LEFT 		0x99
#define TC_CHARACTER_MAI_TRI_LEFT 		0x9a
#define TC_CHARACTER_MAI_CHATTAWA_LEFT 		0x9b
#define TC_CHARACTER_THANTHAKHAT_LEFT 		0x9c

#define TC_CHARACTER_THO_THAN_NO_DESCENT 	0x9f

/*
 * Special characters.
 */
#define TC_ACUTE 				0x80
#define TC_L_MU 					0x81
#define TC_PLUSMINUS 				0x82
#define TC_PARAGRAPH 				0x8d
#define TC_GERMANDBLS 				0x8e
#define TC_REGISTERED 				0x9d
#define TC_COPYRIGHT 				0x9e
#define TC_TRADEMARK 				0xa0
#define TC_L_PI 					0xa3
#define TC_CURRENCY 				0xdb
#define TC_STERLING 				0xdc
#define TC_YEN 					0xdd
#define TC_CENT 					0xde
#define TC_SECTION 				0xe5
#define TC_LESSEQUAL 				0xee
#define TC_GREATEREQUAL 				0xef
#define TC_ORDFEMININE 				0xfa
#define TC_PERTHOUSAND 				0xfb
#define TC_GUILLEDBLLEFT 			0xfc
#define TC_GUILLEDBLRIGHT 			0xfd
#define TC_DIVISION 				0xfe
#define TC_DEGREE 				0xff
#endif

#endif /* __THAICHAR_H */


thaikbd.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1997.  All rights reserved.
 *	GEOWORKS CONFIDENTIAL
 *
 * PROJECT:	  PC GEOS
 * MODULE:
 * FILE:	  thaikbd.h
 *
 * AUTHOR:  	  Jason Ho: Dec 11, 1997
 *
 * REVISION HISTORY:
 *	Name		Date		Description
 *	----		----		-----------
 *	kho     	12/11/97   	Initial version
 *
 * DESCRIPTION:
 *
 *	A list of equivalent characters on Thai/English keyboard maps.
 *
 *	$Id: thaikbd.h,v 1.1.1.2 98/06/29 17:33:33 kho Exp $
 *
 ***********************************************************************/
#ifndef _THAIKBD_H_
#define _THAIKBD_H_

#if DBCS_PCGEOS

/* not supported */

#else

#include  <thaichar.h>

/*
 * Thai char you get by pressing English char in Thai keymap.
 */
#define THAI_CHAR_FROM_KEY_CAP_A 		TC_CHARACTER_RU
#define THAI_CHAR_FROM_KEY_CAP_B 		TC_CHARACTER_PHINTHU
#define THAI_CHAR_FROM_KEY_CAP_C 		TC_CHARACTER_CHO_CHING
#define THAI_CHAR_FROM_KEY_CAP_D 		TC_CHARACTER_TO_PATAK
#define THAI_CHAR_FROM_KEY_CAP_E 		TC_CHARACTER_DO_CHADA
#define THAI_CHAR_FROM_KEY_CAP_F 		TC_CHARACTER_SARA_O
#define THAI_CHAR_FROM_KEY_CAP_G 		TC_CHARACTER_CHO_CHOE
#define THAI_CHAR_FROM_KEY_CAP_H 		TC_CHARACTER_MAITAIKHU
#define THAI_CHAR_FROM_KEY_CAP_I 		TC_CHARACTER_NO_NEN
#define THAI_CHAR_FROM_KEY_CAP_J 		TC_CHARACTER_MAI_CHATTAWA
#define THAI_CHAR_FROM_KEY_CAP_K 		TC_CHARACTER_SO_RUSI
#define THAI_CHAR_FROM_KEY_CAP_L 		TC_CHARACTER_SO_SALA
#define THAI_CHAR_FROM_KEY_CAP_M 		TC_ASCII_CIRCUMFLEX
#define THAI_CHAR_FROM_KEY_CAP_N 		TC_CHARACTER_THANTHAKHAT
#define THAI_CHAR_FROM_KEY_CAP_O 		TC_CHARACTER_PAIYANNOI
#define THAI_CHAR_FROM_KEY_CAP_P 		TC_CHARACTER_YO_YING
#define THAI_CHAR_FROM_KEY_CAP_Q 		TC_DIGIT_ZERO
#define THAI_CHAR_FROM_KEY_CAP_R 		TC_CHARACTER_THO_NANGMONTHO
#define THAI_CHAR_FROM_KEY_CAP_S 		TC_CHARACTER_KHO_RAKHANG
#define THAI_CHAR_FROM_KEY_CAP_T 		TC_CHARACTER_THO_THONG
#define THAI_CHAR_FROM_KEY_CAP_U 		TC_CHARACTER_MAI_TRI
#define THAI_CHAR_FROM_KEY_CAP_V 		TC_CHARACTER_HO_NOKHUK
#define THAI_CHAR_FROM_KEY_CAP_W 		TC_QUOTE
#define THAI_CHAR_FROM_KEY_CAP_X 		TC_RIGHT_PAREN
#define THAI_CHAR_FROM_KEY_CAP_Y 		TC_CHARACTER_NIKHAHIT
#define THAI_CHAR_FROM_KEY_CAP_Z 		TC_LEFT_PAREN
#define THAI_CHAR_FROM_KEY_COMMA 		TC_CHARACTER_MO_MA
#define THAI_CHAR_FROM_KEY_EIGHT 		TC_CHARACTER_KHO_KHWAI
#define THAI_CHAR_FROM_KEY_FIVE 			TC_CHARACTER_THO_THUNG
#define THAI_CHAR_FROM_KEY_FOUR 			TC_CHARACTER_PHO_SAMPHAO
#define THAI_CHAR_FROM_KEY_NINE 			TC_CHARACTER_TO_TAO
#define THAI_CHAR_FROM_KEY_ONE 			TC_PLUS
#define THAI_CHAR_FROM_KEY_PERIOD 		TC_CHARACTER_SARA_AI_MAIMUAN
#define THAI_CHAR_FROM_KEY_SEMICOLON 		TC_CHARACTER_WO_WAEN
#define THAI_CHAR_FROM_KEY_SEVEN 		TC_CHARACTER_SARA_UE
#define THAI_CHAR_FROM_KEY_SHIFT_COMMA 		TC_CHARACTER_THO_PHUTHAO
#define THAI_CHAR_FROM_KEY_SHIFT_EIGHT 		TC_DIGIT_EIGHT
#define THAI_CHAR_FROM_KEY_SHIFT_FIVE 		TC_DIGIT_FIVE
#define THAI_CHAR_FROM_KEY_SHIFT_FOUR 		TC_DIGIT_FOUR
#define THAI_CHAR_FROM_KEY_SHIFT_NINE 		TC_DIGIT_NINE
#define THAI_CHAR_FROM_KEY_SHIFT_ONE 		TC_DIGIT_ONE
#define THAI_CHAR_FROM_KEY_SHIFT_PERIOD 		TC_CHARACTER_LO_CHULA
#define THAI_CHAR_FROM_KEY_SHIFT_SEMICOLON 	TC_CHARACTER_SO_SO
#define THAI_CHAR_FROM_KEY_SHIFT_SEVEN 		TC_DIGIT_SEVEN
#define THAI_CHAR_FROM_KEY_SHIFT_SIX 		TC_CHARACTER_SARA_UU
#define THAI_CHAR_FROM_KEY_SHIFT_THREE 		TC_DIGIT_THREE
#define THAI_CHAR_FROM_KEY_SHIFT_TWO 		TC_DIGIT_TWO
#define THAI_CHAR_FROM_KEY_SHIFT_ZERO 		TC_DIGIT_ZERO
#define THAI_CHAR_FROM_KEY_SIX 			TC_CHARACTER_SARA_U
#define THAI_CHAR_FROM_KEY_SMALL_A 		TC_CHARACTER_FO_FAN
#define THAI_CHAR_FROM_KEY_SMALL_B 		TC_CHARACTER_SARA_I
#define THAI_CHAR_FROM_KEY_SMALL_C 		TC_CHARACTER_SARA_AE
#define THAI_CHAR_FROM_KEY_SMALL_D 		TC_CHARACTER_KO_KAI
#define THAI_CHAR_FROM_KEY_SMALL_E 		TC_CHARACTER_SARA_AM
#define THAI_CHAR_FROM_KEY_SMALL_F 		TC_CHARACTER_DO_DEK
#define THAI_CHAR_FROM_KEY_SMALL_G 		TC_CHARACTER_SARA_E
#define THAI_CHAR_FROM_KEY_SMALL_H 		TC_CHARACTER_MAI_THO
#define THAI_CHAR_FROM_KEY_SMALL_I 		TC_CHARACTER_RO_RUA
#define THAI_CHAR_FROM_KEY_SMALL_J 		TC_CHARACTER_MAI_EK
#define THAI_CHAR_FROM_KEY_SMALL_K 		TC_CHARACTER_SARA_AA
#define THAI_CHAR_FROM_KEY_SMALL_L 		TC_CHARACTER_SO_SUA
#define THAI_CHAR_FROM_KEY_SMALL_M 		TC_CHARACTER_THO_THAHAN
#define THAI_CHAR_FROM_KEY_SMALL_N 		TC_CHARACTER_SARA_UEE
#define THAI_CHAR_FROM_KEY_SMALL_O 		TC_CHARACTER_NO_NU
#define THAI_CHAR_FROM_KEY_SMALL_P 		TC_CHARACTER_YO_YAK
#define THAI_CHAR_FROM_KEY_SMALL_Q 		TC_CHARACTER_MAIYAMOK
#define THAI_CHAR_FROM_KEY_SMALL_R 		TC_CHARACTER_PHO_PHAN
#define THAI_CHAR_FROM_KEY_SMALL_S 		TC_CHARACTER_HO_HIP
#define THAI_CHAR_FROM_KEY_SMALL_T 		TC_CHARACTER_SARA_A
#define THAI_CHAR_FROM_KEY_SMALL_U 		TC_CHARACTER_SARA_II
#define THAI_CHAR_FROM_KEY_SMALL_V 		TC_CHARACTER_O_ANG
#define THAI_CHAR_FROM_KEY_SMALL_W 		TC_CHARACTER_SARA_AI_MAIMALAI
#define THAI_CHAR_FROM_KEY_SMALL_X 		TC_CHARACTER_PO_PLA
#define THAI_CHAR_FROM_KEY_SMALL_Y 		TC_CHARACTER_MAI_HAN_AKAT
#define THAI_CHAR_FROM_KEY_SMALL_Z 		TC_CHARACTER_PHO_PHUNG
#define THAI_CHAR_FROM_KEY_SPACE 		TC_SPACE
#define THAI_CHAR_FROM_KEY_THREE 		TC_MINUS
#define THAI_CHAR_FROM_KEY_TWO 			TC_CURRENCY_SYMBOL_BAHT
#define THAI_CHAR_FROM_KEY_ZERO 			TC_CHARACTER_CHO_CHAN

/*
 * English char to be pressed in Thai keymap to get the Thai char.
 */
#define ENG_CHAR_TO_GET_CHAR_RU 			TC_CAP_A
#define ENG_CHAR_TO_GET_CHAR_PHINTHU 		TC_CAP_B
#define ENG_CHAR_TO_GET_CHAR_CHO_CHING 		TC_CAP_C
#define ENG_CHAR_TO_GET_CHAR_TO_PATAK 		TC_CAP_D
#define ENG_CHAR_TO_GET_CHAR_DO_CHADA 		TC_CAP_E
#define ENG_CHAR_TO_GET_CHAR_SARA_O 		TC_CAP_F
#define ENG_CHAR_TO_GET_CHAR_CHO_CHOE 		TC_CAP_G
#define ENG_CHAR_TO_GET_CHAR_MAITAIKHU 		TC_CAP_H
#define ENG_CHAR_TO_GET_CHAR_NO_NEN 		TC_CAP_I
#define ENG_CHAR_TO_GET_CHAR_MAI_CHATTAWA 	TC_CAP_J
#define ENG_CHAR_TO_GET_CHAR_SO_RUSI 		TC_CAP_K
#define ENG_CHAR_TO_GET_CHAR_SO_SALA 		TC_CAP_L
#define ENG_CHAR_TO_GET_ASCII_CIRCUMFLEX 	TC_CAP_M
#define ENG_CHAR_TO_GET_CHAR_THANTHAKHAT 	TC_CAP_N
#define ENG_CHAR_TO_GET_CHAR_PAIYANNOI 		TC_CAP_O
#define ENG_CHAR_TO_GET_CHAR_YO_YING 		TC_CAP_P
#define ENG_CHAR_TO_GET_DIGIT_ZERO 		TC_CAP_Q
#define ENG_CHAR_TO_GET_CHAR_THO_NANGMONTHO 	TC_CAP_R
#define ENG_CHAR_TO_GET_CHAR_KHO_RAKHANG 	TC_CAP_S
#define ENG_CHAR_TO_GET_CHAR_THO_THONG 		TC_CAP_T
#define ENG_CHAR_TO_GET_CHAR_MAI_TRI 		TC_CAP_U
#define ENG_CHAR_TO_GET_CHAR_HO_NOKHUK 		TC_CAP_V
#define ENG_CHAR_TO_GET_QUOTE 			TC_CAP_W
#define ENG_CHAR_TO_GET_RIGHT_PAREN 		TC_CAP_X
#define ENG_CHAR_TO_GET_CHAR_NIKHAHIT 		TC_CAP_Y
#define ENG_CHAR_TO_GET_LEFT_PAREN 		TC_CAP_Z
#define ENG_CHAR_TO_GET_CHAR_MO_MA 		TC_COMMA
#define ENG_CHAR_TO_GET_CHAR_KHO_KHWAI 		TC_EIGHT
#define ENG_CHAR_TO_GET_CHAR_THO_THUNG 		TC_FIVE
#define ENG_CHAR_TO_GET_CHAR_PHO_SAMPHAO 	TC_FOUR
#define ENG_CHAR_TO_GET_CHAR_TO_TAO 		TC_NINE
#define ENG_CHAR_TO_GET_PLUS 			TC_ONE
#define ENG_CHAR_TO_GET_CHAR_SARA_AI_MAIMUAN 	TC_PERIOD
#define ENG_CHAR_TO_GET_CHAR_WO_WAEN 		TC_SEMICOLON
#define ENG_CHAR_TO_GET_CHAR_SARA_UE 		TC_SEVEN
#define ENG_CHAR_TO_GET_CHAR_THO_PHUTHAO 	TC_GREATER_THAN	/*SHIFT_COMMA*/
#define ENG_CHAR_TO_GET_DIGIT_EIGHT 		TC_ASTERISK	/*SHIFT_EIGHT*/
#define ENG_CHAR_TO_GET_DIGIT_FIVE 		TC_PERCENT	/*SHIFT_FIVE*/
#define ENG_CHAR_TO_GET_DIGIT_FOUR 		TC_DOLLAR_SIGN	/*SHIFT_FOUR*/
#define ENG_CHAR_TO_GET_DIGIT_NINE 		TC_LEFT_PAREN	/*SHIFT_NINE*/
#define ENG_CHAR_TO_GET_DIGIT_ONE 		TC_EXCLAMATION	/*SHIFT_ONE*/
#define ENG_CHAR_TO_GET_CHAR_LO_CHULA 		TC_LESS_THAN	/*SHIFT_PERIOD*/
#define NG_CHAR_TO_GET_CHAR_SO_SO 		TC_COLON	/*SHIFT_SEMICOLON*/
#define ENG_CHAR_TO_GET_DIGIT_SEVEN 		TC_AMPERSAND	/*SHIFT_SEVEN*/
#define ENG_CHAR_TO_GET_CHAR_SARA_UU 		TC_ASCII_CIRCUMFLEX/*SHIFT_SIX*/
#define ENG_CHAR_TO_GET_DIGIT_THREE 		TC_NUMBER_SIGN	/*SHIFT_THREE*/
#define ENG_CHAR_TO_GET_DIGIT_TWO 		TC_AT_SIGN	/*SHIFT_TWO*/
/* #define ENG_CHAR_TO_GET_DIGIT_ZERO		TC_RIGHT_PAREN	SHIFT_ZERO */
#define ENG_CHAR_TO_GET_CHAR_SARA_U 		TC_SIX
#define ENG_CHAR_TO_GET_CHAR_FO_FAN 		TC_SMALL_A
#define ENG_CHAR_TO_GET_CHAR_SARA_I 		TC_SMALL_B
#define ENG_CHAR_TO_GET_CHAR_SARA_AE 		TC_SMALL_C
#define ENG_CHAR_TO_GET_CHAR_KO_KAI 		TC_SMALL_D
#define ENG_CHAR_TO_GET_CHAR_SARA_AM 		TC_SMALL_E
#define ENG_CHAR_TO_GET_CHAR_DO_DEK 		TC_SMALL_F
#define ENG_CHAR_TO_GET_CHAR_SARA_E 		TC_SMALL_G
#define ENG_CHAR_TO_GET_CHAR_MAI_THO 		TC_SMALL_H
#define ENG_CHAR_TO_GET_CHAR_RO_RUA 		TC_SMALL_I
#define ENG_CHAR_TO_GET_CHAR_MAI_EK 		TC_SMALL_J
#define ENG_CHAR_TO_GET_CHAR_SARA_AA 		TC_SMALL_K
#define ENG_CHAR_TO_GET_CHAR_SO_SUA 		TC_SMALL_L
#define ENG_CHAR_TO_GET_CHAR_THO_THAHAN 		TC_SMALL_M
#define ENG_CHAR_TO_GET_CHAR_SARA_UEE 		TC_SMALL_N
#define ENG_CHAR_TO_GET_CHAR_NO_NU 		TC_SMALL_O
#define ENG_CHAR_TO_GET_CHAR_YO_YAK 		TC_SMALL_P
#define ENG_CHAR_TO_GET_CHAR_MAIYAMOK 		TC_SMALL_Q
#define ENG_CHAR_TO_GET_CHAR_PHO_PHAN 		TC_SMALL_R
#define ENG_CHAR_TO_GET_CHAR_HO_HIP 		TC_SMALL_S
#define ENG_CHAR_TO_GET_CHAR_SARA_A 		TC_SMALL_T
#define ENG_CHAR_TO_GET_CHAR_SARA_II 		TC_SMALL_U
#define ENG_CHAR_TO_GET_CHAR_O_ANG 		TC_SMALL_V
#define ENG_CHAR_TO_GET_CHAR_SARA_AI_MAIMALAI 	TC_SMALL_W
#define ENG_CHAR_TO_GET_CHAR_PO_PLA 		TC_SMALL_X
#define ENG_CHAR_TO_GET_CHAR_MAI_HAN_AKAT 	TC_SMALL_Y
#define ENG_CHAR_TO_GET_CHAR_PHO_PHUNG 		TC_SMALL_Z
#define ENG_CHAR_TO_GET_SPACE 			TC_SPACE
#define ENG_CHAR_TO_GET_MINUS 			TC_THREE
#define ENG_CHAR_TO_GET_CURRENCY_SYMBOL_BAHT 	TC_TWO
#define ENG_CHAR_TO_GET_CHAR_CHO_CHAN 		TC_ZERO

/*
 * The lower case of English char to be pressed in Thai keymap to get
 * the Thai char.
 */
#define SMALL_CHAR_TO_GET_CHAR_RU 		TC_SMALL_A
#define SMALL_CHAR_TO_GET_CHAR_PHINTHU 		TC_SMALL_B
#define SMALL_CHAR_TO_GET_CHAR_CHO_CHING 	TC_SMALL_C
#define SMALL_CHAR_TO_GET_CHAR_TO_PATAK 		TC_SMALL_D
#define SMALL_CHAR_TO_GET_CHAR_DO_CHADA 		TC_SMALL_E
#define SMALL_CHAR_TO_GET_CHAR_SARA_O 		TC_SMALL_F
#define SMALL_CHAR_TO_GET_CHAR_CHO_CHOE 		TC_SMALL_G
#define SMALL_CHAR_TO_GET_CHAR_MAITAIKHU 	TC_SMALL_H
#define SMALL_CHAR_TO_GET_CHAR_NO_NEN 		TC_SMALL_I
#define SMALL_CHAR_TO_GET_CHAR_MAI_CHATTAWA 	TC_SMALL_J
#define SMALL_CHAR_TO_GET_CHAR_SO_RUSI 		TC_SMALL_K
#define SMALL_CHAR_TO_GET_CHAR_SO_SALA 		TC_SMALL_L
#define SMALL_CHAR_TO_GET_ASCII_CIRCUMFLEX 	TC_SMALL_M
#define SMALL_CHAR_TO_GET_CHAR_THANTHAKHAT 	TC_SMALL_N
#define SMALL_CHAR_TO_GET_CHAR_PAIYANNOI 	TC_SMALL_O
#define SMALL_CHAR_TO_GET_CHAR_YO_YING 		TC_SMALL_P
#define SMALL_CHAR_TO_GET_DIGIT_ZERO 		TC_SMALL_Q
#define SMALL_CHAR_TO_GET_CHAR_THO_NANGMONTHO 	TC_SMALL_R
#define SMALL_CHAR_TO_GET_CHAR_KHO_RAKHANG 	TC_SMALL_S
#define SMALL_CHAR_TO_GET_CHAR_THO_THONG 	TC_SMALL_T
#define SMALL_CHAR_TO_GET_CHAR_MAI_TRI 		TC_SMALL_U
#define SMALL_CHAR_TO_GET_CHAR_HO_NOKHUK 	TC_SMALL_V
#define SMALL_CHAR_TO_GET_QUOTE 			TC_SMALL_W
#define SMALL_CHAR_TO_GET_RIGHT_PAREN 		TC_SMALL_X
#define SMALL_CHAR_TO_GET_CHAR_NIKHAHIT 		TC_SMALL_Y
#define SMALL_CHAR_TO_GET_LEFT_PAREN 		TC_SMALL_Z
#define SMALL_CHAR_TO_GET_CHAR_MO_MA 		TC_COMMA
#define SMALL_CHAR_TO_GET_CHAR_KHO_KHWAI 	TC_EIGHT
#define SMALL_CHAR_TO_GET_CHAR_THO_THUNG 	TC_FIVE
#define SMALL_CHAR_TO_GET_CHAR_PHO_SAMPHAO 	TC_FOUR
#define SMALL_CHAR_TO_GET_CHAR_TO_TAO 		TC_NINE
#define SMALL_CHAR_TO_GET_PLUS 			TC_ONE
#define SMALL_CHAR_TO_GET_CHAR_SARA_AI_MAIMUAN 	TC_PERIOD
#define SMALL_CHAR_TO_GET_CHAR_WO_WAEN 		TC_SEMICOLON
#define SMALL_CHAR_TO_GET_CHAR_SARA_UE 		TC_SEVEN
#define SMALL_CHAR_TO_GET_CHAR_THO_PHUTHAO 	TC_COMMA
#define SMALL_CHAR_TO_GET_DIGIT_EIGHT 		TC_EIGHT
#define SMALL_CHAR_TO_GET_DIGIT_FIVE 		TC_FIVE
#define SMALL_CHAR_TO_GET_DIGIT_FOUR 		TC_FOUR
#define SMALL_CHAR_TO_GET_DIGIT_NINE 		TC_NINE
#define SMALL_CHAR_TO_GET_DIGIT_ONE 		TC_ONE
#define SMALL_CHAR_TO_GET_CHAR_LO_CHULA 		TC_PERIOD
#define SMALL_CHAR_TO_GET_CHAR_SO_SO 		TC_SEMICOLON
#define SMALL_CHAR_TO_GET_DIGIT_SEVEN 		TC_SEVEN
#define SMALL_CHAR_TO_GET_CHAR_SARA_UU 		TC_SIX
#define SMALL_CHAR_TO_GET_DIGIT_THREE 		TC_THREE
#define SMALL_CHAR_TO_GET_DIGIT_TWO 		TC_TWO
/* #define SMALL_CHAR_TO_GET_DIGIT_ZERO		TC_ZERO */
#define SMALL_CHAR_TO_GET_CHAR_SARA_U 		TC_SIX
#define SMALL_CHAR_TO_GET_CHAR_FO_FAN 		TC_SMALL_A
#define SMALL_CHAR_TO_GET_CHAR_SARA_I 		TC_SMALL_B
#define SMALL_CHAR_TO_GET_CHAR_SARA_AE 		TC_SMALL_C
#define SMALL_CHAR_TO_GET_CHAR_KO_KAI 		TC_SMALL_D
#define SMALL_CHAR_TO_GET_CHAR_SARA_AM 		TC_SMALL_E
#define SMALL_CHAR_TO_GET_CHAR_DO_DEK 		TC_SMALL_F
#define SMALL_CHAR_TO_GET_CHAR_SARA_E 		TC_SMALL_G
#define SMALL_CHAR_TO_GET_CHAR_MAI_THO 		TC_SMALL_H
#define SMALL_CHAR_TO_GET_CHAR_RO_RUA 		TC_SMALL_I
#define SMALL_CHAR_TO_GET_CHAR_MAI_EK 		TC_SMALL_J
#define SMALL_CHAR_TO_GET_CHAR_SARA_AA 		TC_SMALL_K
#define SMALL_CHAR_TO_GET_CHAR_SO_SUA 		TC_SMALL_L
#define SMALL_CHAR_TO_GET_CHAR_THO_THAHAN 	TC_SMALL_M
#define SMALL_CHAR_TO_GET_CHAR_SARA_UEE 		TC_SMALL_N
#define SMALL_CHAR_TO_GET_CHAR_NO_NU 		TC_SMALL_O
#define SMALL_CHAR_TO_GET_CHAR_YO_YAK 		TC_SMALL_P
#define SMALL_CHAR_TO_GET_CHAR_MAIYAMOK 		TC_SMALL_Q
#define SMALL_CHAR_TO_GET_CHAR_PHO_PHAN 		TC_SMALL_R
#define SMALL_CHAR_TO_GET_CHAR_HO_HIP 		TC_SMALL_S
#define SMALL_CHAR_TO_GET_CHAR_SARA_A 		TC_SMALL_T
#define SMALL_CHAR_TO_GET_CHAR_SARA_II 		TC_SMALL_U
#define SMALL_CHAR_TO_GET_CHAR_O_ANG 		TC_SMALL_V
#define SMALL_CHAR_TO_GET_CHAR_SARA_AI_MAIMALAI 	TC_SMALL_W
#define SMALL_CHAR_TO_GET_CHAR_PO_PLA 		TC_SMALL_X
#define SMALL_CHAR_TO_GET_CHAR_MAI_HAN_AKAT 	TC_SMALL_Y
#define SMALL_CHAR_TO_GET_CHAR_PHO_PHUNG 	TC_SMALL_Z
#define SMALL_CHAR_TO_GET_SPACE 			TC_SPACE
#define SMALL_CHAR_TO_GET_MINUS 			TC_THREE
#define SMALL_CHAR_TO_GET_CURRENCY_SYMBOL_BAHT 	TC_TWO
#define SMALL_CHAR_TO_GET_CHAR_CHO_CHAN 		TC_ZERO

#endif /* DBCS_PCGEOS */

#endif /* _THAIKBD_H_ */


thread.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	thread.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines thread structures and routines.
 *
 *	$Id: thread.h,v 1.17.6.2 96/06/19 16:58:27 andrew Exp $
 *
 ***********************************************************************/

#ifndef	__THREAD_H
#define __THREAD_H

#include  <object.h> 	/* ClassStruct */

extern void	/*XXX*/
    _pascal ThreadDestroy (word errorCode, optr ackObject, word ackData);

/***/

extern ThreadHandle	/*XXX*/
    _pascal ThreadCreate (word priority,
         word valueToPass,
         word (*startRoutine)(word valuePassed),
         word stackSize,
         GeodeHandle owner);

/***/

#define TGI_PRIORITY (val)	 	((byte) (val))
#define TGI_RECENT_CPU_USAGE (val) 	((byte) ((val) >> 8))

typedef enum /* word */ {
    TGIT_PRIORITY_AND_USAGE    =0,	/* use TGI_PRIORITY and TGI_RECENT_CPU_USAGE */
    TGIT_THREAD_HANDLE    =2,
    TGIT_QUEUE_HANDLE    =4
} ThreadGetInfoType} ;

extern word	/*XXX*/
    _pascal ThreadGetInfo (ThreadHandle th, ThreadGetInfoType info);

/***/

typedef ByteFlags ThreadModifyFlags ;
#define TMF_BASE_PRIO 	0x80
#define TMF_ZERO_USAGE 	0x40

extern void	/*XXX*/
    _pascal ThreadModify (ThreadHandle th,
         word newBasePriority,
         ThreadModifyFlags flags);

/***/

extern void	/*XXX*/
    _pascal ThreadAttachToQueue (QueueHandle qh, ClassStruct *class);

/***/

extern word	/*XXX*/
    _pascal ThreadPrivAlloc (word wordsRequested, GeodeHandle owner);

/***/

extern void	/*XXX*/
    _pascal ThreadPrivFree (word range, word wordsRequested);

/***/

typedef enum /* word */ {
    TE_DIVIDE_BY_ZERO    =0,
    TE_OVERFLOW    =4,
    TE_BOUND    =8,
    TE_FPU_EXCEPTION    =12,
    TE_SINGLE_STEP    =16,
    TE_BREAKPOINT    =20
} ThreadException} ;

extern void	/*XXX*/
    _pascal ThreadHandleException (ThreadHandle th,
              ThreadException exception,
              PCB(void, handler, (void)));

/*
 *	Constants for thread priorities
 */

typedef ByteEnum ThreadPriority ;
#define PRIORITY_TIME_CRITICAL 	0
#define PRIORITY_HIGH 		64
#define PRIORITY_UI 		96
#define PRIORITY_FOCUS 		128
#define PRIORITY_STANDARD 	160
#define PRIORITY_LOW 		192
#define PRIORITY_LOWEST 		254
#define PRIORITY_IDLE 		255 /* Will never run until system is idle */

#ifdef __HIGHC__
pragma Alias(ThreadDestroy, "THREADDESTROY");
pragma Alias(ThreadCreate, "THREADCREATE");
pragma Alias(ThreadGetInfo, "THREADGETINFO");
pragma Alias(ThreadModify, "THREADMODIFY");
pragma Alias(ThreadAttachToQueue, "THREADATTACHTOQUEUE");
pragma Alias(ThreadPrivAlloc, "THREADPRIVALLOC");
pragma Alias(ThreadPrivFree, "THREADPRIVFREE");
pragma Alias(ThreadHandleException, "THREADHANDLEEXCEPTION");
#endif

#endif


timedate.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	timedate.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines time and date structures and routines.
 *
 *	$Id: timedate.h,v 1.12.4.1 96/04/28 08:28:51 chris Exp $
 *
 ***********************************************************************/

#ifndef	__TIMEDATE_H
#define __TIMEDATE_H

typedef enum /* word */ {
    DOTW_SUNDAY    ,
    DOTW_MONDAY    ,
    DOTW_TUESAY    ,
    DOTW_WEDNESDAY    ,
    DOTW_THURSDAY    ,
    DOTW_FRIDAY    ,
    DOTW_SATURDAY
} DayOfTheWeek} ;

typedef struct {
    word		TDAT_year;
    word		TDAT_month;
    word		TDAT_day;
    DayOfTheWeek	TDAT_dayOfWeek;
    word		TDAT_hours;
    word		TDAT_minutes;
    word		TDAT_seconds;
} TimerDateAndTime} ;

extern void	/*XXX*/
    _pascal TimerGetDateAndTime (TimerDateAndTime *dateAndTime);

/***/

#define TIME_SET_DATE  0x80
#define TIME_SET_TIME  0x40

extern void	/*XXX*/
    _pascal TimerSetDateAndTime (word flags, const TimerDateAndTime *dateAndTime);

typedef struct {
    word	TFDT_fileDate;
    word	TFDT_fileTime;
} TimerFileDateTime} ;

extern TimerFileDateTime	/*XXX*/
    _pascal TimerGetFileDateTime (void);

#ifdef __HIGHC__
pragma Alias(TimerGetDateAndTime, "TIMERGETDATEANDTIME");
pragma Alias(TimerSetDateAndTime, "TIMERSETDATEANDTIME");
pragma Alias(TimerGetFileDateTime, "TIMERGETFILEDATETIME");
#endif

#endif


timer.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	timer.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines timer structures and routines.
 *
 *	$Id: timer.h,v 1.22.4.1 96/04/28 08:28:21 chris Exp $
 *
 ***********************************************************************/

#ifndef	__TIMER_H
#define __TIMER_H

/***/

typedef enum /* word */ {
    TIMER_ROUTINE_ONE_SHOT    =0,
    TIMER_ROUTINE_CONTINUAL    =2,
    TIMER_EVENT_ONE_SHOT    =4,
    TIMER_EVENT_CONTINUAL    =6,
    TIMER_MS_ROUTINE_ONE_SHOT    =8,
    TIMER_EVENT_REAL_TIME    =10,
    TIMER_ROUTINE_REAL_TIME    =12
} TimerType} ;

typedef WordFlags TimerCompressedDate ;
#define TCD_YEAR     	    	0xfe00	/* years since 1980 */
#define TCD_MONTH    	    	0x01e0	/* months (1 - 12) (0 illegal) */
#define TCD_DAY 	    	    	0x001f	/* days (1-31) (0 illegal) */

#define TCD_YEAR_OFFSET 		9
#define TCD_MONTH_OFFSET 	5
#define TCD_DAY_OFFSET 		0

extern TimerHandle
    _pascal TimerStart (TimerType timerType,
           optr destObject,word ticks,
           Message msg,
           word interval,
           word *id);

/***/

extern Boolean		/* true if not found */
    _pascal TimerStop (TimerHandle th, word id);

/***/

extern void	/*XXX*/
    _pascal TimerSleep (word ticks);

/***/

extern dword	/*XXX*/
    _pascal TimerGetCount (void);

#ifdef __HIGHC__
pragma Alias(TimerStart, "TIMERSTART");
pragma Alias(TimerStop, "TIMERSTOP");
pragma Alias(TimerSleep, "TIMERSLEEP");
pragma Alias(TimerGetCount, "TIMERGETCOUNT");
#endif

#endif


token.h

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	token.h
 * AUTHOR:	Brian Chin: May 21, 1992
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	Routines to manage a database of visual monikers.
 *
 *	$Id: token.h,v 1.12.6.1 96/04/28 08:29:03 chris Exp $
 *
 ***********************************************************************/

#ifndef	__TOKEN_H
#define __TOKEN_H

typedef DBGroupAndItem TokenDBItem ;

typedef WordFlags TokenFlags ;
#define TF_NEED_RELOCATION 	0x8000
#define TF_UNUSED 		0x7fff

typedef struct {
    GeodeToken		TE_token;
    TokenDBItem		TE_monikerList;
    TokenFlags		TE_flags;
    ReleaseNumber	TE_release;
    ProtocolNumber	TE_protocol;
} TokenEntry} ;

/* The TokenMonikerInfo structure is used by apps which call
   TokenLookupMoniker, store the information returned, and later use
   it to call TokenLockTokenMoniker.
*/
typedef struct {
    TokenDBItem         TMI_moniker;
    word                TMI_fileFlag;           /* 0 if token is in shared
                           token DB file
                           Non-0 if it's in local file
                         */
} TokenMonikerInfo} ;

/* The TokenRangeFlags are used with TokenListTokens to describe the
   range of tokens the caller would like to get.
*/
typedef WordFlags TokenRangeFlags ;
#define TRF_ONLY_GSTRING 	0x8000
#define TRF_ONLY_PASSED_MANUFID 	0x4000
#define TRF_UNUSED 		0x3fff

/* TokenOpenLocalTokenDB will return 0 on success or a VMStatus error
   code if it could not open an existing local token database. It will
   not create a new local token database; see TokenDefineToken.
*/
extern word /*XXX*/
    _pascal TokenOpenLocalTokenDB (void);

extern void /*XXX*/
    _pascal TokenCloseLocalTokenDB (void);

/* TokenDefineToken will return 0 on success or a VMStatus error code if
   it tried and failed to create the local token database file, without
   which no tokens can be defined. If TokenDefineToken has succeeded once,
   it will always succeed, since the local token database will be in place.
*/
extern word /*XXX*/
    _pascal TokenDefineToken (dword tokenChars,
             ManufacturerID manufacturerID,
             optr monikerList,
             TokenFlags flags);

extern Boolean /*XXX*/
    _pascal TokenGetTokenInfo (dword tokenChars,
              ManufacturerID manufacturerID,
              TokenFlags *flags);

extern Boolean /*XXX*/
    _pascal TokenLookupMoniker (dword tokenChars,
               ManufacturerID manufacturerID,
               DisplayType displayType,
               VisMonikerSearchFlags searchFlags,
               TokenMonikerInfo *tokenMonikerInfo);

extern Boolean /*XXX*/
    _pascal TokenLoadMonikerBlock (dword tokenChars,
              ManufacturerID manufacturerID,
              DisplayType displayType,
              VisMonikerSearchFlags searchFlags,
              word *blockSize,
              MemHandle *blockHandle);

extern Boolean /*XXX*/
    _pascal TokenLoadMonikerChunk (dword tokenChars,
              ManufacturerID manufacturerID,
              DisplayType displayType,
              VisMonikerSearchFlags searchFlags,
              MemHandle lmemBlock,
              word *chunkSize,
              ChunkHandle *chunkHandle);

extern Boolean /*XXX*/
    _pascal TokenLoadMonikerBuffer (dword tokenChars,
               ManufacturerID manufacturerID,
               DisplayType displayType,
               VisMonikerSearchFlags searchFlags,
               void *buffer,
               word bufferSize,
               word *bytesReturned);

extern Boolean /*XXX*/
    _pascal TokenRemoveToken (dword tokenChars, ManufacturerID manufacturerID);

extern void /*XXX*/
    _pascal TokenGetTokenStats (dword tokenChars, ManufacturerID manufacturerID);

extern Boolean /*XXX*/
    _pascal TokenLoadTokenBlock (dword tokenChars,
            ManufacturerID manufacturerID,
            word *blockSize,
            MemHandle *blockHandle);

extern Boolean /*XXX*/
    _pascal TokenLoadTokenChunk (dword tokenChars,
            ManufacturerID manufacturerID,
            MemHandle lmemBlock,
            word *chunkSize,
            ChunkHandle *chunkHandle);

extern Boolean /*XXX*/
    _pascal TokenLoadTokenBuffer (dword tokenChars,
             ManufacturerID manufacturerID,
             TokenEntry *buffer);

/*
  IMPORTANT: No token database call may be made between a call
  to TokenLockTokenMoniker and the corresponding call to
  TokenUnlockTokenMoniker. TokenLockTokenMoniker grabs the semaphore
  for the token database file containing the moniker; TokenUnlockTokenMoniker
  releases it. Calling any token database routine before the semaphore
  is released will hang the system.
*/
extern void * /*XXX*/
    _pascal TokenLockTokenMoniker (TokenMonikerInfo tokenMonikerInfo);

extern void /*XXX*/
    _pascal TokenUnlockTokenMoniker (void *moniker);

extern dword /*XXX*/
    _pascal TokenListTokens  (TokenRangeFlags tokenRangeFlags,
                 word headerSize,
                 ManufacturerID manufacturerID);

/*
 * Use these macros to fetch handle and count return values from
 * TokenListTokens.
 */
#define TokenListTokensHandleFromDWord (d) \
    ((MemHandle) (d))
#define TokenListTokensCountFromDWord (d) \
    ((word) ((d) >> 16))

/*
 * Use this macro to pass the tokenChars to the above routines
 */
#define TOKEN_CHARS (A, B, C, D) \
    ((A) | ((B) << 8) | ((C) << 16) | ((D) << 24))

#ifdef __HIGHC__
pragma Alias(TokenOpenLocalTokenDB, "TOKENOPENLOCALTOKENDB");
pragma Alias(TokenCloseLocalTokenDB, "TOKENCLOSELOCALTOKENDB");
pragma Alias(TokenDefineToken, "TOKENDEFINETOKEN");
pragma Alias(TokenGetTokenInfo, "TOKENGETTOKENINFO");
pragma Alias(TokenLookupMoniker, "TOKENLOOKUPMONIKER");
pragma Alias(TokenLoadMonikerBlock, "TOKENLOADMONIKERBLOCK");
pragma Alias(TokenLoadMonikerChunk, "TOKENLOADMONIKERCHUNK");
pragma Alias(TokenLoadMonikerBuffer, "TOKENLOADMONIKERBUFFER");
pragma Alias(TokenRemoveToken, "TOKENREMOVETOKEN");
pragma Alias(TokenGetTokenStats, "TOKENGETTOKENSTATS");
pragma Alias(TokenLoadTokenBlock, "TOKENLOADTOKENBLOCK");
pragma Alias(TokenLoadTokenChunk, "TOKENLOADTOKENCHUNK");
pragma Alias(TokenLoadTokenBuffer, "TOKENLOADTOKENBUFFER");
pragma Alias(TokenLockTokenMoniker, "TOKENLOCKTOKENMONIKER");
pragma Alias(TokenUnlockTokenMoniker, "TOKENUNLOCKTOKENMONIKER");
pragma Alias(TokenListTokens, "TOKENLISTTOKENS");
#endif

#endif


uDialog.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	file.h
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines file structures and routines.
 *
 *	$Id: uDialog.h,v 1.20.6.1 96/04/28 08:28:04 chris Exp $
 *
 ***********************************************************************/

#ifndef	__UDIALOG_H
#define __UDIALOG_H

#include  <Objects/gInterC.h>

typedef ByteEnum CustomDialogType ;
#define CDT_QUESTION  0
#define CDT_WARNING  1
#define CDT_NOTIFICATION  2
#define CDT_ERROR  3

/* Bitfield CustomDialogBoxFlags */

typedef WordFlags CustomDialogBoxFlags ;
#define CDBF_SYSTEM_MODAL 	0x8000
#define CDBF_DIALOG_TYPE 	0x6000
#define CDBF_INTERACTION_TYPE 	0x1e00
#define CDBF_DESTRUCTIVE_ACTION  0x0100
#define CDBF_DIALOG_TYPE_OFFSET 		13
#define CDBF_INTERACTION_TYPE_OFFSET 	9

typedef struct {
    optr                SDRTE_moniker;
    InteractionCommand  SDRTE_responseValue;
} StandardDialogResponseTriggerEntry} ;

/*
 * a structure of this type must be defined and passed to UserStandardDialog
 * and UserStandardDialogOptr if GIT_MULTIPLE_RESPONSE is used.
 *
 * Define as many SDRTT_triggers entries as you have SDRTT_numTriggers.  For
 * 1, 2, 3, or 4 response trigger cases, use these:
 */
typedef struct {
    word				SD1RTT_numTriggers;
    StandardDialogResponseTriggerEntry	SD1RTT_trigger1;
} StandardDialog1ResponseTriggerTable} ;

typedef struct {
    word				SD2RTT_numTriggers;
    StandardDialogResponseTriggerEntry	SD2RTT_trigger1;
    StandardDialogResponseTriggerEntry	SD2RTT_trigger2;
} StandardDialog2ResponseTriggerTable} ;

typedef struct {
    word				SD3RTT_numTriggers;
    StandardDialogResponseTriggerEntry	SD3RTT_trigger1;
    StandardDialogResponseTriggerEntry	SD3RTT_trigger2;
    StandardDialogResponseTriggerEntry	SD3RTT_trigger3;
} StandardDialog3ResponseTriggerTable} ;

typedef struct {
    word				SD4RTT_numTriggers;
    StandardDialogResponseTriggerEntry	SD4RTT_trigger1;
    StandardDialogResponseTriggerEntry	SD4RTT_trigger2;
    StandardDialogResponseTriggerEntry	SD4RTT_trigger3;
    StandardDialogResponseTriggerEntry	SD4RTT_trigger4;
} StandardDialog4ResponseTriggerTable} ;

/* parameters for MSG_GEN_APPLICATION_BUILD_DIALOG */

typedef struct {
    CustomDialogBoxFlags	SDOP_customFlags;
    optr 			SDOP_customString;
    optr 			SDOP_stringArg1;
    optr 			SDOP_stringArg2;
    optr 			SDOP_customTriggers;
    optr    			SDOP_helpContext;
} StandardDialogOptrParams} ;

extern word /*XXX*/
    _pascal UserDoDialog (optr dialogBox);

extern optr /*XXX*/
    _pascal UserCreateDialog (optr dialogBox);

extern void /*XXX*/
    _pascal UserDestroyDialog (optr dialogBox);

extern word   /*XXX*/
    _pascal UserStandardDialog (char *helpContext,
                   char *customTriggers,
                   char *arg2,
                   char *arg1,
                   char *string,
                   CustomDialogBoxFlags dialogFlags);

extern word
    _pascal UserStandardDialogOptr (optr helpContext,
                   optr customTriggers,
                   optr arg2,
                   optr arg1,
                   optr string,
                   CustomDialogBoxFlags dialogFlags);

#ifdef __HIGHC__
pragma Alias(UserDoDialog, "USERDODIALOG");
pragma Alias(UserStandardDialog, "USERSTANDARDDIALOG");
pragma Alias(UserStandardDialogOptr, "USERSTANDARDDIALOGOPTR");
pragma Alias(UserCreateDialog, "USERCREATEDIALOG");
pragma Alias(UserDestroyDialog, "USERDESTROYDIALOG");
#endif

#endif


ui.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	ui.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines generic UI stuff
 *
 *	$Id: ui.goh,v 1.110.1.4 96/08/09 15:13:41 allen Exp $
 *
 ***********************************************************************/
@optimize
@deflib ui

@include  <Objects/metaC.goh>
@include  <Objects/inputC.goh>
#include  <disk.h>
@include  <Objects/clipbrd.goh>

/*
 * Constants
 */

#define UI_STACK_SPACE_REQUIREMENT_FOR_RECURSE_ITERATION 	 600
#define UI_MAXIMUM_THREAD_BORROW_STACK_SPACE_AMOUNT 		1200
#define INTERFACE_THREAD_MINIMUM_STACK_SIZE 			1500
#define INTERFACE_THREAD_DEF_STACK_SIZE 				2000

/*
 * Utility routines (in User/userUtils.asm)
 */

typedef ByteFlags AppLaunchFlags ;
#define ALF_SEND_LAUNCH_REQUEST_TO_UI_TO_HANDLE 	0x80
#define ALF_OPEN_IN_BACK 			0x40
#define ALF_DESK_ACCESSORY 			0x20
#define ALF_DO_NOT_OPEN_ON_TOP 			0x10
#define ALF_OVERRIDE_MULTIPLE_INSTANCE 		0x08
#define ALF_LAUNCHED_FOR_PRINTING_ONLY 		0x04

typedef Boolean _pascal GestureCallback  (Point *arrayOfInkPoints, word numPoints, word numStrokes);

extern MemHandle _pascal
    UserCreateInkDestinationInfo    (optr dest,
                 GStateHandle gs,
                 word brushSize,
                 GestureCallback *callback);

extern GeodeHandle _pascal
    UserGetHWRLibraryHandle    (void);

extern void _pascal
    UserRegisterForTextContext    (optr obj);
extern void _pascal
    UserUnregisterForTextContext    (optr obj);

extern Boolean _pascal
    UserCheckIfContextUpdateDesired    (void);

extern void _pascal
    UserGetInitFileCategory    (char *buf);

extern GeodeHandle _pascal
    UserLoadApplication    (AppLaunchFlags alf,
            Message attachMethod,
            MemHandle appLaunchBlock,
            char *filename,
            StandardPath sPath,
            GeodeLoadError *err);

extern MemHandle _pascal
    UserAllocObjBlock     (ThreadHandle threadHandle);

/*
 * Interface Level
 */

typedef enum /* word */ {
    UIIL_INTRODUCTORY	,
    UIIL_BEGINNING	,
    UIIL_INTERMEDIATE	,
    UIIL_ADVANCED	,
    UIIL_GURU
#define UIIL_MAX_LEVEL 	UIIL_GURU
} UIInterfaceLevel} ;

extern UIInterfaceLevel
    _pascal UserGetDefaultLaunchLevel (void);	/* XXX */

extern UIInterfaceLevel
    _pascal UserGetDefaultUILevel (void);	/* XXX */

typedef WordFlags UIInterfaceOptions ;
#define UIIO_OPTIONS_MENU 			0x8000
#define UIIO_DISABLE_POPOUTS 			0x4000
#define UIIO_ALLOW_INITIALLY_HIDDEN_MENU_BARS 	0x2000

typedef enum {
    UILM_TRANSPARENT    ,
    UILM_SINGLE_INSTANCE    ,
    UILM_MULTIPLE_INSTANCES    ,
    UILM_GURU
} UILaunchModel} ;

extern UILaunchModel
    _pascal UserGetLaunchModel (void);		/* XXX */

typedef WordFlags UILaunchOptions ;
#define UILO_DESK_ACCESSORIES 		0x8000
#define UILO_CLOSABLE_APPS 		0x4000

extern UILaunchOptions
    _pascal UserGetLaunchOptions (void);		/* XXX */

typedef enum {
    UIEP_NONE    ,
    UIEP_TOP_PRIMARY    ,
    UIEP_LOWER_LEFT
} UIExpressPositions} ;

typedef WordFlags UIExpressOptions ;
#define UIEO_RETURN_TO_DEFAULT_LAUNCHER 	0x0800
#define UIEO_GEOS_TASKS_LIST 		0x0400
#define UIEO_DESK_ACCESSORY_LIST 	0x0200
#define UIEO_MAIN_APPS_LIST 		0x0100
#define UIEO_OTHER_APPS_LIST 		0x0080
#define UIEO_CONTROL_PANEL 		0x0040
#define UIEO_DOS_TASKS_LIST 		0x0020
#define UIEO_UTILITIES_PANEL 		0x0010
#define UIEO_EXIT_TO_DOS 		0x0008
#define UIEO_POSITION 			0x0007

typedef ByteFlags UIWindowOptions ;
#define UIWO_MAXIMIZE_ON_STARTUP 	0x40
#define UIWO_COMBINE_HEADER_AND_MENU_IN_MAXIMIZED_WINDOWS 	0x20
#define UIWO_PRIMARY_MIN_MAX_RESTORE_CONTROLS 		0x10
#define UIWO_WINDOW_MENU 				0x08
#define UIWO_PINNABLE_MENUS 				0x04
#define UIWO_KBD_NAVIGATION 				0x02
#define UIWO_POPOUT_MENU_BAR 				0x01

typedef WordFlags UIWindowOptionsInteger ;
#define UIWOI_MASK 	0xff00
#define UIWOI_OPTIONS 	0x00ff

typedef WordFlags UIHelpOptions ;
#define UIHO_HIDE_HELP_BUTTONS 	0x0001

extern UIInterfaceOptions
    _pascal UserGetInterfaceOptions (void);	/* XXX */

/*
 * Add/remove an application from the list of those, like Welcome, started up
 * by the UI when it loads. To be used only for system applications, such
 * as Lights Out...
 */
extern void _pascal UserAddAutoExec (const char *appName);
extern void _pascal UserRemoveAutoExec (const char *appName);

/*
 * Sound support
 */
typedef enum /* word */ {
    SST_ERROR	, 		    /* Sound produced when an Error box comes
                     * up. */
    SST_WARNING	,		    /* General warning beep sound */
    SST_NOTIFY	,		    /* General notify beep */
    SST_NO_INPUT	,		    /* Sound produced when the user's
                     * keystrokes/mouse presses are not going
                     * anywhere (if he clicks off a modal
                     * dialog box, or clicks on the field or
                     * something) */
    SST_KEY_CLICK	,		    /* Sound produced when a floating
                     * keyboard has a key pressed */
    SST_ALARM	,		    /* Sound produced as a standard
                     * Alarm noise. */
    SST_CUSTOM_SOUND	=0xfffd,    /* Allows the playing of a simple sound
                     * buffer while taking care of the system
                     * sound on/off selection
                         */
    SST_CUSTOM_BUFFER	=0xfffe,   /* Allows applications to play a custom
                     * note buffer and does all the checking
                     * for sound being off, etc. */

        /* NOTE:  When using SST_CUSTOM_BUFFER in systems where the
         sound library has a protocol number of 4.0 or earlier, it is
         necessary for the calling thread to worry about
         synchronisation issues.  The calling thread must allocate a
         semaphre via ThreadAllocSem, and add sound events at the end
         of the buffers being played via SST_CUSTOM_BUFFER that V()
         this semaphore.  In the CLOSE_APPLICATION handler for the
         app, the app must P() this semaphore the same number of times
         it used SST_CUSTOM_BUFFER.  This will ensure that the app
         does not exit until all buffers played by SST_CUSTOM_BUFFER
         are completed.  Failure to do so introduces a race condition
         which can cause the system to crash.  You have been warned.

         If your app depends upon having sound library v4.1 or
         newer, this is no longer a consideration.
                -- todd 12/29/93 */

    SST_CUSTOM_NOTE	=0xffff	    /* Allows applications to play a custom
                     * note and does all the checking for sound
                     * being off, etc. */
} StandardSoundType} ;

#define SST_IGNORE_SOUND_OFF  0x8000
/*
 * if SST_????? is OR'd with SST_IGNORE_SOUND_OFF, the sound will be
 * played regardless of [ui]sound or soundMask. Note that this doesn't
 * work with SST_CUSTOM_???
 *
 * This feature supported in 3.0 or later.
 */

/*
 *  StandardSoundFlags
 *
 *    These flags are used in the [ui]:soundMask = <integer> INI key
 *  to turn individual StandardSoundTypes on and off.
 *  A StandardSoundType will be played by UserStandardSound if the
 *  corresponding bit is set in the soundMask key.  Note that the
 *  SST_CUSTOM_xxx "standard" sounds are not supported by this
 *  mechanism.
 */

typedef WordFlags StandardSoundFlags ;
#define	SSF_ALARM	       0x0020
#define	SSF_KEY_CLICK	   0x0010
#define	SSF_NO_INPUT	    0x0008
#define	SSF_NOTIFY	      0x0004
#define	SSF_WARNING	     0x0002
#define	SSF_ERROR	       0x0001

#define SOUND_MASK_ALL   0xffff

/*
 * SST_ERROR, SST_WARNING, SST_NOTIFY, and SST_NO_INPUT, SST_KEY_CLICK,
 * and SST_ALARM require no additional arguments. Others:
 *	UserStandardSound(SST_CUSTOM_BUFFER, &SoundNoteBuffer, word size);
 *	UserStandardSound(SST_CUSTOM_NOTE, word frequency, word duration);
 *	UserStandardSound(SST_CUSTOM_SOUND, MemHandle SoundHandle, word tempo);
 *
 * Returns countID for the standard sound that is needed for
 * UserStopStandardSound. Returns zero if no sound is played, or
 * SST_CUSTOM... is played.
 */
extern word _cdecl UserStandardSound (StandardSoundType type, ...);

/*
 * Stop the standard sound being played.
 *
 * Will NOT stop SST_CUSTOM_... sounds because the sound handle could
 * possibly be destroyed, and because we don't know what the custom
 * handles are.
 *
 * The routine handles soundType that has the SST_IGNORE_SOUND_OFF bit
 * set, however.
 */
extern void _far _pascal UserStopStandardSound (StandardSoundType soundType,
                           word		 countID);

/*
 * Front-end for DiskRestore. Returns 0 and *diskHandlePtr if successfully
 * restored, else returns DiskRestoreError.
 */
extern word _pascal UserDiskRestore (void *savedData, word *diskHandlePtr);

/*
 * Utility routine to encrypt a string
 *
 * Returns TRUE if a non-null string is passed
 */
extern Boolean _pascal UserEncryptPassword (const char *string, char *dest);

#define PASSWORD_ENCRYPTED_SIZE  8
#define MAX_PASSWORD_SOURCE_SIZE  32

/*
 *		Imported methods
 */

/* genC.goh */

/*
 * target levels for MSG_GET_TARGET_AT_TARGET_LEVEL (defined in
 * Objects/metaC.goh)
 */

typedef enum /* word */ {
    TL_TARGET    =			0,
    TL_CONTENT    ,
    TL_GENERIC_OBJECTS    =  	1000,
    TL_GEN_SYSTEM    ,
    TL_GEN_FIELD    ,
    TL_GEN_APPLICATION    ,
    TL_GEN_PRIMARY    ,
    TL_GEN_DISPLAY_CTRL    ,
    TL_GEN_DISPLAY    ,
    TL_GEN_VIEW    ,
    TL_LIBRARY_LEVELS    =  	2000,
    TL_APPLICATION_OBJECTS    =  	3000,
} TargetLevel} ;

/* clipbrd.goh */

@importMessage	MetaUIMessages, void MSG_META_CLIPBOARD_NOTIFY_QUICK_TRANSFER_FEEDBACK (QuickTransferCursor quickTransferCursor = bp);	/* XXX */
@importMessage	MetaUIMessages, void MSG_META_CLIPBOARD_NOTIFY_QUICK_TRANSFER_CONCLUDED (ClipboardQuickNotifyFlags flags = bp);	/* XXX */
@reserveMessages	MetaUIMessages, 1;

@importMessage	MetaUIMessages, void MSG_META_CLIPBOARD_CUT ();
@importMessage	MetaUIMessages, void MSG_META_CLIPBOARD_COPY ();
@importMessage	MetaUIMessages, void MSG_META_CLIPBOARD_PASTE ();
@importMessage	MetaUIMessages, void MSG_META_UNDO (UndoActionStruct *undoData = ss:bp);
@importMessage	MetaUIMessages, void MSG_META_UNDO_FREEING_ACTION (
                        AddUndoActionStruct *data = ss:bp);

@importMessage	MetaUIMessages, void MSG_META_SELECT_ALL ();
@importMessage	MetaUIMessages, void MSG_META_DELETE ();
@importMessage	MetaUIMessages, void MSG_META_CLIPBOARD_NOTIFY_TRANSFER_ITEM_FREED (VMFileHandle itemFile = cx, VMBlockHandle itemBlock = dx);	/* XXX */
@importMessage	MetaUIMessages, void MSG_META_CLIPBOARD_NOTIFY_NORMAL_TRANSFER_ITEM_CHANGED ();	/* XXX */

/* gViewC.goh */

@importMessage MetaUIMessages, void MSG_META_CONTENT_SET_VIEW (optr view = cx:dx);   /*XXX*/

@importMessage MetaUIMessages, void MSG_META_CONTENT_VIEW_OPENING (optr view =
                                cx:dx); /*XXX*/

@importMessage MetaUIMessages, void MSG_META_CONTENT_VIEW_CLOSING ();   /*XXX*/

@importMessage MetaUIMessages, void MSG_META_CONTENT_VIEW_WIN_OPENED (
                    word viewWidth = cx,
                    word viewHeight = dx,
                    WindowHandle viewWindow = bp);  /*XXX*/

@importMessage MetaUIMessages, void MSG_META_CONTENT_VIEW_WIN_CLOSED (WindowHandle viewWindow = bp);   /*XXX*/

@importMessage MetaUIMessages, void MSG_META_CONTENT_VIEW_ORIGIN_CHANGED(@stack WindowHandle viewWindow,	sdword yOrigin, sdword xOrigin);  /*XXX*/

@importMessage MetaUIMessages, void MSG_META_CONTENT_VIEW_SCALE_FACTOR_CHANGED(
                @stack WindowHandle viewWindow,
                WWFixedAsDWord yScaleFactor,
                WWFixedAsDWord xScaleFactor);  /***/

@importMessage MetaUIMessages, void MSG_META_CONTENT_VIEW_SIZE_CHANGED (
                word viewWidth = cx, word viewHeight = dx,
                WindowHandle viewWindow = bp);   /*XXX*/

@importMessage MetaUIMessages, void MSG_META_CONTENT_TRACK_SCROLLING (
                TrackScrollingParams *args = ss:bp);

@importMessage MetaUIMessages, void MSG_META_CONTENT_VIEW_LOST_GADGET_EXCL (WindowHandle
                viewWindow = bp);  /*XXX*/

@importMessage MetaUIMessages, void MSG_META_CONTENT_NAVIGATION_QUERY (
                                optr queryOrigin = cx:dx,
                                NavigateFlags navFlags = bp);  /***/
@importMessage MetaUIMessages, void MSG_META_CONTENT_APPLY_DEFAULT_FOCUS ();  /***/

@importMessage MetaUIMessages, void MSG_META_CONTENT_ENTER (optr view =
                            cx:dx); /*XXX*/
@importMessage MetaUIMessages, void MSG_META_CONTENT_LEAVE (optr view =
                            cx:dx); /*XXX*/

/* gDocGrpC.goh */

@importMessage MetaUIMessages, Boolean MSG_META_DOC_OUTPUT_INITIALIZE_DOCUMENT_FILE (
                     optr document = cx:dx, FileHandle file = bp)
                    = carry;

@importMessage MetaUIMessages, void MSG_META_DOC_OUTPUT_CREATE_UI_FOR_DOCUMENT (
                     optr document = cx:dx, FileHandle file = bp);

@importMessage MetaUIMessages, void MSG_META_DOC_OUTPUT_DESTROY_UI_FOR_DOCUMENT (
                     optr document = cx:dx, FileHandle file = bp);

@importMessage MetaUIMessages, void MSG_META_DOC_OUTPUT_ATTACH_UI_TO_DOCUMENT (
                     optr document = cx:dx, FileHandle file = bp);

@importMessage MetaUIMessages, void MSG_META_DOC_OUTPUT_DETACH_UI_FROM_DOCUMENT (
                     optr document = cx:dx, FileHandle file = bp);

@importMessage MetaUIMessages, void MSG_META_DOC_OUTPUT_READ_CACHED_DATA_FROM_FILE (
                     optr document = cx:dx, FileHandle file = bp);

@importMessage MetaUIMessages, void MSG_META_DOC_OUTPUT_WRITE_CACHED_DATA_TO_FILE (
                     optr document = cx:dx, FileHandle file = bp);

@importMessage MetaUIMessages, void MSG_META_DOC_OUTPUT_DOCUMENT_HAS_CHANGED (
                     optr document = cx:dx, FileHandle file = bp);

@importMessage MetaUIMessages, Boolean MSG_META_DOC_OUTPUT_PHYSICAL_SAVE (
                     word *error = multipleax,
                     optr document = cx:dx,
                 FileHandle file = bp) = carry;

@importMessage MetaUIMessages, Boolean MSG_META_DOC_OUTPUT_PHYSICAL_UPDATE (
                     word *error = multipleax,
                     optr document = cx:dx,
                 FileHandle file = bp) = carry;

@importMessage MetaUIMessages, Boolean MSG_META_DOC_OUTPUT_PHYSICAL_SAVE_AS_FILE_HANDLE (
                     word *error = multipleax,
                     optr document = cx:dx,
                 FileHandle file = bp) = carry;

@importMessage MetaUIMessages, Boolean MSG_META_DOC_OUTPUT_PHYSICAL_REVERT (
                     word *error = multipleax,
                     optr document = cx:dx,
                 FileHandle file = bp) = carry;

@importMessage MetaUIMessages, Boolean MSG_META_DOC_OUTPUT_UPDATE_EARLIER_COMPATIBLE_DOCUMENT (
                     word *error = multipleax,
                     optr document = cx:dx,
                 FileHandle file = bp) = carry;

@importMessage MetaUIMessages, Boolean MSG_META_DOC_OUTPUT_UPDATE_EARLIER_INCOMPATIBLE_DOCUMENT (
                     word *error = multipleax,
                     optr document = cx:dx,
                 FileHandle file = bp) = carry;

@importMessage MetaUIMessages, void MSG_META_DOC_OUTPUT_SAVE_AS_COMPLETED (
                     optr document = cx:dx, FileHandle file = bp);

@importMessage MetaUIMessages, void MSG_META_DOC_OUTPUT_ATTACH_FAILED (
                     optr document = cx:dx, FileHandle file = bp);

@importMessage MetaUIMessages, Boolean MSG_META_DOC_OUTPUT_PHYSICAL_REVERT_TO_AUTO_SAVE (
                     word *error = multipleax,
                     optr document = cx:dx,
                 FileHandle file = bp) = carry;

@importMessage	MetaUIMessages, void MSG_META_UNUSED_META_UI_11 ();
@importMessage	MetaUIMessages, void MSG_META_UNUSED_META_UI_12 ();
@importMessage	MetaUIMessages, void MSG_META_UNUSED_META_UI_13 ();
@importMessage	MetaUIMessages, void MSG_META_UNUSED_META_UI_14 ();
@importMessage	MetaUIMessages, void MSG_META_UNUSED_META_UI_15 ();
@importMessage	MetaUIMessages, void MSG_META_UNUSED_META_UI_16 ();
@importMessage	MetaUIMessages, void MSG_META_UNUSED_META_UI_17 ();
@importMessage	MetaUIMessages, void MSG_META_UNUSED_META_UI_18 ();
@importMessage	MetaUIMessages, void MSG_META_UNUSED_META_UI_19 ();
@importMessage	MetaUIMessages, void MSG_META_UNUSED_META_UI_20 ();

/* gCtrlC.goh */

@importMessage MetaUIMessages, void MSG_META_UI_FORCE_CONTROLLER_UPDATE (
                    ManufacturerID manufID = cx,
                    word changeID = dx);

/* genC.goh (again) */
typedef struct {
    word    	    	GPDRA_pathType;	    	/* vardata tag holding path */
    word    	    	GPDRA_savedDiskType;	/* vardata tag holding saved
                         * disk handle */
    char    	    	*GPDRA_driveName;   	/* drive name, null-terminated
                         * with trailing ':' */
    char    	    	*GPDRA_diskName;    	/* disk name, null-terminated */
    DiskRestoreError	GPDRA_errorCode;    	/* error code that would be
                         * returned by DiskRestore if
                         * this method weren't being
                         * called */
} GenPathDiskRestoreArgs} ;

@importMessage MetaUIMessages, Boolean MSG_META_GEN_PATH_RESTORE_DISK_PROMPT (
    DiskRestoreError *error = multipleax,
    GenPathDiskRestoreArgs *args = ss:bp) = carry;	/* always return TRUE */

@importMessage MetaUIMessages, void MSG_META_PAGED_OBJECT_GOTO_PAGE (word page = cx);
@importMessage MetaUIMessages, void MSG_META_PAGED_OBJECT_NEXT_PAGE ();
@importMessage MetaUIMessages, void MSG_META_PAGED_OBJECT_PREVIOUS_PAGE ();

@importMessage MetaUIMessages, void MSG_META_NOTIFY_TASK_SELECTED ();

/* In various include files for ui.def in the asm version */ ""

@importMessage	MetaUIMessages, void MSG_META_GAINED_MOUSE_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_LOST_MOUSE_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_GAINED_KBD_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_LOST_KBD_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_GAINED_PRESSURE_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_LOST_PRESSURE_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_GAINED_DIRECTION_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_LOST_DIRECTION_EXCL ();   /* XXX */

/*** Focus and Target Methods ***/

@importMessage	MetaUIMessages, void MSG_META_GRAB_FOCUS_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_RELEASE_FOCUS_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, Boolean MSG_META_GET_FOCUS_EXCL (  /* XXX */
                optr *focusObject = dxcx) = carry;
@importMessage	MetaUIMessages, void MSG_META_GRAB_TARGET_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_RELEASE_TARGET_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, Boolean MSG_META_GET_TARGET_EXCL (   /* XXX */
                optr *targetObject = dxcx) = carry;
@importMessage	MetaUIMessages, void MSG_META_GRAB_MODEL_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_RELEASE_MODEL_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, Boolean MSG_META_GET_MODEL_EXCL (
                optr *modelObject = dxcx) = carry;   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_RELEASE_FT_EXCL ();   /* XXX */

@importMessage	MetaUIMessages, void MSG_META_MUP_ALTER_FTVMC_EXCL (   /* XXX */
                    optr objectWantingControl = cx:dx,
                    MetaAlterFTVMCExclFlags flags = bp);

@importMessage	MetaUIMessages, void MSG_META_GAINED_FOCUS_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_LOST_FOCUS_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_GAINED_SYS_FOCUS_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_LOST_SYS_FOCUS_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_GAINED_TARGET_EXCL ();
@importMessage	MetaUIMessages, void MSG_META_LOST_TARGET_EXCL ();
@importMessage	MetaUIMessages, void MSG_META_GAINED_SYS_TARGET_EXCL ();
@importMessage	MetaUIMessages, void MSG_META_LOST_SYS_TARGET_EXCL ();
@importMessage	MetaUIMessages, void MSG_META_GAINED_MODEL_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_LOST_MODEL_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_GAINED_SYS_MODEL_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_LOST_SYS_MODEL_EXCL ();   /* XXX */
@importMessage  MetaUIMessages, void MSG_META_QUERY_SAVE_DOCUMENTS ();
@importMessage  MetaUIMessages, void MSG_META_BROADCAST_RETURNING_TO_WELCOME ();

@importMessage	MetaUIMessages, void MSG_META_GAINED_DEFAULT_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_LOST_DEFAULT_EXCL ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_MOUSE_BUMP_NOTIFICATION (
                sword xBump = cx, sword yBump = dx);   /* XXX */
@importMessage	MetaUIMessages, Boolean MSG_META_FUP_KBD_CHAR (
                word character = cx,
                word flags = dx,
                word state = bp) = carry;   /* XXX */

typedef WordFlags KbdReturnFlags ;
#define KRF_PREVENT_PASS_THROUGH 	0x8000

@importMessage	MetaUIMessages, KbdReturnFlags MSG_META_PRE_PASSIVE_KBD_CHAR (
                word character = cx,
                word flags = dx,
                word state = bp) = ax;   /* XXX */
@importMessage	MetaUIMessages, KbdReturnFlags MSG_META_POST_PASSIVE_KBD_CHAR (
                word character = cx,
                word flags = dx,
                word state = bp) = ax;   /* XXX */

/*
 * InkReturnParams are defined in Objects/uiInputC.goh.
 */
@importMessage	MetaUIMessages, void MSG_META_QUERY_IF_PRESS_IS_INK (
                InkReturnParams *retVal = bpaxdxcx,
                sword xPosition=cx, sword yPosition=dx);

@importMessage	MetaUIMessages, void MSG_META_LARGE_QUERY_IF_PRESS_IS_INK (
                InkReturnParams *retVal = bpaxdxcx,
                LargeMouseData *largeMouseDataStruct = ss:bp);

/*
 * 16-bit coordinate button events.
 *
 * MSG_META_PTR is part of this functional grouping, but for compilation reasons
 * is declared in Objects/inputC.goh.
 *
 * MouseReturnParams is defined in Objects/uiInputC.goh.
 *  "inputState" for MSG_META_PTR & the following messages is
 * ButtonInfo in the low byte, UIFunctionsActive in the high byte --
 * use GET_BUTTON_INFO and GET_UI_FUNCTIONS_ACTIVE to extract.
 */
@prototype void MSG_UI_BUTTON (MouseReturnParams *retVal = bpaxdxcx,
                  sword xPosition = cx,
                  sword yPosition = dx,
                  word inputState = bp);
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_START_SELECT;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_END_SELECT;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_START_MOVE_COPY;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_END_MOVE_COPY;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_START_FEATURES;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_END_FEATURES;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_START_OTHER;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_END_OTHER;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_DRAG_SELECT;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_DRAG_MOVE_COPY;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_DRAG_FEATURES;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_DRAG_OTHER;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_PRE_PASSIVE_BUTTON;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_POST_PASSIVE_BUTTON;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_PRE_PASSIVE_START_SELECT;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_PRE_PASSIVE_END_SELECT;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_PRE_PASSIVE_START_MOVE_COPY;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_PRE_PASSIVE_END_MOVE_COPY;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_PRE_PASSIVE_START_FEATURES;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_PRE_PASSIVE_END_FEATURES;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_PRE_PASSIVE_START_OTHER;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_PRE_PASSIVE_END_OTHER;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_POST_PASSIVE_START_SELECT;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_POST_PASSIVE_END_SELECT;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_POST_PASSIVE_START_MOVE_COPY;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_POST_PASSIVE_END_MOVE_COPY;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_POST_PASSIVE_START_FEATURES;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_POST_PASSIVE_END_FEATURES;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_POST_PASSIVE_START_OTHER;
@importMessage	MetaUIMessages, (MSG_UI_BUTTON)MSG_META_POST_PASSIVE_END_OTHER;

/*
 * 32-bit coordinate pointer events.
 * MouseReturn Params, LargeMouseData are defined in Objects/uiInputC.goh.
 */
@prototype void MSG_UI_LARGE_BUTTON (MouseReturnParams *retVal = bpaxdxcx,
                    LargeMouseData *largeMouseDataStruct=ss:bp);

@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_PTR;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_START_SELECT;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_END_SELECT;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_START_MOVE_COPY;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_END_MOVE_COPY;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_START_FEATURES;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_END_FEATURES;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_START_OTHER;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_END_OTHER;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_DRAG_SELECT;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_DRAG_MOVE_COPY;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_DRAG_FEATURES;
@importMessage	MetaUIMessages, (MSG_UI_LARGE_BUTTON)MSG_META_LARGE_DRAG_OTHER;

@importMessage	MetaUIMessages, MouseReturnFlags MSG_META_ENSURE_MOUSE_NOT_ACTIVELY_TRESPASSING () = ax;   /* XXX */

typedef struct {
    word		ENMISUMP_menuCount;	/* # of menus released so far */
} EnsureNoMenusInStayUpModeParams} ;

@importMessage	MetaUIMessages, MouseReturnFlags MSG_META_ENSURE_NO_MENUS_IN_STAY_UP_MODE (EnsureNoMenusInStayUpModeParams *params = cx:dx) = ax;   /* XXX */

@importMessage	MetaUIMessages, void MSG_META_ENSURE_ACTIVE_FT ();   /* XXX */
@importMessage	MetaUIMessages, void MSG_META_NOTIFY_NO_FOCUS_WITHIN_NODE ();   /* XXX */

@importMessage	MetaUIMessages, void MSG_META_DOC_OUTPUT_IMPORT_FILE ();	/* XXX */
@importMessage	MetaUIMessages, void MSG_META_DOC_OUTPUT_EXPORT_FILE ();	/* XXX */
@importMessage	MetaUIMessages, void MSG_META_GRAB_KBD ();	/* XXX */
@importMessage	MetaUIMessages, void MSG_META_FORCE_GRAB_KBD ();	/* XXX */
@importMessage	MetaUIMessages, void MSG_META_RELEASE_KBD ();	/* XXX */
@importMessage	MetaUIMessages, void MSG_META_VIEW_COMMAND_CHANGE_SCALE (); /* XXX */

@importMessage	MetaUIMessages, void MSG_META_FIELD_NOTIFY_DETACH (optr field = cx:dx, word shutdownFlag = bp);
@importMessage	MetaUIMessages, void MSG_META_FIELD_NOTIFY_NO_FOCUS (optr field = cx:dx, word shutdownFlag = bp);
@importMessage	MetaUIMessages, void MSG_META_FIELD_NOTIFY_START_LAUNCHER_ERROR (optr field = cx:dx);
@importMessage	MetaUIMessages, void MSG_META_DELETE_RANGE_OF_CHARS(@stack
                        VisTextRange rangeToDelete);
@importMessage	MetaUIMessages,  Boolean MSG_META_TEST_WIN_INTERACTIBILITY (optr inputOD = cx:dx, WindowHandle window = bp) = carry; /* XXX */
@importMessage	MetaUIMessages,	 Boolean MSG_META_CHECK_IF_INTERACTABLE_OBJECT (optr obj=cx:dx) = carry; /* XXX */
@importMessage	MetaUIMessages,	 void MSG_META_GAINED_FULL_SCREEN_EXCL (); /* XXX */
@importMessage	MetaUIMessages,	 void MSG_META_LOST_FULL_SCREEN_EXCL (); /* XXX */

#if defined(__HIGHC__)
pragma Alias(UserStandardSound, "_UserStandardSound");
pragma Alias(UserStopStandardSound, "USERSTOPSTANDARDSOUND");
pragma Alias(UserAddAutoExec, "USERADDAUTOEXEC");
pragma Alias(UserRemoveAutoExec, "USERREMOVEAUTOEXEC");
pragma Alias(UserGetHWRLibraryHandle, "USERGETHWRLIBRARYHANDLE");
pragma Alias(UserRegisterForTextContext, "USERREGISTERFORTEXTCONTEXT");
pragma Alias(UserUnregisterForTextContext, "USERUNREGISTERFORTEXTCONTEXT");
pragma Alias(UserCheckIfContextUpdateDesired,"USERCHECKIFCONTEXTUPDATEDESIRED");
pragma Alias(UserGetDefaultUILevel, "USERGETDEFAULTUILEVEL");
pragma Alias(UserGetDefaultLaunchLevel, "USERGETDEFAULTLAUNCHLEVEL");
pragma Alias(UserGetInterfaceOptions, "USERGETINTERFACEOPTIONS");
pragma Alias(UserGetLaunchModel, "USERGETLAUNCHMODEL");
pragma Alias(UserGetLaunchOptions, "USERGETLAUNCHOPTIONS");
pragma Alias(UserCreateInkDestinationInfo, "USERCREATEINKDESTINATIONINFO");
pragma Alias(UserGetInitFileCategory, "USERGETINITFILECATEGORY");
pragma Alias(UserLoadApplication, "USERLOADAPPLICATION");
pragma Alias(UserAllocObjBlock, "USERALLOCOBJBLOCK");
pragma Alias(UserEncryptPassword, "USERENCRYPTPASSWORD");
#endif

@endlib


Objects\uiInputC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	Objects/uiInputC.goh
 * AUTHOR:	Doug Fults: April 21, 1992
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines UI input methods, constants
 *	(All MetaUIMessages are in ui.goh)
 *
 *	$Id: uiInputC.goh,v 1.25.1.6 98/02/25 21:46:55 cthomas Exp $
 *
 ***********************************************************************/
@optimize

@deflib ui

#include  <input.h>

typedef WordFlags MetaAlterFTVMCExclFlags ;
#define MAEF_NOT_HERE 		0x8000
#define MAEF_SYS_EXCL 		0x4000
#define MAEF_APP_EXCL 		0x2000
#define MAEF_GRAB 		0x1000
#define MAEF_FOCUS 		0x0800
#define MAEF_TARGET 		0x0400
#define MAEF_MODEL 		0x0200
#define MAEF_FULL_SCREEN 	0x0100
#define MAEF_MODAL 		0x0004
#define MAEF_OD_IS_WINDOW 	0x0002
#define MAEF_OD_IS_MENU_RELATED  0x0001

#define MAEF_MASK_OF_ALL_HIERARCHIES     0x0f00

typedef enum /* word */ {
    IRV_NO_REPLY	,
    IRV_NO_INK	,
    IRV_INK_WITH_STANDARD_OVERRIDE	,
    IRV_DESIRES_INK	,
    IRV_WAIT
} InkReturnValue} ;

typedef struct {
    MemHandle	    destInfo;
    InkReturnValue  inkType;
    word    unused1;
    word    unused2;
} InkReturnParams} ;

/*
 *  About the InkDestinationInfo structure:
 *
 *  This is used by objects to force a destination for the ink
 *  (this forces the ink to go to an object if the initial click was
 *   in the object).
 *
 *  This is also used by the Ink object to keep from having to redraw
 *  the ink. The ink that is collected is drawn through the returned
 *  gstate to clip it to the bounds of the ink. The gstate that is
 *  returned will be destroyed by the IM thread.
 */

typedef struct {
    optr		IDI_destObj;
/*  This is the object that the ink should be sent to. */

    GStateHandle	IDI_gstate;
/*
 *  A gstate to draw through (this is optional, and can be set to 0 if
 *  ink can go all over the screen)
 */

    word		IDI_brushSize;
/*
 *  The width/height parameter of the ink lines (see GrBrushPolyline).
 *  (use 0 for default)
 */

    dword	IDI_gestureCallback;
/*
 *  The virtual far pointer to the callback routine. The callback
 *  routine params are the following:
 *
 * 	Passed on the stack (Pascal calling type):
 *
 * 		fptr	arrayOfInkPoints
 * 		word	numPoints
 * 		word	numStrokes	;The # strokes entered by the
 * 					; user. If you only support
 * 					; single-stroke gestures, you
 * 					; can check this to quickly
 * 					; exit if the user has entered
 * 					; a bunch of strokes.
 *
 * 	Returns:
 * 		AX - Non-zero if the ink is a gesture
 */

} InkDestinationInfo} ;

typedef ByteFlags UIFunctionsActive ;
#define UIFA_SELECT 	0x80
#define UIFA_MOVE_COPY 	0x40
#define UIFA_FEATURES 	0x20
#define UIFA_CONSTRAIN 	0x10
#define UIFA_PREF_A 	0x08
#define UIFA_PREF_B 	0x04
#define UIFA_PREF_C 	0x02
#define UIFA_IN 		0x01

#define UIFA_ADJUST 	0x08
#define UIFA_EXTEND 	0x04
#define UIFA_MOVE 	0x08
#define UIFA_COPY 	0x04
#define UIFA_POPUP 	0x08
#define UIFA_PAN 	0x04

/*
 * These may be used to extract ButtonInfo or UIFunctionsActive information from
 * the "inputState" value passed in the UI input messages.
 */
#define GET_BUTTON_INFO (val) 		((byte) (val))
#define GET_UI_FUNCTIONS_ACTIVE (val) 	((byte) ((val) >> 8))

typedef WordFlags MouseReturnFlags ;
#define    MRF_PROCESSED    		0x8000
#define    MRF_REPLAY    			0x4000
#define    MRF_PREVENT_PASS_THROUGH    	0x2000
#define    MRF_SET_POINTER_IMAGE    	0x1000
#define    MRF_CLEAR_POINTER_IMAGE    	0x0800

/*
 * Structure of data that must be returned by any handler of the following
 * input messages
 */
typedef struct {
    word			unused;
    MouseReturnFlags	flags;
    optr			ptrImage;
    /* Pointer image to use, if MRF_SET_PTR_IMAGE returned */
} MouseReturnParams} ;

/*
 * This structure is passed to handlers of _LARGE_ mouse messages
 */

typedef struct {
    PointDWFixed	LMD_location;
    byte		LMD_buttonInfo;
    UIFunctionsActive	LMD_uiFunctionsActive;
} LargeMouseData} ;

/* NOTE:  button, pre & post-passive buttons events declared in ui.goh */

typedef ByteFlags UIButtonFlags ;
#define UIBF_NO_KEYBOARD 		0x80
#define UIBF_CLICK_TO_TYPE 		0x40
#define UIBF_SELECT_ALWAYS_RAISES 	0x20
#define UIBF_SELECT_DISPLAYS_MENU 	0x10
#define UIBF_KEYBOARD_ONLY 		0x08
#define UIBF_CLICK_GOES_THRU 		0x04
#define UIBF_SPECIFIC_UI_COMPATIBLE 	0x02
#define UIBF_BLINKING_CURSOR 		0x01

/*
 * Special CS_UI_FUNCS character set -- these represent the low
 * byte of the character value when the high byte is CS_UI_FUNCS.
 *
 */

typedef	ByteEnum UChar ;
#define UC_NULL 			0x00
#define UC_QUICK_COPY 		0x01
#define UC_BUTTON_EVENT 		0x02
#define UC_CUT 			0x03
#define UC_COPY 			0x04
#define UC_PASTE 		0x05
#define UC_DATE 			0x06
#define UC_TIME 			0x07
#define	UC_EXIT				0x08
#define	UC_ON				0x09
#define	UC_OFF				0x10
#define	UC_LOCK				0x11
#define	UC_JOTTER			0x12
#define	UC_MENU				0x13
#define UC_DELETE    	    	0x14
#define UC_ROTATE                0x15
#define UC_ZOOM 			0x16
#define UC_BACKLIGHT 		0x17
#define UC_SWITCH_KEYMAP 	0x18
#define UC_COVER_OPEN 		0x19
#define UC_COVER_CLOSE 		0x1a
#define UC_CARD_INSERT 		0x1b
#define UC_CARD_REMOVE 		0x1c
#define UC_IR                    0x1d

typedef struct {
    optr    	    	BG_OD;
    word		BG_data;
} BasicGrab} ;

typedef struct {
    optr    	    	KG_OD;
    word		KG_unused;
} KbdGrab} ;

typedef struct {
    optr    	    	MG_OD;
    WindowHandle	MG_gWin;
} MouseGrab} ;

typedef struct {
    optr    	    		FTVMC_OD;
    MetaAlterFTVMCExclFlags	FTVMC_flags;
} FTVMCGrab} ;

extern word
    _pascal FlowCheckKbdShortcut (KeyboardShortcut *shortcutTable,
                 word numEntriesInTable,
                 word character,
                 word flags,
                 word state);

typedef WordFlags HierarchicalGrabFlags ;
#define HGF_SYS_EXCL 	0x4000
#define HGF_APP_EXCL 	0x2000
#define HGF_GRAB 	0x1000
#define HGF_OTHER_INFO 	0x0fff

typedef struct {
    optr    	    	HG_OD;
    HierarchicalGrabFlags HG_flags;
} HierarchicalGrab} ;

extern Segment /* XXX */
    _pascal FlowAlterHierarchicalGrab (optr objectOptr,
             Message gainedMessage,
             word offsetToMasterInstance,
             word offsetToHierarchicalGrab,
             optr objectToBeGivenExclusive,
             HierarchicalGrabFlags flags);

extern Segment /* XXX */
    _pascal FlowUpdateHierarchicalGrab (optr objectOptr,
           Message gainedMessage,
           word offsetToMasterInstance,
           word offsetToHierarchicalGrab,
           Message updateMessage);

typedef struct {
    word ax_value;
    word bp_value;
    word cx_value;
    word dx_value;
} MessageReturnValues} ;

extern Boolean /* XXX */
    _pascal FlowDispatchSendOnOrDestroyClassedEvent (
            MessageReturnValues *retvals,
            optr objectOptr,
            Message messageToSend,
            EventHandle classedEvent,
            word otherData,
            optr objectToSendTo,
            MessageFlags flags);

typedef ByteFlags HoldUpInputFlags ;
#define HUIF_FLUSHING_QUEUE  0x80
#define HUIF_HOLD_UP_MODE_DISABLED  0x40

#ifdef __HIGHC__
pragma Alias (FlowCheckKbdShortcut, "FLOWCHECKKBDSHORTCUT");
pragma Alias (FlowAlterHierarchicalGrab, "FLOWALTERHIERARCHICALGRAB");
pragma Alias (FlowUpdateHierarchicalGrab, "FLOWUPDATEHIERARCHICALGRAB");
pragma Alias (FlowDispatchSendOnOrDestroyClassedEvent,
        "FLOWDISPATCHSENDONORDESTROYCLASSEDEVENT");
#endif

@endlib


Internal\uProcC.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    (c) Copyright Geoworks 1996 -- All Rights Reserved
    GEOWORKS CONFIDENTIAL

PROJECT:	PC GEOS
MODULE:		Include/Objects
FILE:		uProcC.goh

AUTHOR:		Jason Ho, Jan 25, 1996

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    kho	1/25/96   	Initial version.

DESCRIPTION:
    Class declaration for "UserClass", the UI library's process class

    $Id: uProcC.goh,v 1.1.2.1 96/04/28 08:32:53 chris Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@include  <ui.goh>

@deflib	ui

@class	Userclass, GenProcessClass;

/*
 * Private methods to UserClass
 */

@message void MSG_USER_FREE_SPECIFIC_UI  ();
/*
 * Message NOT available in GOC
 */

/*
 * Methods
 */

@message void MSG_USER_LAUNCH_APPLICATION  ();
/*
 * Message NOT available in GOC
 */

@message void MSG_USER_USE_LIBRARY  ();
/*
 * Message NOT available in GOC
 */

@message void MSG_USER_UPDATE_SOUND_PARAMS  ();
/*
 *	Sent to the UI thread to tell it to re-scan the .ini table for whatever
 * params it needs.
 */

@message void MSG_USER_STARTUP_APPLS  ();
/*
 * Message NOT available in GOC
 */

@message void MSG_USER_DELETE_STATE_FILES_DIALOG_RESPONSE  ();
/*
 * Message NOT available in GOC
 */

@message void MSG_USER_CONTINUE_STARTUP  ();
/*
 * Message NOT available in GOC
 */

@message void MSG_USER_FREE_SOUND_HANDLE  ();
/*
 * Message NOT available in GOC
 */

@message void MSG_USER_PROMPT_FOR_PASSWORD  ();
/*
 * Message NOT available in GOC
 */

@message void MSG_USER_PASSWORD_ENTERED  ();
/*
 * Message NOT available in GOC
 */

@message void MSG_USER_IS_PASSWORD_DIALOG_ACTIVE  ();
/*
 * Message NOT available in GOC
 */

@endc

@endlib


Objects\vCntC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	vCntC.goh
 * AUTHOR:	Chris Hawley: 8/19/91
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines VisContentClass
 *
 *	$Id: vCntC.goh,v 1.21.6.1 96/04/28 08:30:54 chris Exp $
 *
 ***********************************************************************/
@optimize
@deflib ui

@include  <Objects/uiInputC.goh>
@include  <Objects/vCompC.goh>
@include  <Objects/visC.goh>

@class VisContentClass, VisCompClass;

@message SizeAsDWord MSG_VIS_CONTENT_GET_WIN_SIZE () = dx.cx;	/*XXX*/

typedef ByteFlags VisContentAttrs ;
#define	VCNA_SAME_WIDTH_AS_VIEW				0x80
#define VCNA_SAME_HEIGHT_AS_VIEW 			0x40
#define	VCNA_LARGE_DOCUMENT_MODEL				0x20
#define VCNA_WINDOW_COORDINATE_MOUSE_EVENTS 		0x10
#define VCNA_ACTIVE_MOUSE_GRAB_REQUIRES_LARGE_EVENTS 	0x08
#define VCNA_VIEW_DOC_BOUNDS_SET_MANUALLY 		0x04
#define VCNA_VIEW_DOES_NOT_WIN_SCROLL 			0x02

@message void MSG_VIS_CONTENT_SET_ATTRS (VisContentAttrs attrsToSet = cl,
                    VisContentAttrs attrsToClear = ch); /*XXX*/
@message VisContentAttrs MSG_VIS_CONTENT_GET_ATTRS () = cl;  /*XXX*/

@message SizeAsDWord MSG_VIS_CONTENT_RECALC_SIZE_BASED_ON_VIEW () = dx.cx;
                                                              /*XXX*/
@message void MSG_VIS_CONTENT_HOLD_UP_INPUT_FLOW ();  /*XXX*/
@message void MSG_VIS_CONTENT_RESUME_INPUT_FLOW ();  /*XXX*/
@message void MSG_VIS_CONTENT_DISABLE_HOLD_UP ();  /*XXX*/
@message void MSG_VIS_CONTENT_ENABLE_HOLD_UP ();  /*XXX*/
@message Boolean MSG_VIS_CONTENT_TEST_IF_ACTIVE_OR_IMPLIED_WIN (WinHandle window =  bp) = carry;  /*XXX*/
@message void MSG_VIS_CONTENT_UNWANTED_MOUSE_EVENT (VisMouseGrab *mouseGrab = cx:dx, word inputState = bp);  /*XXX*/
@message void MSG_VIS_CONTENT_UNWANTED_KBD_EVENT (word character = cx, word flags = dx, word state = bp);  /*XXX*/
@message void MSG_VIS_CONTENT_REMOTE_OBJ_MESSAGE_VIA_HOLD_UP_QUEUE ();  /* Can't be accessed in C */
@message void MSG_VIS_CONTENT_SET_DOC_BOUNDS(@stack sdword bottom,
                sdword right, sdword top, sdword left);  /*XXX*/
@message void MSG_VIS_CONTENT_NOTIFY_ACTIVE_MOUSE_GRAB_WIN_CHANGED ();

typedef struct {
    optr			VMG_object;
    WindowHandle		VMG_gWin;
    PointDWord			VMG_translation;
    VisInputFlowGrabFlags	VMG_flags;
    byte			VMG_unused;
} VisMouseGrab} ;

    @default VI_typeFlags = VTF_IS_COMPOSITE | VTF_IS_WINDOW |
                VTF_IS_CONTENT | VTF_IS_WIN_GROUP |
                VTF_IS_INPUT_NODE;

    @instance optr VCNI_view;
    @instance WindowHandle VCNI_window = 0;
    @instance word VCNI_viewHeight = 0;
    @instance word VCNI_viewWidth = 0;
    @instance VisContentAttrs VCNI_attrs = 0;

    @instance PointDWord VCNI_docOrigin = {0, 0};
    @instance PointWWFixed VCNI_scaleFactor = {{0, 1}, {0, 1}};
    @instance ChunkHandle VCNI_prePassiveMouseGrabList = 0;
    @instance VisMouseGrab VCNI_impliedMouseGrab =
        {0, 0, {0, 0}, (VIFGF_MOUSE | VIFGF_PTR), 0};
    @instance VisMouseGrab VCNI_activeMouseGrab =
        {0, 0, {0, 0}, 0, 0};
    @instance ChunkHandle VCNI_postPassiveMouseGrabList = 0;
    @instance KbdGrab VCNI_kbdGrab = {0, 0};
    @instance FTVMCGrab VCNI_focusExcl = {0, MAEF_FOCUS};
    @instance FTVMCGrab VCNI_targetExcl = {0, MAEF_TARGET};
    @instance Handle VCNI_holdUpInputQueue = 0;
    @instance word VCNI_holdUpInputCount = 0;
    @instance HoldUpInputFlags VCNI_holdUpInputFlags = 0;

@endc

@endlib


Objects\vCompC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	vCompC.goh
 * AUTHOR:	Chris Hawley: 8/19/91
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines VisCompClass
 *
 *	$Id: vCompC.goh,v 1.22.6.1 96/04/28 08:31:38 chris Exp $
 *
 ***********************************************************************/

@optimize

@deflib ui

@include  <Objects/visC.goh>

@class 	VisCompClass, VisClass;

/* VCI_geoDimensionAttrs */

typedef ByteEnum WidthJustification ;
#define WJ_LEFT_JUSTIFY_CHILDREN  		  0x00
#define WJ_RIGHT_JUSTIFY_CHILDREN  		  0x40
#define WJ_CENTER_CHILDREN_HORIZONTALLY 		  0x80
#define WJ_FULL_JUSTIFY_CHILDREN_HORIZONTALLY 	  0xc0

typedef ByteEnum HeightJustification ;
#define HJ_TOP_JUSTIFY_CHILDREN 			  0x00
#define HJ_BOTTOM_JUSTIFY_CHILDREN 		  0x04
#define HJ_CENTER_CHILDREN_VERTICALLY 		  0x08
#define HJ_FULL_JUSTIFY_CHILDREN_VERTICALLY 	  0x0c

typedef ByteFlags VisCompGeoDimensionAttrs ;
#define VCGDA_WIDTH_JUSTIFICATION                0xc0
#define VCGDA_EXPAND_WIDTH_TO_FIT_PARENT         0x20
#define VCGDA_DIVIDE_WIDTH_EQUALLY               0x10
#define VCGDA_HEIGHT_JUSTIFICATION               0x0c
#define VCGDA_EXPAND_HEIGHT_TO_FIT_PARENT        0x02
#define VCGDA_DIVIDE_HEIGHT_EQUALLY              0x01

/* VCI_geoAttrs */

typedef ByteFlags VisCompGeoAttrs ;
#define	VCGA_ORIENT_CHILDREN_VERTICALLY			0x80
#define VCGA_INCLUDE_ENDS_IN_CHILD_SPACING 	0x40
#define VCGA_ALLOW_CHILDREN_TO_WRAP 		0x20
#define VCGA_ONE_PASS_OPTIMIZATION 		0x10
#define VCGA_CUSTOM_MANAGE_CHILDREN 		0x08
#define VCGA_HAS_MINIMUM_SIZE 			0x04
#define	VCGA_WRAP_AFTER_CHILD_COUNT			0x02
#define VCGA_ONLY_DRAWS_IN_MARGINS 		0x01

typedef struct {
    VisCompGeoAttrs	    	GADA_geoAttrs;
    VisCompGeoDimensionAttrs	GADA_geoDimensionAttrs;
} GeoAndDimensionAttrs} ;

#define GEO_ATTRS (val) ((val).GADA_geoAttrs)
#define GEO_DIMENSION_ATTRS (val) ((val).GADA_geoDimensionAttrs)

@message GeoAndDimensionAttrs MSG_VIS_COMP_GET_GEO_ATTRS () = cx; /***/
@message void MSG_VIS_COMP_SET_GEO_ATTRS (   /***/
                                GeoAndDimensionAttrs attrsToSet = cx,
                                GeoAndDimensionAttrs attrsToClear = dx);

/*
 * Size values are often returned from functions.  To allow their easy return,
 * the type SizeAsDWord is returned.  The DWORD_WIDTH() and DWORD_HEIGHT()
 * macros can be used to access the x and y components.
 */
typedef dword SpacingAsDWord ;

#define DWORD_CHILD_SPACING (val) 	((word) (val))
#define DWORD_WRAP_SPACING (val) 	((word) ((val) >> 16))

#define MAKE_SPACING_DWORD (width,height) \
    ((((dword) (height)) << 16) | (width))

@message SpacingAsDWord MSG_VIS_COMP_GET_CHILD_SPACING () = dx.cx;
@message SizeAsDWord MSG_VIS_COMP_GET_MINIMUM_SIZE () = dx.cx;

@message void MSG_VIS_COMP_GET_MARGINS (Rectangle *retValue = axbpcxdx );
@message word MSG_VIS_COMP_GET_WRAP_COUNT () = cx;

    @default VI_typeFlags = VTF_IS_COMPOSITE;

    @instance @composite VCI_comp = VI_link;
    @instance optr VCI_gadgetExcl;
    @instance WindowHandle VCI_window = NullHandle;
    @instance VisCompGeoAttrs VCI_geoAttrs = 0;
    @instance VisCompGeoDimensionAttrs VCI_geoDimensionAttrs = 0;

@endc

@endlib


viewer.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1994 -- All Rights Reserved

PROJECT:	GEOS
MODULE:		Viewer Interface Library
FILE:		viewer.goh

AUTHOR:		Skarpi Hedinsson, Nov  9, 1994

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    SH	11/ 9/94   	Initial version.

DESCRIPTION:

    $Id: viewer.goh,v 1.67.1.34 98/09/24 22:31:23 kho Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@optimize

@include  <mailbox.goh>
#include  <Foam/faxOpts.h>

@deflib	viewer

/* ---------------------------------------------------------------------------
 *   Constants
 * --------------------------------------------------------------------------*/
typedef enum {
    VIE_FILE_NOT_RECOGNIZED     = 0x1,
    /*  A file did not have a token (if GEOS file) or an DOS extension. */

    VIE_NO_VIEWER_LIBRARY    ,
    /*
     *  A viewer library for the given file was not found.  An application
     *  can respond to the message by launching a default viewer library.
     */

    VIE_SHARING_VIOLATION    ,
    /*  The file could not be opened. */

} ViewerInterfaceError} ;

typedef enum {
    VLR_OPEN     = 0x0,
    /*  Loads a viewer library and opens the file in ViewerParams. */

    VLR_DETACH    ,
    /*
     *  Called by ViewerDetach to tell the viewer library to detach and
     *  destroy it's UI and return a block of state to save.
     *
     *  Pass: optr viewerLibUI	(Viewer Library UI to destroy)
     *  Return: hptr stateBlock
     */

    VLR_CHANGE_DOCUMENT    ,
    /*
     *  Called when a new document needs to be viewed using a viewer already
     *  on screen.
     *
     *  Pass: ViewerChangeDocumentStruct *vcds
     */

    VLR_CLOSE
    /*
     *  Called when the application needs to close the viewer.  This could
     *  happen when a user presses ctrl-n (or ctrl-p) to view a new file and
     *  the new file is a different type and thus needs a differnet viewer.
     *
     *  Pass: optr viewerLibUI (Viewer Library UI to destory)
     */

} ViewerLibraryRoutine} ;

typedef WordFlags ViewerAttributes ;
#define VA_NEW_DOCUMENT 	(0x8000)
    /* The document to open is new (just created.)  This will turn off
       the Ctrl-N/P keys of the viewer libraries. */
#define VA_NO_UNDO  (0x4000)
        /* Undo shouldn't be allowed in the document editor. */
#define VA_NO_RENAME  (0x2000)
        /* We won't let the user rename the document while closing. */
/* 13 bits unused */

/* ---------------------------------------------------------------------------
 *   Structures
 * --------------------------------------------------------------------------*/
typedef struct {
    DocumentInfo	VCD_documentInfo;
    /* Name of document to view. */

    optr		VCD_viewerOD;
    /* Optr of the viewer library ui. */

} ViewerChangeDocumentStruct} ;

typedef struct {

    FileLongName	VP_libraryName;
    /*  Name of the library viewing VP_documentInfo.DI_docName */

    DocumentInfo	VP_documentInfo;
    /*  The full path and name of the file to view. */

    GeodeToken		VP_app;
    /*
     *  Specifies what application is loading the library.  This allows
     *  a viewer library to customize user interface.
     */

    optr		VP_destination;
    /*  Process OD of the calling thread. Needed to unload the library */

    word		VP_closeMsg;
   /*
    *  Message sent to the destination passing the library handle when
    *  the library should be unloaded.  The handler for this message the
    *  calles ViewerUnloadLibrary.  See VIEWER_PARAMS_CLOSE_MSG prototype.
    */

    word		VP_nextPrevMsg;
   /*
    *  Message sent to the destination when the user wants to see the next
    *  or previous document.  See VIWER_PARAMS_NEXT_PREV_MSG prototype.
    */

    ViewerAttributes 	VP_attr;
   /*
    * Special attributes that apply to the viewer or the document being
    * viewed.
    *
    */

    hptr		VP_state;
   /*
    * Handle of a state block if viewer library is being restored from state.
    * Null if no state.
    *
    */

} ViewerParams} ;

/*
 * Message prototype for the VP_closeMsg.  Use this when you need to define
 * a callback close message for a viewer library.
 *
 */
@prototype void VIEWER_PARAMS_CLOSE_MSG (GeodeHandle gh=cx, ViewerCloseStatus vcs=dx);

/*
 * Message prototype for the VP_nextPrevMsg.
 *
 */
@prototype void VIEWER_PARAMS_NEXT_PREV_MSG (word character=cx);

/*
 * State file structure returned by MSG_VIEWER_RETURN_STATE and passed in
 * VP_state.
 *
 */
typedef struct {

    DocumentInfo	VCS_documentInfo;
    /*
     * Name and directory of the current document.
     */

    VisTextRange	VCS_textRange;
    /*
     * The text range (cursor/selection) of the current document.
     */

} ViewerControlState} ;

typedef struct {
    FileLongName	FOCRCS_documentName;
    /* Name of document to rename/copy. */
    FileLongName	FOCRCS_newName;
    /* New name for document. */
    FDocumentDir	FOCRCS_documentDir;
    /* Document directory where the documents are located. */
} FileOpenControlRenameCopyStruct} ;

/*
 * The type of the file being viewed: a text note, a faxfile, an SMS, or
 * whatever.
 */
typedef enum {
    VFT_NOTE     = 0,   	    /* It's a note */
    VFT_FAXFILE     = 2, 	    /* It's a faxfile */
    VFT_GRAPHICS     = 4,       /* Graphics file */
    VFT_RESET_STATUS     = 6    /* This is to make sure viewer get UI update,
                  even when the same file is opened twice in a row. */
} ViewerFileType} ;

/*
 * This structure is used with the GAGCNLT_VIEWER_NOTIFICATIONS gcn list and
 * GWNT_VIEWER_DOCUMENT_CHANGE notification to allow the fax transport driver's
 * mail address control to behave differently when viewing a faxnote or a
 * received fax.
 *
 * Or whatever.
 */
typedef struct {
    DocumentInfo    	VDS_docInfo;	    /* The document's name */
    ViewerFileType  	VDS_type;
    FaxSendResolutionChoice VDS_resolution; /* If it's a fax, we need to know */
} ViewerDocumentStatus} ;

/*
 *  The status of the document as returned from MSG_VIEWER_CLOSE.  This enum
 *  is also passed to the viewer close message (VP_closeMsg), so applications
 *  can determin what the status of the document was at the time the viewer
 *  was closed.
 */
typedef enum {
    VCS_CLOSED     = 0x0,
/*
 *  Viewer closed.  This means the document was closed and the auto-save
 *  timers have been turned off.
 */

    VCS_DOCUMENT_DELETED    ,
/*  The viewer was closed and the document was deleted. */

    VCS_NOT_CLOSED    ,
/*
 *  The viewer was not closed.  This happens when the user gets a
 *  warning that he/she is about to close an empty document that will
 *  be deleted and the user elects not to close the viewer.
 */

    VCS_ERROR    ,
/*
 *  The viewer was closed but an error occurd.  This can
 *  only be returned with the viewer close message (VP_closeMsg).
 */

} ViewerCloseStatus} ;

/*
 * Maximum length of text moniker for button that lets user create
 * new notes/message/faxes.
 */
#define MAX_CREATE_NEW_MONIKER_LENGTH 	20	/* new for N9000v20 */

/*
 * Max # of files user can transfer via IR at a time.
 */
#define MAX_NUM_OF_FILES_COPIED_VIA_IR 	20

/* ---------------------------------------------------------------------------
 *   FileOpenControlClass
 * --------------------------------------------------------------------------*/
@class  FileOpenControlClass, ComplexMonikerClass;

@default ComplexMoniker = GenControlClass;

typedef WordFlags FileOpenFeatures ;
/*  for future use 5 bits unused */
#define FOF_COPY_VIA_IR 		(0x0400) /*  new for N9110 */
#define FOF_COPY_TO_SOUNDS 	(0x0200) /*  new for N9110 */
#define FOF_MOVE 		(0x0100) /*  new for N9000V20 */
#define FOF_CREATE_FOLDER 	(0x0080) /*  new for N9000V20 */
#define FOF_COPY 		(0x0040) /*  new for N9000V20 */
#define FOF_CLOSE 		(0x0020)
#define FOF_OPEN 		(0x0010)
#define FOF_CREATE_NEW 		(0x0008)
#define FOF_DELETE 		(0x0004)
#define FOF_RENAME_COPY 		(0x0002)
#define FOF_RENAME 		(0x0001)

#define FOF_DEFAULT_FEATURES 	(FOF_OPEN | FOF_CLOSE | FOF_CREATE_NEW)
#define FOF_FULL_MENU 	(FOF_MOVE | FOF_CREATE_FOLDER | FOF_COPY | \
             FOF_CREATE_NEW | FOF_RENAME_COPY | FOF_RENAME | \
             FOF_COPY_TO_SOUNDS | FOF_COPY_VIA_IR)

@message void MSG_FILE_OPEN_CONTROL_OPEN (DocumentInfo *docInfo = cx:dx, \
                     ViewerAttributes attr = bp);
/*
 *  Opens/displays the currently selected file by loading the
 *  corrisponding viewer library.
 *
 *  Pass: cx:dx - ptr to DocumentInfo
 *        bp - ViewerAttributes
 *  Return: nothing
 *  Destroyed: ax, cx, dx, bp
 */

@message ViewerInterfaceError \
     MSG_FILE_OPEN_CONTROL_GET_VIEWER_LIBRARY_NAME(@stack
                    FileLongName *libName,
                    DocumentInfo *docInfo) = ax;
/*
 *  Returns the name of the viewer library used to view/edit the
 *  selected file.  Applications can subclass this message to return
 *  a different viewer library name.
 *
 *  Pass: ss:bp - ViewerLibNameStruct
 *  Return: ss:bp - VLNS_libraryName filed.
 *          ax - ViewerInterfaceError
 *  Destroyed: nothing
 */

@message Boolean MSG_FILE_OPEN_CONTROL_CREATE_NEW (DocumentInfo *docInfo = cx:dx)=carry;
/*
 *  Return TRUE if error creating a file.
 *
 *  Creates a default new file and calls MSG_FILE_OPEN_CONTROL_OPEN on
 *  it.  A application can subclass this message to create a different
 *  file type.
 *
 *  Pass: cx:dx - buffer for DocumentInfo
 *  Return: cx:dx - buffer with DocumentInfo filled out.
 *          carry - set if error creating file.
 *  Destroyed: ax, cx, dx, bp
 */

@message void MSG_FILE_OPEN_CONTROL_DELETE ();
/*
 *  Deletes the currently selected file.
 *
 *  Pass: nothing
 *  Return: nothing
 *  Destroyed: ax, cx, dx, bp
 */

@message void MSG_FILE_OPEN_CONTROL_RENAME_COPY ();
/*
 *  OBSELEDATED BY MSG_FILE_OPEN_CONTROL_RENAME and
 *                 MSG_FILE_OPEN_CONTROL_COPY messages
 *
 *  Now we don't have a UI that gives the two options at the same time.
 *
 *  Opens the Rename/Copy dialog which allows the user to rename or copy the
 *  selected file.
 *
 *  Pass: nothing
 *  Return: nothing
 *  Destroyed: ax, cx, dx, bp
 *
 */

@message void MSG_FILE_OPEN_CONTROL_ITEM_SELECTED( \
                word entryNumber = cx, \
                GenFileSelectorEntryFlags fsFlags = bp);
/*
 *  Message sent out when an item is selected in the file selector
 *
 *  Pass: cx - entry # of selection
 * 	bp - GenFileSelectorEntryFlags
 *
 *  Return: nothing
 *  Destroyed: ax, cx, dx, bp
 */

@message void MSG_FILE_OPEN_CONTROL_SET_DIRECTORY (FDocumentDir fDocDir = cx);
/*
 *  Sets the current directory of the file selector.
 *
 *  Pass: cx - FDocumentDir
 *  Return: nothing
 *  Destroyed: ax, cx, dx, bp
 */

@message FDocumentDir MSG_FILE_OPEN_CONTROL_GET_DIRECTORY ()=cx;
/*
 *  Gets the current directory of the file selector.
 *
 *  Pass: nothing
 *  Return: cx - FDocumentDir
 *  Destroyed: ax, cx, dx, bp
 */

@message void MSG_FILE_OPEN_CONTROL_GET_FILTER_ROUTINE (
        GenFileSelectorGetFilterRoutineResults *filter = axcxdxbp);
/*
 * Same as MSG_GEN_FILE_SELECTOR_GET_FILTER_ROUTINE
 */

@message void MSG_FILE_OPEN_CONTROL_SUB_DIR_OPEN (FDocumentDir fDocDir=cx);
/*
 * Sent when a user opens a sub directory. Passing the directory.
 */

@message void MSG_FILE_OPEN_CONTROL_SUB_DIR_CLOSE (FDocumentDir fDocDir=cx);
/*
 * Sent when a user closes a sub directory. Passing the directory.
 */

@message void MSG_FILE_OPEN_CONTROL_RENAME_DOCUMENT (
        FileOpenControlRenameCopyStruct *renameCopyStruct=ss:bp);
/*
 * Renames the selected document using FileRename. Subclass this message if
 * you need to prepare the document before renaming.
 */

@message void MSG_FILE_OPEN_CONTROL_COPY_DOCUMENT (
        FileOpenControlRenameCopyStruct *renameCopyStruct=ss:bp);
/*
 * Copies the selected document using FileCopy. Subclass this message if
 * you need to prepare the document before copying.
 */

@message void
    MSG_FILE_OPEN_CONTROL_CHANGE_FEATURES    (FileOpenFeatures setf = cl,
                      FileOpenFeatures clearf = ch);
/*
 *
 * OBSOLEDATED BY MSG_FILE_OPEN_CONTROL_CHANGE_FEATURES_16
 *
 * Now there are more than 8 features, so we can't use CL, CH.
 *
 * Allows you to turn features on and off on the fly without forcing
 * a visual re-build of the controllers UI.  This will allow you to
 * remove/add the "rename/copy", "rename" and "delete" triggers in the
 * MSG_FILE_OPEN_CONTROL_SUB_DIR_OPEN/CLOSE method handlers.
 */

@message optr
    MSG_FILE_OPEN_CONTROL_GET_FILE_SELECTOR_OPTR    () = cx:dx;
/*
  Returns the optr of the FileOpenControl's FFileSelector.
*/

/*------------------------------------------------------------------
| The following messages are internal and should not be subclassed.
------------------------------------------------------------------*/

@message void MSG_FOC_OPEN ();
/*
 *  Internal message sent when the user presses the "open" trigger.
 *  The handler for this message calls MSG_FILE_OPEN_CONTROL_OPEN passing
 *  the selected file name.
 */

@message void MSG_FOC_CLOSE ();
/*
 * Internal message sent when a user presses the "close" trigger,
 * which returns them to the top level directory.
 */

@message void MSG_FOC_CREATE_NEW ();
/*
 *  Internal message sent when the user presses the "create new" trigger.
 *  The handler for this message calls MSG_FILE_OPEN_CONTROL_CREATE_NEW
 *  to get the name of create file.
 */

@message void MSG_FOC_UNLOAD_VIEWER_LIBRARY (GeodeHandle gh=cx);
/*
 *  Internal message sent by a viewer library notifying the controller
 *  that it should unload the viewer library.
 */

@message void MSG_FOC_NEXT_PREV_DOCUMENT (word character=cx);
/*
 * Internal message sent by a viewer library notifying the controller that
 * a new document should be opened.
 */

@message void MSG_FOC_NEXT_PREV_GET_NEW_DOC (FileLongName *oldDocName=ss:bp);
/* Internal message sent when the file selector has been updated to show
 * the next or previous document.
 */

@message void MSG_FOC_RENAME_DOC ();
/*
 *  Internal message sent when the user presses the "rename" trigger to
 *  rename a selected file.
 *
 */

@message void MSG_FOC_COPY_DOC ();
/*
 *  Internal message sent when the user presses the "copy" trigger to
 *  copy a selected file.  The "copy" trigger is only enabled if the
 *  current directory is "created texts".
 *
 */

@message word MSG_FOC_CHECK_INCLUDE_EXCLUDE_DIR (FileLongName *name = ss:bp) = cx;
/*
 *  Internal message sent from our FileSelector object to check
 *  if the specified file is in the INCLUDE_DIR or EXCLUDE_DIR list.
 *
 *  Return: non zero to reject the file
 */

@message word MSG_FOC_CHECK_INCLUDE_EXCLUDE_FILE (dword token = cx:dx,
                         word id = bp) = cx;
/*
 *  Internal message sent from our FileSelector object to check
 *  if the specified file is in the INCLUDE_FILE or EXCLUDE_FILE list.
 *
 *  Return: non zero to reject the file
 */

@message void MSG_FOC_OPEN_FOLDER ();
/*
 *  Internal message sent when a user opens a folder.  This message
 *  sets up the FileOpenControl UI for a open folder.
 */

@message void MSG_FOC_SET_FILE_SELECTOR_SELECTION (FileLongName *fileName = ss:bp);
/*
 *  Sends a MSG_GEN_FILE_SELECTOR_SET_SELECTION to the file selector.
 *
 */

@message word MSG_FILE_OPEN_CONTROL_DELETE_CALLBACK () = ax;
/*
 *  Sent by FoamDisplayDeleteWarningNoBlock if the user wants to delete
 *  the current document.  FileDelete is called on the selected document.
 *
 *  Returns FileError if error deleting the document.
 */

@message void MSG_FOC_MENU ();
/*
 *  Open menu dialog in an open folder
 */

@message void MSG_FOC_CREATE_FOLDER ();
/*
 *  Sent when the user finished interacting with create folder ui, and ok'ed
 *  to create folder
 */

@message void MSG_FOC_COPY_DEST_READY ();
/*
 *  The user is done interacting with destination dialog for copy operation
 */

@message void MSG_FOC_MOVE_DOC ();
/*
 *  Sent when the user finished interacting with move document ui, and
 *  ok'ed to move the document
 */

/*------------------------------------------------------------------
| The following messages are not internal, but they are put there to
| make sure that message numbers are preserved.
------------------------------------------------------------------*/

@message void MSG_FILE_OPEN_CONTROL_CREATE_FOLDER ();
/*
 *  This message will bring up create folder ui, so user can create
 *  a new folder inside current folder.
 */

@message void MSG_FILE_OPEN_CONTROL_RENAME ();
/*
 *  This message will bring up file rename dialog.
 */

@message void MSG_FILE_OPEN_CONTROL_COPY ();
/*
 *  This message will bring up file copy dialog.
 */

@message void MSG_FILE_OPEN_CONTROL_MOVE ();
/*
 *  This message will bring up file move dialog.
 */

@message void
    MSG_FILE_OPEN_CONTROL_CHANGE_FEATURES_16    ( FileOpenFeatures setf = cx,
                                     FileOpenFeatures clearf = dx );
/*
 *  This message will change features( see FileOpenFeatures ).
 *  New applications should use this message instead of its 8bit
 *  predecesor: MSG_FILE_OPEN_CONTROL_CHANGE_FEATURES
 */

/*
 *  MSG_META_NOTIFY(ManufacturerID manufID,
 *                  word notificationType,
 *                  word data);
 *
 *  If the NotificationType is GWNT_VIEWER_SHUTTING_DOWN/
 *  MANUFACTURER_ID_GEOWORKS and ViewerCloseStatus is VCS_CLOSED,
 *  FOI_viewerAttr is checked to see if VA_NEW_DOCUMENT is set.
 *  If this is the case then FDD_CREATED_TEXTS folder is opened by
 *  calling MSG_FFS_SET_PATH and MSG_FOC_OPEN_FOLDER is called after
 *  that to set the open folder ui.
 *
 *  In order for this to happen the FileOpenControl must be added to
 *  the GAGCNLT_VIEWER_NOTIFICATIONS gcnlist.
 *
 *  Pass:  data = ViewerCloseStatus
 */

@message void MSG_FILE_OPEN_CONTROL_GET_UNREAD_DOCUMENT (DocumentInfo *docInfo = cx:dx);
/*
 *  This message is sent out to ourselves when we want to get
 *  the DocumentInfo of an unread document. The normal handler
 *  will return the newest unread document in the passed directory.
 *  Applications which subclass this message can return a
 *  different document of their choosing. Do not call super
 *  class if you do so.
 *
 *  Pass:	  DocumentInfo with DI_docDir filled
 *  Return:       DI_docName filled in buffer,
 * 		      or empty string if no such file
 */

@message void MSG_FILE_OPEN_CONTROL_CLOSE_ALL_BUBBLES ();
/*
 *  This is a utility message that can be used to close all the
 *  bubbles (Menu, Destination, Rename, etc).
 */

@message void MSG_FILE_OPEN_CONTROL_LOAD_UNREAD_DOCUMENT (FDocumentDir folder=cx);
/*
 *  A utility message sent to ourselves when we get notification
 *  that we should open the an unread document in a given
 *  directory.
 *
 *  Pass: cx = FDocumentDir or FoamPathHandle of the folder that
 * 		contains the unread document.
 *  Return: nothing
 *  Destroyed: nothing
 */

@protominor NewForCopyToSounds

@message void MSG_FILE_OPEN_CONTROL_COPY_TO_SOUNDS ();
/*
 *  This message will copy the selected file(s) to the folder
 *  which Composer can access
 */

@protoreset

@message void MSG_FOC_DELETE_FILE_OP_VAR_DATA_VIA_QUEUE ();
/*
 * Wrapper for ObjVarDeleteData so that we can force queue it.  Part
 * of the mechanism for preventing bad behavior when the user
 * clicks OK button twice when copying or renaming.
 */

@protominor NewForCopyViaIR

@message void MSG_FILE_OPEN_CONTROL_COPY_VIA_IR ();
/*
 *  This message will copy the selected file(s) via IR.
 *
 */

@message void MSG_FILE_OPEN_CONTROL_COPY_ONE_FILE_VIA_IR (hptr block = cx,
                             word numFiles = dx,
                             word fileID = bp);
/*
 * Internal message to copy one file via IR.
 *
 */

@message void MSG_FILE_OPEN_CONTROL_COPY_VIA_IR_CLEANUP (hptr block = cx,
                            word numFiles = dx);
/*
 * Internal message to clean up IR transfer, and report error
 * (some files are open) if necessary.
 *
 * Pass:	cx = selection block handle
 *		dx = number of files in the selection block
 */

@message void MSG_FILE_OPEN_CONTROL_COPY_VIA_IR_MAILBOX_ERROR (hptr block = cx,
                              word numFiles = dx);
/*
 * Internal message to clean up IR transfer, and report error
 * because of mailbox error.
 *
 * Pass:	cx = selection block handle
 *		dx = number of files in the selection block
 */

@message void MSG_FILE_OPEN_CONTROL_COPY_VIA_IR_TOO_MANY_FILES (hptr block = cx,
                              word numFiles = dx);
/*
 * Internal message to clean up IR transfer, and report error
 * because the user selects too many files.
 *
 * Pass:	cx = selection block handle
 *		dx = number of files in the selection block
 */

@protoreset

@vardata FDocumentDir ATTR_FILE_OPEN_DEFAULT_DIRECTORY;
/*  The directory to start off in */

@vardata ChunkHandle ATTR_FILE_OPEN_DEFAULT_FILE_NAME_PREFIX;
/*
 *  Default prefix to file name when the conroller creates a new
 *  file. (EX. FAX -> FAX 10.10.94)
 */

@vardata ChunkHandle ATTR_FILE_OPEN_CREATE_TRIGGER_MONIKER;
/*
 * (ChunkHandle) FileOpenCreateNewMoniker
 *
 * The moniker of the create document trigger.  The
 * default trigger moniker for create new is "Create Document" but the
 * trigger moniker can customized using this vardata. Example:
 * "Create Message" or "Create Note".
 */

typedef struct {
    optr FOCNM_topText;
    /* Optr of chunk containing the top text of the moniker. */
    optr FOCNM_iconBitmap;
    /* Optr of chunk containing the icon bitmap of the moniker. */
} FileOpenCreateNewMoniker} ;

@vardata FileAttrInfo 	ATTR_FILE_OPEN_FILE_ATTR_INFO;
/*
 *  The FileAttrInfo to use when creating a new file.  The default
 *  is to create a NOTE file but this can be changed by adding this
 *  vardata entry.
 */

@vardata FileLongName	ATTR_FILE_OPEN_VIEWER_LIB_NAME;
/*
 * Stores the name of the viewer library being used to display the selected
 * document. This vardata is used when the controller is restarted from
 * state and needs to know what viewer library to load.
 *
 */

@vardata void ATTR_FILE_OPEN_FILTER_IS_C;
/*
 * Set this attribute if your filter routine is written in C and obeys
 * the Pascal calling convention.
 *
 */

@vardata void ATTR_FILE_OPEN_FILTER;
/*
 * Set this attribute if you have a filter routine.
 *
 */

@vardata ChunkHandle	ATTR_FILE_OPEN_INCLUDE_DIR;
/*
 *  Set this to point to a list of FDocumentDir types, if you
 *  DON'T have your own filter routine, but
 *  want the controller to exclusively list the specified
 *  directories. See usage example below:
 *
 */

@vardata ChunkHandle	ATTR_FILE_OPEN_EXCLUDE_DIR;
/*
 *  Set this to point to a list of FDocumentDir types, if you
 *  DON'T have your own filter routine, but
 *  want the controller to exclude the specified
 *  directories.
 *
 *  NOTE: ATTR_FILE_OPEN_INCLUDE_DIR has a higher priority than
 *  ATTR_FILE_OPEN_EXCLUDE_DIR if both are used concurrently.
 *
 *  Usage example for ATTR_FILE_OPEN_[IN|EX]CLUDE_DIR:
 *
 * 		......
 * 		ATTR_FILE_OPEN_INCLUDE_DIR  = @IncludeList;
 * 	}
 *
 *  	@chunk word IncludeList[] = {
 * 		FDD_CREATED_TEXTS,
 * 		FDD_RECEIVED_SM,
 * 		FDD_DOWNLOADED_FILES
 * 	}
 */

@vardata ChunkHandle	ATTR_FILE_OPEN_INCLUDE_FILE;
/*
 *  Set this to point to a list of GeodeToken types, if you
 *  DON'T have your own filter routine, but
 *  want the controller to exclusively list the specified
 *  files. See usage example below.
 */

@vardata ChunkHandle	ATTR_FILE_OPEN_EXCLUDE_FILE;
/*
 *  Set this to point to a list of GeodeToken types, if you
 *  DON'T have your own filter routine, but
 *  want the controller to exclude the specified
 *  files.
 *
 *  NOTE: ATTR_FILE_OPEN_INCLUDE_FILE has a higher priority than
 *  ATTR_FILE_OPEN_EXCLUDE_FILE if both are used concurrently.
 *
 *  Usage examples for ATTR_FILE_OPEN_[IN|EX]CLUDE_FILE:
 *
 * 		......
 * 		ATTR_FILE_OPEN_INCLUDE_FILE  = @IncludeList;
 * 		......
 * 	}
 *
 *  	@chunk GeodeToken IncludeList[] = {
 * 		{"OUTB", MANUFACTURER_ID_GEOWORKS}
 * 	}
 *
 *  You can also use '{"", MANUFACTURER_ID_GEOWORKS}'
 *  to imply non-Geos created files which don't have a
 *  proper GeodeToken.
 */

@vardata DocumentInfo TEMP_FILE_OPEN_FILE_SELECTOR_INFO;
/*
 *  Temporary stores the path and selection of the file selector so it
 *  can be reset when we are restoring from state.
 */

@vardata FileLongName TEMP_FS_SELECTION;
/*
 *  Temporary stores the file selectors current selection when the user
 *  presses CTRL_N or CTRL_P in a document viewer.
 */

@vardata void HINT_FILE_OPEN_DONT_FILTER_DOCUMENT_SUB_DIRS;
/*
 * If present, will not perform file/directory filtering on
 * sub-directories of SP_DOCUMENT. Used in conjunction with
 * ATTR_FILE_OPEN_[IN|EX]CLUDE_FILE/DIR.
 */

@vardata word TEMP_FILE_OPEN_CONTROL_LAST_UI;
/*
 * Internal use.  Stores the last UI state
 */

@vardata word TEMP_FILE_OPEN_CONTROL_DESTINATION_PATH;
/*
 * Internal use.  Stores destination folder for copy/move operations
 */

typedef struct {
    PathName         FFP_path;          /* path string */
    FileLongName     FFP_fileName;      /* file name string */
    word             FFP_disk;          /* disk handle or StandardPath */
} FocFilePath} ;

@vardata FocFilePath TEMP_FOC_SELECTOR_INFO;
/*
 * This saves current path and file name of file selector to state
 */

@vardata void TEMP_FILE_OPEN_CONTROL_FILE_OPERATION_IN_PROGRESS;
/*
 * Internal use.  Signals we're in the middle of a copy or rename (so
 * we don't try it again)
 */

@vardata DocumentInfo TEMP_FILE_OPEN_CONTROL_NEW_DOC;
/*
 * Internal use: Saves the name of the new document we just created
 * so we can display it as being selected when the document is closed.
 */

@vardata void TEMP_FILE_OPEN_CONTROL_SOME_IR_DOCS_ARE_OPEN;
/*
 * Internal use:  Set to signal that some documents to be
 * transferred via IR are open. In that case, we still want to
 * keep transferring the rest of files but user would see an
 * error.
 */

@instance byte FOI_viewerLibraryOpenCount = 0;
/*
 *  Tells us if the file open control has a viewer library loaded.
 */

@instance hptr FOI_viewerLibraryHandle = 0;
/*
 *  Handle of the currently loaded viewer library.  The handle is need
 *  to be able to unload the library.
 */

@instance optr FOI_viewerLibraryUIOD = ConstructOptr(0,0);
/*
 *  OD of the UI created for the viewer library.  This OD is passed on
 *  to ViewerDetatch which will destroy the UI and return a state block.
 */

@instance ChunkHandle FOI_viewerLibraryStateChunk = 0;
/*
 * The chunk handle of the save state block returned by a viewer library
 * during a detach.  If this is zero then there is no state chunk.
 *
 */

@instance word FOI_folderTextChunk = 0;
/*
 * Chunk handle of the current folder topText chunk located in the child block.
 * Used when the the ComplexMoniker of FileOpenSelectorMoniker changes to
 * reflect the folder opened by the user. INTERNAL ONLY.
 *
 */

@instance ViewerAttributes FOI_viewerAttr = 0;
/*
 *  ViewerAttributes passed to the current viewer in ViewerParams.
 *  When the FileOpenControl restores from state these are the
 *  ViewerAttributes passed to the viewer library.
 */

@default GI_states = (@default | GS_ENABLED);

@endc	/* FileOpenClass */

/* ---------------------------------------------------------------------------
 *   ViewerControlClass
 *
 *   Notification type(s) responded to:
 *  	- MANUFACTURER_ID_GEOWORKS.GWNT_FOAM_AUTO_SAVE:
 *
 *   GenApplication GCN lists subclasses have to be on:
 *	- GAGCNLT_FOAM_NOTIFICATIONS
 *
 * --------------------------------------------------------------------------*/
@class  ViewerControlClass, GenControlClass;

/*
 *  Displays the file specified in vardata in the textObject passed.
 *
 *  Pass: DocumentInfo of document to open.
 *  Return: FALSE if error and doc could not be displayed.
 *  Destroyed: nothing
 */
@message Boolean MSG_VIEWER_OPEN (DocumentInfo *docInfo=cx:dx)=ax;

typedef struct {
    word DOR_status;
    DocumentHandle DOR_docHandle;
    word unused1;
    word unused2;
} DocumentOpenResult} ;

/*
 * Opens the document in ATTR_DOCUMENT_INFO and returns the DocumentHandle.
 * This message can be subclassed to add file checking (protocols and token).
 * Returns a error (FALSE if no error).  Stores the document handle in
 * VCI_docHandle.
 */
#define VCC_GET_STATUS (A) ((word) ((A) >> 16))
#define VCC_GET_DOCUMENT_HANDLE (A) ((DocumentHandle) (A))
@message dword MSG_VIEWER_OPEN_DOCUMENT (FDocAccess docAccess=cx)=ax.cx;

/*
 * Closes the document in ATTR_DOCUMENT_INFO.
 */
@message void MSG_VIEWER_CLOSE_DOCUMENT ();

/*
 * Loads a text transfer item from an open document file into the text object.
 *
 * Pass: DocumentHandle docHandle
 * Return: TRUE if a text transfer item was not found and no text was loaded.
 */
@message Boolean MSG_VIEWER_ATTACH_UI (DocumentHandle docHandle=cx)=carry;

/*
 * Applications can subclass this message to display the document name in
 * user interface.
 */
@message void MSG_VIEWER_SET_TITLE (TCHAR *titleText=cx:dx);

/*
 *  Close the viewer control by closing the document, turning off the auto-save
 *  timer.  Also deletes empty documents being closed.
 *
 *  Pass: nothing
 *  Return: ViewerCloseStatus
 *  Destroyed: nothing
 */
@message ViewerCloseStatus MSG_VIEWER_CLOSE ()=ax;

/*
 *  Saves the text in textObject to a file.
 *
 *  Pass: nothing
 *  Return: FoamSaveAction if document was saved.
 *          TRUE if no text was saved (document empty).
 *
 *  Destroyed: nothing
 */
@message FoamSaveAction MSG_VIEWER_SAVE ()=ax;

/*
 *  Deletes the current viewer document. Will not display a warning dialog.
 *
 *  Pass: nothing
 *  Return: nothing
 *  Destroyed: nothing
 */
@message void MSG_VIEWER_DELETE ();

/*
 *  Internal message sent by the controller to itself requesting the text
 *  object chunk handle.  Controllers subclassed of ViewerControlClass need
 *  to handle this message.
 *
 *  Pass: dx - Text object chunk handle.
 *  Return: nothing
 *  Destroyed: nothing
 */
@message ChunkHandle MSG_VIEWER_GET_TEXT_OBJECT_OFFSET ()=dx;

/*
 * Returns a block of the viewers state.  This includes DocumentInfo and ""
 * where is the cursor is positioned.  Message MSG_VIEWER_SAVE is called to
 * save any changes made to the text object.
 *
 */
@message hptr MSG_VIEWER_RETURN_STATE ()=dx;

/*
 *  Same as MSG_VIEWER_OPEN only this method takes a handle to a block of
 *  ViewerControlState which specifies what file to open.  State block is
 *  freed after use.
 *
 */
@message Boolean MSG_VIEWER_OPEN_FROM_STATE (hptr hStateBlock=dx)=ax;

/*
 *  Starts the auto-save timer.  The interval is stored in the .ini file
 *  (under the [UI] catagory.)  The timer calls MSG_VIEWER_AUTO_SAVE when
 *  it`s time to save the document.  The timer is only started if the
 *  VCA_AUTO_SAVE flag is set.
 *
 */
@message void MSG_VIEWER_AUTO_SAVE_START ();

/*
 *  Save the text in the text object to open document.
 *
 */
@message void MSG_VIEWER_AUTO_SAVE ();

/*
 *  Stops the auto-save timer.
 *
 */
@message void MSG_VIEWER_AUTO_SAVE_STOP ();

/*
 *  Displays the document specified in vardata read-only.  The document can
 *  not be saved and auto-save is disabled.
 *
 *  Pass: DocumentInfo of document to open.
 *  Return: FALSE if error and doc could not be displayed.
 *  Destroyed: nothing
 */
@message Boolean MSG_VIEWER_OPEN_READ_ONLY (DocumentInfo *docInfo=cx:dx);

/*
 *  Get the DocumentInfo of the current document.
 *
 *  Pass: DocumentInfo buffer
 *  Return: DocumentInfo filled inn.
 *  Destroyed: nothing
 */
@message void MSG_VIEWER_GET_DOCUMENT_INFO (DocumentInfo *docInfo=cx:dx);

/*
 * Returns the MailboxDataFormat for the document when registering
 * a message with the Mailbox library.
 *
 * Pass: nothing
 * Return: MailboxDataFormat
 */
@message MailboxDataFormat MSG_VIEWER_GET_MESSAGE_FORMAT () = cx:dx;

/*

  Returns the ViewerControlAttributes.

  Pass: nothing
  Return: cx - ViewerControlAttributes
  Destroyed: nothing

*/
@message ViewerControlAttributes MSG_VIEWER_GET_ATTRIBUTES () = cx;

/*

  Open the viewer passing a buffer of text. This means there is no
  document file associated with the viewer content - this means no
  saving of any kind.

  Pass: cx:dx - fptr to a buffer of text.
  Return: nothing
  Destroyed: nothing

*/
@message void MSG_VIEWER_OPEN_TEXT_ONLY (TCHAR *text=cx:dx);

typedef struct {
    GeodeToken	token;
    word    	junk;
} ViewerMessageToken} ;

/*
 * Returns the GeodeToken to use as the destination application
 * when creating a message for the Mailbox library. No need to call superclass
 * unless you don't understand the format. ViewerControlClass returns
 * 'SMSA',GEOWORKS for GMDFID_SHORT_MESSAGE, 'NBOK',GEOWORKS for
 * GMDFID_FOAM_FILE, and 'FAXA',GEOWORKS for GMDFID_FAX_FILE.
 *
 * Pass: cxdx = MailboxDataFormat
 * Return: cxdxbp = GeodeToken
 * Destroyed: nothing
 */
@message void MSG_VIEWER_GET_MESSAGE_TOKEN (ViewerMessageToken *result=cxdxbpax,
                       MailboxDataFormat format = cx:dx);

/*
 * Called when the viewer class is generating a short message to send.
 * Returns a block handle of a message body text block. The default behavior
 * is to return the text in the viewers text object as the text body.
 * Subclass this method if you need to return anything other than the text
 * in text object.
 *
 * The block should always exist on return.  It should contain at least a NULL.
 *
 *	PASS:	Nothing
 *
 *	RETURN:	MemHandle and text size of the block in which text was placed.
 *		Block resized to be the size of the null-terminated text.
 */
#define VCC_SM_TEXT_GET_TEXT_SIZE (A) ((A) >> 16))
#define VCC_SM_TEXT_GET_MEM_HANDLE (A) ((MemHandle) (A))
@message dword MSG_VIEWER_GET_SM_TEXT () = ax.cx;

/*
 *
 * This message is sent when a document is about to be sent using the
 * mailbox library.  The default behavior is to save the document via
 * MSG_VIEWER_SAVE.  If for some reason you don't want this you can
 * subclass this message and not call superclass.
 *
 *	PASS:	Nothing
 *
 *	RETURN:	Nothing
 */
@message void MSG_VIEWER_SAVE_BEFORE_MAILBOX_SEND ();

/*
 *  Notify any listening (now or future) MailboxSendControl objects
 *  what the default message body is and in what formats we can
 *  produce it.
 *
 */
@message void MSG_VIEWER_NOTIFY_SEND_CONTROLS ();

/*  INTERNAL
 *  Event sent when the autosave timer goes off.  MSG_VIEWER_AUTO_SAVE is
 *  called and the autosave timer is restarted.
 *
 */
@message void MSG_VIEWER_AUTO_SAVE_EXECUTE ();

/*
 *  Internal message sent when loading a DOS document into the viewer.
 *  The method will queue up additional MSG_VIEWER_APPEND_DOS_TEXT until
 *  the document is fully loaded.  This releaves the performance
 *  bottleneck of loading a very large document in a static loop.
 *
 *  RETURN: True when the last part of the file has been loaded.
 */
@message Boolean MSG_VIEWER_APPEND_DOS_TEXT (dword filePosition=cx:dx)=carry;

/*
 *  Internal message sent when loaded a FoamDocument into the viewer.
 *  The FoamDocument can be saved as a vm chain of text transfer items,
 *  in this case the method will queue up MSG_VC_APPEND_TEXT_TR_ITEM's
 *  until the document is fully loaded.
 *
 *  RETURN: True when the last transfer item has been loaded.
 */
@message Boolean MSG_VIEWER_APPEND_TEXT_TR_ITEM (VMBlockHandle block=cx)=carry;

/*
 * Sent by ViewerSendControlClass object as during transaction creation.
 * MailboxDataFormat is the expected body type that will be requested.
 * This message may not always be sent.
 *
 * Pass: cxdx = MailboxDataFormat
 * Return: nothing
 */
@protominor NewForMessagePrecheck
@message void MSG_VIEWER_PRECHECK_MAILBOX_MESSAGE_FORMAT (
                            MailboxDataFormat format = cx:dx);
@protoreset

/* ----------------------------------------------------------------------------
 * 	Records
 * --------------------------------------------------------------------------*/
typedef WordFlags ViewerControlAttributes ;
#define VCA_AUTO_SAVE 	(0x8000)
/* If this bit is set the viewer control will start an
   auto-save timer to automaticly save the context of the
   text object to the open document. */

/* The following bits reflect temporary state of the document --
   set by the viewer control. */

#define VCA_AUTO_SAVE_STOPPED 	(0x4000)
/* Auto-save has been stopped. */

#define VCA_DOCUMENT_READ_ONLY 	(0x2000)
/* The viewer document is read-only and can not be saved. */

#define VCA_DOCUMENT_IS_NATIVE  (0x1000)
/* The viewer document is a native (DOS) file. */

#define VCA_DOCUMENT_EMPTY_WHEN_OPENED  (0x800)
/* The viewer document was empty at the time it was opened.
   This bit can be use full if you have to take action
   if the user has deleted all the text from the document. */

#define VCA_NO_DOCUMENT  (0x400)
/* There is no document file accosiated with the viewer, this attribute
   is set by MSG_VIEWER_OPEN_TEXT_ONLY. */

#define VCA_DOCUMENT_NOT_FULLY_LOADED  (0x200)
/*  This bit is set if MSG_VC_APPEND_DOS_TEXT has not completed
 *  loading the document. */

#define VCA_DOCUMENT_NAME_CHOSEN  (0x100)
/* This bit is set if the user has chosen the
   document name when the document was being saved. */

/* 8 bits unused */

typedef struct {
    word	RI_docDisk;
    /* Handle of the document's disk. */
    dword	RI_docID;
    /* Document ID of the open document. */
} RegisterInfo} ;

/* ----------------------------------------------------------------------------
 * 	Vardata
 * --------------------------------------------------------------------------*/
@vardata DocumentInfo TEMP_VIEWER_DOC_INFO;
/* The name of the currently displayed document */

@vardata ChunkHandle ATTR_VIEWER_TEXT_OBJECT;
/*  The text object chunk handle */

@vardata RegisterInfo TEMP_REGISTER_INFO;
/* Disk handle and document ID of the open document */

@vardata dword ATTR_VIEWER_CONTROL_SHOW_SAVE_PROGRESS_DIALOG_THRESHOLD;
/*
 *  (only usable in Communicator products  shipped in April 1997
 *  or later)
 *
 *  The threshold of the text size (in bytes) we're trying to save
 *  before a progress dialog appears.
 *
 *  Note: This position used to be occupied by TEMP_VIEWER_UNUSED in
 *  	pre-April 1997 Communicator products.
 */

@vardata optr TEMP_VIEWER_LOADING_METER;
/* Optr to loading meter */

/*-----------------------------------------------------------
 * Vardata only available in Communicator products shipped
 * after April 1997
 *-----------------------------------------------------------*/

@vardata void HINT_VIEWER_NO_DOCUMENT_RENAME;
/* If present, will not put up the document name dialog which
 * allows the user to rename the new document when closing.
 */

typedef struct {
    VMBlockHandle	VTS_contents;
    /*
     *  The HugeArray (in the clipboard file)
     *  that contains a copy of the original
     *  contents of the text object
     */
    VisTextRange	VTS_selection;
    /*
     * The position of cursor/selection
     */
} ViewerTextState} ;

@vardata ViewerTextState TEMP_VIEWER_ORIGINAL_TEXT;
/*
 *  Contains the original contents & state of the text editor
 *  while temporary changes are made to the document for
 *  formatting as a mailbox message.
 */

@vardata dword ATTR_VIEWER_CONTROL_SHOW_DELETE_PROGRESS_DIALOG_THRESHOLD;
/*
 *  The threshold of the document size (in bytes) we're trying to delete
 *  before a progress dialog appears.
 *
 */

/* ----------------------------------------------------------------------------
 * 	Instance Data
 * --------------------------------------------------------------------------*/
@instance hptr VCI_docHandle = 0;
/* Handle of the open document. */

@instance ViewerControlAttributes VCI_attr = VCA_AUTO_SAVE;
/* Attributes the viewer control has. */

@instance hptr VCI_autoSaveHandle = 0;
/* Auto-save timer handle */

@instance word VCI_autoSaveID = 0;
/* Auto-save timer ID */

@endc	/* ViewerControlClass */

/* ---------------------------------------------------------------------------
 *   ViewerControlClass
 * --------------------------------------------------------------------------*/
@class  ViewerDialogClass, GenInteractionClass;

/*
 *  Copies the close message and destination to instance data
 *
 */
@message void MSG_VD_SET_VIEWER_PARAMS (ViewerParams *viewerParams=cx:dx);

/*
 *  Destorys the interaction and sends the close message to the destination.
 *  Calls MSG_VD_RETURN_HEAPSPACE to return the heapspace defined by the
 *  token stored with MSG_VD_SET_HEAPSPACE_TOKEN.
 *
 */
@message void MSG_VD_CLOSE (GeodeHandle viewerLibHandle=cx,
               ViewerCloseStatus closeStatus=dx);

/*
 *  Set or clear the ViewerDialogAttributes.
 *
 */
@message void MSG_VD_SET_DIALOG_ATTR (ViewerDialogAttributes attrSet=cx, \
                     ViewerDialogAttributes attrClear=dx);

/*
 *  Store the heapspace ReservationHandle returned from GeodeRequestSpace.
 *
 */
@message void MSG_VD_SET_HEAPSPACE_TOKEN (ReservationHandle token=cx);

/*
 * Return the heapspace using GeodeReturnSpace  It uses the
 * heapspace token that was saved using MSG_VD_SET_HEAPSPACE_TOKEN.
 *
 */
@message void MSG_VD_RETURN_HEAPSPACE ();

/* ----------------------------------------------------------------------------
 * 	Records
 * --------------------------------------------------------------------------*/
typedef WordFlags ViewerDialogAttributes ;
#define VDA_ALLOW_NEXT_PREV_SHORTCUTS 	(0x8000)
    /* Set this attribute if the viewer should accept the next
     * (ctrl-n) and previous (ctrl-p) shortcut keys.  If the bit
     * is set the VDI_nextPrevMsg will be sent to the destination
     * when the user presses ctrl-p or ctrl-n.
         */
/* 15 bits unused */

/* ----------------------------------------------------------------------------
 * 	Instance Data
 * --------------------------------------------------------------------------*/
@vardata ReservationHandle TEMP_HEAPSPACE_TOKEN;
/* Used to store the token set using MSG_VD_SET_HEAPSPACE_TOKEN. */

@instance optr VDI_destination = ConstructOptr(0,0);
/* Destination of close message */

@instance Message VDI_closeMsg = 0;
/* Close message to be sent to the destination */

@instance Message VDI_nextPrevMsg = 0;
/* Message sent to the destination when the user wants to view the next
 * or previous document.
 */

@instance ViewerAttributes VDI_attr = 0;
/* Viewer attributes passed to the viewer in ViewerParams */

@instance ViewerDialogAttributes \
            VDI_dialogAttr = VDA_ALLOW_NEXT_PREV_SHORTCUTS;
/* Viewer dialog attributes */

@default GI_attrs = (@default | GA_TARGETABLE);
@default GII_attrs = (@default | GIA_MODAL | GIA_NOT_USER_INITIATABLE);
@default GII_visibility = GIV_DIALOG;

@endc

/* ---------------------------------------------------------------------------
 *   ViewerSendControlClass
 * ---------------------------------------------------------------------------*/
@class ViewerSendControlClass, MailboxSendControlClass;

@message void MSG_VSC_CONNECT (optr newOutput = cx:dx,
                  word newParentOffset = bp);
     /*
     * Hooks up the ViewerSendControl's output to the passed optr,
     * and sets the output of all PrintControls mentioned in any
     * ATTR_MAILBOX_SEND_CONTROL_TRANSPORT_HINTs to the same.
     *
     * Also hooks up the ViewerSendControl to another passed optr with a
     * MSG_GEN_ADD_CHILD.
     *
     * Pass: newOutput  	  - optr to the new output
     *	 newParentOffset  - offset to new parent of this send control.
     *  	    	            Note that the block of this object must be
     *  	    	    	    the same as that of the newOutput!
     *
     * Return: nothing
     */

@message void MSG_VSC_DISCONNECT (optr oldOutput = cx:dx,
                 word oldParentOffset = bp);
     /*
     * Clears the ViewerSendControl's output, and does the same to the
     * output of all PrintControls mentioned in any
     * ATTR_MAILBOX_SEND_CONTROL_TRANSPORT_HINTs.
     *
     * Also disconnects the ViewerSendControl from the parent with a
     * MSG_GEN_REMOVE.    The VSC is set unusable by this, incidentally.
     *
     * Pass: oldOutput  	  - optr to the old output
     *	 oldParentOffset  - offset to old parent of this send control.
     *  	    	      	    Note that the block of this object must be
     *  	    	    	    the same as that of the oldOutput!
     *
     * Return: nothing
     */

typedef struct {
    MSCSetAddressesArgs	VSCRI_mscSetAddressesArgs;
    /*
     *  MSCSAA_transAddrs should hold the offset of the
     *  MailboxTransAddr array (within the same block), and the
     *  entries in that array should hold offsets to their
     *  data also in the same block. The segment portion of each
     *  far pointer will be set by the ViewerSendControl method.
     */
    MediumType	VSCRI_mediumType;
    /* MediumType */
} VSCReplyInfo} ;

@message void MSG_VSC_SET_REPLY_ADDRESSES (MemHandle vscReplyInfo);
/*
 *  Sets up a Reply by setting the single transport, changing the moniker
 *  to a default CMT_SEND or to a moniker specified in
 *  ATTR_VIEWER_SEND_CONTROL_REPLY_SEND_MONIKER.  The method then sends a
 *  MSG_MAILBOX_SEND_CONTROL_SET_ADDRESSES using the addresses passed in
 *  vscReplyInfo.
 *
 *  Pass: vscReplyInfo - Block containing VSCReplyInfo structure.
 *  Return: Nothing
 */

@message void MSG_VSC_CANCEL_REPLY ();
/*
 *  Reverts MSG_VSC_SET_REPLY_ADDRESSES setting the single transport and
 *  the complex moniker back to the original state.
 *
 *  Pass: Nothing
 *  Return: Nothing
 */

@message void MSG_VSC_SET_OPTIONS_ACTION (optr optionsTree = cx:dx);
/*
 *	Sets the optr of top of ui tree to attach to Options trigger
 *	when printing.
 *
 *	Passing a null optr will disable the Options trigger.
 *      See ViewerSetSendControlOptions for more information.
 */

@vardata ChunkHandle ATTR_VIEWER_SEND_CONTROL_REPLY_SEND_MONIKER;
/*
 *  ChunkHandle VSCReplySendMoniker
 *  The moniker of the reply dialog "Send" trigger.  The
 *  default trigger moniker is "Send" but the trigger moniker can
 *  customized using this vardata. Example:
 *  "Send Reply" or "START".
 */

@vardata MailboxMediaTransport TEMP_VIEWER_SEND_CONTROL_SINGLE_TRANSPORT;
/*  Temporary storage for the MailboxMediaTransport */

@vardata GetComplexMoniker TEMP_VIEWER_SEND_CONTROL_COMPLEX_MONIKER;
/*  Temporary storage for the text and iconBitmap chunk handles. */

@vardata void TEMP_VIEWER_SEND_CONTROL_REPLY_IN_PROGRESS;
/*  Temporary vardata that tells us if a reply is in progress. */

typedef struct {
    dword	VSCRSM_text;
    /*  Moniker text, optr or ComplexMonikerText constant. */
    dword	VSCRSM_iconBitmap;
    /*  Moniker icon bitmap, optr or ComplexMonikerBitmap constant. */
} VSCReplySendMoniker} ;

@protominor NewViewerMenuClass
@vardata void TEMP_VIEWER_SEND_CONTROL_NO_SEEK_REPLY_BAR_IS_OK;
/* Temporary vardata that tells us if the viewer we are attached to can
   handle ViewerSendControl objects that do not have HINT_SEEK_REPLY_BAR */
@protoreset

typedef struct {
   optr VSCOA_destination;
} VSCOptionsAction} ;

@vardata void TEMP_VIEWER_SEND_CONTROL_ENABLE_OPTIONS_OPTR;
/* Temporary vardata set when printing so we know to enable the Options ui */

@vardata VSCOptionsAction ATTR_VIEWER_SEND_CONTROL_OPTIONS_OPTR;
/* optr of ui tree to attach to Options trigger when printing */

@endc;
/* ---------------------------------------------------------------------------
 *   ViewerMenuInteractionClass
 * -------------------------------------------------------------------------*/
@class ViewerMenuInteractionClass, GenInteractionClass;
@message void MSG_VMI_SET_ALTERNATE_VSC_PARENT (optr altParent = cx:bp);
/*
 * Set the parent to use for a ViewerSendControl if the menu
 * interaction does not want it.
 */

@instance optr VMII_altParent = ConstructOptr(0,0);

@endc;

/* ---------------------------------------------------------------------------
 *   ViewerPrintControlClass
 * --------------------------------------------------------------------------*/
@class  ViewerPrintControlClass, PrintControlClass;

/*
 * Flags for the viewer print control.
 */
typedef ByteFlags   ViewerPrintControlFlags   ;
#define	VPCF_ALWAYS_TILE	    0x01    	/* Set when the doc should be tiled. */
#define	VPCF_ALWAYS_SCALE	   0x02    	/* Set when the doc should be scaled */

@message Boolean MSG_VPC_CHECK_FOR_FAX_FORWARDING (PrinterMode pm = cl) = ax;
     /*
     * Synopsis:	This method checks to see if the destination of a print
     *		job is a fax print driver or not.  It is recommended
     *		that this be called from the MSG_PRINT_START_PRINTING
     *		handler.
     *
     *		Also, pass the print mode of the fax being printed in
     *		cx.  If the destination is a fax print driver, the
     *		JobParameters' JP_printMode will be changed to whatever
     *		you pass.
     *
     * Pass:	cl	- the print mode (resolution) of the current
     *  	    	    	  fax.
     *
     * Return:	ax	- TRUE if the destination is a fax print driver
     *			- FALSE if the destination is not a fax print
     *			  driver, or if there is no way to tell.
     */

@message void MSG_VPC_ALWAYS_TILE ();
     /*
     * Synopsis:	Call this to have the print control always tile the
     *  	    	document.  Call at the beginning of the handler for
     *  	    	MSG_PRINT_START_PRINTING.
     *
     * Pass:    	nothing
     *
     * Return:  	nothing
     *
     */

@message void MSG_VPC_ALWAYS_SCALE ();
     /*
     * Synopsis:	Call this to have the print control always scale the
     *  	    	document.  Call at the beginning of the handler for
     *  	    	MSG_PRINT_START_PRINTING.
     *
     * Pass:    	nothing
     *
     * Return:  	nothing
     *
     */

@protominor LPrintControlFaxCheck
@message Boolean MSG_VPC_CHECK_FOR_FAXING () = ax;
     /*
     * Synopsis:	This method checks to see if the destination of a print
     *		job is a fax print driver or not.  It is recommended
     *		that this be called from the MSG_PRINT_START_PRINTING
     *		handler.
     *
     * Pass:	nothing
     *
     * Return:	ax	- TRUE if the destination is a fax print driver
     *			- FALSE if the destination is not a fax print
     *			  driver, or if there is no way to tell.
     */
@protoreset
     /* --------------------------------------------------------------------
     * 	Instance Data for ViewerPrintControlClass
     * ------------------------------------------------------------------*/
@instance ViewerPrintControlFlags VPCI_flags = 0;

@endc;

/* ---------------------------------------------------------------------------
 *   ViewerLoadingMeterClass
 * --------------------------------------------------------------------------*/
@class  ViewerLoadingMeterClass, GenControlClass;
@message void	MSG_VIEWER_LOADING_METER_SET_VALUE	(dword value = dx:cx);
        /*
     *  Synopsis:	This message sets the current value of the
     *  		loading meter to display.
     *
     *  Pass:	dxcx	- value to set
     *
     *  Return:	nothing
     */

@message void	MSG_VIEWER_LOADING_METER_SET_MAXIMUM	(dword max = dx:cx);
    /*
     *  Synopsis:	Sets the maximum value of the meter.
     *
     *  Pass:	dxcx	- maximum value
     *
     *  Return:	nothing
     */

@message void	MSG_VIEWER_LOADING_METER_SET_FOCUS_OBJECT	(optr obj = cx:dx);
    /*
     *  Synopsis:	Sets object to receive focus when we next gain
     *  		the focus. Usually set before we are put up.
     *
     *  Pass:	^lcx:dx	- object
     *
     *  Return:	nothing
     */

typedef WordFlags ViewerLoadingMeterFeatures ;
#define VLM_UI 	(0x0001)

#define VLM_DEFAULT_FEATURES  VLM_UI

/* -----------------------------------------------------------
 *  Instance data
 * -----------------------------------------------------------*/
@instance optr	VLMI_focusObject;	/* the object to forward
                     *  keystrokes received, or to
                     *  give focus to.
                     */
@default GI_states = GS_ENABLED;
@default GII_visibility = GIV_DIALOG;
@default GII_type = GIT_MULTIPLE_RESPONSE;
@default GII_attrs = (GIA_NOT_USER_INITIATABLE | GIA_MODAL);

@endc;	/* ViewerLoadingMeterClass */

/* ---------------------------------------------------------------------------
 *   Exported functions
 * --------------------------------------------------------------------------*/
extern ViewerInterfaceError _far _pascal \
       ViewerGetLibrary       (DocumentInfo *docInfo, FileLongName *fname);

extern Boolean _far _pascal \
       ViewerGetLibraryNameFromToken       (TokenChars *token, FileLongName *libName);

extern Boolean _far _pascal \
       ViewerAddLibrary       (FileLongName *libName, GeodeToken *token);

extern Boolean _far _pascal \
       ViewerUnloadLibrary       (hptr libHandle);

extern ViewerInterfaceError _far _pascal \
       ViewerGetFileToken       (DocumentInfo *docInfo, GeodeToken *token);

extern hptr _far _pascal \
       ViewerLibraryOpen       (ViewerParams viewerParams, optr *uiOptr);

extern hptr _far _pascal \
       ViewerLibraryDetach       (hptr libHandle, optr uiOptr);

extern ViewerCloseStatus _far _pascal \
       ViewerLibraryChangeDocument       (hptr libHandle, \
                   ViewerChangeDocumentStruct *vcds);

extern _far _pascal \
       ViewerLibraryClose       (hptr libHandle, optr uiOptr);

extern _far _pascal \
       ViewerMarkFileRead       (FileHandle fileH);

extern _far _pascal \
       ViewerMarkFileUnread       (FileHandle fileH);

extern void _far _pascal \
    ViewerAddSendControl	(optr newOutput, word newParentOffset);

extern void _far _pascal \
    ViewerRemoveSendControl	(optr output, ViewerCloseStatus vcs);

extern void _far _pascal \
    ViewerSendDocumentNotification	(MemHandle memH);

extern void _far _pascal \
    ViewerSetSendControlOptions	(optr optionsTree);
/*
 * This function should be passed an optr of a ui tree.  This will be the
 * ui that is brought up when the "Options" trigger of the printer selection
 * dialog is pressed.  This function MUST be called again to clear out the
 * old value before the viewer library detaches the ViewerSendControls (before
 * the call to ViewerRemoveSendControl.)  Pass null to clear the old optr.
 */

#ifdef __HIGHC__
pragma Alias(ViewerGetLibrary, "VIEWERGETLIBRARY");
pragma Alias(ViewerGetLibraryNameFromToken, "VIEWERGETLIBRARYNAMEFROMTOKEN");
pragma Alias(ViewerAddLibrary, "VIEWERADDLIBRARY");
pragma Alias(ViewerUnloadLibrary, "VIEWERUNLOADLIBRARY");
pragma Alias(ViewerGetFileToken, "VIEWERGETFILETOKEN");
pragma Alias(ViewerLibraryOpen, "VIEWERLIBRARYOPEN");
pragma Alias(ViewerLibraryDetach, "VIEWERLIBRARYDETACH");
pragma Alias(ViewerLibraryChangeDocument, "VIEWERLIBRARHCHANGEDOCUMENT");
pragma Alias(ViewerLibraryClose, "VIEWERLIBRARYCLOSE");
pragma Alias(ViewerMarkFileRead, "VIEWERMARKFILEREAD");
pragma Alias(ViewerMarkFileUnread, "VIEWERMARKFILEUNREAD");
pragma Alias(ViewerAddSendControl, "VIEWERADDSENDCONTROL");
pragma Alias(ViewerRemoveSendControl, "VIEWERREMOVESENDCONTROL");
pragma Alias(ViewerSendDocumentNotification, "VIEWERSENDDOCUMENTNOTIFICATION");
pragma Alias(ViewerSetSendControlOptions, "VIEWERSETSENDCONTROLOPTIONS");
#endif

@endlib


Objects\visC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	visC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	UI
 *
 * DESCRIPTION:
 *	This file defines VisClass
 *
 *	$Id: visC.goh,v 1.93.1.1 96/04/28 08:31:36 chris Exp $
 *
 ***********************************************************************/

@optimize

@deflib ui

#include  <graphics.h>
#include  <win.h>
@include  <object.goh>

extern void _pascal
        VisObjectHandlesInkReply    	();

@class	VisClass, MetaClass, master;

@define visParent @parent word_offsetof (VisBase, Vis_offset), word_offsetof), (VisInstance, VI_link)

@define visChildren @children word_offsetof(VisBase, Vis_offset), word_offsetof(VisCompInstance, VCI_comp), word_offsetof(VisInstance, VI_link)

#define ObjDerefVis (obj) ObjDeref1(obj)

@exportMessages	VisSpecMessages, @DEFAULT_EXPORTED_MESSAGES;
@exportMessages	VisAppMessages, @DEFAULT_EXPORTED_MESSAGES;

typedef ByteFlags DrawFlags ;
#define DF_EXPOSED 		0x80
#define DF_OBJECT_SPECIFIC 	0x40
#define DF_PRINT 		0x20
#define DF_DONT_DRAW_CHILDREN 	0x10
#define DF_DISPLAY_TYPE 		0x0f

/* Drawing */

@message void MSG_VIS_DRAW (DrawFlags drawFlags = cl,
               GStateHandle gstate = bp);

@message void MSG_VIS_REDRAW_ENTIRE_OBJECT ();

@message GStateHandle MSG_VIS_VUP_CREATE_GSTATE () = bp;

/* MSG_VIS_VUP_QUERY */

@message void MSG_VIS_VUP_QUERY ();	/*XXX*/

typedef ByteFlags ColorScheme ;
#define CS_lightColor 		0xf0
#define CS_darkColor 		0x0f
#define CS_lightColor_OFFSET 	4

typedef struct {
    byte DS_colorScheme;
    byte DS_displayType;
    word DS_unused;
    FontID DS_fontID;
    sword DS_pointSize;
} DisplayScheme} ;

@message optr MSG_VIS_VUP_FIND_OBJECT_OF_CLASS (ClassStruct *class = cx:dx) = cx:dx;

typedef enum {
    TO_VIS_PARENT    =_FIRST_VisClass
} VisTravelOption} ;

/*
 * VisUpdateMode - Used for specifying when a visual update should happen:
 */
typedef ByteEnum VisUpdateMode ;
#define VUM_MANUAL  0
#define VUM_NOW  1
#define VUM_DELAYED_VIA_UI_QUEUE  2
#define VUM_DELAYED_VIA_APP_QUEUE  3

typedef ByteFlags VisAttrs ;
#define VA_VISIBLE 			0x80
#define VA_FULLY_ENABLED 		0x40
#define VA_MANAGED 			0x20
#define VA_DRAWABLE 			0x10
#define VA_DETECTABLE 			0x08
#define VA_BRANCH_NOT_MINIMIZABLE 	0x04
#define VA_OLD_BOUNDS_SAVED 		0x02
#define VA_REALIZED 			0x01

typedef ByteFlags VisOptFlags ;
#define VOF_GEOMETRY_INVALID 	0x80
#define VOF_GEO_UPDATE_PATH 	0x40
#define VOF_IMAGE_INVALID 	0x20
#define VOF_IMAGE_UPDATE_PATH 	0x10
#define VOF_WINDOW_INVALID 	0x08
#define VOF_WINDOW_UPDATE_PATH 	0x04
#define VOF_UPDATE_PENDING 	0x02
#define VOF_EC_UPDATING 		0x01

typedef ByteFlags VisGeoAttrs ;
#define VGA_GEOMETRY_CALCULATED 			0x80
#define VGA_NO_SIZE_HINTS 			0x40
#define VGA_NOTIFY_GEOMETRY_VALID 		0x20
#define VGA_DONT_CENTER 				0x10
#define VGA_USE_VIS_SET_POSITION 		0x08
#define VGA_USE_VIS_CENTER 			0x04
#define VGA_ONLY_RECALC_SIZE_WHEN_INVALID 	0x02
#define VGA_ALWAYS_RECALC_SIZE 			0x01

typedef ByteFlags VisTypeFlags ;
#define VTF_IS_COMPOSITE 	0x80
#define VTF_IS_WINDOW 		0x40
#define VTF_IS_PORTAL 		0x20
#define VTF_IS_WIN_GROUP 	0x10
#define VTF_IS_CONTENT 		0x08
#define VTF_IS_INPUT_NODE 	0x04
#define VTF_IS_GEN 		0x02
#define VTF_CHILDREN_OUTSIDE_PORTAL_WIN 	0x01

typedef ByteFlags SpecAttrs ;
#define SA_ATTACHED 			0x80
#define SA_REALIZABLE 			0x40
#define SA_BRANCH_MINIMIZED 		0x20
#define SA_USES_DUAL_BUILD 		0x10
#define SA_CUSTOM_VIS_PARENT 		0x08
#define SA_SIMPLE_GEN_OBJ 		0x04
#define SA_CUSTOM_VIS_PARENT_FOR_CHILD 	0x02
#define SA_TREE_BUILT_BUT_NOT_REALIZED 	0x01

@message void MSG_VIS_VUP_CALL_OBJECT_OF_CLASS (EventHandle event = cx);

@message void MSG_VIS_VUP_SEND_TO_OBJECT_OF_CLASS (EventHandle event = cx);

@message Boolean MSG_VIS_VUP_TEST_FOR_OBJECT_OF_CLASS (
                                ClassStruct *class = cx:dx) = carry;

@message void MSG_VIS_VUP_CALL_WIN_GROUP (EventHandle event = cx);

@message void MSG_VIS_VUP_SEND_TO_WIN_GROUP (EventHandle event = cx);

/* Get/Set attributes */

@message void MSG_VIS_SET_ATTRS (VisAttrs attrsToSet = cl,
                VisAttrs attrsToClear = ch,
                VisUpdateMode updateMode = dl);

@message void MSG_VIS_SET_GEO_ATTRS (VisGeoAttrs attrsToSet = cl,
                    VisGeoAttrs attrsToClear = ch,
                    VisUpdateMode updateMode = dl);

@message VisGeoAttrs MSG_VIS_GET_GEO_ATTRS () = cl;

@message VisOptFlags MSG_VIS_GET_OPT_FLAGS () = cl;

@message void MSG_VIS_SET_TYPE_FLAGS (VisTypeFlags flagsToSet = cl,
                     VisTypeFlags flagsToClear = ch);

@message VisTypeFlags MSG_VIS_GET_TYPE_FLAGS () = cl;

@message VisAttrs MSG_VIS_GET_ATTRS () = cl;

/* Geometry messages */

/* Use DWORD_X and DWORD_Y to get x, y positions */
@message XYValueAsDWord MSG_VIS_GET_POSITION () = dx.cx;

@message void MSG_VIS_SET_POSITION (int xOrigin = cx, int yOrigin = dx);

@message void MSG_VIS_GET_BOUNDS (Rectangle *retValue = axbpcxdx);

/* Use DWORD_WIDTH and DWORD_HEIGHT to get width, height from return value */
@message SizeAsDWord MSG_VIS_GET_SIZE () = dx.cx;

@message void MSG_VIS_SET_SIZE (int width = cx, int height = dx);

typedef struct {
    word	GCP_aboveCenter;
    word	GCP_belowCenter;
    word	GCP_leftOfCenter;
    word	GCP_rightOfCenter;
} GetCenterParams} ;

@message void MSG_VIS_GET_CENTER (GetCenterParams *retValue = axbpcxdx);	/*XXX*/

/*
 * Use DWORD_WIDTH and DWORD_HEIGHT to get width, height from return value.
 */
@message SizeAsDWord MSG_VIS_RECALC_SIZE (
                                RecalcSizeArgs width = cx,
                RecalcSizeArgs height = dx) = dx.cx;

@message void MSG_VIS_POSITION_BRANCH (int xOrigin = cx, int yOrigin = dx);	/*XXX*/

@message void MSG_VIS_NOTIFY_GEOMETRY_VALID ();

@message void MSG_VIS_BOUNDS_CHANGED(@stack word bottom, word right,
                     word top, word left);   /*XXX*/

@message void MSG_VIS_RESET_TO_INITIAL_SIZE (VisUpdateMode updateMode = dl);	/*XXX*/

/*
 * Use DWORD_WIDTH and DWORD_HEIGHT to get width, height from return value.
 */
@message SizeAsDWord MSG_VIS_RECALC_SIZE_AND_INVAL_IF_NEEDED (
                                RecalcSizeArgs width = cx,
                RecalcSizeArgs height = dx) = dx.cx;  /*XXX*/

@message Boolean MSG_VIS_POSITION_AND_INVAL_IF_NEEDED (word xPosition = cx,
                word yPosition = dx) = carry;  /*XXX*/

/* Update mechanism */

@message void MSG_VIS_MARK_INVALID (VisOptFlags flagsToSet = cl,
                   VisUpdateMode updateMode = dl);

@message Boolean MSG_VIS_VUP_UPDATE_WIN_GROUP (
                                VisUpdateMode updateMode = dl) = carry;

@message void MSG_VIS_UPDATE_WIN_GROUP (VisUpdateMode updateMode = dl);

@message void MSG_VIS_UPDATE_GEOMETRY ();

typedef ByteFlags VisUpdateImageFlags ;
#define	VUIF_ALREADY_INVALIDATED	  0x80
#define VUIF_SEND_TO_ALL_CHILDREN  0x40
#define VUIF_JUST_OPENED           0x20    /* INTERNAL */
/*
 * For backwards compatibility:
 */
#define VUIF_ALREADY_INVALID  VUIF_ALREADY_INVALIDATED
#define VUIF_ALWAYS_INVALIDATE  VUIF_SEND_TO_ALL_CHILDREN

@message void MSG_VIS_UPDATE_WINDOWS_AND_IMAGE(VisUpdateImageFlags 	\
                          updateImageFlags = cl); /*XXX*/

@message void MSG_VIS_INVALIDATE ();

@message void MSG_VIS_ADD_RECT_TO_UPDATE_REGION(@stack byte unused,
            VisAddRectFlags addRectFlags, word bottom, word right,
             word top, word left);   /*XXX*/

typedef ByteFlags VisAddRectFlags ;
#define VARF_NOT_IF_ALREADY_INVALID 	0x80
#define VARF_ONLY_REDRAW_MARGINS 	0x40

@message void MSG_VIS_INVAL_TREE ();

/* Open/Close messages */

@message void MSG_VIS_OPEN (WindowHandle window = bp);	/*XXX*/
@message void MSG_VIS_CLOSE ();
@message void MSG_VIS_DESTROY (VisUpdateMode updateMode = dl);	/*XXX*/
@message void MSG_VIS_REMOVE (VisUpdateMode updateMode = dl);	/*XXX*/

@message WindowHandle MSG_VIS_QUERY_WINDOW () = cx;  /*XXX*/
@message void MSG_VIS_OPEN_WIN (WindowHandle parentWindow = bp);
@message void MSG_VIS_CLOSE_WIN ();
@message void MSG_VIS_WIN_ABOUT_TO_BE_CLOSED ();
@message void MSG_VIS_MOVE_RESIZE_WIN ();

/* Vis tree manipulation */

@message void MSG_VIS_ADD_CHILD (optr child = cx:dx, CompChildFlags flags = bp);

@message void MSG_VIS_REMOVE_CHILD (optr child = cx:dx,
                   CompChildFlags flags = bp);

@message void MSG_VIS_MOVE_CHILD (optr child = cx:dx,
                 CompChildFlags flags = bp) ;  /*XXX*/
@message word MSG_VIS_FIND_CHILD (optr object = cx:dx) = bp;
@message optr MSG_VIS_FIND_CHILD_AT_POSITION (word position = cx) = cx:dx;
@message word MSG_VIS_COUNT_CHILDREN () = dx;	/*XXX*/
@message optr MSG_VIS_FIND_PARENT () = cx:dx;

@message void MSG_VIS_CALL_PARENT (EventHandle event = cx);
@message void MSG_VIS_SEND_TO_PARENT (EventHandle event = cx);
@message void MSG_VIS_SEND_TO_CHILDREN (EventHandle event = cx);   /*XXX*/

/* Grab messages */

@message void MSG_VIS_GRAB_MOUSE ();
@message void MSG_VIS_FORCE_GRAB_MOUSE ();
@message void MSG_VIS_GRAB_LARGE_MOUSE ();
@message void MSG_VIS_FORCE_GRAB_LARGE_MOUSE ();
@message void MSG_VIS_RELEASE_MOUSE ();

@message void MSG_VIS_ADD_BUTTON_PRE_PASSIVE ();
@message void MSG_VIS_REMOVE_BUTTON_PRE_PASSIVE ();
@message void MSG_VIS_ADD_BUTTON_POST_PASSIVE ();
@message void MSG_VIS_REMOVE_BUTTON_POST_PASSIVE ();

/* Focus/target messages */

@message void MSG_VIS_TAKE_GADGET_EXCL (optr child = cx:dx);
@message void MSG_VIS_RELEASE_GADGET_EXCL (optr child = cx:dx);
@message void MSG_VIS_LOST_GADGET_EXCL ();
@reserveMessages 2;

typedef struct	{
    HierarchicalGrabFlags	OAGP_grabFlags;
    word			OAGP_unused;
    optr			OAGP_object;
} ObjectAndGrabParams} ;

@message void MSG_VIS_VUP_QUERY_FOCUS_EXCL (
                        ObjectAndGrabParams *retValue = bpaxdxcx); /*XXX*/

@message void MSG_VIS_FUP_QUERY_FOCUS_EXCL (
                        ObjectAndGrabParams *retValue = bpaxdxcx); /*XXX*/

typedef ByteFlags VisInputFlowGrabFlags ;
#define		VIFGF_NOT_HERE			0x80
#define		VIFGF_FORCE			0x20
#define		VIFGF_GRAB			0x10
#define		VIFGF_KBD			0x08
#define 	VIFGF_MOUSE 		0x04
#define		VIFGF_LARGE			0x02
#define		VIFGF_PTR			0x01

typedef ByteEnum VisInputFlowGrabType ;
#define VIFGT_ACTIVE  0
#define VIFGT_PRE_PASSIVE  1
#define VIGFT_POST_PASSIVE  2

@message void MSG_VIS_VUP_ALTER_INPUT_FLOW(
                        @stack PointDWord translation,
            WindowHandle window,
            optr object,
            VisInputFlowGrabType grabType,
            VisInputFlowGrabFlags grabFlags);

@message void MSG_VIS_VUP_SET_MOUSE_INTERACTION_BOUNDS(
                        @stack int bottom, int right, int top, int left);

@message word MSG_VIS_VUP_GET_MOUSE_STATUS () = bp;	/*XXX*/

@message void MSG_VIS_VUP_TERMINATE_ACTIVE_MOUSE_FUNCTION ();

@message void MSG_VIS_VUP_BUMP_MOUSE (word xBump = cx, word yBump = dx);

/* Miscellaneous */

@message void MSG_VIS_VUP_ALLOW_GLOBAL_TRANSFER ();

@message void MSG_VIS_CALL_ROUTINE (); /* Do not use */

/* MF_monikerFlags */

typedef ByteFlags DrawMonikerFlags ;
#define DMF_TEXT_ONLY 			0x80
#define	DMF_UNDERLINE_ACCELERATOR		0x40
#define DMF_CLIP_TO_MAX_WIDTH 		0x20
#define DMF_NONE 			0x10
#define	DMF_Y_JUST_MASK				0x0c	/* Justification */
#define DMF_X_JUST_MASK 			0x03    /* Justification */

#define DMF_Y_JUST_OFFSET 		2
#define DMF_X_JUST_OFFSET 		0

typedef WordFlags VisMonikerSearchFlags ;
#define VMSF_STYLE 		0xf000
#define VMSF_COPY_CHUNK 		0x0400
#define VMSF_REPLACE_LIST 	0x0200
#define VMSF_GSTRING 		0x0100

#define VMSF_STYLE_OFFSET 	12

@message void MSG_VIS_DRAW_MONIKER(@stack
                   DrawMonikerFlags monikerFlags,
                   ChunkHandle visMoniker,
                   word textHeight, GStateHandle gstate,
                   word yMaximum, word xMaximum, word yInset,
                   word xInset);

/* Use DWORD_X and DWORD_Y to get x, y position */
@message XYValueAsDWord MSG_VIS_GET_MONIKER_POS(@stack
                   DrawMonikerFlags monikerFlags,
                   ChunkHandle visMoniker,
                   word textHeight, GStateHandle gstate,
                   word yMaximum, word xMaximum, word yInset,
                   word xInset) = dx.cx;

/* Use DWORD_WIDTH and DWORD_HEIGHT to get width, height from return value */
@message SizeAsDWord MSG_VIS_GET_MONIKER_SIZE(@stack
                   DrawMonikerFlags monikerFlags,
                   ChunkHandle visMoniker,
                   word textHeight, GStateHandle gstate,
                   word yMaximum, word xMaximum, word yInset,
                   word xInset) = dx.cx;

@message optr MSG_VIS_FIND_MONIKER(@stack
                    VisMonikerSearchFlags searchFlags,
                    MemHandle destBlock,
                    ChunkHandle monikerList,
                    DisplayType displayType) = cx:dx;  /*XXX*/

@message ChunkHandle MSG_VIS_CREATE_VIS_MONIKER(@stack
                CreateVisMonikerFlags flags,
                word height, word width, word length,
                VisMonikerDataType dataType,
                VisMonikerSourceType sourceType,
                dword source) = ax;

/* Error checking */

@message void MSG_VIS_VUP_EC_ENSURE_WINDOW_NOT_REFERENCED (WindowHandle window = cx);

@message void MSG_VIS_VUP_EC_ENSURE_OBJ_BLOCK_NOT_REFERENCED (MemHandle objBlock = cx);

@message void MSG_VIS_VUP_EC_ENSURE_OD_NOT_REFERENCED (optr object = cx:dx);

/* Messages, Structures used for specific UI implementation */

/*
 * Specific Size specification structures
 */

typedef WordFlags SpecSizeSpec ;
#define SSS_TYPE 	0x8c00
#define	SSS_DATA		0x03ff

typedef WordFlags SpecWidth ;
#define SW_TYPE 		0x8c00
#define	SW_DATA			0x03ff

typedef WordFlags SpecHeight ;
#define SH_TYPE 		0x8c00
#define	SH_DATA			0x03ff

#define SSS_TYPE_OFFSET 	10
#define SSS_DATA_OFFSET 	0

typedef ByteEnum SpecSizeType ;
#define SST_PIXELS 				  0x0000
#define SST_COUNT 				  0x0400
#define SST_PCT_OF_FIELD_WIDTH 	  0x0800
#define SST_PCT_OF_FIELD_HEIGHT 	  0x0c00
#define SST_AVG_CHAR_WIDTHS 	  0x1000
#define SST_WIDE_CHAR_WIDTHS 	  0x1400
#define SST_LINES_OF_TEXT 		  0x1800

#define PCT_0 	0x000
#define PCT_5 	0x033
#define PCT_10 	0x066
#define PCT_15 	0x099
#define PCT_20 	0x0cc
#define PCT_25 	0x100
#define PCT_30 	0x133
#define PCT_35 	0x166
#define PCT_40 	0x199
#define PCT_45 	0x1cc
#define PCT_50 	0x200
#define PCT_55 	0x233
#define PCT_60 	0x266
#define PCT_65 	0x299
#define PCT_70 	0x2cc
#define PCT_75 	0x300
#define PCT_80 	0x333
#define PCT_85 	0x366
#define PCT_90 	0x399
#define PCT_95 	0x3cc
#define PCT_100 	0x3ff

typedef WordFlags SpecWinSizeSpec ;
#define SWSS_RATIO 	0x8000
#define SWSS_SIGN 	0x4000
#define SWSS_MANTISSA 	0x3c00
#define SWSS_FRACTION 	0x03ff

typedef WordFlags RecalcSizeArgs ;
#define RSA_CHOOSE_OWN_SIZE  	0x8000
#define RSA_SUGGESTED_SIZE 	0x7fff

typedef struct {
    SpecWinSizeSpec	SWSP_x;
    SpecWinSizeSpec	SWSP_y;
} SpecWinSizePair} ;

typedef ByteEnum WinPositionType ;
#define WPT_AT_RATIO  0
#define WPT_STAGGER  1
#define WPT_CENTER  2
#define WPT_TILED  3
#define WPT_AT_MOUSE_POSITION  4
#define WPT_AS_REQUIRED  5
#define WPT_AT_SPECIFIC_POSITION  6

typedef ByteEnum WinSizeType ;
#define WST_AS_RATIO_OF_PARENT  0
#define WST_AS_RATIO_OF_FIELD  1
#define WST_AS_DESIRED  2
#define WST_EXTEND_TO_BOTTOM_RIGHT  3
#define WST_EXTEND_NEAR_BOTTOM_RIGHT  4

typedef ByteEnum WinConstrainType ;
#define WCT_NONE  0
#define WCT_KEEP_PARTIALLY_VISIBLE  1
#define WCT_KEEP_VISIBLE  2
#define WCT_KEEP_VISIBLE_WITH_MARGIN  3

typedef WordFlags WinPosSizeFlags ;
#define WPSF_PERSIST 		0x8000
#define WPSF_HINT_FOR_ICON 	0x4000
#define WPSF_NEVER_SAVE_STATE 	0x2000
#define WPSF_SHRINK_DESIRED_SIZE_TO_FIT_IN_PARENT 	0x1000
#define WPSF_CONSTRAIN_TYPE 	0x00c0
#define WPSF_POSITION_TYPE 	0x0038
#define WPSF_SIZE_TYPE 		0x0007

/*
 * Size values are often returned from functions.  To allow their easy return,
 * the type SizeAsDWord is returned.  The DWORD_WIDTH() and DWORD_HEIGHT()
 * macros can be used to access the x and y components.
 */
typedef dword SizeAsDWord ;

#define DWORD_WIDTH (val)	((word) (val))
#define DWORD_HEIGHT (val) 	((word) ((val) >> 16))

#define MAKE_SIZE_DWORD (width,height) ((((dword) (height)) << 16) | (word)(width))

/*
 *	VisMonikers
 */

typedef ByteEnum VMStyle ;
#define VMS_TEXT  0
#define VMS_ABBREV_TEXT  1
#define VMS_GRAPHIC_TEXT  2
#define VMS_ICON  3
#define VMS_TOOL  4

typedef WordFlags VisMonikerListEntryType ;
#define VMLET_GS_SIZE  		0x3000	/* DisplaySize */
#define VMLET_STYLE 		0x0f00  /* VMStyle */
#define VMLET_MONIKER_LIST 	0x0080
#define VMLET_GSTRING 		0x0040
#define VMLET_GS_ASPECT_RATIO 	0x0030	/* DisplayAspectRatio */
#define VMLET_GS_COLOR 		0x000f	/* DisplayClass */

#define VMLET_GS_SIZE_OFFSET  12
#define VMLET_STYLE_OFFSET  8
#define VMLET_GS_ASPECT_RATIO_OFFSET  4
#define VMLET_GS_COLOR_OFFSET  0

typedef ByteFlags VisMonikerType ;
#define VMT_MONIKER_LIST 	0x80
#define VMT_GSTRING 		0x40
#define VMT_GS_ASPECT_RATIO 	0x30	/* VMAspectRatio */
#define VMT_GS_COLOR 		0x0f	/* DisplayClass */

#define VMT_GS_ASPECT_RATIO_OFFSET  4
#define VMT_GS_COLOR_OFFSET  0

typedef struct {
     word		VMLE_type;
     optr		VMLE_moniker;
} VisMonikerListEntry} ;

typedef WordFlags VisMonikerCachedWidth ;
#define VMCW_HINTED 		0x8000
#define VMCW_BERKELEY_9 		0x7f00
#define VMCW_BERKELEY_10 	0x00ff

#define VMCW_BERKELEY_9_OFFSET 	8
#define VMCW_BERKELEY_10_OFFSET 	0

typedef struct {
    byte		VM_type;
    word		VM_width;
} VisMoniker} ;

typedef struct {
    VisMoniker		VMWGS_common;
    word		VMWGS_height;
} VisMonikerWithGString} ;

#define VMWGS_gString 	(sizeof(VisMonikerWithGString))   /* Start of gstring */

typedef struct {
    VisMoniker		VMWT_common;
    char		VMWT_mnemonicOffset;
} VisMonikerWithText} ;

#define VMWT_text 	(sizeof(VisMonikerWithText))  /* Start of text */

@define VMO_CANCEL			0xfd
@define VMO_MNEMONIC_NOT_IN_MKR_TEXT	0xfe
@define VMO_NO_MNEMONIC			0xff

typedef ByteFlags CreateVisMonikerFlags ;
#define CVMF_DIRTY 		0x80

typedef ByteEnum VisMonikerSourceType ;
#define VMST_FPTR  0
#define VMST_OPTR  1
#define VMST_HPTR  2

typedef ByteEnum VisMonikerDataType ;
#define VMDT_NULL  0
#define VMDT_VIS_MONIKER  1
#define VMDT_TEXT  2
#define VMDT_GSTRING  3
#define VMDT_TOKEN  4

/* Spec build/unbuild messages */

typedef WordFlags SpecBuildFlags ;
#define SBF_IN_UPDATE_WIN_GROUP 			0x8000
#define SBF_WIN_GROUP 				0x4000
#define SBF_TREE_BUILD 				0x2000
#define SBF_VIS_PARENT_WITHIN_SCOPE_OF_TREE_BUILD  0x1000
#define SBF_SKIP_CHILD 				0x0800
#define SBF_FIND_LAST 				0x0400
#define SBF_VIS_PARENT_UNBUILDING 		0x0200
#define SBF_VIS_PARENT_FULLY_ENABLED 		0x0100
#define SBF_UPDATE_MODE 				0x0003

@message void MSG_SPEC_BUILD (SpecBuildFlags flags = bp);	/*XXX*/
@message void MSG_SPEC_BUILD_BRANCH (SpecBuildFlags flags = bp);	/*XXX*/
@message void MSG_SPEC_UNBUILD_BRANCH (SpecBuildFlags flags = bp);	/*XXX*/
@message void MSG_SPEC_UNBUILD (SpecBuildFlags flags = bp);	/*XXX*/
@message optr MSG_SPEC_GET_VIS_PARENT (SpecBuildFlags flags = bp) = cx:dx;	/*XXX*/

@message optr MSG_SPEC_DETERMINE_VIS_PARENT_FOR_CHILD (optr child = cx:dx) = cx:dx;	/*XXX*/

@message optr MSG_SPEC_GUP_QUERY_VIS_PARENT (word parentType = cx) = cx:dx;	/*XXX*/
@message optr MSG_SPEC_GET_SPECIFIC_VIS_OBJECT (word flags = bp) = cx:dx;	/*XXX*/

@message void MSG_SPEC_ADD_CHILD_RELATIVE_TO_GEN(@stack word buildFlags,
                         optr parent,
                         optr child);  /*XXX*/

@message void MSG_SPEC_RESOLVE_MONIKER_LIST (ChunkHandle monikerList = cx);
@message void MSG_SPEC_RESOLVE_TOKEN_MONIKER (ChunkHandle monikerChunk = cx);

/* Get/Set attributes */

@message void MSG_SPEC_SET_ATTRS (SpecAttrs attrsToSet = cl,
                 SpecAttrs attrsToClear = ch,
                  VisUpdateMode updateMode = dl);	/*XXX*/

@message SpecAttrs MSG_SPEC_GET_ATTRS () = cl;

/* Set usable, enabled, vis moniker */

@message void MSG_SPEC_SET_USABLE (byte updateMode = dl);

@message void MSG_SPEC_SET_NOT_USABLE (byte updateMode = dl);

@message Boolean MSG_SPEC_NOTIFY_ENABLED (byte updateMode = dl,
                     byte flags = dh) = carry;

@message Boolean MSG_SPEC_NOTIFY_NOT_ENABLED (byte updateMode = dl,
                         byte flags = dh) = carry;

@message void MSG_SPEC_UPDATE_VIS_MONIKER (byte updateMode = dl,
                       word oldMonikerWidth = cx,
                       word oldMonikerHeight = bp);

@message void MSG_SPEC_UPDATE_VISUAL (byte updateMode = dl);

/* Specific UI geometry related messages */

typedef struct {
    word		ESP_extraWidth;
    word		ESP_extraHeight;
    word		ESP_leftoverChildren;
    word		ESP_unused;
} ExtraSizeParams} ;

@message void MSG_SPEC_GET_EXTRA_SIZE (ExtraSizeParams *retValue = cxdxbpax,
                      word childCount = bp);	/*XXX*/

/* Use DWORD_WIDTH and DWORD_HEIGHT to get width, height from return value */
@message SizeAsDWord MSG_SPEC_CONVERT_DESIRED_SIZE_HINT (
                                        word desiredWidth = cx,
                     word desiredHeight = dx,
                     word childCount = bp) = dx.cx;	/*XXX*/

@message word MSG_SPEC_CONVERT_SIZE (word specSize = cx,
                    GStateHandle gstate = bp) = cx;  /*XXX*/

typedef struct {
    word		WSIP_windowWidth;
    word		WSIP_windowHeight;
    byte		WSIP_bottomArea;
    byte		WSIP_rightArea;
    word		WSIP_unused;
} WinSizeInfoParams} ;

@message void MSG_SPEC_VUP_GET_WIN_SIZE_INFO (WinSizeInfoParams *retValue = cxdxbpax); /*XXX*/

/* Keyboard navigation messages */

@message void MSG_SPEC_NAVIGATE_TO_NEXT_FIELD ();	/*XXX*/

@message void MSG_SPEC_NAVIGATE_TO_PREVIOUS_FIELD ();	/*XXX*/

typedef WordFlags NavigationFlags ;
#define NF_COMPLETED_CIRCUIT 		0x8000
#define NF_REACHED_ROOT 			0x4000
#define NF_NAV_MENU_BAR 			0x0020
#define NF_INITIATE_QUERY 		0x0008
#define NF_SKIP_NODE 			0x0004
#define NF_TRAVEL_CIRCUIT 		0x0002
#define NF_BACKTRACK_AFTER_TRAVELING 	0x0001
/*
 * For those used to the .def name, NavigateFlags:
 */
typedef NavigationFlags NavigateFlags ;

typedef ByteFlags NavigateCommonFlags ;
#define NCF_IS_COMPOSITE 	0x80
#define NCF_IS_FOCUSABLE 	0x40
#define NCF_IS_MENU_RELATED 	0x20
#define NCF_IS_INPUT_NODE 	0x10

typedef struct {
    optr		NCP_object;
    NavigationFlags	NCP_navFlags;
    NavigateCommonFlags	NCP_navCommonFlags;
    ChunkHandle		NCP_genPart;
    byte		NCP_backtrackFlag;
} NavigateCommonParams} ;

@message Boolean MSG_SPEC_NAVIGATE_COMMON (
                        NavigateCommonParams *navCommonParams = ss:bp) = carry;  /*XXX*/

@message Boolean MSG_SPEC_ACTIVATE_INTERACTION_DEFAULT () = carry; /*XXX*/

@message optr MSG_SPEC_NAVIGATE (word navigateFlags = bp) = cx:dx;  /*XXX*/

typedef struct {
    word	NQP_navFlags;
    byte	NQP_backtrackFlag;
    byte	NQP_unused;
    optr	NQP_nextObject;
} NavigationQueryParams} ;

@message Boolean MSG_SPEC_NAVIGATION_QUERY (
            NavigationQueryParams *retValue = bpaxdxcx,
            optr queryOrigin = cx:dx,
             NavigationFlags navFlags = bp) = carry;	/*XXX*/

@message void MSG_SPEC_NOTIFY_NAVIGATION_COMPLETE (NavigationFlags
                    navigateFlags = bp); /*XXX*/

@message Boolean MSG_SPEC_ACTIVATE_OBJECT_WITH_MNEMONIC (word character = cx,
            byte flags = dx, word state = bp) = carry;	/*XXX*/

@message Boolean MSG_SPEC_CHECK_MNEMONIC (word character = cx,
                     byte flags = dx,
                     word state = bp) = carry;   /*XXX*/

typedef ByteFlags MenuSepFlags ;
#define MSF_SEP 		0x80
#define MSF_USABLE 	0x40
#define MSF_FROM_CHILD 	0x20

@message byte MSG_SPEC_MENU_SEP_QUERY (byte flags = ch) = ch;	/*XXX*/

@message void MSG_SPEC_UPDATE_MENU_SEPARATORS ();	/*XXX*/

/* Broadcast for default focus */

@message optr MSG_SPEC_START_BROADCAST_FOR_DEFAULT_FOCUS () = cx:dx; /*XXX*/

@message void MSG_SPEC_BROADCAST_FOR_DEFAULT_FOCUS (ObjectAndGrabParams *retValue = bpaxdxcx); /*XXX*/

@message void MSG_VIS_LAYER_SET_DOC_BOUNDS(@stack long bottom, long right,
                           long top, long left);  /*XXX*/

@message void MSG_VIS_LAYER_GET_DOC_BOUNDS (RectDWord *retValue = cx:dx);  /*XXX*/

typedef struct {
    word    	VCCIBF_data1;
    word    	VCCIBF_data2;
    word    	VCCIBF_data3;
    word    	VCCIBF_data4;
    word    	VCCIBF_data5;
    Rectangle	VCCIBF_bounds;
} VisCallChildrenInBoundsFrame} ;

@message void MSG_VIS_QUERY_IF_OBJECT_HANDLES_INK (VisCallChildrenInBoundsFrame *data = ss:bp);

@message void MSG_SPEC_SCAN_GEOMETRY_HINTS ();  /*XXX*/
@message void MSG_SPEC_RESCAN_GEO_AND_UPDATE (VisUpdateMode updateMode = dl);  /*XXX*/
@message void MSG_SPEC_UPDATE_SPECIFIC_OBJECT ();
@message void MSG_VIS_RECREATE_CACHED_GSTATES ();

typedef word InsertDeleteSpaceTypes ;
#define IDST_MOVE_OBJECTS_INSIDE_DELETED_SPACE_BY_AMOUNT_DELETED     0x0010
#define IDST_MOVE_OBJECTS_INTERSECTING_DELETED_SPACE 	    	    0x0008
#define IDST_RESIZE_OBJECTS_INTERSECTING_SPACE 	    	    	    0x0004
#define IDST_DELETE_OBJECTS_SHRUNK_TO_ZERO_SIZE 	    	    	    0x0002
#define IDST_MOVE_OBJECTS_BELOW_AND_RIGHT_OF_INSERT_POINT_OR_DELETED_SPACE  \
                                                                    0x0001
@message void MSG_VIS_LAYER_INSERT_OR_DELETE_SPACE(@stack
                InsertDeleteSpaceTypes type,
                DWFixed spaceY,
                DWFixed spaceX,
                DWFixed positionY,
                DWFixed positionX);

@message void MSG_VIS_CREATE_CACHED_GSTATES ();
@message void MSG_VIS_DESTROY_CACHED_GSTATES ();
@message void MSG_SPEC_VIS_OPEN_NOTIFY ();
@message void MSG_SPEC_VIS_CLOSE_NOTIFY ();
@message dword MSG_SPEC_GET_MENU_CENTER () = cx.dx;
@message void MSG_SPEC_UPDATE_KBD_ACCELERATOR (VisUpdateMode updateMode = dl);
@message void MSG_VIS_ADD_NON_DISCARDABLE_VM_CHILD (optr child = cx:dx,
                           CompChildFlags flags = bp);

@message void MSG_VIS_REMOVE_NON_DISCARDABLE_VM_CHILD (optr child = cx:dx);
@message void MSG_VIS_REMOVE_NON_DISCARDABLE (VisUpdateMode updateMode = dl);

@message void MSG_VIS_INVAL_ALL_GEOMETRY (VisUpdateMode updateMode = dl);
@message void MSG_SPEC_GUP_QUERY ();	/* Internal spui message */
@message void MSG_SPEC_RESET_SIZE_TO_STAY_ONSCREEN (VisUpdateMode updateMode = dl);

@protominor LegosLooksSupport
@message void MSG_SPEC_SET_LEGOS_LOOK (char legosLook = cl);
@message char MSG_SPEC_GET_LEGOS_LOOK () = cl;
@protoreset

typedef WordFlags GenBranchInfo ;
#define GBI_USABLE 		0x8000
#define GBI_BRANCH_MINIMIZED 	0x4000

/* Variable data */

typedef struct {
    word VGD_lineWidth;
    word VGD_centerOffset;
    word VGD_secondWidth;
} VarGeoData} ;

    @vardata Rectangle TEMP_VIS_OLD_BOUNDS;
    @vardata VarGeoData ATTR_VIS_GEOMETRY_DATA;
    @vardata word TEMP_VIS_INVAL_REGION;

@protoreset
@protominor	UINewForResponder
    @vardata PointDWord ATTR_SPEC_POSITION;	/* Responder-only, currently. */
    @vardata sword ATTR_SPEC_POSITION_X;
    @vardata sword ATTR_SPEC_POSITION_Y;
@protoreset

/*	Instance Variables */

    @instance Rectangle	VI_bounds = {0, 0, 0, 0};
    @instance VisTypeFlags VI_typeFlags = 0;
    @instance VisAttrs VI_attrs =
        (VA_MANAGED|VA_DRAWABLE|VA_DETECTABLE|VA_FULLY_ENABLED);
    @instance VisOptFlags VI_optFlags =
            (VOF_GEOMETRY_INVALID|VOF_GEO_UPDATE_PATH|
             VOF_WINDOW_INVALID|VOF_WINDOW_UPDATE_PATH|
             VOF_IMAGE_INVALID|VOF_IMAGE_UPDATE_PATH);
    @instance VisGeoAttrs VI_geoAttrs = 0;
    @instance SpecAttrs VI_specAttrs = 0;
    @instance @link VI_link;
@endc

#if defined (__HIGHC__)
pragma Alias(VisObjectHandlesInkReply, "VISOBJECTHANDLESINKREPLY");
#endif

@endlib


Objects\vLTextC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	vLTextC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	Text
 *
 * DESCRIPTION:
 *	This file defines VisLargeTextClass
 *
 *	$Id: vLTextC.goh,v 1.11.6.1 96/04/28 08:31:04 chris Exp $
 *
 ***********************************************************************/

@deflib text

/*
 * VisLargeTextClass is a subclass of VisText used for large objects.  Almost
 * all of VisLargeTextClass is implemented in VisTextClass, but having the
 * subclass allows adding instance data for large text objects only.
 */
@class VisLargeTextClass, VisTextClass;

@message void MSG_VIS_LARGE_TEXT_CREATE_DATA_STRUCTURES ();
/*
 *  Create the VM based data structures for a newly instantiated (or
 *  duplicated) VisLargeText object.
 *
 *  Pass:
 * 	none
 *  Return:
 * 	none
 *  Compat:
 * 	Can only be used with small text objects that have no text,
 * 	runs or elements.
 */

/*----------------------------------------------------------------------------
 * 	Region messages
 *---------------------------------------------------------------------------*/

typedef WordFlags VisLargeTextRegionFlags ;
#define VLTRF_ENDED_BY_COLUMN_BREAK 	0x8000
#define VLTRF_EMPTY 			0x4000

typedef struct {
    /* # characters in region */
    dword			VLTRAE_charCount;

    /* # lines in region */
    dword			VLTRAE_lineCount;

    /* section number */
    word			VLTRAE_section;

    /* position (in 32 bit space) */
    PointDWord			VLTRAE_spatialPosition;

    /* region size */
    XYSize			VLTRAE_size;

    /* computed height of text */
    WBFixed			VLTRAE_calcHeight;

    /* DBItem containing region or 0 for rectangular */
    dword			VLTRAE_region;

    VisLargeTextRegionFlags	VLTRAE_flags;
    byte			VLTRAE_reserved[3];
} VisLargeTextRegionArrayElement} ;

/*
 *  Coordinate systems:
 *
 *  Regions are in general a device level construct that work with a somewhat
 *  unique coordinate system.  Normally the rectangle (10,10),(20,20) is
 *  represented by the region:
 *
 * 	9 $			;from infinity thru 9 is empty
 * 	19 10 19 $		;from 10 (9+1) to 19 is 10 thru 19 inclusive
 * 	$ $			;from 20 (19+1) to infinity is empty
 *
 *  Passing this region to GrGetPtrRegBounds returns bounds of (10,10),(19,19)
 *
 *  The text object in general uses document coordinates for everything.  Thus
 *  the region for the rectangle (10,10),(20,20) is the text object world is:
 *
 * 	10 $			;from infinity to line 10 is empty
 * 	20 10 20 $		;from 10 to 20 is 10 thru 20
 * 	$ $			;from 20 to infinity is empty
 */

@message void MSG_VIS_LARGE_TEXT_APPEND_REGION (word region = cx);
/*
 *  The text object sends this message to itsself to create a new text region.
 *
 *  Pass:
 * 	region - region number to append after
 *  Return:
 * 	none
 */

@message void MSG_VIS_LARGE_TEXT_REGION_IS_LAST (word region = cx);
/*
 *  The text object sends this message to itsself to notify that a text region
 *  has become the last one in the section.
 *
 *  Pass:
 * 	region - region number that is the last one
 *  Return:
 * 	none
 */

@message void MSG_VIS_LARGE_TEXT_CURRENT_REGION_CHANGED (word region = cx);
/*
 *  The text object sends this message to itself to notify that the region
 *  containing the cursor (or start-select if the selection is a range) has
 *  moved between regions.
 *
 * 	PASS:	region	- New region containing cursor or start-select
 */

/*
 *  The display mode affects how regions are displayed and calculated.
 *  Changing display modes allows the user to view a document in various
 *  ways.  In display modes other than page mode the text object ignores
 *  some of the data in the region array and calculates it instead.  The
 *  fields thus calculated are:
 *
 * 	- VLTRAE_spatialPosition
 * 	- VLTRAE_size
 * 	- VLTRAE_region
 *
 *  The display mode is stored in vardata, along with additional data
 *  used in some modes.  If the vardata does not exist, page mode is
 *  used.
 */

@message void MSG_VIS_LARGE_TEXT_REGION_CHANGED (word region = cx);
/*
 *  Recalculate because a region changed
 *
 *  Pass:
 * 	region - region number
 *  Return:
 * 	none
 */

/*---------------------------------------------------------------------------
 * 	Display mode messages
 *---------------------------------------------------------------------------*/

typedef enum {
/*
 *  In page mode the values stored in the region array are used.
 */
    VLTDM_PAGE    ,

/*
 *  In condensed mode all text regions are put vertically one after the
 *  other.  Calculated fields are:
 *  - VLTRAE_spatialPosition
 * 	The x position is taken from vardata.  The y position is the
 * 	sum of the region heights (VLTRAE_size.XYS_height) for all
 * 	preceeding regions plus the offset stored in vardata plus the
 * 	page spacing stored in vardata.
 */
    VLTDM_CONDENSED    ,

/*
 *  In galley mode all text regions are put vertically one after the
 *  other as in condensed mode, except that the computed heights are
 *  used (so that the regions are jammed right next to each other).
 *  Calculated fields are:
 *  - VLTRAE_spatialPosition
 * 	The x position is taken from vardata.  The y position is the
 * 	sum of the region calculated heights (VLTRAE_calcHeight) for all
 * 	preceeding regions plus the offset stored in vardata plus the
 * 	page spacing stored in vardata.
 *  - VLTRAE_size.XYS_height
 * 	Taken from VLTRAE_calcHeight when being used to clear
 */
    VLTDM_GALLEY    ,

/*
 *  In draft mode all text regions are forced to a standard size and are
 *  then put one after the other as in galley mode.  Calculated fields
 *  are:
 *  - VLTRAE_spatialPosition
 * 	Same as galley mode
 *  - VLTRAE_size
 * 	Taken from VTDMD_draftRegionSize
 *  - VLTRAE_region
 * 	Always 0 (rectangular region)
 */
    VLTDM_DRAFT_WITH_STYLES    ,
    VLTDM_DRAFT_WITHOUT_STYLES
} VisLargeTextDisplayModes} ;

@message void MSG_VIS_LARGE_TEXT_SET_DISPLAY_MODE (
            VisLargeTextDisplayModes mode = cx);
/*
 *  Set the display mode.
 *
 *  Pass:
 * 	mode - VisLargeTextDisplayModes
 */

@message void MSG_VIS_LARGE_TEXT_SET_DRAFT_REGION_SIZE (word width = cx,
                               word height = dx);
/*
 *  Set the draft region size
 *
 *  Pass:
 * 	 width
 * 	 height
 */

@message XYValueAsDWord MSG_VIS_LARGE_TEXT_GET_DRAFT_REGION_SIZE (
                           word region = cx) = dx.cx;
/*
 *  Get the draft region size
 *
 *  Pass:
 * 	region - region number
 *
 *  Return:
 * 	XYValueAsDWord - use DWORD_X to get width,
 * 	    	    	     DWORD_Y to get height
 */

@message word MSG_VIS_LARGE_TEXT_GET_REGION_COUNT () = cx;
/*
 *  Get the region count
 *
 *  Return:
 * 	 region count
 */

typedef struct {
    word   	VLTGRPRS_unused;
    sdword   	VLTGRPRS_yPosition;
    word    	VLTGRPRS_height;
} VisLargeTextGetRegionPosReturnStruct} ;

@message void MSG_VIS_LARGE_TEXT_GET_REGION_POS (
                    VisLargeTextGetRegionPosReturnStruct
                    *retVal = bpaxdxcx, word region = cx);
/*
 *  Get position and size of a region
 *
 *  Pass:
 * 	region - region number
 *
 *  Return:
 * 	*retVal filled in
 */

@message void MSG_VIS_LARGE_TEXT_REGION_FROM_POINT (); /* XXX */
/*
 *  Given a point, return the region in which it lies
 *
 *  WARNING: THIS MESSAGE CANNOT BE SENT FROM GOC.
 *
 *  Use the function MsgVisLargeTextRegionFromPoint() to send this message.
 */

typedef struct {
    word     VLTRFPP_region; 	    	/* region number */
    sword    VLTRFPP_xPosition;	    	/* relative X position */
    sword    VLTRFPP_yPosition;	    	/* relatvie Y position */
} VisLargeTextRegionFromPointParams} ;

extern void
    _pascal MsgVisLargeTextRegionFromPoint (
            VisLargeTextRegionFromPointParams *retValue,
            optr object,
            PointDWFixed point);
/*
 *  @call object::MSG_VIS_LARGE_TEXT_REGION_FROM_POINT();
 *
 *  Pass:  	retValue - VisLargeTextRegionFromPointParams
 * 	    	object - optr of VisLargeText object to send message to
 *	    	point - PointDWFixed
 *  Return: 	*retValue filled with return values
 *
 */

/*----------------------------------------------------------------------------
 * 	Instance data
 *---------------------------------------------------------------------------*/

typedef WordFlags VisLargeTextFlags ;
#define VLTF_HEIGHT_NOTIFY_PENDING 	0x8000

typedef WordFlags VisLargeTextAttrs ;
#define VLTA_EXACT_HEIGHT    		0x8000

    @instance ChunkHandle		VLTI_regionArray;
    @instance VisLargeTextDisplayModes	VLTI_displayMode = VLTDM_PAGE;
    @instance word			VLTI_regionSpacing;
    @instance XYSize			VLTI_draftRegionSize = {0, 4000};

    /* object height */
    @instance dword			VLTI_totalHeight;

    /* width for non-page mode */
    @instance word			VLTI_displayModeWidth;

    @instance VisLargeTextFlags		VLTI_flags;
    @instance VisLargeTextAttrs		VLTI_attrs;

@endc

@ifdef __HIGHC__

pragma Alias(MsgVisLargeTextRegionFromPoint, "MSGVISLARGETEXTREGIONFROMPOINT");

@endif

@endlib


vm.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	vm.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines VM structures and routines.
 *
 *	$Id: vm.h,v 1.48.4.1 96/04/28 08:29:22 chris Exp $
 *
 ***********************************************************************/

#ifndef	__VMEM_H
#define __VMEM_H

#include  <lmem.h>

/* VMOpen status codes */

#define VM_OPEN_OK_READ_ONLY 			256
#define VM_OPEN_OK_TEMPLATE  	    	    	257
#define VM_OPEN_OK_READ_WRITE_NOT_SHARED     	258
#define VM_OPEN_OK_READ_WRITE_SINGLE 		259
#define VM_OPEN_OK_READ_WRITE_MULTIPLE 		260
#define VM_OPEN_OK_BLOCK_LEVEL 			261
#define VM_CREATE_OK 				262

/* VMGrabExclusive return values */

typedef enum /* word */ {
    VMSERV_NO_CHANGES    ,
    VMSERV_CHANGES    ,
    VMSERV_TIMEOUT
} VMStartExclusiveReturnValue} ;

/* VM operations (for transaction based apps) */

typedef enum /* word */ {
    VMO_READ    ,
    VMO_INTERNAL    ,
    VMO_SAVE    ,
    VMO_SAVE_AS    ,
    VMO_REVERT    ,
    VMO_UPDATE    ,
    VMO_WRITE
} VMOperation} ;

#define VMO_FIRST_APP_CODE 	0x8000

/* VM error codes */

#define VM_FILE_EXISTS 				263
#define VM_FILE_NOT_FOUND 			264
#define VM_SHARING_DENIED 			265
#define VM_OPEN_INVALID_VM_FILE 			266
#define VM_CANNOT_CREATE 			267
#define VM_TRUNCATE_FAILED 			268
#define VM_WRITE_PROTECTED 			269
#define VM_CANNOT_OPEN_SHARED_MULTIPLE 	    	270
#define VM_FILE_FORMAT_MISMATCH 		        271

/* VMUpdate status codes */

#define VM_UPDATE_NOTHING_DIRTY 			272
#define VM_UPDATE_INSUFFICIENT_DISK_SPACE 	273
#define VM_UPDATE_BLOCK_WAS_LOCKED 		274

/* VMDiscardDirtyBlock status codes */

#define  VM_DISCARD_CANNOT_DISCARD_BLOCK          275

/* Macros for VMChain */

#define VMCHAIN_IS_DBITEM (chain) \
    ((word) (chain))
#define VMCHAIN_GET_VM_BLOCK (chain) \
    ((VMBlockHandle) ((chain) >> 16))
#define VMCHAIN_MAKE_FROM_VM_BLOCK (block) \
    (((VMChain) (block)) << 16)

/* VM file attributes */

typedef ByteFlags VMAttributes ;
#define VMA_SYNC_UPDATE 			0x80
#define VMA_BACKUP 			0x40
#define VMA_OBJECT_RELOC 		0x20
#define VMA_NOTIFY_DIRTY 		0x08
#define VMA_NO_DISCARD_IF_IN_USE 	0x04
#define VMA_COMPACT_OBJ_BLOCK 		0x02
#define VMA_SINGLE_THREAD_ACCESS 	0x01

/* Attribute bits that must be enabled if the file contains object blocks */

#define VMA_OBJECT_ATTRS  (VMA_OBJECT_RELOC | VMA_NO_DISCARD_IF_IN_USE \
              | VMA_SINGLE_THREAD_ACCESS)

/***/

extern void *
    _pascal VMLock (VMFileHandle file, VMBlockHandle block, MemHandle *mh);

/***/

extern void
    _pascal VMUnlock (MemHandle mh);

/***/

extern VMBlockHandle
    _pascal VMAlloc (VMFileHandle file, word size, word userId);

/***/

extern VMBlockHandle	/*XXX*/
    _pascal VMFind (VMFileHandle file, VMBlockHandle startBlock, word userId);

/***/

extern void	/*XXX*/
    _pascal VMFree (VMFileHandle file, VMBlockHandle block);

/***/

extern void
    _pascal VMDirty (MemHandle mh);

/***/

extern void	/*XXX*/
    _pascal VMModifyUserID (VMFileHandle file, VMBlockHandle block, word userId);

/***/

typedef struct {
    MemHandle	mh;
    word	size;
    word	userId;
} VMInfoStruct} ;

extern Boolean	/*XXX*/
    _pascal VMInfo (VMFileHandle file, VMBlockHandle block, VMInfoStruct *info);

/***/

#define VMDIRTY_SINCE_LAST_SAVE (val) \
    ((val) & 0xff)
#define VMDIRTY_SINCE_LAST_AUTO_SAVE (val) \
    ((val) >> 8)

extern word	/*XXX*/
    _pascal VMGetDirtyState (VMFileHandle file);

/***/

extern VMBlockHandle
    _pascal VMGetMapBlock (VMFileHandle file);

/***/

extern void
    _pascal VMSetMapBlock (VMFileHandle file, VMBlockHandle block);

/***/

typedef ByteEnum VMOpenType ;
#define VMO_OPEN  0
#define VMO_TEMP_FILE  1
#define VMO_CREATE  2
#define VMO_CREATE_ONLY  3
#define VMO_CREATE_TRUNCATE  4

#define VMO_NATIVE_WITH_EXT_ATTRS    0x80

typedef ByteFlags VMAccessFlags ;
#define VMAF_FORCE_READ_ONLY 	    	    0x80
#define VMAF_FORCE_READ_WRITE 	    	    0x40
#define VMAF_ALLOW_SHARED_MEMORY     	    0x20
#define VMAF_FORCE_DENY_WRITE 	    	    0x10
#define VMAF_DISALLOW_SHARED_MULTIPLE 	    0x08
#define VMAF_USE_BLOCK_LEVEL_SYNCHRONIZATION  0x04
#define VMAF_FORCE_SHARED_MULTIPLE   	    0x02

extern VMFileHandle			/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal VMOpen (char *name, VMAccessFlags flags, VMOpenType mode, word compression);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal VMUpdate (VMFileHandle file);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal VMClose (VMFileHandle file, Boolean noErrorFlag);

/***/

extern word	/*XXX*/
    _pascal VMGetAttributes (VMFileHandle file);

/***/

extern VMAttributes	/*XXX*/
    _pascal VMSetAttributes (VMFileHandle file,
            VMAttributes attrToSet,
            VMAttributes AttrToClear);

/***/

extern VMStartExclusiveReturnValue
    _pascal VMGrabExclusive (VMFileHandle file,
            word timeout,
            VMOperation operation,
            VMOperation *currentOperation);

/***/

extern void
    _pascal VMReleaseExclusive (VMFileHandle file);

/***/

extern Boolean	/*XXX*/
    _pascal VMCheckForModifications (VMFileHandle file);

/***/

typedef enum /* word */ {
    VMRT_UNRELOCATE_BEFORE_WRITE    ,
    VMRT_RELOCATE_AFTER_READ    ,
    VMRT_RELOCATE_AFTER_WRITE    ,
    VMRT_RELOCATE_FROM_RESOURCE    ,
    VMRT_UNRELOCATE_FROM_RESOURCE    ,
} VMRelocType} ;

/* HELP !!! DON'T USE THIS ROUTINE FROM C */
extern void	/*XXX*/
    _pascal VMSetReloc (VMFileHandle file,
           PCB(void, reloc,(VMFileHandle file,
                 VMBlockHandle block,
                 MemHandle mh,
                 void *data,
                 VMRelocType type)));

/***/

extern VMBlockHandle
    _pascal VMAttach (VMFileHandle file, VMBlockHandle block, MemHandle mh);

/***/

extern MemHandle	/*XXX*/
    _pascal VMDetach (VMFileHandle file, VMBlockHandle block, GeodeHandle owner);

/***/

extern VMBlockHandle	/*XXX*/
    _pascal VMMemBlockToVMBlock (MemHandle mh, VMFileHandle *file);

/***/

extern MemHandle	/*XXX*/
    _pascal VMVMBlockToMemBlock (VMFileHandle file, VMBlockHandle block);

/***/

extern Boolean	/*XXX*/
    _pascal VMSave (VMFileHandle file);

/***/

extern VMFileHandle			/* Sets value for ThreadGetError() */	/*XXX*/
    _pascal VMSaveAs (VMFileHandle file,
         const char *name,
         VMAccessFlags flags,
         VMOpenType mode,
         word compression);

/***/

extern void	/*XXX*/
    _pascal VMRevert (VMFileHandle file);

/***/

extern void	/*XXX*/
    _pascal VMPreserveBlocksHandle (VMFileHandle file, VMBlockHandle block);

/***/

extern VMChain	/*XXX*/
    _pascal VMCopyVMChain (VMFileHandle sourceFile,
          VMChain sourceChain,
          VMFileHandle destFile);

/***/

extern void	/*XXX*/
    _pascal VMFreeVMChain (VMFileHandle file, VMChain chain);

/***/

extern Boolean	/*XXX*/
    _pascal VMCompareVMChains (VMFileHandle sourceFile,
              VMChain sourceChain,
              VMFileHandle destFile,
              VMChain destChain);

/***/

extern Boolean	/*XXX*/
    _pascal VMInfoVMChain (VMFileHandle sourceFile,
              VMChain sourceChain,
              dword *chainSize,
              word  *vmBlockCount,
              word  *dbItemCount
              );

/***/

extern VMBlockHandle	/*XXX*/
    _pascal VMCopyVMBlock (VMFileHandle sourceFile,
          VMBlockHandle sourceBlock,
          VMFileHandle destFile);

/* Structure of a VM chain */

#define VM_CHAIN_TREE 		0xffff

typedef struct {
    VMBlockHandle	VMC_next;
} VMChainLink} ;

typedef struct {
    VMChainLink		VMCT_meta;
    word		VMCT_offset;
    word		VMCT_count;
} VMChainTree} ;

/***/

extern void	/*XXX*/
    _pascal VMSetExecThread (VMFileHandle file, ThreadHandle thread);

/***/

extern VMBlockHandle	/*XXX*/
    _pascal VMAllocLMem (VMFileHandle file, LMemType ltype, word headerSize);

/***/

typedef struct {
    word	usedBlocks;
    word	headerSize;
    word	freeBlocks;
} VMHeaderInfoStruct} ;

extern void	/*XXX*/
    _pascal VMGetHeaderInfo (VMFileHandle file, VMHeaderInfoStruct *vmInfo);

/***/

extern word		/* Returns error and sets value for ThreadGetError() */	/*XXX*/
    _pascal VMDiscardDirtyBlocks (VMFileHandle file);

/***/

/*
 *		System VM ID's
 *
 *      VM ID's from 0xff00 to 0xffff are reserved for use by the
 *      system and system libraries
 */

#define SVMID_RANGE_DBASE   	0xff00	/* Reserved for DB code */

typedef enum /* word */ {

    DB_MAP_ID     = 0xff00,		/*  ID for DB map block */
    DB_GROUP_ID    ,		/*  ID for new DB group */
    DB_ITEM_BLOCK_ID    ,		/*  ID for new DB item block */
    SVMID_HA_DIR_ID    ,		/*  ID for HugeArray dir blocks */
    SVMID_HA_BLOCK_ID    ,		/*  ID for HugeArray data blocks */
    SVMID_DOCUMENT_NOTES    ,	/*  ID for document note block */

} SystemVMID} ;

extern void     /*XXX*/
   _pascal VMSetDirtyLimit (VMFileHandle file, word dirtyLimit);

/***/

#ifdef __HIGHC__
pragma Alias(VMLock, "VMLOCK");
pragma Alias(VMUnlock, "VMUNLOCK");
pragma Alias(VMAlloc, "VMALLOC");
pragma Alias(VMFind, "VMFIND");
pragma Alias(VMFree, "VMFREE");
pragma Alias(VMDirty, "VMDIRTY");
pragma Alias(VMModifyUserID, "VMMODIFYUSERID");
pragma Alias(VMInfo, "VMINFO");
pragma Alias(VMGetDirtyState, "VMGETDIRTYSTATE");
pragma Alias(VMGetMapBlock, "VMGETMAPBLOCK");
pragma Alias(VMSetMapBlock, "VMSETMAPBLOCK");
pragma Alias(VMOpen, "VMOPEN");
pragma Alias(VMUpdate, "VMUPDATE");
pragma Alias(VMClose, "VMCLOSE");
pragma Alias(VMGetAttributes, "VMGETATTRIBUTES");
pragma Alias(VMSetAttributes, "VMSETATTRIBUTES");
pragma Alias(VMGrabExclusive, "VMGRABEXCLUSIVE");
pragma Alias(VMReleaseExclusive, "VMRELEASEEXCLUSIVE");
pragma Alias(VMCheckForModifications, "VMCHECKFORMODIFICATIONS");
pragma Alias(VMSetReloc, "VMSETRELOC");
pragma Alias(VMAttach, "VMATTACH");
pragma Alias(VMDetach, "VMDETACH");
pragma Alias(VMMemBlockToVMBlock, "VMMEMBLOCKTOVMBLOCK");
pragma Alias(VMVMBlockToMemBlock, "VMVMBLOCKTOMEMBLOCK");
pragma Alias(VMSave, "VMSAVE");
pragma Alias(VMSaveAs, "VMSAVEAS");
pragma Alias(VMRevert, "VMREVERT");
pragma Alias(VMPreserveBlocksHandle, "VMPRESERVEBLOCKSHANDLE");
pragma Alias(VMCopyVMChain, "VMCOPYVMCHAIN");
pragma Alias(VMFreeVMChain, "VMFREEVMCHAIN");
pragma Alias(VMCompareVMChains, "VMCOMPAREVMCHAINS");
pragma Alias(VMCopyVMBlock, "VMCOPYVMBLOCK");
pragma Alias(VMInfoVMChain, "VMINFOVMCHAIN");
pragma Alias(VMSetExecThread, "VMSETEXECTHREAD");
pragma Alias(VMAllocLMem, "VMALLOCLMEM");
pragma Alias(VMGetHeaderInfo, "VMGETHEADERINFO");
pragma Alias(VMDiscardDirtyBlocks, "VMDISCARDDIRTYBLOCKS");
pragma Alias(VMSetDirtyLimit, "VMSETDIRTYLIMIT");
#endif

#endif


Mailbox\vmtree.h

/***********************************************************************
 *
 *	Copyright (c) Geoworks 1994 -- All Rights Reserved
 *
 * PROJECT:	  Clavin
 * MODULE:	  VM Tree Data Driver
 * FILE:	  vmtree.h
 *
 * AUTHOR:  	  Chung Liu: Nov 21, 1994
 *
 * REVISION HISTORY:
 *	Name	Date		Description
 *	----	----		-----------
 *	CL	11/21/94   	Initial version
 *
 * DESCRIPTION:
 *	Interface file for the VM Tree data driver.
 *
 *
 * 	$Id: vmtree.h,v 1.1.9.1 96/04/28 08:33:16 chris Exp $
 *
 ***********************************************************************/
#ifndef _VMTREE_H_
#define _VMTREE_H_

typedef struct {
    VMChain       VMTAR_vmChain;
    VMFileHandle  VMTAR_vmFile;
} VMTreeAppRef} ;

#endif /* _VMTREE_H_ */


Internal\Resp\vrecui.goh

/*
- Lisätty DISK_SPACE_LOW & DISK_SPACE_CRITICAL
-----------------------------------------------------------------------------
Copyright (c) 1997. Nokia Mobile Phones
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

    Class definitions and constants for the Voice Recorder UI library.

-----------------------------------------------------------------------------
*/

@deflib vrecui;

@include  <stdapp.goh>

/* Define the following Goc variable if the user is allowed to create
   subfolders under "Tones". */
/* @define SUBFOLDERS_ALLOWED_IN_TONES */
typedef int RetVal ;

/* Library mode constants. */
#define VRECUI_MODE_IDLE       000
#define VRECUI_MODE_PLAY       001
#define VRECUI_MODE_RECORD     002
#define VRECUI_MODE_PAUSE      010

#define VREC_NEW_FILE  0
#define VREC_OLD_FILE  1
#define VREC_NEW_RECORDED_FILE  2

/* Token and protocol version for created files. */
#define VREC_FILE_TOKEN              "VREC"
#define VREC_FILE_MAJOR_PROTOCOL     NOTES_FILE_MAJOR_PROTOCOL
#define VREC_FILE_MINOR_PROTOCOL     1

#define DISK_SPACE_LOW       0x16800  /*90kb*/
#define DISK_SPACE_CRITICAL  0x11800  /*70kb*/

@class VrecuiControlClass, GenControlClass;
    @message void MSG_VRECUI_CONTROL_INITIATE (TCHAR *directory, TCHAR *file);
    @message void MSG_VRECUI_PLAY ();
    @message void MSG_VRECUI_RECORD ();
    @message void MSG_VRECUI_DELETE ();
    @message void MSG_VRECUI_CLOSE ();
    @message void MSG_VRECUI_PAUSE ();
    @message void MSG_VRECUI_CONTINUE ();
    @message void MSG_VRECUI_UI_STOP ();
    @message void MSG_VRECUI_STOP ();
    @message void MSG_VRECUI_SET_TRIGGERS (byte statePlay, byte stateRec);
    @message void MSG_VRECUI_SET_ERROR ();

    @message void MSG_VRECUI_MENU_SELECT ();
    @message void MSG_VRECUI_CTRL_VOLUME_COMMAND ( word commandId);;
    @message void MSG_START_WAIT_NEXT_ROUND_TIMER ();
    @message void MSG_VRECUI_SET_PAUSE (byte Pause, byte Continue);

     @message void MSG_VRECUI_UPDATE_STATE ();

    @default GI_states = (@default | GS_ENABLED);
    @default GII_type = (GIT_MULTIPLE_RESPONSE);
    @default GII_visibility = (GIV_DIALOG);
    @default GII_attrs = (@default | GIA_NOT_USER_INITIATABLE | GIA_MODAL);

    @instance optr VCI_visObject  = NullOptr;

    @instance byte VolumeLevel	= 3;
@endc;

/*@class VrecuiControlClass, GenControlClass;
    @instance       word            FNI_duration;
@endc;
*/
@endlib;

/* third parameter is volume 1-5*/
extern RetVal _cdecl StartPlayVoiceFile ( char*, byte, byte);

extern RetVal _cdecl StopPlayVoiceFile ( byte);
extern RetVal _cdecl StartRecVoiceFile ( byte);
extern RetVal _cdecl VrecuiCheckIfRT24 ( TCHAR*);


Internal\Resp\vserlib.h

/*
-----------------------------------------------------------------------------

Copyright (c) 1995 - 1997. Nokia Mobile Phones
*/

#ifndef VSERLIB_H
#define VSERLIB_H

#include  <library.h>
/*Constants:*/

/*Constants related to SerialDriver (DR_SERIAL_..., DR_STREAM_...)*/

#define     DR_VIRTUAL_SERIAL_OPEN                   0x000a
#define     DR_VIRTUAL_SERIAL_CLOSE                  0x000c
#define     DR_VIRTUAL_SERIAL_SET_NOTIFY             0x000e
#define     DR_VIRTUAL_SERIAL_FLUSH                  0x0014
#define     DR_VIRTUAL_SERIAL_READ                   0x0018
#define     DR_VIRTUAL_SERIAL_READ_BYTE              0x001a
#define     DR_VIRTUAL_SERIAL_WRITE                  0x001c
#define     DR_VIRTUAL_SERIAL_WRITE_BYTE             0x001e
#define     DR_VIRTUAL_SERIAL_OPEN_FOR_DRIVERS       0x002a
#define     DR_VIRTUAL_SERIAL_SET_FLOW_CONTROL       0x002c
#define     DR_VIRTUAL_SERIAL_GET_MEDIUM             0x003a
#define     DR_VIRTUAL_SERIAL_SET_FORMAT             0x0022
/*Virtual serial return values:*/

#define     VS_INIT                          0xfffe
#define     VS_NOT_SUPPORTED                 0xffff
#define     VS_OK                            0x0000
#define     VS_CANNOT_ALLOC                  0x0003
#define     VS_BUFFER_TOO_BIG                0x0004
#define     VS_CLOSED                        0x0005
#define     VS_SHORT_READ_WRITE              0x0006
#define     VS_DATA_RESOURCE_RESERVED        0x0008
#define     VS_ALREADY_OPEN                  0x000a

/*Virtual serial parameter constants:*/

#define     VSNT_WRITER                      0x0000
#define     VSNT_READER                      0x0020
#define     VSNE_ERROR                       0x0000
#define     VSNE_DATA                        0x0004
#define     VSNE_MODEM                       0x0008
#define     VSNE_FCLASS                      0x0059  /* don't add to vser.def*/
#define     VSNM_NONE                        0x0000
#define     VSNM_ROUTINE                     0x0001
#define     VSNM_MESSAGE                     0x0002

#define     STREAM_NO_BLOCK                  0x0000
#define     STREAM_BLOCK                     0x0002

#define     VSFC_HARDWARE                    0x0001
#define     VSFC_SOFTWARE                    0x0002
#define     VSFC_BOTH                        0x0003

#define     SOF_TIMEOUT                      0x0001
#define     SOF_NOBLOCK                      0x0002
#define     STREAM_READ                      0xffff
#define     STREAM_BOTH                      0xfffe
#define     STREAM_WRITE                     0x0000
#define     SERIAL_READ                      STREAM_READ
#define     STREAM_DISCARD                   0
#define     STREAM_LINGER                    -1

/* #include  <library.h>  */

typedef word VirtualSerialStatus ;
typedef word VSOpenFlags ;
typedef word VSNotifytype ;
typedef word VSBlockingMode ;
typedef word VSFlowControl ;
typedef word VSSerialFormat ;
typedef word VSSerialMode ;
typedef word VSSerialBaud ;

/* ASM interface */
void _pascal VirtualSerialStrategy ( void);

/* Opens a data connection to modem */
VirtualSerialStatus _cdecl VirtualSerialOpen ( VSOpenFlags stream_open_mode,
                                       word input_buffer_size,
                                       word output_buffer_size,
                                       word timeout);

/* Closes data connection to modem */
VirtualSerialStatus _cdecl VirtualSerialClose ( Boolean linger);

/* Set notify address */
VirtualSerialStatus _cdecl VirtualSerialSetNotify ( VSNotifytype notify_type,
                                            optr destination,
                                            word method);

/* Flushes in and out buffers */
VirtualSerialStatus _cdecl VirtualSerialFlush ( word flushMode);

/* Reads from VP */
VirtualSerialStatus _cdecl VirtualSerialRead ( VSBlockingMode blocking_mode,
                                       word buffer_size,
                                       byte *buffer,
                                       word *bytes_read);

/* Reads from VP */
VirtualSerialStatus _cdecl VirtualSerialReadByte ( VSBlockingMode blocking_mode,
                                           byte *data_byte);

/* Writes to VP */
VirtualSerialStatus _cdecl VirtualSerialWrite (
                                        VSBlockingMode blocking_mode,
                                        word buffer_size,
                                        const byte *buffer,
                                        word *bytes_written);

/* Writes to VP */
VirtualSerialStatus _cdecl VirtualSerialWriteByte (
                                            VSBlockingMode blocking_mode,
                                            byte data_byte);

/* Sets the flow mode */
VirtualSerialStatus _cdecl VirtualSerialSetFlowControl (
                                            VSFlowControl flow_control_mode);

/* Sets the modem data format */
VirtualSerialStatus _cdecl VirtualSerialSetFormat ( VSSerialFormat  format,
                                            VSSerialBaud    baud);

/* Sends DTR to	modem */
VirtualSerialStatus _cdecl VirtualSerialSendDTR ( byte DTR_Status);

/* Function for receiving data */
void _cdecl VirtualSerialReceiveData ( byte destination,
                               byte msgLength,
                               char *data);

/* Library entry point */
Boolean _pascal VSLibraryEntry ( LibraryCallType ty,
                                GeodeHandle client);

#endif


Objects\vTextC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	vTextC.goh
 * AUTHOR:	Tony Requist: February 12, 1991
 *
 * DECLARER:	Text
 *
 * DESCRIPTION:
 *	This file defines VisTextClass
 *
 *	$Id: vTextC.goh,v 1.221.1.8 97/11/07 13:38:40 reza Exp $
 *
 ***********************************************************************/

@ifndef	__VTEXTC_GOH
@define __VTEXTC_GOH

@optimize
@deflib text

@include  <ui.goh>
#include  <Objects/Text/tCommon.h>

@include  <Objects/visC.goh>
@include  <Objects/gCtrlC.goh>
@include  <Objects/gViewC.goh> 	    	/* for MakeRectVisibleParams */
@include  <spool.goh>
#include  <hugearr.h>
#include  <dbase.h>

/*------------------------------------------------------------------------
 *	    Class Definition
 *------------------------------------------------------------------------*/

@class VisTextClass, VisClass;

typedef	dword	TokenAsDWord	;
typedef	dword	SizeAsDWord	;

#define DWORD_TOKEN (val) ((word)( (val) & 0xffff ))
#define DWORD_DATA (val) ((word)( ((val) >> 16) & 0xffff ))

/*
 * Flags sent as data with GWNT_EDITABLE_TEXT_OBJECT_HAS_FOCUS .
 */
typedef WordFlags TextFocusFlags ;
#define TFF_EDITABLE_TEXT_OBJECT_HAS_FOCUS   0x8000
#define TFF_OBJECT_RUN_BY_UI_THREAD  	    0x4000

/*------------------------------------------------------------------------
 *		Exported Search Replace routines
 *------------------------------------------------------------------------*/

#define SEARCH_REPLACE_TEXT_MAXIMUM  	    65	    /* 64 chars + 1 null */

typedef ByteFlags SearchOptions ;

#define SO_START_FROM_TOP 		    0x40
/*	Set if the search is starting from the top of document or object. */

#define SO_NO_WILDCARDS 	    	    	    0x20
/* 	Set if you want to treat wildcard chars as literal chars */

#define SO_IGNORE_SOFT_HYPHENS 	    	    0x10
/* 	Set if you want to treat soft hyphens in the "searched-in" text
 *	as if they do not exist. If the string we are trying to match
 *	contains soft hyphens, do not set this flag or the strings will
 *	never match.
 */

#define SO_BACKWARD_SEARCH 	    	    0x08
/* 	Set if the user wants to search backward */

#define SO_IGNORE_CASE 	    	    	    0x04
/*	Set if you want to ignore case when searching for strings */

#define SO_PARTIAL_WORD 	    	    	    0x02
/* 	Set if you want to match partial words when searching for strings */

#define SO_PRESERVE_CASE_OF_DOCUMENT_STRING  0x01
/* 	If set, will preserve the case of the occurrence of the search
 *	string when replacing (will modify the replace string before
 * 	replacing it).
 */

typedef ByteEnum SearchNoteOptionType ;
#define SNOT_INCLUDE_NOTE 		0x0
#define SNOT_EXCLUDE_NOTE 		0x1
#define SNOT_NOTE_ONLY 			0x2

typedef ByteEnum WildCard ;
#define WC_MATCH_SINGLE_CHAR    	    0x10
#define WC_MATCH_MULTIPLE_CHARS      0x11
#define WC_MATCH_WHITESPACE_CHAR     0x12

/**************************************************************************/
extern char *
    _pascal TextSearchInString (const char *str1, const char *startPtr,
                const char *endPtr, word str1Size,
                const char *str2, word str2Size,
                word searchOptions, word *matchLen);
/*
 * 	Finds an occurrence of a string (str2) in another string (str1).
 *	TextSearchInString can take search strings with wildcards, and returns
 *	a pointer to a match (or NULL if none), and the length of the match.
 *
 *	NOTE: startPtr and endPtr *must* be in the same segment.
 *
 *  	Pass: str1 - ptr to first char in string we are searching in
 * 	      startPtr - ptr to character to start search at in string (str1)
 * 	      endPtr - ptr to last char to include in search in string (str1) ""
 * 		       (will not match any word that begins after this
 * 			offset, but will match words that start before this
 * 			char and extend beyond it)
 *
 * 	      strSize - # chars of str1 pointed to by ES:DI
 * 		   (if strSize=0, str1 is assumed to be null terminated, and
 * 			strSize is calculated to be the number of non-null
 *	    	    	chars in the string)
 * 	      str2 - ptr to string to match
 * 		      May contain WildCard chars
 * 	      str2Size - # chars in str2 (or 0 if null-terminated)
 * 	      searchOptions - SearchOptions cast to a word
 *
 * 	Returns: 0 if no match found,
 * 	    	    -else-
 *		 pointer to start of string found
 * 		 matchLen filled in with # chars matched
 *
 * Example:
 * 	Want to search for the string "foo" in "I want some food", starting
 * 	with the "w" in "want":
 *
 * 	startPtr     endPtr
 * 	  V	       V
 * 	I want some food
 * 	^
 *      str1
 *
 */

/**************************************************************************/
extern dword
    _pascal TextSearchInHugeArray (char *str2, word str2Size,
                       dword str1Size, dword curOffset,
                       dword endOffset,
                       FileHandle hugeArrayFile,
                       VMBlockHandle hugeArrayBlock,
                       word searchOptions,
                       dword *matchLen);
/*
 * 	Finds an occurrence of a string (str2) in another string (str1).
 *	TextSearchInHugeArray can take search strings with wildcards, and
 *	returns a dword offset to a match and the length of the match
 *
 *  	Pass: str2 - ptr to string to match
 * 	      str2Size - # chars in str2 (or 0 if null-terminated)
 *
 * 	Returns: offset to match found,
 * 		 matchLen - number of chars in matching string, or
 * 	    	    	    0 if string not found
 */

/*--------------------------------------------------------------------------
 *	 Text Ranges
 *--------------------------------------------------------------------------*/

typedef WordFlags VisTextRangeContext ;

#define VTRC_PARAGRAPH_CHANGE 		0x8000
/* 	Change done on paragraph level  */

#define VTRC_CHAR_ATTR_CHANGE 		0x4000
/* 	Used for a charAttr change (include last CR, don't include next CR) */ ""

#define VTRC_PARA_ATTR_BORDER_CHANGE 	0x2000
/*	Used for a paraAttr change including a border */

/***************************************************************************/
@message void MSG_VIS_TEXT_GET_RANGE (VisTextRange *range = dx:bp,
                     VisTextRangeContext context = cx);
/*
 * Given a VisTextRange, return the text positions.
 *
 *  	Pass:  	range - pointer to VisTextRange
 *	    	context - VisTextRangeContext
 *
 *  	Return: The text positions in "range"
 *	Compat: Can be used with all text objects.
 */

/*------------------------------------------------------------------------
 * 	Structures for generic runs and elements
 *------------------------------------------------------------------------*/

/*
 * 	A generic array of runs in the small format.
 */
typedef struct {
    ChunkArrayHeader	TRAH_meta;
    VMBlockHandle	TRAH_elementVMBlock;	/* Element block or 0 */
    ChunkHandle		TRAH_elementArray;  	/* ChunkHandle of the array */
} TextRunArrayHeader} ;

/*
 * 	A generic array of runs in the large format.
 */
typedef struct {
    HugeArrayDirectory	TLRAH_meta;
    VMBlockHandle	TLRAH_elementVMBlock;	/* Element block or 0 */
} TextLargeRunArrayHeader} ;

/*
 * 	An element in a array of runs
 */
typedef struct {
    WordAndAHalf 	TRAE_position;		/* Position for start of run */
    word	    	TRAE_token;		/*  Token for run */
} TextRunArrayElement} ;

typedef ByteEnum TextArrayType ;
#define TAT_CHAR_ATTRS  	0
#define TAT_PARA_ATTRS  	1
#define TAT_GRAPHICS  	2
#define TAT_TYPES    	3

/*
 * 	A generic array of elements
 */
typedef struct {
    ElementArrayHeader	TEAH_meta;
    TextArrayType	TEAH_arrayType;
    byte		TEAH_unused;
} TextElementArrayHeader} ;

/*---------------------------------------------------------------------------
 * Macros for easily creating run and element arrays
 *--------------------------------------------------------------------------*/

#define TRAE (pos, base, type) {{pos-base, 0}, type}
#define TRAE_ABS (pos, type) {{pos, 0}, type}
#define TRAE_ALL (type) {{0, 0}, type}
#define TRAE_END  {{TEXT_ADDRESS_PAST_END&0xffff, TEXT_ADDRESS_PAST_END>>16}, \
                                                        CA_NULL_ELEMENT}

@define CHAR_ATTR_ELEMENT_ARRAY_HEADER @elementArray VisTextCharAttr \
                            (TextElementArrayHeader (TAT_CHAR_ATTRS))

@define RUN_ARRAY_HEADER(elements) @chunkArray TextRunArrayElement \
                            (TextRunArrayHeader (0, (ChunkHandle)@elements))

/*--------------------------------------------------------------------------
 * 	    Style sheet structures
 *--------------------------------------------------------------------------*/

typedef WordFlags TextStyleFlags ;
#define TSF_APPLY_TO_SELECTION_ONLY  0x8000
#define TSF_POINT_SIZE_RELATIVE 	    0x4000
#define TSF_MARGINS_RELATIVE 	    0x2000
#define TSF_SPACING_RELATIVE 	    0x1000

typedef struct {
    TextStyleFlags    	TSPD_flags;
    byte    	    	TSPD_unused[2];
} TextStylePrivateData} ;

typedef struct {
    NameArrayElement	    	TSEH_meta;
    word	    	    	TSEH_baseStyle;
    StyleElementFlags	    	TSEH_flags;
    byte	    	    	TSEH_reserved[6];
    TextStylePrivateData	TSEH_privateData;
    word	    	    	TSEH_charAttrToken;
    word	    	    	TSEH_paraAttrToken;
} TextStyleElementHeader} ;

/*--------------------------------------------------------------------------
 * 		Global routines for attributes
 *--------------------------------------------------------------------------*/

extern void
    _pascal TextMapDefaultCharAttr (VisTextDefaultCharAttr defaulAttr,
                   VisTextCharAttr *attr);
/*
 *  Load a default VisTextCharAttr.
 *	PASS:	defaultAttr - VisTextDefaultCharAttr to get attrs for
 *	        attr - pointer to VisTextCharAttr structure to fill in
 *	RETURN: attr - filled in
 */

extern Boolean
    _pascal TextFindDefaultCharAttr (VisTextDefaultCharAttr  *defaultAttr,
                    VisTextCharAttr *attr);
/*
 *  Look up a default VisTextCharAttr.
 *	PASS:	defaultAttr - pointer to VisTextDefaultCharAttr
 *	        attr - VisTextCharAttrs to look for
 *	RETURN: if TRUE, attr is one of the default VisTextCharAttrs
 * 		    	defaultAttr - filled in
 *	    	if FALSE, attr is not one of the default VisTextCharAttrs
 */

extern void
    _pascal TextMapDefaultParaAttr (VisTextDefaultParaAttr defaulAttr,
                   VisTextParaAttr *attr);
/*
 *  Load a default VisTextParaAttr.
 *	PASS:	defaultAttr - VisTextDefaultParaAttr to get attrs for
 *	        attr - pointer to VisTextParaAttr structure to fill in
 */

extern Boolean
    _pascal TextFindDefaultParaAttr (VisTextDefaultParaAttr  *defaultAttr,
                    VisTextParaAttr *attr);
/*
 *  Look up a default VisTextParaAttr.
 *	PASS:	defaultAttr - VisTextDefaultParaAttr
 *	        attr - VisTextParaAttr to look for
 *	RETURN: if TRUE, attr is one of the default VisTextParaAttrs
 * 		    	defaultAttr -  which matches attr
 *	    	if FALSE, attr is not one of the default VisTextParaAttrs
 */

extern Boolean
    _pascal TextGetSystemCharAttrRun (word *chunkOrConstant, optr object,
                     ObjChunkFlags flags);
/*
 *  Return the system charAttr run for an object's specific UI.
 *
 *	PASS:	object to get charAttr run for
 *	    	flags - ObjChunkFlags to allocate lmem chunk with (if any)
 *
 *	RETURN:	FALSE if chunk allocated:
 *	    	    chunkOrConstant = ChunkHandle of chunk containing
 *	    	        VisTextCharAttr, allocated in same block as object
 *	    	TRUE if default attr returned:
 *		    chunkOrConstant = VisTextDefaultCharAttr
 *
 *	NOTE: This function must be called from the thread which is
 *	      running the object.
 *
 */

extern word
    _pascal GetTokenForPosition (optr object, word runOffset,
                dword *position);
/*
 *  Return the token of a run at the passed position
 *
 *	PASS:	object - the text object
 *	    	runOffset - offset of RunArray to use
 *	    	position - ptr to dword containing the position
 *
 *	RETURN:	token of the run
 *	    	position is updated to the actual position of the run
 *
 */

/*----------------------------------------------------------------------------
 *	Routines for informing the text library what libs to use
 *---------------------------------------------------------------------------*/

/*
 *	By default, the text library does not load any spell or hyphenation
 *	libraries. Apps that will be using hyphenation or spell checking need
 *	to load these libraries themselves, and these libraries will, in turn,
 *	notify the text library of their existence
 */

extern void 	/* XXX */
     _pascal TextSetSpellLibrary (MemHandle libHandle);
/*
 *	Pass: bx - library handle (or 0 if library is exiting)
 *	Return: nothing
 *	Destroyed: nothing
 */

extern void 	/* XXX */
     _pascal TextSetHyphenationCall (void *hyphenationWordEntryPoint);
/*
 * Pass (on-stack):
 *	(void *) to pass to ProcCallFixedOrMovable to call to get
 *	      	 hyphenation position
 *
 *	Routine is passed args on stack (pushed in this order):
 *			fptr	ptrToWordToHyphenate
 *			word	lengthOfShortestWordToHyphenate
 *
 *	Routine returns:
 *		 0 if error or no hyphenation
 *				- else -
 *		 handle of block containing HyphenationPoints structure
 */

/*---------------------------------------------------------------------------
 * 	Messages to set character attributes (charAttrs)
 *--------------------------------------------------------------------------*/
/*
 * Each of these messages takes some values to be changed
 * and the range of text to change.
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_CHAR_ATTR_BY_DEFAULT(@stack
                     VisTextDefaultCharAttr defCharAttrs,
                                         dword rangeEnd, dword rangeStart);
/*
 * 	Set: the entire charAttr structure via a default charAttr
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_CHAR_ATTR(@stack
                     VisTextCharAttr *attrs,
                                         dword rangeEnd, dword rangeStart);
/*
 * 	Set: the entire charAttr structure via a VisTextCharAttr structure
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_CHAR_ATTR_BY_TOKEN(@stack word token,
                                         dword rangeEnd, dword rangeStart);
/*
 * 	Set: the entire charAttr structure via a VisTextCharAttr token
 *
 * 	Passing CA_NULL_ELEMENT as the token causes "revert to base style"
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_FONT_ID(@stack
                    FontID fid,
                                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the font ID
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_FONT_WEIGHT(@stack
                    byte fontWeight,
                                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the font weight
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_FONT_WIDTH(@stack
                    byte fontWidth,
                                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the font width
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_POINT_SIZE(@stack
                    WWFixed pointSize,
                                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the point size
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_SMALLER_POINT_SIZE(
                    @stack word minimumSize,
                                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the point size to a smaller point size
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_LARGER_POINT_SIZE(
                    @stack word maximumSize,
                                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the point size to a larger point size
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_TEXT_STYLE(@stack
                  VisTextExtendedStyles extBitsToClear,
                  VisTextExtendedStyles extBitsToSet,
                  TextStyle styleBitsToClear,
                  TextStyle styleBitsToSet,
                                     dword rangeEnd, dword rangeStart);
/*
 *	Set: the text style and extended style bits
 *
 * If both the set bit and the clear bit is set then the bit is toggled
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_COLOR(@stack
                    ColorQuad color,
                                       dword rangeEnd, dword rangeStart);
/*
 *	Set: the text color
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_GRAY_SCREEN(@stack
                    SystemDrawMask grayScreen,
                                       dword rangeEnd, dword rangeStart);
/*
 *	Set: the gray screen
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_PATTERN(@stack
                    GraphicPattern hatch,
                                       dword rangeEnd, dword rangeStart);
/*
 *	Set: the text pattern
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_CHAR_BG_COLOR(@stack
                    ColorQuad color,
                                       dword rangeEnd, dword rangeStart);
/*
 *	Set: the character background color
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_CHAR_BG_GRAY_SCREEN(
                    @stack SystemDrawMask grayScreen,
                                       dword rangeEnd, dword rangeStart);
/*
 *	Set: the character background gray screen
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_CHAR_BG_PATTERN(@stack
                    GraphicPattern hatch,
                                       dword rangeEnd, dword rangeStart);
/*
 *	Set: the character background pattern
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_TRACK_KERNING(@stack
                    BBFixed trackKerning,
                                       dword rangeEnd, dword rangeStart);
/*
 *	Set: the track kerning value
 */

/*--------------------------------------------------------------------------
 *		Other character attributes (charAttrs) messages
 *--------------------------------------------------------------------------*/

typedef WordFlags VisTextCharAttrFlags ;
#define VTCAF_MULTIPLE_FONT_IDS 		0x8000
#define VTCAF_MULTIPLE_POINT_SIZES 	0x4000
#define VTCAF_MULTIPLE_COLORS 		0x2000
#define VTCAF_MULTIPLE_GRAY_SCREENS 	0x1000
#define VTCAF_MULTIPLE_PATTERNS 		0x0800
#define VTCAF_MULTIPLE_TRACK_KERNINGS 	0x0400
#define VTCAF_MULTIPLE_FONT_WEIGHTS 	0x0200
#define VTCAF_MULTIPLE_FONT_WIDTHS 	0x0100
#define VTCAF_MULTIPLE_BG_COLORS 	0x0080
#define VTCAF_MULTIPLE_BG_GRAY_SCREENS 	0x0040
#define VTCAF_MULTIPLE_BG_PATTERNS 	0x0020
#define VTCAF_MULTIPLE_STYLES 		0x0010

typedef struct {
    VisTextCharAttrFlags	VTCAD_diffs;
    VisTextExtendedStyles	VTCAD_extendedStyles;
    TextStyle			VTCAD_textStyles;
    byte			VTCAD_unused;
} VisTextCharAttrDiffs} ;

typedef WordFlags VisTextGetAttrFlags ;
#define VTGAF_MERGE_WITH_PASSED 	    0x8000
/*
 * If set, merge the attributes for this object with the passed attributes
 */

/***************************************************************************/

@message word MSG_VIS_TEXT_GET_CHAR_ATTR(@stack VisTextGetAttrFlags flags,
                     VisTextCharAttrDiffs *diffs,
                     VisTextCharAttr *attrs,
                                            dword rangeEnd,
                     dword rangeStart) = ax;
/*
 * 	Return the VisTextCharAttr structure for the specified range.
 *	PASS:
 *	    	attrs - pointer to buffer to hold VisTextCharAttrs
 *	    	diffs - pointer to buffer to hold VisTextCharAttrDiffs
 *	RETURN:
 *	    	VisTextCharAttr token (0 if multiple)
 *	    	buffers filled in
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_ADD_CHAR_ATTR(@stack VisTextCharAttr *attrs) = ax;
/*
 * 	Add a given charAttr to the charAttr array and initialize its
 * 	reference count to one.
 *	Pass:	attrs  - pointer to VisTextCharAttr to add
 *	Return:	 VisTextCharAttr token
 *	Compat:	This method cannot be used on a text object that does not have
 *		multiple charAttrs
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_REMOVE_CHAR_ATTR (word attrToken = cx);
/*
 *	Remove a given charAttr from the charAttr array.
 *	Pass:	attrToken  - token of VisTextCharAttr to remove
 *	Compat:	This method cannot be used on a text object that does not have
 *		multiple charAttrs
 */

/*---------------------------------------------------------------------------
 * 	Messages to set paragraph attributes (paraAttrs)
 *--------------------------------------------------------------------------*/

/*
 * Each of these messages takes a structure that indicates the range of text
 * to change and the values to change it to.
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_PARA_ATTR_BY_DEFAULT(@stack
                     VisTextDefaultParaAttr defParaAttrs,
                                            dword rangeEnd, dword rangeStart);
/*
 *	Set: the entire paraAttr structure via a default paraAttr
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_PARA_ATTR(@stack
                     VisTextParaAttr *newParaAttrs,
                                            dword rangeEnd, dword rangeStart);
/*
 *	Set: the entire paraAttr structure via a VisTextParaAttr structure
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_PARA_ATTR_BY_TOKEN(@stack
                          word paraAttrToken,
                                             dword rangeEnd, dword rangeStart);
/*
 *	Set: the entire paraAttr structure via a VisTextParaAttr token
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_BORDER_BITS(@stack
                       VisTextParaBorderFlags bitsToClear,
                       VisTextParaBorderFlags bitsToSet,
                                              dword rangeEnd, dword rangeStart);
/*
 *	Set: the border bits
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_BORDER_WIDTH(@stack byte width,
                                              dword rangeEnd, dword rangeStart);
/*
 *	Set: the border width
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_BORDER_SPACING(@stack byte width,
                                              dword rangeEnd, dword rangeStart);
/*
 *	Set: the border spacing
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_BORDER_SHADOW(@stack byte width,
                                              dword rangeEnd, dword rangeStart);
/*
 *	Set: the border shadow
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_BORDER_COLOR(@stack
                       ColorQuad color,
                                              dword rangeEnd, dword rangeStart);
/*
 *	Set: the border color
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_BORDER_GRAY_SCREEN(
                    @stack SystemDrawMask grayScreen,
                                       dword rangeEnd, dword rangeStart);
/*
 *	Set: the border gray screen
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_BORDER_PATTERN(@stack
                    GraphicPattern hatch,
                                       dword rangeEnd, dword rangeStart);
/*
 *	Set: the border pattern
 */

/***************************************************************************/

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_PARA_ATTRIBUTES(@stack
                  VisTextParaAttrAttributes bitsToClear,
                  VisTextParaAttrAttributes bitsToSet,
                                     dword rangeEnd, dword rangeStart);
/*
 *	Set: the paragraph attribtues (justification, ...)
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_LINE_SPACING(@stack BBFixed lineSpacing,
                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the line spacing
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_DEFAULT_TABS(@stack word defaultTabs,
                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the default tabs
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_LEFT_MARGIN(@stack
                        word position, /* points * 8 */
                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the left margin
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_RIGHT_MARGIN(@stack
                        word position, /* points * 8 */
                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the right margin
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_PARA_MARGIN(@stack
                        word position, /* points * 8 */
                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the paragraph margin
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_LEFT_AND_PARA_MARGIN(@stack
                        word position, /* points * 8 */
                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the left and the paragraph margin
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_SPACE_ON_TOP(@stack BBFixed spacing,
                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the space on top
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_SPACE_ON_BOTTOM(@stack BBFixed spacing,
                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the space on bottom
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_LEADING(@stack
                        word leading, /* points * 8 */
                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the leading
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_PARA_BG_COLOR(@stack ColorQuad color,
                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the paragraph background color
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_PARA_BG_GRAY_SCREEN(@stack
                     SystemDrawMask grayScreen,
                        dword rangeEnd, dword rangeStart);
/*
 *	Set: the paragraph background gray screen
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_PARA_BG_PATTERN(@stack
                    GraphicPattern hatch,
                    dword rangeEnd, dword rangeStart);
/*
 *	Set: the paragraph background pattern
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_TAB(@stack Tab tab,
                    dword rangeEnd, dword rangeStart);
/*
 *	Set: a tab
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_CLEAR_TAB(@stack word position, /* points * 8 */
                    dword rangeEnd, dword rangeStart);
/*
 *	Set: Clear a tab
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_MOVE_TAB(@stack
                     word destPosition,     /* points * 8 */
                     word sourcePosition,   /* points * 8 */
                     dword rangeEnd, dword rangeStart);
/*
 *	Set: Move a tab
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_CLEAR_ALL_TABS(@stack
                      dword rangeEnd, dword rangeStart);
/*
 *	Set: Clear all tabs
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_PREPEND_CHARS(@stack
                     char prependChars[4], /* XXX */
                     dword rangeEnd, dword rangeStart);
/*
 *	Set: The characters to prepend at the start of a paragraph
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_HYPHENATION_PARAMS(@stack
                VisTextHyphenationInfo bitsToSet,
                VisTextHyphenationInfo bitsToClear,
                dword rangeEnd, dword rangeStart);
/*
 *	Set: The hyphenation parameters
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_DROP_CAP_PARAMS(@stack
                        VisTextDropCapInfo bitsToSet,
                        VisTextDropCapInfo bitsToClear,
                            dword rangeEnd, dword rangeStart);
/*
 *	Set: The drop cap parameters
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_KEEP_PARAMS(@stack
                               VisTextKeepInfo bitsToSet,
                        VisTextKeepInfo bitsToClear,
                            dword rangeEnd, dword rangeStart);
/*
 *	Set: The keep (lines together) parameters
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_PARAGRAPH_NUMBER(@stack
                        word startingParaNumber,
                            dword rangeEnd, dword rangeStart);
/*
 *	Set: The paragraph number
 */

/*--------------------------------------------------------------------------
 *	Other character attributes (charAttrs) messages
 *--------------------------------------------------------------------------*/

typedef WordFlags VisTextParaAttrFlags ;
#define VTPAF_MULTIPLE_LEFT_MARGINS 		0x8000
#define VTPAF_MULTIPLE_RIGHT_MARGINS 		0x4000
#define VTPAF_MULTIPLE_PARA_MARGINS 		0x2000
#define VTPAF_MULTIPLE_LINE_SPACINGS 		0x1000
#define VTPAF_MULTIPLE_DEFAULT_TABS 		0x0800
#define VTPAF_MULTIPLE_TOP_SPACING 		0x0400
#define VTPAF_MULTIPLE_BOTTOM_SPACING 		0x0200
#define VTPAF_MULTIPLE_LEADINGS 			0x0100
#define VTPAF_MULTIPLE_BG_COLORS 		0x0080
#define VTPAF_MULTIPLE_BG_GRAY_SCREENS 		0x0040
#define VTPAF_MULTIPLE_BG_PATTERNS 		0x0020
#define VTPAF_MULTIPLE_TAB_LISTS 		0x0010
#define VTPAF_MULTIPLE_STYLES 			0x0008
#define VTPAF_MULTIPLE_PREPEND_CHARS 		0x0004
#define VTPAF_MULTIPLE_STARTING_PARA_NUMBERS 	0x0002
#define VTPAF_MULTIPLE_NEXT_STYLES 		0x0001

typedef WordFlags VisTextParaAttrFlags2 ;
#define VTPAF2_MULTIPLE_LANGUAGES 		0x8000

typedef WordFlags VisTextParaAttrBorderFlags ;
#define VTPABF_MULTIPLE_BORDER_LEFT 		0x8000
#define VTPABF_MULTIPLE_BORDER_TOP 		0x4000
#define VTPABF_MULTIPLE_BORDER_RIGHT 		0x2000
#define VTPABF_MULTIPLE_BORDER_BOTTOM 		0x1000
#define VTPABF_MULTIPLE_BORDER_DOUBLES 		0x0800
#define VTPABF_MULTIPLE_BORDER_DRAW_INNERS 	0x0400
#define VTPABF_MULTIPLE_BORDER_ANCHORS 		0x0200
#define VTPABF_MULTIPLE_BORDER_WIDTHS 		0x0100
#define VTPABF_MULTIPLE_BORDER_SPACINGS 		0x0080
#define VTPABF_MULTIPLE_BORDER_SHADOWS 		0x0040
#define VTPABF_MULTIPLE_BORDER_COLORS 		0x0020
#define VTPABF_MULTIPLE_BORDER_GRAY_SCREENS 	0x0010
#define VTPABF_MULTIPLE_BORDER_PATTERNS 	    	0x0008

typedef struct {
    VisTextParaAttrFlags	VTPAD_diffs;
    VisTextParaAttrFlags2	VTPAD_diffs2;
    VisTextParaAttrBorderFlags	VTPAD_borderDiffs;
    VisTextParaAttrAttributes	VTPAD_attributes;
    VisTextHyphenationInfo	VTPAD_hyphenationInfo;
    VisTextKeepInfo		VTPAD_keepInfo;
    VisTextDropCapInfo		VTPAD_dropCapInfo;
} VisTextParaAttrDiffs} ;

/***************************************************************************/

@message word MSG_VIS_TEXT_GET_PARA_ATTR(@stack
                     VisTextGetAttrFlags flags,
                     VisTextParaAttrDiffs *diffs,
                     VisTextMaxParaAttr *attrs,
                     dword rangeEnd,
                     dword rangeStart) = ax;
/*
 *	Return the paraAttr structure for the specified range.
 */

/***************************************************************************/

@message word MSG_VIS_TEXT_ADD_PARA_ATTR(@stack VisTextParaAttr attrs) = ax;
/*
 *	Add a given paraAttr to the paraAttr array and initialize
 *	its reference count to one.
 *
 *	PASS:	attrs - VisTextParaAttr structure
 *	RETURN:	VisTextParaAttr token
 *	COMPAT:	This method cannot be used on a text object that does not
 *		have multiple paraAttrs
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_REMOVE_PARA_ATTR (word token = cx);
/*
 *	Remove a given paraAttr from the paraAttr array.
 *
 *	PASS:	token - token of VisTextParaAttr to remove
 *	RETURN:	nothing
 *	COMPAT:	This method cannot be used on a text object that does not
 *		have multiple paraAttrs
 */

/*---------------------------------------------------------------------------
 *		Messages to deal with style sheets
 *--------------------------------------------------------------------------*/

/***************************************************************************/

@message void MSG_VIS_TEXT_SUBST_ATTR_TOKEN(@stack
                        Boolean *recalcFlag,
                        Boolean relayed,
                        Boolean updateRefFlag,
                        word runOffset,
                        word newToken,
                        word oldToken);
/*
 * Substitute an attribute token as part of a style sheet change.  This message
 * exists to allow a higher level manager to pass this message to all text
 * objects sharing the same attribute arrays (and thus the same styles)
 *
 *	PASS:	recalcFlag - pointer to a Boolean flag
 *		relayed	- TRUE is relayed to like objects
 *		updateRefFlag - TRUE to update element references
 *		runOffset - offset of run array
 *		newToken - new token
 *		oldToken - old token to replace
 *	RETURN: *recalcFlag is TRUE if recalc needed
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_RECALC_FOR_ATTR_CHANGE (Boolean relayed = cx);
/*
 * Recalculate text objects as part of a style sheet change.  This message
 * exists to allow a higher level manager to pass this message to all text
 * objects sharing the same attribute arrays (and thus the same styles)
 *
 *	PASS:	relayed - TRUE if this message has been relayed to
 *		like text objects.
 *	RETURN: nothing
 */

/*---------------------------------------------------------------------------
 *		Messages to set type information
 *--------------------------------------------------------------------------*/

/*
 *	Definition of a text type element.  The hyperlinkName,
 *	hyperlinkFile, and context fields are name array element tokens,
 *	or -1 for none.
 */
typedef struct {
    RefElementHeader	VTT_meta;
    word		VTT_hyperlinkName; /* name array element (-1 = none) */
    word		VTT_hyperlinkFile; /* name array element (-1 = none) */
    word		VTT_context;	   /* name array element (-1 = none) */
    byte		VTT_unused[1];
} VisTextType} ;

typedef ByteFlags VisTextSetContextFlags ;
#define VTCF_TOKEN 	  			0x01
                /* TRUE: context and hyperlink are tokens */
#define VTCF_SHOWING_HYPERLINKS  		0x02
                /* TRUE: hyperlinks are shown in boxed style */
#define	VTCF_REDIRECT_HYPERLINKS			0x04
                /* TRUE: take hyperlinks pointing
                 *       to the context currently
                 *       set on passed range and
                 *       redirect them to point to
                 *       the context now being set */
#define VTCF_ENSURE_CONTEXT_NOT_ALREADY_SET 	0x08
                /* TRUE: before setting context, make sure
                 *       it's  not already set somewhere */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_HYPERLINK(@stack
                     VisTextSetContextFlags flags,
                     word file,
                             word context,
                     dword rangeEnd, dword rangeStart);
/*
 * 	Set: the hyperlink
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_CONTEXT(@stack
                     VisTextSetContextFlags flags,
                             word context,
                     dword rangeEnd, dword rangeStart);
/*
 * Set the context for the specified range.
 *
 * Context:	Sent when context index or token is available to pass.
 * 		See also MSG_VIS_TEXT_SET_CONTEXT_GIVEN_NAME_TEXT.
 * Source:	Hyperlink controller, TextHelp controller
 * Destination:	Text object
 * Interception: May be intercepted.
 *
 */

@reserveMessages	    1;

typedef WordFlags VisTextTypeDiffs ;
#define VTTF_MULTIPLE_HYPERLINKS 	0x8000
#define VTTF_MULTIPLE_CONTEXTS 		0x4000

/***************************************************************************/

@message TokenAsDWord MSG_VIS_TEXT_GET_TYPE(@stack
                       VisTextGetAttrFlags flags,
                       VisTextTypeDiffs *diffs,
                       VisTextType *type,
                       dword rangeEnd,
                       dword rangeStart) = dx.ax;
/*
 *  Return the type for the specified range.
 *	PASS:
 *	RETURN:	buffer filled in
 *	   	TokenAsDWord
 * 		  Use DWORD_TOKEN to get the type token (0 if multiple)
 *		  and DWORD_DATA to get VisTextTypeDiffs
 *	COMPAT:	This method cannot be used on a text object that does not have
 *		multiple types or does not have a name array
 */

/**************************************************************************/

@message word MSG_VIS_TEXT_ADD_TYPE(@stack VisTextType type) = ax;
/*
 * 	Add a given type to the type array and initialize its reference
 *	count to one, and return its token.
 *
 *	    PASS:   type    - VisTextType to add
 *	    RETURN: token   - type token
 *	    COMPAT: This method cannot be used on a text object that
 *	    	    does not have multiple types.
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REMOVE_TYPE (word token = cx);
/*
 * 	Remove a given type from the type array.
 *	    PASS: token - token of the type to remove
 *	    COMPAT: This method cannot be used on a text object that
 *	    	    does not have multiple types.
 */

/*---------------------------------------------------------------------------
 * 	    Messages to set name information
 *--------------------------------------------------------------------------*/
/*
 *	 "Token" for names & types in the current file
 */
#define VIS_TEXT_CURRENT_FILE_TOKEN 	-1

typedef ByteEnum VisTextNameType ;
#define	VTNT_CONTEXT		0
#define VTNT_FILE    	1

typedef ByteEnum VisTextContextType ;
#define VTCT_TEXT    	0
#define VTCT_CATEGORY 	1
#define VTCT_QUESTION 	2
#define VTCT_ANSWER  	3
#define VTCT_DEFINITION 	4
#define VTCT_FILE    	255

typedef struct {
    VisTextNameType 	VTND_type;
    VisTextContextType	VTND_contextType;
    word    	    	VTND_file;
    DBGroupAndItem  	VTND_helpText;
} VisTextNameData} ;

/**************************************************************************/

@message TokenAsDWord MSG_VIS_TEXT_ADD_NAME(@stack
                    char *name,
                    word  size,
                    NameArrayAddFlags flags,
                    VisTextNameData data) = dx.ax;
/*
 * 	Add a name to the name array (or add a reference to an existing name).
 *	Set the data for the name to the given data.
 *
 *	PASS:	name - pointer to name to add
 *		size - length of name (0 for NULL-terminated)
 *		flags - NameArrayAddFlags
 *		data - VisTextNameData to add for the name
 *
 *	RETURN:	TokenAsDWord
 * 		Use DWORD_TOKEN to get the new token
 *		and DWORD_DATA to get a word which is non-zero if the name
 *		was newly added.
 */

/**************************************************************************/

@message word MSG_VIS_TEXT_FIND_NAME(@stack
                     char *name,
                     word size,
                     VisTextnameData *data) = ax;
/*
 *	Find a name in the name array.
 *
 *	PASS:	name - pointer to name to find
 *	    	size - length of name (0 if NULL-terminated)
 *	    	data - pointer to VisTextNameData buffer for data (0 if none)
 *
 *	RETURN:	token, or CA_NULL_ELEMENT if not found.
 *
 *	COMPAT:	This method cannot be used on a text object that does not have
 *		multiple types
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_FIND_NAME_BY_TOKEN (word token = bp,
                      NameArrayMaxElement *buffer = cx:dx);
/*
 *	Return the data for a name token.
 *
 *	PASS:	token - token of name to return data for
 *	    	buffer - NameyArrayMaxElement buffer to fill in
 *	RETURN:	buffer filled
 *	COMPAT:	This method cannot be used on a text object that does not have
 *		multiple types
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_ADD_REF_FOR_NAME (word token = cx);
/*
 *	Add a reference for a name.
 *
 *	Pass:	token - token of name to add reference for
 *	Return:	nothing
 *	Compat:	This method cannot be used on a text object that does not have
 *		multiple types
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REMOVE_NAME (word token = cx);
/*
 *	Remove a given name from the name array.
 *
 *	Pass:	token - token of name to remove
 *	Return:	nothing
 *	Compat:	This method cannot be used on a text object that does not have
 *		multiple types
 */

/*--------------------------------------------------------------------------
 * 	    Messages to set graphic information
 *--------------------------------------------------------------------------*/

/*
 * "graphics" are a general purpose mechanism to embed things in the text
 * stream.  Graphics can have data stored several ways:
 *   * vm chains
 *   * db items
 *   * lmem chunks -- this format is not supported for cut/copy/paste
 *
 * graphics can be of several types
 *   * gstrings -- handled automatically
 *   * annotations -- handled automatically   *** NOT YET SUPPORTED ***
 *   * custom
 *
 * Graphics are treated as characters, and thus reasonably small graphics can
 * be in the middle of a line of text.
 *
 */

/*
 *	Size of opaque structure in VisTextGraphic
 */
#define VIS_TEXT_GRAPHIC_OPAQUE_SIZE 	32

/*
 *	Types of graphics
 */
typedef ByteEnum VisTextGraphicType ;
#define VTGT_GSTRING  0
#define VTGT_VARIABLE  1

/*
 *	Flags for graphics
 */
typedef WordFlags VisTextGraphicFlags ;

#define VTGF_DRAW_FROM_BASELINE 	    0x8000
    /*  	Draw from baseline if set, else draw from top */
#define VTGF_HANDLES_POINTER 	    0x4000
    /* 	Graphic can deal with pointer messages */
#define VTGF_HOT_SPOT 	    	    0x2000
    /* 	This GString graphic defines a hot spot */

/*
 *	Type dependent data
 *
 * VTGT_GSTRING: gstring
 *	VTG_opaque = VisTextGraphicGString
 */
typedef struct {
    TransMatrix	VTGG_tmatrix;
    XYOffset	VTGG_drawOffset;
} VisTextGraphicGString} ;

/*
 * VTGT_VARIABLE: message sent to object.  See documentation below.
 *	VTG_opaque = VisTextGraphicVariable
 */
typedef struct {
    ManufacturerID	VTGV_manufacturerID;
    VisTextVariableType	VTGV_type;
    byte		VTGV_privateData[VIS_TEXT_GRAPHIC_OPAQUE_SIZE-4];
} VisTextGraphicVariable} ;

typedef union {
    VisTextGraphicGString	VTGD_gstring;
    VisTextGraphicVariable	VTGD_variable;
    byte			VTGD_opaque[VIS_TEXT_GRAPHIC_OPAQUE_SIZE];
} VisTextGraphicData} ;

/*
 *	Definition of a text graphic element.
 */
typedef struct {
    RefElementHeader	VTG_meta;
    dword	    	VTG_vmChain;	   /* This is a dword value to pass
                                * to the VMChain routines.
                        *
                        * If only the low word is 0,
                        * then the high word is a VM
                        * handle.
                        *
                        * If both are non-zero, it is
                        * a DB item (high word is group
                        * and low word is item)
                        *
                        * If the high word is 0, then the
                        * low word is an LMemChunk.
                        *
                        * If both are 0, there is no data.
                        */

    XYSize		VTG_size;   	/* Size of graphic (0 if dynamic) */
    VisTextGraphicType	VTG_type;
    VisTextGraphicFlags	VTG_flags;
    byte		VTG_reserved[4];
    VisTextGraphicData	VTG_data;
} VisTextGraphic} ;

#define VIS_TEXT_DEFAULT_GRAPHIC_WIDTH 	10
#define VIS_TEXT_DEFAULT_GRAPHIC_HEIGHT 	10

/****************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_WITH_GRAPHIC(@stack
                        VisTextGraphic graphic,
                        word sourceFile,
                        word pasteFrame,
                           dword rangeEnd,
                           dword rangeStart);
/*
 *	Replace the given range with a graphic.
 *
 *	Pass:	graphic - VisTextGraphic
 *		sourceFile - source VM file
 *		pasteFrame - pointer to frame if quick paste,
 *					0 otherwise
 *	Compat:	As described above, only text objects stored in vm files can
 *		paste in graphics stored in vm blocks.
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_GET_GRAPHIC_AT_POSITION(@stack
                VisTextGraphic *retPtr, dword position);
/*
 *	Get the VisTextGraphic structure corresponding to a graphic
 *	at the passed position.
 */

/****************************************************************************/
@message SizeAsDWord MSG_VIS_TEXT_GRAPHIC_VARIABLE_SIZE (
                GStateHandle gstate = cx,
                VisTextGraphic *graphic = dx:bp) = dx.cx;
/*
 * 	Find the size of a variable graphic.  The default handler for
 *	this sends a MSG_GEN_DOCUMENT_GET_VARIABLE up the visual tree
 *	(via MSG_VIS_VUP_CALL_OBJECT_OF_CLASS).
 *
 *	Pass:	gstate - GStateHandle
 *		graphic - VisTextGraphic to find size of.
 *
 *	Return:	SizeAsDWord
 *		Use DWORD_WIDTH and DWORD_HEIGHT to get width, height
 */

/****************************************************************************/

@message SizeAsDWord MSG_VIS_TEXT_GRAPHIC_VARIABLE_DRAW (
                GStateHandle gstate = cx,
                VisTextGraphic *graphic = dx:bp) = dx.cx;
/*
 * 	Draw a variable graphic.  The default handler for
 *	this sends a MSG_GEN_DOCUMENT_GET_VARIABLE up the visual tree
 *	(via MSG_VIS_VUP_CALL_OBJECT_OF_CLASS).
 *
 *	Pass:	GStateHandle gstate - gstate with font and current position set
 *		VisTextGraphic graphic
 *
 *	Return:	SizeAsDWord
 *		Use DWORD_WIDTH and DWORD_HEIGHT to get width, height
 */

/*
 *	Not yet implemented...........
 */
@message void MSG_VIS_TEXT_GRAPHIC_VARIABLE_START_SELECT (); /* NEEDS PROTOTYPE */
@message void MSG_VIS_TEXT_GRAPHIC_VARIABLE_OPEN (); /* NEEDS PROTOTYPE */
@message void MSG_VIS_TEXT_GRAPHIC_VARIABLE_CLOSE (); /* NEEDS PROTOTYPE */

/*
 * Utility routine for compressing graphics
 */

extern VMChain
   _pascal VisTextGraphicCompressGraphic (VisTextGraphic *graphic,
                     FileHandle sourceFile,
                     FileHandle destFile,
                     BMFormat format,
                     byte compressFlag,
                     word xRes, word yRes);
/*
 * Copy a VisTextGraphic GString to a new GString, optimizing its bitmaps
 * along the way.
 *
 *	Pass:	graphic - pointer to the VisTextGraphic element
 *	    	    	  whose gstring is to be compressed.
 *	    	sourceFile - file containing the graphic's gstring
 *	    	destFile - file to create the new gstring in
 *	    	format - BMFormat to convert all bitmaps to
 *	    	compressFlag - non-zero to compress bitmaps
 *	        xRes - x Resolution to convert all bitmaps to
 *	        yRes - y Resolution to convert all bitmaps to
 *
 *	Return: VMChain of new GString
 */

/*---------------------------------------------------------------------------
 *	Utility routine for format numbers
 *--------------------------------------------------------------------------*/

extern void
    _pascal VisTextFormatNumber (char *buf, dword num, VisTextNumberType numtype);
/*
 * 	Format a number into a buffer.
 * 	This routine is commonly used by handlers for variable graphics.
 *	  PASS:
 *		char *buf - pointer to buffer
 *		dword num - number to format
 *		VisTextNumberType numType - format to use
 */

/*---------------------------------------------------------------------------
 *	Messages to load and save data in text objects.
 *--------------------------------------------------------------------------*/

/*
 * 	These data structures are used to store a text object in a DBItem.
 * 	Do not use these unless absolutely necessary.
 */

typedef ByteEnum VisTextSaveType ;
#define	VTST_NONE	 		0	/* nothing saved */
#define VTST_SINGLE_CHUNK  	1	/* single attr structure */
#define VTST_RUNS_ONLY  		2
#define VTST_RUNS_AND_ELEMENTS  	3

typedef WordFlags VisTextSaveDBFlags ;
#define VTSDBF_TEXT  	    0x8000	/* set if text saved (0 = null text) */
#define VTSDBF_CHAR_ATTR     0x6000
#define VTSDBF_PARA_ATTR     0x1800
#define VTSDBF_TYPE  	    0x0600
#define VTSDBF_GRAPHIC  	    0x0180
#define VTSDBF_STYLE  	    0x0040
#define VTSDBF_REGION  	    0x0020 	/* not currently implemented */
#define VTSDBF_NAME  	    0x0010

#define VTSDBF_CHAR_ATTR_OFFSET 	13
#define VTSDBF_PARA_ATTR_OFFSET 	11
#define VTSDBF_TYPE_OFFSET   	9
#define VTSDBF_GRAPHIC_OFFSET   	7

/**************************************************************************/

@message DBGroupAndItem MSG_VIS_TEXT_SAVE_TO_DB_ITEM (
                    DBGroupAndItem item = cx.dx,
                    VisTextSaveDBFlags flags = bp) = cx.dx;
/*
 *	Save a text object to a DB item.
 *
 *	PASS:
 *		item - DBGroupAndItem to save to (or 0 to allocate)
 *		flags - VisTextSavedDBFlags
 */

@alias (MSG_VIS_TEXT_SAVE_TO_DB_ITEM) DBGroupAndItem
    MSG_VIS_TEXT_SAVE_TO_DB_GROUP_ITEM(DBGroup group = cx,
                    DBItem item = dx,
                    VisTextSaveDBFlags flags = bp) = cx.dx;

/**************************************************************************/

typedef struct {
    StyleSheetParams	VTSSSP_common;
    word		VTSSSP_graphicsElements;
/* 	VMBlock of graphics elements */

    word		VTSSSP_treeBlock;
    word		VTSSSP_graphicTreeOffset;
/* 	offset in treeBlock */
} VisTextSaveStyleSheetParams} ;

/**************************************************************************/

@message DBGroupAndItem MSG_VIS_TEXT_SAVE_TO_DB_ITEM_WITH_STYLES(@stack
                    FileHandle xferFile,
                    VisTextSaveDBFlags flags,
                    DBGroupAndItem item,
                    VisTextStyleSheetParams *params);
/*
 * Save a text object to a DB item, passing a StyleSheetParams structure.
 *
 * This message is intended for applications that have multiple text objects
 * sharing common attribute structures.  Only VTST_RUNS_ONLY should be passed
 * for charAttr and paraAttr (and likely type and graphic) and normally
 * VTST_STYLE will not be passed.
 *
 * 	PASS:	xferFile - if non-zero then the StyleSheetParams
 *			    are not initialized and this is the
 *			    file to put the arrays in.
 *		flags - VisTextSavedDBFlags
 *		item - DBGroupAndItem to save to (0 to allocate one)
 *		params - StyleSheetParams
 *
 * 	RETURN: saved DBGroupAndItem
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_LOAD_FROM_DB_ITEM (DBGroupAndItem item = cx.dx,
                         VMFileHandle file = bp);
/*
 * 	Load a text object from a DBItem.
 *
 *	PASS:	item - DBGroupAndItem to load from
 *		file - VMFileHandle to use (or 0 to use the
 *			file associated with the text object)
 */

@alias (MSG_VIS_TEXT_LOAD_FROM_DB_ITEM) void
    MSG_VIS_TEXT_LOAD_FROM_DB_GROUP_ITEM(DBGroup group = cx,
                        DBItem item = dx,
                        VMFileHandle file = bp);

/***************************************************************************/

@message void MSG_VIS_TEXT_LOAD_FROM_DB_ITEM_WITH_STYLES(@stack
                    FileHandle file,
                    DBGroupAndItem item,
                    StyleSheetParams *params);
/*
 * 	Load a text object from a DBItem, passing a
 *	StyleSheetParams structure.
 *
 *	PASS: 	file - VMFileHandle to use (or 0 to use the
 *			file associated with the text object)
 *		item - DBGroupAndItem to load from
 *		params - StyleSheetParams
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_VM_FILE (VMFileHandle file = cx);
/*
 *	Change the file handle with which the text object is associated.
 *
 *	PASS: 	file - FileHandle of file to associate with text object
 *	RETURN: nothing
 */

/*--------------------------------------------------------------------------
 *	Messages to create and destroy the data structures used to store
 *	attributes
 *-------------------------------------------------------------------------*/

/****************************************************************************/

@message void MSG_VIS_TEXT_CREATE_STORAGE (VisTextStorageFlags flags = cl,
                      byte regionFlag = ch);
/*
 *	Create storage structures for a text object.  Note that
 *	additional levels of attribute storage can only be *set*.
 *
 *	These bits can be set:
 *		VTSF_MULTIPLE_CHAR_ATTRS, VTSF_MULTIPLE_PARA_ATTRS,
 *		VTSF_TYPES, VTSF_GRAPHICS
 *
 * 	PASS: 	flags - VisTextStorage flags to set
 *		regionFlag - non-zero to create regions
 * 	RETURN: nothing
 * 	COMPAT: Can be used with small or large objects as long as the
 *		object does not already have the structures to be added.
 */

/****************************************************************************/

typedef struct {
  VisTextStorageFlags	VTCEAP_storageFlags;	/* cl */
  byte			VTCEAP_blockOrChunk;	/* ch */
} VisTextChangeElementArrayParams} ;

@message void MSG_VIS_TEXT_CHANGE_ELEMENT_ARRAY (
                VisTextChangeElementArrayParams params = cx,
                word arrayHandle = dx,
                word token = bp);
/*
 *	Change the element array being used for the text object.  This
 *	allows an application to easily set up multiple objects referencing
 *	common element arrays.
 *
 *	If you are changing multiple arrays, do the name and style arrays
 *	first because to change the element array the text object must free
 *	the old element array. To do this it must know how this array is
 *	stored (with chunk or VM block). It does this by looking at the
 *	character attributes and assuming that the styles/names are stored
 *	in the same way.  Thus we must change the styles/names while the
 *	character attributes are still stored in a chunk so that the old
 *	style/name array will be freed correctly.
 *
 * PASS:
 *	flags - VisTextStorageFlags for field to replace.
 *		One of these bits should be set:
 *
 *			VTSF_MULTIPLE_CHAR_ATTRS
 *			VTSF_MULTIPLE_PARA_ATTRS
 *			VTSF_TYPES
 *			VTSF_GRAPHICS
 *			VTSF_STYLES
 *			VTSF_NAMES
 *
 *	blockOrChunk - non-zero if value passed in arrayHandle is
 *			a VM block, zero if it is a chunk handle
 *	arrayHandle - VM block handle or chunk handle containing
 *			element array (depends on blockOrChunk)
 *	token  - token for empty run to cover object (char, para, type)
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_FREE_STORAGE (Boolean removeElementArrays = cx);
/*
 *	Remove all runs associated with this object.
 *	Basically all elements which are referred to have their reference
 *	counts decremented and if the reference counts go to zero, the
 *	elements are removed.
 *	Use caution with this method.
 *
 *	PASS:	removeElementArrays - TRUE to remove element arrays also
 *	RETURN:	nothing
 */

/*--------------------------------------------------------------------------
 *	Messages to create and manipulate transfer items
 *-------------------------------------------------------------------------*/
/*
 *
 *		Structure of a transfer item (TIF_TEXT)
 *
 * Note that some of the blocks in the tree are lmem blocks.  For VM chains the
 * first word of a block must be the VM block handle of the next linked data
 * block.  For the lmem code, the first word must be the block handle.
 * Also, the HF_LMEM bit in the handle must be set for the lmem code, but it
 * must not be set for the clipboard.
 *
 * To handle this conflict, the text object clears the HF_LMEM bit and stuffs
 * the VM block handle link (always 0 for now) before calling the clipboard.
 * When it gets a block from the clipboard, the text object locks it and
 * temporarily sets the HF_LMEM bit.
 *
 * The element arrays in lmem blocks use the chunk handle
 * "VM_ELEMENT_ARRAY_CHUNK" defined below.
 *
 */

#define VM_ELEMENT_ARRAY_CHUNK 	(((sizeof(LMemBlockHeader)) + 3) & ~3)

typedef struct {
    VMChainTree	TTBH_meta;
    word	TTBH_reservedOther[20];
    VMChain	TTBH_text;
    VMChain	TTBH_charAttrRuns;
    VMChain	TTBH_paraAttrRuns;
    VMChain	TTBH_typeRuns;
    VMChain	TTBH_graphicRuns;
    VMChain	TTBH_charAttrElements;
    VMChain	TTBH_paraAttrElements;
    VMChain	TTBH_typeElements;
    VMChain	TTBH_graphicElements;
    VMChain	TTBH_styles;
    VMChain	TTBH_names;
    VMChain	TTBH_pageSetup;
    VMChain	TTBH_reservedVM[10];
} TextTransferBlockHeader} ;

/*
 *	The following structure is plugged into the TTBH_pageSetup field
 *	by apps during an export.
 */
typedef struct {
    VMChainLink	PSI_meta;
    XYSize  	PSI_page;
    PageLayout  PSI_layout;
    word    	PSI_numColumns;
    word    	PSI_columnSpacing;  	/* Points * 8 */
    word    	PSI_ruleWidth;		/* Pixels (points) */
/* The margins are relative to the edges of the page */
    word    	PSI_leftMargin;	    	/* Points * 8 */
    word    	PSI_rightMargin;    	/* Points * 8 */
    word    	PSI_topMargin;	    	/* Points * 8 */
    word    	PSI_bottomMargin;   	/* Points * 8 */
} PageSetupInfo} ;

/***************************************************************************/

extern 	void	/*XXX*/
    _pascal VTFClearSmartQuotes ();
/*
 *	Clear the variable that prohibits smart quotes.
 *
 *	PASS: 	nothing
 *	RETURN: nothing
 */

/***************************************************************************/

extern optr /*XXX*/
    _pascal TextAllocClipboardObject (VMFileHandle file,
                     VisTextStorageFlags storageFlags,
                          byte regionFlag);
/*
 * 	Allocate a temporary object associated with the clipboard file
 *	for purposes of producing a transfer item.
 *
 *	PASS:
 *		storageFlags - VisTextStorageFlags for object.
 *		    Only the following bits may be set:
 *			VTSF_MULTIPLE_CHAR_ATTRS
 *			VTSF_MULTIPLE_PARA_ATTRS
 *			VTSF_TYPES
 *			VTSF_GRAPHICS
 *			VTSF_STYLES
 *		     The following are assumed set if flags = 0:
 *		VTSF_LARGE, VTSF_DEFAULT_CHAR_ATTR, VTSF_DEFAULT_PARA_ATTR
 *
 *		regionFlag - non-zero to create regions for object
 *
 *		file - FileHandle of file with which to associate object,
 *			or 0 for clipboard file
 *	RETURN:
 *		optr - clipboard object
 */

typedef enum {
    TCO_COPY    ,
    TCO_RETURN_TRANSFER_FORMAT    ,
    TCO_RETURN_TRANSFER_ITEM    ,
    TCO_RETURN_NOTHING    ,
} TextClipboardOption} ;

/**************************************************************************/

extern VMBlockHandle	/*XXX*/
    _pascal TextFinishWithClipboardObject (optr obj, TextClipboardOption opt,
                                  optr owner, const char *name);
/*
 *	Finish with an object created by TextAllocClipboardObject
 *
 *	PASS:
 *		obj - optr
 *		opt - TextClipboardOption
 *		owner - optr of owner for clipboard item
 *		name - pointer to name for clipboard item (-1 for default)
 *
 * 	RETURN:
 *		object destroyed.
 *		Return value depends on value passed in opt:
 *		TCO_COPY			nothing; transfer item is
 *						generated from the object and
 *						set as the normal transfer item
 *		TCO_RETURN_TRANSFER_FORMAT	VM block handle to store in
 *						high word of TFI_vmChain (low
 *						word s/b 0)
 *		TCO_RETURN_TRANSFER_ITEM	VM block handle of block with
 *						TransferItemHeader and text
 *						rendered from the object in
 *						the appropriate formats
 *		TCO_RETURN_NOTHING		nothing. just destroys the
 *						text object.
 */

/**************************************************************************/

/*XXX*/
@message void MSG_VIS_TEXT_REPLACE_WITH_TEXT_TRANSFER_FORMAT(@stack
                    VMBlockHandle block,
                    VMFileHandle file, word pasteFrame,
                                        dword end, dword start);
/*
 *	Replace the given range with a text transfer item.  The range passed
 *	is the range to replace.  (0, 0) can be passed to insert and the
 *	beginning.  (TEXT_ADDRESS_PAST_END, TEXT_ADDRESS_PAST_END) can be
 *	passed to append at the end.
 *
 *	Pass:	block - VMBlockHandle
 *		file - VMFileHandle
 *		pasteFrame - ptr to frame if quick paste, 0 otherwise
 *		start, end - range to replace
 *	Return:	nothing
 */

/**************************************************************************/
/*XXX*/
@message VMBlockHandle MSG_VIS_TEXT_CREATE_TRANSFER_FORMAT(@stack
                    VMBlockHandle block,
                    VMFileHandle file, word pasteFrame,
                                        dword end, dword start) = ax;
/*
 *	Create a text transfer item for a range of text.
 *
 *	Pass:	block - VMBlockHandle
 *		file - VMFileHandle
 *		pasteFrame - ptr to frame if quick paste, 0 otherwise
 *		start, end - range to replace
 *
 *	Return:	VMBlockHandle of newly created transfer block
 */

/*--------------------------------------------------------------------------
 *	      Methods for modifying text in a text object
 *--------------------------------------------------------------------------*/

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_ALL_PTR (const char *text = dx:bp,
                       word textLen = cx);
/*
 * Replace the entire text of an object with text referenced by a pointer.
 *	PASS:	text	= Pointer to the text string
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_ALL_OPTR (optr o = dx:bp,
                       word textLen = cx);
/*
 * Replace the entire text of an object with text referenced by a chunk.
 *	PASS:	o	= Pointer to the text string
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_ALL_BLOCK (word block = dx,
                       word textLen = cx);
/*
 * Replace the entire text of an object with text referenced by a block.
 *	PASS:	block	= Pointer to the text string
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_ALL_VM_BLOCK (VMFileHandle file = dx,
                       VMBlockHandle block = bp,
                       word textLen = cx);
/*
 * Replace the entire text of an object with text referenced by a vm-block.
 *	PASS:	file	= file handle
 *		block	= vm block handle
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_ALL_DB_ITEM (VMFileHandle file = dx,
                       DBGroup group = bp,
                       DBItem item = cx);
/*
 * Replace the entire text of an object with text referenced by a db-item.
 * The text is assumed to be NULL terminated.
 *
 *	PASS:	file	= file handle
 *		group	= Group number
 *	    	item	= Item number
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_ALL_HUGE_ARRAY (VMFileHandle file = dx,
                       VMBlockHandle hugeArrayBlock = bp,
                       word textLen = cx);
/*
 * Replace the entire text of an object with text referenced by a huge-array.
 *
 *	PASS:	file	= file handle
 *		hugeArrayBlock	= HugeArray
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_SELECTION_PTR (const char *text = dx:bp,
                       word textLen = cx);
/*
 * Replace the selection of an object with text referenced by a pointer.
 *	PASS:	text	= Pointer to the text string
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_SELECTION_OPTR (optr o = dx:bp,
                       word textLen = cx);
/*
 * Replace the selection of an object with text referenced by a chunk.
 *	PASS:	o	= Pointer to the text string
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_SELECTION_BLOCK (word block = dx,
                       word textLen = cx);
/*
 * Replace the selection of an object with text referenced by a block.
 *	PASS:	block	= Pointer to the text string
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_SELECTION_VM_BLOCK (VMFileHandle file = dx,
                       VMBlockHandle block = bp,
                       word textLen = cx);
/*
 * Replace the selection of an object with text referenced by a vm-block.
 *	PASS:	file	= file handle
 *	    	block	= vm block handle
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_SELECTION_DB_ITEM (VMFileHandle file = dx,
                       DBGroup group = bp,
                       DBItem item = cx);
/*
 * Replace the selection of an object with text referenced by a db-item.
 * The text is assumed to be NULL terminated.
 *	PASS:	file	= file handle
 *	    	group	= Group number
 *		item 	= Item number
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_REPLACE_SELECTION_HUGE_ARRAY (VMFileHandle file = dx,
                       VMBlockHandle hugeArrayBlock = bp,
                       word textLen = cx);
/*
 * Replace the selection of an object with text referenced by a HugeArray
 *	PASS:	file	= file handle
 *	    	hugeArrayBlock	= HugeArray
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_APPEND_PTR (const char *text = dx:bp,
                       word textLen = cx);
/*
 * Append to an object with text referenced by a pointer.
 *	PASS:	text	= Pointer to the text string
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_APPEND_OPTR (optr o = dx:bp,
                       word textLen = cx);
/*
 * Append to an object with text referenced by an optr.
 *	PASS:	o	= Pointer to the text string
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_APPEND_BLOCK (word block = dx,
                       word textLen = cx);
/*
 * Append to an object with text referenced by a block.
 *	PASS:	block	= Pointer to the text string
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_APPEND_VM_BLOCK (VMFileHandle file = dx,
                       VMBlockHandle block = bp,
                       word textLen = cx);
/*
 * Append to an object with text referenced by a VMBlock
 *	PASS:	file	= file handle
 *		block	= VMBlockHandle
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_APPEND_DB_ITEM (VMFileHandle file = dx,
                       DBGroup group = bp,
                       DBItem item = cx);
/*
 * Append to an object with text referenced by a DBItem
 *	PASS:	file	= file handle
 *		group	= DBGroup
 *		item	= DBItem
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_APPEND_HUGE_ARRAY (VMFileHandle file = dx,
                       VMBlockHandle hugeArrayBlock = bp,
                       word textLen = cx);
/*
 * Append to an object with text referenced by a HugeArray.
 *	PASS:	file	= file handle
 *		hugeArrayBlock	= HugeArray
 *		textLen	= String length, or 0 if null-terminated
 */

/**************************************************************************/

@message word MSG_VIS_TEXT_GET_ALL_PTR (const char *text = dx:bp) = cx;
/*
 * Get the entire text of an object into a buffer referenced by a pointer.
 *	PASS:	text	= Pointer to the text buffer
 *	RETURN:	word	= String length not counting the NULL
 */

/**************************************************************************/

@message ChunkHandle MSG_VIS_TEXT_GET_ALL_OPTR (optr o = dx:bp) = cx;
/*
 * Get the entire text of an object into a buffer referenced by a chunk.
 * The chunk will always exist on return.  It will contain at least a NULL.
 *
 *	PASS:	o = optr of block which is to contain chunk
 *		    pass the ChunkHandle of chunk to hold text,
 *			  0 to allocate new chunk
 *
 *	RETURN:	ChunkHandle of the chunk in which text was placed.
 *	    	Chunk resized to be the size of the null-terminated text.
 */

/**************************************************************************/

@message MemHandle MSG_VIS_TEXT_GET_ALL_BLOCK (word block = dx) = cx;
/*
 * Get the entire text of an object into a buffer referenced by a block.
 * The block will always exist on return.  It will contain at least a NULL.
 *
 *	PASS:	block	= MemHandle of block to hold text
 *			= 0 to allocate new block
 *
 *	RETURN:	MemHandle of the block in which text was placed.
 *		Block resized to be the size of the null-terminated text.
 */

/**************************************************************************/

@message VMBlockHandle MSG_VIS_TEXT_GET_ALL_VM_BLOCK (VMFileHandle file = dx,
                       VMBlockHandle block = bp) = cx;
/*
 * Get the entire text of an object into a buffer referenced by a VMBlock.
 * The VMBLock will always exist on return.  It will contain at least a NULL.
 *
 *	PASS:	file = FileHandle
 *		block	= VMBlockHandle of block to hold text
 *			= 0 to allocate new VMBlock.
 *
 *	RETURN:	VMBlockHandle of the block in which text was placed.
 *	    	Block resized to be the size of the null-terminated text.
 */

/**************************************************************************/

@message DBGroupAndItem MSG_VIS_TEXT_GET_ALL_DB_ITEM (VMFileHandle file = dx,
                       DBGroup group = bp,
                       DBItem item = cx) = bp.cx;
/*
 * Get the entire text of an object into a buffer referenced by a DBItem.
 * The item will always exist on return.  It will contain at least a NULL.
 *
 *	PASS:	file 	= FileHandle
 *		group	= Group
 *		item	= Item, 0 to allocate new item.
 *
 *	RETURN:	DBGroupAndItem in which the text was placed.
 *	    	DBItem resized to be the size of the null-terminated text.
 */

/**************************************************************************/

@message  VMBlockHandle MSG_VIS_TEXT_GET_ALL_HUGE_ARRAY (VMFileHandle file = dx,
                     VMBlockHandle hugeArrayBlock = bp) = cx;
/*
 * Get the entire text of an object into a buffer referenced by a HugeArray.
 * The HugeArray will always exist on return.  It will contain at least a NULL.
 *
 *	PASS:	file = FileHandle
 *		hugeArrayBlock	= HugeArray
 *				= 0 to allocate a new array
 *	RETURN:	VMBlockHandle of the array in which the text was placed.
 *	    	Array resized to be size of the null-terminated text.
 */

/****************************************************************************/

@message word MSG_VIS_TEXT_GET_SELECTION_PTR (char *text = dx:bp) = cx;
/*
 * Get the selected text of an object into a buffer referenced by a pointer.
 *	PASS:	text 	= Pointer to the text string
 *	RETURN:	String length not counting the NULL
 */

/****************************************************************************/

typedef struct {
    word		VTGRS_length;
    word		VTGRS_handle;
    word		VTGRS_dx;
    DBGroup		VTGRS_group;
} VisTextGetReturnStruct} ;

@message void MSG_VIS_TEXT_GET_SELECTION_OPTR (
                VisTextGetReturnStruct *retVal = axcxdxbp,
                block MemHandle = dx,
                chunk ChunkHandle = bp);
/*
 * Get the selected text of an object into a buffer referenced by a chunk.
 * The chunk will always exist on return. It will contain at least a NULL.
 *
 *	PASS:	*retVal = VisTextGetReturnStruct
 *		block	= MemHandle of block containing chunk
 *		chunk	= ChunkHandle of chunk to hold text,
 *			  0 to allocate new chunk
 *
 *	RETURN:	*retVal->VTGRS_length = string length, not counting the NULL
 *		*retVal->VTGRS_handle = ChunkHandle of the chunk in which text
 *					was placed.  Chunk resized to be the
 *					size of the null-terminated text.
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_GET_SELECTION_BLOCK (
                VisTextGetReturnStruct *retVal = axcxdxbp,
                word block = dx);
/*
 * Get the selected text of an object into a buffer referenced by a block.
 * The block will always exist on return.  It will contain at least a NULL.
 *
 *	PASS:	*retVal = VisTextGetReturnStruct
 *		block	= MemHandle of block to hold text
 *			= 0 to allocate new block
 *
 *	RETURN:	retVal->VTGRS_length = string length, not counting the NULL
 *		retVal->VTGRS_handle = MemHandle of the block in which text
 *					was placed.  Block resized to be the
 *					size of the null-terminated text.
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_GET_SELECTION_VM_BLOCK (
                VisTextGetReturnStruct *retVal = axcxdxbp,
                VMFileHandle file = dx,
                 VMBlockHandle block = bp);
/*
 * Get the selected text of an object into a buffer referenced by a VMBlock.
 * The VMBLock will always exist on return.  It will contain at least a NULL.
 *
 *	PASS:	*retVal = VisTextGetReturnStruct
 *		file = FileHandle
 *		block	= VMBlockHandle of block to hold text
 *			= 0 to allocate new VMBlock.
 *
 *	RETURN:	*retVal->VTGRS_length = string length, not counting the NULL
 *		*retVal->VTGRS_handle = VMBlockHandle of the block in which
 *					text was placed.  Block resized to be
 *					the size of the null-terminated text.
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_GET_SELECTION_DB_ITEM (
                VisTextGetReturnStruct *retVal = axcxdxbp,
                VMFileHandle file = dx,
                 DBGroup group = bp,
                DBItem item = cx);
/*
 * Get the selected text of an object into a buffer referenced by a DBItem.
 * The item will always exist on return.  It will contain at least a NULL.
 *
 *	PASS:	*retVal = VisTextGetReturnStruct
 *		file 	= FileHandle
 *		group	= Group
 *		item	= Item, 0 to allocate new item.
 *
 *	RETURN:	*retVal->VTGRS_length = string length, not counting the NULL
 *		*retVal->VTGRS_handle = DBItem of the chunk in which the text
 *					was placed.  DBItem resized to be the
 *					size of the null-terminated text.
 *		*retVal->VTGRS_group = Group (may be different from above if
 *					DB_UNGROUPED passed)
 */

/****************************************************************************/

typedef struct {
    word		VTGHARS_bp;
    dword		VTGHARS_length;
    word		VTGHARS_handle;
} VisTextGetHugeArrayReturnStruct} ;

@message void MSG_VIS_TEXT_GET_SELECTION_HUGE_ARRAY (
            VisTextGetHugeArrayReturnStruct *retval = bpaxdxcx,
            VMFileHandle file = dx,
            VMBlockHandle hugeArrayBlock = bp);
/*
 * Get the selected text of an object into a buffer referenced by a HugeArray.
 * The HugeArray will always exist on return.  It will contain at least a NULL.
 *
 *	PASS:	*retVal = VisTextGetHugeArrayReturnStruct
 *		file = FileHandle
 *		hugeArrayBlock	= HugeArray
 *				= 0 to allocate a new array
 *	RETURN:	*retVal->VTGHARS_length = string length, not counting the NULL
 *		*retVal->VTGHARS_handle = Array handle of the chunk in which
 *					the text was placed.  Array resized to
 *					be size of the null-terminated text.
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_DELETE_ALL ();
/*
 *	Delete the entire text of an object.
 *	PASS: 	nothing
 *	RETURN: nothing
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_DELETE_SELECTION ();
/*
 *	Delete the selected text of an object.
 *	PASS: 	nothing
 *	RETURN: nothing
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_GET_SELECTION_RANGE (VisTextRange *vtr = dx:bp);
/*
 *	Get the range of the selection.
 *	PASS: 	vtr - VisTextRange to fill in
 *	RETURN:	vtr filled in
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_SELECT_RANGE_SMALL (word start = cx, word end = dx);
/*
 *	Select a range in the object.
 *
 *	PASS:	start - start of range to select
 *		end - end of range to select
 *	RETURN: nothing
 *	COMPAT: this only works with small model objects.
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_SELECT_ALL ();
/*
 * 	Select the entire object.
 *	PASS: 	nothing
 *	RETURN: nothing
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_SELECT_START ();
/*
 * 	Place the cursor at the start of the text.
 *	PASS: 	nothing
 *	RETURN: nothing
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_SELECT_END ();
/*
 * 	Place the cursor at the end of the text.
 *	PASS: 	nothing
 *	RETURN: nothing
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_SELECT_RELATIVE (word newStart = cx,
                       word newEnd = dx);
/*
 *	Place the cursor at a position relative to its current one.
 *
 *	PASS:	start - new start selection relative to old start selection
 *		end   - new end selection relative to old end selection
 *	RETURN: nothing
 */

/****************************************************************************/

/*----------------------------------------------------------------------------
 *	Messages to change or get the state of the text object
 *---------------------------------------------------------------------------*/

/****************************************************************************/

@message VisTextStates MSG_VIS_TEXT_GET_STATE ()=cl;
/*
 *	Get the VTI_state
 *	PASS:	nothing
 *	RETURN:	VisTextState
 */

/***************************************************************************/

@message VisTextFeatures MSG_VIS_TEXT_GET_FEATURES ()=cx;
/*
 *	Get the VTI_features
 *	PASS:	nothing
 *	RETURN:	VisTextFeatures
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_FEATURES (VisTextFeatures bitsToSet=cx,
                    VisTextFeatures bitsToClear=dx);
/*
 *	Set the VTI_features
 *	PASS:	bitsToSet - VisTextFeatures to set
 *		bitsToClear - VisTextFeatures to clear
 *	RETURN:	nothing
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_MAX_LENGTH (word newMaxLength = cx);
/*
 *	Set the maximum length of the text.  If the current text is too long,
 *	text at the end is removed. This only applies to small text objects.
 *
 *	PASS:	newMaxLength - maximum length
 *	RETURN: nothing
 */

/***************************************************************************/

@message word MSG_VIS_TEXT_GET_MAX_LENGTH () = cx;
/*
 *	Get the maximum length of the text.
 *
 *	PASS:	nothing
 *	RETURN: maximum length
 */

/***************************************************************************/

@message Boolean MSG_VIS_TEXT_GET_USER_MODIFIED_STATE () = cx;
/*
 *	Get the user modified status of the text object.
 *
 *	PASS:	nothing
 *	RETURN: TRUE if user modified
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_NOT_USER_MODIFIED ();
/*
 *	Mark a text object as not user modified.
 *
 *	PASS:	nothing
 *	RETURN: nothing
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SET_USER_MODIFIED ();
/*
 *	Mark a text object as user modified.
 *
 *	NOTE: 	This does *not* send out the MSG_META_TEXT_USER_MODIFIED
 *		notification.
 *
 *	PASS:	nothing
 *	RETURN: nothing
 */

/***************************************************************************/

typedef struct {
    byte    VTWCMR_redOrIndex;
    byte    VTWCMR_mapMode;
} VisTextWashColorModeRed} ;

typedef struct {
    byte    VTWCBG_green;
    byte    VTWCBG_blue;
} VisTextWashColorBlueGreen} ;

@message void MSG_VIS_TEXT_SET_WASH_COLOR (VisTextWashColorModeRed modeRed = cx,
                  VisTextWashColorBlueGreen blueGreen = dx);
/*
 *	Set the wash color for behind the text.
 *
 *	PASS:	modeRed - VisTextWashColorModeRed:
 *		  VTWCMR_mapMode     - VisTextColorMapMode
 *		  VTWCMR_redOrIndex  - if (mapMode == CF_RGB), Red
 *			    	    - if (mapMode == CF_INDEX), color index.
 *		blueGreen - VisTextWashColorBlueGreen:
 *		  VTWCBG_blue	    - Blue (if mapMode == CF_RGB)
 *		  VTWCBG_green	    - Green (if mapMode == CF_RGB)
 *
 *	RETURN: nothing
 *

/***************************************************************************/

typedef struct {
    VisTextWashColorBlueGreen VTGWC_blueGreen;
    VisTextWashColorModeRed VTGWC_modeRed;
} VisTextGetWashColor} ;

@message void MSG_VIS_TEXT_GET_WASH_COLOR (VisTextGetWashColor *retVal = dxcx);
/*
 *	Set the wash color for behind the text.
 *
 *	PASS:	*retVal - VisTextGetWashColor
 *	RETURN: *retVal filled in
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_MODIFY_EDITABLE_SELECTABLE (
          VisTextStates setBits = cl, VisTextStates clearBits = ch);
/*
 *	Modify the editable and/or selectable state of the object
 *
 *	PASS:	setBits   - VisTextStates to set
 *		clearBits - VisTextStates to clear
 */

/*--------------------------------------------------------------------------
 *	Internal methods used by specific UI
 *--------------------------------------------------------------------------*/

@message void MSG_VIS_TEXT_UPDATE_GENERIC ();
/*
 *	Update the generic instance data from the visual instance data.
 *	PASS:	nothing
 *	RETURN: nothing
 */

/*--------------------------------------------------------------------------
 *	Messages that can be subclassed to add functionality
 *--------------------------------------------------------------------------*/

typedef struct {
    VisTextCharAttr	    	VTNCAC_charAttr;
    word	    	    	VTNCAC_charAttrToken;
    VisTextCharAttrDiffs	VTNCAC_charAttrDiffs;
} VisTextNotifyCharAttrChange} ;

typedef struct {
    VisTextMaxParaAttr	    	VTNPAC_paraAttr;
    word	    	    	VTNPAC_paraAttrToken;
    VisTextParaAttrDiffs	VTNPAC_paraAttrDiffs;
    sdword			VTNPAC_regionOffset;
    sword			VTNPAC_regionWidth;
    word			VTNPAC_selectedTab;
} VisTextNotifyParaAttrChange} ;

typedef struct {
    VisTextType	    	    	VTNTC_type;
    word	    	    	VTNTC_typeToken;
    VisTextTypeDiffs	    	VTNTC_typeDiffs;
    VisTextType		    	VTNTC_index;
} VisTextNotifyTypeChange} ;

typedef struct {
    dword	    	    	VTNSC_selectStart;
    dword	    	    	VTNSC_selectEnd;
    dword	    	    	VTNSC_lineNumber;
    dword	    	    	VTNSC_lineStart;
    word	    	    	VTNSC_region;
    dword	    	    	VTNSC_regionStartLine;
    dword	    	    	VTNSC_regionStartOffset;
} VisTextNotifySelectionChange} ;

typedef struct {
    Boolean	    	    	VTNHC_hyperlinkable;
} VisTextNotifyHyperlinkabilityChange} ;

typedef struct {
    dword	    	    	VTNCC_charCount;
    dword	    	    	VTNCC_wordCount;
    dword	    	    	VTNCC_lineCount;
    dword	    	    	VTNCC_paraCount;
} VisTextNotifyCountChange} ;

typedef ByteEnum VisTextNameChangeType ;
#define	VTNCT_NULL		0
#define	VTNCT_ADD		1
#define	VTNCT_REMOVE		2
#define	VTNCT_RENAME		3

typedef	struct {
    word			VTNNC_count;
    VisTextNameType		VTNNC_type;		/* type of name */
    VisTextNameChangeType	VTNNC_changeType; 	/* type of change */
    word			VTNNC_index;		/* index of name */
    word			VTNNC_fileIndex;	/* file index, if
                                  VTNT_CONTEXT */
} VisTextNotifyNameChange} ;

typedef struct {
    dword 			VTCPC_lineNumber;
    dword 			VTCPC_rowNumber;
} VisTextCursorPositionChange} ;

typedef WordFlags VisTextNotificationFlags ;
#define VTNF_SELECT_STATE 	0x8000
#define VTNF_CHAR_ATTR 		0x4000
#define VTNF_PARA_ATTR 		0x2000
#define VTNF_TYPE 		0x1000
#define VTNF_SELECTION 		0x0800
#define VTNF_COUNT 		0x0400
#define VTNF_STYLE_SHEET 	0x0200
#define VTNF_STYLE 		0x0100
#define VTNF_SEARCH_ENABLE 	0x0080
#define VTNF_SPELL_ENABLE 	0x0040
#define VTNF_NAME 		0x0020
#define VTNF_CURSOR_POSITION 	0x0010
#define VTNF_HYPERLINKABILITY 	0x0008

#define VIS_TEXT_STANDARD_NOTIFICATION_FLAGS   	(VTNF_SELECT_STATE | \
                         VTNF_CHAR_ATTR | \
                         VTNF_PARA_ATTR | \
                                             VTNF_TYPE | \
                         VTNF_STYLE | \
                         VTNF_STYLE_SHEET | \
                         VTNF_CURSOR_POSITION | \
                         VTNF_HYPERLINKABILITY)

#define VIS_TEXT_GAINED_TARGET_NOTIFICATION_FLAGS  	\
                            (VIS_TEXT_STANDARD_NOTIFICATION_FLAGS | \
                 VTNF_SEARCH_ENABLE | \
                 VTNF_SPELL_ENABLE | \
                 VTNF_NAME)

typedef WordFlags VisTextNotifySendFlags ;
#define VTNSF_UPDATE_APP_TARGET_GCN_LISTS 	0x8000
/*
 * 	Set if pertinent Application Target GCN Lists should be
 * 	updated with changes in status.
 */

#define VTNSF_NULL_STATUS 			0x4000
/*
 *	Send notification of null status, for all notification types
 *	(used only to notify GCN Lists of loss of eligibility to update,
 *	i.e. lost target). The text output will always be sent only
 *	meaningful info.
 */

#define VTNSF_STRUCTURE_INITIALIZED 		0x2000
/*
 * 	Set if the rest of the VisTextGenerateNotifyParams structure is
 *      initialized.
 */

#define VTNSF_SEND_AFTER_GENERATION 		0x1000
/*
 *	Set to send the notifications after generating them.
 */

#define VTNSF_SEND_ONLY 				0x0800
/*
 *	 Set to send the notifications *only*.
 */

#define VTNSF_RELAYED_TO_LIKE_TEXT_OBJECTS 	0x0400
/*
 *    	Set if the message has been registered with the object responsible
 *	for relaying the message to multiple text objects.
 */

typedef struct {
    VisTextNotificationFlags	VTGNP_notificationTypes;
    VisTextNotifySendFlags	VTGNP_sendFlags;
    MemHandle			VTGNP_notificationBlocks[16];
} VisTextGenerateNotifyParams} ;

/***************************************************************************/

@message void MSG_VIS_TEXT_GENERATE_NOTIFY (VisTextGenerateNotifyParams
                                        *params = ss:bp);
/*
 * Generate notification structures as needed and send them out.  This allows
 * subclasses to send out their own notifications and allows subclasses to
 * combine the notification data from several text objects.
 *
 * 	PASS: 	params - VisTextGenerateNotifyParams
 *	RETURN: nothing
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_CHAR_ATTR_VIRTUAL_TO_PHYSICAL (VisTextCharAttr attr);
/*
 *	Convert a virtual charAttr to a physical charAttr.  This message is
 *	only sent if the VTS_SUBCLASS_VIRT_PHYS_TRANSLATION bit is set in
 *	VTS_states.  This message is sent before the default processing.
 *
 *	Pass:	attr - VisTextCharAttr
 *	Return:	none
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_PARA_ATTR_VIRTUAL_TO_PHYSICAL (VisTextParaAttr attr);
/*
 *	Convert a virtual paraAttr to a physical paraAttr.  This message is
 *	only sent if the VTS_SUBCLASS_VIRT_PHYS_TRANSLATION bit is set in
 *	VTS_states.  This message is sent before the default processing.
 *
 *	Pass:	attr - VisTextParaAttr
 *	Return:	none
 */

/*---------------------------------------------------------------------------
 *	 The following methods are passed to the OD VTI_output
 *--------------------------------------------------------------------------*/

@importMessage	MetaTextMessages, void MSG_META_TEXT_USER_MODIFIED (
                            optr obj = cx:dx);
/*
 *	Sent when the user modifies the text
 *	This message is sent to the text object itself first.
 *
 * NOTE:  the text object sends this notification first to its destination, &
 * then to itself for internal update.  If you intercept this message at the
 * destination, be aware the text object's MODIFIED state has not yet been
 * updated, & so operations that modify that state, such as
 * MSG_VIS_TEXT_SET_NOT_USER_MODIFIED, or MSG_GEN_TEXT_SET_MODIFIED_STATE,
 * may not be synchronously called.  If you need to perform such operations,
 * such as the case where you need to clear the modified status in order to
 * receive notification on every keypress, use the MF_FORCE_QUEUE and
 * MF_PLACE_AT_FRONT flags when sending the message, so as to allow the text
 * object to first finish updating itself.
 *
 *	Pass:	obj - object
 *	Return:	none
 */

/****************************************************************************/

typedef	struct {
    CharFlags 	MTFP_charFlags;
    ShiftState	MTFP_shiftState;
    ToggleState MTFP_toggleState;
    byte	MTFP_scanCode;
} MetaTextFilteredParameters} ;

@importMessage	MetaTextMessages, void MSG_META_TEXT_CR_FILTERED (
                    word character = cx,
                    MetaTextFilteredParameters params=dx:bp);
/*
 *	Sent when a CR is filtered out of the text input.
 *	This message is sent to the text object itself first.
 *
 *	Pass: 	character -
 *		params - MetaTextFilteredParameters
 *	Return:	none
 */

/****************************************************************************/

@importMessage	MetaTextMessages, void MSG_META_TEXT_TAB_FILTERED (
                    word character = cx,
                    MetaTextFilteredParameters params=dx:bp);
/*
 *	Sent when a tab is filtered out of the text input.
 *	This message is sent to the text object itself first.
 *
 *	Pass: 	character = character value
 *		params - MetaTextFilteredParameters
 *	Return:	none
 */

/****************************************************************************/

@importMessage	MetaTextMessages, void MSG_META_TEXT_LOST_FOCUS (
                    optr obj = cx:dx);
/*
 *	Sent when the text object loses the focus.
 *
 *	Pass:	obj - object
 *	Return:	none
 */

/****************************************************************************/

@importMessage	MetaTextMessages, void MSG_META_TEXT_GAINED_FOCUS (
                    optr obj = cx:dx);
/*
 *	Sent when the text object gains the focus.
 *
 *	Pass:	obj - object
 *	Return:	none
 */

/****************************************************************************/

@importMessage	MetaTextMessages, void MSG_META_TEXT_LOST_TARGET (
                    optr obj = cx:dx);
/*
 *	Sent when the text object loses the target.
 *
 *	Pass:	obj - object
 *	Return:	none
 */

/****************************************************************************/

@importMessage	MetaTextMessages, void MSG_META_TEXT_GAINED_TARGET (
                    optr obj = cx:dx);
/*
 *	Sent when the text object gains the target.
 *
 *	Pass:	obj - object
 *	Return:	none
 */

/****************************************************************************/

@importMessage	MetaTextMessages, void MSG_META_TEXT_EMPTY_STATUS_CHANGED (
                                    optr object = cx:dx,
                    Boolean hasTextFlag = bp);
/*
 * 	Sent when text object becomes empty or not empty
 *	This message is sent to the text object itself first.
 *
 *	Pass:	optr - text object
 *		hasTextFlag - TRUE if text is becoming non-empty
 *	Return:	none
 */

/****************************************************************************/

@importMessage	MetaTextMessages, void MSG_META_TEXT_NOT_USER_MODIFIED (
                    optr obj = cx:dx);
/*
 * 	Sent when text object is set not user modified.
 *	This message is sent to the text object itself first.
 *
 *	Pass:	optr - text object
 *	Return:	none
 */

/*---------------------------------------------------------------------------
 * The following methods are assumed to be handled by a sub-class
 * (usually the specific ui).
 *--------------------------------------------------------------------------*/

@message void MSG_VIS_TEXT_EDIT_DRAW ();
/*
 *	This method is invoked after the text has been drawn so that the
 *	specific UI or sub-class can handle anything special that it needs to.
 *
 *	Pass:	none
 *	Return:	none
 */

/****************************************************************************/

typedef WordFlags VisTextShowSelectionFlags ;
#define VTSSF_DRAGGING 		0x8000

@message void MSG_VIS_TEXT_SHOW_SELECTION(@stack
                        VisTextShowSelectionFlags flags,
                        MakeRectVisibleFlags yFlags,
                                            MakeRectVisibleMargin yMargin,
                            MakeRectVisibleFlags xFlags,
                                            MakeRectVisibleMargin xMargin,
                                            sdword bottom, sdword right,
                                            sdword top, sdword left);
/*
 *	Sent from the text display to allow subclasses of text display to make
 *	the current selection visible.  For instance, in an openlook text
 *	display the text may be in a window, and the openlook implementation
 *	can use this method handler to scroll the selection onscreen.  The
 *	text display doesn't handle this method itself.
 *
 *	Pass:	params - MakeRectVisibleParams (see gViewC.goh)
 *		flags - VisTextShowSelectionFlags
 *	Return:	none
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_HEIGHT_NOTIFY (word newHeight = dx);
/*
 *	A method sent out by the object, to itself (for use in subclassing),
 *	which announces any change it text height.  Will be used to drive
 *	changes in visual box height, conversion to scrolled version.
 *
 *	For large objects newHeight is meaningless.  For large objects
 *	this message *must* be passed to the superclass.
 *
 *	Pass:	newHeight - New height of text at current with (-1 if infinite)
 *	Return:	none
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_ENTER_OVERSTRIKE_MODE (Boolean
                         calledFromTextObject = cx);
/*
 *	Enter overstrike mode. Leave insert mode.
 *
 *	Pass:	calledFromTextObject - TRUE if called from the text object.
 *	Return:	none
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_ENTER_INSERT_MODE (Boolean
                         calledFromTextObject = cx);
/*
 *	Enter insert mode. Leave overstrike mode.
 *
 *	Pass:	calledFromTextObject - TRUE if called from the text object.
 *	Return:	none
 */

/****************************************************************************/

typedef struct {
    WBFixed	VTMDP_height;
    WBFixed	VTMDP_width;
} VisTextMinimumDimensionsParameters} ;

@message void MSG_VIS_TEXT_GET_MINIMUM_DIMENSIONS (
            VisTextMinimumDimensionsParameters *params = dx:bp);
/*
 * Figure the minimum dimensions of a text object whose geometry is valid and
 * which has been calculated. This is to allow applications which create
 * text objects to figure their minimum size, given some initial configuration.
 *
 * The height and width returned will already be accounting for the lr and tb
 * margin values, so the caller should not have to.
 *
 *	PASS:	params	= pointer to VisTextMinimumDimensionsParameters
 *	RETURN:	*params filled in
 */

/*---------------------------------------------------------------------------
 *	Filtering messages
 *--------------------------------------------------------------------------*/
/*
 * The text object allows various mechanisms for filtering text.  The simplest
 * is the VisTextFilter variable stored in VTI_filters, which covers most
 * basic filtering situations.
 *
 * More complex filtering can be implemented using the filtering messages
 * below.  Because these messages can impose a non-trivial performance
 * penalty, they are only sent out if the ATTR_VIS_TEXT_EXTENDED_FILTER
 * attribute exists.
 *
 * ATTR_VIS_TEXT_EXTENDED_FILTER allows several levels of filtering as
 * controlled by the data stored with it (VisTextExtendedFilterTypes)
 */

typedef ByteEnum VisTextExtendedFilterType ;

#define VTEFT_REPLACE_PARAMS 		0
/*	This causes MSG_VIS_TEXT_FILTER_VIA_REPLACE_PARAMS to be send */

#define VTEFT_CHARACTER_LEVELER_LEVEL 	1
/*	This causes MSG_VIS_TEXT_FILTER_VIA_CHARACTER to be sent */

#define VTEFT_BEFORE_AFTER 		2
/*	This causes MSG_VIS_TEXT_FILTER_VIA_BEFORE_AFTER to be sent */

/*
 *	TextReference structure - the following definitions apply to
 *	VisTextReplace and VisTextGetRange.
 */

/*
 * This structure defines a reference to text. It can be:
 *	Pointer
 *	Memory segment and chunk
 *	Memory block and chunk
 *	Memory block handle
 *	VM file and VM block
 *	VM file and DBase item
 *	VM file and huge-array handle
 */
typedef enum /* word */ {
    TRT_POINTER    =0,		/* TextReferencePointer */
    TRT_SEGMENT_CHUNK    =2,	/* TextReferenceSegmentChunk */
    TRT_OPTR    =4,			/* TextReferenceBlockChunk */
    TRT_BLOCK    =6,		/* TextReferenceBlock */
    TRT_VM_BLOCK    =8,		/* TextReferenceVMBlock */
    TRT_DB_ITEM    =10,		/* TextReferenceDBItem */
    TRT_HUGE_ARRAY    =12,		/* TextReferenceHugeArray */
} TextReferenceType} ;

typedef struct {
    char _far *TRP_pointer;
   /*
    * MSG_VIS_TEXT_GET_TEXT_RANGE Documentation:
    * ------------------------------------------
    * VTGRF_RESIZE has no meaning with this sort of reference.
    *
    * The TRP_pointer field must always be filled in.
    *
    * VTGRF_ALLOCATE and VTGRF_ALLOCATE_ALWAYS are not valid flags to pass
    * with this type of text reference.
    *
    * This is the safest way to copy text out of a text object. Since the
    * caller allocates the block it can also handle errors in the allocation.
    */
} TextReferencePointer} ;

typedef struct {
    ChunkHandle	TRSC_chunk;
    Segment	TRSC_segment;
   /*
    * MSG_VIS_TEXT_GET_TEXT_RANGE Documentation:
    * ------------------------------------------
    * The TRSC_segment field must be filled in.
    *
    * It is assumed that the lmem heap will be able to accomodate this
    * allocation. The caller is responsible for ensuring that this is the
    * case.
    *
    * If VTGRF_RESIZE is passed then either the passed chunk or the allocated
    * chunk will be resized to accomodate the text.
    */
} TextReferenceSegmentChunk} ;

typedef struct {
    optr	TRBC_ref;
   /*
    * MSG_VIS_TEXT_GET_TEXT_RANGE Documentation:
    * ------------------------------------------
    * The handle field of the TRBC_ref field must be filled in.
    *
    * It is assumed that the lmem heap will be able to accomodate this
    * allocation. The caller is responsible for ensuring that this is the
    * case.
    *
    * If VTGRF_RESIZE is passed then either the passed chunk or the allocated
    * chunk will be resized to accomodate the text.
    */
} TextReferenceBlockChunk} ;

typedef struct {
    MemHandle TRB_handle;
   /*
    * MSG_VIS_TEXT_GET_TEXT_RANGE Documentation:
    * ------------------------------------------
    * No fields need to be filled in in order to allocate a destination buffer.
    * The heap allocation request will be made with the HAF_NO_ERR flag.
    *
    * If VTGRF_RESIZE is passed then either the passed block or the allocated
    * block will be resized to accomodate the text.
    */
} TextReferenceBlock} ;

typedef struct {
    FileHandle 		TRVMB_file;
    VMBlockHandle 	TRVMB_block;
   /*
    * MSG_VIS_TEXT_GET_TEXT_RANGE Documentation:
    * ------------------------------------------
    * The TRVMB_file must be filled in if you want a VM block to be
    * allocated.
    *
    * If VTGRF_RESIZE is passed then either the passed vm-block or the
    * allocated vm-block will be resized to accomodate the text.
    */
} TextReferenceVMBlock} ;

typedef struct {
    FileHandle 		TRDBI_file;
    DBItem		TRDBI_item;
    DBGroup		TRDBI_group;
   /*
    * MSG_VIS_TEXT_GET_TEXT_RANGE Documentation:
    * ------------------------------------------
    * Both the TRDBI_file and the TRDBI_group fields must be filled in if
    * you want a VM block to be allocated.
    *
    * If the TRDBI_group field is set to DB_UNGROUPED then the item will be
    * allocated ungrouped. TRDBI_group will hold the group in which the
    * item was allocated on return.
    *
    * If VTGRF_RESIZE is passed then either the passed db-item or the allocated
    * db-item will be resized to accomodate the text.
    */
} TextReferenceDBItem} ;

typedef struct {
    FileHandle		TRHA_file;
    word		TRHA_array;
   /*
    * MSG_VIS_TEXT_GET_TEXT_RANGE Documentation:
    * ------------------------------------------
    * The TRHA_file field must be set if you want a huge-array to be
    * allocated.
    *
    * It does not make sense to pass VTGRF_RESIZE when the text reference is
    * a huge-array. The huge-array will always be forced to be the correct
    * size for the text.
    */
} TextReferenceHugeArray} ;

/*
 *	A union containing all the various references.
 */
typedef union {
    TextReferencePointer 	TRU_pointer;
    TextReferenceSegmentChunk 	TRU_segChunk;
    TextReferenceBlockChunk 	TRU_blockChunk;
    TextReferenceBlock	 	TRU_block;
    TextReferenceVMBlock	TRU_vmBlock;
    TextReferenceDBItem	 	TRU_dbItem;
    TextReferenceHugeArray	TRU_hugeArray;
} TextReferenceUnion} ;

/*
 *	The typed reference
 */
typedef struct {
    TextReferenceType	TR_type;
    TextReferenceUnion 	TR_ref;
} TextReference} ;

typedef WordFlags VisTextReplaceFlags ;

#define VTRF_FILTER 			0x8000
/*	Set to filter replacement			*/

#define VTRF_KEYBOARD_INPUT 		0x4000
/*	Set if data is coming from the kbd input	*/

#define VTRF_USER_MODIFICATION 		0x2000
/*	Set if replace is due to a user action		*/

#define VTRF_UNDO 			0x1000
/*	Set if replace is due to an undo		*/

#define VTRF_DO_NOT_SEND_CONTEXT_UPDATE 	0x0800
/*	Set if this is part of a  multi-part replace, and so the
 *	text object should not send a context update (used internally
 *	to the text object only)
 */

#define VTRF_TRUNCATE 	    	    	0x0400
/*	Truncated the inserted text as necessary to not overflow */

typedef	struct {
   /*
    * The VisTextRange *must* come first in this structure
    */
    VisTextRange	VTRP_range;	      /* Range to replace */
    dword		VTRP_insCount;	      /* # of characters to insert */
    TextReference	VTRP_textReference;   /* Reference to text to insert*/
    VisTextReplaceFlags VTRP_flags;
} VisTextReplaceParameters} ;

/*
 * It is possible to ask the text object to compute the length of the text
 * being inserted by passing the following constant in the high word of the
 * VTRP_insCount field.
 */
#define INSERT_COMPUTE_TEXT_LENGTH 	0x01ff

/****************************************************************************/

@message Boolean MSG_VIS_TEXT_FILTER_VIA_REPLACE_PARAMS (
            VisTextReplaceParameters *params= ss:bp) = carry;
/*
 *	Filter text that is about to be entered in the text object.
 *	PASS: 	params - VisTextReplaceParams
 *	RETURN: carry set to reject replacement
 */

/****************************************************************************/

@message word MSG_VIS_TEXT_FILTER_VIA_CHARACTER (word charToFilter = cx) = cx;
/*
 *	Filter text that is about to be entered in the text object.
 *	The text object calls this message for each character in the
 *	replacement text.
 *
 *	PASS: 	charToFilter - character
 *	RETURN: cx - 0 to reject replacement, otherwise the replacement char
 */

/****************************************************************************/

@message Boolean MSG_VIS_TEXT_FILTER_VIA_BEFORE_AFTER (
        ChunkHandle before = cx,
        ChunkHandle after  = dx,
        word	    frame  = bp) = carry;
/*
 * Filter text that is about to be entered in the text object.  This message
 * passes two buffers containing the current text in the text object and
 * the (proposed) new text for the object.
 *
 * This message can only be used on small text objects.
 *
 * If the buffer is going to be rejected it is legal to call text object
 * messages from within this handler
 *
 * PASS:
 *	ChunkHandle before	chunk handle to "before" text
 *	ChunkHandle after	chunk handle to "after" text
 *	word        frame	offset to VisTextReplaceParameters
 * RETURN:
 *	TRUE	to reject buffer
 *	FALSE	to accept buffer
 *
 *  To access the VisTextReplaceParamters you need to create a fptr.
 *  An example would be like:
 *
 *   VisTextReplaceParams *p =
 *		(VisTextReplaceParams *)(((dword)&p &0xffff0000L) + frame);
 */

/*---------------------------------------------------------------------------
 *		Style sheet messages
 *--------------------------------------------------------------------------*/

@message void MSG_VIS_TEXT_LOAD_STYLE_SHEET (StyleSheetParams *params= ss:bp);
/*
 *	Merge data from a given style sheet
 *
 *	PASS: 	params - StyleSheetParams
 *	RETURN: nothing
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_LOAD_STYLE_SHEET_PARAMS ();
/*
 *  Fill in the passed StyleSheetParams structure.
 *
 *  WARNING: THIS MESSAGE CANNOT BE SENT FROM GOC.
 *
 *  Use the function MsgVisTextLoadStyleSheetParams() to send this message.
 *  It *MUST* be called from the same thread as that which is running the
 *  VisText object to get valid results.
 */

extern void
    _pascal MsgVisTextLoadStyleSheetParams (StyleSheetParams *params,
                               optr object,
                       word preserveArrays);
/*
 *  @call object::MSG_VIS_TEXT_LOAD_STYLE_SHEET_PARAMS();
 *
 *  Pass:  	params - pointer to StyleSheetParams
 * 	    	object - optr of VisText object to send message to
 *	    	preserveArrays - nonzero to preserve transfer arrays
 *  Return: 	*params filled with return values
 *
 */

/*---------------------------------------------------------------------------
 *		Geometry methods
 *--------------------------------------------------------------------------*/

/***************************************************************************/

@message word MSG_VIS_TEXT_GET_MIN_WIDTH () = cx;
/*
 *	Returns minimum width that can be supported for attributes of the
 *	text object.
 *
 *	Pass:	none
 *	Return:	minimum width which can be supported
 *	Compat:	Can be used with all text objects.
 */

/***************************************************************************/

@message word MSG_VIS_TEXT_GET_AVERAGE_CHAR_WIDTH () = cx;
/*
 *	Returns the average character width for the first font/charAttr
 *	combination.
 *
 *	Pass:	none
 *	Return:	average character width
 *	Compat:	Can be used with all text objects.
 */

/***************************************************************************/

@message word MSG_VIS_TEXT_CALC_HEIGHT (word width = cx,
                       Boolean cacheResult = dx) = dx;
/*
 *	Returns the height of the text give a width.
 *
 *	Pass:	width - width to calculate height for
 *		cacheResult - TRUE if result should be cached.  This should
 *			only be passed from the specific UI.  If you are not
 *			the specific UI you should pass FALSE always.
 *	Return:	height of the text at given width
 *	Compat:	Cannot be used with document objects.
 */

/***************************************************************************/

@message word MSG_VIS_TEXT_GET_LINE_HEIGHT ()=ax;
/*
 *	Get the height of a line in a single-line text object only. This will
 *	not work for multi-line objects - use MSG_VIS_TEXT_GET_LINE_INFO
 *	instead.
 *
 *	Pass:	nothing
 *	Return:	line height
 *	Compat:	Cannot be used with document objects.
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_RECALC_AND_DRAW ();
/*
 *	Recalculate and redraw the text object.  Call this after you have
 *	made a change to the text objects instance data without its knowledge.
 *
 *	Pass:	nothing
 *	Return:	nothing
 *	Compat:	Can be used with all text objects.
 */

/***************************************************************************/

@message word MSG_VIS_TEXT_GET_ONE_LINE_WIDTH (word charsToCalc = cx) = cx;
/*
 *	Calculate the width of the text if it were all to appear on one
 *	lien, assuming one charAttr.
 *
 *	Pass:	charsToCalc - number of chars to use in the calculation,
 *			    - 0 to use entire string
 *	Return:	width of the text
 *	Compat:	Cannot be used with document objects.  Only intended for
 *		one line text objects.
 */

/***************************************************************************/

@message word MSG_VIS_TEXT_GET_SIMPLE_MIN_WIDTH () = cx;
/*
 *	Returns minimum width that can be supported for current text, font &
 *	charAttr.  Just like the regular version but assumes that the caller is
 *	not worried about keeping a width large enough for the largest border
 *	possible.
 *
 *	Pass:	none
 *	Return:	minimum width which can be supported
 */

/*---------------------------------------------------------------------------
 *
 *	 Methods to handle search and replace and spell
 *
 *---------------------------------------------------------------------------*/

/*
 * The structure at the front of all of the search/replace blocks
 */
typedef struct {
    word    searchSize;		/* number of chars in search string,
                   including null-terminator */
    word    replaceSize;	/* number of chars in replace string,
                   including null-terminator */
    byte    params;
    optr    replyObject; 	/* optr of object to send
                   string-not-found message to */
    Message replyMsg;		/* Message sent to SRS_replyObject
                   if the string was not found */
} SearchReplaceStruct} ;

/*
 *	In the search replace messages below, the passed block has this
 *	format:
 *		SearchReplaceStruct<>
 *		data	Null-Terminated Search String
 *		data	Null-Terminated Replace string
 */

/*-------------------------------------------------------------------------
 *	Methods sent from the search and replace and spell check boxes
 *-------------------------------------------------------------------------*/

/**************************************************************************/

@importMessage MetaSearchSpellMessages, void MSG_SEARCH (MemHandle searchInfo = dx);

/*
 *	Method sent out by the search box to tell an object to start a
 *	search.  The search string may contain wildcard characters.
 *
 *	Pass: searchInfo - MemHandle of block containing words
 *			   (should be freed by method handlers)
 */

/****************************************************************************/

@importMessage MetaSearchSpellMessages, void MSG_REPLACE_CURRENT (MemHandle replaceInfo = dx);
/*
 *	Method sent out by spell check library to tell the application to
 *	replace the current string with the passed text.
 *
 *	Pass: searchInfo - MemHandle of block containing words
 *			   (should be freed by method handlers)
 */

/****************************************************************************/

@importMessage MetaSearchSpellMessages, void MSG_REPLACE_ALL_OCCURRENCES (
                MemHandle replaceInfo = dx,
                Boolean replaceFromBeginning = cx);
/*
 *	Method sent out by spell check library to tell the text object to
 *	replace all occurrences of the current word (after the start of the
 *	current selection) with the passed text.
 *
 *	Pass: replaceInfo - MemHandle of block containing words
 *		   	(should be freed by method handlers)
 *	      replaceFromBeginning - TRUE if it should do a replace all
 *			throughout the entire document (as opposed to after
 *			the current position)
 *
 *	Return: nothing
 */

/****************************************************************************/

@importMessage MetaSearchSpellMessages, void MSG_REPLACE_ALL_OCCURRENCES_IN_SELECTION (MemHandle replaceInfo = dx);
/*
 *	Method sent out by spell check library to tell the text object to
 *	replace all occurrences of the current word in the selected area
 *	with the passed text.
 *
 *	Pass: replaceInfo - MemHandle of block containing words
 *		   	(should be freed by method handlers)
 *	Return: nothing
 */

/****************************************************************************/

@importMessage MetaSearchSpellMessages, void MSG_ABORT_ACTIVE_SPELL ();
@importMessage MetaSearchSpellMessages, void MSG_ABORT_ACTIVE_SEARCH ();
/*
 *	Sent out to the GAGCNLT_APP_TARGET_NOTIFY_SEARCH_SPELL_CHANGE gcnlist
 *	to let the search/spell boxes know that the user has aborted the
 *	current search/spell.
 *
 *	Pass: nothing
 *	Return: nothing
 */

/****************************************************************************/

typedef enum {
    GSSOT_FIRST_OBJECT    ,
/*	This is used by the spell check code to determine in which object to
 *	start spell checking when the user clicks on "Check Entire Document".
 *	It is also used by the search code to wrap a search to the beginning
 *	after it has reached the end.
 */

    GSSOT_LAST_OBJECT    ,
/*
 *	This is used by the search code to wrap a backwards search around to
 *	the end.
 */

    GSSOT_NEXT_OBJECT    ,
/*
 *	This is used by the search/spell/replace all code to get the next
 *	object in which to continue a search/spell/replace all. At the end
 *	of the chain of objects, it should return 0:0.
 */

    GSSOT_PREV_OBJECT
/*
 *	This is used by the backwards search code. After reaching the
 *	start of the chain, it should return 0:0.
 */
} GetSearchSpellObjectOption} ;

typedef WordFlags GetSearchSpellObjectParam ;
#define GSSOP_RELAYED_FLAG 	0x8000
#define GSSOP_TYPE 		0x000f

@importMessage MetaSearchSpellMessages, optr MSG_META_GET_OBJECT_FOR_SEARCH_SPELL (GetSearchSpellObjectOption option = bp, optr curObject = cx:dx) = cx:dx;
/*
 *	This is a message that the text object sends to itself when it needs
 *	to determine in what object it should start/continue a search and
 *	replace (for example, a search can wrap across multiple objects - when
 *	the end of one object is reached, the text object sends this to
 *	itself, and the app can intercept this message to cause the search to
 *	continue in the appropriate object).
 *
 *	Pass: option - GetSearchSpellObjectParam
 *	      curObject - the object that the search/replace is currently in
 *	Return: optr of requested object
 */

/****************************************************************************/

typedef enum {
    CL_STARTING_AT_POSITION    ,
/*	Gets "numCharsToGet" chars starting at GCP_position */
    CL_ENDING_AT_POSITION    ,
/*	Gets "numCharsToGet" chars ending at the passed selection */
    CL_CENTERED_AROUND_POSITION    ,
/*	Gets "numCharsToGet" chars centered around GCP_position */
    CL_CENTERED_AROUND_SELECTION    ,
/*	Gets "numCharsToGet" chars centered around the selection */
    CL_CENTERED_AROUND_SELECTION_START    ,
/*	Gets "numCharsToGet" chars centered around the start of selection */
    CL_GET_SELECTED_WORD
/*	Gets selection, or surrounding word, or whatever */
} ContextLocation} ;

@importMessage MetaSearchSpellMessages, void MSG_META_GET_CONTEXT(@stack
                             dword position,
                        ContextLocation location,
                        word numCharsToGet,
                        optr replyObj);
/*
 *	Gets information from the destination text object so it can be
 *	displayed on the screen.
 *
 *	Pass: 	position - desired position, if ContextLocation is
 *			not one of the "SELECTION" enums.
 *		location - ContextLocation
 *		numCharsToGet - maximum # chars to return
 *		replyObj - optr of object to replay to via MSG_META_CONTEXT
 *	Return: nothing
 */

/****************************************************************************/

@importMessage MetaSearchSpellMessages, void MSG_META_GENERATE_CONTEXT_NOTIFICATION (@stack
                                                   dword position,
                        ContextLocation location,
                        word numCharsToGet,
                        optr replyObj);
/*
 *
 *	Creates a context block and sends it to the GAGCNLT_NOTIFY_TEXT_CONTEXT
 *	list.
 *
 *	Pass: 	position - desired position, if ContextLocation is
 *			not one of the "SELECTION" enums.
 *		location - ContextLocation
 *		numCharsToGet - maximum # chars to return
 *		replyObj - ignored
 *	Return: nothing
 */

/****************************************************************************/

typedef struct {
    optr    	    CD_object;
    /*	What object the context is coming from */

    dword   	    CD_numChars;
    /*	# chars in the text object */

    VisTextRange    CD_range;
    /* The range of characters that this context represents */

    VisTextRange    CD_selection;
    /* What the current text seletion is */
} ContextData} ;

@importMessage MetaSearchSpellMessages, void MSG_META_CONTEXT (
                              MemHandle data = bp);
/*
 *
 *	Message used to return context to the SpellControl object.
 *	list.
 *
 *	Pass: data - MemHandle of block containing ContextData
 *	Return: nothing (block is freed by SpellControl)
 */

/****************************************************************************/

@importMessage MetaSearchSpellMessages, void MSG_META_DISPLAY_OBJECT_FOR_SEARCH_SPELL ();
/*
 *	Force the object onto the screen.
 *
 *	Pass:	none
 *	Return:	none
 */

/*---------------------------------------------------------------------------
 * These are used by the specific ui and are special, consider carefully
 * whether or not you really want to use these.
 *--------------------------------------------------------------------------*/

@message void MSG_VIS_TEXT_SCROLL_ONE_LINE (word position = cx);
/*
 *	Scroll a one line object so a given position is displayed.
 *
 *	Pass:	position - position to make visible.
 *		     This position is kind of screwed up. It is the offset
 *		     into the text, plus the offset to the left edge of the
 *		     object, plus the lrMargin.
 *	Return:	nothing
 *	Compat:	Can only be used on one line objects
 */

/***************************************************************************/

@message sword MSG_VIS_TEXT_GET_SCROLL_AMOUNT (sword offset = dx,
                          sword scrollAmount = cx) = dx;
/*
 *	Decide the amount to scroll vertically.
 *
 *	Pass:	offset - offset to scroll from.
 *		scrollAmount - suggested amount to scroll.
 *				(Positive or negative).
 *	Return:	amount to scroll.
 *	Compat:	Cannot be use on one line objects
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SCROLL_PAGE_UP ();
@message void MSG_VIS_TEXT_SCROLL_PAGE_DOWN ();
/*
 *	Scrolls a text object up or down a page if it's scrollable
 *	PASS: 	nothing
 *	RETURN: nothing
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_SCREEN_UPDATE ();
/*
 *	Make the screen update itself
 *	PASS: 	nothing
 *	RETURN: nothing
 */

/*------------------------------------------------------------------------
 * 	These are used internally and shouldn't be used by anyone...
 *------------------------------------------------------------------------*/

@message void MSG_VIS_TEXT_FLASH_CURSOR_ON ();
@message void MSG_VIS_TEXT_FLASH_CURSOR_OFF ();
/*
 *	Flash the cursor on or off.
 *	PASS: 	nothing
 *	RETURN: nothing
 */

/***************************************************************************/

typedef ByteFlags SpellCheckFromOffsetFlags ;
#define SCFOF_CHECK_NUM_CHARS 		0x01
/* 	if set, will spell check the passed # chars */

@message void MSG_VIS_TEXT_SPELL_CHECK_FROM_OFFSET(@stack
                           optr	 replyObject,
                           dword startOffset,
                           dword numCharsToCheck,
                           SpellCheckFromOffsetFlags flags,
                           MemHandle icBuff);
/*
 *	Starts a spell check in this object at the passed offset.
 *	It ignores the SpellCheckStartOption field, and instead uses
 *	startOffset.
 *
 *	Pass: 	replyObject - object reply messages (such as
 *				SPELL_CHECK_COMPLETED) should be sent to
 *		startOffset - offset into text to begin spell checking
 *		numCharsToCheck - total # chars to spell check (if we want
 *				to skip the next word, the size of that word
 *				is deducted from this total.)
 *		flags - flags to say whether or not to skip the
 *				next word in the document
 *		icBuff - ICBuff to pass to spell check library
 *
 *	Returns: nothing
 */

/***************************************************************************/

typedef ByteFlags SearchFromOffsetFlags ;
#define SFOF_STOP_AT_STARTING_POINT 	0x01
/*	Set (internally) if this search has wrapped around  	*/

typedef struct {
    optr	SFORS_object;	/* object that match was found in (0:0 if
                   not found) */
    dword	SFORS_offset;	/* offset into object where was was found
                   (ala VisTextRange) */
    dword	SFORS_len;	/* length of the match */
} SearchFromOffsetReturnStruct} ;

@message void MSG_VIS_TEXT_SEARCH_FROM_OFFSET(@stack
                      SearchFromOffsetReturnStruct *retStruct,
                SearchFromOffsetFlags flags,
                dword currentOffset,
                dword startOffset,
                dword startObject,
                MemHandle searchReplaceStruct);
/*
 *
 *	Does a wrap-around search from the passed offset into the text object.
 *
 *	Pass: 	retStruct - pointer to SearchFromOffsetReturnStruct
 *		flags - SearchFromOffsetFlags
 *		currentOffset - offset between chars in text object to
 *			start search (can range from 0 to <text size>).
 *		startOffset - offset into object where current search began.
 *			This offset is *not* an offset to a char, but rather
 *			an offset between chars (i.e. the beginning of an
 *			object is 0, between the first second chars = 1, etc.)
 *			(can range from 0 to <text size>)
 *		startObject - object where current search began
 *		searchReplaceStruct - handle of block with data in this
 *			format:
 *				SearchReplaceStruct<>
 *				data Null-terminated Search string
 *				data Null-terminated Replace string
 *
 *
 *	Return: *retStruct filled in
 */

/****************************************************************************/

typedef WordFlags   ReplaceAllFromOffsetFlags   ;
#define	RAFOF_CONTINUING_REPLACE	    0x8000
/* Set if this message was generated to continue a replace all sent to
 * a different object
 */

#define	RAFOF_HAS_UNDO	 	    	    0x4000
/* Set if this action will be undoable - mainly used for error-checking,
 * to ensure that all objects involved in a ReplaceAll are undoable.
 */

@message word MSG_VIS_TEXT_REPLACE_ALL_OCCURRENCES_FROM_OFFSET(@stack
                ReplaceAllFromOffsetFlags flags,
                 dword offset,
                 MemHandle infoHan) = cx;
/*
 *	Method sent out by text object to do a "replace all" from the passed
 *	offset.
 *
 *	Pass: 	flags - ReplaceAllFromOffsetFlags, they are set internally
 *			by the text object - do not set them.
 *		offset - offset in this object to begin replace all
 *		infoHan - handle of block with data in this format:
 *				SearchReplaceStruct<>
 *				data Null-terminated Search string
 *				data Null-terminated Replace string
 *
 *		     (This replace all is assumed to start at the passed offset
 *		       and continue until the end of the chain of text objects
 *		       is reached)
 *
 *	Returns: number of replaces that actually occurred
 */

/***************************************************************************/

@message word MSG_VIS_TEXT_REPLACE_ALL_OCCURRENCES_IN_RANGE
                        (@stack VisTextRange range,
             MemHandle infoHan) = cx;
/*
 *	Method sent out by text object to do a "replace all" over the passed
 *	range.
 *
 *	Pass:   range - VisTextRange to do replace all in
 *		infoHan - handle of block with data in this format:
 *				SearchReplaceStruct<>
 *				data Null-terminated Search string
 *				data Null-terminated Replace string
 *	NOTE: The sender of this message is responsible for freeing
 *		the passed SearchReplaceStruct.
 *
 *	Return: number of replaces that actually occurred
 */

@reserveMessages 1;

/*---------------------------------------------------------------------------
 *	Text filters
 *--------------------------------------------------------------------------*/

typedef ByteEnum VisTextFilterClass ;
#define VTFC_NO_FILTER 	 		0	/* no filter */
#define VTFC_ALPHA  			1	/* alpha chars only */
#define VTFC_NUMERIC 	 		2	/* numeric only */
#define VTFC_SIGNED_NUMERIC 	 	3	/* signed numeric */
#define VTFC_SIGNED_DECIMAL 	 	4	/* numeric, with decimal */
#define VTFC_FLOAT_DECIMAL 	 	5	/* numeric, decimal, e, E */
#define VTFC_ALPHA_NUMERIC  		6	/* alphanumeric */
#define VTFC_FILENAMES 	 		7	/* legal GEOS filenames */
#define VTFC_DOS_FILENAMES  		8	/* legal DOS filenames */
#define VTFC_DOS_PATH  			9	/* legal DOS path */
#define VTFC_DATE  			10	/* legal date */
#define VTFC_TIME 	 		11 	/* legal time */
#define VTFC_DASHED_ALPHA_NUMERIC  	12	/* alphanumeric plus '-' */
#define VTFC_NORMAL_ASCII  		13	/* normal ascii chars */
#define VTFC_DOS_VOLUME_NAMES  		14	/* legal DOS volume names */
#define VTFC_DOS_CHARACTER_SET  		15	/* DOS character set */
#define VTFC_ALLOW_COLUMN_BREAKS  	16	/* allow column breaks */

typedef ByteFlags VisTextFilters ;
#define VTF_NO_SPACES 		0x80	/* no spaces allowed */
/* NOTE: This only filters out C_SPACE in text libraries v3.1 and below.
 *	 Starting with 3.2, non-breaking-spaces, em-spaces, etc get filtered
 *	 as well.
 */
#define VTF_NO_TABS 		0x40	/* no tabs */
#define VTF_UPCASE_CHARS     	0x20	/* make uppercase */
#define VTF_FILTER_CLASS 	0x1f	/* VisTextFilterClass */

/*
 * Specific UI's define mappings between keys and functions using the following
 * data structures.
 */
typedef enum /* word */ {
    VTKF_FORWARD_LINE    =0,
    VTKF_BACKWARD_LINE    =6,
    VTKF_SELECT_ADJUST_FORWARD_LINE    =12,
    VTKF_SELECT_ADJUST_BACKWARD_LINE    =18,
    VTKF_FORWARD_CHAR    =24,
    VTKF_BACKWARD_CHAR    =30,
    VTKF_FORWARD_WORD    =36,
    VTKF_BACKWARD_WORD    =42,
    VTKF_FORWARD_PARAGRAPH    =48,
    VTKF_BACKWARD_PARAGRAPH    =54,
    VTKF_START_OF_LINE    =60,
    VTKF_END_OF_LINE    =66,
    VTKF_START_OF_TEXT    =72,
    VTKF_END_OF_TEXT    =78,
    VTKF_SELECT_WORD    =84,

/****************************************************************************/
/*	 None of the following entries are supported:
 *		VTKF_SELECT_LINE
 *		VTKF_SELECT_PARAGRAPH
 *		VTKF_SELECT_OBJECT
 */
    VTKF_SELECT_LINE    =90,
    VTKF_SELECT_PARAGRAPH    =96,
    VTKF_SELECT_OBJECT    =102,
/****************************************************************************/

    VTKF_SELECT_ADJUST_FORWARD_CHAR    =108,
    VTKF_SELECT_ADJUST_BACKWARD_CHAR    =114,
    VTKF_SELECT_ADJUST_FORWARD_WORD    =120,
    VTKF_SELECT_ADJUST_BACKWARD_WORD    =126,
    VTKF_SELECT_ADJUST_FORWARD_PARAGRAPH    =132,
    VTKF_SELECT_ADJUST_BACKWARD_PARAGRAPH    =138,
    VTKF_SELECT_ADJUST_TO_START    =144,
    VTKF_SELECT_ADJUST_TO_END    =150,
    VTKF_SELECT_ADJUST_START_OF_LINE    =156,
    VTKF_SELECT_ADJUST_END_OF_LINE    =162,
    VTKF_DELETE_BACKWARD_CHAR    =168,
    VTKF_DELETE_BACKWARD_WORD    =174,
    VTKF_DELETE_BACKWARD_LINE    =180,
    VTKF_DELETE_BACKWARD_PARAGRAPH    =186,
    VTKF_DELETE_TO_START    =192,
    VTKF_DELETE_CHAR    =198,
    VTKF_DELETE_WORD    =204,
    VTKF_DELETE_LINE    =210,
    VTKF_DELETE_PARAGRAPH    =216,
    VTKF_DELETE_TO_END    =222,
    VTKF_DELETE_EVERYTHING    =228,
    VTKF_DESELECT    =234,
    VTKF_TOGGLE_OVERSTRIKE_MODE    =240,
    VTKF_TOGGLE_SMART_QUOTES    =246,
    VTKF_PAGE_UP    =252,
    VTKF_PAGE_DOWN    =258,
    VTKF_INSERT_TIME    =264,
    VTKF_INSERT_DATE    =270,
    VTKF_INSERT_NAME    =276,
    VTKF_SELECT_ADJUST_BACKWARD_PAGE    =282,
    VTKF_SELECT_ADJUST_FORWARD_PAGE    =288
} VisTextKeyFunction} ;

/************************************************************************/

@message void MSG_VIS_TEXT_DO_KEY_FUNCTION (VisTextKeyFunction func = cx,
                       word data = bp);
/*
 *	Perform one of the VisTextKeyFunction on a text object without
 *	having had to hit the proper key. Useful when GenDataTriggers are what
 *	are performing the function and you don't want to/can't figure out the
 *	shortcut being used by the specific UI to implement the function.
 *
 *	Pass:	func - VisTextKeyFunction to perform
 *		data - data for function
 *	Return:	nothing
 *	Compat:	Can be used with all text objects.
 */

/****************************************************************************
 *	      Method for getting text from a text object
 ****************************************************************************/

@message Boolean MSG_VIS_TEXT_REPLACE_TEXT (VisTextReplaceParameters
                    *params = ss:bp) = carry;
/*
 *	Replace a range of text with some new text.
 *
 *	Pass:	params - pointer to a VisTextReplaceParameters structure
 *			See VisTextReplace() for more details (below)
 *			on how to create and pass this structure.
 *			Really, you ought to look...
 *	Return:	TRUE if error
 *	Compat:	Can be used with all text objects
 */

/************************************************************************/

/*
 * It is important to know that if you pass the "allocate" or "allocate always"
 * flags there are some fields that need to be filled in. These are documented
 * in the various TextReference* structure definitions.
 */
typedef ByteFlags VisTextGetTextRangeFlags ;
#define VTGTRF_ALLOCATE 	    	0x80	/* set: allocate destination */
                    /* clear: use destination provided */
#define VTGTRF_ALLOCATE_ALWAYS 	0x40	/* set: allocate even if no text */
                    /* clear: use destination provided */
#define VTGTRF_RESIZE_DEST 	0x20	/* set: if possible resize the
                     * destination so that it is just
                     * large enough to hold the text and
                     * no larger.
                     */

@message dword MSG_VIS_TEXT_GET_TEXT_RANGE(@stack
                       VisTextGetTextRangeFlags flags,
                       TextReference reference,
                       dword rangeEnd,
                       dword rangeStart) = dx.ax;
/*
 * Get a range of text from the text object. The buffer must be able to hold
 * the number of bytes requested. The caller is responsible for making sure
 * that this is the case. It is legal to ask for more characters than actually
 * exist in the text object.
 *	The returned string is null terminated in every case except
 *	when the user requests the string in a huge-array.
 *
 *	PASS:	flags - VisTextGetTextRangeFlags specifiying how to
 *	    	    	allocate space for the text
 *	    	reference - TextReference specifying what type of
 *	    	    	buffer to allocate
 *	    	rangeEnd - end of range to get
 *	    	rangeStart - start of range to get
 *
 *	RETURN:	Number of characters in the returned string, not
 *			  counting any NULL terminator.
 *		If a buffer was allocated, the TextReferenceUnion
 *	    	structure will hold the handle of the appropriate type.
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_SELECT_RANGE(@stack dword end, dword start);
/*
 *	Sets the selected area of the text to the passed range.
 *
 *	PASS:	end - end of range
 *		start - start of range
 *	RETURN: nothing
 *	COMPAT:	Can be used with all text objects.
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_SHOW_POSITION (dword position);
/*
 *	Display a position in the text on the screen.
 *
 *	Pass:	position = Offset into the text to display.
 *		This can be any of the special values for VTR_start.
 *	Compat:	Can be used with all text objects
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_SET_FILTER (VisTextFilters filter = cl);
/*
 *	Sets the current text filter.
 *
 *	Note: This does not affect any text that already exists in the text
 *	      object.
 *
 *	Pass: 	filter - VisTextFilters
 *	Return: nothing
 *	Compat: Can be used with all text objects
 */

/**************************************************************************/

@message VisTextFilters MSG_VIS_TEXT_GET_FILTER () = cl;
/*
 *	Gets the current text filter.
 *
 *	Pass: nothing
 *	Return:  VisTextFilters
 *	Compat: Can be used with all text objects
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_SET_OUTPUT (optr newOutput = cx:dx);
/*
 *	Sets the VTI_output field.
 *
 *	Pass: newOutput - new optr
 *	Return: nothing
 *	Compat: Can be used with all text objects
 */

/**************************************************************************/

@message optr MSG_VIS_TEXT_GET_OUTPUT () = cx:dx;
/*
 *	Gets the VTI_output field.
 *
 *	Pass: nothing
 *	Return: optr of Output object
 *	Compat: Can be used with all text objects
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_SET_LR_MARGIN (byte lrMargin = cl);
/*
 *	Sets the VTI_lrMargin field.
 *	NOTE: Should not be used with GenText objects, as the specific UI
 *	      likes to set this itself.
 *
 * 	Pass: lrMargin - new Left/Right margin
 *	Return: nothing
 *	Compat: Should not be used with Gen-based text objects;
 */

/**************************************************************************/

@message byte MSG_VIS_TEXT_GET_LR_MARGIN () = cl;
/*
 *	Gets the VTI_lrMargin field.
 *	NOTE: Should not be used with GenText objects, as the specific UI
 *	      likes to set this itself.
 *
 * 	Pass: nothing
 *	Return: current Left/Right margin
 *	Compat: Should not be used with Gen-based text objects;
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_SET_TB_MARGIN (byte tbMargin = cl);
/*
 *	Sets the VTI_tbMargin field.
 *	NOTE: Should not be used with GenText objects, as the specific UI
 *	      likes to set this itself.
 *
 * 	Pass: tbMargin - new top/bottom margin
 *	Return: nothing
 *	Compat: Should not be used with Gen-based text objects;
 */

/**************************************************************************/

@message byte MSG_VIS_TEXT_GET_TB_MARGIN () = cl;
/*
 *	Gets the VTI_tbMargin field.
 *	NOTE: Should not be used with GenText objects, as the specific UI
 *	      likes to set this itself.
 *
 * 	Pass: nothing
 *	Return: current top/bottom margin
 *	Compat: Should not be used with Gen-based text objects;
 */

/**************************************************************************/

typedef WordFlags VisTextHWRFlags ;
#define	VTHWRF_NO_CONTEXT	   	    0x8000
/*	 This is sent when the ink is being quick-copied to the object, or
 *	 in other cases where the user did not draw the ink on top of the
 *	 object, and so the position of the object is not useful information
 *	 for the recognizer.
 */
#define	VTHWRF_USE_PASSED_CONTEXT	   0x4000

@message void MSG_VIS_TEXT_REPLACE_WITH_HWR(@stack HWRContext context,
                        MemHandle ink,
                        VisTextHWRFlags flags,
                        VisTextRange range);
/*
 *	Does HWR on the current text object.
 *
 *	PASS:	context - HWRContext
 *		ink - MemHandle of InkHeader block.
 *			Call MemDecRefCount on ink block when done.
 *		flags - VisTextHWRFlags
 *		range - VisTextRange
 *
 *	RETURN: nothing
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_SET_HWR_CONTEXT ();
/*
 *	This sets up the context for the current handwriting recognition
 *	attempt. This allows the specific UI to set up the context depending
 *	upon what is visible.
 *
 *	NOTE: If you want to set your own context, do not pass this message
 *	      to the superclass, as the VisText handler resets the context
 *	      to "none".
 *
 *	Pass: nothing
 *	Returns: nothing
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_SET_HWR_FILTER ();
/*
 *	Sets up the filter for the current handwriting recognition attempt.
 *	This allows an app writer to set up his own custom filters instead.
 *
 *	Pass: nothing
 *	Returns: nothing
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_SET_SELECTED_TAB (word position = cx);
/*
 *	Set the position of the selected tab.
 *
 *	Pass: position - position to set (13.3), -1 for none
 *	Returns: nothing
 */

/**************************************************************************/

@message dword MSG_VIS_TEXT_GET_TEXT_SIZE () = dx:ax;
/*
 *	Get the length of the text.
 *
 *	Pass:  nothing
 *	Returns: text length (number of chars)
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_INVALIDATE_RANGE (VisTextRange *vtr = dx:bp);
/*
 * Invalidate a range in a suspended object or else force recalculation of
 * the range in an active object.
 *
 *	Pass:  vtr - pointer to VisTextRange
 *	Returns: nothing
 */

/**************************************************************************/

@message void MSG_VIS_TEXT_ATTRIBUTE_CHANGE ();
/*
 *	The text object sends this message to itself when it is changing
 *	its attributes.
 *	PASS: nothing
 *	RETURN: nothing
 */

/**************************************************************************/

typedef	struct {
    LineInfo 	*VTGLIP_buffer;		/* Pointer to buffer to use */
    /* This method handler will return a LineInfo structure followed by
     * a number of FieldInfo structures, depending upon how many tabs
     * are in the line.
     */
    word 	VTGLIP_bsize;		/* Size of buffer */
    dword 	VTGLIP_line;		/* Line to get information for */
} VisTextGetLineInfoParameters} ;

typedef	struct {
    word    	VTGLIRV_unused;
    word    	VTGLIRV_byteCount;
} VisTextGetLineInfoReturnValues} ;

@message Boolean MSG_VIS_TEXT_GET_LINE_INFO (
            VisTextGetLineInfoReturnValues *retValue = dxcx,
                VisTextGetLineInfoParameters *vtglip = dx:bp) = carry;
/*
 * Get line and field information associated with a given line of the
 * text object.
 *	PASS:	dx:bp	= VisTextGetLineInfoParameters
 *	RETURN:	if TRUE -
 *	    	    Buffer filled with line info
 *		    *retValue->VTGLIRV_byteCount - Number of bytes copied
 *		FALSE if there is no such line
 */

/****************************************************************************/

/*
 * This is what is stored with each name in the ElementArray.
 */

typedef struct {
    NameArrayElement	VTNAE_meta;
    VisTextNameData	VTNAE_data;
} VisTextNameArrayElement} ;

typedef	ByteFlags VisTextNameCommonFlags ;
#define	VTNCF_COLOR_MONIKERS_FOR_UNSET_CONTEXTS		0x80
                        /* SET: use green gstring
                         *  monikers for context
                         *  names not yet applied
                         * CLEAR: use a regular text
                         *  moniker for all names
                         */
#define	VTNCF_DISABLE_MONIKERS_FOR_SET_CONTEXTS		0x40
                        /* SET: disable monikers
                         *  for context names
                         *  applied to text
                         */

typedef struct {
    VisTextNameData		VTNCP_data;	/* type (context or file)
                         *  & file */
    word    	    		VTNCP_index;    /* index of name   	     */
    optr    	    		VTNCP_object;   /* OD of object to update    */
    word    	    		VTNCP_message;	/* message to send to object */
    VisTextNameCommonFlags	VTNCP_flags;	/* flags for some of the
                             messages that use
                             this structure */
    byte			VTNCP_unused;
} VisTextNameCommonParams} ;

/****************************************************************************/
 /*XXX*/
@message void MSG_VIS_TEXT_DEFINE_NAME (VisTextNameCommonParams *data=ss:bp);
/*
 *	Define a new name (context or file)
 *
 *	PASS:	data - ptr to VisTextNameCommonParams
 *			VTNCP_data - type and associated file
 *			VTNCP_object - text object with name
 *	RETURN: nothing
 */

/****************************************************************************/

 /*XXX*/
@message void MSG_VIS_TEXT_DELETE_NAME (VisTextNameCommonParams *data=ss:bp);
/*
 *	Delete a name (context or file)
 *
 *	PASS:	data - ptr to VisTextNameCommonParams
 *			VTNCP_data - type and associated file
 *			VTNCP_index - index of name in list
 *	RETURN: nothing
 */

/****************************************************************************/

 /*XXX*/
@message void MSG_VIS_TEXT_RENAME_NAME (VisTextNameCommonParams *data=ss:bp);
/*
 *	Rename a name (context or file)
 *
 *	PASS:	data - ptr to VisTextNameCommonParams
 *			VTNCP_data - type and associated file
 *			VTNCP_index - index of name in list
 *			VTNCP_object - text object with new name
 *	RETURN: nothing
 */

/****************************************************************************/

 /*XXX*/
@message void MSG_VIS_TEXT_UPDATE_NAME_LIST (VisTextNameCommonParams
                        *data = ss:bp);
/*
 *	Update a list of names
 *
 *	PASS:	data - ptr to VisTextNameCommonParams
 *			VTNCP_data - type and associated file
 *			VTNCP_object - list object to update
 *	RETURN: nothing
 */

/****************************************************************************/

 /*XXX*/
@message void MSG_VIS_TEXT_GET_NAME_LIST_MONIKER (VisTextNameCommonParams
                         *data = ss:bp);
/*
 *	Get a moniker for a name list
 *
 *	PASS:	data - ptr to VisTextNameCommonParams
 *			VTNCP_data - type and associated file
 *			VTNCP_index - index of name in list
 *			VTNCP_object - object to update
 *	    	    	VTNCP_message - message to send to object
 *	RETURN: nothing
 */

/****************************************************************************/

typedef struct {
    VisTextRange VTFHLP_range;
} VisTextFollowHyperLinkParams} ;

/*XXX*/
@message void MSG_VIS_TEXT_FOLLOW_HYPERLINK (
                        VisTextFollowHyperLinkParams *params = ss:bp);
/*
 *	 Follow the selected hyperlink
 *
 * NOTE: if the selection includes more than one hyperlink, the run at ""
 * the start of the selection is used
 *
 *	Pass: params - VisTextFollowHyperLinkParams
 */

/****************************************************************************/

@message dword MSG_VIS_TEXT_GET_LINE_FROM_OFFSET (dword offset=cx.dx) = dx.ax;
/*
 * Return the line number given an offset into the text
 *
 * 	PASS:	offset - offset into text
 * 	RETURN: line number
 */

/****************************************************************************/

typedef struct {
    dword	VTGLOAFP_line;		/* Pass this - line to get info for */
    dword	VTGLOAFP_offset;	/* returned offset to line start */
    LineFlags	VTGLOAFP_flags;		/* returned LineFlags */
} VisTextGetLineOffsetAndFlagsParameters} ;

/*XXX*/
@message Boolean MSG_VIS_TEXT_GET_LINE_OFFSET_AND_FLAGS (
    VisTextGetLineOffsetAndFlagsParameters *params=dx:bp) = carry;
/*
 *	Get the offset where a line starts and the LineFlags associated with
 *	that line.
 *	PASS:	params	= ptr to VisTextGetLineOffsetAndFlagsParameters
 *
 *	RETURN:	Buffer filled in
 *		TRUE if the line does not exist
 */

/****************************************************************************/

@message dword MSG_VIS_TEXT_GET_TEXT_POSITION_FROM_COORD (
                    PointDWFixed *coord = ss:bp) = dx:ax;
/*
 * Get the nearest character position to the specified coordinate.
 *
 *	PASS:	coord - PointDWFixed to check
 *	RETURN:	dword - the nearest character position
 *	    	coord updated with the nearest valid X and Y positions
 *			replacing the position of the event
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_GET_NAME_LIST_NAME_TYPE (VisTextNameCommonParams
                           *data=ss:bp); /*XXX*/
/*
 *	 Get and update the type for a name in a name list
 *
 *	PASS:	data - ptr to VisTextNameCommonParams
 *		    VTNCP_data - type and associated file
 *		    VTNCP_index - index of name in list
 *		    VTNCP_object - list object to update
 *	RETURN:	none
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_CROSS_SECTION_REPLACE_ABORTED ();
/*
 *	Notification that a cross section change has been aborted (sent
 *	by the text object to itself)
 *
 *	PASS:	nothing
 *	RETURN:	nothing
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_SET_SPELL_IN_PROGRESS ();	/* private */
@message void MSG_VIS_TEXT_SET_SEARCH_IN_PROGRESS (); 	/* private */
/*
 *	Basically just sets the "Search/Spell in progress" flag.
 *
 *	Pass: nothing
 *	Returns: nothing
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_LOAD_FROM_DB_ITEM_FORMAT (void *data = cx:dx);
/*
 * Loads a text object with data that had been previously saved to a DB item.
 * This allows things (like the help control) to compact the DB item produced
 * by MSG_VIS_TEXT_SAVE_TO_DB_ITEM, then uncompact/load it.
 *
 *	 Pass: data - ptr to data to load
 *	 Return: nothing
 */

/****************************************************************************/

@message void MSG_VIS_TEXT_GET_RUN_BOUNDS(@stack VisTextRange *retVal,
                      word runOffset, dword position);
/*
 * Gets the bounds of the run that starts at or before the passed position
 *
 * 	Pass: retVal - ptr to VisTextRange to fill in with the run bounds
 *	      runOffset - run offset
 *	      position - position to check for run around
 *
 * 	Return: VisTextRange pointed to retVal - filled in
 */

/****************************************************************************/

@protominor TextNewForZoomer

#define OFFSET_FOR_TYPE_RUNS 	0
#define OFFSET_FOR_GRAPHIC_RUNS 	1

/*XXX*/
@message void MSG_VIS_TEXT_FREE_ALL_STORAGE (Boolean removeElementArrays = cx);
/*
 *	Superset of MSG_VIS_TEXT_FREE_STORAGE.  Also frees text
 *	storage and line structures storage.
 *
 *	 NOTE:  This message was added 6/17/93
 *
 *	 Pass: removeElementArrays - TRUE to remove element arrays also
 *	 Return: none
 */

@protoreset

/****************************************************************************/

@message void MSG_VIS_TEXT_GENERATE_CURSOR_POSITION_NOTIFICATION ();
/*
 * Generate cursor position notification.
 *
 * Pass:       none
 * Return:     none
 */

/****************************************************************************/

@message dword MSG_VIS_TEXT_GET_SELECTION_START () = dx:cx;
/*
 * Get the selection start.
 *
 * Pass:         nothing
 *
 * Return:       Selection start
 */

/****************************************************************************/

@message GStateHandle MSG_VIS_TEXT_GET_GSTATE () = cx;
/*
 * Get the gstate of the text object's window.
 *
 * Pass:         nothing
 *
 * Return:       gstate handle
 */

/****************************************************************************/

typedef struct {
  word VTGFEPB_layerID;
  word VTGFEPB_baselineOffset;
} VisTextGetFEPBounds} ;

@message Boolean MSG_VIS_TEXT_GET_FEP_BOUNDS (
                        VisTextGetFEPBounds *retVal = dxcx,
                    Rectangle *rect = dx:bp) = carry;
/*
 * Get the cursor position in document coordinates.  (PIZZA only)
 *
 * Pass:    retVal - pointer to VisTextGetFEPBounds
 *	    rect - pointer Rectangle to place bounds in
 *
 * Return:  TRUE iff bounds invalid
 *	    *retVal, *rect filled in
 */

/***************************************************************************/

@protominor TextNewForHelpEditor
@message void MSG_VIS_TEXT_DELETE_ALL_HYPERLINKS(@stack
                     VisTextSetContextFlags flags,
                     word file,
                             word context,
                     dword rangeEnd, dword rangeStart);
/*
 * 	Given a virtual range of text, clear all the hyperlinks
 *	within that range.  This routine is used by the help editor.
 *	The flags argument is ignored.  File should be GIGS_NONE and
 *	context should be 0.  These arguments are passed so that the
 *	routine can be easily called from the help editor.
 */

/***************************************************************************/

@message void MSG_VIS_TEXT_UNSET_ALL_CONTEXTS(@stack
                     VisTextSetContextFlags flags,
                             word context,
                     dword rangeEnd, dword rangeStart);
/*
 *	Given a virtual range of text, unset all the contexts
 * 	within that range.  This routine is used by the help editor.
 *	The flags argument is ignored.  The context argument should
 *	be GIGS_NONE.  These arguments are passed only to be consistent
 *	with the way the help editor sends messages to the text object.
 */

typedef struct {
    dword   VTCOP_offset;	/* pass: offset to convert  	    */
                                /* return: offset of returned position */
    sdword   VTCOP_xPos;	/* return: x position of offset	    */
    sdword   VTCOP_yPos;    	/* return: y position of offset	    */
} VisTextConvertOffsetParams} ;

/***************************************************************************/

@message void MSG_VIS_TEXT_CONVERT_OFFSET_TO_COORDINATE (
            VisTextConvertOffsetParams *params = dx:bp);
/*
 * Convert an offset into the text into its document coordinate. If the
 * passed offset is beyond the end of the text, it will be updated to the
 * last valid offset and the coordinate of that offset will be returned.
 *
 *	Pass:	VisTextConvertOffsetParams
 *	Return: VisTextConvertOffsetParams filled in
 */

@protoreset

/***************************************************************************/

@protominor TextNewForCondo

@message void MSG_VIS_TEXT_SET_HYPERLINK_TEXT_STYLE(@stack
                  VisTextExtendedStyles extBitsToClear,
                  VisTextExtendedStyles extBitsToSet,
                  TextStyle styleBitsToClear,
                  TextStyle styleBitsToSet,
                                     dword rangeEnd, dword rangeStart);
/*
 * 	Given a virtual range of text, set a style on all the hyperlinks
 *	within that range.  This routine is used by the hyperlink controller.
 */

/***************************************************************************/

typedef WordFlags VisTextUpdateGraphicFlags ;
#define VTUGF_RECALC 	    	(0x8000)
/* recalc and redraw after updating */

#define VTUGF_NEW_ELEMENT 	(0x4000)
/* If the graphic being updated has multiple references, create a new
 * element for this run instead of changing the original.
 */

typedef enum {
/*
 * No errors occurred, and the element was updated
 */
    UGRV_MODIFIED_ELEMENT    ,
    /* The graphic element's data was replaced with the passed data
     */
    UGRV_CREATED_NEW_ELEMENT    ,
    /* A new graphic element was created using the passed data, and the
     * old element was left untouched
     */
/*
 * Errors occurred, so the element was not updated
 */
    UGRV_INVALID_GRAPHIC_TYPE    ,
    /* The passed VTG_type field contains an invalid value
     */
    UGRV_INVALID_GRAPHIC_FLAGS    ,
    /* The passed VTG_flags field contains an invalid value
     */
    UGRV_INVALID_GSTRING_SIZE    ,
    /* The passed VTG_size field contains an invalid value.
     * A gstring graphic cannot have zero size.
     */
    UGRV_INVALID_GSTRING_VMCHAIN_HANDLE    ,
    /* The passed VTG_vmChain.high field contains an invalid value.
     * This field should contain the VMBlock handle for a VMChain.
     */
    UGRV_INVALID_GSTRING_VMCHAIN    ,
    /* The passed vmChain contains invalid data
     */
    UGRV_INVALID_VARIABLE_TYPE    ,
    /* The passed variable graphic type is invalid
     */
    UGRV_INVALID_VARIABLE_VMCHAIN_HANDLE    ,
    /* The passed VTG_vmChain field is non-zero, but for a
     * variable graphic it should be zero.
     */
    UGRV_INVALID_VARIABLE_MANUFACTURER_ID    ,
    /* The value in VTG_data.VTGD_variable.VTGV_manufacturerID is invalid
     */
    UGRV_INVALID_VARIABLE_PRIVATE_DATA    ,
    /* The values in VTG_data.VTGD_variable.VTGV_privateData do not
     * match the expected data types.
     */
} UpdateGraphicReturnValue} ;

@message UpdateGraphicReturnValue MSG_VIS_TEXT_UPDATE_GRAPHIC_ELEMENT(
                   @stack VisTextUpdateGraphicFlags flags,
                       VisTextGraphic graphic,
                       dword position) = ax;
/*
 * Updates the VisTextGraphic element for the graphic run at the passed
 * position with the new graphic data (does not copy VTG_meta).
 *
 * Be careful when changing the VTG_vmChain field, or modifying the
 * old VMChain.  Multiple runs may point to the same graphic element,
 * and if it is modified or replaced, all of those runs will take
 * on the characteristics of the new graphic, unless the VTUGF_NEW_ELEMENT
 * flag is passed.  This flag will cause a new element to be created
 * for this run if the original graphic is used by more than 1 run.
 *
 * If the VTUGF_NEW_ELEMENT flag is passed, the VMChain in the new
 * graphic must be a new VMChain, which is in the text object's file.
 * The caller should never free the old VMChain when this flag is passed.
 *
 * If the VTUGF_NEW_ELEMENT flag is not passed, the caller can modify
 * or replace the old VMChain.  If replacing it (if the passed VTG_vmChain
 * field differs fromt the original graphic element's VTG_vmChain field),
 * the new VMChain must be in the same file as the old one (the text
 * object's file).  The caller should free the old VMChain if the return
 * value is UGRV_MODIFIED_ELEMENT and a new VMChain was passed in VTG_data.
 *
 *
 *	Pass:	flags - VisTextUpdateGraphicFlags
 *	    	position - graphic's position in text
 *	    	graphic -  new VisTextGraphic
 *	Return: UpdateGraphicReturnValue
 */

@protoreset

/***************************************************************************/

@protominor TextNewForPizza

@importMessage MetaTextMessages, void MSG_VIS_TEXT_SET_TEXT_MISC_MODE(@stack byte miscModeFlags,
                          dword rangeEnd, dword rangeStart);

/*
 * Set the text misc mode bits (eg. char vs. word spacing)
 */

@protoreset

/***************************************************************************/

@protominor TextNewerForCondo

@message void MSG_VIS_TEXT_NAME_TOKENS_TO_LIST_INDICES (
                VisTextNotifyTypeChange *type = ss:bp);
/*
 * Convert a VisTextType's name tokens to their list indices.
 *
 * Pass: 	type->VTNTC_type - filled with name tokens
 * Return:	type->VTNTC_index - filled with corresponding indices
 */

@importMessage MetaTextMessages, void MSG_META_TEXT_SET_HYPERLINK(@stack
                     VisTextSetContextFlags flags,
                     word file,
                             word context,
                     dword rangeEnd, dword rangeStart);
/*
* Context:	Sent to set a hyperlink on a range of text associated with
* 		the recipient object.
* Source:	Hyperlink controller
* Destination:	Text object or any object embedded in the text.
* Interception: Default behavior is to set a hyperlink on the currently
*		selected range of text. In order for an object embedded
*		in the text to be hyperlinkable, it must intercept
*		this message, alter the rangeEnd and rangeStart parameters
*		to specify the position	of its associated C_GRAPHIC
*		character, and then pass the message on to the text object.
*/

@importMessage MetaTextMessages, void MSG_META_TEXT_FOLLOW_HYPERLINK(@stack
                     dword rangeEnd, dword rangeStart);
/*
* Context:	Sent to follow a hyperlink on a range of text associated with
* 		the recipient object.
* Source:	Hyperlink controller
* Destination:	Text object or any object embedded in the text.
* Interception: Default behavior is to follow a hyperlink on the currently
*		selected range of text. In order for a hyperlink on an
*		object embedded to be followable, the object must intercept
*		this message, alter the VTFHLP_range field of the
*		passed VisTextFollowHyperlinkParams to specify the position
*		of its associated C_GRAPHIC character, and then pass
*		the message on to the text object.
*/

@message word MSG_VIS_TEXT_FIND_NAME_BY_INDEX(@stack char *name,
                          word file, VisTextNameType type,
                          word index) = ax;
/*
 *	Return the data for a name index
 *
 *	Pass:	char *name - buffer of size MaxNameArrayElement
 *	    	file - index of file name, if type = VTNT_CONTEXT
 *	    	type - VisTextNameType for index to find name for
 *	    	index - index to find name for
 *	Return:	name buffer filled with VisTextNameArrayElement
 *		token for index, or CA_NULL_ELEMENT if
 *			name was not found
 *	Compat:	This method cannot be used on a text object that does not have
 *		multiple types
 */

@protoreset

@protominor TextNewFor2_1

@message void MSG_VIS_TEXT_REGION_FROM_POINT (); /*XXX*/
/*
 *  INTERNAL USE ONLY
 *
 *  Get the region associated with a given point.
 *
 *  WARNING: THIS MESSAGE CANNOT BE SENT FROM GOC.
 */

@protoreset

@protominor TextEvenNewerForCondo

@message void	MSG_VIS_TEXT_GET_NAME_LIST_MONIKER_FRAME	(
                VisTextNameCommonParams *data=ss:bp); /*XXX*/
/*
 * Gets a moniker for a name in the name list and uses a specified
 * message to pass it in a ReplaceItemMonikerFrame structure to a
 * specified object. Gets a text moniker for any name unless passed
 * the VTNCF_COLOR_UNSET_CONTEXT_NAMES flag, in which case
 * gets a text moniker for everything except context names not yet
 * assigned to pages - for those, gets a light green gstring moniker.
 *
 * Context:	Sent to get a name list moniker when the moniker should be
 * 		passed with a particular message to a particular object. If
 * 		one would like to get a regular text moniker and pass it
 * 		with MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_TEXT to a
 * 		dynamic list, one should use the simpler
 *		MSG_VIS_TEXT_GET_NAME_LIST_MONIKER instead of
 *		MSG_VIS_TEXT_GET_NAME_LIST_MONIKER_FRAME.
 * Source:	Hyperlink controller
 * Destination:	Text object
 * Interception: Not generally intercepted
 * Pass:	data	= ptr to VisTextNameCommonParams structure
 *			VTNCP_data	- type (context/file) &
 *					   associated file
 *			VTNCP_index	- index of name
 *			VTNCP_object	- object to update
 *			VTNCP_message	- message to send to object
 *			VTNCP_flags	- color unset context names?
 *		Passed to message:
 *			(@stack word item, ReplaceItemMonikerFlags flags,
 *			word height, word width, word length,
 *			VisMonikerDataType dataType,
 *			VisMonikerSourceType sourceType,
 *			dword source);
 *		with
 *			source 		= pointer to data source
 *			item		= index of item in list
 *		and either
 *			sourceType	= VMST_FPTR
 *			dataType 	= VMDT_TEXT
 *			length		= 0
 *			itemFlags	= 0
 *		  *or*
 *			sourceType	= VMST_OPTR
 *			dataType 	= VMDT_GSTRING
 *			length		= 0
 *			width		= gstring width
 *			height		= gstring height
 *			itemFlags	= 0
 */

@protoreset

/****************************************************************************/

@protominor TextNew2ForPizza

@message void MSG_VIS_TEXT_GET_SINGLE_CHAR_ATTR (); /* Can't be prototyped */

@protoreset

@protominor	TextNew4ForCondo

@message void MSG_VIS_TEXT_SET_CONTEXT_GIVEN_NAME_TEXT(@stack
                    optr object,
                    VisTextSetContextFlags flags,
                            word context,
                    dword rangeEnd, dword rangeStart);
/*
 * Queries the passed object for a name, which should be a context name
 * in the current file, and uses that name to set a context on the
 * passed range of text. If the name is new, adds it to the name
 * array before setting the context. If the name is not that of a
 * context in the current file, displays an error message.
 *
 * Context:	Sent in place of MSG_VIS_TEXT_SET_CONTEXT when the
 * 		index or token for the context is not available,
 * 		possibly because the name is not yet defined.
 * Source:	Hyperlink controller
 * Destination:	Text object
 * Interception: Application may intercept to query the passed object
 * 		for the name string if necessary. For other purposes,
 * 		it's probably better to intercept MSG_VIS_TEXT_SET_CONTEXT.
 *
 * Return:	nothing
 */

@message void MSG_VIS_TEXT_REDIRECT_HYPERLINKS(@stack
                    VisTextSetContextFlags flags,
                            word context,
                    dword rangeEnd, dword rangeStart);
/*
 * Redirects hyperlinks pointing to a particular file and context pair
 * to point to another.
 *
 * Context:	Sent to make one file/context pair take over another's duties.
 * Source:	Hyperlink controller or text object
 * Destination:	Text object
 * Interception: Application may intercept.
 */

@protoreset

/****************************************************************************/

/*--------------------------------------------------------------------------
 * 	EXTERNAL state bits in the instance data
 *--------------------------------------------------------------------------*/
/*
 * Some of these state bits can be changed at any time, others must be set
 * set initially and cannot be changed.
 */

/*
 *	VisTextFeatures reflect whether various features are
 *	enabled in the text object.
 */
typedef WordFlags VisTextFeatures ;
#define VTF_NO_WORD_WRAPPING 		0x8000
    /* Set: no word-wrapping is desired. */
#define VTF_AUTO_HYPHENATE 		0x4000
    /* Set: if we want to hyphenate. */
#define VTF_ALLOW_SMART_QUOTES 		0x2000
    /* Set: allows smart quotes if they are enabled */
#define VTF_ALLOW_UNDO 			0x1000
    /* Set: allows undo in this object */
#define VTF_SHOW_HIDDEN_TEXT 		0x0800
    /* Set: show text marked as hidden. *** Not implemented *** */
#define VTF_OUTLINE_MODE 		0x0400
    /* Set: show text in outline mode. *** Not implemented *** */
#define VTF_DONT_SHOW_SOFT_PAGE_BREAKS 	0x0200
    /* Set: don't display soft (non C_PAGE_BREAK)
       page breaks in VisLargeTextDisplayModes VLTDM_GALLEY and
       above. */
#define VTF_DONT_SHOW_GRAPHICS 		0x0100
    /* Set: draw graphics as gray rectangles.  *** Not implemented. *** */
#define VTF_TRANSPARENT 			0x0080
    /* Set: don't use wash color on DRAW */
#define VTF_USE_50_PCT_TEXT_MASK     	0x0040
    /* Set: force 50% draw mask for drawing, regardless of char
     *  	attr runs.  Used by specific GenText objects.  */
/*
 * VisTextStates reflect various states of the text object
 */
typedef ByteFlags VisTextStates ;
#define VTS_EDITABLE 			0x80	/* set: text is editable */
#define VTS_SELECTABLE 			0x40	/* set: text is selectable */
#define VTS_TARGETABLE 			0x20	/* set: object is targetable */
#define VTS_ONE_LINE 			0x10	/* set: object is limited to
                           one line */
#define VTS_SUBCLASS_VIRT_PHYS_TRANSLATION  0x08	/* set: send virtual to
                         * physical charAttr/paraAttr
                         * translation messages to
                         * self (for subclass) */
#define VTS_OVERSTRIKE_MODE 		0x04	/* set: overstrike mode */
#define VTS_USER_MODIFIED 		0x02	/* set: text has changed */

/*--------------------------------------------------------------------------
 * 	EXTERNAL state bits in the instance data
 *--------------------------------------------------------------------------*/
/*
 * The following bits reflect the internal state of the text object.  These
 * bits should not be altered.
 */

/*
 * VisTextIntSelFlags reflect the selection state of the text object.
 */
typedef ByteEnum SelectionType ;
#define ST_DOING_CHAR_SELECTION  0
#define ST_DOING_WORD_SELECTION  1
#define ST_DOING_LINE_SELECTION  2
#define ST_DOING_PARA_SELECTION  3

typedef ByteFlags VisTextIntSelFlags ;
#define VTISF_IS_TARGET 			0x80	/* set if object is target */
#define VTISF_IS_FOCUS 			0x40	/* set if object is focus */
#define VTISF_CURSOR_ON 			0x20	/* set if cursor is drawn */
#define VTISF_CURSOR_ENABLED 		0x10	/* set if cursor is enabled */
#define VTISF_DOING_SELECTION 		0x08 	/* set if doing selection */
#define VTISF_DOING_DRAG_SELECTION 	0x04	/* set if we have positioned
                         * the cursor (also doubles as
                         * flag that indicates we are
                         * doing quick-transfer
                         * feedback)		*/
#define VTISF_SELECTION_TYPE 		0x03 	/* SelectionType */

/*
 *	VisTextIntFlags reflects the general internal state of the object
 */
typedef ByteEnum AdjustType ;
#define AT_NORMAL  	0
#define AT_NO_ADJUST  	1
#define AT_PASTE  	2
#define AT_QUICK  	3
#define AT_ENTIRE_RANGE  4

typedef ByteEnum ActiveSearchSpellType ;
#define ASST_NOTHING_ACTIVE  0
#define ASST_SPELL_ACTIVE  1
#define ASST_SEARCH_ACTIVE  2

#define	ASST_OFFSET	 3	/* offset in VisTextIntFlags */

typedef ByteFlags VisTextIntFlags ;
#define VTIF_HAS_LINES 			0x80
    /* set if has valid line structures */
#define VTIF_SUSPENDED 			0x40
    /* set if calculation suspended */
#define VTIF_UPDATE_PENDING 		0x20
    /* set if update is about to be delivered */
#define VTIF_ACTIVE_SEARCH_SPELL 	0x18
    /* ActiveSearchSpellType - set if active search/spell session is
     * in progress
     */
#define VTIF_HILITED 			0x04
    /* set if we have drawn the hilite */
#define VTIF_ADJUST_TYPE 		0x03
    /* AdjustType - how to adjust the seletion */

/*
 * GSRefCountAndFlags reflects the state of the cached gstate
 */
typedef ByteFlags GSRefCountAndFlags ;
#define GSRCAF_USE_DOC_CLIP_REGION 	0x80
    /* If set, then use GrSetDocClipRect */
#define GSRCAF_REF_COUNT 		0x7f

/*----------------------------------------------------------------------------
 *	Variable Instance data
 *---------------------------------------------------------------------------*/

    @vardata word ATTR_VIS_TEXT_TYPE_RUNS;
    @vardata word ATTR_VIS_TEXT_GRAPHIC_RUNS;
    @vardata word ATTR_VIS_TEXT_STYLE_ARRAY;
    @vardata word ATTR_VIS_TEXT_NAME_ARRAY;

typedef struct {
    word    	    VTSD_count;
    VisTextRange    VTSD_recalcRange;		/* range to recalculate */
    VisTextRange    VTSD_selectRange;		/* range to select */
    dword	    VTSD_showSelectionPos;	/* position to show */
    WordFlags	    VTSD_notifications;
    byte	    VTSD_needsRecalc;
} VisTextSuspendData} ;

    @vardata VisTextSuspendData ATTR_VIS_TEXT_SUSPEND_DATA;

    @vardata void ATTR_VIS_TEXT_NOTIFY_CONTENT;

    @vardata word ATTR_VIS_TEXT_SELECTED_TAB;

    @vardata void ATTR_VIS_TEXT_DO_NOT_INTERACT_WITH_SEARCH_CONTROL;
/*
 *	If set, these attrs keep the text object from sending
 *	GWNT_SEARCH_SPELL_ENABLE_CHANGE.
 */

    @vardata VisTextExtendedFilterType ATTR_VIS_TEXT_EXTENDED_FILTER;

    @vardata word ATTR_VIS_TEXT_CHAR_ATTR_INSERTION_TOKEN;
    @vardata word ATTR_VIS_TEXT_TYPE_INSERTION_TOKEN;

/*
 *	TEMPORARY VARDATA
 */
typedef struct {
    dword	VTCRI_lastCharAttrRun;
    dword	VTCRI_lastParaAttrRun;
    dword	VTCRI_lastTypeRun;
    dword	VTCRI_lastGraphicRun;
} VisTextCachedRunInfo} ;

    @vardata VisTextCachedRunInfo TEMP_VIS_TEXT_CACHED_RUN_INFO;

    @vardata void TEMP_VIS_TEXT_FORCE_SEND_IS_LAST_REGION;

typedef struct {
    VMChain   	    VTCUI_vmChain;
    VMFileHandle    VTCUI_file;
} VisTextCachedUndoInfo} ;

    @vardata VisTextCachedUndoInfo TEMP_VIS_TEXT_CACHED_UNDO_INFO;

typedef struct {
    wchar    VTCFD_startOfRange;
    wchar    VTCFD_endOfRange;
} VisTextCustomFilterData} ;

    @vardata ChunkHandle ATTR_VIS_TEXT_CUSTOM_FILTER;
/*
 *	This should contain the handle of a chunk containing an array of
 *	VisTextCustomFilterData structures. Each structure corresponds to a
 *	range of characters that the app wants to filter out.
 */

    @vardata void ATTR_VIS_TEXT_UPDATE_VIA_PROCESS;
/*
 *	Indicates that status updates must be sent via the process object
 *	because there are targetable text objects in multiple threads
 */

    @vardata void ATTR_VIS_TEXT_DOES_NOT_ACCEPT_INK;
/*
 *	When present, the VisText object will not accept ink.
 */

    @vardata WBFixed ATTR_VIS_TEXT_MINIMUM_SINGLE_LINE_HEIGHT;
/*
 *	For a one-line object, lets the object override the default line
 *	height, so graphics, etc can be put inside it.
 */

    @vardata void TEMP_VIS_TEXT_SYS_TARGET;

@protominor TextNewForZoomer

    @vardata void ATTR_VIS_TEXT_SEND_CONTEXT_NOTIFICATIONS_EVEN_IF_NOT_FOCUSED;
/*
 *	This sends out context notifications even if the object is
 *	not focused. Apps should beware when using this, to make sure
 * 	the object that this is on does *not* get modified while another
 *	text object has the focus.
 */

    @vardata void ATTR_VIS_TEXT_DO_NOT_NOTIFY_CONTENT;

@protoreset

    @vardata word ATTR_VIS_TEXT_ADD_SPACE_ON_TOP_TO_FIRST_LINE_OF_REGION;
/*
 *	This attribute causes vis-text (and gen-text) objects to add
 *	additional spacing above the first line of the object.
 *
 *	This helps fix up accent glitch problems in Vis and Gen text
 *	objects that aren't easily satisfied by the preceding ATTR_.
 *
 *	This attribute does not take effect if the paragraph on the
 *	first line of the region contains a top-line border.
 *
 *	************************************************************
 *	**** This ATTR may not be implemented on all systems.
 *	**** It was added specifically to handle European characters
 *	**** with accents. If I were to up the minor protocol for
 *	**** users of this ATTR, then applications which used it might
 *	**** not run on older systems, such as Zoomer-US. Therefore
 *	**** the protocol does not change. This means that applications
 *	**** which include this ATTR should continue to work on older ""
 *	**** system software, though this attribute might not have any
 *	**** effect
 *	************************************************************
 */

    @vardata word ATTR_VIS_TEXT_ADD_SPACE_TO_ALL_LINES;
/*
 *	This attribute causes vis-text (and gen-text) objects to add
 *	additional spacing above all lines of the object.
 *
 *	This attribute will take effect on *all* lines, including the
 *	first line, and including any lines with borders on them.
 *
 *	This means that if you have a border around a paragraph, and
 *	the object also has this hint, then the space between the
 *	top/bottom border and the text will include any addition space ""
 *	provided as part of this hint.
 *
 *	This attribute is intended to be added to objects where accent
 *	characters are getting messed up by redraws on the previous
 *	line, typically due to editing on that line. This may produce
 *	funny line spacing, so use it with care.
 *
 *	************************************************************
 *	**** This ATTR may not be implemented on all systems.
 *	**** It was added specifically to handle European characters
 *	**** with accents. If I were to up the minor protocol for
 *	**** users of this ATTR, then applications which used it might
 *	**** not run on older systems, such as Zoomer-US. Therefore
 *	**** the protocol does not change. This means that applications
 *	**** which include this ATTR should continue to work on older ""
 *	**** system software, though this attribute might not have any
 *	**** effect
 *	************************************************************
 */

    @vardata word ATTR_VIS_TEXT_NOTIFY_CURSOR_POSITION;
/*
 *	This causes cursor position notifications to be sent out.
 *	To improve proformance while quickly typing in text or quickly
 *	moving the cursor through text, a threshold time is specified.
 *	A new notification won't be sent out until the threshold time
 *	has past since the last notification was sent.  The time is
 *	specified in 1/60ths of a second.  A value of zero may be used
 *	to send notification all the time.
 */

    @vardata dword TEMP_VIS_TEXT_NOTIFY_CURSOR_POSITION_TIME;

typedef struct {
    word    TVTNCPID_handle;
    word    TVTNCPID_id;
} TVTNCPIData} ;

    @vardata TVTNCPIData TEMP_VIS_TEXT_NOTIFY_CURSOR_POSITION_INFO;

    @vardata void TEMP_VIS_TEXT_FREEING_OBJECT;
/*
 * This is added by the text object when it receives MSG_META_OBJ_FREE, to
 * prevent it from sending out notifications while exiting.
 */

    @vardata void TEMP_VIS_TEXT_UNDO_FOR_SUSPEND;
/*
 * This is added by the text object when it receives MSG_META_SUSPEND, so it
 * knows to encapsulate any subsequent undo actions in a single chain.
 */

@protominor	TextNewForQuickFax

    @vardata void ATTR_VIS_TEXT_DISABLE_OPTIMIZED_REDRAW;
/*
 * This attribute causes vis-text objects to NOT use optimized
 * redraw (ie bit-blt) when inserting text. This is useful when an
 * Ink object overlaps a VisText object (we don't want the ink to
 * be blitted down with the text)
 */

@protoreset

@protominor TextNewFor2_1

@vardata void ATTR_VIS_TEXT_DONT_SHOW_POSITION_ON_GAINED_TARGET_EXCL;
/*
 * This attribute causes the vis-text objects to NOT call
 * MSG_VIS_TEXT_SHOW_POSITION whenever MSG_META_GAINED_TARGET_EXCL is
 * received.  This way if the cursor is outside the visible text window
 * when the target is gained the text will not automatically scroll to
 * the cursor position
 */

@vardata void ATTR_VIS_TEXT_SHOW_POSITION_ON_GAINED_TARGET_EXCL;
/*
 * This attribute causes the vis-text object to call
 * MSG_VIS_TEXT_SHOW_POSITION whenever MSG_META_GAINED_TARGET_EXCL is
 * received.   This way if the cursor is outside the visible text window
 * when the target is gained the text will automatically scroll to
 * the cursor position
 */

@vardata void ATTR_VIS_TEXT_DONT_BEEP_ON_INSERTION_ERROR;
/*
 * This attribute causes the vis-text object to not call the sound
 * routine with SST_ERROR, even though there was an error inserting
 * the character.
 */

@protoreset

@protominor TextNew2ForPizza

@vardata void ATTR_VIS_TEXT_NO_FEP;
/*
 * This attribute causes the text object to not interact with the FEP,
 * if any.  This is useful for numeric-only text fields, such as in
 * a calculator.   Only implemented in DBCS/Pizza.
 * NOTE: care should be taken in adding / removing this dynamically,
 * as chaos will result if the text object already has the focus,
 * and already interacted with / didn't interact with the FEP.
 */

@protoreset

@protominor	TextNewForJedi

@vardata void ATTR_VIS_TEXT_NOTIFY_EVEN_IF_NOT_TARGETED;
/*
 *  This attribute causes the vis-text object to send out notificiations
 *  to controllers even when it doesn't have the target.
 */

@protoreset

@protominor	TextNewForResponder

@vardata void ATTR_VIS_TEXT_XOR_SELECTION;
/*
 *  This attribute sets the text object in a state where the selected text will
 *  be xor'ed with some product-specific value, rather than inverted.  This
 *  is currently only handled in Responder, for achieving the black-text-on-
 *  light-grey-background effect similar to selected gadgetry in the UI.
 */

@protoreset

@protominor	TextNewForLeia

/*
 * This etype is used by the specific UI to change text cursors for
 * Graffiti HWR modes.
 */
typedef enum /* word */ {
    VTCT_NORMAL_CURSOR    =0,
    VTCT_CAPLOCK_CURSOR    =2,
    VTCT_NUMLOCK_CURSOR    =4,
    VTCT_EQNLOCK_CURSOR    =6,
} VisTextCursorType} ;

@vardata	VisTextCursorType	TEMP_VIS_TEXT_CURSOR_TYPE;
/*
 * This vardata is for internal use only.  If you put it on your
 * VisText object you'll probably have problems.  Don't use it.
 */

@protoreset

@protominor	TextNewForDove

@vardata void ATTR_VIS_TEXT_CURSOR_NO_FOCUS;
/*
 *  When set, this attribute will cause the text object to have a cursor
 *  regardless of whether it has the focus or not.
 */

@protoreset

@protominor	TextNewForPenelope

@vardata    void    ATTR_VIS_TEXT_NO_CURSOR;
/*
 * This attribute will cause the cursor *not* to be drawn even though the
 * text object is editable.
 */

@protoreset

/*---------------------------------------------------------------------------
 *	Instance data
 *---------------------------------------------------------------------------*/

    @instance ChunkHandle	VTI_text = NullChunk;
    /* chunk containing the text 	*/

    @instance word		VTI_charAttrRuns = VIS_TEXT_INITIAL_CHAR_ATTR;
    /* CharAttr runs or single 	*/

    @instance word		VTI_paraAttrRuns = VIS_TEXT_INITIAL_PARA_ATTR;
    /* ParaAttr runs or single 	*/

    @instance VMFileHandle	VTI_vmFile = NullHandle;
    /* Handle of associated VM file */

    @instance word		VTI_lines = 0;
    /* Reference to line info 	*/

/*
 *	External states ........
 */
    @instance VisTextStorageFlags VTI_storageFlags = (VTSF_DEFAULT_CHAR_ATTR |
                              VTSF_DEFAULT_PARA_ATTR);
    @instance VisTextFeatures	VTI_features = 0;
    @instance VisTextStates	VTI_state = 0;

/*
 *	Internal states ........
 */
    @instance VisTextIntFlags	VTI_intFlags = 0;
    @instance VisTextIntSelFlags VTI_intSelFlags = 0;

    @instance GSRefCountAndFlags VTI_gsRefCount = 0;
    /* Reference count for gstate. 	*/

    @instance GStateHandle	VTI_gstate = NullHandle;
    /* Temporary GState 		*/

    @instance word		VTI_gstateRegion = -1;
    /* Region to which gstate has been translated.	*/

/*
 *	Selection variables
 */
    @instance dword		VTI_selectStart = 0;
    /* offset to selection start 	*/

    @instance dword		VTI_selectEnd = 0;
    /* offset to selection end 	*/

    @instance PointDWord	VTI_startEventPos = {0,0};
    /*
     * Start event-pos holds the coordinate position of the original
     * mouse event.
     */
/*
 * The next group of variables are used to make selection work
 * right and also for optimizations.
 */
    ;
    @instance dword		VTI_selectMinStart = 0;
    @instance dword		VTI_selectMinEnd = 0;
    /*
     * minStart/End are set by the start-select handler and indicate the
     * minimum range that must remain selected during drag-selection. The
     * selection will never be smaller than this.
     */

    @instance dword		VTI_lastOffset = 0;
    /* Last-offset holds the last character offset which the mouse
     * was over. This is used for optimizations since if the
     * character offset of the mouse event hasn't changed then
     * the selection can't have changed.
      */

    @instance word		VTI_goalPosition = 0;

/****************************************************************************/

    @instance Point		VTI_cursorPos = {0,0};
    /* The current cursor position */

    @instance word		VTI_cursorRegion = 0;
    /* The region the cursor is in */

    @instance word		VTI_leftOffset = 0;
    /* Offset from left edge of text to left edge of vis-bounds.
     * Used for moving one line text edit object left/right.
     */

/*
 *	User set state information
 */
    @instance byte		VTI_lrMargin = 0;
    @instance byte		VTI_tbMargin = 0;
    /* padding around text */

    @instance ColorQuad		VTI_washColor = {
                    C_WHITE,	    /* CQ_redOrIndex */
                        CF_INDEX,    /* CQ_info */
                    0,		/* CQ_green */
                    0		/* CQ_blue */
                };
    /* Background color and map mode */

    @instance word		VTI_maxLength = 10000;
    /* Max amount of text.  This applies only to small text objects.
     * Large text objects cannot have a limit on their size.
     */

    @instance VisTextFilters	VTI_filters = 0;
    /* Pre-defined key filters */

    @instance optr		VTI_output;

/*
 *	Derived state information
 */
    @instance WBFixed		VTI_height = {0,0};
    /* height in points	*/

    @instance word		VTI_lastWidth = -1;
    /* Cached width, used to optimize resizing the object
     * (via the geometry manager).  For more information see
     * VisTextCalcHeight().
     */

    @instance TimerHandle	VTI_timerHandle = NullHandle;
    @instance word		VTI_timerID = 0;

@endc

@ifdef __HIGHC__
pragma Alias(TextSearchInString, "TEXTSEARCHINSTRING");
pragma Alias(TextSearchInHugeArray, "TEXTSEARCHINHUGEARRAY");
pragma Alias(TextMapDefaultCharAttr, "TEXTMAPDEFAULTCHARATTR");
pragma Alias(TextFindDefaultCharAttr, "TEXTFINDDEFAULTCHARATTR");
pragma Alias(TextMapDefaultParaAttr, "TEXTMAPDEFAULTPARAATTR");
pragma Alias(TextFindDefaultParaAttr, "TEXTFINDDEFAULTPARAATTR");
pragma Alias(TextGetSystemCharAttrRun, "TEXTGETSYSTEMCHARATTRRUN");
pragma Alias(TextSetHyphenationCall, "TEXTSETHYPHENATIONCALL");
pragma Alias(TextAllocClipboardObject, "TEXTALLOCCLIPBOARDOBJECT");
pragma Alias(TextFinishWithClipboardObject, "TEXTFINISHWITHCLIPBOARDOBJECT");
pragma Alias(VisTextFormatNumber, "VISTEXTFORMATNUMBER");
pragma Alias(MsgVisTextLoadStyleSheetParams, "MSGVISTEXTLOADSTYLESHEETPARAMS");
pragma Alias(GetTokenForPosition, "GETTOKENFORPOSITION");

@endif

@endlib
@endif


Internal\Resp\w3ext.goh

@ifndef _w3ext_goh
@define _w3ext_goh

/******************************************************************
*
*  Project:     	Nokia Communicator PDA SW WWW 3C
*  Module:      	WWW User Interface
*  File:        	w3ext.goh
*
*  Description: 	This file contains constants and structures
*			which are needed in external interface of the
*			WWW application.
*
*******************************************************************/

#define WAKE_UP_WWW  1
#define ADD_TO_HOTLIST  2
#define AUTO_FETCHING  3

typedef enum
{
    GET_METHOD	,
    POST_METHOD
} HttpMethod} ;

typedef enum
{
    USER	 = 1,
    APPLICATION	,
    SILENT	,		/* TIR/CCC 150797 fix 343 */
    MAX_LAUNCH_MODE
} LaunchType} ;

/* IACPStruct */
typedef struct
{
    HttpMethod	method;						/* Method GET or POST */
    word			wIAP;							/* Internet accesspoint, 0 if default IAP used */
    LaunchType 	Launcher;					/* Was launcher USER or APPLICATION */
    TCHAR  		tcApplicationName[32];  /* Name of the caller application */
    TCHAR  		tcURL[250];             /* Absolute URL */
    TCHAR  		tcHotListTitle[32];     /* Title in HotList */
    MemHandle 	mhEntityBody; 				/* Buffer which contains entitybody (or NullHandle) */
    MemHandle 	mhExtraHeaders;			/* Buffer which contains extra headers (or NullHandle) */
} IACPStruct} ;

@endif	/* _w3ext_goh */

/*********************************************************************
**************************** END OF FILE *****************************
*********************************************************************/


wav.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1992 -- All Rights Reserved
 *
 * PROJECT:	Wav Library
 * FILE:	wav.h
 *
 *
 * REVISION HISTORY:
 *
 *	Name	Date		Description
 *	----	----		-----------
 *	atw	10/ 6/93	Initial revision
 *
 *
 * DESCRIPTION:
 *	Contains routines for playing .WAV files on the Zoomer
 *
 *	$Id: wav.goh,v 1.1.8.1 96/04/28 08:28:44 chris Exp $
 *
 ***********************************************************************/

@deflib	wav
extern void
    _pascal WavPlayFile (DiskHandle disk, const char *path, const char *fname);

extern void
    _pascal PlaySoundFromFile (FileHandle file);

#ifdef	__HIGHC__
pragma Alias(WavPlayFile, "WAVPLAYFILE");
pragma Alias(PlaySoundFromFile, "PLAYSOUNDFROMFILE");
#endif

@endlib


win.h

/***********************************************************************
 *
 *	Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	win.h
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines window structures and routines.
 *
 *	$Id: win.h,v 1.34.10.4 97/09/02 16:13:47 jwu Exp $
 *
 ***********************************************************************/

#ifndef	__WIN_H
#define __WIN_H

/* #include  <object.h>  */
/* #include  <metaC.h>  */
#include  <graphics.h>

/**	NOTE: moved definition for RectDWord to graphics.h  -jim  **/

extern void	/*XXX*/
    _pascal WinGetWinScreenBounds (WindowHandle win,
                        Rectangle *bounds);

/***/

#define WCF_RGB 		0x80
#define WCF_TRANSPARENT 	0x40
#define WCF_PLAIN 	0x20
#define WCF_MAP_MODE 	0x07

#define WCF_MAP_MODE_OFFSET      0

typedef ByteEnum LayerPriority ;
#define LAYER_PRIO_MODAL    6
#define LAYER_PRIO_ON_TOP    8
#define LAYER_PRIO_STD   12
#define LAYER_PRIO_ON_BOTTOM  14

typedef ByteEnum WinPriority ;
#define WIN_PRIO_POPUP    4
#define WIN_PRIO_MODAL    6
#define WIN_PRIO_ON_TOP    8
#define WIN_PRIO_COMMAND    10
#define WIN_PRIO_STD  12
#define WIN_PRIO_ON_BOTTOM  14

#define WPF_CREATE_GSTATE 	0x8000
#define WPF_ROOT 		0x4000
#define WPF_SAVE_UNDER 		0x2000
#define WPF_INIT_EXCLUDED 	0x1000
#define WPF_PLACE_BEHIND 	0x0800
#define WPF_PLACE_LAYER_BEHIND 	0x0400
#define WPF_LAYER 		0x0200
#define WPF_ABS 			0x0100
#define WPF_INIT_SUSPENDED 	WPF_ABS
#define WPF_LAYER_PRIORITY 	0x00f0
#define WPF_WIN_PRIORITY 	0x000f

#define WPF_LAYER_PRIORITY_OFFSET 	4
#define WPF_WIN_PRIORITY_OFFSET 		0

extern WindowHandle	/*XXX*/
    _pascal WinOpen (Handle parentWinOrVidDr,
        optr inputRecipient, optr exposureRecipient,
        word colorFlags, word redOrIndex,
        word green, word blue, word flags, word layerID,
        GeodeHandle owner, const Region *winReg, word axParam,
        word bxParam, word cxParam, word dxParam);

/***/

extern void	/*XXX*/
    _pascal WinClose (WindowHandle win);

/***/

typedef WordFlags WinPassFlags ;
#define WPF_CREATE_GSTATE 	0x8000
#define WPF_ROOT 		0x4000
#define WPF_SAVE_UNDER 		0x2000
#define WPF_INIT_EXCLUDED 	0x1000
#define WPF_PLACE_BEHIND 	0x0800
#define WPF_PLACE_LAYER_BEHIND 	0x0400
#define	WPF_LAYER			0x0200
#define WPF_ABS 			0x0100
#define WPF_PRIORITY 		0x00ff

extern void	/*XXX*/
    _pascal WinMove (WindowHandle win, sword xMove, sword yMove,	WinPassFlags flags);

/***/

extern void	/*XXX*/
    _pascal WinResize (WindowHandle win, const Region *reg,
            word axParam, word bxParam, word cxParam, word dxParam,
            WinPassFlags flags);

/***/

extern void	/*XXX*/
    _pascal WinChangePriority (WindowHandle win, WinPassFlags flags, word layerID);

/***/

extern void	/*XXX*/
    _pascal WinScroll (WindowHandle win, WWFixedAsDWord xMove,
               WWFixedAsDWord yMove, PointWWFixed *scrollAmt);

/***/

extern void
    _pascal GrBeginUpdate (GStateHandle gstate);

/***/

extern void
    _pascal GrEndUpdate (GStateHandle gstate);

/***/

extern void	/*XXX*/
    _pascal WinAckUpdate (WindowHandle win);

/***/

extern void	/*XXX*/
    _pascal WinDecRefCount (WindowHandle win);

/***/

extern void	/*XXX*/
    _pascal WinInvalReg (WindowHandle win, const Region *reg,
        word axParam, word bxParam, word cxParam, word dxParam);

/***/

extern void	/*XXX*/
    _pascal WinSuspendUpdate (WindowHandle win);

/***/

extern void	/*XXX*/
    _pascal WinUnSuspendUpdate (WindowHandle win);

/***/

#define WRF_DELAYED_WASH 		0x80
#define WRF_DELAYED_V 			0x40
#define WRF_SIBLING_VALID 		0x20
#define WRF_EXPOSE_PENDING 		0x10
#define WRF_CLOSED 			0x08

#define WPF_PTR_IN_UNIV 		0x20
#define WPF_PTR_IN_VIS 		0x10

typedef enum /* word */ {
    WIT_PRIVATE_DATA      =0,
    WIT_COLOR      =2,
    WIT_INPUT_OBJ      =4,
    WIT_EXPOSURE_OBJ      =6,
    WIT_STRATEGY      =8,
    WIT_FLAGS      =10,
    WIT_LAYER_ID      =12,
    WIT_PARENT_WIN      =14,
    WIT_FIRST_CHILD_WIN      =16,
    WIT_LAST_CHILD_WIN      =18,
    WIT_PREV_SIBLING_WIN      =20,
    WIT_NEXT_SIBLING_WIN      =22,
    WIT_PRIORITY    =24,
} WinInfoType} ;

extern void	/*XXX*/
    _pascal WinGetInfo (WindowHandle win, WinInfoType type,
                            void *data);

/***/

extern void	/*XXX*/
    _pascal WinSetInfo (WindowHandle win, WinInfoType type, dword data);

/***/

typedef ByteEnum WinInvalFlag ;
#define WIF_INVALIDATE  0
#define WIF_DONT_INVALIDATE  1

extern void	/*XXX*/
    _pascal WinApplyRotation (WindowHandle win, WWFixedAsDWord angle,
                            WinInvalFlag flag);

/***/

extern void	/*XXX*/
    _pascal WinApplyScale (WindowHandle win, WWFixedAsDWord xScale,
                WWFixedAsDWord yScale, WinInvalFlag flag);

/***/

extern void	/*XXX*/
    _pascal WinApplyTranslation (WindowHandle win, WWFixedAsDWord xTrans,
                WWFixedAsDWord yTrans, WinInvalFlag flag);

/***/

extern void	/*XXX*/
    _pascal WinApplyTranslationDWord (WindowHandle win, sdword xTrans,
                    sdword yTrans, WinInvalFlag flag);

/***/

extern XYValueAsDWord	/*XXX*/
    _pascal WinTransform (WindowHandle win, sword x, sword y);

/***/

extern XYValueAsDWord	/*XXX*/
    _pascal WinUntransform (WindowHandle win, sword x, sword y);

/***/

extern void	/*XXX*/
    _pascal WinTransformDWord (WindowHandle win, sdword xCoord,
            sdword yCoord, PointDWord *screenCoordinates);

/***/

extern void	/*XXX*/
    _pascal WinUntransformDWord (WindowHandle win, sdword xCoord,
            sdword yCoord, PointDWord *documentCoordinates);

/***/

extern void	/*XXX*/
    _pascal WinSetTransform (WindowHandle win, const TransMatrix *tm,
                            WinInvalFlag flag);

/***/

extern void	/*XXX*/
    _pascal WinApplyTransform (WindowHandle win,
            const TransMatrix *tm, WinInvalFlag flag);

/***/

extern void	/*XXX*/
    _pascal WinSetNullTransform (WindowHandle win, WinInvalFlag flag);

/***/

extern void	/*XXX*/
    _pascal WinGetTransform (WindowHandle win, TransMatrix *tm);

/***/

/* HELP !!! */
extern Boolean	/*XXX*/
    _pascal WinGrabChange (WindowHandle win, optr newObj);

/***/

/* HELP !!! */
extern void	/*XXX*/
    _pascal WinReleaseChange (WindowHandle win, optr obj);

/***/

/* HELP !!! */
extern WindowHandle	/*XXX*/
    _pascal WinChangeAck (WindowHandle win, sword x, sword y, optr *winOD);

/***/

/* HELP !!! */
extern void	/*XXX*/
    _pascal WinEnsureChangeNotification (void);

typedef enum {
    PIV_NONE    ,
    PIV_VIDEO_DRIVER_DEFAULT    ,
    PIV_UPDATE
} PtrImageValue} ;

typedef enum {
    PIL_SYSTEM    ,
    PIL_1    ,
    PIL_FLOW    ,
    PIL_3    ,
    PIL_GEODE    ,
    PIL_5    ,
    PIL_GADGET    ,
    PIL_7    ,
    PIL_WINDOW    ,
    PIL_DEFAULT
} PtrImageLevel} ;

extern void	/*XXX*/
    _pascal WinSetPtrImage (WindowHandle win, PtrImageLevel ptrLevel,
           optr ptrCh);

extern void	/*XXX*/
    _pascal WinGeodeSetPtrImage (GeodeHandle gh, optr ptrCh);

extern optr	/*XXX*/
    _pascal WinGeodeGetInputObj (GeodeHandle gh);

extern void	/*XXX*/
    _pascal WinGeodeSetInputObj (GeodeHandle gh, optr iobj);

extern optr	/*XXX*/
    _pascal WinGeodeGetParentObj (GeodeHandle gh);

extern void	/*XXX*/
    _pascal WinGeodeSetParentObj (GeodeHandle gh, optr pObj);

extern void	/*XXX*/
    _pascal WinGeodeSetActiveWin (GeodeHandle gh, WindowHandle win);

extern void 	/*XXX*/
    _pascal WinRealizePalette (WindowHandle win);

/***/

/* HELP !!! */
/* Must declare imported methods */

/* Display Types */

typedef ByteEnum DisplaySize ;
#define DS_TINY  0
#define DS_STANDARD  1
#define DS_LARGE  2
#define DS_HUGE  3

typedef ByteEnum DisplayAspectRatio ;
#define DAR_NORMAL  0
#define DAR_SQUISHED  1
#define DAR_VERY_SQUISHED  2

typedef ByteEnum DisplayClass ;
#define DC_TEXT  0
#define DC_GRAY_1  1
#define DC_GRAY_2  2
#define DC_GRAY_4  3
#define DC_GRAY_8  4
#define DC_COLOR_2  5
#define DC_COLOR_4  6
#define DC_COLOR_8  7
#define DC_CF_RGB  8

typedef ByteFlags DisplayType ;
#define DT_DISP_SIZE 		0xc0
#define DT_DISP_ASPECT_RATIO 	0x30
#define DT_DISP_CLASS 		0x0f

#define DT_DISP_SIZE_OFFSET  6
#define DT_DISP_ASPECT_RATIO_OFFSET  4
#define DT_DISP_CLASS_OFFSET  0

typedef ByteEnum DisplayModeOrientation ;
#define DMO_NO_CHANGE 	0x0
#define DMO_DEFAULT 	0x1
#define DMO_PORTRAIT 	0x2
#define DMO_TOGGLE 	0x3

typedef ByteEnum DisplayModeColor ;
#define DMC_NO_CHANGE 	0x0
#define DMC_DEFAULT 	0x1
#define DMC_INVERTED 	0x2
#define DMC_TOGGLE 	0x3

typedef ByteEnum DisplayModeDefinition ;
#define DMD_NO_CHANGE 	0x0
#define DMD_DEFAULT 	0x1
#define DMD_HIGH 	0x2
#define DMD_TOGGLE 	0x3

typedef ByteEnum DisplayModeResolution ;
#define DMR_NO_CHANGE 	0x0
#define DMR_DEFAULT 	0x1
#define DMR_HIGH 	0x2
#define DMR_TOGGLE 	0x3

typedef WordFlags DisplayMode ;
/* 8 bits unused */
#define DM_color 	(0x0080 | 0x0040)
#define DM_color_OFFSET 	6
#define DM_orientation 	(0x0020 | 0x0010)
#define DM_orientation_OFFSET 	4
#define DM_definition 	(0x0008 | 0x0004)
#define DM_definition_OFFSET 	2
#define DM_resolution 	(0x0002 | 0x0001)
#define DM_resolution_OFFSET 	0

#ifdef __HIGHC__
pragma Alias(WinGetWinScreenBounds, "WINGETWINSCREENBOUNDS");
pragma Alias(WinOpen, "WINOPEN");
pragma Alias(WinClose, "WINCLOSE");
pragma Alias(WinMove, "WINMOVE");
pragma Alias(WinResize, "WINRESIZE");
pragma Alias(WinDecRefCount, "WINDECREFCOUNT");
pragma Alias(WinChangePriority, "WINCHANGEPRIORITY");
pragma Alias(WinScroll, "WINSCROLL");
pragma Alias(GrBeginUpdate, "GRBEGINUPDATE");
pragma Alias(GrEndUpdate, "GRENDUPDATE");
pragma Alias(WinAckUpdate, "WINACKUPDATE");
pragma Alias(WinInvalReg, "WININVALREG");
pragma Alias(WinSuspendUpdate, "WINSUSPENDUPDATE");
pragma Alias(WinUnSuspendUpdate, "WINUNSUSPENDUPDATE");
pragma Alias(WinGetInfo, "WINGETINFO");
pragma Alias(WinSetInfo, "WINSETINFO");
pragma Alias(WinApplyRotation, "WINAPPLYROTATION");
pragma Alias(WinApplyScale, "WINAPPLYSCALE");
pragma Alias(WinApplyTranslation, "WINAPPLYTRANSLATION");
pragma Alias(WinApplyTranslationDWord, "WINAPPLYTRANSLATIONDWORD");
pragma Alias(WinTransform, "WINTRANSFORM");
pragma Alias(WinUntransform, "WINUNTRANSFORM");
pragma Alias(WinTransformDWord, "WINTRANSFORMDWORD");
pragma Alias(WinUntransformDWord, "WINUNTRANSFORMDWORD");
pragma Alias(WinSetTransform, "WINSETTRANSFORM");
pragma Alias(WinApplyTransform, "WINAPPLYTRANSFORM");
pragma Alias(WinSetNullTransform, "WINSETNULLTRANSFORM");
pragma Alias(WinGetTransform, "WINGETTRANSFORM");
pragma Alias(WinGrabChange, "WINGRABCHANGE");
pragma Alias(WinReleaseChange, "WINRELEASECHANGE");
pragma Alias(WinChangeAck, "WINCHANGEACK");
pragma Alias(WinEnsureChangeNotification, "WINENSURECHANGENOTIFICATION");
pragma Alias(WinSetPtrImage, "WINSETPTRIMAGE");
pragma Alias(WinGeodeSetPtrImage, "WINGEODESETPTRIMAGE");
pragma Alias(WinGeodeGetInputObj, "WINGEODEGETINPUTOBJ");
pragma Alias(WinGeodeSetInputObj, "WINGEODESETINPUTOBJ");
pragma Alias(WinGeodeGetParentObj, "WINGEODEGETPARENTOBJ");
pragma Alias(WinGeodeSetParentObj, "WINGEODESETPARENTOBJ");
pragma Alias(WinGeodeSetActiveWin, "WINGEODESETACTIVEWIN");
pragma Alias(WinRealizePalette, "WINREALIZEPALETTE");
#endif

#endif


Objects\winC.goh

/***********************************************************************
 *
 *	Copyright (c) GeoWorks 1991 -- All Rights Reserved
 *
 * PROJECT:	PC GEOS
 * FILE:	Objects/winC.goh
 * AUTHOR:	Tony Requist: February 14, 1991
 *
 * DECLARER:	Kernel
 *
 * DESCRIPTION:
 *	This file defines window methods
 *
 *	$Id: winC.goh,v 1.14.20.1 96/04/28 08:31:08 chris Exp $
 *
 ***********************************************************************/
@optimize
@deflib ui

@include  <Objects/metaC.goh>

@importMessage	MetaWindowMessages, void MSG_META_EXPOSED (WindowHandle win=cx);

@importMessage	MetaWindowMessages, void MSG_META_EXPOSED_FOR_PRINT (
            GStringHandle gstring = bp, optr completionOD=cx:dx);

@importMessage	MetaWindowMessages, void MSG_META_WIN_UPDATE_COMPLETE ();	/* NEEDS PROTOTYPE! */

@importMessage	MetaWindowMessages, void MSG_META_WIN_UNUSED_2 ();

@importMessage	MetaWindowMessages, void MSG_META_WIN_CHANGE ();	/* NEEDS PROTOTYPE! */

@importMessage	MetaWindowMessages, void MSG_META_IMPLIED_WIN_CHANGE ();	/* NEEDS PROTOTYPE! */

@importMessage	MetaWindowMessages, void MSG_META_RAW_UNIV_ENTER ();	/* NEEDS PROTOTYPE! */

@importMessage	MetaWindowMessages, void MSG_META_RAW_UNIV_LEAVE ();	/* NEEDS PROTOTYPE! */

@importMessage	MetaWindowMessages, void MSG_META_UNUSED_1 ();

@importMessage	MetaWindowMessages, void MSG_META_INVAL_TREE ();	/* NEEDS PROTOTYPE! */

@importMessage  MetaWindowMessages, void MSG_META_INVAL_BOUNDS ();	/* NEEDS PROTOTYPE! */

@endlib


Internal\Resp\wwwmain.goh

/*
-----------------------------------------------------------------------------

Copyright (c) 1997. Nokia Mobile Phones
*/

/*
-----------------------------------------------------------------------------

DESCRIPTION

     Header file of WWW for other applications to enable IACP connection.

-----------------------------------------------------------------------------
*/

@ifndef  WWWMAIN_GOH
@define  WWWMAIN_GOH

@include   <stdapp.goh>

/*  CLASS DEFINITIONS  */
@class	WWWProcessClass, GenProcessClass;
    @message void MSG_W3PROCESS_HANDLE_IACP_EVENT  (word wIACP_Case, MemHandle mhFetchParams);
@endc

@endif

/* End of File */


accpnt.goh

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Copyright (c) Geoworks 1995 -- All Rights Reserved

PROJECT:	socket
MODULE:		access point database
FILE:		accpnt.goh

AUTHOR:		Eric Weber, May 24, 1995

ROUTINES:
    Name			Description
    ----			-----------

REVISION HISTORY:
    Name	Date		Description
    ----	----		-----------
    EW	5/24/95   	Initial version.

DESCRIPTION:
    C API for managing access points

    $Id: accpnt.goh,v 1.12.1.15 98/05/20 10:57:56 nfiedler Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef __ACCPNT_GOH_
#define __ACCPNT_GOH_  1

@deflib accpnt

/*
 * Each access point has an ID number, which applications should use to
 * identify it.  This number does not change over the life of the access
 * point, and no two access points have the same ID.  ID numbers are assigned
 * sequentially from 1 to 65535.  If an access point is deleted, it's
 * ID will not be reused unless all 65535 possible IDs have been exhausted,
 * in which case currently unused values starting with 1 again will be
 * assigned.
 *
 * ID 0 will never be assigned.  It is used by the controller and various
 * API routines as a canonical invalid ID number.
*/
#define ACCESS_POINT_INVALID_ID 	0

/*
 *  what type of access an access point defines
 */
/* enum AccessPointType */
typedef enum {
    APT_INTERNET     = 0x1,
    APT_TERMINAL    ,
    APT_TELNET    ,
    APT_APP_LOCAL    ,

    /* new for N9000V20 */
    APT_CALLING_CARD    ,

    /* new for N9110 */
    APT_REMOTE_MAILBOX    ,
} AccessPointType} ;

/* an obsolete alias for APT_APP_LOCAL */
#define APT_RESPONDER  APT_APP_LOCAL
#define APT_ALL 	(0)

/*
 *  some common property strings
 *
 * Any access point function requesting a property name as a far pointer,
 * can also accept a "pointer" with segment=0 and
 * offset=AccessPointStandardProperty.  Any APSP can be combined with
 * APSP_AUTOMATIC to make an alternative form of the name.  This library
 * puts no special interpretation on temporary names, but they are intended
 * to represent values which are obtained from automatic configuration and
 * not from the user.
 *
 */
/* enum AccessPointStandardProperty */
typedef enum {
    APSP_NAME     = 0x0,
    APSP_PHONE     = 0x2,
    APSP_USER     = 0x4,
    APSP_SECRET     = 0x6,
    APSP_ADDRESS     = 0x8,
    APSP_MASK     = 0xa,
    APSP_GATEWAY     = 0xc,
    APSP_DNS1     = 0xe,
    APSP_DNS2     = 0x10,
    APSP_DATA_BITS     = 0x12,
    APSP_STOP_BITS     = 0x14,
    APSP_PARITY     = 0x16,
    APSP_DUPLEX     = 0x18,
    APSP_MODEM_INIT     = 0x1a,
    APSP_BS     = 0x1c,
    APSP_HOSTNAME     = 0x1e,
    APSP_INTERNET_ACCPNT     = 0x20,
    APSP_PROMPT_SECRET     = 0x22,

    /*
     * Special values
     */
    APSP_AUTOMATIC     = 0x4000,   /* see above for description */
    APSP_UNDEFINED     = 0xffff,   /* for change notification only */

    /*
     * The following types are new for N9000V20.  Using them on an earlier
     * release will cause a fatal error.
     */
    APSP_USE_LOGIN_APP     = 0x24,
    APSP_LOGIN_APP_NAME     = 0x26,
    APSP_SCRIPT_NAME     = 0x28,
    APSP_CCARD_NAME     = 0x2a,
    APSP_CCARD_ACCESS     = 0x2c,
    APSP_CCARD_ID     = 0x2e,
    APSP_CCARD_PREFIX     = 0x30,
    APSP_CCARD_SEQUENCE     = 0x32,
    APSP_COMPRESSION     = 0x34,

    /*
     * The following types are new for N9110.  Using them on an earlier
     * release will cause a fatal error.
     */
    APSP_LINE_END     = 0x36,

} AccessPointStandardProperty} ;

/* enum AccessPointChangeType */
typedef enum {
    APCT_CREATE     = 0x0,     /*  access pnt created */
    APCT_DESTROY     = 0x2,    /*  access pnt destroyed */
    APCT_PROPERTY     = 0x4,   /*  prop value changed */
    APCT_MULTI_DESTROY     = 0x6, /* multiple accpnts destroyed */
    /* If change type is APCT_MULTI_DESTROY, APCD_id field is the
     * number of access points which were deleted, and an array of
     * access point IDs is stored starting at APCD_property.
     */
    APCT_LOCK     = 0x8,       /* lock status of an access point changed */

} AccessPointChangeType} ;

/* enum AccessPointValueType */
typedef enum {
    APVT_INTEGER     = 0x0,
    APVT_STRING    ,
    APVT_UNDEFINED     = 0xffff,
} AccessPointValueType} ;

/*
 *  data for GWNT_ACCESS_POINT_CHANGE
 */
typedef struct {
    /*  what kind of change occurred */
    AccessPointChangeType	APCD_changeType;
    /*  which access point changed - or number of changed points */
    word	APCD_id;
    /*  the type of the access point */
    AccessPointType	APCD_accessType;
    /*
     * If the change type is not APCT_PROPERTY, this field has no meaning
     * and may contain arbitrary values.
     *
     * For APCT_PROPERTY, this field contains the standard property value
     * if it is known, and APSP_UNDEFINED if it is unknown.
     *
     * The standard property will only be known if an APSP constant
     * was explicitly passed to an accpnt routine.  If a custom string
     * which happens to be identical to a standard property is used,
     * the coincidence will not be detected.
     */
    AccessPointStandardProperty	APCD_stdProperty;
    /*
     * If change type is APCT_PROPERTY, the null terminated name of the
     * property follows this structure.
     *
     * If change type is APCT_MULTI_DESTROY, the array of ID numbers
     * follows this structure.
     *
     */
} AccessPointChangeDescription} ;

typedef WordFlags AccessPointControlFeatures ;
/* 13 bits unused */
/*  put edit/create/delete on seperate subgroup */
#define APCF_TWOLEVEL    (0x04)
/*  edit, create, and delete triggers */
#define APCF_EDIT 	(0x02)
/*  list of access points */
#define APCF_LIST 	(0x01)

/*
 *  controller for selecting an access point
 */
@class  AccessPointControlClass, GenControlClass;

/*
 *  Set the APSI_type instance data
 *
 *  Pass:	cx	= AccessPointType
 *  Return:	nothing
 *  Destroyed:	nothing
 */
@message void MSG_ACCESS_POINT_CONTROL_SET_TYPE (AccessPointType apt = cx);

/*
 *  Get APSI_type
 *
 *  Pass:	nothing
 *  Return:	ax	= AccessPointType
 *  Destroyed:	nothing
 */
@message AccessPointType MSG_ACCESS_POINT_CONTROL_GET_TYPE () = ax;

/*
 *  Get the current selection
 *
 *  Pass:	nothing
 *  Return:	selection ID (0 if no selection)
 * 		carry set if no selection
 *  Destroyed:	nothing
 */
@message word MSG_ACCESS_POINT_CONTROL_GET_SELECTION () = ax;

/*
 *  Get the current selection
 *
 *  Pass:	id = selection ID
 *  Return:	carry set if not in list
 *  Destroyed:	nothing
 */
@message void MSG_ACCESS_POINT_CONTROL_SET_SELECTION (word id = cx);

/*
 *  Get the ASPCI_editMsg
 *
 *  Pass:	nothing
 *  Return:	edit message number
 *  Destroyed:	nothing
 */
@message word MSG_ACCESS_POINT_CONTROL_GET_EDIT_MSG () = ax;

/*
 *  Set the ASPCI_editMsg
 *
 *  Pass:	msg = edit message number
 *  Return:	nothing
 *  Destroyed:	nothing
 */
@message void MSG_ACCESS_POINT_CONTROL_SET_EDIT_MSG (word msg = cx);

/*
 *  Send the edit messge to the controller's output
 *
 *  Pass:	id = access point to edit
 *  Return:	nothing
 *  Destroyed:	nothing
 */
@message void MSG_ACCESS_POINT_CONTROL_SEND_EDIT_MSG (word id = cx);

/*
 *  Get the ASPCI_enableDisable
 *
 *  Pass:	nothing
 *  Return:	object to enable
 *  Destroyed:	nothing
 */
@message optr MSG_ACCESS_POINT_CONTROL_GET_ENABLE_DISABLE () = cx:dx;

/*
 *  Set the ASPCI_enableDisable
 *
 *  Pass:	obj = object to enable
 *  Return:	nothing
 *  Destroyed:	nothing
 */
@message void MSG_ACCESS_POINT_CONTROL_SET_ENABLE_DISABLE (optr obj = cx:dx);

/*
 * One of the two-level triggers has been activated, and the controller
 * should exchange icons and update vardata.  Should not be used
 * externally.
 */
@message void MSG_ACCESS_POINT_CONTROL_CHANGING_LEVELS ();

/*
 * The user has changed the dynamic list's selection.  Should only be sent
 * by the list object.  Returns the selection ID.
 *
 * Pass: index = current list selection
 *       num   = # of selections
 */
@message word MSG_ACCESS_POINT_CONTROL_UPDATE_SELECTION (word index = cx,
                            word num = bp) = cx;

@protominor AccessNewForMultiselection

/*
 * Get the current number of selections in the access point list.
 * Returns zero if there is no selection.
 */
@message word MSG_ACCESS_POINT_CONTROL_GET_NUM_SELECTIONS () = ax;

/*
 * Return the current list of selection IDs.  The caller must allocate
 * a buffer for the entries and pass the size of the buffer.  If
 * there is insufficient space in the passed buffer for the IDs,
 * the buffer will not be filled in.
 * Call MSG_ACCESS_POINT_CONTROL_GET_NUM_SELECTIONS if you don't
 * know the number of selections beforehand.  If you are using an
 * exclusive list in the Access Point Controller, or know that the
 * access point list has none or one item selected, an easier way
 * to get the selection is to call MSG_ACCESS_POINT_CONTROL_GET_SELECTION.
 */
@message word MSG_ACCESS_POINT_CONTROL_GET_MULTIPLE_SELECTIONS (
              word *buffer = cx:dx,
              word maxIDs = bp) = ax;

@protoreset

/*
 * adds HINT_ITEM_GROUP_MINIMIZE_SIZE to the dynamic list inside the
 * controller's UI
 */
@vardata void HINT_ACCESS_POINT_CONTROL_MINIMIZE_SIZE;

/*
 * Null-terminated string to be used as a moniker for the dynamic list.
 */
@vardata ChunkHandle ATTR_ACCESS_POINT_CONTROL_LIST_MONIKER;

/*
 * The ID of the current selection.
 */
@vardata word ATTR_ACCESS_POINT_CONTROL_SELECTION;

/*
 * On a controller with APCF_TWOLEVEL, indicates that the edit buttons
 * are active and APCI_defineParent is inactive.  If present when the
 * controller is built, the second level will be initially usable.  In
 * this case, the APCI_defineParent should not be usable.
 */
@vardata void ATTR_ACCESS_POINT_CONTROL_SECOND_LEVEL_ACTIVE;

/*
 * ATTR_GEN_CONTROL_APP_UI is used internally to ensure proper cleanup
 * of the two-level trigger.  Applications should not use this attribute.
 */

@protominor AccessNewForMultiselection

/*
 * Causes the dyanmic list inside the controller's ui to be non-exclusive.
 */
@vardata void HINT_ACCESS_POINT_CONTROL_MULTISELECTABLE;

@protoreset

/*  type of access point to be displayed */
@instance AccessPointType	APCI_type = APT_INTERNET;

/*
 *  message sent to output when a value should be edited
 *
 *  Pass:		cx	= access point ID to edit
 *  Return:		nothing
 * */
@instance word	APCI_editMsg = 0;

/*  parent object for the "define" two level trigger */
@instance optr	APCI_defineParent = 0;

/*  menu slot in which the trigger should be placed */
@instance word	APCI_defineSlot = 0;

/*  object to enable when at least one access point exists */
@instance optr	APCI_enableDisable = 0;

/*
 * Bitmap lptr or ComplexMonikerBitmap to be exchanged with
 * ComplexMoniker icon when switching between viewing mode and edit
 * mode.  A value of 0 means do not change icon.  This field has no
 * effect unless APCF_TWOLEVEL is set, and the controller is a
 * ComplexMoniker.
 */
@instance word APCI_altBitmap = 0;

@endc /* AccessPointControlClass */
/*
 *  generic API for manipulating properties
 */

extern  word _pascal AccessPointCreateEntry (word loc,
                        AccessPointType apt);
/*
 * SYNOPSIS:	Create an access point
 *
 * PASS:	loc = access point before which to insert (0 for end)
 * 		apt = type of access point to create
 * RETURN:	new access point id
 */

extern	Boolean _pascal AccessPointDestroyEntry (word id);
/*
 * SYNOPSIS:	Destroy an access point
 *
 * PASS:	id = access point to remove
 * RETURN:	TRUE if error
 *	    	    (no such access point or access point is locked)
 */

extern  AccessPointType _pascal AccessPointGetType (word id);
/*
 * SYNOPSIS:	Get the access point type
 *
 * PASS:	id = access point to get type of
 * RETURN:	type of requested access point
 */

extern Boolean _pascal AccessPointSetStringProperty (word id,
                         char *prop,
                         char *val);
/*
 * SYNOPSIS:	Set a string property on an access point
 *
 * PASS:	id = access point to modify
 * 		prop = name of property, or AccessPointStandardProperty
 *		val = new value for property
 *
 * RETURN:	TRUE if error
 *	    	    (no such access point or access point is locked)
 */

extern Boolean _pascal AccessPointSetIntegerProperty (word id,
                          char *prop,
                          int val);
/*
 * SYNOPSIS:	Set a integer property on an access point
 *
 * PASS:	id = access point to modify
 * 		prop = name of property, or AccessPointStandardProperty
 *		val = new value for property
 *
 * RETURN:	TRUE if error
 *	    	    (no such access point or access point is locked)
 */

extern Boolean _pascal AccessPointGetStringPropertyBlock (word id,
                                char *prop,
                            MemHandle *data,
                            int *datalen);
/*
 * SYNOPSIS:	Get a string property on an access point
 *
 * PASS:	id = access point to read
 *		prop = name of property, or AccessPointStandardProperty
 *		data = block in which to put data (0 to allocate)
 *		datalen = buffer for data size
 *
 * RETURN:	TRUE if error
 *              data = block containing data
 *		datalen = length of data excluding NULL
 */

extern Boolean _pascal AccessPointGetStringPropertyBuffer (word id,
                               char *prop,
                               char *buf,
                               int *datalen);
/*
 * SYNOPSIS:	Get a string property on an access point
 *
 * PASS:	id = access point to read
 *		prop = name of property, or AccessPointStandardProperty
 *		buf = buffer to hold data
 *		datalen = size of buffer in bytes
 *
 * RETURN:	TRUE if error
 *		data filled in
 *		datalen = length of data in chars
 *
 * note that you pass a size and get back a length
 * it's weird, but it's consistent with InitFileReadStringBuffer
 */

extern Boolean _pascal AccessPointGetIntegerProperty (word id,
                             char *prop,
                             int *val);
/*
 * SYNOPSIS:	Get a integer property on an access point
 *
 * PASS:	id = access point to read
 *		prop = name of property, or AccessPointStandardProperty
 *		val = buffer to hold value
 *
 * RETURN:	TRUE if error
 *		val filled in
 */

extern Boolean _pascal AccessPointDestroyProperty (word id, char *prop);
/*
 * SYNOPSIS:	Destroy one property of an access point
 *
 * PASS:	id = access point to read
 *		prop = name of property, or AccessPointStandardProperty
 *
 * RETURN:	TRUE If error
 *	    	    (no such access point or access point is locked)
 */

extern ChunkHandle _pascal AccessPointGetEntries (MemHandle mh,
                         ChunkHandle chunk,
                         AccessPointType apt);
/*
 * SYNOPSIS:	Get a chunk array of entry IDs of a given type
 *
 * PASS:	mh = block containing chunk aray (locked)
 * 		chunk = chunk of chunk array, or 0 to allocate
 *		apt = type of entries to list
 *
 * RETURN:	handle of alloated array
 */

extern Boolean _pascal
    AccessPointCompareStandardProperty    (AccessPointStandardProperty prop,
                       char *str);
/*
 * SYNOPSIS:	Compare a string to a standard property name
 *
 * PASS:	prop - standard property to check
 *		str - string to compare standard property name to
 *
 * RETURN:	TRUE if identical
 */

extern void _pascal AccessPointCommit (void);
/*
 * SYNOPSIS:	force database to be written to disk
 *
 * PASS:	nothing
 * RETURN:	nothing
 *
 * This happens automaticly during shutdown, so this call is mainly useful
 * when debugging, where the system is likely to crash before committing.
 */

extern Boolean _pascal AccessPointIsEntryValid (word id);
/*
 * SYNOPSIS:    Determine whether an access point exists
 *
 * PASS:        id - access point ID to verify
 * RETURN:      TRUE if access point exists, FALSE if it does not
 */

/*-----------------------------------------------------------------------
 *   Routines below this line are not available on Communicators
 *   shipped before January 1997.  (pragmas excepted)
 *----------------------------------------------------------------------*/

extern void _pascal AccessPointLock  (word id);
/*
 * SYNOPSIS:	Lock an access point, preventing changes to it.
 *	    	Automatic properties may still be modified.
 *
 * PASS:    	id - access point to lock
 * RETURN:  	nothing
 */

extern void _pascal AccessPointUnlock  (word id);
/*
 * SYNOPSIS:	Unlock an access point.
 *
 * PASS:    	id - access point to unlock
 * RETURN:  	nothing
 */

extern Boolean _pascal AccessPointInUse  (word id);
/*
 * SYNOPSIS:    Check if an access point is being used by a connection.
 *
 * PASS:        id - access point to check
 * RETURN:      TRUE if access point is in use, FALSE if it is not
 */

@endlib

#ifdef __HIGHC__
pragma Alias(AccessPointCreateEntry,"ACCESSPOINTCREATEENTRY");
pragma Alias(AccessPointDestroyEntry,"ACCESSPOINTDESTROYENTRY");
pragma Alias(AccessPointGetType,"ACCESSPOINTGETTYPE");
pragma Alias(AccessPointSetStringProperty,"ACCESSPOINTSETSTRINGPROPERTY");
pragma Alias(AccessPointSetIntegerProperty,"ACCESSPOINTSETINTEGERPROPERTY");
pragma Alias(AccessPointGetStringPropertyBlock,"ACCESSPOINTGETSTRINGPROPERTYBLOCK");
pragma Alias(AccessPointGetStringPropertyBuffer,"ACCESSPOINTGETSTRINGPROPERTYBUFFER");
pragma Alias(AccessPointGetIntegerProperty,"ACCESSPOINTGETINTEGERPROPERTY");
pragma Alias(AccessPointDestroyProperty,"ACCESSPOINTDESTROYPROPERTY");
pragma Alias(AccessPointGetEntries,"ACCESSPOINTGETENTRIES");
pragma Alias(AccessPointCompareStandardProperty,"ACCESSPOINTCOMPARESTANDARDPROPERTY");
pragma Alias(AccessPointCommit,"ACCESSPOINTCOMMIT");

pragma Alias(AccessPointIsEntryValid, "ACCESSPOINTISENTRYVALID");
pragma Alias(AccessPointLock, "ACCESSPOINTLOCK");
pragma Alias(AccessPointUnlock, "ACCESSPOINTUNLOCK");
pragma Alias(AccessPointInUse, "ACCESSPOINTINUSE");

#endif

#endif