Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Apr 1997 13:47:33 -0500
From:      "Eric L. Hernes" <erich@lodgenet.com>
To:        Peter Dufault <dufault@hda.com>
Cc:        erich@lodgenet.com (Eric L. Hernes), scsi@freebsd.org
Subject:   Re: scsi(8) and (3) changes 
Message-ID:  <199704161847.NAA07317@jake.lodgenet.com>
In-Reply-To: Your message of "Wed, 16 Apr 1997 13:41:45 EDT." <199704161741.NAA13814@hda.hda.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Dufault writes:
>
>Tcl isn't linked in - the input/output look like tcl lists and is
>driven through popen.  I don't know what "swig" is.

Yea, but the README mentions possibly integrating it into
a tclsh/wish app.

swig will take c or c++ style declarations and generate glue-code
to build tcl/perl/python/etc. libraries.

for example, say I have a file scsi.i that contains:

------------------------
%init Scsi_Init
%{
#include <scsi.h>
%}

struct scsireq_t;

scsireq_t *scsireq_reset(scsireq_t *);
scsireq_t *scsireq_new(void);
-------------------------

then swig/compile/link it as:

(ttyp3@jake)$ swig scsi.i
Making wrappers for Tcl
(ttyp3@jake)$ gcc -fpic -c scsi_wrap.c 
(ttyp3@jake)$ ld -Bshareable scsi_wrap.o -o scsi.so -lscsi

I get a shared object that can be loaded into a tclsh or wish
and provide two new commands `scsireq_new' and `scsireq_reset'
that are direct hooks to the scsi(3) functions. I can use them like:

(ttyp3@jake)$ tclsh
% load scsi.so
% set t [scsireq_new]
_8300_scsireq_t_p
% scsireq_reset $t
_8300_scsireq_t_p
% 

at this point `scsireq_t' is opaque to tcl. If you declare the full
structure in the .i file, swig create helper functions to access
the structure's members, and an object to manipulate the structure
in the spirit of Tk widgets (cget/configure).

/usr/ports/devel/SWIG

>
>-- 
>Peter Dufault (dufault@hda.com)   Realtime Machine Control and Simulation
>HD Associates, Inc.               Voice: 508 433 6936

eric.
-- 
erich@rrnet.com http://rrnet.com/~erich
erich@freebsd.org http://www.freebsd.org/~erich
erich@lodgenet.com






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704161847.NAA07317>