📄 param.c
字号:
if( *arg == '=' ) arg++;
resfile = RcMemMalloc( sizeof( ExtraRes ) );
if( scanString( resfile->name, arg, _MAX_PATH ) ) {
RcError( ERR_UNMATCHED_QUOTE_ON_CMD_LINE );
RcMemFree( resfile );
} else {
resfile->next = CmdLineParms.ExtraResFiles;
CmdLineParms.ExtraResFiles = resfile;
}
break;
case 'e':
arg++;
if( *arg == '=' ) arg++;
if( scanString( CmdLineParms.OutExeFileName, arg, _MAX_PATH ) ) {
RcError( ERR_UNMATCHED_QUOTE_ON_CMD_LINE );
}
break;
default:
RcError( ERR_UNKNOWN_MULT_OPTION, arg - 1 );
contok = FALSE;
break;
}
break;
case 'g':
arg++;
if( *arg == '=' ) arg++;
temp = RcMemMalloc( strlen( arg ) + 1 );
strcpy( temp, arg );
if( scanString( temp, arg, _MAX_PATH ) ) {
RcError( ERR_UNMATCHED_QUOTE_ON_CMD_LINE );
}
frStrings = RcMemMalloc( sizeof( FRStrings ) + strlen( arg ) + 2 );
p = strtok( temp, delims );
if( p != NULL ) {
findlen = strlen( p );
strcpy( frStrings->buf, p );
frStrings->findString = frStrings->buf;
} else {
RcError( ERR_SYNTAX_STR, "/g=" );
contok = FALSE;
}
p = strtok( NULL, delims );
if( p != NULL ) {
replen = strlen( p );
strcpy( &frStrings->buf[findlen+1], p );
frStrings->replaceString = &frStrings->buf[findlen+1];
} else {
RcError( ERR_SYNTAX_STR, frStrings->findString );
contok = FALSE;
}
frStrings->next = CmdLineParms.FindReplaceStrings;
CmdLineParms.FindReplaceStrings = frStrings;
CmdLineParms.FindAndReplace = TRUE;
RcMemFree( temp );
break;
case 'i':
arg++;
if( *arg == '=' ) arg++;
AddNewIncludeDirs( arg );
break;
case 'o':
CmdLineParms.PreprocessOnly = TRUE;
break;
case 's':
arg++;
switch( tolower( *arg ) ) {
case '0':
CmdLineParms.SegmentSorting = SEG_SORT_NONE;
break;
case '1':
CmdLineParms.SegmentSorting = SEG_SORT_PRELOAD_ONLY;
break;
case '2':
CmdLineParms.SegmentSorting = SEG_SORT_MANY;
break;
}
break;
case 'w':
arg++;
if( *arg == 'r' ) {
// CmdLineParms.WritableRes = TRUE;
}
break;
#if defined(YYDEBUG) || defined(SCANDEBUG)
case 'v':
arg++;
switch( tolower( *arg ) ) {
#if defined(YYDEBUG)
case '1':
CmdLineParms.DebugParser = 1;
break;
#endif
#if defined(YYDEBUG) && defined(SCANDEBUG)
case '2':
CmdLineParms.DebugParser = 1;
CmdLineParms.DebugScanner = 1;
break;
case '3':
CmdLineParms.DebugScanner = 1;
break;
#endif
#if defined(SCANDEBUG)
default:
CmdLineParms.DebugScanner = 1;
break;
#endif
}
break;
#endif
case 'x':
arg++;
if( tolower( *arg ) == 'c' ) {
CmdLineParms.IgnoreCWD= TRUE;
} else {
CmdLineParms.IgnoreINCLUDE = TRUE;
}
break;
case 'z':
arg++;
switch( tolower( *arg ) ) {
case 'm':
CmdLineParms.MSResFormat = TRUE;
break;
case 'n':
CmdLineParms.NoPreprocess = TRUE;
break;
/*
Lead-byte and trail-byte ranges for code pages used in Far East
editions of Windows 95.
Character Code Lead-Byte Trail-Byte
Language Set Name Page Ranges Ranges
Chinese
(Simplified) GB 2312-80 CP 936 0xA1-0xFE 0xA1-0xFE
Chinese
(Traditional) Big-5 CP 950 0x81-0xFE 0x40-0x7E
0xA1-0xFE
Japanese Shift-JIS (Japan
Industry Standard) CP 932 0x81-0x9F 0x40-0xFC
0xE0-0xFC (except 0x7F)
Korean
(Wansung) KS C-5601-1987 CP 949 0x81-0xFE 0x41-0x5A
0x61-0x7A
0x81-0xFE
Korean
(Johab) KS C-5601-1992 CP 1361 0x84-0xD3 0x41-0x7E
0xD8 0x81-0xFE
0xD9-0xDE (Government
0xE0-0xF9 standard:
0x31-0x7E
0x41-0xFE)
*/
case 'k':
arg++;
switch( *arg ) {
case '1':
SetDBRange( 0x81, 0xfe );
CmdLineParms.DBCharSupport = DB_TRADITIONAL_CHINESE;
break;
case '2':
SetDBRange( 0x81, 0xfe );
CmdLineParms.DBCharSupport = DB_WANSUNG_KOREAN;
break;
case '3':
SetDBRange( 0xA1, 0xfe );
CmdLineParms.DBCharSupport = DB_SIMPLIFIED_CHINESE;
break;
case '0':
case ' ':
case '\0':
SetDBRange( 0x81, 0x9f );
SetDBRange( 0xe0, 0xfc );
CmdLineParms.DBCharSupport = DB_KANJI;
break;
// case 'u':
//
// NYI - set up a new code page
//
// break;
default:
RcError( ERR_UNKNOWN_MULT_OPTION, arg - 2 );
contok = FALSE;
break;
}
break;
default:
RcError( ERR_UNKNOWN_MULT_OPTION, arg - 1 );
contok = FALSE;
break;
}
break;
default: /* option that could have others with it */
contok = ScanMultiOptArg( arg ) && contok;
break;
}
return( contok );
} /* ScanOptionsArg */
static void MakeFileName( char * infilename, char * outfilename, char * ext )
/***************************************************************************/
{
char name[ _MAX_FNAME ];
char dir[ _MAX_DIR ];
char drive[ _MAX_DRIVE ];
_splitpath( infilename, drive, dir, name, NULL );
_makepath( outfilename, drive, dir, name, ext );
} /* MakeFileName */
static void CheckExtension( char * filename, char * defext )
/**********************************************************/
{
char name[ _MAX_FNAME ];
char drive[ _MAX_DRIVE ];
char dir[ _MAX_DIR ];
char ext[ _MAX_EXT ];
_splitpath( filename, drive, dir, name, ext );
if( *ext == '\0' ) {
_makepath( filename, drive, dir, name, defext );
}
} /* CheckExtension */
/* extensions for Windows executables */
/* The strings are in the format of the _splitpath function */
static const char *ExeExt[] = {
".EXE",
".DLL",
".DRV",
".SCR", /* Windows 3.1 screen saver apps */
NULL
};
static void CheckPass2Only( void )
/********************************/
{
char ext[ _MAX_EXT ];
char **check_ext;
_splitpath( CmdLineParms.InFileName, NULL, NULL, NULL, ext );
if( stricmp( ext, ".RES" ) == 0 ) {
CmdLineParms.Pass2Only = TRUE;
} else {
/* if the extension is in the ExeExt list then we want pass2 only */
/* and there is no resource file to merge */
for (check_ext = (char**)ExeExt; *check_ext != NULL; check_ext++) {
if (stricmp( ext, *check_ext ) == 0) {
CmdLineParms.Pass2Only = TRUE;
CmdLineParms.NoResFile = TRUE;
}
}
}
} /* CheckPass2Only */
static void SetIncludeVar( void )
/*******************************/
{
char * old_inc_dirs;
if( !CmdLineParms.IgnoreINCLUDE ) {
old_inc_dirs = RcGetEnv( "INCLUDE" );
if( old_inc_dirs != NULL ) {
AddNewIncludeDirs( old_inc_dirs );
}
}
} /* SetIncludeVar */
static void CheckParms( void )
/****************************/
{
char *defext;
CheckExtension( CmdLineParms.InFileName, "rc" );
CheckPass2Only();
/* was an EXE file name given */
if( CmdLineParms.InExeFileName[0] == '\0' ) {
if (CmdLineParms.NoResFile) {
strncpy( CmdLineParms.InExeFileName, CmdLineParms.InFileName,
_MAX_PATH );
} else {
MakeFileName( CmdLineParms.InFileName,
CmdLineParms.InExeFileName, "exe" );
}
} else {
CheckExtension( CmdLineParms.InExeFileName, "exe" );
}
/* was an output RES file name given */
if( CmdLineParms.PreprocessOnly ) {
defext = "lst";
} else {
defext = "res";
}
if( CmdLineParms.OutResFileName[0] == '\0' ) {
MakeFileName( CmdLineParms.InFileName,
CmdLineParms.OutResFileName, defext );
} else {
CheckExtension( CmdLineParms.OutResFileName, defext );
}
/* was an output EXE file name given */
if( CmdLineParms.OutExeFileName[0] == '\0' ) {
strncpy( CmdLineParms.OutExeFileName,
CmdLineParms.InExeFileName, _MAX_PATH );
} else {
CheckExtension( CmdLineParms.OutExeFileName, "exe" );
}
/* check for the existance of the input files */
if (! (CmdLineParms.Pass2Only && CmdLineParms.NoResFile) ) {
if( access( CmdLineParms.InFileName, F_OK ) != 0 ) {
RcFatalError( ERR_CANT_FIND_FILE, CmdLineParms.InFileName );
}
}
if( !CmdLineParms.Pass1Only && !CmdLineParms.PreprocessOnly ) {
if( access( CmdLineParms.InExeFileName, F_OK ) != 0 ) {
RcFatalError( ERR_CANT_FIND_FILE, CmdLineParms.InExeFileName );
}
}
if( CmdLineParms.GenAutoDep && CmdLineParms.MSResFormat ) {
RcFatalError( ERR_OPT_NOT_VALID_TOGETHER, "-ad", "-zm" );
}
if( CmdLineParms.TargetOS == RC_TARGET_OS_WIN32 ) {
switch( CmdLineParms.DBCharSupport ) {
case DB_SIMPLIFIED_CHINESE:
strcpy( CmdLineParms.CodePageFile, "936.uni" );
break;
case DB_TRADITIONAL_CHINESE:
strcpy( CmdLineParms.CodePageFile, "950.uni" );
break;
case DB_KANJI:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -