Skip to content

Commit

Permalink
Clean up text label generation. Introduce #define for ETX. Fix missin…
Browse files Browse the repository at this point in the history
…g semicolon that's been wrong swince the very beginning.
  • Loading branch information
anachrocomputer committed Aug 22, 2020
1 parent 7b4a486 commit 5ceb406
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions hpgllib.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <errno.h>
#include "hpgllib.h"

#define ETX (0x03)

enum InterfaceType {
PLOT_UNKNOWN, //!< Type of interface unknown
PLOT_FILE, //!< Writing to a file
Expand Down Expand Up @@ -306,9 +308,8 @@ int plotbegin(const int border)

/* Draw page title */
if (Title[0] != '\0') {
fprintf(Plt, "PU;PA%d,%d\n", (int)(Minx + (10.0 * 40.0)), (int)(Miny + (10.0 * 40.0)));
fprintf(Plt, "DR0,1;\n");
fprintf(Plt, "LB%s%c;PU;\n", Title, 3);
fprintf(Plt, "PU;PA%d,%d;", (int)(Minx + (10.0 * 40.0)), (int)(Miny + (10.0 * 40.0)));
fprintf(Plt, "DR0,1;LB%s%c;PU;\n", Title, ETX);
}

/* Plot border of drawing area */
Expand Down Expand Up @@ -887,7 +888,7 @@ void vlabel(const double x, const double y, const double siz, const char *const
else if (PenState == PEN_DOWN)
fprintf(Plt, "PU;");

fprintf(Plt, "PA%d,%d;SI%1.2f,%1.2f;DI0,1;LB%s%c;\n", ix, iy, siz/10.0, siz/10.0, str, 0x03);
fprintf(Plt, "PA%d,%d;SI%1.2f,%1.2f;DI0,1;LB%s%c;\n", ix, iy, siz/10.0, siz/10.0, str, ETX);
PenState = PEN_DOWN;
}

Expand All @@ -910,7 +911,7 @@ void hlabel(const double x, const double y, const double siz, const char *const
else if (PenState == PEN_DOWN)
fprintf(Plt, "PU;");

fprintf(Plt, "PA%d,%d;SI%1.2f,%1.2f;DI1,0;LB%s%c;\n", ix, iy, siz/10.0, siz/10.0, str, 0x03);
fprintf(Plt, "PA%d,%d;SI%1.2f,%1.2f;DI1,0;LB%s%c;\n", ix, iy, siz/10.0, siz/10.0, str, ETX);
PenState = PEN_DOWN;
}

Expand All @@ -930,7 +931,7 @@ int writedisplay(const char *const str)
{
switch (PlotterModel) {
case HP_7550A:
fprintf(Plt, "WD%s%c;", str, 0x03);
fprintf(Plt, "WD%s%c;", str, ETX);
break;
default:
return (-1);
Expand Down

0 comments on commit 5ceb406

Please sign in to comment.