Add an spcomp option to print #included files (bug 5997 part 4, r=ds).

This commit is contained in:
David Anderson 2013-12-30 17:50:58 -05:00
parent 54ed1807c0
commit 58995fc829
4 changed files with 14 additions and 5 deletions

View File

@ -808,6 +808,7 @@ SC_VDECL int sc_needsemicolon;/* semicolon required to terminate expressions? */
SC_VDECL int sc_dataalign; /* data alignment value */
SC_VDECL int sc_alignnext; /* must frame of the next function be aligned? */
SC_VDECL int pc_docexpr; /* must expression be attached to documentation comment? */
SC_VDECL int sc_showincludes; /* show include files? */
SC_VDECL int curseg; /* 1 if currently parsing CODE, 2 if parsing DATA */
SC_VDECL cell pc_stksize; /* stack size */
SC_VDECL cell pc_amxlimit; /* abstract machine size limit (code + data, or only code) */

View File

@ -859,11 +859,11 @@ static void parseoptions(int argc,char **argv,char *oname,char *ename,char *pnam
int arg,i,isoption;
for (arg=1; arg<argc; arg++) {
#if DIRSEP_CHAR=='/'
isoption= argv[arg][0]=='-';
#else
isoption= argv[arg][0]=='/' || argv[arg][0]=='-';
#endif
#if DIRSEP_CHAR=='/'
isoption= argv[arg][0]=='-';
#else
isoption= argv[arg][0]=='/' || argv[arg][0]=='-';
#endif
if (isoption) {
ptr=&argv[arg][1];
switch (*ptr) {
@ -933,6 +933,9 @@ static void parseoptions(int argc,char **argv,char *oname,char *ename,char *pnam
hwndFinish=(HWND)0;
break;
#endif
case 'h':
sc_showincludes = 1;
break;
case 'i':
strlcpy(str,option_value(ptr),sizeof str); /* set name of include directory */
i=strlen(str);
@ -1271,6 +1274,7 @@ static void about(void)
#if defined __WIN32__ || defined _WIN32 || defined _Windows
pc_printf(" -H<hwnd> window handle to send a notification message on finish\n");
#endif
pc_printf(" -h show included file paths\n");
pc_printf(" -i<name> path for include files\n");
pc_printf(" -l create list file (preprocess only)\n");
pc_printf(" -o<name> set base name of (P-code) output file\n");

View File

@ -153,6 +153,9 @@ static char *extensions[] = { ".inc", ".p", ".pawn" };
*ext='\0'; /* restore filename */
return FALSE;
} /* if */
if (sc_showincludes && sc_status==statFIRST) {
fprintf(stdout, "Note: including file: %s\n", name);
}
PUSHSTK_P(inpf);
PUSHSTK_P(inpfname); /* pointer to current file name */
PUSHSTK_P(curlibrary);

View File

@ -91,6 +91,7 @@ SC_VDEFINE char *pc_deprecate=NULL;/* if non-null, mark next declaration as depr
SC_VDEFINE int sc_curstates=0; /* ID of the current state list */
SC_VDEFINE int pc_optimize=sOPTIMIZE_NOMACRO; /* (peephole) optimization level */
SC_VDEFINE int pc_memflags=0; /* special flags for the stack/heap usage */
SC_VDEFINE int sc_showincludes=0; /* show include files */
SC_VDEFINE constvalue sc_automaton_tab = { NULL, "", 0, 0}; /* automaton table */
SC_VDEFINE constvalue sc_state_tab = { NULL, "", 0, 0}; /* state table */