Sujet : Re: VMS Pascal article
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vmsDate : 03. Jan 2025, 17:45:59
Autres entêtes
Organisation : SunSITE.dk - Supporting Open source
Message-ID : <67781447$0$711$14726298@news.sunsite.dk>
References : 1 2
User-Agent : Mozilla Thunderbird
On 1/3/2025 10:11 AM, Dan Cross wrote:
In article <vl3pi8$2r2sr$1@dont-email.me>,
Arne Vajhøj <arne@vajhoej.dk> wrote:
VMS Pascal for C/Java/C# programmers:
https://www.vajhoej.dk/arne/articles/vmspascal.html
>
It is a "pre-release" - I am not sure I got it right.
>
So I would love some feedback.
C supports 'long double' which _may_ be the same as
`quadruple`, depending on the implementation, though
that's usually 80-bit floats.
Very good point. It is 128 bit on VMS unless using /L_DOUBLE=64.
Added.
I would not say that 'chr' and 'ord' are like casts in C.
Pascal is strongly, statically typed; C is weakly typed with
implicit conversions. Conversion between characters and integer
types in Pascal is an explicit operation, but `int c = 'a' + 1;`
is perfectly legal in C.
It was the best explanation I could come up with.
You give two C equivalents of, `round`: `lround` and
`ceil(v + 0.5)`. Surely the latter should be `trunc(v + 0.5)`:
Ooops. All ceil should be floor.
Fixed.
But, consider negative numbers,
Very good point.
I have added notes.
and note that one would still
have to do a conversion to an integer type.
Yes.
Fixed.
Your C equivalent of `substr` is not correct; exercise left to
the reader (consider what happens when `ix` is beyond the end of
the string). For that matter, this is true of the VSI Pascal
example as well: you should specify the preconditions that must
be true.
Invalid index or length causes an exception in VMS Pascal.
But I don't want to get into that level of detail.
`readln` and `fgets` are not similar in that `readln` strips the
line ending sequence, and `fgets` does not.
Close enough for the purpose of this article.
`f = fopen,fnm "r");` is an obvious typo.
`while not eof(f)) do` is an obvious typo.
Fixed.
You may want to mention that Pascal, the semicolon is a
statement separator, not a terminator, and hence why the last
"END" in the protocol is followed by "." and not ";".
The article is more what to do than why to do that.
The structure you present at the end as "equivalent" of a
varying character array is not correct. `integer16` is a signed
type, with a maximum value of 32,767. The length field for a
`varying [n] of char` is an integer subrange type with word
representation. That is, `length` is unsigned 0..max, where max
is <= 65,535.
Ooops.
You are right.
I was sure that the limit was 32K but it is 64K.
Fixed.
And also fixed in the description of VARYING further up.
Arne
Date | Sujet | # | | Auteur |
1 Jan 25 | VMS Pascal article | 72 | | Arne Vajhøj |
1 Jan 25 |  Re: VMS Pascal article | 3 | | Chris Townley |
1 Jan 25 |   Re: VMS Pascal article | 1 | | Arne Vajhøj |
1 Jan 25 |   Re: VMS Pascal article | 1 | | Dennis Boone |
2 Jan 25 |  Re: VMS Pascal article | 18 | | Marc Van Dyck |
2 Jan 25 |   Re: VMS Pascal article | 17 | | Arne Vajhøj |
3 Jan 25 |    Re: VMS Pascal article | 5 | | Lawrence D'Oliveiro |
3 Jan 25 |     Re: VMS Pascal article | 4 | | Arne Vajhøj |
3 Jan 25 |      Re: VMS Pascal article | 2 | | Lawrence D'Oliveiro |
3 Jan 25 |       Re: VMS Pascal article | 1 | | Robert A. Brooks |
3 Jan 25 |      Re: VMS Pascal article | 1 | | Simon Clubley |
3 Jan 25 |    Re: VMS Pascal article | 11 | | Arne Vajhøj |
3 Jan 25 |     Re: VMS Pascal article | 10 | | Robert A. Brooks |
3 Jan 25 |      Re: VMS Pascal article | 9 | | Arne Vajhøj |
3 Jan 25 |       Re: VMS Pascal article | 8 | | Robert A. Brooks |
3 Jan 25 |        Re: VMS Pascal article | 7 | | Arne Vajhøj |
3 Jan 25 |         Re: VMS Pascal article | 6 | | Robert A. Brooks |
4 Jan 25 |          Re: SDL, SDLC, PL/I (was Re: VMS Pascal article) | 5 | | Stephen Hoffman |
4 Jan 25 |           Re: SDL, SDLC, PL/I (was Re: VMS Pascal article) | 3 | | Arne Vajhøj |
6 Jan 25 |            Re: SDL, SDLC, PL/I (was Re: VMS Pascal article) | 2 | | Simon Clubley |
6 Jan 25 |             Re: SDL, SDLC, PL/I (was Re: VMS Pascal article) | 1 | | Robert A. Brooks |
4 Jan 25 |           Re: SDL, SDLC, PL/I (was Re: VMS Pascal article) | 1 | | Lawrence D'Oliveiro |
3 Jan 25 |  Re: VMS Pascal article | 1 | | David Meyer |
3 Jan 25 |  Re: VMS Pascal article | 24 | | Dan Cross |
3 Jan 25 |   Re: VMS Pascal article | 23 | | Arne Vajhøj |
3 Jan 25 |    Re: VMS Pascal article | 22 | | Dan Cross |
3 Jan 25 |     Re: VMS Pascal article | 21 | | Arne Vajhøj |
3 Jan 25 |      Re: VMS Pascal article | 20 | | Dan Cross |
3 Jan 25 |       Re: VMS Pascal article | 19 | | Arne Vajhøj |
3 Jan 25 |        Re: VMS Pascal article | 4 | | Dan Cross |
3 Jan 25 |         Re: VMS Pascal article | 2 | | Dan Cross |
4 Jan 25 |          Re: VMS Pascal article | 1 | | Arne Vajhøj |
4 Jan 25 |         Re: VMS Pascal article | 1 | | Arne Vajhøj |
3 Jan 25 |        Re: VMS Pascal article | 2 | | Lawrence D'Oliveiro |
4 Jan 25 |         Re: VMS Pascal article | 1 | | Arne Vajhøj |
5 Jan 25 |        Coding examples (Re: VMS Pascal article) | 12 | | David Meyer |
5 Jan 25 |         Re: Coding examples (Re: VMS Pascal article) | 2 | | Arne Vajhøj |
5 Jan 25 |          Re: Coding examples (Re: VMS Pascal article) | 1 | | Arne Vajhøj |
5 Jan 25 |         Re: Coding examples (Re: VMS Pascal article) | 9 | | Stephen Hoffman |
6 Jan 25 |          Re: Coding examples (Re: VMS Pascal article) | 8 | | Marc Van Dyck |
6 Jan 25 |           Re: Coding examples (Re: VMS Pascal article) | 1 | | Craig A. Berry |
6 Jan 25 |           Re: Coding examples (Re: VMS Pascal article) | 6 | | Arne Vajhøj |
6 Jan 25 |            Re: Coding examples (Re: VMS Pascal article) | 1 | | Arne Vajhøj |
7 Jan 25 |            Re: Coding examples (Re: VMS Pascal article) | 1 | | mjos_examine |
8 Jan 25 |            Re: Coding examples (Re: VMS Pascal article) | 3 | | Craig A. Berry |
8 Jan 25 |             Re: Coding examples (Re: VMS Pascal article) | 2 | | Arne Vajhøj |
8 Jan 25 |              Re: Coding examples (Re: VMS Pascal article) | 1 | | Lawrence D'Oliveiro |
4 Jan 25 |  Re: VMS Pascal article | 1 | | Martin Vorländer |
6 Jan 25 |  Re: VMS Pascal article | 23 | | John Reagan |
7 Jan 25 |   Re: VMS Pascal article | 22 | | John Reagan |
7 Jan 25 |    Re: VMS Pascal article | 20 | | Dan Cross |
7 Jan 25 |     Re: VMS Pascal article | 19 | | John Reagan |
8 Jan 25 |      Re: VMS Pascal article | 18 | | Dan Cross |
8 Jan 25 |       Re: VMS Pascal article | 17 | | Arne Vajhøj |
8 Jan 25 |        Re: VMS Pascal article | 5 | | Dan Cross |
9 Jan 25 |         Re: VMS Pascal article | 1 | | Arne Vajhøj |
9 Jan 25 |         Re: VMS Pascal article | 1 | | Simon Clubley |
9 Jan 25 |         Re: VMS Pascal article | 2 | | jayjwa |
10 Jan 25 |          Re: VMS Pascal article | 1 | | Craig A. Berry |
9 Jan 25 |        Re: VMS Pascal article | 11 | | Dave Froble |
9 Jan 25 |         Re: VMS Pascal article | 5 | | Arne Vajhøj |
9 Jan 25 |          Re: VMS Pascal article | 4 | | Dan Cross |
9 Jan 25 |           Re: VMS Pascal article | 3 | | Simon Clubley |
10 Jan 25 |            Re: VMS Pascal article | 2 | | Simon Clubley |
10 Jan 25 |             Re: VMS Pascal article | 1 | | Arne Vajhøj |
9 Jan 25 |         Re: VMS Pascal article | 5 | | Arne Vajhøj |
9 Jan 25 |          Re: VMS Pascal article | 2 | | Robert A. Brooks |
9 Jan 25 |           Re: VMS Pascal article | 1 | | Arne Vajhøj |
9 Jan 25 |          Re: VMS Pascal article | 2 | | Simon Clubley |
9 Jan 25 |           Re: VMS Pascal article | 1 | | Arne Vajhøj |
8 Jan 25 |    Re: VMS Pascal article | 1 | | Arne Vajhøj |
8 Jan 25 |  Re: VMS Pascal article | 1 | | Arne Vajhøj |