コード例 #1
0
ファイル: gppconio.c プロジェクト: OS2World/APP-EDITOR-Vile
int putch(int c)
{
  int     row, col;

  ScreenGetCursor(&row, &col);

  /*  first, handle the character */
  if (c == '\n')
    {
      row++;
    }
  else if (c == '\r')
    {
      col = txinfo.winleft - 1;
    }
  else if (c == '\b')
  {
      if (col > txinfo.winleft - 1)
          col--;
      else if (row > txinfo.wintop -1)
      {
          /*
           * Turbo-C ignores this case; we are smarter.
           */
          row--;
          col = txinfo.winright-1;
      }
  }
  else if (c == 0x07)
    bell();
  else {
    /* short   val = c | (ScreenAttrib << 8); */
    /* puttext(col + 1, row + 1, col + 1, row + 1, &val); */
    ScreenPutChar(c, ScreenAttrib, col, row);
    col++;
  }

  /* now, readjust the window     */

  if (col >= txinfo.winright) {
    col = txinfo.winleft - 1;
    row++;
  }

  if (row >= txinfo.winbottom) {
    /* scrollwin(0, txinfo.winbottom - txinfo.wintop, 1); */
    if (_wscroll)
    {
      ScreenSetCursor(txinfo.wintop-1,0);
      delline();
    }
    row--;
  }

  ScreenSetCursor(row, col);
  txinfo.cury = row - txinfo.wintop + 2;
  txinfo.curx = col - txinfo.winleft + 2;
  return c;
}
コード例 #2
0
ファイル: gppconio.c プロジェクト: OS2World/APP-EDITOR-Vile
int wherey(void)
{
  int row, col;

  ScreenGetCursor(&row, &col);

  return row - txinfo.wintop + 2;
}
コード例 #3
0
ファイル: gppconio.c プロジェクト: OS2World/APP-EDITOR-Vile
int wherex(void)
{
  int row, col;

  ScreenGetCursor(&row, &col);

  return col - txinfo.winleft + 2;
}
コード例 #4
0
ファイル: screen.c プロジェクト: Feechka/UOBP
static void
describe_PcBiosScreen (ScreenDescription *description) {
  int row, column;
  description->rows = ScreenRows();
  description->cols = ScreenCols();
  ScreenGetCursor(&row, &column);
  description->posx = column;
  description->posy = row;
  description->number = 1;
}
コード例 #5
0
ファイル: gppconio.c プロジェクト: OS2World/APP-EDITOR-Vile
void delline(void)
{
  int row, col, left, right, nbytes, bot, fill;
  ScreenGetCursor(&row, &col);
  left = txinfo.winleft - 1;
  right = txinfo.winright - 1;
  nbytes = (right-left+1)*2;
  bot = txinfo.winbottom-1;
  fill = ' ' | (ScreenAttrib << 8);
  while(row < bot)
    {
      movedata(_go32_conventional_mem_selector(), VIDADDR(row+1, left),
               _go32_conventional_mem_selector(), VIDADDR(row, left),
               nbytes);
      row++;
    }
  fillrow(bot,left,right,fill);
}
コード例 #6
0
ファイル: gppconio.c プロジェクト: OS2World/APP-EDITOR-Vile
static void _gettextinfo(struct text_info *t)
{
  int row, col;

  t->winleft = t->wintop = 1;
  t->winright = t->screenwidth = ScreenCols();
  t->winbottom = t->screenheight = ScreenRows();
  ScreenAttrib = t->attribute = t->normattr = get_screenattrib();
  t->currmode = getvideomode();
  ScreenGetCursor(&row, &col);
  t->curx = col+1;
  t->cury = row+1;
#if DBGGTINFO
  printf("left=%2d,right=%2d,top=%2d,bottom=%2d\n",t->winleft,
	 t->winright,t->wintop,t->winbottom);
  printf("scrht=%2d,scrwid=%2d,norm=%2x,mode=%2d,x=%2d,y=%2d\n",
	 t->screenheight, t->screenwidth, t->normattr, t->currmode,
	 t->curx, t->cury);
#endif
}
コード例 #7
0
ファイル: gppconio.c プロジェクト: OS2World/APP-EDITOR-Vile
int cputs(const char *s)
{
  int     row, col,c;
  const unsigned char *ss = (const unsigned char *)s;
  short *viaddr;
  short sa = ScreenAttrib << 8;
  ScreenGetCursor(&row, &col);
  viaddr = (short *)VIDADDR(row,col);
  /*
   * Instead of just calling putch; we do everything by hand here,
   * This is much faster. We don't move the cursor after each character,
   * only after the whole string is written, because ScreenSetCursor
   * needs to long because of switching to real mode needed with djgpp.
   * You won't recognize the difference.
   */
  while ((c = *ss++))
    {
      /*  first, handle the character */
      if (c == '\n')
	{
	  row++;
	  viaddr += txinfo.screenwidth;
	}
      else if (c == '\r')
	{
	  col = txinfo.winleft - 1;
	  viaddr = (short *)VIDADDR(row,col);
	}
      else if (c == '\b')
        {
          if (col > txinfo.winleft-1)
          {
              col--;
              viaddr--;
          }
          else if (row > txinfo.wintop -1)
          {
              /*
               * Turbo-C ignores this case. We want to be able to
               * edit strings with backspace in gets after
               * a linefeed, so we are smarter
               */
              row--;
              col = txinfo.winright-1;
              viaddr = (short *)VIDADDR(row,col);
          }
        }
      else if (c == 0x07)
          bell();
      else {
        short q = c | sa;
        dosmemput(&q, 2, (int)viaddr);
	viaddr++;
	col++;
      }

      /* now, readjust the window     */

      if (col >= txinfo.winright) {
	col = txinfo.winleft - 1;
	row++;
	viaddr = (short *)VIDADDR(row,col);
      }

      if (row >= txinfo.winbottom) {
	ScreenSetCursor(txinfo.wintop-1,0); /* goto first line in window */
	delline();                          /* and delete it */
	row--;
	viaddr -= txinfo.screenwidth;
      }
    }

  ScreenSetCursor(row, col);
  txinfo.cury = row - txinfo.wintop + 2;
  txinfo.curx = col - txinfo.winleft + 2;
  return(*(--ss));
}
コード例 #8
0
ファイル: gppconio.c プロジェクト: OS2World/APP-EDITOR-Vile
static void getwincursor(int *row, int *col)
{
  ScreenGetCursor(row, col);
}