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

Clem cole clemc at ccc.com
Thu Feb 8 17:55:42 EST 2018


FWIW if you get a hold of K&P’s “SW tools in Pascal” I think I remember that they created a small portable IO library. That is described in a chapter or the appendix I forget which.  But the library was ported and tested on VMS.  If you switch your IO to it then you can (in theory) — isolate the VMSisms in one place.  

Further if you just stare at the library sources it should give you a hint at what’s different between most implementations.  If you google around the sources for same is generally available.

Also Johnny is spot on.   IO was always the weak link and source of the most frustration.  Next was how external libraries were supported. As I said before the unit idea became persuasive but the syntax like IO varies. As Johnny also warned, and ad you just learned you need to be real careful of data types too since different implementations used similar or the same name for some routines but the types and parameters were all over the map.  This is why Brian and Dave chose to hide the IO in a private library that could be rewritten on a per system basis. 



> On Feb 8, 2018, at 5:38 PM, Dan Gahlinger <dgahling at hotmail.com> wrote:
> 
> yes I'm reading it, and making some progress.
> I have a program that can read a file and display the contents to screen.
> 
> this is going to be quite a learning curve. but fun!
> 
> thanks guys!
> 
> Dan.
>  
> From: Simh <simh-bounces at trailing-edge.com> on behalf of Johnny Billquist <bqt at softjar.se>
> Sent: February 8, 2018 5:33 PM
> To: simh at trailing-edge.com
> Subject: Re: [Simh] anyone know how to convert/translate turbo pascal to vax pascal?
>  
> Like I said, you cannot just replace "assign" with "open". The number, 
> types, and exact arguments are not the same between assign in 
> Turbo-Pascal and open in VMS Pascal. You need to read the manual!
> 
>    Johnny
> 
> On 2018-02-08 21:18, Dan Gahlinger wrote:
> > So I tried this but the output file is empty. first.txt contains "text' 
> > and second.txt contains "not test":
> > 
> > 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;
> >    open(f,s,old);
> >    open(g,t,old);
> >    open(h,u,new);
> >    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.
> > 
> > ------------------------------------------------------------------------
> > *From:* Clem Cole <clemc at ccc.com>
> > *Sent:* February 8, 2018 12:44 PM
> > *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?
> > Yup - traditional Pascal (lack of) portability due to the report having 
> > been silent.   Associating files with file descriptors could never be 
> > agreed so ISO never defined how to do.  Every OS does it differently.  
> > Since Wirth was silent on it, if they picked one scheme over another the 
> > Pascal committee was favoring that implementation [Kernighan may have 
> > even pointed this out in his paper they wrote after writing the software 
> > tools in Pascal - Why Pascal is Not My Favorite Programming Language 
> > <http://wiki.lazarus.freepascal.org/Why_Pascal_is_Not_My_Favorite_Programming_Language> ].**
> > 
> > Go google the two document I mentioned previously and it should be a 
> > fairly simply change.  Look up file I/O and then read how VMS 
> > implemented the association of  name.
> > 
> > I'm now going by memory, but a number of Pascal's did that in the 
> > reset() function.   A number created a new function as Turbo did 
> > (assign() in this case, but I think open() was used by a couple of other 
> > Pascals. I think a couple of other pass it in via the Program function 
> > and style other that supported separate libraries (usually called units) 
> > did it other ways still.
> > 
> > For grins, in the late 1970s at an HP/Tektronix  'Hatfield/McCoy' style 
> > party - in those days HP in particular was Basic happy and Tek was 
> > mostly Pascal.   We counted over 25 different incompatible 'HP Basic' 
> > implementations, and over 10 different Tek Pascals.
> > 
> > These are just the sorts of things you need the Turbo Pascal manual in 
> > one had if that is were you are coming from and in this case the VMS 
> > Pascal manual in the other.  Look up assign() in the first and the read 
> > how perform the same action in the other.
> > 
> > Good Luck,
> > Clem
> > 
> > ** IMHO: This is a good example of where C 'beat' Pascal - the I/O was 
> > defined by UNIX and when it came time to create a standard, C mostly 
> > kept the UNIX semantics and was able to keep many/most of the OS-ism 
> > from other systems out.
> > ᐧ
> > 
> > On Thu, Feb 8, 2018 at 12:21 PM, Dan Gahlinger <dgahling at hotmail.com 
> > <mailto:dgahling at hotmail.com>> wrote:
> > 
> >     so here you go, a simple file compare I wrote using "freepascal"
> >     (freepascal.org <http://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 <mailto: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
> >     <mailto: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
> >     <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-zfor letters, the
> >     traditional digits 0-9and 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
> > 
> >     ᐧ
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Simh mailing list
> > Simh at trailing-edge.com
> > http://mailman.trailing-edge.com/mailman/listinfo/simh
> > 
> 
> -- 
> Johnny Billquist                  || "I'm on a bus
>                                    ||  on a psychedelic trip
> email: bqt at softjar.se             ||  Reading murder books
> pdp is alive!                     ||  tryin' to stay hip" - B. Idol
> _______________________________________________
> Simh mailing list
> Simh at trailing-edge.com
> http://mailman.trailing-edge.com/mailman/listinfo/simh
> _______________________________________________
> Simh mailing list
> Simh at trailing-edge.com
> http://mailman.trailing-edge.com/mailman/listinfo/simh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20180208/03489549/attachment-0001.html>


More information about the Simh mailing list