annotate lib/swig/swigwin-2.0.11/Lib/cdata.i @ 2164:f5e9ac04dd25

fixpoint_mul in ProcessPartyActions
author Ritor1
date Thu, 16 Jan 2014 00:08:27 +0600
parents b3009adc0e2f
children
rev   line source
1899
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
1 /* -----------------------------------------------------------------------------
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
2 * cdata.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
3 *
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
4 * SWIG library file containing macros for manipulating raw C data as strings.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
5 * ----------------------------------------------------------------------------- */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
7 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
8 typedef struct SWIGCDATA {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
9 char *data;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
10 int len;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
11 } SWIGCDATA;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
12 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
13
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
14 /* -----------------------------------------------------------------------------
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
15 * Typemaps for returning binary data
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
16 * ----------------------------------------------------------------------------- */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
17
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
18 #if SWIGGUILE
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
19 %typemap(out) SWIGCDATA {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
20 $result = scm_from_locale_stringn($1.data,$1.len);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
21 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
22 %typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
23 #elif SWIGCHICKEN
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
24 %typemap(out) SWIGCDATA {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
25 C_word *string_space = C_alloc(C_SIZEOF_STRING($1.len));
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
26 $result = C_string(&string_space, $1.len, $1.data);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
27 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
28 %typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
29 #elif SWIGPHP
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
30 %typemap(out) SWIGCDATA {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
31 ZVAL_STRINGL($result, $1.data, $1.len, 1);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
32 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
33 %typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
34 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
35 %echo "cdata.i module not supported."
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
36 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
37
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
38
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
39 /* -----------------------------------------------------------------------------
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
40 * %cdata(TYPE [, NAME])
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
41 *
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
42 * Convert raw C data to a binary string.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
43 * ----------------------------------------------------------------------------- */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
44
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
45 %define %cdata(TYPE,NAME...)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
46
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
47 %insert("header") {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
48 #if #NAME == ""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
49 static SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
50 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
51 static SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
52 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
53 SWIGCDATA d;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
54 d.data = (char *) ptr;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
55 #if #TYPE != "void"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
56 d.len = nelements*sizeof(TYPE);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
57 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
58 d.len = nelements;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
59 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
60 return d;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
61 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
62 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
63
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
64 %typemap(default) int nelements "$1 = 1;"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
65
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
66 #if #NAME == ""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
67 SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
68 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
69 SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
70 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
71 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
72
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
73 %typemap(default) int nelements;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
74
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
75 %rename(cdata) ::cdata_void(void *ptr, int nelements);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
76
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
77 %cdata(void);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
78
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
79 /* Memory move function. Due to multi-argument typemaps this appears to be wrapped as
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
80 void memmove(void *data, const char *s); */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
81 void memmove(void *data, const void *indata, int inlen);