HOME | Research | Media | Careers | Contacts | Products | Search | Publications | Site Map
CSIRO Mathematics, Informatics and Statistics

 

 

Image Analysis
Biotech Imaging Group
Application Areas
 Biotechnology
 Cellular Screening
 Health
 Asset Monitoring
 Exploration
 Other Areas
Skills
 Segmentation
 Feature Extraction
 Statistical Analysis
 Stereo Vision
 Image Motion
 
Projects
Imaging Services
Imaging Products
Track Record
Publications
Patents
Staff
next up previous contents
Next: The LIAR ASC interface Up: No Title Previous: Coupling

The LIAR Error reporting and Message system

There are many methods in which functions can report an error. The standard C run-time library mechanism predominately uses a global variable mechanism. However, this increases coupling and creates problems in asynchronous environments. Another technique that is commonly used--and is also to be avoided--is the use of error numbers and an associated write error module. In this latter approach, the caller passes an error-code number to the write error module, which then looks up the associated message in an error table that then gets printed out. The problem with this method is that it reduces observability, it is difficult to maintain because any modification affects the callee as well as the caller, and the calling routine actually losses control over its own messages.

The LIAR uses the simplest of all approaches. Each function returns an error value. The return value from a function indicates whether an error has occured or not and it is ZERO if no error has occurred or a nonzero value if an error has occured. Also the error message text is to be placed with the code that detects the error.

LIAR functions are not true functions in the classic sense: return values are communicated via parameters passed to LIAR functions by reference; that is, the input and output parameters are passed to the callee from the caller; for example:

/* prototype */
int getaverage(int *data, int n, float *result);

  :

if( getaverage(data,100,&result))         /* check for error */
      ADDmsg("error in average module");  /* message handler */

  :

Since a LIAR function cannot make assumptions about its environment, it cannot simply call printf or equivalent functions to put text on the screen. Rather this text must be controlled, so as to allow the system to display the messages in what ever fashion is suitable to its environment. Having said this, the LIAR message system does have a default display function called SHOWmsgs as seen in Table 1.

 

Function prototype Description
void SHOWmsgs(void); print out the message list
void CLEARmsgs(void); clear message list
int ADDmsg(const char * msg); add a message to the list
char ** GETmsgs(void); get the message list
int GETNumMsgs(void); get number of messages
#define GOTmsgs() (GETNumMsgs()>0) test for message
Table 1:   Message System

  figure167
Figure 5:   Example usages of the message system functions


next up previous contents
Next: The LIAR ASC interface Up: No Title Previous: Coupling

Ed Breen
Tue Sep 3 17:19:31 EST 1996

© Copyright 2013, CSIRO Australia
Use of this web site and information available from
it is subject to our
Legal Notice and Disclaimer and Privacy Statement