Menu

#27 add acucobol accept/​display external form

GC 3.x
open
None
5 - default
2017-12-10
2016-04-25
wim niemans
No

Patch for [feature-requests:#100].
Compiled, tested on iMac OSX and runs oke, but is not yet complete.
Missing: a few configuration variables.
Missing: fields with occurs <integer> times.
Bug: will accept: DISPLAY 'abc' ABC. </integer>

@Simon: I am not sure if all used variables are freed properly. Please check.
Also, please check the naming scheme of entries and variables.

Attachment patch.zip contains the original files, the patched files and individual patches made with diff.
Attachment cgi4cobolTEST.zip contains test/demo programs, generated C.

2 Attachments

Related

Wish List: #100
Patches: #27

Discussion

  • wim niemans

    wim niemans - 2016-04-26

    I've published this because I will be offline for a few weeks. So, you can take your time.
    I am looking forward for your comments.

    All patches, when complete, will be donated to gnuCobol or will use a license of choice by gnuCobol.
    Cheers.

     

    Last edit: wim niemans 2016-04-26
  • wim niemans

    wim niemans - 2016-06-13

    Herewith the final patches, this time based on the bracnch of gnucobol 2.0, commit 904.
    Including an example program, configuration options, and documentation of the syntax.

     
  • Simon Sobisch

    Simon Sobisch - 2017-06-11

    Thank you wim for the work you've done on this - and a big SORRY that the review took that long.
    Because of the delay in my part this is a target for GnuCOBOL 2.3 (if released) or 3.0.

    The code looks good, the Changelog entries are ok and the sample is nice. The sample only misses an entry for a multiple repeated CGI variable "this occurs when multiple items have been selected in a choose many list" [whatever this means]) but we can add this part later - this is likely the "fields with occurs <integer> times missing" part.</integer>

    Something that should be added later (when some things in common.c changed - I'll come back to this) is to allow multiple paths in HTML_TEMPLATE_PREFIX which we should rename to HTML_TEMPLATE_PATH in the first commit already (as we parse it different than acu [space seperated vs. path delimiter]).

    Something that should be changed is the memory management using cob_malloc and cob_free.

    Some questions:

    • It is maybe better to handle error messages in cgi.c as cob_fatal_error as you abort (does ACUCOBOL the same?). In any case it should exit with cob_stop_run (1);, shouldn't it?
    • Shouldn't it be somehow possible to set CGI_CONTENT_TYPE different for multiple cgi files or would these have a different environment/configuration file in any case?
    • What does happen with ACUCOBOL if you run these programs in a non-cgi environment (for example directly on command line)?
    • What compilers did you used for testing?
    • Which CGI environment did you use for testing this ((just out of interest)?
    • What configuration variables do you think are missing?

    One thing that is missing is a patch for test/syn_misc.at to check for the actual compiler warnings you've integrated, it would be nice if you could provide it, too.

    As you see: I'd really like to include your changes ASAP (even if it is not well tested we could integrate it very soon as it is a completely new feature).

    Would you be willing to assign the copyright to the Free Software Foundation, so that we could install it in GnuCOBOL sources? See [Copyright reassignment]

     

    Related

    Wiki: Copyright reassignment


    Last edit: Simon Sobisch 2017-06-11
    • wim niemans

      wim niemans - 2017-06-12

      The sample only misses an entry for a multiple repeated CGI variable "this occurs when multiple items have been selected in a choose many list" [whatever this means]) but we can add this part later - this is likely the "fields with occurs <integer> times missing" part.</integer>

      The example contains a repeated CGI variable: 'D'. It has an occurs clause and its name is used 3 times. The 'choose many list' option is the HTML "<SELECT MULTIPLE ...." and has the same effect. A repeated "<INPUT TYPE=TEXT...." is used because you can see the value in the page, wich is not possible with "<SELECT MULTIPLE....". Nevertheless it can be done in the example.

      to allow multiple paths in HTML_TEMPLATE_PREFIX which we should rename to HTML_TEMPLATE_PATH in the first commit already (as we parse it different than acu [space seperated vs. path delimiter]).

      There are two implications with this whish:
      1. I know that the algorithm is available in gnuCOBOL.c, but was not able to locate this in the source and I had no further information how to handle this. So I left it out.
      2. Apparently a path with a space will not be handled ?

       

      Last edit: wim niemans 2017-06-12
      • Simon Sobisch

        Simon Sobisch - 2017-06-12

        Thank you for your answer to these two points.

        There are two implications with this whish:
        1. I know that the algorithm is available in gnuCOBOL.c, but was not able to locate this in the source and I had no further information how to handle this. So I left it out.
        2. Apparently a path with a space will be handled.

        yes, that is the reason for my note

        Something that should be added later (when some things in common.c changed - I'll come back to this

        The first integrated version doesn't need to handle it, I've started to move the code to common.c allowing it to be used by COB_LIBRARY_PATH (it is currently only in there) and later for multiple paths in COB_FILE_PATH (I want to do so before integrating [feature-requests:#131]) and HTML_TEMPLATE_PATH.
        The only thing that should change for now in this place is the name of the configuration setting (the others can stay with the ACU-names as we'll interpret them identical).

        Can you revise the topic and answer the other points, too?

         

        Related

        Wish List: #131

  • Simon Sobisch

    Simon Sobisch - 2017-06-12

    Answer to one of my questions is found in the docs:

    To avoid overriding other Content-Type associations, we suggest that you create a different configuration file for each of the MIME Content-Type associations that you make in your Web server setup.

    Most of the relevant information is found in the ACUCOBOL docs A Programmer's Guide to the Internet -> Launching Web Applications Through CGI.

    Note: I'll update some of the cobc parts soon to recognize the syntax already, the provided notes are OK and with some additions this can be integrated already. The libcob parts are definitely compley enough for a copyright and therefore can only officially be integrated with papers signed.

     
  • wim niemans

    wim niemans - 2017-06-12

    To answer your questions:

    It is maybe better to handle error messages in cgi.c as cob_fatal_error as you abort (does ACUCOBOL the same?). In any case it should exit with cob_stop_run (1);, shouldn't it?

    ACU does the same in my version (acuGT 5.6). I agree on the exit method.

    Shouldn't it be somehow possible to set CGI_CONTENT_TYPE different for multiple cgi files or would these have a different environment/configuration file in any case?

    What does happen with ACUCOBOL if you run these programs in a non-cgi environment (for example directly on command line)?

    ACU does nearly the same, but there is no help display: ACU reads from SYSIN, suitable for shells.
    The current code tests the query string and tries to get the post variables from input.
    However, there is a fuzzy effect in acu if a SCREEN section is involved too. ACU features the -b switch for batched rununits, which prevents the initialization of the screen. I'm not sure that gnuCobol features such too.

    • In my code I am using a screen section. Depending on a custom environment variable cgi calls are issued or interactive accept/display are used. This makes my code runnable as a terminal-cli or a web page, while the source is greatly minimalised.

    What compilers did you used for testing?

    gnuCobol 2,0 branche 904, 945 and rc1, rc2

    Which CGI environment did you use for testing this ((just out of interest)?

    Apache, ngi on macOSx, Xitami on Windows XP, and terminal-cli on macOSx and a dosBox on Windows.
    Would like to test on BSD but cannot install gnuCobol because it is a hosted environment.

    What configuration variables do you think are missing?

    Haven't thought about that.

    One thing that is missing is a patch for test/syn_misc.at to check for the actual compiler warnings you've integrated, it would be nice if you could provide it, too.

    Found such a file in branches / gnu-cobol-2.0 / tests / testsuite.src / but have no idea what it means or does.

    As you see: I'd really like to include your changes ASAP (even if it is not well tested we could integrate it very soon as it is a completely new feature).

    It is tested very well.

    Would you be willing to assign the copyright to the Free Software Foundation, so that we could install it in GnuCOBOL sources? See [Copyright reassignment]

    Sure.

     

    Related

    Wiki: Copyright reassignment

  • Simon Sobisch

    Simon Sobisch - 2017-08-07
    • Group: GC 22 --> GC 2.3
     
  • Simon Sobisch

    Simon Sobisch - 2017-08-07

    Wim, can you please extend the patch to add the system library call C$GETCGI? Looks like this has to do something with these changes, too.
    It would be an entry in libcob/system.def that points to a new function in libcob/cgi.c.
    You've mentioned EXEC HTML earlier but this is likely more complex to add as it needs lexer changes.

     
  • Simon Sobisch

    Simon Sobisch - 2017-08-07

    I've applied the patch for the cobc part and adjusted it to the current code.
    When adding the minimal testcases (all samples from the ACU docs added as "must compile error free" test) I've was prompted with different errors which I've fixed. Together with the Changelog entry this is in 2.x branch now (will try to merge it to trunk this evening).

    @Wim: Please create a new patch based on what is in 2.x branch (or what is in trunk after my merge)? I think only minimal changes to the cobc part will be needed (I've added a HACK that should be fixed, see tree.c around line 905 /* FIXME: Hack for CGI to not abort */). libcob likely needs some adjustments and parts need to be added completely (just see the testcase that was added with [r1915], for example the "debugging purposes" DISPLAY of an EXTERNAL-FROM without a template and the "static" displays). In general we need better syntax test cases (at least an entry for every error message we raise in the cgi code parts).

    If you don't want to work with patch files I can create a short-term feature branch for this, just drop a note.

     

    Last edit: Simon Sobisch 2017-08-07
  • Simon Sobisch

    Simon Sobisch - 2017-10-29

    Ping@Wim: Do you have any chance to look into the issues mentioned in the messages on 2017-08-07 [now against trunk]?

     
    • wim niemans

      wim niemans - 2017-11-01

      I will do so around november 15th. I have to reinstall my test environment.

      Cheers,
      Wim

      Sent while transmuting using my iPhone. Hope this find you well.

      Op 29 okt. 2017 om 13:35 heeft Simon Sobisch sf-mensch@users.sf.net het volgende geschreven:

      Ping@Wim: Do you have any chance to look into the issues mentioned in the messages on 2017-08-07 [now against trunk]?

      [patches:#27] add acucobol accept/​display external form

      Status: open
      Group: GC 2.3
      Created: Mon Apr 25, 2016 02:10 PM UTC by wim niemans
      Last Updated: Mon Aug 07, 2017 04:05 PM UTC
      Owner: Simon Sobisch
      Attachments:

      cgi4cobolTEST.zip (24.2 kB; application/zip)
      patch.zip (235.5 kB; application/zip)
      Patch for [feature-requests:#100].
      Compiled, tested on iMac OSX and runs oke, but is not yet complete.
      Missing: a few configuration variables.
      Missing: fields with occurs <integer> times.
      Bug: will accept: DISPLAY 'abc' ABC.</integer>

      @Simon: I am not sure if all used variables are freed properly. Please check.
      Also, please check the naming scheme of entries and variables.

      Attachment patch.zip contains the original files, the patched files and individual patches made with diff.
      Attachment cgi4cobolTEST.zip contains test/demo programs, generated C.

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/open-cobol/patches/27/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Wish List: #100
      Patches: #27


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.