gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] Re: OC issues (more)


From: Roger While
Subject: [open-cobol-list] Re: OC issues (more)
Date: Wed Jan 18 09:41:08 2006

No, we cannot comment it out.
The test has to stay for SECTION names.
We need different tests depending on section/paragraph.
Problem is that the same routine is called from parser.y.
Checking now. (probably need to duplicate the routine)

The level patch I will take a look at, but I can say now
that we would need to make it dependent on a config option
(ie allowed in -std=mf/ibm, not allowed in cobol85/2002 etc).

I recall there was a discussion on this issue some
time ago. The problem is trying to second-guess what is
meant. It is very prone to incorrect interpretation.
Depending on group/elementary definition, consider :
  02
     05
    03
     05

Roger

Roger,

Yes, it looks not necessary.
For the test I've commented out return and replaced redefinition_error by redefinition_warning.
Test went ok.

And here is the patch for the first issue (which is about misaligned/missed levels)
G:\open-cobol\cobc>diff -u /open-cobol-0.33/cobc/field.c field.c
--- /open-cobol-0.33/cobc/field.c       Sun Jan 08 08:00:00 2006
+++ field.c     Tue Jan 17 18:12:36 2006
@@ -154,14 +154,35 @@
    {
      /* upper level */
      struct cb_field *p;
-      for (p = last_field->parent; p; p = p->parent)
-       if (p->level == f->level)
-         {
-           last_field = p;
-           goto same_level;
+         for (p = last_field->parent; p; p = p->parent) {
+               if (p->level == f->level)
+               {
+                       last_field = p;
+                       goto same_level;
+               }
+               if (p->level < f->level)
+                       break;
+         }
+         if(p == NULL) { /* actually it can't be NULL so we can skip that */
+ cb_error_x (name, _("no previous data item of level %02d"), f->level);
+                 return cb_error_node;
+         } else {
+                 cb_tree fil = cb_build_filler();
+                 struct cb_reference *rfil = CB_REFERENCE (fil);
+                 struct cb_field *ffil = CB_FIELD (cb_build_field (fil));
+ cb_warning_x (name, _("no previous data item of level %02d"),f->level);
+                 ffil->level = f->level;
+                 ffil->storage = storage;
+                 ffil->children = p->children;
+                 ffil->parent = p;
+                 for(p = p->children; p != NULL; p = p->sister) {
+                         p->parent = ffil;
+                 }
+                 ffil->parent->children = ffil;
+                 ffil->sister = f;
+                 f->parent = ffil->parent;
+                 last_field = ffil;
         }
-      cb_error_x (name, _("no previous data item of level %02d"), f->level);
-      return cb_error_node;
    }

  /* inherit parent's properties */


----- Original Message ----- From: "Roger While" <address@hidden>
To: <address@hidden>
Cc: <address@hidden>
Sent: Wednesday, January 18, 2006 8:56 AM
Subject: Re: OC issues (more)


Well the problem is caused by this code in typeck.c line 302 :
        if (CB_REFERENCE (name)->word->count > 0) {
                cb_tree x = CB_VALUE (CB_REFERENCE (name)->word->items);
                /* used as a non-label name or used as a section name or
                   used as the same paragraph name in the same section */
                if (!CB_LABEL_P (x) || CB_LABEL (x)->section == NULL
                    || CB_LABEL (x)->section == current_section) {
                        redefinition_error (name);
                        return cb_error_node;
                }
The first test is OK (i think) but I wonder why we do the
subsequent tests ?
Hmm.
Uniqueness is checked later.
Roger






reply via email to

[Prev in Thread] Current Thread [Next in Thread]