home *** CD-ROM | disk | FTP | other *** search
- #ifndef osword_H
- #define osword_H
-
- /* C header file for OSWord
- * written by DefMod (Sep 7 1994) on Wed Sep 7 21:20:08 1994
- * Copyright © Acorn Computers Ltd, 1994
- */
-
- /*************************************************************************
- * This source file was written by Acorn Computers Limited. It is part *
- * of the OSLib library for writing applications for RISC OS. It may be *
- * used freely in the creation of programs for RISC OS. *
- *************************************************************************/
-
- #ifndef types_H
- #include "types.h"
- #endif
-
- #ifndef os_H
- #include "os.h"
- #endif
-
- /**********************************
- * SWI names and SWI reason codes *
- **********************************/
- #undef OS_Word
- #define OS_Word 0x7
- #undef XOS_Word
- #define XOS_Word 0x20007
- #undef WordV
- #define WordV 0x7
- #undef OSWord_ReadLine
- #define OSWord_ReadLine 0x0
- #undef OSWord_ReadSystemClock
- #define OSWord_ReadSystemClock 0x1
- #undef OSWord_WriteSystemClock
- #define OSWord_WriteSystemClock 0x2
- #undef OSWord_ReadIntervalTimer
- #define OSWord_ReadIntervalTimer 0x3
- #undef OSWord_WriteIntervalTimer
- #define OSWord_WriteIntervalTimer 0x4
- #undef OSWord_ReadGCOL
- #define OSWord_ReadGCOL 0x9
- #undef OSWord_ReadCharDefinition
- #define OSWord_ReadCharDefinition 0xA
- #undef OSWord_ReadPalette
- #define OSWord_ReadPalette 0xB
- #undef OSWord_WritePalette
- #define OSWord_WritePalette 0xC
- #undef OSWord_ReadCursorPosition
- #define OSWord_ReadCursorPosition 0xD
- #undef OSWordRead_Clock
- #define OSWordRead_Clock 0xE
- #undef OSWordReadClock_LocalString
- #define OSWordReadClock_LocalString 0xE
- #undef OSWordReadClock_LocalBCD
- #define OSWordReadClock_LocalBCD 0xE
- #undef OSWordReadClock_ConvertBCDToString
- #define OSWordReadClock_ConvertBCDToString 0xE
- #undef OSWordReadClock_UTC
- #define OSWordReadClock_UTC 0xE
- #undef OSWord_WriteClock
- #define OSWord_WriteClock 0xF
- #undef OSWordWriteClock_TimeLocalString
- #define OSWordWriteClock_TimeLocalString 0xF
- #undef OSWordWriteClock_DateLocalString
- #define OSWordWriteClock_DateLocalString 0xF
- #undef OSWordWriteClock_DateAndTimeLocalString
- #define OSWordWriteClock_DateAndTimeLocalString 0xF
- #undef OSWord_Pointer
- #define OSWord_Pointer 0x15
- #undef OSWordPointer_Define
- #define OSWordPointer_Define 0x15
- #undef OSWordPointer_SetBBox
- #define OSWordPointer_SetBBox 0x15
- #undef OSWordPointer_Step
- #define OSWordPointer_Step 0x15
- #undef OSWordPointer_SetPosition
- #define OSWordPointer_SetPosition 0x15
- #undef OSWordPointer_ReadPosition
- #define OSWordPointer_ReadPosition 0x15
- #undef OSWordPointer_SetUnlinkedPosition
- #define OSWordPointer_SetUnlinkedPosition 0x15
- #undef OSWordPointer_ReadUnlinkedPosition
- #define OSWordPointer_ReadUnlinkedPosition 0x15
- #undef OSWord_WriteScreenBase
- #define OSWord_WriteScreenBase 0x16
-
- /************************************
- * Structure and union declarations *
- ************************************/
- typedef struct osword_line_block osword_line_block;
- typedef struct osword_timer_block osword_timer_block;
- typedef struct osword_gcol_block osword_gcol_block;
- typedef struct osword_char_definition_block osword_char_definition_block;
- typedef struct osword_palette_block osword_palette_block;
- typedef struct osword_cursor_position_block osword_cursor_position_block;
- typedef union oswordreadclock_local_string_block oswordreadclock_local_string_block;
- typedef union oswordreadclock_local_bcd_block oswordreadclock_local_bcd_block;
- typedef union oswordreadclock_convert_bcd_to_string_block oswordreadclock_convert_bcd_to_string_block;
- typedef union oswordreadclock_utc_block oswordreadclock_utc_block;
- typedef struct oswordwriteclock_block oswordwriteclock_block;
- typedef struct oswordpointer_define_block oswordpointer_define_block;
- typedef struct oswordpointer_bbox_block oswordpointer_bbox_block;
- typedef struct oswordpointer_step_block oswordpointer_step_block;
- typedef struct oswordpointer_position_block oswordpointer_position_block;
- typedef struct osword_screen_base_block osword_screen_base_block;
- typedef union osword_block osword_block;
-
- /********************
- * Type definitions *
- ********************/
- struct osword_line_block
- { short line;
- byte size;
- byte min_char;
- byte max_char;
- };
-
- struct osword_timer_block
- { byte b [5];
- };
-
- struct osword_gcol_block
- { short x;
- short y;
- os_gcol gcol;
- };
-
- struct osword_char_definition_block
- { char c;
- byte definition [8];
- };
-
- struct osword_palette_block
- { os_gcol gcol;
- byte colour_number;
- byte r;
- byte g;
- byte b;
- };
-
- struct osword_cursor_position_block
- { short xprev;
- short yprev;
- short x;
- short y;
- };
-
- union oswordreadclock_local_string_block
- { byte op;
- struct
- { char c [UNKNOWN];
- }
- string;
- };
-
- union oswordreadclock_local_bcd_block
- { byte op;
- os_bcd_date_and_time date_and_time;
- };
-
- union oswordreadclock_convert_bcd_to_string_block
- { struct
- { byte op;
- os_bcd_date_and_time date_and_time;
- }
- bcd;
- struct
- { char c [UNKNOWN];
- }
- string;
- };
-
- union oswordreadclock_utc_block
- { byte op;
- os_date_and_time utc;
- };
-
- struct oswordwriteclock_block
- { byte op;
- char string [UNKNOWN];
- };
-
- #define oswordwriteclock_BLOCK(N) \
- struct \
- { byte op; \
- char string [N]; \
- }
-
- #define oswordwriteclock_SIZEOF_BLOCK(N) \
- (offsetof (oswordwriteclock_block, string) + \
- (N)*sizeof ((oswordwriteclock_block *) NULL)->string)
-
- struct oswordpointer_define_block
- { byte reserved [2];
- byte op;
- byte shape_no;
- byte width;
- byte height;
- byte xactive;
- byte yactive;
- byte *data;
- };
-
- struct oswordpointer_bbox_block
- { byte reserved [3];
- byte op;
- short x0;
- short y0;
- short x1;
- short y1;
- };
-
- struct oswordpointer_step_block
- { byte op;
- byte xstep;
- byte ystep;
- };
-
- struct oswordpointer_position_block
- { byte reserved;
- byte op;
- short x;
- short y;
- };
-
- struct osword_screen_base_block
- { byte reserved [3];
- byte type;
- byte *base;
- };
-
- union osword_block
- { osword_line_block line;
- osword_timer_block timer;
- osword_gcol_block gcol;
- osword_char_definition_block char_definition;
- osword_palette_block palette;
- osword_cursor_position_block cursor_position;
- oswordreadclock_local_string_block string;
- oswordreadclock_local_bcd_block bcd;
- oswordreadclock_convert_bcd_to_string_block convert_bcd_to_string;
- oswordreadclock_utc_block utc;
- oswordwriteclock_block write_clock;
- oswordpointer_define_block pointer_define;
- oswordpointer_bbox_block pointer_bbox;
- oswordpointer_step_block pointer_step;
- oswordpointer_position_block pointer_position;
- osword_screen_base_block screen_base;
- };
-
- /************************
- * Constant definitions *
- ************************/
- #define oswordreadclock_OP_LOCAL_STRING 0
- #define oswordreadclock_OP_LOCAL_BCD 1
- #define oswordreadclock_OP_CONVERT_BCD_TO_STRING 2
- #define oswordreadclock_OP_UTC 3
- #define oswordwriteclock_OP_TIME_LOCAL_STRING 8
- #define oswordwriteclock_OP_DATE_LOCAL_STRING 15
- #define oswordwriteclock_OP_LOCAL_STRING 24
- #define oswordpointer_OP_DEFINE 0
- #define oswordpointer_OP_SET_BBOX 1
- #define oswordpointer_OP_STEP 2
- #define oswordpointer_OP_SET_POSITION 3
- #define oswordpointer_OP_READ_POSITION 4
- #define oswordpointer_OP_SET_UNLINKED_POSITION 5
- #define oswordpointer_OP_READ_UNLINKED_POSITION 6
- #define osword_CHAR_DEFINITION_ECF1 ((char) '\x02')
- #define osword_CHAR_DEFINITION_ECF2 ((char) '\x03')
- #define osword_CHAR_DEFINITION_ECF3 ((char) '\x04')
- #define osword_CHAR_DEFINITION_ECF4 ((char) '\x05')
- #define osword_CHAR_DEFINITION_DOT_DASH_PATTERN ((char) '\x06')
-
- /*************************
- * Function declarations *
- *************************/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*************************************************************
- * NOTE: The following functions provide direct access to *
- * the SWI's noted in the function description. *
- * Please read the relevant PRM section for more *
- * information on their input/output parameters. *
- *************************************************************/
-
- /* ------------------------------------------------------------------------
- * Function: osword_read_line()
- *
- * Description: Reads a line from the input stream to memory (prefer
- * OS_ReadLine)
- *
- * Input: line - value of R1 on entry
- *
- * Output: used - value of R2 on exit
- * psr - processor status register on exit (X version only)
- *
- * Returns: psr (non-X version only)
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x0.
- */
-
- extern os_error *xosword_read_line (osword_line_block *line,
- int *used,
- bits *psr);
- extern bits osword_read_line (osword_line_block *line,
- int *used);
-
- /* ------------------------------------------------------------------------
- * Function: osword_read_system_clock()
- *
- * Description: Reads the system clock
- *
- * Input: clock - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x1.
- */
-
- extern os_error *xosword_read_system_clock (osword_timer_block *clock);
- extern void osword_read_system_clock (osword_timer_block *clock);
-
- /* ------------------------------------------------------------------------
- * Function: osword_write_system_clock()
- *
- * Description: Writes the system clock
- *
- * Input: clock - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x2.
- */
-
- extern os_error *xosword_write_system_clock (osword_timer_block *clock);
- extern void osword_write_system_clock (osword_timer_block *clock);
-
- /* ------------------------------------------------------------------------
- * Function: osword_read_interval_timer()
- *
- * Description: Reads the interval timer
- *
- * Input: timer - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x3.
- */
-
- extern os_error *xosword_read_interval_timer (osword_timer_block *timer);
- extern void osword_read_interval_timer (osword_timer_block *timer);
-
- /* ------------------------------------------------------------------------
- * Function: osword_write_interval_timer()
- *
- * Description: Writes the interval timer
- *
- * Input: timer - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x4.
- */
-
- extern os_error *xosword_write_interval_timer (osword_timer_block *timer);
- extern void osword_write_interval_timer (osword_timer_block *timer);
-
- /* ------------------------------------------------------------------------
- * Function: osword_read_gcol()
- *
- * Description: Reads the logical colour of a pixel (prefer OS_ReadPoint)
- *
- * Input: gcol - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x9.
- */
-
- extern os_error *xosword_read_gcol (osword_gcol_block *gcol);
- extern void osword_read_gcol (osword_gcol_block *gcol);
-
- /* ------------------------------------------------------------------------
- * Function: osword_read_char_definition()
- *
- * Description: Reads a character definition
- *
- * Input: definition - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0xA.
- */
-
- extern os_error *xosword_read_char_definition (osword_char_definition_block *definition);
- extern void osword_read_char_definition (osword_char_definition_block *definition);
-
- /* ------------------------------------------------------------------------
- * Function: osword_read_palette()
- *
- * Description: Reads the palette (prefer OS_ReadPalette)
- *
- * Input: entry - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0xB.
- */
-
- extern os_error *xosword_read_palette (osword_palette_block *entry);
- extern void osword_read_palette (osword_palette_block *entry);
-
- /* ------------------------------------------------------------------------
- * Function: osword_write_palette()
- *
- * Description: Writes the palette (prefer os_VDU_SET_PALETTE)
- *
- * Input: entry - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0xC.
- */
-
- extern os_error *xosword_write_palette (osword_palette_block *entry);
- extern void osword_write_palette (osword_palette_block *entry);
-
- /* ------------------------------------------------------------------------
- * Function: osword_read_cursor_position()
- *
- * Description: Reads the current and previous graphics cursor positions
- * (prefer OS_ReadVduVariables)
- *
- * Input: position - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0xD.
- */
-
- extern os_error *xosword_read_cursor_position (osword_cursor_position_block *position);
- extern void osword_read_cursor_position (osword_cursor_position_block *position);
-
- /* ------------------------------------------------------------------------
- * Function: oswordreadclock_local_string()
- *
- * Description: Reads the real-time clock as a string, converting to
- * local time
- *
- * Input: string - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0xE.
- */
-
- extern os_error *xoswordreadclock_local_string (oswordreadclock_local_string_block *string);
- extern void oswordreadclock_local_string (oswordreadclock_local_string_block *string);
-
- /* ------------------------------------------------------------------------
- * Function: oswordreadclock_local_bcd()
- *
- * Description: Reads the real-time clock in BCD format, converting to
- * local time
- *
- * Input: bcd - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0xE.
- */
-
- extern os_error *xoswordreadclock_local_bcd (oswordreadclock_local_bcd_block *bcd);
- extern void oswordreadclock_local_bcd (oswordreadclock_local_bcd_block *bcd);
-
- /* ------------------------------------------------------------------------
- * Function: oswordreadclock_convert_bcd_to_string()
- *
- * Description: Converts a BCD clock value into string format
- *
- * Input: convert_bcd_to_String - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0xE.
- */
-
- extern os_error *xoswordreadclock_convert_bcd_to_string (oswordreadclock_convert_bcd_to_string_block *convert_bcd_to_String);
- extern void oswordreadclock_convert_bcd_to_string (oswordreadclock_convert_bcd_to_string_block *convert_bcd_to_String);
-
- /* ------------------------------------------------------------------------
- * Function: oswordreadclock_utc()
- *
- * Description: Reads the real-time clock in 5-byte format
- *
- * Input: utc - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0xE.
- */
-
- extern os_error *xoswordreadclock_utc (oswordreadclock_utc_block *utc);
- extern void oswordreadclock_utc (oswordreadclock_utc_block *utc);
-
- /* ------------------------------------------------------------------------
- * Function: oswordwriteclock_time_local_string()
- *
- * Description: Writes the real-time clock with a time string, converting
- * from local time
- *
- * Input: time - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0xF.
- */
-
- extern os_error *xoswordwriteclock_time_local_string (oswordwriteclock_block *time);
- extern void oswordwriteclock_time_local_string (oswordwriteclock_block *time);
-
- /* ------------------------------------------------------------------------
- * Function: oswordwriteclock_date_local_string()
- *
- * Description: Writes the real-time clock with a date string, converting
- * from local time
- *
- * Input: date - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0xF.
- */
-
- extern os_error *xoswordwriteclock_date_local_string (oswordwriteclock_block *date);
- extern void oswordwriteclock_date_local_string (oswordwriteclock_block *date);
-
- /* ------------------------------------------------------------------------
- * Function: oswordwriteclock_date_and_time_local_string()
- *
- * Description: Writes the real-time clock with a time and date string,
- * converting from local time
- *
- * Input: date_and_time - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0xF.
- */
-
- extern os_error *xoswordwriteclock_date_and_time_local_string (oswordwriteclock_block *date_and_time);
- extern void oswordwriteclock_date_and_time_local_string (oswordwriteclock_block *date_and_time);
-
- /* ------------------------------------------------------------------------
- * Function: oswordpointer_define()
- *
- * Description: Defines the pointer size, shape and active point (prefer
- * OSSpriteOp_SetPointerShape)
- *
- * Input: define - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x15, R1 += 0x2.
- */
-
- extern os_error *xoswordpointer_define (oswordpointer_define_block *define);
- extern void oswordpointer_define (oswordpointer_define_block *define);
-
- /* ------------------------------------------------------------------------
- * Function: oswordpointer_set_bbox()
- *
- * Description: Defines the mouse coordinate bounding box
- *
- * Input: bbox - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x15, R1 += 0x3.
- */
-
- extern os_error *xoswordpointer_set_bbox (oswordpointer_bbox_block *bbox);
- extern void oswordpointer_set_bbox (oswordpointer_bbox_block *bbox);
-
- /* ------------------------------------------------------------------------
- * Function: oswordpointer_step()
- *
- * Description: Defines the mouse multipliers
- *
- * Input: step - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x15.
- */
-
- extern os_error *xoswordpointer_step (oswordpointer_step_block *step);
- extern void oswordpointer_step (oswordpointer_step_block *step);
-
- /* ------------------------------------------------------------------------
- * Function: oswordpointer_set_position()
- *
- * Description: Sets the mouse position
- *
- * Input: pos - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x15, R1 += 0x1.
- */
-
- extern os_error *xoswordpointer_set_position (oswordpointer_position_block *pos);
- extern void oswordpointer_set_position (oswordpointer_position_block *pos);
-
- /* ------------------------------------------------------------------------
- * Function: oswordpointer_read_position()
- *
- * Description: Reads the unbuffered mouse position
- *
- * Input: pos - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x15, R1 += 0x1.
- */
-
- extern os_error *xoswordpointer_read_position (oswordpointer_position_block *pos);
- extern void oswordpointer_read_position (oswordpointer_position_block *pos);
-
- /* ------------------------------------------------------------------------
- * Function: oswordpointer_set_unlinked_position()
- *
- * Description: Sets the pointer position
- *
- * Input: pos - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x15, R1 += 0x1.
- */
-
- extern os_error *xoswordpointer_set_unlinked_position (oswordpointer_position_block *pos);
- extern void oswordpointer_set_unlinked_position (oswordpointer_position_block *pos);
-
- /* ------------------------------------------------------------------------
- * Function: oswordpointer_read_unlinked_position()
- *
- * Description: Reads the pointer position
- *
- * Input: pos - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x15, R1 += 0x1.
- */
-
- extern os_error *xoswordpointer_read_unlinked_position (oswordpointer_position_block *pos);
- extern void oswordpointer_read_unlinked_position (oswordpointer_position_block *pos);
-
- /* ------------------------------------------------------------------------
- * Function: osword_write_screen_base()
- *
- * Description: Writes the screen base address
- *
- * Input: screen_base - value of R1 on entry
- *
- * Other notes: Calls SWI 0x7 with R0 = 0x16, R1 += 0x3.
- */
-
- extern os_error *xosword_write_screen_base (osword_screen_base_block *screen_base);
- extern void osword_write_screen_base (osword_screen_base_block *screen_base);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-