[comp.lang.pascal] Porting Turbo Pascal programs to VMS

elmo@uhura.cc.rochester.edu (Eric Cabot) (08/27/90)

Hi Folks,
  Does anyone out there have any experience porting Turbo Pascal Programs
to VMS Pascal.  Although I swore that I'd never program in VMS, I decided
to give it a whirl anyway, because I need the tools that I'm used to
having on my PC.  
  For example, is there a VMS-Pascal equivalent to gotoxy?  I'm willing
to rewrite my programs to *SOME* extent but there's no way that I'm going
to redraw the entire screen just to put a single character, or move the
cursor, into the middle of the display. 

   I'm also pretty disappointed with the string handling, not to
mention dealing with I/O to files. I know that VMS's implementation
is closer to standard than Borland's but that's no excuse. The standards
are just too chunky to allow smoothly operating programs. No wonder
all the "pro's" got out of Pascal years ago!
    So anyway, I'd appreciate it if anyone could e-mail me some tips
on making the port to VMS-Pascal.



-- 
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Eric Cabot                             |  elmo@{uhura | db1}.cc.rochester.edu
      "insert your face here"          |  elmo@uordbv.bitnet
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

ts@uwasa.fi (Timo Salmi LASK) (08/27/90)

In article <9090@ur-cc.UUCP> elmo@uhura.cc.rochester.edu (Eric Cabot) writes:
>  Does anyone out there have any experience porting Turbo Pascal Programs
>to VMS Pascal.  Although I swore that I'd never program in VMS, I decided

I've done some (well quite some) work with both, and unfortunately
you are in for big problems if you have used Turbo Pascal's special
features as you most certainly will have. 

>  For example, is there a VMS-Pascal equivalent to gotoxy?  I'm willing
>to rewrite my programs to *SOME* extent but there's no way that I'm going
>to redraw the entire screen just to put a single character, or move the
>cursor, into the middle of the display. 

You'll have to link to the VMS runtime library (RTL) which in some
ways resembles using interrupts.  It is an art by itself, and the
RTL documentation takes hundreds of pages.  The only nice feature of
it is that it is rather language independent.  (I've used the same
routines for fortran, basic, and pascal.)

>   I'm also pretty disappointed with the string handling, not to
>mention dealing with I/O to files. I know that VMS's implementation
>is closer to standard than Borland's but that's no excuse. The standards

Don't be.  VMS Pascal I/O and string handling are much more
convenient than the standard, and in this aspect VSM Pascal is
perhaps closer to TP than ANSI.  Try Unix Pascal, and see what these
useless standards of the purists really mean for serious utility
program writing.  For the proponents these standards often are a
holy end by themselves, never mind how hard it makes the real
programming work.  VMS Pascal is not as bad as that.

In summary.  Don't try to port your code.  Take your TP program's
logic, and then rewrite the whole thing. 

...................................................................
Prof. Timo Salmi        (Moderating at anon. ftp site 128.214.12.3)
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun

lanmaint@nssdca.gsfc.nasa.gov (Dave Yoest) (08/27/90)

In article <9090@ur-cc.UUCP>, elmo@uhura.cc.rochester.edu (Eric Cabot) writes...
>Hi Folks,
>  Does anyone out there have any experience porting Turbo Pascal Programs
>to VMS Pascal.  Although I swore that I'd never program in VMS, I decided
>to give it a whirl anyway, because I need the tools that I'm used to
>having on my PC.  
>  For example, is there a VMS-Pascal equivalent to gotoxy?  I'm willing
>to rewrite my programs to *SOME* extent but there's no way that I'm going
>to redraw the entire screen just to put a single character, or move the
>cursor, into the middle of the display. 
> 
Eric,

 I ran (run) into the same problem. My solution was to write a VAX 
 Pascal procedure/function that works like the Turbo 
 procedure/function. Then add the procedures/functions to a library
 file and link against them (or include them in your program source)

 You requested gotoxy(x,y) for VMS, so I included it here since it's
 small. This should work on any ansi terminal, because it uses the 
 ansi escape sequence for cursor position (CUP)





procedure gotoxy(xpos,ypos : integer);

  begin
   write(chr(27)+'['+(udec(ypos,2))+';'+(udec(xpos,2))+'H');
  end;


Hope this helps!


Dave Yoest
DYOEST@128.183.4.5  internet

(301)-286-7033      phone

PETERSEN@ctrvx1.vanderbilt.edu (Ghost in the -Turing- Machine) (08/29/90)

> From:	IN%"lanmaint@nssdca.gsfc.nasa.gov"  "Dave Yoest" 28-AUG-1990 19:13:20.14
>  You requested gotoxy(x,y) for VMS, so I included it here since it's
>  small. This should work on any ansi terminal, because it uses the 
>  ansi escape sequence for cursor position (CUP)
> 
> procedure gotoxy(xpos,ypos : integer);
> 
>   begin
>    write(chr(27)+'['+(udec(ypos,2))+';'+(udec(xpos,2))+'H');
>   end;

    You might also want to check out what seem to be VMS standard RTL calls
(even though I can't find documentation on them) like LIB$SET_CURSOR(Row,Col)
and LIB$ERASE_PAGE(Row,Col).  If you define the function like this:

[EXTERNAL(LIB$SET_CURSOR)] FUNCTION GotoXY(Row, Col : INTEGER) : INTEGER;

you should be able to use it without any real problems.  NOTE:  I have not
tested the definition above.  I use the function without renaming it...
These also seem to work only with terminals that VMS implicitly understands.

-Chris

                             +------------------+
                              \ Chris Petersen /
       +-----------------------+--------------+----------------------+
      /  Vanderbilt University Computer Center - Systems Development  \
     / petersen@ctrvax.Vanderbilt.EDU  .AND.  petersen@VUctrvx1.Bitnet \
    +-------------------------------------------------------------------+
               { "You're quoting me?  I make it up as I go!" }
               +---------------------------------------------+