[ale] p2c Problem

Jeff Hubbs hbbs at bellsouth.net
Sat Jul 24 01:15:44 EDT 1999


I have some Pascal code I'm trying to compile with p2c.

Problem 1:  I keep getting repeated errors like


     .
     .
     .
     "BIG.PAS", line 407: Warning: Unrecognized character 015 in
     file [247]
     "BIG.PAS", line 408: Warning: Unrecognized character 015 in
     file [247]
     "BIG.PAS", line 409: Warning: Unrecognized character 015 in
     file [247]
     "BIG.PAS", line 410: Warning: Unrecognized character 015 in
     file [247]
     .
     .
     .

What is the significance of "015" and "247"?  This source code came by
roundabout means from VAX/VMS, so it wouldn't surprise me if the source
file needs massaging somehow.

Problem 2:

I wrote a simple test program in Pascal and ran it through p2c.

Here is the Pascal source:


     PROGRAM Test(Input,Output);

     VAR a, b, c : REAL;

     Begin
        a := 15;
        b := 33;
        c := 55;
        writeln((a+b)*c);
     End.

Here is the resulting c source:


     /* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C
     translator */
     /* From input file "test.pas" */

     #include <p2c/p2c.h>

     main(argc, argv)
     int argc;
     Char *argv[];
     {
       double a = 15.0, b = 33.0, c = 55.0;

       PASCAL_MAIN(argc, argv);
       printf("% .5E\n", (a + b) * c);
       exit(EXIT_SUCCESS);
     }

     /* End. */

It seems that the line "#include <p2c/p2c.h>" is causing a problem.
Trying to gcc the p2c output gives me


     test.c:5: p2c/p2c.h: No such file or directory


I got the impression from man p2c that p2c.h is some kind of library
file but I havene't been able to locate it nor can I figure out what
creates it.  Does anyone know the story behind p2c.h?

Thanks,
- Jeff

P.S. BTW, the Pascal source that I'm trying to compile and run under
Linux is an implementation of the Quine-McCluskey-Caldwell-Fielder logic
reduction algorithm that I wrote in 1987.  This program takes a truth
table for a given number of input Boolean values and returns a Boolean
expression that replicates the truth table.  I used this program to
develop a procedure in the ATLAS language that would take an
eight-character text string of ones and zeroes (representing a byte) and
return another string of ones and zeros representing the input byte plus
one.  The ATLAS interpreter could evaluate eight Boolean expressions
much faster than it could convert these byte strings to integers, add
one to the integers, and convert the integers back to strings of ones
and zeroes, and the method was extensible to the performance of any math
operation on text strings representing binary values.  Doing logic
reduction by inspection works with one (duh!) or two input variables and
with pencil and paper for truth tables with two to four input variables
handily (via Karnaugh maps).  It becomes virtually impossible beyond
six.  The VAX 8600 I developed the program on could handle up to fifteen
input variables (available memory is the limiting factor) and a VAX 8810
I worked with later could handle eighteen.






More information about the Ale mailing list