Bring in some fixes from GSoC 2015.

There was a GSoC 2015 from Colin Lord to bring to the base system a recent
version of Ficl. pfg@ found many bugs in ficl4.

Among them:
- Fix ficlInstructionPick bug. Pick instructions from 0, not 1.
Credit to Toomas Soome from the Illumos project.
- Fix some math bugs.
Credit to Toomas Soome from the Illumos project.
- Fix bug in Ficl stack preventing the stack from growing.
Obtained from:    http://sourceforge.net/p/ficl/mailman/message/26634755/
- Change rand and srand calls to random and srandom

Fix those in the port. While here, unset MAKE_JOBS_UNSAFE as the port builds
fine without it, and get rid of the DATA option that has no effect.

PR:		207041
Submitted by:	pfg
Approved by:	Pavel Volkov <pavelivolkov@gmail.com> (maintainer)
This commit is contained in:
Raphael Kubo da Costa 2016-03-05 19:07:33 +00:00
parent 31f1e3c53f
commit 26372dce2a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=410201
9 changed files with 103 additions and 32 deletions

View file

@ -3,7 +3,7 @@
PORTNAME= ficl
PORTVERSION= 4.1.0
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= lang
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-all/${PORTNAME}${PORTVERSION:C/([[:digit:]]+\.[[:digit:]]+)\.0/\1/}
@ -15,10 +15,7 @@ LICENSE_NAME= BSD-style
LICENSE_TEXT= Description of the license can be obtained from the following URL: http://ficl.sourceforge.net/license.html
LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
OPTIONS_DEFINE= DATA DOCS
OPTIONS_DEFAULT= DATA
MAKE_JOBS_UNSAFE= YES
OPTIONS_DEFINE= DOCS
ONLY_FOR_ARCHS= i386 amd64
ONLY_FOR_ARCHS_REASON= this port is not tested on anything other than i386 and amd64

View file

@ -1,6 +1,6 @@
--- dictionary.c.orig 2010-09-12 19:14:52.000000000 +0400
+++ dictionary.c 2012-03-20 19:19:53.000000000 +0400
@@ -662,7 +662,7 @@
--- dictionary.c.orig 2010-09-12 15:14:52 UTC
+++ dictionary.c
@@ -662,7 +662,7 @@ void ficlDictionarySee(ficlDictionary *d
*trace++ = '>';
else
*trace++ = ' ';
@ -9,7 +9,7 @@
if (ficlDictionaryIsAWord(dictionary, word))
{
@@ -676,7 +676,7 @@
@@ -676,7 +676,7 @@ void ficlDictionarySee(ficlDictionary *d
break;
case FICL_WORDKIND_INSTRUCTION_WITH_ARGUMENT:
c = *++cell;
@ -18,7 +18,7 @@
break;
case FICL_WORDKIND_INSTRUCTION_WORD:
sprintf(trace, "%s :: executes %s (instruction word %ld)", word->name, ficlDictionaryInstructionNames[(long)word->code], (long)word->code);
@@ -687,20 +687,20 @@
@@ -687,20 +687,20 @@ void ficlDictionarySee(ficlDictionary *d
{
ficlWord *word = (ficlWord *)c.p;
sprintf(trace, "%.*s ( %#lx literal )",
@ -43,7 +43,7 @@
break;
#endif /* FICL_WANT_FLOAT */
case FICL_WORDKIND_STRING_LITERAL:
@@ -719,32 +719,32 @@
@@ -719,32 +719,32 @@ void ficlDictionarySee(ficlDictionary *d
break;
case FICL_WORDKIND_BRANCH0:
c = *++cell;
@ -83,7 +83,7 @@
break;
default:
sprintf(trace, "%.*s", word->length, word->name);
@@ -754,7 +754,7 @@
@@ -754,7 +754,7 @@ void ficlDictionarySee(ficlDictionary *d
}
else /* probably not a word - punt and print value */
{

View file

@ -0,0 +1,29 @@
--- double.c.orig 2010-09-12 15:18:07 UTC
+++ double.c
@@ -157,7 +157,7 @@ ficl2Integer ficl2IntegerMultiply(ficlIn
ficl2Integer ficl2IntegerDecrement(ficl2Integer x)
{
- if (x.low == INT_MIN)
+ if (x.low == INTMAX_MIN)
x.high--;
x.low--;
@@ -168,16 +168,11 @@ ficl2Integer ficl2IntegerDecrement(ficl2
ficl2Unsigned ficl2UnsignedAdd(ficl2Unsigned x, ficl2Unsigned y)
{
ficl2Unsigned result;
- int carry;
result.high = x.high + y.high;
result.low = x.low + y.low;
-
- carry = ((x.low | y.low) & FICL_CELL_HIGH_BIT) && !(result.low & FICL_CELL_HIGH_BIT);
- carry |= ((x.low & y.low) & FICL_CELL_HIGH_BIT);
-
- if (carry)
+ if (result.low < y.low)
{
result.high++;
}

View file

@ -1,6 +1,6 @@
--- ficl.h.orig Mon Dec 8 18:33:42 2003
+++ ficl.h Mon Dec 8 18:33:58 2003
@@ -163,6 +163,8 @@
--- ficl.h.orig 2010-10-03 09:52:12 UTC
+++ ficl.h
@@ -163,6 +163,8 @@ extern "C" {
#include "ficlplatform/ansi.h"
#elif defined(_WIN32)
#include "ficlplatform/win32.h"
@ -8,4 +8,4 @@
+ #include "ficlplatform/unix.h"
#elif defined (FREEBSD_ALPHA)
#include "ficlplatform/alpha.h"
#elif defined(linux)
#elif defined(unix) || defined(__unix__) || defined(__unix)

View file

@ -1,6 +1,6 @@
--- float.c.orig 2010-09-13 22:43:04.000000000 +0400
+++ float.c 2012-03-20 19:09:18.000000000 +0400
@@ -159,7 +159,7 @@
--- float.c.orig 2010-09-13 18:43:04 UTC
+++ float.c
@@ -159,7 +159,7 @@ static ficlInteger ficlFloatStackDisplay
{
struct stackContext *context = (struct stackContext *)c;
char buffer[64];

View file

@ -1,6 +1,6 @@
--- primitives.c.orig 2014-01-05 15:25:11.000000000 +0400
+++ primitives.c 2014-01-05 16:00:30.000000000 +0400
@@ -487,7 +487,7 @@
--- primitives.c.orig 2010-09-13 18:43:04 UTC
+++ primitives.c
@@ -487,7 +487,7 @@ static void ficlPrimitiveSprintf(ficlVm
ficlStackPushPointer(vm->dataStack, bufferStart);
ficlStackPushInteger(vm->dataStack, buffer - bufferStart);
@ -9,7 +9,7 @@
}
@@ -1350,7 +1350,7 @@
@@ -1350,7 +1350,7 @@ static void ficlPrimitiveSetObjectFlag(f
static void ficlPrimitiveIsObject(ficlVm *vm)
{

View file

@ -1,6 +1,6 @@
--- tools.c.orig 2010-08-12 17:57:22.000000000 +0400
+++ tools.c 2012-03-20 19:08:11.000000000 +0400
@@ -236,24 +236,24 @@
--- tools.c.orig 2010-08-12 13:57:22 UTC
+++ tools.c
@@ -236,24 +236,24 @@ static void ficlPrimitiveSeeXT(ficlVm *v
break;
case FICL_WORDKIND_VARIABLE:
@ -29,7 +29,7 @@
ficlVmTextOut(vm, vm->pad);
break;
@@ -567,7 +567,7 @@
@@ -567,7 +567,7 @@ static ficlInteger ficlStackDisplayCallb
{
struct stackContext *context = (struct stackContext *)c;
char buffer[64];
@ -38,7 +38,7 @@
ficlVmTextOut(context->vm, buffer);
return FICL_TRUE;
}
@@ -580,7 +580,7 @@
@@ -580,7 +580,7 @@ void ficlStackDisplay(ficlStack *stack,
FICL_STACK_CHECK(stack, 0, 0);
@ -47,7 +47,7 @@
ficlVmTextOut(vm, buffer);
if (callback == NULL)
@@ -592,7 +592,7 @@
@@ -592,7 +592,7 @@ void ficlStackDisplay(ficlStack *stack,
}
ficlStackWalk(stack, callback, context, FICL_FALSE);
@ -56,7 +56,7 @@
ficlVmTextOut(vm, buffer);
return;
@@ -612,7 +612,7 @@
@@ -612,7 +612,7 @@ static ficlInteger ficlStackDisplaySimpl
{
struct stackContext *context = (struct stackContext *)c;
char buffer[32];
@ -65,7 +65,7 @@
context->count++;
ficlVmTextOut(context->vm, buffer);
return FICL_TRUE;
@@ -644,7 +644,7 @@
@@ -644,7 +644,7 @@ static ficlInteger ficlReturnStackDispla
struct stackContext *context = (struct stackContext *)c;
char buffer[128];

View file

@ -0,0 +1,46 @@
--- vm.c.orig 2010-09-13 18:43:04 UTC
+++ vm.c
@@ -280,12 +280,12 @@ void ficlVmInnerLoop(ficlVm *vm, ficlWor
if (once)
count = 1;
- LOCAL_VARIABLE_REFILL;
-
oldExceptionHandler = vm->exceptionHandler;
vm->exceptionHandler = &exceptionHandler; /* This has to come before the setjmp! */
except = setjmp(exceptionHandler);
+ LOCAL_VARIABLE_REFILL;
+
if (except)
{
LOCAL_VARIABLE_SPILL;
@@ -717,8 +717,8 @@ AGAIN:
i = dataTop->i;
if (i < 0)
continue;
- CHECK_STACK(i + 1, i + 2);
- *dataTop = dataTop[-i];
+ CHECK_STACK(i + 2, i + 3);
+ *dataTop = dataTop[-i - 1];
continue;
}
@@ -1228,7 +1228,7 @@ COMPARE:
**************************************************************************/
case ficlInstructionRandom:
{
- (++dataTop)->i = rand();
+ (++dataTop)->u = random();
continue;
}
@@ -1239,7 +1239,7 @@ COMPARE:
**************************************************************************/
case ficlInstructionSeedRandom:
{
- srand((dataTop--)->i);
+ srandom((dataTop--)->u);
continue;
}

View file

@ -5,4 +5,3 @@ can typically be found in /usr/src/sys/boot/ficl on FreeBSD with the
bindings needed by the OS loader.
WWW: http://ficl.sourceforge.net/