summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root>2012-06-12 10:45:53 +0000
committerroot <root>2012-06-12 10:45:53 +0000
commit8825f1b028df864898228f0a5b14f2d4d5604ebe (patch)
tree4257f8f5c8de2a9c3a9623a2abd444f1340cbdb8
parentc9e4ff88e1a8251eeb9f392f4ccd622523fde047 (diff)
*** empty log message ***
-rw-r--r--src/rxvtperl.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/rxvtperl.h b/src/rxvtperl.h
new file mode 100644
index 0000000..0e50e8f
--- /dev/null
+++ b/src/rxvtperl.h
@@ -0,0 +1,82 @@
+/*
+ * rxvtperl.h
+ */
+
+#ifndef RXVTPERL_H_
+#define RXVTPERL_H_
+
+#if ENABLE_PERL
+
+#define SHOULD_INVOKE(htype) \
+ ( (htype) == HOOK_INIT \
+ || (htype) == HOOK_DESTROY \
+ || (htype) == HOOK_REFRESH_BEGIN \
+ || (htype) == HOOK_REFRESH_END \
+ || perl.should_invoke [htype])
+#define HOOK_INVOKE(args) rxvt_perl.invoke args
+
+enum data_type {
+ DT_END, // no further arguments
+ DT_INT,
+ DT_LONG,
+ DT_STR, // 0-terminated string
+ DT_STR_LEN, // string + length
+ DT_WCS_LEN, // wchar_t* + length
+ DT_LCS_LEN, // long* + length
+ DT_XEVENT,
+};
+
+enum hook_type {
+# define def(sym) HOOK_ ## sym,
+# include "hookinc.h"
+# undef def
+ HOOK_NUM,
+};
+
+struct rxvt_perl_term
+{
+ void *self;
+ unsigned long grabtime;
+ uint8_t should_invoke[HOOK_NUM];
+
+ // this object must be zero-initialised
+ rxvt_perl_term ()
+ {
+ should_invoke [HOOK_INIT] =
+ should_invoke [HOOK_DESTROY] = 1;
+ }
+};
+
+struct rxvt_perl_interp
+{
+ char **perl_environ;
+
+ ~rxvt_perl_interp ();
+
+ void init ();
+ void init (rxvt_term *term);
+ void eval (const char *str);
+ bool invoke (rxvt_term *term, hook_type htype, ...);
+ void line_update (rxvt_term *term);
+ void selection_finish (rxvt_selection *sel, char *data, unsigned int len);
+ void usage (rxvt_term *term, int type);
+
+ enum
+ {
+ RESOURCE_AVAILABLE = 1, // whether the option is valid
+ RESOURCE_ARG = 2 // whether the option eats the next arg
+ };
+ uint8_t parse_resource (rxvt_term *term, const char *name, bool arg, bool longopt, bool flag, const char *value);
+};
+
+extern struct rxvt_perl_interp rxvt_perl;
+
+#else
+
+#define SHOULD_INVOKE(htype) false
+#define HOOK_INVOKE(args) false
+
+#endif
+
+#endif
+