| \ lib.fs shared library support package 11may97py |
\ lib.fs shared library support package 11may97py |
| |
|
| \ Copyright (C) 1995,1996,1997,1998,2000,2003 Free Software Foundation, Inc. |
\ Copyright (C) 1995,1996,1997,1998,2000,2003,2005 Free Software Foundation, Inc. |
| |
|
| \ This file is part of Gforth. |
\ This file is part of Gforth. |
| |
|
| Variable libs 0 libs ! |
Variable libs 0 libs ! |
| \G links between libraries |
\G links between libraries |
| |
|
| |
Variable legacy legacy off |
| |
|
| : @lib ( lib -- ) |
: @lib ( lib -- ) |
| \G obtains library handle |
\G obtains library handle |
| cell+ dup 2 cells + count open-lib |
cell+ dup 2 cells + count open-lib |
| cell+ tuck 2 cells + count rot cell+ @ |
cell+ tuck 2 cells + count rot cell+ @ |
| lib-sym dup 0= abort" Proc not found!" swap cell+ ! ; |
lib-sym dup 0= abort" Proc not found!" swap cell+ ! ; |
| |
|
| |
-1 Constant <addr> |
| |
0 Constant <int> |
| |
1 Constant <float> |
| |
2 Constant <void> |
| |
4 Constant <int...> |
| |
5 Constant <float...> |
| |
6 Constant <void...> |
| |
|
| : proc, ( pars type lib addr -- ) |
: proc, ( pars type lib addr -- ) |
| \G allocates and initializes proc stub |
\G allocates and initializes proc stub |
| \G stub format: |
\G stub format: |
| \G address of proc |
\G address of proc |
| \G offset in lcall1-table to call proc |
\G offset in lcall1-table to call proc |
| \G OS name of symbol as counted string |
\G OS name of symbol as counted string |
| |
legacy @ IF (int) -rot THEN |
| here 2dup swap 2 cells + dup @ A, ! |
here 2dup swap 2 cells + dup @ A, ! |
| 2swap 1 and IF fcall-table ELSE icall-table THEN swap |
2swap 1 and IF fcall-table ELSE icall-table THEN swap |
| cells 2* + , 0 , bl sword string, @proc ; |
cells 2* + , 0 , bl sword string, @proc ; |
| |
|
| -1 Constant (addr) |
|
| 0 Constant (int) |
|
| 1 Constant (float) |
|
| 2 Constant (void) |
|
| 4 Constant (int...) |
|
| 5 Constant (float...) |
|
| 6 Constant (void...) |
|
| |
|
| : proc: ( pars type lib "name" "string" -- ) |
: proc: ( pars type lib "name" "string" -- ) |
| \G Creates a named proc stub |
\G Creates a named proc stub |
| Create proc, |
Create proc, |