crscott@sdrc.UUCP (Scott_Klosterman) (07/27/88)
Does anyone know of a program which will convert Pascal source to C? We have quite a few applications written in Pascal and since we are going to a policy of Fortran or C only we must somehow convert them. Please reply E-Mail as I don't read all these groups. Scott Klosterman uunet!sdrc!crscott
pk-tle@nada.kth.se (Tommy Levitte) (07/29/88)
> Does anyone know of a program which will convert Pascal > source to C? We have quite a few applications written in > Pascal and since we are going to a policy of Fortran or > C only we must somehow convert them. Please reply E-Mail > as I don't read all these groups. Please tell me also (and send it to me). I NEED IT!
wytze@gouldnl.UUCP (Wytze van der Raay) (07/31/88)
In article <486@draken.nada.kth.se> pk-tle@draken.UUCP (Tommy Levitte) writes: >> Does anyone know of a program which will convert Pascal >> source to C? We have quite a few applications written in >> Pascal and since we are going to a policy of Fortran or >> C only we must somehow convert them. Please reply E-Mail >> as I don't read all these groups. > >Please tell me also (and send it to me). I NEED IT! It's on the latest EUUG tape, distributed at the EUUG Spring Conference in London (April 1988), and now available through euug-tapes@cwi.nl It is named "ptc", and written by (information copied from the README file): Per Bergsten Email: perb%holtec.uucp@chalmers.csnet ... mcvax!enea!chalmers!holtec!perb aka: bergsten@chalmers Smail: Holistic Technology AB Grona Gatan 59 414 54 Gothenburg Sweden Fax: +46 31 247456 -- | Wytze van der Raay ...!mcvax!gouldnl!wytze | | Gould European Unix Support Centre wytze@gouldnl.nl | | Maarssenbroek, The Netherlands (USA) ...!gould!wraay |
bph@buengc.BU.EDU (Blair P. Houghton) (08/01/88)
In article <486@draken.nada.kth.se> pk-tle@draken.UUCP (Tommy Levitte) writes: >> Does anyone know of a program which will convert Pascal >> source to C? We have quite a few applications written in >> Pascal and since we are going to a policy of Fortran or >> C only we must somehow convert them. Please reply E-Mail >> as I don't read all these groups. > >Please tell me also (and send it to me). I NEED IT! Whatever happened to ptoc? I have never had occasion to use it, and this computer hasn't installed it, but it's right there in my manual (Umax, Ultrix, or Unix, they all list it). Any reason nobody can find the program? I can't. --Blair
scl@virginia.acc.virginia.edu (Steve Losen) (08/01/88)
On the subject of Pascal to C conversion utilities: I know such beasts
exist, but I don't know any by name. Offhand I can think of 3
areas to be very careful of when using such a program because Pascal
has several features for which C has no obvious counterpart.
1) Up level references. In C, a function can only reference its own
arguments, its own local variables, or global variables. In Pascal,
a function or procedure can also reference the local variables and
arguments of other subprograms. How does the translator handle the
Pascal scope rules? The most correct way would be to pass extra
arguments to the C functions. These extra arguments would be pointers
to the variables being referenced.
2) Set operations: The translator will probably come with a library of
set routines that the C programs call.
4) With statements: These cannot be handled with simple textual
substitutions. For example,
program test;
type
rec = record f1, f2 : integer;
var
a : array [1..10] of rec;
i : integer;
begin
i := 5;
with a[i] do begin
for i := 1 to 10 do
f1 := i;
end
end.
According to the Pascal standard, a[i] is evaluated once
at the beginning of the with statement. All the references to
"f1" within the with statement refer to the same memory location
(even though "i" changes). To get this right in C would require
code like this:
struct rec { int f1,f2;};
main()
{
struct rec a[10], *p;
int i;
i := 5;
p = &a[i-1];
for(i=1; i<=10; i++)
p->f1 = i;
}
I'm sure there are other areas to watch out for. Be sure your translator
does the job correctly or at least admits where it fails.
--
Steve Losen scl@virginia.edu
University of Virginia Academic Computing Center
walter@garth.UUCP (Walter Bays) (08/04/88)
>> Does anyone know of a program which will convert Pascal >> source to C? Green Hills Software (818-246-5555) has a translator. It does not handle nested procedures, and the resulting C is not maintainable. I have not tried it, and do not recommend for or against it. -- ------------------------------------------------------------------------------ My opinions are my own. Objects in mirror are closer than they appear. E-Mail route: ...!pyramid!garth!walter (415) 852-2384 USPS: Intergraph APD, 2400 Geng Road, Palo Alto, California 94303 ------------------------------------------------------------------------------
teb@execu.UUCP (Thomas E. Bernhard) (08/05/88)
In article <336@sdrc.UUCP> crscott@sdrc.UUCP (Scott_Klosterman) writes: > > Does anyone know of a program which will convert Pascal > source to C? We have quite a few applications written in > Pascal and since we are going to a policy of Fortran or > C only we must somehow convert them. Please reply E-Mail > as I don't read all these groups. > Scott Klosterman > uunet!sdrc!crscott There is a company called Maritime InfoSystems which sells a very good Pascal to C comversion program. They will also convert your code for you at a price. My information is dated July 1, 1986 so I don't even know if they are in business anymore. Anyway here's their calling card: Maritime Infosystems Ltd. 6660 Reservoir Road Corvallis, Oregon 97333 (503) 929-2552 -- Tom Bernhard (teb@execu)
bertanij@mist.cs.orst.edu (John Bertani) (08/05/88)
>In article <336@sdrc.UUCP> crscott@sdrc.UUCP (Scott_Klosterman) writes: >> >> Does anyone know of a program which will convert Pascal >> source to C? We have quite a few applications written in >> Pascal and since we are going to a policy of Fortran or >> C only we must somehow convert them. Please reply E-Mail >> as I don't read all these groups. >> Scott Klosterman >> uunet!sdrc!crscott > >There is a company called Maritime InfoSystems which sells a very good >Pascal to C comversion program. They will also convert your code for >you at a price. My information is dated July 1, 1986 so I don't even know >if they are in business anymore. He's not! He got a job as a sysop in New Zealand. But he was just reselling the TGL Pascal-to-C Converters. You can get more info by writing to: Ted Lewis TGL, Inc. 27096 Forest Springs Ln. Corvallis, OR 97330 (503) 745-7476 What dialects? UCSD, MS, MT+, Metaware, Intel, Apollo Domain, and Turbo. If it's not on the list, call anyway.