文字列リテラルのエスケープシークエンスに\xnnを追加するパッチ
これでオブジェクトファイルを直接いじらず非印字を文字列リテラルに入れられますね。微妙。
--- codegen.cpp.orig Mon Jan 14 09:30:26 2008 +++ codegen.cpp Wed Feb 13 15:39:36 2008 @@ -398,6 +398,19 @@ case 'r': a1 = 13; break; + case 'x': + if( !isxdigit( *(vs+1) ) || !isxdigit( *(vs+2) ) ) { + continue; + } + { + unsigned char a2; + a2 = tolower( *++vs ); + a1 = isdigit( a2 ) ? a2 - '0' : a2 - 'a' + 10; + a1 *= 16; + a2 = tolower( *++vs ); + a1 += isdigit( a2 ) ? a2 - '0' : a2 - 'a' + 10; + } + goto skip; } } if (a1>=129) { // 全角文字チェック @@ -407,6 +420,7 @@ a1=*vs; } } +skip: vs++; *pp++ = a1; } @@ -454,6 +468,19 @@ case 0x22: a1 = 0x22; break; + case 'x': + if( !isxdigit( *(vs+1) ) || !isxdigit( *(vs+2) ) ) { + continue; + } + { + unsigned char a2; + a2 = tolower( *++vs ); + a1 = isdigit( a2 ) ? a2 - '0' : a2 - 'a' + 10; + a1 *= 16; + a2 = tolower( *++vs ); + a1 += isdigit( a2 ) ? a2 - '0' : a2 - 'a' + 10; + } + goto skip; } } if (a1>=129) { // 全角文字チェック @@ -463,6 +490,7 @@ a1=*vs; } } +skip: vs++; *pp++ = a1; }
OpenHSP Copyright (C) 1997-2008, Onion Software/onitama, all rights reserved. This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed.