gnucobol-users
[Top][All Lists]
Advanced

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

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


From: Sergey Kashyrin
Subject: Re: [open-cobol-list] Re: OC issues (more)
Date: Wed Jan 18 12:24:08 2006

Roger,

No, we cannot comment it out.

Of course we can't. I did that only to test. At least it gives an error correctly if you 
do "perform xx thru dupname"

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

Yes, we can add that for dialects.
Instead of checking for NULL which can't happen, we better check for dialect.

+         if(p == NULL) { /* actually it can't be NULL so we can skip that */

Depending on group/elementary definition, consider :
  02
     05
    03
     05

My understanding is that interpretation is always like this:
  02
      03 FILLER.
     05
    03
     05

----- Original Message ----- From: "Roger While" <address@hidden>
To: "Sergey Kashyrin" <address@hidden>
Cc: <address@hidden>
Sent: Wednesday, January 18, 2006 12:40 PM
Subject: [open-cobol-list] Re: OC issues (more)


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






-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list


reply via email to

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