home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / shareware / dev / ucb_logoppc / source / ztcterm.c.ztc < prev    next >
Encoding:
Text File  |  1997-03-07  |  15.1 KB  |  632 lines

  1. /*
  2.  *      ztcterm.c           IBM screen module             mak
  3.  *
  4.  *    Copyright (C) 1993 by the Regents of the University of California
  5.  *
  6.  *      This program is free software; you can redistribute it and/or modify
  7.  *      it under the terms of the GNU General Public License as published by
  8.  *      the Free Software Foundation; either version 2 of the License, or
  9.  *      (at your option) any later version.
  10.  *  
  11.  *      This program is distributed in the hope that it will be useful,
  12.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *      GNU General Public License for more details.
  15.  *  
  16.  *      You should have received a copy of the GNU General Public License
  17.  *      along with this program; if not, write to the Free Software
  18.  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  *
  20.  */
  21.  
  22. #include "logo.h"
  23. #include "globals.h"
  24. #include <math.h>
  25. #include <bios.h>
  26. #include <fg.h>
  27. #include <conio.h>
  28. #include <disp.h>
  29. #include <sound.h>
  30. #include <io.h>
  31. #include "ztcterm.h"
  32.  
  33. /************************************************************/
  34.  
  35. unsigned _stack = 8000; /* 5000 for debugging, 65000 for real */
  36.  
  37. BOOLEAN in_graphics_mode = FALSE, in_splitscreen = FALSE;
  38. BOOLEAN have_been_in_graphics_mode = FALSE, can_do_color = FALSE;
  39. BOOLEAN in_erase_mode = FALSE;
  40.  
  41. /* NOTE NOTE NOTE:  graphics.c really really believes that the top left
  42.  * corner of the screen has hardware coords (0,0).  Zortech has (0,0)
  43.  * in the BOTTOM left.  It's hopeless to fix graphics.c so instead we
  44.  * use the following kludge: go ahead and think the screen is upside down,
  45.  * and switch to Zortech coords only in draw_line! */
  46.  
  47. int ibm_screen_bottom;
  48. int current_write_mode = FG_MODE_SET;
  49. int current_vis = 0;
  50. fg_color_t turtle_color, bg_color;
  51. fg_color_t dull, bright;
  52. fg_coord_t texth;
  53. fg_coord_t MaxX, MaxY;
  54. int ztc_penwidth = 1, ztc_linepattern = -1;
  55. fg_box_t ztc_box, ztc_textbox, text_scroll_box, text_last_line_box, clear_box;
  56. void rgb_init(void);
  57. int scrunching = FALSE;
  58.  
  59. fg_line_t the_line;
  60. fg_coord_t ztc_x, ztc_y;
  61. fg_color_t ztc_textcolor;
  62. fg_coord_t ztc_graph_textx, ztc_graph_texty;
  63. FIXNUM pen_color = 0, back_ground = 7;
  64.  
  65. void moveto(int x, int y) {
  66.     ztc_x = (fg_coord_t)x;
  67.     ztc_y = (fg_coord_t)y;
  68. }
  69.  
  70. void lineto(int x, int y) {
  71.     fg_make_line(the_line, ztc_x, MaxY-ztc_y,
  72.              (fg_coord_t)x, MaxY-(fg_coord_t)y);
  73.     fg_drawthickline((in_erase_mode ? bg_color : turtle_color),
  74.            current_write_mode, ~0, FG_LINE_SOLID, the_line, ztc_box,
  75.            ztc_penwidth);
  76.     moveto(x, y);
  77. }
  78.  
  79. void outtext(char *s) {
  80.     fg_puts((in_erase_mode ? bg_color : turtle_color),
  81.             current_write_mode, ~0, FG_ROT0, ztc_x, MaxY-ztc_y,
  82.             s, fg.displaybox);
  83. }
  84.  
  85. void gr_mode(void) {
  86.     int errorcode;
  87.  
  88.     if (!in_graphics_mode) {
  89.     x_coord = x_margin;
  90.     y_coord = y_margin;
  91.     errorcode = fg_init();
  92.     if (have_been_in_graphics_mode) {
  93.         in_graphics_mode = TRUE;
  94.         if (turtle_shown && !refresh_p) draw_turtle();
  95.         redraw_graphics();
  96.     }
  97.     else {
  98.         if (errorcode == 0)
  99.         err_logo(BAD_GRAPH_INIT, NIL);
  100.         else {
  101.         in_graphics_mode = have_been_in_graphics_mode = TRUE;
  102.         if (can_do_color = (fg.nsimulcolor > 16 /* != fg.ncolormap */ )) {
  103.             rgb_init();
  104.             dull = fg.nsimulcolor-1;
  105.             bright = 7;
  106.         } else {
  107.             turtle_color = FG_HIGHLIGHT;
  108.             dull = FG_WHITE;
  109.             bright = FG_HIGHLIGHT;
  110.         }
  111.         bg_color = FG_BLACK;
  112.         ztc_set_penc(7);
  113.         ztc_textcolor = dull;
  114.         back_ground = 0;
  115.         ztc_box[FG_X1] = ztc_textbox[FG_X1]
  116.                    = text_scroll_box[FG_X1]
  117.                    = text_last_line_box[FG_X1]
  118.                    = clear_box[FG_X1]
  119.                    = fg.displaybox[FG_X1];
  120.         ztc_textbox[FG_Y1] = fg.displaybox[FG_Y1];
  121.         ztc_box[FG_X2] = ztc_textbox[FG_X2]
  122.                    = text_scroll_box[FG_X2]
  123.                    = text_last_line_box[FG_X2]
  124.                    = clear_box[FG_X2]
  125.                    = MaxX = fg.displaybox[FG_X2];
  126.         ztc_box[FG_Y2] = MaxY
  127.                    = clear_box[FG_Y2]
  128.                    = fg.displaybox[FG_Y2];
  129.         y_scale = (double)fg.pixelx/(double)fg.pixely;
  130.         {
  131.             FILE *fp = fopen("scrunch.dat","r");
  132.             if (fp != NULL) {
  133.                 scrunching = TRUE;
  134.             if (filelength(fileno(fp)) > 0) {
  135.                 fread(&x_scale, sizeof(FLONUM), 1, fp);
  136.                 fread(&y_scale, sizeof(FLONUM), 1, fp);
  137.             }
  138.             fclose(fp);
  139.             }
  140.         }
  141.         if (MaxY == 479)
  142.             texth = 16;
  143.         else
  144.             texth = (MaxY+1)/25;
  145.         ztc_box[FG_Y1] = 4*texth+1;
  146.         clear_box[FG_Y1] = 4*texth;
  147.         ibm_screen_bottom = MaxY - (ztc_box[FG_Y1]);
  148.         ztc_textbox[FG_Y2] = 4*texth-1;
  149.         text_scroll_box[FG_Y2] = 3*texth-1;
  150.         text_scroll_box[FG_Y1] = 0;
  151.         text_last_line_box[FG_Y2] = texth-1;
  152.         lclearscreen(NIL);
  153.         lcleartext(NIL);
  154.         in_splitscreen = TRUE;
  155.        }
  156.     }
  157.     }
  158. }
  159.  
  160. void nop() {
  161. }
  162.  
  163. void init_ibm_memory(void) {
  164. }
  165.  
  166. volatile int ctrl_c_count = 0;
  167.  
  168. BOOLEAN check_ibm_stop(void) {
  169.     int key;
  170.     int __ss *p;
  171.  
  172. /*    if (kbhit())
  173.     getch(); */   /* allow DOS to test for control-C */
  174.  
  175.     p = &key;
  176.     if ((int)p < 500) {
  177.     err_logo(STACK_OVERFLOW, NIL);
  178.     return(1);
  179.     }
  180.  
  181.     if (((key = bioskey(1)) == (4113)) || ctrl_c_count > 0) { /* control-q */
  182.     if (ctrl_c_count == 0) getch();
  183.     ctrl_c_count = 0;
  184.     err_logo(STOP_ERROR,NIL);
  185.     return(1);
  186.     }
  187.     if (key == (4375)) { /* control-w */
  188.     getch();
  189.     to_pending = 0;
  190.     lpause(NIL);
  191.     }
  192.     return (0);
  193. }
  194.  
  195. void term_init_ibm(void) {
  196.     disp_open();
  197.     ztc_textcolor = FG_WHITE;
  198.     tty_charmode = 0;
  199.     x_max = 80;
  200.     y_max = 25;
  201.     x_coord = y_coord = 0;
  202.     so_arr[0] = '\1'; so_arr[1] = '\0';
  203.     se_arr[0] = '\2'; se_arr[1] = '\0';
  204. }
  205.  
  206. void ibm_gotoxy(int x, int y) {
  207.     if (in_graphics_mode) {
  208.     if (!in_splitscreen)
  209.         lsplitscreen(NIL);
  210.     if (y >= 4) y = 3;
  211.     ztc_graph_texty = texth*(3-y);
  212.     fg_adjustxy(FG_ROT0, x, &ztc_graph_textx,
  213.             &ztc_graph_texty, fg.charbox);
  214.     } else {
  215.         disp_move(y, x);
  216.         disp_flush();
  217.     }
  218. }
  219.  
  220. void ibm_clear_text(void) {
  221.     if (in_graphics_mode) {
  222.     if (in_splitscreen)
  223.         erase_graphics_top();
  224.     } else {
  225.     disp_move(0,0);
  226.     disp_eeop();
  227.     disp_flush();
  228.     }
  229. }
  230.  
  231. void ibm_clear_screen(void)
  232. {
  233.     fg_fillbox(bg_color, FG_MODE_SET, ~0, clear_box);
  234. }
  235.  
  236. void ibm_plain_mode(void) {
  237.     if (in_graphics_mode)
  238.     ztc_textcolor = dull;
  239.     else
  240.     disp_endstand();
  241. }
  242.  
  243. void ibm_bold_mode(void) {
  244.     if (in_graphics_mode)
  245.     ztc_textcolor = bright;
  246.     else
  247.     disp_startstand();
  248. }
  249.  
  250. void erase_graphics_top(void) {
  251.     fg_fillbox(FG_BLACK, FG_MODE_SET, ~0, ztc_textbox);
  252.     ztc_graph_textx = 0;
  253.     ztc_graph_texty = 3*texth;
  254. }
  255.  
  256. /************************************************************/
  257. /* These are the machine-specific graphics definitions.  All versions must
  258.    provide a set of functions analogous to these. */
  259.  
  260. void save_pen(pen_info *p) {
  261.     p->h = ztc_x;
  262.     p->v = ztc_y;
  263.     p->vis = current_vis;
  264.     p->width = ztc_penwidth;
  265.     p->color = turtle_color;
  266.     get_pen_pattern(p->pattern);
  267.     p->mode = get_ibm_pen_mode();
  268. }
  269.  
  270. void restore_pen(pen_info *p) {
  271.     moveto(p->h, p->v);
  272.     current_vis = p->vis;
  273.     ztc_penwidth = p->width;
  274.     set_ibm_pen_mode(p->mode);  /* must restore mode before color */
  275.     turtle_color = p->color;
  276.     set_pen_pattern(p->pattern);
  277. }
  278.  
  279. fg_color_t color_table[8] = {0, 9, 10, 11, 12, 13, 14, 15};
  280.  
  281. FIXNUM hw_color(FIXNUM c) {
  282.     if (can_do_color) return c;
  283.     if (c >= 0 && c < 8) return color_table[c];
  284.     if (c < 0) return c;
  285.     return c-8;
  286. }
  287.  
  288. struct rgbcolor { int red, green, blue; } the_palette[256] = {
  289.     {0, 0, 0}, {0, 0, 255}, {0, 255, 0}, {0, 255, 255},
  290.     {255, 0, 0}, {255, 0, 255}, {255, 255, 0}, {255, 255, 255},
  291.     {155, 96, 59}, {197, 136, 18}, {100, 162, 64}, {120, 187, 187},
  292.     {255, 149, 119}, {144, 113, 208}, {255, 163, 0}, {183, 183, 183}};
  293.  
  294. void rgb_init(void) {
  295.     int i,j;
  296.  
  297.     for (i=0; i<16; i++) {
  298.         fg_setpalette(i, the_palette[i].red, the_palette[i].green,
  299.                     the_palette[i].blue);
  300.         for (j=i+16; j<fg.nsimulcolor; j += 16) {
  301.             the_palette[j] = the_palette[i];
  302.             fg_setpalette(j, the_palette[i].red,
  303.                     the_palette[i].green,
  304.                     the_palette[i].blue);
  305.         }
  306.     }
  307. }
  308.  
  309. void plain_xor_pen(void) {
  310.     ztc_penwidth = 1;
  311.     turtle_color = hw_color(pen_color)^bg_color;
  312.     current_write_mode = FG_MODE_XOR;
  313.     in_erase_mode = FALSE;
  314. }
  315.  
  316. void ztc_set_penc(FIXNUM c) {
  317.     draw_turtle();
  318.     pen_color = c;
  319.     turtle_color = hw_color(c) % fg.nsimulcolor;
  320.     if (current_write_mode == FG_MODE_XOR)
  321.     turtle_color = hw_color(pen_color)^bg_color;
  322.     draw_turtle();
  323. }
  324.  
  325. void ztc_set_bg(FIXNUM c) {
  326.     back_ground = c;
  327.     bg_color = hw_color(c);
  328.     if (!refresh_p) ibm_clear_screen();
  329.     if (turtle_shown && !refresh_p) draw_turtle();
  330.     redraw_graphics();
  331. }
  332.  
  333. void set_palette(int slot, unsigned int r, unsigned int g, unsigned int b) {
  334.     if (slot >= 255) return;
  335.     the_palette[slot].red = (r+128)/256;
  336.     the_palette[slot].green = (g+128)/256;
  337.     the_palette[slot].blue = (b+128)/256;
  338.     fg_setpalette(slot, the_palette[slot].red, the_palette[slot].green,
  339.                     the_palette[slot].blue);
  340. }
  341.  
  342. void get_palette(int slot, unsigned int *r, unsigned int *g, unsigned int *b) {
  343.     *r = the_palette[slot % 256].red * 256;
  344.     *g = the_palette[slot % 256].green * 256;
  345.     *b = the_palette[slot % 256].blue * 256;
  346. }
  347.  
  348. void ibm_pen_down(void) {
  349.     current_write_mode = FG_MODE_SET;
  350.     turtle_color = hw_color(pen_color);
  351.     in_erase_mode = FALSE;
  352. }
  353.  
  354. void ibm_pen_xor(void) {
  355.     current_write_mode = FG_MODE_XOR;
  356.     turtle_color = hw_color(pen_color)^bg_color;
  357.     in_erase_mode = FALSE;
  358. }
  359.  
  360. void ibm_pen_erase(void) {
  361.     if (!in_erase_mode) {
  362.     current_write_mode = FG_MODE_SET;
  363.     turtle_color = hw_color(pen_color);
  364.     in_erase_mode = TRUE;
  365.     }
  366. }
  367.  
  368. int get_ibm_pen_mode(void) {
  369.     if (in_erase_mode)
  370.     return 2;
  371.     else
  372.     return current_write_mode;
  373. }
  374.  
  375. void set_ibm_pen_mode(int m) {
  376.     switch (m) {
  377.     case 2: ibm_pen_erase(); break;
  378.     case FG_MODE_SET: ibm_pen_down(); break;
  379.     case FG_MODE_XOR: ibm_pen_xor(); break;
  380.     }
  381. }
  382.  
  383. int get_ibm_pen_width(void) {
  384.     return ztc_penwidth;
  385. }
  386.  
  387. void set_pen_pattern(char *pat) {
  388.     ztc_linepattern = *(int *)pat;
  389. }
  390.  
  391. void set_list_pen_pattern(NODE *arg) {
  392.     NODE *temp;
  393.  
  394.     temp = cnv_node_to_numnode(car(arg));
  395.     ztc_linepattern = getint(temp);
  396. }
  397.  
  398. void get_pen_pattern(char *pat) {
  399.     *(int *)pat = ztc_linepattern;
  400. }
  401.  
  402. NODE *Get_node_pen_pattern(void) {
  403.     return(cons(make_intnode(0-1L), NIL));
  404. }
  405.  
  406. NODE *Get_node_pen_mode(void) {
  407.     if (in_erase_mode)
  408.     return(make_static_strnode("erase"));
  409.     if (current_write_mode == FG_MODE_XOR)
  410.     return(make_static_strnode("reverse"));
  411.     return(make_static_strnode("paint"));
  412. }
  413.  
  414. void label(char *s) {
  415.     gr_mode();
  416.     moveto(g_round(screen_x_coord), g_round(screen_y_coord));
  417.     outtext(s);
  418. }
  419.  
  420. void logofill(void) {
  421.     fg_fill(ztc_x, MaxY-ztc_y, turtle_color, turtle_color);
  422. }
  423.  
  424. void erase_screen(void) {
  425.     ibm_clear_screen();
  426. }
  427.  
  428. void t_screen(void) {
  429.     if (in_graphics_mode) {
  430.     fg_term();
  431.     in_graphics_mode = FALSE;
  432.     in_splitscreen = FALSE;
  433.     y_max = 25;
  434.     }
  435. }
  436.  
  437. void s_screen(void) {
  438.     int save_vis;
  439.  
  440.     if (in_graphics_mode && !in_splitscreen) {
  441.     if (turtle_shown && (screen_y_coord > (MaxY - (4*texth+1)))) {
  442.         save_vis = current_vis;
  443.         current_vis = -1;
  444.         lhome(NIL);
  445.         current_vis = save_vis;
  446.     }
  447.     erase_graphics_top();
  448.     }
  449.     if (!have_been_in_graphics_mode) gr_mode();
  450.     in_splitscreen = TRUE;
  451.     ztc_box[FG_Y1] = 4*texth+1;
  452.     clear_box[FG_Y1] = 4*texth;
  453.     ibm_screen_bottom = MaxY - (ztc_box[FG_Y1]);
  454.     y_max = 4;
  455.     gr_mode();
  456. }
  457.  
  458. void f_screen(void) {
  459.     if (in_graphics_mode && in_splitscreen)
  460.     erase_graphics_top();
  461.     in_splitscreen = FALSE;
  462.     ztc_box[FG_Y1] = clear_box[FG_Y1] = 0;
  463.     ibm_screen_bottom = MaxY;
  464.     gr_mode();
  465. }
  466.  
  467. FIXNUM mickey_x(void) {
  468.     return 0;
  469. }
  470.  
  471. FIXNUM mickey_y(void) {
  472.     return 0;
  473. }
  474.  
  475. BOOLEAN Button(void) {
  476.     return FALSE;
  477. }
  478.  
  479. void tone(FIXNUM pitch, FIXNUM duration) {
  480.     FIXNUM period = 2400000L/pitch;        /* 200000 */
  481.     FIXNUM cycles = duration * pitch/60;
  482.     if (cycles > 0)
  483.         sound_tone((int)cycles, (int)period, (int)period);
  484. }
  485.  
  486. FIXNUM t_height(void) {
  487.     return 18;
  488. }
  489.  
  490. FLONUM t_half_bottom(void) {
  491.     return 6.0;
  492. }
  493.  
  494. FLONUM t_side(void) {
  495.     return 19.0;
  496. }
  497.  
  498. void check_scroll(void) {
  499.     fg_blit(text_scroll_box, 0, texth, fg.activepage, fg.activepage);
  500.     fg_fillbox(FG_BLACK, FG_MODE_SET, ~0, text_last_line_box);
  501. }
  502.  
  503. void ztc_put_char(int ch) {
  504.     if (in_graphics_mode && !in_splitscreen)
  505.     lsplitscreen(NIL);
  506.     if (ch != '\1' && ch != '\2') {
  507.     if (in_graphics_mode) {
  508.         if (ch == '\n') {
  509.         ztc_graph_textx = 0;
  510.         if (ztc_graph_texty - texth >= 0)
  511.             ztc_graph_texty -= texth;
  512.         else check_scroll();
  513.         } else if (ch == '\b') {
  514.         if (ztc_graph_textx > 0)
  515.             fg_adjustxy(FG_ROT180, 1, &ztc_graph_textx,
  516.                 &ztc_graph_texty, fg.charbox);
  517.         } else if (ch == '\t') {
  518.         fg_adjustxy(FG_ROT0, 8 - (x_coord&07),
  519.                 &ztc_graph_textx,
  520.                 &ztc_graph_texty, fg.charbox);
  521.         if (ztc_graph_textx >= MaxX) print_char(stdout,'\n');
  522.         } else {
  523.         fg_putc(ztc_textcolor, FG_MODE_SET, ~0, FG_ROT0,
  524.             ztc_graph_textx, ztc_graph_texty,
  525.             ch, fg.displaybox);
  526.         fg_adjustxy(FG_ROT0, 1, &ztc_graph_textx,
  527.                 &ztc_graph_texty, fg.charbox);
  528.         if (ztc_graph_textx >= MaxX) print_char(stdout,'\n');
  529.         }
  530.     } else
  531.             disp_putc(ch);
  532.     }
  533. }
  534.  
  535. BOOLEAN cursor_off = 0;
  536.  
  537. void fix_cursor(void) {
  538.     if (!cursor_off && !in_graphics_mode) {
  539.         disp_hidecursor();
  540.     cursor_off++;
  541.     }
  542. }
  543.  
  544. void zflush(void) {
  545.     if (in_graphics_mode)
  546.     fg_flush();
  547.     else {
  548.     disp_flush();
  549.     if (cursor_off) disp_showcursor();
  550.     cursor_off = 0;
  551.     }
  552. }
  553.  
  554. void newline_bugfix(void) {
  555.     if (!in_graphics_mode) {
  556.     if (disp_cursorrow+1 < disp_numrows)
  557.             new_line(stdout);
  558.     else
  559.         disp_move(disp_numrows-1,0);
  560.     disp_flush();
  561.     }
  562.     y_coord--;
  563. }
  564.  
  565. char graph_line_buffer[200];
  566. char *graph_line_pointer = NULL;
  567.  
  568. int ztc_getc(FILE *strm) {
  569.     int ch;
  570.  
  571.     if (strm != stdin || !interactive || !in_graphics_mode)
  572.     return getc(strm);
  573.     if (graph_line_pointer != NULL) {
  574.     ch = *graph_line_pointer++;
  575.     if (ch == '\t') graph_line_pointer += 2;
  576.     if (ch != '\0') return ch;
  577.     }
  578.     graph_line_pointer = graph_line_buffer;
  579.     do {
  580.     fg_putc(dull, FG_MODE_XOR, ~0, FG_ROT0,
  581.         ztc_graph_textx, ztc_graph_texty,
  582.         '_', fg.displaybox);
  583.     ch = getch();
  584.     fg_putc(dull, FG_MODE_XOR, ~0, FG_ROT0,
  585.         ztc_graph_textx, ztc_graph_texty,
  586.         '_', fg.displaybox);
  587.     if (ch == '\r' || ch == '\n') {
  588.         ch = '\n';
  589.         *graph_line_pointer++ = ch;
  590.         print_char(stdout,'\n');
  591.         *graph_line_pointer = '\0';
  592.         graph_line_pointer = graph_line_buffer;
  593.         return *graph_line_pointer++;
  594.     } else if (ch == '\t') {
  595.         int i = 8 - (x_coord & 07);
  596.         *graph_line_pointer++ = '\t';
  597.         *graph_line_pointer++ = (char)i;
  598.         *graph_line_pointer++ = '\t';
  599.         print_char(stdout, '\t');
  600.     } else if (ch == 0177 || ch == '\b') {
  601.         if (graph_line_pointer != graph_line_buffer) {
  602.         graph_line_pointer--;
  603.         if (*graph_line_pointer == '\t') {
  604.             int i = (int)*--graph_line_pointer;
  605.             --graph_line_pointer;
  606.             while (i-- > 0) print_char(stdout, '\b');
  607.         } else {
  608.             print_char(stdout, '\b');
  609.             ztc_textcolor = FG_BLACK;
  610.             print_char(stdout, *graph_line_pointer);
  611.             ztc_textcolor = dull;
  612.             print_char(stdout, '\b');
  613.         }
  614.         }
  615.     } else if (ch == 17 || ch == 23) {
  616.         print_char(stdout,'\n');
  617.         graph_line_pointer = NULL;
  618.         return ch;
  619.     } else {
  620.         *graph_line_pointer++ = ch;
  621.         print_char(stdout, ch);
  622.     }
  623.     } while (ch != '\n');
  624.     graph_line_pointer = graph_line_buffer;
  625.     return *graph_line_pointer++;
  626. }
  627.  
  628. void ztc_getcr(void) {
  629.     (void) ztc_getc(stdin);
  630.     graph_line_pointer = NULL;
  631. }
  632.