development/kforth: Updated for version 1.8.0.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Antonio Leal 2023-12-01 08:30:52 +07:00 committed by Willy Sudiarto Raharjo
parent 5da56c5b38
commit e3bf01d803
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
8 changed files with 102 additions and 174 deletions

View File

@ -1,78 +0,0 @@
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 <string.h>
#include <stdlib.h>
@@ -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);

View File

@ -1,48 +0,0 @@
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

View File

@ -8,3 +8,9 @@ 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.
This package contains the updates made to the branch 1.x originally
available at ccreweb.org (now only acessible through archive.org as
http://ccreweb.org/software/kforth/kforth.html). It provided for
legacy purposes, as the kForth-32 branch 2.x is more actievly
maintained.

View File

@ -0,0 +1,13 @@
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi
if [ -x /usr/bin/update-mime-database ]; then
/usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1
fi
if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
if [ -x /usr/bin/gtk-update-icon-cache ]; then
/usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
fi
fi

View File

@ -1,25 +1,37 @@
#!/bin/bash
# Slackware build script for kforth
# Slackware build script for kForth-32 branch 1.x.x
# Written by G. Schoenmakers <gschoen@iinet.net.au>
# 20220318 bkw: Modified by SlackBuilds.org:
# - fix build on 15.0.
# - use SLKCFLAGS.
# - strip the binaries.
# - check ARCH and exit if unsupported.
# Copyright 2023 Antonio Leal, Porto Salvo, Oeiras, Portugal
# Modified by SlackBuilds.org on 2022/03/18
# Copyright 2022 G. Schoenmakers <gschoen@iinet.net.au>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=kforth
VERSION=${VERSION:-1.5.2p1}
SRCVER="$( echo $VERSION | cut -dp -f1 )"
VERSION=${VERSION:-1.8.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
MODEL=${MODEL:-x86-linux}
TARBALL=${TARBALL:-kForth-32-$VERSION}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
@ -40,58 +52,70 @@ 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
case "$ARCH" in
i?86) ;; # OK
*) echo "Unsupported ARCH '$ARCH'"; exit 1 ;;
esac
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$SRCVER
tar xvf $CWD/$PRGNAM-$MODEL-$SRCVER.tar.gz
cd $PRGNAM-$SRCVER
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$TARBALL.tar.gz
mv $TARBALL $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -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 {} \+
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \+ -o \
\( -perm 666 -o -perm 664 -o -perm 640 -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
cd src
make
# 20220318 bkw: pow10() is deprecated, according to its man
# page. and apparently it's also a macro, since taking its address
# fails. exp10() performs exactly the same, and is a real function...
sed -i 's,\<pow10\>,exp10,g' vmc.c
# 20220318 bkw: sneak our CFLAGS in...
make CC="gcc $SLKCFLAGS" CPP="g++ $SLKCFLAGS"
# There is no "make install" so the following instructions are used to copy
# the relevant files into the $PKG directory.
rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
mkdir -p $PKG/usr/bin
install -s -m0755 $PRGNAM $PRGNAM-fast $PKG/usr/bin
install -Dsv -m 0755 kforth32 $PKG/usr/bin/kforth
install -Dsv -m 0755 kforth32-fast $PKG/usr/bin/kforth-fast
mkdir -p $PKG/usr/share/kforth
cd ../forth-src
cp -avxu * $PKG/usr/share/kforth
cd ../doc
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp *.* $PKG/usr/doc/$PRGNAM-$VERSION
cp $CWD/dpans94.pdf $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/etc/profile.d
cat <<EOF >$PKG/etc/profile.d/kforth.sh
#!/bin/sh
export KFORTH_DIR=/usr/share/kforth
EOF
chmod 0755 $PKG/etc/profile.d/kforth.sh
mkdir -p $PKG/usr/share/pixmaps
cp -a kforth.xpm $PKG/usr/share/pixmaps
cp $TMP/$PRGNAM-$VERSION/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/usr/share/applications
cp $CWD/kforth.desktop $PKG/usr/share/applications
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Name=kforth
Comment=kforth (1.x) is a 32-bit Forth System for x86
Exec=/usr/bin/kforth
Icon=/usr/share/pixmaps/kforth.xpm
Terminal=true
Type=Application
Categories=Development;

View File

@ -1,10 +1,12 @@
PRGNAM="kforth"
VERSION="1.5.2p1"
HOMEPAGE="https://web.archive.org/web/20180109141744/http://ccreweb.org/software/kforth/kforth.html"
DOWNLOAD="http://ponce.cc/slackware/sources/repo/kforth-x86-linux-1.5.2.tar.gz"
MD5SUM="8def6b906289fc2f2b404a7be8e8d9ce"
VERSION="1.8.0"
HOMEPAGE="https://github.com/mynenik/kForth-32"
DOWNLOAD="https://github.com/mynenik/kForth-32/archive/refs/tags/v1.8.0/kForth-32-1.8.0.tar.gz \
https://github.com/antonioleal/slackbuilds/raw/main/kforth/dpans94.pdf"
MD5SUM="5d5b822ad399b0261eee68ba1761219c \
9ec4c6ae1f460415ecab6051f4e278b5"
DOWNLOAD_x86_64="UNTESTED"
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="G. Schoenmakers"
EMAIL="gschoen@iinet.net.au"
MAINTAINER="Antonio Leal"
EMAIL="antonio.leal@yahoo.com"

View File

@ -15,5 +15,5 @@ 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:
kforth: This package contains the branch 1.x of kforth for legacy systems.
kforth: