Annotation of gforth/lib.fs, revision 1.35

1.1       pazsan      1: \ lib.fs       shared library support package          11may97py
                      2: 
1.26      anton       3: \ Copyright (C) 1995,1996,1997,1998,2000,2003,2005,2006,2007,2008 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
1.22      anton       9: \ as published by the Free Software Foundation, either version 3
1.1       pazsan     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
1.22      anton      18: \ along with this program. If not, see http://www.gnu.org/licenses/.
1.1       pazsan     19: 
1.34      anton      20: libffi-present [if]
                     21:     require ./libffi.fs
                     22: [else]
                     23:     ffcall-present [if]
                     24:        require ./fflib.fs
                     25:     [else]
                     26:        .( Neither libffi nor ffcall are configured ) cr
                     27:        .( If you have installed one of them, you can use libffi.fs or fflib.fs directly ) cr
                     28:        .( Or you can just use the new, documented and better, but different, libcc.fs ) cr
1.29      pazsan     29:        abort
1.34      anton      30:     [then]
                     31: [then]
1.1       pazsan     32: 
1.11      pazsan     33: \ testing stuff
                     34: 
1.34      anton      35: \ [IFUNDEF] libc
                     36: \     s" os-type" environment? [IF]
                     37: \      2dup s" linux-gnu" str= [IF]  2drop
                     38: \          cell 8 = [IF]
                     39: \              library libc /lib64/libc.so.6 
                     40: \          [ELSE]
                     41: \              library libc /lib/libc.so.6
                     42: \          [THEN]
                     43: \      [ELSE] 2dup s" cygwin" str= [IF]  2drop
                     44: \              library libc cygwin1.dll
                     45: \          [ELSE]  2dup s" bsd" search nip nip [IF]  2drop
                     46: \                  library libc libc.so
                     47: \              [ELSE]  2dup s" darwin" string-prefix? [IF]  2drop
                     48: \                      library libc libc.dylib
                     49: \                  [ELSE]  2drop \ or add your stuff here
                     50: \                  [THEN]
                     51: \              [THEN]
                     52: \          [THEN]
                     53: \      [THEN]
                     54: \     [THEN]
                     55: \ [THEN]
1.18      pazsan     56: 
1.35    ! anton      57: 0 [if]
1.11      pazsan     58: 
                     59: library libc libc.so.6
                     60:                 
                     61: libc sleep int (int) sleep
1.16      anton      62: libc open  ptr int int (int) open
1.11      pazsan     63: libc lseek int llong int (llong) lseek64
                     64: libc read  int ptr int (int) read
                     65: libc close int (int) close
                     66: 
                     67: library libm libm.so.6
                     68: 
                     69: libm fmodf sf sf (sf) fmodf
                     70: libm fmod  df df (fp) fmod
                     71: 
                     72: \ example for a windows callback
                     73:     
                     74: callback wincall (int) int int int int callback;
                     75: 
                     76: :noname ( a b c d -- e )  2drop 2drop 0 ; wincall do_timer
                     77: 
                     78: \ test a callback
                     79: 
                     80: callback 2:1 (int) int int callback;
                     81: 
                     82: : cb-test ( a b -- c )
                     83:     cr ." Testing callback"
                     84:     cr ." arguments: " .s
                     85:     cr ." result " + .s cr ;
                     86: ' cb-test 2:1 c_plus
                     87: 
1.14      pazsan     88: fptr 2:1call int int (int)
1.12      pazsan     89: 
                     90: : test  c_plus 2:1call ;
1.11      pazsan     91: 
                     92: \ 3 4 test
                     93: 
                     94: \ bigFORTH legacy library test
                     95: 
                     96: library libX11 libX11.so.6
                     97: 
                     98: legacy on
                     99: 
                    100: 1 libX11 XOpenDisplay XOpenDisplay    ( name -- dpy )
                    101: 5 libX11 XInternAtoms XInternAtoms    ( atoms flag count names dpy -- status )
                    102: 
                    103: legacy off
                    104: 
                    105: [then]    

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