Main Page | Class List | Directories | File List | Class Members | File Members

msg.c File Reference

#include "awk.h"

Go to the source code of this file.

Functions

void err (const char *s, const char *emsg, va_list argp)
void msg (va_alist)
void warning (va_alist)
void error (va_alist)
void set_loc (const char *file, int line)
void r_fatal (va_alist)

Variables

int sourceline = 0
char * source = NULL
static const char * srcfile = NULL
static int srcline


Function Documentation

void err const char *  s,
const char *  emsg,
va_list  argp
 

Definition at line 38 of file msg.c.

References _, FILENAME_node, FNR, myname, NULL, source, sourceline, srcfile, and srcline.

Referenced by add_epsilon_src_nodes(), calc_eclosure(), calc_eclosure_iter(), check_matching(), check_subexp_limits(), check_subexp_matching_top(), clean_state_log_if_need(), create_cd_newstate(), create_ci_newstate(), create_initial_state(), create_newstate_common(), duplicate_node_closure(), error(), merge_state_array(), msg(), proceed_next_node(), push_fail_stack(), r_fatal(), re_compile_internal(), re_search_internal(), regexec(), sift_states_backward(), sift_states_bkref(), sub_epsilon_src_nodes(), update_cur_sifted_state(), warning(), and yyerror().

00039 {
00040         char *file;
00041 
00042         (void) fflush(stdout);
00043         (void) fprintf(stderr, "%s: ", myname);
00044 #ifdef GAWKDEBUG
00045         if (srcfile != NULL) {
00046                 fprintf(stderr, "%s:%d:", srcfile, srcline);
00047                 srcfile = NULL;
00048         }
00049 #endif /* GAWKDEBUG */
00050         if (sourceline != 0) {
00051                 if (source != NULL)
00052                         (void) fprintf(stderr, "%s:", source);
00053                 else
00054                         (void) fprintf(stderr, _("cmd. line:"));
00055 
00056                 (void) fprintf(stderr, "%d: ", sourceline);
00057         }
00058         if (FNR > 0) {
00059                 file = FILENAME_node->var_value->stptr;
00060                 (void) putc('(', stderr);
00061                 if (file)
00062                         (void) fprintf(stderr, "FILENAME=%s ", file);
00063                 (void) fprintf(stderr, "FNR=%ld) ", FNR);
00064         }
00065         (void) fprintf(stderr, "%s", s);
00066         vfprintf(stderr, emsg, argp);
00067         (void) fprintf(stderr, "\n");
00068         (void) fflush(stderr);
00069 }

void error va_alist   ) 
 

Definition at line 129 of file msg.c.

References _, and err().

00132 {
00133         va_list args;
00134 #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
00135         va_start(args, mesg);
00136 #else
00137         char *mesg;
00138 
00139         va_start(args);
00140         mesg = va_arg(args, char *);
00141 #endif
00142         err(_("error: "), mesg, args);
00143         va_end(args);
00144 }

void msg va_alist   ) 
 

Definition at line 83 of file msg.c.

References err().

00086 {
00087         va_list args;
00088 #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
00089         va_start(args, mesg);
00090 #else
00091         char *mesg;
00092 
00093         va_start(args);
00094         mesg = va_arg(args, char *);
00095 #endif
00096         err("", mesg, args);
00097         va_end(args);
00098 }

void r_fatal va_alist   ) 
 

Definition at line 165 of file msg.c.

References _, err(), and exit.

00168 {
00169         va_list args;
00170 #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
00171         va_start(args, mesg);
00172 #else
00173         char *mesg;
00174 
00175         va_start(args);
00176         mesg = va_arg(args, char *);
00177 #endif
00178         err(_("fatal: "), mesg, args);
00179         va_end(args);
00180 #ifdef GAWKDEBUG
00181         abort();
00182 #endif
00183         exit(2);
00184 }

void set_loc const char *  file,
int  line
 

Definition at line 149 of file msg.c.

References srcfile, and srcline.

00150 {
00151         srcfile = file;
00152         srcline = line;
00153 
00154         /* This stupid line keeps some compilers happy: */
00155         file = srcfile; line = srcline;
00156 }

void warning va_alist   ) 
 

Definition at line 107 of file msg.c.

References _, and err().

00110 {
00111         va_list args;
00112 #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
00113         va_start(args, mesg);
00114 #else
00115         char *mesg;
00116 
00117         va_start(args);
00118         mesg = va_arg(args, char *);
00119 #endif
00120         err(_("warning: "), mesg, args);
00121         va_end(args);
00122 }


Variable Documentation

char* source = NULL
 

Definition at line 29 of file msg.c.

int sourceline = 0
 

Definition at line 28 of file msg.c.

const char* srcfile = NULL [static]
 

Definition at line 31 of file msg.c.

Referenced by err(), and set_loc().

int srcline [static]
 

Definition at line 32 of file msg.c.

Referenced by err(), and set_loc().


© sourcejam.com 2005-2008