From d34c34353b70a31ab7756d48a4e9fad87eb5d56c Mon Sep 17 00:00:00 2001 From: "G. Schoenmakers" Date: Sat, 23 Feb 2013 23:00:15 -0600 Subject: development/kforth: Added (A Forth programming language and environment) Signed-off-by: Robby Workman --- development/kforth/ForthVM.diff | 78 ++++++++++++++++++++++++++++++++++++ development/kforth/Makefile.diff | 48 ++++++++++++++++++++++ development/kforth/README | 10 +++++ development/kforth/kforth.SlackBuild | 66 ++++++++++++++++++++++++++++++ development/kforth/kforth.info | 10 +++++ development/kforth/slack-desc | 19 +++++++++ 6 files changed, 231 insertions(+) create mode 100644 development/kforth/ForthVM.diff create mode 100644 development/kforth/Makefile.diff create mode 100644 development/kforth/README create mode 100644 development/kforth/kforth.SlackBuild create mode 100644 development/kforth/kforth.info create mode 100644 development/kforth/slack-desc (limited to 'development') diff --git a/development/kforth/ForthVM.diff b/development/kforth/ForthVM.diff new file mode 100644 index 0000000000..494b515fc4 --- /dev/null +++ b/development/kforth/ForthVM.diff @@ -0,0 +1,78 @@ +Index: ForthVM.cpp +=================================================================== +--- ForthVM.cpp (revision 7) ++++ ForthVM.cpp (working copy) +@@ -155,6 +155,14 @@ + // PUSH_IVAL and PUSH_ADDR + // 2011-02-06 km fixed problem with FS. not restoring original precision. + // 2011-03-05 km removed commented out code which was replaced by macros. ++// 2011-03-10 km added global string dir_env_var to allow default directory ++// environment variable to be specified externally, in the ++// Makefile. ++// 2011-11-01 km revised CPP_allot to ensure all created words which have ++// ALLOTed memory also have appropriate execution code; ++// This change also allows removal of common code from ++// CPP_variable and CPP_fvariable. ++const char* dir_env_var=DIR_ENV_VAR; + + #include + #include +@@ -1550,6 +1558,13 @@ + { + id->Pfa = new byte[n]; + if (id->Pfa) memset (id->Pfa, 0, n); ++ ++ // Provide execution code to the word to return its Pfa ++ byte *bp = new byte[6]; ++ id->Cfa = bp; ++ bp[0] = OP_ADDR; ++ *((int*) &bp[1]) = (int) id->Pfa; ++ bp[5] = OP_RET; + } + else + return E_V_REALLOT; +@@ -1642,14 +1657,7 @@ + DEC_DSP + STD_IVAL + int e = CPP_allot(); +- if (e) return e; +- WordIndex id = pCompilationWL->end() - 1; +- byte *bp = new byte[6]; +- id->Cfa = bp; +- bp[0] = OP_ADDR; +- *((int*) &bp[1]) = (int) id->Pfa; +- bp[5] = OP_RET; +- return 0; ++ return e; + } + //----------------------------------------------------------------- + +@@ -1662,14 +1670,7 @@ + DEC_DSP + STD_IVAL + int e = CPP_allot(); +- if (e) return e; +- WordIndex id = pCompilationWL->end() - 1; +- byte *bp = new byte[6]; +- id->Cfa = bp; +- bp[0] = OP_ADDR; +- *((int*) &bp[1]) = (int) id->Pfa; +- bp[5] = OP_RET; +- return 0; ++ return e; + } + //------------------------------------------------------------------ + +@@ -2464,10 +2465,10 @@ + ifstream f(filename); + if (!f) + { +- if (getenv("KFORTH_DIR")) ++ if (getenv(dir_env_var)) + { + char temp[256]; +- strcpy(temp, getenv("KFORTH_DIR")); ++ strcpy(temp, getenv(dir_env_var)); + strcat(temp, "/"); + strcat(temp, filename); + strcpy(filename, temp); diff --git a/development/kforth/Makefile.diff b/development/kforth/Makefile.diff new file mode 100644 index 0000000000..8223cc7742 --- /dev/null +++ b/development/kforth/Makefile.diff @@ -0,0 +1,48 @@ +Index: Makefile +=================================================================== +--- Makefile (revision 7) ++++ Makefile (working copy) +@@ -31,6 +31,9 @@ + # 2011-03-05 km; revised archive and snapshot rules to exclude version + # control subdirectories in the archive files (since we + # now using Subversion for source control) ++# 2011-03-10 km; define name of environment variable containing default ++# Forth source directory, and pass to compiler. ++# 2011-11-01 km; updated version to 1.5.2p1 + # + # Possible invocations: + # +@@ -50,7 +53,8 @@ + # Invoke "make debug" if you want to create an executable + # that contains debugging information for the GNU debugger (gdb). + +-VERSION = 1.5.2 ++VERSION = 1.5.2p1 ++DEF_DIR_VAR=KFORTH_DIR + BUILD_DATE=`date +%F` + DEBUG = + TARGET_CPU = x86 +@@ -64,7 +68,7 @@ + + CPP = ${GCCDIR}/g++ + CC = ${GCCDIR}/gcc +-CPPFLAGS = -c -m32 ++CPPFLAGS = -c -m32 + CFLAGS = -c -m32 + FAST = -D__FAST__ + OBJS = kforth.o ForthVM.o ForthCompiler.o vm.o vmc.o +@@ -118,10 +122,12 @@ + ${CPP} ${CPPFLAGS} ${DEBUG} ForthCompiler.cpp + + ForthVM.o: ForthVM.cpp ForthVM.h fbc.h ForthCompiler.h kfmacros.h +- ${CPP} ${CPPFLAGS} ${DEBUG} ForthVM.cpp ++ ${CPP} ${CPPFLAGS} -DDIR_ENV_VAR=\"${DEF_DIR_VAR}\" \ ++ ${DEBUG} ForthVM.cpp + + ForthVM-fast.o: ForthVM.cpp ForthVM.h fbc.h ForthCompiler.h kfmacros.h +- ${CPP} ${CPPFLAGS} ${DEBUG} ${FAST} -o ForthVM-fast.o ForthVM.cpp ++ ${CPP} ${CPPFLAGS} -DDIR_ENV_VAR=\"${DEF_DIR_VAR}\" \ ++ ${DEBUG} ${FAST} -o ForthVM-fast.o ForthVM.cpp + + vmc.o: vmc.c kfmacros.h + ${CC} ${CFLAGS} ${DEBUG} vmc.c diff --git a/development/kforth/README b/development/kforth/README new file mode 100644 index 0000000000..8d0ce87122 --- /dev/null +++ b/development/kforth/README @@ -0,0 +1,10 @@ +kForth is an implementation of the Forth programming language and +environment. The user may write Forth programs with an editor, +load these program files from kForth, and run them. kForth, like +other implementations of Forth, provides an interactive environment, +allowing the user to examine or define variables and execute or +define individual words. + +kForth is designed to be installed on a 32-bit linux operating system. +It will not install on 64-bit Slackware unless multilib support is +installed. \ No newline at end of file diff --git a/development/kforth/kforth.SlackBuild b/development/kforth/kforth.SlackBuild new file mode 100644 index 0000000000..e601b9549c --- /dev/null +++ b/development/kforth/kforth.SlackBuild @@ -0,0 +1,66 @@ +#!/bin/sh + +# Slackware build script for kforth + +# Written by G. Schoenmakers + +PRGNAM=kforth +VERSION=${VERSION:-1.5.2} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +MODEL=${MODEL:-x86-linux} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$MODEL-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +patch ForthVM.cpp $CWD/ForthVM.diff +patch Makefile $CWD/Makefile.diff +VERSION=${VERSION}p1 + +make + +# There is no "make install" so the following instructions are used to copy +# the relevant files into the $PKG directory. + +mkdir -p $PKG/usr/bin +cp -a kforth $PKG/usr/bin +cp -a kforth-fast $PKG/usr/bin + +mkdir -p $PKG/usr/share/pixmaps +cp -a kforth.xpm $PKG/usr/share/pixmaps + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a ChangeLog README examples $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$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:-tgz} diff --git a/development/kforth/kforth.info b/development/kforth/kforth.info new file mode 100644 index 0000000000..d1dd8824d5 --- /dev/null +++ b/development/kforth/kforth.info @@ -0,0 +1,10 @@ +PRGNAM="kforth" +VERSION="1.5.2p1" +HOMEPAGE="http://ccreweb.org/software/kforth/kforth.html" +DOWNLOAD="ftp://ccreweb.org/software/kforth/linux/kforth-x86-linux-1.5.2.tar.gz" +MD5SUM="8def6b906289fc2f2b404a7be8e8d9ce" +DOWNLOAD_x86_64="UNTESTED" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="G. Schoenmakers" +EMAIL="gschoen@iinet.net.au" diff --git a/development/kforth/slack-desc b/development/kforth/slack-desc new file mode 100644 index 0000000000..635e645617 --- /dev/null +++ b/development/kforth/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------------------------------------------------------| +kforth: kforth (A Forth programming language and environment) +kforth: +kforth: kForth is an implementation of the Forth programming language and +kforth: environment. The user may write Forth programs with an editor, +kforth: load these program files from kForth, and run them. kForth, like +kforth: other implementations of Forth, provides an interactive environment, +kforth: allowing the user to examine or define variables and execute or +kforth: define individual words. +kforth: +kforth: http://ccreweb.org/software/kforth/kforth1.html +kforth: -- cgit v1.2.3