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

📄 dds_basic.c

📁 a c example of dds module
💻 C
字号:
/* DDS-BASIC Interpreter (Version 1.00).   by <dds@cc.ic.ac.uk> Diomidis Spinellis,   this is a 1990 IOCCC (obfuscated C code) entry */#define O(b,f,u,s,c,a)b(){int o=f();switch(*p++){X u:_ o s b();X c:_ o a b();default:p--;_ o;}}#define t(e,d,_,C)X e:f=fopen(B+d,_);C;fclose(f)#define U(y,z)while(p=Q(s,y))*p++=z,*p=' '#define N for(i=0;i<11*R;i++)m[i]&&#define I "%d %s\n",i,m[i]#define X ;break;case#define _ return#define R 999typedef char*A;int*C,E[R],L[R],M[R],P[R],l,i,j;char B[R],F[2];A m[12*R],malloc(),p,q,x,y,z,s,d,f,fopen();A Q(s,o)A s,o;{for(x=s;*x;x++){for(y=x,z=o;*z&&*y==*z;y++)z++;if(z>o&&!*z)_ x;}_	0;}main(){m[11*R]="E";while(puts("Ok"),gets(B))switch(*B){X'R':C=E;l=1;for(i=0;i<R;P[i++]=0);while(l){while(!(s=m[l]))l++;if(!Q(s,"\"")){U("<>",'#');U("<=",'$');U(">=",'!');}d=B;while(*F=*s){*s=='"'&&j++;if(j&1||!Q(" \t",F))*d++=*s;s++;}*d--=j=0;if(B[1]!='=')switch(*B){X'E':l=-1X'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?gets(p=B),P[*d]=S():(*(q=Q(B,"TH"))=0,p=B+2,S()&&(p=q+4,l=S()-1))X'P':B[5]=='"'?*d=0,puts(B+6):(p=B+5,printf("%d\n",S()))X'G':p=B+4,B[2]=='S'&&(*C++=l,p++),l=S()-1 X'F':*(q=Q(B,"TO"))=0;p=B+5;P[i=B[3]]=S();p=q+2;M[i]=S();L[i]=l X'N':++P[*d]<=M[*d]&&(l=L[*d]);}else p=B+2,P[*B]=S();l++;}X'L':N printf(I)X'N':N free(m[i]),m[i]=0	X'B':_ 0 t('S',5,"w",Nfprintf(f,I))t('O',4,"r",while(fgets(B,R,f))(*Q(B,"\n")=0,G()))X 0:default:G();}_ 0;}G(){l=atoi(B);m[l]&&free(m[l]);(p=Q(B," "))?strcpy(m[l]=malloc(strlen(p)),p+1):(m[l]=0,0);}O(S,J,'=',==,'#',!=)O(J,K,'<',<,'>',>)O(K,V,'$',<=,'!',>=)O(V,W,'+',+,'-',-)O(W,Y,'*',*,'/',/)Y(){int o;_*p=='-'?p++,-Y():*p>='0'&&*p<='9'?strtol(p,&p,0):*p=='('?p++,o=S(),p++,o:P[*p++];}/*    author:	Diomidis Spinellis	Imperial College, University of London	Myrsinis 1	GR-145 62 Kifissia	Greece    notes:    The rules of the IOCCC require that the source code be public domain.        Immediate commands:	NEW	LIST	OLD filename	RUN	SAVE filename	BYE    Program statements:	var = exp	INPUT variable			PRINT string	PRINT exp			GOTO exp		IF exp THEN exp	FOR var = exp TO exp	NEXT variable	GOSUB exp			RETURN	REM any text	END    Expressions (ranked by precedence):	Bracketed expressions	number (leading 0 for octal, 0x for hex, else decimal),	variable	Unary -	* / 	+ - 	= <> 	> < 	<= >=	(* and + are also used for boolean AND and boolean OR)	(Boolean expressions evaluate to 0 for false and 1 for true)    Variables:	variable names a to z	variables initialized to 0 on RUN    Editing:	- Line editor using line re-entry.	- A line number with nothing following it, deletes the line.	- Line number range	1-10000    Input format:	- ALL INPUT MUST BE UPPERCASE.	- No space is allowed before the line number.	- Exactly one space is needed between the OLD or SAVE command and 	  the filename.	No error checking is performed.	The message 'core dumped' or 'bus error'	signifies a syntax or semantic error.*/

⌨️ 快捷键说明

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