Re: error handling template

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue, 8 Aug 2006 11:38:42 -0600 (MDT)

>Could someone provide a short archtypal
>template for handling errors in NCL?

>I would like to write some code of this form:

>load "/usr/local/include/ncarg/hlu/hlu.h"

>do while(true)
> try a function
> if (Error_at_ErrorCode .eq. NOERROR)
> clear error code
> execute statement
> break
> else
> execute alternative statement
> end if
> clear error code
>end do

>I am not sure how to include the library,
>initialize the error object,
>access the current error code, or clear the error code.
-----------------------------------------------------------

You sound like a computer science guy! All this object stuff!
Pretty soon you will be calling the functions/procedures
 'methods'. Makes me nervous responding!

[1] Are you using the "hlu.h"? I *think* that is a bunch
    of C-code interfaces. If you want information
    from that specific library then one of the NCL
    core developers will have to respond. One or
    more is attending an Apple conference this week
    so the response will likely be delayed.
    
[2] If what you mean is something like the following.
    Let foo.ncl have a function
    
    undef ("foo1")
    function foo1 (....)
    local ....
    begin
      :
      x_at_error = False ; no error condition encountered
      :
      x_at_error = True ; error condition encountered
      :
      return(x)
    end
   --------------------

    load "/my/fav/ncl_library/foo.ncl"
    begin
      :
      do ...
         x = foo1(....) ; contained in foo.ncl
         if (.not.x_at_error) then
             x2 = x^2 ; must have been no error encountered :-)
                         ; u r a genius
         else
             x2 = 2*x ; a boo-boo must have occurred :-(
                         ; u r not a genius
         end if
         
         :
         
         delete(x) ; perhaps, x will change shape/size/type
                         ; next iteration
      end do
        
    end
    

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 08 2006 - 11:38:42 MDT

This archive was generated by hypermail 2.2.0 : Wed Aug 09 2006 - 08:25:35 MDT