📄 raw_cio.c
字号:
/* *---------------------------------------------------------------------- * T-Kernel / Standard Extension * * Copyright (C) 2006 by Ken Sakamura. All rights reserved. * T-Kernel / Standard Extension is distributed * under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * * Version: 1.00.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* * @(#)raw_cio.c * * The console I/O (on the side of use) * * libg : use at "printf" and "gets" ,etc. * The equivalent function is existent also in monitor. */#include <basic.h>#include <sys/consio.h>IMPORT W __MyConsPort;IMPORT W __GetMyPort( void );#define MyPort ((__MyConsPort <= 0) ? __GetMyPort() : __MyConsPort)#define TSD_GST_LEN_256 256#define TSD_PST_RTN_M1 (-1)#define TSD_PCH_RTN_M1 (-1)#define TSD_GCH_RTN_M1 (-1)/*---------------------------------------------------------------------- Character-string output to the console----------------------------------------------------------------------*/W _PutString(const B *buf){ W len; for ( len = 0; buf[len] != '\0'; ++len ){ ; } len = console_out(MyPort, (B*)buf, (UW)len); return (len <= 0) ? TSD_PST_RTN_M1 : len;}/*---------------------------------------------------------------------- Single-character-string output to the console----------------------------------------------------------------------*/W _PutChar(W c){ UB cc = (UB)c; return (console_out(MyPort, (B*)&cc, 1) <= 0) ? TSD_PCH_RTN_M1 : 1;}/*---------------------------------------------------------------------- Single-line input from the console----------------------------------------------------------------------*/W _GetString(B *buf){ W len; len = console_in(MyPort, buf, TSD_GST_LEN_256); if ((len > 0 )&&( buf[len - 1] == '\n')) { buf[--len] = 0; } return len;}/*---------------------------------------------------------------------- Single-character-string input from the console----------------------------------------------------------------------*/W _GetChar( void ){ UB c; return (console_in(MyPort, (B*)&c, 1) <= 0) ? TSD_GCH_RTN_M1 : c;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -