A friend of mine wrote an extensive CAD program using HP-Pascal back in the mid 1980s. The program was used exclusively on HP workstations. HP had two variations of Pascal. One was a standalone operating environment, the other worked under HPUX. The CAD program was developed under the workstation version.
My friend would like to move this program to the PC world. One approach is "P2C" which converts HP-Pascal code to C. I just discovered GPC and would like to know if it is fairly compatible with HP-Pascal. I'm sure there would be a ton of rewriting that would be necessary whether the P2C or GPC approach is taken, but I would like to get a general idea of GPC compatibility. Thank you very much.
John Hardy
Hi!
On Sat, Nov 23, 2002 at 01:05:23PM -0600, John W. Hardy wrote:
My friend would like to move this program to the PC world. One approach is "P2C" which converts HP-Pascal code to C. I just discovered GPC and would like to know if it is fairly compatible with HP-Pascal.
Please tell me more about the non-standard features of HP-Pascal. (and contribute some code to play with :-)
Eike
On 23 Nov 2002 at 13:05, John W. Hardy wrote:
I just discovered GPC and would like to know if it is fairly compatible with HP-Pascal.
I have used the "Pascal/1000" (for HP 1000 minicomputers) and "Pascal/64000" (for the HP 64000 microprocessor development station) variants extensively. There was no single "HP Pascal," as I recall, as each variant (e.g., "/1000", "/3000", "/9000") was tuned a bit to support features relevant to the host platform. However, all of the variants essentially were what was to become ISO-7195 Pascal ("Classic Pascal") with extensions.
Some of those extensions (e.g., "OTHERWISE" in CASE statements) appeared verbatim in the later ISO-10206 Pascal ("Extended Pascal") standard, others (e.g., structured constants) appeared with different syntax, and still others (e.g., the predefined "overprint" procedure) remained HP- proprietary.
GPC supports ISO-7185 and ISO-10206 (and other Pascal variants) and so will support a large part of the HP Pascals. Some specific areas needing syntactic conversion attention would be compiler directives, structured constant representations, numeric constant representations, etc. I have used a simple "sed" script to perform this conversion from Pascal/64000 for use by GPC, so the syntactic conversion probably won't be too hard.
In general, GPC is much richer than the HP Pascals, so I would think that conversion to GPC would be quite a bit simpler than trying to convert to C.
-- Dave
"John W. Hardy" wrote:
A friend of mine wrote an extensive CAD program using HP-Pascal back in the mid 1980s. The program was used exclusively on HP workstations. HP had two variations of Pascal. One was a standalone operating environment, the other worked under HPUX. The CAD program was developed under the workstation version.
My friend would like to move this program to the PC world. One approach is "P2C" which converts HP-Pascal code to C. I just discovered GPC and would like to know if it is fairly compatible with HP-Pascal. I'm sure there would be a ton of rewriting that would be necessary whether the P2C or GPC approach is taken, but I would like to get a general idea of GPC compatibility. Thank you very much.
HPs Pascal was originally developed by Bob Fraley, and is basically ISO 7185 standard Pascal. I believe the only syntax extensions were the OTHERWISE clause for case statements, the array[firstindex FOR length] subarray construct, and provision for separate compilation by an isolated '.' ending the compilation without a normal outer code block. His original implementation made OTHERWISE a reserved word, which I avoided in PascalP at the cost of context sensitivity.
Any added standard procedures would be fairly system specific, although somebody mentioned 'overprint'. This simply flushes a line with a terminal <cr>, rather than a <crlf> combination (as from writeln), so that a following line overprints. 'prompt' is in the same category, except that no line termination characters are used, and is analagous to the C fflush() function. write, writeln, overprint, prompt should all share the same user syntax, with the difference being the handling of the output buffer and line termination characters. My memory has some dropped bits however.
OTHERWISE should work, right?
Someone being far too creative could try to implement those procs as a UNIT for compatibility.
I have no idea what the '.' thing is.
What about the array format? I am curious about that.
--- CBFalconer cbfalconer@yahoo.com wrote:
HPs Pascal was originally developed by Bob Fraley, and is basically ISO 7185 standard Pascal. I believe the only syntax extensions were the OTHERWISE clause for case statements, the array[firstindex FOR length] subarray construct, and provision for separate compilation by an isolated '.' ending the compilation without a normal outer code block. His original implementation made OTHERWISE a reserved word, which I avoided in PascalP at the cost of context sensitivity.
Any added standard procedures would be fairly system specific, although somebody mentioned 'overprint'. This simply flushes a line with a terminal <cr>, rather than a <crlf> combination (as from writeln), so that a following line overprints. 'prompt' is in the same category, except that no line termination characters are used, and is analagous to the C fflush() function. write, writeln, overprint, prompt should all share the same user syntax, with the difference being the handling of the output buffer and line termination characters. My memory has some dropped bits however.
===== ======= Frank D. Engel, Jr.
__________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
"Frank D. Engel, Jr." wrote:
--- CBFalconer cbfalconer@yahoo.com wrote:
HPs Pascal was originally developed by Bob Fraley, and is basically ISO 7185 standard Pascal. I believe the only syntax extensions were the OTHERWISE clause for case statements, the array[firstindex FOR length] subarray construct, and provision for separate compilation by an isolated '.' ending the compilation without a normal outer code block. His original implementation made OTHERWISE a reserved word, which I avoided in PascalP at the cost of context sensitivity.
Any added standard procedures would be fairly system specific, although somebody mentioned 'overprint'. This simply flushes a line with a terminal <cr>, rather than a <crlf> combination (as from writeln), so that a following line overprints. 'prompt' is in the same category, except that no line termination characters are used, and is analagous to the C fflush() function. write, writeln, overprint, prompt should all share the same user syntax, with the difference being the handling of the output buffer and line termination characters. My memory has some dropped bits however.
OTHERWISE should work, right?
Someone being far too creative could try to implement those procs as a UNIT for compatibility.
I have no idea what the '.' thing is.
The syntax of the outer block is "BEGIN <statements> END ." Everything after the final '.' in the source is ignored, allowing various annotations etc. in the source. The early versions used the omission of "BEGIN <statements> END" to signify that this was a separately compiled module which contained only GLOBAL functions and procedures. If there were global variables and types they had to be specified in a separate file and included in the module, using whatever (extension) include mechanism is available. Pascal as originally designed was expected to compile only a single source file.
What about the array format? I am curious about that.
Probably no longer there.
BTW, please DO NOT top-post. I corrected this one.
Frank D. Engel, Jr. wrote:
OTHERWISE should work, right?
Yep, it's part of EP.
the array[firstindex FOR length] subarray construct,
EP has `array [firstindex .. lastindex]'. I think only for strings, but GPC allows it for all arrays.
His original implementation made OTHERWISE a reserved word, which I avoided in PascalP at the cost of context sensitivity.
GPC tries to as well, but in the case of `otherwise' it turns it on for the whole `case' block currently, i.e. an identifier `Otherwise' could not be used in any case branch. Changing that might be possible, but with quite some extra effort (more read-ahead etc.). I wonder if that's really useful (same for other "conditional keywords").
Any added standard procedures would be fairly system specific, although somebody mentioned 'overprint'. This simply flushes a line with a terminal <cr>, rather than a <crlf> combination (as from writeln), so that a following line overprints. 'prompt' is in the same category, except that no line termination characters are used, and is analagous to the C fflush() function.
Someone being far too creative could try to implement those procs as a UNIT for compatibility.
Or a module, of course. :-)
Except for the implicit use of `Output', IIUIC.
GPC has `Flush' (which is currently mostly a dummy, since the RTS does not buffer output, and when it will, it will probably at least flush all terminal output automatically before any input) ...
CBFalconer wrote:
BTW, please DO NOT top-post. I corrected this one.
Me too. :-)
Frank
On 4 Dec 2002 at 3:38, CBFalconer wrote:
I believe the only syntax extensions were the OTHERWISE clause for case statements, the array[firstindex FOR length] subarray construct, and provision for separate compilation by an isolated '.' ending the compilation without a normal outer code block.
See:
http://docs.hp.com/hpux/onlinedocs/92431-90013/92431-90013.html
The "Introduction" chapter has a section titled "Extensions to ANSI/IEEE and ISO Pascal." It mentions quite a few additional things but not the "array FOR" construct you cite. Indeed, having used HP Pascal on a number of different systems, I have never encountered that construct. Do you know on what system it was implemented?
My memory has some dropped bits however.
Haven't we all! ;-)
-- Dave
"J. David Bryan" wrote:
On 4 Dec 2002 at 3:38, CBFalconer wrote:
I believe the only syntax extensions were the OTHERWISE clause for case statements, the array[firstindex FOR length] subarray construct, and provision for separate compilation by an isolated '.' ending the compilation without a normal outer code block.
See:
http://docs.hp.com/hpux/onlinedocs/92431-90013/92431-90013.html
The "Introduction" chapter has a section titled "Extensions to ANSI/IEEE and ISO Pascal." It mentions quite a few additional things but not the "array FOR" construct you cite. Indeed, having used HP Pascal on a number of different systems, I have never encountered that construct. Do you know on what system it was implemented?
It was in the original 16 bit integer system Bob developed, and published in the HPUG for the HP3000 back around 1978 or so. It probably got criticized out.
On 4 Dec 2002 at 15:24, CBFalconer wrote:
It was in the original 16 bit integer system Bob developed, and published in the HPUG for the HP3000 back around 1978 or so. It probably got criticized out.
Must have. It doesn't appear in my "PASCAL/3000 Pocket Guide" from 1982.
-- Dave