|
OpenCOBOL 1.1pre-rel
|
#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 | |
| 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) |
| void ambiguous_error | ( | cb_tree | x | ) |
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);
}
/* display error on the first time */
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;
/* display all fields with the same name */
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, |
| ... | |||
| ) |
Definition at line 85 of file error.c.
{
va_list ap;
va_start (ap, fmt);
print_error (NULL, 0, "Error: ", fmt, ap);
va_end (ap);
errorcount++;
}

| void cb_error_x | ( | cb_tree | x, |
| const char * | fmt, | ||
| ... | |||
| ) |
Definition at line 110 of file error.c.
{
va_list ap;
va_start (ap, fmt);
print_error ((char *)(x->source_file), x->source_line, "Error: ", fmt, ap);
va_end (ap);
errorcount++;
}

| int cb_verify | ( | const enum cb_support | tag, |
| const char * | feature | ||
| ) |
Definition at line 122 of file error.c.
{
switch (tag) {
case CB_OK:
return 1;
case CB_WARNING:
return 1;
case CB_ARCHAIC:
if (cb_warn_archaic) {
cb_warning (_("%s is archaic in %s"), feature, cb_config_name);
}
return 1;
case CB_OBSOLETE:
if (cb_warn_obsolete) {
cb_warning (_("%s is obsolete in %s"), feature, cb_config_name);
}
return 1;
case CB_SKIP:
return 0;
case CB_IGNORE:
cb_warning (_("%s ignored"), feature);
return 0;
case CB_ERROR:
return 0;
case CB_UNCONFORMABLE:
cb_error (_("%s does not conform to %s"), feature, cb_config_name);
return 0;
}
return 0;
}


| void cb_warning | ( | const char * | fmt, |
| ... | |||
| ) |
Definition at line 73 of file error.c.
{
va_list ap;
va_start (ap, fmt);
print_error (NULL, 0, "Warning: ", fmt, ap);
va_end (ap);
warningcount++;
}

| void cb_warning_x | ( | cb_tree | x, |
| const char * | fmt, | ||
| ... | |||
| ) |
Definition at line 98 of file error.c.
{
va_list ap;
va_start (ap, fmt);
print_error ((char *)(x->source_file), x->source_line, "Warning: ", fmt, ap);
va_end (ap);
warningcount++;
}

| char* check_filler_name | ( | char * | name | ) |
| void group_error | ( | cb_tree | x, |
| const char * | clause | ||
| ) |
Definition at line 250 of file error.c.
{
cb_error_x (x, _("Group item '%s' cannot have %s clause"), check_filler_name (cb_name (x)), clause);
}

| void level_except_error | ( | cb_tree | x, |
| const char * | clause | ||
| ) |
Definition at line 270 of file error.c.
{
cb_error_x (x, _("Level %02d item '%s' cannot have other than %s clause"),
cb_field (x)->level, check_filler_name (cb_name (x)), clause);
}


| void level_redundant_error | ( | cb_tree | x, |
| const char * | clause | ||
| ) |
Definition at line 256 of file error.c.
{
cb_error_x (x, _("Level %02d item '%s' cannot have %s clause"),
cb_field (x)->level, check_filler_name (cb_name (x)), clause);
}

| void level_require_error | ( | cb_tree | x, |
| const char * | clause | ||
| ) |
Definition at line 263 of file error.c.
{
cb_error_x (x, _("Level %02d item '%s' requires %s clause"),
cb_field (x)->level, check_filler_name (cb_name (x)), clause);
}


| void redefinition_error | ( | cb_tree | x | ) |
Definition at line 154 of file error.c.
{
struct cb_word *w;
w = CB_REFERENCE (x)->word;
cb_error_x (x, _("Redefinition of '%s'"), w->name);
cb_error_x (CB_VALUE (w->items), _("'%s' previously defined here"), w->name);
}


Definition at line 164 of file error.c.
{
struct cb_word *w;
w = CB_REFERENCE (x)->word;
cb_warning_x (x, _("Redefinition of '%s'"), w->name);
if (y) {
cb_warning_x (y, _("'%s' previously defined here"), w->name);
} else {
cb_warning_x (CB_VALUE (w->items), _("'%s' previously defined here"), w->name);
}
}


| void undefined_error | ( | cb_tree | x | ) |
Definition at line 178 of file error.c.
{
struct cb_reference *r;
cb_tree c;
if (!errnamebuff) {
errnamebuff = cobc_malloc (COB_NORMAL_BUFF);
}
r = CB_REFERENCE (x);
snprintf (errnamebuff, COB_NORMAL_MAX, "'%s'", CB_NAME (x));
for (c = r->chain; c; c = CB_REFERENCE (c)->chain) {
strcat (errnamebuff, " in '");
strcat (errnamebuff, CB_NAME (c));
strcat (errnamebuff, "'");
}
cb_error_x (x, _("%s undefined"), errnamebuff);
}


1.7.4