Files
ports/lang/ficl/files/patch-tools.c
T
Raphael Kubo da Costa 26372dce2a 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)
2016-03-05 19:07:33 +00:00

77 lines
3.4 KiB
C

--- 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:
- sprintf(vm->pad, "variable = %ld (%#lx)\n", word->param->i, word->param->u);
+ sprintf(vm->pad, "variable = %ld (%#lx)\n", (long)word->param->i, (long unsigned)word->param->u);
ficlVmTextOut(vm, vm->pad);
break;
#if FICL_WANT_USER
case FICL_WORDKIND_USER:
- sprintf(vm->pad, "user variable %ld (%#lx)\n", word->param->i, word->param->u);
+ sprintf(vm->pad, "user variable %ld (%#lx)\n", (long)word->param->i, (long unsigned)word->param->u);
ficlVmTextOut(vm, vm->pad);
break;
#endif
case FICL_WORDKIND_CONSTANT:
- sprintf(vm->pad, "constant = %ld (%#lx)\n", word->param->i, word->param->u);
+ sprintf(vm->pad, "constant = %ld (%#lx)\n", (long)word->param->i, (long unsigned)word->param->u);
ficlVmTextOut(vm, vm->pad);
break;
case FICL_WORDKIND_2CONSTANT:
- sprintf(vm->pad, "constant = %ld %ld (%#lx %#lx)\n", word->param[1].i, word->param->i, word->param[1].u, word->param->u);
+ sprintf(vm->pad, "constant = %ld %ld (%#lx %#lx)\n", (long)word->param[1].i, (long)word->param->i, (long unsigned)word->param[1].u, (long unsigned)word->param->u);
ficlVmTextOut(vm, vm->pad);
break;
@@ -567,7 +567,7 @@ static ficlInteger ficlStackDisplayCallb
{
struct stackContext *context = (struct stackContext *)c;
char buffer[64];
- sprintf(buffer, "[0x%08x %3d]: %12d (0x%08x)\n", cell, context->count++, cell->i, cell->i);
+ sprintf(buffer, "[0x%08lx %3d]: %12ld (0x%08lx)\n", (long unsigned)cell, context->count++, (long)cell->i, (long unsigned)cell->u); /* Did it should be cell->i, not cell->u? */
ficlVmTextOut(context->vm, buffer);
return FICL_TRUE;
}
@@ -580,7 +580,7 @@ void ficlStackDisplay(ficlStack *stack,
FICL_STACK_CHECK(stack, 0, 0);
- sprintf(buffer, "[%s stack has %d entries, top at 0x%08x]\n", stack->name, ficlStackDepth(stack), stack->top);
+ sprintf(buffer, "[%s stack has %d entries, top at 0x%08lx]\n", stack->name, ficlStackDepth(stack), (long unsigned)stack->top);
ficlVmTextOut(vm, buffer);
if (callback == NULL)
@@ -592,7 +592,7 @@ void ficlStackDisplay(ficlStack *stack,
}
ficlStackWalk(stack, callback, context, FICL_FALSE);
- sprintf(buffer, "[%s stack base at 0x%08x]\n", stack->name, stack->base);
+ sprintf(buffer, "[%s stack base at 0x%08lx]\n", stack->name, (long unsigned)stack->base);
ficlVmTextOut(vm, buffer);
return;
@@ -612,7 +612,7 @@ static ficlInteger ficlStackDisplaySimpl
{
struct stackContext *context = (struct stackContext *)c;
char buffer[32];
- sprintf(buffer, "%s%d", context->count ? " " : "", cell->i);
+ sprintf(buffer, "%s%ld", context->count ? " " : "", (long)cell->i);
context->count++;
ficlVmTextOut(context->vm, buffer);
return FICL_TRUE;
@@ -644,7 +644,7 @@ static ficlInteger ficlReturnStackDispla
struct stackContext *context = (struct stackContext *)c;
char buffer[128];
- sprintf(buffer, "[0x%08x %3d] %12d (0x%08x)", cell, context->count++, cell->i, cell->i);
+ sprintf(buffer, "[0x%08lx %3d] %12ld (0x%08lx)", (long unsigned)cell, context->count++, (long)cell->i, (long unsigned)cell->u); /* Did it should be cell->i, not cell->u? */
/*
** Attempt to find the word that contains the return