Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: swig/Lib/cdata.i

Issue 553095: Checkin swig binaries for win, linux and Mac... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « swig/Lib/carrays.i ('k') | swig/Lib/cmalloc.i » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* -----------------------------------------------------------------------------
2 * See the LICENSE file for information on copyright, usage and redistribution
3 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
4 *
5 * cdata.i
6 *
7 * SWIG library file containing macros for manipulating raw C data as strings.
8 * ----------------------------------------------------------------------------- */
9
10 %{
11 typedef struct SWIGCDATA {
12 char *data;
13 int len;
14 } SWIGCDATA;
15 %}
16
17 /* -----------------------------------------------------------------------------
18 * Typemaps for returning binary data
19 * ----------------------------------------------------------------------------- */
20
21 #if SWIGGUILE
22 %typemap(out) SWIGCDATA {
23 $result = gh_str2scm($1.data,$1.len);
24 }
25 %typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
26 #elif SWIGCHICKEN
27 %typemap(out) SWIGCDATA {
28 C_word *string_space = C_alloc(C_SIZEOF_STRING($1.len));
29 $result = C_string(&string_space, $1.len, $1.data);
30 }
31 %typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
32 #elif SWIGPHP
33 %typemap(out) SWIGCDATA {
34 ZVAL_STRINGL($result, $1.data, $1.len, 1);
35 }
36 %typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
37 #else
38 %echo "cdata.i module not supported."
39 #endif
40
41
42 /* -----------------------------------------------------------------------------
43 * %cdata(TYPE [, NAME])
44 *
45 * Convert raw C data to a binary string.
46 * ----------------------------------------------------------------------------- */
47
48 %define %cdata(TYPE,NAME...)
49
50 %insert("header") {
51 #if #NAME == ""
52 static SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements) {
53 #else
54 static SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements) {
55 #endif
56 SWIGCDATA d;
57 d.data = (char *) ptr;
58 #if #TYPE != "void"
59 d.len = nelements*sizeof(TYPE);
60 #else
61 d.len = nelements;
62 #endif
63 return d;
64 }
65 }
66
67 %typemap(default) int nelements "$1 = 1;"
68
69 #if #NAME == ""
70 SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements);
71 #else
72 SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements);
73 #endif
74 %enddef
75
76 %typemap(default) int nelements;
77
78 %rename(cdata) ::cdata_void(void *ptr, int nelements);
79
80 %cdata(void);
81
82 /* Memory move function */
83 void memmove(void *data, const void *indata, int inlen);
OLDNEW
« no previous file with comments | « swig/Lib/carrays.i ('k') | swig/Lib/cmalloc.i » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698