<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<small>Greetings,<br>
I've updated</small> <small>the code to use pj_ctx_set_errno.
Thanks! What is the command line flag for displaying the error
code/error string?<br>
<br>
Thanks<br>
<br>
On 01/11/11 09:45, Frank Warmerdam wrote:</small>
<blockquote
cite="mid:CA+YzLBdrsjnz8-WMCWMZoSyprFDMo4E0s-MRrtkT+Dr7-zDbmg@mail.gmail.com"
type="cite">
<pre wrap="">On Mon, Oct 31, 2011 at 1:31 PM, Michael Speth
<a class="moz-txt-link-rfc2396E" href="mailto:spethm@landcareresearch.co.nz"><spethm@landcareresearch.co.nz></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi Frank,
There are 4 errors that I want to generate which are only in the inverse
projections and not the forward. However, the E_ERROR directive seems to
only work in the ENTRY and SETUP functions (because it returns an int).
>From looking at proj.c, the forward or inverse functions are called after
the setup code which includes the ENTRY0; I think that I am unable to check
in the ENTRY0 directive for the error conditions for inverse projections.
Is this correct?
So should I use the I_ERROR directive in this case? If so, it doesn't seem
to allow for entering errno values (its defined as -20). Can I create a new
directive similar to E_ERROR(err) but for I_ERROR?
</pre>
</blockquote>
<pre wrap="">
Michael,
I would actually encourage you to actually explicitly call
the error code instead of using the opaque I_ERROR
or a similar macro. For instance in PJ_tmerc.c I now do:
/*
* Fail if our longitude is more than 90 degrees from the
* central meridian since the results are essentially garbage.
* Is error -20 really an appropriate return value?
*
* <a class="moz-txt-link-freetext" href="http://trac.osgeo.org/proj/ticket/5">http://trac.osgeo.org/proj/ticket/5</a>
*/
if( lp.lam < -HALFPI || lp.lam > HALFPI )
{
xy.x = HUGE_VAL;
xy.y = HUGE_VAL;
pj_ctx_set_errno( P->ctx, -14 );
return xy;
}
Best regards,
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Michael Speth
Scientific Programmer
Landcare Research</pre>
</body>
</html>