erp_app 3.0.10 → 3.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/erp_app/version.rb +1 -1
- data/public/javascripts/erp_app/codemirror/README.md +1 -1
- data/public/javascripts/erp_app/codemirror/doc/compress.html +11 -3
- data/public/javascripts/erp_app/codemirror/doc/docs.css +16 -5
- data/public/javascripts/erp_app/codemirror/doc/internals.html +6 -3
- data/public/javascripts/erp_app/codemirror/doc/manual.html +103 -41
- data/public/javascripts/erp_app/codemirror/doc/oldrelease.html +43 -5
- data/public/javascripts/erp_app/codemirror/doc/reporting.html +6 -3
- data/public/javascripts/erp_app/codemirror/doc/upgrade_v2.2.html +7 -4
- data/public/javascripts/erp_app/codemirror/keymap/vim.js +10 -6
- data/public/javascripts/erp_app/codemirror/lib/codemirror.css +16 -12
- data/public/javascripts/erp_app/codemirror/lib/codemirror.js +699 -787
- data/public/javascripts/erp_app/codemirror/lib/util/closetag.js +35 -35
- data/public/javascripts/erp_app/codemirror/lib/util/dialog.js +4 -1
- data/public/javascripts/erp_app/codemirror/lib/util/formatting.js +147 -253
- data/public/javascripts/erp_app/codemirror/lib/util/javascript-hint.js +3 -3
- data/public/javascripts/erp_app/codemirror/lib/util/loadmode.js +1 -1
- data/public/javascripts/erp_app/codemirror/lib/util/multiplex.js +5 -9
- data/public/javascripts/erp_app/codemirror/lib/util/overlay.js +3 -1
- data/public/javascripts/erp_app/codemirror/lib/util/pig-hint.js +1 -1
- data/public/javascripts/erp_app/codemirror/lib/util/runmode-standalone.js +90 -0
- data/public/javascripts/erp_app/codemirror/lib/util/runmode.js +8 -4
- data/public/javascripts/erp_app/codemirror/lib/util/search.js +4 -4
- data/public/javascripts/erp_app/codemirror/lib/util/searchcursor.js +13 -11
- data/public/javascripts/erp_app/codemirror/lib/util/simple-hint.js +89 -68
- data/public/javascripts/erp_app/codemirror/lib/util/xml-hint.js +8 -8
- data/public/javascripts/erp_app/codemirror/mode/clike/clike.js +6 -2
- data/public/javascripts/erp_app/codemirror/mode/clike/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/clike/scala.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/clojure/clojure.js +8 -9
- data/public/javascripts/erp_app/codemirror/mode/clojure/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/coffeescript/coffeescript.js +3 -3
- data/public/javascripts/erp_app/codemirror/mode/coffeescript/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/commonlisp/commonlisp.js +101 -0
- data/public/javascripts/erp_app/codemirror/mode/commonlisp/index.html +165 -0
- data/public/javascripts/erp_app/codemirror/mode/css/css.js +339 -15
- data/public/javascripts/erp_app/codemirror/mode/css/index.html +3 -0
- data/public/javascripts/erp_app/codemirror/mode/css/test.js +501 -0
- data/public/javascripts/erp_app/codemirror/mode/diff/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/ecl/ecl.js +1 -1
- data/public/javascripts/erp_app/codemirror/mode/erlang/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/gfm/gfm.js +10 -4
- data/public/javascripts/erp_app/codemirror/mode/gfm/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/go/go.js +2 -2
- data/public/javascripts/erp_app/codemirror/mode/go/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/groovy/groovy.js +1 -1
- data/public/javascripts/erp_app/codemirror/mode/groovy/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/haskell/haskell.js +2 -2
- data/public/javascripts/erp_app/codemirror/mode/haskell/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/haxe/haxe.js +4 -7
- data/public/javascripts/erp_app/codemirror/mode/haxe/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/htmlembedded/htmlembedded.js +8 -4
- data/public/javascripts/erp_app/codemirror/mode/htmlembedded/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/htmlmixed/htmlmixed.js +12 -13
- data/public/javascripts/erp_app/codemirror/mode/htmlmixed/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/javascript/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/javascript/javascript.js +3 -3
- data/public/javascripts/erp_app/codemirror/mode/jinja2/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/less/index.html +124 -2
- data/public/javascripts/erp_app/codemirror/mode/less/less.js +94 -60
- data/public/javascripts/erp_app/codemirror/mode/lua/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/markdown/index.html +3 -0
- data/public/javascripts/erp_app/codemirror/mode/markdown/markdown.js +134 -20
- data/public/javascripts/erp_app/codemirror/mode/markdown/test.js +1084 -0
- data/public/javascripts/erp_app/codemirror/mode/mysql/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/ntriples/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/ntriples/ntriples.js +4 -4
- data/public/javascripts/erp_app/codemirror/mode/ocaml/ocaml.js +1 -1
- data/public/javascripts/erp_app/codemirror/mode/pascal/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/pascal/pascal.js +1 -1
- data/public/javascripts/erp_app/codemirror/mode/perl/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/perl/perl.js +71 -71
- data/public/javascripts/erp_app/codemirror/mode/php/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/php/php.js +7 -9
- data/public/javascripts/erp_app/codemirror/mode/pig/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/pig/pig.js +3 -3
- data/public/javascripts/erp_app/codemirror/mode/plsql/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/properties/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/python/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/python/python.js +1 -1
- data/public/javascripts/erp_app/codemirror/mode/r/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/rpm/changes/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/rpm/spec/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/rst/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/ruby/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/rust/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/scheme/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/scheme/scheme.js +1 -1
- data/public/javascripts/erp_app/codemirror/mode/shell/shell.js +2 -2
- data/public/javascripts/erp_app/codemirror/mode/sieve/LICENSE +23 -0
- data/public/javascripts/erp_app/codemirror/mode/sieve/index.html +81 -0
- data/public/javascripts/erp_app/codemirror/mode/sieve/sieve.js +156 -0
- data/public/javascripts/erp_app/codemirror/mode/smalltalk/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/smalltalk/smalltalk.js +2 -2
- data/public/javascripts/erp_app/codemirror/mode/smarty/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/smarty/smarty.js +2 -2
- data/public/javascripts/erp_app/codemirror/mode/sparql/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/stex/index.html +3 -0
- data/public/javascripts/erp_app/codemirror/mode/stex/stex.js +1 -1
- data/public/javascripts/erp_app/codemirror/mode/stex/test.js +343 -0
- data/public/javascripts/erp_app/codemirror/mode/tiddlywiki/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/tiki/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/tiki/tiki.js +4 -11
- data/public/javascripts/erp_app/codemirror/mode/vb/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/vb/vb.js +2 -2
- data/public/javascripts/erp_app/codemirror/mode/vbscript/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/velocity/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/velocity/velocity.js +1 -1
- data/public/javascripts/erp_app/codemirror/mode/verilog/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/mode/verilog/verilog.js +1 -1
- data/public/javascripts/erp_app/codemirror/mode/xml/index.html +2 -1
- data/public/javascripts/erp_app/codemirror/mode/xml/xml.js +2 -10
- data/public/javascripts/erp_app/codemirror/mode/xquery/index.html +3 -2
- data/public/javascripts/erp_app/codemirror/mode/xquery/xquery.js +7 -4
- data/public/javascripts/erp_app/codemirror/mode/yaml/index.html +1 -0
- data/public/javascripts/erp_app/codemirror/package.json +15 -23
- data/public/javascripts/erp_app/codemirror/test/driver.js +109 -22
- data/public/javascripts/erp_app/codemirror/test/index.html +129 -16
- data/public/javascripts/erp_app/codemirror/test/lint/lint.js +120 -0
- data/public/javascripts/erp_app/codemirror/test/lint/parse-js.js +1372 -0
- data/public/javascripts/erp_app/codemirror/test/mode_test.css +0 -12
- data/public/javascripts/erp_app/codemirror/test/mode_test.js +66 -27
- data/public/javascripts/erp_app/codemirror/test/phantom_driver.js +30 -0
- data/public/javascripts/erp_app/codemirror/test/run.js +32 -0
- data/public/javascripts/erp_app/codemirror/test/test.js +213 -8
- data/public/javascripts/erp_app/shared/dynamic_editable_grid.js +33 -27
- data/public/javascripts/erp_app/shared/dynamic_editable_grid_loader_panel.js +2 -1
- metadata +15 -3
- data/public/javascripts/erp_app/codemirror/mode/stex/test.html +0 -263
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
CodeMirror.defineMode("commonlisp", function (config) {
|
|
2
|
+
var assumeBody = /^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/;
|
|
3
|
+
var numLiteral = /^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/;
|
|
4
|
+
var symbol = /[^\s'`,@()\[\]";]/;
|
|
5
|
+
var type;
|
|
6
|
+
|
|
7
|
+
function readSym(stream) {
|
|
8
|
+
var ch;
|
|
9
|
+
while (ch = stream.next()) {
|
|
10
|
+
if (ch == "\\") stream.next();
|
|
11
|
+
else if (!symbol.test(ch)) { stream.backUp(1); break; }
|
|
12
|
+
}
|
|
13
|
+
return stream.current();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function base(stream, state) {
|
|
17
|
+
if (stream.eatSpace()) {type = "ws"; return null;}
|
|
18
|
+
if (stream.match(numLiteral)) return "number";
|
|
19
|
+
var ch = stream.next();
|
|
20
|
+
if (ch == "\\") ch = stream.next();
|
|
21
|
+
|
|
22
|
+
if (ch == '"') return (state.tokenize = inString)(stream, state);
|
|
23
|
+
else if (ch == "(") { type = "open"; return "bracket"; }
|
|
24
|
+
else if (ch == ")" || ch == "]") { type = "close"; return "bracket"; }
|
|
25
|
+
else if (ch == ";") { stream.skipToEnd(); type = "ws"; return "comment"; }
|
|
26
|
+
else if (/['`,@]/.test(ch)) return null;
|
|
27
|
+
else if (ch == "|") {
|
|
28
|
+
if (stream.skipTo("|")) { stream.next(); return "symbol"; }
|
|
29
|
+
else { stream.skipToEnd(); return "error"; }
|
|
30
|
+
} else if (ch == "#") {
|
|
31
|
+
var ch = stream.next();
|
|
32
|
+
if (ch == "[") { type = "open"; return "bracket"; }
|
|
33
|
+
else if (/[+\-=\.']/.test(ch)) return null;
|
|
34
|
+
else if (/\d/.test(ch) && stream.match(/^\d*#/)) return null;
|
|
35
|
+
else if (ch == "|") return (state.tokenize = inComment)(stream, state);
|
|
36
|
+
else if (ch == ":") { readSym(stream); return "meta"; }
|
|
37
|
+
else return "error";
|
|
38
|
+
} else {
|
|
39
|
+
var name = readSym(stream);
|
|
40
|
+
if (name == ".") return null;
|
|
41
|
+
type = "symbol";
|
|
42
|
+
if (name == "nil" || name == "t") return "atom";
|
|
43
|
+
if (name.charAt(0) == ":") return "keyword";
|
|
44
|
+
if (name.charAt(0) == "&") return "variable-2";
|
|
45
|
+
return "variable";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function inString(stream, state) {
|
|
50
|
+
var escaped = false, next;
|
|
51
|
+
while (next = stream.next()) {
|
|
52
|
+
if (next == '"' && !escaped) { state.tokenize = base; break; }
|
|
53
|
+
escaped = !escaped && next == "\\";
|
|
54
|
+
}
|
|
55
|
+
return "string";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function inComment(stream, state) {
|
|
59
|
+
var next, last;
|
|
60
|
+
while (next = stream.next()) {
|
|
61
|
+
if (next == "#" && last == "|") { state.tokenize = base; break; }
|
|
62
|
+
last = next;
|
|
63
|
+
}
|
|
64
|
+
type = "ws";
|
|
65
|
+
return "comment";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
startState: function () {
|
|
70
|
+
return {ctx: {prev: null, start: 0, indentTo: 0}, tokenize: base};
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
token: function (stream, state) {
|
|
74
|
+
if (stream.sol() && typeof state.ctx.indentTo != "number")
|
|
75
|
+
state.ctx.indentTo = state.ctx.start + 1;
|
|
76
|
+
|
|
77
|
+
type = null;
|
|
78
|
+
var style = state.tokenize(stream, state);
|
|
79
|
+
if (type != "ws") {
|
|
80
|
+
if (state.ctx.indentTo == null) {
|
|
81
|
+
if (type == "symbol" && assumeBody.test(stream.current()))
|
|
82
|
+
state.ctx.indentTo = state.ctx.start + config.indentUnit;
|
|
83
|
+
else
|
|
84
|
+
state.ctx.indentTo = "next";
|
|
85
|
+
} else if (state.ctx.indentTo == "next") {
|
|
86
|
+
state.ctx.indentTo = stream.column();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (type == "open") state.ctx = {prev: state.ctx, start: stream.column(), indentTo: null};
|
|
90
|
+
else if (type == "close") state.ctx = state.ctx.prev || state.ctx;
|
|
91
|
+
return style;
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
indent: function (state, textAfter) {
|
|
95
|
+
var i = state.ctx.indentTo;
|
|
96
|
+
return typeof i == "number" ? i : state.ctx.start + 1;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
CodeMirror.defineMIME("text/x-common-lisp", "commonlisp");
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>CodeMirror: Common Lisp mode</title>
|
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
|
8
|
+
<script src="commonlisp.js"></script>
|
|
9
|
+
<style>.CodeMirror {background: #f8f8f8;}</style>
|
|
10
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<h1>CodeMirror: Common Lisp mode</h1>
|
|
14
|
+
<form><textarea id="code" name="code">(in-package :cl-postgres)
|
|
15
|
+
|
|
16
|
+
;; These are used to synthesize reader and writer names for integer
|
|
17
|
+
;; reading/writing functions when the amount of bytes and the
|
|
18
|
+
;; signedness is known. Both the macro that creates the functions and
|
|
19
|
+
;; some macros that use them create names this way.
|
|
20
|
+
(eval-when (:compile-toplevel :load-toplevel :execute)
|
|
21
|
+
(defun integer-reader-name (bytes signed)
|
|
22
|
+
(intern (with-standard-io-syntax
|
|
23
|
+
(format nil "~a~a~a~a" '#:read- (if signed "" '#:u) '#:int bytes))))
|
|
24
|
+
(defun integer-writer-name (bytes signed)
|
|
25
|
+
(intern (with-standard-io-syntax
|
|
26
|
+
(format nil "~a~a~a~a" '#:write- (if signed "" '#:u) '#:int bytes)))))
|
|
27
|
+
|
|
28
|
+
(defmacro integer-reader (bytes)
|
|
29
|
+
"Create a function to read integers from a binary stream."
|
|
30
|
+
(let ((bits (* bytes 8)))
|
|
31
|
+
(labels ((return-form (signed)
|
|
32
|
+
(if signed
|
|
33
|
+
`(if (logbitp ,(1- bits) result)
|
|
34
|
+
(dpb result (byte ,(1- bits) 0) -1)
|
|
35
|
+
result)
|
|
36
|
+
`result))
|
|
37
|
+
(generate-reader (signed)
|
|
38
|
+
`(defun ,(integer-reader-name bytes signed) (socket)
|
|
39
|
+
(declare (type stream socket)
|
|
40
|
+
#.*optimize*)
|
|
41
|
+
,(if (= bytes 1)
|
|
42
|
+
`(let ((result (the (unsigned-byte 8) (read-byte socket))))
|
|
43
|
+
(declare (type (unsigned-byte 8) result))
|
|
44
|
+
,(return-form signed))
|
|
45
|
+
`(let ((result 0))
|
|
46
|
+
(declare (type (unsigned-byte ,bits) result))
|
|
47
|
+
,@(loop :for byte :from (1- bytes) :downto 0
|
|
48
|
+
:collect `(setf (ldb (byte 8 ,(* 8 byte)) result)
|
|
49
|
+
(the (unsigned-byte 8) (read-byte socket))))
|
|
50
|
+
,(return-form signed))))))
|
|
51
|
+
`(progn
|
|
52
|
+
;; This causes weird errors on SBCL in some circumstances. Disabled for now.
|
|
53
|
+
;; (declaim (inline ,(integer-reader-name bytes t)
|
|
54
|
+
;; ,(integer-reader-name bytes nil)))
|
|
55
|
+
(declaim (ftype (function (t) (signed-byte ,bits))
|
|
56
|
+
,(integer-reader-name bytes t)))
|
|
57
|
+
,(generate-reader t)
|
|
58
|
+
(declaim (ftype (function (t) (unsigned-byte ,bits))
|
|
59
|
+
,(integer-reader-name bytes nil)))
|
|
60
|
+
,(generate-reader nil)))))
|
|
61
|
+
|
|
62
|
+
(defmacro integer-writer (bytes)
|
|
63
|
+
"Create a function to write integers to a binary stream."
|
|
64
|
+
(let ((bits (* 8 bytes)))
|
|
65
|
+
`(progn
|
|
66
|
+
(declaim (inline ,(integer-writer-name bytes t)
|
|
67
|
+
,(integer-writer-name bytes nil)))
|
|
68
|
+
(defun ,(integer-writer-name bytes nil) (socket value)
|
|
69
|
+
(declare (type stream socket)
|
|
70
|
+
(type (unsigned-byte ,bits) value)
|
|
71
|
+
#.*optimize*)
|
|
72
|
+
,@(if (= bytes 1)
|
|
73
|
+
`((write-byte value socket))
|
|
74
|
+
(loop :for byte :from (1- bytes) :downto 0
|
|
75
|
+
:collect `(write-byte (ldb (byte 8 ,(* byte 8)) value)
|
|
76
|
+
socket)))
|
|
77
|
+
(values))
|
|
78
|
+
(defun ,(integer-writer-name bytes t) (socket value)
|
|
79
|
+
(declare (type stream socket)
|
|
80
|
+
(type (signed-byte ,bits) value)
|
|
81
|
+
#.*optimize*)
|
|
82
|
+
,@(if (= bytes 1)
|
|
83
|
+
`((write-byte (ldb (byte 8 0) value) socket))
|
|
84
|
+
(loop :for byte :from (1- bytes) :downto 0
|
|
85
|
+
:collect `(write-byte (ldb (byte 8 ,(* byte 8)) value)
|
|
86
|
+
socket)))
|
|
87
|
+
(values)))))
|
|
88
|
+
|
|
89
|
+
;; All the instances of the above that we need.
|
|
90
|
+
|
|
91
|
+
(integer-reader 1)
|
|
92
|
+
(integer-reader 2)
|
|
93
|
+
(integer-reader 4)
|
|
94
|
+
(integer-reader 8)
|
|
95
|
+
|
|
96
|
+
(integer-writer 1)
|
|
97
|
+
(integer-writer 2)
|
|
98
|
+
(integer-writer 4)
|
|
99
|
+
|
|
100
|
+
(defun write-bytes (socket bytes)
|
|
101
|
+
"Write a byte-array to a stream."
|
|
102
|
+
(declare (type stream socket)
|
|
103
|
+
(type (simple-array (unsigned-byte 8)) bytes)
|
|
104
|
+
#.*optimize*)
|
|
105
|
+
(write-sequence bytes socket))
|
|
106
|
+
|
|
107
|
+
(defun write-str (socket string)
|
|
108
|
+
"Write a null-terminated string to a stream \(encoding it when UTF-8
|
|
109
|
+
support is enabled.)."
|
|
110
|
+
(declare (type stream socket)
|
|
111
|
+
(type string string)
|
|
112
|
+
#.*optimize*)
|
|
113
|
+
(enc-write-string string socket)
|
|
114
|
+
(write-uint1 socket 0))
|
|
115
|
+
|
|
116
|
+
(declaim (ftype (function (t unsigned-byte)
|
|
117
|
+
(simple-array (unsigned-byte 8) (*)))
|
|
118
|
+
read-bytes))
|
|
119
|
+
(defun read-bytes (socket length)
|
|
120
|
+
"Read a byte array of the given length from a stream."
|
|
121
|
+
(declare (type stream socket)
|
|
122
|
+
(type fixnum length)
|
|
123
|
+
#.*optimize*)
|
|
124
|
+
(let ((result (make-array length :element-type '(unsigned-byte 8))))
|
|
125
|
+
(read-sequence result socket)
|
|
126
|
+
result))
|
|
127
|
+
|
|
128
|
+
(declaim (ftype (function (t) string) read-str))
|
|
129
|
+
(defun read-str (socket)
|
|
130
|
+
"Read a null-terminated string from a stream. Takes care of encoding
|
|
131
|
+
when UTF-8 support is enabled."
|
|
132
|
+
(declare (type stream socket)
|
|
133
|
+
#.*optimize*)
|
|
134
|
+
(enc-read-string socket :null-terminated t))
|
|
135
|
+
|
|
136
|
+
(defun skip-bytes (socket length)
|
|
137
|
+
"Skip a given number of bytes in a binary stream."
|
|
138
|
+
(declare (type stream socket)
|
|
139
|
+
(type (unsigned-byte 32) length)
|
|
140
|
+
#.*optimize*)
|
|
141
|
+
(dotimes (i length)
|
|
142
|
+
(read-byte socket)))
|
|
143
|
+
|
|
144
|
+
(defun skip-str (socket)
|
|
145
|
+
"Skip a null-terminated string."
|
|
146
|
+
(declare (type stream socket)
|
|
147
|
+
#.*optimize*)
|
|
148
|
+
(loop :for char :of-type fixnum = (read-byte socket)
|
|
149
|
+
:until (zerop char)))
|
|
150
|
+
|
|
151
|
+
(defun ensure-socket-is-closed (socket &key abort)
|
|
152
|
+
(when (open-stream-p socket)
|
|
153
|
+
(handler-case
|
|
154
|
+
(close socket :abort abort)
|
|
155
|
+
(error (error)
|
|
156
|
+
(warn "Ignoring the error which happened while trying to close PostgreSQL socket: ~A" error)))))
|
|
157
|
+
</textarea></form>
|
|
158
|
+
<script>
|
|
159
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {lineNumbers: true});
|
|
160
|
+
</script>
|
|
161
|
+
|
|
162
|
+
<p><strong>MIME types defined:</strong> <code>text/x-common-lisp</code>.</p>
|
|
163
|
+
|
|
164
|
+
</body>
|
|
165
|
+
</html>
|