socsvn commit: r287874 - soc2015/clord/head/sys/contrib/ficl

clord at FreeBSD.org clord at FreeBSD.org
Thu Jul 2 20:05:42 UTC 2015


Author: clord
Date: Thu Jul  2 20:05:39 2015
New Revision: 287874
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=287874

Log:
  Apply patches to Ficl soruce from the existing Ficl port

Modified:
  soc2015/clord/head/sys/contrib/ficl/dictionary.c
  soc2015/clord/head/sys/contrib/ficl/ficl.h
  soc2015/clord/head/sys/contrib/ficl/float.c
  soc2015/clord/head/sys/contrib/ficl/primitives.c
  soc2015/clord/head/sys/contrib/ficl/tools.c

Modified: soc2015/clord/head/sys/contrib/ficl/dictionary.c
==============================================================================
--- soc2015/clord/head/sys/contrib/ficl/dictionary.c	Thu Jul  2 19:41:08 2015	(r287873)
+++ soc2015/clord/head/sys/contrib/ficl/dictionary.c	Thu Jul  2 20:05:39 2015	(r287874)
@@ -662,7 +662,7 @@
             *trace++ = '>';
         else
             *trace++ = ' ';
-        trace += sprintf(trace, "%3d   ", cell - param0);
+        trace += sprintf(trace, "%3ld   ", (long)(cell - param0));
         
         if (ficlDictionaryIsAWord(dictionary, word))
         {
@@ -676,7 +676,7 @@
                 break;
             case FICL_WORDKIND_INSTRUCTION_WITH_ARGUMENT:
                 c = *++cell;
-                sprintf(trace, "%s (instruction %ld), with argument %ld (%#lx)", ficlDictionaryInstructionNames[(long)word], (long)word, c.i, c.u);
+                sprintf(trace, "%s (instruction %ld), with argument %ld (%#lx)", ficlDictionaryInstructionNames[(long)word], (long)word, (long)c.i, (long unsigned)c.u);
                 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 @@
                 {
                     ficlWord *word = (ficlWord *)c.p;
                     sprintf(trace, "%.*s ( %#lx literal )", 
-                        word->length, word->name, c.u);
+                        word->length, word->name, (long unsigned)c.u);
                 }
                 else
-                    sprintf(trace, "literal %ld (%#lx)", c.i, c.u);
+                    sprintf(trace, "literal %ld (%#lx)", (long)c.i, (long unsigned)c.u);
                 break;
             case FICL_WORDKIND_2LITERAL:
                 c = *++cell;
                 c2 = *++cell;
-                sprintf(trace, "2literal %d %d (%#lx %#lx)", c2.i, c.i, c2.u, c.u);
+                sprintf(trace, "2literal %ld %ld (%#lx %#lx)", (long)c2.i, (long)c.i, (long unsigned)c2.u, (long unsigned)c.u);
                 break;
 #if FICL_WANT_FLOAT
             case FICL_WORDKIND_FLITERAL:
                 c = *++cell;
-                sprintf(trace, "fliteral %f (%#lx)", c.f, c.u);
+                sprintf(trace, "fliteral %f (%#lx)", (double)c.f, (long unsigned)c.u);
                 break;
 #endif /* FICL_WANT_FLOAT */
             case FICL_WORDKIND_STRING_LITERAL:
@@ -719,32 +719,32 @@
                 break;
             case FICL_WORDKIND_BRANCH0:
                 c = *++cell;
-                sprintf(trace, "branch0 %d", cell + c.i - param0);
+                sprintf(trace, "branch0 %ld", (long)(cell + c.i - param0));
                 break;                                                           
             case FICL_WORDKIND_BRANCH:
                 c = *++cell;
-                sprintf(trace, "branch %d",     cell + c.i - param0);
+                sprintf(trace, "branch %ld", (long)(cell + c.i - param0));
                 break;
 
             case FICL_WORDKIND_QDO:
                 c = *++cell;
-                sprintf(trace, "?do (leave %d)",  (ficlCell *)c.p - param0);
+                sprintf(trace, "?do (leave %ld)", (long)((ficlCell *)c.p - param0));
                 break;
             case FICL_WORDKIND_DO:
                 c = *++cell;
-                sprintf(trace, "do (leave %d)", (ficlCell *)c.p - param0);
+                sprintf(trace, "do (leave %ld)", (long)((ficlCell *)c.p - param0));
                 break;
             case FICL_WORDKIND_LOOP:
                 c = *++cell;
-                sprintf(trace, "loop (branch %d)", cell + c.i - param0);
+                sprintf(trace, "loop (branch %ld)", (long)(cell + c.i - param0));
                 break;
             case FICL_WORDKIND_OF:
                 c = *++cell;
-                sprintf(trace, "of (branch %d)",      cell + c.i - param0);
+                sprintf(trace, "of (branch %ld)", (long)(cell + c.i - param0));
                 break;
             case FICL_WORDKIND_PLOOP:
                 c = *++cell;
-                sprintf(trace, "+loop (branch %d)", cell + c.i - param0);
+                sprintf(trace, "+loop (branch %ld)", (long)(cell + c.i - param0));
                 break;
             default:
                 sprintf(trace, "%.*s", word->length, word->name);
@@ -754,7 +754,7 @@
         }
         else /* probably not a word - punt and print value */
         {
-            sprintf(trace, "%ld ( %#lx )", cell->i, cell->u);
+            sprintf(trace, "%ld ( %#lx )", (long)cell->i, (long unsigned)cell->u);
         }
 
         ficlCallbackTextOut(callback, buffer);

Modified: soc2015/clord/head/sys/contrib/ficl/ficl.h
==============================================================================
--- soc2015/clord/head/sys/contrib/ficl/ficl.h	Thu Jul  2 19:41:08 2015	(r287873)
+++ soc2015/clord/head/sys/contrib/ficl/ficl.h	Thu Jul  2 20:05:39 2015	(r287874)
@@ -165,6 +165,8 @@
 	#include "ficlplatform/ansi.h"
 #elif defined(_WIN32)
 	#include "ficlplatform/win32.h"
+#elif defined (FREEBSD)
+	#include "ficlplatform/unix.h"
 #elif defined (FREEBSD_ALPHA)
 	#include "ficlplatform/alpha.h"
 #elif defined(unix) || defined(__unix__) || defined(__unix)

Modified: soc2015/clord/head/sys/contrib/ficl/float.c
==============================================================================
--- soc2015/clord/head/sys/contrib/ficl/float.c	Thu Jul  2 19:41:08 2015	(r287873)
+++ soc2015/clord/head/sys/contrib/ficl/float.c	Thu Jul  2 20:05:39 2015	(r287874)
@@ -161,7 +161,7 @@
 {
     struct stackContext *context = (struct stackContext *)c;
     char buffer[64];
-    sprintf(buffer, "[0x%08x %3d] %16f (0x%08x)\n", cell, context->count++, (double)(cell->f), cell->i);
+    sprintf(buffer, "[0x%08lx %3d] %16f (0x%08lx)\n", (long unsigned)cell, context->count++, (double)(cell->f), (long)cell->i);
     ficlVmTextOut(context->vm, buffer);
 	return FICL_TRUE;
 }

Modified: soc2015/clord/head/sys/contrib/ficl/primitives.c
==============================================================================
--- soc2015/clord/head/sys/contrib/ficl/primitives.c	Thu Jul  2 19:41:08 2015	(r287873)
+++ soc2015/clord/head/sys/contrib/ficl/primitives.c	Thu Jul  2 20:05:39 2015	(r287874)
@@ -487,7 +487,7 @@
 
 	ficlStackPushPointer(vm->dataStack, bufferStart);
 	ficlStackPushInteger(vm->dataStack, buffer - bufferStart);
-	ficlStackPushInteger(vm->dataStack, append && FICL_TRUE);
+	ficlStackPushInteger(vm->dataStack, FICL_BOOL(!append));
 }
 
 
@@ -1350,7 +1350,7 @@
 
 static void ficlPrimitiveIsObject(ficlVm *vm)
 {
-    int flag;
+    ficlInteger flag;
     ficlWord *word = (ficlWord *)ficlStackPopPointer(vm->dataStack);
     
     flag = ((word != NULL) && (word->flags & FICL_WORD_OBJECT)) ? FICL_TRUE : FICL_FALSE;

Modified: soc2015/clord/head/sys/contrib/ficl/tools.c
==============================================================================
--- soc2015/clord/head/sys/contrib/ficl/tools.c	Thu Jul  2 19:41:08 2015	(r287873)
+++ soc2015/clord/head/sys/contrib/ficl/tools.c	Thu Jul  2 20:05:39 2015	(r287874)
@@ -242,24 +242,24 @@
         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;
 
@@ -573,7 +573,7 @@
 {
     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;
 }
@@ -586,7 +586,7 @@
 
     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)
@@ -598,7 +598,7 @@
     }
 	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;
@@ -618,7 +618,7 @@
 {
     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;
@@ -650,7 +650,7 @@
     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


More information about the svn-soc-all mailing list