Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions check/features.frm
Original file line number Diff line number Diff line change
Expand Up @@ -3289,3 +3289,33 @@ Local test = diagrams_(PHI3,{phi},{phi},{q1,q2},{q1,p2},1,0);
.end
assert runtime_error?('Invalid repeated momentum in diagrams_: q1')
*--#] diagrams_err_8 :
*--#[ warnings_1 :
#-
#define TEST "10"
#: MaxTermSize 50K
.sort
Local test = `TEST';
Print;
.end
assert stdout =~ exact_pattern(<<'EOF')
Warning: ignoring out-of-place setup command:
1.frm Line 4 ==> #: MaxTermSize 50K
EOF
assert result("test") =~ expr("10")
*--#] warnings_1 :
*--#[ warnings_2 :
#-
#: SmallSize 200M
#: LargeSize 500M
#define TEST "10"
#: MaxTermSize 50K
.sort
Local test = `TEST';
Print;
.end
assert stdout =~ exact_pattern(<<'EOF')
Warning: ignoring out-of-place setup command:
1.frm Line 6 ==> #: MaxTermSize 50K
EOF
assert result("test") =~ expr("10")
*--#] warnings_2 :
11 changes: 10 additions & 1 deletion sources/pre.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,16 @@ int PreProInstruction(void)
&& AP.PreIfStack[AP.PreIfLevel] == EXECUTINGIF )
AC.NoShowInput = 0;
}
else if ( *t == ':' ) {}
else if ( *t == ':' ) {
AP.FoundFileSetupCount--;
if ( AP.FoundFileSetupCount < 0 ) {
// This implies that TryFileSetups found fewer #: setup lines than
// are present in the file. This means that some were specified
// out-of-order, i.e. after a non-comment non-#: line. Warn.
MesPrint("Warning: ignoring out-of-place setup command:");
MesPrint("@%#%s", t);
}
}
else {
retry:;
key = FindKeyWord(t,precommands,sizeof(precommands)/sizeof(KEYWORD));
Expand Down
3 changes: 3 additions & 0 deletions sources/setfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,7 @@ int TryFileSetups(void)
int oldNoShowInput = AC.NoShowInput;
UBYTE buff[SETBUFSIZE+1], *s, *t, *u, *settop, c;
LONG linenum, prevline;
AP.FoundFileSetupCount = 0;

if ( AC.CurrentStream == 0 ) return(error);
oldstream = AC.CurrentStream - AC.Streams;
Expand All @@ -1200,6 +1201,8 @@ int TryFileSetups(void)
while ( c != '\n' && c != ENDOFINPUT ) c = GetInput();
continue;
}
// Count the number of file setup parameters found
AP.FoundFileSetupCount++;
s = buff;
while ( ( c = GetInput() ) == ' ' || c == '\t' || c == '\r' ) {}
if ( c == ENDOFINPUT ) break;
Expand Down
1 change: 1 addition & 0 deletions sources/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,7 @@ struct P_const {
int PreAssignLevel; /* For nesting #$name = ...; assignments */
int MaxPreAssignLevel; /* For nesting #$name = ...; assignments */
int fullnamesize; /* size of the fullname buffer */
int FoundFileSetupCount; /* The number of "file setup" (#:) lines */
WORD DebugFlag; /* (P) For debugging purposes */
WORD preError; /* (P) Blocks certain types of execution */
UBYTE ComChar; /* (P) Commentary character */
Expand Down
Loading