Main Page | Data Structures | File List | Data Fields | Globals

error.h File Reference

Standard error output methods. More...

Go to the source code of this file.

Defines

#define FATAL_ERROR(string)   lutil_error_fatal(string, __FILE__, __FUNCTION__, __LINE__)
 Display error and die.

#define ERROR(args...)   lutil_error(__FILE__, __FUNCTION__, __LINE__, args)
 Display error and continue.


Typedefs

typedef void(* UErrorFunc )(const char *string, const char *filename, const char *function, int lineno)
typedef int(* UPromptFunc )(const char *title, const char *msg, int nTotal, int nDefault, const char *choice1, va_list args)

Functions

void lutil_error_setErrorFunc (UErrorFunc errorFunc)
 Set a new function to display errors with.

void lutil_error_setPromptFunc (UPromptFunc promptFunc)
 Set a new function to prompt the user with.

void lutil_error_resetErrorFunc (void)
 Reset the error function to the default error function.

void lutil_error_resetPromptFunc (void)
 Reset the prompt function to the default prompt function.

void lutil_error_fatal (const char *string, const char *filename, const char *function, int lineno)
 Display an error and die.

int lutil_error_prompt (const char *title, const char *msg, int nTotal, int nDefault, const char *choice1,...)
 Prompt the user for input.

void lutil_error (const char *filename, const char *function, int lineno, const char *template,...) __attribute__((format(printf
 Display an error and continue.


Detailed Description

Standard error output methods.

Standard interface for displaying errors and prompting the user for input. Allows the program developer to define how errors are displayed and how prompts are shown while also providing default functions.

Definition in file error.h.


Define Documentation

#define ERROR args...   )     lutil_error(__FILE__, __FUNCTION__, __LINE__, args)
 

Display error and continue.

Definition at line 38 of file error.h.

Referenced by g_container_add(), g_container_convert(), g_container_copy(), g_container_destroy(), g_container_destroy_type(), g_container_free(), g_container_get_iter(), g_container_get_iter_last(), g_container_index(), g_container_new(), g_container_new_from_data(), g_container_remove(), g_container_remove_index(), g_container_remove_index_fast(), g_iterator_get(), g_iterator_hasNext(), g_iterator_hasPrev(), iterNext(), iterPrev(), luau_copyQuant(), luau_downloadUpdate(), luau_freePkgInfo(), luau_freeProgInfo(), luau_freeUpdateInfo(), luau_getUpdatePackage(), luau_install_deb(), luau_install_exec(), luau_install_rpm(), luau_install_src(), luau_installPackage(), luau_multPackageTypeString(), luau_net_downloadUpdate(), luau_net_queryServer(), luau_parseUpdateFileXML(), luau_satisfiesQuant(), lutil_ftp_downloadToFile(), lutil_ftp_getURL(), lutil_parse_nextToken_r(), lutil_uncompress(), lutil_vstrcreate(), parseGenericInfo(), parsePackage(), parseQuantData(), parseUpdate(), and parseUpdates().

#define FATAL_ERROR string   )     lutil_error_fatal(string, __FILE__, __FUNCTION__, __LINE__)
 

Display error and die.

Definition at line 36 of file error.h.


Typedef Documentation

typedef void(* UErrorFunc)(const char * string, const char* filename, const char* function, int lineno)
 

Definition at line 40 of file error.h.

typedef int(* UPromptFunc)(const char * title, const char* msg, int nTotal, int nDefault, const char *choice1, va_list args)
 

Definition at line 41 of file error.h.


Function Documentation

void lutil_error const char *  filename,
const char *  function,
int  lineno,
const char *  template,
... 
 

Display an error and continue.

void lutil_error_fatal const char *  string,
const char *  filename,
const char *  function,
int  lineno
 

Display an error and die.

Display a fatal error message and die. Cannot be overridden. Only called internally when there is a memory failure.

  • string is the error string
  • filename is the name of the source file where the error occured
  • function is the name of the function where the error occured
  • lineno is the line number where the error occured
    Returns:
    ... Never.

Definition at line 111 of file error.c.

int lutil_error_prompt const char *  title,
const char *  msg,
int  nTotal,
int  nDefault,
const char *  choice1,
... 
 

Prompt the user for input.

Prompt the user for input, using the defined prompt function (or the default, if none is defined). Default behavior is not to prompt the user at all, but instead to return the default value.

  • title is the name of the prompt
  • msg is the prompt to ask the user
  • nTotal is the number of options given
  • nDefault is the id of the default option (must be provided)
  • choice1 is the first choice
  • args is the rest of the choices
See also:
lutil_error_setPromptFunc

Definition at line 131 of file error.c.

References promptFunc_global.

Referenced by luau_downloadUpdate(), and luau_net_downloadUpdate().

void lutil_error_resetErrorFunc void   ) 
 

Reset the error function to the default error function.

Definition at line 91 of file error.c.

References defaultErrorFunc(), and errorFunc_global.

Referenced by luau_resetErrorFunc().

void lutil_error_resetPromptFunc void   ) 
 

Reset the prompt function to the default prompt function.

Definition at line 96 of file error.c.

References defaultPromptFunc(), and promptFunc_global.

Referenced by luau_resetPromptFunc().

void lutil_error_setErrorFunc UErrorFunc  errorFunc  ) 
 

Set a new function to display errors with.

Define a new function to be used for error output. The error function takes a number of pieces of information concerning where the error concerned, but any or all of them may be ignored in accordance with the user's discretion. Function should handle NULL values cleanly. Default behavior (as defined by defaultErrorFunc) is to simply display the error to STDERR in the following format:

 *** ERROR ***
 luau: FILENAME: FUNCTION: STRING

  • errorFunc is the new error function to use
  • string is the error string
  • filename is the name of the source file where the error occured
  • function is the name of the function where the error occured
  • lineno is the line number where the error occured
See also:
lutil_error

Definition at line 66 of file error.c.

References errorFunc_global.

Referenced by luau_registerErrorFunc().

void lutil_error_setPromptFunc UPromptFunc  promptFunc  ) 
 

Set a new function to prompt the user with.

Define a new function to be used for prompting the user for input. The default value, specified by nDefault, and the title (title) may be ignored. The prompt function should return the id of the value picked (first = 1, second = 2, etc.). Default behavior is to not prompt the user at all, and simply return the default value.

  • promptFunc is the new prompting function to use
  • title is the name of the prompt
  • msg is the prompt to ask the user
  • nTotal is the number of options given
  • nDefault is the id of the default option (must be provided)
  • choice1 is the first choice
  • args is the rest of the choices
See also:
lutil_error_prompt

Definition at line 86 of file error.c.

References promptFunc_global.

Referenced by luau_registerPromptFunc().


Generated on Mon Apr 12 22:17:11 2004 for luau by doxygen 1.3.2