Created
March 21, 2012 10:54
-
-
Save upsuper/2146157 to your computer and use it in GitHub Desktop.
中文C编程
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define 主函数 main | |
#define 整数 int | |
#define 返回 return | |
#define 打印 printf | |
#include <stdio.h> | |
整数 主函数() | |
{ | |
打印("你好世界\n"); | |
返回 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFLAGS=-fextended-identifiers -std=c99 | |
objects=chinese.ucn.o | |
target=chinese | |
.PHONY: all clean | |
all: $(target) | |
$(target): $(objects) | |
$(CC) $< -o $@ | |
$(objects): %.o: %.c | |
$(objects:%.o=%.c): %.ucn.c: %.c | |
./to_UCN.sh $< $@ | |
clean: | |
-rm $(target) *.o *.ucn.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat $1 | perl -pe 'BEGIN { binmode STDIN, ":utf8"; } s/(.)/ord($1) < 128 ? $1 : sprintf("\\U%08x", ord($1))/ge;' > $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment