Skip to content
Merged
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
90 changes: 90 additions & 0 deletions check/features.frm
Original file line number Diff line number Diff line change
Expand Up @@ -1187,3 +1187,93 @@ else
assert runtime_error?('Could not create sort file: bad_path\xformxxx.sor')
end
*--#] TempSortDir_windows :
*--#[ ZeroUnchanged :
#-

#procedure exprinfo
#message Module `CMODULE_':
#do e = {`activeexprnames_'}
#if `ZERO_`e''
#message zero `e': `ZERO_`e''
#endif
#if `UNCHANGED_`e''
#message unchanged `e': `UNCHANGED_`e''
#endif
#enddo
#if `ZERO_'
#message All zero: `ZERO_'
#endif
#if `UNCHANGED_'
#message All unchanged: `UNCHANGED_'
#endif
#message
#endprocedure


Off stats;

Symbol x,y;

Local test1 = x;
Local test2 = y;
Local test3 = 1;
.sort:1;

#call exprinfo
Identify x = 0;
.sort:2;

#call exprinfo
Identify y = 0;
.sort:3;

#call exprinfo
.sort:4;

#call exprinfo
Multiply 0;
.sort:5;

#message Here, test3 is incorrectly flagged as unchanged:
#call exprinfo
Print;
.end
assert succeeded?
assert result("test1") =~ expr("0")
assert result("test2") =~ expr("0")
assert result("test3") =~ expr("0")
assert stdout =~ exact_pattern(<<'EOF')
~~~Module 2:
~~~
~~~Module 3:
~~~zero test1: 1
~~~unchanged test2: 1
~~~unchanged test3: 1
~~~
~~~Module 4:
~~~zero test1: 1
~~~unchanged test1: 1
~~~zero test2: 1
~~~unchanged test3: 1
~~~
~~~Module 5:
~~~zero test1: 1
~~~unchanged test1: 1
~~~zero test2: 1
~~~unchanged test2: 1
~~~unchanged test3: 1
~~~All unchanged: 1
~~~
~~~Here, test3 is incorrectly flagged as unchanged:
~~~Module 6:
~~~zero test1: 1
~~~unchanged test1: 1
~~~zero test2: 1
~~~unchanged test2: 1
~~~zero test3: 1
~~~unchanged test3: 1
~~~All zero: 1
~~~All unchanged: 1
~~~
EOF
*--#] ZeroUnchanged :
8 changes: 8 additions & 0 deletions doc/manual/prepro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ \section{The preprocessor variables}
#endif
#enddo
\end{verbatim}
\item[UNCHANGED\_] Takes the value 1 if all active expressions were unchanged in the
previous module, and 0 otherwise. `UNCHANGED\_exprname' is 1 if the
expression ``exprname'' was unchanged in the previous module, and
0 otherwise.
\item[ZERO\_] Takes the value 1 if all active expressions were zero in the
previous module, and 0 otherwise. `ZERO\_exprname' is 1 if the
expression ``exprname'' was zero in the previous module, and
0 otherwise.
\end{description}

\noindent If \FORM\ cannot find a preprocessor variable, because it has
Expand Down