File:  [gforth] / gforth / test / libcc.fs
Revision 1.4: download - view: text, annotated - select for diffs
Fri Jun 1 17:38:13 2007 UTC (14 years, 2 months ago) by anton
Branches: MAIN
CVS tags: HEAD
minor fixes

    1: require libcc.fs
    2: 
    3: \c #include <string.h>
    4: \c #include <stdlib.h>
    5: 
    6: c-function strlen strlen a -- n
    7: cr s\" fooo\0" 2dup dump drop .s strlen cr .s drop cr 
    8: c-function labs labs n -- n
    9: 
   10: \c #define _FILE_OFFSET_BITS 64
   11: \c #include <sys/types.h>
   12: \c #include <unistd.h>
   13: c-function dlseek lseek n d n -- d
   14: 
   15: cr s\" fooo\0" 2dup dump drop .s strlen cr .s drop cr 
   16: -5 labs .s drop cr
   17: 
   18: \c #include <stdio.h>
   19: c-function printf-nr printf a n r -- n
   20: c-function printf-rn printf a r n -- n
   21: s\" n=%d r=%f\n\0" drop -5 -0.5e fp@ hex. cr printf-nr . cr
   22: s\" r=%f n=%d\n\0" drop -0.5e -5 printf-rn . cr
   23: 
   24: \c #define printfull(s,ull) printf(s,(unsigned long long)ull)
   25: c-function printfull printfull a n -- n
   26: s\" ull=%llu\n\0" drop -1 printfull . cr
   27: s\" ull=%llu r=%f\n\0" drop -1 -0.5e printf-nr . cr
   28: 
   29: \c #define printfll(s,ll) printf(s,(long long)ll)
   30: c-function printfll printfll a n -- n
   31: s\" ll=%lld\n\0" drop -1 printfll . cr
   32: s\" ll=%lld r=%f\n\0" drop -1 -0.5e printf-nr . cr

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