移植到UNICODE
来源:互联网 发布:洮南网络花店 编辑:程序博客网 时间:2024/05/20 06:22
很久以前写的一个简单的脚本,功能:
- 替换"xxx" 到 _T("xxx")
- ...
虽然非常简陋,可是可以看到在开发中使用脚本会极大地提高开发效率。
# File:
# Purpose: A simple tools to change c/cpp file from ANSI to UNICODE
# in windows.
# Author: xxxxxxxxxx
# Purpose: A simple tools to change c/cpp file from ANSI to UNICODE
# in windows.
# Author: xxxxxxxxxx
#
# Functions list:
# - Change all "xxx" string to _T("xxx") except #include "xxx"
# Functions list:
# - Change all "xxx" string to _T("xxx") except #include "xxx"
# - Change "strcpy","strcmp",strcat,substr,sprintf,strstr,strchr,
# - Change "sizeof(char)" to sizeof(TCHAR) # BTW: if you want to alloc bytes,pls use sizeof(BYTE)
# Notes: u can write a shell scirpt to change all files
# in derectory recursively.
#
# TODO:
#
# - Change "sizeof(char)" to sizeof(TCHAR) # BTW: if you want to alloc bytes,pls use sizeof(BYTE)
# Notes: u can write a shell scirpt to change all files
# in derectory recursively.
#
# TODO:
#
BEGIN{
# flush temp file
tmpfile = "tmp";
flush = "cat /dev/null > " tmpfile;
system(flush);
}
# skip '#include'
/[ /t]*#include/{print $0 > tmpfile; next}
/[ /t]*#include/{print $0 > tmpfile; next}
# process each line
# from "xxx.tracer..." to "HWDEBUG(xxx.tracer...)"
{
sub(/[a-zA-Z/)(1-9_/./-/>]+/.tracef/(.*/)/, "HWDEBUG(&)", $0)
}
# from "xxx.tracer..." to "HWDEBUG(xxx.tracer...)"
{
sub(/[a-zA-Z/)(1-9_/./-/>]+/.tracef/(.*/)/, "HWDEBUG(&)", $0)
}
# from "char" to "TCHAR", from "unsigned char" to "BYTE"
{
gsub(/unsigned char/, "BYTE", $0);
gsub(/char[ /t]+/, "TCHAR ", $0);
}
# from "char* " to "TCHAR* "
{
gsub(/char*[ /t]+/, "TCHAR* ", $0);
}
{
gsub(/char*[ /t]+/, "TCHAR* ", $0);
}
# from "strxxx" to "_tcsxxx"
{
if (match($0,/str[a-z]+[ /t]*/(/))
{
tmpstr = "_tcs" substr($0, RSTART+3, RLENGTH - 3);
gsub(/str[a-z]+[ /t]*/(/, tmpstr, $0);
}
}
{
if (match($0,/str[a-z]+[ /t]*/(/))
{
tmpstr = "_tcs" substr($0, RSTART+3, RLENGTH - 3);
gsub(/str[a-z]+[ /t]*/(/, tmpstr, $0);
}
}
# string printf functions
{
gsub(/_vsnprintf[ /t]*/(/, "_vsntprintf(", $0);
gsub(/_snprintf[ /t]*/(/, "_snprintf(", $0);
gsub(/sprintf[ /t]*/(/, "_stprintf(", $0);
}
{
gsub(/_vsnprintf[ /t]*/(/, "_vsntprintf(", $0);
gsub(/_snprintf[ /t]*/(/, "_snprintf(", $0);
gsub(/sprintf[ /t]*/(/, "_stprintf(", $0);
}
# from "xxx" to _T("xxx")
{
gsub(/"[^"]*"/, "_T(&)", $0);print $0 > tmpfile;
}
{
gsub(/"[^"]*"/, "_T(&)", $0);print $0 > tmpfile;
}
END{
system("cp " tmpfile " " FILENAME);
# print filename;
# system("mv " + newname + " " + filename);
}
# system("mv " + newname + " " + filename);
}
- 移植到UNICODE
- VC 程序员的阵痛--将多字节环境移植到Unicode环境
- 把代码移植成UNICODE
- 关于GB到UNICODE
- ASCII到UNICODE转换
- 将ANSI转换到Unicode 将Unicode转换到ANSI
- 将ANSI转换到Unicode 将Unicode转换到ANSI
- ANSI转换到Unicode 或者将Unicode转换到ANSI
- PHP4移植到PHP5
- opie移植到EZX
- 移植Qtopia4到S3C2440
- 移植SNMP到ARM
- 移植ssh到arm
- x264移植到MFC
- 移植djyos到S3C44B0
- ffmpeg移植到andriod
- 5.0移植到6.0
- 移植Dnsmasq到Android
- 学习。。。
- Gentoo 2007 Install Guide.doc
- Playout buffer优化
- 利用HttpWebRequest向服务器XML数据
- 2007最值得考虑的20位VC(附简介)
- 移植到UNICODE
- 搭建eclipse+myeclipse开发环境
- 关于报编程培训班的再一次思考
- SVM算法笔记一
- C++学习------重置
- 弯路
- [VC][编译选项]
- SOA实现八大陷阱
- java动态的程序设计