summaryrefslogtreecommitdiffstats
path: root/typemap
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-11-12 03:19:29 -0600
committerJesse Luehrs <doy@tozt.net>2010-11-12 03:20:45 -0600
commita382a84ba7f959ceab7ecbf75e7c937153ebb603 (patch)
tree0444d203ed3fd9d52b7b9bf801693a7bf5c5cc6f /typemap
parentbe2a7e99515c2096db81cd42d59b2476e92795de (diff)
downloadpackage-stash-xs-a382a84ba7f959ceab7ecbf75e7c937153ebb603.tar.gz
package-stash-xs-a382a84ba7f959ceab7ecbf75e7c937153ebb603.zip
implement some helper functions
Diffstat (limited to 'typemap')
-rw-r--r--typemap17
1 files changed, 17 insertions, 0 deletions
diff --git a/typemap b/typemap
new file mode 100644
index 0000000..3ea935e
--- /dev/null
+++ b/typemap
@@ -0,0 +1,17 @@
+TYPEMAP
+varspec_t T_VARSPEC
+vartype_t T_VARTYPE
+
+INPUT
+T_VARSPEC
+ if (SvPOK($arg))
+ _deconstruct_variable_name(SvPV_nolen($arg), &$var);
+ else if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVHV)
+ _deconstruct_variable_hash((HV*)SvRV($arg), &$var);
+ else
+ croak(\"varspec must be a string or a hashref\");
+
+T_VARTYPE
+ if (!SvPOK($arg))
+ croak(\"vartype must be a string\");
+ $var = string_to_vartype(SvPV_nolen($arg));