Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/commonli...
File: index.html
<!doctype html>
[0] Fix | Delete
[1] Fix | Delete
<title>CodeMirror: Common Lisp mode</title>
[2] Fix | Delete
<meta charset="utf-8"/>
[3] Fix | Delete
<link rel=stylesheet href="../../doc/docs.css">
[4] Fix | Delete
[5] Fix | Delete
<link rel="stylesheet" href="../../lib/codemirror.css">
[6] Fix | Delete
<script src="../../lib/codemirror.js"></script>
[7] Fix | Delete
<script src="commonlisp.js"></script>
[8] Fix | Delete
<style>.CodeMirror {background: #f8f8f8;}</style>
[9] Fix | Delete
<div id=nav>
[10] Fix | Delete
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
[11] Fix | Delete
[12] Fix | Delete
<ul>
[13] Fix | Delete
<li><a href="../../index.html">Home</a>
[14] Fix | Delete
<li><a href="../../doc/manual.html">Manual</a>
[15] Fix | Delete
<li><a href="https://github.com/codemirror/codemirror">Code</a>
[16] Fix | Delete
</ul>
[17] Fix | Delete
<ul>
[18] Fix | Delete
<li><a href="../index.html">Language modes</a>
[19] Fix | Delete
<li><a class=active href="#">Common Lisp</a>
[20] Fix | Delete
</ul>
[21] Fix | Delete
</div>
[22] Fix | Delete
[23] Fix | Delete
<article>
[24] Fix | Delete
<h2>Common Lisp mode</h2>
[25] Fix | Delete
<form><textarea id="code" name="code">(in-package :cl-postgres)
[26] Fix | Delete
[27] Fix | Delete
;; These are used to synthesize reader and writer names for integer
[28] Fix | Delete
;; reading/writing functions when the amount of bytes and the
[29] Fix | Delete
;; signedness is known. Both the macro that creates the functions and
[30] Fix | Delete
;; some macros that use them create names this way.
[31] Fix | Delete
(eval-when (:compile-toplevel :load-toplevel :execute)
[32] Fix | Delete
(defun integer-reader-name (bytes signed)
[33] Fix | Delete
(intern (with-standard-io-syntax
[34] Fix | Delete
(format nil "~a~a~a~a" '#:read- (if signed "" '#:u) '#:int bytes))))
[35] Fix | Delete
(defun integer-writer-name (bytes signed)
[36] Fix | Delete
(intern (with-standard-io-syntax
[37] Fix | Delete
(format nil "~a~a~a~a" '#:write- (if signed "" '#:u) '#:int bytes)))))
[38] Fix | Delete
[39] Fix | Delete
(defmacro integer-reader (bytes)
[40] Fix | Delete
"Create a function to read integers from a binary stream."
[41] Fix | Delete
(let ((bits (* bytes 8)))
[42] Fix | Delete
(labels ((return-form (signed)
[43] Fix | Delete
(if signed
[44] Fix | Delete
`(if (logbitp ,(1- bits) result)
[45] Fix | Delete
(dpb result (byte ,(1- bits) 0) -1)
[46] Fix | Delete
result)
[47] Fix | Delete
`result))
[48] Fix | Delete
(generate-reader (signed)
[49] Fix | Delete
`(defun ,(integer-reader-name bytes signed) (socket)
[50] Fix | Delete
(declare (type stream socket)
[51] Fix | Delete
#.*optimize*)
[52] Fix | Delete
,(if (= bytes 1)
[53] Fix | Delete
`(let ((result (the (unsigned-byte 8) (read-byte socket))))
[54] Fix | Delete
(declare (type (unsigned-byte 8) result))
[55] Fix | Delete
,(return-form signed))
[56] Fix | Delete
`(let ((result 0))
[57] Fix | Delete
(declare (type (unsigned-byte ,bits) result))
[58] Fix | Delete
,@(loop :for byte :from (1- bytes) :downto 0
[59] Fix | Delete
:collect `(setf (ldb (byte 8 ,(* 8 byte)) result)
[60] Fix | Delete
(the (unsigned-byte 8) (read-byte socket))))
[61] Fix | Delete
,(return-form signed))))))
[62] Fix | Delete
`(progn
[63] Fix | Delete
;; This causes weird errors on SBCL in some circumstances. Disabled for now.
[64] Fix | Delete
;; (declaim (inline ,(integer-reader-name bytes t)
[65] Fix | Delete
;; ,(integer-reader-name bytes nil)))
[66] Fix | Delete
(declaim (ftype (function (t) (signed-byte ,bits))
[67] Fix | Delete
,(integer-reader-name bytes t)))
[68] Fix | Delete
,(generate-reader t)
[69] Fix | Delete
(declaim (ftype (function (t) (unsigned-byte ,bits))
[70] Fix | Delete
,(integer-reader-name bytes nil)))
[71] Fix | Delete
,(generate-reader nil)))))
[72] Fix | Delete
[73] Fix | Delete
(defmacro integer-writer (bytes)
[74] Fix | Delete
"Create a function to write integers to a binary stream."
[75] Fix | Delete
(let ((bits (* 8 bytes)))
[76] Fix | Delete
`(progn
[77] Fix | Delete
(declaim (inline ,(integer-writer-name bytes t)
[78] Fix | Delete
,(integer-writer-name bytes nil)))
[79] Fix | Delete
(defun ,(integer-writer-name bytes nil) (socket value)
[80] Fix | Delete
(declare (type stream socket)
[81] Fix | Delete
(type (unsigned-byte ,bits) value)
[82] Fix | Delete
#.*optimize*)
[83] Fix | Delete
,@(if (= bytes 1)
[84] Fix | Delete
`((write-byte value socket))
[85] Fix | Delete
(loop :for byte :from (1- bytes) :downto 0
[86] Fix | Delete
:collect `(write-byte (ldb (byte 8 ,(* byte 8)) value)
[87] Fix | Delete
socket)))
[88] Fix | Delete
(values))
[89] Fix | Delete
(defun ,(integer-writer-name bytes t) (socket value)
[90] Fix | Delete
(declare (type stream socket)
[91] Fix | Delete
(type (signed-byte ,bits) value)
[92] Fix | Delete
#.*optimize*)
[93] Fix | Delete
,@(if (= bytes 1)
[94] Fix | Delete
`((write-byte (ldb (byte 8 0) value) socket))
[95] Fix | Delete
(loop :for byte :from (1- bytes) :downto 0
[96] Fix | Delete
:collect `(write-byte (ldb (byte 8 ,(* byte 8)) value)
[97] Fix | Delete
socket)))
[98] Fix | Delete
(values)))))
[99] Fix | Delete
[100] Fix | Delete
;; All the instances of the above that we need.
[101] Fix | Delete
[102] Fix | Delete
(integer-reader 1)
[103] Fix | Delete
(integer-reader 2)
[104] Fix | Delete
(integer-reader 4)
[105] Fix | Delete
(integer-reader 8)
[106] Fix | Delete
[107] Fix | Delete
(integer-writer 1)
[108] Fix | Delete
(integer-writer 2)
[109] Fix | Delete
(integer-writer 4)
[110] Fix | Delete
[111] Fix | Delete
(defun write-bytes (socket bytes)
[112] Fix | Delete
"Write a byte-array to a stream."
[113] Fix | Delete
(declare (type stream socket)
[114] Fix | Delete
(type (simple-array (unsigned-byte 8)) bytes)
[115] Fix | Delete
#.*optimize*)
[116] Fix | Delete
(write-sequence bytes socket))
[117] Fix | Delete
[118] Fix | Delete
(defun write-str (socket string)
[119] Fix | Delete
"Write a null-terminated string to a stream \(encoding it when UTF-8
[120] Fix | Delete
support is enabled.)."
[121] Fix | Delete
(declare (type stream socket)
[122] Fix | Delete
(type string string)
[123] Fix | Delete
#.*optimize*)
[124] Fix | Delete
(enc-write-string string socket)
[125] Fix | Delete
(write-uint1 socket 0))
[126] Fix | Delete
[127] Fix | Delete
(declaim (ftype (function (t unsigned-byte)
[128] Fix | Delete
(simple-array (unsigned-byte 8) (*)))
[129] Fix | Delete
read-bytes))
[130] Fix | Delete
(defun read-bytes (socket length)
[131] Fix | Delete
"Read a byte array of the given length from a stream."
[132] Fix | Delete
(declare (type stream socket)
[133] Fix | Delete
(type fixnum length)
[134] Fix | Delete
#.*optimize*)
[135] Fix | Delete
(let ((result (make-array length :element-type '(unsigned-byte 8))))
[136] Fix | Delete
(read-sequence result socket)
[137] Fix | Delete
result))
[138] Fix | Delete
[139] Fix | Delete
(declaim (ftype (function (t) string) read-str))
[140] Fix | Delete
(defun read-str (socket)
[141] Fix | Delete
"Read a null-terminated string from a stream. Takes care of encoding
[142] Fix | Delete
when UTF-8 support is enabled."
[143] Fix | Delete
(declare (type stream socket)
[144] Fix | Delete
#.*optimize*)
[145] Fix | Delete
(enc-read-string socket :null-terminated t))
[146] Fix | Delete
[147] Fix | Delete
(defun skip-bytes (socket length)
[148] Fix | Delete
"Skip a given number of bytes in a binary stream."
[149] Fix | Delete
(declare (type stream socket)
[150] Fix | Delete
(type (unsigned-byte 32) length)
[151] Fix | Delete
#.*optimize*)
[152] Fix | Delete
(dotimes (i length)
[153] Fix | Delete
(read-byte socket)))
[154] Fix | Delete
[155] Fix | Delete
(defun skip-str (socket)
[156] Fix | Delete
"Skip a null-terminated string."
[157] Fix | Delete
(declare (type stream socket)
[158] Fix | Delete
#.*optimize*)
[159] Fix | Delete
(loop :for char :of-type fixnum = (read-byte socket)
[160] Fix | Delete
:until (zerop char)))
[161] Fix | Delete
[162] Fix | Delete
(defun ensure-socket-is-closed (socket &amp;key abort)
[163] Fix | Delete
(when (open-stream-p socket)
[164] Fix | Delete
(handler-case
[165] Fix | Delete
(close socket :abort abort)
[166] Fix | Delete
(error (error)
[167] Fix | Delete
(warn "Ignoring the error which happened while trying to close PostgreSQL socket: ~A" error)))))
[168] Fix | Delete
</textarea></form>
[169] Fix | Delete
<script>
[170] Fix | Delete
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {lineNumbers: true});
[171] Fix | Delete
</script>
[172] Fix | Delete
[173] Fix | Delete
<p><strong>MIME types defined:</strong> <code>text/x-common-lisp</code>.</p>
[174] Fix | Delete
[175] Fix | Delete
</article>
[176] Fix | Delete
[177] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function