Software: Apache/2.0.54 (Fedora). PHP/5.0.4 uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/doc/swig-1.3.24/Manual/ drwxr-xr-x |
Viewing file: Select action/file-type: 21 SWIG and MzSchemeThis section contains information on SWIG's support of MzScheme. 21.1 Creating native MzScheme structuresExample interface file:Then in scheme, you can use regular struct access procedures like/* define a macro for the struct creation */ %define handle_ptr(TYPE,NAME) %typemap(mzscheme,argout) TYPE *NAME{ Scheme_Object *o = SWIG_NewStructFromPtr($1, $*1_mangle); SWIG_APPEND_VALUE(o); } %typemap(mzscheme,in,numinputs=0) TYPE *NAME (TYPE temp) { $1 = &temp; } %enddef /* setup the typemaps for the pointer to an output parameter cntrs */ handle_ptr(struct diag_cntrs, cntrs); That's pretty much it. It works with nested structs as well.; suppose a function created a struct foo as ; (define foo (make-diag-cntrs (#x1 #x2 #x3) (make-inspector)) ; Then you can do (format "0x~x" (diag-cntrs-field1 foo)) (format "0x~x" (diag-cntrs-field2 foo)) ;etc... |
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0031 ]-- |