diff options
author | B. Watson <urchlay@slackware.uk> | 2023-04-28 10:14:08 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-04-29 18:11:44 +0700 |
commit | e60f4c06816fb63f104703ec1cf96359c526fb24 (patch) | |
tree | 849bcd0a1fdc4d5fe4a11dd08d9e9606e5657e9d /development/focal | |
parent | 86af8dcfaa6b6e1b8be4b52d1a357d7bc75a816e (diff) |
development/focal: Added (FOCAL language interpreter)
Signed-off-by: bedlam <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'development/focal')
-rw-r--r-- | development/focal/README | 24 | ||||
-rw-r--r-- | development/focal/beer.foc | 24 | ||||
-rw-r--r-- | development/focal/focal.SlackBuild | 102 | ||||
-rw-r--r-- | development/focal/focal.info | 10 | ||||
-rw-r--r-- | development/focal/hello.foc | 1 | ||||
-rw-r--r-- | development/focal/slack-desc | 19 |
6 files changed, 180 insertions, 0 deletions
diff --git a/development/focal/README b/development/focal/README new file mode 100644 index 000000000000..b28995ba0b04 --- /dev/null +++ b/development/focal/README @@ -0,0 +1,24 @@ +focal (FOCAL language interpreter) + +FOCAL is an interactive interpreted programming language based on JOSS +and mostly used on DEC PDP series machines. It is an ancestor of (or +at least an influence on) the BASIC language. For more information on +FOCAL, see: https://en.wikipedia.org/wiki/FOCAL_(programming_language) + +This implementation is by Dave Conroy and Akira KIDA. It comes from Eric +Raymond and John Cowan's Retrocomputing Museum: +http://www.catb.org/retro/ + +See /usr/doc/focal-$VERSION/focal_doc.txt for the language +specification. See /usr/share/focal for sample code. Loading and +running a FOCAL program is done like so: + + $ focal + *lib call program.foc + *g + +Enter "quit" at the * prompt to exit. + +There is a small archive of FOCAL programs available here: +ftp://ftp.pdp8.net/software/games/focal/ +...although not all of them are compatible with this version of FOCAL. diff --git a/development/focal/beer.foc b/development/focal/beer.foc new file mode 100644 index 000000000000..13beb83ccf9c --- /dev/null +++ b/development/focal/beer.foc @@ -0,0 +1,24 @@ +01.10 c Focal-8 version of 99 Bottles of beer +01.20 c Hacked by Akira KIDA, <SDI00379@niftyserve.or.jp> +01.30 c Made to actually work by Dave Pitts <dpitts@cozx.com> +10.10 set bottles = 99 +10.20 do 20 +10.30 quit +20.10 for j=1,bottles; set i=bottles+1-j;do 30 +20.20 return +30.10 set b = i +30.20 do 40 ; type " on the wall, " +30.30 do 40 ; type ".", ! , "Take one down, pass it around.", ! +30.40 set b = i - 1 +30.50 do 40 ; type " on the wall.", !, ! +30.60 return +40.10 do 50 +40.20 type " of beer" +40.30 return +50.10 if (b - 1) 50.20, 50.40, 50.60 +50.20 type "No more bottles" +50.30 return +50.40 type %1.0, b, " bottle" +50.50 return +50.60 type %1.0, b, " bottles" +50.70 return diff --git a/development/focal/focal.SlackBuild b/development/focal/focal.SlackBuild new file mode 100644 index 000000000000..4a9fc6be114f --- /dev/null +++ b/development/focal/focal.SlackBuild @@ -0,0 +1,102 @@ +#!/bin/bash + +# Slackware build script for focal + +# Written by B. Watson (urchlay@slackware.uk) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# VERSION is the date on the files inside the tarball. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=focal +VERSION=${VERSION:-19950417} +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" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" +else + SLKCFLAGS="-O2" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM +tar xvf $CWD/$PRGNAM.tar.gz +cd $PRGNAM +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 {} \+ + +# Use our flags. +sed -i "/^CFLAGS/s,-O -g,$SLKCFLAGS," Makefile + +# Fix compile issues on modern gcc. Yes, it uses the hated and +# deprecated gets(). There are still some compiler warnings (implicit +# int for e.g. "register c;") but they don't seem to do harm. +sed -i '1iextern char *gets(char *s);' focal.h +sed -i '67s,|,||,' focal3.c # wrong: if (ln<1 | ln>99) +sed -i 's,\<getline\>,Getline,g' *.c *.h + +make + +# Test the thing now that it's built. +cat <<EOF | ./focal > test.out +lib call queens.foc +g +quit +EOF +if grep -q 'Total 92 answers' test.out; then + echo "=== Self-test passed." +else + echo "=== Self-test FAILED, bailing." + exit 1 +fi + +# beer.foc comes from https://www.99-bottles-of-beer.net/language-focal-2514.html +# hello.foc comes from https://github.com/leachim6/hello-world but it had to +# be modified (this FOCAL hates the line number with 4 parts). +PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION +mkdir -p $PKG/usr/bin $PKGDOC $PKG/usr/share/$PRGNAM +install -s -m0755 $PRGNAM $PKG/usr/bin/$PRGNAM +install -oroot -groot -m0644 *.foc $CWD/*.foc $PKG/usr/share/$PRGNAM + +# Rename, in case KDE or XFCE thinks it should open this with Calligra +# or MS-Word in Wine, based on the filename extension. +mv focal.doc focal_doc.txt + +cp -a README focal_doc.txt $PKGDOC +cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/development/focal/focal.info b/development/focal/focal.info new file mode 100644 index 000000000000..7847e9773a6b --- /dev/null +++ b/development/focal/focal.info @@ -0,0 +1,10 @@ +PRGNAM="focal" +VERSION="19950417" +HOMEPAGE="http://www.catb.org/retro/" +DOWNLOAD="http://www.catb.org/retro/focal.tar.gz" +MD5SUM="de1db172fca2489dd701a7377342de03" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="B. Watson" +EMAIL="urchlay@slackware.uk" diff --git a/development/focal/hello.foc b/development/focal/hello.foc new file mode 100644 index 000000000000..a13024bc7779 --- /dev/null +++ b/development/focal/hello.foc @@ -0,0 +1 @@ +01.01 TYPE "HELLO WORLD",! diff --git a/development/focal/slack-desc b/development/focal/slack-desc new file mode 100644 index 000000000000..956398b7e4ac --- /dev/null +++ b/development/focal/slack-desc @@ -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------------------------------------------------------| +focal: focal (FOCAL language interpreter) +focal: +focal: FOCAL is an interactive interpreted programming language based on JOSS +focal: and mostly used on DEC PDP series machines. It is an ancestor of (or +focal: at least an influence on) the BASIC language. For more information on +focal: FOCAL, see: https://en.wikipedia.org/wiki/FOCAL_(programming_language) +focal: +focal: +focal: +focal: +focal: |