Changeset a01ed7c for perl/lib


Ignore:
Timestamp:
Oct 27, 2009, 2:15:08 PM (12 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
7ca5d3e
Parents:
e7f5970 (diff), f1a2736 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge branch 'io_dispatch_rewrite'
Location:
perl/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • perl/lib/BarnOwl.pm

    r3c428d4 rffc4df6  
    1313                    error debug
    1414                    create_style getnumcolors wordwrap
    15                     add_dispath remove_dispatch
     15                    add_dispatch remove_dispatch
     16                    add_io_dispatch remove_io_dispatch
    1617                    new_command
    1718                    new_variable_int new_variable_bool new_variable_string
     
    6263Returns the current message as a C<BarnOwl::Message> subclass, or
    6364undef if there is no message selected
    64 
    6565=head2 getnumcols
    6666
     
    160160read from C<FD>.
    161161
     162C<add_dispatch> has been deprecated in favor of C<add_io_dispatch>,
     163and is now a wrapper for it called with C<mode> set to C<'r'>.
     164
     165=cut
     166
     167sub add_dispatch {
     168    my $fd = shift;
     169    my $cb = shift;
     170    add_io_dispatch($fd, 'r', $cb);
     171}
     172
    162173=head2 remove_dispatch FD
    163174
    164175Remove a file descriptor previously registered via C<add_dispatch>
     176
     177C<remove_dispatch> has been deprecated in favor of
     178C<remove_io_dispatch>.
     179
     180=cut
     181
     182*remove_dispatch = \&remove_io_dispatch;
     183
     184=head2 add_io_dispatch FD MODE CB
     185
     186Adds a file descriptor to C<BarnOwl>'s internal C<select()>
     187loop. <MODE> can be 'r', 'w', or 'rw'. C<CALLBACK> will be invoked
     188whenever C<FD> becomes ready, as specified by <MODE>.
     189
     190Only one callback can be registered per FD. If a new callback is
     191registered, the old one is removed.
     192
     193=cut
     194
     195sub add_io_dispatch {
     196    my $fd = shift;
     197    my $modeStr = shift;
     198    my $cb = shift;
     199    my $mode = 0;
     200
     201    $mode |= 0x1 if ($modeStr =~ /r/i); # Read
     202    $mode |= 0x2 if ($modeStr =~ /w/i); # Write
     203    if ($mode) {
     204        $mode |= 0x4;                  # Exceptional
     205        BarnOwl::Internal::add_io_dispatch($fd, $mode, $cb);
     206    } else {
     207        die("Invalid I/O Dispatch mode: $modeStr");
     208    }
     209}
     210
     211=head2 remove_io_dispatch FD
     212
     213Remove a file descriptor previously registered via C<add_io_dispatch>
    165214
    166215=head2 create_style NAME OBJECT
  • perl/lib/BarnOwl/Complete/Client.pm

    ra3a9eb7 r02a72bf  
    2424    commands    => undef,
    2525    command     => \&complete_command,
     26    errors      => undef,
    2627    filters     => undef,
    2728    filter      => \&complete_filter_name,
    2829    license     => undef,
     30    keymaps     => undef,
     31    keymap      => \&complete_keymap,
    2932    quickstart  => undef,
    3033    startup     => undef,
     
    4548sub complete_variable    { return @{BarnOwl::all_variables()}; }
    4649sub complete_style       { return @{BarnOwl::all_styles()}; }
     50sub complete_keymap      { return @{BarnOwl::all_keymaps()}; }
    4751
    4852sub complete_help {
Note: See TracChangeset for help on using the changeset viewer.