;ELC ;;; compiled by kwzh@hal.gnu.ai.mit.edu on Tue Apr 25 19:10:19 1995 ;;; from file /gd/gnu/emacs/19.0/lisp/hexl.el ;;; emacs version 19.28.90.40. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "`/gd/gnu/emacs/19.0/lisp/hexl.el' was compiled for Emacs 19")) #@157 The program that will hexlify and de-hexlify its stdin. `hexl-program' will always be concatenated with `hexl-options' and "-de" when dehexlfying a buffer. (defvar hexl-program "hexl" (#$ . 478)) #@98 If your emacs can handle ISO characters, this should be set to "-iso" otherwise it should be "". (defvar hexl-iso "" (#$ . 680)) #@47 Options to hexl-program that suit your needs. (defvar hexl-options (format "-hex %s" hexl-iso) (#$ . 815)) #@41 The command to use to hexlify a buffer. (defvar hexlify-command (format "%s%s %s" exec-directory hexl-program hexl-options) (#$ . 928)) #@43 The command to use to unhexlify a buffer. (defvar dehexlify-command (format "%s%s -de %s" exec-directory hexl-program hexl-options) (#$ . 1070)) #@34 Maximum offset into hexl buffer. (defvar hexl-max-address 0 (#$ . 1221)) (byte-code "! B B B B‡" [boundp hexl-mode-map nil current-load-list hexl-mode-old-local-map hexl-mode-old-mode-name hexl-mode-old-major-mode] 2) #@3278 \ A major mode for editing binary files in hex dump format. This function automatically converts a buffer into the hexl format using the function `hexlify-buffer'. Each line in the buffer has an "address" (displayed in hexadecimal) representing the offset into the file that the characters on this line are at and 16 characters from the file (displayed as hexadecimal values grouped every 16 bits) and as their ASCII values. If any of the characters (displayed as ASCII characters) are unprintable (control or meta characters) they will be replaced as periods. If `hexl-mode' is invoked with an argument the buffer is assumed to be in hexl format. A sample format: HEX ADDR: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ASCII-TEXT -------- ---- ---- ---- ---- ---- ---- ---- ---- ---------------- 00000000: 5468 6973 2069 7320 6865 786c 2d6d 6f64 This is hexl-mod 00000010: 652e 2020 4561 6368 206c 696e 6520 7265 e. Each line re 00000020: 7072 6573 656e 7473 2031 3620 6279 7465 presents 16 byte 00000030: 7320 6173 2068 6578 6164 6563 696d 616c s as hexadecimal 00000040: 2041 5343 4949 0a61 6e64 2070 7269 6e74 ASCII.and print 00000050: 6162 6c65 2041 5343 4949 2063 6861 7261 able ASCII chara 00000060: 6374 6572 732e 2020 416e 7920 636f 6e74 cters. Any cont 00000070: 726f 6c20 6f72 206e 6f6e 2d41 5343 4949 rol or non-ASCII 00000080: 2063 6861 7261 6374 6572 730a 6172 6520 characters.are 00000090: 6469 7370 6c61 7965 6420 6173 2070 6572 displayed as per 000000a0: 696f 6473 2069 6e20 7468 6520 7072 696e iods in the prin 000000b0: 7461 626c 6520 6368 6172 6163 7465 7220 table character 000000c0: 7265 6769 6f6e 2e0a region.. Movement is as simple as movement in a normal emacs text buffer. Most cursor movement bindings are the same (ie. Use \[hexl-backward-char], \[hexl-forward-char], \[hexl-next-line], and \[hexl-previous-line] to move the cursor left, right, down, and up). Advanced cursor movement commands (ala \[hexl-beginning-of-line], \[hexl-end-of-line], \[hexl-beginning-of-buffer], and \[hexl-end-of-buffer]) are also supported. There are several ways to change text in hexl mode: ASCII characters (character between space (0x20) and tilde (0x7E)) are bound to self-insert so you can simply type the character and it will insert itself (actually overstrike) into the buffer. \[hexl-quoted-insert] followed by another keystroke allows you to insert the key even if it isn't bound to self-insert. An octal number can be supplied in place of another key to insert the octal number's ASCII representation. \[hexl-insert-hex-char] will insert a given hexadecimal value (if it is between 0 and 0xFF) into the buffer at the current point. \[hexl-insert-octal-char] will insert a given octal value (if it is between 0 and 0377) into the buffer at the current point. \[hexl-insert-decimal-char] will insert a given decimal value (if it is between 0 and 255) into the buffer at the current point. \[hexl-mode-exit] will exit hexl-mode. Note: saving the file with any of the usual Emacs commands will actually convert it back to binary format while saving. You can use \[hexl-find-file] to visit a file in hexl-mode. \[describe-bindings] for advanced commands. (defalias 'hexl-mode #[(&optional arg) "=\n! !  !! \n ! !\"!$!!\" `S=uu S_\\ S !!+" [major-mode hexl-mode error "You are already in hexl mode." kill-all-local-variables make-local-variable hexl-mode-old-local-map current-local-map use-local-map hexl-mode-map hexl-mode-old-mode-name mode-name "Hexl" hexl-mode-old-major-mode write-contents-hooks add-hook hexl-save-buffer make-local-hook after-revert-hook hexl-after-revert-hook nil t hexl-max-address change-major-mode-hook hexl-maybe-dehexlify-buffer buffer-modified-p original-point inhibit-read-only modified arg 1 buffer-size 68 16 15 hexlify-buffer set-buffer-modified-p hexl-goto-address] 5 (#$ . 1463) "p"]) (defalias 'hexl-after-revert-hook #[nil " !" [hexlify-buffer set-buffer-modified-p nil] 2]) (byte-code "! B‡" [boundp hexl-in-save-buffer nil current-load-list] 2) #@66 Save a hexl format buffer as binary in visited file if modified. (defalias 'hexl-save-buffer #[nil "?c [! ed \n \f q\f\n #\fq Љ * ed| \n # !.`!!Ї" [hexl-in-save-buffer set-buffer-modified-p buffer-modified-p generate-new-buffer " hexl" buffer-name buffer-file-name nil modified end start file-name name buf insert-buffer-substring dehexlify-buffer t buffer-file-type save-buffer kill-buffer message "(No changes need to be saved)"] 8 (#$ . 5690) nil]) #@106 Edit file FILENAME in hexl-mode. Switch to a buffer visiting file FILENAME, creating one in none exists. (defalias 'hexl-find-file #[(filename) "=\f=\f!\f!=?! " [system-type ms-dos windows-nt find-file-binary filename find-file major-mode hexl-mode] 2 (#$ . 6210) "fFilename: "]) #@79 Exit Hexl mode, returning to previous mode. With arg, don't unhexlify buffer. (defalias 'hexl-mode-exit #[(&optional arg) "=\n& T \"! b+ ! " [arg 1 buffer-modified-p t hexl-current-address original-point inhibit-read-only modified dehexlify-buffer remove-hook write-contents-hook hexl-save-buffer set-buffer-modified-p hexl-mode-old-mode-name mode-name use-local-map hexl-mode-old-local-map hexl-mode-old-major-mode major-mode force-mode-line-update] 3 (#$ . 6519) "p"]) #@72 Convert a hexl format buffer to binary. Ask the user for confirmation. (defalias 'hexl-maybe-dehexlify-buffer #[nil "!! T \"! b+" [y-or-n-p "Convert contents back to binary format? " buffer-modified-p t hexl-current-address original-point inhibit-read-only modified dehexlify-buffer remove-hook write-contents-hook hexl-save-buffer set-buffer-modified-p] 3 (#$ . 7036)]) #@30 Return current hexl-address. (defalias 'hexl-current-address #[nil "`Z`_\fƥZǥ\\*" [68 11 0 hexl-address current-column 16 5 2] 5 (#$ . 7437) nil]) #@28 Return marker for ADDRESS. (defalias 'hexl-address-to-marker #[(address) "__ĥ\\\\" [address 16 68 5 2 11] 3 (#$ . 7605) "nAddress: "]) #@82 Goto hexl-mode (decimal) address ADDRESS. Signal error if ADDRESS out of range. (defalias 'hexl-goto-address #[(address) "W\f\nV!!b" [address 0 hexl-max-address error "Out of hexl region." hexl-address-to-marker] 2 (#$ . 7757) "nAddress: "]) #@97 Go to hexl-mode address (hex string) HEX-ADDRESS. Signal error if HEX-ADDRESS is out of range. (defalias 'hexl-goto-hex-address #[(hex-address) "\n!!" [hexl-goto-address hexl-hex-string-to-integer hex-address] 3 (#$ . 8020) "sHex Address: "]) #@40 Return decimal integer for HEX-STRING. (defalias 'hexl-hex-string-to-integer #[(hex-string) "\nÚ _\n!!\\\nO )" [0 hex-num hex-string "" 16 hexl-hex-char-to-integer string-to-char 1 nil] 5 (#$ . 8273) "sHex number: "]) #@42 Return decimal integer for OCTAL-STRING. (defalias 'hexl-octal-string-to-integer #[(octal-string) "\nÚ _\n!!\\\nO )" [0 oct-num octal-string "" 8 hexl-oct-char-to-integer string-to-char 1 nil] 5 (#$ . 8515) "sOctal number: "]) #@62 Move to left ARG bytes (right if ARG negative) in hexl-mode. (defalias 'hexl-backward-char #[(arg) " \nZ!" [hexl-goto-address hexl-current-address arg] 3 (#$ . 8766) "p"]) #@59 Move right ARG bytes (left if ARG negative) in hexl-mode. (defalias 'hexl-forward-char #[(arg) " \n\\!" [hexl-goto-address hexl-current-address arg] 3 (#$ . 8947) "p"]) #@63 Move to left ARG shorts (right if ARG negative) in hexl-mode. (defalias 'hexl-backward-short #[(arg) "  Wj [VQ\n\n\"5\nV-!J\n\"J\nVF!J\n\\ S\nVb!\n\" V\n\n\"\n\"\nĚ\nZ! Sk\n)!" [hexl-goto-address hexl-current-address address arg 0 logior 3 hexl-max-address message "End of buffer." 4 logand -4 "Beginning of buffer."] 6 (#$ . 9125) "p"]) #@60 Move right ARG shorts (left if ARG negative) in hexl-mode. (defalias 'hexl-forward-short #[(arg) " [!" [hexl-backward-short arg] 2 (#$ . 9573) "p"]) #@62 Move to left ARG words (right if ARG negative) in hexl-mode. (defalias 'hexl-backward-word #[(arg) "  Wj [VQ\n\n\"5\nV-!J\n\"J\nVF!J\n\\ S\nVb!\n\" V\n\n\"\n\"\nĚ\nZ! Sk\n)!" [hexl-goto-address hexl-current-address address arg 0 logior 7 hexl-max-address message "End of buffer." 8 logand -8 "Beginning of buffer."] 6 (#$ . 9730) "p"]) #@59 Move right ARG words (left if ARG negative) in hexl-mode. (defalias 'hexl-forward-word #[(arg) " [!" [hexl-backward-word arg] 2 (#$ . 10176) "p"]) #@153 Move vertically up ARG lines [16 bytes] (down if ARG negative) in hexl-mode. If there is byte at the target address move to the last byte in that line. (defalias 'hexl-previous-line #[(arg) " [!" [hexl-next-line arg] 2 (#$ . 10332) "p"]) #@156 Move vertically down ARG lines [16 bytes] (up if ARG negative) in hexl-mode. If there is no byte at the target address move to the last byte in that line. (defalias 'hexl-next-line #[(arg) " \n_\\\nW \fW ! æN\fV8æ\fæW8N\fVN!\" æ\\\f)!" [hexl-goto-address hexl-current-address arg 16 address 0 message "Out of hexl region." hexl-max-address logand -16] 4 (#$ . 10579) "p"]) #@158 Move to the beginning of the hexl buffer. Leaves `hexl-mark' at previous position. With prefix arg N, puts point N bytes of the way from the true beginning. (defalias 'hexl-beginning-of-buffer #[(arg) "`!\nS!" [push-mark hexl-goto-address arg] 2 (#$ . 11007) "p"]) #@37 Go to `hexl-max-address' minus ARG. (defalias 'hexl-end-of-buffer #[(arg) "`!\n SZ!" [push-mark hexl-goto-address hexl-max-address arg] 3 (#$ . 11282) "p"]) #@38 Goto beginning of line in hexl mode. (defalias 'hexl-beginning-of-line #[nil "`_\\b" [68 11] 2 (#$ . 11449) nil]) #@32 Goto end of line in hexl mode. (defalias 'hexl-end-of-line #[nil " \" V \f)!" [hexl-goto-address logior hexl-current-address 15 address hexl-max-address] 5 (#$ . 11574) nil]) #@76 Scroll hexl buffer window upward ARG lines; or near full window if no ARG. (defalias 'hexl-scroll-down #[(arg) " S![!" [arg window-height prefix-numeric-value hexl-scroll-up] 2 (#$ . 11766) "P"]) #@76 Scroll hexl buffer window upward ARG lines; or near full window if no ARG. (defalias 'hexl-scroll-up #[(arg) " S!_  \\V* \\W0!: \\!!*" [arg window-height prefix-numeric-value 16 hexl-current-address address movement hexl-max-address 0 message "Out of hexl region." hexl-goto-address recenter] 3 (#$ . 11983) "P"]) #@34 Goto to beginning of 1k boundry. (defalias 'hexl-beginning-of-1k-page #[nil " \"!" [hexl-goto-address logand hexl-current-address -1024] 4 (#$ . 12343) nil]) #@28 Goto to end of 1k boundry. (defalias 'hexl-end-of-1k-page #[nil " \" V \f)!" [hexl-goto-address logior hexl-current-address 1023 address hexl-max-address] 5 (#$ . 12512) nil]) #@40 Goto to beginning of 512 byte boundry. (defalias 'hexl-beginning-of-512b-page #[nil " \"!" [hexl-goto-address logand hexl-current-address -512] 4 (#$ . 12705) nil]) #@34 Goto to end of 512 byte boundry. (defalias 'hexl-end-of-512b-page #[nil " \" V \f)!" [hexl-goto-address logior hexl-current-address 511 address hexl-max-address] 5 (#$ . 12881) nil]) #@160 Read next input character and insert it. Useful for inserting control characters. You may also type up to 3 octal digits, to insert a character with that code (defalias 'hexl-quoted-insert #[(arg) " \n\"" [hexl-insert-char read-quoted-char arg] 3 (#$ . 13082) "p"]) #@41 Convert a binary buffer to hexl format. (defalias 'hexlify-buffer #[nil "ed $*" [nil t binary-process-input binary-process-output shell-command-on-region hexlify-command] 5 (#$ . 13357) nil]) #@41 Convert a hexl format buffer to binary. (defalias 'dehexlify-buffer #[nil "ed $*" [t nil binary-process-input binary-process-output shell-command-on-region dehexlify-command] 5 (#$ . 13562) nil]) #@44 Return char for ASCII hex digits at point. (defalias 'hexl-char-after-point #[nil "`f`Tf\"" [hexl-htoi] 3 (#$ . 13771)]) #@37 Hex (char) LH (char) RH to integer. (defalias 'hexl-htoi #[(lh rh) " !_ !\\" [hexl-hex-char-to-integer lh 16 rh] 3 (#$ . 13900)]) #@60 Take a char and return its value as if it was a hex digit. (defalias 'hexl-hex-char-to-integer #[(character) "YXZ\"Y' X' Z- \"!)" [character 48 57 logior 32 ch 97 102 87 error format "Invalid hex digit `%c'."] 5 (#$ . 14040)]) #@62 Take a char and return its value as if it was a octal digit. (defalias 'hexl-oct-char-to-integer #[(character) "YXZ\"!" [character 48 55 error format "Invalid octal digit `%c'."] 4 (#$ . 14304)]) #@47 Return a displayable string for character CH. (defalias 'hexl-printable-character #[(ch) "\n W Y Wǂ1 1 W, Y0ǂ1 \"" [format "%c" hexl-iso ch 32 127 160 46] 4 (#$ . 14524)]) #@24 Insert this character. (defalias 'hexl-self-insert-command #[(arg) " \n\"" [hexl-insert-char last-command-char arg] 3 (#$ . 14732) "p"]) #@38 Insert a character in a hexl buffer. (defalias 'hexl-insert-char #[(ch num) " \nV@!\"c ɥ_ ɦ\\\\b!!c =5 T !\nS)" [hexl-current-address address num 0 delete-char 2 format "%02x" ch 16 68 52 1 hexl-printable-character hexl-max-address hexl-goto-address] 4 (#$ . 14877)]) #@72 Insert a ASCII char ARG times at point for a given hexadecimal number. (defalias 'hexl-insert-hex-char #[(arg) "!!V W!  \")" [hexl-hex-string-to-integer read-string "Hex number: " num 255 0 error "Hex number out of range." hexl-insert-char arg] 4 (#$ . 15189) "p"]) #@68 Insert a ASCII char ARG times at point for a given decimal number. (defalias 'hexl-insert-decimal-char #[(arg) "!!V W!  \")" [string-to-int read-string "Decimal Number: " num 255 0 error "Decimal number out of range." hexl-insert-char arg] 4 (#$ . 15482) "p"]) #@66 Insert a ASCII char ARG times at point for a given octal number. (defalias 'hexl-insert-octal-char #[(arg) "!!V W!  \")" [hexl-octal-string-to-integer read-string "Octal Number: " num 255 0 error "Decimal number out of range." hexl-insert-char arg] 4 (#$ . 15770) "p"]) (byte-code " #############!!=i!#############.W.\"#.T.)###########@#A#B#CD#E#F#G#H#I#J#K#LM#N#O#PQ#R#S#T#UV#WX#Y#Z#[\\#]#^#_#`#a#b#c#d#e#f#g#h#i#j#kl#mn#op#qr#st#u#vw#x#" [hexl-mode-map make-sparse-keymap define-key [left] hexl-backward-char [right] hexl-forward-char [up] hexl-previous-line [down] hexl-next-line [M-left] hexl-backward-short [M-right] hexl-forward-short [next] hexl-scroll-up [prev] hexl-scroll-down "" hexl-beginning-of-line "" "" undefined "" hexl-end-of-line "" key-binding char-to-string help-char help-command " " hexl-self-insert-command "\n" " " " " "" "" "" "" hexl-quoted-insert "" "" "" "" 32 ch 127 format "%c" "" hexl-beginning-of-512b-page "" "" "" hexl-insert-decimal-char "" hexl-end-of-512b-page "" "" "" " " "\n" " " "\f" " " "" "" hexl-insert-octal-char "" "" "" "" "" "" "" "" hexl-insert-hex-char "" "a" "b" hexl-backward-word "c" "d" "e" "f" hexl-forward-word "g" hexl-goto-hex-address "h" "i" "j" hexl-goto-address "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "y" "z" "<" hexl-beginning-of-buffer ">" hexl-end-of-buffer "" hexl-mode-exit "[" hexl-beginning-of-1k-page "]" hexl-end-of-1k-page "" "" hexl-save-buffer ""] 6)