Annotation of gforth/lib.fs, revision 1.16

1.1       pazsan      1: \ lib.fs       shared library support package          11may97py
                      2: 
1.15      anton       3: \ Copyright (C) 1995,1996,1997,1998,2000,2003,2005 Free Software Foundation, Inc.
1.1       pazsan      4: 
                      5: \ This file is part of Gforth.
                      6: 
                      7: \ Gforth is free software; you can redistribute it and/or
                      8: \ modify it under the terms of the GNU General Public License
                      9: \ as published by the Free Software Foundation; either version 2
                     10: \ of the License, or (at your option) any later version.
                     11: 
                     12: \ This program is distributed in the hope that it will be useful,
                     13: \ but WITHOUT ANY WARRANTY; without even the implied warranty of
                     14: \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     15: \ GNU General Public License for more details.
                     16: 
                     17: \ You should have received a copy of the GNU General Public License
                     18: \ along with this program; if not, write to the Free Software
1.5       anton      19: \ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
1.1       pazsan     20: 
1.7       pazsan     21: [IFDEF] av-call-int
                     22:     include fflib.fs
                     23: [ELSE]
1.10      pazsan     24:     [IFDEF] ffi-call
                     25:        include libffi.fs
                     26:     [ELSE]
                     27:        include oldlib.fs
                     28:     [THEN]
1.7       pazsan     29: [THEN]
1.1       pazsan     30: 
1.11      pazsan     31: \ testing stuff
                     32: 
                     33: [ifdef] testing
                     34: 
                     35: library libc libc.so.6
                     36:                 
                     37: libc sleep int (int) sleep
1.16    ! anton      38: libc open  ptr int int (int) open
1.11      pazsan     39: libc lseek int llong int (llong) lseek64
                     40: libc read  int ptr int (int) read
                     41: libc close int (int) close
                     42: 
                     43: library libm libm.so.6
                     44: 
                     45: libm fmodf sf sf (sf) fmodf
                     46: libm fmod  df df (fp) fmod
                     47: 
                     48: \ example for a windows callback
                     49:     
                     50: callback wincall (int) int int int int callback;
                     51: 
                     52: :noname ( a b c d -- e )  2drop 2drop 0 ; wincall do_timer
                     53: 
                     54: \ test a callback
                     55: 
                     56: callback 2:1 (int) int int callback;
                     57: 
                     58: : cb-test ( a b -- c )
                     59:     cr ." Testing callback"
                     60:     cr ." arguments: " .s
                     61:     cr ." result " + .s cr ;
                     62: ' cb-test 2:1 c_plus
                     63: 
1.14      pazsan     64: fptr 2:1call int int (int)
1.12      pazsan     65: 
                     66: : test  c_plus 2:1call ;
1.11      pazsan     67: 
                     68: \ 3 4 test
                     69: 
                     70: \ bigFORTH legacy library test
                     71: 
                     72: library libX11 libX11.so.6
                     73: 
                     74: legacy on
                     75: 
                     76: 1 libX11 XOpenDisplay XOpenDisplay    ( name -- dpy )
                     77: 5 libX11 XInternAtoms XInternAtoms    ( atoms flag count names dpy -- status )
                     78: 
                     79: legacy off
                     80: 
                     81: [then]    

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