tclnotmuch

Artifact [527aee944d]
Login

Artifact 527aee944d9a462daf3d1bfad9c074087b1d5024:


     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
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
%module tclnotmuch
%{
/* Includes the header in the wrapper code */
#include <notmuch.h>
%}

/* Need this to get the value returned from some functions */
/* Might there be cases where "long" is not the right thing to choose? */
%typedef long time_t;

/* strip off the existing prefix*/
%rename("%(strip:[notmuch_])s") "";

/* specific changes: */
/*   for notmuch_database_open (and _create) to deal with the opaque pointer argument*/
%typemap(in,numinputs=0) notmuch_database_t **database (notmuch_database_t *temp)
{
    $1 = &temp;
}

/*   for notmuch_database_open (and _create) to return the correct pointer (or NULL) */
/*      (actually just notmuch_database_t *, which can be used to call other API functions) */
%typemap(argout) notmuch_database_t **database
{
    %append_output(SWIG_NewPointerObj(SWIG_as_voidptr(*$1), $*1_descriptor, SWIG_POINTER_OWN));
}

/*   for notmuch_database_get_directory to deal with the opaque pointer argument*/
%typemap(in,numinputs=0) notmuch_directory_t **directory (notmuch_directory_t *temp)
{
    $1 = &temp;
}

/*   for notmuch_database_get_directory to return the correct pointer (or NULL) */
/*      (actually just notmuch_directory_t *, which can be used to call other API functions) */
%typemap(argout) notmuch_directory_t **directory
{
    %append_output(SWIG_NewPointerObj(SWIG_as_voidptr(*$1), $*1_descriptor, SWIG_POINTER_OWN));
}

/*   for notmuch_database_add_message, notmuch_database_find_message, */
/*      notmuch_database_find_message_by_filename to deal with the opaque pointer argument*/
%typemap(in,numinputs=0) notmuch_message_t **message (notmuch_message_t *temp)
{
    $1 = &temp;
}

/*   for notmuch_database_add_message, notmuch_database_find_message, */
/*      notmuch_database_find_message_by_filename to return the correct pointer (or NULL) */
/*      (actually just notmuch_message_t *, which can be used to call other API functions) */
%typemap(argout) notmuch_message_t **message
{
    %append_output(SWIG_NewPointerObj(SWIG_as_voidptr(*$1), $*1_descriptor, SWIG_POINTER_OWN));
}



/* Parse the header file to generate wrappers */
%include <notmuch.h>