This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun get-input-from-client (client) | |
(let* ((stream (usocket:socket-stream (socket client))) | |
(collected-bytes (loop with b | |
do (setf b (read-byte stream)) | |
until (= b (char-code #\Newline)) | |
unless (not (standard-char-p (code-char b))) | |
collect (code-char b)))) | |
(coerce collected-bytes 'string))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defclass client () | |
((server :accessor client-server :initarg :server) | |
(thread :accessor client-thread) | |
(listener-thread :accessor client-listener-thread) | |
(socket :reader client-socket :initarg :socket :type usocket) | |
(event-queue :reader client-event-queue :initform (make-empty-queue) | |
:type queue) | |
(ip-addr :reader client-ip-addr :initarg :ip-addr :type string) | |
(exit-requested-p :accessor client-exit-requested-p :initform nil))) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun preparse-adverbs (token-list) ;This is the worst way to handle this shit. Ever. Temporary. Very. | |
"Yoinks all the adverbs it recognizes out of a list. | |
MULTIPLE RETURN VALUES: The first adv it finds, and a token-list purified of this evil." | |
(if (> (length token-list) 1) | |
(let ((adverb (find-if #'adverb-p token-list))) | |
(if adverb | |
(let ((token-list (remove-if #'adverb-p token-list :count 1))) | |
(values adverb token-list)) | |
(values adverb token-list))) | |
(values nil token-list))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SYKOSOMATIC> (setf *test-hash* (make-hash-table)) | |
#<HASH-TABLE :TEST EQL :COUNT 0 {AB4EF51}> | |
SYKOSOMATIC> (setf (gethash "testing" *test-hash*) "testing") | |
"testing" | |
SYKOSOMATIC> *test-hash* | |
#<HASH-TABLE :TEST EQL :COUNT 1 {AB4EF51}> | |
SYKOSOMATIC> (gethash (string-downcase "TESTING") *test-hash*) | |
NIL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rooms> | |
<room> | |
<name> Room 1 </name> | |
<desc> room 1's desc </desc> | |
<desc-long> room 1's long description </desc-long> | |
<features> | |
<feature> | |
<name> room 1's feature </name> | |
<desc> ... </desc> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun slate-dispatch (selector &rest args) | |
(let ((n (length args)) | |
(most-specific-method nil) | |
(ordering-stack nil)) | |
(loop for index upto n | |
do (let ((position 0)) | |
(push (elt args index) ordering-stack) | |
(loop while ordering-stack | |
do (let ((arg (pop ordering-stack))) | |
(loop for role in (roles arg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;dispatch(selector, args, n) | |
; for each index below n | |
; position := 0 | |
; push args[index] on ordering stack | |
; while ordering stack is not empty | |
; arg := pop ordering stack | |
; for each role on arg with selector and index | |
; rank[role's method][index] := position | |
; if rank[role's method] is fully specified | |
; if no most specific method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq current-cl-package "COMMON-LISP-USER") | |
(defun erc-cmd-CLPACKAGE (&optional package &rest ignore) | |
(when package | |
(setq current-cl-package (upcase package))) | |
(erc-send-message (format "CL Package is: %s" current-cl-package))) | |
(defun erc-cmd-EVAL (&rest form) | |
"Eval FORM and send the result and the original form as: | |
FORM => (eval FORM)." | |
(let* ((form-string (mapconcat 'identity form " ")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defbuzzword create-texture (texture)) | |
(defbuzzword bind-texture (texture)) | |
(defbuzzword delete-texture (texture)) | |
(defbuzzword reload-texture (texture)) | |
(defsheep =texture= () | |
((name nil) | |
(target :texture-2d))) | |
(defmessage bind-texture ((texture =texture=)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHEEPLE> (sb-sprof:with-profiling (:report :flat :max-samples 500) | |
(dotimes (i 2000) (clone () ()))) | |
Profiler sample vector full (155 traces / 5000 samples), doubling the size | |
Profiler sample vector full (309 traces / 10000 samples), doubling the size | |
Number of samples: 500 | |
Sample interval: 0.01 seconds | |
Total sampling time: 5.0 seconds | |
Number of cycles: 0 | |
Sampled threads: |
OlderNewer