Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | changes for testing callback typetags |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
87ae944ab14876c49ed42ce742a826a8 |
| User & Date: | grable 2018-10-31 20:16:20.573 |
Context
|
2018-10-31
| ||
| 22:34 | added struct types as defined in ffcall, as 't' and 'T' based on pointers with explicit size. !! only for imported functions currently. check-in: d91d2ed686 user: grable tags: trunk | |
| 20:16 | changes for testing callback typetags check-in: 87ae944ab1 user: grable tags: trunk | |
| 20:03 | added displaying of callback argument typetags to info command check-in: 543cc53004 user: grable tags: trunk | |
Changes
Changes to jimff-commands.c.
| ︙ | ︙ | |||
711 712 713 714 715 716 717 718 719 720 721 722 723 724 |
numcb++;
break;
}
}
return str;
}
static int fn_context_info( Jim_Interp* interp, int argc, Jim_Obj* const argv[]) {
static const char * const infomodes[] = { "-help", "-libraries", "-symbols", "-functions", "-variables", "-callbacks", NULL };
enum { INFO_HELP, INFO_LIBRARIES, INFO_SYMBOLS, INFO_FUNCTIONS, INFO_VARIABLES, INFO_CALLBACKS };
Jim_Obj* argv0 = argv[0];
struct jimff_context* ctx = Jim_CmdPrivData(interp);
Jim_Obj* list = NULL;
| > > | 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 |
numcb++;
break;
}
}
return str;
}
//TODO: either need to rethink the "info" command since its getting overloaded and only returns lists of tings.
//TODO: or add a companion command like "exists" for finding stuff without searching for it through what info returns.
static int fn_context_info( Jim_Interp* interp, int argc, Jim_Obj* const argv[]) {
static const char * const infomodes[] = { "-help", "-libraries", "-symbols", "-functions", "-variables", "-callbacks", NULL };
enum { INFO_HELP, INFO_LIBRARIES, INFO_SYMBOLS, INFO_FUNCTIONS, INFO_VARIABLES, INFO_CALLBACKS };
Jim_Obj* argv0 = argv[0];
struct jimff_context* ctx = Jim_CmdPrivData(interp);
Jim_Obj* list = NULL;
|
| ︙ | ︙ |
Changes to jimff_test.tcl.
1 2 3 4 5 6 | lappend auto_path . package require jimff jimff ff | | > | > > > > > > > < > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
lappend auto_path .
package require jimff
jimff ff
# returns symbol and typetag if imported/registered
proc find-symbol {{type -function} name} {
set n [ff::info $type -typetags]
set i [lsearch $n $name]
if {$i >= 0} {
lrange $n $i $i+1
} else {
return "symbol $type \"$name\" not found"
}
}
set lib [ff::load test_lib.dll]
ff::import -function $lib {__malloc malloc} Pi
ff::import -function $lib {__strcpy strcpy} ppz
ff::import -function $lib {__strcat strcat} ppz
ff::import -function $lib {__free free} vP
ff::import -function test_callback vzx(iizd)
set test_1 [ff::callback test_1 iizd]
puts [find-symbol -function test_callback]
puts [find-symbol -callback test_1]
set p [malloc 64]
ff::pointer -size $p 64
strcpy $p "Hello"
strcat $p " World!"
puts p=[ff::gets $p]
puts gets->s=[ff::gets $p 6 s]
|
| ︙ | ︙ |