home *** CD-ROM | disk | FTP | other *** search
- #ifndef drawfile_H
- #define drawfile_H
-
- /* C header file for DrawFile
- * written by DefMod (Oct 24 1994) on Tue Jan 17 15:20:45 1995
- * Copyright © Acorn Computers Ltd, 1994
- */
-
- #ifndef types_H
- #include "types.h"
- #endif
-
- #ifndef os_H
- #include "os.h"
- #endif
-
- #ifndef osspriteop_H
- #include "osspriteop.h"
- #endif
-
- #ifndef draw_H
- #include "draw.h"
- #endif
-
- #ifndef font_H
- #include "font.h"
- #endif
-
- #ifndef wimp_H
- #include "wimp.h"
- #endif
-
- /**********************************
- * SWI names and SWI reason codes *
- **********************************/
- #undef DrawFile_Render
- #define DrawFile_Render 0x45540
- #undef XDrawFile_Render
- #define XDrawFile_Render 0x65540
- #undef DrawFile_BBox
- #define DrawFile_BBox 0x45541
- #undef XDrawFile_BBox
- #define XDrawFile_BBox 0x65541
- #undef DrawFile_DeclareFonts
- #define DrawFile_DeclareFonts 0x45542
- #undef XDrawFile_DeclareFonts
- #define XDrawFile_DeclareFonts 0x65542
- #undef Service_DrawObjectRender
- #define Service_DrawObjectRender 0x45540
- #undef Service_DrawObjectDeclareFonts
- #define Service_DrawObjectDeclareFonts 0x45541
-
- /************************************
- * Structure and union declarations *
- ************************************/
- typedef struct drawfile_font_def drawfile_font_def;
- typedef struct drawfile_text_style drawfile_text_style;
- typedef struct drawfile_path_style drawfile_path_style;
- typedef struct drawfile_font_table drawfile_font_table;
- typedef struct drawfile_text drawfile_text;
- typedef struct drawfile_path drawfile_path;
- typedef struct drawfile_path_with_pattern drawfile_path_with_pattern;
- typedef struct drawfile_sprite drawfile_sprite;
- typedef struct drawfile_group drawfile_group;
- typedef struct drawfile_tagged drawfile_tagged;
- typedef struct drawfile_text_column drawfile_text_column;
- typedef struct drawfile_text_column_list drawfile_text_column_list;
- typedef struct drawfile_area_text drawfile_area_text;
- typedef struct drawfile_text_area drawfile_text_area;
- typedef struct drawfile_options drawfile_options;
- typedef struct drawfile_trfm_text drawfile_trfm_text;
- typedef struct drawfile_trfm_sprite drawfile_trfm_sprite;
- typedef struct drawfile_object drawfile_object;
- typedef struct drawfile_diagram drawfile_diagram;
- typedef struct drawfile_render_state drawfile_render_state;
- typedef struct drawfile_declare_fonts_state drawfile_declare_fonts_state;
-
- /********************
- * Type definitions *
- ********************/
- struct drawfile_font_def
- { byte font_index;
- char font_name [UNKNOWN];
- };
-
- #define drawfile_FONT_DEF(N) \
- struct \
- { byte font_index; \
- char font_name [N]; \
- }
-
- #define drawfile_SIZEOF_FONT_DEF(N) \
- (offsetof (drawfile_font_def, font_name) + \
- (N)*sizeof ((drawfile_font_def *) NULL)->font_name)
-
- struct drawfile_text_style
- { byte font_index;
- byte reserved [3];
- };
-
- struct drawfile_path_style
- { byte flags;
- byte reserved;
- byte cap_width;
- byte cap_length;
- };
-
- struct drawfile_font_table
- { drawfile_font_def font_def [UNKNOWN];
- };
-
- struct drawfile_text
- { os_box bbox;
- os_colour fill;
- os_colour bg_hint;
- drawfile_text_style style;
- int xsize;
- int ysize;
- os_coord base;
- char text [UNKNOWN];
- };
-
- #define drawfile_TEXT(N) \
- struct \
- { os_box bbox; \
- os_colour fill; \
- os_colour bg_hint; \
- drawfile_text_style style; \
- int xsize; \
- int ysize; \
- os_coord base; \
- char text [N]; \
- }
-
- #define drawfile_SIZEOF_TEXT(N) \
- (offsetof (drawfile_text, text) + \
- (N)*sizeof ((drawfile_text *) NULL)->text)
-
- struct drawfile_path
- { os_box bbox;
- os_colour fill;
- os_colour outline;
- int width;
- drawfile_path_style style;
- draw_path path;
- };
-
- struct drawfile_path_with_pattern
- { os_box bbox;
- os_colour fill;
- os_colour outline;
- int width;
- drawfile_path_style style;
- draw_dash_pattern pattern;
- draw_path path;
- };
-
- struct drawfile_sprite
- { os_box bbox;
- osspriteop_header header;
- byte data [UNKNOWN];
- };
-
- #define drawfile_SPRITE(N) \
- struct \
- { os_box bbox; \
- osspriteop_header header; \
- byte data [N]; \
- }
-
- #define drawfile_SIZEOF_SPRITE(N) \
- (offsetof (drawfile_sprite, data) + \
- (N)*sizeof ((drawfile_sprite *) NULL)->data)
-
- struct drawfile_group
- { os_box bbox;
- char name [12];
- int objects [UNKNOWN];
- };
-
- #define drawfile_GROUP(N) \
- struct \
- { os_box bbox; \
- char name [12]; \
- int objects [N]; \
- }
-
- #define drawfile_SIZEOF_GROUP(N) \
- (offsetof (drawfile_group, objects) + \
- (N)*sizeof ((drawfile_group *) NULL)->objects)
-
- struct drawfile_tagged
- { os_box bbox;
- int tag;
- int object [UNKNOWN];
- };
-
- #define drawfile_TAGGED(N) \
- struct \
- { os_box bbox; \
- int tag; \
- int object [N]; \
- }
-
- #define drawfile_SIZEOF_TAGGED(N) \
- (offsetof (drawfile_tagged, object) + \
- (N)*sizeof ((drawfile_tagged *) NULL)->object)
-
- struct drawfile_text_column
- { os_box box;
- };
-
- struct drawfile_text_column_list
- { struct
- { int type;
- int size;
- drawfile_text_column data;
- }
- columns [UNKNOWN];
- };
-
- #define drawfile_TEXT_COLUMN_LIST(N) \
- struct \
- { struct \
- { int type; \
- int size; \
- drawfile_text_column data; \
- } \
- columns [N]; \
- }
-
- #define drawfile_SIZEOF_TEXT_COLUMN_LIST(N) \
- ((N)*sizeof ((drawfile_text_column_list *) NULL)->columns)
-
- struct drawfile_area_text
- { int type;
- int reserved [2];
- os_colour fill;
- os_colour bg_hint;
- char text [UNKNOWN];
- };
-
- #define drawfile_AREA_TEXT(N) \
- struct \
- { int type; \
- int reserved [2]; \
- os_colour fill; \
- os_colour bg_hint; \
- char text [N]; \
- }
-
- #define drawfile_SIZEOF_AREA_TEXT(N) \
- (offsetof (drawfile_area_text, text) + \
- (N)*sizeof ((drawfile_area_text *) NULL)->text)
-
- struct drawfile_text_area
- { os_box bbox;
- drawfile_text_column_list header;
- drawfile_area_text area_text;
- };
-
- struct drawfile_options
- { os_box bbox;
- int paper_size;
- bits paper_options;
- float grid_spacing;
- int grid_division;
- bool isometric;
- bool auto_adjust;
- bool show;
- bool lock;
- bool cm;
- int zoom_mul;
- int zoom_div;
- bool zoom_lock;
- bool toolbox;
- bits entry_mode;
- int undo_size;
- };
-
- struct drawfile_trfm_text
- { os_box bbox;
- os_trfm trfm;
- bits flags;
- os_colour fill;
- os_colour bg_hint;
- drawfile_text_style style;
- int xsize;
- int ysize;
- os_coord base;
- char text [UNKNOWN];
- };
-
- #define drawfile_TRFM_TEXT(N) \
- struct \
- { os_box bbox; \
- os_trfm trfm; \
- bits flags; \
- os_colour fill; \
- os_colour bg_hint; \
- drawfile_text_style style; \
- int xsize; \
- int ysize; \
- os_coord base; \
- char text [N]; \
- }
-
- #define drawfile_SIZEOF_TRFM_TEXT(N) \
- (offsetof (drawfile_trfm_text, text) + \
- (N)*sizeof ((drawfile_trfm_text *) NULL)->text)
-
- struct drawfile_trfm_sprite
- { os_box bbox;
- os_trfm trfm;
- osspriteop_header header;
- byte data [UNKNOWN];
- };
-
- #define drawfile_TRFM_SPRITE(N) \
- struct \
- { os_box bbox; \
- os_trfm trfm; \
- osspriteop_header header; \
- byte data [N]; \
- }
-
- #define drawfile_SIZEOF_TRFM_SPRITE(N) \
- (offsetof (drawfile_trfm_sprite, data) + \
- (N)*sizeof ((drawfile_trfm_sprite *) NULL)->data)
-
- struct drawfile_object
- { int type;
- int size;
- union
- { drawfile_font_table font_table;
- drawfile_text text;
- drawfile_path path;
- drawfile_path_with_pattern path_with_pattern;
- drawfile_sprite sprite;
- drawfile_group group;
- drawfile_tagged tagged;
- drawfile_text_column text_column;
- drawfile_text_area text_area;
- drawfile_options options;
- drawfile_trfm_text trfm_text;
- drawfile_trfm_sprite trfm_sprite;
- }
- data;
- };
-
- struct drawfile_diagram
- { char tag [4];
- int major_version;
- int minor_version;
- char source [12];
- os_box bbox;
- drawfile_object objects [UNKNOWN];
- };
-
- struct drawfile_render_state
- { drawfile_object *object;
- drawfile_diagram *diagram;
- drawfile_object *font_table;
- bits flags;
- os_trfm *trfm;
- os_box *clip;
- int flatness;
- os_error *error;
- };
-
- struct drawfile_declare_fonts_state
- { drawfile_object *object;
- drawfile_diagram *diagram;
- drawfile_object *font_table;
- bits flags;
- os_error *error;
- };
-
- /************************
- * Constant definitions *
- ************************/
- #define error_DRAW_FILE_NOT_DRAW 0x20C00u
- #define error_DRAW_FILE_VERSION 0x20C01u
- #define error_DRAW_FILE_FONT_TAB 0x20C02u
- #define error_DRAW_FILE_BAD_FONT_NO 0x20C03u
- #define error_DRAW_FILE_BAD_MODE 0x20C04u
- #define error_DRAW_FILE_BAD_FILE 0x20C05u
- #define error_DRAW_FILE_BAD_GROUP 0x20C06u
- #define error_DRAW_FILE_BAD_TAG 0x20C07u
- #define error_DRAW_FILE_SYNTAX 0x20C08u
- #define error_DRAW_FILE_FONT_NO 0x20C09u
- #define error_DRAW_FILE_AREA_VER 0x20C0Au
- #define error_DRAW_FILE_NO_AREA_VER 0x20C0Bu
- #define drawfile_TYPE_FONT_TABLE 0
- #define drawfile_TYPE_TEXT 1
- #define drawfile_TYPE_PATH 2
- #define drawfile_TYPE_SPRITE 5
- #define drawfile_TYPE_GROUP 6
- #define drawfile_TYPE_TAGGED 7
- #define drawfile_TYPE_TEXT_AREA 9
- #define drawfile_TYPE_TEXT_COLUMN 10
- #define drawfile_TYPE_OPTIONS 11
- #define drawfile_TYPE_TRFM_TEXT 12
- #define drawfile_TYPE_TRFM_SPRITE 13
- #define drawfile_TYPE_JPEG 16
- #define drawfile_PATH_MITRED 0x0u
- #define drawfile_PATH_ROUND 0x1u
- #define drawfile_PATH_BEVELLED 0x2u
- #define drawfile_PATH_BUTT 0x0u
- #define drawfile_PATH_SQUARE 0x2u
- #define drawfile_PATH_TRIANGLE 0x3u
- #define drawfile_PATH_JOIN_SHIFT 0
- #define drawfile_PATH_JOIN 0x3u
- #define drawfile_PATH_END_SHIFT 2
- #define drawfile_PATH_END 0xCu
- #define drawfile_PATH_START_SHIFT 4
- #define drawfile_PATH_START 0x30u
- #define drawfile_PATH_WINDING_EVEN_ODD 0x40u
- #define drawfile_PATH_DASHED 0x80u
- #define drawfile_PATH_CAP_WIDTH_SHIFT 16
- #define drawfile_PATH_CAP_WIDTH 0xFF0000u
- #define drawfile_PATH_CAP_LENGTH_SHIFT 24
- #define drawfile_PATH_CAP_LENGTH 0xFF000000u
- #define drawfile_TEXT_KERN 0x1u
- #define drawfile_TEXT_RIGHT_TO_LEFT 0x2u
- #define drawfile_TEXT_UNDERLINE 0x4u
- #define drawfile_RENDER_BBOXES 0x1u
- #define drawfile_RENDER_SUPPRESS 0x2u
- #define drawfile_RENDER_GIVEN_FLATNESS 0x4u
- #define drawfile_NO_DOWNLOAD 0x1u
-
- /*************************
- * Function declarations *
- *************************/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /* ------------------------------------------------------------------------
- * Function: drawfile_render()
- *
- * Description: Calls SWI 0x45540
- *
- * Input: flags - value of R0 on entry
- * diagram - value of R1 on entry
- * size - value of R2 on entry
- * trfm - value of R3 on entry
- * clip - value of R4 on entry
- * flatness - value of R5 on entry
- */
-
- extern os_error *xdrawfile_render (bits flags,
- drawfile_diagram *diagram,
- int size,
- os_trfm *trfm,
- os_box *clip,
- int flatness);
- extern void drawfile_render (bits flags,
- drawfile_diagram *diagram,
- int size,
- os_trfm *trfm,
- os_box *clip,
- int flatness);
-
- /* ------------------------------------------------------------------------
- * Function: drawfile_bbox()
- *
- * Description: Calls SWI 0x45541
- *
- * Input: flags - value of R0 on entry
- * diagram - value of R1 on entry
- * size - value of R2 on entry
- * trfm - value of R3 on entry
- * bbox - value of R4 on entry
- */
-
- extern os_error *xdrawfile_bbox (bits flags,
- drawfile_diagram *diagram,
- int size,
- os_trfm *trfm,
- os_box *bbox);
- extern void drawfile_bbox (bits flags,
- drawfile_diagram *diagram,
- int size,
- os_trfm *trfm,
- os_box *bbox);
-
- /* ------------------------------------------------------------------------
- * Function: drawfile_declare_fonts()
- *
- * Description: Calls SWI 0x45542
- *
- * Input: flags - value of R0 on entry
- * diagram - value of R1 on entry
- * size - value of R2 on entry
- */
-
- extern os_error *xdrawfile_declare_fonts (bits flags,
- drawfile_diagram *diagram,
- int size);
- extern void drawfile_declare_fonts (bits flags,
- drawfile_diagram *diagram,
- int size);
-
- /* ------------------------------------------------------------------------
- * Function: service_draw_object_render()
- *
- * Description: Render unknown Draw object in Draw file
- *
- * Input: type - value of R0 on entry
- * state - value of R2 on entry
- *
- * Output: unclaimed - value of R1 on exit (X version only)
- *
- * Returns: R1 (non-X version only)
- *
- * Other notes: Calls SWI 0x30 with R1 = 0x45540.
- */
-
- extern os_error *xservice_draw_object_render (int type,
- drawfile_render_state *state,
- bool *unclaimed);
- extern bool service_draw_object_render (int type,
- drawfile_render_state *state);
-
- /* ------------------------------------------------------------------------
- * Function: service_draw_object_declare_fonts()
- *
- * Description: Declare fonts for unknown Draw object in Draw file
- *
- * Input: type - value of R0 on entry
- * state - value of R2 on entry
- *
- * Output: unclaimed - value of R1 on exit (X version only)
- *
- * Returns: R1 (non-X version only)
- *
- * Other notes: Calls SWI 0x30 with R1 = 0x45541.
- */
-
- extern os_error *xservice_draw_object_declare_fonts (int type,
- drawfile_declare_fonts_state *state,
- bool *unclaimed);
- extern bool service_draw_object_declare_fonts (int type,
- drawfile_declare_fonts_state *state);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-