[comp.lang.prolog] C-Prolog Bug Fixes Wanted

abc@nott-cs.UUCP (03/20/87)

I am compiling a list of bug fixes for C-Prolog 1.5
I would be very grateful if you have improved or altered/fixed
it all for your improvements.

---------------------------------------------------------------------

JANET : abc@uk.ac.nott.cs              Andy Cheese
ARPA  : abc%nott.cs@ucl-cs.arpa        Department of Computer Science,
                                       University of Nottingham,
Functional vs. Logic Programming       University Park,
If You Can't Decide Between Em,        Nottingham.
-- Join Em                             NG7 2RD.
                                       England.
 
                                       Tel. No. : (0602) 506101 ext. 3702
-- 
Andy Cheese

robert@arizona.edu (Robert J. Drabek) (04/14/87)

In article <4855@robin.cs.nott.ac.uk>, abc@cs.nott.ac.uk (Andy Cheese) writes:
> 
> I am compiling a list of bug fixes for C-Prolog 1.5
> I would be very grateful if you have improved or altered/fixed
> it all for your improvements.

--------------------------------------------------------------------

The following changes were made to C-Prolog+ by Chris Janton to get it to
run under version 4.4 of VMS.

file    MAIN.C
          in initial "include" statements
             change
                extern int  sys_nerr;
                extern char *sys_errlist[];
             to
                #ifndef vms
                extern int  sys_nerr;
                extern char *sys_errlist[];
                #else
                #include perror
                #endif

          approx line 1529
             change         y = MolP(k1)->Env; k1 = MolP(k1)->Fn;
             to             y = MolP(k1)->Env; k1 = SkelP(MolP(k1))->Fn;

          approx line 1747
             change     bn = &(SkelP(FunctorP(MolP(ARG1)->Sk)->Fn)->flgsoffe);
             to         bn = &(FunctorP(SkelP(MolP(ARG1)->Sk)->Fn)->flgsoffe);

file    SYSBITS.C
        change
                extern int sys_nerr, PrologEvent;
                extern char *sys_errlist[];
        to
                #ifndef vms
                extern int sys_nerr, PrologEvent;
                extern char *sys_errlist[];
                #else
                #include perror
                extern int PrologEvent;
                #endif

        change function ToEOL
          from
                char
                ToEOL(reply,count)
                register char *reply; int count;
                {
                    extern FILE *freopen();
                    extern int  isatty();
                    char c0, c;

                    /* check for eof */
                    if ( feof(stdin) ) {
                        freopen( "/dev/tty", "r", stdin );
                        return PlEOF;
                    }
                    while ((c0 = getchar()) <= ' ' && c0 != '\n');
                    c = c0;
                    while (c0 != '\n') {
                        c0 = getchar();
                        if (reply && --count>0) *reply++ = c0;
                    }
                    if (reply) *reply = '\0';
                    if (c >= 'A' && c <= 'Z') c += 'a'-'A';
                    return c;
                }
        to
                char
                ToEOL(reply,count)
                register char *reply; int count;
                {
                    extern FILE *freopen();
                    extern int  isatty();
                    char c0, c;

                    /* check for eof */
                /*    if ( feof(stdin) ) {
                /*      freopen( "/dev/tty", "r", stdin );
                /*      return PlEOF;
                /*    }
                 */

                    fclose(stdin);
                    stdin = fopen("SYS$COMMAND:", "r");
                    while ((c0 = getchar()) <= ' ' && c0 != '\n');
                    c = c0;
                    while (c0 != '\n') {
                        c0 = getchar();
                        if (reply && --count>0) *reply++ = c0;
                    }
                    if (reply) *reply = '\0';
                    if (c >= 'A' && c <= 'Z') c += 'a'-'A';
                    fclose(stdin);
                    stdin = fopen("SYS$COMMAND:", "r");
                    return c;
                }


file    PL.H
        change
                extern int errno;
        to
                #ifndef vms
                extern int errno;
                #else
                extern int noshare errno;
                #endif

        copied times.h from Eunice distribution to current directory

--------------------------------------------------------------------
-- 
Robert J. Drabek
Department of Computer Science
University of Arizona
Tucson, AZ  85721

todd@eneevax.UUCP (04/15/87)

>In article <4855@robin.cs.nott.ac.uk>, abc@cs.nott.ac.uk (Andy Cheese) writes:
>> 
>> I am compiling a list of bug fixes for C-Prolog 1.5
>> I would be very grateful if you have improved or altered/fixed
>> it all for your improvements.

OK, I hacked at it too. Read on...

>The following changes were made to C-Prolog+ by Chris Janton to get it to
>run under version 4.4 of VMS.

[lot's of diffs removed to save on phone bills for everyone :-) ]

Looks like Chris made the substantive changes I wanted to work on
'when I got the time'. I made superficial changes, but in the course of fixing
things I found that there were a lot of unnecessary '#ifdef VMS' lines
floating around. So what I'll do is this... I'll incorporate Chris'
modifications to my code (fixes bugs I haven't even discovered yet),
then I'll DIFF against the distribution with SUM/SLP output to make
changing easier. Then, if Edinburgh incorporates that into their 
distribution it might be worth money :-). No, I shouldn't really
rag on them so hard, it really is a nice interpreter. I just don't
think they should go out of their way to make VMS look so screwy.

>        copied times.h from Eunice distribution to current directory

I fixed the timing code directly, instead of bringing in a
foreign include file. My philosophy is that if it compiles on
my VAX with C 2.2, then it will compile on *your* VAX. If you
start bringing in extra files, things get muddy (and lost).
Thus, it's a personal preference. But at least my way I get
the same times reported for building the initial system on the
Sun and the VAX, so it can't be all bad.

So, I modified the makefile (only slightly) since VMS command lines
are a little different, I used pl/all instead of pl/vmsall, and it runs.

Regards,
Todd Aven
the Softwear Sweatshop ('home' of completely distributed computing :-)