Diff for /gforth/test/libcc.fs between versions 1.3 and 1.7

version 1.3, 2007/06/01 16:27:37 version 1.7, 2007/12/31 18:40:26
Line 1 Line 1
   \ test libcc.fs C interface
   
   \ Copyright (C) 2007 Free Software Foundation, Inc.
   
   \ This file is part of Gforth.
   
   \ Gforth is free software; you can redistribute it and/or
   \ modify it under the terms of the GNU General Public License
   \ as published by the Free Software Foundation, either version 3
   \ of the License, or (at your option) any later version.
   
   \ This program is distributed in the hope that it will be useful,
   \ but WITHOUT ANY WARRANTY; without even the implied warranty of
   \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   \ GNU General Public License for more details.
   
   \ You should have received a copy of the GNU General Public License
   \ along with this program. If not, see http://www.gnu.org/licenses/.
   
 require libcc.fs  require libcc.fs
   
 \c #include <string.h>  \c #include <string.h>
Line 25  s\" r=%f n=%d\n\0" drop -0.5e -5 printf- Line 44  s\" r=%f n=%d\n\0" drop -0.5e -5 printf-
 c-function printfull printfull a n -- n  c-function printfull printfull a n -- n
 s\" ull=%llu\n\0" drop -1 printfull . cr  s\" ull=%llu\n\0" drop -1 printfull . cr
 s\" ull=%llu r=%f\n\0" drop -1 -0.5e printf-nr . cr  s\" ull=%llu r=%f\n\0" drop -1 -0.5e printf-nr . cr
   
   \c #define printfll(s,ll) printf(s,(long long)ll)
   c-function printfll printfll a n -- n
   s\" ll=%lld\n\0" drop -1 printfll . cr
   s\" ll=%lld r=%f\n\0" drop -1 -0.5e printf-nr . cr
   
   \ test calling a C function pointer from Forth
   
   \ first create a C function pointer:
   
   \c typedef long (* func1)(long);
   \c #define labsptr(dummy) ((func1)labs)
   c-function labsptr labsptr -- a
   
   \ now the call
   \c #define call_func1(par1,fptr) ((func1)fptr)(par1)
   c-function call_func1 call_func1 n func -- n
   
   -5 labsptr call_func1 . cr
   

Removed from v.1.3  
changed lines
  Added in v.1.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>