File:
[gforth] /
gforth /
lib.fs
Revision
1.34:
download - view:
text,
annotated -
select for diffs
Fri Aug 8 20:56:14 2008 UTC (15 years, 8 months ago) by
anton
Branches:
MAIN
CVS tags:
HEAD
Updated Agenda
Now lib.fs selects libffi.fs or fflib.fs based on a configure test
compat/execute-parsing bugfix
fixed some documentation bugs (reported by Jakob Sievers)
1: \ lib.fs shared library support package 11may97py
2:
3: \ Copyright (C) 1995,1996,1997,1998,2000,2003,2005,2006,2007,2008 Free Software Foundation, Inc.
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 3
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, see http://www.gnu.org/licenses/.
19:
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
29: abort
30: [then]
31: [then]
32:
33: \ testing stuff
34:
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]
56:
57: [ifdef] testing
58:
59: library libc libc.so.6
60:
61: libc sleep int (int) sleep
62: libc open ptr int int (int) open
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:
88: fptr 2:1call int int (int)
89:
90: : test c_plus 2:1call ;
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>