static char sccsid
[] = "@(#)fed.c 4.2 (Berkeley) %G%";
* Font editor for the HP 2648.
while (argc
> 1 && argv
[1][0] == '-') {
trace
= fopen("trace", "w");
printf("Bad flag: %s\n", argv
[1]);
fprintf(stderr
,"Usage: %s filename\n", argv
[0]);
/* ^L: redraw munged up screen */
/* b: move cursor to base point of window */
curs_r
= cht
[curchar
].rcent
;
curs_c
= cht
[curchar
].ccent
;
/* c: toggle whether cursor is on */
/* d: draw line of current flavor from pen to cursor */
drawline(pen_r
, pen_c
, curs_r
, curs_c
);
pen_r
= curs_r
; pen_c
= curs_c
;
/* f: fill in the current hole around the cursor */
fprintf(trace
, "fillin(%d, %d)\n", curs_r
, curs_c
);
if (mat(wind
[curwind
].val
, GLROW
, GLCOL
, curs_r
, curs_c
))
/* g <x>: get glyph "x" as current. */
error("No current font file");
message("get glyph <char>");
sprintf(msgbuf
, "get glyph %s", rdchar(curchar
));
/* h, left arrow: move cursor left */
/* j, down arrow: move cursor down */
/* k, up arrow: move cursor up */
/* l, right arrow: move cursor down */
/* m: move the pen to where the cursor is */
pen_r
= curs_r
; pen_c
= curs_c
;
move(base
[curwind
].c
+curs_c
, base
[curwind
].r
+GLROW
-1-curs_r
);
/* n <x>: make a new glyph with char x */
/* p: print a hard copy on the printer of the screen */
/* r: toggle rubber band line */
/* s <what> <where>: set <what> to <where> */
/* u: undo previous buffer modifying command */
/* z <n>: set zoom to n. */
message("zoom to <level>");
if (curzoom
== '\r' || curzoom
== '\n')
/* space: reset zoom to last thing user asked for */
zoomn(curzoom
= oldzoom
);
/* A: artificially embolden/italicize <range> by heavy pen size */
/* B: move base point of window to cursor */
cht
[curchar
].rcent
= curs_r
;
cht
[curchar
].ccent
= curs_c
;
* C <from> <to>: copy glyph <from> to <to>.
* M <from> <to>: move glyph <from> to <to>.
/* D <char1> <char2>: delete range from font */
/* F: display the entire font on the screen. */
/* I: invert the current glyph */
/* K: kill (wipe clean) current glyph. */
zermat(wind
[curwind
].val
, GLROW
, GLCOL
);
fprintf(trace
, "kill: curs_r = %d, curs_c = %d\n", curs_r
, curs_c
);
/* P <first> <last> <file>: read partial font */
/* Q: quit the editor, not saving work. */
/* T: typeset a line of input text */
/* V: toggle video between inverse and normal */
* E <file>: edit new font file <file>.
* N <file>: write, then edit <file>
* R <file>: read <file> on top of buffer.
* W <file>: write out on <file> without quitting
/* Z: exit, writing out work */
* ".", ">". Set and clear the bit under the cursor.
setmat(wind
[curwind
].val
, GLROW
, GLCOL
, curs_r
, curs_c
, cmd
=='.' ? 1 : 0);
* "#": edit the numerical parameters
sprintf(msgbuf
, "No such command as %s", rdchar(cmd
));
* esccmd: a command beginning with an escape.
* Map it into the corresponding regular command.
case 'A': return ('k'); /* up arrow */
case 'B': return ('j'); /* down arrow */
case 'C': return ('l'); /* right arrow */
case 'D': return ('h'); /* left arrow */
case 'h': return ('b'); /* home */
case '2': return ('u'); /* clear tab = undo */
case '1': return (' '); /* set tab = rezoom */
case 'J': return ('f'); /* clear display = fill area */
case 'S': return ('m'); /* roll up = move */
case 'U': return ('d'); /* next page = draw */
case 'T': return ('.'); /* roll down = set bit */
case 'V': return ('>'); /* prev page = clear bit */
* Eat up rest of (possibly long) escape sequence.
* They all end in an upper case letter, with
while (!isupper(cmd
) && cmd
!= 'h' && cmd
!= '\n')
sprintf(msgbuf
, "Bad escape sequence: %s\n", escseqbuf
);
case SIGQUIT
: mes
= "quit"; break;
case SIGILL
: mes
= "illegal instruction"; break;
case SIGBUS
: mes
= "bus error"; break;
case SIGSEGV
: mes
= "segmentation violation"; break;
case SIGSYS
: mes
= "bad system call"; break;
default: mes
= "random signal"; break;
fprintf(trace
, "%s: core dumped\n", mes
);
printf("fed: %s: core dumped\n", mes
);