From: Ivan Gyurdiev <ivg2@cornell.edu>
To: SELinux List <SELinux@tycho.nsa.gov>
Cc: Stephen Smalley <sds@tycho.nsa.gov>,
Joshua Brindle <jbrindle@tresys.com>
Subject: [SEMANAGE] Swig update: typemaps
Date: Sun, 25 Dec 2005 15:55:42 -0500 [thread overview]
Message-ID: <43AF074E.6040301@cornell.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 394 bytes --]
Merry Christmas everyone!
This patch updates the typemaps to add booleans, interfaces, context,
and char** (for context_to_string). I really don't know what I'm doing
here with those typemaps, so I would appreciate if someone (Joshua?) can
look over. I was just following the pattern, with minor changes, and it
seems to work for a port list function that I wrote for the semanage tool.
[-- Attachment #2: libsemanage10.swig_update_typemaps.diff --]
[-- Type: text/x-patch, Size: 3360 bytes --]
diff -Naurp --exclude-from excludes old/libsemanage/src/semanageswig.i new/libsemanage/src/semanageswig.i
--- old/libsemanage/src/semanageswig.i 2005-12-25 15:50:26.000000000 -0500
+++ new/libsemanage/src/semanageswig.i 2005-12-25 15:48:13.000000000 -0500
@@ -51,7 +51,13 @@
}
semanage_port_t *semanage_port_by_idx(semanage_port_t **list, int n) {
return list[n];
- }
+ }
+ semanage_iface_t *semanage_iface_by_idx(semanage_iface_t **list, int n) {
+ return list[n];
+ }
+ semanage_bool_t *semanage_bool_by_idx(semanage_bool_t **list, int n) {
+ return list[n];
+ }
char *char_by_idx(char **list, int n) {
return list[n];
}
@@ -67,6 +73,14 @@
%apply int *OUTPUT { int * };
%apply int *OUTPUT { size_t * };
+%typemap(in, numinputs=0) char **(char *temp) {
+ $1 = &temp;
+}
+
+%typemap(argout) char** {
+ $result = t_output_helper($result, SWIG_FromCharPtr(*$1));
+}
+
%typemap(in, numinputs=0) char ***(char **temp) {
$1 = &temp;
}
@@ -87,6 +101,74 @@
$result = t_output_helper($result, SWIG_NewPointerObj(*$1, SWIGTYPE_p_semanage_module_info, 0));
}
+/** context typemaps **/
+
+/* the wrapper will setup this parameter for passing... the resulting python functions
+ will not take the semanage_context_t ** parameter */
+%typemap(in, numinputs=0) semanage_context_t **(semanage_context_t *temp) {
+ $1 = &temp;
+}
+
+%typemap(argout) semanage_context_t** {
+ $result = t_output_helper($result, SWIG_NewPointerObj(*$1, SWIGTYPE_p_semanage_context, 0));
+}
+
+/** boolean typemaps **/
+
+/* the wrapper will setup this parameter for passing... the resulting python functions
+ will not take the semanage_bool_t *** parameter */
+%typemap(in, numinputs=0) semanage_bool_t ***(semanage_bool_t **temp) {
+ $1 = &temp;
+}
+
+%typemap(argout) semanage_bool_t *** {
+ $result = t_output_helper($result, SWIG_NewPointerObj(*$1, SWIGTYPE_p_p_semanage_bool, 0));
+}
+
+%typemap(in, numinputs=0) semanage_bool_t **(semanage_bool_t *temp) {
+ $1 = &temp;
+}
+
+%typemap(argout) semanage_bool_t ** {
+ $result = t_output_helper($result, SWIG_NewPointerObj(*$1, SWIGTYPE_p_semanage_bool, 0));
+}
+
+%typemap(argout) semanage_bool_key_t ** {
+ $result = t_output_helper($result, SWIG_NewPointerObj(*$1, SWIGTYPE_p_semanage_bool_key, 0));
+}
+
+%typemap(in, numinputs=0) semanage_bool_key_t **(semanage_bool_key_t *temp) {
+ $1 = &temp;
+}
+
+/** interface typemaps **/
+
+/* the wrapper will setup this parameter for passing... the resulting python functions
+ will not take the semanage_iface_t *** parameter */
+%typemap(in, numinputs=0) semanage_iface_t ***(semanage_iface_t **temp) {
+ $1 = &temp;
+}
+
+%typemap(argout) semanage_iface_t *** {
+ $result = t_output_helper($result, SWIG_NewPointerObj(*$1, SWIGTYPE_p_p_semanage_iface, 0));
+}
+
+%typemap(in, numinputs=0) semanage_iface_t **(semanage_iface_t *temp) {
+ $1 = &temp;
+}
+
+%typemap(argout) semanage_iface_t ** {
+ $result = t_output_helper($result, SWIG_NewPointerObj(*$1, SWIGTYPE_p_semanage_iface, 0));
+}
+
+%typemap(argout) semanage_iface_key_t ** {
+ $result = t_output_helper($result, SWIG_NewPointerObj(*$1, SWIGTYPE_p_semanage_iface_key, 0));
+}
+
+%typemap(in, numinputs=0) semanage_iface_key_t **(semanage_iface_key_t *temp) {
+ $1 = &temp;
+}
+
/** seuser typemaps **/
/* the wrapper will setup this parameter for passing... the resulting python functions
next reply other threads:[~2005-12-25 20:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-25 20:55 Ivan Gyurdiev [this message]
2006-01-02 19:06 ` [SEMANAGE] Swig update: typemaps Joshua Brindle
2006-01-02 19:58 ` Joshua Brindle
2006-01-02 18:30 ` Ivan Gyurdiev
2006-01-02 20:33 ` Joshua Brindle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43AF074E.6040301@cornell.edu \
--to=ivg2@cornell.edu \
--cc=SELinux@tycho.nsa.gov \
--cc=jbrindle@tresys.com \
--cc=sds@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.