3
* $Header: /cvsroot/swig/SWIG/Lib/python/cwstring.i,v 1.1 2005/09/06 06:22:10 marcelomatus Exp $
6
* This file provides typemaps and macros for dealing with various forms
7
* of C character string handling. The primary use of this module
8
* is in returning character data that has been allocated or changed in
13
* %cwstring_input_binary(TYPEMAP, SIZE)
15
* Macro makes a function accept binary string data along with
20
* %cwstring_bounded_output(TYPEMAP, MAX)
22
* This macro is used to return a NULL-terminated output string of
23
* some maximum length. For example:
25
* %cwstring_bounded_output(wchar_t *outx, 512);
26
* void foo(wchar_t *outx) {
27
* sprintf(outx,"blah blah\n");
33
* %cwstring_chunk_output(TYPEMAP, SIZE)
35
* This macro is used to return a chunk of binary string data.
36
* Embedded NULLs are okay. For example:
38
* %cwstring_chunk_output(wchar_t *outx, 512);
39
* void foo(wchar_t *outx) {
40
* memmove(outx, somedata, 512);
46
* %cwstring_bounded_mutable(TYPEMAP, SIZE)
48
* This macro is used to wrap a string that's going to mutate.
50
* %cwstring_bounded_mutable(wchar_t *in, 512);
61
* %cwstring_mutable(TYPEMAP [, expansion])
63
* This macro is used to wrap a string that will mutate in place.
64
* It may change size up to a user-defined expansion.
66
* %cwstring_mutable(wchar_t *in);
77
* %cwstring_output_maxsize(TYPEMAP, SIZE)
79
* This macro returns data in a string of some user-defined size.
81
* %cwstring_output_maxsize(wchar_t *outx, int max) {
82
* void foo(wchar_t *outx, int max) {
83
* sprintf(outx,"blah blah\n");
88
* %cwstring_output_withsize(TYPEMAP, SIZE)
90
* This macro is used to return wchar_tacter data along with a size
93
* %cwstring_output_maxsize(wchar_t *outx, int *max) {
94
* void foo(wchar_t *outx, int *max) {
95
* sprintf(outx,"blah blah\n");
96
* *max = strlen(outx);
101
* %cwstring_output_allocate(TYPEMAP, RELEASE)
103
* This macro is used to return wchar_tacter data that was
104
* allocated with new or malloc.
106
* %cwstring_output_allocated(wchar_t **outx, free($1));
107
* void foo(wchar_t **outx) {
108
* *outx = (wchar_t *) malloc(512);
109
* sprintf(outx,"blah blah\n");
114
* %cwstring_output_allocate_size(TYPEMAP, SIZE, RELEASE)
116
* This macro is used to return wchar_tacter data that was
117
* allocated with new or malloc.
119
* %cwstring_output_allocated(wchar_t **outx, int *sz, free($1));
120
* void foo(wchar_t **outx, int *sz) {
121
* *outx = (wchar_t *) malloc(512);
122
* sprintf(outx,"blah blah\n");
123
* *sz = strlen(outx);
128
%include <pywstrings.swg>
129
%include <cstrbase.swg>
131
%typemap_cstrings(%cwstring,
134
SWIG_AsWCharPtrAndSize,
136
SWIG_FromWCharArray);