예제 #1
0
파일: vt100.c 프로젝트: sigflup/vt100
void init_term(struct term_t *win, void (*char_out)(char c, struct term_t *win),int  w, int h) {
 term_t *pwin = (term_t *)win;
 pwin->ws_conf.ws_col = w;
 pwin->ws_conf.ws_row = h;
 pwin->chars = (char_t *)malloc(w*h*sizeof(char_t));
 bzero(pwin->chars, w*h*sizeof(char_t));
 pwin->char_out = char_out;
 pwin->cursor_x = 0;
 pwin->cursor_y = 0;
 pwin->dirty = 1;
 pwin->sy1 = 0;
 pwin->sy2 = h-1;

 pwin->color = 0;
 pwin->attr = 0;

 vt_init(win, ANSI, 0,0,1,0);
 vt_install(keycodes_out, win);
}
예제 #2
0
파일: main.c 프로젝트: feir777/minicom
/*
 * Initialize screen and status line.
 */
void init_emul(int type, int do_init)
{
  int x = -1, y = -1;
  char attr = 0;
  int maxy;
  int ypos;

  if (st) {
    mc_wclose(st, 1);
    tempst = 0;
    st = NULL;
  }

  if (us) {
    x = us->curx;
    y = us->cury;
    attr = us->attr;
    mc_wclose(us, 0);
  }

  /* See if we have space for a fixed status line */
  maxy = LINES - 1;
  if ((use_status || LINES > 24) &&
      P_STATLINE[0] == 'e') {
    if (use_status) {
      ypos = LINES;
      maxy = LINES - 1;
    } else {
      ypos = LINES - 1;
      maxy = LINES - 2;
    }
    st = mc_wopen(0, ypos, COLS - 1, ypos, BNONE,
               st_attr, sfcolor, sbcolor, 1, 0, 1);
    mc_wredraw(st, 1);
  }

  /* MARK updated 02/17/95 - Customizable size for history buffer */
  num_hist_lines = atoi(P_HISTSIZE);
  if (num_hist_lines < 0)
    num_hist_lines = 0;
  if (num_hist_lines > 5000)
    num_hist_lines = 5000;

  /* Open a new main window, and define the configured history buffer size. */
  us = mc_wopen(0, 0, COLS - 1, maxy,
              BNONE, XA_NORMAL, tfcolor, tbcolor, 1, num_hist_lines, 0);

  if (x >= 0) {
    mc_wlocate(us, x, y);
    mc_wsetattr(us, attr);
  }

  us->autocr = 0;
  us->wrap = wrapln;

  terminal = type;
  lines = LINES - (st != NULL);
  cols = COLS;

  /* Install and reset the terminal emulator. */
  if (do_init) {
    vt_install(do_output, kb_handler, us);
    vt_init(type, tfcolor, tbcolor, us->wrap, addlf, addcr);
  } else
    vt_pinit(us, -1, -1);

  show_status();
}