Menu

#103 ACCEPT / DISPLAY syntax enhancements

unclassified
closed
5 - default
2022-02-17
2016-01-16
wim niemans
No

The current snapshot allows for specifying an AT clause and a WITH clause on DISPLAY and ACCEPT. These oddities are observed:

DISPLAY "hello" LINE 15 POSITION 20
is equivalent with
DISPLAY "hello" AT LINE 15 POSITION 20

DISPAY "hello" LINE 15 POSITION 20 WITH .....
DISPAY "hello" AT LINE 15 POSITION 20 WITH .....
all compile okay. But

DISPAY "hello" WITH ...... LINE 15 POSITION 20
does not recognize LINE and
DISPAY "hello" WITH .... AT LINE 15 POSITION 20
does not recognize AT.

The compiler demands obviously that AT and WIDTH are encountered in their very sequence whilst AT might be omitted and WITH may not be omitted.

The proposal is to allow for optional clauses AT and WITH, and that they may be in any order.

Add to this the syntax DISPAY OMITTED to allow for just screen positioning. The workaround is to code DISPLAY SPACE, which looks funny, is ambiguous (one space or padding complete screen?), and destroys at least one character on the screen.

Related

Bugs: #196

Discussion

  • Edward Hart

    Edward Hart - 2016-01-23
    • labels: screen --> screen section
     
  • Simon Sobisch

    Simon Sobisch - 2016-01-23
    • status: open --> accepted
    • assigned_to: Edward Hart
     
  • Simon Sobisch

    Simon Sobisch - 2016-01-23

    Assigned to Ed as he does a lot of good work on the screen i/o.

    @Ed, please leave a short note here: "yes/no" "in some months/soon". You're free to split this into multiple tickets (some of these points are likely duplicates, too).

    Here's the ToDo:

    • allow all clauses to be in any order
    • " Different formats of the DISPLAY statement may be mixed together in one DISPLAY statement, as long as no ambiguity results. The effect is the same as specifying each DISPLAY statement separately." (quote from ACUCOBOL-GT), if this one is not in already it's a bit more ToDo as this changes codegeneration (the parser should split the display into multiple statements)
    • add DISPAY OMITTED to allow for just screen positioning (I thought this was in already...)
    • take care of the [AT] LINE issue Wim described in the ticket
    • put all these to the testsuite (syntax screen checks)

    Simon

     
    • Edward Hart

      Edward Hart - 2016-01-26

      I can begin work on the first and fourth points and then DISPLAY OMITTED. I'll think I'llleave the mixed-format ACCEPT statement for now.

       
      • Simon Sobisch

        Simon Sobisch - 2016-01-26

        Sounds good. You can either stop after the first parts (please open a new ticket for the missing parts then) or go on from this.

        Simon

         
    • Edward Hart

      Edward Hart - 2016-02-01

      I'm struggling to fix a shift/reduce error. I essentially have the following:

      :::c
      display_list:
        display_atom
      | display_list display_atom
      ;
      
      display_atom:
        x_list display_atom_clauses
      | x_list 
      ;
      

      The errror occurs in display_atom. I'd like to shift as much into the x_list as possible and then reduce to either first or second cases (based on the presence of a display_atom_clause), but I'm not sure how to (or whether it's possible this way). Do you have any ideas on what to do?

       
      • Simon Sobisch

        Simon Sobisch - 2016-02-01

        The following may help, or not...

        display_list:
          display_atom
        | display_list
        ;
        
        display_atom:
          x_list opt_display_atom_clauses
        ;
        
        opt_display_atom_clauses:
          /* Empty */
        | display_atom_clauses
        ;
        

        Simon

         
        • Edward Hart

          Edward Hart - 2016-02-01

          No, I still get the same error.

           
          • Simon Sobisch

            Simon Sobisch - 2016-02-01

            Could be because of display_atom_clauses, couldn't it? What does happen if you replace it by something like SELECT { /* Ignore */ } (just for testing purposes)?

            Simon

             
          • Simon Sobisch

            Simon Sobisch - 2016-02-01
            display_list:
              display_atom
            | display_list display_atom
            ;
            

            Was correct, of course. If you cannot fix it directly then the %prec modfier should help.

             
  • Edward Hart

    Edward Hart - 2016-02-12

    Attached is the first version of the patch with most of the requested additions. DISPLAY OMITTED is omitted and only the screen and device formats of the DISPLAY statement can be mixed (which I think is enough; do people really want to mix with DISPLAY ... UPON ARGUMENT-NUMBER or UPON ENVIRONMENT-VALUE?).

     
    • Simon Sobisch

      Simon Sobisch - 2016-02-12

      Looks good. I see no reason for not comitting the patch and go on to DISPLAY OMITTED, if make checkall and your manual testsuite and still work as expected and the posted sources by wim do, too.

      For DISPLAY OMITTED: ACCEPT set the tree for OMITTED to cb_null, resets it directly before the final cb_emit to NULL and the cob_accept function in libcob only waits if the passed field is NULL. Sounds like a plan for display, too :-)

       
  • Simon Sobisch

    Simon Sobisch - 2016-07-12

    Ed, looks like I missed something here.

    Old version has:

    ::c
    display_upon:
      /* empty */
      {
        if (current_program->flag_console_is_crt) {
            $$ = cb_null;
        } else {
            $$ = cb_int0;
        }
    

    and works perfectly for

    ::cobol
           SPECIAL-NAMES.
                console is crt.
            [..]
                        DISPLAY 'Warning: ' WITH NO ADVANCING END-DISPLAY
                        DISPLAY WS-PRFX WS-MSG END-DISPLAY
    

    while [r760] prevents this by

    ::c
                if (display_on_crt) {
                    cb_error ("Cannot display item upon CRT without LINE or COLUMN");
                    return;
                }
    

    Can you please recheck this issue?

     
    • Edward Hart

      Edward Hart - 2016-07-12

      That's [bugs:#246], which I've been working on for the past week. I should have a fix ready soon.

       

      Related

      Bugs: #246

      • Simon Sobisch

        Simon Sobisch - 2016-07-12

        Thank you for the feedback. Looking forward to your change :-)

         
  • Edward Hart

    Edward Hart - 2016-07-18

    As of [r996], here is the status of all the requests:

    • allow all clauses to be in any order: done.
    • allow mixing of different DISPLAY formats: rejected. I don't have an ACUCOBOL compiler, so I'm not sure what they considered to be "unambiguous". All I know is that the more I thought about it, the less happy was that any mixing could be unambiguous. GnuCOBOL now follows the syntax of Micro Focus.
    • DISPLAY OMITTED: not yet done. (In the meantime, you can use DISPLAY LOW-VALUE ... to move the cursor.)
    • optional position clauses: done.
    • testsuite entries: done.
     

    Last edit: Edward Hart 2016-07-18
    • Simon Sobisch

      Simon Sobisch - 2016-12-20

      @Edward: Is there any reason to not simply pass cb_null or a pendant for low-value to the display generation and do cursor position / belling as we do when the passed field is low-value?

       
      • Edward Hart

        Edward Hart - 2016-12-20

        I think DISPLAY OMITTED is a more powerful version of DISPLAY LOW-VALUE. For instance, DISPLAY OMITTED, SIZE 5, REVERSE can be used to swap the colours of the five characters following the cursor. I'm not sure if DISPLAY LOW-VALUE, SIZE 5, REVERSE has the same effect.

         
        • Simon Sobisch

          Simon Sobisch - 2016-12-20

          You're correct. Can you please set this as unfinished instead of PENDING and emit the simple NULL variant? This way we have it working for positioning an bell immediately and can see/check in some months (with a very low priority) if/how we want to change it. Or wait to receive a patch file from someone who needs this to work.

           
          • Edward Hart

            Edward Hart - 2016-12-21

            Done in [r1308].

             
  • Simon Sobisch

    Simon Sobisch - 2016-12-21
    • status: accepted --> closed
     
  • Simon Sobisch

    Simon Sobisch - 2016-12-21

    @Ed: Thank you for your work in this area.

     
  • wim niemans

    wim niemans - 2022-02-15

    Release 3.1.2. DISPLAY OMITTED generates a libcob: error: codegen error.
    Detected on android tablet using termux from f-droid.
    gnuCobol packaged on januari 2022.

     
  • Eugenio Di Lorenzo

    please see also FR #367 A way to change attributes (ex. colors) on the screen.

    May be it is now implemented ? with
    Ron Norman committed [r4555]
    Implement DISPLAY OMITTED

     

    Related

    Commit: [r4555]


Log in to post a comment.

MongoDB Logo MongoDB