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

Unified Diff: swig/Lib/typemaps/cdata.swg

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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « swig/Lib/typemaps/carrays.swg ('k') | swig/Lib/typemaps/cmalloc.swg » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: swig/Lib/typemaps/cdata.swg
===================================================================
--- swig/Lib/typemaps/cdata.swg (revision 0)
+++ swig/Lib/typemaps/cdata.swg (revision 0)
@@ -0,0 +1,78 @@
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * cdata.swg
+ *
+ * This library file contains macros for manipulating raw C data as strings.
+ * ----------------------------------------------------------------------------- */
+
+%{
+typedef struct SWIGCDATA {
+ char *data;
+ size_t len;
+} SWIGCDATA;
+%}
+
+/* -----------------------------------------------------------------------------
+ * Typemaps for returning binary data
+ * ----------------------------------------------------------------------------- */
+
+%typemap(out,noblock=1,fragment="SWIG_FromCharPtrAndSize") SWIGCDATA {
+ %set_output(SWIG_FromCharPtrAndSize($1.data,$1.len));
+}
+%typemap(in) (const void *indata, int inlen) = (char *STRING, int SIZE);
+
+
+/* -----------------------------------------------------------------------------
+ * %cdata(TYPE [, NAME])
+ *
+ * Convert raw C data to a binary string.
+ * ----------------------------------------------------------------------------- */
+
+%define %cdata(TYPE,NAME...)
+
+%insert("header") {
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if #NAME == ""
+static SWIGCDATA cdata_##TYPE(TYPE *ptr, size_t nelements)
+#else
+static SWIGCDATA cdata_##NAME(TYPE *ptr, size_t nelements)
+#endif
+{
+ SWIGCDATA d;
+ d.data = (char *) ptr;
+#if #TYPE != "void"
+ d.len = nelements*sizeof(TYPE);
+#else
+ d.len = nelements;
+#endif
+ return d;
+}
+#ifdef __cplusplus
+}
+#endif
+}
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#if #NAME == ""
+SWIGCDATA cdata_##TYPE(TYPE *ptr, size_t nelements = 1);
+#else
+SWIGCDATA cdata_##NAME(TYPE *ptr, size_t nelements = 1);
+#endif
+%enddef
+
+%rename(cdata) ::cdata_void(void *ptr, size_t nelements = 1);
+
+%cdata(void);
+
+/* Memory move function */
+void memmove(void *data, const void *indata, size_t inlen);
+
+
+
+
« no previous file with comments | « swig/Lib/typemaps/carrays.swg ('k') | swig/Lib/typemaps/cmalloc.swg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698