1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
|
GnuCOBOL TODO -*- outline -*-
The following is only a part of the things to do; many more
can be found in the issue trackers.
1 Pending requests
1.1 Handling of EBCDIC files
2 Other features to be implemented
2.1 New option handling.
A new configuration file, cobc.conf, is described in
https://sourceforge.net/p/gnucobol/feature-requests/342/
Integrate that file with existing command-line parsing,
allowing for overrides and warning-defeats as outlined in
that document.
2.2 New preprocessor support.
https://sourceforge.net/p/gnucobol/feature-requests/341/ defines
configuration for preprocessors. Add support for preprocessors to cobc.
Modify the -E option to be
-E [preprocessor]
meaning that all preprocessors should be run up to and including the
one named in the -E argument. If no argument is provided, -E
continues to work as currently.
2.3 Embedded SQL - ship as sample configurations for 2.2
esqlOC - preprocessor by Sergey Kashyrin.Sergey Kashryin (ODBC)
ocesql - https://github.com/opensourcecobol/Open-COBOL-ESQL (MySQL/ODBC)
PostgreSQL using epcpg, wrapper for COBOL by Frank Polscheit (ruby based)
http://lists.gnu.org/archive/html/gnucobol-users/2004-02/msg00053.html
Firebird (firebird.sourceforge.net) has a SQL preprocessor
for their database.
Oracle Pro*COBOL
3 Improvement of compiler internals
3.1 Error checking
3.1.1 Strict error checking depending on the standard
Mostly implemented
3.1.2 Use `error' token in the parser for better error recovery
3.1.3 detailed diagnostics with output of offending code (similar to gcc)
3.2 Data representations
3.2.1 Fix handling of 32bit, 64bit, and 128bit floating-point usages
3.2.2 Finish USAGE BINARY for sizes > 18 digits "COB_MAX_BINARY"
3.3 add checks
4 Optimization
4.1 More inlining of run-time functions
Done with various binary operands and expressions, open for some
intrinsic functions (actually using libcob at compile time).
4.2 generating multiple C functions for procedures
Currently, cobc translates a COBOL program into a single huge
C function. There are two problems with doing this:
- The speed of C compilation is very slow, especially when
optimization is enabled. Optimizing a single huge C function
is much slower than doing that for divided functions of it and
need a lot of memory - big COBOL sources break 32bit GCC
when compiling without -O0.
- Debugging the generated COBOL program with gdb is hard
because you cannot see performed procedures on the stack and
cannot skip PERFORM statement by the 'next' command.
Currently PERFORM is implemented by C's goto statement, so you
have to go there.
To solve these problems, we could separate COBOL sections into
multiple C functions, and use C function calls to execute each
section. As most of the memory is function-local this only works with
compilers that support nested functions (mostly GCC), with the currently
4.x only addition of placing the memory into one big block (as that can be
passed around).
However, this does not work for all cases _easily_. Consider
the following example:
SAMPLE-1 SECTION.
PERFORM SAMPLE-2.
PERFORM SAMPLE-3.
SAMPLE-2 SECTION.
GO TO SAMPLE-3.
SAMPLE-3 SECTION.
EXIT PROGRAM.
You might want to generate three functions SAMPLE_1, SAMPLE_2,
and SAMPLE_3. SAMPLE_1 might be defined as follows:
void SAMPLE_1 ()
{
SAMPLE_2 ();
SAMPLE_3 ();
}
But you cannot define SAMPLE_2 because you cannot jump from
one function to another function. SAMPLE_1 and SAMPLE_2 must
be defined within the same function, and thus you cannot call
them separately.
A similar problem occurs with "fall through" of paragraphs/sections.
To detect and avoid this kind of problems, we will need control
flow analysis of COBOL programs - the options -fsection-exit-check,
-fimplicit-goback-chec and cb_validate_perform_thru_ranges() partially
take care of this.
If a portion of program is used only through a PERFORM
statement, and if there is no GO TO statement that jumps
to outside of the portion, then we can safely separate the
portion as a C function.
As an alternative we have to have a global jump table (in the GCC
case we can use computed-goto, otherwise a switch to handle that):
prog () { prog_() }
prog_() {
auto void SAMPLE_1();
auto void SAMPLE_2();
auto void SAMPLE_3();
l_sample1:
void SAMPLE_1() {
SAMPLE_2();
if (gotoptr) goto gotoptr;
SAMPLE_3(); // never executed
if (gotoptr) goto gotoptr; // never executed
}
if (gotoptr) goto gotoptr; // never executed
l_sample2: // never executed
SAMPLE_2() {
gotoptr = l_sample3;
}
if (gotoptr) goto gotoptr; // never executed
l_sample3:
SAMPLE_3() {
gotoptr = l_exit;
}
if (gotoptr) goto gotoptr;
l_exit:
// over
}
As a third alternative we can just add a flag that says
"assume I never go out of a section".
4.3 optimizing cob_move_display_to_edited
This function is relative often called in production systems and
re-calculates the picture on runtime, which the compiler already
did - pass this information along with the call.
5 Debugging support
5.1 Data access method
We should generate all data hierarchy defined in a COBOL program
with all relevant information, including data names, picture clauses,
and source locations. We should also define a debugging function
that receives a data name and displays its value using the generated
data hierarchy. By calling the function from gdb, we can easily
access the COBOL data at debugging time.
Note: GnuCOBOL 3 implemented this partially, using extensions
near full GDB support is already possible.
GnuCOBOL 4 provides this quite complete at runtime, too.
6 Better user manual
Yes, we should, for now: refer to the GnuCOBOL Programmer's Guide
https://sourceforge.net/p/gnucobol/code/HEAD/tree/external-doc/guide/
|