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

📄 pp03.c

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 C
字号:
// 3.8.3.5 ANSI C standard
#define str(s) # s
#define xstr(s) str(s)
#define debug(s,t) printf("x" # s "= %d, x" # t "= %s", x ## s, x ##t )
#define INCFILE(n) st ## n
#define glue(a,b) a ## b
#define xglue(a,b) glue(a,b)
#define HIGHLOW "hello"
#define LOW LOW ", world"

// OK, a little obscure but it tests a feature
#include xstr(INCFILE(dio).h)
#include xstr(INCFILE(dlib).h)
#include xstr(INCFILE(ring).h)

#include "fail.h"

char *gen[] = {
xstr(debug(1,2);),
xstr(fputs(str(strncmp("abc\0d", "abc", '\4') /* this goes away */ == 0) str(: @\n), s );),
xstr(glue(HIGH,LOW);),
xstr(xglue(HIGH,LOW)),
 NULL
};

char *check[] = {
 "printf(\"x\" \"1\" \"= %d, x\" \"2\" \"= %s\", x1, x2 );",
 "fputs(\"strncmp(\\\"abc\\\\0d\\\", \\\"abc\\\", '\\\\4') == 0\" \": @\\n\", s );",
 "\"hello\";",
 "\"hello\" \", world\"",
 NULL
};

int main()
{
    char **c;
    char **v;

    c = gen;
    v = check;
    for(;;) {
	if( *c == NULL && *v == NULL ) break;
	if( *c == NULL ) {
	    fail(__LINE__);
	    break;
	}
	if( *v == NULL ) {
	    fail(__LINE__);
	    break;
	}
	if( strcmp( *c, *v ) != 0 ) {
	    fail(__LINE__);
	}
	++c;
	++v;
    }
    _PASS;
}

⌨️ 快捷键说明

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