void _set_align(enum Token_Type t, FILE *fd) {
    unsigned int mode_char = 0;
    switch (t) {
        case TOKEN_CENTER_BEGIN:
            mode_char = 1;
            break;
        case TOKEN_RIGHT_BEGIN:
            mode_char = 2;
            break;
        default:
            mode_char = 0;
            break;
    }
    _printc(0x1B, fd);
    _printc(0x61, fd);
    _printc(mode_char, fd);

}
void _reset_printer(FILE *fd) {
    _printc(0xFF, fd);
    for (i = 0; i < 10; i++) {
        usleep(1000);
        _printc(27, fd);
    }
    _printc(27, fd);
    _printc(64, fd);
    print_mode = 0x0;
    _printc(27, fd);
    _printc(55, fd);
    _printc(20, fd);
    _printc(255, fd);
    _printc(250, fd);
    _printc(18, fd);
    _printc(35, fd);
    _printc((4 << 5) | 14, fd);
    _dotPrintTime = 30000; // See comments near top of file for
    _dotFeedTime = 2100; // an explanation of these values.
}
void _write_print_mode(FILE *fd) {
    _printc(27, fd);
    _printc(33, fd);
    _printc(print_mode, fd);
}
Beispiel #4
0
 u8b osh_prompt()
 {	u8b  	c	= 0 , 
		*cmdptr = osh_cmd_buff ;
		u16b 	counter = 0 ;
		
		print(osh_prompt_msg,osh_x=1,osh_y);
		osh_x+=strlen(osh_prompt_msg);

		gotoxy(++osh_x,osh_y);

		while(c!=13) /* EOL */
		{	c = getch();
			if(c==8) /* Back space */
			{	if(counter>0&&(osh_x)>1)
				{	cmdptr[--counter]=0;
					gotoxy(--osh_x,osh_y);
					_printc(0);
				}
				else
				if(osh_x==0)
				{	gotoxy((osh_x=79),--osh_y);
					_printc(0);
				}
			}
			else if(c==13) /* ENTER */
			{
				break;
			}
			else
			{	if(osh_x<79)
				{	_printc(c);
					gotoxy(++osh_x,osh_y);
					cmdptr[counter++] = c;
				}
				else
				{	if(osh_y<24)
					{	osh_x = 0;
						osh_y+= 1;
						gotoxy(++osh_x,osh_y);
						_printc(c);
						cmdptr[counter++] = c;
						gotoxy(++osh_x,osh_y);
					}
					else 
					{
						osh_x = 0;
						_scrollup(1,0,3,79,24);
						gotoxy(++osh_x,osh_y=24);
						
					}				
				}		
			}
		}
		if(osh_y>=24)
		{	_scrollup(1,0,3,79,24);
			osh_y = 24;
		}
		else
		{	osh_y++;

		}		
		cmdptr[counter] = 0;
	return osh_command();
 }