/*
* This procedure translates RD-GL (Roland DG Graphic Language) into the
* equivalent PostScript language.
*
* The RD-GL is a superset equivalent to HP-GL
*
* Don McCormick
*/
#include "defn.h"
/* The folowing defaults should be 0.5% and 1.0% for the respective character
* width and height, however this is too small when scaled to Postcript
* charcter sizes.
*/
float DEFWIDTH = 0.0075; /* 0.75 % of P2x - P1x for default char width */
float DEFHEIGHT = 0.015; /* 1.5 % of P2y - P1y for default char height */
hpglcom(op1)
char op1;
{
char op2;
int no_op; /* No operation value */
switch (op1)
{
case 'A':
case 'a':
op2 = getc(stream);
switch (op2)
{
case 'A': /* Arc Absolute (not HP-GL) */
case 'a':
break;
case 'P': /* Automatic Pen Lift (HP-GL only) */
case 'p':
while (((ch = getc(stream)) != EOF) && ch != ';');
break;
case 'R': /* Arc Relative (not HP-GL) */
case 'r':
break;
case 'C':
case 'c':
op2 = getc(stream);
switch (op2)
{
case 'A': /* Alternate Character Set (Not Used) */
case 'a':
while (((ch = getc(stream)) != EOF) && ch != ';');
fprintf(stderr, "Warning: Alt character set not implemented yet\n");
break;
case 'I': /* Circle */
case 'i':
circle(RDGLCIRCLE);
break;
case 'P': /* Character Plot */
case 'p':
{
float xspace, yspace;
case 'P': /* Input P1 and P2 (Not Used) */
case 'p':
while (((ch = getc(stream)) != EOF) && ch != ';');
fprintf(stderr,"Warning: IP command not implemented\n");
break;
case 'W': /* Input Window */
case 'w':
while (((ch = getc(stream)) != EOF) && ch != ';');
fprintf(stderr,"Warning: IW command not implemented\n");
break;
case 'P':
case 'p':
op2 = getc(stream);
switch (op2)
{
case 'A': /* Plot Absolute */
case 'a':
PLOTABS = 1;
if (SIGNED_NUMERIC)
if (SETDOT || SYMBOL)
plotdot(MOVE);
else if (PENDOWN)
plotps(DRAW);
else
plotps(MOVE);
break;
case 'D': /* Pen Down */
case 'd':
PENDOWN = 1;
if (SIGNED_NUMERIC)
if (SETDOT)
plotdot(MOVE);
else if (PLOTABS)
plotps(DRAW);
else
plotps(RDRAW);
break;
case 'R': /* Plot Relative */
case 'r':
PLOTABS = 0;
if (SIGNED_NUMERIC)
if (SETDOT || SYMBOL)
plotdot(RMOVE);
else if (PENDOWN)
plotps(RDRAW);
else
plotps(RMOVE);
break;
case 'T': /* Pen Thickness (Not HP-GL) */
case 't':
{
float linewidth;
linewidth = getval() * SCALE; /* In mm */
printf("%g mm setlinewidth\n", linewidth);
}
break;
case 'U': /* Pen Up */
case 'u':
PENDOWN = 0;
if (SIGNED_NUMERIC)
if (SETDOT)
plotdot(MOVE);
else if (PLOTABS)
plotps(MOVE);
else
plotps(RMOVE);
break;
case 'M': /* Symbol Mode */
case 'm':
if ((ch = getc(stream)) != EOF && ch != ';' && isgraph(ch) > 0)
{
symbol = ch;
SYMBOL = 1;
}
else
SYMBOL = 0;
break;
case 'P': /* Pen Select */
case 'p':
linesize();
break;
case 'R': /* Relative Character Size */
case 'r':
{
float pwidth, pheight;
case 'U':
case 'u':
op2 = getc(stream);
switch (op2)
{
case 'C': /* User Defined Character */
case 'c':
while (((ch = getc(stream)) != EOF) && ch != ';');
fprintf(stderr, "Warning: User defined character not implemented yet\n");
break;
case 'X':
case 'x':
op2 = getc(stream);
switch (op2)
{
case 'T': /* X Tick */
case 't':
while (((ch = getc(stream)) != EOF) && ch != ';');
fprintf(stderr, "Warning: X tick not implemented yet\n");
break;
case 'Y':
case 'y':
op2 = getc(stream);
switch (op2)
{
case 'T': /* Y Tick */
case 't':
while (((ch = getc(stream)) != EOF) && ch != ';');
fprintf(stderr, "Warning: Y tick not implemented yet\n");
break;