I'm having trouble understanding the DEFINE CONSTANT statement. I know
that:
1) It is a variant of the DECLARE statement.
2) It declares constants rather than variables.
3) It can only appear at the top of a package, procedure, or begin-block.
What I'm unclear on is how you specify its value. The IBM, Kednos, and
VOS manuals have nothing to say about DEFINE CONSTANT. The ANSI standard isn't very helpful either. Is the INITIAL attribute used, or is this
where the VALUE attribute comes in (also undocumented)?
e.g. DECLARE PI VALUE (3.1415928E0) FLOAT (10);
.
This is an example of a named constant.
On Monday, September 5, 2022 at 4:53:26 PM UTC-4, Robin Vowels wrote:
e.g. DECLARE PI VALUE (3.1415928E0) FLOAT (10);
.
This is an example of a named constant.
Ah, thanks. But the DEFINE CONSTANT statement is part of ANSI
X3.74-1987, the revised version of PL/I Subset G. So I assume it looks like:
DEFINE CONSTANT PI VALUE(3.1415928E0) FLOAT(10);
I'm working on a reference manual for Subset G based on the Kednos
reference manual. I removed everything that's not in the ANSI standard, which is straightforward, and added everything that is not in Kednos but
is in the ANSI standard, which requires understanding of those things.
The VOS and IBM manuals provide most of what I need, but the truly new
things like DEFINE CONSTANT and the enquiry functions require deciphering
the ANSI standard. The concrete and abstract syntax are easy enough, but
the semantics are defined by writing a PL/I interpreter in English prose,
and that's not easy to understand.
Does Kednos use “OPTIONS(CONSTANT)”, like Multics?
Your manual sounds like a worthwhile project.
On Monday, September 5, 2022 at 4:53:26 PM UTC-4, Robin Vowels wrote:understanding of those things. The VOS and IBM manuals provide most of what I need, but the truly new things like DEFINE CONSTANT and the enquiry functions require deciphering the ANSI standard. The concrete and abstract syntax are easy enough, but the
e.g. DECLARE PI VALUE (3.1415928E0) FLOAT (10);Ah, thanks. But the DEFINE CONSTANT statement is part of ANSI X3.74-1987, the revised version of PL/I Subset G. So I assume it looks like:
.
This is an example of a named constant.
DEFINE CONSTANT PI VALUE(3.1415928E0) FLOAT(10);
I'm working on a reference manual for Subset G based on the Kednos reference manual. I removed everything that's not in the ANSI standard, which is straightforward, and added everything that is not in Kednos but is in the ANSI standard, which requires
On Monday, September 5, 2022 at 4:53:26 PM UTC-4, Robin Vowels wrote:understanding of those things. The VOS and IBM manuals provide most of what I need, but the truly new things like DEFINE CONSTANT and the enquiry functions require deciphering the ANSI standard. The concrete and abstract syntax are easy enough, but the
e.g. DECLARE PI VALUE (3.1415928E0) FLOAT (10);Ah, thanks. But the DEFINE CONSTANT statement is part of ANSI X3.74-1987, the revised version of PL/I Subset G. So I assume it looks like:
.
This is an example of a named constant.
DEFINE CONSTANT PI VALUE(3.1415928E0) FLOAT(10);
I'm working on a reference manual for Subset G based on the Kednos reference manual. I removed everything that's not in the ANSI standard, which is straightforward, and added everything that is not in Kednos but is in the ANSI standard, which requires
On Monday, September 5, 2022 at 8:23:28 PM UTC-4, bearlyabus...@gmail.com wrote:
Does Kednos use “OPTIONS(CONSTANT)”, like Multics?
No, it doesn't.
Your manual sounds like a worthwhile project.
I'm glad to hear you think so.
My next step, assuming I live so long, is to write a PL/I-to-GNU-C
compiler. I've figured out a list of extensions to Subset G (complex numbers, C interoperability, FIXED BINARY numbers with nonzero scales,
etc.) and a bunch of existing C packages that will help (DECIMAL FIXED
and FLOAT, non-local GOTOs, ISAM files, etc.) Two packages that I'll
need to write are for pictures and for formats, with help from sprintf().
The compiler, at least its first version, will be written in Python and
will use a PEG parser.
That would be great. There was a GNU PL/I project a while ago, but that seems to be dead. Have you thought about targeting the Gnu intermediate language, whatever it’s called, instead of C?
On Tuesday, September 6, 2022 at 2:31:41 PM UTC-4, bearlyabus...@gmail.com wrote:
That would be great. There was a GNU PL/I project a while ago, but that
seems to be dead. Have you thought about targeting the Gnu intermediate
language, whatever it’s called, instead of C?
Yes, for about five minutes. :-)
PL/I's data model is really very close to C, so that it should be very
easy to make the languages interoperate without much fuss. Each PL/I compilation unit foo.pli will produce both a foo.c and a foo.h file so
that it will be possible to invoke PL/I procedures from C (modulo the
main procedure will have to be in PL/I to set up the default condition processing, etc.)
It would be very nice if something could be written to take a .h file and produce a PL/I equivalent, but the difficulty is that .h files are just random fragments of C that don't have to cohere: pretty much every
language except C++ has this problem. I tried looking into SWIG, which
is supposed to do this job, but it failed on most of the .h files I tried
it on and its output is fiendishly complex. Most of the things labeled "alternatives to SWIG" are very specialized.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 376 |
Nodes: | 16 (2 / 14) |
Uptime: | 02:02:42 |
Calls: | 8,012 |
Calls today: | 2 |
Files: | 13,022 |
Messages: | 5,821,729 |