Source
...
Target
Commits (3)
  • Robert Sprowson's avatar
    Fix for abort when dragging an unknown filetype to Draw, and a bogus error message · 2ab1e96d
    Robert Sprowson authored
    Various places in Draw were making an error block (via makmsg or retmsg macros) from a cast pointer using the msg part of RISC_OSLib. However, as RISC_OSLib caches the messages file and returns direct pointers to it, the resulting error blocks would often not be word aligned, leading to an abort when the Wimp tries to copy it for the Wimp_ReportError.
    In turn, the abort would be reported as unhelpful "wimpt1" message because the signal handler was looking it up in the application messages, not the default RISC_OSLib messages.
    Draw.c:
    New function top copy the msg to a word aligned static struct.
    Fix signal handler to use msgs_default_control_block() so that "wimpt1" can be found.
    Draw.h/others:
    Replace makmsg and retmsg with calls to the new aligning function.
    
    Tested by dragging a GIF and a BMP to Draw, and it no longer aborts.
    
    Version 1.28. Tagged as 'Draw-1_28'
    2ab1e96d
  • Robert Sprowson's avatar
    Static analysis fixups · 61f4df80
    Robert Sprowson authored
    Line 114:
    Remove the potential divide by zero by considering that the only way to get xspace=0 is when yspace <= 1, in which case it's a unity grid.
    Line 295:
    Add some brackets to make the expression unambiguous. Fortunately with Norcroft ((thing & 1) == 1) results in the same output as (thing & (1 == 1)) in this situation.
    From a tip off in https://www.riscosopen.org/forum/forums/4/topics/3990
    
    Version 1.29. Tagged as 'Draw-1_29'
    61f4df80
  • Robert Sprowson's avatar
    Edit UTF-8 text in text entry with backspace correctly · 15e2c31d
    Robert Sprowson authored
    On starting a new string using the text entry tool, cache the current alphabet, then when backspace is pressed handle deletes properly when the alphabet is UTF-8 by skipping over continuation marks until a non continuation mark is found.
    The backspace code can afford to be simplistic because any invalid UTF-8 sequences already in the file when it is opened will end up (via Ctrl-E) in a Wimp writeable, which is handled by the Wimp's robust code. Only newly created strings are able to have backspace applied, so by definition they were entered just moments earlier, and so reasonable to assume they're valid UTF-8.
    
    Having entered a string, get the bounding box right by calling Font_ScanString rather than manually walking the string with Font_CharBBox (Font_ScanString was already being used for transformed text, so rotated bounding boxes were right). Now the two are common, make a font_scanstring() function to handle both.
    
    This could be further simplified...
    15e2c31d
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.27"
Module_Version SETA 127
Module_MajorVersion SETS "1.30"
Module_Version SETA 130
Module_MinorVersion SETS ""
Module_Date SETS "24 Mar 2015"
Module_ApplicationDate SETS "24-Mar-15"
Module_Date SETS "27 Oct 2016"
Module_ApplicationDate SETS "27-Oct-16"
Module_ComponentName SETS "Draw"
Module_ComponentPath SETS "castle/RiscOS/Sources/Apps/Draw"
Module_FullVersion SETS "1.27"
Module_HelpVersion SETS "1.27 (24 Mar 2015)"
Module_FullVersion SETS "1.30"
Module_HelpVersion SETS "1.30 (27 Oct 2016)"
END
/* (1.27)
/* (1.30)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.27
#define Module_MajorVersion_CMHG 1.30
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 24 Mar 2015
#define Module_Date_CMHG 27 Oct 2016
#define Module_MajorVersion "1.27"
#define Module_Version 127
#define Module_MajorVersion "1.30"
#define Module_Version 130
#define Module_MinorVersion ""
#define Module_Date "24 Mar 2015"
#define Module_Date "27 Oct 2016"
#define Module_ApplicationDate "24-Mar-15"
#define Module_ApplicationDate "27-Oct-16"
#define Module_ComponentName "Draw"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Draw"
#define Module_FullVersion "1.27"
#define Module_HelpVersion "1.27 (24 Mar 2015)"
#define Module_LibraryVersionInfo "1:27"
#define Module_FullVersion "1.30"
#define Module_HelpVersion "1.30 (27 Oct 2016)"
#define Module_LibraryVersionInfo "1:30"
......@@ -543,6 +543,15 @@ void draw_reset_gchar (void)
}
}
/*Produce a correctly word aligned error from a messages file token*/
os_error *draw_make_oserror (const char *token)
{ static os_error block;
/* N.B. prefix messages with #### to fake error number field */
memcpy (&block, msgs_lookup ((char *) token), sizeof (block));
return &block;
}
/*Make origin, typically from a wimp_openstr*/
static void make_origin (draw_objcoord *to, wimp_box *box, int *scroll)
......@@ -1572,7 +1581,7 @@ static os_error *load_file (diagrec *diag, viewrec *vuue, draw_objcoord *pt,
default:
#if REJECTUNKNOWNFILETYPES
return makmsg ("DrawCL");
return draw_make_oserror ("DrawCL");
#endif
break;
......@@ -1604,7 +1613,7 @@ static os_error *load_file (diagrec *diag, viewrec *vuue, draw_objcoord *pt,
default:
#if REJECTUNKNOWNFILETYPES
if (!dataopen) return makmsg ("DrawCL");
if (!dataopen) return draw_make_oserror ("DrawCL");
#endif
break;
}
......@@ -2737,7 +2746,7 @@ int main (int argc, char **argv)
os_error errblk = {0, "wimpt1"};
regs.r[0] = (int)&errblk;
regs.r[1] = (int)msgs_main_control_block ();
regs.r[1] = (int)msgs_default_control_block ();
regs.r[2] = NULL;
regs.r[3] = 0;
err = os_swix (MessageTrans_ErrorLookup, &regs);
......@@ -2973,7 +2982,7 @@ static os_error *draw_createblank (int size, diagrec **diagp,
/*Claim a small (non shifting) block, to hold pointers to our*/
/*main dBase, misc workspace & filename*/
if ((diag = (diagrec *) Alloc (sizeof (diagrec))) == NULL)
retmsg ("DrawNR"); /*Return error*/
return draw_make_oserror ("DrawNR"); /*Return error*/
ftracef1 ("draw_createblank: allocated diag: 0x%X\n", diag);
/*diag now holds a pointer to a block in 'C's heap, dispose of this*/
......@@ -2983,20 +2992,20 @@ static os_error *draw_createblank (int size, diagrec **diagp,
ftracef1 ("draw_createblank: claiming %d bytes of paper\n", size);
if (FLEX_ALLOC ((flex_ptr) &diag->misc, sizeof (draw_diagstr)) == NULL)
{ Free (diag);
retmsg ("DrawNR");
return draw_make_oserror ("DrawNR");
}
if (FLEX_ALLOC ((flex_ptr) &diag->paper, size) == NULL)
{ FLEX_FREE ((flex_ptr) &diag->misc); /*free 1st block*/
Free (diag);
retmsg ("DrawNR");
return draw_make_oserror ("DrawNR");
}
if ((diag->undo = draw_undo_new ()) == NULL)
{ FLEX_FREE ((flex_ptr) &diag->paper);
FLEX_FREE ((flex_ptr) &diag->misc); /*free 1st block*/
Free (diag);
retmsg ("DrawNR");
return draw_make_oserror ("DrawNR");
}
draw_undo_setbufsize (diag, opt->undo_size);
......@@ -3159,12 +3168,12 @@ static os_error *draw_createview (diagrec *diag, viewrec **vuuep)
*vuuep = 0; /*incase Alloc fails*/
if ((vuue = (viewrec *) Alloc (sizeof (viewrec))) == NULL)
retmsg ("DrawNR") /*Return error*/
return draw_make_oserror ("DrawNR"); /*Return error*/
/*Allocate space for title*/
if ((title = Alloc (TITLEBUFMAX)) == NULL)
{ Free (vuue);
retmsg ("DrawNR")
return draw_make_oserror ("DrawNR");
}
*title = 0;
......
......@@ -72,45 +72,6 @@ draw_bboxtyp *draw_displ_bbox (draw_objptr hdrptr)
}
#endif
os_error *draw_displ_font_stringpixbbox (font fonth, char *ptr,
draw_bboxtyp *boundp)
{ os_error *err = 0;
draw_bboxtyp bound = draw_big_box;
int x, y, x2, y2;
ftracef0 ("draw_displ_font_stringpixbbox\n");
x = y = 0;
while (*ptr)
{ font_info info;
err = font_charbbox (fonth, *ptr, font_OSCOORDS, &info);
err = font_converttoos (x, y, &x2, &y2);
if (x2+info.minx < bound.x0) bound.x0 = x2+info.minx;
if (y2+info.miny < bound.y0) bound.y0 = y2+info.miny;
if (x2+info.maxx > bound.x1) bound.x1 = x2+info.maxx;
if (y2+info.maxy > bound.y1) bound.y1 = y2+info.maxy;
{ font_string fs;
fs.s = ptr;
fs.x = fs.y = INT_MAX;
fs.split = -1;
fs.term = 1;
err = font_strwidth (&fs);
x += fs.x; y += fs.y;
ptr++;
}
}
*boundp = bound;
return (err);
}
/*(r/c)lpo is last point omitted */
/*(r/c)fpo is first point omitted */
/*(r/c)beo is both ends omitted */
......@@ -907,9 +868,8 @@ static os_error *do_objtrfmtext_system (draw_objptr hdrptr,
len = strlen (hdrptr.trfmtextp->text);
size_of_area = 10*1024; /*!!!*/
if ((area = Alloc (size_of_area)) == NULL)
{ ftracef1 ("-> \"%s\"\n",
((os_error *) msgs_lookup ("DrawNR"))->errmess);
return (os_error *) msgs_lookup ("DrawNR");
{ ftracef1 ("-> out of memory\n");
return draw_make_oserror ("DrawNR");
}
ftracef0 ("do_objtrfmtext_system: initialise sprite area\n");
......@@ -1203,7 +1163,7 @@ static os_error *do_objtrfmtext (draw_objptr hdrptr, draw_objcoord *org)
/*Make a buffer big enough*/
if ((misc_data = Alloc (reg_set1.r [4])) == NULL)
{ (void) font_lose (fonth);
return (os_error *) msgs_lookup ("DrawNR");
return draw_make_oserror ("DrawNR");
}
/*Fill in the buffer*/
......@@ -1227,7 +1187,7 @@ static os_error *do_objtrfmtext (draw_objptr hdrptr, draw_objcoord *org)
if ((buf = Alloc (3 + strlen (hdrptr.trfmtextp->text) + 1))
== NULL)
{ (void) font_lose (fonth);
return (os_error *) msgs_lookup ("DrawNR");
return draw_make_oserror ("DrawNR");
}
/*Fill in the string*/
......
......@@ -813,7 +813,7 @@ void draw_enter_delete(diagrec *diag)
bbox2 = bbox1;
bbox2.x1 = bbox2.x0;
draw_obj_deltext_char(diag); /* delete char */
draw_obj_deltext_char(diag); /* backspace char */
if (draw_obj_findtext_len (diag) == 0) /* if string empty, */
diag->misc->substate = state_text_caret; /* change state */
......
......@@ -108,9 +108,10 @@ void draw_grid_snap (viewrec *vuue, draw_objcoord *pt)
/* Find rounded down x, y coordinates */
if (xspace == 0)
{ x0 = x1 = xx;
{ /* Implies yspace <= 1 */
x0 = x1 = xx;
dx0 = dx1 = 0;
colnum = x0/xspace;
colnum = xx;
}
else
{ x0 = (xx/xspace)*xspace;
......@@ -289,7 +290,7 @@ void draw_grid_paint (viewrec *vuue, draw_objcoord *org, draw_bboxtyp clip)
yDelta = (int) (yInc/ySteps);
xStart = clip.x0;
if ((clip.y0/yInc) & 1 == 1) /* Row number test */
if (((clip.y0/yInc) & 1) == 1) /* Row number test */
{ clip.x0 = (int) (clip.x0 + xInc/2);
if (clip.x0 >= xStart) clip.x0 -= xInc;
}
......
......@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <string.h>
#include <swis.h>
#include "Global/Countries.h"
#include "bbc.h"
#include "bezierarc.h"
......@@ -88,7 +89,7 @@ os_error *draw_obj_checkspace(diagrec *diag, int needed)
diag->misc->bufferlimit += shortfall;
}
else
retmsg("DrawNR");
return draw_make_oserror("DrawNR");
}
return 0;
......@@ -107,6 +108,8 @@ void draw_obj_fileheader(diagrec *diag)
diag->misc->ghostlimit += sizeof(draw_fileheader);
}
static int draw_currentalphabet; /*cached system alphabet*/
static draw_groupnametyp twelvespaces = { ' ',' ',' ',' ',
' ',' ',' ',' ',
' ',' ',' ',' ',};
......@@ -115,6 +118,7 @@ void draw_obj_start(diagrec *diag, draw_tagtyp tag)
{ draw_objptr hdrptr;
int hdr_off = diag->misc->ghostlimit;
int junk;
ftracef0 ("draw_obj_start\n");
hdrptr.bytep = diag->paper + diag->misc->ghostlimit;
......@@ -136,6 +140,8 @@ void draw_obj_start(diagrec *diag, draw_tagtyp tag)
case draw_OBJTEXT:
diag->misc->ghostlimit += sizeof(draw_textstrhdr) + sizeof (char);
hdrptr.textp->text[0] = 0; /* Null text string */
draw_currentalphabet = 127; /* Read alphabet */
os_byte(71, &draw_currentalphabet, &junk);
break;
case draw_OBJPATH:
......@@ -645,10 +651,23 @@ int draw_obj_findtext_len(diagrec *diag) /* Count chars incase string is */
void draw_obj_deltext_char(diagrec *diag) /* Assumes at least 1 char present */
{ char *to = diag->paper + diag->misc->ghostlimit;
int bytes;
ftracef0 ("draw_obj_deltext_char\n");
*(to-2) = '\0'; /* Knock out with a null */
diag->misc->ghostlimit -= sizeof (char);
if (draw_currentalphabet == ISOAlphabet_UTF8)
{ to -= 2; /* Byte before the null */
bytes = 1;
while ((*to & 0xC0) == 0x80) /* Skip continuation marks */
{ bytes++;
to--;
}
*to = '\0'; /* Knock out with a null */
}
else
{ *(to-2) = '\0'; /* Knock out with a null */
bytes = 1; /* Not UTF-8, so 1 character = 1 byte */
}
diag->misc->ghostlimit -= (bytes * sizeof (char));
}
void draw_obj_addtext_term(diagrec *diag) /* text has 1 null terminator*/
......@@ -856,12 +875,40 @@ void draw_obj_bound_minmax2(draw_objptr hdrptr, draw_bboxtyp *boundp)
draw_obj_bound_minmax(bbox->x1, bbox->y1, boundp);
}
/* Local implementation of oddly missing function from RISC_OSLib */
static os_error *font_scanstring(const char *text, int options, font fonth,
const drawmod_transmat *matrix, draw_bboxtyp *bbox)
{ os_error *error;
os_regset reg_set;
struct {struct {int x, y;} space_offset; struct {int x, y;} char_offset;
int split_char; draw_bboxtyp bbox;} block;
options |= 1 << 5 /*R5 -> coordinate block*/ |
1 << 8 /*R0 = initial font handle*/ |
1 << 18 /*return bbox*/;
if (matrix != NULL)
{ options |= 1 << 6 /*R6 -> trfm*/;
reg_set.r [6] = (int) matrix;
}
reg_set.r [0] = fonth;
reg_set.r [1] = (int) text;
reg_set.r [2] = options;
reg_set.r [3] = INT_MAX;
reg_set.r [4] = INT_MAX;
reg_set.r [5] = (int) memset (&block, 0, sizeof block);
error = os_swix (Font_ScanString, &reg_set);
*bbox = block.bbox;
return error;
}
/* Code to find the bbox for just the current text object. FALSE on error */
BOOL draw_obj_findTextBox(draw_objptr hdrptr, draw_bboxtyp *bbox)
{ os_error *err = 0;
font fonth;
char *text;
{ BOOL ok = TRUE;
font fonth;
const char *text;
ftracef0 ("draw_obj_findTextBox\n");
text = &hdrptr.textp->text [0];
......@@ -871,19 +918,20 @@ BOOL draw_obj_findTextBox(draw_objptr hdrptr, draw_bboxtyp *bbox)
/* fsizex & fsizey are in 1/640ths point, current font managers */
/* take 1/16ths point, so scale by 1/40 (ie 16/640) */
if (err = font_find(draw_fontcat.name[hdrptr.textp->textstyle.fontref],
MAXZOOMFACTOR*hdrptr.textp->fsizex/40,
MAXZOOMFACTOR*hdrptr.textp->fsizey/40,
0,0, &fonth), !err)
{ err = draw_displ_font_stringpixbbox(fonth, text, bbox);
font_lose(fonth);
if (!err)
{ /* Calculate actual bbox in Draw units */
bbox->x0 = (bbox->x0 << 8)/MAXZOOMFACTOR + hdrptr.textp->coord.x;
bbox->x1 = (bbox->x1 << 8)/MAXZOOMFACTOR + hdrptr.textp->coord.x;
bbox->y0 = (bbox->y0 << 8)/MAXZOOMFACTOR + hdrptr.textp->coord.y;
bbox->y1 = (bbox->y1 << 8)/MAXZOOMFACTOR + hdrptr.textp->coord.y;
ok = font_find (draw_fontcat.name[hdrptr.textp->textstyle.fontref],
MAXZOOMFACTOR*hdrptr.textp->fsizex/40,
MAXZOOMFACTOR*hdrptr.textp->fsizey/40,
0,0, &fonth) == NULL;
if (ok)
{ ok = font_scanstring (text, 0, fonth, NULL, bbox) == NULL;
font_lose (fonth);
if (ok)
{ /* Calculate actual bbox in Draw units from millipoints */
bbox->x0 = (bbox->x0 << 8)/(400*MAXZOOMFACTOR) + hdrptr.textp->coord.x;
bbox->x1 = (bbox->x1 << 8)/(400*MAXZOOMFACTOR) + hdrptr.textp->coord.x;
bbox->y0 = (bbox->y0 << 8)/(400*MAXZOOMFACTOR) + hdrptr.textp->coord.y;
bbox->y1 = (bbox->y1 << 8)/(400*MAXZOOMFACTOR) + hdrptr.textp->coord.y;
return(TRUE);
}
......@@ -892,9 +940,7 @@ BOOL draw_obj_findTextBox(draw_objptr hdrptr, draw_bboxtyp *bbox)
/*Either text is in system font, OR an unfound fancy font (so rendered in */
/*system font) or some font manager call went bang, so.. */
/*Return BBox for system font. Assumes character base line is row 7 (of 8)*/
/*Calculate actual bbox in Draw units*/
/*Return BBox for system font. */
bbox->x0 = hdrptr.textp->coord.x;
bbox->x1 = hdrptr.textp->coord.x +
hdrptr.textp->fsizex*strlen(hdrptr.textp->text);
......@@ -902,7 +948,7 @@ BOOL draw_obj_findTextBox(draw_objptr hdrptr, draw_bboxtyp *bbox)
/* Assume char base line is row 7 (of 8) */
bbox->y1 = hdrptr.textp->coord.y + (7*hdrptr.textp->fsizey)/8;
bbox->y0 = bbox->y1 - hdrptr.textp->fsizey;
return !err;
return ok;
}
static void bound_text(draw_objptr hdrptr)
......@@ -1101,11 +1147,10 @@ static BOOL find_trfmtext_bbox (draw_objptr hdrptr, draw_bboxtyp *bbox)
{ os_error *error;
font h;
char *text;
os_regset reg_set;
struct {struct {int x, y;} space_offset; struct {int x, y;} char_offset;
int split_char; draw_bboxtyp bbox;} block;
int i;
int options;
size_t i;
const char *text;
draw_bboxtyp bounds;
ftracef0 ("find_trfmtext_bbox\n");
text = &hdrptr.trfmtextp->text [0];
......@@ -1114,66 +1159,37 @@ static BOOL find_trfmtext_bbox (draw_objptr hdrptr, draw_bboxtyp *bbox)
return find_trfmtext_system_bbox (hdrptr, bbox);
else
{ /*Find the untransformed font.*/
if ((error = font_find
(draw_fontcat.name [hdrptr.trfmtextp->textstyle.fontref],
MAXZOOMFACTOR*hdrptr.trfmtextp->fsizex/40,
MAXZOOMFACTOR*hdrptr.trfmtextp->fsizey/40,
0, 0, &h)) != NULL)
return FALSE;
reg_set.r [0] = h;
reg_set.r [1] = (int) text;
reg_set.r [2] =
1 << 5 /*R5 -> coordinate block*/ |
1 << 6 /*R6 -> trfm*/ |
1 << 8 /*R0 = initial font handle*/ |
hdrptr.trfmtextp->flags.kerned << 9 |
hdrptr.trfmtextp->flags.direction << 10 |
1 << 18 /*return bbox*/;
reg_set.r [3] = INT_MAX;
reg_set.r [4] = INT_MAX;
reg_set.r [5] = (int) memset (&block, 0, sizeof block);
reg_set.r [6] = (int) &hdrptr.trfmtextp->trfm; /*no translation used*/
if ((error = os_swix (Font_ScanString, &reg_set)) != NULL)
error = font_find (draw_fontcat.name [hdrptr.trfmtextp->textstyle.fontref],
MAXZOOMFACTOR*hdrptr.trfmtextp->fsizex/40,
MAXZOOMFACTOR*hdrptr.trfmtextp->fsizey/40,
0, 0, &h);
if (error != NULL) return FALSE;
options = (hdrptr.trfmtextp->flags.kerned ? font_KERN : 0) |
(hdrptr.trfmtextp->flags.direction ? font_RTOL : 0);
error = font_scanstring (text, options, h, &hdrptr.trfmtextp->trfm, &bounds);
if (error != NULL)
{ /*On error, try again without the trfm matrix. We don't
actually have any right at all to assume that Font_ScanString goes
wrong in the same ways and for the same reasons as Font_Paint, but
we don't have much choice.*/
ftracef1 ("find_trfmtext_bbox: *ERROR* \"%s\"\n", error->errmess);
reg_set.r [0] = h;
reg_set.r [1] = (int) text;
/*Turn off bit 6*/
reg_set.r [2] =
1 << 5 /*R5 -> coordinate block*/ |
1 << 8 /*R0 = initial font handle*/ |
hdrptr.trfmtextp->flags.kerned << 9 |
hdrptr.trfmtextp->flags.direction << 10 |
1 << 18 /*return bbox*/;
reg_set.r [3] = INT_MAX;
reg_set.r [4] = INT_MAX;
reg_set.r [5] = (int) memset (&block, 0, sizeof block);
reg_set.r [6] = (int) &hdrptr.trfmtextp->trfm; /*no translation used*/
error = os_swix (Font_ScanString, &reg_set);
error = font_scanstring (text, options, h, NULL, &bounds);
}
font_lose (h);
if (error != NULL)
{ ftracef1 ("find_trfmtext_bbox: *ERROR* \"%s\"\n", error->errmess);
font_lose (h);
return FALSE;
}
ftracef4 ("find_trfmtext_bbox: font manager gives bbox of "
"(%d, %d, %d, %d)\n", block.bbox.x0, block.bbox.y0,
block.bbox.x1, block.bbox.y1);
font_lose (h);
"(%d, %d, %d, %d)\n", bounds.x0, bounds.y0,
bounds.x1, bounds.y1);
for (i = 0; i < 4; i++)
{ (&bbox->x0) [i] = ((&block.bbox.x0) [i] << 8)/(400*MAXZOOMFACTOR);
{ /*Convert from millipoints to transformed Draw units*/
(&bbox->x0) [i] = ((&bounds.x0) [i] << 8)/(400*MAXZOOMFACTOR);
(&bbox->x0) [i] +=
!(i & 1)? hdrptr.trfmtextp->coord.x: hdrptr.trfmtextp->coord.y;
}
......
......@@ -344,7 +344,7 @@ os_error *draw_print_to_file (diagrec *diag, int file, BOOL illustration)
draw_obj_bound_all (diag, &pictureBB);
if (pictureBB.x0 > pictureBB.x1 || pictureBB.y0 > pictureBB.y1)
{ error = (os_error *) msgs_lookup ("Print2");
{ error = draw_make_oserror ("Print2");
goto finish;
}
......@@ -483,7 +483,7 @@ os_error *draw_print_printall (diagrec *diag)
goto finish;
ftracef0 ("OS_Find returned successfully\n");
if (blk.r [0] == 0)
{ error = (os_error *) msgs_lookup ("Print3");
{ error = draw_make_oserror ("Print3");
goto finish;
}
ftracef0 ("OS_Find returned a valid handle\n");
......@@ -526,7 +526,7 @@ os_error *draw_print_queue (diagrec *diag, int copies)
/*Check that there is a printer.*/
if (draw_printer_name () == NULL)
return (os_error *) msgs_lookup ("Print1");
return draw_make_oserror ("Print1");
print_copies = copies;
......@@ -540,7 +540,7 @@ os_error *draw_print_queue (diagrec *diag, int copies)
diag->misc->solidlimit - diag->misc->solidstart,
&draw_file_file_saveall, &draw_file_ram_saveall, &draw_file_printall,
diag))
retmsg ("Print3");
return draw_make_oserror ("Print3");
return NULL;
}
......
......@@ -153,7 +153,7 @@ os_error *draw_select_checkspace (void)
/*array full, try to extend*/
if (FLEX_EXTEND ((flex_ptr) &draw_selection, newsize) == 0)
{ ftracef0 ("draw_select_checkspace: extending draw_selection FAILED\n");
retmsg ("DrawR3");
return draw_make_oserror ("DrawR3");
}
ftracef1 ("draw_select_checkspace: draw_selection 0x%X\n",
......@@ -2551,7 +2551,7 @@ static os_error *Convert_Text_Line_To_Paths (diagrec *diag,
if ((text_line_ptr.objhdrp->tag == draw_OBJTEXT?
text_line_ptr.textp->textstyle.fontref:
text_line_ptr.trfmtextp->textstyle.fontref) == NULL)
return (os_error *) msgs_lookup ("DrawT");
return draw_make_oserror ("DrawT");
ftracef0 ("turn off system font output\n"); /*JRC 1 Feb 1990*/
(void) bbc_vdu (bbc_DisableVDU);
......
......@@ -167,12 +167,6 @@ don't work at large zoom factors.*/
#define tbi_elli 7
#define tbi_select 8
/* N.B. prefix messages with #### to fake */
/* error number field */
#define makmsg(A) ((os_error *) (msgs_lookup (A)))
#define retmsg(A) {return makmsg (A);}
#define MAX(a, b) ((a) > (b)? (a): (b))
#define MIN(a, b) ((a) < (b)? (a): (b))
......@@ -1212,9 +1206,12 @@ extern void draw_make_clip(wimp_redrawstr *r, draw_objcoord *org, draw_bboxtyp *
/* Set printer limits from capture box */
extern void draw_set_paper_limits(diagrec *diag, captu_str box);
/* Restet VDU 5 character size after change */
/* Reset VDU 5 character size after change */
extern void draw_reset_gchar(void);
/* Conjure an OS error from a Draw message token */
extern os_error *draw_make_oserror(const char *token);
/*-----------------------------------------------------------------------*/
/* Some of the following functions are actually declared in c.drawAction */
......
......@@ -75,9 +75,6 @@ extern void draw_displ_showcaret (viewrec *vuue);
extern void draw_displ_showcaret_if_up (diagrec *diag);
extern os_error *draw_displ_font_stringpixbbox (font fonth, char *ptr,
draw_bboxtyp *boundp);
#ifndef USETAGBBOX
extern draw_bboxtyp *draw_displ_bbox (draw_objptr hdrptr);
#else
......