⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mystdio.c

📁 minimal python variant for small footprint apps like embedded apps
💻 C
字号:
#include "io.h"#include <stdio.h>#include <stdlib.h>#include "libc_segments.h"#define BUF_LEN 100static char put_buf[BUF_LEN]; /* roughly one line */static UInt16 buf_pos = 0;static int flush_buf() {	if (buf_pos > 0) {		put_buf[buf_pos]='\0';		ioPutS(put_buf);		buf_pos = 0;	}	return 0;}int puts(unsigned char *s) {	flush_buf();	ioPutS(s);	return 0;}int putchar (unsigned int x) {		put_buf[buf_pos++] = x;	/* flush on \n character or when BUF_LEN-1 (keep last \0 for	   end-of-string indication) is reached */	if (x == '\n' || buf_pos == BUF_LEN-1) {		flush_buf();	}	return 0;}int printf(const char *fmt, ...){	va_list args;	int i;		va_start(args, fmt);	i = vfprintf(stdout, fmt, args);	va_end(args);		return i;}int fprintf(FILE* f, const char *fmt, ...){	va_list args;	int i;		va_start(args, fmt);	i = vfprintf(f, fmt, args);	va_end(args);		return i;}int vfprintf(FILE *stream, const char *fmt, va_list ap){	int i,j;	char *buf = (char *)malloc(500L);	i=vsprintf(buf,fmt,ap);	/*	flush_buf();		ioPutS(buf);*/	/* avoid buffer copy when a whole line is being output */	if ((i&&(buf[i-1]=='\n')|| (i>(BUF_LEN-buf_pos))))	{	  flush_buf();	  ioPutS(buf);	}	else {	  for (j=0; j<i;j++)	    putchar(buf[j]);	} 	free(buf);	return i;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -