Example #1
0
//--------------------------------------------------------------
void draw_circle(int xC, int yC, int radius)
   {
   double theta, increment, xF, pi=3.14159;
   int x, xN, yN;

   increment = 0.8 / static_cast<double>(radius);
   for(theta=0; theta<=pi/2; theta+=increment)  //quarter circle
      {
      xF = radius * cos(theta);  
      xN = static_cast<int>(xF * 2 / 1); //pixels not square
      yN = static_cast<int>(radius * sin(theta) + 0.5);
      x = xC-xN;
      while(x <= xC+xN)          //fill two horizontal lines
         {                       //one for each half circle
         set_cursor_pos(x,   yC-yN); putch(fill_char);  //top
         set_cursor_pos(x++, yC+yN); putch(fill_char);  //bottom
         }
      }  //end for
   }
Example #2
0
void putstr(const char *str)
{
	int i;
	if (!str)
		return;
	i = 0;
	while (str[i]) {
		putch(str[i++]);
	}
}
Example #3
0
void
worm_draw(worm_t *worm)
{
    int w;

    for (w = 0; w < worm->nsegs; w++) {
        position(worm->row[w], worm->col[w]);
        putch('*');
    }
}
Example #4
0
int
plodput(int c)
{

	if (plodflg) {
		plodcnt--;
		return 0;
	} else
		return putch(c);
}
Example #5
0
static
void
flush_delay_buf(void)
{
	size_t i;
	for (i=0; i<delayed_outbuf_pos; i++) {
		putch(delayed_outbuf[i]);
	}
	delayed_outbuf_pos = 0;
}
Example #6
0
void puts(char *text)
    /// Output a string to the screen
{
    int i;

    for (i = 0; i < strlen(text); i++)  // Repeat until null charecter
    {
        putch(text[i]);                 // Put a charecter on the screen
    }
}
Example #7
0
void putHexNibble(unsigned char value)
{
   value &= 0xf;
   if(value > 9)
     value +=  'A' - 10;
 else
    value += '0';
   putch(value);

}
Example #8
0
void readstring(char *buf)
{
while (*(buf-1) != 13)
{
*(buf++) = toupper(getch());
putch(*(buf-1));
if (*(buf-1) == 8) buf -= 2;
}
*(buf-1) = 0;
}
Example #9
0
/*----------------------------------------------------------------------*
                             rtp_term_putc
 *----------------------------------------------------------------------*/
void rtp_term_putc (char ch)
{
    // Do ASCII translation.  Make sure that \n gets translated to \r\n.
	if (ch == '\n')
	{
		rtp_term_putc('\r');
	}
	
	putch(ch);
}
Example #10
0
ssize_t vfs_console_write(struct vfs_file_s *file, const void *src, size_t len)
{
	if (stdout_hook)
		stdout_hook(src, len);
	size_t i;
	for (i = 0; i < len; ++i)
		putch(((const char*)src)[i]);
        
	return len;
}
Example #11
0
void puts(char *str) {
	pt_s = 1;
	int length = str_len(str);
	int i =0;
	while(i < length) {
		putch(str[i]);
		i++;
	}
	pt_s = 0;
}
Example #12
0
int
plodput(int c)
{

	if (plodflg)
		plodcnt--;
	else
		putch(c);
	return c;
}
Example #13
0
uint8_t read_pass()
{
  for(uint8_t inchar = getch(); inchar != 0 && inchar != 0xa && inchar != 0xd; inchar = getch())
  {
#if PASS_VULN_TRIVIAL
    if (n_received >= passwlen || inchar != password[n_received])
    {
      putch(n_received);
      putch(inchar);
      putch(password[n_received]);
      return 1;
    }
    n_received++;
#else
    received[n_received++] = inchar;
#endif
  }
  return 0;
}
Example #14
0
CAMLprim value caml_ml_output_char(value vchannel, value ch)
{
  CAMLparam2 (vchannel, ch);
  struct channel * channel = Channel(vchannel);

  Lock(channel);
  putch(channel, Long_val(ch));
  Unlock(channel);
  CAMLreturn (Val_unit);
}
Example #15
0
void textlineh(int row, int start, int finish)
{
int count;

	for(count = start; count <= finish; count++)
	{
	gotoxy(count,row);
	putch(HLINE);
	}
}
Example #16
0
char *Sys_ConsoleInput(void)
{
	static char	text[256];
	static int	len = 0;
	char		ch;

	if (!isDedicated)
		return NULL;

	if (! kbhit())
		return NULL;

	ch = getche();

	switch (ch)
	{
		case '\r':
			putch('\n');
			if (len)
			{
				text[len] = 0;
				len = 0;
				return text;
			}
			break;

		case '\b':
			putch(' ');
			if (len)
			{
				len--;
				putch('\b');
			}
			break;

		default:
			text[len] = ch;
			len = (len + 1) & 0xff;
			break;
	}

	return NULL;
}
Example #17
0
static void flush_console()
{
	char * p=text;
	while(*p){
		putch(*p);
		console_putch(*p++);
	}

	text[0]='\0';
}
Example #18
0
File: pmu.c Project: robbie-cao/wmd
/* PMU interrupt service routine */
void PMU_ISR(void)
{
#ifdef DEBUG
    putch('I');
#endif
    /* send msg to main loop */
    Task_Push(MSG_ID_PMU_IND, 0, 0);

    INTF = 0;
}
Example #19
0
/* -------------------------------------------------------------------- */
void outCon(char c)
{
    unsigned char row, col;
    static char escape = FALSE;

    if (!console)
        return;

    if (c == '\a' /* BELL */ && cfg.noBells)
        return;
    if (c == 27 || escape) {    /* ESC || ANSI sequence */
        escape = ansi(c);
        return;
    }
    if (c == 0x1a)      /* CT-Z */
        return;

    if (!anyEcho)
        return;

    /* if we dont have carrier then count what goes to console */
    if (!gotCarrier())
        transmitted++;

    if (c == '\n')
        doccr();
    else if (c == '\r') {
        putch(c);
    } else {
        readpos(&row, &col);
        if (c == '\b' || c == 7) {
            if (c == '\b' && col == 0 && prevChar != '\n')
                position(row - 1, 80);
            putch(c);
        } else {
            (*charattr) (c, ansiattr);
            if (col == 79) {
                position(row, col);
                doccr();
            }
        }
    }
}
Example #20
0
void 
RingBell(void)
{
#ifdef UNIX
    refresh();
    beep();
#else
    putch('\a');
#endif
}
Example #21
0
/**
 * Fake vfs
 */
ssize_t vfs_console_write(struct _reent *r, int fd, const char *src, size_t len) {
	if (stdout_hook)
		stdout_hook(src, len);
	if (stdlog_hook)
		stdlog_hook(src, len);
	size_t i;
	for (i = 0; i < len; ++i)
		putch(((const char*) src)[i]);
	return len;
}
Example #22
0
/*
 * do an even faster scan than fastscan while at flslvl.
 * just search for a new directive.
 */
static void
flscan(void)
{
	int ch;

	for (;;) {
		ch = qcchar();
again:		switch (ch) {
		case 0:
			return;
		case '\n':
			putch('\n');
			ifiles->lineno++;
			while ((ch = qcchar()) == ' ' || ch == '\t')
				;
			if (ch == '#')
				return;
			if (ch == '%' && (ch = qcchar()) == ':')
				return;
			goto again;
		case '\'':
			while ((ch = qcchar()) != '\'') {
				if (ch == '\\')
					qcchar();
				if (ch == '\n')
					return;
			}
			break;
		case '\"':
			instr = 1;
			while ((ch = qcchar()) != '\"') {
				switch (ch) {
				case '\\':
					incmnt = 1;
					qcchar();
					incmnt = 0;
					break;
				case '\n':
					unch(ch);
					/* FALLTHROUGH */
				case 0:
					instr = 0;
					return;
				}
			}
			instr = 0;
			break;
		case '/':
			ch = qcchar();
			if (ch == '/' || ch == '*')
				fastcmnt2(ch);
			goto again;
		}
        }
}
Example #23
0
void* sender(void *ptr) {
	struct stuff *s = (struct stuff *)ptr;
/*	int r = 0, i = 0, mode = -1;
	char mybuf[CHATLEN], tmbuf[CHATLEN];
	memset(mybuf, 0, CHATLEN);
	memset(tmbuf, 0, CHATLEN);
*/
	setupscreen();
	int ch;
	while (1) {
		if (i > CHATLEN - 1) {
			i = 0;
		}
		ch = wgetch(me);
		mybuf[i] = ch;
		if (ch == KEY_RESIZE) {
			clear();
			endwin();
			setupscreen();
			char *p = &mybuf[0];
			while (&(*p) < &mybuf[CHATLEN - 1]) {
				putch(me, (*p));
				p++;
			}
			p = &tmbuf[0];
			while (&(*p) < &tmbuf[CHATLEN - 1]) {
				putch(them, (*p));
				p++;
			}
			refresh();
		} else {
			putch(me, mybuf[i]);
			int writefd = s->bertil.writechan;
			write(writefd, &mybuf[i], 1);
		}
			i++;
		}
		pthread_cancel(sendthread);
		return NULL;

		
}
Example #24
0
static inline void handle_programmerID(void) {
	putch('A');  /* this is smaller than a string */
	putch('V');
	putch('R');
	putch(' ');
	putch('I');
	putch('S');
	putch('P');
}
Example #25
0
void Draw() // Drawborder
{
	clrscr(); // clear clonsole
	for (int a = 0; a < g_width + 2; a++) {
		textcolor(BORDER_COLOR);
		putch(219);
	}
	for (int a = 1; a <= g_high; a++) {
		gotoxy(1, a + 1);
		textcolor(BORDER_COLOR);
		putch(219);
		gotoxy(g_width + 2, a + 1);
		putch(219);
	}
	printf(" \n");
	for (int a = 0; a < g_width + 2; a++) {
		textcolor(BORDER_COLOR);
		putch(219);
	}
}
Example #26
0
int cputs(const char *__str)
{
	int k = 0;
	while (*__str)
	{
		putch(*__str);
		++__str;
		++k;
	}
	return k;
}
Example #27
0
/*****************************************************************************
 * Name:
 *    print
 * In:
 *    s: string
 * Out:
 *    n/a
 *
 * Description:
 *    Print the specified string.
 * Assumptions:
 *
 *****************************************************************************/
void print_usb(char *s)
{
    while(*s)
    {
        while(*s != (char)putch(*s))
        {
            DelayTask(1);
        };
        s++;
    }
}
Example #28
0
void puthex(u8 byte)
{
    u8 c;

    c = byte >> 4;
#ifdef USART_OPTIMIZE
    c +=  (c <= 9) ? '0' : 0x37;    /* 0x37 = 'A' - 0xA */
#else
    c +=  ((c <= 9) ? '0' : ('A' - 0xA));
#endif
    putch(c);

    c = byte & 0xF;
#ifdef USART_OPTIMIZE
    c +=  (c <= 9) ? '0' : 0x37;    /* 0x37 = 'A' - 0xA */
#else
    c +=  ((c <= 9) ? '0' : ('A' - 0xA));
#endif
    putch(c);
}
Example #29
0
void UART::print(const __FlashStringHelper * flashStr)
{
	char readedByte, *flashPointer = (char*)flashStr;
	readedByte = pgm_read_byte(flashPointer);
	while(readedByte)
	{
		putch(readedByte);
		flashPointer++;
		readedByte = pgm_read_byte(flashPointer);
	}
}
Example #30
0
static void
pragmastmt(void)
{
	int ch;

	putstr((const usch *)"\n#pragma");
	while ((ch = qcchar()) != '\n' && ch > 0)
		putch(ch);
	unch(ch);
	prtline(1);
}