development/ieee-pilot: Added (CAI language Pilot impl).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2024-09-13 06:23:56 +09:00 committed by Willy Sudiarto Raharjo
parent 959df34ebc
commit 19ce1d0eb5
No known key found for this signature in database
GPG key ID: 3F617144D7238786
6 changed files with 252 additions and 0 deletions

View file

@ -0,0 +1,15 @@
ieee-pilot (implementation of the PILOT programming language)
Reference implementation of IEEE Pilot, a CAI language. This is an
implementation of the very old (1962) CAI language Pilot, as described
by IEEE Std 1154-1991, ISBN 1-55937-151-X.
ieee-pilot can run as an interpreter or compile Pilot programs to
standalone executables. It supports some extensions to the language,
taken from the Atari, Apple, and Nevada implementations. Also, an
ieee-pilotconv utility is included, which converts Capitol Pilot
programs to standard IEEE Pilot.
To avoid conflicting with Slackware's alpine package (which has a
/usr/bin/pilot command), the executables and man pages are installed
as ieee-pilot and ieee-pilotconv.

View file

@ -0,0 +1,66 @@
diff --git a/pilot.adoc b/pilot.adoc
index bdfc926..4303b0f 100644
--- a/pilot.adoc
+++ b/pilot.adoc
@@ -1,11 +1,11 @@
-= pilot(1) =
+= ieee-pilot(1) =
:doctype: manpage
== NAME ==
-pilot - interpreter and compiler for IEEE Std 1154-1991 PILOT
+ieee-pilot - interpreter and compiler for IEEE Std 1154-1991 PILOT
== SYNOPSIS ==
-pilot [-dcmpk] [-v num[y]] [files...]
+ieee-pilot [-dcmpk] [-v num[y]] [files...]
== DESCRIPTION ==
This program is an interpreter/compiler for IEEE PILOT. Details of the
diff --git a/pilotconv.adoc b/pilotconv.adoc
index 61e730e..89de566 100644
--- a/pilotconv.adoc
+++ b/pilotconv.adoc
@@ -1,11 +1,11 @@
-= pilotconv(1) =
+= ieee-pilotconv(1) =
:doctype: manpage
== NAME ==
-pilotconv - convert source to IEEE Std 1154-1991 PILOT
+ieee-pilotconv - convert source to IEEE Std 1154-1991 PILOT
== SYNOPSIS ==
-pilotconv
+ieee-pilotconv
== DESCRIPTION ==
This program does some conformance checking for IEEE PILOT, and
@@ -26,8 +26,8 @@ are written to standard error and should be self-explanatory.
== NOTE ==
For a better (but slower) conformance test, compile the program using
-pilot's -c option. For a much stricter test, disallowing extensions
-present in the this reference implentation but not described in the
+ieee-pilot's -c option. For a much stricter test, disallowing extensions
+present in the this reference implementation but not described in the
standard, add the -p (pedantic) option.
== AUTHOR ==
diff --git a/tour.adoc b/tour.adoc
index 2152bd8..0ef9095 100644
--- a/tour.adoc
+++ b/tour.adoc
@@ -90,10 +90,10 @@ PILOT library primitive is the MATCH operation.
== Portability considerations
This PILOT is written in ANSI C99, YACC, and LEX. It will make and
-run correctly on any modern Unix carring Bison and Flex.
+run correctly on any modern Unix carrying Bison and Flex.
The only serious problem is the call to the C compiler to bash
-generated C code into executable bits (this is in gencode.c:execfile().
+generated C code into executable bits (this is in gencode.c:execfile()).
This should work on any UNIX system, provided you have your pilot
directory variable PILOTDIR set up properly and put a copy of pilot.h
there. If you're porting this to MS-DOS or whatever, string together

View file

@ -0,0 +1,38 @@
diff --git a/gencode.c b/gencode.c
index 0909641..4d4ec8b 100644
--- a/gencode.c
+++ b/gencode.c
@@ -529,8 +529,11 @@ void solhook(char *s) {
vp->v.label.addr <= ftell(yyin) &&
vp->v.label.addr >=
ftell(yyin) - (int)strlen(s)) {
- (void)fprintf(yyout, "plt_%s:\n",
- vp->name);
+ static char *last_emitted;
+ if(last_emitted != vp->name) {
+ (void)fprintf(yyout, "plt_%s:\n", vp->name);
+ last_emitted = vp->name;
+ }
}
}
@@ -1227,6 +1230,10 @@ int execfile(char *t) {
(void)fprintf(yyout, "/* %s -- generated C code for %s */\n",
outfile, source);
(void)fputs("#include <stdio.h>\n", yyout);
+ (void)fputs("#include <string.h>\n", yyout);
+ (void)fputs("#include <unistd.h>\n", yyout);
+ (void)fputs("#include <stdlib.h>\n", yyout);
+ (void)fputs("extern char *gets(char *s);\n", yyout);
(void)fputs("#include \"pilot.h\"\n", yyout);
/* generate declarations for all non-system variables */
@@ -1256,7 +1263,7 @@ int execfile(char *t) {
(void)fputs(PASS2, stderr);
}
- (void)fputs("\nmain()\n{\n do_scrinit();\n", yyout);
+ (void)fputs("\nint main(int argc, char **argv)\n{\n do_scrinit();\n", yyout);
indent = 1;
}

View file

@ -0,0 +1,104 @@
#!/bin/bash
# Slackware build script for ieee-pilot
# Written by B. Watson (urchlay@slackware.uk)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=ieee-pilot
VERSION=${VERSION:-1.11}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +
# Fix man pages so they refer to ieee-pilot and ieee-pilotconv.
# Also, fix a couple of typos in the docs.
patch -p1 < $CWD/docs.diff
# Fix error in generated C code: a comment (R) followed by label
# results in the label being emitted twice (which fails to compile
# in modern gcc or clang). This affects the speaknum.p example.
# The fix is a "band-aid", but effective.
# Also, fix warnings in generated C code (-c option).
patch -p1 < $CWD/gencode.diff
LIBDIR=/usr/lib$LIBDIRSUFFIX/$PRGNAM
PKGLIB=$PKG$LIBDIR
PKGBIN=$PKG/usr/bin
PKGMAN1=$PKG/usr/man/man1
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
CONV=${PRGNAM}conv
sed -i "/PILOTDIR/s,/usr/lib/pilot/,$LIBDIR," pilot.h
# The -j1 is needed. Parallel makes don't speed this up much
# anyway, because it's a tiny project.
make -j1 all man html OPTFLAGS="$SLKCFLAGS" PILOTDIR=$LIBDIR
mkdir -p $PKGLIB $PKGBIN $PKGMAN1 $PKGDOC/examples
install -m0644 libpilot.a pilot.h $PKGLIB
install -m0755 -s pilot $PKGBIN/$PRGNAM
install -m0755 -s pilotconv $PKGBIN/$CONV
gzip -9 < $PRGNAM.1 > $PKGMAN1/$PRGNAM.1.gz
gzip -9 < $CONV.1 > $PKGMAN1/$CONV.1.gz
cp -a COPYING NEWS README TODO *.html *.jpg $PKGDOC
cp -a *.p $PKGDOC/examples
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
find usr/man -type f -a -name '*.gz' \
-printf "chroot . /usr/bin/mandb -f '/%p' &> /dev/null\n" \
>> install/doinst.sh
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

View file

@ -0,0 +1,10 @@
PRGNAM="ieee-pilot"
VERSION="1.11"
HOMEPAGE="http://www.catb.org/esr/ieee-pilot/"
DOWNLOAD="https://gitlab.com/esr/ieee-pilot/-/archive/1.11/ieee-pilot-1.11.tar.gz"
MD5SUM="049697a58411dce4ee1282ab190d6efa"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="B. Watson"
EMAIL="urchlay@slackware.uk"

View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
ieee-pilot: ieee-pilot (implementation of the PILOT programming language)
ieee-pilot:
ieee-pilot: Reference implementation of IEEE Pilot, a CAI language. This is an
ieee-pilot: implementation of the very old (1962) CAI language Pilot, as described
ieee-pilot: by IEEE Std 1154-1991, ISBN 1-55937-151-X.
ieee-pilot:
ieee-pilot: ieee-pilot can run as an interpreter or compile Pilot programs to
ieee-pilot: standalone executables. It supports some extensions to the language,
ieee-pilot: taken from the Atari, Apple, and Nevada implementations.
ieee-pilot:
ieee-pilot: