projects
/
rrq
/
lsp-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ignore too small data snippets.
[rrq/lsp-utils.git]
/
lsp-misc
/
misc.lsp
diff --git
a/lsp-misc/misc.lsp
b/lsp-misc/misc.lsp
index 5b7248401680c2fd977e411e219463dd445c2c0a..9e77db93efe06db5c81e050265abcc7f3dd561b7 100644
(file)
--- a/
lsp-misc/misc.lsp
+++ b/
lsp-misc/misc.lsp
@@
-6,17
+6,24
@@
(and N (exit N)))
(global 'die)
(and N (exit N)))
(global 'die)
+(define (char2hex STR)
+ (join (map (curry format "%2x") (map char (explode STR)))))
+(global 'char2hex)
+
;; Print binary byte as octal or as ASCII character [32-126]
(define (octal-byte x)
(if (and (> x 31) (< x 127)) (char x) (format "\\%o" x)))
;; Print binary byte as octal or as ASCII character [32-126]
(define (octal-byte x)
(if (and (> x 31) (< x 127)) (char x) (format "\\%o" x)))
+(global 'octal-byte)
;; Print string as binary octals
(define (octals-string S)
(join (map octal-byte (unpack (dup "b" (length S)) S))))
;; Print string as binary octals
(define (octals-string S)
(join (map octal-byte (unpack (dup "b" (length S)) S))))
+(global 'octals-string)
;; Return byte code as printable or as code.
(define (human-byte B)
(if (and (> B 32) (< B 127)) (char B) B))
;; Return byte code as printable or as code.
(define (human-byte B)
(if (and (> B 32) (< B 127)) (char B) B))
+(global 'human-byte)
;; Return a packed encoding of a list of bytes, joining string elements
(define (human-bytes BL)
;; Return a packed encoding of a list of bytes, joining string elements
(define (human-bytes BL)
@@
-28,5
+35,6
@@
(setf X nil))))
(when (string? X) (push X OUT -1))
OUT))
(setf X nil))))
(when (string? X) (push X OUT -1))
OUT))
-
-(global 'octals-string 'octal-byte 'human-byte 'human-bytes)
+(global 'human-bytes)
+
+"misc.lsp"