Better handling of macros and one line commands for standard predefines.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2637 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
icemank 2003-06-12 21:50:17 +00:00
parent 70a48ad5b8
commit b523639b83

View file

@ -450,21 +450,30 @@ int CEXEBuild::process_oneline(char *line, char *filename, int linenum)
char *oldfilename = NULL; char *oldfilename = NULL;
char *oldtimestamp = NULL; char *oldtimestamp = NULL;
char *oldline = NULL; char *oldline = NULL;
BOOL is_commandline = !lstrcmp(filename,"command line");
BOOL is_macro = !strncmp(filename,"macro:",lstrlen("macro:"));
if(lstrcmp(filename,"command line")) { // Don't set the predefines for command line /X option if(!is_commandline) { // Don't set the predefines for command line /X option
oldfilename = set_file_predefine(curfilename); if(is_macro) {
oldtimestamp = set_timestamp_predefine(curfilename); oldline = set_line_predefine(last_linecnt+linecnt-1); // This is done so that line numbers are
oldline = set_line_predefine(last_linecnt+linecnt-1); // This is done so that line numbers are } //handled properly when macros are inserted.
} //handled properly when macros are inserted. else {
oldfilename = set_file_predefine(curfilename);
oldtimestamp = set_timestamp_predefine(curfilename);
oldline = set_line_predefine(linecnt);
}
}
#endif #endif
ps_addtoline(line,linedata,hist); ps_addtoline(line,linedata,hist);
#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES #ifdef NSIS_SUPPORT_STANDARD_PREDEFINES
// Added by Sunil Kamath 11 June 2003 // Added by Sunil Kamath 11 June 2003
if(lstrcmp(filename,"command line")) { // Don't set the predefines for command line /X option if(!is_commandline) { // Don't set the predefines for command line /X option
restore_file_predefine(oldfilename); if(!is_macro) {
restore_timestamp_predefine(oldtimestamp); restore_file_predefine(oldfilename);
restore_timestamp_predefine(oldtimestamp);
}
restore_line_predefine(oldline); restore_line_predefine(oldline);
} }
#endif #endif