source: perlglue.xs @ f1e629d

barnowl_perlaimdebianowlrelease-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since f1e629d was f1e629d, checked in by Erik Nygren <nygren@mit.edu>, 17 years ago
New API for perl message formatting functions. Legacy variables are still supported for owl::format_msg and owl::receive_msg, but these functions are now also passed an owl::Message object which contains methods for accessing the contents of the message. See perlwrap.pm (and docs TBD) for the available methods. *** WARNING: The exact API for owl::Message has *** not yet stabilized. Added "style" command for creating new styles. Usage: style <name> perl <function_name> Added support for "show styles". Changed global style table from list to dictionary. Changed AIM password prompt from "Password:" to "AIM Password:". Messages are reformatted after a window resize to allow styles to take into account the width of the window. When perl throws an error, the message is put in the msgwin if possible. Added perl functions for: owl::getcurmsg() -- returns an owl::Message object for the active message in the current view. owl::getnumcols() -- returns the column width of the window owl::zephyr_getrealm() -- returns the zephyr realm owl::zephyr_getsender() -- returns the zephyr sender Made owl::COMMAND("foo"); be syntactic sugar for owl::command("COMMAND foo"); *** Is this a good or bad idea? *** This feature may be taken out before release. Added perlwrap.pm to contain perl code to be compiled into the binary. This is transformed into perlwrap.c by encapsulate.pl. Renamed readconfig.c to perlconfig.c and changed variables accordingly. Minor bugfixes in cmd.c and commands.c
  • Property mode set to 100644
File size: 1.3 KB
Line 
1static const char fileIdent[] = "$Id$";
2
3#include <zephyr/zephyr.h>
4#include <EXTERN.h>
5#include <perl.h>
6#include <XSUB.h>
7
8/* Yeah, we should just include owl.h, but curses and perl don't play nice. */
9extern char *owl_function_command(char *cmd);
10extern void owl_free(void *x);
11extern SV *owl_perlconfig_curmessage2hashref();
12extern int owl_zwrite_create_and_send_from_line(char *, char *);
13extern char *owl_function_ztext_stylestrip(char *);
14extern void g;
15extern int owl_global_get_cols(void*);
16
17MODULE = owl            PACKAGE = owl           
18
19char *
20command(cmd)
21        char *cmd
22        PREINIT:
23                char *rv = NULL;
24        CODE:
25                rv = owl_function_command(cmd);
26                RETVAL = rv;   
27        OUTPUT:
28                RETVAL
29        CLEANUP:
30                if (rv) owl_free(rv);
31
32SV *
33getcurmsg()
34        CODE:
35                ST(0) = owl_perlconfig_curmessage2hashref();
36
37int
38getnumcols()
39        CODE:
40                RETVAL = owl_global_get_cols(&g);
41        OUTPUT:
42                RETVAL
43
44char *
45zephyr_getrealm()
46        CODE:
47                RETVAL = ZGetRealm();
48        OUTPUT:
49                RETVAL
50
51char *
52zephyr_getsender()
53        CODE:
54                RETVAL = ZGetSender();
55        OUTPUT:
56                RETVAL
57
58void
59zephyr_zwrite(cmd,msg)
60        char *cmd
61        char *msg
62        PREINIT:
63                int i;
64        CODE:
65                i = owl_zwrite_create_and_send_from_line(cmd, msg);
66
67char *
68ztext_stylestrip(ztext)
69        char *ztext
70        PREINIT:
71                char *rv = NULL;
72        CODE:
73                rv = owl_function_ztext_stylestrip(ztext);
74                RETVAL = rv;
75        OUTPUT:
76                RETVAL
77        CLEANUP:
78                if (rv) owl_free(rv);
79
Note: See TracBrowser for help on using the repository browser.