The routine would not put elements at the right place in the residuals
vector (it would use variable indices instead of equation indices).
Also change the routine so that it computes a residual on evaluated
equations (instead of systematically returning zero for those).
Finally, simplify resid.m by calling this routine instead of embedding a
similar code.
Ref. #1823
Rather use a single vector as in non-block mode.
By the way, change the order of output arguments in static functions, to be
closer to the dynamic ones.
Because at some point throwing exceptions from MEX files (with mexErrMsgTxt())
was not working under Windows 64-bit, we had designed a workaround to avoid
using exceptions.
Most MEX files were returning an error code as their first (or sometimes last)
argument, and that code would have to be checked from the MATLAB code.
Since this workaround is no longer needed, this commit removes it. As a
consequence, the interface of many MEX files is modified.
For some background, see https://www.dynare.org/pipermail/dev/2010-September/000895.html