#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "cobc.h"
#include "tree.h"
Go to the source code of this file.
Functions |
static void | print_error (char *file, int line, const char *prefix, const char *fmt, va_list ap) |
char * | check_filler_name (char *name) |
void | cb_warning (const char *fmt,...) |
void | cb_error (const char *fmt,...) |
void | cb_warning_x (cb_tree x, const char *fmt,...) |
void | cb_error_x (cb_tree x, const char *fmt,...) |
int | cb_verify (const enum cb_support tag, const char *feature) |
void | redefinition_error (cb_tree x) |
void | redefinition_warning (cb_tree x, cb_tree y) |
void | undefined_error (cb_tree x) |
void | ambiguous_error (cb_tree x) |
void | group_error (cb_tree x, const char *clause) |
void | level_redundant_error (cb_tree x, const char *clause) |
void | level_require_error (cb_tree x, const char *clause) |
void | level_except_error (cb_tree x, const char *clause) |
Variables |
static char * | errnamebuff = NULL |
Function Documentation
Definition at line 197 of file error.c.
{
struct cb_word *w;
struct cb_field *p;
struct cb_label *l2;
cb_tree l;
cb_tree y;
w = CB_REFERENCE (x)->word;
if (w->error == 0) {
if (!errnamebuff) {
errnamebuff = cobc_malloc (COB_NORMAL_BUFF);
}
snprintf (errnamebuff, COB_NORMAL_MAX, "'%s'", CB_NAME (x));
for (l = CB_REFERENCE (x)->chain; l; l = CB_REFERENCE (l)->chain) {
strcat (errnamebuff, " in '");
strcat (errnamebuff, CB_NAME (l));
strcat (errnamebuff, "'");
}
cb_error_x (x, _("%s ambiguous; need qualification"), errnamebuff);
w->error = 1;
for (l = w->items; l; l = CB_CHAIN (l)) {
y = CB_VALUE (l);
snprintf (errnamebuff, COB_NORMAL_MAX, "'%s' ", w->name);
switch (CB_TREE_TAG (y)) {
case CB_TAG_FIELD:
for (p = CB_FIELD (y)->parent; p; p = p->parent) {
strcat (errnamebuff, "in '");
strcat (errnamebuff, p->name);
strcat (errnamebuff, "' ");
}
break;
case CB_TAG_LABEL:
l2 = CB_LABEL (y);
if (l2->section) {
strcat (errnamebuff, "in '");
strcat (errnamebuff, (const char *)(l2->section->name));
strcat (errnamebuff, "' ");
}
break;
default:
break;
}
strcat (errnamebuff, _("defined here"));
cb_error_x (y, errnamebuff);
}
}
}
void cb_error |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
void cb_error_x |
( |
cb_tree |
x, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
int cb_verify |
( |
const enum cb_support |
tag, |
|
|
const char * |
feature |
|
) |
| |
void cb_warning |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
void cb_warning_x |
( |
cb_tree |
x, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
char* check_filler_name |
( |
char * |
name | ) |
|
Definition at line 64 of file error.c.
{
if (!memcmp (name, "WORK$", 5)) {
name = (char *)"FILLER";
}
return name;
}
void group_error |
( |
cb_tree |
x, |
|
|
const char * |
clause |
|
) |
| |
void level_except_error |
( |
cb_tree |
x, |
|
|
const char * |
clause |
|
) |
| |
void level_redundant_error |
( |
cb_tree |
x, |
|
|
const char * |
clause |
|
) |
| |
void level_require_error |
( |
cb_tree |
x, |
|
|
const char * |
clause |
|
) |
| |
static void print_error |
( |
char * |
file, |
|
|
int |
line, |
|
|
const char * |
prefix, |
|
|
const char * |
fmt, |
|
|
va_list |
ap |
|
) |
| [static] |
Definition at line 34 of file error.c.
{
static struct cb_label *last_section = NULL;
static struct cb_label *last_paragraph = NULL;
file = file ? file : cb_source_file;
line = line ? line : cb_source_line;
if (current_section != last_section || current_paragraph != last_paragraph) {
if (current_paragraph &&
strcmp ((const char *)(current_paragraph->name), "MAIN PARAGRAPH")) {
fprintf (stderr, _("%s: In paragraph '%s':\n"),
file, current_paragraph->name);
} else if (current_section &&
strcmp ((const char *)(current_section->name), "MAIN SECTION")) {
fprintf (stderr, _("%s: In section '%s':\n"),
file, current_section->name);
}
last_section = current_section;
last_paragraph = current_paragraph;
}
fprintf (stderr, "%s:%d: %s", file, line, prefix);
vfprintf (stderr, fmt, ap);
fputs ("\n", stderr);
}
void redefinition_error |
( |
cb_tree |
x | ) |
|
Variable Documentation