-
Notifications
You must be signed in to change notification settings - Fork 1
[Feature] ifdiff::ignore
The user can instruct the preprocessing to let an if statement of their right-hand-side code be untouched.
If statements to be ignored must be preceded by a comment containing the ignorestring, which currently is 'ifdiff::ignore'.
The ignorestring can be looked up at:
makeConfig.m --> config.preprocess_ignorestring.
The feature can come in handy for debugging or error messages, for example.
The following code would be left untouched.
function dx = RHS(t,x,p)
if ~isnumeric(t) % ifdiff::ignore
error('Input *t* must be numeric.');
end
The ignorestring must directly follow the line of code containing the if keyword. In particular, it SHOULD NOT be placed after the next line of code as in the following example.
function dx = RHS(t,x,p)
if ~isnumeric(t)
error('Input *t* must be numeric.'); % ifdiff::ignore
end
The preprocessing would try to replace the if in this example by a ctrlif.
An ignorestring prohibits processing in contained if statements too, but not the processing of functions. In this example, the function 'log_state' would be replaced by a preprocessed (i.e., changed) version:
function dx = RHS(t,x,p)
if ~isnumeric(t) % ifdiff::ignore
log_state(t,x,p);
end
The string that is detected by the preprocessing (ignorestring) can be changed.
It is specified in
makeConfig.m --> config.preprocess_ignorestring.
It is planned to extend ifdiff::ignore's scope of effectiveness to function calls too if the effort is moderate.