⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readline.pm

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PM
📖 第 1 页 / 共 5 页
字号:
#### Perl Readline -- The Quick Help## (see the manual for complete info)#### Once this package is included (require'd), you can then call##	$text = &readline'readline($input);## to get lines of input from the user.#### Normally, it reads ~/.inputrc when loaded... to suppress this, set## 	$readline'rl_NoInitFromFile = 1;## before requiring the package.#### Call rl_bind to add your own key bindings, as in##	&readline'rl_bind('C-L', 'possible-completions');#### Call rl_set to set mode variables yourself, as in##	&readline'rl_set('TcshCompleteMode', 'On');#### To change the input mode (emacs or vi) use ~/.inputrc or call## 	   &readline::rl_set('EditingMode', 'vi');## 	or &readline::rl_set('EditingMode', 'emacs');#### Call rl_basic_commands to set your own command completion, as in##      &readline'rl_basic_commands('print', 'list', 'quit', 'run', 'status');##### Wrap the code below (initially Perl4, now partially Perl4) into a fake# Perl5 pseudo-module; mismatch of package and file name is intentional# to make is harder to abuse this (very fragile) code...package readline;my $autoload_broken = 1;	# currently: defined does not work with a-lmy $useioctl = 1;my $usestty = 1;my $max_include_depth = 10;     # follow $include's in init files this deepBEGIN {			# Some old systems have ioctl "unsupported"  *ioctl = sub ($$$) { eval { ioctl $_[0], $_[1], $_[2] } };}#### BLURB:## A pretty full-function package similar to GNU's readline.## Includes support for EUC-encoded Japanese text.#### Written by Jeffrey Friedl, Omron Corporation (jfriedl@omron.co.jp)#### Comments, corrections welcome.#### Thanks to the people at FSF for readline (and the code I referenced## while writing this), and for Roland Schemers whose line_edit.pl I used## as an early basis for this.##$VERSION = $VERSION = '1.0302';##            - Changes from Slaven Rezic (slaven@rezic.de):##		* reverted the usage of $ENV{EDITOR} to set startup mode##		  only ~/.inputrc or an explicit call to rl_set should##		  be used to set startup mode### 1011109.011 - Changes from Russ Southern (russ@dvns.com):##             * Added $rl_vi_replace_default_on_insert# 1000510.010 - Changes from Joe Petolino (petolino@eng.sun.com), requested##              by Ilya:####              * Make it compatible with perl 5.003.##              * Rename getc() to getc_with_pending().##              * Change unshift(@Pending) to push(@Pending).#### 991109.009 - Changes from Joe Petolino (petolino@eng.sun.com):##              Added vi mode.  Also added a way to set the keymap default##      	action for multi-character keymaps, so that a 2-character##      	sequence (e.g. <esc>A) can be treated as two one-character##      	commands (<esc>, then A) if the sequence is not explicitly##              mapped.##      ##              Changed subs:####              * preinit(): Initialize new keymaps and other data structures.##		             Use $ENV{EDITOR} to set startup mode.####              * init():    Sets the global *KeyMap, since &F_ReReadInitFile##                           may have changed the key map.####		* InitKeymap(): $KeyMap{default} is now optional - don't##			     set it if $_[1] eq '';####		* actually_do_binding(): Set $KeyMap{default} for '\*' key;##			     warning if double-defined.####		* rl_bind(): Implement \* to set the keymap default.  Also fix##			     some existing regex bugs that I happened to notice.####		* readline(): No longer takes input from $pending before##                           calling &$rl_getc(); instead, it calls getc_with_pending(),##                           which takes input from the new array @Pending##			     before calling &$rl_getc().  Sets the global##			     *KeyMap after do_command(), since do_command()##			     may change the keymap now.  Does some cursor##			     manipulation after do_command() when at the end##			     of the line in vi command mode, to match the##			     behavior of vi.####		* rl_getc(): Added a my declaration for $key, which was##			     apparently omitted by the author.  rl_getc() is ##			     no longer called directly; instead, getc_with_pending() calls##			     it only after exhausting any requeued characters##			     in @Pending.  @Pending is used to implement the##			     vi '.' command, as well as the emacs DoSearch##			     functionality.####		* do_command(): Now defaults the command to 'F_Ding' if##			     $KeyMap{default} is undefined.  This is part##			     of the new \* feature.####		* savestate()/getstate(): Now use an anonymous array instead##		             of packing the fields into a string.####		* F_AcceptLine(): Code moved to new sub add_line_to_history(),##			     so that it may be called by F_SaveLine()##			     as well as by F_AcceptLine().####		* F_QuotedInsert(): Calls getc_with_pending() instead of &$rl_getc().####		* F_UnixWordRubout(): Fixed bug: changed 'my' declaration of##		             global $rl_basic_word_break_characters to 'local'.####		* DoSearch(): Calls getc_with_pending() instead of &$rl_getc().  Ungets##			     character onto @Pending instead of $pending.####		* F_EmacsEditingMode(): Resets global $Vi_mode;####		* F_ToggleEditingMode(): Deleted.  We use F_ViInput() and##                           F_EmacsEditingMode() instead.####		* F_PrefixMeta(): Calls getc_with_pending() instead of &$rl_getc().####		* F_DigitArgument(): Calls getc_with_pending() instead of &$rl_getc().####		* F_Ding(): Returns undef, for testing by vi commands.####		* F_Complete(): Returns true if a completion was done, false##                           otherwise, so vi completion routines can test it.####		* complete_internal(): Returns true if a completion was done,##                           false otherwise, so vi completion routines can##                           test it.  Does a little cursor massaging in vi##                           mode, to match the behavior of ksh vi mode.####              Disclaimer: the original code dates from the perl 4 days, and##              isn't very pretty by today's standards (for example,##              extensive use of typeglobs and localized globals).  In the##              interests of not breaking anything, I've tried to preserve##              the old code as much as possible, and I've avoided making##              major stylistic changes.  Since I'm not a regular emacs user,##              I haven't done much testing to see that all the emacs-mode##              features still work.#### 940817.008 - Added $var_CompleteAddsuffix.##		Now recognizes window-change signals (at least on BSD).##              Various typos and bug fixes.##	Changes from Chris Arthur (csa@halcyon.com):##		Added a few new keybindings.##              Various typos and bug fixes.##		Support for use from a dumb terminal.##		Pretty-printing of filename-completion matches.##		## 930306.007 - Added rl_start_default_at_beginning.##		Added optional message arg to &redisplay.##		Added explicit numeric argument var to functions that use it.##		Redid many commands to simplify.##		Added TransposeChars, UpcaseWord, CapitalizeWord, DownCaseWord.##		Redid key binding specs to better match GNU.. added##		  undocumented "new-style" bindings.... can now bind##		  arrow keys and other arbitrairly long key sequences.##		Added if/else/then to .inputrc.##		## 930305.006 - optional "default" added (from mmuegel@cssmp.corp.mot.com).#### 930211.005 - fixed strange problem with eval while keybinding###### Ilya: #### Added support for ReadKey, #### Added customization variable $minlength## to denote minimal lenth of a string to be put into history buffer.#### Added support for a bug in debugger: preinit cannot be a subroutine ?!!!## (See immendiately below)#### Added support for WINCH hooks. The subroutine references should be put into## @winchhooks.#### Added F_ToggleInsertMode, F_HistorySearchBackward,## F_HistorySearchForward, PC keyboard bindings.## 0.93: Updates to Operate, couple of keybindings added.## $rl_completer_terminator_character, $rl_correct_sw added.## Reload-init-file moved to C-x C-x.## C-x ? and C-x * list/insert possible completions.$rl_getc = \&rl_getc;&preinit;&init;# # # # use strict 'vars';# # # # # Separation into my and vars needs some thought...# # # # use vars qw(@KeyMap %KeyMap $rl_screen_width $rl_start_default_at_beginning# # # # 	    $rl_completion_function $rl_basic_word_break_characters# # # # 	    $rl_completer_word_break_characters $rl_special_prefixes# # # # 	    $rl_readline_name @rl_History $rl_MaxHistorySize# # # #             $rl_max_numeric_arg $rl_OperateCount# # # # 	    $KillBuffer $dumb_term $stdin_not_tty $InsertMode # # # # 	    $rl_NoInitFromFile);# # # # my ($InputLocMsg, $term_OUT, $term_IN);# # # # my ($winsz_t, $TIOCGWINSZ, $winsz, $rl_margin, $hooj, $force_redraw);# # # # my ($hook, %var_HorizontalScrollMode, %var_EditingMode, %var_OutputMeta);# # # # my ($var_HorizontalScrollMode, $var_EditingMode, $var_OutputMeta);# # # # my (%var_ConvertMeta, $var_ConvertMeta, %var_MarkModifiedLines, $var_MarkModifiedLines);# # # # my ($term_readkey, $inDOS);# # # # my (%var_PreferVisibleBell, $var_PreferVisibleBell);# # # # my (%var_TcshCompleteMode, $var_TcshCompleteMode);# # # # my (%var_CompleteAddsuffix, $var_CompleteAddsuffix);# # # # my ($minlength, @winchhooks);# # # # my ($BRKINT, $ECHO, $FIONREAD, $ICANON, $ICRNL, $IGNBRK, $IGNCR, $INLCR,# # # #     $ISIG, $ISTRIP, $NCCS, $OPOST, $RAW, $TCGETS, $TCOON, $TCSETS, $TCXONC,# # # #     $TERMIOS_CFLAG, $TERMIOS_IFLAG, $TERMIOS_LFLAG, $TERMIOS_NORMAL_IOFF,# # # #     $TERMIOS_NORMAL_ION, $TERMIOS_NORMAL_LOFF, $TERMIOS_NORMAL_LON, # # # #     $TERMIOS_NORMAL_OOFF, $TERMIOS_NORMAL_OON, $TERMIOS_OFLAG, # # # #     $TERMIOS_READLINE_IOFF, $TERMIOS_READLINE_ION, $TERMIOS_READLINE_LOFF, # # # #     $TERMIOS_READLINE_LON, $TERMIOS_READLINE_OOFF, $TERMIOS_READLINE_OON, # # # #     $TERMIOS_VMIN, $TERMIOS_VTIME, $TIOCGETP, $TIOCGWINSZ, $TIOCSETP, # # # #     $fion, $fionread_t, $mode, $sgttyb_t, # # # #     $termios, $termios_t, $winsz, $winsz_t);# # # # my ($line, $initialized, $term_readkey);# # # # # Global variables added for vi mode (I'm leaving them all commented# # # # #     out, like the declarations above, until SelfLoader issues# # # # #     are resolved).# # # # # True when we're in one of the vi modes.# # # # my $Vi_mode;# # # # # Array refs: saves keystrokes for '.' command.  Undefined when we're# # # # #     not doing a '.'-able command.# # # # my $Dot_buf;                # Working buffer# # # # my $Last_vi_command;        # Gets $Dot_buf when a command is parsed# # # # # These hold state for vi 'u' and 'U'.# # # # my($Dot_state, $Vi_undo_state, $Vi_undo_all_state);# # # # # Refs to hashes used for cursor movement# # # # my($Vi_delete_patterns, $Vi_move_patterns,# # # #    $Vi_change_patterns, $Vi_yank_patterns);# # # # # Array ref: holds parameters from the last [fFtT] command, for ';'# # # # #     and ','.# # # # my $Last_findchar;# # # # # Globals for history search commands (/, ?, n, N)# # # # my $Vi_search_re;       # Regular expression (compiled by qr{})# # # # my $Vi_search_reverse;  # True for '?' search, false for '/'#### What's Cool## ----------------------------------------------------------------------## * hey, it's in perl.## * Pretty full GNU readline like library...## *	support for ~/.inputrc## *    horizontal scrolling## *	command/file completion## *	rebinding## *	history (with search)## *	undo## *	numeric prefixes## * supports multi-byte characters (at least for the Japanese I use).## * Has a tcsh-like completion-function mode.##     call &readline'rl_set('tcsh-complete-mode', 'On') to turn on.###### What's not Cool## ----------------------------------------------------------------------## Can you say HUGE?## I can't spell, so comments riddled with misspellings.## Written by someone that has never really used readline.## History mechanism is slightly different than GNU... may get fixed##     someday, but I like it as it is now...## Killbuffer not a ring.. just one level.## Obviously not well tested yet.## Written by someone that doesn't have a bell on his terminal, so##     proper readline use of the bell may not be here.###### Functions beginning with F_ are functions that are mapped to keys.## Variables and functions beginning rl_ may be accessed/set/called/read## from outside the package.  Other things are internal.#### Some notable internal-only variables of global proportions:##   $prompt -- line prompt (passed from user)##   $line  -- the line being input##   $D     -- ``Dot'' -- index into $line of the cursor's location.##   $InsertMode -- usually true. False means overwrite mode.##   $InputLocMsg -- string for error messages, such as "[~/.inputrc line 2]"##   *emacs_keymap -- keymap for emacs-mode bindings:##	@emacs_keymap - bindings indexed by ASCII ordinal##      $emacs_keymap{'name'} = "emacs_keymap"##      $emacs_keymap{'default'} = "SelfInsert"  (default binding)##   *vi_keymap -- keymap for vi input mode bindings##   *vicmd_keymap -- keymap for vi command mode bindings##   *vipos_keymap -- keymap for vi positioning command bindings##   *visearch_keymap -- keymap for vi search pattern input mode bindings##   *KeyMap -- current keymap in effect.##   $LastCommandKilledText -- needed so that subsequent kills accumulate##   $lastcommand -- name of command previously run##   $lastredisplay -- text placed upon screen during previous &redisplay##   $si -- ``screen index''; index into $line of leftmost char &redisplay'ed##   $force_redraw -- if set to true, causes &redisplay to be verbose.##   $AcceptLine -- when set, its value is returned from &readline.##   $ReturnEOF -- unless this also set, in which case undef is returned.##   @Pending -- characters to be used as input.##   @undo -- array holding all states of current line, for undoing.##   $KillBuffer -- top of kill ring (well, don't have a kill ring yet)##   @tcsh_complete_selections -- for tcsh mode, possible selections#### Some internal variables modified by &rl_set (see comment at &rl_set for## info about how these set'able variables work)##   $var_EditingMode -- a keymap typeglob like *emacs_keymap or *vi_keymap##   $var_TcshCompleteMode -- if true, the completion function works like##      in tcsh.  That is, the first time you try to complete something,##	the common prefix is completed for you. Subsequent completion tries##	(without other commands in between) cycles the command line through##	the various possibilities.  If/when you get the one you want, just##	continue typing.## Other $var_ things not supported yet.#### Some variables used internally, but may be accessed from outside...##   $VERSION -- just for good looks.##   $rl_readline_name = name of program -- for .initrc if/endif stuff.##   $rl_NoInitFromFile -- if defined when package is require'd, ~/.inputrc##  	will not be read.##   @rl_History -- array of previous lines input##   $rl_HistoryIndex -- history pointer (for moving about history array)##   $rl_completion_function -- see "How Command Completion Works" (way) below.##   $rl_basic_word_break_characters -- string of characters that can cause##	a word break for forward-word, etc.##   $rl_start_default_at_beginning --##	Normally, the user's cursor starts at the end of any default text##	passed to readline.  If this variable is true, it starts at the##	beginning.##   $rl_completer_word_break_characters --##	like $rl_basic_word_break_characters (and in fact defaults to it),##	but for the completion function.##   $rl_completer_terminator_character -- what to insert to separate##      a completed token from the rest.  Reset at beginning of##      completion to ' ' so completion function can change it.##   $rl_special_prefixes -- characters that are part of this string as well##      as of $rl_completer_word_break_characters cause a word break for the##	completer function, but remain part of the word.  An example: consider##      when the input might be perl code, and one wants to be able to##      complete on variable and function names, yet still have the '$',##	'&', '@',etc. part of the $text to be completed. Then set this var## 	to '&@$%' and make sure each of these characters is in## 	$rl_completer_word_break_characters as well....##   $rl_MaxHistorySize -- maximum size that the history array may grow.##   $rl_screen_width -- width readline thinks it can use on the screen.##   $rl_correct_sw -- is substructed from the real width of the terminal

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -