[Simh] anyone know how to convert/translate turbo pascal to vax pascal?

Dan Gahlinger dgahling at hotmail.com
Thu Feb 8 12:21:36 EST 2018


so here you go, a simple file compare I wrote using "freepascal" (freepascal.org) and I've done what I can to convert it to vms pascal
but it doesn't compile.

code:
Program fcomp(input,output);
var
  f, g, h : text;
  s, t, u : varying [255] of char;
  c, d : char;
  i : integer;
begin
  s := 'first.txt';
  t := 'second.txt';
  u := 'output.txt';
  i := 0;
  assign(f,s);
  reset(f);
  assign(g,t);
  reset(g);
  assign(h,u);
  rewrite(h);
  while (not(eof(f))) do
    begin
      read(f,c);
      read(g,d);
      i := i + 1;
      if (c <> d) then
        writeln(h,i,' = 1:[',c,']/',ord(c),' 2:[',d,']/',ord(d));
    end;
  close(f);
  close(g);
  close(h);
end.

errors:
 pas fcomp.pas
00016      0  1   assign(f,s);
                  1
%PASCAL-E-UNDECLID, (1) Undeclared identifier ASSIGN
at line number 16 in file DUA1:[DAN]FCOMP.PAS;4
%PASCAL-E-ENDDIAGS, PASCAL completed with 1 diagnostic

________________________________
From: Clem Cole <clemc at ccc.com>
Sent: February 8, 2018 10:58 AM
To: Dan Gahlinger
Cc: Gary Lee Phillips; Tim Shoppa; simh at trailing-edge.com
Subject: Re: [Simh] anyone know how to convert/translate turbo pascal to vax pascal?

Dan,

As others have said something smells wrong here.  It's true the original '71 report from Wirth did not defined I/O and '72 revised report only defined write.  By the time of the Jensen & Wirth book from Springer-Verlag in the mid-late '70s writeln is there.  And by the time of the first standard efforts @ IEEE and ANSI it very much in the language.  I do have an old copy ANSI/IEEE770X3.97-1983 "American National Standard Pascal Computer Programming Language" which on page 93 (Section 6.9.3) defines the required standard Pascal function writeln:
6.9.4 The Procedure Writeln.
The syntax of the parameter list of writeln shall be:

writeln-parameter-list = [ "(" ( file-variable | write-parameter )
                              | "," write-parameter | ")" ] .

Writeln shall only be applied to textfiles. If the file-variable or the writeln-parameter-list is omitted, the procedure shall be applied to the required textfile output.

From a quick search on the HP web site (http://h41379.www4.hpe.com/commercial/pascal/pascal_index.html ) I found reference to the SPD and the site says:  :

HP Pascal (formerly known as Compaq Pascal and DEC Pascal) runs on OpenVMS for VAX systems, OpenVMS for AlphaServer systems, and OpenVMS for Integrity servers. With HP Pascal, your source code investment is not only protected, it is extended.

HP Pascal supports code compatible with either level of the ISO specification, meets Federal Information Processing Standard Publications (FIPS-109) requirements, and supports many features from the Extended Pascal Standard. HP Pascal has a solid reputation as a robust, production-quality, high-performance compiler. It is a full compiler, not an interpretive one. Tightly integrated wit

While I do not have FIPS 109 on my system, FIPS was based on ANSI/IEEE770X3.97, and I do have a copy of the an old DEC pascal manual so I'm 100% sure writeln is there.  I also believe that Turbo Pascal was developed after the ANSI/IEEE770X3.97 was published so the Turbo extension to writeln and any VMS ones should be able to puzzled out.

Here is a pointer to Pascal for OpenVMS - User Manual Order Number: AA-PXSND-TK<https://support.hpe.com/hpsc/doc/public/display?docId=emr_na-c04619822>   This may give you hints.

That said, I have a PDF of the VMS Pascal Reference, but lord knows where it came from; probably my time at DEC.   I have to believe its on bitsavers or the like.   But when I look on page 9-67, Section 9.8.26 defines the WRITELN procedure as defined in the standard with the one DEC extension of supporting that last optional parameter to be: [, ERROR := error-recovery] where error-recovery  is defined as the action to be taken when an error occurs.

 As other have said maybe its something silly from file format conversion like <CR><LF> processing as VMS record oriented I/O is different than DOS/Windows.  But I suspect you are running into a difference in how I/O is declared and bound to files on the disk.   My experience with a number of different Pascal compilers 'back in the day' was this was an area for wide variation.   This is what I would look up in the HP/Compaq/DEC user manuals I just pointed you too.  I suspect that the 'VMS Pascal Language' manual should help you through the DEC variant, so google is your friend to try find a PDF.  With that open and a Turbo Pascal manual I think you'll be fine (and if you cannot find a Turbo manual, I have to believe the freepascal.org<http://freepascal.org> docs will get you a long way since they claim to be 100% Turbo Pascal and Delphi compatible).

BTW:  One other though/place where Pascal I/O can differ is character sets, although I don't think it a problem because PCs and Vaxen never had this issue, if you read any the reports or "Jensen and Wirth" you will notice that Pascal was defined for a 6-bit byte on a CDC-6600 system (SCOPE was the OS IIRC).    As I have said elsewhere, a 6-bit character was not unusual on earlier systems -> today, we can thank Fred Brooks for the 8-bit byte (Gene Amdahl wanted it to be 6 bits but Brooks kicked him out of his office until he had something that could easily be handled by SW - i.e. a power of 2, which Amdahl thought was wasteful for the HW).

Anyway, characters can be an issue when moving Pascal code because original Pascal was defined with some CDC isms and in those days, CDC had as number of different character sets.    I note that if look at the ANSI standard you'll noted the definition of all identifiers is just the lower case [english] chars a-z for letters, the traditional digits 0-9 and very limited number of special-symbols ( + - * / = < > [ ] . , : ' | ( ) ).  They do say:
The representation of any letter (upper-case or lower-case, differences of font, etc.) occurring anywhere outside of a character-string (see 6.1.7) shall be insignificant in that occurrence to the meaning of the program.
Because of the '6-bit ness' of some systems, the standard even provides for alternative tokens to do things like square braces to (. and .) or vertical bar to @ [and I think may allow ^ to be used for same IIRC].

Also remember that DEC manuals tended to show the identifiers in upper case (go figure).  And since both Vaxen and Intel processors (i.e. VMS Pascal and Turbo Pascal) support at least 7-bit ASCII fitting into an 8 bit character, and DEC added support for other special symbols such as dollar $, but I have to believe the problem is not in character set.

Best wishes,
Clem

[https://mailfoogae.appspot.com/t?sender=aY2xlbWNAY2NjLmNvbQ%3D%3D&type=zerocontent&guid=fb55634a-d1bf-49d9-8e6c-1dd5acc9ab1f]ᐧ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20180208/40b809d6/attachment-0001.html>


More information about the Simh mailing list