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

📄 r2.c

📁 UNIX v6源代码 这几乎是最经典的unix版本 unix操作系统设计和莱昂氏unix源代码分析都是用的该版
💻 C
字号:
#include "r.h"char	outbuf[80];int	outp	0;int	cont	0;outcode(p) char *p; {	int i,j,c,c1;	char *q;	if( p == 0 ){		outbuf[outp] = '\0';		printf("%s\n", outbuf);		outp = cont = 0;		return;	}	while( (c = *p++) ){		c1 = *p;		switch(c){		case '"':		case '\'':			for( q=p; *q != c; q++ );			outnum(q-p);			ptc('h');			while( p != q )				ptc(*p++);			p++;			break;		case '>':			if( c1=='=' ){				pts(".ge."); p++;			} else				pts(".gt.");			break;		case '<':			if( c1=='=' ){				pts(".le."); p++;			} else if( c1=='>' ){				pts(".ne."); p++;			} else				pts(".lt.");			break;		case '=':			if( c1=='=' ){				pts(".eq."); p++;			} else				ptc('=');			break;		case '!':			if( c1=='=' ){				pts(".ne."); p++;			} else				pts(".not.");			break;		case '&':			if( c1=='&' )				p++;			pts(".and.");			break;		case '|':			if( c1=='|' )				p++;			pts(".or.");			break;		case '\t':			tabs();			break;		case '\n':			ptc(' ');			break;		default:			ptc(c);			break;		}	}}ptc(c) char c; {	if( outp > 71 )		contcard();	outbuf[outp++] = c;}pts(s) char *s; {	while(*s)		ptc(*s++);}int	contfld	0;contcard(){	outbuf[outp] = '\0';	printf("%s\n", outbuf);	for( outp=0; outp<contfld-1; outbuf[outp++] = ' ' );	outbuf[outp++] = '&';}tabs(){	ptc(' ');	while( outp<7 )		ptc(' ');	while( outp%3 != 1)		ptc(' ');}outnum(n) int n; {	int a;	if( a = n/10 )		outnum(a);	ptc(n%10 + '0');}outcont(n) int n; {	if( n > 0 )		outnum(n);	outcode("\tcontinue");	outcode(0);}outgoto(n) int n; {	outcode("\tgoto ");	outnum(n);	outcode(0);}

⌨️ 快捷键说明

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