summaryrefslogtreecommitdiff
path: root/devtools/swigwin-1.3.34/Lib/guile/pointer-in-out.i
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /devtools/swigwin-1.3.34/Lib/guile/pointer-in-out.i
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'devtools/swigwin-1.3.34/Lib/guile/pointer-in-out.i')
-rw-r--r--devtools/swigwin-1.3.34/Lib/guile/pointer-in-out.i105
1 files changed, 105 insertions, 0 deletions
diff --git a/devtools/swigwin-1.3.34/Lib/guile/pointer-in-out.i b/devtools/swigwin-1.3.34/Lib/guile/pointer-in-out.i
new file mode 100644
index 0000000..bc64387
--- /dev/null
+++ b/devtools/swigwin-1.3.34/Lib/guile/pointer-in-out.i
@@ -0,0 +1,105 @@
+/* -----------------------------------------------------------------------------
+ * 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.
+ *
+ * pointer-in-out.i
+ *
+ * Guile typemaps for passing pointers indirectly
+ * ----------------------------------------------------------------------------- */
+
+/* Here is a macro that will define typemaps for passing C pointers indirectly.
+
+ TYPEMAP_POINTER_INPUT_OUTPUT(PTRTYPE, SCM_TYPE)
+
+ Supported calling conventions (in this example, PTRTYPE is int *):
+
+ func(int **INPUT)
+
+ Scheme wrapper will take one argument, a wrapped C pointer.
+ The address of a variable containing this pointer will be
+ passed to the function.
+
+ func(int **INPUT_CONSUMED)
+
+ Likewise, but mark the pointer object as not garbage
+ collectable.
+
+ func(int **INPUT_DESTROYED)
+
+ Likewise, but mark the pointer object as destroyed.
+
+ func(int **OUTPUT)
+
+ Scheme wrapper will take no arguments. The address of an int *
+ variable will be passed to the function. The function is
+ expected to modify the variable; its value is wrapped and
+ becomes an extra return value. (See the documentation on how
+ to deal with multiple values.)
+
+ func(int **OUTPUT_NONCOLLECTABLE)
+
+ Likewise, but make the pointer object not garbage collectable.
+
+ func(int **BOTH)
+ func(int **INOUT)
+
+ This annotation combines INPUT and OUTPUT.
+
+*/
+
+%define TYPEMAP_POINTER_INPUT_OUTPUT(PTRTYPE, SCM_TYPE)
+
+%typemap(in, doc="$NAME is of type <" #SCM_TYPE ">") PTRTYPE *INPUT(PTRTYPE temp)
+{
+ if (SWIG_ConvertPtr($input, (void **) &temp, $*descriptor, 0)) {
+ scm_wrong_type_arg(FUNC_NAME, $argnum, $input);
+ }
+ $1 = &temp;
+}
+
+%typemap(in, doc="$NAME is of type <" #SCM_TYPE "> and is consumed by the function") PTRTYPE *INPUT_CONSUMED(PTRTYPE temp)
+{
+ if (SWIG_ConvertPtr($input, (void **) &temp, $*descriptor, 0)) {
+ scm_wrong_type_arg(FUNC_NAME, $argnum, $input);
+ }
+ SWIG_Guile_MarkPointerNoncollectable($input);
+ $1 = &temp;
+}
+
+%typemap(in, doc="$NAME is of type <" #SCM_TYPE "> and is consumed by the function") PTRTYPE *INPUT_DESTROYED(PTRTYPE temp)
+{
+ if (SWIG_ConvertPtr($input, (void **) &temp, $*descriptor, 0)) {
+ scm_wrong_type_arg(FUNC_NAME, $argnum, $input);
+ }
+ SWIG_Guile_MarkPointerDestroyed($input);
+ $1 = &temp;
+}
+
+%typemap(in, numinputs=0) PTRTYPE *OUTPUT(PTRTYPE temp),
+ PTRTYPE *OUTPUT_NONCOLLECTABLE(PTRTYPE temp)
+ "$1 = &temp;";
+
+%typemap(argout, doc="<" #SCM_TYPE ">") PTRTYPE *OUTPUT
+ "SWIG_APPEND_VALUE(SWIG_NewPointerObj(*$1, $*descriptor, 1));";
+
+%typemap(argout, doc="<" #SCM_TYPE ">") PTRTYPE *OUTPUT_NONCOLLECTABLE
+ "SWIG_APPEND_VALUE(SWIG_NewPointerObj(*$1, $*descriptor, 0));";
+
+%typemap(in) PTRTYPE *BOTH = PTRTYPE *INPUT;
+%typemap(argout) PTRTYPE *BOTH = PTRTYPE *OUTPUT;
+%typemap(in) PTRTYPE *INOUT = PTRTYPE *INPUT;
+%typemap(argout) PTRTYPE *INOUT = PTRTYPE *OUTPUT;
+
+/* As a special convenience measure, also attach docs involving
+ SCM_TYPE to the standard pointer typemaps */
+
+%typemap(in, doc="$NAME is of type <" #SCM_TYPE ">") PTRTYPE {
+ if (SWIG_ConvertPtr($input, (void **) &$1, $descriptor, 0))
+ scm_wrong_type_arg(FUNC_NAME, $argnum, $input);
+}
+
+%typemap(out, doc="<" #SCM_TYPE ">") PTRTYPE {
+ $result = SWIG_NewPointerObj ($1, $descriptor, $owner);
+}
+
+%enddef