-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 4030cd8d0fea13b878fb287ad71f35458b37e36c: path_to: revision_to:
commit 4030cd8d0fea13b878fb287ad71f35458b37e36c Author: Marc Lehmann <schmorp@schmorp.de> Date: Mon Jan 2 20:35:39 2006 +0000 *** empty log message *** diff --git a/doc/rxvt.1.html b/doc/rxvt.1.html
--- a/doc/rxvt.1.html +++ b/doc/rxvt.1.html @@ -628,10 +628,10 @@ longer example is in <em>doc/pty-fd</em>):</p> while (<$slave>) { print $slave "got <$_>\n" }</pre> </dd> <p></p> -<dt><strong><a name="item__2dperl_string"><strong>-perl</strong> <em>string</em></a></strong><br /> +<dt><strong><a name="item__2dpe_string"><strong>-pe</strong> <em>string</em></a></strong><br /> </dt> <dd> -Used by perl extension. See resource <strong>perl</strong>. +Colon-separated list of perl extension scripts to use in this terminal instance. See resource <strong>perl-ext</strong>. </dd> <p></p></dl> <p> @@ -1416,27 +1416,28 @@ info):</p> URxvt.keysym.M-C-4: command:\033[8;48;110t</pre> </dd> <p></p> -<dt><strong><a name="item_perl_3a_string"><strong>perl</strong>: <em>string</em></a></strong><br /> +<dt><strong><a name="item_perl_2dext_3a_string"><strong>perl-ext</strong>: <em>string</em></a></strong><br /> </dt> <dd> -Used by perl extension and is free for any use, as it is not interpreted -by rxvt-unicode itself; option <strong>perl</strong>. +Colon-separated list of perl extension scripts to use in this terminal +instance. Each extension is looked up in the library directories, loaded +if necessary, and bound to the current terminal instance; option <strong>-pe</strong>. </dd> <p></p> <dt><strong><a name="item_perl_2deval_3a_string"><strong>perl-eval</strong>: <em>string</em></a></strong><br /> </dt> <dd> -Perl code to be evaluated when all extensions have been loaded. See the +Perl code to be evaluated when all extensions have been registered. See the <code>rxvtperl(3)</code> manpage. </dd> <p></p> <dt><strong><a name="item_perl_2dlib_3a_path"><strong>perl-lib</strong>: <em>path</em></a></strong><br /> </dt> <dd> -Additional directory that holds extension scripts that are loaded and -enabled for this terminal instance, in addition to scripts stored in -<em>/opt/rxvt/lib/urxvt/perl-ext/</em>, which are global to all terminal -instances. +Colon-separated list of additional directories that hold extension +scripts. When looking for extensions specified by the <code>perl</code> resource, +rxvt will first look in these directories and then in +<em>/opt/rxvt/lib/urxvt/perl-ext/</em>. </dd> <dd> <p>See the <code>rxvtperl(3)</code> manpage.</p> diff --git a/doc/rxvt.1.man.in b/doc/rxvt.1.man.in
--- a/doc/rxvt.1.man.in +++ b/doc/rxvt.1.man.in @@ -534,9 +534,9 @@ longer example is in \fIdoc/pty\-fd\fR): \& my $slave = $pty->slave; \& while (<$slave>) { print $slave "got <$_>\en" } .Ve -.IP "\fB\-perl\fR \fIstring\fR" 4 -.IX Item "-perl string" -Used by perl extension. See resource \fBperl\fR. +.IP "\fB\-pe\fR \fIstring\fR" 4 +.IX Item "-pe string" +Colon-separated list of perl extension scripts to use in this terminal instance. See resource \fBperl-ext\fR. .SH "RESOURCES (available also as long\-options)" .IX Header "RESOURCES (available also as long-options)" Note: `@@RXVT_NAME@@ \-\-help' gives a list of all resources (long @@ -1080,20 +1080,21 @@ info): \& URxvt.keysym.M-C-3: command:\e033[8;25;80t \& URxvt.keysym.M-C-4: command:\e033[8;48;110t .Ve -.IP "\fBperl\fR: \fIstring\fR" 4 -.IX Item "perl: string" -Used by perl extension and is free for any use, as it is not interpreted -by rxvt-unicode itself; option \fBperl\fR. +.IP "\fBperl-ext\fR: \fIstring\fR" 4 +.IX Item "perl-ext: string" +Colon-separated list of perl extension scripts to use in this terminal +instance. Each extension is looked up in the library directories, loaded +if necessary, and bound to the current terminal instance; option \fB\-pe\fR. .IP "\fBperl-eval\fR: \fIstring\fR" 4 .IX Item "perl-eval: string" -Perl code to be evaluated when all extensions have been loaded. See the +Perl code to be evaluated when all extensions have been registered. See the \&\fIrxvtperl\fR\|(3) manpage. .IP "\fBperl-lib\fR: \fIpath\fR" 4 .IX Item "perl-lib: path" -Additional directory that holds extension scripts that are loaded and -enabled for this terminal instance, in addition to scripts stored in -\&\fI@@RXVT_LIBDIR@@/urxvt/perl\-ext/\fR, which are global to all terminal -instances. +Colon-separated list of additional directories that hold extension +scripts. When looking for extensions specified by the \f(CW\*(C`perl\*(C'\fR resource, +@@RXVT_NAME@@ will first look in these directories and then in +\&\fI@@RXVT_LIBDIR@@/urxvt/perl\-ext/\fR. .Sp See the \fIrxvtperl\fR\|(3) manpage. .SH "THE SCROLLBAR" diff --git a/doc/rxvt.1.pod b/doc/rxvt.1.pod
--- a/doc/rxvt.1.pod +++ b/doc/rxvt.1.pod @@ -455,9 +455,9 @@ longer example is in F<doc/pty-fd>): my $slave = $pty->slave; while (<$slave>) { print $slave "got <$_>\n" } -=item B<-perl> I<string> +=item B<-pe> I<string> -Used by perl extension. See resource B<perl>. +Colon-separated list of perl extension scripts to use in this terminal instance. See resource B<perl-ext>. =back @@ -1056,22 +1056,23 @@ info): URxvt.keysym.M-C-3: command:\033[8;25;80t URxvt.keysym.M-C-4: command:\033[8;48;110t -=item B<perl>: I<string> +=item B<perl-ext>: I<string> -Used by perl extension and is free for any use, as it is not interpreted -by rxvt-unicode itself; option B<perl>. +Colon-separated list of perl extension scripts to use in this terminal +instance. Each extension is looked up in the library directories, loaded +if necessary, and bound to the current terminal instance; option B<-pe>. =item B<perl-eval>: I<string> -Perl code to be evaluated when all extensions have been loaded. See the +Perl code to be evaluated when all extensions have been registered. See the rxvtperl(3) manpage. =item B<perl-lib>: I<path> -Additional directory that holds extension scripts that are loaded and -enabled for this terminal instance, in addition to scripts stored in -F<@@RXVT_LIBDIR@@/urxvt/perl-ext/>, which are global to all terminal -instances. +Colon-separated list of additional directories that hold extension +scripts. When looking for extensions specified by the C<perl> resource, +@@RXVT_NAME@@ will first look in these directories and then in +F<@@RXVT_LIBDIR@@/urxvt/perl-ext/>. See the rxvtperl(3) manpage. diff --git a/doc/rxvt.1.txt b/doc/rxvt.1.txt
--- a/doc/rxvt.1.txt +++ b/doc/rxvt.1.txt @@ -392,8 +392,9 @@ OPTIONS my $slave = $pty->slave; while (<$slave>) { print $slave "got <$_>\n" } - -perl *string* - Used by perl extension. See resource perl. + -pe *string* + Colon-separated list of perl extension scripts to use in this + terminal instance. See resource perl-ext. RESOURCES (available also as long-options) Note: `rxvt --help' gives a list of all resources (long options) @@ -918,19 +919,21 @@ RESOURCES (available also as long-options) URxvt.keysym.M-C-3: command:\033[8;25;80t URxvt.keysym.M-C-4: command:\033[8;48;110t - perl: *string* - Used by perl extension and is free for any use, as it is not - interpreted by rxvt-unicode itself; option perl. + perl-ext: *string* + Colon-separated list of perl extension scripts to use in this + terminal instance. Each extension is looked up in the library + directories, loaded if necessary, and bound to the current terminal + instance; option -pe. perl-eval: *string* - Perl code to be evaluated when all extensions have been loaded. See - the rxvtperl(3) manpage. + Perl code to be evaluated when all extensions have been registered. + See the rxvtperl(3) manpage. perl-lib: *path* - Additional directory that holds extension scripts that are loaded - and enabled for this terminal instance, in addition to scripts - stored in /opt/rxvt/lib/urxvt/perl-ext/, which are global to all - terminal instances. + Colon-separated list of additional directories that hold extension + scripts. When looking for extensions specified by the "perl" + resource, rxvt will first look in these directories and then in + /opt/rxvt/lib/urxvt/perl-ext/. See the rxvtperl(3) manpage. diff --git a/doc/rxvtperl.3.html b/doc/rxvtperl.3.html
--- a/doc/rxvtperl.3.html +++ b/doc/rxvtperl.3.html @@ -58,14 +58,10 @@ thus must be encoded as UTF-8.</p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> -<p>On startup, rxvt will scan <em>/opt/rxvt/lib/urxvt/perl-ext/</em> -for files and will load them. Everytime a terminal object gets created, -the directory specified by the <code>perl-lib</code> resource will be additionally -scanned.</p> +<p>Everytime a terminal object gets created, scripts specified via the +<code>perl</code> resource are associated with it.</p> <p>Each script will only ever be loaded once, even in rxvtd, where -scripts will be shared for all terminals.</p> -<p>Hooks in scripts specified by <code>perl-lib</code> will only be called for the -terminals created with that specific option value.</p> +scripts will be shared (But not enabled) for all terminals.</p> <p> </p> <h2><a name="general_api_considerations">General API Considerations</a></h2> @@ -255,8 +251,8 @@ list:</p> borderLess color cursorBlink cursorUnderline cutchars delete_key display_name embed ext_bwidth fade font geometry hold iconName imFont imLocale inputMethod insecure int_bwidth intensityStyles - italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 - modifier mouseWheelScrollPage name pastableTabs path perl perl_eval + italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier + mouseWheelScrollPage name pastableTabs path perl_eval perl_ext perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput diff --git a/doc/rxvtperl.3.man.in b/doc/rxvtperl.3.man.in
--- a/doc/rxvtperl.3.man.in +++ b/doc/rxvtperl.3.man.in @@ -151,16 +151,11 @@ thus must be encoded as \s-1UTF\-8\s0. .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" -On startup, @@RXVT_NAME@@ will scan \fI@@RXVT_LIBDIR@@/urxvt/perl\-ext/\fR -for files and will load them. Everytime a terminal object gets created, -the directory specified by the \f(CW\*(C`perl\-lib\*(C'\fR resource will be additionally -scanned. +Everytime a terminal object gets created, scripts specified via the +\&\f(CW\*(C`perl\*(C'\fR resource are associated with it. .PP Each script will only ever be loaded once, even in @@RXVT_NAME@@d, where -scripts will be shared for all terminals. -.PP -Hooks in scripts specified by \f(CW\*(C`perl\-lib\*(C'\fR will only be called for the -terminals created with that specific option value. +scripts will be shared (But not enabled) for all terminals. .Sh "General \s-1API\s0 Considerations" .IX Subsection "General API Considerations" All objects (such as terminals, time watchers etc.) are typical @@ -308,8 +303,8 @@ list: \& borderLess color cursorBlink cursorUnderline cutchars delete_key \& display_name embed ext_bwidth fade font geometry hold iconName \& imFont imLocale inputMethod insecure int_bwidth intensityStyles -\& italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 -\& modifier mouseWheelScrollPage name pastableTabs path perl perl_eval +\& italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier +\& mouseWheelScrollPage name pastableTabs path perl_eval perl_ext \& perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd \& reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating \& scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput diff --git a/doc/rxvtperl.3.txt b/doc/rxvtperl.3.txt
--- a/doc/rxvtperl.3.txt +++ b/doc/rxvtperl.3.txt @@ -16,15 +16,11 @@ SYNOPSIS 1 DESCRIPTION - On startup, rxvt will scan /opt/rxvt/lib/urxvt/perl-ext/ for files and - will load them. Everytime a terminal object gets created, the directory - specified by the "perl-lib" resource will be additionally scanned. + Everytime a terminal object gets created, scripts specified via the + "perl" resource are associated with it. Each script will only ever be loaded once, even in rxvtd, where scripts - will be shared for all terminals. - - Hooks in scripts specified by "perl-lib" will only be called for the - terminals created with that specific option value. + will be shared (But not enabled) for all terminals. General API Considerations All objects (such as terminals, time watchers etc.) are typical @@ -157,8 +153,8 @@ DESCRIPTION borderLess color cursorBlink cursorUnderline cutchars delete_key display_name embed ext_bwidth fade font geometry hold iconName imFont imLocale inputMethod insecure int_bwidth intensityStyles - italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 - modifier mouseWheelScrollPage name pastableTabs path perl perl_eval + italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier + mouseWheelScrollPage name pastableTabs path perl_eval perl_ext perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput diff --git a/src/rsinc.h b/src/rsinc.h
--- a/src/rsinc.h +++ b/src/rsinc.h @@ -104,7 +104,7 @@ Rs_def(shade) #endif #if ENABLE_PERL - Rs_def(perl_lib) Rs_def(perl_eval) - Rs_def(perl) + Rs_def(perl_ext) + Rs_def(perl_lib) #endif diff --git a/src/rxvtperl.h b/src/rxvtperl.h
--- a/src/rxvtperl.h +++ b/src/rxvtperl.h @@ -18,12 +18,10 @@ enum data_type { }; enum hook_type { - HOOK_LOAD, - - HOOK_INIT, + HOOK_INIT = 0, // special, hardcoded + HOOK_DESTROY = 1, // values in urxvt.pm HOOK_RESET, HOOK_START, - HOOK_DESTROY, HOOK_SEL_BEGIN, HOOK_SEL_EXTEND, diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
--- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -210,9 +210,8 @@ rxvt_perl_interp::init () bool rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) { - // INIT and DESTROY must be requested by the runtime - - if (!perl || !should_invoke [htype]) + if (!perl + || (!should_invoke [htype] && htype != HOOK_INIT && htype != HOOK_DESTROY)) return false; if (htype == HOOK_INIT) // first hook ever called @@ -291,7 +290,6 @@ BOOT: { # define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0)) AV *hookname = get_av ("urxvt::HOOKNAME", 1); - set_hookname (LOAD); set_hookname (INIT); set_hookname (RESET); set_hookname (START); diff --git a/src/urxvt.pm b/src/urxvt.pm
--- a/src/urxvt.pm +++ b/src/urxvt.pm @@ -18,16 +18,11 @@ thus must be encoded as UTF-8. =head1 DESCRIPTION -On startup, @@RXVT_NAME@@ will scan F<@@RXVT_LIBDIR@@/urxvt/perl-ext/> -for files and will load them. Everytime a terminal object gets created, -the directory specified by the C<perl-lib> resource will be additionally -scanned. +Everytime a terminal object gets created, scripts specified via the +C<perl> resource are associated with it. Each script will only ever be loaded once, even in @@RXVT_NAME@@d, where -scripts will be shared for all terminals. - -Hooks in scripts specified by C<perl-lib> will only be called for the -terminals created with that specific option value. +scripts will be shared (But not enabled) for all terminals. =head2 General API Considerations @@ -176,33 +171,12 @@ BEGIN { }; } +my @hook_count; my $verbosity = $ENV{URXVT_PERL_VERBOSITY}; sub verbose { my ($level, $msg) = @_; - warn "$msg\n" if $level < $verbosity; -} - -my %hook_global; -my @hook_count; - -# called by the rxvt core -sub invoke { - local $term = shift; - my $htype = shift; - - verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $term, @_) . ")" - if $verbosity >= 10; - - for my $cb ($hook_global{_hook}[$htype], $term->{_hook}[$htype]) { - $cb or next; - - while (my ($k, $v) = each %$cb) { - return 1 if $v->($term, @_); - } - } - - 0 + warn "$msg\n" if $level <= $verbosity; } # find on_xxx subs in the package and register them @@ -230,57 +204,62 @@ sub script_package($) { my ($path) = @_; $script_pkg{$path} ||= do { - my $pkg = $script_pkg++; + my $pkg = "urxvt::" . ($script_pkg++); + verbose 3, "loading script '$path' into package '$pkg'"; open my $fh, "<:raw", $path or die "$path: $!"; - eval "package $pkg; use strict; use utf8;\n" - . "#line 1 \"$path\"\n" - . do { local $/; <$fh> } - or die "$path: $@"; + my $source = "package $pkg; use strict; use utf8;\n" + . "#line 1 \"$path\"\n{\n" + . (do { local $/; <$fh> }) + . "\n};\n1"; + + eval $source or die "$path: $@"; $pkg } } -sub load_scripts($) { - my ($dir) = @_; - - verbose 3, "loading scripts from '$dir'"; - - register_package script_package $_ - for grep -f $_, - <$dir/*>; -} +# called by the rxvt core +sub invoke { + local $term = shift; + my $htype = shift; -sub on_init { - my ($term) = @_; + if ($htype == 0) { # INIT + my @dirs = ((split /:/, $term->resource ("perl_lib")), $LIBDIR); - my $libdir = $term->resource ("perl_lib"); + for my $ext (split /:/, $term->resource ("perl_ext")) { + my @files = grep -f $_, map "$_/$ext", @dirs; - load_scripts $libdir - if defined $libdir; -} + if (@files) { + register_package script_package $files[0]; + } else { + warn "perl extension '$ext' not found in perl library search path\n"; + } + } -sub on_destroy { - my ($term) = @_; + } elsif ($htype == 1) { # DESTROY + if (my $hook = $term->{_hook}) { + for my $htype (0..$#$hook) { + $hook_count[$htype] -= scalar keys %{ $hook->[$htype] || {} } + or set_should_invoke $htype, 0; + } + } + } - my $hook = $term->{_hook} + my $cb = $term->{_hook}[$htype] or return; - for my $htype (0..$#$hook) { - $hook_count[$htype] -= scalar keys %{ $hook->[$htype] || {} } - or set_should_invoke $htype, 0; - } -} + verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $term, @_) . ")" + if $verbosity >= 10; -{ - local $term = \%hook_global; + while (my ($k, $v) = each %$cb) { + return 1 if $v->($term, @_); + } - register_package __PACKAGE__; - load_scripts "$LIBDIR/perl-ext"; + 0 } =back @@ -314,8 +293,8 @@ list: borderLess color cursorBlink cursorUnderline cutchars delete_key display_name embed ext_bwidth fade font geometry hold iconName imFont imLocale inputMethod insecure int_bwidth intensityStyles - italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 - modifier mouseWheelScrollPage name pastableTabs path perl perl_eval + italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier + mouseWheelScrollPage name pastableTabs path perl_eval perl_ext perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput diff --git a/src/xdefaults.C b/src/xdefaults.C
--- a/src/xdefaults.C +++ b/src/xdefaults.C @@ -261,9 +261,9 @@ optList[] = { BOOL (Rs_secondaryScroll, "secondaryScroll", "ssr", Opt_secondaryScroll, "enable secondary screen scroll"), #endif #if ENABLE_PERL - STRG (Rs_perl_lib, "perl-lib", 0, "string", "directory where to look for additional extension scripts"), - STRG (Rs_perl_eval, "perl-eval", 0, "string", "string to be evaluated after all extensions have been loaded"), - STRG (Rs_perl, "perl", "perl", "string", "unused by urxvt proper, free for extensions to use"), + STRG (Rs_perl_lib, "perl-lib", 0, "string", "colon-separated directories with extension scripts"), + STRG (Rs_perl_eval, "perl-eval", 0, "string", "code to be evaluated after all extensions have been loaded"), + STRG (Rs_perl_ext, "perl-ext", "pe", "string", "colon-sepaated list of perl extensions to enable"), #endif #if 0 && TODO #if !defined(NO_RESOURCES) && defined(USE_XGETDEFAULT)
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 10:38:53 2024