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.
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
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.
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 toHTML_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
andcob_free
.Some questions:
cob_fatal_error
as you abort (does ACUCOBOL the same?). In any case it should exit withcob_stop_run (1);
, shouldn't it?CGI_CONTENT_TYPE
different for multiple cgi files or would these have a different environment/configuration file in any case?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
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.
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
Thank you for your answer to these two points.
yes, that is the reason for my note
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 inCOB_FILE_PATH
(I want to do so before integrating [feature-requests:#131]) andHTML_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
Answer to one of my questions is found in the docs:
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.
To answer your questions:
ACU does the same in my version (acuGT 5.6). I agree on the exit method.
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.
gnuCobol 2,0 branche 904, 945 and rc1, rc2
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.
Haven't thought about that.
Found such a file in branches / gnu-cobol-2.0 / tests / testsuite.src / but have no idea what it means or does.
It is tested very well.
Sure.
Related
Wiki: Copyright reassignment
Diff:
Related
Wish List: #100
Please note that there is a more actual patch: patchBuild904.zip https://sourceforge.net/p/open-cobol/patches/_discuss/thread/3cd48898/5dcf/attachment/patchBuild904.zip
see https://sourceforge.net/p/open-cobol/patches/27/#5dcf https://sourceforge.net/p/open-cobol/patches/27/#5dcf
Wim
Last edit: 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.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 anEXTERNAL-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
Ping@Wim: Do you have any chance to look into the issues mentioned in the messages on 2017-08-07 [now against trunk]?
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.
Related
Wish List: #100
Patches: #27