diff options
author | kamil <kamil@pkgsrc.org> | 2018-02-03 20:26:31 +0000 |
---|---|---|
committer | kamil <kamil@pkgsrc.org> | 2018-02-03 20:26:31 +0000 |
commit | 166304fbd5f43c812990c81c7c78d4ef231e8b8d (patch) | |
tree | 607f778cebf5cda7e5c6e1ed11d14be203b7e591 | |
parent | d1a712b22728c8d21d2860ea12e6d732c6fbaf75 (diff) | |
download | pkgsrc-166304fbd5f43c812990c81c7c78d4ef231e8b8d.tar.gz |
lang/pc-lisp: import pc-lisp-6.0
PC-LISP is a small implementation of LISP for just about any machine with a
good C compiler. This manual is biased towards the UNIX and MS-DOS versions.
While small, it is capable of running a pretty good subset of Franz LISP.
The functions are supposed to perform in the same way as Franz with a few
exceptions made for effeciencies sake.
-rw-r--r-- | lang/pc-lisp/DESCR | 6 | ||||
-rw-r--r-- | lang/pc-lisp/Makefile | 45 | ||||
-rw-r--r-- | lang/pc-lisp/PLIST | 14 | ||||
-rw-r--r-- | lang/pc-lisp/distinfo | 11 | ||||
-rw-r--r-- | lang/pc-lisp/patches/patch-src_Makefile | 21 | ||||
-rw-r--r-- | lang/pc-lisp/patches/patch-src_buselect.c | 21 | ||||
-rw-r--r-- | lang/pc-lisp/patches/patch-src_busopen.c | 147 | ||||
-rw-r--r-- | lang/pc-lisp/patches/patch-src_bustrfnd.c | 47 | ||||
-rw-r--r-- | lang/pc-lisp/patches/patch-src_lisp.h | 25 |
9 files changed, 337 insertions, 0 deletions
diff --git a/lang/pc-lisp/DESCR b/lang/pc-lisp/DESCR new file mode 100644 index 00000000000..c4a85df47d6 --- /dev/null +++ b/lang/pc-lisp/DESCR @@ -0,0 +1,6 @@ +PC-LISP is a small implementation of LISP for just about any machine with a +good C compiler. This manual is biased towards the UNIX and MS-DOS versions. + +While small, it is capable of running a pretty good subset of Franz LISP. +The functions are supposed to perform in the same way as Franz with a few +exceptions made for effeciencies sake. diff --git a/lang/pc-lisp/Makefile b/lang/pc-lisp/Makefile new file mode 100644 index 00000000000..29ff0f1bd89 --- /dev/null +++ b/lang/pc-lisp/Makefile @@ -0,0 +1,45 @@ +# $NetBSD: Makefile,v 1.1 2018/02/03 20:26:31 kamil Exp $ + +DISTNAME= master +# There is no exact version available; use VERSION from lisp.h +PKGNAME= pc-lisp-6.0 +CATEGORIES= lang +MASTER_SITES= ${MASTER_SITE_GITHUB:=blakemcbride/} +DIST_SUBDIR= ${GITHUB_PROJECT} +EXTRACT_SUFX= .zip + +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= https://github.com/blakemcbride/PC-LISP/ +COMMENT= Franz Lisp dialect Lisp system +LICENSE= 2-clause-bsd + +GITHUB_PROJECT= PC-LISP +GITHUB_TAG= 2b50414e258a3916bf19d1b354f4c4e647eb7bb8 + +USE_TOOLS+= gmake + +BUILD_DIRS= src +BUILD_TARGET= pc-lisp + +INSTALLATION_DIRS= bin share/doc/${PKGBASE} share/${PKGBASE} + +do-install: + ${RUN} ${INSTALL_PROGRAM} \ + ${WRKSRC}/src/pc-lisp \ + ${DESTDIR}${PREFIX}/bin + +.for f in README.md Franz_Lisp_July_1983.pdf pc-lisp.doc + ${RUN} ${INSTALL_DATA} \ + ${WRKSRC}/${f} \ + ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}/${f} +.endfor + +.for f in diff.l dragon.l hanoi.l if.l match.l pc-lisp.l qanda.l queens.l \ + turtle.l + ${RUN} ${INSTALL_SCRIPT} \ + ${WRKSRC}/${f} \ + ${DESTDIR}${PREFIX}/share/${PKGBASE}/${f} + ${RUN} ${CHMOD} -x ${DESTDIR}${PREFIX}/share/${PKGBASE}/${f} +.endfor + +.include "../../mk/bsd.pkg.mk" diff --git a/lang/pc-lisp/PLIST b/lang/pc-lisp/PLIST new file mode 100644 index 00000000000..f4a7ae06373 --- /dev/null +++ b/lang/pc-lisp/PLIST @@ -0,0 +1,14 @@ +@comment $NetBSD: PLIST,v 1.1 2018/02/03 20:26:31 kamil Exp $ +bin/pc-lisp +share/doc/pc-lisp/Franz_Lisp_July_1983.pdf +share/doc/pc-lisp/README.md +share/doc/pc-lisp/pc-lisp.doc +share/pc-lisp/diff.l +share/pc-lisp/dragon.l +share/pc-lisp/hanoi.l +share/pc-lisp/if.l +share/pc-lisp/match.l +share/pc-lisp/pc-lisp.l +share/pc-lisp/qanda.l +share/pc-lisp/queens.l +share/pc-lisp/turtle.l diff --git a/lang/pc-lisp/distinfo b/lang/pc-lisp/distinfo new file mode 100644 index 00000000000..1a4fab17763 --- /dev/null +++ b/lang/pc-lisp/distinfo @@ -0,0 +1,11 @@ +$NetBSD: distinfo,v 1.1 2018/02/03 20:26:31 kamil Exp $ + +SHA1 (PC-LISP/master-2b50414e258a3916bf19d1b354f4c4e647eb7bb8.zip) = b5cda3214fbf41673d26f25defc0db3095d9e538 +RMD160 (PC-LISP/master-2b50414e258a3916bf19d1b354f4c4e647eb7bb8.zip) = 9da45864097aa2d5de2f18630a267584bfba826a +SHA512 (PC-LISP/master-2b50414e258a3916bf19d1b354f4c4e647eb7bb8.zip) = 4aec599bc6a26311b7d4d509b171919a05714b56ff23949ebfb5a61a986505f45d377ab68ae5a5fae605ec976c695c12d2fc8101a7cc4d5676ceeb73311d2a0f +Size (PC-LISP/master-2b50414e258a3916bf19d1b354f4c4e647eb7bb8.zip) = 1011041 bytes +SHA1 (patch-src_Makefile) = 3f388dbff31fad82c9813fb7b3bb5888d118d480 +SHA1 (patch-src_buselect.c) = eeae7661fd5a8d3b4f0a68f38dc50471902ae444 +SHA1 (patch-src_busopen.c) = bf44bf31a9653c86b8616b6d6901dbbbe7c71298 +SHA1 (patch-src_bustrfnd.c) = f2dc238e8d52d9731d685caa88b1218d1ec49706 +SHA1 (patch-src_lisp.h) = 623ab2b3897aaa8f6a99843ff14574a6ede19297 diff --git a/lang/pc-lisp/patches/patch-src_Makefile b/lang/pc-lisp/patches/patch-src_Makefile new file mode 100644 index 00000000000..72cd78361c8 --- /dev/null +++ b/lang/pc-lisp/patches/patch-src_Makefile @@ -0,0 +1,21 @@ +$NetBSD: patch-src_Makefile,v 1.1 2018/02/03 20:26:31 kamil Exp $ + +Pass CFLAGS and LDFLAGS. + +--- src/Makefile.orig 2015-07-22 00:49:58.000000000 +0000 ++++ src/Makefile +@@ -31,12 +31,12 @@ buuntrac.c buwhile.c buzaplin.c buzerop. + lierror.c lieval.c liinst.c limain.c limkstak.c limman.c liscan.c \ + lithrow.c litrace.c liutils.c + +-CFLAGS = -Wall -Wno-parentheses -O3 ++CFLAGS ?= -Wall -Wno-parentheses -O3 + + OBJ = $(SRC:.c=.o) + + pc-lisp : $(OBJ) +- gcc -o $@ $^ -lm ++ gcc $(CFLAGS) $(LDFLAGS) -o $@ $^ -lm + + + $(OBJ) : lisp.h diff --git a/lang/pc-lisp/patches/patch-src_buselect.c b/lang/pc-lisp/patches/patch-src_buselect.c new file mode 100644 index 00000000000..4251ae5e559 --- /dev/null +++ b/lang/pc-lisp/patches/patch-src_buselect.c @@ -0,0 +1,21 @@ +$NetBSD: patch-src_buselect.c,v 1.1 2018/02/03 20:26:31 kamil Exp $ + +Port to NetBSD. + +--- src/buselect.c.orig 2015-07-22 00:49:58.000000000 +0000 ++++ src/buselect.c +@@ -48,7 +48,7 @@ struct conscell *form; + if (port->celltype == FILECELL) { /* if argument is a port */ + fp = port->atom; /* extract FILE * from atom */ + if (fp == NULL) ioerror(fp); /* a null 'atom' indicates file closed */ +-#if defined(__linux__) || defined(__APPLE__) /* _cnt & _flag are no longer available; this code will have to be updated */ ++#if defined(__linux__) || defined(__APPLE__) || defined(__NetBSD__) /* _cnt & _flag are no longer available; this code will have to be updated */ + return(LIST(port)); + #else + if ((fp->_cnt > 0) && (fp->_flag & _IOREAD)) /* a read only port with data pending causes an immediate return */ +@@ -117,5 +117,3 @@ struct conscell *form; + er: ierror("*select"); /* doesn't return */ + return NULL; /* keep compiler happy */ + } +- +- diff --git a/lang/pc-lisp/patches/patch-src_busopen.c b/lang/pc-lisp/patches/patch-src_busopen.c new file mode 100644 index 00000000000..2c314b00d1b --- /dev/null +++ b/lang/pc-lisp/patches/patch-src_busopen.c @@ -0,0 +1,147 @@ +$NetBSD: patch-src_busopen.c,v 1.1 2018/02/03 20:26:31 kamil Exp $ + +Port to NetBSD. + +--- src/busopen.c.orig 2015-07-22 00:49:58.000000000 +0000 ++++ src/busopen.c +@@ -40,6 +40,7 @@ + *************************************************************************/ + + #include <stdio.h> ++#include <unistd.h> + #include "lisp.h" + + #if HASTCP /* only compile busopen/busopenP if TCP/IP available */ +@@ -76,7 +77,7 @@ static int fd_port = -1; + ** default is 'anybody' i.e. INADDR_ANY. ** + ** implies no port currently in use. ** + *************************************************************************/ +-static long fd_addr = INADDR_ANY; ++static struct in_addr fd_addr = { INADDR_ANY }; + + /************************************************************************* + ** fdwait(fd, sec, usec) return 1 iff and only if there is activity on ** +@@ -102,7 +103,7 @@ static int fdwait(fd, sec, usec) + ** any forked children to inherit this file descriptor because that can** + ** stop listens from working so we set the close-on-exec flag on the fd** + *************************************************************************/ +-static int fdasync(fd) ++static void fdasync(fd) + int fd; + { + fcntl(fd, F_SETFL, FASYNC); +@@ -164,7 +165,8 @@ static int addrok(cl_addr, m_addr) + static FILE *sopen(addr, port, wait, caddr) + long addr, port, wait; char *caddr; + { +- int len, on = 1, s1, s2 = -1; FILE *fp; ++ int on = 1, s1, s2 = -1; FILE *fp; ++ socklen_t len; + struct sockaddr_in server, client; + if ((s1 = socket(AF_INET, SOCK_STREAM, 0)) < 0) goto er; /* allocate a new socket using TCP/IP */ + bzero(&server, sizeof(server)); +@@ -179,11 +181,11 @@ static FILE *sopen(addr, port, wait, cad + for(;;) { /* repeat while getting EINTR's */ + if (!fdwait(s1, wait, 0)) goto er; /* wait at most wait seconds for activity on s1 */ + len = sizeof(client); +- if ((s2 = accept(s1,&client,&len)) >= 0) break; /* if activity on s1 and got connection exit loop */ ++ if ((s2 = accept(s1,(struct sockaddr *)&client,&len)) >= 0) break; /* if activity on s1 and got connection exit loop */ + if (len != sizeof(client)) goto er; /* did we conenct to AF_INET addressee? */ + if (errno != EINTR) goto er; /* error occured, only one we expect is EINTR */ + } +- if (!addrok(client.sin_addr.s_addr, addr)) goto er; ++ if (!addrok(client.sin_addr.s_addr, (struct sockaddr *)addr)) goto er; + if (caddr) {strcpy(caddr, inet_ntoa(client.sin_addr));} /* construct clients address for as a return parameter */ + close(s1); /* all ok, have a new fd s2 so can close s1 now */ + } else { /* we are not to wait (ie wait = -2), will process on SIGIO */ +@@ -191,7 +193,7 @@ static FILE *sopen(addr, port, wait, cad + s2 = s1; + } + } else { /* this is the active side of the connection ie wait = 0 */ +- if (connect(s1, &server, sizeof(server)) < 0) goto er; /* so try to make an active connect */ ++ if (connect(s1, (struct sockaddr *)&server, sizeof(server)) < 0) goto er; /* so try to make an active connect */ + s2 = s1; /* just copy s1 to s2 so that we end in same state as passive */ + } + fp = fdopen(s2, "r+"); /* convert the file descriptor s2 into a FILE * */ +@@ -226,7 +228,7 @@ struct conscell *busopen(form) + struct conscell *form; + { char *iaddr; FILE *fd; + struct conscell *fcell; +- struct hostent *host; ++// struct hostent *host; + char addr[MAXATOMSIZE + 1]; + long port, wait = 0, haddr; + errno = 0; +@@ -250,6 +252,7 @@ struct conscell *form; + er: ierror("socketopen"); + er2: ierror("socketopen:bad address"); + er3: ierror("socketopen:reserved port"); ++ return NULL; // XXX + } + + /*************************************************************************************************** +@@ -264,7 +267,7 @@ struct conscell *form; + int busopenP(op) + int op; + { +- static FILE *fd_listen = NULL, *fd_talk = NULL; static int old_mask; ++ static FILE *fd_listen = NULL, *fd_talk = NULL; // static int old_mask; + + /* + | Must reset errno to see if I/O routines triggered an error. +@@ -311,9 +314,9 @@ int busopenP(op) + Dprintf(("\tbusopenP accepting fd_listen & opening fd_talk\n")); + if (fdwait(fdl, 0, 10) == 1) { /* if activity on socket try to accept */ + struct sockaddr_in client; +- int len = sizeof(client); ++ socklen_t len = sizeof(client); + Dprintf(("\tbusopenP data available on fd_listen\n")); +- if ((fdt = accept(fdl, &client, &len)) >= 0) { /* accept the connection, if error drop out */ ++ if ((fdt = accept(fdl, (struct sockaddr *)&client, &len)) >= 0) { /* accept the connection, if error drop out */ + Dprintf(("\tbusopenP connection accepted\n")); + fclose(fd_listen); /* got accept don't need listner socket now so close it down */ + fd_listen = NULL; /* and clear FILE * so we do not enter this code on next liio(-1) */ +@@ -446,7 +449,7 @@ struct conscell *buREPsopen(form) + struct conscell *form; + { + int isdflt, last_fd_port = fd_port; +- long addr, last_fd_addr = fd_addr; ++ struct in_addr addr, last_fd_addr = fd_addr; + long port; void (*f)(); + + /* +@@ -457,7 +460,7 @@ struct conscell *buREPsopen(form) + */ + if (form == NULL) { + if (last_fd_port <= IPPORT_RESERVED) return(NULL); +- fd_addr = INADDR_ANY; /* restore default addr mask to 'anyone' */ ++ fd_addr.s_addr = INADDR_ANY; /* restore default addr mask to 'anyone' */ + busopenP(1); + goto ret; + } +@@ -485,7 +488,7 @@ struct conscell *buREPsopen(form) + if (form->cdrp) goto er; + if (!name2addr(addr_s, &addr)) goto er4; + } else +- addr = INADDR_ANY; ++ addr.s_addr = INADDR_ANY; + + /* + | Now, try to open the new port/addr as a REP server. If we suceed all is well, just return the previous +@@ -510,7 +513,7 @@ ret: form = new(CONSCELL); + form->cdrp = new(CONSCELL); + if (last_fd_port > IPPORT_RESERVED) { + form->carp = newintop((long) last_fd_port); +- form->cdrp->carp = LIST(insertstring((last_fd_addr == INADDR_ANY) ? "*" : inet_ntoa(last_fd_addr))); ++ form->cdrp->carp = LIST(insertstring((last_fd_addr.s_addr == INADDR_ANY) ? "*" : inet_ntoa(last_fd_addr))); + } + xpop(1); + return(form); +@@ -522,6 +525,7 @@ ret: form = new(CONSCELL); + er1: ierror("REP-socketopen: illegal port"); + er2: ierror("REP-socketopen: no SIGIO handler present"); + er4: ierror("REP-socketopen: bad address mask"); ++ return NULL; // XXX + } + + #else /* dummy out these routines on machines that do not support TCP/IP */ diff --git a/lang/pc-lisp/patches/patch-src_bustrfnd.c b/lang/pc-lisp/patches/patch-src_bustrfnd.c new file mode 100644 index 00000000000..8f020530b74 --- /dev/null +++ b/lang/pc-lisp/patches/patch-src_bustrfnd.c @@ -0,0 +1,47 @@ +$NetBSD: patch-src_bustrfnd.c,v 1.1 2018/02/03 20:26:31 kamil Exp $ + +Port to NetBSD. + +--- src/bustrfnd.c.orig 2015-07-22 00:49:58.000000000 +0000 ++++ src/bustrfnd.c +@@ -4,7 +4,7 @@ + */ + #include <stdio.h> + #include "lisp.h" +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__NetBSD__) + #include <regex.h> + #endif + +@@ -14,7 +14,7 @@ + | because SYSV only handles a static pattern of its own hence we must be + | compatible with the minimum system. + */ +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__NetBSD__) + static regex_t pattern; + static int reUsed = 0; + #else +@@ -70,7 +70,7 @@ struct conscell *bustrsetpat(form) + *p++ = '$'; *p = '\0'; /* match end of string '$' */ + } else + strcpy(expr, s); +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__NetBSD__) + if (reUsed) + regfree(&pattern); + if (!regcomp(&pattern, expr, 0)) return(LIST(thold)); +@@ -102,7 +102,7 @@ struct conscell *bustrfndpat(form) + char *s; + if ((form != NULL)&&(form->cdrp == NULL)) { + if (GetString(form->carp, &s)) { +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__NetBSD__) + return( regexec(&pattern, s, 0, NULL, 0) ? NULL : LIST(thold) ); + #else + # if RE_COMP +@@ -119,4 +119,3 @@ struct conscell *bustrfndpat(form) + ierror("strfndpat"); /* doesn't return */ + return NULL; /* keep compiler happy */ + } +- diff --git a/lang/pc-lisp/patches/patch-src_lisp.h b/lang/pc-lisp/patches/patch-src_lisp.h new file mode 100644 index 00000000000..128106522cf --- /dev/null +++ b/lang/pc-lisp/patches/patch-src_lisp.h @@ -0,0 +1,25 @@ +$NetBSD: patch-src_lisp.h,v 1.1 2018/02/03 20:26:31 kamil Exp $ + +Port to NetBSD. + +--- src/lisp.h.orig 2015-07-22 00:49:58.000000000 +0000 ++++ src/lisp.h +@@ -39,6 +39,9 @@ + #if RTPC + # undef IBM_RT_AIX + # define IBM_RT_AIX 1 ++#elif defined(__NetBSD__) ++# undef BERKELEY_UNIX ++# define BERKELEY_UNIX 1 + #else + # if RS6000 + # undef IBM_RT_AIX +@@ -1183,8 +1186,3 @@ extern int liScanLineNum; + #define OPK_LIT2 4 /* has two <lit> args */ + #define OPK_INTERNAL 5 /* state change operation, arguments are internal to byte machine */ + #define OPK_N1 6 /* operation uses a single <n> argument */ +- +- +- +- +- |