id
int64 0
45.1k
| file_name
stringlengths 4
68
| file_path
stringlengths 14
193
| content
stringlengths 32
9.62M
| size
int64 32
9.62M
| language
stringclasses 1
value | extension
stringclasses 6
values | total_lines
int64 1
136k
| avg_line_length
float64 3
903k
| max_line_length
int64 3
4.51M
| alphanum_fraction
float64 0
1
| repo_name
stringclasses 779
values | repo_stars
int64 0
882
| repo_forks
int64 0
108
| repo_open_issues
int64 0
90
| repo_license
stringclasses 8
values | repo_extraction_date
stringclasses 146
values | sha
stringlengths 64
64
| __index_level_0__
int64 0
45.1k
| exdup_ids_cmlisp_stkv2
sequencelengths 1
47
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,835 | auto-notify.lisp | Ramarren_lisa/misc/auto-notify.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young ([email protected])
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: auto-notify.lisp
;;; Description: Small test code for LISA's auto-notify feature.
;;; $Id: auto-notify.lisp,v 1.4 2002/12/04 15:05:41 youngde Exp $
(in-package "LISA-USER")
(defclass frodo ()
((name :initarg :name
:initform 'frodo
:reader frodo-name)
(has-ring :initform nil
:accessor has-ring))
(:metaclass standard-kb-class))
(defrule frodo ()
(frodo (has-ring t))
=>
(format t "Frodo has the Ring!~%"))
(defparameter *frodo* (make-instance 'frodo))
(reset)
(assert (#?*frodo*))
| 1,440 | Common Lisp | .lisp | 32 | 42.25 | 79 | 0.717765 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 35a0b17c9f3aaafb53d008ade4ab376a9730718d4b485c70de2b11b5ca352117 | 9,835 | [
-1
] |
9,836 | rpc-server.lisp | Ramarren_lisa/misc/rpc-server.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young ([email protected])
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: rpc-server.lisp
;;; Description: A sample implementation of an RPC server capable of reasoning
;;; over remote objects.
;;; $Id: rpc-server.lisp,v 1.3 2002/12/12 20:59:18 youngde Exp $
(in-package "RPC")
(defvar *lisa-server-host* "localhost")
(defvar *lisa-server-port* 10000)
(defvar *server-proc* nil)
(defun assert-object (object)
(let ((*package* (find-package "RPC")))
(format t "package is ~S~%" *package*)
(format t "object is ~S~%" object)
(format t "class of object is ~S~%" (class-of object))
(format t "class name of object is ~S~%" (class-name (class-of object)))
(assert-instance object)
object))
(defun initialize-client-environment (port)
(format t "Initialising client environment~%")
(import-remote-class port 'remote-instance "frodo"))
(defun make-server ()
(make-rpc-server
'rpc-socket-server
:name "LISA RPC Server"
:local-port *lisa-server-port*
:open :listener
:connect-action :call
:connect-function
#'(lambda (port &rest args)
(initialize-client-environment port)
(values))))
(defun start-server ()
(when (null *server-proc*)
(setf *server-proc* (make-server)))
*server-proc*)
(defun stop-server ()
(unless (null *server-proc*)
(rpc-close :stop :final)
(setf *server-proc* nil)))
(defrule remote-frodo ()
(?frodo (frodo (has-ring :no)))
=>
(modify ?frodo (has-ring t) (companions '(samwise gandalf))))
| 2,335 | Common Lisp | .lisp | 56 | 38.821429 | 79 | 0.708168 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | c2f9a83b051db5715239a73fc9ac71e7f22ab1a1189c2da9a7d5bac29f4d4a2e | 9,836 | [
-1
] |
9,837 | mab.lisp | Ramarren_lisa/misc/mab.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young ([email protected])
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: mab.lisp
;;; Description: The "Monkey And Bananas" sample implementation, a common AI
;;; planning problem. The monkey's objective is to find and eat some bananas.
;;; $Id: mab.lisp,v 1.53 2002/11/07 20:04:22 youngde Exp $
(eval-when (:compile-toplevel :load-toplevel :execute)
(when (not (find-package "LISA-MAB"))
(defpackage "LISA-MAB"
(:use "LISA-LISP"))))
(in-package "LISA-MAB")
(make-inference-engine)
(deftemplate monkey ()
(slot location)
(slot on-top-of)
(slot holding))
(deftemplate thing ()
(slot name)
(slot location)
(slot on-top-of)
(slot weight))
(deftemplate chest ()
(slot name)
(slot contents)
(slot unlocked-by))
(deftemplate goal-is-to ()
(slot action)
(slot argument-1)
(slot argument-2))
;;;(watch :activations)
;;;(watch :facts)
;;;(watch :rules)
;;; Chest-unlocking rules...
(defrule hold-chest-to-put-on-floor ()
(goal-is-to (action unlock) (argument-1 ?chest))
(thing (name ?chest) (on-top-of (not floor)) (weight light))
(monkey (holding (not ?chest)))
(not (goal-is-to (action hold) (argument-1 ?chest)))
=>
(assert (goal-is-to (action hold) (argument-1 ?chest)
(argument-2 empty))))
(defrule put-chest-on-floor ()
(goal-is-to (action unlock) (argument-1 ?chest))
(?monkey (monkey (location ?place) (on-top-of ?on) (holding ?chest)))
(?thing (thing (name ?chest)))
=>
(format t "Monkey throws the ~A off the ~A onto the floor.~%" ?chest ?on)
(modify ?monkey (holding blank))
(modify ?thing (location ?place) (on-top-of floor)))
(defrule get-key-to-unlock ()
(goal-is-to (action unlock) (argument-1 ?obj))
(thing (name ?obj) (on-top-of floor))
(chest (name ?obj) (unlocked-by ?key))
(monkey (holding (not ?key)))
(not (goal-is-to (action hold) (argument-1 ?key)))
=>
(assert (goal-is-to (action hold) (argument-1 ?key)
(argument-2 empty))))
(defrule move-to-chest-with-key ()
(goal-is-to (action unlock) (argument-1 ?chest))
(thing (name ?chest) (location ?cplace) (on-top-of floor))
(monkey (location (not ?cplace)) (holding ?key))
(chest (name ?chest) (unlocked-by ?key))
(not (goal-is-to (action walk-to) (argument-1 ?cplace)))
=>
(assert (goal-is-to (action walk-to) (argument-1 ?cplace)
(argument-2 empty))))
(defrule unlock-chest-with-key ()
(?goal (goal-is-to (action unlock) (argument-1 ?name)))
(?chest (chest (name ?name) (contents ?contents) (unlocked-by ?key)))
(thing (name ?name) (location ?place) (on-top-of ?on))
(monkey (location ?place) (on-top-of ?on) (holding ?key))
=>
(format t "Monkey opens the ~A with the ~A revealing the ~A.~%"
?name ?key ?contents)
(modify ?chest (contents nothing))
(assert (thing (name ?contents) (location ?place)
(weight light) (on-top-of ?name)))
(retract ?goal))
;;; Hold-object rules...
(defrule unlock-chest-to-hold-object ()
(goal-is-to (action hold) (argument-1 ?obj))
(chest (name ?chest) (contents ?obj))
(not (goal-is-to (action unlock) (argument-1 ?chest)))
=>
(assert (goal-is-to (action unlock) (argument-1 ?chest)
(argument-2 empty))))
(defrule use-ladder-to-hold ()
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ceiling) (weight light))
(not (thing (name ladder) (location ?place)))
(not (goal-is-to (action move) (argument-1 ladder) (argument-2 ?place)))
=>
(assert (goal-is-to (action move) (argument-1 ladder) (argument-2 ?place))))
(defrule climb-ladder-to-hold ()
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ceiling) (weight light))
(thing (name ladder) (location ?place) (on-top-of floor))
(monkey (on-top-of (not ladder)))
(not (goal-is-to (action on) (argument-1 ladder)))
=>
(assert (goal-is-to (action on) (argument-1 ladder)
(argument-2 empty))))
(defrule grab-object-from-ladder ()
(?goal (goal-is-to (action hold) (argument-1 ?name)))
(?thing (thing (name ?name) (location ?place)
(on-top-of ceiling) (weight light)))
(thing (name ladder) (location ?place))
(?monkey (monkey (location ?place) (on-top-of ladder) (holding blank)))
=>
(format t "Monkey grabs the ~A.~%" ?name)
(modify ?thing (location held) (on-top-of held))
(modify ?monkey (holding ?name))
(retract ?goal))
(defrule climb-to-hold ()
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place (not ceiling))
(on-top-of ?on) (weight light))
(monkey (location ?place) (on-top-of (not ?on)))
(not (goal-is-to (action on) (argument-1 ?on)))
=>
(assert (goal-is-to (action on) (argument-1 ?on)
(argument-2 empty))))
(defrule walk-to-hold ()
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of (not ceiling))
(weight light))
(monkey (location (not ?place)))
(not (goal-is-to (action walk-to) (argument-1 ?place)))
=>
(assert (goal-is-to (action walk-to) (argument-1 ?place)
(argument-2 empty))))
(defrule drop-to-hold ()
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ?on) (weight light))
(monkey (location ?place) (on-top-of ?on) (holding (not blank)))
(not (goal-is-to (action hold) (argument-1 blank)))
=>
(assert (goal-is-to (action hold) (argument-1 blank)
(argument-2 empty))))
(defrule grab-object ()
(?goal (goal-is-to (action hold) (argument-1 ?name)))
(?thing (thing (name ?name) (location ?place)
(on-top-of ?on) (weight light)))
(?monkey (monkey (location ?place) (on-top-of ?on) (holding blank)))
=>
(format t "Monkey grabs the ~A.~%" ?name)
(modify ?thing (location held) (on-top-of held))
(modify ?monkey (holding ?name))
(retract ?goal))
(defrule drop-object ()
(?goal (goal-is-to (action hold) (argument-1 blank)))
(?monkey (monkey (location ?place) (on-top-of ?on)
(holding ?name (not blank))))
(?thing (thing (name ?name)))
=>
(format t "Monkey drops the ~A.~%" ?name)
(modify ?monkey (holding blank))
(modify ?thing (location ?place) (on-top-of ?on))
(retract ?goal))
;;; Move-object rules...
(defrule unlock-chest-to-move-object ()
(goal-is-to (action move) (argument-1 ?obj))
(chest (name ?chest) (contents ?obj))
(not (goal-is-to (action unlock) (argument-1 ?chest)))
=>
(assert (goal-is-to (action unlock) (argument-1 ?chest)
(argument-2 empty))))
(defrule hold-object-to-move ()
(goal-is-to (action move) (argument-1 ?obj) (argument-2 ?place))
(thing (name ?obj) (location (not ?place)) (weight light))
(monkey (holding (not ?obj)))
(not (goal-is-to (action hold) (argument-1 ?obj)))
=>
(assert (goal-is-to (action hold) (argument-1 ?obj)
(argument-2 empty))))
(defrule move-object-to-place ()
(goal-is-to (action move) (argument-1 ?obj) (argument-2 ?place))
(monkey (location (not ?place)) (holding ?obj))
(not (goal-is-to (action walk-to) (argument-1 ?place)))
=>
(assert (goal-is-to (action walk-to) (argument-1 ?place)
(argument-2 empty))))
(defrule drop-object-once-moved ()
(?goal (goal-is-to (action move) (argument-1 ?name) (argument-2 ?place)))
(?monkey (monkey (location ?place) (holding ?obj)))
(?thing (thing (name ?name) (weight light)))
=>
(format t "Monkey drops the ~A.~%" ?name)
(modify ?monkey (holding blank))
(modify ?thing (location ?place) (on-top-of floor))
(retract ?goal))
(defrule already-moved-object ()
(?goal (goal-is-to (action move) (argument-1 ?obj) (argument-2 ?place)))
(thing (name ?obj) (location ?place))
=>
(retract ?goal))
;;; Walk-to-place rules...
(defrule already-at-place ()
(?goal (goal-is-to (action walk-to) (argument-1 ?place)))
(monkey (location ?place))
=>
(retract ?goal))
(defrule get-on-floor-to-walk ()
(goal-is-to (action walk-to) (argument-1 ?place))
(monkey (location (not ?place)) (on-top-of (not floor)))
(not (goal-is-to (action on) (argument-1 floor)))
=>
(assert (goal-is-to (action on) (argument-1 floor)
(argument-2 empty))))
(defrule walk-holding-nothing ()
(?goal (goal-is-to (action walk-to) (argument-1 ?place)))
(?monkey (monkey (location (not ?place)) (on-top-of floor) (holding blank)))
=>
(format t "Monkey walks to ~A.~%" ?place)
(modify ?monkey (location ?place))
(retract ?goal))
(defrule walk-holding-object ()
(?goal (goal-is-to (action walk-to) (argument-1 ?place)))
(?monkey (monkey (location (not ?place)) (on-top-of floor) (holding ?obj)))
(thing (name ?obj))
=>
(format t "Monkey walks to ~A holding the ~A.~%" ?place ?obj)
(modify ?monkey (location ?place))
(retract ?goal))
;;; Get-on-object rules...
(defrule jump-onto-floor ()
(?goal (goal-is-to (action on) (argument-1 floor)))
(?monkey (monkey (on-top-of ?on (not floor))))
=>
(format t "Monkey jumps off the ~A onto the floor.~%" ?on)
(modify ?monkey (on-top-of floor))
(retract ?goal))
(defrule walk-to-place-to-climb ()
(goal-is-to (action on) (argument-1 ?obj))
(thing (name ?obj) (location ?place))
(monkey (location (not ?place)))
(not (goal-is-to (action walk-to) (argument-1 ?place)))
=>
(assert (goal-is-to (action walk-to) (argument-1 ?place)
(argument-2 empty))))
(defrule drop-to-climb ()
(goal-is-to (action on) (argument-1 ?obj))
(thing (name ?obj) (location ?place))
(monkey (location ?place) (holding (not blank)))
(not (goal-is-to (action hold) (argument-1 blank)))
=>
(assert (goal-is-to (action hold) (argument-1 blank)
(argument-2 empty))))
(defrule climb-indirectly ()
(goal-is-to (action on) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ?on))
(monkey (location ?place) (on-top-of ?top
(and (not (eq ?top ?on))
(not (eq ?top ?obj))))
(holding blank))
(not (goal-is-to (action on) (argument-1 ?on)))
=>
(assert (goal-is-to (action on) (argument-1 ?on)
(argument-2 empty))))
(defrule climb-directly ()
(?goal (goal-is-to (action on) (argument-1 ?obj)))
(thing (name ?obj) (location ?place) (on-top-of ?on))
(?monkey (monkey (location ?place) (on-top-of ?on) (holding blank)))
=>
(format t "Monkey climbs onto the ~A.~%" ?obj)
(modify ?monkey (on-top-of ?obj))
(retract ?goal))
(defrule already-on-object ()
(?goal (goal-is-to (action on) (argument-1 ?obj)))
(monkey (on-top-of ?obj))
=>
(retract ?goal))
;;; Eat-object rules...
(defrule hold-to-eat ()
(goal-is-to (action eat) (argument-1 ?obj))
(monkey (holding (not ?obj)))
(not (goal-is-to (action hold) (argument-1 ?obj)))
=>
(assert (goal-is-to (action hold) (argument-1 ?obj)
(argument-2 empty))))
#+ignore
(defrule satisfy-hunger ()
(?goal (goal-is-to (action eat) (argument-1 ?name)))
(?monkey (monkey (holding ?name)))
(?thing (thing (name ?name)))
=>
(format t "Monkey eats the ~A.~%" ?name)
(modify ?monkey (holding blank))
(retract ?goal)
(retract ?thing))
(defrule satisfy-hunger ()
(?goal (goal-is-to (action eat) (argument-1 ?name)))
(?monkey (monkey (holding ?name)))
(?thing (thing (name ?thing-name)))
(test (eql ?name ?thing-name))
=>
(format t "Monkey eats the ~A.~%" ?name)
(modify ?monkey (holding blank))
(retract ?goal)
(retract ?thing))
;;; startup rule...
#+ignore
(defrule startup ()
=>
(assert (monkey (location t5-7) (on-top-of green-couch)
(location green-couch) (holding blank)))
(assert (thing (name green-couch) (location t5-7) (weight heavy)
(on-top-of floor)))
(assert (thing (name red-couch) (location t2-2)
(on-top-of floor) (weight heavy)))
(assert (thing (name big-pillow) (location t2-2)
(weight light) (on-top-of red-couch)))
(assert (thing (name red-chest) (location t2-2)
(weight light) (on-top-of big-pillow)))
(assert (chest (name red-chest) (contents ladder) (unlocked-by red-key)))
(assert (thing (name blue-chest) (location t7-7)
(weight light) (on-top-of ceiling)))
(assert (thing (name grapes) (location t7-8)
(weight light) (on-top-of ceiling)))
(assert (chest (name blue-chest) (contents bananas) (unlocked-by blue-key)))
(assert (thing (name blue-couch) (location t8-8)
(on-top-of floor) (weight heavy)))
(assert (thing (name green-chest) (location t8-8)
(weight light) (on-top-of ceiling)))
(assert (chest (name green-chest) (contents blue-key) (unlocked-by red-key)))
(assert (thing (name red-key)
(on-top-of floor) (weight light) (location t1-3)))
(assert (goal-is-to (action eat) (argument-1 bananas) (argument-2 empty))))
(deffacts mab-startup ()
(monkey (location t5-7) (on-top-of green-couch)
(location green-couch) (holding blank))
(thing (name green-couch) (location t5-7) (weight heavy)
(on-top-of floor))
(thing (name red-couch) (location t2-2)
(on-top-of floor) (weight heavy))
(thing (name big-pillow) (location t2-2)
(weight light) (on-top-of red-couch))
(thing (name red-chest) (location t2-2)
(weight light) (on-top-of big-pillow))
(chest (name red-chest) (contents ladder) (unlocked-by red-key))
(thing (name blue-chest) (location t7-7)
(weight light) (on-top-of ceiling))
(thing (name grapes) (location t7-8)
(weight light) (on-top-of ceiling))
(chest (name blue-chest) (contents bananas) (unlocked-by blue-key))
(thing (name blue-couch) (location t8-8)
(on-top-of floor) (weight heavy))
(thing (name green-chest) (location t8-8)
(weight light) (on-top-of ceiling))
(chest (name green-chest) (contents blue-key) (unlocked-by red-key))
(thing (name red-key)
(on-top-of floor) (weight light) (location t1-3))
(goal-is-to (action eat) (argument-1 bananas) (argument-2 empty)))
#+ignore
(defun run-mab (&optional (ntimes 1))
(let ((start (get-internal-real-time)))
(dotimes (i ntimes)
(format t "Starting run.~%")
(reset)
(run))
(format t "Elapsed time: ~F~%"
(/ (- (get-internal-real-time) start)
internal-time-units-per-second))))
(defun run-mab (&optional (ntimes 1))
(flet ((repeat-mab ()
(dotimes (i ntimes)
(format t "Starting run.~%")
(reset)
(run))))
(time (repeat-mab))))
#+Allegro
(defun profile-mab (&optional (ntimes 10))
(prof:with-profiling (:type :time)
(run-mab ntimes)))
#+LispWorks
(defun profile-mab (&optional (ntimes 10))
(hcl:set-up-profiler :packages '("LISA" "CLOS"))
(hcl:profile (run-mab ntimes)))
| 15,925 | Common Lisp | .lisp | 391 | 35.869565 | 79 | 0.629467 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | c4a6b3baf9e90b7a05821fa12680d79cd5574d326ade64a1197edf4377fe548b | 9,837 | [
-1
] |
9,838 | rpc.lisp | Ramarren_lisa/misc/rpc.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young ([email protected])
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: rpc.lisp
;;; Description:
;;; $Id: rpc.lisp,v 1.5 2002/12/11 19:02:05 youngde Exp $
(in-package "CL-USER")
(eval-when (:compile-toplevel :load-toplevel :execute)
(require 'aclrpc)
(unless (find-package "RPC")
(defpackage "RPC"
(:use "COMMON-LISP" "NET.RPC"))))
(in-package "RPC")
(defvar *server-host* "localhost")
(defvar *server-port* 10000)
(defvar *server-proc* nil)
(defclass frodo ()
((name :initarg :name
:initform nil
:accessor frodo-name)
(age :initform 0
:accessor frodo-age)))
(defmethod print-object ((self frodo) strm)
(print-unreadable-object (strm strm :type t :identity t)
(format strm "~S, ~S" (frodo-name self) (frodo-age self))))
(defclass remote-frodo (rpc-remote-ref) ())
(defmethod frodo-name ((self remote-frodo))
(rcall 'frodo-name self))
(defmethod (setf slot-value-of-instance)
(new-value (instance rpc-remote-ref) slot-name)
(rcall 'set-instance-slot instance slot-name new-value))
(defun assert-instance (object)
(format t "instance is ~S~%" object)
(format t "class-of instance is ~S~%" (class-of object))
(setf (slot-value-of-instance object 'age) 100)
object)
(defun initialize-client-environment (port)
(format t "Initialising client environment~%")
(import-remote-class port 'remote-frodo "frodo"))
(defun set-instance-slot (object slot value)
(setf (slot-value object slot) value))
(defun make-server ()
(make-rpc-server
'rpc-socket-server
:name "RPC Server"
:local-port *server-port*
:open :listener
:connect-action :call
:connect-function
#'(lambda (port &rest args)
(initialize-client-environment port)
(values))))
(defun start-server ()
(when (null *server-proc*)
(setf *server-proc* (make-server)))
*server-proc*)
(defun stop-server ()
(unless (null *server-proc*)
(rpc-close :stop :final)
(setf *server-proc* nil)))
(defun make-client ()
(make-rpc-client
'rpc-socket-port
:remote-host *server-host*
:remote-port *server-port*))
(defun run-client ()
(multiple-value-bind (port stuff)
(make-client)
(with-remote-port (port :close t)
(let ((frodo (make-instance 'frodo :name 'frodo)))
(rcall 'assert-instance frodo)
(format t "frodo instance after remote call: ~S~%" frodo)
frodo))))
(defun run-sample ()
(start-server)
(run-client))
| 3,289 | Common Lisp | .lisp | 87 | 34.333333 | 79 | 0.698708 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | b7fcbc3bf3a38d8be3ca6258d7c167f575002063e43a96c39456e6f2ac190677 | 9,838 | [
-1
] |
9,839 | core.lisp | Ramarren_lisa/misc/core.lisp |
(in-package "LISA-USER")
(clear)
(deftemplate frodo ()
(slot name)
(slot has-ring)
(slot age))
(deftemplate bilbo ()
(slot name)
(slot relative)
(slot age))
(deftemplate gandalf ()
(slot name)
(slot age))
(deftemplate saruman ()
(slot name))
(deftemplate samwise ()
(slot name)
(slot friend)
(slot age))
(deftemplate hobbit ()
(slot name))
(deftemplate pippin ()
(slot name))
#+ignore
(defrule frodo ()
(frodo (name ?name frodo))
=>
(format t "frodo fired: ~S~%" ?name))
#+ignore
(defrule not-frodo ()
(frodo (name ?name (not frodo)))
=>
(format t "not-frodo fired: ~S~%" ?name))
#+ignore
(defrule simple-rule ()
(frodo)
=>
(format t "simple-rule fired.~%"))
#+ignore
(defrule special-pattern ()
;;;(bilbo (name ?name) (relative ?name))
(frodo (name ?fname) (has-ring ?ring (eq ?ring ?fname)))
=>
)
#+ignore
(defrule negated-slot-rule ()
(frodo (name (not frodo)))
=>
)
#+ignore
(defrule shared-rule-a ()
(frodo (name frodo))
(gandalf (name gandalf) (age 100))
=>
)
#+ignore
(defrule shared-rule-b ()
(frodo (name frodo))
(gandalf (name gandalf) (age 200))
=>
)
#+ignore
(defrule constraints ()
(frodo (name ?name))
(samwise (name sam) (friend ?friend (not frodo)))
=>
(format t "constraints: ~S ~S~%" ?name ?friend))
#+ignore
(defrule variable-rule ()
(frodo (name ?name))
(?sam (samwise (name ?name) (friend ?name)))
=>
(format t "variable-rule fired: ~S~%" ?sam)
(modify ?sam (name samwise)))
#+ignore
(defrule logical-1 ()
(logical
(frodo))
=>
(assert (bilbo)))
#+ignore
(defrule logical-2 ()
(logical
(bilbo))
=>
(assert (samwise)))
(defrule exists ()
(frodo (name ?name))
(exists (bilbo (name ?name)))
=>
(format t "exists fired.~%"))
#+ignore
(defrule respond-to-logical-rule ()
(bilbo)
=>
(format t "Uh oh...~%"))
#+ignore
(defrule or-rule ()
(frodo)
(or (gandalf)
(samwise))
=>
(format t "or-rule~%"))
#+ignore
(defrule or-rule ()
(or (samwise (name sam))
(gandalf (name gandalf)))
(frodo (name ?name))
(or (hobbit)
(pippin))
(saruman)
=>
(format t "or-rule fired.~%"))
#+ignore
(defrule samwise ()
(samwise (name samwise))
=>
(format t "Rule samwise fired.~%"))
#+ignore
(defrule test-rule ()
(frodo (name ?name))
(samwise (friend ?name) (age ?age))
(test (eq ?age 100))
=>
)
#+ignore
(defrule negated-variable ()
(frodo (name ?name))
(samwise (friend (not ?name)))
=>
)
#+ignore
(defrule simple ()
(?f (gandalf (age 100)))
=>
(let ((?age 1000))
(modify ?f (age ?age) (name (intern (make-symbol "gandalf"))))))
#+ignore
(defrule embedded-rule ()
(gandalf (name gandalf) (age ?age))
=>
(defrule new-gandalf ()
(gandalf (name new-gandalf) (age ?age))
=>
(format t "new-gandalf fired.~%")))
#|
(defparameter *frodo* (assert (frodo (name frodo))))
(defparameter *bilbo* (assert (bilbo (name bilbo))))
(defparameter *samwise* (assert (samwise (friend frodo) (age 100))))
(defparameter *gandalf* (assert (gandalf (name gandalf) (age 200))))
|#
(reset)
| 3,103 | Common Lisp | .lisp | 152 | 17.789474 | 68 | 0.627397 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | f3482521025644428bcc5c41238a89bb7d4bab32948a1176766bc73007a20239 | 9,839 | [
-1
] |
9,840 | asdf.lisp | Ramarren_lisa/misc/asdf.lisp | ;;; This is asdf: Another System Definition Facility. $Revision: 1.2 $
;;;
;;; Feedback, bug reports, and patches are all welcome: please mail to
;;; <[email protected]>. But note first that the canonical
;;; source for asdf is presently the cCLan CVS repository at
;;; <URL:http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/cclan/asdf/>
;;;
;;; If you obtained this copy from anywhere else, and you experience
;;; trouble using it, or find bugs, you may want to check at the
;;; location above for a more recent version (and for documentation
;;; and test files, if your copy came without them) before reporting
;;; bugs. There are usually two "supported" revisions - the CVS HEAD
;;; is the latest development version, whereas the revision tagged
;;; RELEASE may be slightly older but is considered `stable'
;;; Copyright (c) 2001-2003 Daniel Barlow and contributors
;;;
;;; Permission is hereby granted, free of charge, to any person obtaining
;;; a copy of this software and associated documentation files (the
;;; "Software"), to deal in the Software without restriction, including
;;; without limitation the rights to use, copy, modify, merge, publish,
;;; distribute, sublicense, and/or sell copies of the Software, and to
;;; permit persons to whom the Software is furnished to do so, subject to
;;; the following conditions:
;;;
;;; The above copyright notice and this permission notice shall be
;;; included in all copies or substantial portions of the Software.
;;;
;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
;;; LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
;;; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
;;; WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
;;; the problem with writing a defsystem replacement is bootstrapping:
;;; we can't use defsystem to compile it. Hence, all in one file
(defpackage #:asdf
(:export #:defsystem #:oos #:operate #:find-system #:run-shell-command
#:system-definition-pathname #:find-component ; miscellaneous
#:hyperdocumentation #:hyperdoc
#:compile-op #:load-op #:load-source-op #:test-system-version
#:test-op
#:operation ; operations
#:feature ; sort-of operation
#:version ; metaphorically sort-of an operation
#:input-files #:output-files #:perform ; operation methods
#:operation-done-p #:explain
#:component #:source-file
#:c-source-file #:cl-source-file #:java-source-file
#:static-file
#:doc-file
#:html-file
#:text-file
#:source-file-type
#:module ; components
#:system
#:unix-dso
#:module-components ; component accessors
#:component-pathname
#:component-relative-pathname
#:component-name
#:component-version
#:component-parent
#:component-property
#:component-system
#:component-depends-on
#:system-description
#:system-long-description
#:system-author
#:system-maintainer
#:system-license
#:operation-on-warnings
#:operation-on-failure
;#:*component-parent-pathname*
#:*system-definition-search-functions*
#:*central-registry* ; variables
#:*compile-file-warnings-behaviour*
#:*compile-file-failure-behaviour*
#:*asdf-revision*
#:operation-error #:compile-failed #:compile-warned #:compile-error
#:error-component #:error-operation
#:system-definition-error
#:missing-component
#:missing-dependency
#:circular-dependency ; errors
#:duplicate-names
#:retry
#:accept ; restarts
)
(:use :cl))
#+nil
(error "The author of this file habitually uses #+nil to comment out forms. But don't worry, it was unlikely to work in the New Implementation of Lisp anyway")
(in-package #:asdf)
(defvar *asdf-revision* (let* ((v "$Revision: 1.2 $")
(colon (or (position #\: v) -1))
(dot (position #\. v)))
(and v colon dot
(list (parse-integer v :start (1+ colon)
:junk-allowed t)
(parse-integer v :start (1+ dot)
:junk-allowed t)))))
(defvar *compile-file-warnings-behaviour* :warn)
(defvar *compile-file-failure-behaviour* #+sbcl :error #-sbcl :warn)
(defvar *verbose-out* nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; utility stuff
(defmacro aif (test then &optional else)
`(let ((it ,test)) (if it ,then ,else)))
(defun pathname-sans-name+type (pathname)
"Returns a new pathname with same HOST, DEVICE, DIRECTORY as PATHNAME,
and NIL NAME and TYPE components"
(make-pathname :name nil :type nil :defaults pathname))
(define-modify-macro appendf (&rest args)
append "Append onto list")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; classes, condiitons
(define-condition system-definition-error (error) ()
;; [this use of :report should be redundant, but unfortunately it's not.
;; cmucl's lisp::output-instance prefers the kernel:slot-class-print-function
;; over print-object; this is always conditions::%print-condition for
;; condition objects, which in turn does inheritance of :report options at
;; run-time. fortunately, inheritance means we only need this kludge here in
;; order to fix all conditions that build on it. -- rgr, 28-Jul-02.]
#+cmu (:report print-object))
(define-condition formatted-system-definition-error (system-definition-error)
((format-control :initarg :format-control :reader format-control)
(format-arguments :initarg :format-arguments :reader format-arguments))
(:report (lambda (c s)
(apply #'format s (format-control c) (format-arguments c)))))
(define-condition circular-dependency (system-definition-error)
((components :initarg :components :reader circular-dependency-components)))
(define-condition duplicate-names (system-definition-error)
((name :initarg :name :reader duplicate-names-name)))
(define-condition missing-component (system-definition-error)
((requires :initform "(unnamed)" :reader missing-requires :initarg :requires)
(version :initform nil :reader missing-version :initarg :version)
(parent :initform nil :reader missing-parent :initarg :parent)))
(define-condition missing-dependency (missing-component)
((required-by :initarg :required-by :reader missing-required-by)))
(define-condition operation-error (error)
((component :reader error-component :initarg :component)
(operation :reader error-operation :initarg :operation))
(:report (lambda (c s)
(format s "~@<erred while invoking ~A on ~A~@:>"
(error-operation c) (error-component c)))))
(define-condition compile-error (operation-error) ())
(define-condition compile-failed (compile-error) ())
(define-condition compile-warned (compile-error) ())
(defclass component ()
((name :accessor component-name :initarg :name :documentation
"Component name: designator for a string composed of portable pathname characters")
(version :accessor component-version :initarg :version)
(in-order-to :initform nil :initarg :in-order-to)
;;; XXX crap name
(do-first :initform nil :initarg :do-first)
;; methods defined using the "inline" style inside a defsystem form:
;; need to store them somewhere so we can delete them when the system
;; is re-evaluated
(inline-methods :accessor component-inline-methods :initform nil)
(parent :initarg :parent :initform nil :reader component-parent)
;; no direct accessor for pathname, we do this as a method to allow
;; it to default in funky ways if not supplied
(relative-pathname :initarg :pathname)
(operation-times :initform (make-hash-table )
:accessor component-operation-times)
;; XXX we should provide some atomic interface for updating the
;; component properties
(properties :accessor component-properties :initarg :properties
:initform nil)))
;;;; methods: conditions
(defmethod print-object ((c missing-dependency) s)
(format s "~@<~A, required by ~A~@:>"
(call-next-method c nil) (missing-required-by c)))
(defun sysdef-error (format &rest arguments)
(error 'formatted-system-definition-error :format-control format :format-arguments arguments))
;;;; methods: components
(defmethod print-object ((c missing-component) s)
(format s "~@<component ~S not found~
~@[ or does not match version ~A~]~
~@[ in ~A~]~@:>"
(missing-requires c)
(missing-version c)
(when (missing-parent c)
(component-name (missing-parent c)))))
(defgeneric component-system (component)
(:documentation "Find the top-level system containing COMPONENT"))
(defmethod component-system ((component component))
(aif (component-parent component)
(component-system it)
component))
(defmethod print-object ((c component) stream)
(print-unreadable-object (c stream :type t :identity t)
(ignore-errors
(prin1 (component-name c) stream))))
(defclass module (component)
((components :initform nil :accessor module-components :initarg :components)
;; what to do if we can't satisfy a dependency of one of this module's
;; components. This allows a limited form of conditional processing
(if-component-dep-fails :initform :fail
:accessor module-if-component-dep-fails
:initarg :if-component-dep-fails)
(default-component-class :accessor module-default-component-class
:initform 'cl-source-file :initarg :default-component-class)))
(defgeneric component-pathname (component)
(:documentation "Extracts the pathname applicable for a particular component."))
(defun component-parent-pathname (component)
(aif (component-parent component)
(component-pathname it)
*default-pathname-defaults*))
(defgeneric component-relative-pathname (component)
(:documentation "Extracts the relative pathname applicable for a particular component."))
(defmethod component-relative-pathname ((component module))
(or (slot-value component 'relative-pathname)
(make-pathname
:directory `(:relative ,(component-name component))
:host (pathname-host (component-parent-pathname component)))))
(defmethod component-pathname ((component component))
(let ((*default-pathname-defaults* (component-parent-pathname component)))
(merge-pathnames (component-relative-pathname component))))
(defgeneric component-property (component property))
(defmethod component-property ((c component) property)
(cdr (assoc property (slot-value c 'properties) :test #'equal)))
(defgeneric (setf component-property) (new-value component property))
(defmethod (setf component-property) (new-value (c component) property)
(let ((a (assoc property (slot-value c 'properties) :test #'equal)))
(if a
(setf (cdr a) new-value)
(setf (slot-value c 'properties)
(acons property new-value (slot-value c 'properties))))))
(defclass system (module)
((description :accessor system-description :initarg :description)
(long-description
:accessor system-long-description :initarg :long-description)
(author :accessor system-author :initarg :author)
(maintainer :accessor system-maintainer :initarg :maintainer)
(licence :accessor system-licence :initarg :licence)))
;;; version-satisfies
;;; with apologies to christophe rhodes ...
(defun split (string &optional max (ws '(#\Space #\Tab)))
(flet ((is-ws (char) (find char ws)))
(nreverse
(let ((list nil) (start 0) (words 0) end)
(loop
(when (and max (>= words (1- max)))
(return (cons (subseq string start) list)))
(setf end (position-if #'is-ws string :start start))
(push (subseq string start end) list)
(incf words)
(unless end (return list))
(setf start (1+ end)))))))
(defgeneric version-satisfies (component version))
(defmethod version-satisfies ((c component) version)
(unless (and version (slot-boundp c 'version))
(return-from version-satisfies t))
(let ((x (mapcar #'parse-integer
(split (component-version c) nil '(#\.))))
(y (mapcar #'parse-integer
(split version nil '(#\.)))))
(labels ((bigger (x y)
(cond ((not y) t)
((not x) nil)
((> (car x) (car y)) t)
((= (car x) (car y))
(bigger (cdr x) (cdr y))))))
(and (= (car x) (car y))
(or (not (cdr y)) (bigger (cdr x) (cdr y)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; finding systems
(defvar *defined-systems* (make-hash-table :test 'equal))
(defun coerce-name (name)
(typecase name
(component (component-name name))
(symbol (string-downcase (symbol-name name)))
(string name)
(t (sysdef-error "~@<invalid component designator ~A~@:>" name))))
;;; for the sake of keeping things reasonably neat, we adopt a
;;; convention that functions in this list are prefixed SYSDEF-
(defvar *system-definition-search-functions*
'(sysdef-central-registry-search))
(defun system-definition-pathname (system)
(some (lambda (x) (funcall x system))
*system-definition-search-functions*))
(defvar *central-registry*
'(*default-pathname-defaults*
#+nil "/home/dan/src/sourceforge/cclan/asdf/systems/"
#+nil "telent:asdf;systems;"))
(defun sysdef-central-registry-search (system)
(let ((name (coerce-name system)))
(block nil
(dolist (dir *central-registry*)
(let* ((defaults (eval dir))
(file (and defaults
(make-pathname
:defaults defaults :version :newest
:name name :type "asd" :case :local))))
(if (and file (probe-file file))
(return file)))))))
(defun make-temporary-package ()
(flet ((try (counter)
(ignore-errors
(make-package (format nil "ASDF~D" counter)
:use '(:cl :asdf)))))
(do* ((counter 0 (+ counter 1))
(package (try counter) (try counter)))
(package package))))
(defun find-system (name &optional (error-p t))
(let* ((name (coerce-name name))
(in-memory (gethash name *defined-systems*))
(on-disk (system-definition-pathname name)))
(when (and on-disk
(or (not in-memory)
(< (car in-memory) (file-write-date on-disk))))
(let ((package (make-temporary-package)))
(unwind-protect
(let ((*package* package))
(format
*verbose-out*
"~&~@<; ~@;loading system definition from ~A into ~A~@:>~%"
;; FIXME: This wants to be (ENOUGH-NAMESTRING
;; ON-DISK), but CMUCL barfs on that.
on-disk
*package*)
(load on-disk))
(delete-package package))))
(let ((in-memory (gethash name *defined-systems*)))
(if in-memory
(progn (if on-disk (setf (car in-memory) (file-write-date on-disk)))
(cdr in-memory))
(if error-p (error 'missing-component :requires name))))))
(defun register-system (name system)
(format *verbose-out* "~&~@<; ~@;registering ~A as ~A~@:>~%" system name)
(setf (gethash (coerce-name name) *defined-systems*)
(cons (get-universal-time) system)))
(defun system-registered-p (name)
(gethash (coerce-name name) *defined-systems*))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; finding components
(defgeneric find-component (module name &optional version)
(:documentation "Finds the component with name NAME present in the
MODULE module; if MODULE is nil, then the component is assumed to be a
system."))
(defmethod find-component ((module module) name &optional version)
(if (slot-boundp module 'components)
(let ((m (find name (module-components module)
:test #'equal :key #'component-name)))
(if (and m (version-satisfies m version)) m))))
;;; a component with no parent is a system
(defmethod find-component ((module (eql nil)) name &optional version)
(let ((m (find-system name nil)))
(if (and m (version-satisfies m version)) m)))
;;; component subclasses
(defclass source-file (component) ())
(defclass cl-source-file (source-file) ())
(defclass c-source-file (source-file) ())
(defclass java-source-file (source-file) ())
(defclass static-file (source-file) ())
(defclass doc-file (static-file) ())
(defclass html-file (doc-file) ())
(defgeneric source-file-type (component system))
(defmethod source-file-type ((c cl-source-file) (s module)) "lisp")
(defmethod source-file-type ((c c-source-file) (s module)) "c")
(defmethod source-file-type ((c java-source-file) (s module)) "java")
(defmethod source-file-type ((c html-file) (s module)) "html")
(defmethod source-file-type ((c static-file) (s module)) nil)
(defmethod component-relative-pathname ((component source-file))
(let ((relative-pathname (slot-value component 'relative-pathname)))
(if relative-pathname
relative-pathname
(let* ((*default-pathname-defaults*
(component-parent-pathname component))
(name-type
(make-pathname
:name (component-name component)
:type (source-file-type component
(component-system component)))))
name-type))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; operations
;;; one of these is instantiated whenever (operate ) is called
(defclass operation ()
((forced :initform nil :initarg :force :accessor operation-forced)
(original-initargs :initform nil :initarg :original-initargs
:accessor operation-original-initargs)
(visited-nodes :initform nil :accessor operation-visited-nodes)
(visiting-nodes :initform nil :accessor operation-visiting-nodes)
(parent :initform nil :initarg :parent :accessor operation-parent)))
(defmethod print-object ((o operation) stream)
(print-unreadable-object (o stream :type t :identity t)
(ignore-errors
(prin1 (operation-original-initargs o) stream))))
(defmethod shared-initialize :after ((operation operation) slot-names
&key force
&allow-other-keys)
(declare (ignore slot-names force))
;; empty method to disable initarg validity checking
)
(defgeneric perform (operation component))
(defgeneric operation-done-p (operation component))
(defgeneric explain (operation component))
(defgeneric output-files (operation component))
(defgeneric input-files (operation component))
(defun node-for (o c)
(cons (class-name (class-of o)) c))
(defgeneric operation-ancestor (operation)
(:documentation "Recursively chase the operation's parent pointer until we get to the head of the tree"))
(defmethod operation-ancestor ((operation operation))
(aif (operation-parent operation)
(operation-ancestor it)
operation))
(defun make-sub-operation (c o dep-c dep-o)
(let* ((args (copy-list (operation-original-initargs o)))
(force-p (getf args :force)))
;; note explicit comparison with T: any other non-NIL force value
;; (e.g. :recursive) will pass through
(cond ((and (null (component-parent c))
(null (component-parent dep-c))
(not (eql c dep-c)))
(when (eql force-p t)
(setf (getf args :force) nil))
(apply #'make-instance dep-o
:parent o
:original-initargs args args))
((subtypep (type-of o) dep-o)
o)
(t
(apply #'make-instance dep-o
:parent o :original-initargs args args)))))
(defgeneric visit-component (operation component data))
(defmethod visit-component ((o operation) (c component) data)
(unless (component-visited-p o c)
(push (cons (node-for o c) data)
(operation-visited-nodes (operation-ancestor o)))))
(defgeneric component-visited-p (operation component))
(defmethod component-visited-p ((o operation) (c component))
(assoc (node-for o c)
(operation-visited-nodes (operation-ancestor o))
:test 'equal))
(defgeneric (setf visiting-component) (new-value operation component))
(defmethod (setf visiting-component) (new-value operation component)
;; MCL complains about unused lexical variables
(declare (ignorable new-value operation component)))
(defmethod (setf visiting-component) (new-value (o operation) (c component))
(let ((node (node-for o c))
(a (operation-ancestor o)))
(if new-value
(pushnew node (operation-visiting-nodes a) :test 'equal)
(setf (operation-visiting-nodes a)
(remove node (operation-visiting-nodes a) :test 'equal)))))
(defgeneric component-visiting-p (operation component))
(defmethod component-visiting-p ((o operation) (c component))
(let ((node (cons o c)))
(member node (operation-visiting-nodes (operation-ancestor o))
:test 'equal)))
(defgeneric component-depends-on (operation component))
(defmethod component-depends-on ((o operation) (c component))
(cdr (assoc (class-name (class-of o))
(slot-value c 'in-order-to))))
(defgeneric component-self-dependencies (operation component))
(defmethod component-self-dependencies ((o operation) (c component))
(let ((all-deps (component-depends-on o c)))
(remove-if-not (lambda (x)
(member (component-name c) (cdr x) :test #'string=))
all-deps)))
(defmethod input-files ((operation operation) (c component))
(let ((parent (component-parent c))
(self-deps (component-self-dependencies operation c)))
(if self-deps
(mapcan (lambda (dep)
(destructuring-bind (op name) dep
(output-files (make-instance op)
(find-component parent name))))
self-deps)
;; no previous operations needed? I guess we work with the
;; original source file, then
(list (component-pathname c)))))
(defmethod input-files ((operation operation) (c module)) nil)
(defmethod operation-done-p ((o operation) (c component))
(let ((out-files (output-files o c))
(in-files (input-files o c)))
(cond ((and (not in-files) (not out-files))
;; arbitrary decision: an operation that uses nothing to
;; produce nothing probably isn't doing much
t)
((not out-files)
(let ((op-done
(gethash (type-of o)
(component-operation-times c))))
(and op-done
(>= op-done
(or (apply #'max
(mapcar #'file-write-date in-files)) 0)))))
((not in-files) nil)
(t
(and
(every #'probe-file out-files)
(> (apply #'min (mapcar #'file-write-date out-files))
(apply #'max (mapcar #'file-write-date in-files)) ))))))
;;; So you look at this code and think "why isn't it a bunch of
;;; methods". And the answer is, because standard method combination
;;; runs :before methods most->least-specific, which is back to front
;;; for our purposes. And CLISP doesn't have non-standard method
;;; combinations, so let's keep it simple and aspire to portability
(defgeneric traverse (operation component))
(defmethod traverse ((operation operation) (c component))
(let ((forced nil))
(labels ((do-one-dep (required-op required-c required-v)
(let* ((dep-c (or (find-component
(component-parent c)
;; XXX tacky. really we should build the
;; in-order-to slot with canonicalized
;; names instead of coercing this late
(coerce-name required-c) required-v)
(error 'missing-dependency :required-by c
:version required-v
:requires required-c)))
(op (make-sub-operation c operation dep-c required-op)))
(traverse op dep-c)))
(do-dep (op dep)
(cond ((eq op 'feature)
(or (member (car dep) *features*)
(error 'missing-dependency :required-by c
:requires (car dep) :version nil)))
(t
(dolist (d dep)
(cond ((consp d)
(assert (string-equal
(symbol-name (first d))
"VERSION"))
(appendf forced
(do-one-dep op (second d) (third d))))
(t
(appendf forced (do-one-dep op d nil)))))))))
(aif (component-visited-p operation c)
(return-from traverse
(if (cdr it) (list (cons 'pruned-op c)) nil)))
;; dependencies
(if (component-visiting-p operation c)
(error 'circular-dependency :components (list c)))
(setf (visiting-component operation c) t)
(loop for (required-op . deps) in (component-depends-on operation c)
do (do-dep required-op deps))
;; constituent bits
(let ((module-ops
(when (typep c 'module)
(let ((at-least-one nil)
(forced nil)
(error nil))
(loop for kid in (module-components c)
do (handler-case
(appendf forced (traverse operation kid ))
(missing-dependency (condition)
(if (eq (module-if-component-dep-fails c) :fail)
(error condition))
(setf error condition))
(:no-error (c)
(declare (ignore c))
(setf at-least-one t))))
(when (and (eq (module-if-component-dep-fails c) :try-next)
(not at-least-one))
(error error))
forced))))
;; now the thing itself
(when (or forced module-ops
(not (operation-done-p operation c))
(let ((f (operation-forced (operation-ancestor operation))))
(and f (or (not (consp f))
(member (component-name
(operation-ancestor operation))
(mapcar #'coerce-name f)
:test #'string=)))))
(let ((do-first (cdr (assoc (class-name (class-of operation))
(slot-value c 'do-first)))))
(loop for (required-op . deps) in do-first
do (do-dep required-op deps)))
(setf forced (append (delete 'pruned-op forced :key #'car)
(delete 'pruned-op module-ops :key #'car)
(list (cons operation c))))))
(setf (visiting-component operation c) nil)
(visit-component operation c (and forced t))
forced)))
(defmethod perform ((operation operation) (c source-file))
(sysdef-error
"~@<required method PERFORM not implemented ~
for operation ~A, component ~A~@:>"
(class-of operation) (class-of c)))
(defmethod perform ((operation operation) (c module))
nil)
(defmethod explain ((operation operation) (component component))
(format *verbose-out* "~&;;; ~A on ~A~%" operation component))
;;; compile-op
(defclass compile-op (operation)
((proclamations :initarg :proclamations :accessor compile-op-proclamations :initform nil)
(on-warnings :initarg :on-warnings :accessor operation-on-warnings
:initform *compile-file-warnings-behaviour*)
(on-failure :initarg :on-failure :accessor operation-on-failure
:initform *compile-file-failure-behaviour*)))
(defmethod perform :before ((operation compile-op) (c source-file))
(map nil #'ensure-directories-exist (output-files operation c)))
(defmethod perform :after ((operation operation) (c component))
(setf (gethash (type-of operation) (component-operation-times c))
(get-universal-time)))
;;; perform is required to check output-files to find out where to put
;;; its answers, in case it has been overridden for site policy
(defmethod perform ((operation compile-op) (c cl-source-file))
#-:broken-fasl-loader
(let ((source-file (component-pathname c))
(output-file (car (output-files operation c))))
(multiple-value-bind (output warnings-p failure-p)
(compile-file source-file
:output-file output-file)
;(declare (ignore output))
(when warnings-p
(case (operation-on-warnings operation)
(:warn (warn
"~@<COMPILE-FILE warned while performing ~A on ~A.~@:>"
operation c))
(:error (error 'compile-warned :component c :operation operation))
(:ignore nil)))
(when failure-p
(case (operation-on-failure operation)
(:warn (warn
"~@<COMPILE-FILE failed while performing ~A on ~A.~@:>"
operation c))
(:error (error 'compile-failed :component c :operation operation))
(:ignore nil)))
(unless output
(error 'compile-error :component c :operation operation)))))
(defmethod output-files ((operation compile-op) (c cl-source-file))
#-:broken-fasl-loader (list (compile-file-pathname (component-pathname c)))
#+:broken-fasl-loader (list (component-pathname c)))
(defmethod perform ((operation compile-op) (c static-file))
nil)
(defmethod output-files ((operation compile-op) (c static-file))
nil)
;;; load-op
(defclass load-op (operation) ())
(defmethod perform ((o load-op) (c cl-source-file))
(mapcar #'load (input-files o c)))
(defmethod perform ((operation load-op) (c static-file))
nil)
(defmethod operation-done-p ((operation load-op) (c static-file))
t)
(defmethod output-files ((o operation) (c component))
nil)
(defmethod component-depends-on ((operation load-op) (c component))
(cons (list 'compile-op (component-name c))
(call-next-method)))
;;; load-source-op
(defclass load-source-op (operation) ())
(defmethod perform ((o load-source-op) (c cl-source-file))
(let ((source (component-pathname c)))
(setf (component-property c 'last-loaded-as-source)
(and (load source)
(get-universal-time)))))
(defmethod perform ((operation load-source-op) (c static-file))
nil)
(defmethod output-files ((operation load-source-op) (c component))
nil)
;;; FIXME: we simply copy load-op's dependencies. this is Just Not Right.
(defmethod component-depends-on ((o load-source-op) (c component))
(let ((what-would-load-op-do (cdr (assoc 'load-op
(slot-value c 'in-order-to)))))
(mapcar (lambda (dep)
(if (eq (car dep) 'load-op)
(cons 'load-source-op (cdr dep))
dep))
what-would-load-op-do)))
(defmethod operation-done-p ((o load-source-op) (c source-file))
(if (or (not (component-property c 'last-loaded-as-source))
(> (file-write-date (component-pathname c))
(component-property c 'last-loaded-as-source)))
nil t))
(defclass test-op (operation) ())
(defmethod perform ((operation test-op) (c component))
nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; invoking operations
(defun operate (operation-class system &rest args)
(let* ((op (apply #'make-instance operation-class
:original-initargs args args))
(*verbose-out*
(if (getf args :verbose t)
*trace-output*
(make-broadcast-stream)))
(system (if (typep system 'component) system (find-system system)))
(steps (traverse op system)))
(with-compilation-unit ()
(loop for (op . component) in steps do
(loop
(restart-case
(progn (perform op component)
(return))
(retry ()
:report
(lambda (s)
(format s "~@<Retry performing ~S on ~S.~@:>"
op component)))
(accept ()
:report
(lambda (s)
(format s
"~@<Continue, treating ~S on ~S as ~
having been successful.~@:>"
op component))
(setf (gethash (type-of op)
(component-operation-times component))
(get-universal-time))
(return))))))))
(defun oos (&rest args)
"Alias of OPERATE function"
(apply #'operate args))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; syntax
(defun remove-keyword (key arglist)
(labels ((aux (key arglist)
(cond ((null arglist) nil)
((eq key (car arglist)) (cddr arglist))
(t (cons (car arglist) (cons (cadr arglist)
(remove-keyword
key (cddr arglist))))))))
(aux key arglist)))
(defmacro defsystem (name &body options)
(destructuring-bind (&key pathname (class 'system) &allow-other-keys) options
(let ((component-options (remove-keyword :class options)))
`(progn
;; system must be registered before we parse the body, otherwise
;; we recur when trying to find an existing system of the same name
;; to reuse options (e.g. pathname) from
(let ((s (system-registered-p ',name)))
(cond ((and s (eq (type-of (cdr s)) ',class))
(setf (car s) (get-universal-time)))
(s
#+clisp
(sysdef-error "Cannot redefine the existing system ~A with a different class" s)
#-clisp
(change-class (cdr s) ',class))
(t
(register-system (quote ,name)
(make-instance ',class :name ',name)))))
(parse-component-form nil (apply
#'list
:module (coerce-name ',name)
:pathname
(or ,pathname
(pathname-sans-name+type
(resolve-symlinks *load-truename*))
*default-pathname-defaults*)
',component-options))))))
(defun class-for-type (parent type)
(let ((class
(find-class
(or (find-symbol (symbol-name type) *package*)
(find-symbol (symbol-name type) #.(package-name *package*)))
nil)))
(or class
(and (eq type :file)
(or (module-default-component-class parent)
(find-class 'cl-source-file)))
(sysdef-error "~@<don't recognize component type ~A~@:>" type))))
(defun maybe-add-tree (tree op1 op2 c)
"Add the node C at /OP1/OP2 in TREE, unless it's there already.
Returns the new tree (which probably shares structure with the old one)"
(let ((first-op-tree (assoc op1 tree)))
(if first-op-tree
(progn
(aif (assoc op2 (cdr first-op-tree))
(if (find c (cdr it))
nil
(setf (cdr it) (cons c (cdr it))))
(setf (cdr first-op-tree)
(acons op2 (list c) (cdr first-op-tree))))
tree)
(acons op1 (list (list op2 c)) tree))))
(defun union-of-dependencies (&rest deps)
(let ((new-tree nil))
(dolist (dep deps)
(dolist (op-tree dep)
(dolist (op (cdr op-tree))
(dolist (c (cdr op))
(setf new-tree
(maybe-add-tree new-tree (car op-tree) (car op) c))))))
new-tree))
(defun remove-keys (key-names args)
(loop for ( name val ) on args by #'cddr
unless (member (symbol-name name) key-names
:key #'symbol-name :test 'equal)
append (list name val)))
(defvar *serial-depends-on*)
(defun parse-component-form (parent options)
(destructuring-bind
(type name &rest rest &key
;; the following list of keywords is reproduced below in the
;; remove-keys form. important to keep them in sync
components pathname default-component-class
perform explain output-files operation-done-p
weakly-depends-on
depends-on serial in-order-to
;; list ends
&allow-other-keys) options
(check-component-input type name weakly-depends-on depends-on components in-order-to)
(when (and parent
(find-component parent name)
;; ignore the same object when rereading the defsystem
(not
(typep (find-component parent name)
(class-for-type parent type))))
(error 'duplicate-names :name name))
(let* ((other-args (remove-keys
'(components pathname default-component-class
perform explain output-files operation-done-p
weakly-depends-on
depends-on serial in-order-to)
rest))
(ret
(or (find-component parent name)
(make-instance (class-for-type parent type)))))
(when weakly-depends-on
(setf depends-on (append depends-on (remove-if (complement #'find-system) weakly-depends-on))))
(when (boundp '*serial-depends-on*)
(setf depends-on
(concatenate 'list *serial-depends-on* depends-on)))
(apply #'reinitialize-instance
ret
:name (coerce-name name)
:pathname pathname
:parent parent
other-args)
(when (typep ret 'module)
(setf (module-default-component-class ret)
(or default-component-class
(and (typep parent 'module)
(module-default-component-class parent))))
(let ((*serial-depends-on* nil))
(setf (module-components ret)
(loop for c-form in components
for c = (parse-component-form ret c-form)
collect c
if serial
do (push (component-name c) *serial-depends-on*))))
;; check for duplicate names
(let ((name-hash (make-hash-table :test #'equal)))
(loop for c in (module-components ret)
do
(if (gethash (component-name c)
name-hash)
(error 'duplicate-names
:name (component-name c))
(setf (gethash (component-name c)
name-hash)
t)))))
(setf (slot-value ret 'in-order-to)
(union-of-dependencies
in-order-to
`((compile-op (compile-op ,@depends-on))
(load-op (load-op ,@depends-on))))
(slot-value ret 'do-first) `((compile-op (load-op ,@depends-on))))
(loop for (n v) in `((perform ,perform) (explain ,explain)
(output-files ,output-files)
(operation-done-p ,operation-done-p))
do (map 'nil
;; this is inefficient as most of the stored
;; methods will not be for this particular gf n
;; But this is hardly performance-critical
(lambda (m) (remove-method (symbol-function n) m))
(component-inline-methods ret))
when v
do (destructuring-bind (op qual (o c) &body body) v
(pushnew
(eval `(defmethod ,n ,qual ((,o ,op) (,c (eql ,ret)))
,@body))
(component-inline-methods ret))))
ret)))
(defun check-component-input (type name weakly-depends-on depends-on components in-order-to)
"A partial test of the values of a component."
(when weakly-depends-on (warn "We got one! XXXXX"))
(unless (listp depends-on)
(sysdef-error-component ":depends-on must be a list."
type name depends-on))
(unless (listp weakly-depends-on)
(sysdef-error-component ":weakly-depends-on must be a list."
type name weakly-depends-on))
(unless (listp components)
(sysdef-error-component ":components must be NIL or a list of components."
type name components))
(unless (and (listp in-order-to) (listp (car in-order-to)))
(sysdef-error-component ":in-order-to must be NIL or a list of components."
type name in-order-to)))
(defun sysdef-error-component (msg type name value)
(sysdef-error (concatenate 'string msg
"~&The value specified for ~(~A~) ~A is ~W")
type name value))
(defun resolve-symlinks (path)
#-allegro (truename path)
#+allegro (excl:pathname-resolve-symbolic-links path)
)
;;; optional extras
;;; run-shell-command functions for other lisp implementations will be
;;; gratefully accepted, if they do the same thing. If the docstring
;;; is ambiguous, send a bug report
(defun run-shell-command (control-string &rest args)
"Interpolate ARGS into CONTROL-STRING as if by FORMAT, and
synchronously execute the result using a Bourne-compatible shell, with
output to *verbose-out*. Returns the shell's exit code."
(let ((command (apply #'format nil control-string args)))
(format *verbose-out* "; $ ~A~%" command)
#+sbcl
(sb-impl::process-exit-code
(sb-ext:run-program
"/bin/sh"
(list "-c" command)
:input nil :output *verbose-out*))
#+(or cmu scl)
(ext:process-exit-code
(ext:run-program
"/bin/sh"
(list "-c" command)
:input nil :output *verbose-out*))
#+allegro
(excl:run-shell-command command :input nil :output *verbose-out*)
#+lispworks
(system:call-system-showing-output
command
:shell-type "/bin/sh"
:output-stream *verbose-out*)
#+clisp ;XXX not exactly *verbose-out*, I know
(ext:run-shell-command command :output :terminal :wait t)
#+openmcl
(nth-value 1
(ccl:external-process-status
(ccl:run-program "/bin/sh" (list "-c" command)
:input nil :output *verbose-out*
:wait t)))
#+ecl ;; courtesy of Juan Jose Garcia Ripoll
(si:system command)
#-(or openmcl clisp lispworks allegro scl cmu sbcl ecl)
(error "RUN-SHELL-PROGRAM not implemented for this Lisp")
))
(defgeneric hyperdocumentation (package name doc-type))
(defmethod hyperdocumentation ((package symbol) name doc-type)
(hyperdocumentation (find-package package) name doc-type))
(defun hyperdoc (name doc-type)
(hyperdocumentation (symbol-package name) name doc-type))
(pushnew :asdf *features*)
#+sbcl
(eval-when (:compile-toplevel :load-toplevel :execute)
(when (sb-ext:posix-getenv "SBCL_BUILDING_CONTRIB")
(pushnew :sbcl-hooks-require *features*)))
#+(and sbcl sbcl-hooks-require)
(progn
(defun module-provide-asdf (name)
(handler-bind ((style-warning #'muffle-warning))
(let* ((*verbose-out* (make-broadcast-stream))
(system (asdf:find-system name nil)))
(when system
(asdf:operate 'asdf:load-op name)
t))))
(defun contrib-sysdef-search (system)
(let* ((name (coerce-name system))
(home (truename (sb-ext:posix-getenv "SBCL_HOME")))
(contrib (merge-pathnames
(make-pathname :directory `(:relative ,name)
:name name
:type "asd"
:case :local
:version :newest)
home)))
(probe-file contrib)))
(pushnew
'(merge-pathnames "site-systems/"
(truename (sb-ext:posix-getenv "SBCL_HOME")))
*central-registry*)
(pushnew
'(merge-pathnames ".sbcl/systems/"
(user-homedir-pathname))
*central-registry*)
(pushnew 'module-provide-asdf sb-ext:*module-provider-functions*)
(pushnew 'contrib-sysdef-search *system-definition-search-functions*))
(provide 'asdf)
| 41,068 | Common Lisp | .lisp | 978 | 36.688139 | 160 | 0.672016 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 00ba2edf70084188e89ae4ceadcc052e16064f79d8230342bbda5d3c05b8663b | 9,840 | [
-1
] |
9,841 | lisa.asd | Ramarren_lisa/lisa.asd | ;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: lisa.asd
;;; Description: Lisa's ASDF system definition file. To use it, you must have asdf loaded; Lisa
;;; provides a copy in "lisa:misc;asdf.lisp".
;;; Assuming a loaded asdf, this is the easiest way to install Lisa:
;;; (push <lisa root directory> asdf:*central-registry*)
;;; (asdf:operate 'asdf:load-op :lisa)
;;; $Id: lisa.asd,v 1.7 2007/09/11 21:14:07 youngde Exp $
(in-package :cl-user)
(eval-when (:compile-toplevel :load-toplevel :execute)
(unless (find-package :lisa-system)
(defpackage "LISA-SYSTEM"
(:use "COMMON-LISP" "ASDF"))))
(in-package :lisa-system)
(defsystem lisa
:name "Lisa"
:author "David E. Young"
:maintainer "David E. Young"
:licence "LGPL"
:description "The Lisa expert system shell"
:components
((:module src
:components
((:module packages
:components
((:file "pkgdecl")))
(:module utils
:components
((:file "compose")
(:file "utils"))
:serial t)
(:module belief-systems
:components
((:file "belief")
(:file "certainty-factors"))
:serial t)
(:module reflect
:components
((:file "reflect")))
(:module core
:components
((:file "preamble")
(:file "conditions")
(:file "deffacts")
(:file "fact")
(:file "watches")
(:file "activation")
(:file "heap")
(:file "conflict-resolution-strategies")
(:file "context")
(:file "rule")
(:file "pattern")
(:file "rule-parser")
(:file "fact-parser")
(:file "language")
(:file "tms-support")
(:file "rete")
(:file "belief-interface")
(:file "meta")
(:file "binding")
(:file "token")
(:file "retrieve"))
:serial t)
(:module implementations
:components
((:file "workarounds")
#+:lispworks
(:file "lispworks-auto-notify")
#+:cmucl
(:file "cmucl-auto-notify")
#+:allegro
(:file "allegro-auto-notify"))
:serial t)
(:module rete
:pathname "rete/reference/"
:components
((:file "node-tests")
(:file "shared-node")
(:file "successor")
(:file "node-pair")
(:file "terminal-node")
(:file "node1")
(:file "join-node")
(:file "node2")
(:file "node2-not")
(:file "node2-test")
(:file "node2-exists")
(:file "rete-compiler")
(:file "tms")
(:file "network-ops")
(:file "network-crawler"))
:serial t)
(:module config
:components
((:file "config")
(:file "epilogue"))
:serial t))
:serial t)))
(defvar *lisa-root-pathname*
(make-pathname :directory
(pathname-directory *load-truename*)
:host (pathname-host *load-truename*)
:device (pathname-device *load-truename*)))
(defun make-lisa-path (relative-path)
(concatenate 'string (namestring *lisa-root-pathname*)
relative-path))
(setf (logical-pathname-translations "lisa")
`(("src;**;" ,(make-lisa-path "src/**/"))
("lib;**;*.*" ,(make-lisa-path "lib/**/"))
("config;*.*" ,(make-lisa-path "config/"))
("debugger;*.*" ,(make-lisa-path "src/debugger/"))
("contrib;**;" ,(make-lisa-path "contrib/**/"))))
(defun lisa-debugger ()
(translate-logical-pathname "lisa:debugger;lisa-debugger.lisp"))
;;; Sets up the environment so folks can use the non-portable form of REQUIRE
;;; with some implementations...
#+:allegro
(setf system:*require-search-list*
(append system:*require-search-list*
`(:newest ,(lisa-debugger))))
#+:clisp
(setf custom:*load-paths*
(append custom:*load-paths* `(,(lisa-debugger))))
#+:openmcl
(pushnew (pathname-directory (lisa-debugger)) ccl:*module-search-path* :test #'equal)
#+:lispworks
(let ((loadable-modules `(("lisa-debugger" . ,(lisa-debugger)))))
(lw:defadvice (require lisa-require :around)
(module-name &optional pathname)
(let ((lisa-module
(find module-name loadable-modules
:test #'string=
:key #'car)))
(if (null lisa-module)
(lw:call-next-advice module-name pathname)
(lw:call-next-advice module-name (cdr lisa-module))))))
| 6,534 | Common Lisp | .asd | 150 | 28.96 | 95 | 0.489863 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | ecb6514aaf7424a41a1e88882d83058d65fa33159b726b70f5bddde8fa562326 | 9,841 | [
-1
] |
9,847 | mab.clp | Ramarren_lisa/misc/mab.clp | ;;;======================================================
;;; Monkees and Bananas Sample Problem
;;;
;;; This is an extended version of a
;;; rather common AI planning problem.
;;; The point is for the monkee to find
;;; and eat some bananas.
;;;
;;; CLIPS Version 6.0 Example
;;;
;;; To execute, merely load, reset and run.
;;;======================================================
;;;
;;; modified EJFH 4/11/96 for JES Java Expert System
;;; produces identical output under CLIPS
;;;(set-node-index-hash 1)
;;;(set-fact-duplication TRUE)
;;;(set-multithreaded-io TRUE)
;;;(watch facts)
;;;(watch activations)
;;;(watch rules)
(load-package jess.ViewFunctions)
;;;*************
;;;* TEMPLATES *
;;;*************
(deftemplate monkey
(slot location
(default green-couch))
(slot on-top-of
(default floor))
(slot holding
(default nothing)))
(deftemplate thing
(slot name)
(slot location)
(slot on-top-of
(default floor))
(slot weight
(default light)))
(deftemplate chest
(slot name)
(slot contents)
(slot unlocked-by))
(deftemplate goal-is-to
(slot action)
(slot argument-1)
(slot argument-2))
;;;*************************
;;;* CHEST UNLOCKING RULES *
;;;*************************
(defrule hold-chest-to-put-on-floor ""
(goal-is-to (action unlock) (argument-1 ?chest))
(thing (name ?chest) (on-top-of ~floor) (weight light))
(monkey (holding ~?chest))
(not (goal-is-to (action hold) (argument-1 ?chest)))
=>
(assert (goal-is-to (action hold) (argument-1 ?chest))))
(defrule put-chest-on-floor ""
(goal-is-to (action unlock) (argument-1 ?chest))
?monkey <- (monkey (location ?place) (on-top-of ?on) (holding ?chest))
?thing <- (thing (name ?chest))
=>
(printout t "Monkey throws the " ?chest " off the "
?on " onto the floor." crlf)
(modify ?monkey (holding blank))
(modify ?thing (location ?place) (on-top-of floor)))
(defrule get-key-to-unlock ""
(goal-is-to (action unlock) (argument-1 ?obj))
(thing (name ?obj) (on-top-of floor))
(chest (name ?obj) (unlocked-by ?key))
(monkey (holding ~?key))
(not (goal-is-to (action hold) (argument-1 ?key)))
=>
(assert (goal-is-to (action hold) (argument-1 ?key))))
;; one conjunction removed here just by reordering patterns.
(defrule move-to-chest-with-key ""
(goal-is-to (action unlock) (argument-1 ?chest))
(thing (name ?chest) (location ?cplace) (on-top-of floor))
(monkey (location ~?cplace) (holding ?key))
(chest (name ?chest) (unlocked-by ?key))
(not (goal-is-to (action walk-to) (argument-1 ?cplace)))
=>
(assert (goal-is-to (action walk-to) (argument-1 ?cplace))))
(defrule unlock-chest-with-key ""
?goal <- (goal-is-to (action unlock) (argument-1 ?name))
?chest <- (chest (name ?name) (contents ?contents) (unlocked-by ?key))
(thing (name ?name) (location ?place) (on-top-of ?on))
(monkey (location ?place) (on-top-of ?on) (holding ?key))
=>
(printout t "Monkey opens the " ?name " with the " ?key
" revealing the " ?contents "." crlf)
(modify ?chest (contents nothing))
(assert (thing (name ?contents) (location ?place) (on-top-of ?name)))
(retract ?goal))
;;;*********************
;;;* HOLD OBJECT RULES *
;;;*********************
(defrule unlock-chest-to-hold-object ""
(goal-is-to (action hold) (argument-1 ?obj))
(chest (name ?chest) (contents ?obj))
(not (goal-is-to (action unlock) (argument-1 ?chest)))
=>
(assert (goal-is-to (action unlock) (argument-1 ?chest))))
(defrule use-ladder-to-hold ""
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ceiling) (weight light))
(not (thing (name ladder) (location ?place)))
(not (goal-is-to (action move) (argument-1 ladder) (argument-2 ?place)))
=>
(assert (goal-is-to (action move) (argument-1 ladder) (argument-2 ?place))))
(defrule climb-ladder-to-hold ""
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ceiling) (weight light))
(thing (name ladder) (location ?place) (on-top-of floor))
(monkey (on-top-of ~ladder))
(not (goal-is-to (action on) (argument-1 ladder)))
=>
(assert (goal-is-to (action on) (argument-1 ladder))))
(defrule grab-object-from-ladder ""
?goal <- (goal-is-to (action hold) (argument-1 ?name))
?thing <- (thing (name ?name) (location ?place)
(on-top-of ceiling) (weight light))
(thing (name ladder) (location ?place))
?monkey <- (monkey (location ?place) (on-top-of ladder) (holding blank))
=>
(printout t "Monkey grabs the " ?name "." crlf)
(modify ?thing (location held) (on-top-of held))
(modify ?monkey (holding ?name))
(retract ?goal))
(defrule climb-to-hold ""
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place&~ceiling) (on-top-of ?on) (weight light))
(monkey (location ?place) (on-top-of ~?on))
(not (goal-is-to (action on) (argument-1 ?on)))
=>
(assert (goal-is-to (action on) (argument-1 ?on))))
(defrule walk-to-hold ""
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ~ceiling) (weight light))
(monkey (location ~?place))
(not (goal-is-to (action walk-to) (argument-1 ?place)))
=>
(assert (goal-is-to (action walk-to) (argument-1 ?place))))
(defrule drop-to-hold ""
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ?on) (weight light))
(monkey (location ?place) (on-top-of ?on) (holding ~blank))
(not (goal-is-to (action hold) (argument-1 blank)))
=>
(assert (goal-is-to (action hold) (argument-1 blank))))
(defrule grab-object ""
?goal <- (goal-is-to (action hold) (argument-1 ?name))
?thing <- (thing (name ?name) (location ?place)
(on-top-of ?on) (weight light))
?monkey <- (monkey (location ?place) (on-top-of ?on) (holding blank))
=>
(printout t "Monkey grabs the " ?name "." crlf)
(modify ?thing (location held) (on-top-of held))
(modify ?monkey (holding ?name))
(retract ?goal))
(defrule drop-object ""
?goal <- (goal-is-to (action hold) (argument-1 blank))
?monkey <- (monkey (location ?place)
(on-top-of ?on)
(holding ?name&~blank))
?thing <- (thing (name ?name))
=>
(printout t "Monkey drops the " ?name "." crlf)
(modify ?monkey (holding blank))
(modify ?thing (location ?place) (on-top-of ?on))
(retract ?goal))
;;;*********************
;;;* MOVE OBJECT RULES *
;;;*********************
(defrule unlock-chest-to-move-object ""
(goal-is-to (action move) (argument-1 ?obj))
(chest (name ?chest) (contents ?obj))
(not (goal-is-to (action unlock) (argument-1 ?chest)))
=>
(assert (goal-is-to (action unlock) (argument-1 ?chest))))
(defrule hold-object-to-move ""
(goal-is-to (action move) (argument-1 ?obj) (argument-2 ?place))
(thing (name ?obj) (location ~?place) (weight light))
(monkey (holding ~?obj))
(not (goal-is-to (action hold) (argument-1 ?obj)))
=>
(assert (goal-is-to (action hold) (argument-1 ?obj))))
(defrule move-object-to-place ""
(goal-is-to (action move) (argument-1 ?obj) (argument-2 ?place))
(monkey (location ~?place) (holding ?obj))
(not (goal-is-to (action walk-to) (argument-1 ?place)))
=>
(assert (goal-is-to (action walk-to) (argument-1 ?place))))
(defrule drop-object-once-moved ""
?goal <- (goal-is-to (action move) (argument-1 ?name) (argument-2 ?place))
?monkey <- (monkey (location ?place) (holding ?obj))
?thing <- (thing (name ?name) (weight light))
=>
(printout t "Monkey drops the " ?name "." crlf)
(modify ?monkey (holding blank))
(modify ?thing (location ?place) (on-top-of floor))
(retract ?goal))
(defrule already-moved-object ""
?goal <- (goal-is-to (action move) (argument-1 ?obj) (argument-2 ?place))
(thing (name ?obj) (location ?place))
=>
(retract ?goal))
;;;***********************
;;;* WALK TO PLACE RULES *
;;;***********************
(defrule already-at-place ""
?goal <- (goal-is-to (action walk-to) (argument-1 ?place))
(monkey (location ?place))
=>
(retract ?goal))
(defrule get-on-floor-to-walk ""
(goal-is-to (action walk-to) (argument-1 ?place))
(monkey (location ~?place) (on-top-of ~floor))
(not (goal-is-to (action on) (argument-1 floor)))
=>
(assert (goal-is-to (action on) (argument-1 floor))))
(defrule walk-holding-nothing ""
?goal <- (goal-is-to (action walk-to) (argument-1 ?place))
?monkey <- (monkey (location ~?place) (on-top-of floor) (holding blank))
=>
(printout t "Monkey walks to " ?place "." crlf)
(modify ?monkey (location ?place))
(retract ?goal))
(defrule walk-holding-object ""
?goal <- (goal-is-to (action walk-to) (argument-1 ?place))
?monkey <- (monkey (location ~?place) (on-top-of floor) (holding ?obj))
(thing (name ?obj))
=>
(printout t "Monkey walks to " ?place " holding the " ?obj "." crlf)
(modify ?monkey (location ?place))
(retract ?goal))
;;;***********************
;;;* GET ON OBJECT RULES *
;;;***********************
(defrule jump-onto-floor ""
?goal <- (goal-is-to (action on) (argument-1 floor))
?monkey <- (monkey (on-top-of ?on&~floor))
=>
(printout t "Monkey jumps off the " ?on " onto the floor." crlf)
(modify ?monkey (on-top-of floor))
(retract ?goal))
(defrule walk-to-place-to-climb ""
(goal-is-to (action on) (argument-1 ?obj))
(thing (name ?obj) (location ?place))
(monkey (location ~?place))
(not (goal-is-to (action walk-to) (argument-1 ?place)))
=>
(assert (goal-is-to (action walk-to) (argument-1 ?place))))
(defrule drop-to-climb ""
(goal-is-to (action on) (argument-1 ?obj))
(thing (name ?obj) (location ?place))
(monkey (location ?place) (holding ~blank))
(not (goal-is-to (action hold) (argument-1 blank)))
=>
(assert (goal-is-to (action hold) (argument-1 blank))))
(defrule climb-indirectly ""
(goal-is-to (action on) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ?on))
(monkey (location ?place) (on-top-of ~?on&~obj) (holding blank))
(not (goal-is-to (action on) (argument-1 ?on)))
=>
(assert (goal-is-to (action on) (argument-1 ?on))))
(defrule climb-directly ""
?goal <- (goal-is-to (action on) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ?on))
?monkey <- (monkey (location ?place) (on-top-of ?on) (holding blank))
=>
(printout t "Monkey climbs onto the " ?obj "." crlf)
(modify ?monkey (on-top-of ?obj))
(retract ?goal))
(defrule already-on-object ""
?goal <- (goal-is-to (action on) (argument-1 ?obj))
(monkey (on-top-of ?obj))
=>
(retract ?goal))
;;;********************
;;;* EAT OBJECT RULES *
;;;********************
(defrule hold-to-eat ""
(goal-is-to (action eat) (argument-1 ?obj))
(monkey (holding ~?obj))
(not (goal-is-to (action hold) (argument-1 ?obj)))
=>
(assert (goal-is-to (action hold) (argument-1 ?obj))))
(defrule satisfy-hunger ""
?goal <- (goal-is-to (action eat) (argument-1 ?name))
?monkey <- (monkey (holding ?name))
?thing <- (thing (name ?name))
=>
(printout t "Monkey eats the " ?name "." crlf)
(modify ?monkey (holding blank))
(retract ?goal ?thing))
;;;**********************
;;;* INITIAL STATE RULE *
;;;**********************
(defrule startup ""
=>
(assert (monkey (location t5-7) (on-top-of green-couch) (holding blank)))
(assert (thing (name green-couch) (location t5-7) (weight heavy)))
(assert (thing (name red-couch) (location t2-2) (weight heavy)))
(assert (thing (name big-pillow) (location t2-2) (on-top-of red-couch)))
(assert (thing (name red-chest) (location t2-2) (on-top-of big-pillow)))
(assert (chest (name red-chest) (contents ladder) (unlocked-by red-key)))
(assert (thing (name blue-chest) (location t7-7) (on-top-of ceiling)))
(assert (thing (name grapes) (location t7-8) (on-top-of ceiling)))
(assert (chest (name blue-chest) (contents bananas) (unlocked-by blue-key)))
(assert (thing (name blue-couch) (location t8-8) (weight heavy)))
(assert (thing (name green-chest) (location t8-8) (on-top-of ceiling)))
(assert (chest (name green-chest) (contents blue-key) (unlocked-by red-key)))
(assert (thing (name red-key) (location t1-3)))
(assert (goal-is-to (action eat) (argument-1 bananas)))
)
(defglobal ?*time* = (time))
(set-reset-globals FALSE)
(deffunction run-mab (?n)
(bind ?start (time))
(while (> ?n 0) do
(reset)
(run)
(bind ?n (- ?n 1)))
(printout t "Elapsed time: "
(- (time) ?start) crlf))
(deffunction walk ()
(run 1)
(facts)
(agenda))
;(reset)
;(run)
;;(run-n-times 256)
;;(run-n-times 1)
;;(printout t "Elapsed time: " (integer (- (time) ?*time*)) crlf)
| 12,853 | Common Lisp | .cl | 336 | 34.89881 | 79 | 0.61751 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 7c57cb2d477470d174f4b0647d7793b1ff69a337a8c0e35f4c165f90117c6f39 | 9,847 | [
-1
] |
9,851 | make-release | Ramarren_lisa/bin/make-release | #!/bin/sh
# This file is part of LISA, the Lisp-based Intelligent Software
# Agents platform.
# Copyright (C) 2000 David E. Young ([email protected])
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# File: make-release
# Description: Trivial script to help make LISA releases.
# $Id: make-release,v 1.7 2004/09/17 19:29:36 youngde Exp $
ROOT=${LISA_ROOT:-/c/development/lisa}
FASL_FILES="*.fasl *.ufsl *.x86f *.err *.fas *.lib"
remove_fasl ()
{
find -name "*.fasl" -o -name "*.ufsl" -o -name "*.x86f" -o -name\
"*.err" -o -name "*.fas" -o -name "*.fsl" -o -name "*.lib" | xargs rm -f
}
cd $ROOT/lib
remove_fasl
cd $ROOT/contrib/clocc
remove_fasl
cd $ROOT/..
tar czvf distributions/lisa.tgz --exclude CVS --exclude zebu-3.5.5 lisa
zip -r -v distributions/lisa lisa -x \*CVS\* \*zebu-3.5.5\*
| 1,490 | Common Lisp | .l | 32 | 44.84375 | 80 | 0.728404 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 502d3139e7e34274403769888b2a9cc5b16aa204365ed5b34660a0abc1b2d39c | 9,851 | [
-1
] |
9,921 | lgpl.txt | Ramarren_lisa/misc/lgpl.txt | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File:
;;; Description:
;;; $Id: lgpl.txt,v 1.2 2004/09/14 14:55:34 youngde Exp $
| 960 | Common Lisp | .l | 17 | 55.117647 | 79 | 0.744931 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 7487713920921f68aff9b86682818e49dd3814d6ee17a0c884780b72fd0e6396 | 9,921 | [
-1
] |
9,923 | lispwire-template | Ramarren_lisa/doc/lispwire-template | << $Id: lispwire-template,v 1.1 2005/07/08 17:07:55 youngde Exp $ >>
<< Instructions in this template appear in comments like this. You
can leave them in your entry or remove them. It is up to you.
They are ignored by the entry processing program.
INSTRUCTIONS FOR FILLING IN THIS TEMPLATE
A bit about the formatting is this file, which is somewhat like the
markup language that some wiki's use.
* Please leave the section headers (== foo ==) as they are.
* Paragraphs should not be indented.
* Examples should be indented 2 spaces. They will be put into an HTML
`pre' and will appear verbatim.
* No HTML is allowed. All occurances of < and > will be escaped.
* Links in your text can be described like this:
href(name of link,http://...)
* Emails in text can be specified as mailto([email protected]) so they
appear as links on the site.
* Bold and italic are accomplished with bold(text) and italic(text).
* Lists of items are accomplished with a ``* '', with no indentation
before the first and subsequent lines. This sentence is in a valid
list item.
Each section for an entry starts with ``== ... ==''. The first
comment inside each section gives a description of the type of text
you should enter for that section. The first part of this comment has
the form:
TYPE: <type>
where <type> will vary from section to section. Here are the valid
types and the format for each:
type description
---- -----------
plain-text Plain text.
wml `wml' stands for `wiki-like markup language'.
Sections of this type can use href(), mailto(),
bold(), italic(), `* ' lists, and use indentation to
distinguish from paragraphs and examples.
url a fully formed and valid URL
urls a list of URLs, one per line
date a date (currently any format will do)
version a version (currently any format will do)
>>
<< ******************************************************************* >>
<< ********* ENTRY STARTS HERE *************************************** >>
<< ******************************************************************* >>
== lispwire-entry ==
<< The name of your entry. Anything from one word to a few is OK.
The name can contain spaces, too.
TYPE: plain-text >>
Lisa
== category ==
<< Looking at the menu on the left of lispwire.com, which one would
you say best describes your entry, or should we make a new entry?
If we should make a new menu entry for your application, what would
you suggest it be?
TYPE: plain-text >>
Artificial Intelligence -> Production Systems
== author ==
<< Descriptive text about the author(s). Use the mailto() macro to
specify an email address.
TYPE: wml >>
David E. Young (mailto([email protected]))
== author-image ==
<< If there is a url with your favorite picture, please include it here,
otherwise send it to us via email. If there is more than one
author, you can send us multiple links.
TYPE: url >>
== short-description ==
<< A short description, 3 or 4 sentences long at the most. This
description will appear on index pages of applications, which is
why it needs to be short and concise.
TYPE: wml >>
Lisa is a production rule system for Common Lisp. Its purpose is to
provide a foundation for the development of intelligent
applications. Lisa employs a CLOS implementation of Rete and is based
on CLIPS and Jess.
== long-description ==
<< A long description of your entry. Keep in mind this is probably
the first thing potential users of your application will read.
TYPE: wml >>
Lisa is a production-rule system implemented in the Common Lisp Object
System (CLOS), and is heavily influenced by CLIPS and the Java Expert
System Shell (JESS). At its core is a reasoning engine based on an
object-oriented implementation of the Rete algorithm, a very efficient
mechanism for solving the difficult many-to-many matching problem
("Rete: A Fast Algorithm for the Many Pattern/Many Object Pattern
Match Problem", Charles L. Forgy, Artificial Intelligence 19(1982),
17-37.) Intrinsic to Lisa is the ability to reason over CLOS objects
without imposing special class hierarchy requirements; thus it should
be possible to easily augment existing CLOS applications with
reasoning capabilities. As Lisa is an extension to Common Lisp, the
full power of the Lisp environment is always available. Lisa-enabled
applications should run on any ANSI-compliant Common Lisp platform.
<< Further details may be found at the project href(home page,http:lisa.sf.net). >>
== examples ==
<< Some examples of your code in action; they need not be
self-contained, just code segments that show the power of your
code. The more examples the better. These will likely be the
first example uses new users of your code will see. Wow them!
TYPE: wml >>
Here is a solution to the classic Monkey and Bananas problem
implemented in Lisa:
(lisa:consider-taxonomy)
(defclass mab-fundamental () ())
(defclass monkey (mab-fundamental)
((location :initarg :location
:initform 'green-couch)
(on-top-of :initarg :on-top-of
:initform 'floor)
(satisfied :initarg :satisfied
:initform nil)
(holding :initarg :holding
:initform 'nothing)))
(defclass thing (mab-fundamental)
((name :initarg :name)
(location :initarg :location)
(on-top-of :initarg :on-top-of
:initform 'floor)
(weight :initarg :weight
:initform 'light)))
(defclass chest (mab-fundamental)
((name :initarg :name)
(contents :initarg :contents)
(unlocked-by :initarg :unlocked-by)))
(defclass goal-is-to (mab-fundamental)
((action :initarg :action)
(argument-1 :initarg :argument-1)
(argument-2 :initarg :argument-2
:initform nil)))
;;;(watch :activations)
;;;(watch :facts)
;;;(watch :rules)
;;; Chest-unlocking rules...
(defrule hold-chest-to-put-on-floor ()
(goal-is-to (action unlock) (argument-1 ?chest))
(thing (name ?chest) (on-top-of (not floor)) (weight light))
(monkey (holding (not ?chest)))
(not (goal-is-to (action hold) (argument-1 ?chest)))
=>
(assert ((make-instance 'goal-is-to :action 'hold :argument-1 ?chest))))
(defrule put-chest-on-floor ()
(goal-is-to (action unlock) (argument-1 ?chest))
(?monkey (monkey (location ?place) (on-top-of ?on) (holding ?chest)))
(?thing (thing (name ?chest)))
=>
(format t "Monkey throws the ~A off the ~A onto the floor.~%" ?chest ?on)
(modify ?monkey (holding blank))
(modify ?thing (location ?place) (on-top-of floor)))
(defrule get-key-to-unlock ()
(goal-is-to (action unlock) (argument-1 ?obj))
(thing (name ?obj) (on-top-of floor))
(chest (name ?obj) (unlocked-by ?key))
(monkey (holding (not ?key)))
(not (goal-is-to (action hold) (argument-1 ?key)))
=>
(assert ((make-instance 'goal-is-to :action 'hold :argument-1 ?key))))
(defrule move-to-chest-with-key ()
(goal-is-to (action unlock) (argument-1 ?chest))
(thing (name ?chest) (location ?cplace) (on-top-of floor))
(monkey (location (not ?cplace)) (holding ?key))
(chest (name ?chest) (unlocked-by ?key))
(not (goal-is-to (action walk-to) (argument-1 ?cplace)))
=>
(assert ((make-instance 'goal-is-to :action 'walk-to :argument-1 ?cplace))))
(defrule unlock-chest-with-key ()
(?goal (goal-is-to (action unlock) (argument-1 ?name)))
(?chest (chest (name ?name) (contents ?contents) (unlocked-by ?key)))
(thing (name ?name) (location ?place) (on-top-of ?on))
(monkey (location ?place) (on-top-of ?on) (holding ?key))
=>
(format t "Monkey opens the ~A with the ~A revealing the ~A.~%"
?name ?key ?contents)
(modify ?chest (contents nothing))
(assert ((make-instance 'thing :name ?contents :location ?place
:weight 'light :on-top-of ?name)))
(retract ?goal))
;;; Hold-object rules...
(defrule unlock-chest-to-hold-object ()
(goal-is-to (action hold) (argument-1 ?obj))
(chest (name ?chest) (contents ?obj))
(not (goal-is-to (action unlock) (argument-1 ?chest)))
=>
(assert ((make-instance 'goal-is-to :action 'unlock :argument-1 ?chest))))
(defrule use-ladder-to-hold ()
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ceiling) (weight light))
(not (thing (name ladder) (location ?place)))
(not (goal-is-to (action move) (argument-1 ladder) (argument-2 ?place)))
=>
(assert ((make-instance 'goal-is-to :action 'move
:argument-1 'ladder
:argument-2 ?place))))
(defrule climb-ladder-to-hold ()
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ceiling) (weight light))
(thing (name ladder) (location ?place) (on-top-of floor))
(monkey (on-top-of (not ladder)))
(not (goal-is-to (action on) (argument-1 ladder)))
=>
(assert ((make-instance 'goal-is-to :action 'on :argument-1 'ladder))))
(defrule grab-object-from-ladder ()
(?goal (goal-is-to (action hold) (argument-1 ?name)))
(?thing (thing (name ?name) (location ?place)
(on-top-of ceiling) (weight light)))
(thing (name ladder) (location ?place))
(?monkey (monkey (location ?place) (on-top-of ladder) (holding blank)))
=>
(format t "Monkey grabs the ~A.~%" ?name)
(modify ?thing (location held) (on-top-of held))
(modify ?monkey (holding ?name))
(retract ?goal))
(defrule climb-to-hold ()
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place (not ceiling))
(on-top-of ?on) (weight light))
(monkey (location ?place) (on-top-of (not ?on)))
(not (goal-is-to (action on) (argument-1 ?on)))
=>
(assert ((make-instance 'goal-is-to :action 'on :argument-1 ?on))))
(defrule walk-to-hold ()
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of (not ceiling))
(weight light))
(monkey (location (not ?place)))
(not (goal-is-to (action walk-to) (argument-1 ?place)))
=>
(assert ((make-instance 'goal-is-to :action 'walk-to :argument-1 ?place))))
(defrule drop-to-hold ()
(goal-is-to (action hold) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ?on) (weight light))
(monkey (location ?place) (on-top-of ?on) (holding (not blank)))
(not (goal-is-to (action hold) (argument-1 blank)))
=>
(assert ((make-instance 'goal-is-to :action 'hold :argument-1 'blank))))
(defrule grab-object ()
(?goal (goal-is-to (action hold) (argument-1 ?name)))
(?thing (thing (name ?name) (location ?place)
(on-top-of ?on) (weight light)))
(?monkey (monkey (location ?place) (on-top-of ?on) (holding blank)))
=>
(format t "Monkey grabs the ~A.~%" ?name)
(modify ?thing (location held) (on-top-of held))
(modify ?monkey (holding ?name))
(retract ?goal))
(defrule drop-object ()
(?goal (goal-is-to (action hold) (argument-1 blank)))
(?monkey (monkey (location ?place) (on-top-of ?on)
(holding ?name (not blank))))
(?thing (thing (name ?name)))
=>
(format t "Monkey drops the ~A.~%" ?name)
(modify ?monkey (holding blank))
(modify ?thing (location ?place) (on-top-of ?on))
(retract ?goal))
;;; Move-object rules...
(defrule unlock-chest-to-move-object ()
(goal-is-to (action move) (argument-1 ?obj))
(chest (name ?chest) (contents ?obj))
(not (goal-is-to (action unlock) (argument-1 ?chest)))
=>
(assert ((make-instance 'goal-is-to :action 'unlock :argument-1 ?chest))))
(defrule hold-object-to-move ()
(goal-is-to (action move) (argument-1 ?obj) (argument-2 ?place))
(thing (name ?obj) (location (not ?place)) (weight light))
(monkey (holding (not ?obj)))
(not (goal-is-to (action hold) (argument-1 ?obj)))
=>
(assert ((make-instance 'goal-is-to :action 'hold :argument-1 ?obj))))
(defrule move-object-to-place ()
(goal-is-to (action move) (argument-1 ?obj) (argument-2 ?place))
(monkey (location (not ?place)) (holding ?obj))
(not (goal-is-to (action walk-to) (argument-1 ?place)))
=>
(assert ((make-instance 'goal-is-to :action 'walk-to :argument-1 ?place))))
(defrule drop-object-once-moved ()
(?goal (goal-is-to (action move) (argument-1 ?name) (argument-2 ?place)))
(?monkey (monkey (location ?place) (holding ?obj)))
(?thing (thing (name ?name) (weight light)))
=>
(format t "Monkey drops the ~A.~%" ?name)
(modify ?monkey (holding blank))
(modify ?thing (location ?place) (on-top-of floor))
(retract ?goal))
(defrule already-moved-object ()
(?goal (goal-is-to (action move) (argument-1 ?obj) (argument-2 ?place)))
(thing (name ?obj) (location ?place))
=>
(retract ?goal))
;;; Walk-to-place rules...
(defrule already-at-place ()
(?goal (goal-is-to (action walk-to) (argument-1 ?place)))
(monkey (location ?place))
=>
(retract ?goal))
(defrule get-on-floor-to-walk ()
(goal-is-to (action walk-to) (argument-1 ?place))
(monkey (location (not ?place)) (on-top-of (not floor)))
(not (goal-is-to (action on) (argument-1 floor)))
=>
(assert ((make-instance 'goal-is-to :action 'on :argument-1 'floor))))
(defrule walk-holding-nothing ()
(?goal (goal-is-to (action walk-to) (argument-1 ?place)))
(?monkey (monkey (location (not ?place)) (on-top-of floor) (holding blank)))
=>
(format t "Monkey walks to ~A.~%" ?place)
(modify ?monkey (location ?place))
(retract ?goal))
(defrule walk-holding-object ()
(?goal (goal-is-to (action walk-to) (argument-1 ?place)))
(?monkey (monkey (location (not ?place)) (on-top-of floor) (holding ?obj)))
(thing (name ?obj))
=>
(format t "Monkey walks to ~A holding the ~A.~%" ?place ?obj)
(modify ?monkey (location ?place))
(retract ?goal))
;;; Get-on-object rules...
(defrule jump-onto-floor ()
(?goal (goal-is-to (action on) (argument-1 floor)))
(?monkey (monkey (on-top-of ?on (not floor))))
=>
(format t "Monkey jumps off the ~A onto the floor.~%" ?on)
(modify ?monkey (on-top-of floor))
(retract ?goal))
(defrule walk-to-place-to-climb ()
(goal-is-to (action on) (argument-1 ?obj))
(thing (name ?obj) (location ?place))
(monkey (location (not ?place)))
(not (goal-is-to (action walk-to) (argument-1 ?place)))
=>
(assert ((make-instance 'goal-is-to :action 'walk-to :argument-1 ?place))))
(defrule drop-to-climb ()
(goal-is-to (action on) (argument-1 ?obj))
(thing (name ?obj) (location ?place))
(monkey (location ?place) (holding (not blank)))
(not (goal-is-to (action hold) (argument-1 blank)))
=>
(assert ((make-instance 'goal-is-to :action 'hold :argument-1 'blank))))
(defrule climb-indirectly ()
(goal-is-to (action on) (argument-1 ?obj))
(thing (name ?obj) (location ?place) (on-top-of ?on))
(monkey (location ?place) (on-top-of ?top
(and (not (eq ?top ?on))
(not (eq ?top ?obj))))
(holding blank))
(not (goal-is-to (action on) (argument-1 ?on)))
=>
(assert ((make-instance 'goal-is-to :action 'on :argument-1 ?on))))
(defrule climb-directly ()
(?goal (goal-is-to (action on) (argument-1 ?obj)))
(thing (name ?obj) (location ?place) (on-top-of ?on))
(?monkey (monkey (location ?place) (on-top-of ?on) (holding blank)))
=>
(format t "Monkey climbs onto the ~A.~%" ?obj)
(modify ?monkey (on-top-of ?obj))
(retract ?goal))
(defrule already-on-object ()
(?goal (goal-is-to (action on) (argument-1 ?obj)))
(monkey (on-top-of ?obj))
=>
(retract ?goal))
;;; Eat-object rules...
(defrule hold-to-eat ()
(goal-is-to (action eat) (argument-1 ?obj))
(monkey (holding (not ?obj)))
(not (goal-is-to (action hold) (argument-1 ?obj)))
=>
(assert ((make-instance 'goal-is-to :action 'hold :argument-1 ?obj))))
(defrule satisfy-hunger ()
(?goal (goal-is-to (action eat) (argument-1 ?name)))
(?monkey (monkey (holding ?name)))
(?thing (thing (name ?name)))
=>
(format t "Monkey eats the ~A.~%" ?name)
(modify ?monkey (holding blank) (satisfied t))
(retract ?goal)
(retract ?thing))
(defrule monkey-is-satisfied ()
(monkey (satisfied t) (:object ?monkey))
=>
(format t "Monkey is satisfied: ~S~%" ?monkey))
;;; Retract every object whose ancestor is an instance of MAB-FUNDAMENTAL...
(defrule cleanup (:salience -100)
(?fact (mab-fundamental))
=>
(retract ?fact))
;;; startup rule...
(defrule startup ()
=>
(assert
((make-instance 'monkey :location 't5-7
:on-top-of 'green-couch
:location 'green-couch
:holding 'blank)))
(assert
((make-instance 'thing :name 'green-couch
:location 't5-7
:weight 'heavy
:on-top-of 'floor)))
(assert
((make-instance 'thing :name 'red-couch
:location 't2-2
:weight 'heavy
:on-top-of 'floor)))
(assert
((make-instance 'thing :name 'big-pillow
:location 't2-2
:weight 'light
:on-top-of 'red-couch)))
(assert
((make-instance 'thing :name 'red-chest
:location 't2-2
:weight 'light
:on-top-of 'big-pillow)))
(assert
((make-instance 'chest :name 'red-chest
:contents 'ladder
:unlocked-by 'red-key)))
(assert
((make-instance 'thing :name 'blue-chest
:location 't7-7
:weight 'light
:on-top-of 'ceiling)))
(assert
((make-instance 'thing :name 'grapes
:location 't7-8
:weight 'light
:on-top-of 'ceiling)))
(assert
((make-instance 'chest :name 'blue-chest
:contents 'bananas
:unlocked-by 'blue-key)))
(assert
((make-instance 'thing :name 'blue-couch
:location 't8-8
:weight 'heavy
:on-top-of 'floor)))
(assert
((make-instance 'thing :name 'green-chest
:location 't8-8
:weight 'light
:on-top-of 'ceiling)))
(assert
((make-instance 'chest :name 'green-chest
:contents 'blue-key
:unlocked-by 'red-key)))
(assert
((make-instance 'thing :name 'red-key
:location 't1-3
:weight 'light
:on-top-of 'floor)))
(assert
((make-instance 'goal-is-to :action 'eat
:argument-1 'bananas))))
== instructions ==
<< Instructions on how to load and use your code. We encourage everyone
to have a file called "load.cl" that loads their project.
TYPE: wml >>
Load the file lisa-root:install.lisp, where 'lisa-root' is the
location of your Lisa distribution.
== tutorial ==
<< A tutorial of how to do simple to complex things; intermix code and
description. A comprehensive tutorial is strongly recommended.
Remember, example text is indented, explanatory text is not.
TYPE: wml >>
The most authoritative source for Lisa is the Reference Guide, which may
be found either in the distribution or href(here,http://lisa.sourceforge.net/ref-guide.html).
== home-url ==
<< The URL of the home page for your project. In some cases this will
be empty. Just list the URL without using the href() macro.
TYPE: url >>
http://lisa.sf.net
== doc-url ==
<< The URLs to your documentation -- just list the URLs one per line,
without using the href() macro.
TYPE: urls >>
http://lisa.sf.net/ref-guide.html
== license ==
<< If you have a specific license for the code, include the URL here.
If not, and you want it to be public domain, specify that here
too.
TYPE: wml >>
LGPL
== book ==
<< If there are books that are relevant to the audience of your
program, list them here. Please include the title and
book URL (to amazon.com or some other site).
Recommended syntax is one "paragraph" per book (with no
indentation):
href(book title,http://...) by author. descriptive text...
more text...
TYPE: wml >>
== references ==
<< Include text which would be of interest to readers wishing to dive
deeper into the subject of your application.
TYPE: wml >>
== source-fooball ==
<< The URL where the source code can be obtained, or some description
of the status of obtaining source code.
TYPE: wml >>
Lisa source distributions are available href(here,http://sourceforge.net/projects/lisa).
== release-date ==
<< Specify the date of the current release.
TYPE: date >>
4/4/2005
== release-version ==
<< Specify the version of the current release.
TYPE: version >>
2.1
== status ==
<< One of: alpha, beta or stable. You may also include descriptive
text relevant to the status of the current version.
TYPE: wml >>
stable
== history ==
<< Any relevant version history.
TYPE: wml >>
== acl-dependencies ==
<< Include here a description of dependencies on particlar versions of
ACL.
TYPE: wml >>
== other-dependencies ==
<< Include here a description of dependencies on other software; for
example, if the software relies on another package (e.g.,
AllegroServe) to run, say that here. Also, if a specific operating
system package (i.e., rpm package) is needed specify it here.
TYPE: wml >>
== platform ==
<< If the software runs only on specific platforms for this software,
include that information here.
TYPE: wml >>
Lisa is known to run on Lispworks, Allegro, CLISP, SBCL, CMUCL (19a),
and ABCL. There are no operating system dependencies.
== ad ==
<< IGNORE -- this is an internal field. >>
| 21,591 | Common Lisp | .l | 531 | 36.190207 | 93 | 0.656159 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 3bc0a182c912cc685e6ef18cec07352924b434e52634967b8abaa72653b71e6b | 9,923 | [
-1
] |
9,924 | auto-notify.html | Ramarren_lisa/doc/auto-notify.html | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>LISA 2</title>
</head>
<body background="hierarchy-background.gif">
<h1>LISA 2.0</h1>
<h3>5 December, 2002</h3>
<h3>Auto Notification</h3>
<p>For Common Lisps with complete, or mostly complete, MOP implementations, LISA
offers an experimental feature called “auto notification”. This mechanism
may be used to monitor changes to CLOS instances in working memory that occur
outside of LISA (i.e. somewhere else in the application, and not via the <i>modify</i>
macro). Normally, LISA must be explicitly told about these changes via the
function <i>lisa:mark-instance-as-changed</i>; when an application alters the
contents of an instance’s slots, it informs LISA about the changes so the
inference engine can maintain the consistency of working memory. Auto
Notification obviates this requirement; LISA hooks into the MOP slot access
protocol and notices slot changes without application intervention. Like just
about anything worthwhile, however, the benefits of this feature come at a small
price. Any user-defined class participating in Auto Notification must, at a
minimum, have as its metaclass <i>lisa:standard-kb-class</i>. For example:</p>
<dl>
<dd>(defclass frodo ()<br>
((name :accessor frodo-name))<br>
(:metaclass lisa:standard-kb-class))</dd>
</dl>
<p>There may also be implementation-specific needs that further constrain users
of Auto Notification. In general, however, the use of the aforementioned
metaclass is all that’s required.</p>
<p>As of this writing, Auto Notification has been tested with Allegro Common
Lisp 6.2 and Lispworks 4.2. CLISP does not have a MOP implementation of
sufficient depth, and I have not yet attempted a version for CMUCL (I would
welcome a submission). Regarding the two commercial Common Lisps supported by
LISA, their implementations of Auto Notification are described below, listing
any additional requirements beyond the use of <i>lisa:standard-kb-class</i>.</p>
<h3>ACL 6.2</h3>
<p>LISA implements Auto Notification for Allegro by adding an <i>around</i>
method on <i>make-instance</i>, and an <i>after</i> method on <i>(setf
slot-value-using-class)</i>. Whether an application alters a slot via its writer
method or a direct invocation of <i>(setf slot-value)</i>, LISA notices the
change and reacts accordingly. Note carefully, however, that I’ve only tested
this with the default compiler optimization settings, under version 6.2. Due to
my experience with Lispworks (see below), it remains to be seen whether the
current implementation for ACL will hold.</p>
<h3>Lispworks 4.2</h3>
<p><span style="font-size:12.0pt;font-family:"Times New Roman";mso-fareast-font-family:
"Times New Roman";mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA">Auto Notification for Lispworks is a bit more
complicated than the ACL version, because the Lispworks compiler appears to
optimize methods containing calls to <i>slot-value</i>, such that the standard
MOP slot access protocol is bypassed. Therefore, the implementation used for ACL
won’t work here. Instead, LISA must iterate through the writer methods of all
classes whose metaclass is <i>lisa:standard-kb-class</i> and attach special <i>after</i>
methods on their generic functions; these special methods respond to slot
changes and notify LISA accordingly. To create these methods, LISA installs an <i>after
</i>method on <i>initialize-instance</i>, specialized on <i>lisa:standard-kb-class</i>,
that does most of the work. <b>As a result, applications wishing to use Auto
Notification with Lispworks must ensure that all class slots that might be
referenced by rules have corresponding writer methods</b>. Altering a slot’s
contents by direct calls to <i>(setf slot-value)</i> will bypass Auto
Notification and corrupt the inference engine’s working memory. This
constraint is in addition to the metaclass requirement described previously.</span></p>
</body>
</html>
| 4,223 | Common Lisp | .l | 67 | 60.731343 | 98 | 0.778582 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | b152b9b5edd5cc56a03f0c19f99787d1e0595b9163021ebc6f3b2d8680cec2fc | 9,924 | [
-1
] |
9,925 | RELNOTES.html | Ramarren_lisa/doc/RELNOTES.html | <html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./RELNOTES_files/filelist.xml">
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>dyoung</o:Author>
<o:Template>Normal</o:Template>
<o:LastAuthor>dyoung</o:LastAuthor>
<o:Revision>11</o:Revision>
<o:TotalTime>9</o:TotalTime>
<o:Created>2002-12-09T15:39:00Z</o:Created>
<o:LastSaved>2003-05-28T15:08:00Z</o:LastSaved>
<o:Pages>3</o:Pages>
<o:Words>1429</o:Words>
<o:Characters>8148</o:Characters>
<o:Company>Bloodhound Software</o:Company>
<o:Lines>67</o:Lines>
<o:Paragraphs>16</o:Paragraphs>
<o:CharactersWithSpaces>10006</o:CharactersWithSpaces>
<o:Version>9.2720</o:Version>
</o:DocumentProperties>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;
mso-font-charset:2;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:0 268435456 0 0 -2147483648 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p
{margin-right:0in;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:34815586;
mso-list-type:hybrid;
mso-list-template-ids:-323427016 1054215498 1368262122 819783640 -64555038 1656262036 152204388 -1414908664 -695537064 -1326811476;}
@list l1
{mso-list-id:1098066236;
mso-list-type:hybrid;
mso-list-template-ids:734288032 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:39.0pt;
mso-level-number-position:left;
margin-left:39.0pt;
text-indent:-.25in;
font-family:Symbol;}
@list l2
{mso-list-id:1564102393;
mso-list-type:hybrid;
mso-list-template-ids:-546437862 -147955702 -272235756 -2034235302 -894803028 723663212 1667431092 1964310150 -239309534 1271685704;}
@list l2:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l3
{mso-list-id:1716925823;
mso-list-type:hybrid;
mso-list-template-ids:-48354470 -1489309010 -1911512280 -1003878558 2101673534 701285742 -1678868880 637073842 -993629572 -1680183246;}
@list l3:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l4
{mso-list-id:1873879823;
mso-list-type:hybrid;
mso-list-template-ids:1970329758 -1586055644 332586568 875984248 478441260 1296968498 -2061364318 -1850698708 -317555522 166462850;}
@list l4:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1027"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor=white background=hierarchy-background.gif lang=EN-US
style='tab-interval:.5in'>
<div class=Section1>
<h1>Release Notes for LISA 2.0</h1>
<h2>The LISA Project</h2>
<h3>28 May, 2003</h3>
<p>Release 2.0.4, a bug-fix release that mostly addresses some minor
irritations with the debugger:</p>
<p style='margin-left:39.0pt;text-indent:-.25in;mso-list:l1 level1 lfo13;
tab-stops:list 39.0pt'><![if !supportLists]><span style='font-family:Symbol'>·<span
style='font:7.0pt "Times New Roman"'>
</span></span><![endif]>It is no longer necessary to supply a fully qualified
rule name when manipulating break points; Lisa is now smart enough to figure
this out.</p>
<p style='margin-left:39.0pt;text-indent:-.25in;mso-list:l1 level1 lfo13;
tab-stops:list 39.0pt'><![if !supportLists]><span style='font-family:Symbol'>·<span
style='font:7.0pt "Times New Roman"'>
</span></span><![endif]>Interaction with the debugger when running the LispWorks
IDE is now sane.</p>
<p style='margin-left:39.0pt;text-indent:-.25in;mso-list:l1 level1 lfo13;
tab-stops:list 39.0pt'><![if !supportLists]><span style='font-family:Symbol'>·<span
style='font:7.0pt "Times New Roman"'>
</span></span><![endif]>Tokens are now displayed correctly.</p>
<p style='margin-left:3.0pt'>Thanks to Yarden Katz for getting me to look at
these issues.</p>
<p style='margin-left:3.0pt'>The short-hand version of REQUIRE (e.g. (require “lisa-debugger”))
now works in LispWorks.</p>
<h3>19 December, 2002</h3>
<p>Release 2.0.3, a bug-fix release that corrects a problem with queries.
Thanks to Push Singh for the report. For Allegro users, there’s also a sample
RPC applications that illustrates reasoning with remote objects. Look in the
“misc” folder for details.</p>
<h3>10 December, 2002</h3>
<p>Release 2.0.2, another bug-fix release that introduces a proper fix for the
incomplete fix found in 2.0.1. The caveat regarding RESET no longer applies.
Sigh… I apologize for this; there are a number of large trees sitting in my
home, placed there by our recent ice storm, and I should have known better than
to make a release under these circumstances.</p>
<h3>9 December, 2002</h3>
<p>Release 2.0.1, a bug-fix release to correct a problem reported in the Rete
network that prevented rules such as the following from activating:</p>
<p style='margin-right:.5in;margin-left:.5in'>(defrule frodo ()<br>
(?a (relation))<br>
(?b (relation))<br>
(test (not (eq ?a ?b)))<br>
=>)</p>
<p>As a consequence, there's a semantic change. If the first two patterns of a
rule have the same class (i.e. are matching the same template or class name),
then a RESET must have been issued prior to running the engine.</p>
<h3>9 December, 2002</h3>
<p>The first production release for LISA 2.0. One major new feature, and some
small enhancements:</p>
<ul type=disc>
<li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
mso-list:l4 level1 lfo3;tab-stops:list .5in'>Auto Notification (AN), a
mechanism used to monitor changes to CLOS instances in working memory that
occur outside of LISA (i.e. somewhere else in the application). Normally,
LISA must be explicitly told about these changes via the function <i>lisa:mark-instance-as-changed</i>;
when an application alters the contents of an instance’s slots, it must
inform LISA about the changes so the inference engine can maintain the
consistency of working memory. Auto Notification obviates this requirement;
LISA hooks into the MOP slot access protocol and notices slot changes
without application intervention. This is an experimental feature, and
requires a Common Lisp with a robust MOP implementation. As of this
writing, only Allegro (6.2) and LispWorks (4.2) are supported [note that
earlier versions of ACL and LW will probably also work; I just haven't
tested AN with anything else]. AN for CLISP will <i>not</i> be available
until CLISP's MOP is more complete; AN for CMUCL is also not supported as
I don't have ready access to a platform that runs CMUCL. There's more on
Auto Notification in the reference guide.</li>
<li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
mso-list:l4 level1 lfo3;tab-stops:list .5in'>Both <i>assert-instance</i>
and <i>retract-instance</i>, deprecated in 2.0b2, have been
"undeprecated". I've also added the #? dispatch macro character to
offer yet another way to add CLOS instances to working memory via <i>assert</i>.
See the documentation for <i>assert</i> in the reference guide.</li>
</ul>
<h3>25 November, 2002</h3>
<p>The third beta release for 2.0 further extends LISA's capabilities. New to
this version:</p>
<ul type=disc>
<li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
mso-list:l3 level1 lfo6;tab-stops:list .5in'>Contexts, a mechanism for
partitioning a knowledge base into distinct collections of related rules,
each with its own agenda and conflict set. Contexts are similar to Jess
and CLIPS modules.</li>
<li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
mso-list:l3 level1 lfo6;tab-stops:list .5in'>The EXISTS conditional
element.</li>
<li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
mso-list:l3 level1 lfo6;tab-stops:list .5in'>Duplicate fact detection.
LISA now offers the option of performing duplicate detection during fact
assertion, bringing its behavior more in line with CLIPS and Jess.</li>
<li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
mso-list:l3 level1 lfo6;tab-stops:list .5in'>Some new
"introspection" functions in the API.</li>
</ul>
<p>Unless bugs are reported, 2.0b3 will be released again as the official 2.0 production
version, probably with an additional experimental feature yet to be revealed.
See the Reference Guide for details on the new features.</p>
<h3>18 November, 2002</h3>
<p>The second beta release for 2.0, 2.0b2, offers a number of significant
enhancements. Some of these might break existing code:</p>
<ul type=disc>
<li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
mso-list:l2 level1 lfo9;tab-stops:list .5in'>Truth maintenance has been
completed. Negated patterns are now allowed within LOGICAL forms, lifting
the restriction imposed by the initial TMS implementation. Beware removing
or redefining rules that have active logical dependencies, however; this
is not (yet) supported. Also, there are restrictions on where the LOGICAL
operator may appear within a DEFRULE form. See the Reference Guide for
details.</li>
<li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
mso-list:l2 level1 lfo9;tab-stops:list .5in'>The ASSERT and RETRACT macros
now operate on both template and CLOS instances. ASSERT-INSTANCE and
RETRACT-INSTANCE have been deprecated.</li>
<li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
mso-list:l2 level1 lfo9;tab-stops:list .5in'>The last remaining (known)
concurrency issues have been addressed. As a side effect, LISA delays
validating asserted facts (i.e. looking for their meta data) until
assertion time. To assist developers, LISA will signal a continuable error
if an attempt is made to assert a template fact that was not previously
defined.</li>
<li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
mso-list:l2 level1 lfo9;tab-stops:list .5in'>DEFIMPORT is no longer
required. And indeed, its semantics have changed. If a class is either
defined in, or imported into, a package of rules, then LISA will discover
it automatically upon assertion of the first instance. Note that if a
class is imported then its name <i>and all required slots</i> must be
imported as well. DEFIMPORT is now a convenience macro that may be used to
handle those details.</li>
<li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
mso-list:l2 level1 lfo9;tab-stops:list .5in'>USE-DEFAULT-ENGINE is
deprecated. LISA now creates an initial inference engine instance when
first loaded.</li>
<li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
mso-list:l2 level1 lfo9;tab-stops:list .5in'>Inheritance reasoning, or the
consideration of an object's taxonomy during pattern matching, is now an
"all or nothing" deal. In other words, this behavior is either
enabled or disabled globally rather than on a class-by-class basis. By
default, taxonomic reasoning is disabled; if you want this behavior
evaluate the form (CONSIDER-TAXONOMY) prior to asserting any facts.</li>
</ul>
<p>I hope I've remembered everything. This will likely be LISA's last beta
before the official 2.0 production release. In the interim, I'll probably begin
writing a document describing LISA's implementation of the Rete algorithm, for
posterity if nothing else.</p>
<h3>6 November, 2002</h3>
<p>LISA 2.0's first beta release, 2.0b1. This version introduces LISA's notion
of truth maintenance, implemented via the new LOGICAL conditional element. The
reference guide contains details.</p>
<h3>4 November, 2002</h3>
<p>Alpha release five. This version introduces the OR conditional element,
along with some improvements to the LISA debugger. The reference guide in the
distribution contains details.</p>
<h3>28 October, 2002</h3>
<p>Alpha release four. This version introduces the LISA debugger, a simple monitoring
and inspection facility for production rules. There is documentation for this
feature in the 2.0 reference guide. Well, it's actually the 1.x guide with
debugger documentation grafted in. I haven't yet gone through the document and
updated it for the rest of 2.0.</p>
<h3>20 October, 2002</h3>
<p>This is the third alpha release for LISA version 2.0, following closely on
the heels of 2.0a2 because I had a bit more time than anticipated to spend on
it. The last remaining missing 1.x features have been added; these are 1) a
basic watch mechanism; and 2) embedded rule definitions (i.e. DEFRULE forms on
rule RHSs). The 2.0 branch remains a much improved implementation over 1.x, and
should offer a solid foundation for any future LISA development.</p>
<h3>17 October, 2002</h3>
<p>This is the second alpha release for LISA version 2.0. Rule redefinition and
queries are now in place, with improved performance and efficiency. In the case
of rule redefinition, or rule insertion into a "live" engine, LISA
now builds a "mini Rete network" for the new rule and grafts it into
the larger network. Also new are rewritten ASSERT and MODIFY macros, allowing
code similar to the following:</p>
<p class=MsoNormal style='margin-top:0in;margin-right:.5in;margin-bottom:0in;
margin-left:.5in;margin-bottom:.0001pt'>(let ((?age 1000))</p>
<p class=MsoNormal style='margin-top:0in;margin-right:.5in;margin-bottom:0in;
margin-left:.5in;margin-bottom:.0001pt'> (modify ?fact (age ?age) (name
(make-a-name))))</p>
<p>In other words, ASSERT and MODIFY should now respond better to their lexical
environments.</p>
<h3>1 October, 2002</h3>
<p>This is the first alpha release for LISA version 2.0, representing a
significant improvement over the 1.x branch. At the core of 2.0 is a ground-up
rewrite of LISA's Rete algorithm. While CLOS still forms the basic structure of
the algorithm, 2.0 makes extensive use of closures and function objects,
yielding a more "lispy" feel to the implementation. The second
significant departure from 1.x is a redesigned language parser, with particular
attention paid to the analysis of DEFRULE forms. While the 1.x parser performs
multi-pass transformations over DEFRULEs, the new parser is a single-pass
implementation that collects more structural information "up-front"
before sending the output to the Rete compiler.</p>
<p>By incorporating the algorithmic and parsing changes mentioned above, a
significant amount of code has been eliminated from 2.0. In particular, the
entire 1.x binding mechanism, used to establish variable bindings in production
rules and support rule firings, has been replaced by closures. Closures also
form the basis of various types of intra- and inter-pattern node tests, making
possible a reduction in the number of classes required to implement nodes in
the Rete network. These two changes alone make for a dramatic improvement in
code readability, simplicity, and application performance.</p>
<p>Some features present in 1.x have not yet been adapted to 2.0. These are:</p>
<ol start=1 type=1>
<li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
mso-list:l0 level1 lfo12;tab-stops:list .5in'>Rule redefinition, including
runtime rule creation (i.e. DEFRULE forms on rule RHSs).</li>
<li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
mso-list:l0 level1 lfo12;tab-stops:list .5in'>Query support.</li>
<li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
mso-list:l0 level1 lfo12;tab-stops:list .5in'>Debugging support, including
watches.</li>
</ol>
<p>This first alpha release is intended to give developers a chance to try
their rule sets with the new algorithm and parser, and expose any remaining
bugs. LISA 2.0 is able to successfully run the sample MAB problems included in
the distribution, but exposure to other rule sets is vital to ensuring the
stability of forthcoming releases.</p>
<p>Version 2.0 contains its own DEFSYSTEM file, lisa2.system. Building 2.0 is
very similar to how one builds 1.x; the system name is LISA2 rather than LISA.
So, something like (mk:compile-system :lisa2) should work for you. The 2.0 code
base is kept separate from 1.x; you'll notice two new directories in the source
tree; 2.0-core contains the core system files, rete/reference contains those
files strictly associated with the 2.0 Rete implementation.</p>
<p>This alpha version of 2.0 has been tested with ACL 6.2 and CLISP 2.29, both
on Windows 2000.</p>
</div>
</body>
</html>
| 18,474 | Common Lisp | .l | 359 | 48.991643 | 136 | 0.763511 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 3a49b9ac29b4174941adbf555993f0627e8a76c0e99d453125fda0102afbf2da | 9,925 | [
-1
] |
9,926 | ref-guide.html | Ramarren_lisa/doc/ref-guide.html | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.2 (Linux)">
<META NAME="CREATED" CONTENT="20070920;9270400">
<META NAME="CHANGEDBY" CONTENT="David Young">
<META NAME="CHANGED" CONTENT="20070920;9301600">
</HEAD>
<BODY LANG="en-US" BACKGROUND="hierarchy-background.gif" DIR="LTR">
<H2 ALIGN=CENTER>The Lisa Reference Guide</H2>
<P>This guide describes in detail the programming interface to Lisa.
It is <I>not</I> a treatise on production-rule technology; readers
are assumed to have a working knowledge of rule-based systems and
their development. This document also avoids any detailed description
of Lisa's implementation of the Rete algorithm; perhaps at some
future date I'll make an attempt.
</P>
<H2 ALIGN=CENTER>Abbreviated Table of Contents</H2>
<P><A HREF="#The Programming Language">The Programming Language</A>
<BR><A HREF="#The Environment">The Environment</A><BR><A HREF="#Contexts">Contexts</A>
<BR><A HREF="#Dynamic Rule Definition">Dynamic Rule Definition</A>
<BR><A HREF="#Queries">Queries</A> <BR><A HREF="#Conflict Resolution">Conflict
Resolution</A><A HREF="#The LISA Debugger"><BR>The Lisa Debugger<BR></A><A HREF="auto-notify.html">Auto
Notification</A> <BR><A HREF="#Getting Started">Getting Started</A>
<BR><A HREF="#Things Yet to Do">Things Yet to Do</A> <BR><A HREF="#Supported Platforms">Supported
Platforms</A> <BR>
</P>
<H3><A NAME="The Programming Language"></A>I. The Programming
Language</H3>
<P>This section describes the publicly-available operators in the
Lisa language, separated into various categories:
</P>
<BLOCKQUOTE><A HREF="#Fact-Related Operators">Fact-Related Operators</A>
</BLOCKQUOTE>
<BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">Language
elements dealing with facts.</BLOCKQUOTE>
<BLOCKQUOTE><A HREF="#Rule-Related Operators">Rule-Related Operators</A>
</BLOCKQUOTE>
<BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">Language
elements dealing with rules.</BLOCKQUOTE>
<BLOCKQUOTE><A HREF="#CLOS-Related Operators">CLOS-Related Operators</A>
</BLOCKQUOTE>
<BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">Language
elements dealing with CLOS instances.</BLOCKQUOTE>
<BLOCKQUOTE><A HREF="#Engine-Related Operators">Engine-Related
Operators</A>
</BLOCKQUOTE>
<BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">Language
elements dealing with operations on an inference engine.</BLOCKQUOTE>
<BLOCKQUOTE><A HREF="#Environment-Related Operators">Environment-Related
Operators</A>
</BLOCKQUOTE>
<BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">Language
elements dealing with the Lisa environment.</BLOCKQUOTE>
<BLOCKQUOTE><A HREF="#Debugging-Related Operators">Debugging-Related
Operators</A>
</BLOCKQUOTE>
<BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">Language
elements useful during system development.</BLOCKQUOTE>
<H4><A NAME="Fact-Related Operators"></A>Fact-Related Operators</H4>
<P STYLE="margin-bottom: 0in">
</P>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(deftemplate <I>name</I> () (<I>slot-name*</I>))</P>
</TD>
<TD>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Creates an internal Lisa class identified by <I>name</I>
that can be instantiated as a fact within the knowledge base. The
<I>slot-name</I>s are analogous to class slots, but without any of
the keyword arguments. Templates are a convenient way of specifying
concepts that don't need the full support of CLOS, but frankly
they're really only in place to ease the transition from CLIPS and
Jess. </BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(deffacts <I>deffact-name</I> (<I>key</I>*) <I>fact-list</I>*)</P>
</TD>
<TD>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Registers a list of facts that will be automatically
inserted into the knowledge base upon each RESET. The <I>deffact-name</I>
is the symbolic name that will be attached to this group of facts;
<I>fact-list</I> is a list of fact specifiers. The format of each
fact specifier is identical to that found in an ASSERT form, minus
the <I>assert</I> keyword. There are currently no supported keywords
for this macro.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(assert (<I>fact-specifier</I>))</P>
</TD>
<TD>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Inserts a fact identified by <I>fact-specifier</I> into
the knowledge base. There are two forms of ASSERT; the first operates
on template-based facts, the other on CLOS instances. For templates,
ASSERT takes a symbol representing the name of the template, followed
by a list of (<I>slot-name value</I>) pairs:
</BLOCKQUOTE>
<DL>
<DL>
<DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">(assert
(frodo (name frodo) (age 100))
</DD></DL>
</DL>
<BLOCKQUOTE>
If the template associated with a fact has not been declared prior to
its assertion, Lisa will signal a continuable error.</BLOCKQUOTE>
<BLOCKQUOTE>For instances of user-defined classes, ASSERT takes a
form that must evaluate to a CLOS instance:</BLOCKQUOTE>
<DL>
<DL>
<DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">(assert
((make-instance 'frodo :name 'frodo :age 100)))
</DD></DL>
</DL>
<BLOCKQUOTE>
or:</BLOCKQUOTE>
<DL>
<DL>
<DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">(let
((?instance (make-instance 'frodo :name 'frodo)))
</DD><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">
(assert (?instance)))
</DD></DL>
</DL>
<BLOCKQUOTE>
or:</BLOCKQUOTE>
<DL>
<DL>
<DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">(defun
add-my-instance (frodo-object)<BR> (assert (#?frodo-object)))
</DD></DL>
</DL>
<BLOCKQUOTE>
This last example makes use of the #? reader macro, which Lisa offers
as a user-customisable feature. It's simply a short-hand notation for
<I>(identity frodo-object)</I>.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(retract <I>fact-or-instance</I>)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Removes a fact or instance from the knowledge base. In
the case of a template-based fact, <I>fact-or-instance</I> may be
either a symbol representing the name of the fact, or an integer
mapping to the fact identifier; for CLOS objects <I>fact-or-instance</I>
must be an instance of STANDARD-OBJECT.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(assert-instance <I>instance</I>)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Inserts a CLOS instance into the knowledge base.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(retract-instance <I>instance</I>)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Removes a CLOS instance from the knowledge base.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(modify <I>fact</I> (<I>slot-name value</I>)*)</P>
</TD>
<TD>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Makes changes to the fact instance identified by <I>fact</I>.
Affected slots and their new values are specified by (<I>slot-name
value</I>). Note that <I>value</I> can be an arbitrary Lisp
expression that will be evaluated at execution time.</BLOCKQUOTE>
<H4><A NAME="Rule-Related Operators"></A>Rule-Related Operators</H4>
<P STYLE="margin-bottom: 0in">
</P>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(defrule <I>name (key*) pattern*</I> => <I>action*</I>)</P>
</TD>
<TD>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Creates a rule identified by <I>name</I> and compiles it
into the Rete network. <I>Name</I> is any Lisp form that evaluates to
a symbol. The keyword arguments modify the rule as follows:
</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">:salience <I>integer</I></PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
Assigns a priority to the rule that will affect the firing order. The
salience value is a small integer in the range (-250, 250). By
default, all rules have salience 0.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">:context <I>name</I></PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
Binds the rule to a context identified by the symbol <I>name</I>. The
context must have been previously defined, or Lisa will signal an
error.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">:auto-focus <I>t</I></PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
Identifies the rule as requiring "auto focus" behavior.
This means that whenever the rule is activated, its context will be
made the active context after the rule firing completes.</BLOCKQUOTE>
<BLOCKQUOTE>If the rule identified by <I>name</I> already exists in
the Rete network it is replaced by the new definition.
</BLOCKQUOTE>
<H5 STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-top: 0in">
Patterns</H5>
<BLOCKQUOTE>Each rule consists of zero or more <I>pattern</I>s, or
Conditional Elements (CEs). Collectively these patterns are known as
the rule's Left Hand Side (LHS), and are the entities that
participate in the pattern-matching process. Lisa currently defines
three pattern types:
</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">generic pattern</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
This pattern type matches against facts in the knowledge base. The
head of the pattern matches equivalently-named facts; the pattern
body is optionally composed of slot-names, values, variables and
predicates. The best way to understand these things is to look at
some examples:
</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.79in; margin-right: 0.79in; margin-bottom: 0.2in">(simple-pattern)</PRE><BLOCKQUOTE STYLE="margin-left: 1.18in; margin-right: 1.18in">
The simplest type of pattern. This example will match any fact of
class <I>simple-pattern</I>.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.79in; margin-right: 0.79in; margin-bottom: 0.2in">(goal-is-to (action unlock))</PRE><BLOCKQUOTE STYLE="margin-left: 1.18in; margin-right: 1.18in">
This pattern matches facts of class <I>goal-is-to</I>. In addition,
it specifies that the slot named <I>action</I> must have as its value
the symbol <I>unlock</I>.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.79in; margin-right: 0.79in; margin-bottom: 0.2in">(thing (name ?chest) (on-top-of (not floor)))</PRE><BLOCKQUOTE STYLE="margin-left: 1.18in; margin-right: 1.18in">
A bit more interesting. Matches facts of class <I>thing</I>; assuming
this is the first appearance of the variable <I>?chest</I>, binds it
to the value of the slot <I>name</I>; specifies that the slot
<I>on-top-of</I> should not have as its value the symbol <I>floor</I>.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.79in; margin-right: 0.79in; margin-bottom: 0.2in">(?monkey (monkey (holding ?chest)))</PRE><BLOCKQUOTE STYLE="margin-left: 1.18in; margin-right: 1.18in">
Assuming the variable <I>?chest</I> was bound in a previous pattern,
matches facts of class <I>monkey</I> whose slot <I>holding</I> has
the same value as <I>?chest</I>. Additionally, if the pattern is
successfully matched, binds the fact object to the variable <I>?monkey</I>.
The variable <I>?monkey</I> is called a <I>pattern binding</I>.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.79in; margin-right: 0.79in; margin-bottom: 0.2in">(pump (flow-rate ?flow-rate (< ?flow-rate 25)))</PRE><BLOCKQUOTE STYLE="margin-left: 1.18in; margin-right: 1.18in">
More interesting still. This pattern matches facts of class <I>pump</I>,
and binds the value of the slot <I>flow-rate</I> to the variable
<I>?flow-rate</I>. In addition, there is a constraint on this slot
declaring that the value of <I>?flow-rate</I> must be less than 25.
In general, constraints can be arbitrary Lisp expressions that serve
as predicates.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.79in; margin-right: 0.79in; margin-bottom: 0.2in">(fact-with-list (list '(1 2 three)))</PRE><BLOCKQUOTE STYLE="margin-left: 1.18in; margin-right: 1.18in">
Patterns can perform matching on lists as well as simpler data types.
Here, the slot <I>list</I> must have the value <I>'(1 2 three)</I>.
More complicated list analysis can be done using user-defined
predicates.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">negated pattern</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
This pattern type is the complement of most variations of the generic
pattern. Negated patterns have the symbol <I>not</I> as their head,
and match if a fact satisfying the pattern is <I>not</I> found. For
example:
</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.79in; margin-right: 0.79in; margin-bottom: 0.2in">(not (tank-level-warning (tank ?tank) (type low)))</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
Note that negated patterns are not allowed to have pattern bindings.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">test pattern</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
The <I>test</I> conditional element allows one to evaluate arbitrary
Lisp code on the rule LHS; these Lisp forms serve as a predicate that
determines whether or not the pattern will match. For example, the
pattern
</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.79in; margin-right: 0.79in; margin-bottom: 0.2in">(test (and (high-p ?tank) (intact-p ?tank)))</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
will succeed if the AND form returns non-<I>nil</I>; i.e. the
functions HIGH-P and INTACT-P both return non-<I>nil</I> values.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">or pattern</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
The <I>or</I> conditional element collects any number of patterns
into a logical group, and matches if any of the patterns inside the
<I>or</I> match. If more than one of the sub-patterns matches, the <I>or</I>
group matches more than once. Lisa implements a rule containing an <I>or</I>
CE as a collection of related rules, with each rule representing
exactly one branch. For example, given the following DEFRULE form:</BLOCKQUOTE>
<DL>
<DL>
<DL>
<DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">(defrule
frodo ()
</DD><DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">
(frodo)
</DD><DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">
(or (bilbo)
</DD><DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">
(gandalf))
</DD><DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">
(samwise)
</DD><DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">
=>)
</DD></DL>
</DL>
</DL>
<BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
Lisa will generate two rules into the rete network, a primary rule
and a single sub-rule:</BLOCKQUOTE>
<PRE STYLE="margin-left: 1.18in; margin-right: 1.18in; margin-bottom: 0.2in">frodo: (frodo), (bilbo), (samwise)
frodo~1: (frodo), (gandalf), (samwise)</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
Notice that Lisa separates the example DEFRULE into the primary rule
<I>frodo</I>, and a single sub-rule, <I>frodo~1</I>. Lisa maintains
the relationship between a primary rule and its sub-rules; if a
primary rule is removed, every related sub-rule is also eliminated.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">logical pattern</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
The <I>logical</I> conditional element implements Lisa's notion of
truth maintenance. Patterns appearing within a LOGICAL form in a rule
are conditionally bound to facts asserted from that rule's RHS. If
during inferencing one or more logical facts are retracted (or
asserted in the case of negated patterns), all facts bound to those
logical facts are retracted. Here's an example:</BLOCKQUOTE>
<DL>
<DL>
<DL>
<DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">(defrule
frodo ()
</DD><DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">
(logical
</DD><DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">
(bilbo)
</DD><DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">
(not (gandalf)))
</DD><DT STYLE="margin-right: 0.79in; margin-bottom: 0.2in">
(frodo)
</DT><DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">
=>
</DD><DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">
(assert (pippin)))
</DD></DL>
</DL>
</DL>
<BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
When rule FRODO fires, it asserts a PIPPIN fact that is dependent on
the existence of BILBO and the absence of GANDALF. If either BILBO is
retracted or GANDALF asserted, PIPPIN will be removed as a
consequence.</BLOCKQUOTE>
<BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">A
LOGICAL conditional element must be the first pattern in a rule.
Multiple LOGICAL forms within the same rule are allowed, but they
must be contiguous.</BLOCKQUOTE>
<BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in"><B>NB</B>:
A rule beginning with the LOGICAL conditional element implicitly
matches the INITIAL-FACT; thus, in order for rules employing truth
maintenance to function correctly, a RESET must be always be
performed prior to any operation affecting working memory. Lisa's
behavior is undefined otherwise.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">exists pattern</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
The EXISTS conditional element performs an existential test on a
pattern. The pattern will match exactly once, even if there are many
facts that might satisfy it. For example, this rule:</BLOCKQUOTE>
<DL>
<DL>
<DL>
<DD STYLE="margin-right: 0.79in; margin-bottom: 0.2in">(defrule
frodo ()<BR> (exists (frodo (has-ring t)))<BR>
=>)</DD></DL>
</DL>
</DL>
<BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
will activate just once if there is at least one FRODO fact whose
HAS-RING slot has the value T.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">The initial fact</PRE><BLOCKQUOTE>
If a rule provides no conditional elements, then it is said to match
the <I>initial-fact</I>, which is asserted as the result of a call to
<I>reset</I>. Thus, the following rule will always activate after
each reset:</BLOCKQUOTE>
<DL>
<DL>
<DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">(defrule
always-fires ()
</DD><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">
=>
</DD><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">
(format t "always-fires fired!~%"))
</DD></DL>
</DL>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">CLOS instances</PRE><BLOCKQUOTE>
Every fact asserted into working memory is backed by a corresponding
CLOS instance. In the case of DEFTEMPLATEs, Lisa creates an internal
class mirroring the template; user-defined class instances are simply
bound to a fact during assertions. Instances associated with facts
are accessible on rule LHSs via the :OBJECT special slot:
</BLOCKQUOTE>
<DL>
<DL>
<DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">(tank (name
?name) (:object ?tank-object))
</DD></DL>
</DL>
<BLOCKQUOTE>
Once bound, method and function calls can be made on this object from
the rule's LHS and RHS.
</BLOCKQUOTE>
<BLOCKQUOTE>When reasoning over CLOS objects, Lisa is capable of
considering an instance's object hierarchy during pattern matching.
In other words, it is possible to write rules that apply to many
facts that share a common ancestry. The following code fragment
provides an example: <BR>
</BLOCKQUOTE>
<DL>
<DL>
<DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">(defclass
fundamental () ())
</DD><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">
(defclass rocky (fundamental) ())
</DD><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">
(defclass boris (fundamental) ())
</DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in">
</DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">
(defrule cleanup (:salience -100)
</DD><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">
(?fact (fundamental))
</DD><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">
=>
</DD><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in">
(retract ?fact))
</DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in">
</DT></DL>
</DL>
<BLOCKQUOTE>
The rule <I>cleanup</I> will fire for every instance of <I>rocky</I>
and <I>boris</I> in the knowledge base, retracting each in turn. Note
that taxonomic reasoning is disabled by default. To use the feature,
evaluate (setf (Lisa:consider-taxonomy) t).</BLOCKQUOTE>
<H5 STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-top: 0in">
Actions</H5>
<BLOCKQUOTE>Following any conditional elements are the rule's
actions, if any. Collectively known as the Right Hand Side (RHS),
actions consist of arbitrary Lisp forms. All variables declared on
the LHS are available, along with the special operator <I>engine</I>,
which evaluates to the rule's inference engine object. Currently,
each rule's RHS is given to the Lisp compiler during rule
compilation, and executes within a special lexical environment
established by Lisa for each firing.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(undefrule <I>rule-name</I>)</P>
</TD>
<TD>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Undefines, or removes, a rule from the Rete network.
<I>Rule-name</I> is a symbol representing the name of the rule. If
<I>rule-name</I> is not qualified with a context name (e.g.
<I>context.rulename</I>), then the Initial Context is assumed.</BLOCKQUOTE>
<H4><A NAME="CLOS-Related Operators"></A>CLOS-Related Operators</H4>
<P STYLE="margin-bottom: 0in">There are a few special features that
Lisa provides for keeping CLOS instances synchronised with their
corresponding facts in working memory. If an instance is altered
outside of Lisa's control, then Lisa must somehow be informed of the
change to maintain working memory consistency. The basic mechanism is
manual notification, in which an application explicitly invokes a
special function to initiate synchronisation. Users of the two
commercial Lisps supported by Lisa also have the option of employing
<A HREF="auto-notify.html">Auto Notification</A>, an experimental
feature that removes the burden of synchronisation from the
application. <BR>
</P>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(mark-instance-as-changed <I>instance </I>&key <I>slot-name</I>)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Notifies Lisa that a change has been made to <I>instance</I>
outside of the knowledge-base (i.e. not via the <I>modify</I>
operator), and synchronizes the instance with its associated fact.
<I>Slot-name</I> is either the symbolic name of a slot belonging to
<I>instance</I> that has changed value, or NIL (the default), in
which case all slots are synchronized. An application <I>must</I>
call this method whenever a slot change occurs outside of Lisa's
control.</BLOCKQUOTE>
<H4><A NAME="Engine-Related Operators"></A>Engine-Related Operators</H4>
<P STYLE="margin-bottom: 0in">These operators provide an interface to
instances of the inference engine itself.</P>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(inference-engine)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Evaluates to the currently active instance of the
inference engine.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(reset)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Re-initializes the knowledge base, removing facts,
clearing all context agendas, and asserting the <I>initial-fact</I>.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(clear)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Re-initializes the Lisa environment, mostly by creating a
new instance of the default inference engine.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(run &optional <I>focus-list)</I></P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Runs the inference engine, optionally pushing the context
names on <I>focus-list</I> onto the focus stack before doing so.
Execution will continue until either all agendas are exhausted or a
rule calls (halt).</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(walk &optional <I>step</I>)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Runs the engine in <I>step</I> increments,
single-stepping by default. Here, "single-stepping" means
"one rule at a time".</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(halt)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Halts the inference engine, even if the agendas still
have activations. Typically used only on rule RHSs.</BLOCKQUOTE>
<H4><A NAME="Environment-Related Operators"></A>Environment-Related
Operators</H4>
<BLOCKQUOTE>These operators are used to manipulate and inspect the
Lisa environment.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(with-inference-engine (<I>engine</I>) <I>forms</I>*)</P>
</TD>
<TD>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Evaluates <I>forms</I> within the context of the
inference engine <I>engine</I>. Under most circumstances, use this
macro in a multi-processing environment to safely load a knowledge
base into <I>engine</I>.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(make-inference-engine)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Creates an instance of Lisa's default inference engine.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(rule)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Within the context of an executing rule, returns the CLOS
object representing that rule.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(consider-taxonomy)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Returns the current setting for taxonomic reasoning. Use
(setf (consider-taxonomy) <I>value</I>) to change the setting. The
default (NIL) means Lisa ignores class taxonomy during pattern
matching.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(allow-duplicate-facts)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Returns the current setting for duplicate fact checking.
Use (setf (allow-duplicate-facts) <I>value</I>) to change the
setting. By default, Lisa allows duplicate facts to be asserted. If
checking is enabled and an application attempts to assert a duplicate
fact, Lisa signals a DUPLICATE-FACT error.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(use-fancy-assert)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Returns the current setting for fancy assertions. If
enabled (the default), the #? reader macro is installed in the global
readtable.</BLOCKQUOTE>
<H4><A NAME="Debugging-Related Operators"></A>Debugging-Related
Operators</H4>
<P STYLE="margin-bottom: 0in">These operators are typically used
interactively to inspect the state of an inference engine. Some of
these operators are only loosly defined and need further work. <BR>
</P>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(facts)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Prints on <I>trace output</I> the contents of the active
inference engine's fact base.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(rules &optional <I>context-name</I>)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Prints on <I>trace output</I> the contents of the active
inference engine's rule base. By default, all rules and all contexts
will be printed. If <I>context-name</I> is provided, then only those
rules in that context are printed.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(agenda &optional <I>context-name</I>)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Prints on <I>trace output</I> the contents of the active
inference engine's agenda. By default, the agendas for all contexts
will be printed, unless <I>context-name</I> is supplied.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(watch <I>event</I>)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Asks Lisa to report the occurrence of <I>event</I> to
<I>trace output</I>.
</BLOCKQUOTE>
<BLOCKQUOTE>Currently, Lisa allows monitoring of these events:
</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">:facts</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
Triggers an event each time a fact is asserted or retracted.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">:activations</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
Triggers an event each time a rule is added to or removed from the
agenda.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">:rules</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
Triggers an event each time a rule is fired.</BLOCKQUOTE>
<PRE STYLE="margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0.2in">:all</PRE><BLOCKQUOTE STYLE="margin-left: 0.79in; margin-right: 0.79in">
Watch all allowable events.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(unwatch <I>event</I>)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Disables the monitoring of <I>event</I>. See the
documentation for <I>watch</I> to see the allowable event types.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(watching)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Displays the list of events currently being monitored.</BLOCKQUOTE>
<H3><A NAME="The Environment"></A>II. The Environment</H3>
<P>For application developers, Lisa makes available two different
types of environments. Package Lisa-USER contains all of Lisa's
exported symbols, plus those of COMMON-LISP. User-level work can
safely be done in this package. Alternatively, package Lisa-LISP can
be used with DEFPACKAGE forms to import a Lisa environment into
user-defined packages:
</P>
<BLOCKQUOTE>(defpackage "FRODO"<BR> (:use
"Lisa-LISP"))</BLOCKQUOTE>
<P>As with Lisa-USER, Lisa-LISP exports all external symbols in the
Lisa and COMMON-LISP packages. See the various examples provided in
"Lisa:misc;".</P>
<P>There are a few aspects of Lisa that may be customised prior to
building. The file "Lisa:src;config;config.lisp" contains a
set of default behaviors; feel free to edit this file to your liking.</P>
<H3><A NAME="Contexts"></A>III. Contexts</H3>
<P>Lisa contexts are a way of partitioning a knowledge base into
distinct groups of rules. The mechanism is similar to modules in
CLIPS and recent versions of Jess, in that individual rule groups can
be invoked "procedurally" without resorting to the use of
control facts to manipulate firing order. Contexts can also serve as
an organizational construct when working with larger knowledge bases.
Each context has its own agenda and conflict resolution strategy.</P>
<P>Each inference engine instance created in Lisa contains a default
context, named "The Initial Context" (or INITIAL-CONTEXT).
Unless arrangements are made otherwise, all rules will reside in this
context. The DEFCONTEXT macro creates a new context; rules may
then be loaded into the new context by supplying the :CONTEXT keyword
to DEFRULE. Contexts serve as a form of namespace for rules; thus, it
is legal for identically named rules to reside in different contexts.
Rules are distinctly identified by qualifying the rule name with the
context name; for example, rule <I>wizards.gandalf</I> is a rule
named <I>gandalf</I> that resides within the <I>wizards</I> context.</P>
<P>Activations in the Initial Context are always available for
firing. Otherwise, activations in other contexts will only fire if
those contexts are explicitly given control, via the FOCUS operator.
Each inference engine maintains its own focus stack; before a new
context is given control, the active context is pushed onto the focus
stack. The REFOCUS operator may be used on a rule's RHS (or, perhaps,
interactively) to leave the active context and return control to the
previous context on the stack. Control automatically returns to the
previous context if the active context runs out of activations. When
all contexts have exhausted their activations, the inference engine
halts.</P>
<P>A rule can be tagged with the <I>auto-focus</I> attribute by
supplying the AUTO-FOCUS keyword to DEFRULE. If an auto-focus rule
activates, that rule's context is automatically pushed onto the focus
stack and given control when the rule completes its firing.</P>
<P>Note carefully that while the <I>rules</I> in a knowledge base may
be partitioned, there remains a <I>single working memory</I> per
inference engine. At any given time, all facts in a knowledge base
are visible to all rules in that knowledge base, regardless of
context.</P>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(defcontext <I>context-name</I> &key <I>strategy</I>)</P>
</TD>
<TD WIDTH=20%>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Creates a new context identified by <I>context-name</I>,
which must be a string designator. If <I>strategy</I> is non-NIL then
it must be an object implementing a suitable conflict resolution
strategy.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(undefcontext <I>context-name</I>)</P>
</TD>
<TD WIDTH=20%>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Destroys the context identified by <I>context-name</I>,
which must be a string designator. All rules bound to the context are
removed from the Rete network, along with their activations, if any.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(focus &rest <I>context-names</I>)</P>
</TD>
<TD WIDTH=20%>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>If <I>context-names</I> is non-NIL, it should be a
collection of context names that will be added to the focus stack.
Contexts are pushed onto the focus stack in right-to-left order. If
no names are specified, then FOCUS returns the active context object.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(refocus)</P>
</TD>
<TD WIDTH=20%>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Activates the next available context.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(focus-stack)</P>
</TD>
<TD WIDTH=20%>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Returns the inference engine's focus stack.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(contexts)</P>
</TD>
<TD WIDTH=20%>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Returns a list of all the inference engine's defined
contexts.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(with-context (<I>context</I> &body <I>body</I>)</P>
</TD>
<TD WIDTH=20%>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Evaluates the forms contained in <I>body</I> within the
context <I>context</I>.</BLOCKQUOTE>
<H3><A NAME="Dynamic Rule Definition"></A>IV. Dynamic Rule
Definition</H3>
<P>In addition to statically declared rules, Lisa supports the
definition of rules at runtime. That is, it is possible to create new
rules from the RHSs of existing rules as they fire. These <I>dynamically
defined</I> rules become immediately available to the inference
engine for potential activation. As a simple example, consider the
following rule:</P>
<BLOCKQUOTE>(defrule rocky () <BR> (rocky (name ?name)) <BR>
=> <BR> (defrule boris () <BR> (boris
(name ?name)) <BR> => <BR>
(format t "Dynamic rule BORIS fired; NAME is ~S~%" ?name)))</BLOCKQUOTE>
<P>When rule ROCKY fires, its RHS creates a dynamically defined rule
named BORIS. This new rule is inserted into the inference engine and
immediately becomes part of the Rete network. Variables bound on the
LHS of ROCKY behave as expected within the context of BORIS; this
means that ?NAME in BORIS is bound to the same object as that found
in ROCKY<SUP>*</SUP>.
</P>
<P>Here's a more complicated example:
</P>
<BLOCKQUOTE>(defrule rocky () <BR> (rocky (name ?name)) <BR>
=> <BR> (let ((dynamic-rule <BR>
(defrule (gensym) () <BR>
(boris (name ?name)) <BR>
=> <BR>
(format t "Dynamic rule ~A fired; name is ~S~%" (get-name
(rule)) ?name)))) <BR> (format t "Rule ROCKY
added dynamic rule ~A~%" (get-name dynamic-rule))))</BLOCKQUOTE>
<P>As before, rule ROCKY creates a dynamic rule when fired. However,
this time the new rule is given a unique name by evaluating the form
(GENSYM); either the name or the instance can then be remembered for
use later. These two rules also introduce functions in the Lisa API
for retrieving both the currently executing rule and its name (RULE
and GET-NAME, respectively).
</P>
<P><SUP>*</SUP> Actually, this isn't precisely true. Whenever Lisa
encounters a dynamic rule during parsing it looks at all the rule's
variables and substitutes any bound values. Thus, in rule BORIS the
variable ?NAME would be replaced by the value of ?NAME as bound in
rule ROCKY.
</P>
<H3><A NAME="Queries"></A>V. Queries</H3>
<P>As of Lisa version 1.2, a simple query language is supported that
allows retrieval of facts from a knowledge base, either interactively
via a Lisp listener or programmatically. The query engine leverages
the inferencing component by transforming query expressions into
rules and inserting them, at runtime, into the Rete network. Each
query is assigned a unique identifier and cached upon first
appearance; subsequent queries with semantically equivalent bodies
will find the cached instance and execute with substantially improved
performance, especially for larger knowledge bases. As an example,
consider the following two query forms:
</P>
<P> (retrieve (?x ?y) <BR> (?x (hobbit (name
?name))) <BR> (?y (ring-bearer (name ?name))))
</P>
<P> (retrieve (?h1 ?h2) <BR> (?h1 (hobbit
(name ?hobbit-name))) <BR> (?h2 (ring-bearer (name
?hobbit-name))))
</P>
<P>The variables appearing in the first argument to RETRIEVE (e.g.
'(?x ?y)) are used to establish bindings for each firing of the
query; each variable must also appear in the query body as an
appropriate pattern binding. Other than this requirement, query
bodies are structurally identical to rule bodies; anything that is
legal in a rule LHS is legal in a query body. Note that these two
examples are semantically equivalent; although the variable names are
different, the patterns appear in the same order and the
relationships among variables are identical. Thus, firing either
query will yield the same set of fact bindings. Lisa is able to
recognize such similarities in queries and implements a caching
scheme that minimizes unnecessary dynamic rule creation.
</P>
<P>RETRIEVE returns two values; a list of bindings for each query
firing, and the symbolic name assigned by Lisa to the query instance.
The second value is probably only useful while developing/testing
queries; using this symbol one can ask Lisa to forget about a query
by removing it from the cache and the Rete network. The binding list
is the principal value of interest. Since a query is really a rule,
it can fire an arbitrary number of times for each invocation. Each
firing is represented as a list of CONS cells. The CAR of each cell
is one of the variables specified in the query's binding list; its
CDR is a fact bound to that variable that satisfies the variable's
associated pattern. For example, assuming that the first of the above
query examples fires twice during a certain invocation, RETRIEVE
would return something like:
</P>
<P> (((?X . <HOBBIT INSTANCE 1>) (?Y . <RING-BEARER
INSTANCE 1>)) <BR> ((?X . <HOBBIT INSTANCE
2>) (?Y . <RING-BEARER INSTANCE 2))) <BR> #:G7777
</P>
<P>As explained previously, the second value is the symbolic name
Lisa assigned to the query when its rule instance was initially
created. Most of the time it will be ignored.
</P>
<P>As of release 1.3, Lisa incorporates a unified view of template-
and CLOS-based facts; as a result queries now function for both types
of facts. In the former case, Lisa creates a class modeled around the
template. Class and slot names are taken directly from the
DEFTEMPLATE form; each slot is given a reader method named according
to DEFSTRUCT conventions (i.e. <I>class name-slot name</I>). For
example,
</P>
<BLOCKQUOTE>(deftemplate frodo ()<BR> (slot companion (default
merry)))
</BLOCKQUOTE>
<P>Will yield the following class specification:
</P>
<BLOCKQUOTE>(defclass frodo (inference-engine-object)<BR>
((companion :initform 'merry :initarg :companion :reader
frodo-companion)))
</BLOCKQUOTE>
<P STYLE="margin-bottom: 0in">These functions and macros comprise the
current interface to the query engine: <BR>
</P>
<TABLE COLS=2 WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(retrieve (<I>variables</I>*) <I>patterns</I>*)</P>
</TD>
<TD>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Initiates a query against the knowledge base. Variable
bindings for the query are found in <I>variables; patterns</I>
consists of matching forms that comprise the body of the query rule.
RETRIEVE returns two values: a list of CONS cells for each firing and
the symbolic name Lisa assigned to the query when it was initially
constructed. The CAR of each CONS cell is one of the binding
variables; the CDR is the CLOS instance bound to that variable.</BLOCKQUOTE>
<TABLE COLS=2 WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(forget-query <I>name</I>)</P>
</TD>
<TD>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Instructs Lisa to forget about the query identified by
the symbol <I>name</I>. Doing so removes the query's rule instance
from the Rete network and the query itself from the cache. Useful
only during query development, probably.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(with-simple-query ((<I>var value</I>) <I>query-form</I> &body
<I>body</I>))</P>
</TD>
<TD WIDTH=20%>
<P>Macro</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Evaluates <I>query-form</I>. Then, iterates over the
resulting list structure, binding each variable and fact to <I>var</I>
and <I>value</I>, respectively, and evaluating <I>body</I>. This
macro is useful if one is interested in just the individual
variable/fact pairs and doesn't care much about the binding context
that occurred during query firing.</BLOCKQUOTE>
<H3><A NAME="Conflict Resolution"></A>VI. Conflict Resolution</H3>
<P STYLE="margin-bottom: 0in">Conflict Resolution (CR) is the
mechanism Lisa employs to determine the order in which multiple
activations will fire. Currently, Lisa offers two "built-in"
strategies; <I>breadth-first</I> and <I>depth-first</I>. It is
possible to implement new CR algorithms by creating a class derived
from <I>Lisa:strategy</I> and implementing a few generic functions;
instances of this new strategy can then be given to
<I>make-inference-engine</I>. <BR>
</P>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(add-activation <I>strategy</I> <I>activation</I>)</P>
</TD>
<TD>
<P>Generic Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Makes a new <I>activation</I> eligible for firing.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(find-activation <I>strategy</I> <I>rule</I> <I>token</I>)</P>
</TD>
<TD>
<P>Generic Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Locates an activation associated with <I>rule</I> and
<I>token</I>.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(next-activation <I>strategy</I>)</P>
</TD>
<TD>
<P>Generic Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Returns the next eligible activation.</BLOCKQUOTE>
<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(list-activations <I>strategy</I>)</P>
</TD>
<TD>
<P>Generic Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Returns a list of eligible activations.</BLOCKQUOTE>
<P>Documentation for the CR interface is still fairly light. Look for
improvements in upcoming releases.
</P>
<H3><A NAME="The LISA Debugger"></A>VII. The Lisa Debugger</H3>
<P>New as of 2.0 alpha 4, the Lisa debugger is a simple monitoring
and inspection utility that may be used to "debug"
production rules. Although one cannot step through a rule pattern by
pattern, breakpoints may be set to trigger just before a rule fires.
When a breakpoint is reached, one can then interactively examine the
token stack, display all pattern bindings and their values,
single-step into the next activation, etc.</P>
<P>By default, Lisa builds without the debugger loaded to avoid a
slight performance drag on rule firings. To use the debugger, in the
CL-USER package evaluate the form (require 'Lisa-debugger
(Lisa-debugger)). If you're running Allegro Common Lisp, Lisa
understands how to hook into the module search list; thus you may
instead evaluate (require 'Lisa-debugger).</P>
<P>The functionality available via the Lisa debugger may increase as
user needs dictate; here is the command set as of this writing:</P>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(set-break <I>rule-name</I>)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Sets a breakpoint in the rule identified by the symbol
<I>rule-name.</I></BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(clear-break <I>rule-name</I>)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Clears the breakpoint previously set on the rule
identified by the symbol <I>rule-name</I>.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(clear-breaks)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Removes all breakpoints.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>*break-on-subrules*</P>
</TD>
<TD WIDTH=20%>
<P>Special variable</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Setting this variable to a non-NIL value will cause the
debugger to manage breakpoints for a primary rule and all of its
subrules (see the section on the <I>or</I> conditional element for an
explanation of primary rules).</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(next)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Fires the currently suspended rule, then single-steps
into the next activation, if there is one. If there isn't one, the
debugger exits.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(resume)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Resumes normal execution, until the next breakpoint is
reached.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(tokens &key (<I>verbose nil</I>))</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE> Displays the token stack, which contains the facts
that activated this particular rule. If <I>verbose</I> is non-nil,
then the fact instances themselves are printed; otherwise, a
shorthand notation is used.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(bindings)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Displays the bindings (pattern variables) found on the
rule's LHS, along with their values.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(fact <I>fact-id</I>)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Returns the fact instance associated with <I>fact-id</I>,
a small integer assigned to each fact by the inference engine.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(breakpoints)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Displays all breakpoints.</BLOCKQUOTE>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH=80%>
<P>(rule)</P>
</TD>
<TD WIDTH=20%>
<P>Function</P>
</TD>
</TR>
</TABLE>
<BLOCKQUOTE>Returns the rule instance representing the suspended
activation.</BLOCKQUOTE>
<H3><A NAME="Getting Started"></A>VIII. Getting Started</H3>
<P>Lisa requires the Portable Defsystem as maintained by the CLOCC
project; for your convenience, a copy is included in the
distribution. Building Lisa should be straight-forward. First, either
load "Lisa:Lisa.system" or change your working directory to
the Lisa root directory; then, evaluate (mk:compile-system :Lisa).
Note that Lisa uses logical pathnames in its defsystem, and
translations that are suitable for a Linux (or Cygwin/Windows)
environment are established there. They might work for you; perhaps
not. Until I figure out how to correctly place default translations
you might have to do some hand editing. Sorry.
</P>
<P>To build a knowledge base, write your production rules using the
various source examples (and this document) as your guide and load
the file(s) into Lisp. You can then change to the Lisa-USER package
and experiment. Look for the examples in "Lisa:misc;".
</P>
<P>A note to CLISP users. Lisa requires that CLISP be run with full
ANSI support enabled. Also, the baseline version with which Lisa has
been tested is 2.25.1. Earlier releases might work as well, but no
guarantees.
</P>
<H3><A NAME="Things Yet to Do"></A>IX. Things Yet to Do.</H3>
<P>This section is a list (albeit incomplete) of features that would
improve Lisa significantly.
</P>
<OL>
<LI><P><I>Backward chaining</I>: Perhaps an implementation of
Prolog's backchaining algorithm that has concurrent access to
working memory (i.e. along with Rete).</P>
</OL>
<H3><A NAME="Supported Platforms"></A>X. Supported Platforms.</H3>
<P>Lisa has been tested, and is known to run, on the following Common
Lisp implementations:
</P>
<UL>
<LI><P STYLE="margin-bottom: 0in">Allegro Common Lisp, versions
5.0.1 and 6.x, Linux and Windows 2000.
</P>
<LI><P STYLE="margin-bottom: 0in">Xanalys LispWorks, versions 4.1.20
and 4.2, Linux and Windows 2000.
</P>
<LI><P STYLE="margin-bottom: 0in">CLISP, version 2.27 and newer,
Linux and Windows 2000.
</P>
<LI><P>CMUCL, version 18c, Linux.
</P>
</UL>
</BODY>
</HTML> | 53,764 | Common Lisp | .l | 1,327 | 38.647325 | 195 | 0.737118 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | e5cdca901d2de05d57d5864a42d321ab62c38f38387dcce4a7d26140c2d1e82e | 9,926 | [
-1
] |
9,927 | index.html | Ramarren_lisa/doc/index.html | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.2 (Linux)">
<META NAME="CREATED" CONTENT="20070908;14272300">
<META NAME="CHANGEDBY" CONTENT="David Young">
<META NAME="CHANGED" CONTENT="20070918;22122200">
<META NAME="ProgId" CONTENT="Word.Document">
<META NAME="Originator" CONTENT="Microsoft Word 9">
<META NAME="ProgId" CONTENT="Word.Document">
<META NAME="Originator" CONTENT="Microsoft Word 9">
<!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]-->
<STYLE TYPE="text/css">
<!--
TD P { color: #000000 }
P { color: #000000 }
H2 { color: #000000 }
H3 { color: #000000 }
A:link { color: #0000ef }
A:visited { color: #52188c }
-->
</STYLE>
</HEAD>
<BODY LANG="en-US" TEXT="#000000" LINK="#0000ef" VLINK="#52188c" BGCOLOR="#ffffff" BACKGROUND="hierarchy-background.gif" DIR="LTR">
<P>
</P>
<TABLE COLS=3 WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=2>
<TR>
<TD ROWSPAN=2 WIDTH=28%>
<P STYLE="text-decoration: none"><A NAME="_x0000_i10271"></A><A HREF="http://www.powmiaff.org/"><IMG SRC="powmia.jpg" NAME="graphics1" ALIGN=BOTTOM WIDTH=50 HEIGHT=85 BORDER=0></A></P>
</TD>
<TD ROWSPAN=2 WIDTH=100%>
<P> </P>
<P> </P>
</TD>
<TD WIDTH=29%>
<P ALIGN=RIGHT><A NAME="_x0000_i10261"></A><IMG SRC="http://sourceforge.net/sflogo.php?group_id=12453&type=1" NAME="graphics2" ALIGN=BOTTOM WIDTH=88 HEIGHT=31 BORDER=0></P>
</TD>
</TR>
<TR>
<TD WIDTH=29% VALIGN=TOP>
<P> </P>
</TD>
</TR>
</TABLE>
<H2 ALIGN=CENTER>The Lisa Project</H2>
<P><BR>Welcome to the <A HREF="http://sourceforge.net/projects/lisa">Lisa</A>
project, a platform for the development of <B>L</B>isp-based
<B>I</B>ntelligent <B>S</B>oftware <B>A</B>gents. Lisa is a
production-rule system implemented in the Common Lisp Object System
(CLOS), and is heavily influenced by CLIPS and the Java Expert System
Shell (JESS). At its core is a reasoning engine based on an
object-oriented implementation of the Rete algorithm, a very
efficient mechanism for solving the difficult many-to-many matching
problem ("Rete: A Fast Algorithm for the Many Pattern/Many
Object Pattern Match Problem", Charles L. Forgy, Artificial
Intelligence 19(1982), 17-37.) Intrinsic to Lisa is the ability to
reason over CLOS objects without imposing special class hierarchy
requirements; thus it should be possible to easily augment existing
CLOS applications with reasoning capabilities. As Lisa is an
extension to Common Lisp, the full power of the Lisp environment is
always available. Lisa-enabled applications should run on any
ANSI-compliant Common Lisp platform.
</P>
<H3>Project Goals</H3>
<P>The Lisa project is driven by a number of important goals:
</P>
<UL TYPE=DISC>
<LI><P><I>Unrestricted availability</I>: The principal motivation
for beginning Lisa was the apparent dearth of lightweight, <I>current,
freely-available</I> toolkits for constructing Lisp-based
intelligent systems. There are a number of very fine commercial and
restricted-use products out there (see the links below), but these
systems do not necessarily address the needs of developers
attempting to introduce Lisp into their organizations. This is
exactly the position I found myself in prior to Lisa. I was leading
an applied research project that needed an expert system shell, and
if I'd had a modern implementation freely available for Lisp I might
have been able to successfully entrench Lisp within the
organization. So, I wrote Lisa.
</P>
<LI><P><I>Portability</I>: Vendor neutrality is a significant
project goal, not because I disapprove of commercial software but to
ensure Lisa is available on as many platforms as I can manage.. As
previously mentioned, Lisa is implemented in ANSI Common Lisp;
currently, all development is being done on Windows 2000 using
<A HREF="http://www.xanalys.com/">Xanalys</A>' LispWorks. Every
effort will be made to avoid the use of implementation-specific
functionality; in the cases where a non-ANSI feature must be used
(e.g. multiprocessing support), Lisa will attempt to support the
major Lisp implementations either through conditional evaluation or
the use of a common library such as <A HREF="http://clocc.sourceforge.net/">CLOCC</A>.
</P>
<LI><P><I>Familiarity</I>: Lisa's production-rule system has its
roots in CLIPS and JESS, making it readily familiar to developers
who've worked with either of these systems. Indeed, the CLIPS and
JESS languages both have their roots in Lisp.
</P>
<LI><P><I>Flexibility</I>: As previously mentioned, Lisa reasons
over CLOS objects without requiring changes to an application's
class hierarchy. In addition, the full power of Common Lisp is
available for use within productions; there is no dichotomy between
Lisa's programming language and her implementation.
</P>
<LI><P><I>Simplicity</I>: Along with portability, the project is
striving for simplicity and elegance at the functional, architecture
and source code levels. This doesn't mean Lisa should have limited
usefulness; rather, it should be possible for new developers to
easily understand the code layout and behavior. Unless performance
absolutely demands otherwise, clarity of design and implementation
will take precedence.
</P>
</UL>
<H3>Project People</H3>
<UL TYPE=DISC>
<LI><P><A HREF="mailto:[email protected]">David E. Young</A>:
Presently a knowledge engineer at a small startup in RTP, North
Carolina.
</P>
</UL>
<H3>Project Status</H3>
<P>Release 3.2 is the latest official release. The major addition
after version 2.1 is support for Certainty Factors (CF), as described
in Peter Norvig's <I>Paradigms of Artificial Intelligence
Programming</I>. There's also a simplified install facility based on
ASDF, and some major performance improvements.</P>
<P>The first production release for Lisa 2.0, a major rewrite of the
system, was available as of 9 December, 2002. The Rete algorithm was
re-implemented from scratch; new conditional elements were added;
contexts were introduced; and a production rule debugger made
available. There were also other features not listed here.
</P>
<P>Lisa had its first production release (Version 1.0) on 31 August,
2001 and is considered "stable" software; it should now be
possible to develop reasonably sophisticated knowledge bases for
"real systems". Lisa has successfully run adaptations of
the "monkey and bananas" (MAB) planning problem on all four
target Lisp platforms, and full reasoning capabilities are available
for CLOS objects in a multi-threaded environment. Release 1.1 offers
support for <I>dynamic rule definition</I>, the ability to create new
rules from existing rules at runtime; version 1.2 includes a new
query facility that allows interactive and programmatic retrieval of
CLOS instances from a knowledge base. For the most current
information on the project, including mailing lists, latest news and
available downloads, see the <A HREF="http://sourceforge.net/projects/lisa">official
project page</A>. If you prefer, you may contact the project staff
directly (see <I>Project People</I>).</P>
<H3>Supported Platforms</H3>
<P>Lisa is known to run on LispWorks, ACL, CLISP, CMUCL (19a), SBCL
and OpenMCL. I also know of an individual that has managed to get
Lisa running on Armed Bear Common Lisp, a testimony to the quality of
that member of the Common Lisp family.</P>
<H3>Documentation</H3>
<P>Currently, documentation for Lisa is a work-in-progress. However,
there is a beta-quality version of the <A HREF="ref-guide.html">Lisa</A>
<A HREF="ref-guide.html">Reference Guide</A> that should help you get
started. Also, you may see the source code for Lisa's two versions of
the MAB, <A HREF="http://lisa.sourceforge.net/mab.lisp">mab.lisp</A>
and <A HREF="http://lisa.sourceforge.net/mab-clos.lisp">mab-clos.lisp</A>
(a "CLOS-ified" version of the default MAB implementation).
</P>
<H3>License</H3>
<P>Lisa is currently released under the GNU Lesser General Public
License (LGPL), primarily because it seemed more versatile than the
GPL. However, some sources indicate that the LGPL might inhibit
commercial uses of Lisp applications like Lisa. I've no idea if this
is the case as I'm not a legal expert. So, if you're interested in
using Lisa commercially and decide the LGPL gets in the way, feel
free to contact me to discuss some other type of license arrangement.</P>
<H3>News</H3>
<P><I>8 September, 2007:</I> <SPAN STYLE="font-style: normal">Release
3.0. This is a major release that offers support for certainty
factors, big performance improvements, and some important bug fixes.</SPAN></P>
<P><I>21 February, 2006:</I> Release 2.4. This is a minor release
that makes Lisa compatible with CLISP 2.38.</P>
<P><I>5 April, 2005:</I> Release 2.3. This version fixes a serious
bug in Lisa’s join network; thanks to Andy Sloane for the patch.
There’s also a patch from Fred Gilham that enables auto-notify
support for CMUCL.</P>
<P><I>4 April, 2005: </I>Release 2.1 is out of beta and is the latest
stable release.</P>
<P><I>17 September, 2004</I>: Release 2.1 beta is available, with
support for Certainty Factors. Also, Lisa now unofficially once again
supports CMUCL. I've had reports that the PCL bugs were fixed as of
19a, and that Lisa is able to run the MAB on that platform.</P>
<P><I>9 June, 2004</I>: Lisa now uses ASDF as its default system
definition facility. The build and load procedure has also been
simplified to help new folks get up and running quickly. I also have
plans to write a tutorial that will be more useful than the reference
guide. Also, note that Lisa officially no longer supports CMUCL.
There's apparently a bug in PCL that prevents Lisa from running (or
perhaps compiling; I forget). This situation has existed for awhile
now, but I'm just getting around to announcing it.</P>
<P><I>6 June, 2004</I>: Release 2.0.7. Yet another bug-fix release
that corrects a problem reported by Aneil Mallavarapu. Lisa was
having difficulty keeping the agenda straight when rules were created
after facts had been asserted into working memory.</P>
<P><I>5 March, 2004</I>: Release 2.0.6. This is a bug-fix release
that addresses problems with a) Lisa's duplicate fact detection
mechanism; and b) the LOGICAL conditional element. Patches for both
issues were submitted by Aneil Mallavarapu.</P>
<P><I>1 November, 2003</I>: Release 2.0.5, a bug-fix release that
corrects problems with Lisa’s taxonomic reasoning system. Patches
submitted courtesy of Aneil Mallavarapu.</P>
<P><I>19 December, 2002</I>: Release 2.0.3, a bug-fix release
addressing a problem with queries.
</P>
<P><I>10 December, 2002</I>: Release 2.0.1, a bug-fix release for
2.0.</P>
<P><I>9 December, 2002</I>: The first production release for 2.0 is
available. Details are in the <A HREF="RELNOTES.html">release notes</A>.</P>
<P><I>25 November, 2002</I>: Beta 3 is available. Again, some major
enhancements, including Contexts, a new conditional element and
duplicate fact detection. Details are in the release notes.</P>
<P><I>18 November, 2002</I>: Beta 2 is available. Lots of changes and
enhancements in this version, including completion of Lisa's truth
maintenance system. See the <A HREF="RELNOTES.html">release notes</A>
for details.</P>
<P><I>6 November, 2002</I>: The first beta release for Lisa 2.0,
2.0b1. This version introduces a form of truth maintenance via the
LOGICAL conditional element. Details are in the reference guide in
the distribution.</P>
<P><I>4 November, 2002</I>: Alpha release 5 for Lisa 2.0 is now
available. This version introduces the OR conditional element, along
with some improvements to the debugger. Details are in the reference
guide in the distribution.</P>
<P><I>28 October, 2002</I>: Alpha release 4 for Lisa 2.0 is now
available. New to this version is the Lisa debugger, a simple,
interactive production rule monitoring/inspection facility. The
Reference Guide in the distribution has a chapter explaining how to
use it.</P>
<P>Additional items of interest can be found <A HREF="news.htm">here</A>.</P>
<H3>Related Links</H3>
<P>This section contains a small collection of topics related to Lisa
and its development environment. It will be updated periodically as
the need arises. NB: If your favorite Lisp/Environment/Tool was
omitted here it was done without prejudice; I simply haven't had time
to test Lisa with every mainstream Lisp implementation, or
investigate every knowledge representation system, or... you get the
idea. <BR><BR><BR>
</P>
<TABLE COLS=2 WIDTH=893 BORDER=0 CELLPADDING=0 CELLSPACING=2>
<TR>
<TD WIDTH=351>
<P><B>Free Common Lisp Implementations</B></P>
</TD>
<TD WIDTH=528>
<P><B>Commercial Common Lisp Implementations</B></P>
</TD>
</TR>
<TR>
<TD WIDTH=351>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.cons.org/cmucl">CMU
Common Lisp</A> (CMUCL)
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://clisp.cons.org/">CLISP</A>
</P>
<LI><P><A HREF="http://armedbear-j.sourceforge.net/">Armed Bear
Lisp</A> (ABL)
</P>
</UL>
</TD>
<TD WIDTH=528>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.lispworks.com/">LispWorks</A>:
Xanalys, Inc. My Lisp environment of choice. Reminds me of my
Symbolics days...
</P>
<LI><P><A HREF="http://www.franz.com/">Allegro Common Lisp</A>:
Franz, Inc.</P>
</UL>
</TD>
</TR>
</TABLE>
<P><BR><BR>
</P>
<TABLE COLS=2 WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=2>
<TR>
<TD>
<P><B>Lisp Development Environments and Libraries</B></P>
</TD>
<TD>
<P> </P>
</TD>
</TR>
<TR>
<TD>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.gnu.org/">Emacs</A>:
No comment necessary.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://ilisp.sourceforge.net/">ILisp</A>:
A nice, comprehensive Emacs Lisp package that integrates a number
of Lisp implementations.
</P>
<LI><P><A HREF="http://clocc.sourceforge.net/">CLOCC</A>: The
Common Lisp Open Code Collection.
</P>
</UL>
</TD>
<TD>
<P> </P>
</TD>
</TR>
</TABLE>
<P><BR><BR>
</P>
<TABLE COLS=2 WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=2>
<TR>
<TD>
<P><B>Commercial and Restricted-Use Knowledge Systems</B></P>
</TD>
<TD>
<P><B>Freely-Available Knowledge Systems</B></P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.isi.edu/isd/LOOM/LOOM-HOME.html">Loom,
PowerLoom</A>: Semantic networks, ontologies.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.lispworks.com/">KnowledgeWorks</A>:
Production-rule system for LispWorks.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://herzberg.ca.sandia.gov/jess/">JESS</A>:
The Java Expert System Shell.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.ilog.com/">JRules</A>:
ILog's production-rule system for Java.
</P>
<LI><P><A HREF="http://www.haley.com/">Eclipse, Authorete</A>:
The Haley Enterprise's production rule suite.
</P>
</UL>
</TD>
<TD>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.ghgcorp.com/clips/CLIPS.html">CLIPS</A>:
A classic expert system tool.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.cis.upenn.edu/~screamer-tools/home.html">Screamer:</A>
Nondeterministic programming for Lisp.
</P>
<LI><P><A HREF="http://jlisa.sf.net/">JLisa</A>: A powerful
framework for building business rules accessible to Java.
</P>
</UL>
<P><BR> </P>
</TD>
</TR>
</TABLE>
<P><BR><BR>
</P>
<TABLE COLS=2 WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=2>
<TR>
<TD>
<P><B>Useful References</B></P>
</TD>
<TD>
<P> </P>
</TD>
</TR>
<TR>
<TD>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.lisp.org/HyperSpec/FrontMatter/index.html">Common
Lisp HyperSpec</A>: HTML version of the ANSI standard X3.226,
1994.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.alu.org/mop/index.html">The
CLOS MOP</A>: HTML version of the AMOP.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.alu.org/">ALU</A>:
The Association of Lisp Users.
</P>
<LI><P STYLE="margin-bottom: 0in"><I>Steele, Guy L. Jr.</I>:
<A HREF="http://www.amazon.com/exec/obidos/ASIN/1555580416/qid%3D984074327/107-1518177-7350946">Common
Lisp : The Language, Second Edition</A> (CLtL2).
</P>
<LI><P STYLE="margin-bottom: 0in"><I>Keene, Sonya E.</I>: <A HREF="http://www.amazon.com/exec/obidos/ASIN/0201175894/">Object
Oriented Programming in Common Lisp - A Programmer's Guide to the
Common Lisp Object System.</A>
</P>
<LI><P STYLE="margin-bottom: 0in"><I>Kiczales, Gregor et al</I>:
<A HREF="http://www.amazon.com/exec/obidos/ASIN/0262610744/">The
Art of the Metaobject Protocol.</A>
</P>
<LI><P STYLE="margin-bottom: 0in"><I>Graham, Paul</I>: <A HREF="http://www.amazon.com/exec/obidos/ASIN/0133708756/ref=sim_books/104-3504753-0375128">ANSI
Common Lisp</A>.
</P>
<LI><P><I>Graham, Paul</I>: <A HREF="http://www.amazon.com/exec/obidos/ASIN/0130305529/">On
Lisp</A>.
</P>
</UL>
</TD>
<TD>
<P> </P>
</TD>
</TR>
</TABLE>
<P><B>Credits</B>
</P>
<P>The background image for this web site was lifted, with
permission, from the Loom project home page.
</P>
</BODY>
</HTML> | 17,826 | Common Lisp | .l | 414 | 40.582126 | 187 | 0.728557 | Ramarren/lisa | 17 | 3 | 1 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 89490e9369e30f0d15d7ab47a60469a6746128c7ea3d54348dbaa4b08085e54f | 9,927 | [
-1
] |
9,942 | cl-cron.lisp | ciel-lang_cl-cron/cl-cron.lisp | ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-CRON;
;;; Copyright (c) 2009, Mackram Ghassan Raydan
;;; This file is part of cl-cron.
;;; cl-cron is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; cl-cron is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with cl-cron. If not, see <http://www.gnu.org/licenses/>.
(in-package :cl-cron)
(defparameter *day-list*
'(:monday :tuesday :wednesday :thursday :friday :saturday :sunday))
(defparameter *month-list*
'(:january :february :march :april :may :june :july :august :september :october :november :december))
(defclass cron-job ()
((minute :accessor job-minute :initarg :job-minute :initform :every)
(hour :accessor job-hour :initarg :job-hour :initform :every)
(day-of-month :accessor job-dom :initarg :job-dom :initform :every)
(month :accessor job-month :initarg :job-month :initform :every)
(day-of-week :accessor job-dow :initarg :job-dow :initform :every)
(at-boot :accessor job-@boot :initarg :job-@boot :initform nil)
(function-symbol :accessor job-func :initarg :job-func)))
(defvar *cron-jobs-hash* (make-hash-table)
"contains a hash of all cron-job objects that need to be run")
(defvar *cron-dispatcher-thread* nil
"a parameter to that holds the cron-dispatcher thread")
(defvar *cron-dispatcher-processing* (bordeaux-threads:make-lock)
"allows us to not kill the thread unless the lock can be acquired")
(defparameter *cron-load-file* nil
"a parameter which points to a lisp or fasl file which would be loaded once start-cron is called. The boot file should be made of as many make-cron-job calls as you like one after the other in normal s-expression fashion.")
(defparameter *cron-log-file* "./cl-cron.log"
"a parameter to set the cron file log location.")
(defun make-cron-job (function-symbol &key (minute :every) (step-min 1) (hour :every) (step-hour 1) (day-of-month :every)
(step-dom 1) (month :every) (step-month 1) (day-of-week :every) (step-dow 1) (boot-only nil) (hash-key nil))
"creates a new instance of a cron-job object and appends it to the cron-jobs-list after processing its time. Note that if you wish to use multiple values for each parameter you need to provide a list of numbers or use the gen-list function. You can not have a list of symbols when it comes to month or day-of-week. Please note that as by ANSI Common Lisp for the month variable the possible values are between 1 and 12 inclusive with January=1 and for day of week the possible values are between 0 and 6 with Monday=0. Returns the hash-key"
(if (eql hash-key nil) (setf hash-key (gensym "cron")))
(setf (gethash hash-key *cron-jobs-hash*)
(make-instance 'cron-job
:job-minute (get-minutes minute step-min)
:job-hour (get-hours hour step-hour)
:job-dom (get-days-of-month day-of-month step-dom)
:job-month (get-months month step-month)
:job-dow (get-days-of-week day-of-week step-dow)
:job-@boot boot-only
:job-func function-symbol))
hash-key)
(defun delete-cron-job (cron-key)
"deletes the cron job with the corresponding hash key"
(remhash cron-key *cron-jobs-hash*))
(defun time-to-run-job (job)
"checks if it is time to run the current job based on the current time"
(multiple-value-bind (usec umin uhour udom umonth uyear udow)
(decode-universal-time (get-universal-time))
(declare (ignore usec))
(and (member umin (job-minute job))
(member uhour (job-hour job))
(cond
((and (= (length (job-dom job)) 31)
(= (length (job-dow job)) 7))
t)
((and (= (length (job-dom job)) 31)
(not (= (length (job-dow job)) 7)))
(member udow (job-dow job)))
((and (not (= (length (job-dom job)) 31))
(= (length (job-dow job)) 7))
(member udom (job-dom job)))
(t
(or (member udom (job-dom job))
(member udow (job-dow job)))))
(member umonth (job-month job))
(not (job-@boot job)))))
(defun current-time-as-str ()
(multiple-value-bind (second minute hour day month year)
(decode-universal-time (get-universal-time))
(format nil "~A-~2,,,'0@A-~2,,,'0@A ~2,,,'0@A:~2,,,'0@A:~2,,,'0@A"
year month day hour minute second)))
(defun run-job-if-time (key job)
"runs the cron-job object in a separate thread if it is its time"
(when (time-to-run-job job)
(bordeaux-threads:make-thread (job-func job)
:name (format nil "Cron ~S (started at ~A)"
key
(current-time-as-str)))))
(defun run-job-if-boot (key job)
"runs the cron-job object in a separate thread if it is a boot job"
(when (job-@boot job)
(bordeaux-threads:make-thread (job-func job)
:name (format nil "Cron ~S (started at ~A)"
key
(current-time-as-str)))))
(defun cron-dispatcher ()
"function that dispatches the jobs that are ready to be run"
(do ()
(nil nil)
(sleep (time-until-full-minute (get-universal-time)))
(bordeaux-threads:with-lock-held (*cron-dispatcher-processing*)
(maphash #'run-job-if-time *cron-jobs-hash*))))
(defun start-cron ()
"function that starts cron by first loading the cron file defined in the variable, then it runs any cron-job that has the job-only-at-boot property set to t. Finally, it starts a thread that runs cron-dispatcher"
(cond (*cron-dispatcher-thread*
(log-cron-message "You attempted to call start-cron while cron is already loaded and running..."))
(t
(if *cron-load-file*
(load *cron-load-file* :verbose nil :print nil :if-does-not-exist nil))
(maphash #'run-job-if-boot *cron-jobs-hash*)
(setf *cron-dispatcher-thread* (bordeaux-threads:make-thread #'cron-dispatcher
:name "cl-cron")))))
(defun restart-cron()
"function that starts up cron but without loading the file or running any of the boot only cron jobs in the list"
(if (or (null *cron-dispatcher-thread*)
(not (bt:thread-alive-p *cron-dispatcher-thread*)))
(setf *cron-dispatcher-thread* (bordeaux-threads:make-thread #'cron-dispatcher
:name "cl-cron"))
(log-cron-message "You attempted to call restart-cron while cron is already loaded and running...")))
(defun stop-cron ()
"allows the stoppage of cron through the killing of the cron-dispatcher. Note that cron-dispatcher is killed only if it is sleeping otherwise we wait till the cron jobs finish. To reuse cron after calling stop-cron, you would need to recall start-cron which would go through all the steps as if cron has just booted. If you wish to prevent these actions when you restart cron then please you restart-cron."
(bordeaux-threads:with-lock-held (*cron-dispatcher-processing*)
(cond (*cron-dispatcher-thread*
(bordeaux-threads:destroy-thread *cron-dispatcher-thread*)
(setf *cron-dispatcher-thread* nil))
(t
(log-cron-message "You attempted to call stop-cron while cron is already stopped...")))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;Utilities for cron that are needed;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmacro def-cron-get-methods (tag-name unit-total-list &optional (allows-symbols nil) (symbol-list nil) (symbol-offset 0))
`(defun ,tag-name (unit step-unit)
(cond ((eq unit :every)
(elements-within-step ,unit-total-list step-unit))
((and (symbolp unit)
,allows-symbols
(not (eq unit :every)))
(let ((num (position unit ,symbol-list)))
(if (numberp num)
(list (+ num ,symbol-offset))
(log-cron-message (format nil "~A could not find the symbol in its corresponding list." ',tag-name)))))
((numberp unit)
(list unit))
((and (consp unit)
(some #'listp unit))
(let ((expanded-list (expand-internal-lists unit)))
(if (every #'numberp expanded-list)
(elements-within-step expanded-list step-unit)
(log-cron-message (format nil "~A could not expand the list of data you provided since it contained symbols." ',tag-name)))))
((and (consp unit) (every #'numberp unit))
(elements-within-step unit step-unit))
(t
(log-cron-message (format nil "~A could not retrieve an appropriate value from what you offered." ',tag-name))))))
(def-cron-get-methods get-minutes (gen-list 0 59))
(def-cron-get-methods get-hours (gen-list 0 23))
(def-cron-get-methods get-days-of-month (gen-list 1 31))
(def-cron-get-methods get-months (gen-list 1 12) t *month-list* 1)
(def-cron-get-methods get-days-of-week (gen-list 0 6) t *day-list*)
(defun gen-list (start-list end-list &optional (increment 1))
"functions that returns a list of numbers starting with start-list and ending with end-list"
(if (> start-list end-list)
nil
(cons start-list (gen-list (+ increment start-list) end-list increment))))
(defun min-list (lst)
"finds the minimum element of a list"
(cond ((endp (cdr lst))
(car lst))
(t
(min (car lst) (min-list (cdr lst))))))
(defun max-list (lst)
"finds the minimum element of a list"
(cond ((endp (cdr lst))
(car lst))
(t
(max (car lst) (max-list (cdr lst))))))
(defun expand-internal-lists (lst)
"function that takes a list and returns a list but with all internal lists expanded"
(if (null lst)
nil
(let ((elt (car lst))
(rest (expand-internal-lists (cdr lst))))
(if (consp elt)
(append elt rest)
(cons elt rest)))))
(defun elements-within-step (lst step)
"function that returns a list of elements that are within a step from each other starting with the first element in the list"
(intersection (gen-list (min-list lst) (max-list lst) step) lst))
(defun time-until-full-minute (time)
(let ((seconds (decode-universal-time time)))
(- 60 seconds)))
(defun log-cron-message (message &optional (type "error"))
"Simply log the message sent with type as well"
(if *cron-log-file*
(with-open-file (out *cron-log-file* :direction :output :if-exists :append :if-does-not-exist :create)
(format out "[~A] ~A ~1%" type message))))
| 10,799 | Common Lisp | .lisp | 196 | 49.122449 | 542 | 0.66493 | ciel-lang/cl-cron | 13 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 17f9d247e3d6a845671593e7b17468af2929d83fe7bb7d366e4c5991afba1627 | 9,942 | [
-1
] |
9,943 | packages.lisp | ciel-lang_cl-cron/packages.lisp | ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-CRON;
;;; Copyright (c) 2009, Mackram Ghassan Raydan
;;; This file is part of cl-cron.
;;; cl-cron is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; cl-cron is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with cl-cron. If not, see <http://www.gnu.org/licenses/>.
(in-package #:cl-user)
(defpackage :cl-cron
(:nicknames :cron)
(:use :cl)
(:export :make-cron-job
:delete-cron-job
:start-cron
:stop-cron
:restart-cron
:gen-list
:min-list
:max-list
:log-cron-message
:*cron-log-file*
:*cron-load-file*))
| 1,118 | Common Lisp | .lisp | 30 | 34.233333 | 75 | 0.672509 | ciel-lang/cl-cron | 13 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 1296cefa5704bbfcd07d6b4ae528c820dd59c78a90a7fb13b9a0581b738e95a3 | 9,943 | [
-1
] |
9,944 | cl-cron.asd | ciel-lang_cl-cron/cl-cron.asd | ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-CRON;
;;; Copyright (c) 2009, Mackram Ghassan Raydan
;;; This file is part of cl-cron.
;;; cl-cron is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; cl-cron is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with cl-cron. If not, see <http://www.gnu.org/licenses/>.
(asdf:defsystem #:cl-cron
:version "0.1"
:author "Mackram G Raydan"
:license "GPL"
:description "A simple tool that provides cron like facilities directly inside of common lisp. For this to work properly note that your lisp implementation should have support for threads"
:serial t
:depends-on (:bordeaux-threads)
:components ((:file "packages")
(:file "cl-cron")))
| 1,211 | Common Lisp | .asd | 24 | 48.375 | 190 | 0.710304 | ciel-lang/cl-cron | 13 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 61c9dd0d421b12aa08eac9617e7bf330e2d4addbb1e5a022cb433665fc376107 | 9,944 | [
-1
] |
9,963 | load.lisp | spacefrogg_clfswm/load.lisp | ;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: System loading functions
;;; --------------------------------------------------------------------------
;;;
;;; (C) 2005-2015 Philippe Brochard <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; --------------------------------------------------------------------------
;;;
;;; Edit this file (or its copy) and load it with your lisp implementation.
;;; If you want, it can download ASDF and CLX for you. You'll need wget and
;;; git program.
;;;
;;; Here are command line reference:
;;;
;;; clisp -E iso-8859-1 load.lisp
;;; sbcl --load load.lisp
;;; cmucl -load load.lisp
;;; ccl -l load.lisp
;;; ecl -load load.lisp
;;;
;;; --------------------------------------------------------------------------
;;;------------------
;;; Customization part
;;;------------------
(defparameter *interactive* t)
(defparameter *build-original-doc* t
"Set to t to use original configuration or to nil to use your own configuration
from $XDG_CONFIG_HOME/clfswm/clfswmrc")
;;; Comment or uncomment the lines above to fit your needs.
(pushnew :clfswm-compile *features*)
;;(pushnew :clfswm-run *features*)
(pushnew :clfswm-build-image *features*)
;;(pushnew :clfswm-build-doc *features*)
(defparameter *binary-name* "clfswm")
;;;;; Uncomment the line below if you want to see all ignored X errors
;;(pushnew :xlib-debug *features*)
;;;;; Uncomment the line below if you want to see all event debug messages
;;(pushnew :event-debug *features*)
#+:CMU (setf ext:*gc-verbose* nil)
#+:SBCL
(require :sb-posix)
(load (compile-file "src/tools.lisp"))
(defun load-info (formatter &rest args)
(format t "~& ==> ~A~%" (apply #'format nil formatter args))
(force-output))
(defun interactive-ask (formatter &rest args)
(when *interactive*
(y-or-n-p (apply #'format nil formatter args))))
;;;------------------
;;; XLib part 1
;;;------------------
#+(or :CMU :ECL)
(require :clx)
;;;------------------
;;; ASDF part
;;;------------------
;;;; Loading ASDF
(load-info "Requiring ASDF")
#+(or :SBCL :CMUCL :CCL :ECL)
(require :asdf)
#-ASDF
(when (probe-file "asdf.lisp")
(load "asdf.lisp"))
#-:ASDF
(let ((asdf-url "http://common-lisp.net/project/asdf/asdf.lisp"))
(when (interactive-ask "ASDF not found. Do you want to download it from ~A ?" asdf-url)
(tools:do-shell-output "wget ~A" asdf-url)
(load "asdf.lisp")))
(format t "ASDF version: ~A~%" (asdf:asdf-version))
;;;------------------
;;; XLib part 2
;;;------------------
(load-info "Requiring CLX")
;;; Loading clisp dynamic module. This part needs clisp >= 2.50
;;#+(AND CLISP (not CLX))
;;(when (fboundp 'require)
;; (require "clx.lisp"))
#-CLX
(progn
(when (probe-file "clx/clx.asd")
(load "clx/clx.asd")
(asdf:oos 'asdf:load-op :clx)))
#-CLX
(progn
(let ((clx-url "git://github.com/sharplispers/clx.git"))
(when (interactive-ask "CLX not found. Do you want to download it from ~A ?" clx-url)
(unless (probe-file "clx/clx.asd")
(tools:do-shell-output "git clone ~A" clx-url))
(load "clx/clx.asd")
(asdf:oos 'asdf:load-op :clx))))
;;;------------------
;;; CLFSWM loading
;;;------------------
#+:clfswm-compile
(progn
(load-info "Compiling CLFSWM")
(load "clfswm.asd")
(asdf:oos 'asdf:load-op :clfswm))
;;;-------------------------
;;; Starting clfswm
;;;-------------------------
#+(or :clfswm-run :clfswm-build-doc :clfswm-build-image)
(in-package :clfswm)
#+(or :clfswm-run :clfswm-build-doc)
(progn
(cl-user::load-info "Running CLFSWM")
(ignore-errors
(main :read-conf-file-p (not cl-user::*build-original-doc*))))
;;;-------------------------
;;; Building documentation
;;;-------------------------
#+:clfswm-build-doc
(progn
(cl-user::load-info "Building documentation")
(produce-all-docs))
;;;-----------------------
;;; Building image part
;;;-----------------------
;;; Uncomment the line below to set the contrib directory in the image
;; (setf *contrib-dir* "/usr/local/lib/clfswm/")
#+:clfswm-build-image
(progn
(cl-user::load-info "Building CLFSWM executable image")
(build-lisp-image "clfswm"))
| 4,987 | Common Lisp | .lisp | 141 | 33.510638 | 89 | 0.592146 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 1f253d7161028b079effccb51dc0f2e648592b5141b2f7a42a115ac01302fd4a | 9,963 | [
-1
] |
9,964 | netwm-util.lisp | spacefrogg_clfswm/src/netwm-util.lisp | ;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: NetWM functions
;;; http://freedesktop.org/wiki/Specifications_2fwm_2dspec
;;; --------------------------------------------------------------------------
;;;
;;; (C) 2005-2015 Philippe Brochard <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; --------------------------------------------------------------------------
(in-package :clfswm)
;;; Client List functions
(defun netwm-set-client-list (id-list)
(xlib:change-property *root* :_NET_CLIENT_LIST id-list :window 32))
(defun netwm-get-client-list ()
(xlib:get-property *root* :_NET_CLIENT_LIST))
(defun netwm-add-in-client-list (window)
(let ((last-list (netwm-get-client-list)))
(pushnew (xlib:window-id window) last-list)
(netwm-set-client-list last-list)))
(defun netwm-remove-in-client-list (window)
(netwm-set-client-list (remove (xlib:window-id window) (netwm-get-client-list))))
;;; Desktop functions ;; +PHIL
(defun netwm-update-desktop-property ()
;; (xlib:change-property *root* :_NET_NUMBER_OF_DESKTOPS
;; (list (length *workspace-list*)) :cardinal 32)
;; (xlib:change-property *root* :_NET_DESKTOP_GEOMETRY
;; (list (screen-width)
;; (screen-height))
;; :cardinal 32)
;; (xlib:change-property *root* :_NET_DESKTOP_VIEWPORT
;; (list 0 0) :cardinal 32)
;; (xlib:change-property *root* :_NET_CURRENT_DESKTOP
;; (list 1) :cardinal 32)
;;; TODO
;;(xlib:change-property *root* :_NET_DESKTOP_NAMES
;; (list "toto" "klm" "poi") :string 8 :transform #'xlib:char->card8))
)
;;; Taken from stumpwm (thanks)
(defun netwm-set-properties ()
"Set NETWM properties on the root window of the specified screen.
FOCUS-WINDOW is an extra window used for _NET_SUPPORTING_WM_CHECK."
;; _NET_SUPPORTED
(xlib:change-property *root* :_NET_SUPPORTED
(mapcar (lambda (a)
(xlib:intern-atom *display* a))
(append +netwm-supported+
(mapcar 'car +netwm-window-types+)))
:atom 32)
;; _NET_SUPPORTING_WM_CHECK
(xlib:change-property *root* :_NET_SUPPORTING_WM_CHECK
(list *no-focus-window*) :window 32
:transform #'xlib:drawable-id)
(xlib:change-property *no-focus-window* :_NET_SUPPORTING_WM_CHECK
(list *no-focus-window*) :window 32
:transform #'xlib:drawable-id)
(xlib:change-property *no-focus-window* :_NET_WM_NAME
"clfswm"
:string 8 :transform #'xlib:char->card8)
(netwm-update-desktop-property))
| 3,316 | Common Lisp | .lisp | 75 | 41.746667 | 83 | 0.636927 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 14cc2bced8ebb214d623bb10020815e735deb3c78e2f9601e1a5bbd0080e9fb4 | 9,964 | [
-1
] |
9,965 | package.lisp | spacefrogg_clfswm/src/package.lisp | ;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: Package definition
;;; --------------------------------------------------------------------------
;;;
;;; (C) 2005-2015 Philippe Brochard <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; --------------------------------------------------------------------------
(in-package :cl-user)
(defpackage clfswm
(:use :common-lisp :my-html :tools :version)
;; (:shadow :defun)
(:export :main
:reload-clfswm
:reset-clfswm
:exit-clfswm))
;;;;; Uncomment the line below if you want to see all ignored X errors
;;(pushnew :xlib-debug *features*)
;;;;; Uncomment the line below if you want to see all event debug messages
;;(pushnew :event-debug *features*)
(in-package :clfswm)
;;; CONFIG - Compress motion notify ?
;; This variable may be useful to speed up some slow version of CLX.
;; It is particulary useful with CLISP/MIT-CLX (and others).
(defconfig *have-to-compress-notify* t
nil "Compress event notify?
This variable may be useful to speed up some slow version of CLX.
It is particulary useful with CLISP/MIT-CLX.")
(defconfig *transparent-background* t
nil "Enable transparent background: one of nil, :pseudo, t (xcompmgr must be started)")
(defconfig *default-transparency* 0.8
nil "Default transparency for all windows when in xcompmgr transparency mode")
(defconfig *show-root-frame-p* nil
nil "Show the root frame information or not")
(defconfig *border-size* 1
nil "Windows and frames border size")
(defparameter *modifier-alias* '((:alt :mod-1) (:alt-l :mod-1)
(:numlock :mod-2)
(:super_l :mod-4)
(:alt-r :mod-5) (:alt-gr :mod-5)
(:capslock :lock))
"Syntax: (modifier-alias effective-modifier)")
(defparameter *display* nil)
(defparameter *screen* nil)
(defparameter *root* nil)
(defparameter *no-focus-window* nil)
(defparameter *sm-window* nil)
(defparameter *sm-font* nil)
(defparameter *sm-gc* nil)
(defparameter *background-image* nil)
(defparameter *background-gc* nil)
(defparameter *expose-child-list* nil)
(defconfig *loop-timeout* 1 nil
"Maximum time (in seconds) to wait before calling *loop-hook*")
(defparameter *pixmap-buffer* nil)
(defparameter *contrib-dir* "contrib/")
(defparameter *default-font* nil)
;;(defparameter *default-font-string* "9x15")
(defconfig *default-font-string* "fixed" nil
"The default font used in clfswm")
(defconfig *color-move-window* "DeepPink" 'Main-mode
"Color when moving or resizing a windows")
(defparameter *child-selection* nil)
;;; CONFIG - Default frame datas
(defconfig *default-frame-data*
(list '(:tile-size 0.8) '(:tile-space-size 0.1)
'(:fast-layout (tile-left-layout tile-layout))
'(:main-layout-windows nil))
nil
"Default slots set in frame date")
;;; CONFIG - Default managed window type for a frame
;;; type can be :all, :normal, :transient, :maxsize, :desktop, :dock, :toolbar, :menu, :utility, :splash, :dialog
(defconfig *default-managed-type* '(:normal) nil
"Default managed window types")
;;(defparameter *default-managed-type* '(:normal :maxsize :transient))
;;(defparameter *default-managed-type* '(:normal :transient :maxsize :desktop :dock :toolbar :menu :utility :splash :dialog))
;;(defparameter *default-managed-type* '())
;;(defparameter *default-managed-type* '(:all))
;;; CONFIG - Default focus policy
(defconfig *default-focus-policy* :click nil
"Default mouse focus policy. One of :click, :sloppy, :sloppy-strict, :sloppy-select or
:sloppy-select-window.")
(defconfig *show-hide-policy* #'<=
nil "'NIL': always display all children (better with transparency support).
'<': Hide only children less than children above.
'<=': Hide children less or equal to children above (better for performance on slow machine).")
(defconfig *show-hide-policy-type* '(:normal)
nil "Windows types which are optimized by the show hide policy")
(defstruct child-rect child parent selected-p x y w h)
(defstruct root child original current-child x y w h)
(defclass frame ()
((name :initarg :name :accessor frame-name :initform nil)
(number :initarg :number :accessor frame-number :initform 0)
;;; Float size between 0 and 1 - Manipulate only those variables and not real size
(x :initarg :x :accessor frame-x :initform 0.1)
(y :initarg :y :accessor frame-y :initform 0.1)
(w :initarg :w :accessor frame-w :initform 0.8)
(h :initarg :h :accessor frame-h :initform 0.8)
;;; Real size (integer) in screen size - Don't set directly those variables
;;; they may be recalculated by the layout manager.
(rx :initarg :rx :accessor frame-rx :initform 0)
(ry :initarg :ry :accessor frame-ry :initform 0)
(rw :initarg :rw :accessor frame-rw :initform 800)
(rh :initarg :rh :accessor frame-rh :initform 600)
;; (root :initarg :root :accessor frame-root :initform nil
;; :documentation "A list a physical coordinates (x y w h) if frame is a root frame. Nil otherwise")
(layout :initarg :layout :accessor frame-layout :initform nil
:documentation "Layout to display windows on a frame")
(nw-hook :initarg :nw-hook :accessor frame-nw-hook :initform nil
:documentation "Hook done by the frame when a new window is mapped")
(managed-type :initarg :managed-type :accessor frame-managed-type
:initform *default-managed-type*
:documentation "Managed window type")
(forced-managed-window :initarg :forced-managed-window
:accessor frame-forced-managed-window
:initform nil
:documentation "A list of forced managed windows (xlib:wm-name or window)")
(forced-unmanaged-window :initarg :forced-unmanaged-window
:accessor frame-forced-unmanaged-window
:initform nil
:documentation "A list of forced unmanaged windows (xlib:wm-name or window)")
(show-window-p :initarg :show-window-p :accessor frame-show-window-p :initform t)
(hidden-children :initarg :hidden-children :accessor frame-hidden-children :initform nil
:documentation "A list of hidden children")
(selected-pos :initarg :selected-pos :accessor frame-selected-pos :initform 0
:documentation "The position in the child list of the selected child")
(focus-policy :initarg :focus-policy :accessor frame-focus-policy
:initform *default-focus-policy*)
(window :initarg :window :accessor frame-window :initform nil)
(gc :initarg :gc :accessor frame-gc :initform nil)
(child :initarg :child :accessor frame-child :initform nil)
(data :initarg :data :accessor frame-data
:initform *default-frame-data*
:documentation "An assoc list to store additional data")))
(defparameter *root-frame* nil
"Root of the root - ie the root frame")
(defparameter *main-keys* nil)
(defparameter *main-mouse* nil)
(defparameter *second-keys* nil)
(defparameter *second-mouse* nil)
(defparameter *info-keys* nil)
(defparameter *info-mouse* nil)
(defparameter *query-keys* nil)
(defparameter *circulate-keys* nil)
(defparameter *circulate-keys-release* nil)
(defparameter *expose-keys* nil)
(defparameter *expose-mouse* nil)
(defparameter *other-window-manager* nil)
(defstruct menu name item doc)
(defstruct menu-item key value)
(defparameter *menu* (make-menu :name 'main :doc "Main menu"))
(defconfig *binding-hook* nil 'Hook
"Hook executed when keys/buttons are bounds")
(defconfig *loop-hook* nil 'Hook
"Hook executed on each event loop")
(defconfig *main-entrance-hook* nil 'Hook
"Hook executed on the main function entrance after
loading configuration file and before opening the display.")
(defconfig *root-size-change-hook* nil 'Hook
"Hook executed when the root size has changed for example when adding/removing a monitor")
(defparameter *in-second-mode* nil)
;;; Placement variables. A list of two absolute coordinates
;;; or a function: 'Y-X-placement' for absolute placement or
;;; 'Y-X-child-placement' for child relative placement or
;;; 'Y-X-root-placement' for root relative placement.
;;; Where Y-X are one of:
;;;
;;; top-left top-middle top-right
;;; middle-left middle-middle middle-right
;;; bottom-left bottom-middle bottom-right
;;;
(defconfig *banish-pointer-placement* 'bottom-right-root-placement
'Placement "Pointer banishment placement")
(defconfig *second-mode-placement* 'top-middle-root-placement
'Placement "Second mode window placement")
(defconfig *info-mode-placement* 'top-left-root-placement
'Placement "Info mode window placement")
(defconfig *query-mode-placement* 'top-left-root-placement
'Placement "Query mode window placement")
(defconfig *circulate-mode-placement* 'bottom-middle-root-placement
'Placement "Circulate mode window placement")
(defconfig *expose-mode-placement* 'top-left-child-placement
'Placement "Expose mode window placement (Selection keys position)")
(defconfig *expose-query-placement* 'bottom-left-root-placement
'Placement "Expose mode query window placement")
(defconfig *fastswitch-mode-placement* 'top-left-root-placement
'Placement "Fastswitch mode window placement")
(defconfig *notify-window-placement* 'bottom-right-root-placement
'Placement "Notify window placement")
(defconfig *ask-close/kill-placement* 'top-right-root-placement
'Placement "Ask close/kill window placement")
(defconfig *unmanaged-window-placement* 'middle-middle-root-placement
'Placement "Unmanager window placement")
(defparameter *in-process-existing-windows* nil)
;; For debug - redefine defun
;;(shadow :defun)
;;(defmacro defun (name args &body body)
;; `(progn
;; (format t "defun: ~A ~A~%" ',name ',args)
;; (force-output)
;; (cl:defun ,name ,args
;; (handler-case
;; (progn
;; ,@body)
;; (error (c)
;; (format t "New defun: Error in ~A : ~A~%" ',name c)
;; (format t "Root tree=~A~%All windows=~A~%"
;; (xlib:query-tree *root*) (get-all-windows))
;; (force-output))))))
(defmacro make-x-drawable (argname type)
"Drawable wrapper to prevent type error in some CLX versions.
Replace xlib:drawable-* functions with x-drawable-* equivalents"
(let ((fun-symbol (create-symbol 'x-drawable- argname))
(set-symbol (create-symbol 'set-x-drawable- argname))
(xlib-equiv-symbol (create-symbol-in-package :xlib 'drawable- argname)))
`(progn
(declaim (inline ,fun-symbol))
(defun ,fun-symbol (window)
(,xlib-equiv-symbol window))
(defun ,set-symbol (window ,argname)
(if (typep ,argname ',type)
(setf (,xlib-equiv-symbol window) ,argname)
(dbg ',(create-symbol 'drawable-type-error- argname) window ,argname (xlib:wm-name window))))
(defsetf ,fun-symbol ,set-symbol))))
(make-x-drawable x (signed-byte 16))
(make-x-drawable y (signed-byte 16))
(make-x-drawable width (unsigned-byte 16))
(make-x-drawable height (unsigned-byte 16))
(make-x-drawable border-width (unsigned-byte 16))
| 11,766 | Common Lisp | .lisp | 245 | 45.073469 | 125 | 0.709807 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 65bfd26140d038aed8a9a38c9e4e2854c83cb5a1a298c12326409a9212374aed | 9,965 | [
-1
] |
9,970 | bindings-second-mode.lisp | spacefrogg_clfswm/src/bindings-second-mode.lisp | ;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: Bindings keys and mouse for second mode
;;;
;;; Note: Mod-1 is the Alt or Meta key, Mod-2 is the Numlock key.
;;; --------------------------------------------------------------------------
;;;
;;; (C) 2005-2015 Philippe Brochard <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; --------------------------------------------------------------------------
(in-package :clfswm)
;;;,-----
;;;| Second keys
;;;|
;;;| CONFIG - Second mode bindings
;;;`-----
(add-hook *binding-hook* 'init-*second-keys* 'init-*second-mouse*)
(defun open-frame-menu ()
"Open the frame menu"
(open-menu (find-menu 'frame-menu)))
(defun open-window-menu ()
"Open the window menu"
(open-menu (find-menu 'window-menu)))
(defun open-action-by-name-menu ()
"Open the action by name menu"
(open-menu (find-menu 'action-by-name-menu)))
(defun open-action-by-number-menu ()
"Open the action by number menu"
(open-menu (find-menu 'action-by-number-menu)))
(defun open-frame-movement-menu ()
"Open the frame movement menu (pack/fill/resize)"
(open-menu (find-menu 'frame-movement-menu)))
(defun open-root-menu ()
"Open the root menu"
(open-menu (find-menu 'root-menu)))
(defun open-child-menu ()
"Open the child menu"
(open-menu (find-menu 'child-menu)))
(defun tile-current-frame ()
"Tile the current frame"
(set-layout-once #'tile-layout)
(leave-second-mode))
(defun stop-all-pending-actions ()
"Stop all pending actions"
(clear-all-nw-hooks)
(leave-second-mode))
;;; default shell programs
(defmacro define-shell (key name docstring cmd)
"Define a second key to start a shell command"
`(define-second-key ,key
(defun ,name ()
,docstring
(setf *second-mode-leave-function* (let ((cmd ,cmd))
(lambda ()
(do-shell cmd))))
(leave-second-mode))))
(defun set-default-second-keys ()
(define-second-key ("F1" :mod-1) 'help-on-clfswm)
(define-second-key ("m") 'open-menu)
(define-second-key ("less") 'open-menu)
(define-second-key ("less" :control) 'open-menu)
(define-second-key ("f") 'open-frame-menu)
(define-second-key ("w") 'open-window-menu)
(define-second-key ("n") 'open-action-by-name-menu)
(define-second-key ("u") 'open-action-by-number-menu)
(define-second-key ("p") 'open-frame-movement-menu)
(define-second-key ("r") 'open-root-menu)
(define-second-key ("c") 'open-child-menu)
(define-second-key ("x") 'update-layout-managed-children-position)
(define-second-key ("g" :control) 'stop-all-pending-actions)
(define-second-key ("q") 'sm-delete-focus-window)
(define-second-key ("k") 'sm-ask-close/kill-current-window)
(define-second-key ("i") 'identify-key)
(define-second-key ("colon") 'eval-from-query-string)
(define-second-key ("exclam") 'run-program-from-query-string)
(define-second-key ("Return") 'leave-second-mode)
(define-second-key ("Escape") 'leave-second-mode)
(define-second-key ("t" :shift) 'tile-current-frame)
(define-second-key ("Home" :mod-1 :control :shift) 'exit-clfswm)
(define-second-key ("Right" :mod-1) 'select-next-brother)
(define-second-key ("Left" :mod-1) 'select-previous-brother)
(define-second-key ("Right" :mod-1 :shift) 'select-next-brother-take-current)
(define-second-key ("Left" :mod-1 :shift) 'select-previous-brother-take-current)
(define-second-key ("Down" :mod-1) 'select-previous-level)
(define-second-key ("Up" :mod-1) 'select-next-level)
(define-second-key ("Left" :control :mod-1) 'select-brother-spatial-move-left)
(define-second-key ("Right" :control :mod-1) 'select-brother-spatial-move-right)
(define-second-key ("Up" :control :mod-1) 'select-brother-spatial-move-up)
(define-second-key ("Down" :control :mod-1) 'select-brother-spatial-move-down)
(define-second-key ("Left" :control :mod-1 :shift) 'select-brother-spatial-move-left-take-current)
(define-second-key ("Right" :control :mod-1 :shift) 'select-brother-spatial-move-right-take-current)
(define-second-key ("Up" :control :mod-1 :shift) 'select-brother-spatial-move-up-take-current)
(define-second-key ("Down" :control :mod-1 :shift) 'select-brother-spatial-move-down-take-current)
(define-second-key ("j") 'swap-frame-geometry)
(define-second-key ("h") 'rotate-frame-geometry)
(define-second-key ("h" :shift) 'anti-rotate-frame-geometry)
(define-second-key ("Page_Up") 'select-next-root)
(define-second-key ("Page_Down") 'select-previous-root)
(define-second-key ("Page_Up" :control) 'rotate-root-geometry-next)
(define-second-key ("Page_Down" :control) 'rotate-root-geometry-previous)
(define-second-key ("Right") 'speed-mouse-right)
(define-second-key ("Left") 'speed-mouse-left)
(define-second-key ("Down") 'speed-mouse-down)
(define-second-key ("Up") 'speed-mouse-up)
(define-second-key ("Left" :control) 'speed-mouse-undo)
(define-second-key ("Up" :control) 'speed-mouse-first-history)
(define-second-key ("Down" :control) 'speed-mouse-reset)
(define-second-key ("Tab" :mod-1) 'select-next-child)
(define-second-key ("Tab" :mod-1 :shift) 'select-previous-child)
(define-second-key ("Tab" :mod-1 :control) 'select-next-subchild)
(define-second-key ("Tab") 'switch-to-last-child)
(define-second-key ("Return" :mod-1) 'enter-frame)
(define-second-key ("Return" :mod-1 :shift) 'leave-frame)
(define-second-key ("Return" :mod-1 :control) 'frame-toggle-maximize)
(define-second-key ("Return" :mod-5) 'frame-toggle-maximize)
(define-second-key ("Page_Up" :mod-1) 'frame-lower-child)
(define-second-key ("Page_Down" :mod-1) 'frame-raise-child)
(define-second-key ("Home" :mod-1) 'switch-to-root-frame)
(define-second-key ("Home" :mod-1 :shift) 'switch-and-select-root-frame)
(define-second-key ("Menu") 'toggle-show-root-frame)
(define-second-key ("b" :mod-1) 'banish-pointer)
(define-second-key ("o") 'set-open-in-new-frame-in-parent-frame-nw-hook)
(define-second-key ("o" :control) 'set-open-in-new-frame-in-root-frame-nw-hook)
(define-second-key ("a") 'add-default-frame)
(define-second-key ("a" :control) 'add-frame-in-parent-frame)
(define-second-key ("plus") 'inc-tile-layout-size)
(define-second-key ("minus") 'dec-tile-layout-size)
(define-second-key ("plus" :control) 'inc-slow-tile-layout-size)
(define-second-key ("minus" :control) 'dec-slow-tile-layout-size)
;; Escape
(define-second-key ("Escape" :control) 'ask-close/kill-current-window)
;; Selection
(define-second-key ("x" :control) 'cut-current-child)
(define-second-key ("x" :control :mod-1) 'clear-selection)
(define-second-key ("c" :control) 'copy-current-child)
(define-second-key ("v" :control) 'paste-selection)
(define-second-key ("v" :control :shift) 'paste-selection-no-clear)
(define-second-key ("Delete" :control) 'remove-current-child)
(define-second-key ("Delete") 'delete-current-child)
(define-shell ("t") b-start-xterm "start an xterm" "cd $HOME && exec xterm")
(define-shell ("e") b-start-emacs "start emacs" "cd $HOME && exec emacs")
(define-shell ("e" :control) b-start-emacsremote
"start an emacs for another user"
"exec xterm -e emacsremote")
(define-second-key ("F10" :mod-1) 'fast-layout-switch)
(define-second-key ("F10" :shift :control) 'toggle-show-root-frame)
(define-second-key ("F10") 'expose-windows-mode)
(define-second-key ("F10" :control) 'expose-all-windows-mode)
(define-second-key ("F12" :shift) 'show-all-frames-info-key)
(define-second-key ("F12" :shift :mod-1) 'show-all-frames-info)
;; Bind or jump functions
(define-second-key ("1" :mod-1) 'bind-or-jump 1)
(define-second-key ("2" :mod-1) 'bind-or-jump 2)
(define-second-key ("3" :mod-1) 'bind-or-jump 3)
(define-second-key ("4" :mod-1) 'bind-or-jump 4)
(define-second-key ("5" :mod-1) 'bind-or-jump 5)
(define-second-key ("6" :mod-1) 'bind-or-jump 6)
(define-second-key ("7" :mod-1) 'bind-or-jump 7)
(define-second-key ("8" :mod-1) 'bind-or-jump 8)
(define-second-key ("9" :mod-1) 'bind-or-jump 9)
(define-second-key ("0" :mod-1) 'bind-or-jump 10)
;;; Transparency
(define-second-key ("t" :control :shift) 'key-inc-transparency)
(define-second-key ("t" :control) 'key-dec-transparency))
(add-hook *binding-hook* 'set-default-second-keys)
;;; Mouse action
(defun sm-mouse-click-to-focus-and-move (window root-x root-y)
"Move and focus the current child - Create a new frame on the root window.
Or do corners actions"
(declare (ignore window))
(or (do-corner-action root-x root-y *corner-second-mode-left-button*)
(mouse-focus-move/resize-generic root-x root-y #'move-frame nil)))
(defun sm-mouse-click-to-focus-and-resize (window root-x root-y)
"Resize and focus the current child - Create a new frame on the root window.
Or do corners actions"
(declare (ignore window))
(or (do-corner-action root-x root-y *corner-second-mode-right-button*)
(mouse-focus-move/resize-generic root-x root-y #'resize-frame nil)))
(defun sm-mouse-middle-click (window root-x root-y)
"Do actions on corners"
(declare (ignore window))
(or (do-corner-action root-x root-y *corner-second-mode-middle-button*)
(replay-button-event)))
(defun sm-mouse-select-next-level (window root-x root-y)
"Select the next level in frame"
(declare (ignore window root-x root-y))
(select-next-level))
(defun sm-mouse-select-previous-level (window root-x root-y)
"Select the previous level in frame"
(declare (ignore window root-x root-y))
(select-previous-level))
(defun sm-mouse-enter-frame (window root-x root-y)
"Enter in the selected frame - ie make it the root frame"
(declare (ignore window root-x root-y))
(enter-frame))
(defun sm-mouse-leave-frame (window root-x root-y)
"Leave the selected frame - ie make its parent the root frame"
(declare (ignore window root-x root-y))
(leave-frame))
(defun sm-mouse-click-to-focus-and-move-window (window root-x root-y)
"Move and focus the current child - Create a new frame on the root window"
(declare (ignore window))
(mouse-focus-move/resize-generic root-x root-y #'move-frame t))
(defun sm-mouse-click-to-focus-and-resize-window (window root-x root-y)
"Resize and focus the current child - Create a new frame on the root window"
(declare (ignore window))
(mouse-focus-move/resize-generic root-x root-y #'resize-frame t))
(defun sm-mouse-click-to-focus-and-move-window-constrained (window root-x root-y)
"Move (constrained by other frames) and focus the current child - Create a new frame on the root window"
(declare (ignore window))
(mouse-focus-move/resize-generic root-x root-y #'move-frame-constrained t))
(defun sm-mouse-click-to-focus-and-resize-window-constrained (window root-x root-y)
"Resize (constrained by other frames) and focus the current child - Create a new frame on the root window"
(declare (ignore window))
(mouse-focus-move/resize-generic root-x root-y #'resize-frame-constrained t))
(defun set-default-second-mouse ()
(define-second-mouse (1) 'sm-mouse-click-to-focus-and-move)
(define-second-mouse (2) 'sm-mouse-middle-click)
(define-second-mouse (3) 'sm-mouse-click-to-focus-and-resize)
(define-second-mouse (1 :mod-1) 'sm-mouse-click-to-focus-and-move-window)
(define-second-mouse (3 :mod-1) 'sm-mouse-click-to-focus-and-resize-window)
(define-second-mouse (1 :mod-1 :shift) 'sm-mouse-click-to-focus-and-move-window-constrained)
(define-second-mouse (3 :mod-1 :shift) 'sm-mouse-click-to-focus-and-resize-window-constrained)
(define-second-mouse (1 :control :mod-1) 'mouse-move-child-over-frame)
(define-second-mouse (4) 'sm-mouse-select-next-level)
(define-second-mouse (5) 'sm-mouse-select-previous-level)
(define-second-mouse (4 :mod-1) 'sm-mouse-enter-frame)
(define-second-mouse (5 :mod-1) 'sm-mouse-leave-frame))
(add-hook *binding-hook* 'set-default-second-mouse)
| 12,736 | Common Lisp | .lisp | 245 | 49.110204 | 108 | 0.691844 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 42fceb748ab0f5c0da90216baed72aaa9a9b38c6db0165fbaeb08148046a94e3 | 9,970 | [
-1
] |
9,971 | clfswm-info.lisp | spacefrogg_clfswm/src/clfswm-info.lisp | ;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: Info function (see the end of this file for user definition
;;; --------------------------------------------------------------------------
;;;
;;; (C) 2005-2015 Philippe Brochard <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; --------------------------------------------------------------------------
(in-package :clfswm)
(defstruct info window gc font list ilw ilh x y max-x max-y)
(defparameter *info-selected-item* nil)
(defun leave-info-mode (info)
"Leave the info mode"
(declare (ignore info))
(setf *info-selected-item* nil)
(throw 'exit-info-loop nil))
(defun leave-info-mode-and-valid (info)
"Leave the info mode and valid the selected item"
(declare (ignore info))
(throw 'exit-info-loop nil))
(defun mouse-leave-info-mode (window root-x root-y info)
"Leave the info mode"
(declare (ignore window root-x root-y info))
(setf *info-selected-item* nil)
(throw 'exit-info-loop nil))
(defun find-info-item-from-mouse (root-x root-y info)
(if (< (x-drawable-x (info-window info)) root-x
(+ (x-drawable-x (info-window info))
(x-drawable-width (info-window info))))
(truncate (/ (- (+ (- root-y (x-drawable-y (info-window info)))
(xlib:max-char-ascent (info-font info))
(info-y info)) (info-ilh info)) (info-ilh info)))
nil))
(defun set-info-item-form-mouse (root-x root-y info)
(setf *info-selected-item* (find-info-item-from-mouse root-x root-y info)))
(defun info-y-display-coords (info posy)
(- (+ (* (info-ilh info) posy) (info-ilh info)) (info-y info)))
(defun incf-info-selected-item (info n)
(setf *info-selected-item*
(min (if *info-selected-item*
(+ *info-selected-item* n)
0)
(1- (or (length (info-list info)) 1)))))
(defun decf-info-selected-item (info n)
(declare (ignore info))
(setf *info-selected-item*
(max (if *info-selected-item*
(- *info-selected-item* n)
0)
0)))
(defun draw-info-window (info)
(labels ((print-line (line posx posy &optional (color *info-foreground*))
(xlib:with-gcontext ((info-gc info) :foreground (get-color color)
:background (if (equal posy *info-selected-item*)
(get-color *info-selected-background*)
(get-color *info-background*)))
(funcall (if (equal posy *info-selected-item*)
#'xlib:draw-image-glyphs
#'xlib:draw-glyphs)
*pixmap-buffer* (info-gc info)
(- (+ (info-ilw info) (* posx (info-ilw info))) (info-x info))
(info-y-display-coords info posy)
(ensure-printable (format nil "~A" line))))
(+ posx (length line))))
(clear-pixmap-buffer (info-window info) (info-gc info))
(loop for line in (info-list info)
for y from 0
do (typecase line
(cons (typecase (first line)
(cons (let ((posx 0))
(dolist (l line)
(typecase l
(cons (setf posx (print-line (first l) posx y (second l))))
(t (setf posx (print-line l posx y)))))))
(t (print-line (first line) 0 y (second line)))))
(t (print-line line 0 y))))
(copy-pixmap-buffer (info-window info) (info-gc info))))
;;;,-----
;;;| Key binding
;;;`-----
(add-hook *binding-hook* 'init-*info-keys* 'init-*info-mouse*)
(defun set-default-info-keys ()
(define-info-key (#\q) 'leave-info-mode)
(define-info-key ("Return") 'leave-info-mode-and-valid)
(define-info-key ("KP_Enter" :mod-2) 'leave-info-mode-and-valid)
(define-info-key ("space") 'leave-info-mode-and-valid)
(define-info-key ("Escape") 'leave-info-mode)
(define-info-key ("g" :control) 'leave-info-mode)
(define-info-key ("twosuperior")
(defun info-banish-pointer (info)
"Move the pointer to the lower right corner of the screen"
(declare (ignore info))
(banish-pointer)))
(define-info-key ("Down")
(defun info-next-line (info)
"Move one line down"
(incf-info-selected-item info 1)
(when (> (info-y-display-coords info *info-selected-item*)
(+ (x-drawable-y (info-window info))
(x-drawable-height (info-window info))))
(setf (info-y info) (min (+ (info-y info) (info-ilh info)) (info-max-y info))))
(draw-info-window info)))
(define-info-key ("Up")
(defun info-previous-line (info)
"Move one line up"
(decf-info-selected-item info 1)
(when (< (info-y-display-coords info *info-selected-item*)
(+ (x-drawable-y (info-window info))
(info-ilh info)))
(setf (info-y info) (max (- (info-y info) (info-ilh info)) 0)))
(draw-info-window info)))
(define-info-key ("Left")
(defun info-previous-char (info)
"Move one char left"
(setf (info-x info) (max (- (info-x info) (info-ilw info)) 0))
(draw-info-window info)))
(define-info-key ("Right")
(defun info-next-char (info)
"Move one char right"
(setf (info-x info) (min (+ (info-x info) (info-ilw info)) (info-max-x info)))
(draw-info-window info)))
(define-info-key ("Home")
(defun info-first-line (info)
"Move to first line"
(setf (info-x info) 0
(info-y info) 0)
(setf *info-selected-item* 0)
(draw-info-window info)))
(define-info-key ("End")
(defun info-end-line (info)
"Move to last line"
(setf (info-x info) 0
(info-y info) (- (* (length (info-list info)) (info-ilh info)) (x-drawable-height (info-window info))))
(setf *info-selected-item* (1- (or (length (info-list info)) 1)))
(draw-info-window info)))
(define-info-key ("Page_Down")
(defun info-next-ten-lines (info)
"Move ten lines down"
(incf-info-selected-item info 10)
(when (> (info-y-display-coords info *info-selected-item*)
(+ (x-drawable-y (info-window info))
(x-drawable-height (info-window info))))
(setf (info-y info) (min (+ (info-y info) (* (info-ilh info) 10)) (info-max-y info))))
(draw-info-window info)))
(define-info-key ("Page_Up")
(defun info-previous-ten-lines (info)
"Move ten lines up"
(decf-info-selected-item info 10)
(when (< (info-y-display-coords info *info-selected-item*)
(+ (x-drawable-y (info-window info))
(info-ilh info)))
(setf (info-y info) (max (- (info-y info) (* (info-ilh info) 10)) 0)))
(draw-info-window info))))
(add-hook *binding-hook* 'set-default-info-keys)
(defparameter *info-start-grab-x* nil)
(defparameter *info-start-grab-y* nil)
(defun info-begin-grab (window root-x root-y info)
"Begin grab text"
(declare (ignore window))
(setf *info-start-grab-x* (min (max (+ root-x (info-x info)) 0) (info-max-x info))
*info-start-grab-y* (min (max (+ root-y (info-y info)) 0) (info-max-y info)))
(draw-info-window info))
(defun info-end-grab (window root-x root-y info)
"End grab"
(declare (ignore window))
(setf (info-x info) (min (max (- *info-start-grab-x* root-x) 0) (info-max-x info))
(info-y info) (min (max (- *info-start-grab-y* root-y) 0) (info-max-y info))
*info-start-grab-x* nil
*info-start-grab-y* nil)
(draw-info-window info))
(defun info-mouse-next-line (window root-x root-y info)
"Move one line down"
(declare (ignore window))
(setf (info-y info) (min (+ (info-y info) (info-ilh info)) (info-max-y info)))
(set-info-item-form-mouse root-x root-y info)
(draw-info-window info))
(defun info-mouse-previous-line (window root-x root-y info)
"Move one line up"
(declare (ignore window))
(setf (info-y info) (max (- (info-y info) (info-ilh info)) 0))
(set-info-item-form-mouse root-x root-y info)
(draw-info-window info))
(defun info-mouse-motion-drag (window root-x root-y info)
"Grab text"
(declare (ignore window))
(when (and *info-start-grab-x* *info-start-grab-y*)
(setf (info-x info) (min (max (- *info-start-grab-x* root-x) 0) (info-max-x info))
(info-y info) (min (max (- *info-start-grab-y* root-y) 0) (info-max-y info)))
(draw-info-window info)))
(defun info-mouse-select-item (window root-x root-y info)
(declare (ignore window))
(set-info-item-form-mouse root-x root-y info)
(leave-info-mode-and-valid info))
(defun info-mouse-motion-click (window root-x root-y info)
(declare (ignore window))
(let ((last *info-selected-item*))
(set-info-item-form-mouse root-x root-y info)
(unless (equal last *info-selected-item*)
(draw-info-window info))))
(defun set-default-info-mouse ()
(if *info-click-to-select*
(define-info-mouse (1) nil 'info-mouse-select-item)
(define-info-mouse (1) 'info-begin-grab 'info-end-grab))
(define-info-mouse (2) 'mouse-leave-info-mode)
(define-info-mouse (3) 'mouse-leave-info-mode)
(define-info-mouse (4) 'info-mouse-previous-line)
(define-info-mouse (5) 'info-mouse-next-line)
(if *info-click-to-select*
(define-info-mouse ('motion) 'info-mouse-motion-click nil)
(define-info-mouse ('motion) 'info-mouse-motion-drag nil)))
(add-hook *binding-hook* 'set-default-info-mouse)
(let (info)
(define-handler info-mode :key-press (code state)
(funcall-key-from-code *info-keys* code state info))
(define-handler info-mode :motion-notify (window root-x root-y)
(unless (compress-motion-notify)
(funcall-button-from-code *info-mouse* 'motion (modifiers->state *default-modifiers*)
window root-x root-y *fun-press* (list info))))
(define-handler info-mode :button-press (window root-x root-y code state)
(funcall-button-from-code *info-mouse* code state window root-x root-y *fun-press* (list info)))
(define-handler info-mode :button-release (window root-x root-y code state)
(funcall-button-from-code *info-mouse* code state window root-x root-y *fun-release* (list info)))
(defun info-mode (info-list &key (width nil) (height nil))
"Open the info mode. Info-list is a list of info: One string per line
Or for colored output: a list (line_string color)
Or ((1_word color) (2_word color) 3_word (4_word color)...)"
(when info-list
(setf *info-selected-item* 0)
(labels ((compute-size (line)
(typecase line
(cons (typecase (first line)
(cons (let ((val 0))
(dolist (l line val)
(incf val (typecase l
(cons (length (first l)))
(t (length l)))))))
(t (length (first line)))))
(t (length line)))))
(let* ((font (xlib:open-font *display* *info-font-string*))
(ilw (xlib:max-char-width font))
(ilh (+ (xlib:max-char-ascent font) (xlib:max-char-descent font) 1))
(width (or width
(min (* (+ (loop for l in info-list maximize (compute-size l)) 2) ilw)
(screen-width))))
(height (or height
(min (round (+ (* (length info-list) ilh) (/ ilh 2)))
(screen-height)))))
(with-placement (*info-mode-placement* x y width height)
(let* ((window (xlib:create-window :parent *root*
:x x :y y
:width width
:height height
:background (get-color *info-background*)
:colormap (xlib:screen-default-colormap *screen*)
:border-width *border-size*
:border (get-color *info-border*)
:event-mask '(:exposure)))
(gc (xlib:create-gcontext :drawable window
:foreground (get-color *info-foreground*)
:background (get-color *info-background*)
:font font
:line-style :solid)))
(setf info (make-info :window window :gc gc :x 0 :y 0 :list info-list
:font font :ilw ilw :ilh ilh
:max-x (* (loop for l in info-list maximize (compute-size l)) ilw)
:max-y (* (length info-list) ilh)))
(setf (window-transparency window) *info-transparency*)
(map-window window)
(draw-info-window info)
(wait-no-key-or-button-press)
(with-grab-keyboard-and-pointer (68 69 66 67)
(generic-mode 'info-mode 'exit-info-loop
:original-mode '(main-mode)))
(xlib:free-gcontext gc)
(xlib:destroy-window window)
(xlib:close-font font)
(xlib:display-finish-output *display*)
(display-all-frame-info)
(wait-no-key-or-button-press)
*info-selected-item*)))))))
(defun info-mode-menu (item-list &key (width nil) (height nil))
"Open an info help menu.
Item-list is: '((key function) separator (key function))
or with explicit docstring: '((key function \"documentation 1\") (key function \"bla bla\") (key function))
key is a character, a keycode or a keysym
Separator is a string or a symbol (all but a list)
Function can be a function or a list (function color) for colored output"
(let ((info-list nil)
(action nil)
(old-info-keys (copy-hash-table *info-keys*)))
(labels ((define-key (key function)
(define-info-key-fun (list key)
(lambda (&optional args)
(declare (ignore args))
(setf action function)
(leave-info-mode nil)))))
(dolist (item item-list)
(typecase item
(cons (destructuring-bind (key function explicit-doc) (ensure-n-elems item 3)
(typecase function
(cons (push (list (list (format nil "~A" key) *menu-color-menu-key*)
(list (format nil ": ~A" (or explicit-doc (documentation (first function) 'function)))
(second function)))
info-list)
(define-key key (first function)))
(t (push (list (list (format nil "~A" key) *menu-color-key*)
(format nil ": ~A" (or explicit-doc (documentation function 'function))))
info-list)
(define-key key function)))))
(t (push (list (format nil "-=- ~A -=-" item) *menu-color-comment*) info-list))))
(let ((selected-item (info-mode (nreverse info-list) :width width :height height)))
(setf *info-keys* old-info-keys)
(when selected-item
(awhen (nth selected-item item-list)
(when (consp it)
(destructuring-bind (key function explicit-doc) (ensure-n-elems it 3)
(declare (ignore key explicit-doc))
(typecase function
(cons (setf action (first function)))
(t (setf action function)))))))
(typecase action
(function (funcall action))
(symbol (when (fboundp action)
(funcall action))))))))
(defun keys-from-list (list)
"Produce a key menu based on list item"
(loop for l in list
for i from 0
collect (list (number->char i) l)))
;;;,-----
;;;| CONFIG - Info mode functions
;;;`-----
(defun key-binding-colorize-line (list)
(loop :for line :in list
:collect (cond ((search "* CLFSWM Keys *" line) (list line *info-color-title*))
((search "---" line) (list line *info-color-underline*))
((begin-with-2-spaces line)
(list (list (subseq line 0 22) *info-color-second*)
(list (subseq line 22 35) *info-color-first*)
(subseq line 35)))
(t line))))
(defun show-key-binding (&rest hash-table-key)
"Show the binding of each hash-table-key.
Pass the :no-producing-doc symbol to remove the producing doc"
(info-mode (key-binding-colorize-line
(split-string (append-newline-space
(with-output-to-string (stream)
(produce-doc (remove :no-producing-doc hash-table-key)
stream
(not (member :no-producing-doc hash-table-key)))))
#\Newline))))
(defun show-global-key-binding ()
"Show all key binding"
(show-key-binding *main-keys* *main-mouse* *second-keys* *second-mouse*
*info-keys* *info-mouse*))
(defun show-main-mode-key-binding ()
"Show the main mode binding"
(show-key-binding *main-keys* *main-mouse*))
(defun show-second-mode-key-binding ()
"Show the second mode key binding"
(show-key-binding *second-keys* *second-mouse*))
(defun show-circulate-mode-key-binding ()
"Show the circulate mode key binding"
(show-key-binding *circulate-keys*))
(defun show-expose-window-mode-key-binding ()
"Show the expose window mode key binding"
(show-key-binding *expose-keys* *expose-mouse*))
(defun show-first-aid-kit ()
"Show the first aid kit key binding"
(labels ((add-key (hash symbol &optional (hashkey *main-keys*))
(multiple-value-bind (k v)
(find-in-hash symbol hashkey)
(setf (gethash k hash) v))))
(let ((hash (make-hash-table :test #'equal))
(hash-second (make-hash-table :test #'equal)))
(setf (gethash 'name hash) "First aid kit - Main mode key binding"
(gethash 'name hash-second) "First aid kit - Second mode key binding")
(add-key hash 'select-next-child)
(add-key hash 'select-previous-child)
(add-key hash 'select-next-brother)
(add-key hash 'select-previous-brother)
(add-key hash 'select-previous-level)
(add-key hash 'select-next-level)
(add-key hash 'enter-frame)
(add-key hash 'leave-frame)
(add-key hash 'second-key-mode)
(add-key hash 'expose-windows-mode)
(add-key hash 'expose-all-windows-mode)
(add-key hash 'present-clfswm-terminal)
(add-key hash-second 'leave-second-mode *second-keys*)
(add-key hash-second 'open-menu *second-keys*)
(add-key hash-second 'run-program-from-query-string *second-keys*)
(add-key hash-second 'eval-from-query-string *second-keys*)
(add-key hash-second 'set-open-in-new-frame-in-parent-frame-nw-hook *second-keys*)
(add-key hash-second 'b-start-xterm *second-keys*)
(add-key hash-second 'b-start-emacs *second-keys*)
(show-key-binding hash hash-second :no-producing-doc))))
(defun corner-help-colorize-line (list)
(loop :for line :in list
:collect (cond ((search "CLFSWM:" line) (list line *info-color-title*))
((search "*:" line) (list line *info-color-underline*))
((begin-with-2-spaces line)
(let ((pos (position #\: line)))
(if pos
(list (list (subseq line 0 (1+ pos)) *info-color-first*)
(subseq line (1+ pos)))
line)))
(t line))))
(defun show-corner-help ()
"Help on clfswm corner"
(info-mode (corner-help-colorize-line
(split-string (append-newline-space
(with-output-to-string (stream)
(produce-corner-doc stream)))
#\Newline))))
(defun configuration-variable-colorize-line (list)
(loop :for line :in list
:collect (cond ((search "CLFSWM " line) (list line *info-color-title*))
((search "* =" line)
(let ((pos (position #\= line)))
(list (list (subseq line 0 (1+ pos)) *info-color-first*)
(list (subseq line (1+ pos)) *info-color-second*))))
((search "<=" line) (list line *info-color-underline*))
(t line))))
(defun show-config-variable ()
"Show all configurable variables"
(let ((result nil))
(labels ((rec ()
(setf result nil)
(info-mode-menu (loop :for group :in (config-all-groups)
:for i :from 0
:collect (list (number->char i)
(let ((group group))
(lambda ()
(setf result group)))
(config-group->string group))))
(when result
(info-mode (configuration-variable-colorize-line
(split-string (append-newline-space
(with-output-to-string (stream)
(produce-conf-var-doc stream result t nil)))
#\Newline)))
(rec))))
(rec))))
(defun show-date ()
"Show the current time and date"
(info-mode (list (list `("Current date:" ,*menu-color-comment*) (date-string)))))
(defun info-on-shell (msg program)
(let ((lines (do-shell program nil t)))
(info-mode (append (list (list msg *menu-color-comment*))
(loop for line = (read-line lines nil nil)
while line
collect (ensure-printable line))))))
(defun show-cpu-proc ()
"Show current processes sorted by CPU usage"
(info-on-shell "Current processes sorted by CPU usage:"
"ps --cols=1000 --sort='-%cpu,uid,pgid,ppid,pid' -e -o user,pid,stime,pcpu,pmem,args"))
(defun show-mem-proc ()
"Show current processes sorted by memory usage"
(info-on-shell "Current processes sorted by MEMORY usage:"
"ps --cols=1000 --sort='-vsz,uid,pgid,ppid,pid' -e -o user,pid,stime,pcpu,pmem,args"))
(defun show-cd-info ()
"Show the current CD track"
(info-on-shell "Current CD track:" "pcd i"))
(defun show-cd-playlist ()
"Show the current CD playlist"
(info-on-shell "Current CD playlist:" "pcd mi"))
(defun show-version ()
"Show the current CLFSWM version"
(info-mode (list *version*)))
| 21,055 | Common Lisp | .lisp | 486 | 38.074074 | 110 | 0.639007 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 378f91cb91daecfc78ba4c25c6dea1d58eae96a617d2327a00840579282bb01d | 9,971 | [
-1
] |
9,972 | bindings.lisp | spacefrogg_clfswm/src/bindings.lisp | ;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: Bindings keys and mouse
;;;
;;; Note: Mod-1 is the Alt or Meta key, Mod-2 is the Numlock key.
;;; --------------------------------------------------------------------------
;;;
;;; (C) 2005-2015 Philippe Brochard <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; --------------------------------------------------------------------------
(in-package :clfswm)
;;;,-----
;;;| CONFIG - Bindings main mode
;;;`-----
(add-hook *binding-hook* 'init-*main-keys* 'init-*main-mouse*)
(defun help-on-clfswm ()
"Open the help and info window"
(open-menu (find-menu 'help-menu)))
(defun set-default-main-keys ()
(define-main-key ("F1" :mod-1) 'help-on-clfswm)
(define-main-key ("Home" :mod-1 :control :shift) 'exit-clfswm)
(define-main-key ("Right" :mod-1) 'select-next-brother)
(define-main-key ("Left" :mod-1) 'select-previous-brother)
(define-main-key ("Down" :mod-1) 'select-previous-level)
(define-main-key ("Up" :mod-1) 'select-next-level)
(define-main-key ("Right" :mod-1 :shift) 'select-next-brother-take-current)
(define-main-key ("Left" :mod-1 :shift) 'select-previous-brother-take-current)
(define-main-key ("Left" :control :mod-1) 'select-brother-spatial-move-left)
(define-main-key ("Right" :control :mod-1) 'select-brother-spatial-move-right)
(define-main-key ("Up" :control :mod-1) 'select-brother-spatial-move-up)
(define-main-key ("Down" :control :mod-1) 'select-brother-spatial-move-down)
(define-main-key ("Left" :control :mod-1 :shift) 'select-brother-spatial-move-left-take-current)
(define-main-key ("Right" :control :mod-1 :shift) 'select-brother-spatial-move-right-take-current)
(define-main-key ("Up" :control :mod-1 :shift) 'select-brother-spatial-move-up-take-current)
(define-main-key ("Down" :control :mod-1 :shift) 'select-brother-spatial-move-down-take-current)
(define-main-key ("Tab" :mod-1) 'select-next-child)
(define-main-key ("Tab" :mod-1 :shift) 'select-previous-child)
(define-main-key ("Tab" :mod-1 :control) 'select-next-subchild)
(define-main-key ("Return" :mod-1) 'enter-frame)
(define-main-key ("Return" :mod-1 :shift) 'leave-frame)
(define-main-key ("Return" :mod-1 :control) 'frame-toggle-maximize)
(define-main-key ("Return" :mod-5) 'frame-toggle-maximize)
(define-main-key ("Page_Up" :mod-1) 'frame-select-previous-child)
(define-main-key ("Page_Down" :mod-1) 'frame-select-next-child)
(define-main-key ("Page_Up" :mod-1 :control) 'frame-lower-child)
(define-main-key ("Page_Down" :mod-1 :control) 'frame-raise-child)
(define-main-key ("Home" :mod-1) 'switch-to-root-frame)
(define-main-key ("Home" :mod-1 :shift) 'switch-and-select-root-frame)
(define-main-key ("Menu") 'fastswitch-mode)
(define-main-key ("Menu" :control) 'fastswitch-move-mode)
(define-main-key ("Menu" :mod-5) 'expose-current-child-mode)
(define-main-key ("F10" :mod-1) 'fast-layout-switch)
(define-main-key ("F10" :shift :control) 'toggle-show-root-frame)
(define-main-key ("F10") 'expose-windows-mode)
(define-main-key ("F10" :control) 'expose-all-windows-mode)
(define-main-key ("F12" :control) 'present-clfswm-terminal)
(define-main-key ("F12" :shift) 'show-all-frames-info-key)
(define-main-key ("F12" :shift :mod-1) 'show-all-frames-info)
(define-main-key ("b" :mod-1) 'banish-pointer)
;; Escape
(define-main-key ("Escape" :control) 'ask-close/kill-current-window)
;; Second mode
(define-main-key (#\t :mod-1) 'second-key-mode)
(define-main-key ("less" :control) 'second-key-mode)
;; Bind or jump functions
(define-main-key ("1" :mod-1) 'bind-or-jump 1)
(define-main-key ("2" :mod-1) 'bind-or-jump 2)
(define-main-key ("3" :mod-1) 'bind-or-jump 3)
(define-main-key ("4" :mod-1) 'bind-or-jump 4)
(define-main-key ("5" :mod-1) 'bind-or-jump 5)
(define-main-key ("6" :mod-1) 'bind-or-jump 6)
(define-main-key ("7" :mod-1) 'bind-or-jump 7)
(define-main-key ("8" :mod-1) 'bind-or-jump 8)
(define-main-key ("9" :mod-1) 'bind-or-jump 9)
(define-main-key ("0" :mod-1) 'bind-or-jump 10))
(add-hook *binding-hook* 'set-default-main-keys)
;;; Mouse actions
(defun mouse-click-to-focus-and-move-window (window root-x root-y)
"Move and focus the current child - Create a new frame on the root window"
(declare (ignore window))
(stop-button-event)
(mouse-focus-move/resize-generic root-x root-y #'move-frame t))
(defun mouse-click-to-focus-and-resize-window (window root-x root-y)
"Resize and focus the current child - Create a new frame on the root window"
(declare (ignore window))
(stop-button-event)
(mouse-focus-move/resize-generic root-x root-y #'resize-frame t))
(defun mouse-click-to-focus-and-move-window-constrained (window root-x root-y)
"Move (constrained by other frames) and focus the current child - Create a new frame on the root window"
(declare (ignore window))
(stop-button-event)
(mouse-focus-move/resize-generic root-x root-y #'move-frame-constrained t))
(defun mouse-click-to-focus-and-resize-window-constrained (window root-x root-y)
"Resize (constrained by other frames) and focus the current child - Create a new frame on the root window"
(declare (ignore window))
(stop-button-event)
(mouse-focus-move/resize-generic root-x root-y #'resize-frame-constrained t))
(defun set-default-main-mouse ()
(define-main-mouse (1) 'mouse-click-to-focus-and-move)
(define-main-mouse (2) 'mouse-middle-click)
(define-main-mouse (3) 'mouse-click-to-focus-and-resize)
(define-main-mouse (1 :mod-1) 'mouse-click-to-focus-and-move-window)
(define-main-mouse (3 :mod-1) 'mouse-click-to-focus-and-resize-window)
(define-main-mouse (1 :mod-1 :shift) 'mouse-click-to-focus-and-move-window-constrained)
(define-main-mouse (3 :mod-1 :shift) 'mouse-click-to-focus-and-resize-window-constrained)
(define-main-mouse (1 :control :mod-1) 'mouse-move-child-over-frame)
(define-main-mouse (4) 'mouse-select-next-level)
(define-main-mouse (5) 'mouse-select-previous-level)
(define-main-mouse (4 :mod-1) 'mouse-enter-frame)
(define-main-mouse (5 :mod-1) 'mouse-leave-frame)
(define-main-mouse (4 :mod-1 :control) 'dec-transparency)
(define-main-mouse (5 :mod-1 :control) 'inc-transparency)
(define-main-mouse (4 :mod-1 :control :shift) 'dec-transparency-slow)
(define-main-mouse (5 :mod-1 :control :shift) 'inc-transparency-slow))
(add-hook *binding-hook* 'set-default-main-mouse)
| 7,316 | Common Lisp | .lisp | 131 | 53.259542 | 108 | 0.677099 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 9139fb9585f8578b21db6a948df1c629bdec29766ac7a932728a436baa4e2675 | 9,972 | [
-1
] |
9,973 | menu-def.lisp | spacefrogg_clfswm/src/menu-def.lisp | ;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: Menu definitions
;;;
;;; Note: Mod-1 is the Alt or Meta key, Mod-2 is the Numlock key.
;;; --------------------------------------------------------------------------
;;;
;;; (C) 2005-2015 Philippe Brochard <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; --------------------------------------------------------------------------
(in-package :clfswm)
(format t "Updating menus...")
(force-output)
(init-menu)
;;; Here is a small example of menu manipulation:
;;(add-menu-key 'main "a" 'help-on-second-mode)
;;(add-menu-key 'main "c" 'help-on-clfswm)
;;
;;(add-sub-menu 'main "p" 'plop "A sub menu")
;;
;;(add-menu-key 'plop "a" 'help-on-clfswm)
;;(add-menu-key 'plop "b" 'help-on-second-mode)
;;(add-menu-key 'plop "d" 'help-on-second-mode)
;;(del-menu-key 'main "p")
;;(del-menu-value 'plop 'help-on-main-mode)
;;(del-sub-menu 'main 'plop)
;;(define-second-key ("a") 'open-menu)
(add-sub-menu 'main "F1" 'help-menu "Help menu")
(add-sub-menu 'main "d" 'standard-menu "Standard menu")
(add-sub-menu 'main "c" 'child-menu "Child menu")
(add-sub-menu 'main "r" 'root-menu "Root menu")
(add-sub-menu 'main "f" 'frame-menu "Frame menu")
(add-sub-menu 'main "w" 'window-menu "Window menu")
(add-sub-menu 'main "s" 'selection-menu "Selection menu")
(add-sub-menu 'main "n" 'action-by-name-menu "Action by name menu")
(add-sub-menu 'main "u" 'action-by-number-menu "Action by number menu")
(add-sub-menu 'main "y" 'utility-menu "Utility menu")
(add-sub-menu 'main "o" 'configuration-menu "Configuration menu")
(add-sub-menu 'main "m" 'clfswm-menu "CLFSWM menu")
(update-menus (find-menu 'standard-menu))
(add-menu-key 'help-menu "a" 'show-first-aid-kit)
(add-menu-key 'help-menu "h" 'show-global-key-binding)
(add-menu-key 'help-menu "b" 'show-main-mode-key-binding)
(add-menu-key 'help-menu "s" 'show-second-mode-key-binding)
(add-menu-key 'help-menu "r" 'show-circulate-mode-key-binding)
(add-menu-key 'help-menu "e" 'show-expose-window-mode-key-binding)
(add-menu-key 'help-menu "c" 'show-corner-help)
(add-menu-key 'help-menu "g" 'show-config-variable)
(add-menu-key 'help-menu "d" 'show-date)
(add-menu-key 'help-menu "p" 'show-cpu-proc)
(add-menu-key 'help-menu "m" 'show-mem-proc)
(add-menu-key 'help-menu "v" 'show-version)
(add-menu-key 'child-menu "r" 'rename-current-child)
(add-menu-key 'child-menu "t" 'set-current-child-transparency)
(add-menu-key 'child-menu "b" 'set-current-child-border-size)
(add-menu-key 'child-menu "e" 'ensure-unique-name)
(add-menu-key 'child-menu "n" 'ensure-unique-number)
(add-menu-key 'child-menu "Delete" 'delete-current-child)
(add-menu-key 'child-menu "X" 'remove-current-child)
(add-menu-key 'child-menu "R" 'retrieve-existing-window)
(add-menu-key 'child-menu "h" 'hide-current-child)
(add-menu-key 'child-menu "u" 'unhide-a-child)
(add-menu-key 'child-menu "f" 'unhide-a-child-from-all-frames)
(add-menu-key 'child-menu "a" 'unhide-all-children)
(add-menu-key 'child-menu "Page_Up" 'frame-lower-child)
(add-menu-key 'child-menu "Page_Down" 'frame-raise-child)
(add-menu-key 'root-menu "n" 'select-next-root-restart-menu)
(add-menu-key 'root-menu "p" 'select-previous-root-restart-menu)
(add-menu-key 'root-menu "g" 'rotate-root-geometry-next-restart-menu)
(add-menu-key 'root-menu "f" 'rotate-root-geometry-previous-restart-menu)
(add-menu-key 'root-menu "x" 'exchange-root-geometry-with-mouse)
(add-menu-key 'root-menu "r" 'change-current-root-geometry)
(add-sub-menu 'frame-menu "a" 'frame-adding-menu "Adding frame menu")
(add-sub-menu 'frame-menu "l" 'frame-layout-menu "Frame layout menu")
(add-sub-menu 'frame-menu "n" 'frame-nw-hook-menu "Frame new window hook menu")
(add-sub-menu 'frame-menu "m" 'frame-movement-menu "Frame movement menu")
(add-sub-menu 'frame-menu "f" 'frame-focus-policy "Frame focus policy menu")
(add-sub-menu 'frame-menu "w" 'frame-managed-window-menu "Managed window type menu")
(add-sub-menu 'frame-menu "u" 'frame-unmanaged-window-menu "Unmanaged window behaviour")
(add-sub-menu 'frame-menu "s" 'frame-miscellaneous-menu "Frame miscallenous menu")
(add-menu-key 'frame-menu "x" 'frame-toggle-maximize)
(add-menu-key 'frame-adding-menu "a" 'add-default-frame)
(add-menu-key 'frame-adding-menu "p" 'add-placed-frame)
(add-sub-menu 'frame-movement-menu "p" 'frame-pack-menu "Frame pack menu")
(add-sub-menu 'frame-movement-menu "f" 'frame-fill-menu "Frame fill menu")
(add-sub-menu 'frame-movement-menu "r" 'frame-resize-menu "Frame resize menu")
(add-menu-key 'frame-movement-menu "c" 'center-current-frame)
(add-menu-key 'frame-movement-menu "R" 'with-movement-select-next-brother)
(add-menu-key 'frame-movement-menu "L" 'with-movement-select-previous-brother)
(add-menu-key 'frame-movement-menu "U" 'with-movement-select-next-level)
(add-menu-key 'frame-movement-menu "D" 'with-movement-select-previous-level)
(add-menu-key 'frame-movement-menu "T" 'with-movement-select-next-child)
(add-menu-key 'frame-pack-menu "u" 'current-frame-pack-up)
(add-menu-key 'frame-pack-menu "d" 'current-frame-pack-down)
(add-menu-key 'frame-pack-menu "l" 'current-frame-pack-left)
(add-menu-key 'frame-pack-menu "r" 'current-frame-pack-right)
(add-menu-key 'frame-fill-menu "u" 'current-frame-fill-up)
(add-menu-key 'frame-fill-menu "d" 'current-frame-fill-down)
(add-menu-key 'frame-fill-menu "l" 'current-frame-fill-left)
(add-menu-key 'frame-fill-menu "r" 'current-frame-fill-right)
(add-menu-key 'frame-fill-menu "a" 'current-frame-fill-all-dir)
(add-menu-key 'frame-fill-menu "v" 'current-frame-fill-vertical)
(add-menu-key 'frame-fill-menu "h" 'current-frame-fill-horizontal)
(add-menu-key 'frame-resize-menu "u" 'current-frame-resize-up)
(add-menu-key 'frame-resize-menu "d" 'current-frame-resize-down)
(add-menu-key 'frame-resize-menu "l" 'current-frame-resize-left)
(add-menu-key 'frame-resize-menu "r" 'current-frame-resize-right)
(add-menu-key 'frame-resize-menu "a" 'current-frame-resize-all-dir)
(add-menu-key 'frame-resize-menu "m" 'current-frame-resize-all-dir-minimal)
(add-menu-comment 'frame-focus-policy "-=- For the current frame -=-")
(add-menu-key 'frame-focus-policy "a" 'current-frame-set-click-focus-policy)
(add-menu-key 'frame-focus-policy "b" 'current-frame-set-sloppy-focus-policy)
(add-menu-key 'frame-focus-policy "c" 'current-frame-set-sloppy-strict-focus-policy)
(add-menu-key 'frame-focus-policy "d" 'current-frame-set-sloppy-select-policy)
(add-menu-key 'frame-focus-policy "e" 'current-frame-set-sloppy-select-window-policy)
(add-menu-comment 'frame-focus-policy "-=- For all frames -=-")
(add-menu-key 'frame-focus-policy "f" 'all-frames-set-click-focus-policy)
(add-menu-key 'frame-focus-policy "g" 'all-frames-set-sloppy-focus-policy)
(add-menu-key 'frame-focus-policy "h" 'all-frames-set-sloppy-strict-focus-policy)
(add-menu-key 'frame-focus-policy "i" 'all-frames-set-sloppy-select-policy)
(add-menu-key 'frame-focus-policy "j" 'all-frames-set-sloppy-select-window-policy)
(add-menu-key 'frame-managed-window-menu "m" 'current-frame-manage-window-type)
(add-menu-key 'frame-managed-window-menu "a" 'current-frame-manage-all-window-type)
(add-menu-key 'frame-managed-window-menu "n" 'current-frame-manage-only-normal-window-type)
(add-menu-key 'frame-managed-window-menu "u" 'current-frame-manage-no-window-type)
(add-menu-key 'frame-unmanaged-window-menu "s" 'set-show-unmanaged-window)
(add-menu-key 'frame-unmanaged-window-menu "h" 'set-hide-unmanaged-window)
(add-menu-key 'frame-unmanaged-window-menu "d" 'set-default-hide-unmanaged-window)
(add-menu-key 'frame-unmanaged-window-menu "w" 'set-globally-show-unmanaged-window)
(add-menu-key 'frame-unmanaged-window-menu "i" 'set-globally-hide-unmanaged-window)
(add-menu-key 'frame-miscellaneous-menu "s" 'show-all-frames-info)
(add-menu-key 'frame-miscellaneous-menu "a" 'hide-all-frames-info)
(add-menu-key 'frame-miscellaneous-menu "h" 'hide-current-frame-window)
(add-menu-key 'frame-miscellaneous-menu "w" 'show-current-frame-window)
(add-menu-key 'frame-miscellaneous-menu "u" 'renumber-current-frame)
(add-menu-key 'frame-miscellaneous-menu "x" 'explode-current-frame)
(add-menu-key 'frame-miscellaneous-menu "i" 'implode-current-frame)
(add-menu-key 'window-menu "i" 'display-current-window-info)
(add-menu-key 'window-menu "t" 'set-current-window-transparency)
(add-menu-key 'window-menu "f" 'force-window-in-frame)
(add-menu-key 'window-menu "c" 'force-window-center-in-frame)
(add-menu-key 'window-menu "m" 'manage-current-window)
(add-menu-key 'window-menu "u" 'unmanage-current-window)
(add-menu-key 'window-menu "a" 'adapt-current-frame-to-window-hints)
(add-menu-key 'window-menu "w" 'adapt-current-frame-to-window-width-hint)
(add-menu-key 'window-menu "h" 'adapt-current-frame-to-window-height-hint)
(add-menu-key 'selection-menu "x" 'cut-current-child)
(add-menu-key 'selection-menu "c" 'copy-current-child)
(add-menu-key 'selection-menu "v" 'paste-selection)
(add-menu-key 'selection-menu "p" 'paste-selection-no-clear)
(add-menu-key 'selection-menu "Delete" 'remove-current-child)
(add-menu-key 'selection-menu "z" 'clear-selection)
(add-menu-key 'action-by-name-menu "f" 'focus-frame-by-name)
(add-menu-key 'action-by-name-menu "o" 'open-frame-by-name)
(add-menu-key 'action-by-name-menu "d" 'delete-frame-by-name)
(add-menu-key 'action-by-name-menu "m" 'move-current-child-by-name)
(add-menu-key 'action-by-name-menu "c" 'copy-current-child-by-name)
(add-menu-key 'action-by-number-menu "f" 'focus-frame-by-number)
(add-menu-key 'action-by-number-menu "o" 'open-frame-by-number)
(add-menu-key 'action-by-number-menu "d" 'delete-frame-by-number)
(add-menu-key 'action-by-number-menu "m" 'move-current-child-by-number)
(add-menu-key 'action-by-number-menu "c" 'copy-current-child-by-number)
(add-menu-key 'utility-menu "i" 'identify-key)
(add-menu-key 'utility-menu "colon" 'eval-from-query-string)
(add-menu-key 'utility-menu "exclam" 'run-program-from-query-string)
(add-sub-menu 'utility-menu "o" 'other-window-manager-menu "Other window manager menu")
(add-menu-key 'other-window-manager-menu "x" 'run-xterm)
(add-menu-key 'other-window-manager-menu "t" 'run-twm)
(add-menu-key 'other-window-manager-menu "i" 'run-icewm)
(add-menu-key 'other-window-manager-menu "g" 'run-gnome-session)
(add-menu-key 'other-window-manager-menu "k" 'run-startkde)
(add-menu-key 'other-window-manager-menu "c" 'run-xfce4-session)
(add-menu-key 'other-window-manager-menu "l" 'run-lxde)
(add-menu-key 'other-window-manager-menu "p" 'run-prompt-wm)
(add-menu-key 'clfswm-menu "r" 'reset-clfswm)
(add-menu-key 'clfswm-menu "l" 'reload-clfswm)
(add-menu-key 'clfswm-menu "x" 'exit-clfswm)
(format t " Done.~%")
(force-output)
| 11,570 | Common Lisp | .lisp | 195 | 58.071795 | 91 | 0.717149 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | e6d6772a7744d9d597db251fce04c5c98e852be874d4ccbac954c96b2c10cde7 | 9,973 | [
-1
] |
9,974 | clfswm-circulate-mode.lisp | spacefrogg_clfswm/src/clfswm-circulate-mode.lisp | ;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: Main functions
;;; --------------------------------------------------------------------------
;;;
;;; (C) 2005-2015 Philippe Brochard <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; --------------------------------------------------------------------------
(in-package :clfswm)
(defparameter *circulate-window* nil)
(defparameter *circulate-font* nil)
(defparameter *circulate-gc* nil)
(defparameter *circulate-hit* 0)
(defparameter *circulate-orig* nil)
(defparameter *circulate-parent* nil)
(defun draw-circulate-mode-window ()
(raise-window *circulate-window*)
(clear-pixmap-buffer *circulate-window* *circulate-gc*)
(let* ((text (format nil "~A [~A]"
(limit-length (ensure-printable (child-name (xlib:input-focus *display*)))
*circulate-text-limite*)
(limit-length (ensure-printable (child-name (current-child)))
*circulate-text-limite*)))
(len (length text)))
(xlib:draw-glyphs *pixmap-buffer* *circulate-gc*
(truncate (/ (- *circulate-width* (* (xlib:max-char-width *circulate-font*) len)) 2))
(truncate (/ (+ *circulate-height* (- (xlib:font-ascent *circulate-font*)
(xlib:font-descent *circulate-font*))) 2))
text))
(copy-pixmap-buffer *circulate-window* *circulate-gc*))
(defun leave-circulate-mode ()
"Leave the circulate mode"
(throw 'exit-circulate-loop nil))
(defun reset-circulate-child ()
(setf *circulate-hit* 0
*circulate-parent* nil
*circulate-orig* (frame-child (current-child))))
(defun reset-circulate-brother ()
(setf *circulate-parent* (find-parent-frame (current-child))
*circulate-hit* 0)
(when (frame-p *circulate-parent*)
(setf *circulate-orig* (frame-child *circulate-parent*))))
(defun reorder-child (direction)
(no-focus)
(with-slots (child selected-pos) (current-child)
(unless *circulate-orig*
(reset-circulate-child))
(let ((len (length *circulate-orig*)))
(when (plusp len)
(let ((elem (nth (mod (incf *circulate-hit* direction) len) *circulate-orig*)))
(setf child (cons elem (child-remove elem *circulate-orig*))
selected-pos 0)))
(show-all-children)
(draw-circulate-mode-window))))
(defun reorder-brother (direction)
(no-focus)
(let ((old-child (current-child)))
(select-current-frame nil)
(unless (and *circulate-orig* *circulate-parent*)
(reset-circulate-brother))
(let ((len (length *circulate-orig*)))
(when (plusp len)
(when (frame-p *circulate-parent*)
(let ((elem (nth (mod (incf *circulate-hit* direction) len) *circulate-orig*)))
(setf (frame-child *circulate-parent*) (cons elem (child-remove elem *circulate-orig*))
(frame-selected-pos *circulate-parent*) 0
(current-child) (frame-selected-child *circulate-parent*))))
(when (and (not (child-root-p (current-child)))
(child-root-p old-child))
(change-root (find-root old-child) (current-child)))))
(show-all-children t)
(draw-circulate-mode-window)))
(defun reorder-subchild (direction)
(declare (ignore direction))
(when (frame-p (current-child))
(let ((selected-child (frame-selected-child (current-child))))
(when (frame-p selected-child)
(no-focus)
(with-slots (child selected-pos) selected-child
(let ((elem (first (last child))))
(when elem
(setf child (cons elem (child-remove elem child))
selected-pos 0))
(show-all-children)
(draw-circulate-mode-window)))))))
(defun circulate-select-next-child ()
"Select the next child"
(when (frame-p (current-child))
(when *circulate-parent*
(reset-circulate-child))
(reorder-child +1)))
(defun circulate-select-previous-child ()
"Select the previous child"
(when (frame-p (current-child))
(when *circulate-parent*
(reset-circulate-child))
(reorder-child -1)))
(defun circulate-select-next-brother ()
"Select the next brother"
(unless *circulate-parent*
(reset-circulate-brother))
(reorder-brother +1))
(defun circulate-select-previous-brother ()
"Select the previous borther"
(unless *circulate-parent*
(reset-circulate-brother))
(reorder-brother -1))
(defun circulate-select-next-subchild ()
"Select the next subchild"
(reorder-subchild +1))
(add-hook *binding-hook* 'set-default-circulate-keys)
(defun set-default-circulate-keys ()
(define-circulate-key ("Escape") 'leave-circulate-mode)
(define-circulate-key ("g" :control) 'leave-circulate-mode)
(define-circulate-key ("Escape" :alt) 'leave-circulate-mode)
(define-circulate-key ("g" :control :alt) 'leave-circulate-mode)
(define-circulate-key ("Tab" :mod-1) 'circulate-select-next-child)
(define-circulate-key ("Tab" :mod-1 :control) 'circulate-select-next-subchild)
(define-circulate-key ("Tab" :mod-1 :shift) 'circulate-select-previous-child)
(define-circulate-key ("Iso_Left_Tab" :mod-1 :shift) 'circulate-select-previous-child)
(define-circulate-key ("Right" :mod-1) 'circulate-select-next-brother)
(define-circulate-key ("Left" :mod-1) 'circulate-select-previous-brother)
(define-circulate-release-key ("Alt_L" :alt) 'leave-circulate-mode)
(define-circulate-release-key ("Alt_L") 'leave-circulate-mode))
(defun circulate-leave-function ()
(when *circulate-gc*
(xlib:free-gcontext *circulate-gc*))
(when *circulate-window*
(xlib:destroy-window *circulate-window*))
(when *circulate-font*
(xlib:close-font *circulate-font*))
(setf *circulate-window* nil
*circulate-gc* nil
*circulate-font* nil)
(xlib:display-finish-output *display*))
(defun circulate-loop-function ()
(unless (is-a-key-pressed-p)
(leave-circulate-mode)))
(define-handler circulate-mode :key-press (code state)
(unless (funcall-key-from-code *circulate-keys* code state)
(setf *circulate-hit* 0
*circulate-orig* nil
*circulate-parent* nil)
(funcall-key-from-code *main-keys* code state)))
(define-handler circulate-mode :key-release (code state)
(funcall-key-from-code *circulate-keys-release* code state))
(defun circulate-mode (&key child-direction brother-direction subchild-direction)
(setf *circulate-hit* 0)
(with-placement (*circulate-mode-placement* x y *circulate-width* *circulate-height*)
(setf *circulate-font* (xlib:open-font *display* *circulate-font-string*)
*circulate-window* (xlib:create-window :parent *root*
:x x
:y y
:width *circulate-width*
:height *circulate-height*
:background (get-color *circulate-background*)
:border-width *border-size*
:border (get-color *circulate-border*)
:colormap (xlib:screen-default-colormap *screen*)
:event-mask '(:exposure :key-press))
*circulate-gc* (xlib:create-gcontext :drawable *circulate-window*
:foreground (get-color *circulate-foreground*)
:background (get-color *circulate-background*)
:font *circulate-font*
:line-style :solid))
(setf (window-transparency *circulate-window*) *circulate-transparency*)
(map-window *circulate-window*)
(draw-circulate-mode-window)
(when child-direction
(reorder-child child-direction))
(when brother-direction
(reorder-brother brother-direction))
(when subchild-direction
(reorder-subchild subchild-direction))
(with-grab-keyboard-and-pointer (92 93 66 67 t)
(generic-mode 'circulate-mode 'exit-circulate-loop
:loop-function #'circulate-loop-function
:leave-function #'circulate-leave-function
:original-mode '(main-mode))
(circulate-leave-function))))
(defun select-next-child ()
"Select the next child"
(when (frame-p (current-child))
(setf *circulate-orig* (frame-child (current-child))
*circulate-parent* nil)
(circulate-mode :child-direction +1)))
(defun select-previous-child ()
"Select the previous child"
(when (frame-p (current-child))
(setf *circulate-orig* (frame-child (current-child))
*circulate-parent* nil)
(circulate-mode :child-direction -1)))
(defun select-next-brother ()
"Select the next brother"
(setf *circulate-parent* (find-parent-frame (current-child)))
(when (frame-p *circulate-parent*)
(setf *circulate-orig* (frame-child *circulate-parent*)))
(circulate-mode :brother-direction +1))
(defun select-previous-brother ()
"Select the previous brother"
(setf *circulate-parent* (find-parent-frame (current-child)))
(when (frame-p *circulate-parent*)
(setf *circulate-orig* (frame-child *circulate-parent*)))
(circulate-mode :brother-direction -1))
(defmacro with-move-current-focused-window (() &body body)
`(with-current-window
,@body
(move-child-to window (if (frame-p (current-child))
(current-child)
(find-parent-frame (current-child) (find-current-root))))))
(defun select-next-brother-take-current ()
"Select the next brother and move the current focused child in it"
(with-move-current-focused-window ()
(select-next-brother)))
(defun select-previous-brother-take-current ()
"Select the previous brother and move the current focused child in it"
(with-move-current-focused-window ()
(select-previous-brother)))
(defun select-next-subchild ()
"Select the next subchild"
(when (and (frame-p (current-child))
(frame-p (frame-selected-child (current-child))))
(setf *circulate-orig* (frame-child (current-child))
*circulate-parent* nil)
(circulate-mode :subchild-direction +1)))
(defun select-previous-subchild ()
"Select the previous subchild"
(when (and (frame-p (current-child))
(frame-p (frame-selected-child (current-child))))
(setf *circulate-orig* (frame-child (current-child))
*circulate-parent* nil)
(circulate-mode :subchild-direction -1)))
(defun select-next-child-simple ()
"Select the next child (do not enter in circulate mode)"
(when (frame-p (current-child))
(with-slots (child) (current-child)
(setf child (rotate-list child)))
(show-all-children)))
(defun select-previous-child-simple ()
"Select the previous child (do not enter circulate mode)"
(when (frame-p (current-child))
(with-slots (child) (current-child)
(setf child (anti-rotate-list child)))
(show-all-children)))
(defun reorder-brother-simple (reorder-fun)
(let ((is-root (child-root-p (current-child))))
(no-focus)
(select-current-frame nil)
(when is-root
(let ((root (find-root (current-child))))
(unless (or (child-equal-p (root-child root) *root-frame*)
(child-original-root-p (root-child root)))
(awhen (and root (find-parent-frame (root-child root)))
(when (frame-p it)
(change-root root it))))))
(let ((parent-frame (find-parent-frame (current-child))))
(when (frame-p parent-frame)
(with-slots (child) parent-frame
(setf child (funcall reorder-fun child)
(current-child) (frame-selected-child parent-frame)))))
(when is-root
(change-root (find-root (current-child)) (current-child)))
(show-all-children (not is-root))))
(defun select-next-brother-simple ()
"Select the next brother frame (do not enter in circulate mode)"
(reorder-brother-simple #'rotate-list))
(defun select-previous-brother-simple ()
"Select the previous brother frame (do not enter in circulate mode)"
(reorder-brother-simple #'anti-rotate-list))
;;; Spatial move functions
(defun select-brother-generic-spatial-move (fun-found)
"Select the nearest brother of the current child based on the fun-found function"
(let ((is-root-p (child-root-p (current-child))))
(when is-root-p
(leave-frame)
(sleep *spatial-move-delay-before*))
(no-focus)
(select-current-frame nil)
(let ((parent-frame (find-parent-frame (current-child))))
(when (frame-p parent-frame)
(with-slots (child selected-pos) parent-frame
(let ((found nil)
(found-dist nil))
(dolist (c child)
(let ((dist (funcall fun-found (current-child) c)))
(when (and dist
(not (child-equal-p (current-child) c))
(or (not found)
(and found-dist (< dist found-dist))))
(setf found c
found-dist dist))))
(when found
(setf (current-child) found
selected-pos 0
child (cons found (child-remove found child)))))))
(show-all-children t)
(when is-root-p
(sleep *spatial-move-delay-after*)
(enter-frame)))))
(defun select-brother-spatial-move-right ()
"Select spatially the nearest brother of the current child in the right direction"
(select-brother-generic-spatial-move #'(lambda (current child)
(when (> (child-x2 child) (child-x2 current))
(distance (child-x2 current) (middle-child-y current)
(child-x child) (middle-child-y child))))))
(defun select-brother-spatial-move-left ()
"Select spatially the nearest brother of the current child in the left direction"
(select-brother-generic-spatial-move #'(lambda (current child)
(when (< (child-x child) (child-x current))
(distance (child-x current) (middle-child-y current)
(child-x2 child) (middle-child-y child))))))
(defun select-brother-spatial-move-down ()
"Select spatially the nearest brother of the current child in the down direction"
(select-brother-generic-spatial-move #'(lambda (current child)
(when (> (child-y2 child) (child-y2 current))
(distance (middle-child-x current) (child-y2 current)
(middle-child-x child) (child-y child))))))
(defun select-brother-spatial-move-up ()
"Select spatially the nearest brother of the current child in the up direction"
(select-brother-generic-spatial-move #'(lambda (current child)
(when (< (child-y child) (child-y current))
(distance (middle-child-x current) (child-y current)
(middle-child-x child) (child-y2 child))))))
(defun select-brother-spatial-move-right-take-current ()
"Select spatially the nearest brother of the current child in the right direction - move current focused child"
(with-move-current-focused-window ()
(select-brother-spatial-move-right)))
(defun select-brother-spatial-move-left-take-current ()
"Select spatially the nearest brother of the current child in the left direction - move current focused child"
(with-move-current-focused-window ()
(select-brother-spatial-move-left)))
(defun select-brother-spatial-move-down-take-current ()
"Select spatially the nearest brother of the current child in the down direction - move current focused child"
(with-move-current-focused-window ()
(select-brother-spatial-move-down)))
(defun select-brother-spatial-move-up-take-current ()
"Select spatially the nearest brother of the current child in the up direction - move current focused child"
(with-move-current-focused-window ()
(select-brother-spatial-move-up)))
| 16,636 | Common Lisp | .lisp | 355 | 39.904225 | 113 | 0.649525 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | b2ec3f7f69ffe4088d2757379e86679a10fe97038a9fa97cae9e4f0095ebc60e | 9,974 | [
-1
] |
9,976 | config.lisp | spacefrogg_clfswm/src/config.lisp | ;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: Configuration file
;;;
;;; Change this file to your own needs or update some of this variables in
;;; your ~/.clfswmrc
;;; Some simple hack can be done in the code begining with the word CONFIG
;;; (you can do a 'grep CONFIG *.lisp' to see what you can configure)
;;; --------------------------------------------------------------------------
;;;
;;; (C) 2005-2015 Philippe Brochard <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; --------------------------------------------------------------------------
(in-package :clfswm)
;;; CONFIG - Default modifiers
(defconfig *default-modifiers* '()
nil "Default modifiers list to append to explicit modifiers
Example: :mod-2 for num_lock, :lock for Caps_lock...")
;;; Standard menu entry based on the XDG specifications
(defconfig *xdg-section-list* (append
'(TextEditor FileManager WebBrowser)
'(AudioVideo Audio Video Development Education Game Graphics Network
Office Settings System Utility)
'(TerminalEmulator Screensaver))
'Menu "Standard menu sections")
(defun-equal-wm-class equal-wm-class-rox-pinboard "ROX-Pinboard")
(defun-equal-wm-class equal-wm-class-xvkbd "xvkbd")
;;; CONFIG - Never managed window list
(defconfig *never-managed-window-list*
(list (list 'equal-wm-class-rox-pinboard nil)
(list 'equal-wm-class-xvkbd 'raise-window)
(list 'equal-clfswm-terminal 'raise-and-focus-window))
nil "CLFSWM will never manage windows of this type.
A list of (list match-function handle-function)")
(defconfig *steal-focus* t
nil "Allow to steal the focus on configure request")
(defconfig *hide-unmanaged-window* t
nil "Hide or not unmanaged windows when a child is deselected.")
(defconfig *snap-size* 5
nil "Snap size (in % of parent size) when move or resize frame is constrained")
(defconfig *spatial-move-delay-before* 0.2
nil "Delay to display the current child before doing a spatial move")
(defconfig *spatial-move-delay-after* 0.5
nil "Delay to display the new child after doing a spatial move")
(defconfig *corner-size* 3
'Corner "The size of the corner square")
;;; CONFIG: Corner actions - See in clfswm-corner.lisp for
;;; allowed functions
(defconfig *corner-main-mode-left-button*
'((:top-left open-menu)
(:top-right present-virtual-keyboard)
(:bottom-right expose-windows-mode)
(:bottom-left nil))
'Corner "Actions on corners in the main mode with the left mouse button")
(defconfig *corner-main-mode-middle-button*
'((:top-left help-on-clfswm)
(:top-right ask-close/kill-current-window)
(:bottom-right nil)
(:bottom-left nil))
'Corner "Actions on corners in the main mode with the middle mouse button")
(defconfig *corner-main-mode-right-button*
'((:top-left present-clfswm-terminal)
(:top-right ask-close/kill-current-window)
(:bottom-right expose-all-windows-mode)
(:bottom-left nil))
'Corner "Actions on corners in the main mode with the right mouse button")
(defconfig *corner-second-mode-left-button*
'((:top-left nil)
(:top-right nil)
(:bottom-right expose-windows-mode)
(:bottom-left nil))
'Corner "Actions on corners in the second mode with the left mouse button")
(defconfig *corner-second-mode-middle-button*
'((:top-left help-on-clfswm)
(:top-right nil)
(:bottom-right nil)
(:bottom-left nil))
'Corner "Actions on corners in the second mode with the middle mouse button")
(defconfig *corner-second-mode-right-button*
'((:top-left nil)
(:top-right nil)
(:bottom-right expose-all-windows-mode)
(:bottom-left nil))
'Corner "Actions on corners in the second mode with the right mouse button")
(defconfig *virtual-keyboard-cmd* "xvkbd"
'Corner "The command to display the virtual keybaord
Here is an ~/.Xresources example for xvkbd:
xvkbd.windowGeometry: 300x100-0-0
xvkbd*Font: 6x12
xvkbd.modalKeytop: true
xvkbd.customization: -french
xvkbd.keypad: false
And make it always on top")
(defconfig *clfswm-terminal-name* "clfswm-terminal"
'Corner "The clfswm terminal name")
;;(defparameter *clfswm-terminal-cmd* (format nil "xterm -T ~A -e /bin/bash --noprofile --norc" *clfswm-terminal-name*)
;;(defparameter *clfswm-terminal-cmd* (format nil "urxvt -name ~A" *clfswm-terminal-name*)
(defconfig *clfswm-terminal-cmd* (format nil "xterm -T ~A" *clfswm-terminal-name*)
'Corner "The clfswm terminal command.
This command must set the window title to *clfswm-terminal-name*")
(defconfig *corner-error-message-color* "red"
'Corner "Error message color")
(defconfig *corner-error-message-delay* 5
'Corner "Time to display the error message on commad error")
(defconfig *corner-command-try-delay* 0.2
'Corner "Time to wait before checking window in query tree")
(defconfig *corner-command-try-number* 10
'Corner "Number of try to wait the window in query tree")
;;; Hook definitions
;;;
;;; A hook is a function, a symbol or a list of functions with a rest
;;; arguments.
;;;
;;; This hooks are set in clfswm.lisp, you can overwrite them or extend
;;; them with a hook list.
;;;
;;; See clfswm.lisp for hooks examples.
(defconfig *init-hook* '(default-init-hook display-hello-window)
'Hook "Init hook. This hook is run just after the first root frame is created")
(defconfig *close-hook* '(close-notify-window close-clfswm-terminal close-virtual-keyboard)
'Hook "Close hook. This hook is run just before closing the display")
(defconfig *default-nw-hook* 'default-frame-nw-hook
'Hook "Default action to do on newly created windows")
(defconfig *query-key-press-hook* nil
'Hook "Query hook. Hook called on each key press event in query loop")
(defconfig *query-button-press-hook* nil
'Hook "Query hook. Hook called on each button press event in query loop")
;;; CONFIG: Root
(defconfig *create-frame-on-root* nil
'Root "Create frame on root.
Set this variable to true if you want to allow to create a new frame
on the root window in the main mode with the mouse")
(defconfig *have-to-show-current-root* t
'Root "Show the current root if true")
(defconfig *show-current-root-delay* 1
'Root "Delay to show the current root")
(defconfig *show-current-root-placement* 'middle-middle-root-placement
'Root "Current root notify window placement")
(defconfig *show-current-root-message* "Current root"
'Root "Current root notify window message")
;;; CONFIG: Main mode colors
(defconfig *color-selected* "Red"
'Main-mode "Color of selected window")
(defconfig *color-unselected* "Blue"
'Main-mode "Color of unselected color")
(defconfig *color-maybe-selected* "Yellow"
'Main-mode "Color of maybe selected windows")
;;; CONFIG: Frame colors
(defconfig *frame-background* "Black"
'Frame-colors "Frame background")
(defconfig *frame-foreground* "Green"
'Frame-colors "Frame foreground")
(defconfig *frame-foreground-root* "Red"
'Frame-colors "Frame foreground when the frame is the root frame")
(defconfig *frame-foreground-hidden* "Darkgreen"
'Frame-colors "Frame foreground for hidden windows")
(defconfig *frame-transparency* 0.6
'Frame-colors "Frame background transparency")
;;; CONFIG: Default window size
(defconfig *default-window-width* 400
nil "Default window width")
(defconfig *default-window-height* 300
nil "Default window height")
;;; CONFIG: Second mode colors and fonts
(defconfig *sm-border-color* "Green"
'Second-mode "Second mode window border color")
(defconfig *sm-background-color* "Black"
'Second-mode "Second mode window background color")
(defconfig *sm-foreground-color* "Red"
'Second-mode "Second mode window foreground color")
(defconfig *sm-font-string* *default-font-string*
'Second-mode "Second mode window font string")
(defconfig *sm-width* 300
'Second-mode "Second mode window width")
(defconfig *sm-height* 25
'Second-mode "Second mode window height")
(defconfig *sm-transparency* *default-transparency*
'Second-mode "Second mode background transparency")
;;; CONFIG - Identify key colors
(defconfig *identify-font-string* *default-font-string*
'Identify-key "Identify window font string")
(defconfig *identify-background* "black"
'Identify-key "Identify window background color")
(defconfig *identify-foreground* "green"
'Identify-key "Identify window foreground color")
(defconfig *identify-border* "red"
'Identify-key "Identify window border color")
(defconfig *identify-transparency* *default-transparency*
'Identify-key "Identify window background transparency")
;;; CONFIG - Query string colors
(defconfig *query-font-string* *default-font-string*
'Query-string "Query string window font string")
(defconfig *query-background* "black"
'Query-string "Query string window background color")
(defconfig *query-message-color* "yellow"
'Query-string "Query string window message color")
(defconfig *query-foreground* "green"
'Query-string "Query string window foreground color")
(defconfig *query-cursor-color* "white"
'Query-string "Query string window foreground cursor color")
(defconfig *query-parent-color* "blue"
'Query-string "Query string window parenthesis color")
(defconfig *query-parent-error-color* "red"
'Query-string "Query string window parenthesis color when no match")
(defconfig *query-border* "red"
'Query-string "Query string window border color")
(defconfig *query-transparency* *default-transparency*
'Query-string "Query string window background transparency")
(defconfig *query-max-complet-length* 100
'Query-string "Query maximum length of completion list")
(defconfig *query-min-complet-char* 2
'Query-string "Query minimum input length for completion")
;;; CONFIG - Info mode
(defconfig *info-background* "black"
'Info-mode "Info window background color")
(defconfig *info-foreground* "green"
'Info-mode "Info window foreground color")
(defconfig *info-border* "red"
'Info-mode "Info window border color")
(defconfig *info-line-cursor* "white"
'Info-mode "Info window line cursor color color")
(defconfig *info-selected-background* "blue"
'Info-mode "Info selected item background color")
(defconfig *info-font-string* *default-font-string*
'Info-mode "Info window font string")
(defconfig *info-transparency* *default-transparency*
'Info-mode "Info window background transparency")
(defconfig *info-click-to-select* t
'Info-mode "If true, click on info window select item. Otherwise, click to drag the menu")
;;; CONFIG - Circulate string colors
(defconfig *circulate-font-string* *default-font-string*
'Circulate-mode "Circulate string window font string")
(defconfig *circulate-background* "black"
'Circulate-mode "Circulate string window background color")
(defconfig *circulate-foreground* "green"
'Circulate-mode "Circulate string window foreground color")
(defconfig *circulate-border* "red"
'Circulate-mode "Circulate string window border color")
(defconfig *circulate-width* 400
'Circulate-mode "Circulate mode window width")
(defconfig *circulate-height* 15
'Circulate-mode "Circulate mode window height")
(defconfig *circulate-transparency* *default-transparency*
'Circulate-mode "Circulate window background transparency")
(defconfig *circulate-text-limite* 30
'Circulate-mode "Maximum text limite in the circulate window")
;;; CONFIG - Expose string colors
(defconfig *expose-font-string* *default-font-string*
'Expose-mode "Expose string window font string")
(defconfig *expose-background* "grey10"
'Expose-mode "Expose string window background color")
(defconfig *expose-foreground* "grey50"
'Expose-mode "Expose string window foreground color")
(defconfig *expose-foreground-letter* "red"
'Expose-mode "Expose string window foreground color for letters")
(defconfig *expose-foreground-letter-nok* "grey30"
'Expose-mode "Expose string window foreground color for letter not selected")
(defconfig *expose-background-letter-match* "green"
'Expose-mode "Expose string window background color for matching letters")
(defconfig *expose-border* "grey20"
'Expose-mode "Expose string window border color")
(defconfig *expose-valid-on-key* t
'Expose-mode "Valid expose mode when an accel key is pressed")
(defconfig *expose-show-window-title* t
'Expose-mode "Show the window title on accel window")
(defconfig *expose-transparency* 0.9
'Expose-mode "Expose string window background transparency")
(defconfig *expose-direct-select* t
'Expose-mode "Immediately select child if they can be directly accessed")
;;; CONFIG - Fastswitch string colors
(defconfig *fastswitch-font-string* *default-font-string*
'Fastswitch-mode "Fastswitch string window font string")
(defconfig *fastswitch-background* "grey10"
'Fastswitch-mode "Fastswitch string window background color")
(defconfig *fastswitch-foreground* "grey50"
'Fastswitch-mode "Fastswitch string window foreground color")
(defconfig *fastswitch-foreground-letter* "red"
'Fastswitch-mode "Fastswitch string window foreground color for letters")
(defconfig *fastswitch-foreground-letter-second* "magenta"
'Fastswitch-mode "Fastswitch string window foreground color for letters")
(defconfig *fastswitch-foreground-letter-second-frame* "yellow"
'Fastswitch-mode "Fastswitch string window foreground color for letters for frames")
(defconfig *fastswitch-foreground-childname* "grey70"
'Fastswitch-mode "Fastswitch string window foreground color for childname")
(defconfig *fastswitch-border* "grey20"
'Fastswitch-mode "Fastswitch string window border color")
(defconfig *fastswitch-transparency* 0.9
'Fastswitch-mode "Fastswitch string window background transparency")
(defconfig *fastswitch-show-frame-p* t
'Fastswitch-mode "Fastswitch show frame in mini window")
(defconfig *fastswitch-adjust-window-p* t
'Fastswitch-mode "Fastswitch adjust window to show all children names")
(defconfig *fastswitch-display-mode* 'Tree
'Fastswitch-mode "Fastswitch display mode (one of LINE or TREE)")
;;; CONFIG - Show key binding colors
(defconfig *info-color-title* "Magenta"
'Info-mode "Colored info title color")
(defconfig *info-color-underline* "Yellow"
'Info-mode "Colored info underline color")
(defconfig *info-color-first* "Cyan"
'Info-mode "Colored info first color")
(defconfig *info-color-second* "lightblue"
'Info-mode "Colored info second color")
;;; CONFIG - Menu colors
;;; Set *info-foreground* to change the default menu foreground
(defconfig *menu-color-submenu* "Cyan"
'Menu "Submenu color in menu")
(defconfig *menu-color-comment* "Yellow"
'Menu "Comment color in menu")
(defconfig *menu-color-key* "Magenta"
'Menu "Key color in menu")
(defconfig *menu-color-menu-key* (->color #xFF9AFF)
'Menu "Menu key color in menu")
(defconfig *menu-key-bound-color* "gray50"
'Menu "Key bound min menu color")
;;; CONFIG - Notify window string colors
(defconfig *notify-window-font-string* *default-font-string*
'Notify-Window "Notify window font string")
(defconfig *notify-window-background* "black"
'Notify-Window "Notify Window background color")
(defconfig *notify-window-foreground* "green"
'Notify-Window "Notify Window foreground color")
(defconfig *notify-window-border* "red"
'Notify-Window "Notify Window border color")
(defconfig *notify-window-delay* 10
'Notify-Window "Notify Window display delay")
(defconfig *notify-window-transparency* *default-transparency*
'Notify-window "Notify window background transparency")
| 16,444 | Common Lisp | .lisp | 344 | 45.040698 | 119 | 0.741053 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | a50bd0e53b7b4292b9c3b0a23269ee45903271da9010ce12ef874825c0d18336 | 9,976 | [
-1
] |
9,985 | clfswm-layout.lisp | spacefrogg_clfswm/src/clfswm-layout.lisp | ;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: Layout functions
;;; --------------------------------------------------------------------------
;;;
;;; (C) 2005-2015 Philippe Brochard <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; --------------------------------------------------------------------------
(in-package :clfswm)
;;; CONFIG - Layout menu
;;;
;;; To add a new layout:
;;; 1- define your own layout: a method returning the real size of the
;;; child in screen size (integer) as 4 values (rx, ry, rw, rh).
;;; This method can use the float size of the child (x, y ,w , h).
;;; It can be specialized for xlib:window or frame
;;; 2- Define a setter function for your layout
;;; 3- Register your new layout with register-layout or create
;;; a sub menu for it with register-layout-sub-menu.
(defparameter *layout-current-key* (1- (char-code #\a)))
;;; Generic functions
(defun set-layout (layout)
"Set the layout of the current child"
(when (frame-p (current-child))
(setf (frame-layout (current-child)) layout)
(leave-second-mode)))
(defun set-layout-dont-leave (layout)
"Set the layout of the current child"
(when (frame-p (current-child))
(setf (frame-layout (current-child)) layout)))
(defun set-layout-once (layout-name)
(set-layout-dont-leave layout-name)
(show-all-children)
(fixe-real-size-current-child)
(set-layout-dont-leave #'no-layout))
(defun set-layout-simple (layout)
"Set the layout of the current child"
(set-layout-dont-leave layout)
(show-all-children))
(defun get-managed-child (parent)
"Return only the windows that are managed for tiling"
(when (frame-p parent)
(remove-if #'(lambda (x)
(and (xlib:window-p x) (not (managed-window-p x parent))))
(frame-child parent))))
(defun next-layout-key ()
(code-char (incf *layout-current-key*)))
(defun register-layout (layout)
(add-menu-key 'frame-layout-menu (next-layout-key) layout))
(defun register-layout-sub-menu (name doc layout-list)
(add-sub-menu 'frame-layout-menu (next-layout-key) name doc)
(loop :for item :in layout-list
:for i :from 0
:do (typecase item
(cons (add-menu-key name (first item) (second item)))
(string (add-menu-comment name item))
(t (add-menu-key name (number->char i) item)))))
(defun layout-ask-size (msg slot &optional (min 80))
(when (frame-p (current-child))
(let ((new-size (/ (or (query-number msg (* (frame-data-slot (current-child) slot) 100)) min) 100)))
(setf (frame-data-slot (current-child) slot) (max (min new-size 0.99) 0.01)))))
(defun adjust-layout-size (slot inc)
(when (frame-p (current-child))
(setf (frame-data-slot (current-child) slot)
(max (min (+ (frame-data-slot (current-child) slot) inc) 0.99) 0.01))))
(defun inc-tile-layout-size ()
"Increase the tile layout size"
(adjust-layout-size :tile-size 0.05)
(show-all-children))
(defun dec-tile-layout-size ()
"Decrease the tile layout size"
(adjust-layout-size :tile-size -0.05)
(show-all-children))
(defun inc-slow-tile-layout-size ()
"Increase slowly the tile layout size"
(adjust-layout-size :tile-size 0.01)
(show-all-children))
(defun dec-slow-tile-layout-size ()
"Decrease slowly the tile layout size"
(adjust-layout-size :tile-size -0.01)
(show-all-children))
(defun fast-layout-switch ()
"Switch between two layouts"
(when (frame-p (current-child))
(with-slots (layout) (current-child)
(let* ((layout-list (frame-data-slot (current-child) :fast-layout))
(first-layout (ensure-function (first layout-list)))
(second-layout (ensure-function (second layout-list))))
(setf layout (if (eql layout first-layout)
second-layout
first-layout))
(leave-second-mode)))))
(defun push-in-fast-layout-list ()
"Push the current layout in the fast layout list"
(when (frame-p (current-child))
(setf (frame-data-slot (current-child) :fast-layout)
(list (frame-layout (current-child))
(first (frame-data-slot (current-child) :fast-layout))))
(leave-second-mode)))
(register-layout-sub-menu 'frame-fast-layout-menu "Frame fast layout menu"
'(("s" fast-layout-switch)
("p" push-in-fast-layout-list)))
;;; No layout
(defgeneric no-layout (child parent)
(:documentation "No layout: Maximize windows in their frame - Leave frames to their original size"))
(defmethod no-layout ((child xlib:window) parent)
(with-slots (rx ry rw rh) parent
(values (adj-border-xy rx parent)
(adj-border-xy ry parent)
(adj-border-wh rw child)
(adj-border-wh rh child))))
(defmethod no-layout ((child frame) parent)
(values (adj-border-xy (x-fl->px (frame-x child) parent) parent)
(adj-border-xy (y-fl->px (frame-y child) parent) parent)
(adj-border-wh (w-fl->px (frame-w child) parent) child)
(adj-border-wh (h-fl->px (frame-h child) parent) child)))
(defun set-no-layout ()
"No layout: Maximize windows in their frame - Leave frames to their original size"
(set-layout #'no-layout))
(register-layout 'set-no-layout)
;;; No layout remember size
(defun set-no-layout-remember-size ()
"No layout: Maximize windows in their frame - Leave frames to their actual size"
(fixe-real-size-current-child)
(set-no-layout))
(register-layout 'set-no-layout-remember-size)
;;; Maximize layout
(defgeneric maximize-layout (child parent)
(:documentation "Maximize layout: Maximize windows and frames in their parent frame"))
(defmethod maximize-layout (child parent)
(with-slots (rx ry rw rh) parent
(values (adj-border-xy rx parent)
(adj-border-xy ry parent)
(adj-border-wh rw child)
(adj-border-wh rh child))))
(defun set-maximize-layout ()
"Maximize layout: Maximize windows and frames in their parent frame"
(set-layout #'maximize-layout))
(register-layout 'set-maximize-layout)
;;; Tile layout
(defun tile-layout-ask-keep-position ()
(when (frame-p (current-child))
(if (query-yes-or-no "Keep frame children positions?")
(setf (frame-data-slot (current-child) :tile-layout-keep-position) :yes)
(remove-frame-data-slot (current-child) :tile-layout-keep-position))))
(labels ((set-managed ()
(setf (frame-data-slot (current-child) :layout-managed-children)
(copy-list (get-managed-child (current-child))))))
(defun set-layout-managed-children ()
(when (frame-p (current-child))
(set-managed)
(tile-layout-ask-keep-position)))
(defun update-layout-managed-children-position ()
"Update layout managed children position"
(when (frame-p (current-child))
(set-managed)
(leave-second-mode))))
(defun update-layout-managed-children-keep-position (child parent)
(declare (ignore child))
(let ((managed-children (frame-data-slot parent :layout-managed-children))
(managed-in-parent (get-managed-child parent)))
(dolist (ch managed-in-parent)
(unless (child-member ch managed-children)
(setf managed-children (append managed-children (list ch)))))
(setf managed-children (remove-if-not (lambda (x)
(child-member x managed-in-parent))
managed-children))
(setf (frame-data-slot parent :layout-managed-children) managed-children)
managed-children))
(defun update-layout-managed-children (child parent)
(if (eql (frame-data-slot parent :tile-layout-keep-position) :yes)
(update-layout-managed-children-keep-position child parent)
(get-managed-child parent)))
(defgeneric tile-layout (child parent)
(:documentation "Tile child in its frame (vertical)"))
(defmethod tile-layout (child parent)
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (length managed-children))
(nx (ceiling (sqrt len)))
(ny (ceiling (/ len nx)))
(dx (/ (frame-rw parent) nx))
(dy (/ (frame-rh parent) ny))
(dpos (- (* nx ny) len))
(width dx))
(when (plusp dpos)
(if (zerop pos)
(setf width (* dx (1+ dpos)))
(incf pos dpos)))
(values (round (adj-border-xy (+ (frame-rx parent) (truncate (* (mod pos nx) dx))) parent))
(round (adj-border-xy (+ (frame-ry parent) (truncate (* (truncate (/ pos nx)) dy))) parent))
(round (adj-border-wh width child))
(round (adj-border-wh dy child)))))
(defun set-tile-layout ()
"Tile child in its frame (vertical)"
(set-layout-managed-children)
(set-layout #'tile-layout))
;; Horizontal tiling layout
(defgeneric tile-horizontal-layout (child parent)
(:documentation "Tile child in its frame (horizontal)"))
(defmethod tile-horizontal-layout (child parent)
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (length managed-children))
(ny (ceiling (sqrt len)))
(nx (ceiling (/ len ny)))
(dx (/ (frame-rw parent) nx))
(dy (/ (frame-rh parent) ny))
(dpos (- (* nx ny) len))
(height dy))
(when (plusp dpos)
(if (zerop pos)
(setf height (* dy (1+ dpos)))
(incf pos dpos)))
(values (round (adj-border-xy (+ (frame-rx parent) (truncate (* (truncate (/ pos ny)) dx))) parent))
(round (adj-border-xy (+ (frame-ry parent) (truncate (* (mod pos ny) dy))) parent))
(round (adj-border-wh dx child))
(round (adj-border-wh height child)))))
(defun set-tile-horizontal-layout ()
"Tile child in its frame (horizontal)"
(set-layout-managed-children)
(set-layout #'tile-horizontal-layout))
;; Mix tile layout : automatic choose between vertical/horizontal
(defgeneric tile-layout-mix (child parent)
(:documentation "Tile child in its frame (mix: automatic choose between vertical/horizontal)"))
(defmethod tile-layout-mix (child parent)
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (length managed-children))
(d1 (ceiling (sqrt len)))
(d2 (ceiling (/ len d1)))
(nx (if (> (frame-rw parent) (frame-rh parent)) d1 d2))
(ny (if (> (frame-rw parent) (frame-rh parent)) d2 d1))
(dx (/ (frame-rw parent) nx))
(dy (/ (frame-rh parent) ny))
(dpos (- (* nx ny) len))
(width dx))
(when (plusp dpos)
(if (zerop pos)
(setf width (* dx (1+ dpos)))
(incf pos dpos)))
(values (round (adj-border-xy (+ (frame-rx parent)
(truncate (* (mod pos nx) dx))) parent))
(round (adj-border-xy (+ (frame-ry parent)
(truncate (* (truncate (/ pos nx)) dy))) parent))
(round (adj-border-wh width child))
(round (adj-border-wh dy child)))))
(defun set-tile-layout-mix ()
"Tile child in its frame (mix: automatic choose between vertical/horizontal)"
(set-layout-managed-children)
(set-layout #'tile-layout-mix))
;; One column layout
(defgeneric one-column-layout (child parent)
(:documentation "One column layout"))
(defmethod one-column-layout (child parent)
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (length managed-children))
(dy (/ (frame-rh parent) len)))
(values (round (adj-border-xy (frame-rx parent) parent))
(round (adj-border-xy (+ (frame-ry parent) (* pos dy)) parent))
(round (adj-border-wh (frame-rw parent) child))
(round (adj-border-wh dy child)))))
(defun set-one-column-layout ()
"One column layout"
(set-layout-managed-children)
(set-layout #'one-column-layout))
;; One line layout
(defgeneric one-line-layout (child parent)
(:documentation "One line layout"))
(defmethod one-line-layout (child parent)
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (length managed-children))
(dx (/ (frame-rw parent) len)))
(values (round (adj-border-xy (+ (frame-rx parent) (* pos dx)) parent))
(round (adj-border-xy (frame-ry parent) parent))
(round (adj-border-wh dx child))
(round (adj-border-wh (frame-rh parent) child)))))
(defun set-one-line-layout ()
"One line layout"
(set-layout-managed-children)
(set-layout #'one-line-layout))
;;; Space layout
(defun tile-space-layout (child parent)
"Tile Space: tile child in its frame leaving spaces between them"
(with-slots (rx ry rw rh) parent
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (length managed-children))
(d1 (ceiling (sqrt len)))
(d2 (ceiling (/ len d1)))
(cols (if (> rw rh) d1 d2))
(rows (if (> rw rh) d2 d1))
(col (mod pos cols))
(row (floor pos cols))
(space-percent (or (frame-data-slot parent :tile-space-size) 0.05))
(col-space-total (* rw space-percent))
(row-space-total (* rh space-percent))
(col-space (floor col-space-total (1+ cols)))
(row-space (floor row-space-total (1+ rows)))
(child-width (floor (- rw col-space-total) cols))
(child-height (floor (- rh row-space-total) rows))
)
(values (round (adj-border-xy (+ rx col-space (* (+ col-space child-width) col)) parent))
(round (adj-border-xy (+ ry row-space (* (+ row-space child-height) row)) parent))
(round (adj-border-wh child-width child))
(round (adj-border-wh child-height child))))))
(defun set-tile-space-layout ()
"Tile Space: tile child in its frame leaving spaces between them"
(layout-ask-size "Space size in percent (%)" :tile-space-size 0.01)
(set-layout-managed-children)
(set-layout #'tile-space-layout))
(defun three-columns-layout (child parent)
"Three Colums: main child in the middle, others on the two sides."
(with-slots (rx ry rw rh) parent
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (max (1- (length managed-children)) 1))
(dy (round (/ rh (max (truncate (/ (+ (if (oddp pos) 1 0) len) 2)) 1))))
(size (or (frame-data-slot parent :tile-size) 0.75))
(other-size (if (> len 1) (/ (- 1 size) 2) (- 1 size))))
(if (> (length managed-children) 1)
(if (= pos 0)
(values (adj-border-xy (if (> len 1)
(round (+ rx (* rw other-size)))
rx) parent)
(adj-border-xy ry parent)
(adj-border-wh (round (* rw size)) child)
(adj-border-wh rh child))
(values (adj-border-xy (if (oddp pos)
(round (+ rx (* rw (if (> len 1) (+ size other-size) size))))
rx) parent)
(adj-border-xy (round (+ ry (* dy (truncate (/ (1- pos) 2))))) parent)
(adj-border-wh (round (* rw other-size)) parent)
(adj-border-wh dy parent)))
(no-layout child parent)))))
(defun set-three-columns-layout ()
"Three Columns: main child in the middle, others on the two sides."
(layout-ask-size "Tile size in percent (%)" :tile-size)
(set-layout-managed-children)
(set-layout #'three-columns-layout))
(register-layout-sub-menu 'frame-tile-layout-menu "Frame tile layout menu"
'(("v" set-tile-layout)
("h" set-tile-horizontal-layout)
("m" set-tile-layout-mix)
("c" set-one-column-layout)
("l" set-one-line-layout)
("s" set-tile-space-layout)
("t" set-three-columns-layout)))
;;; Tile Left
(defun tile-left-layout (child parent)
"Tile Left: main child on left and others on right"
(with-slots (rx ry rw rh) parent
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (max (1- (length managed-children)) 1))
(dy (/ rh len))
(size (or (frame-data-slot parent :tile-size) 0.8)))
(if (> (length managed-children) 1)
(if (= pos 0)
(values (adj-border-xy rx parent)
(adj-border-xy ry parent)
(adj-border-wh (round (* rw size)) child)
(adj-border-wh rh child))
(values (adj-border-xy (round (+ rx (* rw size))) parent)
(adj-border-xy (round (+ ry (* dy (1- pos)))) parent)
(adj-border-wh (round (* rw (- 1 size))) child)
(adj-border-wh (round dy) child)))
(no-layout child parent)))))
(defun set-tile-left-layout ()
"Tile Left: main child on left and others on right"
(layout-ask-size "Tile size in percent (%)" :tile-size)
(set-layout-managed-children)
(set-layout #'tile-left-layout))
;;; Tile right
(defun tile-right-layout (child parent)
"Tile Right: main child on right and others on left"
(with-slots (rx ry rw rh) parent
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (max (1- (length managed-children)) 1))
(dy (/ rh len))
(size (or (frame-data-slot parent :tile-size) 0.8)))
(if (> (length managed-children) 1)
(if (= pos 0)
(values (adj-border-xy (round (+ rx (* rw (- 1 size)))) parent)
(adj-border-xy ry parent)
(adj-border-wh (round (* rw size)) child)
(adj-border-wh rh child))
(values (adj-border-xy rx parent)
(adj-border-xy (round (+ ry (* dy (1- pos)))) parent)
(adj-border-wh (round (* rw (- 1 size))) child)
(adj-border-wh (round dy) child)))
(no-layout child parent)))))
(defun set-tile-right-layout ()
"Tile Right: main child on right and others on left"
(layout-ask-size "Tile size in percent (%)" :tile-size)
(set-layout-managed-children)
(set-layout #'tile-right-layout))
;;; Tile Top
(defun tile-top-layout (child parent)
"Tile Top: main child on top and others on bottom"
(with-slots (rx ry rw rh) parent
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (max (1- (length managed-children)) 1))
(dx (/ rw len))
(size (or (frame-data-slot parent :tile-size) 0.8)))
(if (> (length managed-children) 1)
(if (= pos 0)
(values (adj-border-xy rx parent)
(adj-border-xy ry parent)
(adj-border-wh rw child)
(adj-border-wh (round (* rh size)) child))
(values (adj-border-xy (round (+ rx (* dx (1- pos)))) parent)
(adj-border-xy (round (+ ry (* rh size))) parent)
(adj-border-wh (round dx) child)
(adj-border-wh (round (* rh (- 1 size))) child)))
(no-layout child parent)))))
(defun set-tile-top-layout ()
"Tile Top: main child on top and others on bottom"
(layout-ask-size "Tile size in percent (%)" :tile-size)
(set-layout-managed-children)
(set-layout #'tile-top-layout))
;;; Tile Bottom
(defun tile-bottom-layout (child parent)
"Tile Bottom: main child on bottom and others on top"
(with-slots (rx ry rw rh) parent
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (max (1- (length managed-children)) 1))
(dx (/ rw len))
(size (or (frame-data-slot parent :tile-size) 0.8)))
(if (> (length managed-children) 1)
(if (= pos 0)
(values (adj-border-xy rx parent)
(adj-border-xy (round (+ ry (* rh (- 1 size)))) parent)
(adj-border-wh rw child)
(adj-border-wh (round (* rh size)) child))
(values (adj-border-xy (round (+ rx (* dx (1- pos)))) parent)
(adj-border-xy ry parent)
(adj-border-wh (round dx) child)
(adj-border-wh (round (* rh (- 1 size))) child)))
(no-layout child parent)))))
(defun set-tile-bottom-layout ()
"Tile Bottom: main child on bottom and others on top"
(layout-ask-size "Tile size in percent (%)" :tile-size)
(set-layout-managed-children)
(set-layout #'tile-bottom-layout))
(register-layout-sub-menu 'frame-tile-dir-layout-menu "Tile in one direction layout menu"
'(("l" set-tile-left-layout)
("r" set-tile-right-layout)
("t" set-tile-top-layout)
("b" set-tile-bottom-layout)))
;;; Left and space layout: like left layout but leave a space on the left
(defun layout-ask-space (msg slot &optional (default 100))
(when (frame-p (current-child))
(let ((new-space (or (query-number msg (or (frame-data-slot (current-child) slot) default)) default)))
(setf (frame-data-slot (current-child) slot) new-space))))
(defun tile-left-space-layout (child parent)
"Tile Left Space: main child on left and others on right. Leave some space (in pixels) on the left."
(with-slots (rx ry rw rh) parent
(let* ((managed-children (update-layout-managed-children child parent))
(pos (child-position child managed-children))
(len (max (1- (length managed-children)) 1))
(dy (/ rh len))
(size (or (frame-data-slot parent :tile-size) 0.8))
(space (or (frame-data-slot parent :tile-left-space) 100)))
(if (> (length managed-children) 1)
(if (= pos 0)
(values (adj-border-xy (+ rx space) parent)
(adj-border-xy ry parent)
(adj-border-wh (- (round (* rw size)) space) child)
(adj-border-wh rh child))
(values (adj-border-xy (round (+ rx (* rw size))) parent)
(adj-border-xy (round (+ ry (* dy (1- pos)))) parent)
(adj-border-wh (round (* rw (- 1 size))) child)
(adj-border-wh (round dy) child)))
(multiple-value-bind (rnx rny rnw rnh)
(no-layout child parent)
(values (+ rnx space)
rny
(- rnw space)
rnh))))))
(defun set-tile-left-space-layout ()
"Tile Left Space: main child on left and others on right. Leave some space on the left."
(layout-ask-size "Tile size in percent (%)" :tile-size)
(layout-ask-space "Tile space (in pixels)" :tile-left-space)
(set-layout-managed-children)
(set-layout #'tile-left-space-layout))
(register-layout-sub-menu 'frame-tile-space-layout-menu "Tile with some space on one side menu"
'(set-tile-left-space-layout))
;;; Main windows layout - A possible GIMP layout
;;; The windows in the main list are tiled on the frame
;;; others windows are on one side of the frame.
(defun main-window-right-layout (child parent)
"Main window right: Main windows on the right. Others on the left."
(with-slots (rx ry rw rh) parent
(let* ((main-windows (frame-data-slot parent :main-window-list))
(len (length main-windows))
(size (or (frame-data-slot parent :tile-size) 0.8)))
(if (zerop len)
(no-layout child parent)
(if (child-member child main-windows)
(let* ((dy (/ rh len))
(pos (child-position child main-windows)))
(values (adj-border-xy (round (+ rx (* rw (- 1 size)))) parent)
(adj-border-xy (round (+ ry (* dy pos))) parent)
(adj-border-wh (round (* rw size)) child)
(adj-border-wh (round dy) child)))
(values (adj-border-xy rx parent)
(adj-border-xy ry parent)
(adj-border-wh (round (* rw (- 1 size))) child)
(adj-border-wh rh child)))))))
(defun set-main-window-right-layout ()
"Main window right: Main windows on the right. Others on the left."
(layout-ask-size "Split size in percent (%)" :tile-size)
(set-layout #'main-window-right-layout))
(defun main-window-left-layout (child parent)
"Main window left: Main windows on the left. Others on the right."
(with-slots (rx ry rw rh) parent
(let* ((main-windows (frame-data-slot parent :main-window-list))
(len (length main-windows))
(size (or (frame-data-slot parent :tile-size) 0.8)))
(if (zerop len)
(no-layout child parent)
(if (child-member child main-windows)
(let* ((dy (/ rh len))
(pos (child-position child main-windows)))
(values (adj-border-xy rx parent)
(adj-border-xy (round (+ ry (* dy pos))) parent)
(adj-border-wh (round (* rw size)) child)
(adj-border-wh (round dy) child)))
(values (adj-border-xy (round (+ rx (* rw size))) parent)
(adj-border-xy ry parent)
(adj-border-wh (round (* rw (- 1 size))) child)
(adj-border-wh rh child)))))))
(defun set-main-window-left-layout ()
"Main window left: Main windows on the left. Others on the right."
(layout-ask-size "Split size in percent (%)" :tile-size)
(set-layout #'main-window-left-layout))
(defun main-window-top-layout (child parent)
"Main window top: Main windows on the top. Others on the bottom."
(with-slots (rx ry rw rh) parent
(let* ((main-windows (frame-data-slot parent :main-window-list))
(len (length main-windows))
(size (or (frame-data-slot parent :tile-size) 0.8)))
(if (zerop len)
(no-layout child parent)
(if (child-member child main-windows)
(let* ((dx (/ rw len))
(pos (child-position child main-windows)))
(values (adj-border-xy (round (+ rx (* dx pos))) parent)
(adj-border-xy ry parent)
(adj-border-wh (round dx) child)
(adj-border-wh (round (* rh size)) child)))
(values (adj-border-xy rx parent)
(adj-border-xy (round (+ ry (* rh size))) parent)
(adj-border-wh rw child)
(adj-border-wh (round (* rh (- 1 size))) child)))))))
(defun set-main-window-top-layout ()
"Main window top: Main windows on the top. Others on the bottom."
(layout-ask-size "Split size in percent (%)" :tile-size)
(set-layout #'main-window-top-layout))
(defun main-window-bottom-layout (child parent)
"Main window bottom: Main windows on the bottom. Others on the top."
(with-slots (rx ry rw rh) parent
(let* ((main-windows (frame-data-slot parent :main-window-list))
(len (length main-windows))
(size (or (frame-data-slot parent :tile-size) 0.8)))
(if (zerop len)
(no-layout child parent)
(if (child-member child main-windows)
(let* ((dx (/ rw len))
(pos (child-position child main-windows)))
(values (adj-border-xy (round (+ rx (* dx pos))) parent)
(adj-border-xy (round (+ ry (* rh (- 1 size)))) parent)
(adj-border-wh (round dx) child)
(adj-border-wh (round (* rh size)) child)))
(values (adj-border-xy rx parent)
(adj-border-xy ry parent)
(adj-border-wh rw child)
(adj-border-wh (round (* rh (- 1 size))) child)))))))
(defun set-main-window-bottom-layout ()
"Main window bottom: Main windows on the bottom. Others on the top."
(layout-ask-size "Split size in percent (%)" :tile-size)
(set-layout #'main-window-bottom-layout))
(defun add-in-main-window-list ()
"Add the current window in the main window list"
(when (frame-p (current-child))
(with-current-window
(when (child-member window (get-managed-child (current-child)))
(pushnew window (frame-data-slot (current-child) :main-window-list)))))
(leave-second-mode))
(defun remove-in-main-window-list ()
"Remove the current window from the main window list"
(when (frame-p (current-child))
(with-current-window
(when (child-member window (get-managed-child (current-child)))
(setf (frame-data-slot (current-child) :main-window-list)
(child-remove window (frame-data-slot (current-child) :main-window-list))))))
(leave-second-mode))
(defun clear-main-window-list ()
"Clear the main window list"
(when (frame-p (current-child))
(setf (frame-data-slot (current-child) :main-window-list) nil))
(leave-second-mode))
(register-layout-sub-menu 'frame-main-window-layout-menu "Main window layout menu"
'(("r" set-main-window-right-layout)
("l" set-main-window-left-layout)
("t" set-main-window-top-layout)
("b" set-main-window-bottom-layout)
"-=- Actions on main windows list -=-"
("a" add-in-main-window-list)
("v" remove-in-main-window-list)
("c" clear-main-window-list)))
;;; GIMP layout specifics functions
;;;
(defconfig *gimp-layout-notify-window-delay* 30 'gimp-layout
"Time to display the GIMP layout notify window help")
(defun select-next/previous-child-no-main-window (fun-rotate)
"Select the next/previous child - Skip windows in main window list"
(when (frame-p (current-child))
(with-slots (child) (current-child)
(let* ((main-windows (frame-data-slot (current-child) :main-window-list))
(to-skip? (not (= (length main-windows)
(length child)))))
(labels ((rec ()
(setf child (funcall fun-rotate child))
(when (and to-skip?
(child-member (frame-selected-child (current-child)) main-windows))
(rec))))
(unselect-all-frames)
(rec)
(show-all-children))))))
(defun select-next-child-no-main-window ()
"Select the next child - Skip windows in main window list"
(select-next/previous-child-no-main-window #'rotate-list))
(defun select-previous-child-no-main-window ()
"Select the previous child - Skip windows in main window list"
(select-next/previous-child-no-main-window #'anti-rotate-list))
(defun mouse-click-to-focus-and-move-no-main-window (window root-x root-y)
"Move and focus the current frame or focus the current window parent.
Or do actions on corners - Skip windows in main window list"
(unless (do-corner-action root-x root-y *corner-main-mode-left-button*)
(if (and (frame-p (current-child))
(child-member window (frame-data-slot (current-child) :main-window-list)))
(replay-button-event)
(mouse-click-to-focus-generic window root-x root-y #'move-frame))))
(let ((help-text-list `(("-=- Help on The GIMP layout -=-" ,*info-color-title*)
""
"The GIMP layout is a main-window-layout with a sloppy focus policy."
"You can change the main windows direction with the layout menu."
""
"Press Alt+F8 to add a window to the main windows list."
"Press Alt+F9 to remove a window from the main windows list."
"Press Alt+F10 to clear the main windows list."
""
"You can select a main window with the right mouse button."
""
"Use the layout menu to restore the previous layout and keybinding.")))
(defun help-on-gimp-layout ()
"Help on the GIMP layout"
(info-mode help-text-list)
(leave-second-mode))
(defun set-gimp-layout ()
"The GIMP Layout"
(when (frame-p (current-child))
;; Note: There is no need to ungrab/grab keys because this
;; is done when leaving the second mode.
(define-main-key ("F8" :mod-1) 'add-in-main-window-list)
(define-main-key ("F9" :mod-1) 'remove-in-main-window-list)
(define-main-key ("F10" :mod-1) 'clear-main-window-list)
(define-main-key ("Tab" :mod-1) 'select-next-child-no-main-window)
(define-main-key ("Tab" :mod-1 :shift) 'select-previous-child-no-main-window)
(define-main-mouse (1) 'mouse-click-to-focus-and-move-no-main-window)
(setf (frame-data-slot (current-child) :focus-policy-save)
(frame-focus-policy (current-child)))
(setf (frame-focus-policy (current-child)) :sloppy)
(setf (frame-data-slot (current-child) :layout-save)
(frame-layout (current-child)))
(open-notify-window help-text-list)
(add-timer *gimp-layout-notify-window-delay* #'close-notify-window)
;; Set the default layout and leave the second mode.
(set-main-window-right-layout))))
(defun set-previous-layout ()
"Restore the previous layout"
(undefine-main-key ("F8" :mod-1))
(undefine-main-key ("F9" :mod-1))
(undefine-main-key ("F10" :mod-1))
(define-main-key ("Tab" :mod-1) 'select-next-child)
(define-main-key ("Tab" :mod-1 :shift) 'select-previous-child)
(define-main-mouse (1) 'mouse-click-to-focus-and-move)
(setf (frame-focus-policy (current-child))
(frame-data-slot (current-child) :focus-policy-save))
(setf (frame-layout (current-child))
(frame-data-slot (current-child) :layout-save))
(leave-second-mode))
(register-layout-sub-menu 'frame-gimp-layout-menu "The GIMP layout menu"
'(("g" set-gimp-layout)
("p" set-previous-layout)
("h" help-on-gimp-layout)
"-=- Main window layout -=-"
("r" set-main-window-right-layout)
("l" set-main-window-left-layout)
("t" set-main-window-top-layout)
("b" set-main-window-bottom-layout)
"-=- Actions on main windows list -=-"
("a" add-in-main-window-list)
("v" remove-in-main-window-list)
("c" clear-main-window-list)))
| 33,685 | Common Lisp | .lisp | 728 | 40.497253 | 106 | 0.642798 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 4c4c8a0e34cbd0d1a34851ef22f7f96cd8903d7361b742d5c63e1099653faf55 | 9,985 | [
-1
] |
9,987 | keysyms.lisp | spacefrogg_clfswm/src/keysyms.lisp | ;; Copyright (C) 2006 Matthew Kennedy
;;
;; This file is part of stumpwm.
;;
;; stumpwm is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; stumpwm is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this software; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
;; Boston, MA 02111-1307 USA
;; Commentary:
;;
;; Mapping a keysym to a name is a client side activity in X11. Some
;; of the code here was taken from the CMUCL Hemlocks code base. The
;; actual mappings were taken from Xorg's keysymdefs.h.
;;
;; Code:
(in-package :clfswm)
(defvar *keysym-name-translations* (make-hash-table))
(defvar *name-keysym-translations* (make-hash-table :test #'equal))
(defun cl-define-keysym (keysym name)
"Define a mapping from a keysym name to a keysym."
(setf (gethash keysym *keysym-name-translations*) name
(gethash name *name-keysym-translations*) keysym))
(defun keysym-name->keysym (name)
"Return the keysym corresponding to NAME."
(multiple-value-bind (value present-p)
(gethash name *name-keysym-translations*)
(declare (ignore present-p))
value))
(defun keysym->keysym-name (keysym)
"Return the name corresponding to KEYSYM."
(multiple-value-bind (value present-p)
(gethash keysym *keysym-name-translations*)
(declare (ignore present-p))
value))
(cl-define-keysym #xffffff "VoidSymbol") ;Void symbol
(cl-define-keysym #xff08 "BackSpace") ;Back space, back char
(cl-define-keysym #xff09 "Tab")
(cl-define-keysym #xff0a "Linefeed") ;Linefeed, LF
(cl-define-keysym #xff0b "Clear")
(cl-define-keysym #xff0d "Return") ;Return, enter
(cl-define-keysym #xff13 "Pause") ;Pause, hold
(cl-define-keysym #xff14 "Scroll_Lock")
(cl-define-keysym #xff15 "Sys_Req")
(cl-define-keysym #xff1b "Escape")
(cl-define-keysym #xffff "Delete") ;Delete, rubout
(cl-define-keysym #xff20 "Multi_key") ;Multi-key character compose
(cl-define-keysym #xff37 "Codeinput")
(cl-define-keysym #xff3c "SingleCandidate")
(cl-define-keysym #xff3d "MultipleCandidate")
(cl-define-keysym #xff3e "PreviousCandidate")
(cl-define-keysym #xff21 "Kanji") ;Kanji, Kanji convert
(cl-define-keysym #xff22 "Muhenkan") ;Cancel Conversion
(cl-define-keysym #xff23 "Henkan_Mode") ;Start/Stop Conversion
(cl-define-keysym #xff23 "Henkan") ;Alias for Henkan_Mode
(cl-define-keysym #xff24 "Romaji") ;to Romaji
(cl-define-keysym #xff25 "Hiragana") ;to Hiragana
(cl-define-keysym #xff26 "Katakana") ;to Katakana
(cl-define-keysym #xff27 "Hiragana_Katakana") ;Hiragana/Katakana toggle
(cl-define-keysym #xff28 "Zenkaku") ;to Zenkaku
(cl-define-keysym #xff29 "Hankaku") ;to Hankaku
(cl-define-keysym #xff2a "Zenkaku_Hankaku") ;Zenkaku/Hankaku toggle
(cl-define-keysym #xff2b "Touroku") ;Add to Dictionary
(cl-define-keysym #xff2c "Massyo") ;Delete from Dictionary
(cl-define-keysym #xff2d "Kana_Lock") ;Kana Lock
(cl-define-keysym #xff2e "Kana_Shift") ;Kana Shift
(cl-define-keysym #xff2f "Eisu_Shift") ;Alphanumeric Shift
(cl-define-keysym #xff30 "Eisu_toggle") ;Alphanumeric toggle
(cl-define-keysym #xff37 "Kanji_Bangou") ;Codeinput
(cl-define-keysym #xff3d "Zen_Koho") ;Multiple/All Candidate(s)
(cl-define-keysym #xff3e "Mae_Koho") ;Previous Candidate
(cl-define-keysym #xff50 "Home")
(cl-define-keysym #xff51 "Left") ;Move left, left arrow
(cl-define-keysym #xff52 "Up") ;Move up, up arrow
(cl-define-keysym #xff53 "Right") ;Move right, right arrow
(cl-define-keysym #xff54 "Down") ;Move down, down arrow
(cl-define-keysym #xff55 "Prior") ;Prior, previous
(cl-define-keysym #xff55 "Page_Up")
(cl-define-keysym #xff56 "Next") ;Next
(cl-define-keysym #xff56 "Page_Down")
(cl-define-keysym #xff57 "End") ;EOL
(cl-define-keysym #xff58 "Begin") ;BOL
(cl-define-keysym #xff60 "Select") ;Select, mark
(cl-define-keysym #xff61 "Print")
(cl-define-keysym #xff62 "Execute") ;Execute, run, do
(cl-define-keysym #xff63 "Insert") ;Insert, insert here
(cl-define-keysym #xff65 "Undo")
(cl-define-keysym #xff66 "Redo") ;Redo, again
(cl-define-keysym #xff67 "Menu")
(cl-define-keysym #xff68 "Find") ;Find, search
(cl-define-keysym #xff69 "Cancel") ;Cancel, stop, abort, exit
(cl-define-keysym #xff6a "Help") ;Help
(cl-define-keysym #xff6b "Break")
(cl-define-keysym #xff7e "Mode_switch") ;Character set switch
(cl-define-keysym #xff7e "script_switch") ;Alias for mode_switch
(cl-define-keysym #xff7f "Num_Lock")
(cl-define-keysym #xff80 "KP_Space") ;Space
(cl-define-keysym #xff89 "KP_Tab")
(cl-define-keysym #xff8d "KP_Enter") ;Enter
(cl-define-keysym #xff91 "KP_F1") ;PF1, KP_A, ...
(cl-define-keysym #xff92 "KP_F2")
(cl-define-keysym #xff93 "KP_F3")
(cl-define-keysym #xff94 "KP_F4")
(cl-define-keysym #xff95 "KP_Home")
(cl-define-keysym #xff96 "KP_Left")
(cl-define-keysym #xff97 "KP_Up")
(cl-define-keysym #xff98 "KP_Right")
(cl-define-keysym #xff99 "KP_Down")
(cl-define-keysym #xff9a "KP_Prior")
(cl-define-keysym #xff9a "KP_Page_Up")
(cl-define-keysym #xff9b "KP_Next")
(cl-define-keysym #xff9b "KP_Page_Down")
(cl-define-keysym #xff9c "KP_End")
(cl-define-keysym #xff9d "KP_Begin")
(cl-define-keysym #xff9e "KP_Insert")
(cl-define-keysym #xff9f "KP_Delete")
(cl-define-keysym #xffbd "KP_Equal") ;Equals
(cl-define-keysym #xffaa "KP_Multiply")
(cl-define-keysym #xffab "KP_Add")
(cl-define-keysym #xffac "KP_Separator") ;Separator, often comma
(cl-define-keysym #xffad "KP_Subtract")
(cl-define-keysym #xffae "KP_Decimal")
(cl-define-keysym #xffaf "KP_Divide")
(cl-define-keysym #xffb0 "KP_0")
(cl-define-keysym #xffb1 "KP_1")
(cl-define-keysym #xffb2 "KP_2")
(cl-define-keysym #xffb3 "KP_3")
(cl-define-keysym #xffb4 "KP_4")
(cl-define-keysym #xffb5 "KP_5")
(cl-define-keysym #xffb6 "KP_6")
(cl-define-keysym #xffb7 "KP_7")
(cl-define-keysym #xffb8 "KP_8")
(cl-define-keysym #xffb9 "KP_9")
(cl-define-keysym #xffbe "F1")
(cl-define-keysym #xffbf "F2")
(cl-define-keysym #xffc0 "F3")
(cl-define-keysym #xffc1 "F4")
(cl-define-keysym #xffc2 "F5")
(cl-define-keysym #xffc3 "F6")
(cl-define-keysym #xffc4 "F7")
(cl-define-keysym #xffc5 "F8")
(cl-define-keysym #xffc6 "F9")
(cl-define-keysym #xffc7 "F10")
(cl-define-keysym #xffc8 "F11")
(cl-define-keysym #xffc9 "F12")
(cl-define-keysym #xffca "F13")
(cl-define-keysym #xffcb "F14")
(cl-define-keysym #xffcc "F15")
(cl-define-keysym #xffcd "F16")
(cl-define-keysym #xffce "F17")
(cl-define-keysym #xffcf "F18")
(cl-define-keysym #xffd0 "F19")
(cl-define-keysym #xffd1 "F20")
(cl-define-keysym #xffd2 "F21")
(cl-define-keysym #xffd3 "F22")
(cl-define-keysym #xffd4 "F23")
(cl-define-keysym #xffd5 "F24")
(cl-define-keysym #xffd6 "F25")
(cl-define-keysym #xffd7 "F26")
(cl-define-keysym #xffd8 "F27")
(cl-define-keysym #xffd9 "F28")
(cl-define-keysym #xffda "F29")
(cl-define-keysym #xffdb "F30")
(cl-define-keysym #xffdc "F31")
(cl-define-keysym #xffdd "F32")
(cl-define-keysym #xffde "F33")
(cl-define-keysym #xffdf "F34")
(cl-define-keysym #xffe0 "F35")
(cl-define-keysym #xffe1 "Shift_L") ;Left shift
(cl-define-keysym #xffe2 "Shift_R") ;Right shift
(cl-define-keysym #xffe3 "Control_L") ;Left control
(cl-define-keysym #xffe4 "Control_R") ;Right control
(cl-define-keysym #xffe5 "Caps_Lock") ;Caps lock
(cl-define-keysym #xffe6 "Shift_Lock") ;Shift lock
(cl-define-keysym #xffe7 "Meta_L") ;Left meta
(cl-define-keysym #xffe8 "Meta_R") ;Right meta
(cl-define-keysym #xffe9 "Alt_L") ;Left alt
(cl-define-keysym #xffea "Alt_R") ;Right alt
(cl-define-keysym #xffeb "Super_L") ;Left super
(cl-define-keysym #xffec "Super_R") ;Right super
(cl-define-keysym #xffed "Hyper_L") ;Left hyper
(cl-define-keysym #xffee "Hyper_R") ;Right hyper
(cl-define-keysym #xfe01 "ISO_Lock")
(cl-define-keysym #xfe02 "ISO_Level2_Latch")
(cl-define-keysym #xfe03 "ISO_Level3_Shift")
(cl-define-keysym #xfe04 "ISO_Level3_Latch")
(cl-define-keysym #xfe05 "ISO_Level3_Lock")
(cl-define-keysym #xff7e "ISO_Group_Shift") ;Alias for mode_switch
(cl-define-keysym #xfe06 "ISO_Group_Latch")
(cl-define-keysym #xfe07 "ISO_Group_Lock")
(cl-define-keysym #xfe08 "ISO_Next_Group")
(cl-define-keysym #xfe09 "ISO_Next_Group_Lock")
(cl-define-keysym #xfe0a "ISO_Prev_Group")
(cl-define-keysym #xfe0b "ISO_Prev_Group_Lock")
(cl-define-keysym #xfe0c "ISO_First_Group")
(cl-define-keysym #xfe0d "ISO_First_Group_Lock")
(cl-define-keysym #xfe0e "ISO_Last_Group")
(cl-define-keysym #xfe0f "ISO_Last_Group_Lock")
(cl-define-keysym #xfe20 "ISO_Left_Tab")
(cl-define-keysym #xfe21 "ISO_Move_Line_Up")
(cl-define-keysym #xfe22 "ISO_Move_Line_Down")
(cl-define-keysym #xfe23 "ISO_Partial_Line_Up")
(cl-define-keysym #xfe24 "ISO_Partial_Line_Down")
(cl-define-keysym #xfe25 "ISO_Partial_Space_Left")
(cl-define-keysym #xfe26 "ISO_Partial_Space_Right")
(cl-define-keysym #xfe27 "ISO_Set_Margin_Left")
(cl-define-keysym #xfe28 "ISO_Set_Margin_Right")
(cl-define-keysym #xfe29 "ISO_Release_Margin_Left")
(cl-define-keysym #xfe2a "ISO_Release_Margin_Right")
(cl-define-keysym #xfe2b "ISO_Release_Both_Margins")
(cl-define-keysym #xfe2c "ISO_Fast_Cursor_Left")
(cl-define-keysym #xfe2d "ISO_Fast_Cursor_Right")
(cl-define-keysym #xfe2e "ISO_Fast_Cursor_Up")
(cl-define-keysym #xfe2f "ISO_Fast_Cursor_Down")
(cl-define-keysym #xfe30 "ISO_Continuous_Underline")
(cl-define-keysym #xfe31 "ISO_Discontinuous_Underline")
(cl-define-keysym #xfe32 "ISO_Emphasize")
(cl-define-keysym #xfe33 "ISO_Center_Object")
(cl-define-keysym #xfe34 "ISO_Enter")
(cl-define-keysym #xfe50 "dead_grave")
(cl-define-keysym #xfe51 "dead_acute")
(cl-define-keysym #xfe52 "dead_circumflex")
(cl-define-keysym #xfe53 "dead_tilde")
(cl-define-keysym #xfe54 "dead_macron")
(cl-define-keysym #xfe55 "dead_breve")
(cl-define-keysym #xfe56 "dead_abovedot")
(cl-define-keysym #xfe57 "dead_diaeresis")
(cl-define-keysym #xfe58 "dead_abovering")
(cl-define-keysym #xfe59 "dead_doubleacute")
(cl-define-keysym #xfe5a "dead_caron")
(cl-define-keysym #xfe5b "dead_cedilla")
(cl-define-keysym #xfe5c "dead_ogonek")
(cl-define-keysym #xfe5d "dead_iota")
(cl-define-keysym #xfe5e "dead_voiced_sound")
(cl-define-keysym #xfe5f "dead_semivoiced_sound")
(cl-define-keysym #xfe60 "dead_belowdot")
(cl-define-keysym #xfe61 "dead_hook")
(cl-define-keysym #xfe62 "dead_horn")
(cl-define-keysym #xfed0 "First_Virtual_Screen")
(cl-define-keysym #xfed1 "Prev_Virtual_Screen")
(cl-define-keysym #xfed2 "Next_Virtual_Screen")
(cl-define-keysym #xfed4 "Last_Virtual_Screen")
(cl-define-keysym #xfed5 "Terminate_Server")
(cl-define-keysym #xfe70 "AccessX_Enable")
(cl-define-keysym #xfe71 "AccessX_Feedback_Enable")
(cl-define-keysym #xfe72 "RepeatKeys_Enable")
(cl-define-keysym #xfe73 "SlowKeys_Enable")
(cl-define-keysym #xfe74 "BounceKeys_Enable")
(cl-define-keysym #xfe75 "StickyKeys_Enable")
(cl-define-keysym #xfe76 "MouseKeys_Enable")
(cl-define-keysym #xfe77 "MouseKeys_Accel_Enable")
(cl-define-keysym #xfe78 "Overlay1_Enable")
(cl-define-keysym #xfe79 "Overlay2_Enable")
(cl-define-keysym #xfe7a "AudibleBell_Enable")
(cl-define-keysym #xfee0 "Pointer_Left")
(cl-define-keysym #xfee1 "Pointer_Right")
(cl-define-keysym #xfee2 "Pointer_Up")
(cl-define-keysym #xfee3 "Pointer_Down")
(cl-define-keysym #xfee4 "Pointer_UpLeft")
(cl-define-keysym #xfee5 "Pointer_UpRight")
(cl-define-keysym #xfee6 "Pointer_DownLeft")
(cl-define-keysym #xfee7 "Pointer_DownRight")
(cl-define-keysym #xfee8 "Pointer_Button_Dflt")
(cl-define-keysym #xfee9 "Pointer_Button1")
(cl-define-keysym #xfeea "Pointer_Button2")
(cl-define-keysym #xfeeb "Pointer_Button3")
(cl-define-keysym #xfeec "Pointer_Button4")
(cl-define-keysym #xfeed "Pointer_Button5")
(cl-define-keysym #xfeee "Pointer_DblClick_Dflt")
(cl-define-keysym #xfeef "Pointer_DblClick1")
(cl-define-keysym #xfef0 "Pointer_DblClick2")
(cl-define-keysym #xfef1 "Pointer_DblClick3")
(cl-define-keysym #xfef2 "Pointer_DblClick4")
(cl-define-keysym #xfef3 "Pointer_DblClick5")
(cl-define-keysym #xfef4 "Pointer_Drag_Dflt")
(cl-define-keysym #xfef5 "Pointer_Drag1")
(cl-define-keysym #xfef6 "Pointer_Drag2")
(cl-define-keysym #xfef7 "Pointer_Drag3")
(cl-define-keysym #xfef8 "Pointer_Drag4")
(cl-define-keysym #xfefd "Pointer_Drag5")
(cl-define-keysym #xfef9 "Pointer_EnableKeys")
(cl-define-keysym #xfefa "Pointer_Accelerate")
(cl-define-keysym #xfefb "Pointer_DfltBtnNext")
(cl-define-keysym #xfefc "Pointer_DfltBtnPrev")
(cl-define-keysym #xfd01 "3270_Duplicate")
(cl-define-keysym #xfd02 "3270_FieldMark")
(cl-define-keysym #xfd03 "3270_Right2")
(cl-define-keysym #xfd04 "3270_Left2")
(cl-define-keysym #xfd05 "3270_BackTab")
(cl-define-keysym #xfd06 "3270_EraseEOF")
(cl-define-keysym #xfd07 "3270_EraseInput")
(cl-define-keysym #xfd08 "3270_Reset")
(cl-define-keysym #xfd09 "3270_Quit")
(cl-define-keysym #xfd0a "3270_PA1")
(cl-define-keysym #xfd0b "3270_PA2")
(cl-define-keysym #xfd0c "3270_PA3")
(cl-define-keysym #xfd0d "3270_Test")
(cl-define-keysym #xfd0e "3270_Attn")
(cl-define-keysym #xfd0f "3270_CursorBlink")
(cl-define-keysym #xfd10 "3270_AltCursor")
(cl-define-keysym #xfd11 "3270_KeyClick")
(cl-define-keysym #xfd12 "3270_Jump")
(cl-define-keysym #xfd13 "3270_Ident")
(cl-define-keysym #xfd14 "3270_Rule")
(cl-define-keysym #xfd15 "3270_Copy")
(cl-define-keysym #xfd16 "3270_Play")
(cl-define-keysym #xfd17 "3270_Setup")
(cl-define-keysym #xfd18 "3270_Record")
(cl-define-keysym #xfd19 "3270_ChangeScreen")
(cl-define-keysym #xfd1a "3270_DeleteWord")
(cl-define-keysym #xfd1b "3270_ExSelect")
(cl-define-keysym #xfd1c "3270_CursorSelect")
(cl-define-keysym #xfd1d "3270_PrintScreen")
(cl-define-keysym #xfd1e "3270_Enter")
(cl-define-keysym #x0020 "space") ;U+0020 SPACE
(cl-define-keysym #x0021 "exclam") ;U+0021 EXCLAMATION MARK
(cl-define-keysym #x0022 "quotedbl") ;U+0022 QUOTATION MARK
(cl-define-keysym #x0023 "numbersign") ;U+0023 NUMBER SIGN
(cl-define-keysym #x0024 "dollar") ;U+0024 DOLLAR SIGN
(cl-define-keysym #x0025 "percent") ;U+0025 PERCENT SIGN
(cl-define-keysym #x0026 "ampersand") ;U+0026 AMPERSAND
(cl-define-keysym #x0027 "apostrophe") ;U+0027 APOSTROPHE
(cl-define-keysym #x0027 "quoteright") ;deprecated
(cl-define-keysym #x0028 "parenleft") ;U+0028 LEFT PARENTHESIS
(cl-define-keysym #x0029 "parenright") ;U+0029 RIGHT PARENTHESIS
(cl-define-keysym #x002a "asterisk") ;U+002A ASTERISK
(cl-define-keysym #x002b "plus") ;U+002B PLUS SIGN
(cl-define-keysym #x002c "comma") ;U+002C COMMA
(cl-define-keysym #x002d "minus") ;U+002D HYPHEN-MINUS
(cl-define-keysym #x002e "period") ;U+002E FULL STOP
(cl-define-keysym #x002f "slash") ;U+002F SOLIDUS
(cl-define-keysym #x0030 "0") ;U+0030 DIGIT ZERO
(cl-define-keysym #x0031 "1") ;U+0031 DIGIT ONE
(cl-define-keysym #x0032 "2") ;U+0032 DIGIT TWO
(cl-define-keysym #x0033 "3") ;U+0033 DIGIT THREE
(cl-define-keysym #x0034 "4") ;U+0034 DIGIT FOUR
(cl-define-keysym #x0035 "5") ;U+0035 DIGIT FIVE
(cl-define-keysym #x0036 "6") ;U+0036 DIGIT SIX
(cl-define-keysym #x0037 "7") ;U+0037 DIGIT SEVEN
(cl-define-keysym #x0038 "8") ;U+0038 DIGIT EIGHT
(cl-define-keysym #x0039 "9") ;U+0039 DIGIT NINE
(cl-define-keysym #x003a "colon") ;U+003A COLON
(cl-define-keysym #x003b "semicolon") ;U+003B SEMICOLON
(cl-define-keysym #x003c "less") ;U+003C LESS-THAN SIGN
(cl-define-keysym #x003d "equal") ;U+003D EQUALS SIGN
(cl-define-keysym #x003e "greater") ;U+003E GREATER-THAN SIGN
(cl-define-keysym #x003f "question") ;U+003F QUESTION MARK
(cl-define-keysym #x0040 "at") ;U+0040 COMMERCIAL AT
(cl-define-keysym #x0041 "A") ;U+0041 LATIN CAPITAL LETTER A
(cl-define-keysym #x0042 "B") ;U+0042 LATIN CAPITAL LETTER B
(cl-define-keysym #x0043 "C") ;U+0043 LATIN CAPITAL LETTER C
(cl-define-keysym #x0044 "D") ;U+0044 LATIN CAPITAL LETTER D
(cl-define-keysym #x0045 "E") ;U+0045 LATIN CAPITAL LETTER E
(cl-define-keysym #x0046 "F") ;U+0046 LATIN CAPITAL LETTER F
(cl-define-keysym #x0047 "G") ;U+0047 LATIN CAPITAL LETTER G
(cl-define-keysym #x0048 "H") ;U+0048 LATIN CAPITAL LETTER H
(cl-define-keysym #x0049 "I") ;U+0049 LATIN CAPITAL LETTER I
(cl-define-keysym #x004a "J") ;U+004A LATIN CAPITAL LETTER J
(cl-define-keysym #x004b "K") ;U+004B LATIN CAPITAL LETTER K
(cl-define-keysym #x004c "L") ;U+004C LATIN CAPITAL LETTER L
(cl-define-keysym #x004d "M") ;U+004D LATIN CAPITAL LETTER M
(cl-define-keysym #x004e "N") ;U+004E LATIN CAPITAL LETTER N
(cl-define-keysym #x004f "O") ;U+004F LATIN CAPITAL LETTER O
(cl-define-keysym #x0050 "P") ;U+0050 LATIN CAPITAL LETTER P
(cl-define-keysym #x0051 "Q") ;U+0051 LATIN CAPITAL LETTER Q
(cl-define-keysym #x0052 "R") ;U+0052 LATIN CAPITAL LETTER R
(cl-define-keysym #x0053 "S") ;U+0053 LATIN CAPITAL LETTER S
(cl-define-keysym #x0054 "T") ;U+0054 LATIN CAPITAL LETTER T
(cl-define-keysym #x0055 "U") ;U+0055 LATIN CAPITAL LETTER U
(cl-define-keysym #x0056 "V") ;U+0056 LATIN CAPITAL LETTER V
(cl-define-keysym #x0057 "W") ;U+0057 LATIN CAPITAL LETTER W
(cl-define-keysym #x0058 "X") ;U+0058 LATIN CAPITAL LETTER X
(cl-define-keysym #x0059 "Y") ;U+0059 LATIN CAPITAL LETTER Y
(cl-define-keysym #x005a "Z") ;U+005A LATIN CAPITAL LETTER Z
(cl-define-keysym #x005b "bracketleft") ;U+005B LEFT SQUARE BRACKET
(cl-define-keysym #x005c "backslash") ;U+005C REVERSE SOLIDUS
(cl-define-keysym #x005d "bracketright") ;U+005D RIGHT SQUARE BRACKET
(cl-define-keysym #x005e "asciicircum") ;U+005E CIRCUMFLEX ACCENT
(cl-define-keysym #x005f "underscore") ;U+005F LOW LINE
(cl-define-keysym #x0060 "grave") ;U+0060 GRAVE ACCENT
(cl-define-keysym #x0060 "quoteleft") ;deprecated
(cl-define-keysym #x0061 "a") ;U+0061 LATIN SMALL LETTER A
(cl-define-keysym #x0062 "b") ;U+0062 LATIN SMALL LETTER B
(cl-define-keysym #x0063 "c") ;U+0063 LATIN SMALL LETTER C
(cl-define-keysym #x0064 "d") ;U+0064 LATIN SMALL LETTER D
(cl-define-keysym #x0065 "e") ;U+0065 LATIN SMALL LETTER E
(cl-define-keysym #x0066 "f") ;U+0066 LATIN SMALL LETTER F
(cl-define-keysym #x0067 "g") ;U+0067 LATIN SMALL LETTER G
(cl-define-keysym #x0068 "h") ;U+0068 LATIN SMALL LETTER H
(cl-define-keysym #x0069 "i") ;U+0069 LATIN SMALL LETTER I
(cl-define-keysym #x006a "j") ;U+006A LATIN SMALL LETTER J
(cl-define-keysym #x006b "k") ;U+006B LATIN SMALL LETTER K
(cl-define-keysym #x006c "l") ;U+006C LATIN SMALL LETTER L
(cl-define-keysym #x006d "m") ;U+006D LATIN SMALL LETTER M
(cl-define-keysym #x006e "n") ;U+006E LATIN SMALL LETTER N
(cl-define-keysym #x006f "o") ;U+006F LATIN SMALL LETTER O
(cl-define-keysym #x0070 "p") ;U+0070 LATIN SMALL LETTER P
(cl-define-keysym #x0071 "q") ;U+0071 LATIN SMALL LETTER Q
(cl-define-keysym #x0072 "r") ;U+0072 LATIN SMALL LETTER R
(cl-define-keysym #x0073 "s") ;U+0073 LATIN SMALL LETTER S
(cl-define-keysym #x0074 "t") ;U+0074 LATIN SMALL LETTER T
(cl-define-keysym #x0075 "u") ;U+0075 LATIN SMALL LETTER U
(cl-define-keysym #x0076 "v") ;U+0076 LATIN SMALL LETTER V
(cl-define-keysym #x0077 "w") ;U+0077 LATIN SMALL LETTER W
(cl-define-keysym #x0078 "x") ;U+0078 LATIN SMALL LETTER X
(cl-define-keysym #x0079 "y") ;U+0079 LATIN SMALL LETTER Y
(cl-define-keysym #x007a "z") ;U+007A LATIN SMALL LETTER Z
(cl-define-keysym #x007b "braceleft") ;U+007B LEFT CURLY BRACKET
(cl-define-keysym #x007c "bar") ;U+007C VERTICAL LINE
(cl-define-keysym #x007d "braceright") ;U+007D RIGHT CURLY BRACKET
(cl-define-keysym #x007e "asciitilde") ;U+007E TILDE
(cl-define-keysym #x00a0 "nobreakspace") ;U+00A0 NO-BREAK SPACE
(cl-define-keysym #x00a1 "exclamdown") ;U+00A1 INVERTED EXCLAMATION MARK
(cl-define-keysym #x00a2 "cent") ;U+00A2 CENT SIGN
(cl-define-keysym #x00a3 "sterling") ;U+00A3 POUND SIGN
(cl-define-keysym #x00a4 "currency") ;U+00A4 CURRENCY SIGN
(cl-define-keysym #x00a5 "yen") ;U+00A5 YEN SIGN
(cl-define-keysym #x00a6 "brokenbar") ;U+00A6 BROKEN BAR
(cl-define-keysym #x00a7 "section") ;U+00A7 SECTION SIGN
(cl-define-keysym #x00a8 "diaeresis") ;U+00A8 DIAERESIS
(cl-define-keysym #x00a9 "copyright") ;U+00A9 COPYRIGHT SIGN
(cl-define-keysym #x00aa "ordfeminine") ;U+00AA FEMININE ORDINAL INDICATOR
(cl-define-keysym #x00ab "guillemotleft") ;U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
(cl-define-keysym #x00ac "notsign") ;U+00AC NOT SIGN
(cl-define-keysym #x00ad "hyphen") ;U+00AD SOFT HYPHEN
(cl-define-keysym #x00ae "registered") ;U+00AE REGISTERED SIGN
(cl-define-keysym #x00af "macron") ;U+00AF MACRON
(cl-define-keysym #x00b0 "degree") ;U+00B0 DEGREE SIGN
(cl-define-keysym #x00b1 "plusminus") ;U+00B1 PLUS-MINUS SIGN
(cl-define-keysym #x00b2 "twosuperior") ;U+00B2 SUPERSCRIPT TWO
(cl-define-keysym #x00b3 "threesuperior") ;U+00B3 SUPERSCRIPT THREE
(cl-define-keysym #x00b4 "acute") ;U+00B4 ACUTE ACCENT
(cl-define-keysym #x00b5 "mu") ;U+00B5 MICRO SIGN
(cl-define-keysym #x00b6 "paragraph") ;U+00B6 PILCROW SIGN
(cl-define-keysym #x00b7 "periodcentered") ;U+00B7 MIDDLE DOT
(cl-define-keysym #x00b8 "cedilla") ;U+00B8 CEDILLA
(cl-define-keysym #x00b9 "onesuperior") ;U+00B9 SUPERSCRIPT ONE
(cl-define-keysym #x00ba "masculine") ;U+00BA MASCULINE ORDINAL INDICATOR
(cl-define-keysym #x00bb "guillemotright") ;U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
(cl-define-keysym #x00bc "onequarter") ;U+00BC VULGAR FRACTION ONE QUARTER
(cl-define-keysym #x00bd "onehalf") ;U+00BD VULGAR FRACTION ONE HALF
(cl-define-keysym #x00be "threequarters") ;U+00BE VULGAR FRACTION THREE QUARTERS
(cl-define-keysym #x00bf "questiondown") ;U+00BF INVERTED QUESTION MARK
(cl-define-keysym #x00c0 "Agrave") ;U+00C0 LATIN CAPITAL LETTER A WITH GRAVE
(cl-define-keysym #x00c1 "Aacute") ;U+00C1 LATIN CAPITAL LETTER A WITH ACUTE
(cl-define-keysym #x00c2 "Acircumflex") ;U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
(cl-define-keysym #x00c3 "Atilde") ;U+00C3 LATIN CAPITAL LETTER A WITH TILDE
(cl-define-keysym #x00c4 "Adiaeresis") ;U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
(cl-define-keysym #x00c5 "Aring") ;U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE
(cl-define-keysym #x00c6 "AE") ;U+00C6 LATIN CAPITAL LETTER AE
(cl-define-keysym #x00c7 "Ccedilla") ;U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA
(cl-define-keysym #x00c8 "Egrave") ;U+00C8 LATIN CAPITAL LETTER E WITH GRAVE
(cl-define-keysym #x00c9 "Eacute") ;U+00C9 LATIN CAPITAL LETTER E WITH ACUTE
(cl-define-keysym #x00ca "Ecircumflex") ;U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX
(cl-define-keysym #x00cb "Ediaeresis") ;U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS
(cl-define-keysym #x00cc "Igrave") ;U+00CC LATIN CAPITAL LETTER I WITH GRAVE
(cl-define-keysym #x00cd "Iacute") ;U+00CD LATIN CAPITAL LETTER I WITH ACUTE
(cl-define-keysym #x00ce "Icircumflex") ;U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX
(cl-define-keysym #x00cf "Idiaeresis") ;U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS
(cl-define-keysym #x00d0 "ETH") ;U+00D0 LATIN CAPITAL LETTER ETH
(cl-define-keysym #x00d0 "Eth") ;deprecated
(cl-define-keysym #x00d1 "Ntilde") ;U+00D1 LATIN CAPITAL LETTER N WITH TILDE
(cl-define-keysym #x00d2 "Ograve") ;U+00D2 LATIN CAPITAL LETTER O WITH GRAVE
(cl-define-keysym #x00d3 "Oacute") ;U+00D3 LATIN CAPITAL LETTER O WITH ACUTE
(cl-define-keysym #x00d4 "Ocircumflex") ;U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
(cl-define-keysym #x00d5 "Otilde") ;U+00D5 LATIN CAPITAL LETTER O WITH TILDE
(cl-define-keysym #x00d6 "Odiaeresis") ;U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS
(cl-define-keysym #x00d7 "multiply") ;U+00D7 MULTIPLICATION SIGN
(cl-define-keysym #x00d8 "Oslash") ;U+00D8 LATIN CAPITAL LETTER O WITH STROKE
(cl-define-keysym #x00d8 "Ooblique") ;U+00D8 LATIN CAPITAL LETTER O WITH STROKE
(cl-define-keysym #x00d9 "Ugrave") ;U+00D9 LATIN CAPITAL LETTER U WITH GRAVE
(cl-define-keysym #x00da "Uacute") ;U+00DA LATIN CAPITAL LETTER U WITH ACUTE
(cl-define-keysym #x00db "Ucircumflex") ;U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX
(cl-define-keysym #x00dc "Udiaeresis") ;U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS
(cl-define-keysym #x00dd "Yacute") ;U+00DD LATIN CAPITAL LETTER Y WITH ACUTE
(cl-define-keysym #x00de "THORN") ;U+00DE LATIN CAPITAL LETTER THORN
(cl-define-keysym #x00de "Thorn") ;deprecated
(cl-define-keysym #x00df "ssharp") ;U+00DF LATIN SMALL LETTER SHARP S
(cl-define-keysym #x00e0 "agrave") ;U+00E0 LATIN SMALL LETTER A WITH GRAVE
(cl-define-keysym #x00e1 "aacute") ;U+00E1 LATIN SMALL LETTER A WITH ACUTE
(cl-define-keysym #x00e2 "acircumflex") ;U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX
(cl-define-keysym #x00e3 "atilde") ;U+00E3 LATIN SMALL LETTER A WITH TILDE
(cl-define-keysym #x00e4 "adiaeresis") ;U+00E4 LATIN SMALL LETTER A WITH DIAERESIS
(cl-define-keysym #x00e5 "aring") ;U+00E5 LATIN SMALL LETTER A WITH RING ABOVE
(cl-define-keysym #x00e6 "ae") ;U+00E6 LATIN SMALL LETTER AE
(cl-define-keysym #x00e7 "ccedilla") ;U+00E7 LATIN SMALL LETTER C WITH CEDILLA
(cl-define-keysym #x00e8 "egrave") ;U+00E8 LATIN SMALL LETTER E WITH GRAVE
(cl-define-keysym #x00e9 "eacute") ;U+00E9 LATIN SMALL LETTER E WITH ACUTE
(cl-define-keysym #x00ea "ecircumflex") ;U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX
(cl-define-keysym #x00eb "ediaeresis") ;U+00EB LATIN SMALL LETTER E WITH DIAERESIS
(cl-define-keysym #x00ec "igrave") ;U+00EC LATIN SMALL LETTER I WITH GRAVE
(cl-define-keysym #x00ed "iacute") ;U+00ED LATIN SMALL LETTER I WITH ACUTE
(cl-define-keysym #x00ee "icircumflex") ;U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX
(cl-define-keysym #x00ef "idiaeresis") ;U+00EF LATIN SMALL LETTER I WITH DIAERESIS
(cl-define-keysym #x00f0 "eth") ;U+00F0 LATIN SMALL LETTER ETH
(cl-define-keysym #x00f1 "ntilde") ;U+00F1 LATIN SMALL LETTER N WITH TILDE
(cl-define-keysym #x00f2 "ograve") ;U+00F2 LATIN SMALL LETTER O WITH GRAVE
(cl-define-keysym #x00f3 "oacute") ;U+00F3 LATIN SMALL LETTER O WITH ACUTE
(cl-define-keysym #x00f4 "ocircumflex") ;U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX
(cl-define-keysym #x00f5 "otilde") ;U+00F5 LATIN SMALL LETTER O WITH TILDE
(cl-define-keysym #x00f6 "odiaeresis") ;U+00F6 LATIN SMALL LETTER O WITH DIAERESIS
(cl-define-keysym #x00f7 "division") ;U+00F7 DIVISION SIGN
(cl-define-keysym #x00f8 "oslash") ;U+00F8 LATIN SMALL LETTER O WITH STROKE
(cl-define-keysym #x00f8 "ooblique") ;U+00F8 LATIN SMALL LETTER O WITH STROKE
(cl-define-keysym #x00f9 "ugrave") ;U+00F9 LATIN SMALL LETTER U WITH GRAVE
(cl-define-keysym #x00fa "uacute") ;U+00FA LATIN SMALL LETTER U WITH ACUTE
(cl-define-keysym #x00fb "ucircumflex") ;U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX
(cl-define-keysym #x00fc "udiaeresis") ;U+00FC LATIN SMALL LETTER U WITH DIAERESIS
(cl-define-keysym #x00fd "yacute") ;U+00FD LATIN SMALL LETTER Y WITH ACUTE
(cl-define-keysym #x00fe "thorn") ;U+00FE LATIN SMALL LETTER THORN
(cl-define-keysym #x00ff "ydiaeresis") ;U+00FF LATIN SMALL LETTER Y WITH DIAERESIS
(cl-define-keysym #x01a1 "Aogonek") ;U+0104 LATIN CAPITAL LETTER A WITH OGONEK
(cl-define-keysym #x01a2 "breve") ;U+02D8 BREVE
(cl-define-keysym #x01a3 "Lstroke") ;U+0141 LATIN CAPITAL LETTER L WITH STROKE
(cl-define-keysym #x01a5 "Lcaron") ;U+013D LATIN CAPITAL LETTER L WITH CARON
(cl-define-keysym #x01a6 "Sacute") ;U+015A LATIN CAPITAL LETTER S WITH ACUTE
(cl-define-keysym #x01a9 "Scaron") ;U+0160 LATIN CAPITAL LETTER S WITH CARON
(cl-define-keysym #x01aa "Scedilla") ;U+015E LATIN CAPITAL LETTER S WITH CEDILLA
(cl-define-keysym #x01ab "Tcaron") ;U+0164 LATIN CAPITAL LETTER T WITH CARON
(cl-define-keysym #x01ac "Zacute") ;U+0179 LATIN CAPITAL LETTER Z WITH ACUTE
(cl-define-keysym #x01ae "Zcaron") ;U+017D LATIN CAPITAL LETTER Z WITH CARON
(cl-define-keysym #x01af "Zabovedot") ;U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE
(cl-define-keysym #x01b1 "aogonek") ;U+0105 LATIN SMALL LETTER A WITH OGONEK
(cl-define-keysym #x01b2 "ogonek") ;U+02DB OGONEK
(cl-define-keysym #x01b3 "lstroke") ;U+0142 LATIN SMALL LETTER L WITH STROKE
(cl-define-keysym #x01b5 "lcaron") ;U+013E LATIN SMALL LETTER L WITH CARON
(cl-define-keysym #x01b6 "sacute") ;U+015B LATIN SMALL LETTER S WITH ACUTE
(cl-define-keysym #x01b7 "caron") ;U+02C7 CARON
(cl-define-keysym #x01b9 "scaron") ;U+0161 LATIN SMALL LETTER S WITH CARON
(cl-define-keysym #x01ba "scedilla") ;U+015F LATIN SMALL LETTER S WITH CEDILLA
(cl-define-keysym #x01bb "tcaron") ;U+0165 LATIN SMALL LETTER T WITH CARON
(cl-define-keysym #x01bc "zacute") ;U+017A LATIN SMALL LETTER Z WITH ACUTE
(cl-define-keysym #x01bd "doubleacute") ;U+02DD DOUBLE ACUTE ACCENT
(cl-define-keysym #x01be "zcaron") ;U+017E LATIN SMALL LETTER Z WITH CARON
(cl-define-keysym #x01bf "zabovedot") ;U+017C LATIN SMALL LETTER Z WITH DOT ABOVE
(cl-define-keysym #x01c0 "Racute") ;U+0154 LATIN CAPITAL LETTER R WITH ACUTE
(cl-define-keysym #x01c3 "Abreve") ;U+0102 LATIN CAPITAL LETTER A WITH BREVE
(cl-define-keysym #x01c5 "Lacute") ;U+0139 LATIN CAPITAL LETTER L WITH ACUTE
(cl-define-keysym #x01c6 "Cacute") ;U+0106 LATIN CAPITAL LETTER C WITH ACUTE
(cl-define-keysym #x01c8 "Ccaron") ;U+010C LATIN CAPITAL LETTER C WITH CARON
(cl-define-keysym #x01ca "Eogonek") ;U+0118 LATIN CAPITAL LETTER E WITH OGONEK
(cl-define-keysym #x01cc "Ecaron") ;U+011A LATIN CAPITAL LETTER E WITH CARON
(cl-define-keysym #x01cf "Dcaron") ;U+010E LATIN CAPITAL LETTER D WITH CARON
(cl-define-keysym #x01d0 "Dstroke") ;U+0110 LATIN CAPITAL LETTER D WITH STROKE
(cl-define-keysym #x01d1 "Nacute") ;U+0143 LATIN CAPITAL LETTER N WITH ACUTE
(cl-define-keysym #x01d2 "Ncaron") ;U+0147 LATIN CAPITAL LETTER N WITH CARON
(cl-define-keysym #x01d5 "Odoubleacute") ;U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
(cl-define-keysym #x01d8 "Rcaron") ;U+0158 LATIN CAPITAL LETTER R WITH CARON
(cl-define-keysym #x01d9 "Uring") ;U+016E LATIN CAPITAL LETTER U WITH RING ABOVE
(cl-define-keysym #x01db "Udoubleacute") ;U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
(cl-define-keysym #x01de "Tcedilla") ;U+0162 LATIN CAPITAL LETTER T WITH CEDILLA
(cl-define-keysym #x01e0 "racute") ;U+0155 LATIN SMALL LETTER R WITH ACUTE
(cl-define-keysym #x01e3 "abreve") ;U+0103 LATIN SMALL LETTER A WITH BREVE
(cl-define-keysym #x01e5 "lacute") ;U+013A LATIN SMALL LETTER L WITH ACUTE
(cl-define-keysym #x01e6 "cacute") ;U+0107 LATIN SMALL LETTER C WITH ACUTE
(cl-define-keysym #x01e8 "ccaron") ;U+010D LATIN SMALL LETTER C WITH CARON
(cl-define-keysym #x01ea "eogonek") ;U+0119 LATIN SMALL LETTER E WITH OGONEK
(cl-define-keysym #x01ec "ecaron") ;U+011B LATIN SMALL LETTER E WITH CARON
(cl-define-keysym #x01ef "dcaron") ;U+010F LATIN SMALL LETTER D WITH CARON
(cl-define-keysym #x01f0 "dstroke") ;U+0111 LATIN SMALL LETTER D WITH STROKE
(cl-define-keysym #x01f1 "nacute") ;U+0144 LATIN SMALL LETTER N WITH ACUTE
(cl-define-keysym #x01f2 "ncaron") ;U+0148 LATIN SMALL LETTER N WITH CARON
(cl-define-keysym #x01f5 "odoubleacute") ;U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE
(cl-define-keysym #x01fb "udoubleacute") ;U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE
(cl-define-keysym #x01f8 "rcaron") ;U+0159 LATIN SMALL LETTER R WITH CARON
(cl-define-keysym #x01f9 "uring") ;U+016F LATIN SMALL LETTER U WITH RING ABOVE
(cl-define-keysym #x01fe "tcedilla") ;U+0163 LATIN SMALL LETTER T WITH CEDILLA
(cl-define-keysym #x01ff "abovedot") ;U+02D9 DOT ABOVE
(cl-define-keysym #x02a1 "Hstroke") ;U+0126 LATIN CAPITAL LETTER H WITH STROKE
(cl-define-keysym #x02a6 "Hcircumflex") ;U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX
(cl-define-keysym #x02a9 "Iabovedot") ;U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE
(cl-define-keysym #x02ab "Gbreve") ;U+011E LATIN CAPITAL LETTER G WITH BREVE
(cl-define-keysym #x02ac "Jcircumflex") ;U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX
(cl-define-keysym #x02b1 "hstroke") ;U+0127 LATIN SMALL LETTER H WITH STROKE
(cl-define-keysym #x02b6 "hcircumflex") ;U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX
(cl-define-keysym #x02b9 "idotless") ;U+0131 LATIN SMALL LETTER DOTLESS I
(cl-define-keysym #x02bb "gbreve") ;U+011F LATIN SMALL LETTER G WITH BREVE
(cl-define-keysym #x02bc "jcircumflex") ;U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX
(cl-define-keysym #x02c5 "Cabovedot") ;U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE
(cl-define-keysym #x02c6 "Ccircumflex") ;U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX
(cl-define-keysym #x02d5 "Gabovedot") ;U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE
(cl-define-keysym #x02d8 "Gcircumflex") ;U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX
(cl-define-keysym #x02dd "Ubreve") ;U+016C LATIN CAPITAL LETTER U WITH BREVE
(cl-define-keysym #x02de "Scircumflex") ;U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX
(cl-define-keysym #x02e5 "cabovedot") ;U+010B LATIN SMALL LETTER C WITH DOT ABOVE
(cl-define-keysym #x02e6 "ccircumflex") ;U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX
(cl-define-keysym #x02f5 "gabovedot") ;U+0121 LATIN SMALL LETTER G WITH DOT ABOVE
(cl-define-keysym #x02f8 "gcircumflex") ;U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX
(cl-define-keysym #x02fd "ubreve") ;U+016D LATIN SMALL LETTER U WITH BREVE
(cl-define-keysym #x02fe "scircumflex") ;U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX
(cl-define-keysym #x03a2 "kra") ;U+0138 LATIN SMALL LETTER KRA
(cl-define-keysym #x03a2 "kappa") ;deprecated
(cl-define-keysym #x03a3 "Rcedilla") ;U+0156 LATIN CAPITAL LETTER R WITH CEDILLA
(cl-define-keysym #x03a5 "Itilde") ;U+0128 LATIN CAPITAL LETTER I WITH TILDE
(cl-define-keysym #x03a6 "Lcedilla") ;U+013B LATIN CAPITAL LETTER L WITH CEDILLA
(cl-define-keysym #x03aa "Emacron") ;U+0112 LATIN CAPITAL LETTER E WITH MACRON
(cl-define-keysym #x03ab "Gcedilla") ;U+0122 LATIN CAPITAL LETTER G WITH CEDILLA
(cl-define-keysym #x03ac "Tslash") ;U+0166 LATIN CAPITAL LETTER T WITH STROKE
(cl-define-keysym #x03b3 "rcedilla") ;U+0157 LATIN SMALL LETTER R WITH CEDILLA
(cl-define-keysym #x03b5 "itilde") ;U+0129 LATIN SMALL LETTER I WITH TILDE
(cl-define-keysym #x03b6 "lcedilla") ;U+013C LATIN SMALL LETTER L WITH CEDILLA
(cl-define-keysym #x03ba "emacron") ;U+0113 LATIN SMALL LETTER E WITH MACRON
(cl-define-keysym #x03bb "gcedilla") ;U+0123 LATIN SMALL LETTER G WITH CEDILLA
(cl-define-keysym #x03bc "tslash") ;U+0167 LATIN SMALL LETTER T WITH STROKE
(cl-define-keysym #x03bd "ENG") ;U+014A LATIN CAPITAL LETTER ENG
(cl-define-keysym #x03bf "eng") ;U+014B LATIN SMALL LETTER ENG
(cl-define-keysym #x03c0 "Amacron") ;U+0100 LATIN CAPITAL LETTER A WITH MACRON
(cl-define-keysym #x03c7 "Iogonek") ;U+012E LATIN CAPITAL LETTER I WITH OGONEK
(cl-define-keysym #x03cc "Eabovedot") ;U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE
(cl-define-keysym #x03cf "Imacron") ;U+012A LATIN CAPITAL LETTER I WITH MACRON
(cl-define-keysym #x03d1 "Ncedilla") ;U+0145 LATIN CAPITAL LETTER N WITH CEDILLA
(cl-define-keysym #x03d2 "Omacron") ;U+014C LATIN CAPITAL LETTER O WITH MACRON
(cl-define-keysym #x03d3 "Kcedilla") ;U+0136 LATIN CAPITAL LETTER K WITH CEDILLA
(cl-define-keysym #x03d9 "Uogonek") ;U+0172 LATIN CAPITAL LETTER U WITH OGONEK
(cl-define-keysym #x03dd "Utilde") ;U+0168 LATIN CAPITAL LETTER U WITH TILDE
(cl-define-keysym #x03de "Umacron") ;U+016A LATIN CAPITAL LETTER U WITH MACRON
(cl-define-keysym #x03e0 "amacron") ;U+0101 LATIN SMALL LETTER A WITH MACRON
(cl-define-keysym #x03e7 "iogonek") ;U+012F LATIN SMALL LETTER I WITH OGONEK
(cl-define-keysym #x03ec "eabovedot") ;U+0117 LATIN SMALL LETTER E WITH DOT ABOVE
(cl-define-keysym #x03ef "imacron") ;U+012B LATIN SMALL LETTER I WITH MACRON
(cl-define-keysym #x03f1 "ncedilla") ;U+0146 LATIN SMALL LETTER N WITH CEDILLA
(cl-define-keysym #x03f2 "omacron") ;U+014D LATIN SMALL LETTER O WITH MACRON
(cl-define-keysym #x03f3 "kcedilla") ;U+0137 LATIN SMALL LETTER K WITH CEDILLA
(cl-define-keysym #x03f9 "uogonek") ;U+0173 LATIN SMALL LETTER U WITH OGONEK
(cl-define-keysym #x03fd "utilde") ;U+0169 LATIN SMALL LETTER U WITH TILDE
(cl-define-keysym #x03fe "umacron") ;U+016B LATIN SMALL LETTER U WITH MACRON
(cl-define-keysym #x1001e02 "Babovedot") ;U+1E02 LATIN CAPITAL LETTER B WITH DOT ABOVE
(cl-define-keysym #x1001e03 "babovedot") ;U+1E03 LATIN SMALL LETTER B WITH DOT ABOVE
(cl-define-keysym #x1001e0a "Dabovedot") ;U+1E0A LATIN CAPITAL LETTER D WITH DOT ABOVE
(cl-define-keysym #x1001e80 "Wgrave") ;U+1E80 LATIN CAPITAL LETTER W WITH GRAVE
(cl-define-keysym #x1001e82 "Wacute") ;U+1E82 LATIN CAPITAL LETTER W WITH ACUTE
(cl-define-keysym #x1001e0b "dabovedot") ;U+1E0B LATIN SMALL LETTER D WITH DOT ABOVE
(cl-define-keysym #x1001ef2 "Ygrave") ;U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE
(cl-define-keysym #x1001e1e "Fabovedot") ;U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE
(cl-define-keysym #x1001e1f "fabovedot") ;U+1E1F LATIN SMALL LETTER F WITH DOT ABOVE
(cl-define-keysym #x1001e40 "Mabovedot") ;U+1E40 LATIN CAPITAL LETTER M WITH DOT ABOVE
(cl-define-keysym #x1001e41 "mabovedot") ;U+1E41 LATIN SMALL LETTER M WITH DOT ABOVE
(cl-define-keysym #x1001e56 "Pabovedot") ;U+1E56 LATIN CAPITAL LETTER P WITH DOT ABOVE
(cl-define-keysym #x1001e81 "wgrave") ;U+1E81 LATIN SMALL LETTER W WITH GRAVE
(cl-define-keysym #x1001e57 "pabovedot") ;U+1E57 LATIN SMALL LETTER P WITH DOT ABOVE
(cl-define-keysym #x1001e83 "wacute") ;U+1E83 LATIN SMALL LETTER W WITH ACUTE
(cl-define-keysym #x1001e60 "Sabovedot") ;U+1E60 LATIN CAPITAL LETTER S WITH DOT ABOVE
(cl-define-keysym #x1001ef3 "ygrave") ;U+1EF3 LATIN SMALL LETTER Y WITH GRAVE
(cl-define-keysym #x1001e84 "Wdiaeresis") ;U+1E84 LATIN CAPITAL LETTER W WITH DIAERESIS
(cl-define-keysym #x1001e85 "wdiaeresis") ;U+1E85 LATIN SMALL LETTER W WITH DIAERESIS
(cl-define-keysym #x1001e61 "sabovedot") ;U+1E61 LATIN SMALL LETTER S WITH DOT ABOVE
(cl-define-keysym #x1000174 "Wcircumflex") ;U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX
(cl-define-keysym #x1001e6a "Tabovedot") ;U+1E6A LATIN CAPITAL LETTER T WITH DOT ABOVE
(cl-define-keysym #x1000176 "Ycircumflex") ;U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX
(cl-define-keysym #x1000175 "wcircumflex") ;U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX
(cl-define-keysym #x1001e6b "tabovedot") ;U+1E6B LATIN SMALL LETTER T WITH DOT ABOVE
(cl-define-keysym #x1000177 "ycircumflex") ;U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX
(cl-define-keysym #x13bc "OE") ;U+0152 LATIN CAPITAL LIGATURE OE
(cl-define-keysym #x13bd "oe") ;U+0153 LATIN SMALL LIGATURE OE
(cl-define-keysym #x13be "Ydiaeresis") ;U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS
(cl-define-keysym #x047e "overline") ;U+203E OVERLINE
(cl-define-keysym #x04a1 "kana_fullstop") ;U+3002 IDEOGRAPHIC FULL STOP
(cl-define-keysym #x04a2 "kana_openingbracket") ;U+300C LEFT CORNER BRACKET
(cl-define-keysym #x04a3 "kana_closingbracket") ;U+300D RIGHT CORNER BRACKET
(cl-define-keysym #x04a4 "kana_comma") ;U+3001 IDEOGRAPHIC COMMA
(cl-define-keysym #x04a5 "kana_conjunctive") ;U+30FB KATAKANA MIDDLE DOT
(cl-define-keysym #x04a5 "kana_middledot") ;deprecated
(cl-define-keysym #x04a6 "kana_WO") ;U+30F2 KATAKANA LETTER WO
(cl-define-keysym #x04a7 "kana_a") ;U+30A1 KATAKANA LETTER SMALL A
(cl-define-keysym #x04a8 "kana_i") ;U+30A3 KATAKANA LETTER SMALL I
(cl-define-keysym #x04a9 "kana_u") ;U+30A5 KATAKANA LETTER SMALL U
(cl-define-keysym #x04aa "kana_e") ;U+30A7 KATAKANA LETTER SMALL E
(cl-define-keysym #x04ab "kana_o") ;U+30A9 KATAKANA LETTER SMALL O
(cl-define-keysym #x04ac "kana_ya") ;U+30E3 KATAKANA LETTER SMALL YA
(cl-define-keysym #x04ad "kana_yu") ;U+30E5 KATAKANA LETTER SMALL YU
(cl-define-keysym #x04ae "kana_yo") ;U+30E7 KATAKANA LETTER SMALL YO
(cl-define-keysym #x04af "kana_tsu") ;U+30C3 KATAKANA LETTER SMALL TU
(cl-define-keysym #x04af "kana_tu") ;deprecated
(cl-define-keysym #x04b0 "prolongedsound") ;U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK
(cl-define-keysym #x04b1 "kana_A") ;U+30A2 KATAKANA LETTER A
(cl-define-keysym #x04b2 "kana_I") ;U+30A4 KATAKANA LETTER I
(cl-define-keysym #x04b3 "kana_U") ;U+30A6 KATAKANA LETTER U
(cl-define-keysym #x04b4 "kana_E") ;U+30A8 KATAKANA LETTER E
(cl-define-keysym #x04b5 "kana_O") ;U+30AA KATAKANA LETTER O
(cl-define-keysym #x04b6 "kana_KA") ;U+30AB KATAKANA LETTER KA
(cl-define-keysym #x04b7 "kana_KI") ;U+30AD KATAKANA LETTER KI
(cl-define-keysym #x04b8 "kana_KU") ;U+30AF KATAKANA LETTER KU
(cl-define-keysym #x04b9 "kana_KE") ;U+30B1 KATAKANA LETTER KE
(cl-define-keysym #x04ba "kana_KO") ;U+30B3 KATAKANA LETTER KO
(cl-define-keysym #x04bb "kana_SA") ;U+30B5 KATAKANA LETTER SA
(cl-define-keysym #x04bc "kana_SHI") ;U+30B7 KATAKANA LETTER SI
(cl-define-keysym #x04bd "kana_SU") ;U+30B9 KATAKANA LETTER SU
(cl-define-keysym #x04be "kana_SE") ;U+30BB KATAKANA LETTER SE
(cl-define-keysym #x04bf "kana_SO") ;U+30BD KATAKANA LETTER SO
(cl-define-keysym #x04c0 "kana_TA") ;U+30BF KATAKANA LETTER TA
(cl-define-keysym #x04c1 "kana_CHI") ;U+30C1 KATAKANA LETTER TI
(cl-define-keysym #x04c1 "kana_TI") ;deprecated
(cl-define-keysym #x04c2 "kana_TSU") ;U+30C4 KATAKANA LETTER TU
(cl-define-keysym #x04c2 "kana_TU") ;deprecated
(cl-define-keysym #x04c3 "kana_TE") ;U+30C6 KATAKANA LETTER TE
(cl-define-keysym #x04c4 "kana_TO") ;U+30C8 KATAKANA LETTER TO
(cl-define-keysym #x04c5 "kana_NA") ;U+30CA KATAKANA LETTER NA
(cl-define-keysym #x04c6 "kana_NI") ;U+30CB KATAKANA LETTER NI
(cl-define-keysym #x04c7 "kana_NU") ;U+30CC KATAKANA LETTER NU
(cl-define-keysym #x04c8 "kana_NE") ;U+30CD KATAKANA LETTER NE
(cl-define-keysym #x04c9 "kana_NO") ;U+30CE KATAKANA LETTER NO
(cl-define-keysym #x04ca "kana_HA") ;U+30CF KATAKANA LETTER HA
(cl-define-keysym #x04cb "kana_HI") ;U+30D2 KATAKANA LETTER HI
(cl-define-keysym #x04cc "kana_FU") ;U+30D5 KATAKANA LETTER HU
(cl-define-keysym #x04cc "kana_HU") ;deprecated
(cl-define-keysym #x04cd "kana_HE") ;U+30D8 KATAKANA LETTER HE
(cl-define-keysym #x04ce "kana_HO") ;U+30DB KATAKANA LETTER HO
(cl-define-keysym #x04cf "kana_MA") ;U+30DE KATAKANA LETTER MA
(cl-define-keysym #x04d0 "kana_MI") ;U+30DF KATAKANA LETTER MI
(cl-define-keysym #x04d1 "kana_MU") ;U+30E0 KATAKANA LETTER MU
(cl-define-keysym #x04d2 "kana_ME") ;U+30E1 KATAKANA LETTER ME
(cl-define-keysym #x04d3 "kana_MO") ;U+30E2 KATAKANA LETTER MO
(cl-define-keysym #x04d4 "kana_YA") ;U+30E4 KATAKANA LETTER YA
(cl-define-keysym #x04d5 "kana_YU") ;U+30E6 KATAKANA LETTER YU
(cl-define-keysym #x04d6 "kana_YO") ;U+30E8 KATAKANA LETTER YO
(cl-define-keysym #x04d7 "kana_RA") ;U+30E9 KATAKANA LETTER RA
(cl-define-keysym #x04d8 "kana_RI") ;U+30EA KATAKANA LETTER RI
(cl-define-keysym #x04d9 "kana_RU") ;U+30EB KATAKANA LETTER RU
(cl-define-keysym #x04da "kana_RE") ;U+30EC KATAKANA LETTER RE
(cl-define-keysym #x04db "kana_RO") ;U+30ED KATAKANA LETTER RO
(cl-define-keysym #x04dc "kana_WA") ;U+30EF KATAKANA LETTER WA
(cl-define-keysym #x04dd "kana_N") ;U+30F3 KATAKANA LETTER N
(cl-define-keysym #x04de "voicedsound") ;U+309B KATAKANA-HIRAGANA VOICED SOUND MARK
(cl-define-keysym #x04df "semivoicedsound") ;U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
(cl-define-keysym #xff7e "kana_switch") ;Alias for mode_switch
(cl-define-keysym #x10006f0 "Farsi_0") ;U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO
(cl-define-keysym #x10006f1 "Farsi_1") ;U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE
(cl-define-keysym #x10006f2 "Farsi_2") ;U+06F2 EXTENDED ARABIC-INDIC DIGIT TWO
(cl-define-keysym #x10006f3 "Farsi_3") ;U+06F3 EXTENDED ARABIC-INDIC DIGIT THREE
(cl-define-keysym #x10006f4 "Farsi_4") ;U+06F4 EXTENDED ARABIC-INDIC DIGIT FOUR
(cl-define-keysym #x10006f5 "Farsi_5") ;U+06F5 EXTENDED ARABIC-INDIC DIGIT FIVE
(cl-define-keysym #x10006f6 "Farsi_6") ;U+06F6 EXTENDED ARABIC-INDIC DIGIT SIX
(cl-define-keysym #x10006f7 "Farsi_7") ;U+06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN
(cl-define-keysym #x10006f8 "Farsi_8") ;U+06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT
(cl-define-keysym #x10006f9 "Farsi_9") ;U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE
(cl-define-keysym #x100066a "Arabic_percent") ;U+066A ARABIC PERCENT SIGN
(cl-define-keysym #x1000670 "Arabic_superscript_alef") ;U+0670 ARABIC LETTER SUPERSCRIPT ALEF
(cl-define-keysym #x1000679 "Arabic_tteh") ;U+0679 ARABIC LETTER TTEH
(cl-define-keysym #x100067e "Arabic_peh") ;U+067E ARABIC LETTER PEH
(cl-define-keysym #x1000686 "Arabic_tcheh") ;U+0686 ARABIC LETTER TCHEH
(cl-define-keysym #x1000688 "Arabic_ddal") ;U+0688 ARABIC LETTER DDAL
(cl-define-keysym #x1000691 "Arabic_rreh") ;U+0691 ARABIC LETTER RREH
(cl-define-keysym #x05ac "Arabic_comma") ;U+060C ARABIC COMMA
(cl-define-keysym #x10006d4 "Arabic_fullstop") ;U+06D4 ARABIC FULL STOP
(cl-define-keysym #x1000660 "Arabic_0") ;U+0660 ARABIC-INDIC DIGIT ZERO
(cl-define-keysym #x1000661 "Arabic_1") ;U+0661 ARABIC-INDIC DIGIT ONE
(cl-define-keysym #x1000662 "Arabic_2") ;U+0662 ARABIC-INDIC DIGIT TWO
(cl-define-keysym #x1000663 "Arabic_3") ;U+0663 ARABIC-INDIC DIGIT THREE
(cl-define-keysym #x1000664 "Arabic_4") ;U+0664 ARABIC-INDIC DIGIT FOUR
(cl-define-keysym #x1000665 "Arabic_5") ;U+0665 ARABIC-INDIC DIGIT FIVE
(cl-define-keysym #x1000666 "Arabic_6") ;U+0666 ARABIC-INDIC DIGIT SIX
(cl-define-keysym #x1000667 "Arabic_7") ;U+0667 ARABIC-INDIC DIGIT SEVEN
(cl-define-keysym #x1000668 "Arabic_8") ;U+0668 ARABIC-INDIC DIGIT EIGHT
(cl-define-keysym #x1000669 "Arabic_9") ;U+0669 ARABIC-INDIC DIGIT NINE
(cl-define-keysym #x05bb "Arabic_semicolon") ;U+061B ARABIC SEMICOLON
(cl-define-keysym #x05bf "Arabic_question_mark") ;U+061F ARABIC QUESTION MARK
(cl-define-keysym #x05c1 "Arabic_hamza") ;U+0621 ARABIC LETTER HAMZA
(cl-define-keysym #x05c2 "Arabic_maddaonalef") ;U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE
(cl-define-keysym #x05c3 "Arabic_hamzaonalef") ;U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE
(cl-define-keysym #x05c4 "Arabic_hamzaonwaw") ;U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE
(cl-define-keysym #x05c5 "Arabic_hamzaunderalef") ;U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW
(cl-define-keysym #x05c6 "Arabic_hamzaonyeh") ;U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE
(cl-define-keysym #x05c7 "Arabic_alef") ;U+0627 ARABIC LETTER ALEF
(cl-define-keysym #x05c8 "Arabic_beh") ;U+0628 ARABIC LETTER BEH
(cl-define-keysym #x05c9 "Arabic_tehmarbuta") ;U+0629 ARABIC LETTER TEH MARBUTA
(cl-define-keysym #x05ca "Arabic_teh") ;U+062A ARABIC LETTER TEH
(cl-define-keysym #x05cb "Arabic_theh") ;U+062B ARABIC LETTER THEH
(cl-define-keysym #x05cc "Arabic_jeem") ;U+062C ARABIC LETTER JEEM
(cl-define-keysym #x05cd "Arabic_hah") ;U+062D ARABIC LETTER HAH
(cl-define-keysym #x05ce "Arabic_khah") ;U+062E ARABIC LETTER KHAH
(cl-define-keysym #x05cf "Arabic_dal") ;U+062F ARABIC LETTER DAL
(cl-define-keysym #x05d0 "Arabic_thal") ;U+0630 ARABIC LETTER THAL
(cl-define-keysym #x05d1 "Arabic_ra") ;U+0631 ARABIC LETTER REH
(cl-define-keysym #x05d2 "Arabic_zain") ;U+0632 ARABIC LETTER ZAIN
(cl-define-keysym #x05d3 "Arabic_seen") ;U+0633 ARABIC LETTER SEEN
(cl-define-keysym #x05d4 "Arabic_sheen") ;U+0634 ARABIC LETTER SHEEN
(cl-define-keysym #x05d5 "Arabic_sad") ;U+0635 ARABIC LETTER SAD
(cl-define-keysym #x05d6 "Arabic_dad") ;U+0636 ARABIC LETTER DAD
(cl-define-keysym #x05d7 "Arabic_tah") ;U+0637 ARABIC LETTER TAH
(cl-define-keysym #x05d8 "Arabic_zah") ;U+0638 ARABIC LETTER ZAH
(cl-define-keysym #x05d9 "Arabic_ain") ;U+0639 ARABIC LETTER AIN
(cl-define-keysym #x05da "Arabic_ghain") ;U+063A ARABIC LETTER GHAIN
(cl-define-keysym #x05e0 "Arabic_tatweel") ;U+0640 ARABIC TATWEEL
(cl-define-keysym #x05e1 "Arabic_feh") ;U+0641 ARABIC LETTER FEH
(cl-define-keysym #x05e2 "Arabic_qaf") ;U+0642 ARABIC LETTER QAF
(cl-define-keysym #x05e3 "Arabic_kaf") ;U+0643 ARABIC LETTER KAF
(cl-define-keysym #x05e4 "Arabic_lam") ;U+0644 ARABIC LETTER LAM
(cl-define-keysym #x05e5 "Arabic_meem") ;U+0645 ARABIC LETTER MEEM
(cl-define-keysym #x05e6 "Arabic_noon") ;U+0646 ARABIC LETTER NOON
(cl-define-keysym #x05e7 "Arabic_ha") ;U+0647 ARABIC LETTER HEH
(cl-define-keysym #x05e7 "Arabic_heh") ;deprecated
(cl-define-keysym #x05e8 "Arabic_waw") ;U+0648 ARABIC LETTER WAW
(cl-define-keysym #x05e9 "Arabic_alefmaksura") ;U+0649 ARABIC LETTER ALEF MAKSURA
(cl-define-keysym #x05ea "Arabic_yeh") ;U+064A ARABIC LETTER YEH
(cl-define-keysym #x05eb "Arabic_fathatan") ;U+064B ARABIC FATHATAN
(cl-define-keysym #x05ec "Arabic_dammatan") ;U+064C ARABIC DAMMATAN
(cl-define-keysym #x05ed "Arabic_kasratan") ;U+064D ARABIC KASRATAN
(cl-define-keysym #x05ee "Arabic_fatha") ;U+064E ARABIC FATHA
(cl-define-keysym #x05ef "Arabic_damma") ;U+064F ARABIC DAMMA
(cl-define-keysym #x05f0 "Arabic_kasra") ;U+0650 ARABIC KASRA
(cl-define-keysym #x05f1 "Arabic_shadda") ;U+0651 ARABIC SHADDA
(cl-define-keysym #x05f2 "Arabic_sukun") ;U+0652 ARABIC SUKUN
(cl-define-keysym #x1000653 "Arabic_madda_above") ;U+0653 ARABIC MADDAH ABOVE
(cl-define-keysym #x1000654 "Arabic_hamza_above") ;U+0654 ARABIC HAMZA ABOVE
(cl-define-keysym #x1000655 "Arabic_hamza_below") ;U+0655 ARABIC HAMZA BELOW
(cl-define-keysym #x1000698 "Arabic_jeh") ;U+0698 ARABIC LETTER JEH
(cl-define-keysym #x10006a4 "Arabic_veh") ;U+06A4 ARABIC LETTER VEH
(cl-define-keysym #x10006a9 "Arabic_keheh") ;U+06A9 ARABIC LETTER KEHEH
(cl-define-keysym #x10006af "Arabic_gaf") ;U+06AF ARABIC LETTER GAF
(cl-define-keysym #x10006ba "Arabic_noon_ghunna") ;U+06BA ARABIC LETTER NOON GHUNNA
(cl-define-keysym #x10006be "Arabic_heh_doachashmee") ;U+06BE ARABIC LETTER HEH DOACHASHMEE
(cl-define-keysym #x10006cc "Farsi_yeh") ;U+06CC ARABIC LETTER FARSI YEH
(cl-define-keysym #x10006cc "Arabic_farsi_yeh") ;U+06CC ARABIC LETTER FARSI YEH
(cl-define-keysym #x10006d2 "Arabic_yeh_baree") ;U+06D2 ARABIC LETTER YEH BARREE
(cl-define-keysym #x10006c1 "Arabic_heh_goal") ;U+06C1 ARABIC LETTER HEH GOAL
(cl-define-keysym #xff7e "Arabic_switch") ;Alias for mode_switch
(cl-define-keysym #x1000492 "Cyrillic_GHE_bar") ;U+0492 CYRILLIC CAPITAL LETTER GHE WITH STROKE
(cl-define-keysym #x1000493 "Cyrillic_ghe_bar") ;U+0493 CYRILLIC SMALL LETTER GHE WITH STROKE
(cl-define-keysym #x1000496 "Cyrillic_ZHE_descender") ;U+0496 CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER
(cl-define-keysym #x1000497 "Cyrillic_zhe_descender") ;U+0497 CYRILLIC SMALL LETTER ZHE WITH DESCENDER
(cl-define-keysym #x100049a "Cyrillic_KA_descender") ;U+049A CYRILLIC CAPITAL LETTER KA WITH DESCENDER
(cl-define-keysym #x100049b "Cyrillic_ka_descender") ;U+049B CYRILLIC SMALL LETTER KA WITH DESCENDER
(cl-define-keysym #x100049c "Cyrillic_KA_vertstroke") ;U+049C CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE
(cl-define-keysym #x100049d "Cyrillic_ka_vertstroke") ;U+049D CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE
(cl-define-keysym #x10004a2 "Cyrillic_EN_descender") ;U+04A2 CYRILLIC CAPITAL LETTER EN WITH DESCENDER
(cl-define-keysym #x10004a3 "Cyrillic_en_descender") ;U+04A3 CYRILLIC SMALL LETTER EN WITH DESCENDER
(cl-define-keysym #x10004ae "Cyrillic_U_straight") ;U+04AE CYRILLIC CAPITAL LETTER STRAIGHT U
(cl-define-keysym #x10004af "Cyrillic_u_straight") ;U+04AF CYRILLIC SMALL LETTER STRAIGHT U
(cl-define-keysym #x10004b0 "Cyrillic_U_straight_bar") ;U+04B0 CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE
(cl-define-keysym #x10004b1 "Cyrillic_u_straight_bar") ;U+04B1 CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE
(cl-define-keysym #x10004b2 "Cyrillic_HA_descender") ;U+04B2 CYRILLIC CAPITAL LETTER HA WITH DESCENDER
(cl-define-keysym #x10004b3 "Cyrillic_ha_descender") ;U+04B3 CYRILLIC SMALL LETTER HA WITH DESCENDER
(cl-define-keysym #x10004b6 "Cyrillic_CHE_descender") ;U+04B6 CYRILLIC CAPITAL LETTER CHE WITH DESCENDER
(cl-define-keysym #x10004b7 "Cyrillic_che_descender") ;U+04B7 CYRILLIC SMALL LETTER CHE WITH DESCENDER
(cl-define-keysym #x10004b8 "Cyrillic_CHE_vertstroke") ;U+04B8 CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE
(cl-define-keysym #x10004b9 "Cyrillic_che_vertstroke") ;U+04B9 CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE
(cl-define-keysym #x10004ba "Cyrillic_SHHA") ;U+04BA CYRILLIC CAPITAL LETTER SHHA
(cl-define-keysym #x10004bb "Cyrillic_shha") ;U+04BB CYRILLIC SMALL LETTER SHHA
(cl-define-keysym #x10004d8 "Cyrillic_SCHWA") ;U+04D8 CYRILLIC CAPITAL LETTER SCHWA
(cl-define-keysym #x10004d9 "Cyrillic_schwa") ;U+04D9 CYRILLIC SMALL LETTER SCHWA
(cl-define-keysym #x10004e2 "Cyrillic_I_macron") ;U+04E2 CYRILLIC CAPITAL LETTER I WITH MACRON
(cl-define-keysym #x10004e3 "Cyrillic_i_macron") ;U+04E3 CYRILLIC SMALL LETTER I WITH MACRON
(cl-define-keysym #x10004e8 "Cyrillic_O_bar") ;U+04E8 CYRILLIC CAPITAL LETTER BARRED O
(cl-define-keysym #x10004e9 "Cyrillic_o_bar") ;U+04E9 CYRILLIC SMALL LETTER BARRED O
(cl-define-keysym #x10004ee "Cyrillic_U_macron") ;U+04EE CYRILLIC CAPITAL LETTER U WITH MACRON
(cl-define-keysym #x10004ef "Cyrillic_u_macron") ;U+04EF CYRILLIC SMALL LETTER U WITH MACRON
(cl-define-keysym #x06a1 "Serbian_dje") ;U+0452 CYRILLIC SMALL LETTER DJE
(cl-define-keysym #x06a2 "Macedonia_gje") ;U+0453 CYRILLIC SMALL LETTER GJE
(cl-define-keysym #x06a3 "Cyrillic_io") ;U+0451 CYRILLIC SMALL LETTER IO
(cl-define-keysym #x06a4 "Ukrainian_ie") ;U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE
(cl-define-keysym #x06a4 "Ukranian_je") ;deprecated
(cl-define-keysym #x06a5 "Macedonia_dse") ;U+0455 CYRILLIC SMALL LETTER DZE
(cl-define-keysym #x06a6 "Ukrainian_i") ;U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
(cl-define-keysym #x06a6 "Ukranian_i") ;deprecated
(cl-define-keysym #x06a7 "Ukrainian_yi") ;U+0457 CYRILLIC SMALL LETTER YI
(cl-define-keysym #x06a7 "Ukranian_yi") ;deprecated
(cl-define-keysym #x06a8 "Cyrillic_je") ;U+0458 CYRILLIC SMALL LETTER JE
(cl-define-keysym #x06a8 "Serbian_je") ;deprecated
(cl-define-keysym #x06a9 "Cyrillic_lje") ;U+0459 CYRILLIC SMALL LETTER LJE
(cl-define-keysym #x06a9 "Serbian_lje") ;deprecated
(cl-define-keysym #x06aa "Cyrillic_nje") ;U+045A CYRILLIC SMALL LETTER NJE
(cl-define-keysym #x06aa "Serbian_nje") ;deprecated
(cl-define-keysym #x06ab "Serbian_tshe") ;U+045B CYRILLIC SMALL LETTER TSHE
(cl-define-keysym #x06ac "Macedonia_kje") ;U+045C CYRILLIC SMALL LETTER KJE
(cl-define-keysym #x06ad "Ukrainian_ghe_with_upturn") ;U+0491 CYRILLIC SMALL LETTER GHE WITH UPTURN
(cl-define-keysym #x06ae "Byelorussian_shortu") ;U+045E CYRILLIC SMALL LETTER SHORT U
(cl-define-keysym #x06af "Cyrillic_dzhe") ;U+045F CYRILLIC SMALL LETTER DZHE
(cl-define-keysym #x06af "Serbian_dze") ;deprecated
(cl-define-keysym #x06b0 "numerosign") ;U+2116 NUMERO SIGN
(cl-define-keysym #x06b1 "Serbian_DJE") ;U+0402 CYRILLIC CAPITAL LETTER DJE
(cl-define-keysym #x06b2 "Macedonia_GJE") ;U+0403 CYRILLIC CAPITAL LETTER GJE
(cl-define-keysym #x06b3 "Cyrillic_IO") ;U+0401 CYRILLIC CAPITAL LETTER IO
(cl-define-keysym #x06b4 "Ukrainian_IE") ;U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE
(cl-define-keysym #x06b4 "Ukranian_JE") ;deprecated
(cl-define-keysym #x06b5 "Macedonia_DSE") ;U+0405 CYRILLIC CAPITAL LETTER DZE
(cl-define-keysym #x06b6 "Ukrainian_I") ;U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
(cl-define-keysym #x06b6 "Ukranian_I") ;deprecated
(cl-define-keysym #x06b7 "Ukrainian_YI") ;U+0407 CYRILLIC CAPITAL LETTER YI
(cl-define-keysym #x06b7 "Ukranian_YI") ;deprecated
(cl-define-keysym #x06b8 "Cyrillic_JE") ;U+0408 CYRILLIC CAPITAL LETTER JE
(cl-define-keysym #x06b8 "Serbian_JE") ;deprecated
(cl-define-keysym #x06b9 "Cyrillic_LJE") ;U+0409 CYRILLIC CAPITAL LETTER LJE
(cl-define-keysym #x06b9 "Serbian_LJE") ;deprecated
(cl-define-keysym #x06ba "Cyrillic_NJE") ;U+040A CYRILLIC CAPITAL LETTER NJE
(cl-define-keysym #x06ba "Serbian_NJE") ;deprecated
(cl-define-keysym #x06bb "Serbian_TSHE") ;U+040B CYRILLIC CAPITAL LETTER TSHE
(cl-define-keysym #x06bc "Macedonia_KJE") ;U+040C CYRILLIC CAPITAL LETTER KJE
(cl-define-keysym #x06bd "Ukrainian_GHE_WITH_UPTURN") ;U+0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN
(cl-define-keysym #x06be "Byelorussian_SHORTU") ;U+040E CYRILLIC CAPITAL LETTER SHORT U
(cl-define-keysym #x06bf "Cyrillic_DZHE") ;U+040F CYRILLIC CAPITAL LETTER DZHE
(cl-define-keysym #x06bf "Serbian_DZE") ;deprecated
(cl-define-keysym #x06c0 "Cyrillic_yu") ;U+044E CYRILLIC SMALL LETTER YU
(cl-define-keysym #x06c1 "Cyrillic_a") ;U+0430 CYRILLIC SMALL LETTER A
(cl-define-keysym #x06c2 "Cyrillic_be") ;U+0431 CYRILLIC SMALL LETTER BE
(cl-define-keysym #x06c3 "Cyrillic_tse") ;U+0446 CYRILLIC SMALL LETTER TSE
(cl-define-keysym #x06c4 "Cyrillic_de") ;U+0434 CYRILLIC SMALL LETTER DE
(cl-define-keysym #x06c5 "Cyrillic_ie") ;U+0435 CYRILLIC SMALL LETTER IE
(cl-define-keysym #x06c6 "Cyrillic_ef") ;U+0444 CYRILLIC SMALL LETTER EF
(cl-define-keysym #x06c7 "Cyrillic_ghe") ;U+0433 CYRILLIC SMALL LETTER GHE
(cl-define-keysym #x06c8 "Cyrillic_ha") ;U+0445 CYRILLIC SMALL LETTER HA
(cl-define-keysym #x06c9 "Cyrillic_i") ;U+0438 CYRILLIC SMALL LETTER I
(cl-define-keysym #x06ca "Cyrillic_shorti") ;U+0439 CYRILLIC SMALL LETTER SHORT I
(cl-define-keysym #x06cb "Cyrillic_ka") ;U+043A CYRILLIC SMALL LETTER KA
(cl-define-keysym #x06cc "Cyrillic_el") ;U+043B CYRILLIC SMALL LETTER EL
(cl-define-keysym #x06cd "Cyrillic_em") ;U+043C CYRILLIC SMALL LETTER EM
(cl-define-keysym #x06ce "Cyrillic_en") ;U+043D CYRILLIC SMALL LETTER EN
(cl-define-keysym #x06cf "Cyrillic_o") ;U+043E CYRILLIC SMALL LETTER O
(cl-define-keysym #x06d0 "Cyrillic_pe") ;U+043F CYRILLIC SMALL LETTER PE
(cl-define-keysym #x06d1 "Cyrillic_ya") ;U+044F CYRILLIC SMALL LETTER YA
(cl-define-keysym #x06d2 "Cyrillic_er") ;U+0440 CYRILLIC SMALL LETTER ER
(cl-define-keysym #x06d3 "Cyrillic_es") ;U+0441 CYRILLIC SMALL LETTER ES
(cl-define-keysym #x06d4 "Cyrillic_te") ;U+0442 CYRILLIC SMALL LETTER TE
(cl-define-keysym #x06d5 "Cyrillic_u") ;U+0443 CYRILLIC SMALL LETTER U
(cl-define-keysym #x06d6 "Cyrillic_zhe") ;U+0436 CYRILLIC SMALL LETTER ZHE
(cl-define-keysym #x06d7 "Cyrillic_ve") ;U+0432 CYRILLIC SMALL LETTER VE
(cl-define-keysym #x06d8 "Cyrillic_softsign") ;U+044C CYRILLIC SMALL LETTER SOFT SIGN
(cl-define-keysym #x06d9 "Cyrillic_yeru") ;U+044B CYRILLIC SMALL LETTER YERU
(cl-define-keysym #x06da "Cyrillic_ze") ;U+0437 CYRILLIC SMALL LETTER ZE
(cl-define-keysym #x06db "Cyrillic_sha") ;U+0448 CYRILLIC SMALL LETTER SHA
(cl-define-keysym #x06dc "Cyrillic_e") ;U+044D CYRILLIC SMALL LETTER E
(cl-define-keysym #x06dd "Cyrillic_shcha") ;U+0449 CYRILLIC SMALL LETTER SHCHA
(cl-define-keysym #x06de "Cyrillic_che") ;U+0447 CYRILLIC SMALL LETTER CHE
(cl-define-keysym #x06df "Cyrillic_hardsign") ;U+044A CYRILLIC SMALL LETTER HARD SIGN
(cl-define-keysym #x06e0 "Cyrillic_YU") ;U+042E CYRILLIC CAPITAL LETTER YU
(cl-define-keysym #x06e1 "Cyrillic_A") ;U+0410 CYRILLIC CAPITAL LETTER A
(cl-define-keysym #x06e2 "Cyrillic_BE") ;U+0411 CYRILLIC CAPITAL LETTER BE
(cl-define-keysym #x06e3 "Cyrillic_TSE") ;U+0426 CYRILLIC CAPITAL LETTER TSE
(cl-define-keysym #x06e4 "Cyrillic_DE") ;U+0414 CYRILLIC CAPITAL LETTER DE
(cl-define-keysym #x06e5 "Cyrillic_IE") ;U+0415 CYRILLIC CAPITAL LETTER IE
(cl-define-keysym #x06e6 "Cyrillic_EF") ;U+0424 CYRILLIC CAPITAL LETTER EF
(cl-define-keysym #x06e7 "Cyrillic_GHE") ;U+0413 CYRILLIC CAPITAL LETTER GHE
(cl-define-keysym #x06e8 "Cyrillic_HA") ;U+0425 CYRILLIC CAPITAL LETTER HA
(cl-define-keysym #x06e9 "Cyrillic_I") ;U+0418 CYRILLIC CAPITAL LETTER I
(cl-define-keysym #x06ea "Cyrillic_SHORTI") ;U+0419 CYRILLIC CAPITAL LETTER SHORT I
(cl-define-keysym #x06eb "Cyrillic_KA") ;U+041A CYRILLIC CAPITAL LETTER KA
(cl-define-keysym #x06ec "Cyrillic_EL") ;U+041B CYRILLIC CAPITAL LETTER EL
(cl-define-keysym #x06ed "Cyrillic_EM") ;U+041C CYRILLIC CAPITAL LETTER EM
(cl-define-keysym #x06ee "Cyrillic_EN") ;U+041D CYRILLIC CAPITAL LETTER EN
(cl-define-keysym #x06ef "Cyrillic_O") ;U+041E CYRILLIC CAPITAL LETTER O
(cl-define-keysym #x06f0 "Cyrillic_PE") ;U+041F CYRILLIC CAPITAL LETTER PE
(cl-define-keysym #x06f1 "Cyrillic_YA") ;U+042F CYRILLIC CAPITAL LETTER YA
(cl-define-keysym #x06f2 "Cyrillic_ER") ;U+0420 CYRILLIC CAPITAL LETTER ER
(cl-define-keysym #x06f3 "Cyrillic_ES") ;U+0421 CYRILLIC CAPITAL LETTER ES
(cl-define-keysym #x06f4 "Cyrillic_TE") ;U+0422 CYRILLIC CAPITAL LETTER TE
(cl-define-keysym #x06f5 "Cyrillic_U") ;U+0423 CYRILLIC CAPITAL LETTER U
(cl-define-keysym #x06f6 "Cyrillic_ZHE") ;U+0416 CYRILLIC CAPITAL LETTER ZHE
(cl-define-keysym #x06f7 "Cyrillic_VE") ;U+0412 CYRILLIC CAPITAL LETTER VE
(cl-define-keysym #x06f8 "Cyrillic_SOFTSIGN") ;U+042C CYRILLIC CAPITAL LETTER SOFT SIGN
(cl-define-keysym #x06f9 "Cyrillic_YERU") ;U+042B CYRILLIC CAPITAL LETTER YERU
(cl-define-keysym #x06fa "Cyrillic_ZE") ;U+0417 CYRILLIC CAPITAL LETTER ZE
(cl-define-keysym #x06fb "Cyrillic_SHA") ;U+0428 CYRILLIC CAPITAL LETTER SHA
(cl-define-keysym #x06fc "Cyrillic_E") ;U+042D CYRILLIC CAPITAL LETTER E
(cl-define-keysym #x06fd "Cyrillic_SHCHA") ;U+0429 CYRILLIC CAPITAL LETTER SHCHA
(cl-define-keysym #x06fe "Cyrillic_CHE") ;U+0427 CYRILLIC CAPITAL LETTER CHE
(cl-define-keysym #x06ff "Cyrillic_HARDSIGN") ;U+042A CYRILLIC CAPITAL LETTER HARD SIGN
(cl-define-keysym #x07a1 "Greek_ALPHAaccent") ;U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS
(cl-define-keysym #x07a2 "Greek_EPSILONaccent") ;U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS
(cl-define-keysym #x07a3 "Greek_ETAaccent") ;U+0389 GREEK CAPITAL LETTER ETA WITH TONOS
(cl-define-keysym #x07a4 "Greek_IOTAaccent") ;U+038A GREEK CAPITAL LETTER IOTA WITH TONOS
(cl-define-keysym #x07a5 "Greek_IOTAdieresis") ;U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
(cl-define-keysym #x07a5 "Greek_IOTAdiaeresis") ;old typo
(cl-define-keysym #x07a7 "Greek_OMICRONaccent") ;U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS
(cl-define-keysym #x07a8 "Greek_UPSILONaccent") ;U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS
(cl-define-keysym #x07a9 "Greek_UPSILONdieresis") ;U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
(cl-define-keysym #x07ab "Greek_OMEGAaccent") ;U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS
(cl-define-keysym #x07ae "Greek_accentdieresis") ;U+0385 GREEK DIALYTIKA TONOS
(cl-define-keysym #x07af "Greek_horizbar") ;U+2015 HORIZONTAL BAR
(cl-define-keysym #x07b1 "Greek_alphaaccent") ;U+03AC GREEK SMALL LETTER ALPHA WITH TONOS
(cl-define-keysym #x07b2 "Greek_epsilonaccent") ;U+03AD GREEK SMALL LETTER EPSILON WITH TONOS
(cl-define-keysym #x07b3 "Greek_etaaccent") ;U+03AE GREEK SMALL LETTER ETA WITH TONOS
(cl-define-keysym #x07b4 "Greek_iotaaccent") ;U+03AF GREEK SMALL LETTER IOTA WITH TONOS
(cl-define-keysym #x07b5 "Greek_iotadieresis") ;U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA
(cl-define-keysym #x07b6 "Greek_iotaaccentdieresis") ;U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
(cl-define-keysym #x07b7 "Greek_omicronaccent") ;U+03CC GREEK SMALL LETTER OMICRON WITH TONOS
(cl-define-keysym #x07b8 "Greek_upsilonaccent") ;U+03CD GREEK SMALL LETTER UPSILON WITH TONOS
(cl-define-keysym #x07b9 "Greek_upsilondieresis") ;U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA
(cl-define-keysym #x07ba "Greek_upsilonaccentdieresis") ;U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
(cl-define-keysym #x07bb "Greek_omegaaccent") ;U+03CE GREEK SMALL LETTER OMEGA WITH TONOS
(cl-define-keysym #x07c1 "Greek_ALPHA") ;U+0391 GREEK CAPITAL LETTER ALPHA
(cl-define-keysym #x07c2 "Greek_BETA") ;U+0392 GREEK CAPITAL LETTER BETA
(cl-define-keysym #x07c3 "Greek_GAMMA") ;U+0393 GREEK CAPITAL LETTER GAMMA
(cl-define-keysym #x07c4 "Greek_DELTA") ;U+0394 GREEK CAPITAL LETTER DELTA
(cl-define-keysym #x07c5 "Greek_EPSILON") ;U+0395 GREEK CAPITAL LETTER EPSILON
(cl-define-keysym #x07c6 "Greek_ZETA") ;U+0396 GREEK CAPITAL LETTER ZETA
(cl-define-keysym #x07c7 "Greek_ETA") ;U+0397 GREEK CAPITAL LETTER ETA
(cl-define-keysym #x07c8 "Greek_THETA") ;U+0398 GREEK CAPITAL LETTER THETA
(cl-define-keysym #x07c9 "Greek_IOTA") ;U+0399 GREEK CAPITAL LETTER IOTA
(cl-define-keysym #x07ca "Greek_KAPPA") ;U+039A GREEK CAPITAL LETTER KAPPA
(cl-define-keysym #x07cb "Greek_LAMDA") ;U+039B GREEK CAPITAL LETTER LAMDA
(cl-define-keysym #x07cb "Greek_LAMBDA") ;U+039B GREEK CAPITAL LETTER LAMDA
(cl-define-keysym #x07cc "Greek_MU") ;U+039C GREEK CAPITAL LETTER MU
(cl-define-keysym #x07cd "Greek_NU") ;U+039D GREEK CAPITAL LETTER NU
(cl-define-keysym #x07ce "Greek_XI") ;U+039E GREEK CAPITAL LETTER XI
(cl-define-keysym #x07cf "Greek_OMICRON") ;U+039F GREEK CAPITAL LETTER OMICRON
(cl-define-keysym #x07d0 "Greek_PI") ;U+03A0 GREEK CAPITAL LETTER PI
(cl-define-keysym #x07d1 "Greek_RHO") ;U+03A1 GREEK CAPITAL LETTER RHO
(cl-define-keysym #x07d2 "Greek_SIGMA") ;U+03A3 GREEK CAPITAL LETTER SIGMA
(cl-define-keysym #x07d4 "Greek_TAU") ;U+03A4 GREEK CAPITAL LETTER TAU
(cl-define-keysym #x07d5 "Greek_UPSILON") ;U+03A5 GREEK CAPITAL LETTER UPSILON
(cl-define-keysym #x07d6 "Greek_PHI") ;U+03A6 GREEK CAPITAL LETTER PHI
(cl-define-keysym #x07d7 "Greek_CHI") ;U+03A7 GREEK CAPITAL LETTER CHI
(cl-define-keysym #x07d8 "Greek_PSI") ;U+03A8 GREEK CAPITAL LETTER PSI
(cl-define-keysym #x07d9 "Greek_OMEGA") ;U+03A9 GREEK CAPITAL LETTER OMEGA
(cl-define-keysym #x07e1 "Greek_alpha") ;U+03B1 GREEK SMALL LETTER ALPHA
(cl-define-keysym #x07e2 "Greek_beta") ;U+03B2 GREEK SMALL LETTER BETA
(cl-define-keysym #x07e3 "Greek_gamma") ;U+03B3 GREEK SMALL LETTER GAMMA
(cl-define-keysym #x07e4 "Greek_delta") ;U+03B4 GREEK SMALL LETTER DELTA
(cl-define-keysym #x07e5 "Greek_epsilon") ;U+03B5 GREEK SMALL LETTER EPSILON
(cl-define-keysym #x07e6 "Greek_zeta") ;U+03B6 GREEK SMALL LETTER ZETA
(cl-define-keysym #x07e7 "Greek_eta") ;U+03B7 GREEK SMALL LETTER ETA
(cl-define-keysym #x07e8 "Greek_theta") ;U+03B8 GREEK SMALL LETTER THETA
(cl-define-keysym #x07e9 "Greek_iota") ;U+03B9 GREEK SMALL LETTER IOTA
(cl-define-keysym #x07ea "Greek_kappa") ;U+03BA GREEK SMALL LETTER KAPPA
(cl-define-keysym #x07eb "Greek_lamda") ;U+03BB GREEK SMALL LETTER LAMDA
(cl-define-keysym #x07eb "Greek_lambda") ;U+03BB GREEK SMALL LETTER LAMDA
(cl-define-keysym #x07ec "Greek_mu") ;U+03BC GREEK SMALL LETTER MU
(cl-define-keysym #x07ed "Greek_nu") ;U+03BD GREEK SMALL LETTER NU
(cl-define-keysym #x07ee "Greek_xi") ;U+03BE GREEK SMALL LETTER XI
(cl-define-keysym #x07ef "Greek_omicron") ;U+03BF GREEK SMALL LETTER OMICRON
(cl-define-keysym #x07f0 "Greek_pi") ;U+03C0 GREEK SMALL LETTER PI
(cl-define-keysym #x07f1 "Greek_rho") ;U+03C1 GREEK SMALL LETTER RHO
(cl-define-keysym #x07f2 "Greek_sigma") ;U+03C3 GREEK SMALL LETTER SIGMA
(cl-define-keysym #x07f3 "Greek_finalsmallsigma") ;U+03C2 GREEK SMALL LETTER FINAL SIGMA
(cl-define-keysym #x07f4 "Greek_tau") ;U+03C4 GREEK SMALL LETTER TAU
(cl-define-keysym #x07f5 "Greek_upsilon") ;U+03C5 GREEK SMALL LETTER UPSILON
(cl-define-keysym #x07f6 "Greek_phi") ;U+03C6 GREEK SMALL LETTER PHI
(cl-define-keysym #x07f7 "Greek_chi") ;U+03C7 GREEK SMALL LETTER CHI
(cl-define-keysym #x07f8 "Greek_psi") ;U+03C8 GREEK SMALL LETTER PSI
(cl-define-keysym #x07f9 "Greek_omega") ;U+03C9 GREEK SMALL LETTER OMEGA
(cl-define-keysym #xff7e "Greek_switch") ;Alias for mode_switch
(cl-define-keysym #x08a1 "leftradical") ;U+23B7 RADICAL SYMBOL BOTTOM
(cl-define-keysym #x08a2 "topleftradical") ;(U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT)
(cl-define-keysym #x08a3 "horizconnector") ;(U+2500 BOX DRAWINGS LIGHT HORIZONTAL)
(cl-define-keysym #x08a4 "topintegral") ;U+2320 TOP HALF INTEGRAL
(cl-define-keysym #x08a5 "botintegral") ;U+2321 BOTTOM HALF INTEGRAL
(cl-define-keysym #x08a6 "vertconnector") ;(U+2502 BOX DRAWINGS LIGHT VERTICAL)
(cl-define-keysym #x08a7 "topleftsqbracket") ;U+23A1 LEFT SQUARE BRACKET UPPER CORNER
(cl-define-keysym #x08a8 "botleftsqbracket") ;U+23A3 LEFT SQUARE BRACKET LOWER CORNER
(cl-define-keysym #x08a9 "toprightsqbracket") ;U+23A4 RIGHT SQUARE BRACKET UPPER CORNER
(cl-define-keysym #x08aa "botrightsqbracket") ;U+23A6 RIGHT SQUARE BRACKET LOWER CORNER
(cl-define-keysym #x08ab "topleftparens") ;U+239B LEFT PARENTHESIS UPPER HOOK
(cl-define-keysym #x08ac "botleftparens") ;U+239D LEFT PARENTHESIS LOWER HOOK
(cl-define-keysym #x08ad "toprightparens") ;U+239E RIGHT PARENTHESIS UPPER HOOK
(cl-define-keysym #x08ae "botrightparens") ;U+23A0 RIGHT PARENTHESIS LOWER HOOK
(cl-define-keysym #x08af "leftmiddlecurlybrace") ;U+23A8 LEFT CURLY BRACKET MIDDLE PIECE
(cl-define-keysym #x08b0 "rightmiddlecurlybrace") ;U+23AC RIGHT CURLY BRACKET MIDDLE PIECE
(cl-define-keysym #x08b1 "topleftsummation")
(cl-define-keysym #x08b2 "botleftsummation")
(cl-define-keysym #x08b3 "topvertsummationconnector")
(cl-define-keysym #x08b4 "botvertsummationconnector")
(cl-define-keysym #x08b5 "toprightsummation")
(cl-define-keysym #x08b6 "botrightsummation")
(cl-define-keysym #x08b7 "rightmiddlesummation")
(cl-define-keysym #x08bc "lessthanequal") ;U+2264 LESS-THAN OR EQUAL TO
(cl-define-keysym #x08bd "notequal") ;U+2260 NOT EQUAL TO
(cl-define-keysym #x08be "greaterthanequal") ;U+2265 GREATER-THAN OR EQUAL TO
(cl-define-keysym #x08bf "integral") ;U+222B INTEGRAL
(cl-define-keysym #x08c0 "therefore") ;U+2234 THEREFORE
(cl-define-keysym #x08c1 "variation") ;U+221D PROPORTIONAL TO
(cl-define-keysym #x08c2 "infinity") ;U+221E INFINITY
(cl-define-keysym #x08c5 "nabla") ;U+2207 NABLA
(cl-define-keysym #x08c8 "approximate") ;U+223C TILDE OPERATOR
(cl-define-keysym #x08c9 "similarequal") ;U+2243 ASYMPTOTICALLY EQUAL TO
(cl-define-keysym #x08cd "ifonlyif") ;U+21D4 LEFT RIGHT DOUBLE ARROW
(cl-define-keysym #x08ce "implies") ;U+21D2 RIGHTWARDS DOUBLE ARROW
(cl-define-keysym #x08cf "identical") ;U+2261 IDENTICAL TO
(cl-define-keysym #x08d6 "radical") ;U+221A SQUARE ROOT
(cl-define-keysym #x08da "includedin") ;U+2282 SUBSET OF
(cl-define-keysym #x08db "includes") ;U+2283 SUPERSET OF
(cl-define-keysym #x08dc "intersection") ;U+2229 INTERSECTION
(cl-define-keysym #x08dd "union") ;U+222A UNION
(cl-define-keysym #x08de "logicaland") ;U+2227 LOGICAL AND
(cl-define-keysym #x08df "logicalor") ;U+2228 LOGICAL OR
(cl-define-keysym #x08ef "partialderivative") ;U+2202 PARTIAL DIFFERENTIAL
(cl-define-keysym #x08f6 "function") ;U+0192 LATIN SMALL LETTER F WITH HOOK
(cl-define-keysym #x08fb "leftarrow") ;U+2190 LEFTWARDS ARROW
(cl-define-keysym #x08fc "uparrow") ;U+2191 UPWARDS ARROW
(cl-define-keysym #x08fd "rightarrow") ;U+2192 RIGHTWARDS ARROW
(cl-define-keysym #x08fe "downarrow") ;U+2193 DOWNWARDS ARROW
(cl-define-keysym #x09df "blank")
(cl-define-keysym #x09e0 "soliddiamond") ;U+25C6 BLACK DIAMOND
(cl-define-keysym #x09e1 "checkerboard") ;U+2592 MEDIUM SHADE
(cl-define-keysym #x09e2 "ht") ;U+2409 SYMBOL FOR HORIZONTAL TABULATION
(cl-define-keysym #x09e3 "ff") ;U+240C SYMBOL FOR FORM FEED
(cl-define-keysym #x09e4 "cr") ;U+240D SYMBOL FOR CARRIAGE RETURN
(cl-define-keysym #x09e5 "lf") ;U+240A SYMBOL FOR LINE FEED
(cl-define-keysym #x09e8 "nl") ;U+2424 SYMBOL FOR NEWLINE
(cl-define-keysym #x09e9 "vt") ;U+240B SYMBOL FOR VERTICAL TABULATION
(cl-define-keysym #x09ea "lowrightcorner") ;U+2518 BOX DRAWINGS LIGHT UP AND LEFT
(cl-define-keysym #x09eb "uprightcorner") ;U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT
(cl-define-keysym #x09ec "upleftcorner") ;U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT
(cl-define-keysym #x09ed "lowleftcorner") ;U+2514 BOX DRAWINGS LIGHT UP AND RIGHT
(cl-define-keysym #x09ee "crossinglines") ;U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
(cl-define-keysym #x09ef "horizlinescan1") ;U+23BA HORIZONTAL SCAN LINE-1
(cl-define-keysym #x09f0 "horizlinescan3") ;U+23BB HORIZONTAL SCAN LINE-3
(cl-define-keysym #x09f1 "horizlinescan5") ;U+2500 BOX DRAWINGS LIGHT HORIZONTAL
(cl-define-keysym #x09f2 "horizlinescan7") ;U+23BC HORIZONTAL SCAN LINE-7
(cl-define-keysym #x09f3 "horizlinescan9") ;U+23BD HORIZONTAL SCAN LINE-9
(cl-define-keysym #x09f4 "leftt") ;U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT
(cl-define-keysym #x09f5 "rightt") ;U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT
(cl-define-keysym #x09f6 "bott") ;U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL
(cl-define-keysym #x09f7 "topt") ;U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
(cl-define-keysym #x09f8 "vertbar") ;U+2502 BOX DRAWINGS LIGHT VERTICAL
(cl-define-keysym #x0aa1 "emspace") ;U+2003 EM SPACE
(cl-define-keysym #x0aa2 "enspace") ;U+2002 EN SPACE
(cl-define-keysym #x0aa3 "em3space") ;U+2004 THREE-PER-EM SPACE
(cl-define-keysym #x0aa4 "em4space") ;U+2005 FOUR-PER-EM SPACE
(cl-define-keysym #x0aa5 "digitspace") ;U+2007 FIGURE SPACE
(cl-define-keysym #x0aa6 "punctspace") ;U+2008 PUNCTUATION SPACE
(cl-define-keysym #x0aa7 "thinspace") ;U+2009 THIN SPACE
(cl-define-keysym #x0aa8 "hairspace") ;U+200A HAIR SPACE
(cl-define-keysym #x0aa9 "emdash") ;U+2014 EM DASH
(cl-define-keysym #x0aaa "endash") ;U+2013 EN DASH
(cl-define-keysym #x0aac "signifblank") ;(U+2423 OPEN BOX)
(cl-define-keysym #x0aae "ellipsis") ;U+2026 HORIZONTAL ELLIPSIS
(cl-define-keysym #x0aaf "doubbaselinedot") ;U+2025 TWO DOT LEADER
(cl-define-keysym #x0ab0 "onethird") ;U+2153 VULGAR FRACTION ONE THIRD
(cl-define-keysym #x0ab1 "twothirds") ;U+2154 VULGAR FRACTION TWO THIRDS
(cl-define-keysym #x0ab2 "onefifth") ;U+2155 VULGAR FRACTION ONE FIFTH
(cl-define-keysym #x0ab3 "twofifths") ;U+2156 VULGAR FRACTION TWO FIFTHS
(cl-define-keysym #x0ab4 "threefifths") ;U+2157 VULGAR FRACTION THREE FIFTHS
(cl-define-keysym #x0ab5 "fourfifths") ;U+2158 VULGAR FRACTION FOUR FIFTHS
(cl-define-keysym #x0ab6 "onesixth") ;U+2159 VULGAR FRACTION ONE SIXTH
(cl-define-keysym #x0ab7 "fivesixths") ;U+215A VULGAR FRACTION FIVE SIXTHS
(cl-define-keysym #x0ab8 "careof") ;U+2105 CARE OF
(cl-define-keysym #x0abb "figdash") ;U+2012 FIGURE DASH
(cl-define-keysym #x0abc "leftanglebracket") ;(U+27E8 MATHEMATICAL LEFT ANGLE BRACKET)
(cl-define-keysym #x0abd "decimalpoint") ;(U+002E FULL STOP)
(cl-define-keysym #x0abe "rightanglebracket") ;(U+27E9 MATHEMATICAL RIGHT ANGLE BRACKET)
(cl-define-keysym #x0abf "marker")
(cl-define-keysym #x0ac3 "oneeighth") ;U+215B VULGAR FRACTION ONE EIGHTH
(cl-define-keysym #x0ac4 "threeeighths") ;U+215C VULGAR FRACTION THREE EIGHTHS
(cl-define-keysym #x0ac5 "fiveeighths") ;U+215D VULGAR FRACTION FIVE EIGHTHS
(cl-define-keysym #x0ac6 "seveneighths") ;U+215E VULGAR FRACTION SEVEN EIGHTHS
(cl-define-keysym #x0ac9 "trademark") ;U+2122 TRADE MARK SIGN
(cl-define-keysym #x0aca "signaturemark") ;(U+2613 SALTIRE)
(cl-define-keysym #x0acb "trademarkincircle")
(cl-define-keysym #x0acc "leftopentriangle") ;(U+25C1 WHITE LEFT-POINTING TRIANGLE)
(cl-define-keysym #x0acd "rightopentriangle") ;(U+25B7 WHITE RIGHT-POINTING TRIANGLE)
(cl-define-keysym #x0ace "emopencircle") ;(U+25CB WHITE CIRCLE)
(cl-define-keysym #x0acf "emopenrectangle") ;(U+25AF WHITE VERTICAL RECTANGLE)
(cl-define-keysym #x0ad0 "leftsinglequotemark") ;U+2018 LEFT SINGLE QUOTATION MARK
(cl-define-keysym #x0ad1 "rightsinglequotemark") ;U+2019 RIGHT SINGLE QUOTATION MARK
(cl-define-keysym #x0ad2 "leftdoublequotemark") ;U+201C LEFT DOUBLE QUOTATION MARK
(cl-define-keysym #x0ad3 "rightdoublequotemark") ;U+201D RIGHT DOUBLE QUOTATION MARK
(cl-define-keysym #x0ad4 "prescription") ;U+211E PRESCRIPTION TAKE
(cl-define-keysym #x0ad6 "minutes") ;U+2032 PRIME
(cl-define-keysym #x0ad7 "seconds") ;U+2033 DOUBLE PRIME
(cl-define-keysym #x0ad9 "latincross") ;U+271D LATIN CROSS
(cl-define-keysym #x0ada "hexagram")
(cl-define-keysym #x0adb "filledrectbullet") ;(U+25AC BLACK RECTANGLE)
(cl-define-keysym #x0adc "filledlefttribullet") ;(U+25C0 BLACK LEFT-POINTING TRIANGLE)
(cl-define-keysym #x0add "filledrighttribullet") ;(U+25B6 BLACK RIGHT-POINTING TRIANGLE)
(cl-define-keysym #x0ade "emfilledcircle") ;(U+25CF BLACK CIRCLE)
(cl-define-keysym #x0adf "emfilledrect") ;(U+25AE BLACK VERTICAL RECTANGLE)
(cl-define-keysym #x0ae0 "enopencircbullet") ;(U+25E6 WHITE BULLET)
(cl-define-keysym #x0ae1 "enopensquarebullet") ;(U+25AB WHITE SMALL SQUARE)
(cl-define-keysym #x0ae2 "openrectbullet") ;(U+25AD WHITE RECTANGLE)
(cl-define-keysym #x0ae3 "opentribulletup") ;(U+25B3 WHITE UP-POINTING TRIANGLE)
(cl-define-keysym #x0ae4 "opentribulletdown") ;(U+25BD WHITE DOWN-POINTING TRIANGLE)
(cl-define-keysym #x0ae5 "openstar") ;(U+2606 WHITE STAR)
(cl-define-keysym #x0ae6 "enfilledcircbullet") ;(U+2022 BULLET)
(cl-define-keysym #x0ae7 "enfilledsqbullet") ;(U+25AA BLACK SMALL SQUARE)
(cl-define-keysym #x0ae8 "filledtribulletup") ;(U+25B2 BLACK UP-POINTING TRIANGLE)
(cl-define-keysym #x0ae9 "filledtribulletdown") ;(U+25BC BLACK DOWN-POINTING TRIANGLE)
(cl-define-keysym #x0aea "leftpointer") ;(U+261C WHITE LEFT POINTING INDEX)
(cl-define-keysym #x0aeb "rightpointer") ;(U+261E WHITE RIGHT POINTING INDEX)
(cl-define-keysym #x0aec "club") ;U+2663 BLACK CLUB SUIT
(cl-define-keysym #x0aed "diamond") ;U+2666 BLACK DIAMOND SUIT
(cl-define-keysym #x0aee "heart") ;U+2665 BLACK HEART SUIT
(cl-define-keysym #x0af0 "maltesecross") ;U+2720 MALTESE CROSS
(cl-define-keysym #x0af1 "dagger") ;U+2020 DAGGER
(cl-define-keysym #x0af2 "doubledagger") ;U+2021 DOUBLE DAGGER
(cl-define-keysym #x0af3 "checkmark") ;U+2713 CHECK MARK
(cl-define-keysym #x0af4 "ballotcross") ;U+2717 BALLOT X
(cl-define-keysym #x0af5 "musicalsharp") ;U+266F MUSIC SHARP SIGN
(cl-define-keysym #x0af6 "musicalflat") ;U+266D MUSIC FLAT SIGN
(cl-define-keysym #x0af7 "malesymbol") ;U+2642 MALE SIGN
(cl-define-keysym #x0af8 "femalesymbol") ;U+2640 FEMALE SIGN
(cl-define-keysym #x0af9 "telephone") ;U+260E BLACK TELEPHONE
(cl-define-keysym #x0afa "telephonerecorder") ;U+2315 TELEPHONE RECORDER
(cl-define-keysym #x0afb "phonographcopyright") ;U+2117 SOUND RECORDING COPYRIGHT
(cl-define-keysym #x0afc "caret") ;U+2038 CARET
(cl-define-keysym #x0afd "singlelowquotemark") ;U+201A SINGLE LOW-9 QUOTATION MARK
(cl-define-keysym #x0afe "doublelowquotemark") ;U+201E DOUBLE LOW-9 QUOTATION MARK
(cl-define-keysym #x0aff "cursor")
(cl-define-keysym #x0ba3 "leftcaret") ;(U+003C LESS-THAN SIGN)
(cl-define-keysym #x0ba6 "rightcaret") ;(U+003E GREATER-THAN SIGN)
(cl-define-keysym #x0ba8 "downcaret") ;(U+2228 LOGICAL OR)
(cl-define-keysym #x0ba9 "upcaret") ;(U+2227 LOGICAL AND)
(cl-define-keysym #x0bc0 "overbar") ;(U+00AF MACRON)
(cl-define-keysym #x0bc2 "downtack") ;U+22A5 UP TACK
(cl-define-keysym #x0bc3 "upshoe") ;(U+2229 INTERSECTION)
(cl-define-keysym #x0bc4 "downstile") ;U+230A LEFT FLOOR
(cl-define-keysym #x0bc6 "underbar") ;(U+005F LOW LINE)
(cl-define-keysym #x0bca "jot") ;U+2218 RING OPERATOR
(cl-define-keysym #x0bcc "quad") ;U+2395 APL FUNCTIONAL SYMBOL QUAD
(cl-define-keysym #x0bce "uptack") ;U+22A4 DOWN TACK
(cl-define-keysym #x0bcf "circle") ;U+25CB WHITE CIRCLE
(cl-define-keysym #x0bd3 "upstile") ;U+2308 LEFT CEILING
(cl-define-keysym #x0bd6 "downshoe") ;(U+222A UNION)
(cl-define-keysym #x0bd8 "rightshoe") ;(U+2283 SUPERSET OF)
(cl-define-keysym #x0bda "leftshoe") ;(U+2282 SUBSET OF)
(cl-define-keysym #x0bdc "lefttack") ;U+22A2 RIGHT TACK
(cl-define-keysym #x0bfc "righttack") ;U+22A3 LEFT TACK
(cl-define-keysym #x0cdf "hebrew_doublelowline") ;U+2017 DOUBLE LOW LINE
(cl-define-keysym #x0ce0 "hebrew_aleph") ;U+05D0 HEBREW LETTER ALEF
(cl-define-keysym #x0ce1 "hebrew_bet") ;U+05D1 HEBREW LETTER BET
(cl-define-keysym #x0ce1 "hebrew_beth") ;deprecated
(cl-define-keysym #x0ce2 "hebrew_gimel") ;U+05D2 HEBREW LETTER GIMEL
(cl-define-keysym #x0ce2 "hebrew_gimmel") ;deprecated
(cl-define-keysym #x0ce3 "hebrew_dalet") ;U+05D3 HEBREW LETTER DALET
(cl-define-keysym #x0ce3 "hebrew_daleth") ;deprecated
(cl-define-keysym #x0ce4 "hebrew_he") ;U+05D4 HEBREW LETTER HE
(cl-define-keysym #x0ce5 "hebrew_waw") ;U+05D5 HEBREW LETTER VAV
(cl-define-keysym #x0ce6 "hebrew_zain") ;U+05D6 HEBREW LETTER ZAYIN
(cl-define-keysym #x0ce6 "hebrew_zayin") ;deprecated
(cl-define-keysym #x0ce7 "hebrew_chet") ;U+05D7 HEBREW LETTER HET
(cl-define-keysym #x0ce7 "hebrew_het") ;deprecated
(cl-define-keysym #x0ce8 "hebrew_tet") ;U+05D8 HEBREW LETTER TET
(cl-define-keysym #x0ce8 "hebrew_teth") ;deprecated
(cl-define-keysym #x0ce9 "hebrew_yod") ;U+05D9 HEBREW LETTER YOD
(cl-define-keysym #x0cea "hebrew_finalkaph") ;U+05DA HEBREW LETTER FINAL KAF
(cl-define-keysym #x0ceb "hebrew_kaph") ;U+05DB HEBREW LETTER KAF
(cl-define-keysym #x0cec "hebrew_lamed") ;U+05DC HEBREW LETTER LAMED
(cl-define-keysym #x0ced "hebrew_finalmem") ;U+05DD HEBREW LETTER FINAL MEM
(cl-define-keysym #x0cee "hebrew_mem") ;U+05DE HEBREW LETTER MEM
(cl-define-keysym #x0cef "hebrew_finalnun") ;U+05DF HEBREW LETTER FINAL NUN
(cl-define-keysym #x0cf0 "hebrew_nun") ;U+05E0 HEBREW LETTER NUN
(cl-define-keysym #x0cf1 "hebrew_samech") ;U+05E1 HEBREW LETTER SAMEKH
(cl-define-keysym #x0cf1 "hebrew_samekh") ;deprecated
(cl-define-keysym #x0cf2 "hebrew_ayin") ;U+05E2 HEBREW LETTER AYIN
(cl-define-keysym #x0cf3 "hebrew_finalpe") ;U+05E3 HEBREW LETTER FINAL PE
(cl-define-keysym #x0cf4 "hebrew_pe") ;U+05E4 HEBREW LETTER PE
(cl-define-keysym #x0cf5 "hebrew_finalzade") ;U+05E5 HEBREW LETTER FINAL TSADI
(cl-define-keysym #x0cf5 "hebrew_finalzadi") ;deprecated
(cl-define-keysym #x0cf6 "hebrew_zade") ;U+05E6 HEBREW LETTER TSADI
(cl-define-keysym #x0cf6 "hebrew_zadi") ;deprecated
(cl-define-keysym #x0cf7 "hebrew_qoph") ;U+05E7 HEBREW LETTER QOF
(cl-define-keysym #x0cf7 "hebrew_kuf") ;deprecated
(cl-define-keysym #x0cf8 "hebrew_resh") ;U+05E8 HEBREW LETTER RESH
(cl-define-keysym #x0cf9 "hebrew_shin") ;U+05E9 HEBREW LETTER SHIN
(cl-define-keysym #x0cfa "hebrew_taw") ;U+05EA HEBREW LETTER TAV
(cl-define-keysym #x0cfa "hebrew_taf") ;deprecated
(cl-define-keysym #xff7e "Hebrew_switch") ;Alias for mode_switch
(cl-define-keysym #x0da1 "Thai_kokai") ;U+0E01 THAI CHARACTER KO KAI
(cl-define-keysym #x0da2 "Thai_khokhai") ;U+0E02 THAI CHARACTER KHO KHAI
(cl-define-keysym #x0da3 "Thai_khokhuat") ;U+0E03 THAI CHARACTER KHO KHUAT
(cl-define-keysym #x0da4 "Thai_khokhwai") ;U+0E04 THAI CHARACTER KHO KHWAI
(cl-define-keysym #x0da5 "Thai_khokhon") ;U+0E05 THAI CHARACTER KHO KHON
(cl-define-keysym #x0da6 "Thai_khorakhang") ;U+0E06 THAI CHARACTER KHO RAKHANG
(cl-define-keysym #x0da7 "Thai_ngongu") ;U+0E07 THAI CHARACTER NGO NGU
(cl-define-keysym #x0da8 "Thai_chochan") ;U+0E08 THAI CHARACTER CHO CHAN
(cl-define-keysym #x0da9 "Thai_choching") ;U+0E09 THAI CHARACTER CHO CHING
(cl-define-keysym #x0daa "Thai_chochang") ;U+0E0A THAI CHARACTER CHO CHANG
(cl-define-keysym #x0dab "Thai_soso") ;U+0E0B THAI CHARACTER SO SO
(cl-define-keysym #x0dac "Thai_chochoe") ;U+0E0C THAI CHARACTER CHO CHOE
(cl-define-keysym #x0dad "Thai_yoying") ;U+0E0D THAI CHARACTER YO YING
(cl-define-keysym #x0dae "Thai_dochada") ;U+0E0E THAI CHARACTER DO CHADA
(cl-define-keysym #x0daf "Thai_topatak") ;U+0E0F THAI CHARACTER TO PATAK
(cl-define-keysym #x0db0 "Thai_thothan") ;U+0E10 THAI CHARACTER THO THAN
(cl-define-keysym #x0db1 "Thai_thonangmontho") ;U+0E11 THAI CHARACTER THO NANGMONTHO
(cl-define-keysym #x0db2 "Thai_thophuthao") ;U+0E12 THAI CHARACTER THO PHUTHAO
(cl-define-keysym #x0db3 "Thai_nonen") ;U+0E13 THAI CHARACTER NO NEN
(cl-define-keysym #x0db4 "Thai_dodek") ;U+0E14 THAI CHARACTER DO DEK
(cl-define-keysym #x0db5 "Thai_totao") ;U+0E15 THAI CHARACTER TO TAO
(cl-define-keysym #x0db6 "Thai_thothung") ;U+0E16 THAI CHARACTER THO THUNG
(cl-define-keysym #x0db7 "Thai_thothahan") ;U+0E17 THAI CHARACTER THO THAHAN
(cl-define-keysym #x0db8 "Thai_thothong") ;U+0E18 THAI CHARACTER THO THONG
(cl-define-keysym #x0db9 "Thai_nonu") ;U+0E19 THAI CHARACTER NO NU
(cl-define-keysym #x0dba "Thai_bobaimai") ;U+0E1A THAI CHARACTER BO BAIMAI
(cl-define-keysym #x0dbb "Thai_popla") ;U+0E1B THAI CHARACTER PO PLA
(cl-define-keysym #x0dbc "Thai_phophung") ;U+0E1C THAI CHARACTER PHO PHUNG
(cl-define-keysym #x0dbd "Thai_fofa") ;U+0E1D THAI CHARACTER FO FA
(cl-define-keysym #x0dbe "Thai_phophan") ;U+0E1E THAI CHARACTER PHO PHAN
(cl-define-keysym #x0dbf "Thai_fofan") ;U+0E1F THAI CHARACTER FO FAN
(cl-define-keysym #x0dc0 "Thai_phosamphao") ;U+0E20 THAI CHARACTER PHO SAMPHAO
(cl-define-keysym #x0dc1 "Thai_moma") ;U+0E21 THAI CHARACTER MO MA
(cl-define-keysym #x0dc2 "Thai_yoyak") ;U+0E22 THAI CHARACTER YO YAK
(cl-define-keysym #x0dc3 "Thai_rorua") ;U+0E23 THAI CHARACTER RO RUA
(cl-define-keysym #x0dc4 "Thai_ru") ;U+0E24 THAI CHARACTER RU
(cl-define-keysym #x0dc5 "Thai_loling") ;U+0E25 THAI CHARACTER LO LING
(cl-define-keysym #x0dc6 "Thai_lu") ;U+0E26 THAI CHARACTER LU
(cl-define-keysym #x0dc7 "Thai_wowaen") ;U+0E27 THAI CHARACTER WO WAEN
(cl-define-keysym #x0dc8 "Thai_sosala") ;U+0E28 THAI CHARACTER SO SALA
(cl-define-keysym #x0dc9 "Thai_sorusi") ;U+0E29 THAI CHARACTER SO RUSI
(cl-define-keysym #x0dca "Thai_sosua") ;U+0E2A THAI CHARACTER SO SUA
(cl-define-keysym #x0dcb "Thai_hohip") ;U+0E2B THAI CHARACTER HO HIP
(cl-define-keysym #x0dcc "Thai_lochula") ;U+0E2C THAI CHARACTER LO CHULA
(cl-define-keysym #x0dcd "Thai_oang") ;U+0E2D THAI CHARACTER O ANG
(cl-define-keysym #x0dce "Thai_honokhuk") ;U+0E2E THAI CHARACTER HO NOKHUK
(cl-define-keysym #x0dcf "Thai_paiyannoi") ;U+0E2F THAI CHARACTER PAIYANNOI
(cl-define-keysym #x0dd0 "Thai_saraa") ;U+0E30 THAI CHARACTER SARA A
(cl-define-keysym #x0dd1 "Thai_maihanakat") ;U+0E31 THAI CHARACTER MAI HAN-AKAT
(cl-define-keysym #x0dd2 "Thai_saraaa") ;U+0E32 THAI CHARACTER SARA AA
(cl-define-keysym #x0dd3 "Thai_saraam") ;U+0E33 THAI CHARACTER SARA AM
(cl-define-keysym #x0dd4 "Thai_sarai") ;U+0E34 THAI CHARACTER SARA I
(cl-define-keysym #x0dd5 "Thai_saraii") ;U+0E35 THAI CHARACTER SARA II
(cl-define-keysym #x0dd6 "Thai_saraue") ;U+0E36 THAI CHARACTER SARA UE
(cl-define-keysym #x0dd7 "Thai_sarauee") ;U+0E37 THAI CHARACTER SARA UEE
(cl-define-keysym #x0dd8 "Thai_sarau") ;U+0E38 THAI CHARACTER SARA U
(cl-define-keysym #x0dd9 "Thai_sarauu") ;U+0E39 THAI CHARACTER SARA UU
(cl-define-keysym #x0dda "Thai_phinthu") ;U+0E3A THAI CHARACTER PHINTHU
(cl-define-keysym #x0dde "Thai_maihanakat_maitho")
(cl-define-keysym #x0ddf "Thai_baht") ;U+0E3F THAI CURRENCY SYMBOL BAHT
(cl-define-keysym #x0de0 "Thai_sarae") ;U+0E40 THAI CHARACTER SARA E
(cl-define-keysym #x0de1 "Thai_saraae") ;U+0E41 THAI CHARACTER SARA AE
(cl-define-keysym #x0de2 "Thai_sarao") ;U+0E42 THAI CHARACTER SARA O
(cl-define-keysym #x0de3 "Thai_saraaimaimuan") ;U+0E43 THAI CHARACTER SARA AI MAIMUAN
(cl-define-keysym #x0de4 "Thai_saraaimaimalai") ;U+0E44 THAI CHARACTER SARA AI MAIMALAI
(cl-define-keysym #x0de5 "Thai_lakkhangyao") ;U+0E45 THAI CHARACTER LAKKHANGYAO
(cl-define-keysym #x0de6 "Thai_maiyamok") ;U+0E46 THAI CHARACTER MAIYAMOK
(cl-define-keysym #x0de7 "Thai_maitaikhu") ;U+0E47 THAI CHARACTER MAITAIKHU
(cl-define-keysym #x0de8 "Thai_maiek") ;U+0E48 THAI CHARACTER MAI EK
(cl-define-keysym #x0de9 "Thai_maitho") ;U+0E49 THAI CHARACTER MAI THO
(cl-define-keysym #x0dea "Thai_maitri") ;U+0E4A THAI CHARACTER MAI TRI
(cl-define-keysym #x0deb "Thai_maichattawa") ;U+0E4B THAI CHARACTER MAI CHATTAWA
(cl-define-keysym #x0dec "Thai_thanthakhat") ;U+0E4C THAI CHARACTER THANTHAKHAT
(cl-define-keysym #x0ded "Thai_nikhahit") ;U+0E4D THAI CHARACTER NIKHAHIT
(cl-define-keysym #x0df0 "Thai_leksun") ;U+0E50 THAI DIGIT ZERO
(cl-define-keysym #x0df1 "Thai_leknung") ;U+0E51 THAI DIGIT ONE
(cl-define-keysym #x0df2 "Thai_leksong") ;U+0E52 THAI DIGIT TWO
(cl-define-keysym #x0df3 "Thai_leksam") ;U+0E53 THAI DIGIT THREE
(cl-define-keysym #x0df4 "Thai_leksi") ;U+0E54 THAI DIGIT FOUR
(cl-define-keysym #x0df5 "Thai_lekha") ;U+0E55 THAI DIGIT FIVE
(cl-define-keysym #x0df6 "Thai_lekhok") ;U+0E56 THAI DIGIT SIX
(cl-define-keysym #x0df7 "Thai_lekchet") ;U+0E57 THAI DIGIT SEVEN
(cl-define-keysym #x0df8 "Thai_lekpaet") ;U+0E58 THAI DIGIT EIGHT
(cl-define-keysym #x0df9 "Thai_lekkao") ;U+0E59 THAI DIGIT NINE
(cl-define-keysym #xff31 "Hangul") ;Hangul start/stop(toggle)
(cl-define-keysym #xff32 "Hangul_Start") ;Hangul start
(cl-define-keysym #xff33 "Hangul_End") ;Hangul end, English start
(cl-define-keysym #xff34 "Hangul_Hanja") ;Start Hangul->Hanja Conversion
(cl-define-keysym #xff35 "Hangul_Jamo") ;Hangul Jamo mode
(cl-define-keysym #xff36 "Hangul_Romaja") ;Hangul Romaja mode
(cl-define-keysym #xff37 "Hangul_Codeinput") ;Hangul code input mode
(cl-define-keysym #xff38 "Hangul_Jeonja") ;Jeonja mode
(cl-define-keysym #xff39 "Hangul_Banja") ;Banja mode
(cl-define-keysym #xff3a "Hangul_PreHanja") ;Pre Hanja conversion
(cl-define-keysym #xff3b "Hangul_PostHanja") ;Post Hanja conversion
(cl-define-keysym #xff3c "Hangul_SingleCandidate") ;Single candidate
(cl-define-keysym #xff3d "Hangul_MultipleCandidate") ;Multiple candidate
(cl-define-keysym #xff3e "Hangul_PreviousCandidate") ;Previous candidate
(cl-define-keysym #xff3f "Hangul_Special") ;Special symbols
(cl-define-keysym #xff7e "Hangul_switch") ;Alias for mode_switch
(cl-define-keysym #x0ea1 "Hangul_Kiyeog")
(cl-define-keysym #x0ea2 "Hangul_SsangKiyeog")
(cl-define-keysym #x0ea3 "Hangul_KiyeogSios")
(cl-define-keysym #x0ea4 "Hangul_Nieun")
(cl-define-keysym #x0ea5 "Hangul_NieunJieuj")
(cl-define-keysym #x0ea6 "Hangul_NieunHieuh")
(cl-define-keysym #x0ea7 "Hangul_Dikeud")
(cl-define-keysym #x0ea8 "Hangul_SsangDikeud")
(cl-define-keysym #x0ea9 "Hangul_Rieul")
(cl-define-keysym #x0eaa "Hangul_RieulKiyeog")
(cl-define-keysym #x0eab "Hangul_RieulMieum")
(cl-define-keysym #x0eac "Hangul_RieulPieub")
(cl-define-keysym #x0ead "Hangul_RieulSios")
(cl-define-keysym #x0eae "Hangul_RieulTieut")
(cl-define-keysym #x0eaf "Hangul_RieulPhieuf")
(cl-define-keysym #x0eb0 "Hangul_RieulHieuh")
(cl-define-keysym #x0eb1 "Hangul_Mieum")
(cl-define-keysym #x0eb2 "Hangul_Pieub")
(cl-define-keysym #x0eb3 "Hangul_SsangPieub")
(cl-define-keysym #x0eb4 "Hangul_PieubSios")
(cl-define-keysym #x0eb5 "Hangul_Sios")
(cl-define-keysym #x0eb6 "Hangul_SsangSios")
(cl-define-keysym #x0eb7 "Hangul_Ieung")
(cl-define-keysym #x0eb8 "Hangul_Jieuj")
(cl-define-keysym #x0eb9 "Hangul_SsangJieuj")
(cl-define-keysym #x0eba "Hangul_Cieuc")
(cl-define-keysym #x0ebb "Hangul_Khieuq")
(cl-define-keysym #x0ebc "Hangul_Tieut")
(cl-define-keysym #x0ebd "Hangul_Phieuf")
(cl-define-keysym #x0ebe "Hangul_Hieuh")
(cl-define-keysym #x0ebf "Hangul_A")
(cl-define-keysym #x0ec0 "Hangul_AE")
(cl-define-keysym #x0ec1 "Hangul_YA")
(cl-define-keysym #x0ec2 "Hangul_YAE")
(cl-define-keysym #x0ec3 "Hangul_EO")
(cl-define-keysym #x0ec4 "Hangul_E")
(cl-define-keysym #x0ec5 "Hangul_YEO")
(cl-define-keysym #x0ec6 "Hangul_YE")
(cl-define-keysym #x0ec7 "Hangul_O")
(cl-define-keysym #x0ec8 "Hangul_WA")
(cl-define-keysym #x0ec9 "Hangul_WAE")
(cl-define-keysym #x0eca "Hangul_OE")
(cl-define-keysym #x0ecb "Hangul_YO")
(cl-define-keysym #x0ecc "Hangul_U")
(cl-define-keysym #x0ecd "Hangul_WEO")
(cl-define-keysym #x0ece "Hangul_WE")
(cl-define-keysym #x0ecf "Hangul_WI")
(cl-define-keysym #x0ed0 "Hangul_YU")
(cl-define-keysym #x0ed1 "Hangul_EU")
(cl-define-keysym #x0ed2 "Hangul_YI")
(cl-define-keysym #x0ed3 "Hangul_I")
(cl-define-keysym #x0ed4 "Hangul_J_Kiyeog")
(cl-define-keysym #x0ed5 "Hangul_J_SsangKiyeog")
(cl-define-keysym #x0ed6 "Hangul_J_KiyeogSios")
(cl-define-keysym #x0ed7 "Hangul_J_Nieun")
(cl-define-keysym #x0ed8 "Hangul_J_NieunJieuj")
(cl-define-keysym #x0ed9 "Hangul_J_NieunHieuh")
(cl-define-keysym #x0eda "Hangul_J_Dikeud")
(cl-define-keysym #x0edb "Hangul_J_Rieul")
(cl-define-keysym #x0edc "Hangul_J_RieulKiyeog")
(cl-define-keysym #x0edd "Hangul_J_RieulMieum")
(cl-define-keysym #x0ede "Hangul_J_RieulPieub")
(cl-define-keysym #x0edf "Hangul_J_RieulSios")
(cl-define-keysym #x0ee0 "Hangul_J_RieulTieut")
(cl-define-keysym #x0ee1 "Hangul_J_RieulPhieuf")
(cl-define-keysym #x0ee2 "Hangul_J_RieulHieuh")
(cl-define-keysym #x0ee3 "Hangul_J_Mieum")
(cl-define-keysym #x0ee4 "Hangul_J_Pieub")
(cl-define-keysym #x0ee5 "Hangul_J_PieubSios")
(cl-define-keysym #x0ee6 "Hangul_J_Sios")
(cl-define-keysym #x0ee7 "Hangul_J_SsangSios")
(cl-define-keysym #x0ee8 "Hangul_J_Ieung")
(cl-define-keysym #x0ee9 "Hangul_J_Jieuj")
(cl-define-keysym #x0eea "Hangul_J_Cieuc")
(cl-define-keysym #x0eeb "Hangul_J_Khieuq")
(cl-define-keysym #x0eec "Hangul_J_Tieut")
(cl-define-keysym #x0eed "Hangul_J_Phieuf")
(cl-define-keysym #x0eee "Hangul_J_Hieuh")
(cl-define-keysym #x0eef "Hangul_RieulYeorinHieuh")
(cl-define-keysym #x0ef0 "Hangul_SunkyeongeumMieum")
(cl-define-keysym #x0ef1 "Hangul_SunkyeongeumPieub")
(cl-define-keysym #x0ef2 "Hangul_PanSios")
(cl-define-keysym #x0ef3 "Hangul_KkogjiDalrinIeung")
(cl-define-keysym #x0ef4 "Hangul_SunkyeongeumPhieuf")
(cl-define-keysym #x0ef5 "Hangul_YeorinHieuh")
(cl-define-keysym #x0ef6 "Hangul_AraeA")
(cl-define-keysym #x0ef7 "Hangul_AraeAE")
(cl-define-keysym #x0ef8 "Hangul_J_PanSios")
(cl-define-keysym #x0ef9 "Hangul_J_KkogjiDalrinIeung")
(cl-define-keysym #x0efa "Hangul_J_YeorinHieuh")
(cl-define-keysym #x0eff "Korean_Won") ;(U+20A9 WON SIGN)
(cl-define-keysym #x1000587 "Armenian_ligature_ew") ;U+0587 ARMENIAN SMALL LIGATURE ECH YIWN
(cl-define-keysym #x1000589 "Armenian_full_stop") ;U+0589 ARMENIAN FULL STOP
(cl-define-keysym #x1000589 "Armenian_verjaket") ;U+0589 ARMENIAN FULL STOP
(cl-define-keysym #x100055d "Armenian_separation_mark") ;U+055D ARMENIAN COMMA
(cl-define-keysym #x100055d "Armenian_but") ;U+055D ARMENIAN COMMA
(cl-define-keysym #x100058a "Armenian_hyphen") ;U+058A ARMENIAN HYPHEN
(cl-define-keysym #x100058a "Armenian_yentamna") ;U+058A ARMENIAN HYPHEN
(cl-define-keysym #x100055c "Armenian_exclam") ;U+055C ARMENIAN EXCLAMATION MARK
(cl-define-keysym #x100055c "Armenian_amanak") ;U+055C ARMENIAN EXCLAMATION MARK
(cl-define-keysym #x100055b "Armenian_accent") ;U+055B ARMENIAN EMPHASIS MARK
(cl-define-keysym #x100055b "Armenian_shesht") ;U+055B ARMENIAN EMPHASIS MARK
(cl-define-keysym #x100055e "Armenian_question") ;U+055E ARMENIAN QUESTION MARK
(cl-define-keysym #x100055e "Armenian_paruyk") ;U+055E ARMENIAN QUESTION MARK
(cl-define-keysym #x1000531 "Armenian_AYB") ;U+0531 ARMENIAN CAPITAL LETTER AYB
(cl-define-keysym #x1000561 "Armenian_ayb") ;U+0561 ARMENIAN SMALL LETTER AYB
(cl-define-keysym #x1000532 "Armenian_BEN") ;U+0532 ARMENIAN CAPITAL LETTER BEN
(cl-define-keysym #x1000562 "Armenian_ben") ;U+0562 ARMENIAN SMALL LETTER BEN
(cl-define-keysym #x1000533 "Armenian_GIM") ;U+0533 ARMENIAN CAPITAL LETTER GIM
(cl-define-keysym #x1000563 "Armenian_gim") ;U+0563 ARMENIAN SMALL LETTER GIM
(cl-define-keysym #x1000534 "Armenian_DA") ;U+0534 ARMENIAN CAPITAL LETTER DA
(cl-define-keysym #x1000564 "Armenian_da") ;U+0564 ARMENIAN SMALL LETTER DA
(cl-define-keysym #x1000535 "Armenian_YECH") ;U+0535 ARMENIAN CAPITAL LETTER ECH
(cl-define-keysym #x1000565 "Armenian_yech") ;U+0565 ARMENIAN SMALL LETTER ECH
(cl-define-keysym #x1000536 "Armenian_ZA") ;U+0536 ARMENIAN CAPITAL LETTER ZA
(cl-define-keysym #x1000566 "Armenian_za") ;U+0566 ARMENIAN SMALL LETTER ZA
(cl-define-keysym #x1000537 "Armenian_E") ;U+0537 ARMENIAN CAPITAL LETTER EH
(cl-define-keysym #x1000567 "Armenian_e") ;U+0567 ARMENIAN SMALL LETTER EH
(cl-define-keysym #x1000538 "Armenian_AT") ;U+0538 ARMENIAN CAPITAL LETTER ET
(cl-define-keysym #x1000568 "Armenian_at") ;U+0568 ARMENIAN SMALL LETTER ET
(cl-define-keysym #x1000539 "Armenian_TO") ;U+0539 ARMENIAN CAPITAL LETTER TO
(cl-define-keysym #x1000569 "Armenian_to") ;U+0569 ARMENIAN SMALL LETTER TO
(cl-define-keysym #x100053a "Armenian_ZHE") ;U+053A ARMENIAN CAPITAL LETTER ZHE
(cl-define-keysym #x100056a "Armenian_zhe") ;U+056A ARMENIAN SMALL LETTER ZHE
(cl-define-keysym #x100053b "Armenian_INI") ;U+053B ARMENIAN CAPITAL LETTER INI
(cl-define-keysym #x100056b "Armenian_ini") ;U+056B ARMENIAN SMALL LETTER INI
(cl-define-keysym #x100053c "Armenian_LYUN") ;U+053C ARMENIAN CAPITAL LETTER LIWN
(cl-define-keysym #x100056c "Armenian_lyun") ;U+056C ARMENIAN SMALL LETTER LIWN
(cl-define-keysym #x100053d "Armenian_KHE") ;U+053D ARMENIAN CAPITAL LETTER XEH
(cl-define-keysym #x100056d "Armenian_khe") ;U+056D ARMENIAN SMALL LETTER XEH
(cl-define-keysym #x100053e "Armenian_TSA") ;U+053E ARMENIAN CAPITAL LETTER CA
(cl-define-keysym #x100056e "Armenian_tsa") ;U+056E ARMENIAN SMALL LETTER CA
(cl-define-keysym #x100053f "Armenian_KEN") ;U+053F ARMENIAN CAPITAL LETTER KEN
(cl-define-keysym #x100056f "Armenian_ken") ;U+056F ARMENIAN SMALL LETTER KEN
(cl-define-keysym #x1000540 "Armenian_HO") ;U+0540 ARMENIAN CAPITAL LETTER HO
(cl-define-keysym #x1000570 "Armenian_ho") ;U+0570 ARMENIAN SMALL LETTER HO
(cl-define-keysym #x1000541 "Armenian_DZA") ;U+0541 ARMENIAN CAPITAL LETTER JA
(cl-define-keysym #x1000571 "Armenian_dza") ;U+0571 ARMENIAN SMALL LETTER JA
(cl-define-keysym #x1000542 "Armenian_GHAT") ;U+0542 ARMENIAN CAPITAL LETTER GHAD
(cl-define-keysym #x1000572 "Armenian_ghat") ;U+0572 ARMENIAN SMALL LETTER GHAD
(cl-define-keysym #x1000543 "Armenian_TCHE") ;U+0543 ARMENIAN CAPITAL LETTER CHEH
(cl-define-keysym #x1000573 "Armenian_tche") ;U+0573 ARMENIAN SMALL LETTER CHEH
(cl-define-keysym #x1000544 "Armenian_MEN") ;U+0544 ARMENIAN CAPITAL LETTER MEN
(cl-define-keysym #x1000574 "Armenian_men") ;U+0574 ARMENIAN SMALL LETTER MEN
(cl-define-keysym #x1000545 "Armenian_HI") ;U+0545 ARMENIAN CAPITAL LETTER YI
(cl-define-keysym #x1000575 "Armenian_hi") ;U+0575 ARMENIAN SMALL LETTER YI
(cl-define-keysym #x1000546 "Armenian_NU") ;U+0546 ARMENIAN CAPITAL LETTER NOW
(cl-define-keysym #x1000576 "Armenian_nu") ;U+0576 ARMENIAN SMALL LETTER NOW
(cl-define-keysym #x1000547 "Armenian_SHA") ;U+0547 ARMENIAN CAPITAL LETTER SHA
(cl-define-keysym #x1000577 "Armenian_sha") ;U+0577 ARMENIAN SMALL LETTER SHA
(cl-define-keysym #x1000548 "Armenian_VO") ;U+0548 ARMENIAN CAPITAL LETTER VO
(cl-define-keysym #x1000578 "Armenian_vo") ;U+0578 ARMENIAN SMALL LETTER VO
(cl-define-keysym #x1000549 "Armenian_CHA") ;U+0549 ARMENIAN CAPITAL LETTER CHA
(cl-define-keysym #x1000579 "Armenian_cha") ;U+0579 ARMENIAN SMALL LETTER CHA
(cl-define-keysym #x100054a "Armenian_PE") ;U+054A ARMENIAN CAPITAL LETTER PEH
(cl-define-keysym #x100057a "Armenian_pe") ;U+057A ARMENIAN SMALL LETTER PEH
(cl-define-keysym #x100054b "Armenian_JE") ;U+054B ARMENIAN CAPITAL LETTER JHEH
(cl-define-keysym #x100057b "Armenian_je") ;U+057B ARMENIAN SMALL LETTER JHEH
(cl-define-keysym #x100054c "Armenian_RA") ;U+054C ARMENIAN CAPITAL LETTER RA
(cl-define-keysym #x100057c "Armenian_ra") ;U+057C ARMENIAN SMALL LETTER RA
(cl-define-keysym #x100054d "Armenian_SE") ;U+054D ARMENIAN CAPITAL LETTER SEH
(cl-define-keysym #x100057d "Armenian_se") ;U+057D ARMENIAN SMALL LETTER SEH
(cl-define-keysym #x100054e "Armenian_VEV") ;U+054E ARMENIAN CAPITAL LETTER VEW
(cl-define-keysym #x100057e "Armenian_vev") ;U+057E ARMENIAN SMALL LETTER VEW
(cl-define-keysym #x100054f "Armenian_TYUN") ;U+054F ARMENIAN CAPITAL LETTER TIWN
(cl-define-keysym #x100057f "Armenian_tyun") ;U+057F ARMENIAN SMALL LETTER TIWN
(cl-define-keysym #x1000550 "Armenian_RE") ;U+0550 ARMENIAN CAPITAL LETTER REH
(cl-define-keysym #x1000580 "Armenian_re") ;U+0580 ARMENIAN SMALL LETTER REH
(cl-define-keysym #x1000551 "Armenian_TSO") ;U+0551 ARMENIAN CAPITAL LETTER CO
(cl-define-keysym #x1000581 "Armenian_tso") ;U+0581 ARMENIAN SMALL LETTER CO
(cl-define-keysym #x1000552 "Armenian_VYUN") ;U+0552 ARMENIAN CAPITAL LETTER YIWN
(cl-define-keysym #x1000582 "Armenian_vyun") ;U+0582 ARMENIAN SMALL LETTER YIWN
(cl-define-keysym #x1000553 "Armenian_PYUR") ;U+0553 ARMENIAN CAPITAL LETTER PIWR
(cl-define-keysym #x1000583 "Armenian_pyur") ;U+0583 ARMENIAN SMALL LETTER PIWR
(cl-define-keysym #x1000554 "Armenian_KE") ;U+0554 ARMENIAN CAPITAL LETTER KEH
(cl-define-keysym #x1000584 "Armenian_ke") ;U+0584 ARMENIAN SMALL LETTER KEH
(cl-define-keysym #x1000555 "Armenian_O") ;U+0555 ARMENIAN CAPITAL LETTER OH
(cl-define-keysym #x1000585 "Armenian_o") ;U+0585 ARMENIAN SMALL LETTER OH
(cl-define-keysym #x1000556 "Armenian_FE") ;U+0556 ARMENIAN CAPITAL LETTER FEH
(cl-define-keysym #x1000586 "Armenian_fe") ;U+0586 ARMENIAN SMALL LETTER FEH
(cl-define-keysym #x100055a "Armenian_apostrophe") ;U+055A ARMENIAN APOSTROPHE
(cl-define-keysym #x10010d0 "Georgian_an") ;U+10D0 GEORGIAN LETTER AN
(cl-define-keysym #x10010d1 "Georgian_ban") ;U+10D1 GEORGIAN LETTER BAN
(cl-define-keysym #x10010d2 "Georgian_gan") ;U+10D2 GEORGIAN LETTER GAN
(cl-define-keysym #x10010d3 "Georgian_don") ;U+10D3 GEORGIAN LETTER DON
(cl-define-keysym #x10010d4 "Georgian_en") ;U+10D4 GEORGIAN LETTER EN
(cl-define-keysym #x10010d5 "Georgian_vin") ;U+10D5 GEORGIAN LETTER VIN
(cl-define-keysym #x10010d6 "Georgian_zen") ;U+10D6 GEORGIAN LETTER ZEN
(cl-define-keysym #x10010d7 "Georgian_tan") ;U+10D7 GEORGIAN LETTER TAN
(cl-define-keysym #x10010d8 "Georgian_in") ;U+10D8 GEORGIAN LETTER IN
(cl-define-keysym #x10010d9 "Georgian_kan") ;U+10D9 GEORGIAN LETTER KAN
(cl-define-keysym #x10010da "Georgian_las") ;U+10DA GEORGIAN LETTER LAS
(cl-define-keysym #x10010db "Georgian_man") ;U+10DB GEORGIAN LETTER MAN
(cl-define-keysym #x10010dc "Georgian_nar") ;U+10DC GEORGIAN LETTER NAR
(cl-define-keysym #x10010dd "Georgian_on") ;U+10DD GEORGIAN LETTER ON
(cl-define-keysym #x10010de "Georgian_par") ;U+10DE GEORGIAN LETTER PAR
(cl-define-keysym #x10010df "Georgian_zhar") ;U+10DF GEORGIAN LETTER ZHAR
(cl-define-keysym #x10010e0 "Georgian_rae") ;U+10E0 GEORGIAN LETTER RAE
(cl-define-keysym #x10010e1 "Georgian_san") ;U+10E1 GEORGIAN LETTER SAN
(cl-define-keysym #x10010e2 "Georgian_tar") ;U+10E2 GEORGIAN LETTER TAR
(cl-define-keysym #x10010e3 "Georgian_un") ;U+10E3 GEORGIAN LETTER UN
(cl-define-keysym #x10010e4 "Georgian_phar") ;U+10E4 GEORGIAN LETTER PHAR
(cl-define-keysym #x10010e5 "Georgian_khar") ;U+10E5 GEORGIAN LETTER KHAR
(cl-define-keysym #x10010e6 "Georgian_ghan") ;U+10E6 GEORGIAN LETTER GHAN
(cl-define-keysym #x10010e7 "Georgian_qar") ;U+10E7 GEORGIAN LETTER QAR
(cl-define-keysym #x10010e8 "Georgian_shin") ;U+10E8 GEORGIAN LETTER SHIN
(cl-define-keysym #x10010e9 "Georgian_chin") ;U+10E9 GEORGIAN LETTER CHIN
(cl-define-keysym #x10010ea "Georgian_can") ;U+10EA GEORGIAN LETTER CAN
(cl-define-keysym #x10010eb "Georgian_jil") ;U+10EB GEORGIAN LETTER JIL
(cl-define-keysym #x10010ec "Georgian_cil") ;U+10EC GEORGIAN LETTER CIL
(cl-define-keysym #x10010ed "Georgian_char") ;U+10ED GEORGIAN LETTER CHAR
(cl-define-keysym #x10010ee "Georgian_xan") ;U+10EE GEORGIAN LETTER XAN
(cl-define-keysym #x10010ef "Georgian_jhan") ;U+10EF GEORGIAN LETTER JHAN
(cl-define-keysym #x10010f0 "Georgian_hae") ;U+10F0 GEORGIAN LETTER HAE
(cl-define-keysym #x10010f1 "Georgian_he") ;U+10F1 GEORGIAN LETTER HE
(cl-define-keysym #x10010f2 "Georgian_hie") ;U+10F2 GEORGIAN LETTER HIE
(cl-define-keysym #x10010f3 "Georgian_we") ;U+10F3 GEORGIAN LETTER WE
(cl-define-keysym #x10010f4 "Georgian_har") ;U+10F4 GEORGIAN LETTER HAR
(cl-define-keysym #x10010f5 "Georgian_hoe") ;U+10F5 GEORGIAN LETTER HOE
(cl-define-keysym #x10010f6 "Georgian_fi") ;U+10F6 GEORGIAN LETTER FI
(cl-define-keysym #x1001e8a "Xabovedot") ;U+1E8A LATIN CAPITAL LETTER X WITH DOT ABOVE
(cl-define-keysym #x100012c "Ibreve") ;U+012C LATIN CAPITAL LETTER I WITH BREVE
(cl-define-keysym #x10001b5 "Zstroke") ;U+01B5 LATIN CAPITAL LETTER Z WITH STROKE
(cl-define-keysym #x10001e6 "Gcaron") ;U+01E6 LATIN CAPITAL LETTER G WITH CARON
(cl-define-keysym #x10001d1 "Ocaron") ;U+01D2 LATIN CAPITAL LETTER O WITH CARON
(cl-define-keysym #x100019f "Obarred") ;U+019F LATIN CAPITAL LETTER O WITH MIDDLE TILDE
(cl-define-keysym #x1001e8b "xabovedot") ;U+1E8B LATIN SMALL LETTER X WITH DOT ABOVE
(cl-define-keysym #x100012d "ibreve") ;U+012D LATIN SMALL LETTER I WITH BREVE
(cl-define-keysym #x10001b6 "zstroke") ;U+01B6 LATIN SMALL LETTER Z WITH STROKE
(cl-define-keysym #x10001e7 "gcaron") ;U+01E7 LATIN SMALL LETTER G WITH CARON
(cl-define-keysym #x10001d2 "ocaron") ;U+01D2 LATIN SMALL LETTER O WITH CARON
(cl-define-keysym #x1000275 "obarred") ;U+0275 LATIN SMALL LETTER BARRED O
(cl-define-keysym #x100018f "SCHWA") ;U+018F LATIN CAPITAL LETTER SCHWA
(cl-define-keysym #x1000259 "schwa") ;U+0259 LATIN SMALL LETTER SCHWA
(cl-define-keysym #x1001e36 "Lbelowdot") ;U+1E36 LATIN CAPITAL LETTER L WITH DOT BELOW
(cl-define-keysym #x1001e37 "lbelowdot") ;U+1E37 LATIN SMALL LETTER L WITH DOT BELOW
(cl-define-keysym #x1001ea0 "Abelowdot") ;U+1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW
(cl-define-keysym #x1001ea1 "abelowdot") ;U+1EA1 LATIN SMALL LETTER A WITH DOT BELOW
(cl-define-keysym #x1001ea2 "Ahook") ;U+1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE
(cl-define-keysym #x1001ea3 "ahook") ;U+1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE
(cl-define-keysym #x1001ea4 "Acircumflexacute") ;U+1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE
(cl-define-keysym #x1001ea5 "acircumflexacute") ;U+1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE
(cl-define-keysym #x1001ea6 "Acircumflexgrave") ;U+1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE
(cl-define-keysym #x1001ea7 "acircumflexgrave") ;U+1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE
(cl-define-keysym #x1001ea8 "Acircumflexhook") ;U+1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE
(cl-define-keysym #x1001ea9 "acircumflexhook") ;U+1EA9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE
(cl-define-keysym #x1001eaa "Acircumflextilde") ;U+1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE
(cl-define-keysym #x1001eab "acircumflextilde") ;U+1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE
(cl-define-keysym #x1001eac "Acircumflexbelowdot") ;U+1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW
(cl-define-keysym #x1001ead "acircumflexbelowdot") ;U+1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW
(cl-define-keysym #x1001eae "Abreveacute") ;U+1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE
(cl-define-keysym #x1001eaf "abreveacute") ;U+1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE
(cl-define-keysym #x1001eb0 "Abrevegrave") ;U+1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE
(cl-define-keysym #x1001eb1 "abrevegrave") ;U+1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE
(cl-define-keysym #x1001eb2 "Abrevehook") ;U+1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE
(cl-define-keysym #x1001eb3 "abrevehook") ;U+1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE
(cl-define-keysym #x1001eb4 "Abrevetilde") ;U+1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE
(cl-define-keysym #x1001eb5 "abrevetilde") ;U+1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE
(cl-define-keysym #x1001eb6 "Abrevebelowdot") ;U+1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW
(cl-define-keysym #x1001eb7 "abrevebelowdot") ;U+1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW
(cl-define-keysym #x1001eb8 "Ebelowdot") ;U+1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW
(cl-define-keysym #x1001eb9 "ebelowdot") ;U+1EB9 LATIN SMALL LETTER E WITH DOT BELOW
(cl-define-keysym #x1001eba "Ehook") ;U+1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE
(cl-define-keysym #x1001ebb "ehook") ;U+1EBB LATIN SMALL LETTER E WITH HOOK ABOVE
(cl-define-keysym #x1001ebc "Etilde") ;U+1EBC LATIN CAPITAL LETTER E WITH TILDE
(cl-define-keysym #x1001ebd "etilde") ;U+1EBD LATIN SMALL LETTER E WITH TILDE
(cl-define-keysym #x1001ebe "Ecircumflexacute") ;U+1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE
(cl-define-keysym #x1001ebf "ecircumflexacute") ;U+1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE
(cl-define-keysym #x1001ec0 "Ecircumflexgrave") ;U+1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE
(cl-define-keysym #x1001ec1 "ecircumflexgrave") ;U+1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE
(cl-define-keysym #x1001ec2 "Ecircumflexhook") ;U+1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE
(cl-define-keysym #x1001ec3 "ecircumflexhook") ;U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE
(cl-define-keysym #x1001ec4 "Ecircumflextilde") ;U+1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE
(cl-define-keysym #x1001ec5 "ecircumflextilde") ;U+1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE
(cl-define-keysym #x1001ec6 "Ecircumflexbelowdot") ;U+1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW
(cl-define-keysym #x1001ec7 "ecircumflexbelowdot") ;U+1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW
(cl-define-keysym #x1001ec8 "Ihook") ;U+1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE
(cl-define-keysym #x1001ec9 "ihook") ;U+1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE
(cl-define-keysym #x1001eca "Ibelowdot") ;U+1ECA LATIN CAPITAL LETTER I WITH DOT BELOW
(cl-define-keysym #x1001ecb "ibelowdot") ;U+1ECB LATIN SMALL LETTER I WITH DOT BELOW
(cl-define-keysym #x1001ecc "Obelowdot") ;U+1ECC LATIN CAPITAL LETTER O WITH DOT BELOW
(cl-define-keysym #x1001ecd "obelowdot") ;U+1ECD LATIN SMALL LETTER O WITH DOT BELOW
(cl-define-keysym #x1001ece "Ohook") ;U+1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE
(cl-define-keysym #x1001ecf "ohook") ;U+1ECF LATIN SMALL LETTER O WITH HOOK ABOVE
(cl-define-keysym #x1001ed0 "Ocircumflexacute") ;U+1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE
(cl-define-keysym #x1001ed1 "ocircumflexacute") ;U+1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE
(cl-define-keysym #x1001ed2 "Ocircumflexgrave") ;U+1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE
(cl-define-keysym #x1001ed3 "ocircumflexgrave") ;U+1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE
(cl-define-keysym #x1001ed4 "Ocircumflexhook") ;U+1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE
(cl-define-keysym #x1001ed5 "ocircumflexhook") ;U+1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE
(cl-define-keysym #x1001ed6 "Ocircumflextilde") ;U+1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE
(cl-define-keysym #x1001ed7 "ocircumflextilde") ;U+1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE
(cl-define-keysym #x1001ed8 "Ocircumflexbelowdot") ;U+1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW
(cl-define-keysym #x1001ed9 "ocircumflexbelowdot") ;U+1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW
(cl-define-keysym #x1001eda "Ohornacute") ;U+1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE
(cl-define-keysym #x1001edb "ohornacute") ;U+1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE
(cl-define-keysym #x1001edc "Ohorngrave") ;U+1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE
(cl-define-keysym #x1001edd "ohorngrave") ;U+1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE
(cl-define-keysym #x1001ede "Ohornhook") ;U+1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE
(cl-define-keysym #x1001edf "ohornhook") ;U+1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE
(cl-define-keysym #x1001ee0 "Ohorntilde") ;U+1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE
(cl-define-keysym #x1001ee1 "ohorntilde") ;U+1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE
(cl-define-keysym #x1001ee2 "Ohornbelowdot") ;U+1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW
(cl-define-keysym #x1001ee3 "ohornbelowdot") ;U+1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW
(cl-define-keysym #x1001ee4 "Ubelowdot") ;U+1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW
(cl-define-keysym #x1001ee5 "ubelowdot") ;U+1EE5 LATIN SMALL LETTER U WITH DOT BELOW
(cl-define-keysym #x1001ee6 "Uhook") ;U+1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE
(cl-define-keysym #x1001ee7 "uhook") ;U+1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE
(cl-define-keysym #x1001ee8 "Uhornacute") ;U+1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE
(cl-define-keysym #x1001ee9 "uhornacute") ;U+1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE
(cl-define-keysym #x1001eea "Uhorngrave") ;U+1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE
(cl-define-keysym #x1001eeb "uhorngrave") ;U+1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE
(cl-define-keysym #x1001eec "Uhornhook") ;U+1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE
(cl-define-keysym #x1001eed "uhornhook") ;U+1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE
(cl-define-keysym #x1001eee "Uhorntilde") ;U+1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE
(cl-define-keysym #x1001eef "uhorntilde") ;U+1EEF LATIN SMALL LETTER U WITH HORN AND TILDE
(cl-define-keysym #x1001ef0 "Uhornbelowdot") ;U+1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW
(cl-define-keysym #x1001ef1 "uhornbelowdot") ;U+1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW
(cl-define-keysym #x1001ef4 "Ybelowdot") ;U+1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW
(cl-define-keysym #x1001ef5 "ybelowdot") ;U+1EF5 LATIN SMALL LETTER Y WITH DOT BELOW
(cl-define-keysym #x1001ef6 "Yhook") ;U+1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE
(cl-define-keysym #x1001ef7 "yhook") ;U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE
(cl-define-keysym #x1001ef8 "Ytilde") ;U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE
(cl-define-keysym #x1001ef9 "ytilde") ;U+1EF9 LATIN SMALL LETTER Y WITH TILDE
(cl-define-keysym #x10001a0 "Ohorn") ;U+01A0 LATIN CAPITAL LETTER O WITH HORN
(cl-define-keysym #x10001a1 "ohorn") ;U+01A1 LATIN SMALL LETTER O WITH HORN
(cl-define-keysym #x10001af "Uhorn") ;U+01AF LATIN CAPITAL LETTER U WITH HORN
(cl-define-keysym #x10001b0 "uhorn") ;U+01B0 LATIN SMALL LETTER U WITH HORN
(cl-define-keysym #x10020a0 "EcuSign") ;U+20A0 EURO-CURRENCY SIGN
(cl-define-keysym #x10020a1 "ColonSign") ;U+20A1 COLON SIGN
(cl-define-keysym #x10020a2 "CruzeiroSign") ;U+20A2 CRUZEIRO SIGN
(cl-define-keysym #x10020a3 "FFrancSign") ;U+20A3 FRENCH FRANC SIGN
(cl-define-keysym #x10020a4 "LiraSign") ;U+20A4 LIRA SIGN
(cl-define-keysym #x10020a5 "MillSign") ;U+20A5 MILL SIGN
(cl-define-keysym #x10020a6 "NairaSign") ;U+20A6 NAIRA SIGN
(cl-define-keysym #x10020a7 "PesetaSign") ;U+20A7 PESETA SIGN
(cl-define-keysym #x10020a8 "RupeeSign") ;U+20A8 RUPEE SIGN
(cl-define-keysym #x10020a9 "WonSign") ;U+20A9 WON SIGN
(cl-define-keysym #x10020aa "NewSheqelSign") ;U+20AA NEW SHEQEL SIGN
(cl-define-keysym #x10020ab "DongSign") ;U+20AB DONG SIGN
(cl-define-keysym #x20ac "EuroSign") ;U+20AC EURO SIGN
(cl-define-keysym #x1002070 "zerosuperior") ;U+2070 SUPERSCRIPT ZERO
(cl-define-keysym #x1002074 "foursuperior") ;U+2074 SUPERSCRIPT FOUR
(cl-define-keysym #x1002075 "fivesuperior") ;U+2075 SUPERSCRIPT FIVE
(cl-define-keysym #x1002076 "sixsuperior") ;U+2076 SUPERSCRIPT SIX
(cl-define-keysym #x1002077 "sevensuperior") ;U+2077 SUPERSCRIPT SEVEN
(cl-define-keysym #x1002078 "eightsuperior") ;U+2078 SUPERSCRIPT EIGHT
(cl-define-keysym #x1002079 "ninesuperior") ;U+2079 SUPERSCRIPT NINE
(cl-define-keysym #x1002080 "zerosubscript") ;U+2080 SUBSCRIPT ZERO
(cl-define-keysym #x1002081 "onesubscript") ;U+2081 SUBSCRIPT ONE
(cl-define-keysym #x1002082 "twosubscript") ;U+2082 SUBSCRIPT TWO
(cl-define-keysym #x1002083 "threesubscript") ;U+2083 SUBSCRIPT THREE
(cl-define-keysym #x1002084 "foursubscript") ;U+2084 SUBSCRIPT FOUR
(cl-define-keysym #x1002085 "fivesubscript") ;U+2085 SUBSCRIPT FIVE
(cl-define-keysym #x1002086 "sixsubscript") ;U+2086 SUBSCRIPT SIX
(cl-define-keysym #x1002087 "sevensubscript") ;U+2087 SUBSCRIPT SEVEN
(cl-define-keysym #x1002088 "eightsubscript") ;U+2088 SUBSCRIPT EIGHT
(cl-define-keysym #x1002089 "ninesubscript") ;U+2089 SUBSCRIPT NINE
(cl-define-keysym #x1002202 "partdifferential") ;U+2202 PARTIAL DIFFERENTIAL
(cl-define-keysym #x1002205 "emptyset") ;U+2205 NULL SET
(cl-define-keysym #x1002208 "elementof") ;U+2208 ELEMENT OF
(cl-define-keysym #x1002209 "notelementof") ;U+2209 NOT AN ELEMENT OF
(cl-define-keysym #x100220B "containsas") ;U+220B CONTAINS AS MEMBER
(cl-define-keysym #x100221A "squareroot") ;U+221A SQUARE ROOT
(cl-define-keysym #x100221B "cuberoot") ;U+221B CUBE ROOT
(cl-define-keysym #x100221C "fourthroot") ;U+221C FOURTH ROOT
(cl-define-keysym #x100222C "dintegral") ;U+222C DOUBLE INTEGRAL
(cl-define-keysym #x100222D "tintegral") ;U+222D TRIPLE INTEGRAL
(cl-define-keysym #x1002235 "because") ;U+2235 BECAUSE
(cl-define-keysym #x1002248 "approxeq") ;U+2245 ALMOST EQUAL TO
(cl-define-keysym #x1002247 "notapproxeq") ;U+2247 NOT ALMOST EQUAL TO
(cl-define-keysym #x1002262 "notidentical") ;U+2262 NOT IDENTICAL TO
(cl-define-keysym #x1002263 "stricteq") ;U+2263 STRICTLY EQUIVALENT TO
;; A bunch of extended keysyms
(cl-define-keysym #x100000A8 "hpmute_acute")
(cl-define-keysym #x100000A9 "hpmute_grave")
(cl-define-keysym #x100000AA "hpmute_asciicircum")
(cl-define-keysym #x100000AB "hpmute_diaeresis")
(cl-define-keysym #x100000AC "hpmute_asciitilde")
(cl-define-keysym #x100000AF "hplira")
(cl-define-keysym #x100000BE "hpguilder")
(cl-define-keysym #x100000EE "hpYdiaeresis")
(cl-define-keysym #x100000EE "hpIO")
(cl-define-keysym #x100000F6 "hplongminus")
(cl-define-keysym #x100000FC "hpblock")
(cl-define-keysym #x1000FF00 "apLineDel")
(cl-define-keysym #x1000FF01 "apCharDel")
(cl-define-keysym #x1000FF02 "apCopy")
(cl-define-keysym #x1000FF03 "apCut")
(cl-define-keysym #x1000FF04 "apPaste")
(cl-define-keysym #x1000FF05 "apMove")
(cl-define-keysym #x1000FF06 "apGrow")
(cl-define-keysym #x1000FF07 "apCmd")
(cl-define-keysym #x1000FF08 "apShell")
(cl-define-keysym #x1000FF09 "apLeftBar")
(cl-define-keysym #x1000FF0A "apRightBar")
(cl-define-keysym #x1000FF0B "apLeftBox")
(cl-define-keysym #x1000FF0C "apRightBox")
(cl-define-keysym #x1000FF0D "apUpBox")
(cl-define-keysym #x1000FF0E "apDownBox")
(cl-define-keysym #x1000FF0F "apPop")
(cl-define-keysym #x1000FF10 "apRead")
(cl-define-keysym #x1000FF11 "apEdit")
(cl-define-keysym #x1000FF12 "apSave")
(cl-define-keysym #x1000FF13 "apExit")
(cl-define-keysym #x1000FF14 "apRepeat")
(cl-define-keysym #x1000FF48 "hpModelock1")
(cl-define-keysym #x1000FF49 "hpModelock2")
(cl-define-keysym #x1000FF6C "hpReset")
(cl-define-keysym #x1000FF6D "hpSystem")
(cl-define-keysym #x1000FF6E "hpUser")
(cl-define-keysym #x1000FF6F "hpClearLine")
(cl-define-keysym #x1000FF70 "hpInsertLine")
(cl-define-keysym #x1000FF71 "hpDeleteLine")
(cl-define-keysym #x1000FF72 "hpInsertChar")
(cl-define-keysym #x1000FF73 "hpDeleteChar")
(cl-define-keysym #x1000FF74 "hpBackTab")
(cl-define-keysym #x1000FF75 "hpKP_BackTab")
(cl-define-keysym #x1000FFA8 "apKP_parenleft")
(cl-define-keysym #x1000FFA9 "apKP_parenright")
(cl-define-keysym #x10004001 "I2ND_FUNC_L")
(cl-define-keysym #x10004002 "I2ND_FUNC_R")
(cl-define-keysym #x10004003 "IREMOVE")
(cl-define-keysym #x10004004 "IREPEAT")
(cl-define-keysym #x10004101 "IA1")
(cl-define-keysym #x10004102 "IA2")
(cl-define-keysym #x10004103 "IA3")
(cl-define-keysym #x10004104 "IA4")
(cl-define-keysym #x10004105 "IA5")
(cl-define-keysym #x10004106 "IA6")
(cl-define-keysym #x10004107 "IA7")
(cl-define-keysym #x10004108 "IA8")
(cl-define-keysym #x10004109 "IA9")
(cl-define-keysym #x1000410A "IA10")
(cl-define-keysym #x1000410B "IA11")
(cl-define-keysym #x1000410C "IA12")
(cl-define-keysym #x1000410D "IA13")
(cl-define-keysym #x1000410E "IA14")
(cl-define-keysym #x1000410F "IA15")
(cl-define-keysym #x10004201 "IB1")
(cl-define-keysym #x10004202 "IB2")
(cl-define-keysym #x10004203 "IB3")
(cl-define-keysym #x10004204 "IB4")
(cl-define-keysym #x10004205 "IB5")
(cl-define-keysym #x10004206 "IB6")
(cl-define-keysym #x10004207 "IB7")
(cl-define-keysym #x10004208 "IB8")
(cl-define-keysym #x10004209 "IB9")
(cl-define-keysym #x1000420A "IB10")
(cl-define-keysym #x1000420B "IB11")
(cl-define-keysym #x1000420C "IB12")
(cl-define-keysym #x1000420D "IB13")
(cl-define-keysym #x1000420E "IB14")
(cl-define-keysym #x1000420F "IB15")
(cl-define-keysym #x10004210 "IB16")
(cl-define-keysym #x1000FF00 "DRemove")
(cl-define-keysym #x1000FEB0 "Dring_accent")
(cl-define-keysym #x1000FE5E "Dcircumflex_accent")
(cl-define-keysym #x1000FE2C "Dcedilla_accent")
(cl-define-keysym #x1000FE27 "Dacute_accent")
(cl-define-keysym #x1000FE60 "Dgrave_accent")
(cl-define-keysym #x1000FE7E "Dtilde")
(cl-define-keysym #x1000FE22 "Ddiaeresis")
(cl-define-keysym #x1004FF02 "osfCopy")
(cl-define-keysym #x1004FF03 "osfCut")
(cl-define-keysym #x1004FF04 "osfPaste")
(cl-define-keysym #x1004FF07 "osfBackTab")
(cl-define-keysym #x1004FF08 "osfBackSpace")
(cl-define-keysym #x1004FF0B "osfClear")
(cl-define-keysym #x1004FF1B "osfEscape")
(cl-define-keysym #x1004FF31 "osfAddMode")
(cl-define-keysym #x1004FF32 "osfPrimaryPaste")
(cl-define-keysym #x1004FF33 "osfQuickPaste")
(cl-define-keysym #x1004FF40 "osfPageLeft")
(cl-define-keysym #x1004FF41 "osfPageUp")
(cl-define-keysym #x1004FF42 "osfPageDown")
(cl-define-keysym #x1004FF43 "osfPageRight")
(cl-define-keysym #x1004FF44 "osfActivate")
(cl-define-keysym #x1004FF45 "osfMenuBar")
(cl-define-keysym #x1004FF51 "osfLeft")
(cl-define-keysym #x1004FF52 "osfUp")
(cl-define-keysym #x1004FF53 "osfRight")
(cl-define-keysym #x1004FF54 "osfDown")
(cl-define-keysym #x1004FF55 "osfPrior")
(cl-define-keysym #x1004FF56 "osfNext")
(cl-define-keysym #x1004FF57 "osfEndLine")
(cl-define-keysym #x1004FF58 "osfBeginLine")
(cl-define-keysym #x1004FF59 "osfEndData")
(cl-define-keysym #x1004FF5A "osfBeginData")
(cl-define-keysym #x1004FF5B "osfPrevMenu")
(cl-define-keysym #x1004FF5C "osfNextMenu")
(cl-define-keysym #x1004FF5D "osfPrevField")
(cl-define-keysym #x1004FF5E "osfNextField")
(cl-define-keysym #x1004FF60 "osfSelect")
(cl-define-keysym #x1004FF63 "osfInsert")
(cl-define-keysym #x1004FF65 "osfUndo")
(cl-define-keysym #x1004FF67 "osfMenu")
(cl-define-keysym #x1004FF69 "osfCancel")
(cl-define-keysym #x1004FF6A "osfHelp")
(cl-define-keysym #x1004FF71 "osfSelectAll")
(cl-define-keysym #x1004FF72 "osfDeselectAll")
(cl-define-keysym #x1004FF73 "osfReselect")
(cl-define-keysym #x1004FF74 "osfExtend")
(cl-define-keysym #x1004FF78 "osfRestore")
(cl-define-keysym #x1004FF7E "osfSwitchDirection")
(cl-define-keysym #x1004FFF5 "osfPriorMinor")
(cl-define-keysym #x1004FFF6 "osfNextMinor")
(cl-define-keysym #x1004FFF7 "osfRightLine")
(cl-define-keysym #x1004FFF8 "osfLeftLine")
(cl-define-keysym #x1004FFFF "osfDelete")
(cl-define-keysym #x1005FF00 "SunFA_Grave")
(cl-define-keysym #x1005FF01 "SunFA_Circum")
(cl-define-keysym #x1005FF02 "SunFA_Tilde")
(cl-define-keysym #x1005FF03 "SunFA_Acute")
(cl-define-keysym #x1005FF04 "SunFA_Diaeresis")
(cl-define-keysym #x1005FF05 "SunFA_Cedilla")
(cl-define-keysym #x1005FF10 "SunF36")
(cl-define-keysym #x1005FF11 "SunF37")
(cl-define-keysym #x1005FF60 "SunSys_Req")
(cl-define-keysym #x1005FF70 "SunProps")
(cl-define-keysym #x1005FF71 "SunFront")
(cl-define-keysym #x1005FF72 "SunCopy")
(cl-define-keysym #x1005FF73 "SunOpen")
(cl-define-keysym #x1005FF74 "SunPaste")
(cl-define-keysym #x1005FF75 "SunCut")
(cl-define-keysym #x1005FF76 "SunPowerSwitch")
(cl-define-keysym #x1005FF77 "SunAudioLowerVolume")
(cl-define-keysym #x1005FF78 "SunAudioMute")
(cl-define-keysym #x1005FF79 "SunAudioRaiseVolume")
(cl-define-keysym #x1005FF7A "SunVideoDegauss")
(cl-define-keysym #x1005FF7B "SunVideoLowerBrightness")
(cl-define-keysym #x1005FF7C "SunVideoRaiseBrightness")
(cl-define-keysym #x1005FF7D "SunPowerSwitchShift")
(cl-define-keysym #xFF20 "SunCompose")
(cl-define-keysym #xFF55 "SunPageUp")
(cl-define-keysym #xFF56 "SunPageDown")
(cl-define-keysym #xFF61 "SunPrint_Screen")
(cl-define-keysym #xFF65 "SunUndo")
(cl-define-keysym #xFF66 "SunAgain")
(cl-define-keysym #xFF68 "SunFind")
(cl-define-keysym #xFF69 "SunStop")
(cl-define-keysym #xFF7E "SunAltGraph")
(cl-define-keysym #x1006FF00 "WYSetup")
(cl-define-keysym #x1006FF00 "ncdSetup")
(cl-define-keysym #x10070001 "XeroxPointerButton1")
(cl-define-keysym #x10070002 "XeroxPointerButton2")
(cl-define-keysym #x10070003 "XeroxPointerButton3")
(cl-define-keysym #x10070004 "XeroxPointerButton4")
(cl-define-keysym #x10070005 "XeroxPointerButton5")
(cl-define-keysym #x1008FF01 "XF86ModeLock")
(cl-define-keysym #x1008FF02 "XF86MonBrightnessUp")
(cl-define-keysym #x1008FF03 "XF86MonBrightnessDown")
(cl-define-keysym #x1008FF10 "XF86Standby")
(cl-define-keysym #x1008FF11 "XF86AudioLowerVolume")
(cl-define-keysym #x1008FF12 "XF86AudioMute")
(cl-define-keysym #x1008FFb2 "XF86AudioMicMute")
(cl-define-keysym #x1008FF13 "XF86AudioRaiseVolume")
(cl-define-keysym #x1008FF14 "XF86AudioPlay")
(cl-define-keysym #x1008FF15 "XF86AudioStop")
(cl-define-keysym #x1008FF16 "XF86AudioPrev")
(cl-define-keysym #x1008FF17 "XF86AudioNext")
(cl-define-keysym #x1008FF18 "XF86HomePage")
(cl-define-keysym #x1008FF19 "XF86Mail")
(cl-define-keysym #x1008FF1A "XF86Start")
(cl-define-keysym #x1008FF1B "XF86Search")
(cl-define-keysym #x1008FF1C "XF86AudioRecord")
(cl-define-keysym #x1008FF1D "XF86Calculator")
(cl-define-keysym #x1008FF1E "XF86Memo")
(cl-define-keysym #x1008FF1F "XF86ToDoList")
(cl-define-keysym #x1008FF20 "XF86Calendar")
(cl-define-keysym #x1008FF21 "XF86PowerDown")
(cl-define-keysym #x1008FF22 "XF86ContrastAdjust")
(cl-define-keysym #x1008FF23 "XF86RockerUp")
(cl-define-keysym #x1008FF24 "XF86RockerDown")
(cl-define-keysym #x1008FF25 "XF86RockerEnter")
(cl-define-keysym #x1008FF26 "XF86Back")
(cl-define-keysym #x1008FF27 "XF86Forward")
(cl-define-keysym #x1008FF28 "XF86Stop")
(cl-define-keysym #x1008FF29 "XF86Refresh")
(cl-define-keysym #x1008FF2A "XF86PowerOff")
(cl-define-keysym #x1008FF2B "XF86WakeUp")
(cl-define-keysym #x1008FF2C "XF86Eject")
(cl-define-keysym #x1008FF2D "XF86ScreenSaver")
(cl-define-keysym #x1008FF2E "XF86WWW")
(cl-define-keysym #x1008FF2F "XF86Sleep")
(cl-define-keysym #x1008FF30 "XF86Favorites")
(cl-define-keysym #x1008FF31 "XF86AudioPause")
(cl-define-keysym #x1008FF32 "XF86AudioMedia")
(cl-define-keysym #x1008FF33 "XF86MyComputer")
(cl-define-keysym #x1008FF34 "XF86VendorHome")
(cl-define-keysym #x1008FF35 "XF86LightBulb")
(cl-define-keysym #x1008FF36 "XF86Shop")
(cl-define-keysym #x1008FF37 "XF86History")
(cl-define-keysym #x1008FF38 "XF86OpenURL")
(cl-define-keysym #x1008FF39 "XF86AddFavorite")
(cl-define-keysym #x1008FF3A "XF86HotLinks")
(cl-define-keysym #x1008FF3B "XF86BrightnessAdjust")
(cl-define-keysym #x1008FF3C "XF86Finance")
(cl-define-keysym #x1008FF3D "XF86Community")
(cl-define-keysym #x1008FF3E "XF86AudioRewind")
(cl-define-keysym #x1008FF3F "XF86BackForward")
(cl-define-keysym #x1008FF40 "XF86Launch0")
(cl-define-keysym #x1008FF41 "XF86Launch1")
(cl-define-keysym #x1008FF42 "XF86Launch2")
(cl-define-keysym #x1008FF43 "XF86Launch3")
(cl-define-keysym #x1008FF44 "XF86Launch4")
(cl-define-keysym #x1008FF45 "XF86Launch5")
(cl-define-keysym #x1008FF46 "XF86Launch6")
(cl-define-keysym #x1008FF47 "XF86Launch7")
(cl-define-keysym #x1008FF48 "XF86Launch8")
(cl-define-keysym #x1008FF49 "XF86Launch9")
(cl-define-keysym #x1008FF4A "XF86LaunchA")
(cl-define-keysym #x1008FF4B "XF86LaunchB")
(cl-define-keysym #x1008FF4C "XF86LaunchC")
(cl-define-keysym #x1008FF4D "XF86LaunchD")
(cl-define-keysym #x1008FF4E "XF86LaunchE")
(cl-define-keysym #x1008FF4F "XF86LaunchF")
(cl-define-keysym #x1008FF50 "XF86ApplicationLeft")
(cl-define-keysym #x1008FF51 "XF86ApplicationRight")
(cl-define-keysym #x1008FF52 "XF86Book")
(cl-define-keysym #x1008FF53 "XF86CD")
(cl-define-keysym #x1008FF54 "XF86Calculater")
(cl-define-keysym #x1008FF55 "XF86Clear")
(cl-define-keysym #x1008FF56 "XF86Close")
(cl-define-keysym #x1008FF57 "XF86Copy")
(cl-define-keysym #x1008FF58 "XF86Cut")
(cl-define-keysym #x1008FF59 "XF86Display")
(cl-define-keysym #x1008FF5A "XF86DOS")
(cl-define-keysym #x1008FF5B "XF86Documents")
(cl-define-keysym #x1008FF5C "XF86Excel")
(cl-define-keysym #x1008FF5D "XF86Explorer")
(cl-define-keysym #x1008FF5E "XF86Game")
(cl-define-keysym #x1008FF5F "XF86Go")
(cl-define-keysym #x1008FF60 "XF86iTouch")
(cl-define-keysym #x1008FF61 "XF86LogOff")
(cl-define-keysym #x1008FF62 "XF86Market")
(cl-define-keysym #x1008FF63 "XF86Meeting")
(cl-define-keysym #x1008FF65 "XF86MenuKB")
(cl-define-keysym #x1008FF66 "XF86MenuPB")
(cl-define-keysym #x1008FF67 "XF86MySites")
(cl-define-keysym #x1008FF68 "XF86New")
(cl-define-keysym #x1008FF69 "XF86News")
(cl-define-keysym #x1008FF6A "XF86OfficeHome")
(cl-define-keysym #x1008FF6B "XF86Open")
(cl-define-keysym #x1008FF6C "XF86Option")
(cl-define-keysym #x1008FF6D "XF86Paste")
(cl-define-keysym #x1008FF6E "XF86Phone")
(cl-define-keysym #x1008FF70 "XF86Q")
(cl-define-keysym #x1008FF72 "XF86Reply")
(cl-define-keysym #x1008FF73 "XF86Reload")
(cl-define-keysym #x1008FF74 "XF86RotateWindows")
(cl-define-keysym #x1008FF75 "XF86RotationPB")
(cl-define-keysym #x1008FF76 "XF86RotationKB")
(cl-define-keysym #x1008FF77 "XF86Save")
(cl-define-keysym #x1008FF78 "XF86ScrollUp")
(cl-define-keysym #x1008FF79 "XF86ScrollDown")
(cl-define-keysym #x1008FF7A "XF86ScrollClick")
(cl-define-keysym #x1008FF7B "XF86Send")
(cl-define-keysym #x1008FF7C "XF86Spell")
(cl-define-keysym #x1008FF7D "XF86SplitScreen")
(cl-define-keysym #x1008FF7E "XF86Support")
(cl-define-keysym #x1008FF7F "XF86TaskPane")
(cl-define-keysym #x1008FF80 "XF86Terminal")
(cl-define-keysym #x1008FF81 "XF86Tools")
(cl-define-keysym #x1008FF82 "XF86Travel")
(cl-define-keysym #x1008FF84 "XF86UserPB")
(cl-define-keysym #x1008FF85 "XF86User1KB")
(cl-define-keysym #x1008FF86 "XF86User2KB")
(cl-define-keysym #x1008FF87 "XF86Video")
(cl-define-keysym #x1008FF88 "XF86WheelButton")
(cl-define-keysym #x1008FF89 "XF86Word")
(cl-define-keysym #x1008FF8A "XF86Xfer")
(cl-define-keysym #x1008FF8B "XF86ZoomIn")
(cl-define-keysym #x1008FF8C "XF86ZoomOut")
(cl-define-keysym #x1008FF8D "XF86Away")
(cl-define-keysym #x1008FF8E "XF86Messenger")
(cl-define-keysym #x1008FF8F "XF86WebCam")
(cl-define-keysym #x1008FF90 "XF86MailForward")
(cl-define-keysym #x1008FF91 "XF86Pictures")
(cl-define-keysym #x1008FF92 "XF86Music")
(cl-define-keysym #x1008FE01 "XF86_Switch_VT_1")
(cl-define-keysym #x1008FE02 "XF86_Switch_VT_2")
(cl-define-keysym #x1008FE03 "XF86_Switch_VT_3")
(cl-define-keysym #x1008FE04 "XF86_Switch_VT_4")
(cl-define-keysym #x1008FE05 "XF86_Switch_VT_5")
(cl-define-keysym #x1008FE06 "XF86_Switch_VT_6")
(cl-define-keysym #x1008FE07 "XF86_Switch_VT_7")
(cl-define-keysym #x1008FE08 "XF86_Switch_VT_8")
(cl-define-keysym #x1008FE09 "XF86_Switch_VT_9")
(cl-define-keysym #x1008FE0A "XF86_Switch_VT_10")
(cl-define-keysym #x1008FE0B "XF86_Switch_VT_11")
(cl-define-keysym #x1008FE0C "XF86_Switch_VT_12")
(cl-define-keysym #x1008FE20 "XF86_Ungrab")
(cl-define-keysym #x1008FE21 "XF86_ClearGrab")
(cl-define-keysym #x1008FE22 "XF86_Next_VMode")
(cl-define-keysym #x1008FE23 "XF86_Prev_VMode")
(cl-define-keysym #x100000A8 "usldead_acute")
(cl-define-keysym #x100000A9 "usldead_grave")
(cl-define-keysym #x100000AB "usldead_diaeresis")
(cl-define-keysym #x100000AA "usldead_asciicircum")
(cl-define-keysym #x100000AC "usldead_asciitilde")
(cl-define-keysym #x1000FE2C "usldead_cedilla")
(cl-define-keysym #x1000FEB0 "usldead_ring")
;; For convenience
(cl-define-keysym #xff55 "Page_Up")
(cl-define-keysym #xff56 "Page_Down")
| 129,200 | Common Lisp | .lisp | 2,058 | 61.753644 | 115 | 0.762676 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 298378c9060942992ceb2f59567bba3c3f48268b450ef823f0046fec6aaca006 | 9,987 | [
-1
] |
9,998 | mpd.lisp | spacefrogg_clfswm/contrib/mpd.lisp | ;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: Music Player Daemon (MPD) interface
;;; --------------------------------------------------------------------------
;;;
;;; (C) 2015 Philippe Brochard <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; Documentation: If you want to use this file, just add this line in
;;; your configuration file:
;;;
;;; (load-contrib "mpd.lisp")
;;;
;;; --------------------------------------------------------------------------
(in-package :clfswm)
(format t "Loading MPD code... ")
(defun mpd-menu ()
"Open the Music Player Daemon (MPD) menu"
(open-menu (find-menu 'mpd-menu)))
(defun start-sonata ()
"Start sonata"
(do-shell "exec sonata"))
(defun start-gmpc ()
"Start gmpc"
(do-shell "exec gmpc"))
(let ((mpd-host nil)
(mpd-port nil))
(defun mpd-set-host-port (&key host port)
"Set the host and/or port MPD where is running.
A setting of NIL leaves the respective command-line argument unset in
the call generated by `MPC-CALL'."
(when (or (null host) (stringp host))
(setf mpd-host host))
(when (or (null port) (integerp port))
(setf mpd-port port))
(values mpd-host mpd-port))
(defun mpc-call (&optional args)
"Return a string as the call to the mpc client program with the
command-line arguments set to the currently configured MPD host and port."
(format nil "mpc~@[ -h ~a~]~@[ -p ~d~]~@[ ~a~]" mpd-host mpd-port args)))
(defun show-mpd-info (&optional (in-menu t))
"Show a list of MPD information"
(info-on-shell "MPD information:" (mpc-call))
(if in-menu
(mpd-menu)))
(defun mpd-previous (&optional (in-menu t))
"Play the previous song in the current playlist"
(if in-menu
(progn
(info-on-shell "MPD:" (mpc-call "prev"))
(mpd-menu))
(do-shell (mpc-call "prev") nil t)))
(defun mpd-next (&optional (in-menu t))
"Play the next song in the current playlist"
(if in-menu
(progn
(info-on-shell "MPD:" (mpc-call "next"))
(mpd-menu))
(do-shell (mpc-call "next") nil t)))
(defun mpd-toggle ()
"Toggles Play/Pause, plays if stopped"
(do-shell (mpc-call "toggle")))
(defun mpd-play ()
"Start playing"
(do-shell (mpc-call "play")))
(defun mpd-stop ()
"Stop the currently playing playlists"
(do-shell (mpc-call "stop")))
(defun mpd-seek-+5% (&optional (in-menu t))
"Seeks to +5%"
(if in-menu
(progn
(do-shell (mpc-call "seek +5%"))
(mpd-menu))
(do-shell (mpc-call "seek +5%") nil t)))
(defun mpd-seek--5% (&optional (in-menu t))
"Seeks to -5%"
(if in-menu
(progn
(do-shell (mpc-call "seek -5%"))
(mpd-menu))
(do-shell (mpc-call "seek -5%") nil t)))
(defun show-mpd-playlist ()
"Show the current MPD playlist"
(info-on-shell "Current MPD playlist:" (mpc-call "playlist"))
(mpd-menu))
(unless (find-menu 'mpd-menu)
(add-sub-menu 'help-menu "F2" 'mpd-menu "Music Player Daemon (MPD) menu")
(add-menu-key 'mpd-menu "i" 'show-mpd-info)
(add-menu-key 'mpd-menu "p" 'mpd-previous)
(add-menu-key 'mpd-menu "n" 'mpd-next)
(add-menu-key 'mpd-menu "t" 'mpd-toggle)
(add-menu-key 'mpd-menu "y" 'mpd-play)
(add-menu-key 'mpd-menu "k" 'mpd-stop)
(add-menu-key 'mpd-menu "x" 'mpd-seek-+5%)
(add-menu-key 'mpd-menu "w" 'mpd-seek--5%)
(add-menu-key 'mpd-menu "l" 'show-mpd-playlist)
(add-menu-key 'mpd-menu "s" 'start-sonata)
(add-menu-key 'mpd-menu "g" 'start-gmpc))
(defun mpd-binding ()
(define-main-key ("F2" :alt) 'mpd-menu))
;(add-hook *binding-hook* 'mpd-binding)
#+:clfswm-toolbar
(progn
(defconfig *mpd-toolbar* '((mpd-buttons 1)
(mpd-info 60))
'Toolbar "MPD toolbar modules")
(defconfig *mpd-toolbar-client* "gmpc"
'Toolbar "MPD client")
(define-toolbar-color mpd-info "MPD - Music Player Daemon information color")
(define-toolbar-color mpd-buttons "MPD - Music Player Daemon buttons color")
(define-toolbar-module (mpd-info small)
"(small) - MPD (Music Player Daemon) informations"
(let* ((lines (do-shell "mpc" nil t))
(mpd-line (loop for line = (read-line lines nil nil)
while line
collect line)))
(if (>= (length mpd-line) 3)
(if small
(toolbar-module-text toolbar module (tb-color mpd-info)
"~A"
(ensure-printable (first mpd-line)))
(toolbar-module-text toolbar module (tb-color mpd-info)
"~A - ~A"
(ensure-printable (first mpd-line))
(ensure-printable (second mpd-line))))
(toolbar-module-text toolbar module (tb-color mpd-info)
"MPD - Not playing"))))
(define-toolbar-module (mpd-buttons small)
"(small) - MPD (Music Player Daemon) buttons"
(with-set-toolbar-module-rectangle (module)
(toolbar-module-text toolbar module (tb-color mpd-buttons)
(if small
"PNT<>C"
"P N T < > C"))))
(define-toolbar-module-click (mpd-buttons small)
"P=Previous, N=Next, T=Toogle, <=seek-5% >=seek+5% C=start MPD client"
(declare (ignore state small))
(when (= code 1)
(let ((pos (toolbar-module-subdiv toolbar module root-x root-y 6)))
(case pos
(0 (mpd-previous nil))
(1 (mpd-next nil))
(2 (mpd-toggle))
(3 (mpd-seek--5% nil))
(4 (mpd-seek-+5% nil))
(5 (do-shell *mpd-toolbar-client*))))
(refresh-toolbar toolbar))))
(format t "done~%")
| 6,581 | Common Lisp | .lisp | 164 | 34.006098 | 79 | 0.585683 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | e63ed2348b349c52837cba00d98a96087f4ef52b6502677fc199640757b215e3 | 9,998 | [
-1
] |
10,004 | clfswm.asd | spacefrogg_clfswm/clfswm.asd | ;;;; -*- Mode: Lisp -*-
;;;; Author: Philippe Brochard <[email protected]>
;;;; ASDF System Definition
;;;
(in-package #:asdf)
(defsystem clfswm
:description "CLFSWM: Fullscreen Window Manager"
:version "1209.2"
:author "Philippe Brochard <[email protected]>"
:licence "GNU Public License (GPL)"
:components ((:module src
:components
((:file "tools")
(:file "version"
:depends-on ("tools"))
(:file "my-html"
:depends-on ("tools"))
(:file "package"
:depends-on ("my-html" "tools" "version"))
(:file "keysyms"
:depends-on ("package"))
(:file "xlib-util"
:depends-on ("package" "keysyms" "tools"))
(:file "config"
:depends-on ("package" "xlib-util"))
(:file "netwm-util"
:depends-on ("package" "xlib-util"))
(:file "clfswm-keys"
:depends-on ("package" "config" "xlib-util" "keysyms"))
(:file "clfswm-autodoc"
:depends-on ("package" "clfswm-keys" "my-html" "tools" "config"))
(:file "clfswm-internal"
:depends-on ("xlib-util" "clfswm-keys" "netwm-util" "tools" "config"))
(:file "clfswm-placement"
:depends-on ("package" "clfswm-internal"))
(:file "clfswm-generic-mode"
:depends-on ("package" "tools" "xlib-util" "clfswm-internal"))
(:file "clfswm-query"
:depends-on ("package" "config" "xlib-util" "clfswm-keys"
"clfswm-generic-mode" "clfswm-placement"))
(:file "clfswm-circulate-mode"
:depends-on ("xlib-util" "clfswm-keys" "clfswm-generic-mode"
"clfswm-internal" "netwm-util" "tools" "config"
"clfswm-placement"))
(:file "clfswm"
:depends-on ("xlib-util" "netwm-util" "clfswm-keys" "config"
"clfswm-internal" "clfswm-circulate-mode" "tools"))
(:file "clfswm-second-mode"
:depends-on ("package" "clfswm" "clfswm-internal" "clfswm-generic-mode"
"clfswm-placement"))
(:file "clfswm-expose-mode"
:depends-on ("package" "config" "clfswm-internal" "xlib-util" "tools"
"clfswm-keys" "clfswm-generic-mode" "clfswm-placement"
"clfswm-query"))
(:file "clfswm-fastswitch-mode"
:depends-on ("package" "config" "clfswm-internal" "xlib-util" "tools"
"clfswm-keys" "clfswm-generic-mode" "clfswm-placement"
"clfswm-expose-mode"))
(:file "clfswm-corner"
:depends-on ("package" "config" "clfswm-internal" "clfswm-expose-mode" "xlib-util"))
(:file "clfswm-info"
:depends-on ("package" "version" "xlib-util" "config" "clfswm-keys" "clfswm"
"clfswm-internal"
"clfswm-autodoc" "clfswm-corner"
"clfswm-generic-mode" "clfswm-placement"))
(:file "clfswm-menu"
:depends-on ("package" "clfswm-info"))
(:file "clfswm-util"
:depends-on ("clfswm" "keysyms" "clfswm-info" "clfswm-second-mode" "clfswm-query"
"clfswm-menu" "clfswm-autodoc" "clfswm-corner"
"clfswm-placement" "tools"))
(:file "clfswm-configuration"
:depends-on ("package" "config" "clfswm-internal" "clfswm-util" "clfswm-query"
"clfswm-menu"))
(:file "menu-def"
:depends-on ("clfswm-menu" "clfswm-configuration" "clfswm" "clfswm-util" "clfswm-info"))
(:file "clfswm-layout"
:depends-on ("package" "clfswm-internal" "clfswm-util" "clfswm-info" "menu-def"))
(:file "clfswm-pack"
:depends-on ("clfswm" "xlib-util" "clfswm-util" "clfswm-second-mode" "clfswm-layout"))
(:file "clfswm-nw-hooks"
:depends-on ("package" "clfswm-util" "clfswm-info" "clfswm-layout" "menu-def"))
(:file "bindings"
:depends-on ("clfswm" "clfswm-internal" "clfswm-util" "clfswm-menu"))
(:file "bindings-second-mode"
:depends-on ("clfswm" "clfswm-util" "clfswm-query" "bindings" "clfswm-pack"
"clfswm-menu" "menu-def" "clfswm-layout")))))
:depends-on ( #-:CLX :clx #+:sbcl :sb-posix ))
| 4,369 | Common Lisp | .asd | 88 | 37.431818 | 109 | 0.548666 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 8dd35ccb7bc7a684f3c328564c61e54632c1424856894a0f0fa4cd5f01fad331 | 10,004 | [
-1
] |
10,044 | variables.txt | spacefrogg_clfswm/doc/variables.txt | * CLFSWM Configuration variables *
------------------------------
<= Circulate Mode Group =>
*CIRCULATE-TEXT-LIMITE* = 30
Maximum text limite in the circulate window
*CIRCULATE-TRANSPARENCY* = 0.8
Circulate window background transparency
*CIRCULATE-HEIGHT* = 15
Circulate mode window height
*CIRCULATE-WIDTH* = 400
Circulate mode window width
*CIRCULATE-BORDER* = "red"
Circulate string window border color
*CIRCULATE-FOREGROUND* = "green"
Circulate string window foreground color
*CIRCULATE-BACKGROUND* = "black"
Circulate string window background color
*CIRCULATE-FONT-STRING* = "fixed"
Circulate string window font string
<= Corner Group =>
*CORNER-COMMAND-TRY-NUMBER* = 10
Number of try to wait the window in query tree
*CORNER-COMMAND-TRY-DELAY* = 0.2
Time to wait before checking window in query tree
*CORNER-ERROR-MESSAGE-DELAY* = 5
Time to display the error message on commad error
*CORNER-ERROR-MESSAGE-COLOR* = "red"
Error message color
*CLFSWM-TERMINAL-CMD* = "xterm -T clfswm-terminal"
The clfswm terminal command.
This command must set the window title to *clfswm-terminal-name*
*CLFSWM-TERMINAL-NAME* = "clfswm-terminal"
The clfswm terminal name
*VIRTUAL-KEYBOARD-CMD* = "xvkbd"
The command to display the virtual keybaord
Here is an ~/.Xresources example for xvkbd:
xvkbd.windowGeometry: 300x100-0-0
xvkbd*Font: 6x12
xvkbd.modalKeytop: true
xvkbd.customization: -french
xvkbd.keypad: false
And make it always on top
*CORNER-SECOND-MODE-RIGHT-BUTTON* = ((:TOP-LEFT NIL) (:TOP-RIGHT NIL) (:BOTTOM-RIGHT EXPOSE-ALL-WINDOWS-MODE) (:BOTTOM-LEFT NIL))
Actions on corners in the second mode with the right mouse button
*CORNER-SECOND-MODE-MIDDLE-BUTTON* = ((:TOP-LEFT HELP-ON-CLFSWM) (:TOP-RIGHT NIL) (:BOTTOM-RIGHT NIL) (:BOTTOM-LEFT NIL))
Actions on corners in the second mode with the middle mouse button
*CORNER-SECOND-MODE-LEFT-BUTTON* = ((:TOP-LEFT NIL) (:TOP-RIGHT NIL) (:BOTTOM-RIGHT EXPOSE-WINDOWS-MODE) (:BOTTOM-LEFT NIL))
Actions on corners in the second mode with the left mouse button
*CORNER-MAIN-MODE-RIGHT-BUTTON* =
((:TOP-LEFT PRESENT-CLFSWM-TERMINAL) (:TOP-RIGHT ASK-CLOSE/KILL-CURRENT-WINDOW) (:BOTTOM-RIGHT EXPOSE-ALL-WINDOWS-MODE)
(:BOTTOM-LEFT NIL))
Actions on corners in the main mode with the right mouse button
*CORNER-MAIN-MODE-MIDDLE-BUTTON* = ((:TOP-LEFT HELP-ON-CLFSWM) (:TOP-RIGHT ASK-CLOSE/KILL-CURRENT-WINDOW) (:BOTTOM-RIGHT NIL) (:BOTTOM-LEFT NIL))
Actions on corners in the main mode with the middle mouse button
*CORNER-MAIN-MODE-LEFT-BUTTON* = ((:TOP-LEFT OPEN-MENU) (:TOP-RIGHT PRESENT-VIRTUAL-KEYBOARD) (:BOTTOM-RIGHT EXPOSE-WINDOWS-MODE) (:BOTTOM-LEFT NIL))
Actions on corners in the main mode with the left mouse button
*CORNER-SIZE* = 3
The size of the corner square
<= Expose Mode Group =>
*EXPOSE-DIRECT-SELECT* = T
Immediately select child if they can be directly accessed
*EXPOSE-TRANSPARENCY* = 0.9
Expose string window background transparency
*EXPOSE-SHOW-WINDOW-TITLE* = T
Show the window title on accel window
*EXPOSE-VALID-ON-KEY* = T
Valid expose mode when an accel key is pressed
*EXPOSE-BORDER* = "grey20"
Expose string window border color
*EXPOSE-BACKGROUND-LETTER-MATCH* = "green"
Expose string window background color for matching letters
*EXPOSE-FOREGROUND-LETTER-NOK* = "grey30"
Expose string window foreground color for letter not selected
*EXPOSE-FOREGROUND-LETTER* = "red"
Expose string window foreground color for letters
*EXPOSE-FOREGROUND* = "grey50"
Expose string window foreground color
*EXPOSE-BACKGROUND* = "grey10"
Expose string window background color
*EXPOSE-FONT-STRING* = "fixed"
Expose string window font string
<= Frame Colors Group =>
*FRAME-TRANSPARENCY* = 0.6
Frame background transparency
*FRAME-FOREGROUND-HIDDEN* = "Darkgreen"
Frame foreground for hidden windows
*FRAME-FOREGROUND-ROOT* = "Red"
Frame foreground when the frame is the root frame
*FRAME-FOREGROUND* = "Green"
Frame foreground
*FRAME-BACKGROUND* = "Black"
Frame background
<= Gimp Layout Group =>
*GIMP-LAYOUT-NOTIFY-WINDOW-DELAY* = 30
Time to display the GIMP layout notify window help
<= Hook Group =>
*QUERY-BUTTON-PRESS-HOOK* = NIL
Query hook. Hook called on each button press event in query loop
*QUERY-KEY-PRESS-HOOK* = (QUERY-MODE-COMPLETE-SUGGEST-RESET)
Query hook. Hook called on each key press event in query loop
*DEFAULT-NW-HOOK* = DEFAULT-FRAME-NW-HOOK
Default action to do on newly created windows
*CLOSE-HOOK* = (CLOSE-NOTIFY-WINDOW CLOSE-CLFSWM-TERMINAL CLOSE-VIRTUAL-KEYBOARD)
Close hook. This hook is run just before closing the display
*INIT-HOOK* = (DEFAULT-INIT-HOOK DISPLAY-HELLO-WINDOW)
Init hook. This hook is run just after the first root frame is created
*ROOT-SIZE-CHANGE-HOOK* = NIL
Hook executed when the root size has changed for example when adding/removing a monitor
*MAIN-ENTRANCE-HOOK* = NIL
Hook executed on the main function entrance after
loading configuration file and before opening the display.
*LOOP-HOOK* = NIL
Hook executed on each event loop
*BINDING-HOOK* =
(INIT-*QUERY-KEYS* SET-DEFAULT-QUERY-KEYS SET-DEFAULT-CIRCULATE-KEYS INIT-*INFO-KEYS* INIT-*INFO-MOUSE*
SET-DEFAULT-INFO-KEYS SET-DEFAULT-INFO-MOUSE INIT-*MAIN-KEYS* INIT-*MAIN-MOUSE* SET-DEFAULT-MAIN-KEYS
SET-DEFAULT-MAIN-MOUSE INIT-*SECOND-KEYS* INIT-*SECOND-MOUSE* SET-DEFAULT-SECOND-KEYS SET-DEFAULT-SECOND-MOUSE)
Hook executed when keys/buttons are bounds
<= Identify Key Group =>
*IDENTIFY-TRANSPARENCY* = 0.8
Identify window background transparency
*IDENTIFY-BORDER* = "red"
Identify window border color
*IDENTIFY-FOREGROUND* = "green"
Identify window foreground color
*IDENTIFY-BACKGROUND* = "black"
Identify window background color
*IDENTIFY-FONT-STRING* = "fixed"
Identify window font string
<= Info Mode Group =>
*INFO-COLOR-SECOND* = "lightblue"
Colored info second color
*INFO-COLOR-FIRST* = "Cyan"
Colored info first color
*INFO-COLOR-UNDERLINE* = "Yellow"
Colored info underline color
*INFO-COLOR-TITLE* = "Magenta"
Colored info title color
*INFO-CLICK-TO-SELECT* = T
If true, click on info window select item. Otherwise, click to drag the menu
*INFO-TRANSPARENCY* = 0.8
Info window background transparency
*INFO-FONT-STRING* = "fixed"
Info window font string
*INFO-SELECTED-BACKGROUND* = "blue"
Info selected item background color
*INFO-LINE-CURSOR* = "white"
Info window line cursor color color
*INFO-BORDER* = "red"
Info window border color
*INFO-FOREGROUND* = "green"
Info window foreground color
*INFO-BACKGROUND* = "black"
Info window background color
<= Main Mode Group =>
*COLOR-MAYBE-SELECTED* = "Yellow"
Color of maybe selected windows
*COLOR-UNSELECTED* = "Blue"
Color of unselected color
*COLOR-SELECTED* = "Red"
Color of selected window
*COLOR-MOVE-WINDOW* = "DeepPink"
Color when moving or resizing a windows
<= Menu Group =>
*MENU-KEY-BOUND-COLOR* = "gray50"
Key bound min menu color
*MENU-COLOR-MENU-KEY* = #<XLIB:COLOR 0.99609375 0.6015625 0.99609375>
Menu key color in menu
*MENU-COLOR-KEY* = "Magenta"
Key color in menu
*MENU-COLOR-COMMENT* = "Yellow"
Comment color in menu
*MENU-COLOR-SUBMENU* = "Cyan"
Submenu color in menu
*XDG-SECTION-LIST* =
(TEXTEDITOR FILEMANAGER WEBBROWSER AUDIOVIDEO AUDIO VIDEO DEVELOPMENT EDUCATION GAME GRAPHICS NETWORK OFFICE SETTINGS
SYSTEM UTILITY TERMINALEMULATOR SCREENSAVER)
Standard menu sections
<= Miscellaneous Group =>
*DEFAULT-WINDOW-HEIGHT* = 300
Default window height
*DEFAULT-WINDOW-WIDTH* = 400
Default window width
*SPATIAL-MOVE-DELAY-AFTER* = 0.5
Delay to display the new child after doing a spatial move
*SPATIAL-MOVE-DELAY-BEFORE* = 0.2
Delay to display the current child before doing a spatial move
*SNAP-SIZE* = 5
Snap size (in % of parent size) when move or resize frame is constrained
*HIDE-UNMANAGED-WINDOW* = T
Hide or not unmanaged windows when a child is deselected.
*NEVER-MANAGED-WINDOW-LIST* =
((IS-NOTIFY-WINDOW-P RAISE-WINDOW) (EQUAL-WM-CLASS-ROX-PINBOARD NIL) (EQUAL-WM-CLASS-XVKBD RAISE-WINDOW)
(EQUAL-CLFSWM-TERMINAL RAISE-AND-FOCUS-WINDOW))
CLFSWM will never manage windows of this type.
A list of (list match-function handle-function)
*DEFAULT-MODIFIERS* = NIL
Default modifiers list to append to explicit modifiers
Example: :mod-2 for num_lock, :lock for Caps_lock...
*SHOW-HIDE-POLICY* = #<SYSTEM-FUNCTION <=>
'NIL': always display all children (better with transparency support).
'<': Hide only children less than children above.
'<=': Hide children less or equal to children above (better for performance on slow machine).
*DEFAULT-FOCUS-POLICY* = :CLICK
Default mouse focus policy. One of :click, :sloppy, :sloppy-strict or :sloppy-select.
*DEFAULT-MANAGED-TYPE* = (:NORMAL)
Default managed window types
*DEFAULT-FRAME-DATA* = ((:TILE-SIZE 0.8) (:TILE-SPACE-SIZE 0.1) (:FAST-LAYOUT (TILE-LEFT-LAYOUT TILE-LAYOUT)) (:MAIN-LAYOUT-WINDOWS NIL))
Default slots set in frame date
*DEFAULT-FONT-STRING* = "fixed"
The default font used in clfswm
*LOOP-TIMEOUT* = 1
Maximum time (in seconds) to wait before calling *loop-hook*
*BORDER-SIZE* = 1
Windows and frames border size
*SHOW-ROOT-FRAME-P* = NIL
Show the root frame information or not
*DEFAULT-TRANSPARENCY* = 0.8
Default transparency for all windows when in xcompmgr transparency mode
*TRANSPARENT-BACKGROUND* = T
Enable transparent background: one of nil, :pseudo, t (xcompmgr must be started)
*HAVE-TO-COMPRESS-NOTIFY* = T
Compress event notify?
This variable may be useful to speed up some slow version of CLX.
It is particulary useful with CLISP/MIT-CLX.
<= Notify Window Group =>
*NOTIFY-WINDOW-TRANSPARENCY* = 0.8
Notify window background transparency
*NOTIFY-WINDOW-DELAY* = 10
Notify Window display delay
*NOTIFY-WINDOW-BORDER* = "red"
Notify Window border color
*NOTIFY-WINDOW-FOREGROUND* = "green"
Notify Window foreground color
*NOTIFY-WINDOW-BACKGROUND* = "black"
Notify Window background color
*NOTIFY-WINDOW-FONT-STRING* = "fixed"
Notify window font string
<= Placement Group =>
*UNMANAGED-WINDOW-PLACEMENT* = MIDDLE-MIDDLE-ROOT-PLACEMENT
Unmanager window placement
*ASK-CLOSE/KILL-PLACEMENT* = TOP-RIGHT-ROOT-PLACEMENT
Ask close/kill window placement
*NOTIFY-WINDOW-PLACEMENT* = BOTTOM-RIGHT-ROOT-PLACEMENT
Notify window placement
*EXPOSE-QUERY-PLACEMENT* = BOTTOM-LEFT-ROOT-PLACEMENT
Expose mode query window placement
*EXPOSE-MODE-PLACEMENT* = TOP-LEFT-CHILD-PLACEMENT
Expose mode window placement (Selection keys position)
*CIRCULATE-MODE-PLACEMENT* = BOTTOM-MIDDLE-ROOT-PLACEMENT
Circulate mode window placement
*QUERY-MODE-PLACEMENT* = TOP-LEFT-ROOT-PLACEMENT
Query mode window placement
*INFO-MODE-PLACEMENT* = TOP-LEFT-ROOT-PLACEMENT
Info mode window placement
*SECOND-MODE-PLACEMENT* = TOP-MIDDLE-ROOT-PLACEMENT
Second mode window placement
*BANISH-POINTER-PLACEMENT* = BOTTOM-RIGHT-ROOT-PLACEMENT
Pointer banishment placement
<= Query String Group =>
*QUERY-MIN-COMPLET-CHAR* = 2
Query minimum input length for completion
*QUERY-MAX-COMPLET-LENGTH* = 100
Query maximum length of completion list
*QUERY-TRANSPARENCY* = 0.8
Query string window background transparency
*QUERY-BORDER* = "red"
Query string window border color
*QUERY-PARENT-ERROR-COLOR* = "red"
Query string window parenthesis color when no match
*QUERY-PARENT-COLOR* = "blue"
Query string window parenthesis color
*QUERY-CURSOR-COLOR* = "white"
Query string window foreground cursor color
*QUERY-FOREGROUND* = "green"
Query string window foreground color
*QUERY-MESSAGE-COLOR* = "yellow"
Query string window message color
*QUERY-BACKGROUND* = "black"
Query string window background color
*QUERY-FONT-STRING* = "fixed"
Query string window font string
<= Root Group =>
*SHOW-CURRENT-ROOT-MESSAGE* = "Current root"
Current root notify window message
*SHOW-CURRENT-ROOT-PLACEMENT* = MIDDLE-MIDDLE-ROOT-PLACEMENT
Current root notify window placement
*SHOW-CURRENT-ROOT-DELAY* = 1
Delay to show the current root
*HAVE-TO-SHOW-CURRENT-ROOT* = T
Show the current root if true
*CREATE-FRAME-ON-ROOT* = NIL
Create frame on root.
Set this variable to true if you want to allow to create a new frame
on the root window in the main mode with the mouse
<= Second Mode Group =>
*SM-TRANSPARENCY* = 0.8
Second mode background transparency
*SM-HEIGHT* = 25
Second mode window height
*SM-WIDTH* = 300
Second mode window width
*SM-FONT-STRING* = "fixed"
Second mode window font string
*SM-FOREGROUND-COLOR* = "Red"
Second mode window foreground color
*SM-BACKGROUND-COLOR* = "Black"
Second mode window background color
*SM-BORDER-COLOR* = "Green"
Second mode window border color
Those variables can be changed in clfswm.
Maybe you'll need to restart clfswm to take care of new values
This documentation was produced with the CLFSWM auto-doc functions.
To reproduce it, use the produce-conf-var-doc-in-file or
the produce-all-docs function from the Lisp REPL.
Something like this:
LISP> (in-package :clfswm)
CLFSWM> (produce-conf-var-doc-in-file "my-variables.txt")
or
CLFSWM> (produce-all-docs)
| 13,676 | Common Lisp | .l | 320 | 38.915625 | 151 | 0.742894 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 05a64005f78f6402a7062b8d7c924c77371fdb1ccec25894c9f0f8cb97d1e51d | 10,044 | [
-1
] |
10,045 | keys.html | spacefrogg_clfswm/doc/keys.html | <html>
<head>
<title>
CLFSWM Keys
</title>
</head>
<body>
<h1>
CLFSWM Keys
</h1>
<p>
<small>
Note: Mod-1 is the Meta or Alt key
</small>
</p>
<h3>
<u>
Main mode keys
</u>
</h3>
<table class="ex" cellspacing="5" border="0" width="100%">
<tr>
<th align="right" width="10%">
Modifiers
</th>
<th align="center" width="10%">
Key/Button
</th>
<th align="left">
Function
</th>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
0
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
9
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
8
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
7
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
6
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
5
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
4
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
3
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
2
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
1
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Less
</td>
<td style="color:#0000ff" nowrap>
Switch to editing mode (second mode)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
T
</td>
<td style="color:#0000ff" nowrap>
Switch to editing mode (second mode)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Escape
</td>
<td style="color:#0000ff" nowrap>
Close or kill the current window (ask before doing anything)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
B
</td>
<td style="color:#0000ff" nowrap>
Move the pointer to the lower right corner of the screen
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
L2
</td>
<td style="color:#0000ff" nowrap>
Show all frames info windows
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Shift
</td>
<td align="center" nowrap>
L2
</td>
<td style="color:#0000ff" nowrap>
Show all frames info windows until a key is release
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
L2
</td>
<td style="color:#0000ff" nowrap>
Hide/Unhide a terminal
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
F10
</td>
<td style="color:#0000ff" nowrap>
Present all windows in all frames (An expose like)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
F10
</td>
<td style="color:#0000ff" nowrap>
Present all windows in currents roots (An expose like)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control Shift
</td>
<td align="center" nowrap>
F10
</td>
<td style="color:#0000ff" nowrap>
Show/Hide the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
F10
</td>
<td style="color:#0000ff" nowrap>
Switch between two layouts
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
Home
</td>
<td style="color:#0000ff" nowrap>
Switch and select the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Home
</td>
<td style="color:#0000ff" nowrap>
Switch to the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Page_down
</td>
<td style="color:#0000ff" nowrap>
Raise the child in the current frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Page_up
</td>
<td style="color:#0000ff" nowrap>
Lower the child in the current frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Page_down
</td>
<td style="color:#0000ff" nowrap>
Select the next child in the current frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Page_up
</td>
<td style="color:#0000ff" nowrap>
Select the previous child in the current frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-5
</td>
<td align="center" nowrap>
Return
</td>
<td style="color:#0000ff" nowrap>
Maximize/Unmaximize the current frame in its parent frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Return
</td>
<td style="color:#0000ff" nowrap>
Maximize/Unmaximize the current frame in its parent frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
Return
</td>
<td style="color:#0000ff" nowrap>
Leave the selected frame - ie make its parent the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Return
</td>
<td style="color:#0000ff" nowrap>
Enter in the selected frame - ie make it the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Tab
</td>
<td style="color:#0000ff" nowrap>
Select the next subchild
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
Tab
</td>
<td style="color:#0000ff" nowrap>
Select the previous child
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Tab
</td>
<td style="color:#0000ff" nowrap>
Select the next child
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Down
</td>
<td style="color:#0000ff" nowrap>
Select spatially the nearest brother of the current child in the down direction
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Up
</td>
<td style="color:#0000ff" nowrap>
Select spatially the nearest brother of the current child in the up direction
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Right
</td>
<td style="color:#0000ff" nowrap>
Select spatially the nearest brother of the current child in the right direction
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Left
</td>
<td style="color:#0000ff" nowrap>
Select spatially the nearest brother of the current child in the left direction
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Up
</td>
<td style="color:#0000ff" nowrap>
Select the next level in frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Down
</td>
<td style="color:#0000ff" nowrap>
Select the previous level in frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Left
</td>
<td style="color:#0000ff" nowrap>
Select the previous brother
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Right
</td>
<td style="color:#0000ff" nowrap>
Select the next brother
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control Shift
</td>
<td align="center" nowrap>
Home
</td>
<td style="color:#0000ff" nowrap>
Exit clfswm
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
F1
</td>
<td style="color:#0000ff" nowrap>
Open the help and info window
</td>
</tr>
</table>
<h3>
<u>
Mouse buttons actions in main mode
</u>
</h3>
<table class="ex" cellspacing="5" border="0" width="100%">
<tr>
<th align="right" width="10%">
Modifiers
</th>
<th align="center" width="10%">
Key/Button
</th>
<th align="left">
Function
</th>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control Shift
</td>
<td align="center" nowrap>
5
</td>
<td style="color:#0000ff" nowrap>
Increment slowly the child under mouse transparency
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control Shift
</td>
<td align="center" nowrap>
4
</td>
<td style="color:#0000ff" nowrap>
Decrement slowly the child under mouse transparency
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
5
</td>
<td style="color:#0000ff" nowrap>
Increment the child under mouse transparency
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
4
</td>
<td style="color:#0000ff" nowrap>
Decrement the child under mouse transparency
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
5
</td>
<td style="color:#0000ff" nowrap>
Leave the selected frame - ie make its parent the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
4
</td>
<td style="color:#0000ff" nowrap>
Enter in the selected frame - ie make it the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
5
</td>
<td style="color:#0000ff" nowrap>
Select the previous level in frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
4
</td>
<td style="color:#0000ff" nowrap>
Select the next level in frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
1
</td>
<td style="color:#0000ff" nowrap>
Move the child under the mouse cursor to another frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
3
</td>
<td style="color:#0000ff" nowrap>
Resize (constrained by other frames) and focus the current child - Create a new frame on the root window
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
1
</td>
<td style="color:#0000ff" nowrap>
Move (constrained by other frames) and focus the current child - Create a new frame on the root window
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
3
</td>
<td style="color:#0000ff" nowrap>
Resize and focus the current child - Create a new frame on the root window
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
1
</td>
<td style="color:#0000ff" nowrap>
Move and focus the current child - Create a new frame on the root window
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
3
</td>
<td style="color:#0000ff" nowrap>
Resize and focus the current frame or focus the current window parent.
Or do actions on corners
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
2
</td>
<td style="color:#0000ff" nowrap>
Do actions on corners
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
1
</td>
<td style="color:#0000ff" nowrap>
Move and focus the current frame or focus the current window parent.
Or do actions on corners
</td>
</tr>
</table>
<h3>
<u>
Second mode keys
</u>
</h3>
<table class="ex" cellspacing="5" border="0" width="100%">
<tr>
<th align="right" width="10%">
Modifiers
</th>
<th align="center" width="10%">
Key/Button
</th>
<th align="left">
Function
</th>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
T
</td>
<td style="color:#0000ff" nowrap>
Decrement the current window transparency
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control Shift
</td>
<td align="center" nowrap>
T
</td>
<td style="color:#0000ff" nowrap>
Increment the current window transparency
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
0
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
9
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
8
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
7
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
6
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
5
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
4
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
3
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
2
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
1
</td>
<td style="color:#0000ff" nowrap>
Bind or jump to a slot (a frame or a window)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
L2
</td>
<td style="color:#0000ff" nowrap>
Show all frames info windows
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Shift
</td>
<td align="center" nowrap>
L2
</td>
<td style="color:#0000ff" nowrap>
Show all frames info windows until a key is release
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
F10
</td>
<td style="color:#0000ff" nowrap>
Present all windows in all frames (An expose like)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
F10
</td>
<td style="color:#0000ff" nowrap>
Present all windows in currents roots (An expose like)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control Shift
</td>
<td align="center" nowrap>
F10
</td>
<td style="color:#0000ff" nowrap>
Show/Hide the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
F10
</td>
<td style="color:#0000ff" nowrap>
Switch between two layouts
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
E
</td>
<td style="color:#0000ff" nowrap>
start an emacs for another user
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
E
</td>
<td style="color:#0000ff" nowrap>
start emacs
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
T
</td>
<td style="color:#0000ff" nowrap>
start an xterm
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Delete
</td>
<td style="color:#0000ff" nowrap>
Delete the current child and its children in all frames
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Delete
</td>
<td style="color:#0000ff" nowrap>
Remove the current child from its parent frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control Shift
</td>
<td align="center" nowrap>
V
</td>
<td style="color:#0000ff" nowrap>
Paste the selection in the current frame - Do not clear the selection after paste
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
V
</td>
<td style="color:#0000ff" nowrap>
Paste the selection in the current frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
C
</td>
<td style="color:#0000ff" nowrap>
Copy the current child to the selection
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
X
</td>
<td style="color:#0000ff" nowrap>
Clear the current selection
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
X
</td>
<td style="color:#0000ff" nowrap>
Cut the current child to the selection
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Escape
</td>
<td style="color:#0000ff" nowrap>
Close or kill the current window (ask before doing anything)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Minus
</td>
<td style="color:#0000ff" nowrap>
Decrease slowly the tile layout size
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Plus
</td>
<td style="color:#0000ff" nowrap>
Increase slowly the tile layout size
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Minus
</td>
<td style="color:#0000ff" nowrap>
Decrease the tile layout size
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Plus
</td>
<td style="color:#0000ff" nowrap>
Increase the tile layout size
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
A
</td>
<td style="color:#0000ff" nowrap>
Add a frame in the parent frame (and reorganize parent frame)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
A
</td>
<td style="color:#0000ff" nowrap>
Add a default frame in the current frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
O
</td>
<td style="color:#0000ff" nowrap>
Open the next window in a new frame in the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
O
</td>
<td style="color:#0000ff" nowrap>
Open the next window in a new frame in the parent frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
B
</td>
<td style="color:#0000ff" nowrap>
Move the pointer to the lower right corner of the screen
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Menu
</td>
<td style="color:#0000ff" nowrap>
Show/Hide the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
Home
</td>
<td style="color:#0000ff" nowrap>
Switch and select the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Home
</td>
<td style="color:#0000ff" nowrap>
Switch to the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Page_down
</td>
<td style="color:#0000ff" nowrap>
Raise the child in the current frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Page_up
</td>
<td style="color:#0000ff" nowrap>
Lower the child in the current frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-5
</td>
<td align="center" nowrap>
Return
</td>
<td style="color:#0000ff" nowrap>
Maximize/Unmaximize the current frame in its parent frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Return
</td>
<td style="color:#0000ff" nowrap>
Maximize/Unmaximize the current frame in its parent frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
Return
</td>
<td style="color:#0000ff" nowrap>
Leave the selected frame - ie make its parent the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Return
</td>
<td style="color:#0000ff" nowrap>
Enter in the selected frame - ie make it the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Tab
</td>
<td style="color:#0000ff" nowrap>
Store the current child and switch to the previous one
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Tab
</td>
<td style="color:#0000ff" nowrap>
Select the next subchild
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
Tab
</td>
<td style="color:#0000ff" nowrap>
Select the previous child
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Tab
</td>
<td style="color:#0000ff" nowrap>
Select the next child
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Down
</td>
<td style="color:#0000ff" nowrap>
Reset speed mouse coordinates
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Up
</td>
<td style="color:#0000ff" nowrap>
Revert to the first speed move mouse
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Left
</td>
<td style="color:#0000ff" nowrap>
Undo last speed mouse move
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Up
</td>
<td style="color:#0000ff" nowrap>
Speed move mouse to up
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Down
</td>
<td style="color:#0000ff" nowrap>
Speed move mouse to down
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Left
</td>
<td style="color:#0000ff" nowrap>
Speed move mouse to left
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Right
</td>
<td style="color:#0000ff" nowrap>
Speed move mouse to right
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Page_down
</td>
<td style="color:#0000ff" nowrap>
Rotate root geometry to previous root
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Page_up
</td>
<td style="color:#0000ff" nowrap>
Rotate root geometry to next root
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Page_down
</td>
<td style="color:#0000ff" nowrap>
Select the previous root
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Page_up
</td>
<td style="color:#0000ff" nowrap>
Select the next root
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Shift
</td>
<td align="center" nowrap>
H
</td>
<td style="color:#0000ff" nowrap>
Anti rotate brother frame geometry
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
H
</td>
<td style="color:#0000ff" nowrap>
Rotate brother frame geometry
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
J
</td>
<td style="color:#0000ff" nowrap>
Swap current brother frame geometry
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Down
</td>
<td style="color:#0000ff" nowrap>
Select spatially the nearest brother of the current child in the down direction
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Up
</td>
<td style="color:#0000ff" nowrap>
Select spatially the nearest brother of the current child in the up direction
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Right
</td>
<td style="color:#0000ff" nowrap>
Select spatially the nearest brother of the current child in the right direction
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Left
</td>
<td style="color:#0000ff" nowrap>
Select spatially the nearest brother of the current child in the left direction
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Up
</td>
<td style="color:#0000ff" nowrap>
Select the next level in frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Down
</td>
<td style="color:#0000ff" nowrap>
Select the previous level in frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Left
</td>
<td style="color:#0000ff" nowrap>
Select the previous brother
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Right
</td>
<td style="color:#0000ff" nowrap>
Select the next brother
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control Shift
</td>
<td align="center" nowrap>
Home
</td>
<td style="color:#0000ff" nowrap>
Exit clfswm
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Shift
</td>
<td align="center" nowrap>
T
</td>
<td style="color:#0000ff" nowrap>
Tile the current frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Escape
</td>
<td style="color:#0000ff" nowrap>
Leave second mode
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Return
</td>
<td style="color:#0000ff" nowrap>
Leave second mode
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Exclam
</td>
<td style="color:#0000ff" nowrap>
Run a program from the query input
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Colon
</td>
<td style="color:#0000ff" nowrap>
Eval a lisp form from the query input
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
I
</td>
<td style="color:#0000ff" nowrap>
Identify a key
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
K
</td>
<td style="color:#0000ff" nowrap>
Close or kill the current window (ask before doing anything)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Q
</td>
<td style="color:#0000ff" nowrap>
Close focus window: Delete the focus window in all frames and workspaces
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
G
</td>
<td style="color:#0000ff" nowrap>
Stop all pending actions
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
X
</td>
<td style="color:#0000ff" nowrap>
Update layout managed children position
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
C
</td>
<td style="color:#0000ff" nowrap>
Open the child menu
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
R
</td>
<td style="color:#0000ff" nowrap>
Open the root menu
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
P
</td>
<td style="color:#0000ff" nowrap>
Open the frame movement menu (pack/fill/resize)
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
U
</td>
<td style="color:#0000ff" nowrap>
Open the action by number menu
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
N
</td>
<td style="color:#0000ff" nowrap>
Open the action by name menu
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
W
</td>
<td style="color:#0000ff" nowrap>
Open the window menu
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
F
</td>
<td style="color:#0000ff" nowrap>
Open the frame menu
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
Less
</td>
<td style="color:#0000ff" nowrap>
Open the main menu
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Less
</td>
<td style="color:#0000ff" nowrap>
Open the main menu
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
M
</td>
<td style="color:#0000ff" nowrap>
Open the main menu
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
F1
</td>
<td style="color:#0000ff" nowrap>
Open the help and info window
</td>
</tr>
</table>
<h3>
<u>
Mouse buttons actions in second mode
</u>
</h3>
<table class="ex" cellspacing="5" border="0" width="100%">
<tr>
<th align="right" width="10%">
Modifiers
</th>
<th align="center" width="10%">
Key/Button
</th>
<th align="left">
Function
</th>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
5
</td>
<td style="color:#0000ff" nowrap>
Leave the selected frame - ie make its parent the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
4
</td>
<td style="color:#0000ff" nowrap>
Enter in the selected frame - ie make it the root frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
5
</td>
<td style="color:#0000ff" nowrap>
Select the previous level in frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
4
</td>
<td style="color:#0000ff" nowrap>
Select the next level in frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
1
</td>
<td style="color:#0000ff" nowrap>
Move the child under the mouse cursor to another frame
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
3
</td>
<td style="color:#0000ff" nowrap>
Resize (constrained by other frames) and focus the current child - Create a new frame on the root window
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
1
</td>
<td style="color:#0000ff" nowrap>
Move (constrained by other frames) and focus the current child - Create a new frame on the root window
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
3
</td>
<td style="color:#0000ff" nowrap>
Resize and focus the current child - Create a new frame on the root window
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
1
</td>
<td style="color:#0000ff" nowrap>
Move and focus the current child - Create a new frame on the root window
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
3
</td>
<td style="color:#0000ff" nowrap>
Resize and focus the current child - Create a new frame on the root window.
Or do corners actions
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
2
</td>
<td style="color:#0000ff" nowrap>
Do actions on corners
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
1
</td>
<td style="color:#0000ff" nowrap>
Move and focus the current child - Create a new frame on the root window.
Or do corners actions
</td>
</tr>
</table>
<h3>
<u>
Info mode keys
</u>
</h3>
<table class="ex" cellspacing="5" border="0" width="100%">
<tr>
<th align="right" width="10%">
Modifiers
</th>
<th align="center" width="10%">
Key/Button
</th>
<th align="left">
Function
</th>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Page_up
</td>
<td style="color:#0000ff" nowrap>
Move ten lines up
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Page_down
</td>
<td style="color:#0000ff" nowrap>
Move ten lines down
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
End
</td>
<td style="color:#0000ff" nowrap>
Move to last line
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Home
</td>
<td style="color:#0000ff" nowrap>
Move to first line
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Right
</td>
<td style="color:#0000ff" nowrap>
Move one char right
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Left
</td>
<td style="color:#0000ff" nowrap>
Move one char left
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Up
</td>
<td style="color:#0000ff" nowrap>
Move one line up
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Down
</td>
<td style="color:#0000ff" nowrap>
Move one line down
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Twosuperior
</td>
<td style="color:#0000ff" nowrap>
Move the pointer to the lower right corner of the screen
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
G
</td>
<td style="color:#0000ff" nowrap>
Leave the info mode
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Escape
</td>
<td style="color:#0000ff" nowrap>
Leave the info mode
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Space
</td>
<td style="color:#0000ff" nowrap>
Leave the info mode and valid the selected item
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-2
</td>
<td align="center" nowrap>
Kp_enter
</td>
<td style="color:#0000ff" nowrap>
Leave the info mode and valid the selected item
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Return
</td>
<td style="color:#0000ff" nowrap>
Leave the info mode and valid the selected item
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Q
</td>
<td style="color:#0000ff" nowrap>
Leave the info mode
</td>
</tr>
</table>
<h3>
<u>
Mouse buttons actions in info mode
</u>
</h3>
<table class="ex" cellspacing="5" border="0" width="100%">
<tr>
<th align="right" width="10%">
Modifiers
</th>
<th align="center" width="10%">
Key/Button
</th>
<th align="left">
Function
</th>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Motion
</td>
<td style="color:#0000ff" nowrap>
<nil>
</nil>
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
5
</td>
<td style="color:#0000ff" nowrap>
Move one line down
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
4
</td>
<td style="color:#0000ff" nowrap>
Move one line up
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
3
</td>
<td style="color:#0000ff" nowrap>
Leave the info mode
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
2
</td>
<td style="color:#0000ff" nowrap>
Leave the info mode
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
1
</td>
<td style="color:#0000ff" nowrap>
<nil>
</nil>
</td>
</tr>
</table>
<h3>
<u>
Circulate mode keys
</u>
</h3>
<table class="ex" cellspacing="5" border="0" width="100%">
<tr>
<th align="right" width="10%">
Modifiers
</th>
<th align="center" width="10%">
Key/Button
</th>
<th align="left">
Function
</th>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Left
</td>
<td style="color:#0000ff" nowrap>
Select the previous borther
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Right
</td>
<td style="color:#0000ff" nowrap>
Select the next brother
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
Iso_left_tab
</td>
<td style="color:#0000ff" nowrap>
Select the previous child
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Shift
</td>
<td align="center" nowrap>
Tab
</td>
<td style="color:#0000ff" nowrap>
Select the previous child
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
Tab
</td>
<td style="color:#0000ff" nowrap>
Select the next subchild
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Tab
</td>
<td style="color:#0000ff" nowrap>
Select the next child
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1 Control
</td>
<td align="center" nowrap>
G
</td>
<td style="color:#0000ff" nowrap>
Leave the circulate mode
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Mod-1
</td>
<td align="center" nowrap>
Escape
</td>
<td style="color:#0000ff" nowrap>
Leave the circulate mode
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
Control
</td>
<td align="center" nowrap>
G
</td>
<td style="color:#0000ff" nowrap>
Leave the circulate mode
</td>
</tr>
<tr>
<td align="right" style="color:#ff0000" nowrap>
</td>
<td align="center" nowrap>
Escape
</td>
<td style="color:#0000ff" nowrap>
Leave the circulate mode
</td>
</tr>
</table>
<h3>
<u>
Expose windows mode keys
</u>
</h3>
<table class="ex" cellspacing="5" border="0" width="100%">
<tr>
<th align="right" width="10%">
Modifiers
</th>
<th align="center" width="10%">
Key/Button
</th>
<th align="left">
Function
</th>
</tr>
</table>
<h3>
<u>
Mouse buttons actions in expose windows mode
</u>
</h3>
<table class="ex" cellspacing="5" border="0" width="100%">
<tr>
<th align="right" width="10%">
Modifiers
</th>
<th align="center" width="10%">
Key/Button
</th>
<th align="left">
Function
</th>
</tr>
</table>
<p>
<small>
This documentation was produced with the CLFSWM auto-doc functions. To reproduce it, use the produce-doc-html-in-file or
the produce-all-docs function from the Lisp REPL.
</small>
</p>
<p>
<small>
Something like this:<br>
LISP> (in-package :clfswm)<br>
CLFSWM> (produce-doc-html-in-file "my-keys.html")<br>
or<br> CLFSWM> (produce-all-docs)
</small>
</p>
</body>
</html>
| 59,711 | Common Lisp | .l | 2,311 | 16.428386 | 120 | 0.476825 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 0ab84b8211b87bc7215f5ef664632b814419d7a2b0fae45f3e0975dee56cf818 | 10,045 | [
-1
] |
10,047 | variables.html | spacefrogg_clfswm/doc/variables.html | <html>
<head>
<title>
CLFSWM - Configuration variables
</title>
</head>
<body>
<h1>
<a name='top'>
CLFSWM - Configuration variables
</a>
</h1>
<p>
Here are the variables you can configure in CLFSWM with the configuration file or the configuration menu:
</p>
<h3>
<a name='top'>
Configuration variables groups:
</a>
</h3>
<ul>
<li>
<a href='#circulate-mode'>
Circulate Mode Group
</a>
</li>
<li>
<a href='#corner'>
Corner Group
</a>
</li>
<li>
<a href='#expose-mode'>
Expose Mode Group
</a>
</li>
<li>
<a href='#frame-colors'>
Frame Colors Group
</a>
</li>
<li>
<a href='#gimp-layout'>
Gimp Layout Group
</a>
</li>
<li>
<a href='#hook'>
Hook Group
</a>
</li>
<li>
<a href='#identify-key'>
Identify Key Group
</a>
</li>
<li>
<a href='#info-mode'>
Info Mode Group
</a>
</li>
<li>
<a href='#main-mode'>
Main Mode Group
</a>
</li>
<li>
<a href='#menu'>
Menu Group
</a>
</li>
<li>
<a href='#miscellaneous'>
Miscellaneous Group
</a>
</li>
<li>
<a href='#notify-window'>
Notify Window Group
</a>
</li>
<li>
<a href='#placement'>
Placement Group
</a>
</li>
<li>
<a href='#query-string'>
Query String Group
</a>
</li>
<li>
<a href='#root'>
Root Group
</a>
</li>
<li>
<a href='#second-mode'>
Second Mode Group
</a>
</li>
</ul>
<p>
<a name='circulate-mode' href='#top'>
<= Circulate Mode Group =>
</a>
</p>
<font color='#ff0000'>
*circulate-text-limite*
</font>
<font color='#0000ff'>
= 30 <br>
</font>
Maximum text limite in the circulate window <br>
<font color='#ff0000'>
*circulate-transparency*
</font>
<font color='#0000ff'>
= 0.8 <br>
</font>
Circulate window background transparency <br>
<font color='#ff0000'>
*circulate-height*
</font>
<font color='#0000ff'>
= 15 <br>
</font>
Circulate mode window height <br>
<font color='#ff0000'>
*circulate-width*
</font>
<font color='#0000ff'>
= 400 <br>
</font>
Circulate mode window width <br>
<font color='#ff0000'>
*circulate-border*
</font>
<font color='#0000ff'>
= "red" <br>
</font>
Circulate string window border color <br>
<font color='#ff0000'>
*circulate-foreground*
</font>
<font color='#0000ff'>
= "green" <br>
</font>
Circulate string window foreground color <br>
<font color='#ff0000'>
*circulate-background*
</font>
<font color='#0000ff'>
= "black" <br>
</font>
Circulate string window background color <br>
<font color='#ff0000'>
*circulate-font-string*
</font>
<font color='#0000ff'>
= "fixed" <br>
</font>
Circulate string window font string <br>
<p>
<a name='corner' href='#top'>
<= Corner Group =>
</a>
</p>
<font color='#ff0000'>
*corner-command-try-number*
</font>
<font color='#0000ff'>
= 10 <br>
</font>
Number of try to wait the window in query tree <br>
<font color='#ff0000'>
*corner-command-try-delay*
</font>
<font color='#0000ff'>
= 0.2 <br>
</font>
Time to wait before checking window in query tree <br>
<font color='#ff0000'>
*corner-error-message-delay*
</font>
<font color='#0000ff'>
= 5 <br>
</font>
Time to display the error message on commad error <br>
<font color='#ff0000'>
*corner-error-message-color*
</font>
<font color='#0000ff'>
= "red" <br>
</font>
Error message color <br>
<font color='#ff0000'>
*clfswm-terminal-cmd*
</font>
<font color='#0000ff'>
= "xterm -T clfswm-terminal" <br>
</font>
<br>
The clfswm terminal command. <br>
This command must set the window title to *clfswm-terminal-name* <br>
<font color='#ff0000'>
*clfswm-terminal-name*
</font>
<font color='#0000ff'>
= "clfswm-terminal" <br>
</font>
The clfswm terminal name <br>
<font color='#ff0000'>
*virtual-keyboard-cmd*
</font>
<font color='#0000ff'>
= "xvkbd" <br>
</font>
<br>
The command to display the virtual keybaord <br>
Here is an ~/.Xresources example for xvkbd: <br>
xvkbd.windowGeometry: 300x100-0-0 <br>
xvkbd*Font: 6x12 <br>
xvkbd.modalKeytop: true <br>
xvkbd.customization: -french <br>
xvkbd.keypad: false <br>
And make it always on top <br>
<font color='#ff0000'>
*corner-second-mode-right-button*
</font>
<font color='#0000ff'>
= ((:TOP-LEFT NIL) (:TOP-RIGHT NIL) (:BOTTOM-RIGHT EXPOSE-ALL-WINDOWS-MODE) (:BOTTOM-LEFT NIL)) <br>
</font>
Actions on corners in the second mode with the right mouse button <br>
<font color='#ff0000'>
*corner-second-mode-middle-button*
</font>
<font color='#0000ff'>
= ((:TOP-LEFT HELP-ON-CLFSWM) (:TOP-RIGHT NIL) (:BOTTOM-RIGHT NIL) (:BOTTOM-LEFT NIL)) <br>
</font>
Actions on corners in the second mode with the middle mouse button <br>
<font color='#ff0000'>
*corner-second-mode-left-button*
</font>
<font color='#0000ff'>
= ((:TOP-LEFT NIL) (:TOP-RIGHT NIL) (:BOTTOM-RIGHT EXPOSE-WINDOWS-MODE) (:BOTTOM-LEFT NIL)) <br>
</font>
Actions on corners in the second mode with the left mouse button <br>
<font color='#ff0000'>
*corner-main-mode-right-button*
</font>
<font color='#0000ff'>
= <br>
</font>
((:TOP-LEFT PRESENT-CLFSWM-TERMINAL) (:TOP-RIGHT ASK-CLOSE/KILL-CURRENT-WINDOW) (:BOTTOM-RIGHT EXPOSE-ALL-WINDOWS-MODE) <br>
(:BOTTOM-LEFT NIL)) <br>
Actions on corners in the main mode with the right mouse button <br>
<font color='#ff0000'>
*corner-main-mode-middle-button*
</font>
<font color='#0000ff'>
= ((:TOP-LEFT HELP-ON-CLFSWM) (:TOP-RIGHT ASK-CLOSE/KILL-CURRENT-WINDOW) (:BOTTOM-RIGHT NIL) (:BOTTOM-LEFT NIL)) <br>
</font>
Actions on corners in the main mode with the middle mouse button <br>
<font color='#ff0000'>
*corner-main-mode-left-button*
</font>
<font color='#0000ff'>
= ((:TOP-LEFT OPEN-MENU) (:TOP-RIGHT PRESENT-VIRTUAL-KEYBOARD) (:BOTTOM-RIGHT EXPOSE-WINDOWS-MODE) (:BOTTOM-LEFT NIL)) <br>
</font>
Actions on corners in the main mode with the left mouse button <br>
<font color='#ff0000'>
*corner-size*
</font>
<font color='#0000ff'>
= 3 <br>
</font>
The size of the corner square <br>
<p>
<a name='expose-mode' href='#top'>
<= Expose Mode Group =>
</a>
</p>
<font color='#ff0000'>
*expose-direct-select*
</font>
<font color='#0000ff'>
= T <br>
</font>
Immediately select child if they can be directly accessed <br>
<font color='#ff0000'>
*expose-transparency*
</font>
<font color='#0000ff'>
= 0.9 <br>
</font>
Expose string window background transparency <br>
<font color='#ff0000'>
*expose-show-window-title*
</font>
<font color='#0000ff'>
= T <br>
</font>
Show the window title on accel window <br>
<font color='#ff0000'>
*expose-valid-on-key*
</font>
<font color='#0000ff'>
= T <br>
</font>
Valid expose mode when an accel key is pressed <br>
<font color='#ff0000'>
*expose-border*
</font>
<font color='#0000ff'>
= "grey20" <br>
</font>
Expose string window border color <br>
<font color='#ff0000'>
*expose-background-letter-match*
</font>
<font color='#0000ff'>
= "green" <br>
</font>
Expose string window background color for matching letters <br>
<font color='#ff0000'>
*expose-foreground-letter-nok*
</font>
<font color='#0000ff'>
= "grey30" <br>
</font>
Expose string window foreground color for letter not selected <br>
<font color='#ff0000'>
*expose-foreground-letter*
</font>
<font color='#0000ff'>
= "red" <br>
</font>
Expose string window foreground color for letters <br>
<font color='#ff0000'>
*expose-foreground*
</font>
<font color='#0000ff'>
= "grey50" <br>
</font>
Expose string window foreground color <br>
<font color='#ff0000'>
*expose-background*
</font>
<font color='#0000ff'>
= "grey10" <br>
</font>
Expose string window background color <br>
<font color='#ff0000'>
*expose-font-string*
</font>
<font color='#0000ff'>
= "fixed" <br>
</font>
Expose string window font string <br>
<p>
<a name='frame-colors' href='#top'>
<= Frame Colors Group =>
</a>
</p>
<font color='#ff0000'>
*frame-transparency*
</font>
<font color='#0000ff'>
= 0.6 <br>
</font>
Frame background transparency <br>
<font color='#ff0000'>
*frame-foreground-hidden*
</font>
<font color='#0000ff'>
= "Darkgreen" <br>
</font>
Frame foreground for hidden windows <br>
<font color='#ff0000'>
*frame-foreground-root*
</font>
<font color='#0000ff'>
= "Red" <br>
</font>
Frame foreground when the frame is the root frame <br>
<font color='#ff0000'>
*frame-foreground*
</font>
<font color='#0000ff'>
= "Green" <br>
</font>
Frame foreground <br>
<font color='#ff0000'>
*frame-background*
</font>
<font color='#0000ff'>
= "Black" <br>
</font>
Frame background <br>
<p>
<a name='gimp-layout' href='#top'>
<= Gimp Layout Group =>
</a>
</p>
<font color='#ff0000'>
*gimp-layout-notify-window-delay*
</font>
<font color='#0000ff'>
= 30 <br>
</font>
Time to display the GIMP layout notify window help <br>
<p>
<a name='hook' href='#top'>
<= Hook Group =>
</a>
</p>
<font color='#ff0000'>
*query-button-press-hook*
</font>
<font color='#0000ff'>
= NIL <br>
</font>
Query hook. Hook called on each button press event in query loop <br>
<font color='#ff0000'>
*query-key-press-hook*
</font>
<font color='#0000ff'>
= (QUERY-MODE-COMPLETE-SUGGEST-RESET) <br>
</font>
Query hook. Hook called on each key press event in query loop <br>
<font color='#ff0000'>
*default-nw-hook*
</font>
<font color='#0000ff'>
= DEFAULT-FRAME-NW-HOOK <br>
</font>
Default action to do on newly created windows <br>
<font color='#ff0000'>
*close-hook*
</font>
<font color='#0000ff'>
= (CLOSE-NOTIFY-WINDOW CLOSE-CLFSWM-TERMINAL CLOSE-VIRTUAL-KEYBOARD) <br>
</font>
Close hook. This hook is run just before closing the display <br>
<font color='#ff0000'>
*init-hook*
</font>
<font color='#0000ff'>
= (DEFAULT-INIT-HOOK DISPLAY-HELLO-WINDOW) <br>
</font>
Init hook. This hook is run just after the first root frame is created <br>
<font color='#ff0000'>
*root-size-change-hook*
</font>
<font color='#0000ff'>
= NIL <br>
</font>
Hook executed when the root size has changed for example when adding/removing a monitor <br>
<font color='#ff0000'>
*main-entrance-hook*
</font>
<font color='#0000ff'>
= NIL <br>
</font>
<br>
Hook executed on the main function entrance after <br>
loading configuration file and before opening the display. <br>
<font color='#ff0000'>
*loop-hook*
</font>
<font color='#0000ff'>
= NIL <br>
</font>
Hook executed on each event loop <br>
<font color='#ff0000'>
*binding-hook*
</font>
<font color='#0000ff'>
= <br>
</font>
(INIT-*QUERY-KEYS* SET-DEFAULT-QUERY-KEYS SET-DEFAULT-CIRCULATE-KEYS INIT-*INFO-KEYS* INIT-*INFO-MOUSE* <br>
SET-DEFAULT-INFO-KEYS SET-DEFAULT-INFO-MOUSE INIT-*MAIN-KEYS* INIT-*MAIN-MOUSE* SET-DEFAULT-MAIN-KEYS <br>
SET-DEFAULT-MAIN-MOUSE INIT-*SECOND-KEYS* INIT-*SECOND-MOUSE* SET-DEFAULT-SECOND-KEYS SET-DEFAULT-SECOND-MOUSE) <br>
Hook executed when keys/buttons are bounds <br>
<p>
<a name='identify-key' href='#top'>
<= Identify Key Group =>
</a>
</p>
<font color='#ff0000'>
*identify-transparency*
</font>
<font color='#0000ff'>
= 0.8 <br>
</font>
Identify window background transparency <br>
<font color='#ff0000'>
*identify-border*
</font>
<font color='#0000ff'>
= "red" <br>
</font>
Identify window border color <br>
<font color='#ff0000'>
*identify-foreground*
</font>
<font color='#0000ff'>
= "green" <br>
</font>
Identify window foreground color <br>
<font color='#ff0000'>
*identify-background*
</font>
<font color='#0000ff'>
= "black" <br>
</font>
Identify window background color <br>
<font color='#ff0000'>
*identify-font-string*
</font>
<font color='#0000ff'>
= "fixed" <br>
</font>
Identify window font string <br>
<p>
<a name='info-mode' href='#top'>
<= Info Mode Group =>
</a>
</p>
<font color='#ff0000'>
*info-color-second*
</font>
<font color='#0000ff'>
= "lightblue" <br>
</font>
Colored info second color <br>
<font color='#ff0000'>
*info-color-first*
</font>
<font color='#0000ff'>
= "Cyan" <br>
</font>
Colored info first color <br>
<font color='#ff0000'>
*info-color-underline*
</font>
<font color='#0000ff'>
= "Yellow" <br>
</font>
Colored info underline color <br>
<font color='#ff0000'>
*info-color-title*
</font>
<font color='#0000ff'>
= "Magenta" <br>
</font>
Colored info title color <br>
<font color='#ff0000'>
*info-click-to-select*
</font>
<font color='#0000ff'>
= T <br>
</font>
If true, click on info window select item. Otherwise, click to drag the menu <br>
<font color='#ff0000'>
*info-transparency*
</font>
<font color='#0000ff'>
= 0.8 <br>
</font>
Info window background transparency <br>
<font color='#ff0000'>
*info-font-string*
</font>
<font color='#0000ff'>
= "fixed" <br>
</font>
Info window font string <br>
<font color='#ff0000'>
*info-selected-background*
</font>
<font color='#0000ff'>
= "blue" <br>
</font>
Info selected item background color <br>
<font color='#ff0000'>
*info-line-cursor*
</font>
<font color='#0000ff'>
= "white" <br>
</font>
Info window line cursor color color <br>
<font color='#ff0000'>
*info-border*
</font>
<font color='#0000ff'>
= "red" <br>
</font>
Info window border color <br>
<font color='#ff0000'>
*info-foreground*
</font>
<font color='#0000ff'>
= "green" <br>
</font>
Info window foreground color <br>
<font color='#ff0000'>
*info-background*
</font>
<font color='#0000ff'>
= "black" <br>
</font>
Info window background color <br>
<p>
<a name='main-mode' href='#top'>
<= Main Mode Group =>
</a>
</p>
<font color='#ff0000'>
*color-maybe-selected*
</font>
<font color='#0000ff'>
= "Yellow" <br>
</font>
Color of maybe selected windows <br>
<font color='#ff0000'>
*color-unselected*
</font>
<font color='#0000ff'>
= "Blue" <br>
</font>
Color of unselected color <br>
<font color='#ff0000'>
*color-selected*
</font>
<font color='#0000ff'>
= "Red" <br>
</font>
Color of selected window <br>
<font color='#ff0000'>
*color-move-window*
</font>
<font color='#0000ff'>
= "DeepPink" <br>
</font>
Color when moving or resizing a windows <br>
<p>
<a name='menu' href='#top'>
<= Menu Group =>
</a>
</p>
<font color='#ff0000'>
*menu-key-bound-color*
</font>
<font color='#0000ff'>
= "gray50" <br>
</font>
Key bound min menu color <br>
<font color='#ff0000'>
*menu-color-menu-key*
</font>
<font color='#0000ff'>
= #<XLIB:COLOR 0.99609375 0.6015625 0.99609375> <br>
</font>
Menu key color in menu <br>
<font color='#ff0000'>
*menu-color-key*
</font>
<font color='#0000ff'>
= "Magenta" <br>
</font>
Key color in menu <br>
<font color='#ff0000'>
*menu-color-comment*
</font>
<font color='#0000ff'>
= "Yellow" <br>
</font>
Comment color in menu <br>
<font color='#ff0000'>
*menu-color-submenu*
</font>
<font color='#0000ff'>
= "Cyan" <br>
</font>
Submenu color in menu <br>
<font color='#ff0000'>
*xdg-section-list*
</font>
<font color='#0000ff'>
= <br>
</font>
(TEXTEDITOR FILEMANAGER WEBBROWSER AUDIOVIDEO AUDIO VIDEO DEVELOPMENT EDUCATION GAME GRAPHICS NETWORK OFFICE SETTINGS <br>
SYSTEM UTILITY TERMINALEMULATOR SCREENSAVER) <br>
Standard menu sections <br>
<p>
<a name='miscellaneous' href='#top'>
<= Miscellaneous Group =>
</a>
</p>
<font color='#ff0000'>
*default-window-height*
</font>
<font color='#0000ff'>
= 300 <br>
</font>
Default window height <br>
<font color='#ff0000'>
*default-window-width*
</font>
<font color='#0000ff'>
= 400 <br>
</font>
Default window width <br>
<font color='#ff0000'>
*spatial-move-delay-after*
</font>
<font color='#0000ff'>
= 0.5 <br>
</font>
Delay to display the new child after doing a spatial move <br>
<font color='#ff0000'>
*spatial-move-delay-before*
</font>
<font color='#0000ff'>
= 0.2 <br>
</font>
Delay to display the current child before doing a spatial move <br>
<font color='#ff0000'>
*snap-size*
</font>
<font color='#0000ff'>
= 5 <br>
</font>
Snap size (in % of parent size) when move or resize frame is constrained <br>
<font color='#ff0000'>
*hide-unmanaged-window*
</font>
<font color='#0000ff'>
= T <br>
</font>
Hide or not unmanaged windows when a child is deselected. <br>
<font color='#ff0000'>
*never-managed-window-list*
</font>
<font color='#0000ff'>
= <br>
</font>
((IS-NOTIFY-WINDOW-P RAISE-WINDOW) (EQUAL-WM-CLASS-ROX-PINBOARD NIL) (EQUAL-WM-CLASS-XVKBD RAISE-WINDOW) <br>
(EQUAL-CLFSWM-TERMINAL RAISE-AND-FOCUS-WINDOW)) <br>
<br>
CLFSWM will never manage windows of this type. <br>
A list of (list match-function handle-function) <br>
<font color='#ff0000'>
*default-modifiers*
</font>
<font color='#0000ff'>
= NIL <br>
</font>
<br>
Default modifiers list to append to explicit modifiers <br>
Example: :mod-2 for num_lock, :lock for Caps_lock... <br>
<font color='#ff0000'>
*show-hide-policy*
</font>
<font color='#0000ff'>
= #<SYSTEM-FUNCTION <=> <br>
</font>
<br>
'NIL': always display all children (better with transparency support). <br>
'<': Hide only children less than children above. <br>
<p>
<a name='miscellaneous' href='#top'>
'<=': Hide children less or equal to children above (better for performance on slow machine).
</a>
</p>
<font color='#ff0000'>
*default-focus-policy*
</font>
<font color='#0000ff'>
= :CLICK <br>
</font>
Default mouse focus policy. One of :click, :sloppy, :sloppy-strict or :sloppy-select. <br>
<font color='#ff0000'>
*default-managed-type*
</font>
<font color='#0000ff'>
= (:NORMAL) <br>
</font>
Default managed window types <br>
<font color='#ff0000'>
*default-frame-data*
</font>
<font color='#0000ff'>
= ((:TILE-SIZE 0.8) (:TILE-SPACE-SIZE 0.1) (:FAST-LAYOUT (TILE-LEFT-LAYOUT TILE-LAYOUT)) (:MAIN-LAYOUT-WINDOWS NIL)) <br>
</font>
Default slots set in frame date <br>
<font color='#ff0000'>
*default-font-string*
</font>
<font color='#0000ff'>
= "fixed" <br>
</font>
The default font used in clfswm <br>
<font color='#ff0000'>
*loop-timeout*
</font>
<font color='#0000ff'>
= 1 <br>
</font>
Maximum time (in seconds) to wait before calling *loop-hook* <br>
<font color='#ff0000'>
*border-size*
</font>
<font color='#0000ff'>
= 1 <br>
</font>
Windows and frames border size <br>
<font color='#ff0000'>
*show-root-frame-p*
</font>
<font color='#0000ff'>
= NIL <br>
</font>
Show the root frame information or not <br>
<font color='#ff0000'>
*default-transparency*
</font>
<font color='#0000ff'>
= 0.8 <br>
</font>
Default transparency for all windows when in xcompmgr transparency mode <br>
<font color='#ff0000'>
*transparent-background*
</font>
<font color='#0000ff'>
= T <br>
</font>
Enable transparent background: one of nil, :pseudo, t (xcompmgr must be started) <br>
<font color='#ff0000'>
*have-to-compress-notify*
</font>
<font color='#0000ff'>
= T <br>
</font>
<br>
Compress event notify? <br>
This variable may be useful to speed up some slow version of CLX. <br>
It is particulary useful with CLISP/MIT-CLX. <br>
<p>
<a name='notify-window' href='#top'>
<= Notify Window Group =>
</a>
</p>
<font color='#ff0000'>
*notify-window-transparency*
</font>
<font color='#0000ff'>
= 0.8 <br>
</font>
Notify window background transparency <br>
<font color='#ff0000'>
*notify-window-delay*
</font>
<font color='#0000ff'>
= 10 <br>
</font>
Notify Window display delay <br>
<font color='#ff0000'>
*notify-window-border*
</font>
<font color='#0000ff'>
= "red" <br>
</font>
Notify Window border color <br>
<font color='#ff0000'>
*notify-window-foreground*
</font>
<font color='#0000ff'>
= "green" <br>
</font>
Notify Window foreground color <br>
<font color='#ff0000'>
*notify-window-background*
</font>
<font color='#0000ff'>
= "black" <br>
</font>
Notify Window background color <br>
<font color='#ff0000'>
*notify-window-font-string*
</font>
<font color='#0000ff'>
= "fixed" <br>
</font>
Notify window font string <br>
<p>
<a name='placement' href='#top'>
<= Placement Group =>
</a>
</p>
<font color='#ff0000'>
*unmanaged-window-placement*
</font>
<font color='#0000ff'>
= MIDDLE-MIDDLE-ROOT-PLACEMENT <br>
</font>
Unmanager window placement <br>
<font color='#ff0000'>
*ask-close/kill-placement*
</font>
<font color='#0000ff'>
= TOP-RIGHT-ROOT-PLACEMENT <br>
</font>
Ask close/kill window placement <br>
<font color='#ff0000'>
*notify-window-placement*
</font>
<font color='#0000ff'>
= BOTTOM-RIGHT-ROOT-PLACEMENT <br>
</font>
Notify window placement <br>
<font color='#ff0000'>
*expose-query-placement*
</font>
<font color='#0000ff'>
= BOTTOM-LEFT-ROOT-PLACEMENT <br>
</font>
Expose mode query window placement <br>
<font color='#ff0000'>
*expose-mode-placement*
</font>
<font color='#0000ff'>
= TOP-LEFT-CHILD-PLACEMENT <br>
</font>
Expose mode window placement (Selection keys position) <br>
<font color='#ff0000'>
*circulate-mode-placement*
</font>
<font color='#0000ff'>
= BOTTOM-MIDDLE-ROOT-PLACEMENT <br>
</font>
Circulate mode window placement <br>
<font color='#ff0000'>
*query-mode-placement*
</font>
<font color='#0000ff'>
= TOP-LEFT-ROOT-PLACEMENT <br>
</font>
Query mode window placement <br>
<font color='#ff0000'>
*info-mode-placement*
</font>
<font color='#0000ff'>
= TOP-LEFT-ROOT-PLACEMENT <br>
</font>
Info mode window placement <br>
<font color='#ff0000'>
*second-mode-placement*
</font>
<font color='#0000ff'>
= TOP-MIDDLE-ROOT-PLACEMENT <br>
</font>
Second mode window placement <br>
<font color='#ff0000'>
*banish-pointer-placement*
</font>
<font color='#0000ff'>
= BOTTOM-RIGHT-ROOT-PLACEMENT <br>
</font>
Pointer banishment placement <br>
<p>
<a name='query-string' href='#top'>
<= Query String Group =>
</a>
</p>
<font color='#ff0000'>
*query-min-complet-char*
</font>
<font color='#0000ff'>
= 2 <br>
</font>
Query minimum input length for completion <br>
<font color='#ff0000'>
*query-max-complet-length*
</font>
<font color='#0000ff'>
= 100 <br>
</font>
Query maximum length of completion list <br>
<font color='#ff0000'>
*query-transparency*
</font>
<font color='#0000ff'>
= 0.8 <br>
</font>
Query string window background transparency <br>
<font color='#ff0000'>
*query-border*
</font>
<font color='#0000ff'>
= "red" <br>
</font>
Query string window border color <br>
<font color='#ff0000'>
*query-parent-error-color*
</font>
<font color='#0000ff'>
= "red" <br>
</font>
Query string window parenthesis color when no match <br>
<font color='#ff0000'>
*query-parent-color*
</font>
<font color='#0000ff'>
= "blue" <br>
</font>
Query string window parenthesis color <br>
<font color='#ff0000'>
*query-cursor-color*
</font>
<font color='#0000ff'>
= "white" <br>
</font>
Query string window foreground cursor color <br>
<font color='#ff0000'>
*query-foreground*
</font>
<font color='#0000ff'>
= "green" <br>
</font>
Query string window foreground color <br>
<font color='#ff0000'>
*query-message-color*
</font>
<font color='#0000ff'>
= "yellow" <br>
</font>
Query string window message color <br>
<font color='#ff0000'>
*query-background*
</font>
<font color='#0000ff'>
= "black" <br>
</font>
Query string window background color <br>
<font color='#ff0000'>
*query-font-string*
</font>
<font color='#0000ff'>
= "fixed" <br>
</font>
Query string window font string <br>
<p>
<a name='root' href='#top'>
<= Root Group =>
</a>
</p>
<font color='#ff0000'>
*show-current-root-message*
</font>
<font color='#0000ff'>
= "Current root" <br>
</font>
Current root notify window message <br>
<font color='#ff0000'>
*show-current-root-placement*
</font>
<font color='#0000ff'>
= MIDDLE-MIDDLE-ROOT-PLACEMENT <br>
</font>
Current root notify window placement <br>
<font color='#ff0000'>
*show-current-root-delay*
</font>
<font color='#0000ff'>
= 1 <br>
</font>
Delay to show the current root <br>
<font color='#ff0000'>
*have-to-show-current-root*
</font>
<font color='#0000ff'>
= T <br>
</font>
Show the current root if true <br>
<font color='#ff0000'>
*create-frame-on-root*
</font>
<font color='#0000ff'>
= NIL <br>
</font>
<br>
Create frame on root. <br>
Set this variable to true if you want to allow to create a new frame <br>
on the root window in the main mode with the mouse <br>
<p>
<a name='second-mode' href='#top'>
<= Second Mode Group =>
</a>
</p>
<font color='#ff0000'>
*sm-transparency*
</font>
<font color='#0000ff'>
= 0.8 <br>
</font>
Second mode background transparency <br>
<font color='#ff0000'>
*sm-height*
</font>
<font color='#0000ff'>
= 25 <br>
</font>
Second mode window height <br>
<font color='#ff0000'>
*sm-width*
</font>
<font color='#0000ff'>
= 300 <br>
</font>
Second mode window width <br>
<font color='#ff0000'>
*sm-font-string*
</font>
<font color='#0000ff'>
= "fixed" <br>
</font>
Second mode window font string <br>
<font color='#ff0000'>
*sm-foreground-color*
</font>
<font color='#0000ff'>
= "Red" <br>
</font>
Second mode window foreground color <br>
<font color='#ff0000'>
*sm-background-color*
</font>
<font color='#0000ff'>
= "Black" <br>
</font>
Second mode window background color <br>
<font color='#ff0000'>
*sm-border-color*
</font>
<font color='#0000ff'>
= "Green" <br>
</font>
Second mode window border color <br>
<p>
<small>
This documentation was produced with the CLFSWM auto-doc functions. To reproduce it, use the produce-conf-var-doc-html-in-file or
the produce-all-docs function from the Lisp REPL.
</small>
</p>
<p>
<small>
Something like this:<br>
LISP> (in-package :clfswm)<br>
CLFSWM> (produce-conf-var-doc-html-in-file "my-variables.html")<br>
or<br> CLFSWM> (produce-all-docs)
</small>
</p>
</body>
</html>
| 37,761 | Common Lisp | .l | 1,167 | 26.119966 | 152 | 0.5733 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 2fd128119ad2de7e4f605cbbf577d618b0a079e68fd3e8353e1b42487b480335 | 10,047 | [
-1
] |
10,048 | menu.html | spacefrogg_clfswm/doc/menu.html | <html>
<head>
<title>
CLFSWM Menu
</title>
</head>
<body>
<h1>
<a name="top">
CLFSWM Menu
</a>
</h1>
<p>
Here is the map of the CLFSWM menu:
(By default it is bound on second-mode + m)
</p>
<h3>
<a name="MAIN"></a><a href="#Top">Main</a>
</h3>
<p>
F1: <a href="#HELP-MENU">< Help menu ></a>
</p>
<p>
d: <a href="#STANDARD-MENU">< Standard menu ></a>
</p>
<p>
c: <a href="#CHILD-MENU">< Child menu ></a>
</p>
<p>
r: <a href="#ROOT-MENU">< Root menu ></a>
</p>
<p>
f: <a href="#FRAME-MENU">< Frame menu ></a>
</p>
<p>
w: <a href="#WINDOW-MENU">< Window menu ></a>
</p>
<p>
s: <a href="#SELECTION-MENU">< Selection menu ></a>
</p>
<p>
n: <a href="#ACTION-BY-NAME-MENU">< Action by name menu ></a>
</p>
<p>
u: <a href="#ACTION-BY-NUMBER-MENU">< Action by number menu ></a>
</p>
<p>
y: <a href="#UTILITY-MENU">< Utility menu ></a>
</p>
<p>
o: <a href="#CONFIGURATION-MENU">< Configuration menu ></a>
</p>
<p>
m: <a href="#CLFSWM-MENU">< CLFSWM menu ></a>
</p>
<hr>
<h3>
<a name="HELP-MENU"></a><a href="#MAIN">Help-Menu</a>
</h3>
<p>
a: Show the first aid kit key binding
</p>
<p>
h: Show all key binding
</p>
<p>
b: Show the main mode binding
</p>
<p>
s: Show the second mode key binding
</p>
<p>
r: Show the circulate mode key binding
</p>
<p>
e: Show the expose window mode key binding
</p>
<p>
c: Help on clfswm corner
</p>
<p>
g: Show all configurable variables
</p>
<p>
d: Show the current time and date
</p>
<p>
p: Show current processes sorted by CPU usage
</p>
<p>
m: Show current processes sorted by memory usage
</p>
<p>
v: Show the current CLFSWM version
</p>
<hr>
<h3>
<a name="STANDARD-MENU"></a><a href="#MAIN">Standard-Menu</a>
</h3>
<p>
a: <a href="#TEXTEDITOR">< TEXTEDITOR ></a>
</p>
<p>
b: <a href="#FILEMANAGER">< FILEMANAGER ></a>
</p>
<p>
c: <a href="#WEBBROWSER">< WEBBROWSER ></a>
</p>
<p>
d: <a href="#AUDIOVIDEO">< AUDIOVIDEO ></a>
</p>
<p>
e: <a href="#AUDIO">< AUDIO ></a>
</p>
<p>
f: <a href="#VIDEO">< VIDEO ></a>
</p>
<p>
g: <a href="#DEVELOPMENT">< DEVELOPMENT ></a>
</p>
<p>
h: <a href="#EDUCATION">< EDUCATION ></a>
</p>
<p>
i: <a href="#GAME">< GAME ></a>
</p>
<p>
j: <a href="#GRAPHICS">< GRAPHICS ></a>
</p>
<p>
k: <a href="#NETWORK">< NETWORK ></a>
</p>
<p>
l: <a href="#OFFICE">< OFFICE ></a>
</p>
<p>
m: <a href="#SETTINGS">< SETTINGS ></a>
</p>
<p>
n: <a href="#SYSTEM">< SYSTEM ></a>
</p>
<p>
o: <a href="#UTILITY">< UTILITY ></a>
</p>
<p>
p: <a href="#TERMINALEMULATOR">< TERMINALEMULATOR ></a>
</p>
<p>
q: <a href="#SCREENSAVER">< SCREENSAVER ></a>
</p>
<hr>
<h3>
<a name="TEXTEDITOR"></a><a href="#STANDARD-MENU">Texteditor</a>
</h3>
<p>
a: Snippets datafile editor
</p>
<p>
b: Kate
</p>
<p>
c: KWrite
</p>
<p>
d: Xournal - Take handwritten notes
</p>
<p>
e: Leafpad - Simple text editor
</p>
<p>
f: gedit - Edit text files
</p>
<p>
g: GNU Emacs 23 - View and edit files
</p>
<p>
h: Xfwrite - A simple text editor for Xfe
</p>
<hr>
<h3>
<a name="FILEMANAGER"></a><a href="#STANDARD-MENU">Filemanager</a>
</h3>
<p>
a: Krusader
</p>
<p>
b: Dolphin
</p>
<p>
c: GNOME Commander - A two paned file manager
</p>
<p>
d: File Manager - Configure the Thunar file manager
</p>
<p>
e: Open Folder with Thunar - Open the specified folders in Thunar
</p>
<p>
f: Worker - File manager for X.
</p>
<p>
g: Xfe - A lightweight file manager for X Window
</p>
<p>
h: Thunar File Manager - Browse the filesystem with the file manager
</p>
<p>
i: Midnight Commander - File manager
</p>
<p>
j: Gentoo - Fully GUI-configurable, two-pane X file manager
</p>
<hr>
<h3>
<a name="WEBBROWSER"></a><a href="#STANDARD-MENU">Webbrowser</a>
</h3>
<p>
a: Konqueror
</p>
<p>
b: Bookmark Editor - Bookmark Organizer and Editor
</p>
<p>
c: Web Browser
</p>
<p>
d: Web - Browse the web
</p>
<p>
e: Midori - Lightweight web browser
</p>
<p>
f: Iceweasel - Browse the World Wide Web
</p>
<p>
g: Midori Private Browsing - Open a new private browsing window
</p>
<p>
h: Web - Browse the web
</p>
<p>
i: Conkeror Web Browser - Browse the World Wide Web
</p>
<p>
j: Links 2
</p>
<p>
k: Luakit - Fast, small, webkit based micro-browser extensible by Lua
</p>
<hr>
<h3>
<a name="AUDIOVIDEO"></a><a href="#STANDARD-MENU">Audiovideo</a>
</h3>
<p>
a: Dragon Player
</p>
<p>
b: KMix
</p>
<p>
c: KsCD
</p>
<p>
d: JuK
</p>
<p>
e: Qsampler - Qsampler is a LinuxSampler Qt GUI Interface
</p>
<p>
f: Composite - Live performance sequencer
</p>
<p>
g: Swami Instrument Editor - Create, play and organize MIDI instruments and sounds
</p>
<p>
h: QjackCtl - QjackCtl is a JACK Audio Connection Kit Qt GUI Interface
</p>
<p>
i: Rhythmbox - Play and organize your music collection
</p>
<p>
j: Musique - Play your music collection
</p>
<p>
k: HasciiCam - (h)ascii for the masses!
</p>
<p>
l: MediathekView - View streams from public German TV stations
</p>
<p>
m: XBMC Media Center - Manage and view your media
</p>
<p>
n: Sonata - An elegant GTK+ MPD client
</p>
<p>
o: Stopmotion - Program to create stop-motion animations
</p>
<p>
p: Gnome Music Player Client - A gnome frontend for the mpd daemon
</p>
<p>
q: PulseAudio Volume Control - Adjust the volume level
</p>
<p>
r: Minitube - Watch YouTube videos
</p>
<p>
s: GNOME ALSA Mixer - ALSA sound mixer for GNOME
</p>
<p>
t: Mixer - Audio mixer for the Xfce Desktop Environment
</p>
<p>
u: Alsa Modular Synth - Modular Software Synth
</p>
<p>
v: VLC media player - Read, capture, broadcast your multimedia streams
</p>
<p>
w: Petri-Foo - Sound Sampler
</p>
<p>
x: Sound Juicer - Copy music from your CDs
</p>
<p>
y: PulseAudio Volume Meter (Playback) - Monitor the output volume
</p>
<p>
z: Rhythmbox - Play and organize your music collection
</p>
<p>
0: Brasero - Create and copy CDs and DVDs
</p>
<p>
1: Audacity - Record and edit audio files
</p>
<p>
2: Cheese - Take photos and videos with your webcam, with fun graphical effects
</p>
<p>
3: Sound Recorder - Record sound clips
</p>
<p>
4: OpenShot Video Editor - Create and edit videos and movies
</p>
<p>
5: terminatorX - Scratch and mix audio
</p>
<p>
6: Decibel Audio Player - A simple audio player
</p>
<p>
7: Movie Player - Play movies and songs
</p>
<p>
8: QVideoob - Search for videos on many websites, and get info about them
</p>
<p>
9: PulseAudio Volume Meter (Capture) - Monitor the input volume
</p>
<p>
A: Specimen - Sound Sampler
</p>
<p>
B: Music Player - Play your music files easily
</p>
<hr>
<h3>
<a name="AUDIO"></a><a href="#STANDARD-MENU">Audio</a>
</h3>
<p>
a: KMix
</p>
<p>
b: Qsampler - Qsampler is a LinuxSampler Qt GUI Interface
</p>
<p>
c: Composite - Live performance sequencer
</p>
<p>
d: Swami Instrument Editor - Create, play and organize MIDI instruments and sounds
</p>
<p>
e: QjackCtl - QjackCtl is a JACK Audio Connection Kit Qt GUI Interface
</p>
<p>
f: Musique - Play your music collection
</p>
<p>
g: PulseAudio Volume Control - Adjust the volume level
</p>
<p>
h: Mixer - Audio mixer for the Xfce Desktop Environment
</p>
<p>
i: Alsa Modular Synth - Modular Software Synth
</p>
<p>
j: Petri-Foo - Sound Sampler
</p>
<p>
k: Sound Juicer - Copy music from your CDs
</p>
<p>
l: PulseAudio Volume Meter (Playback) - Monitor the output volume
</p>
<p>
m: Audacity - Record and edit audio files
</p>
<p>
n: Sound Recorder - Record sound clips
</p>
<p>
o: Decibel Audio Player - A simple audio player
</p>
<p>
p: PulseAudio Volume Meter (Capture) - Monitor the input volume
</p>
<p>
q: Music Player - Play your music files easily
</p>
<hr>
<h3>
<a name="VIDEO"></a><a href="#STANDARD-MENU">Video</a>
</h3>
<p>
a: Camorama Webcam Viewer - View, alter and save images from a webcam
</p>
<p>
b: XBMC Media Center - Manage and view your media
</p>
<p>
c: Stopmotion - Program to create stop-motion animations
</p>
<p>
d: Minitube - Watch YouTube videos
</p>
<p>
e: OptGeo - Interactive tool to study and simulate optic assemblies
</p>
<p>
f: OpenShot Video Editor - Create and edit videos and movies
</p>
<p>
g: Movie Player - Play movies and songs
</p>
<hr>
<h3>
<a name="DEVELOPMENT"></a><a href="#STANDARD-MENU">Development</a>
</h3>
<p>
a: KLinkStatus
</p>
<p>
b: Cervisia
</p>
<p>
c: Lokalize
</p>
<p>
d: Umbrello
</p>
<p>
e: KUIViewer
</p>
<p>
f: KImageMapEditor
</p>
<p>
g: Kompare
</p>
<p>
h: KAppTemplate
</p>
<p>
i: KCachegrind - Visualization of Performance Profiling Data
</p>
<p>
j: Akonadi Console - Akonadi Management and Debugging Console
</p>
<p>
k: Scilab CLI - Scientific software package for numerical computations
</p>
<p>
l: Scilab - Scientific software package for numerical computations
</p>
<p>
m: Scilab advanced CLI - Scientific software package for numerical computations
</p>
<p>
n: IDLE (using Python-2.7) - Integrated Development Environment for Python (using Python-2.7)
</p>
<p>
o: GvRng - Guido van Robot NG
</p>
<p>
p: IDLE - Integrated Development Environment for Python
</p>
<p>
q: Python (v2.6) - Python Interpreter (v2.6)
</p>
<p>
r: Python (v3.2) - Python Interpreter (v3.2)
</p>
<p>
s: IDLE (using Python-3.2) - Integrated Development Environment for Python (using Python-3.2)
</p>
<p>
t: IDLE 3 - Integrated DeveLopment Environment for Python3
</p>
<p>
u: Python (v2.7) - Python Interpreter (v2.7)
</p>
<p>
v: IDLE (using Python-2.6) - Integrated Development Environment for Python (using Python-2.6)
</p>
<p>
w: GNU Emacs 23 - View and edit files
</p>
<p>
x: Squeak - Programming system and content development tool
</p>
<hr>
<h3>
<a name="EDUCATION"></a><a href="#STANDARD-MENU">Education</a>
</h3>
<p>
a: Kig - Explore Geometric Constructions
</p>
<p>
b: Rocs - Graph Theory Tool for Professors and Students.
</p>
<p>
c: KWordQuiz - A flashcard and vocabulary learning program
</p>
<p>
d: Marble
</p>
<p>
e: KHangMan - KDE Hangman Game
</p>
<p>
f: Step - Simulate physics experiments
</p>
<p>
g: Parley
</p>
<p>
h: KTurtle
</p>
<p>
i: KStars - Desktop Planetarium
</p>
<p>
j: KmPlot - Function Plotter
</p>
<p>
k: Kiten - Japanese Reference and Study Tool
</p>
<p>
l: KGeography - A Geography Learning Program
</p>
<p>
m: KLettres - a KDE program to learn the alphabet
</p>
<p>
n: Blinken - A memory enhancement game
</p>
<p>
o: KBruch - Practice exercises with fractions
</p>
<p>
p: KTouch
</p>
<p>
q: Cantor
</p>
<p>
r: Kanagram - KDE Letter Order Game
</p>
<p>
s: Kalzium - KDE Periodic Table of Elements
</p>
<p>
t: KAlgebra - Math Expression Solver and Plotter
</p>
<p>
u: Dr.Geo - Dr.Geo Math Tool
</p>
<p>
v: Tux Math - Tux Math - Learn math with Tux!
</p>
<p>
w: Euler
</p>
<p>
x: Scilab CLI - Scientific software package for numerical computations
</p>
<p>
y: MathWar - A simple math game for kids
</p>
<p>
z: GeoGebra - Create interactive mathematical constructions and applets.
</p>
<p>
0: Maxima Algebra System - An interface to the Maxima Computer Algebra System
</p>
<p>
1: Tux Paint
</p>
<p>
2: Scilab - Scientific software package for numerical computations
</p>
<p>
3: K3DSurf - tool for mathematical surfaces
</p>
<p>
4: Tux Typing - Educational typing tutor game starring Tux
</p>
<p>
5: Childsplay - Suite of educational games for young children
</p>
<p>
6: Scilab advanced CLI - Scientific software package for numerical computations
</p>
<p>
7: Geomview - Interactive geometry viewing program
</p>
<p>
8: OptGeo - Interactive tool to study and simulate optic assemblies
</p>
<p>
9: GvRng - Guido van Robot NG
</p>
<p>
A: Klavaro - Yet another touch typing tutor
</p>
<p>
B: TurtleArt - A Logo programming environment
</p>
<p>
C: wxMaxima - Perform symbolic and numeric calculations using Maxima
</p>
<p>
D: Little Wizard - Development environment for children
</p>
<p>
E: Regina - Software for 3-manifold topology and normal surface theory
</p>
<p>
F: CaRMetal - CaRMetal interactive geometry
</p>
<p>
G: python-whiteboard
</p>
<p>
H: AWeather - Advanced weather reporting program
</p>
<p>
I: Xcas Computer Algebra System - The swiss knife for mathematics
</p>
<p>
J: Squeak - Programming system and content development tool
</p>
<p>
K: Educational suite GCompris - Educational game for ages 2 to 10
</p>
<p>
L: eToys - A media-rich model, simulation construction kit and authoring tool
</p>
<hr>
<h3>
<a name="GAME"></a><a href="#STANDARD-MENU">Game</a>
</h3>
<p>
a: Kolf
</p>
<p>
b: KJumpingCube
</p>
<p>
c: Klickety
</p>
<p>
d: Bovo
</p>
<p>
e: Palapeli
</p>
<p>
f: KSnake
</p>
<p>
g: KSpaceDuel
</p>
<p>
h: KPatience
</p>
<p>
i: KMines
</p>
<p>
j: Kiriki
</p>
<p>
k: KBlackBox
</p>
<p>
l: Naval Battle
</p>
<p>
m: Bomber
</p>
<p>
n: Kubrick
</p>
<p>
o: Konquest
</p>
<p>
p: Kolor Lines
</p>
<p>
q: KSquares
</p>
<p>
r: KHangMan - KDE Hangman Game
</p>
<p>
s: KMahjongg
</p>
<p>
t: KsirK
</p>
<p>
u: KDiamond
</p>
<p>
v: KNetWalk
</p>
<p>
w: KAtomic
</p>
<p>
x: Killbots
</p>
<p>
y: KBlocks
</p>
<p>
z: KReversi
</p>
<p>
0: KBounce
</p>
<p>
1: Blinken - A memory enhancement game
</p>
<p>
2: Kigo
</p>
<p>
3: Potato Guy
</p>
<p>
4: KBreakOut
</p>
<p>
5: LSkat
</p>
<p>
6: KGoldrunner - A game of action and puzzle-solving
</p>
<p>
7: Kapman - Eat pills escaping ghosts
</p>
<p>
8: Granatier
</p>
<p>
9: AMOR
</p>
<p>
A: Kanagram - KDE Letter Order Game
</p>
<p>
B: Kollision - A simple ball dodging game
</p>
<p>
C: Shisen-Sho
</p>
<p>
D: KSudoku - KSudoku, Sudoku game & more for KDE
</p>
<p>
E: KSnakeDuel
</p>
<p>
F: KFourInLine
</p>
<p>
G: Kajongg - The ancient Chinese board game for 4 players
</p>
<p>
H: SameGame
</p>
<p>
I: KsirK Skin Editor
</p>
<p>
J: Xboard - Resume XBoard chess tourney
</p>
<p>
K: Frogatto - Young frog's adventure
</p>
<p>
L: Four-in-a-Row - Make lines of the same color to win
</p>
<p>
M: pyRacerz
</p>
<p>
N: Out Of Order - Adventure Game
</p>
<p>
O: Plee the Bear - Catch your son, he ate all the honey then ran away
</p>
<p>
P: I Have No Tomatoes - How many tomatoes can you smash in ten short minutes?
</p>
<p>
Q: FreeCraft - The War begins
</p>
<p>
R: FreeGish - A physics based arcade game
</p>
<p>
S: Neverball - A 3D arcade game with a ball
</p>
<p>
T: Teeworlds - An online multi-player platform 2D shooter
</p>
<p>
U: SDL-Ball
</p>
<p>
V: FreeDinkedit - Portable Dink Smallwood game editor
</p>
<p>
W: PyChess - PyChess is a fully featured, nice looking, easy to use chess client for the Gnome desktop
</p>
<p>
X: PlayOnLinux - PlayOnLinux
</p>
<p>
Y: REminiscence - A port of FlashBack game engine
</p>
<p>
Z: Gravitation - game about mania, melancholia, and the creative process
</p>
<p>
|: OpenArena - A fast-paced 3D first-person shooter, similar to id Software Inc.'s Quake III Arena
</p>
<p>
|: The Ur-Quan Masters - An interstellar adventure game
</p>
<p>
|: Golly - A Conway's Game of Life simulator
</p>
<p>
|: Chromium B.S.U. - Scrolling space shooter
</p>
<p>
|: Virus Killer
</p>
<p>
|: Swell Foop - Clear the screen by removing groups of colored and shaped tiles
</p>
<p>
|: Xmoto
</p>
<p>
|: LordsAWar Editor - Create or Edit LordsAWar maps
</p>
<p>
|: Primrose - Captivating tile-clearing puzzle game
</p>
<p>
|: Biniax-2 - Colorful Logic game with arcade and tactics modes
</p>
<p>
|: Galaga:Hyperspace - Play enhanced Galaga Game
</p>
<p>
|: MegaGlest - A real time strategy game.
</p>
<p>
|: koules - Push your enemies away, but stay away from obstacles
</p>
<p>
|: XBoard - Use an X Windows Chess Board
</p>
<p>
|: Xboard - Resume XBoard chess tourney
</p>
<p>
|: Bouncy the Hungry Rabbit - Eat the yummy veggies in the garden (game for small kids)
</p>
<p>
|: Battle for Wesnoth Map Editor (1.10) - A map editor for Battle for Wesnoth maps
</p>
<p>
|: DFArc - Dink frontend - Run, edit, install, remove and package D-Mods (Dink Modules)
</p>
<p>
|: ii-esu - HIZ's ES
</p>
<p>
|: Amphetamine - Fight evil monsters with your magic weapons.
</p>
<p>
|: Galaga - Play Galaga Game
</p>
<p>
|: Xboard - Resume XBoard chess tourney
</p>
<p>
|: Adanaxis - Fly your ship in a 4d environment
</p>
<p>
|: Flight of the Amazon Queen - Embark on a quest to rescue a kidnapped princess and in the process, discover the true sinister intentions of a suspiciously located Lederhosen company
</p>
<p>
|: Sudoku - Test your logic skills in this number grid puzzle
</p>
<p>
|: Monster Masher - Mash monsters and save the gnomes
</p>
<p>
|: SuperTuxKart
</p>
<p>
|: LordsAWar Army Editor - Create or Edit LordsAWar armies
</p>
<p>
|: DOSBox Emulator - Run old DOS applications
</p>
<p>
|: Childsplay - Suite of educational games for young children
</p>
<p>
|: Egoboo - 3D dungeon crawling game
</p>
<p>
|: X Slash'EM - Super Lotsa Added Stuff Hack - Extended Magic (X11)
</p>
<p>
|: Tuxfootball - 2D Football Game
</p>
<p>
|: Biloba - Up to four player network capable turn based strategy board game
</p>
<p>
|: GTK Slash'EM - Super Lotsa Added Stuff Hack - Extended Magic (GTK)
</p>
<p>
|: The Mana world - The Mana World 2D MMORPG client
</p>
<p>
|: Lights Off - Turn off all the lights
</p>
<p>
|: PIX Frogger - Help the frog cross the street
</p>
<p>
|: Robots - Avoid the robots and make them crash into each other
</p>
<p>
|: Tali - Beat the odds in a poker-style dice game
</p>
<p>
|: Trackballs
</p>
<p>
|: Raincat - 2D puzzle game featuring a fuzzy little cat
</p>
<p>
|: Tetravex - Complete the puzzle by matching numbered tiles
</p>
<p>
|: Freedroid - Clear a spaceship from all droids
</p>
<p>
|: Magicor - Puzzle game in the spirit of solomon's key
</p>
<p>
|: Kiki the nano bot
</p>
<p>
|: FreeDink - Humorous zelda-like isometric adventure/RPG
</p>
<p>
|: Tower Toppler - A clone of the 'Nebulus' game on old 8 and 16 bit machines.
</p>
<p>
|: Klotski - Slide blocks to solve the puzzle
</p>
<p>
|: eboard - A graphical chessboard program
</p>
<p>
|: Word War vi - side-scrolling shoot'em up arcade game
</p>
<p>
|: Lugaru - Third-person action game about an anthropomorphic rabbit with curiously well developed combat skills
</p>
<p>
|: B.A.L.L.Z. - Platform game with some puzzle elements
</p>
<p>
|: Mana - A 2D MMORPG client
</p>
<p>
|: PokerTH - Texas hold'em game
</p>
<p>
|: AisleRiot Solitaire - Play many different solitaire games
</p>
<p>
|: Dodgin Diamond 2
</p>
<p>
|: OpenTTD
</p>
<p>
|: Alex the Allegator 4 - Retro platform game
</p>
<p>
|: Meritous - action-adventure dungeon crawl game
</p>
<p>
|: Amoebax - Defeat your opponent by filling up their grid up with garbage.
</p>
<p>
|: Angband (SDL) - A roguelike dungeon exploration game based on the books of J.R.R.Tolkien
</p>
<p>
|: Triplane Classic - side-scrolling dogfighting game
</p>
<p>
|: Pathological - Solve puzzles involving paths and marbles
</p>
<p>
|: Block Attack - Rise of the Blocks - Switch blocks so they match
</p>
<p>
|: Luola
</p>
<p>
|: Between - game about consciousness and isolation
</p>
<p>
|: Airstrike - Dogfight an enemy plane
</p>
<p>
|: X NetHack
</p>
<p>
|: Balazar - Play a 3D adventure and roleplaying game
</p>
<p>
|: Passage - game about the passage through life
</p>
<p>
|: Numpty Physics
</p>
<p>
|: FreeCell Solitaire - Play the popular FreeCell card game
</p>
<p>
|: Balder2D - 2D overhead shooter in Zero G
</p>
<p>
|: SDL Slash'EM - Super Lotsa Added Stuff Hack - Extended Magic (SDL)
</p>
<p>
|: FloboPuyo
</p>
<p>
|: Which Way is Up - 2D platform game with a slight rotational twist
</p>
<p>
|: Crack Attack - Puzzle game similar to Tetris Attack
</p>
<p>
|: LordsAWar - Play a clone of Warlords II
</p>
<p>
|: Hedgewars
</p>
<p>
|: Five or More - Remove colored balls from the board by forming lines
</p>
<p>
|: Bomberclone - Play a Bomberman like game
</p>
<p>
|: Heroes - Collect powerups and avoid your opponents' trails
</p>
<p>
|: Secret Maryo Chronicles - A 2D platform game with style similar to classic sidescroller games
</p>
<p>
|: Gunroar - Kenta Cho's Gunroar
</p>
<p>
|: Singularity - Become the singularity
</p>
<p>
|: Quadrapassel - Fit falling blocks together
</p>
<p>
|: Minetest - InfiniMiner/Minecraft-inspired open game world
</p>
<p>
|: Angband (GTK) - A roguelike dungeon exploration game based on the books of J.R.R.Tolkien
</p>
<p>
|: Neverputt - A 3D mini golf game
</p>
<p>
|: ScummVM - Interpreter for several adventure games
</p>
<p>
|: Liquid War - A unique multiplayer wargame
</p>
<p>
|: Angband (X11) - A roguelike dungeon exploration game based on the books of J.R.R.Tolkien
</p>
<p>
|: Mahjongg - Disassemble a pile of tiles by removing matching pairs
</p>
<p>
|: Foobillard - 3D billiards game using OpenGL
</p>
<p>
|: rRootage - Destroy autocreated battleships
</p>
<p>
|: VoR
</p>
<p>
|: Search and rescue
</p>
<p>
|: Chess - Play the classic two-player boardgame of chess
</p>
<p>
|: Freedroid RPG - Isometric role playing game
</p>
<p>
|: Billard-GL - Play Billard Game
</p>
<p>
|: Widelands - A a real-time build-up strategy game
</p>
<p>
|: Nibbles - Guide a worm around a maze
</p>
<p>
|: Ardentryst - Fantasy sidescroller game
</p>
<p>
|: Trophy - 2D car racing game with power-ups
</p>
<p>
|: Zatacka - Arcade multiplayer game for 2-6 players
</p>
<p>
|: Tumiki Fighters - Kenta Cho's Tumiki Fighters
</p>
<p>
|: Funny Boat - a side scrolling arcade shooter game on a steamboat
</p>
<p>
|: T.E.G. client - Tenes Empanadas Graciela client
</p>
<p>
|: Tennix! - Play tennis against the computer or a friend
</p>
<p>
|: LordsAWar Tile Editor - Create or Edit LordsAWar tilesets
</p>
<p>
|: Battle for Wesnoth (1.10) - A fantasy turn-based strategy game
</p>
<p>
|: Feeding Frenzy! - multiplayer platform game with dwarfs fighting with/for food
</p>
<p>
|: Trigger - 3D rally racing car game
</p>
<p>
|: PCSX - Sony PlayStation emulator
</p>
<p>
|: Kobo Deluxe - Destroy enemy bases in space
</p>
<p>
|: Ceferino - Save the cows!
</p>
<p>
|: Fish Fillets - Puzzle game about witty fish saving the world sokoban-style
</p>
<p>
|: XScavenger - X11 clone of Lode Runner
</p>
<p>
|: Educational suite GCompris - Educational game for ages 2 to 10
</p>
<p>
|: Tatan - HIZ's Tatan
</p>
<p>
|: Mines - Clear hidden mines from a minefield
</p>
<p>
|: Xmille
</p>
<p>
|: Ri-li - a toy simulator game
</p>
<p>
|: SLUDGE Engine - Play SLUDGE games
</p>
<p>
|: Beneath A Steel Sky - A science-fiction adventure game set in a bleak post-apocalyptic vision of the future
</p>
<p>
|: SuperTux - A Super Mario inspired penguin platform game
</p>
<p>
|: Cytadela - old-school first person shooter
</p>
<p>
|: Iagno - Dominate the board in a classic version of Reversi
</p>
<hr>
<h3>
<a name="GRAPHICS"></a><a href="#STANDARD-MENU">Graphics</a>
</h3>
<p>
a: digiKam
</p>
<p>
b: Okular
</p>
<p>
c: Okular
</p>
<p>
d: Photo Layouts Editor
</p>
<p>
e: Kamoso - Take any picture with your web cam
</p>
<p>
f: ExpoBlending - A tool to blend bracketed images
</p>
<p>
g: KColorChooser
</p>
<p>
h: AcquireImages - A tool to acquire images using a flat scanner
</p>
<p>
i: Okular
</p>
<p>
j: Okular
</p>
<p>
k: Okular
</p>
<p>
l: Gwenview - A simple image viewer
</p>
<p>
m: Okular
</p>
<p>
n: Okular
</p>
<p>
o: Okular
</p>
<p>
p: Okular
</p>
<p>
q: KolourPaint
</p>
<p>
r: Okular
</p>
<p>
s: Okular
</p>
<p>
t: DNGConverter - A tool to batch convert RAW camera images to DNG
</p>
<p>
u: Okular
</p>
<p>
v: KSnapshot
</p>
<p>
w: Panorama - A tool to assemble images as a panorama
</p>
<p>
x: KRuler
</p>
<p>
y: KIPI Plugins - KDE Image Plugins Interface
</p>
<p>
z: K-3D - Free-as-in-freedom 3D modeling and animation software
</p>
<p>
0: Hugin Calibrate Lens - Stitch photographs together
</p>
<p>
1: Inkscape - Create and edit Scalable Vector Graphics images
</p>
<p>
2: MyPaint - Painting program for digital artists
</p>
<p>
3: XSane Image scanning program - A program to work with scanner. Can be used as a scanning, copier, OCR, fax tools.
</p>
<p>
4: Document Viewer - View multi-page documents
</p>
<p>
5: Camorama Webcam Viewer - View, alter and save images from a webcam
</p>
<p>
6: Hugin Panorama Creator - Stitch photographs together
</p>
<p>
7: Mandelbulber - Visit 3D Fractal World
</p>
<p>
8: LibreOffice Draw
</p>
<p>
9: Shotwell - Organize your photos
</p>
<p>
A: Stopmotion - Program to create stop-motion animations
</p>
<p>
B: ImageMagick (display) - Display and edit image files
</p>
<p>
C: PDF Editor - PDF Editor
</p>
<p>
D: Scribus - Page Layout and Publication
</p>
<p>
E: Xaos - Fractal Zoomer - Fractal Generator
</p>
<p>
F: Image Viewer
</p>
<p>
G: GNU Image Manipulation Program - Create images and edit photographs
</p>
<p>
H: apvlv - Alf's PDF Viewer Like Vim
</p>
<p>
I: Hugin Batch Processor - Hugin project stitching queue manager
</p>
<p>
J: Shotwell Viewer
</p>
<p>
K: Image Viewer
</p>
<p>
L: MuPDF - PDF file viewer
</p>
<p>
M: gv - View PS and/or PDF files
</p>
<p>
N: xpdf - View PDF files
</p>
<p>
O: Simple Scan - Scan Documents
</p>
<hr>
<h3>
<a name="NETWORK"></a><a href="#STANDARD-MENU">Network</a>
</h3>
<p>
a: Konqueror
</p>
<p>
b: KNode
</p>
<p>
c: Akregator - A Feed Reader for KDE
</p>
<p>
d: KPPPLogview
</p>
<p>
e: KNetAttach
</p>
<p>
f: Kopete - Instant Messenger
</p>
<p>
g: Blogilo
</p>
<p>
h: KMail
</p>
<p>
i: KRDC
</p>
<p>
j: KPPP
</p>
<p>
k: Krfb
</p>
<p>
l: KGet
</p>
<p>
m: Bookmark Editor - Bookmark Organizer and Editor
</p>
<p>
n: QWebContentEdit - Edit website contents
</p>
<p>
o: Web Browser
</p>
<p>
p: Web - Browse the web
</p>
<p>
q: SSL/SSH VNC Viewer - SSVNC - access remote VNC desktops
</p>
<p>
r: Midori - Lightweight web browser
</p>
<p>
s: Remote Desktop Viewer - Access remote desktops
</p>
<p>
t: Mail Reader
</p>
<p>
u: QBoobmsg - Send and receive messages from various websites
</p>
<p>
v: Iceweasel - Browse the World Wide Web
</p>
<p>
w: Mumble - A low-latency, high quality voice chat program for gaming
</p>
<p>
x: Email Settings - Configure email accounts
</p>
<p>
y: IcedTea Java Web Start - IcedTea Java Web Start
</p>
<p>
z: Desktop Sharing - Choose how other users can remotely view your desktop
</p>
<p>
0: Midori Private Browsing - Open a new private browsing window
</p>
<p>
1: Icedove Mail/News - Read/Write Mail/News with Icedove
</p>
<p>
2: Web - Browse the web
</p>
<p>
3: Liferea - Download and view feeds
</p>
<p>
4: Conkeror Web Browser - Browse the World Wide Web
</p>
<p>
5: Wireshark - Network traffic analyzer
</p>
<p>
6: Ekiga Softphone - Talk to people over the Internet
</p>
<p>
7: Google Gadgets (Qt) - Run Google Gadgets in KDE/Qt environment
</p>
<p>
8: MLDonkey - Graphical frontend for MLDonkey
</p>
<p>
9: Remmina - Connect to remote desktops
</p>
<p>
A: QFlatBoob - Search housings
</p>
<p>
B: Transmission - Download and share files over BitTorrent
</p>
<p>
C: Web Browser
</p>
<p>
D: QHaveDate - Optimize your probabilities to have sex on dating websites
</p>
<p>
E: X11VNC Server - Share this desktop by VNC
</p>
<p>
F: mutt - Simple text-based Mail User Agent
</p>
<p>
G: Links 2
</p>
<p>
H: Wicd Network Manager
</p>
<p>
I: Dillo - Lightweight browser
</p>
<p>
J: Gnubiff - Gnubiff is a mail notification program.
</p>
<p>
K: Luakit - Fast, small, webkit based micro-browser extensible by Lua
</p>
<hr>
<h3>
<a name="OFFICE"></a><a href="#STANDARD-MENU">Office</a>
</h3>
<p>
a: Lokalize
</p>
<p>
b: KOrganizer - Calendar and Scheduling Program
</p>
<p>
c: Kontact
</p>
<p>
d: Kontact Administration
</p>
<p>
e: KAddressBook
</p>
<p>
f: Okular
</p>
<p>
g: KTimeTracker
</p>
<p>
h: LibreOffice Calc
</p>
<p>
i: LibreOffice
</p>
<p>
j: Evolution - Manage your email, contacts and schedule
</p>
<p>
k: Document Viewer - View multi-page documents
</p>
<p>
l: Dictionary - Check word definitions and spellings in an online dictionary
</p>
<p>
m: Orage Calendar - Desktop calendar
</p>
<p>
n: LibreOffice Draw
</p>
<p>
o: Orage Globaltime - Show clocks from different countries
</p>
<p>
p: LibreOffice Writer
</p>
<p>
q: LibreOffice Base
</p>
<p>
r: LyX Document Processor - High level LaTeX frontend
</p>
<p>
s: FreeMind
</p>
<p>
t: LibreOffice Impress
</p>
<p>
u: ePDFViewer - Lightweight PDF document viewer
</p>
<p>
v: AbiWord
</p>
<p>
w: LibreOffice Math
</p>
<p>
x: mutt - Simple text-based Mail User Agent
</p>
<p>
y: Gnumeric - Calculation, Analysis, and Visualization of Information
</p>
<p>
z: Zathura - A minimalistic document viewer
</p>
<hr>
<h3>
<a name="SETTINGS"></a><a href="#STANDARD-MENU">Settings</a>
</h3>
<p>
a: KDE System Settings
</p>
<p>
b: Change Password
</p>
<p>
c: System Settings
</p>
<p>
d: Menu Editor
</p>
<p>
e: Date and Time - Date and Time preferences panel
</p>
<p>
f: Background - Change the background
</p>
<p>
g: Printing - Configure printers
</p>
<p>
h: Mouse - Configure pointer device behavior and appearance
</p>
<p>
i: Power - Power management settings
</p>
<p>
j: Workspaces - Set number and names of workspaces
</p>
<p>
k: Network Tools - View information about your network
</p>
<p>
l: Users and Groups - Add or remove users and groups
</p>
<p>
m: Window Manager - Configure window behavior and shortcuts
</p>
<p>
n: Notifications - Customize how notifications appear on your screen
</p>
<p>
o: Software Center - Lets you choose from thousands of applications available for your system
</p>
<p>
p: Network - Configure network devices and connections
</p>
<p>
q: Network - Configure network devices and connections
</p>
<p>
r: Details - System Information
</p>
<p>
s: User Accounts - Add or remove users
</p>
<p>
t: Brightness and Lock - Screen brightness and lock settings
</p>
<p>
u: Keyboard - Edit keyboard settings and application shortcuts
</p>
<p>
v: Shared Folders - Configure which folders are available for your network neighborhood
</p>
<p>
w: Preferred Applications
</p>
<p>
x: Region and Language - Change your region and language settings
</p>
<p>
y: Bluetooth - Configure Bluetooth settings
</p>
<p>
z: Color - Color management settings
</p>
<p>
0: Startup Applications - Choose what applications to start when you log in
</p>
<p>
1: Screensaver - Change screensaver properties
</p>
<p>
2: Update Manager - Show and install available updates
</p>
<p>
3: Email Settings - Configure email accounts
</p>
<p>
4: Desktop Sharing - Choose how other users can remotely view your desktop
</p>
<p>
5: Services - Configure which services will be run when the system starts
</p>
<p>
6: Universal Access - Universal Access Preferences
</p>
<p>
7: GParted - Create, reorganize, and delete partitions
</p>
<p>
8: Wacom Graphics Tablet - Set your Wacom tablet preferences
</p>
<p>
9: Displays - Change resolution and position of monitors and projectors
</p>
<p>
A: Personal File Sharing - Preferences for sharing of files
</p>
<p>
B: Appearance - Customize the look of your desktop
</p>
<p>
C: Online Accounts - Manage online accounts
</p>
<p>
D: Time and Date - Change system time, date, and timezone
</p>
<p>
E: Desktop - Set desktop background and menu and icon behaviour
</p>
<p>
F: Keyboard and Mouse - Configure keyboard, mouse, and other input devices
</p>
<p>
G: Multimedia Systems Selector - Configure defaults for GStreamer applications
</p>
<p>
H: File Manager - Configure the Thunar file manager
</p>
<p>
I: Session and Startup - Customize desktop startup and splash screen
</p>
<p>
J: Openbox Configuration Manager - Configure and personalize the Openbox window manager
</p>
<p>
K: Keyboard - Edit keyboard settings and application shortcuts
</p>
<p>
L: ARandR
</p>
<p>
M: Settings Editor - Graphical settings editor for Xfconf
</p>
<p>
N: Software Sources - Configure the sources for installable software and updates
</p>
<p>
O: GCompris Administration - Administration for gcompris
</p>
<p>
P: Monitor Settings - Change screen resolution and configure external monitors
</p>
<p>
Q: Synaptic Package Manager - Install, remove and upgrade software packages
</p>
<p>
R: Orage preferences - Settings for the Xfce 4 Calendar Application (Orage)
</p>
<p>
S: Window Manager Tweaks - Fine-tune window behaviour and effects
</p>
<p>
T: Network Connections - Manage and change your network connection settings
</p>
<p>
U: Preferred Applications
</p>
<p>
V: Sound - Change sound volume and sound events
</p>
<p>
W: Guake Preferences - Comment
</p>
<p>
X: System Settings
</p>
<p>
Y: IcedTea Web Control Panel - Configure IcedTea Web (javaws and plugin)
</p>
<p>
Z: Settings Manager - Graphical Settings Manager for Xfce 4
</p>
<p>
|: Tux Paint Config. - Configure Tux Paint
</p>
<p>
|: Passwords and Keys - Manage your passwords and encryption keys
</p>
<p>
|: Software Settings - Change software update preferences and enable or disable software sources
</p>
<p>
|: Main Menu - Add or remove applications from the main menu
</p>
<p>
|: Printers - Change printer settings
</p>
<p>
|: Desktop Session Settings - Manage applications loaded in desktop session
</p>
<p>
|: OpenJDK Java 6 Policy Tool - OpenJDK Java 6 Policy Tool
</p>
<p>
|: Accessibility - Improve keyboard and mouse accessibility
</p>
<p>
|: Mouse and Touchpad - Set your mouse and touchpad preferences
</p>
<p>
|: Customize Look and Feel - Customizes look and feel of your desktop and applications
</p>
<p>
|: Pointing devices - Set your mouse and touchpad preferences
</p>
<p>
|: Panel
</p>
<p>
|: Power Manager - Settings for the Xfce Power Manager
</p>
<p>
|: Removable Drives and Media - Configure management of removable drives and media
</p>
<p>
|: Display - Configure screen settings and layout
</p>
<hr>
<h3>
<a name="SYSTEM"></a><a href="#STANDARD-MENU">System</a>
</h3>
<p>
a: KDiskFree
</p>
<p>
b: Konqueror
</p>
<p>
c: Nepomuk File Indexing Controller - System tray icon to control the behaviour of the Nepomuk file indexer
</p>
<p>
d: Nepomuk Backup
</p>
<p>
e: Konqueror
</p>
<p>
f: Konqueror
</p>
<p>
g: Konsole
</p>
<p>
h: System Monitor - View current processes and monitor system state
</p>
<p>
i: Dolphin
</p>
<p>
j: KwikDisk
</p>
<p>
k: Konqueror
</p>
<p>
l: KSystemLog
</p>
<p>
m: File Manager - Super User Mode
</p>
<p>
n: KWalletManager
</p>
<p>
o: Krusader - root-mode
</p>
<p>
p: Krfb
</p>
<p>
q: KUser
</p>
<p>
r: KInfoCenter
</p>
<p>
s: KRandRTray - A panel applet for resizing and reorientating X screens.
</p>
<p>
t: Software Install - Install selected software on the system
</p>
<p>
u: Synaptic Package Manager - Install, remove and upgrade software packages
</p>
<p>
v: Printing - Configure printers
</p>
<p>
w: UXTerm - standard terminal emulator for the X window system
</p>
<p>
x: Network Tools - View information about your network
</p>
<p>
y: Xosview - X based system monitor
</p>
<p>
z: Log File Viewer - View or monitor system log files
</p>
<p>
0: Users and Groups - Add or remove users and groups
</p>
<p>
1: Configuration Editor - Directly edit your entire configuration database
</p>
<p>
2: Software Log Viewer - View past package management tasks
</p>
<p>
3: Software Center - Lets you choose from thousands of applications available for your system
</p>
<p>
4: Wine Uninstaller - Uninstall Windows programs
</p>
<p>
5: Network - Configure network devices and connections
</p>
<p>
6: Bulk Rename - Rename Multiple Files
</p>
<p>
7: User Accounts - Add or remove users
</p>
<p>
8: CD/DVD Creator - Create CDs and DVDs
</p>
<p>
9: Shared Folders - Configure which folders are available for your network neighborhood
</p>
<p>
A: Power Statistics - Observe power management
</p>
<p>
B: Wine configuration - Setup the compatibility layer for Windows programs
</p>
<p>
C: Update Manager - Show and install available updates
</p>
<p>
D: Software Install - Install selected software on the system
</p>
<p>
E: Services - Configure which services will be run when the system starts
</p>
<p>
F: Disk Usage Analyzer - Check folder sizes and available disk space
</p>
<p>
G: GParted - Create, reorganize, and delete partitions
</p>
<p>
H: Panel
</p>
<p>
I: Time and Date - Change system time, date, and timezone
</p>
<p>
J: Task Manager - Manage running processes
</p>
<p>
K: System Monitor - View current processes and monitor system state
</p>
<p>
L: Open Folder with Thunar - Open the specified folders in Thunar
</p>
<p>
M: Catalog Installer - Install a catalog of software on the system
</p>
<p>
N: Log Out
</p>
<p>
O: Keyboard Layout - Preview keyboard layouts
</p>
<p>
P: XTerm - standard terminal emulator for the X window system
</p>
<p>
Q: Reportbug - Report bugs to the Debian BTS
</p>
<p>
R: GDebi Package Installer - Install and view software packages
</p>
<p>
S: Terminal emulator - Terminal Emulator
</p>
<p>
T: Xfe - A lightweight file manager for X Window
</p>
<p>
U: Thunar File Manager - Browse the filesystem with the file manager
</p>
<p>
V: Synaptic Package Manager - Install, remove and upgrade software packages
</p>
<p>
W: Software Update - Update software installed on the system
</p>
<p>
X: Midnight Commander - File manager
</p>
<p>
Y: dconf Editor - Directly edit your entire configuration database
</p>
<p>
Z: Htop - Show System Processes
</p>
<p>
|: UNetbootin - Tool for creating Live USB drives
</p>
<p>
|: Add/Remove Software - Add or remove software installed on the system
</p>
<p>
|: Service Pack Creator - Create service packs for sharing with other computers
</p>
<hr>
<h3>
<a name="UTILITY"></a><a href="#STANDARD-MENU">Utility</a>
</h3>
<p>
a: KJots
</p>
<p>
b: KTimer
</p>
<p>
c: Okteta
</p>
<p>
d: Krusader
</p>
<p>
e: Ark
</p>
<p>
f: Snippets datafile editor
</p>
<p>
g: KNotes
</p>
<p>
h: Akonaditray
</p>
<p>
i: KonsoleKalendar
</p>
<p>
j: Home
</p>
<p>
k: KDE Groupware Wizard
</p>
<p>
l: Help
</p>
<p>
m: Kate
</p>
<p>
n: Klipper
</p>
<p>
o: Kleopatra
</p>
<p>
p: KMouth
</p>
<p>
q: Kleopatra
</p>
<p>
r: SuperKaramba - An engine for cool desktop eyecandy.
</p>
<p>
s: KGpg - A GnuPG frontend
</p>
<p>
t: KAlarm
</p>
<p>
u: KFileReplace
</p>
<p>
v: KWrite
</p>
<p>
w: KTeaTime
</p>
<p>
x: KFontView
</p>
<p>
y: KCalc
</p>
<p>
z: Jovie - KDE Text To Speech Service
</p>
<p>
0: Sweeper
</p>
<p>
1: KMag
</p>
<p>
2: KTimeTracker
</p>
<p>
3: KMouseTool - Clicks the mouse for you, reducing the effects of RSI
</p>
<p>
4: Find Files/Folders
</p>
<p>
5: Filelight - View disk usage information
</p>
<p>
6: KCharSelect
</p>
<p>
7: Shutter - Capture, edit and share screenshots
</p>
<p>
8: Time Tracker - Project Hamster - track your time
</p>
<p>
9: Run Program...
</p>
<p>
A: Guake Terminal - Use the command line in a Quake-like terminal
</p>
<p>
B: Help
</p>
<p>
C: Xfimage - A simple image viewer for Xfe
</p>
<p>
D: Add New Program - Adds Zero Install programs to your Applications menu
</p>
<p>
E: Xournal - Take handwritten notes
</p>
<p>
F: Leafpad - Simple text editor
</p>
<p>
G: Terminal - Use the command line
</p>
<p>
H: File Manager - Configure the Thunar file manager
</p>
<p>
I: Calculator - Perform arithmetic, scientific or financial calculations
</p>
<p>
J: Kupfer - Convenient command and access tool for applications and documents
</p>
<p>
K: Xfview - A simple text viewer for Xfe
</p>
<p>
L: Galculator - Perform simple and scientific calculations
</p>
<p>
M: Character Map - Insert special characters into documents
</p>
<p>
N: Time Tracker - Project Hamster - track your time
</p>
<p>
O: Bulk Rename - Rename Multiple Files
</p>
<p>
P: Search for Files... - Locate documents and folders on this computer by name or content
</p>
<p>
Q: Live Magic - Create Debian Live systems (LiveCDs, etc.)
</p>
<p>
R: Xfpack - A simple package manager for Xfe
</p>
<p>
S: Manage Programs - Update or Remove Zero Install programs on your Applications menu
</p>
<p>
T: Tux Commander - A two panel file manager
</p>
<p>
U: About Xfce
</p>
<p>
V: gedit - Edit text files
</p>
<p>
W: Curtain - Show and move a curtain on the desktop
</p>
<p>
X: Orage Globaltime - Show clocks from different countries
</p>
<p>
Y: Screenshot - Save images of your desktop or individual windows
</p>
<p>
Z: Bluetooth Device Setup - Setup Bluetooth devices
</p>
<p>
|: VirtualBox - Run several virtual systems on a single host computer
</p>
<p>
|: Help
</p>
<p>
|: GNOME Commander - A two paned file manager
</p>
<p>
|: Time Tracking Overview - The overview window of hamster time tracker
</p>
<p>
|: GNOME Shell Extension Preferences - Configure GNOME Shell Extensions
</p>
<p>
|: Spotlighter - Show and move a spotlight on the desktop
</p>
<p>
|: File Manager - Configure the Thunar file manager
</p>
<p>
|: Xarchiver - A GTK+2 only archive manager
</p>
<p>
|: Take Vector Screenshot - Save vector images of application windows
</p>
<p>
|: Battery Charge Graph - Battery Charge Graph
</p>
<p>
|: Application Finder - Find and launch applications installed on your system
</p>
<p>
|: Open Folder with Thunar - Open the specified folders in Thunar
</p>
<p>
|: Worker - File manager for X.
</p>
<p>
|: Archive Manager - Create and modify an archive
</p>
<p>
|: Weboob backends configuration - Configure Weboob backends
</p>
<p>
|: GNOME Shell - Window management and application launching
</p>
<p>
|: Files - Access and organize files
</p>
<p>
|: LXTerminal - Use the command line
</p>
<p>
|: On-Screen Keyboard - Navigate applications and type using alternative input devices
</p>
<p>
|: Terminal emulator - Terminal Emulator
</p>
<p>
|: GNU Emacs 23 - View and edit files
</p>
<p>
|: Thunar File Manager - Browse the filesystem with the file manager
</p>
<p>
|: Midnight Commander - File manager
</p>
<p>
|: Xfwrite - A simple text editor for Xfe
</p>
<p>
|: Gentoo - Fully GUI-configurable, two-pane X file manager
</p>
<p>
|: Disk Utility - Manage Drives and Media
</p>
<p>
|: Terminal Emulator
</p>
<p>
|: Root Terminal - Opens a terminal as the root user, using gksu to ask for the password
</p>
<p>
|: Bluetooth Transfer - Send files via Bluetooth
</p>
<p>
|: Main Menu - Add or remove applications from the main menu
</p>
<p>
|: Image Viewer
</p>
<p>
|: Contacts
</p>
<hr>
<h3>
<a name="TERMINALEMULATOR"></a><a href="#STANDARD-MENU">Terminalemulator</a>
</h3>
<p>
a: Konsole
</p>
<p>
b: Guake Terminal - Use the command line in a Quake-like terminal
</p>
<p>
c: UXTerm - standard terminal emulator for the X window system
</p>
<p>
d: Terminal - Use the command line
</p>
<p>
e: XTerm - standard terminal emulator for the X window system
</p>
<p>
f: LXTerminal - Use the command line
</p>
<p>
g: Terminal emulator - Terminal Emulator
</p>
<p>
h: Root Terminal - Opens a terminal as the root user, using gksu to ask for the password
</p>
<hr>
<h3>
<a name="SCREENSAVER"></a><a href="#STANDARD-MENU">Screensaver</a>
</h3>
<p>
a: LCDscrub - This screen saver is not meant to look pretty, but rather, to repair burn-in on LCD monitors. Believe it or not, screen burn is not a thing of the past. It can happen to LCD screens pretty easily, even in this modern age. However, leaving the screen on and displaying high contrast images can often repair the damage. That's what this screen saver does. See also: http://docs.info.apple.com/article.html?artnum
</p>
<p>
b: Kumppa - Spiraling, spinning, and very, very fast splashes of color rush toward the screen. Written by Teemu Suutari.
</p>
<p>
c: CloudLife - Generates cloud-like formations based on a variant of Conway's Life. The difference is that cells have a maximum age, after which they count as 3 for populating the next generation. This makes long-lived formations explode instead of just sitting there. http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life Written by Don Marti.
</p>
<p>
d: m6502 - This emulates a 6502 microprocessor. The family of 6502 chips were used throughout the 70's and 80's in machines such as the Atari 2600, Commodore PET, VIC20 and C64, Apple ][, and the NES. Some example programs are included, and it can also read in an assembly file as input. Original JavaScript Version by Stian Soreng: http://www.6502asm.com/. Ported to XScreenSaver by Jeremy English. Written by Stian Soreng and Jeremy English.
</p>
<p>
e: Galaxy - This draws spinning galaxies, which then collide and scatter their stars to the, uh, four winds or something. Written by Uli Siegmund, Harald Backert, and Hubert Feyrer.
</p>
<p>
f: IFS - This one draws spinning, colliding iterated-function-system images. Note that the "Detail" parameter is exponential. Number of points drawn is functions^detail. http://en.wikipedia.org/wiki/Iterated_function_system Written by Chris Le Sueur and Robby Griffin.
</p>
<p>
g: Swirl - Flowing, swirly patterns. Written by M. Dobie and R. Taylor.
</p>
<p>
h: StonerView - Chains of colorful squares dance around each other in complex spiral patterns. Inspired by David Tristram's `electropaint' screen saver, originally written for SGI computers in the late 1980s or early 1990s. Written by Andrew Plotkin.
</p>
<p>
i: Slip - This throws some random bits on the screen, then sucks them through a jet engine and spews them out the other side. To avoid turning the image completely to mush, every now and then it will it interject some splashes of color into the scene, or go into a spin cycle, or stretch the image like taffy. Written by Scott Draves and Jamie Zawinski.
</p>
<p>
j: GFlux - Draws a rippling waves on a rotating wireframe grid. Written by Josiah Pease.
</p>
<p>
k: Munch - DATAI 2 ADDB 1,2 ROTC 2,-22 XOR 1,2 JRST .-4 As reported by HAKMEM, in 1962, Jackson Wright wrote the above PDP-1 code. That code still lives on here, some 46 years later. The number of lines of enclosing code has increased substantially, however. http://en.wikipedia.org/wiki/HAKMEM http://en.wikipedia.org/wiki/Munching_square Written by Jackson Wright and Tim Showalter.
</p>
<p>
l: Apple2 - Simulates an original Apple ][ Plus computer in all its 1979 glory. It also reproduces the appearance of display on a color television set of the period. In "Basic Programming Mode", a simulated user types in a BASIC program and runs it. In "Text Mode", it displays the output of a program, or the contents of a file or URL. In "Slideshow Mode", it chooses random images and displays them within the limitations of the Apple ][ display hardware. (Six available colors in hi-res mode!) On X11 systems, This program is also a fully-functional VT100 emulator. http://en.wikipedia.org/wiki/Apple_II_series Written by Trevor Blackwell.
</p>
<p>
m: Hypertorus - This shows a rotating Clifford Torus: a torus lying on the "surface" of a 4D hypersphere. Inspired by Thomas Banchoff's book "Beyond the Third Dimension: Geometry, Computer Graphics, and Higher Dimensions", Scientific American Library, 1990. http://en.wikipedia.org/wiki/N-sphere http://en.wikipedia.org/wiki/Clifford_torus http://en.wikipedia.org/wiki/Regular_polytope Written by Carsten Steger.
</p>
<p>
n: Jigsaw - This grabs a screen image, carves it up into a jigsaw puzzle, shuffles it, and then solves the puzzle. This works especially well when you feed it an external video signal instead of letting it grab the screen image (actually, I guess this is generally true...) When it is grabbing a video image, it is sometimes pretty hard to guess what the image is going to look like once the puzzle is solved. Written by Jamie Zawinski.
</p>
<p>
o: Rorschach - This generates random inkblot patterns via a reflected random walk. Any deep-seated neurotic tendencies which this program reveals are your own problem. http://en.wikipedia.org/wiki/Rorschach_inkblot_test http://en.wikipedia.org/wiki/Random_walk Written by Jamie Zawinski.
</p>
<p>
p: GLHanoi - Solves the Towers of Hanoi puzzle. Move N disks from one pole to another, one disk at a time, with no disk ever resting on a disk smaller than itself. http://en.wikipedia.org/wiki/Tower_of_Hanoi Written by Dave Atkinson; 2005.
</p>
<p>
q: Circuit - Animates a number of 3D electronic components. Written by Ben Buxton.
</p>
<p>
r: Starfish - This generates a sequence of undulating, throbbing, star-like patterns which pulsate, rotate, and turn inside out. Another display mode uses these shapes to lay down a field of colors, which are then cycled. The motion is very organic. Written by Jamie Zawinski.
</p>
<p>
s: Julia - Animates the Julia set (a close relative of the Mandelbrot set). The small moving dot indicates the control point from which the rest of the image was generated. See also the "Discrete" screen saver. http://en.wikipedia.org/wiki/Julia_set Written by Sean McCullough.
</p>
<p>
t: Maze - This generates random mazes (with various different algorithms), and then solves them. Backtracking and look-ahead paths are displayed in different colors. Written by Jim Randell and many others.
</p>
<p>
u: VidWhacker - This is a shell script that grabs a frame of video from the system's video input, and then uses some PBM filters (chosen at random) to manipulate and recombine the video frame in various ways (edge detection, subtracting the image from a rotated version of itself, etc.) Then it displays that image for a few seconds, and does it again. This works really well if you just feed broadcast television into it. Written by Jamie Zawinski.
</p>
<p>
v: Pipes - A growing plumbing system, with bolts and valves. Written by Marcelo Vianna.
</p>
<p>
w: SBalls - Draws an animation of textured balls spinning like crazy. Written by Eric Lassauge.
</p>
<p>
x: MirrorBlob - Draws a wobbly blob that distorts the image behind it. Written by Jon Dowdall.
</p>
<p>
y: Polyominoes - Repeatedly attempts to completely fill a rectangle with irregularly-shaped puzzle pieces. http://en.wikipedia.org/wiki/Polyomino Written by Stephen Montgomery-Smith.
</p>
<p>
z: Flame - Iterative fractals. Written by Scott Draves.
</p>
<p>
0: AntSpotlight - Draws an ant (with a headlight) who walks on top of an image of your desktop or other image. Written by Blair Tennessy.
</p>
<p>
1: XLyap - This generates pretty fractal pictures via the Lyapunov exponent. http://en.wikipedia.org/wiki/Lyapunov_exponent Written by Ron Record.
</p>
<p>
2: FontGlide - Puts text on the screen using large characters that glide in from the edges, assemble, then disperse. Alternately, it can simply scroll whole sentences from right to left. Written by Jamie Zawinski.
</p>
<p>
3: Spotlight - Draws a spotlight scanning across a black screen, illuminating the underlying desktop (or a picture) when it passes. Written by Rick Schultz and Jamie Zawinski.
</p>
<p>
4: SkyTentacles - There is a tentacled abomination in the sky. From above you it devours. Written by Jamie Zawinski.
</p>
<p>
5: Surfaces - This draws a visualization of several interesting parametric surfaces. http://mathworld.wolfram.com/DinisSurface.html http://en.wikipedia.org/wiki/Enneper_surface http://mathworld.wolfram.com/EnnepersMinimalSurface.html http://mathworld.wolfram.com/KuenSurface.html http://en.wikipedia.org/wiki/Moebius_strip http://mathworld.wolfram.com/Seashell.html http://mathworld.wolfram.com/SwallowtailCatastrophe.html http://mathworld.wolfram.com/BohemianDome.html http://en.wikipedia.org/wiki/Whitney_umbrella http://mathworld.wolfram.com/PlueckersConoid.html http://mathworld.wolfram.com/HennebergsMinimalSurface.html http://mathworld.wolfram.com/CatalansSurface.html http://mathworld.wolfram.com/CorkscrewSurface.html Written by Andrey Mirtchovski and Carsten Steger.
</p>
<p>
6: GLPlanet - Draws a planet bouncing around in space. The built-in image is a map of the earth (extracted from `xearth'), but you can wrap any texture around the sphere, e.g., the planetary textures that come with `ssystem'. Written by David Konerding.
</p>
<p>
7: Intermomentary - A surface is filled with a hundred medium to small sized circles. Each circle has a different size and direction, but moves at the same slow rate. Displays the instantaneous intersections of the circles as well as the aggregate intersections of the circles. The circles begin with a radius of 1 pixel and slowly increase to some arbitrary size. Circles are drawn with small moving points along the perimeter. The intersections are rendered as glowing orbs. Glowing orbs are rendered only when a perimeter point moves past the intersection point. Written by Casey Reas, William Ngan, Robert Hodgin, and Jamie Zawinski.
</p>
<p>
8: Cynosure - Random dropshadowed rectangles pop onto the screen in lockstep. Written by Ozymandias G. Desiderata, Jamie Zawinski, and Stephen Linhart.
</p>
<p>
9: WhirlWindWarp - Floating stars are acted upon by a mixture of simple 2D forcefields. The strength of each forcefield changes continuously, and it is also switched on and off at random. Written by Paul 'Joey' Clark.
</p>
<p>
A: SpeedMine - Simulates speeding down a rocky mineshaft, or a funky dancing worm. Written by Conrad Parker.
</p>
<p>
B: Flow - Strange attractors formed of flows in a 3D differential equation phase space. Features the popular attractors described by Lorentz, Roessler, Birkhoff and Duffing, and can discover entirely new attractors by itself. http://en.wikipedia.org/wiki/Attractor#Strange_attractor Written by Tim Auckland.
</p>
<p>
C: Bouboule - This draws what looks like a spinning, deforming balloon with varying-sized spots painted on its invisible surface. Written by Jeremie Petit.
</p>
<p>
D: Barcode - Draws a random sequence of colorful barcodes scrolling across your screen. CONSUME! The barcodes follow the UPC-A, UPC-E, EAN-8 or EAN-13 standards. http://en.wikipedia.org/wiki/Universal_Product_Code http://en.wikipedia.org/wiki/European_Article_Number Written by Dan Bornstein.
</p>
<p>
E: Moire2 - Generates fields of concentric circles or ovals, and combines the planes with various operations. The planes are moving independently of one another, causing the interference lines to spray. http://en.wikipedia.org/wiki/Moire_pattern Written by Jamie Zawinski.
</p>
<p>
F: BouncingCow - A Cow. A Trampoline. Together, they fight crime. Written by Jamie Zawinski.
</p>
<p>
G: Grav - This draws a simple orbital simulation. With trails enabled, it looks kind of like a cloud-chamber photograph. Written by Greg Bowering.
</p>
<p>
H: Greynetic - Draws random colored, stippled and transparent rectangles. Written by Jamie Zawinski.
</p>
<p>
I: Atunnel - Draws an animation of a textured tunnel in GL. Written by Eric Lassauge and Roman Podobedov.
</p>
<p>
J: Sproingies - Slinky-like creatures walk down an infinite staircase and occasionally explode! http://en.wikipedia.org/wiki/Slinky http://en.wikipedia.org/wiki/Q%2Abert http://en.wikipedia.org/wiki/Marble_Madness Written by Ed Mackey.
</p>
<p>
K: Hilbert - This draws the recursive Hilbert space-filling curve, in both 2D and 3D variants. It incrementally animates the growth and recursion to the maximum depth, then unwinds it back. The Hilbert path is a single contiguous line that can fill a volume without crossing itself. As a data structure, Hilbert paths are useful because ordering along the curve preserves locality: points that close together along the curve are also close together in space. The converse is often, but not always, true. The coloration reflects this. http://en.wikipedia.org/wiki/Hilbert_curve Written by Jamie Zawinski.
</p>
<p>
L: Mountain - Generates random 3D plots that look vaguely mountainous. Written by Pascal Pensa.
</p>
<p>
M: Polytopes - This shows one of the six regular 4D polytopes rotating in 4D. Inspired by H.S.M Coxeter's book "Regular Polytopes", 3rd Edition, Dover Publications, Inc., 1973, and Thomas Banchoff's book "Beyond the Third Dimension: Geometry, Computer Graphics, and Higher Dimensions", Scientific American Library, 1990. http://en.wikipedia.org/wiki/Hypercube http://en.wikipedia.org/wiki/Regular_polytope Written by Carsten Steger.
</p>
<p>
N: Morph3D - Platonic solids that turn inside out and get spikey. http://en.wikipedia.org/wiki/Platonic_solid Written by Marcelo Vianna.
</p>
<p>
O: GLMatrix - Draws 3D dropping characters similar to what is seen in the title sequence of "The Matrix". See also "xmatrix" for a 2D rendering of the similar effect that appeared on the computer monitors actually *in* the movie. Written by Jamie Zawinski.
</p>
<p>
P: FluidBalls - Models the physics of bouncing balls, or of particles in a gas or fluid, depending on the settings. If "Shake Box" is selected, then every now and then, the box will be rotated, changing which direction is down (in order to keep the settled balls in motion.) Written by Peter Birtles and Jamie Zawinski.
</p>
<p>
Q: Qix - Bounces a series of line segments around the screen, and uses variations on this basic motion pattern to produce all sorts of different presentations: line segments, filled polygons, and overlapping translucent areas. http://en.wikipedia.org/wiki/Qix Written by Jamie Zawinski.
</p>
<p>
R: CubicGrid - Draws the view of an observer located inside a rotating 3D lattice of colored points. Written by Vasek Potocek.
</p>
<p>
S: Boing - This bouncing ball is a clone of the first graphics demo for the Amiga 1000, which was written by Dale Luck and RJ Mical during a break at the 1984 Consumer Electronics Show (or so the legend goes.) This looks like the original Amiga demo if you turn off "smoothing" and "lighting" and turn on "scanlines", and is somewhat more modern otherwise. http://en.wikipedia.org/wiki/Amiga#Boing_Ball Written by Jamie Zawinski.
</p>
<p>
T: GLKnots - Generates some twisting 3d knot patterns. Spins 'em around. http://en.wikipedia.org/wiki/Knot_theory Written by Jamie Zawinski.
</p>
<p>
U: RubikBlocks - Animates the Rubik's Mirror Blocks puzzle. See also the "Rubik", "Cube21", and "GLSnake" screen savers. http://en.wikipedia.org/wiki/Combination_puzzles#Irregular_Cuboids Written by Vasek Potocek.
</p>
<p>
V: BSOD - BSOD stands for "Blue Screen of Death". The finest in personal computer emulation, BSOD simulates popular screen savers from a number of less robust operating systems. Written by Jamie Zawinski.
</p>
<p>
W: Celtic - Repeatedly draws random Celtic cross-stitch patterns. http://en.wikipedia.org/wiki/Celtic_knot Written by Max Froumentin.
</p>
<p>
X: TimeTunnel - Draws an animation similar to the opening and closing effects on the Dr. Who TV show. Written by Sean P. Brennan.
</p>
<p>
Y: Rocks - This draws an animation of flight through an asteroid field, with changes in rotation and direction. Written by Jamie Zawinski.
</p>
<p>
Z: Kaleidescope - A simple kaleidoscope. See also "GLeidescope". http://en.wikipedia.org/wiki/Kaleidoscope Written by Ron Tapia.
</p>
<p>
|: Deluxe - Draws a pulsing sequence of transparent stars, circles, and lines. Written by Jamie Zawinski.
</p>
<p>
|: Pinion - Draws an interconnected set of gears moving across the screen. See also the "Gears" and "MoebiusGears" screen savers. http://en.wikipedia.org/wiki/Involute_gear Written by Jamie Zawinski.
</p>
<p>
|: Hopalong - This draws lacy fractal patterns based on iteration in the imaginary plane, from a 1986 Scientific American article. See also the "Discrete" screen saver. Written by Patrick Naughton.
</p>
<p>
|: Atlantis - A 3D animation of a number of sharks, dolphins, and whales. Written by Mark Kilgard.
</p>
<p>
|: Goop - This draws set of animating, transparent, amoeba-like blobs. The blobs change shape as they wander around the screen, and they are translucent, so you can see the lower blobs through the higher ones, and when one passes over another, their colors merge. I got the idea for this from a mouse pad I had once, which achieved the same kind of effect in real life by having several layers of plastic with colored oil between them. Written by Jamie Zawinski.
</p>
<p>
|: Noof - Draws some rotatey patterns, using OpenGL. Written by Bill Torzewski.
</p>
<p>
|: Pong - This simulates the 1971 Pong home video game, as well as various artifacts from displaying it on a color TV set. In clock mode, the score keeps track of the current time. http://en.wikipedia.org/wiki/Pong Written by Jeremy English and Trevor Blackwell.
</p>
<p>
|: Interaggregate - A surface is filled with a hundred medium to small sized circles. Each circle has a different size and direction, but moves at the same slow rate. Displays the instantaneous intersections of the circles as well as the aggregate intersections of the circles. Though actually it doesn't look like circles at all! Written by Casey Reas, William Ngan, Robert Hodgin, and Jamie Zawinski.
</p>
<p>
|: Petri - This simulates colonies of mold growing in a petri dish. Growing colored circles overlap and leave spiral interference in their wake. Written by Dan Bornstein.
</p>
<p>
|: Fiberlamp - Draws a groovy rotating fiber optic lamp. Written by Tim Auckland.
</p>
<p>
|: Pyro - Exploding fireworks. See also the "Fireworkx", "Eruption", and "XFlame" screen savers. Written by Jamie Zawinski.
</p>
<p>
|: Wormhole - Flying through a colored wormhole in space. Written by Jon Rafkind.
</p>
<p>
|: Spheremonics - These closed objects are commonly called spherical harmonics, although they are only remotely related to the mathematical definition found in the solution to certain wave functions, most notably the eigenfunctions of angular momentum operators. http://en.wikipedia.org/wiki/Spherical_harmonics#Visualization_of_the_spherical_harmonics Written by Paul Bourke and Jamie Zawinski.
</p>
<p>
|: Substrate - Crystalline lines grow on a computational substrate. A simple perpendicular growth rule creates intricate city-like structures. Written by J. Tarbell and Mike Kershaw.
</p>
<p>
|: AntMaze - Draws a few views of a few ants walking around in a simple maze. Written by Blair Tennessy.
</p>
<p>
|: Crackberg - Flies through height maps, optionally animating the creation and destruction of generated tiles; tiles `grow' into place. Written by Matus Telgarsky.
</p>
<p>
|: DecayScreen - This takes an image and makes it melt. You've no doubt seen this effect before, but no screensaver would really be complete without it. It works best if there's something colorful visible. Warning, if the effect continues after the screen saver is off, seek medical attention. Written by David Wald, Vivek Khera, Jamie Zawinski, and Vince Levey.
</p>
<p>
|: Tangram - Solves tangram puzzles. http://en.wikipedia.org/wiki/Tangram Written by Jeremy English.
</p>
<p>
|: Lavalite - Draws a 3D Simulation a Lava Lite(r). Odd-shaped blobs of a mysterious substance are heated, slowly rise to the top of the bottle, and then drop back down as they cool. This simulation requires a fairly fast machine (both CPU and 3D performance.) "LAVA LITE(r) and the configuration of the LAVA(r) brand motion lamp are registered trademarks of Haggerty Enterprises, Inc. The configuration of the globe and base of the motion lamp are registered trademarks of Haggerty Enterprises, Inc. in the U.S.A. and in other countries around the world." http://en.wikipedia.org/wiki/Lava_lamp http://en.wikipedia.org/wiki/Metaballs Written by Jamie Zawinski.
</p>
<p>
|: Pulsar - Draws some intersecting planes, making use of alpha blending, fog, textures, and mipmaps. Written by David Konerding.
</p>
<p>
|: RotZoomer - Creates a collage of rotated and scaled portions of the screen. Written by Claudio Matsuoka.
</p>
<p>
|: Engine - Draws a simple model of an engine that floats around the screen. http://en.wikipedia.org/wiki/Internal_combustion_engine#Operation Written by Ben Buxton and Ed Beroset.
</p>
<p>
|: Phosphor - Draws a simulation of an old terminal, with large pixels and long-sustain phosphor. On X11 systems, This program is also a fully-functional VT100 emulator! Written by Jamie Zawinski.
</p>
<p>
|: Rubik - Draws a Rubik's Cube that rotates in three dimensions and repeatedly shuffles and solves itself. See also the "GLSnake" and "Cube21" screen savers. http://en.wikipedia.org/wiki/Rubik%27s_Cube Written by Marcelo Vianna.
</p>
<p>
|: Zoom - Zooms in on a part of the screen and then moves around. With the "Lenses" option, the result is like looking through many overlapping lenses rather than just a simple zoom. Written by James Macnicol.
</p>
<p>
|: Polyhedra - Displays different 3D solids and some information about each. A new solid is chosen every few seconds. There are 75 uniform polyhedra, plus 5 infinite sets of prisms and antiprisms; including their duals brings the total to 160. http://en.wikipedia.org/wiki/Uniform_polyhedra Written by Dr. Zvi Har'El and Jamie Zawinski.
</p>
<p>
|: Lockward - A translucent spinning, blinking thing. Sort of a cross between the wards in an old combination lock and those old backlit information displays that animated and changed color via polarized light. Written by Leo L. Schwab.
</p>
<p>
|: Stairs - Escher's infinite staircase. http://en.wikipedia.org/wiki/Maurits_Cornelis_Escher Written by Marcelo Vianna.
</p>
<p>
|: Loop - Generates loop-shaped colonies that spawn, age, and eventually die. http://en.wikipedia.org/wiki/Langton%27s_loops Written by David Bagley.
</p>
<p>
|: Bubble3D - Draws a stream of rising, undulating 3D bubbles, rising toward the top of the screen, with transparency and specular reflections. Written by Richard Jones.
</p>
<p>
|: CompanionCube - The symptoms most commonly produced by Enrichment Center testing are superstition, perceiving inanimate objects as alive, and hallucinations. The Enrichment Center reminds you that the weighted companion cube will never threaten to stab you and, in fact, cannot speak. In the event that the Weighted Companion Cube does speak, the Enrichment Center urges you to disregard its advice. http://en.wikipedia.org/wiki/Portal_%28video_game%29 Written by Jamie Zawinski.
</p>
<p>
|: Juggler3D - 3D simulation of a juggler performing with balls, clubs and rings. http://en.wikipedia.org/wiki/Siteswap Written by Brian Apps.
</p>
<p>
|: Anemone - Wiggling tentacles. Written by Gabriel Finch.
</p>
<p>
|: MoebiusGears - Draws a closed, interlinked chain of rotating gears. The layout of the gears follows the path of a moebius strip. See also the "Pinion" and "Gears" screen savers. http://en.wikipedia.org/wiki/Involute_gear http://en.wikipedia.org/wiki/Moebius_strip Written by Jamie Zawinski.
</p>
<p>
|: Hypnowheel - Draws a series of overlapping, translucent spiral patterns. The tightness of their spirals fluctuates in and out. http://en.wikipedia.org/wiki/Moire_pattern Written by Jamie Zawinski.
</p>
<p>
|: Sierpinski - This draws the two-dimensional variant of the recursive Sierpinski triangle fractal. See also the "Sierpinski3D" screen saver. http://en.wikipedia.org/wiki/Sierpinski_triangle Written by Desmond Daignault.
</p>
<p>
|: Sierpinski3D - This draws the Sierpinski tetrahedron fractal, the three-dimensional variant of the recursive Sierpinski triangle. http://en.wikipedia.org/wiki/Sierpinski_triangle#Analogs_in_higher_dimension Written by Tim Robinson and Jamie Zawinski.
</p>
<p>
|: GLText - Displays a few lines of text spinning around in a solid 3D font. The text can use strftime() escape codes to display the current date and time. Written by Jamie Zawinski.
</p>
<p>
|: Euler2D - Simulates two dimensional incompressible inviscid fluid flow. http://en.wikipedia.org/wiki/Euler_equations_%28fluid_dynamics%29 http://en.wikipedia.org/wiki/Inviscid_flow Written by Stephen Montgomery-Smith.
</p>
<p>
|: Boxed - Draws a box full of 3D bouncing balls that explode. Written by Sander van Grieken.
</p>
<p>
|: Superquadrics - Morphing 3D shapes. Written by Ed Mackey.
</p>
<p>
|: Fireworkx - Exploding fireworks. See also the "Eruption", "XFlame" and "Pyro" screen savers. Written by Rony B Chandran.
</p>
<p>
|: FlipFlop - Draws a grid of 3D colored tiles that change positions with each other. Written by Kevin Ogden and Sergio Gutierrez.
</p>
<p>
|: XMatrix - Draws dropping characters similar to what is seen on the computer monitors in "The Matrix". See also "GLMatrix" for a 3D rendering of the similar effect that appeared in the movie's title sequence. Written by Jamie Zawinski.
</p>
<p>
|: Distort - Grabs an image of the screen, and then lets a transparent lens wander around the screen, magnifying whatever is underneath. Written by Jonas Munsin.
</p>
<p>
|: XJack - This behaves schizophrenically and makes a lot of typos. Written by Jamie Zawinski.
</p>
<p>
|: Extrusion - Draws various rotating extruded shapes that twist around, lengthen, and turn inside out. Written by Linas Vepstas, David Konerding, and Jamie Zawinski.
</p>
<p>
|: MemScroller - This draws a dump of its own process memory scrolling across the screen in three windows at three different rates. Written by Jamie Zawinski.
</p>
<p>
|: FlyingToasters - A fleet of 3d space-age jet-powered flying toasters (and toast!) Inspired by the ancient Berkeley Systems After Dark flying toasters. http://en.wikipedia.org/wiki/After_Dark_%28software%29#Flying_Toasters Written by Jamie Zawinski and Devon Dossett.
</p>
<p>
|: Bumps - A spotlight roams across an embossed version of your desktop or other picture. Written by Shane Smit.
</p>
<p>
|: XAnalogTV - XAnalogTV shows a detailed simulation of an old TV set showing various test patterns, with various picture artifacts like snow, bloom, distortion, ghosting, and hash noise. It also simulates the TV warming up. It will cycle through 12 channels, some with images you give it, and some with color bars or nothing but static. Written by Trevor Blackwell.
</p>
<p>
|: Penetrate - Simulates (something like) the classic arcade game Missile Command. http://en.wikipedia.org/wiki/Missile_Command Written by Adam Miller.
</p>
<p>
|: Apollonian - Draws an Apollonian gasket: a fractal packing of circles with smaller circles, demonstrating Descartes's theorem. http://en.wikipedia.org/wiki/Apollonian_gasket http://en.wikipedia.org/wiki/Descartes%27_theorem Written by Allan R. Wilks and David Bagley.
</p>
<p>
|: Endgame - Black slips out of three mating nets, but the fourth one holds him tight! A brilliant composition! See also the "Queens" screen saver. http://en.wikipedia.org/wiki/Chess_endgame Written by Blair Tennessy.
</p>
<p>
|: Ripples - This draws rippling interference patterns like splashing water. With the -water option, it manipulates your desktop image to look like something is dripping into it. Written by Tom Hammersley.
</p>
<p>
|: Menger - This draws the three-dimensional variant of the recursive Menger Gasket, a cube-based fractal object analagous to the Sierpinski Tetrahedron. http://en.wikipedia.org/wiki/Menger_sponge http://en.wikipedia.org/wiki/Sierpinski_carpet Written by Jamie Zawinski.
</p>
<p>
|: Cage - This draws Escher's "Impossible Cage", a 3d analog of a moebius strip, and rotates it in three dimensions. http://en.wikipedia.org/wiki/Maurits_Cornelis_Escher Written by Marcelo Vianna.
</p>
<p>
|: Triangle - Generates random mountain ranges using iterative subdivision of triangles. Written by Tobias Gloth.
</p>
<p>
|: Gears - This draws sets of turning, interlocking gears, rotating in three dimensions. See also the "Pinion" and "MoebiusGears" screen savers. http://en.wikipedia.org/wiki/Involute_gear http://en.wikipedia.org/wiki/Epicyclic_gearing Written by Jamie Zawinski.
</p>
<p>
|: JigglyPuff - This does bad things with quasi-spherical objects. You have a tetrahedron with tesselated faces. The vertices on these faces have forces on them: one proportional to the distance from the surface of a sphere; and one proportional to the distance from the neighbors. They also have inertia. The resulting effect can range from a shape that does nothing, to a frenetic polygon storm. Somewhere in between there it usually manifests as a blob that jiggles in a kind of disturbing manner. Written by Keith Macleod.
</p>
<p>
|: Wander - Draws a colorful random-walk, in various forms. http://en.wikipedia.org/wiki/Random_walk Written by Rick Campbell.
</p>
<p>
|: Cube21 - Animates a Rubik-like puzzle known as Cube 21 or Square-1. The rotations are chosen randomly. See also the "Rubik" and "GLSnake" screen savers. http://en.wikipedia.org/wiki/Square_One_%28puzzle%29 Written by Vasek Potocek.
</p>
<p>
|: FlipText - Draws successive pages of text. The lines flip in and out in a soothing 3D pattern. Written by Jamie Zawinski.
</p>
<p>
|: Providence - "A pyramid unfinished. In the zenith an eye in a triangle, surrounded by a glory, proper." http://en.wikipedia.org/wiki/Eye_of_Providence Written by Blair Tennessy.
</p>
<p>
|: Penrose - Draws quasiperiodic tilings; think of the implications on modern formica technology. In April 1997, Sir Roger Penrose, a British math professor who has worked with Stephen Hawking on such topics as relativity, black holes, and whether time has a beginning, filed a copyright-infringement lawsuit against the Kimberly-Clark Corporation, which Penrose said copied a pattern he created (a pattern demonstrating that "a nonrepeating pattern could exist in nature") for its Kleenex quilted toilet paper. Penrose said he doesn't like litigation but, "When it comes to the population of Great Britain being invited by a multinational to wipe their bottoms on what appears to be the work of a Knight of the Realm, then a last stand must be taken." As reported by News of the Weird #491, 4-Jul-1997. http://en.wikipedia.org/wiki/Penrose_tiling Written by Timo Korvola.
</p>
<p>
|: FadePlot - Draws what looks like a waving ribbon following a sinusoidal path. Written by Bas van Gaalen and Charles Vidal.
</p>
<p>
|: XFlame - Draws a simulation of pulsing fire. It can also take an arbitrary image and set it on fire too. Written by Carsten Haitzler and many others.
</p>
<p>
|: Photopile - Loads several random images, and displays them as if lying in a random pile. The pile is periodically reshuffled, with new images coming in and old ones being thrown out. Written by Jens Kilian.
</p>
<p>
|: GLBlur - This draws a box and a few line segments, and generates a radial blur outward from it. This creates flowing field effects. This is done by rendering the scene into a small texture, then repeatedly rendering increasingly-enlarged and increasingly-transparent versions of that texture onto the frame buffer. As such, it's quite GPU-intensive: if you don't have a very good graphics card, it will hurt your machine bad. Written by Jamie Zawinski.
</p>
<p>
|: Crystal - Moving polygons, similar to a kaleidoscope. See also the "Kaleidescope" and "GLeidescope" screen savers. http://en.wikipedia.org/wiki/Kaleidoscope Written by Jouk Jansen.
</p>
<p>
|: Interference - Color field based on computing decaying sinusoidal waves. Written by Hannu Mallat.
</p>
<p>
|: Carousel - Loads several random images, and displays them flying in a circular formation. The formation changes speed and direction randomly, and images periodically drop out to be replaced by new ones. Written by Jamie Zawinski.
</p>
<p>
|: Epicycle - This draws the path traced out by a point on the edge of a circle. That circle rotates around a point on the rim of another circle, and so on, several times. These were the basis for the pre-heliocentric model of planetary motion. http://en.wikipedia.org/wiki/Deferent_and_epicycle Written by James Youngman.
</p>
<p>
|: StarWars - Draws a stream of text slowly scrolling into the distance at an angle, over a star field, like at the beginning of the movie of the same name. http://en.wikipedia.org/wiki/Star_Wars_opening_crawl Written by Jamie Zawinski and Claudio Matauoka.
</p>
<p>
|: Vermiculate - Draws squiggly worm-like paths. Written by Tyler Pierce.
</p>
<p>
|: Blaster - Draws a simulation of flying space-combat robots (cleverly disguised as colored circles) doing battle in front of a moving star field. Written by Jonathan Lin.
</p>
<p>
|: Discrete - More "discrete map" systems, including new variants of Hopalong and Julia, and a few others. Written by Tim Auckland.
</p>
<p>
|: NerveRot - Draws different shapes composed of nervously vibrating squiggles, as if seen through a camera operated by a monkey on crack. Written by Dan Bornstein.
</p>
<p>
|: Abstractile - Generates mosaic patterns of interlocking tiles. Written by Steve Sundstrom.
</p>
<p>
|: Demon - A cellular automaton that starts with a random field, and organizes it into stripes and spirals. http://en.wikipedia.org/wiki/Maxwell%27s_demon Written by David Bagley.
</p>
<p>
|: TronBit - Draws an animation of the character "Bit" from the film, "Tron". The "yes" state is a tetrahedron; the "no" state is the second stellation of an icosahedron; and the idle state oscillates between a small triambic icosahedron and the compound of an icosahedron and a dodecahedron. http://en.wikipedia.org/wiki/List_of_Tron_characters#Bit http://en.wikipedia.org/wiki/Uniform_polyhedra http://en.wikipedia.org/wiki/Stellation Written by Jamie Zawinski.
</p>
<p>
|: AntInspect - Draws a trio of ants moving their spheres around a circle. Written by Blair Tennessy.
</p>
<p>
|: Truchet - This draws line- and arc-based truchet patterns that tile the screen. http://en.wikipedia.org/wiki/Tessellation Written by Adrian Likins.
</p>
<p>
|: Pedal - This is sort of a combination spirograph/string-art. It generates a large, complex polygon, and renders it by filling using an even/odd winding rule. Written by Dale Moore.
</p>
<p>
|: BlockTube - Draws a swirling, falling tunnel of reflective slabs. They fade from hue to hue. Written by Lars R. Damerow.
</p>
<p>
|: Moire - When the lines on the screen Make more lines in between, That's a moire'! http://en.wikipedia.org/wiki/Moire_pattern Written by Jamie Zawinski and Michael Bayne.
</p>
<p>
|: Drift - Drifting recursive fractal cosmic flames. Written by Scott Draves.
</p>
<p>
|: NoseGuy - A little man with a big nose wanders around your screen saying things. Written by Dan Heller and Jamie Zawinski.
</p>
<p>
|: FlipScreen3D - Grabs an image of the desktop, turns it into a GL texture map, and spins it around and deforms it in various ways. Written by Ben Buxton and Jamie Zawinski.
</p>
<p>
|: Strange - This draws iterations to strange attractors: it's a colorful, unpredictably-animating swarm of dots that swoops and twists around. http://en.wikipedia.org/wiki/Attractor#Strange_attractor Written by Massimino Pascal.
</p>
<p>
|: CWaves - This generates a languidly-scrolling vertical field of sinusoidal colors. Written by Jamie Zawinski.
</p>
<p>
|: IMSMap - This generates random cloud-like patterns. The idea is to take four points on the edge of the image, and assign each a random "elevation". Then find the point between them, and give it a value which is the average of the other four, plus some small random offset. Coloration is done based on elevation. Written by Juergen Nickelsen and Jamie Zawinski.
</p>
<p>
|: GLSlideshow - Loads a random sequence of images and smoothly scans and zooms around in each, fading from pan to pan. Written by Jamie Zawinski and Mike Oliphant.
</p>
<p>
|: ShadeBobs - This draws smoothly-shaded oscillating oval patterns that look something like vapor trails or neon tubes. Written by Shane Smit.
</p>
<p>
|: Eruption - Exploding fireworks. See also the "Fireworkx", "XFlame" and "Pyro" screen savers. Written by W.P. van Paassen.
</p>
<p>
|: Thornbird - Displays a view of the "Bird in a Thornbush" fractal. Written by Tim Auckland.
</p>
<p>
|: Halo - Draws trippy psychedelic circular patterns that hurt to look at. http://en.wikipedia.org/wiki/Moire_pattern Written by Jamie Zawinski.
</p>
<p>
|: XRaySwarm - Draws a few swarms of critters flying around the screen, with faded color trails behind them. Written by Chris Leger.
</p>
<p>
|: Anemotaxis - Anemotaxis demonstrates a search algorithm designed for locating a source of odor in turbulent atmosphere. The searcher is able to sense the odor and determine local instantaneous wind direction. The goal is to find the source in the shortest mean time. http://en.wikipedia.org/wiki/Anemotaxis Written by Eugene Balkovsky.
</p>
<p>
|: Queens - Solves the N-Queens problem (where N is between 5 and 10 queens). The problem is: how may one place N queens on an NxN chessboard such that no queen can attack a sister? See also the "Endgame" screen saver. http://en.wikipedia.org/wiki/Eight_queens_puzzle Written by Blair Tennessy.
</p>
<p>
|: Halftone - Draws the gravity force in each point on the screen seen through a halftone dot pattern. The gravity force is calculated from a set of moving mass points. View it from a distance for best effect. http://en.wikipedia.org/wiki/Halftone Written by Peter Jaric.
</p>
<p>
|: Moebius - This animates a 3D rendition M.C. Escher's "Moebius Strip II", an image of ants walking along the surface of a moebius strip. http://en.wikipedia.org/wiki/Moebius_strip http://en.wikipedia.org/wiki/Maurits_Cornelis_Escher Written by Marcelo F. Vianna.
</p>
<p>
|: Helix - Spirally string-art-ish patterns. Written by Jamie Zawinski.
</p>
<p>
|: Flurry - This X11 port of the OSX screensaver of the same name draws a colourful star(fish)like flurry of particles. Original Mac version: http://homepage.mac.com/calumr Written by Calum Robinson and Tobias Sargeant.
</p>
<p>
|: CCurve - Generates self-similar linear fractals, including the classic "C Curve". http://en.wikipedia.org/wiki/Levy_C_curve Written by Rick Campbell.
</p>
<p>
|: Cubenetic - Draws a pulsating set of overlapping boxes with ever-chaning blobby patterns undulating across their surfaces. It's sort of a cubist Lavalite. Written by Jamie Zawinski.
</p>
<p>
|: GLSchool - Uses Craig Reynolds' Boids algorithm to simulate a school of fish. http://en.wikipedia.org/wiki/Boids Written by David C. Lambert.
</p>
<p>
|: Pacman - Simulates a game of Pac-Man on a randomly-created level. http://en.wikipedia.org/wiki/Pac-Man Written by Edwin de Jong.
</p>
<p>
|: Voronoi - Draws a randomly-colored Voronoi tessellation, and periodically zooms in and adds new points. The existing points also wander around. There are a set of control points on the plane, each at the center of a colored cell. Every pixel within that cell is closer to that cell's control point than to any other control point. That is what determines the cell's shapes. http://en.wikipedia.org/wiki/Voronoi_diagram Written by Jamie Zawinski.
</p>
<p>
|: BoxFit - Packs the screen with growing squares or circles, colored according to a horizontal or vertical gradient, or according to the colors of the desktop or a loaded image file. The objects grow until they touch, then stop. When the screen is full, they shrink away and the process restarts. Written by Jamie Zawinski.
</p>
<p>
|: Coral - Simulates coral growth, albeit somewhat slowly. Written by Frederick Roeber.
</p>
<p>
|: TopBlock - Creates a 3D world with dropping blocks that build up and up. Written by rednuht.
</p>
<p>
|: Lament - Animates a simulation of Lemarchand's Box, the Lament Configuration, repeatedly solving itself. Warning: occasionally opens doors. http://en.wikipedia.org/wiki/Lemarchand%27s_box Written by Jamie Zawinski.
</p>
<p>
|: Attraction - Uses a simple simple motion model to generate many different display modes. The control points attract each other up to a certain distance, and then begin to repel each other. The attraction/repulsion is proportional to the distance between any two particles, similar to the strong and weak nuclear forces. Written by Jamie Zawinski and John Pezaris.
</p>
<p>
|: Gleidescope - A kaleidoscope that operates on your desktop image, or on image files loaded from disk. http://en.wikipedia.org/wiki/Kaleidoscope Written by Andrew Dean.
</p>
<p>
|: CubeStorm - Draws a series of rotating 3D boxes that intersect each other and eventually fill space. Written by Jamie Zawinski.
</p>
<p>
|: Compass - This draws a compass, with all elements spinning about randomly, for that "lost and nauseous" feeling. Written by Jamie Zawinski.
</p>
<p>
|: Twang - Divides the screen into a grid, and plucks them. Written by Dan Bornstein.
</p>
<p>
|: BlitSpin - Repeatedly rotates a bitmap by 90 degrees by using logical operations: the bitmap is divided into quadrants, and the quadrants are shifted clockwise. Then the same thing is done again with progressively smaller quadrants, except that all sub-quadrants of a given size are rotated in parallel. As you watch it, the image appears to dissolve into static and then reconstitute itself, but rotated. Written by Jamie Zawinski.
</p>
<p>
|: XSpirograph - Simulates that pen-in-nested-plastic-gears toy from your childhood. http://en.wikipedia.org/wiki/Spirograph Written by Rohit Singh.
</p>
<p>
|: SlideScreen - This takes an image, divides it into a grid, and then randomly shuffles the squares around as if it was one of those "fifteen-puzzle" games where there is a grid of squares, one of which is missing. http://en.wikipedia.org/wiki/Fifteen_puzzle Written by Jamie Zawinski.
</p>
<p>
|: Piecewise - This draws a bunch of moving circles which switch from visibility to invisibility at intersection points. Written by Geoffrey Irving.
</p>
<p>
|: Deco - Subdivides and colors rectangles randomly. It looks kind of like Brady-Bunch-era rec-room wall paneling. http://en.wikipedia.org/wiki/Piet_Mondrian#Paris_1919.E2.80.931938 Written by Jamie Zawinski and Michael Bayne.
</p>
<p>
|: GLSnake - Draws a simulation of the Rubik's Snake puzzle. See also the "Rubik" and "Cube21" screen savers. http://en.wikipedia.org/wiki/Rubik%27s_Snake Written by Jamie Wilkinson, Andrew Bennetts, and Peter Aylett.
</p>
<p>
|: RDbomb - Draws a grid of growing square-like shapes that, once they overtake each other, react in unpredictable ways. "RD" stands for reaction-diffusion. Written by Scott Draves.
</p>
<p>
|: FuzzyFlakes - Falling colored snowflake/flower shapes. Written by Barry Dmytro.
</p>
<p>
|: Braid - Draws random color-cycling inter-braided concentric circles. Written by John Neil.
</p>
<p>
|: MetaBalls - Draws two dimensional metaballs: overlapping and merging balls with fuzzy edges. http://en.wikipedia.org/wiki/Metaballs Written by W.P. van Paassen.
</p>
<p>
|: DangerBall - Draws a ball that periodically extrudes many random spikes. Ouch! Written by Jamie Zawinski.
</p>
<p>
|: Molecule - Draws several different representations of molecules. Some common molecules are built in, and it can also read PDB (Protein Data Bank) files as input. http://en.wikipedia.org/wiki/Protein_Data_Bank_%28file_format%29 Written by Jamie Zawinski.
</p>
<p>
|: BlinkBox - Shows a ball contained inside of a bounding box. Colored blocks blink in when the ball hits the sides. Written by Jeremy English.
</p>
<p>
|: Sonar - This draws a sonar screen that pings (get it?) the hosts on your local network, and plots their distance (response time) from you. The three rings represent ping times of approximately 2.5, 70 and 2,000 milliseconds respectively. Alternately, it can run a simulation that doesn't involve hosts. (If pinging doesn't work, you may need to make the executable be setuid.) http://en.wikipedia.org/wiki/Ping#History Written by Stephen Martin and Jamie Zawinski.
</p>
<p>
|: GLCells - Cells growing, dividing and dying on your screen. Written by Matthias Toussaint.
</p>
<p>
|: Squiral - Draws a set of interacting, square-spiral-producing automata. The spirals grow outward until they hit something, then they go around it. Written by Jeff Epler.
</p>
<p>
|: Klein - This draws a visualization of a Klein bottle or some other interesting parametric surfaces. http://en.wikipedia.org/wiki/Klein_bottle Written by Andrey Mirtchovski.
</p>
<hr>
<h3>
<a name="CHILD-MENU"></a><a href="#MAIN">Child-Menu</a>
</h3>
<p>
r: Rename the current child
</p>
<p>
t: Set the current child transparency
</p>
<p>
b: Set the current child border size
</p>
<p>
e: Ensure that all children names are unique
</p>
<p>
n: Ensure that all children numbers are unique
</p>
<p>
Delete: Delete the current child and its children in all frames
</p>
<p>
X: Remove the current child from its parent frame
</p>
<p>
h: Hide the current child
</p>
<p>
u: Unhide a child in the current frame
</p>
<p>
f: Unhide a child from all frames in the current frame
</p>
<p>
a: Unhide all current frame hidden children
</p>
<p>
Page_Up: Lower the child in the current frame
</p>
<p>
Page_Down: Raise the child in the current frame
</p>
<hr>
<h3>
<a name="ROOT-MENU"></a><a href="#MAIN">Root-Menu</a>
</h3>
<p>
n: Select the next root
</p>
<p>
p: Select the previous root
</p>
<p>
g: Rotate root geometry to next root
</p>
<p>
f: Rotate root geometry to previous root
</p>
<p>
x: Exchange two root geometry pointed with the mouse
</p>
<p>
r: Change the current root geometry
</p>
<hr>
<h3>
<a name="FRAME-MENU"></a><a href="#MAIN">Frame-Menu</a>
</h3>
<p>
a: <a href="#FRAME-ADDING-MENU">< Adding frame menu ></a>
</p>
<p>
l: <a href="#FRAME-LAYOUT-MENU">< Frame layout menu ></a>
</p>
<p>
n: <a href="#FRAME-NW-HOOK-MENU">< Frame new window hook menu ></a>
</p>
<p>
m: <a href="#FRAME-MOVEMENT-MENU">< Frame movement menu ></a>
</p>
<p>
f: <a href="#FRAME-FOCUS-POLICY">< Frame focus policy menu ></a>
</p>
<p>
w: <a href="#FRAME-MANAGED-WINDOW-MENU">< Managed window type menu ></a>
</p>
<p>
u: <a href="#FRAME-UNMANAGED-WINDOW-MENU">< Unmanaged window behaviour ></a>
</p>
<p>
s: <a href="#FRAME-MISCELLANEOUS-MENU">< Frame miscallenous menu ></a>
</p>
<p>
x: Maximize/Unmaximize the current frame in its parent frame
</p>
<hr>
<h3>
<a name="FRAME-ADDING-MENU"></a><a href="#FRAME-MENU">Frame-Adding-Menu</a>
</h3>
<p>
a: Add a default frame in the current frame
</p>
<p>
p: Add a placed frame in the current frame
</p>
<hr>
<h3>
<a name="FRAME-LAYOUT-MENU"></a><a href="#FRAME-MENU">Frame-Layout-Menu</a>
</h3>
<p>
a: <a href="#FRAME-FAST-LAYOUT-MENU">< Frame fast layout menu ></a>
</p>
<p>
b: No layout: Maximize windows in their frame - Leave frames to their original size
</p>
<p>
c: No layout: Maximize windows in their frame - Leave frames to their actual size
</p>
<p>
d: Maximize layout: Maximize windows and frames in their parent frame
</p>
<p>
e: <a href="#FRAME-TILE-LAYOUT-MENU">< Frame tile layout menu ></a>
</p>
<p>
f: <a href="#FRAME-TILE-DIR-LAYOUT-MENU">< Tile in one direction layout menu ></a>
</p>
<p>
g: <a href="#FRAME-TILE-SPACE-LAYOUT-MENU">< Tile with some space on one side menu ></a>
</p>
<p>
h: <a href="#FRAME-MAIN-WINDOW-LAYOUT-MENU">< Main window layout menu ></a>
</p>
<p>
i: <a href="#FRAME-GIMP-LAYOUT-MENU">< The GIMP layout menu ></a>
</p>
<hr>
<h3>
<a name="FRAME-FAST-LAYOUT-MENU"></a><a href="#FRAME-LAYOUT-MENU">Frame-Fast-Layout-Menu</a>
</h3>
<p>
s: Switch between two layouts
</p>
<p>
p: Push the current layout in the fast layout list
</p>
<hr>
<h3>
<a name="FRAME-TILE-LAYOUT-MENU"></a><a href="#FRAME-LAYOUT-MENU">Frame-Tile-Layout-Menu</a>
</h3>
<p>
v: Tile child in its frame (vertical)
</p>
<p>
h: Tile child in its frame (horizontal)
</p>
<p>
m: Tile child in its frame (mix: automatic choose between vertical/horizontal)
</p>
<p>
c: One column layout
</p>
<p>
l: One line layout
</p>
<p>
s: Tile Space: tile child in its frame leaving spaces between them
</p>
<hr>
<h3>
<a name="FRAME-TILE-DIR-LAYOUT-MENU"></a><a href="#FRAME-LAYOUT-MENU">Frame-Tile-Dir-Layout-Menu</a>
</h3>
<p>
l: Tile Left: main child on left and others on right
</p>
<p>
r: Tile Right: main child on right and others on left
</p>
<p>
t: Tile Top: main child on top and others on bottom
</p>
<p>
b: Tile Bottom: main child on bottom and others on top
</p>
<hr>
<h3>
<a name="FRAME-TILE-SPACE-LAYOUT-MENU"></a><a href="#FRAME-LAYOUT-MENU">Frame-Tile-Space-Layout-Menu</a>
</h3>
<p>
a: Tile Left Space: main child on left and others on right. Leave some space on the left.
</p>
<hr>
<h3>
<a name="FRAME-MAIN-WINDOW-LAYOUT-MENU"></a><a href="#FRAME-LAYOUT-MENU">Frame-Main-Window-Layout-Menu</a>
</h3>
<p>
r: Main window right: Main windows on the right. Others on the left.
</p>
<p>
l: Main window left: Main windows on the left. Others on the right.
</p>
<p>
t: Main window top: Main windows on the top. Others on the bottom.
</p>
<p>
b: Main window bottom: Main windows on the bottom. Others on the top.
</p>
<p>
-=- Actions on main windows list -=-
</p>
<p>
a: Add the current window in the main window list
</p>
<p>
v: Remove the current window from the main window list
</p>
<p>
c: Clear the main window list
</p>
<hr>
<h3>
<a name="FRAME-GIMP-LAYOUT-MENU"></a><a href="#FRAME-LAYOUT-MENU">Frame-Gimp-Layout-Menu</a>
</h3>
<p>
g: The GIMP Layout
</p>
<p>
p: Restore the previous layout
</p>
<p>
h: Help on the GIMP layout
</p>
<p>
-=- Main window layout -=-
</p>
<p>
r: Main window right: Main windows on the right. Others on the left.
</p>
<p>
l: Main window left: Main windows on the left. Others on the right.
</p>
<p>
t: Main window top: Main windows on the top. Others on the bottom.
</p>
<p>
b: Main window bottom: Main windows on the bottom. Others on the top.
</p>
<p>
-=- Actions on main windows list -=-
</p>
<p>
a: Add the current window in the main window list
</p>
<p>
v: Remove the current window from the main window list
</p>
<p>
c: Clear the main window list
</p>
<hr>
<h3>
<a name="FRAME-NW-HOOK-MENU"></a><a href="#FRAME-MENU">Frame-Nw-Hook-Menu</a>
</h3>
<p>
a: Open the next window in the current frame
</p>
<p>
b: Open the next window in the current root
</p>
<p>
c: Open the next window in a new frame in the current root
</p>
<p>
d: Open the next window in a new frame in the root frame
</p>
<p>
e: Open the next window in a new frame in the parent frame
</p>
<p>
f: Open the next window in the current frame and leave the focus on the current child
</p>
<p>
g: Open the next window in a named frame
</p>
<p>
h: Open the next window in a numbered frame
</p>
<p>
i: Open the window in this frame if it match nw-absorb-test
</p>
<hr>
<h3>
<a name="FRAME-MOVEMENT-MENU"></a><a href="#FRAME-MENU">Frame-Movement-Menu</a>
</h3>
<p>
p: <a href="#FRAME-PACK-MENU">< Frame pack menu ></a>
</p>
<p>
f: <a href="#FRAME-FILL-MENU">< Frame fill menu ></a>
</p>
<p>
r: <a href="#FRAME-RESIZE-MENU">< Frame resize menu ></a>
</p>
<p>
c: Center the current frame
</p>
<p>
R: Select the next brother frame
</p>
<p>
L: Select the previous brother frame
</p>
<p>
U: Select the next level
</p>
<p>
D: Select the previous levelframe
</p>
<p>
T: Select the next child
</p>
<hr>
<h3>
<a name="FRAME-PACK-MENU"></a><a href="#FRAME-MOVEMENT-MENU">Frame-Pack-Menu</a>
</h3>
<p>
u: Pack the current frame up
</p>
<p>
d: Pack the current frame down
</p>
<p>
l: Pack the current frame left
</p>
<p>
r: Pack the current frame right
</p>
<hr>
<h3>
<a name="FRAME-FILL-MENU"></a><a href="#FRAME-MOVEMENT-MENU">Frame-Fill-Menu</a>
</h3>
<p>
u: Fill the current frame up
</p>
<p>
d: Fill the current frame down
</p>
<p>
l: Fill the current frame left
</p>
<p>
r: Fill the current frame right
</p>
<p>
a: Fill the current frame in all directions
</p>
<p>
v: Fill the current frame vertically
</p>
<p>
h: Fill the current frame horizontally
</p>
<hr>
<h3>
<a name="FRAME-RESIZE-MENU"></a><a href="#FRAME-MOVEMENT-MENU">Frame-Resize-Menu</a>
</h3>
<p>
u: Resize the current frame up to its half height
</p>
<p>
d: Resize the current frame down to its half height
</p>
<p>
l: Resize the current frame left to its half width
</p>
<p>
r: Resize the current frame right to its half width
</p>
<p>
a: Resize down the current frame
</p>
<p>
m: Resize down the current frame to its minimal size
</p>
<hr>
<h3>
<a name="FRAME-FOCUS-POLICY"></a><a href="#FRAME-MENU">Frame-Focus-Policy</a>
</h3>
<p>
-=- For the current frame -=-
</p>
<p>
a: Set a click focus policy for the current frame.
</p>
<p>
b: Set a sloppy focus policy for the current frame.
</p>
<p>
c: Set a (strict) sloppy focus policy only for windows in the current frame.
</p>
<p>
d: Set a sloppy select policy for the current frame.
</p>
<p>
-=- For all frames -=-
</p>
<p>
e: Set a click focus policy for all frames.
</p>
<p>
f: Set a sloppy focus policy for all frames.
</p>
<p>
g: Set a (strict) sloppy focus policy for all frames.
</p>
<p>
h: Set a sloppy select policy for all frames.
</p>
<hr>
<h3>
<a name="FRAME-MANAGED-WINDOW-MENU"></a><a href="#FRAME-MENU">Frame-Managed-Window-Menu</a>
</h3>
<p>
m: Change window types to be managed by a frame
</p>
<p>
a: Manage all window type
</p>
<p>
n: Manage only normal window type
</p>
<p>
u: Do not manage any window type
</p>
<hr>
<h3>
<a name="FRAME-UNMANAGED-WINDOW-MENU"></a><a href="#FRAME-MENU">Frame-Unmanaged-Window-Menu</a>
</h3>
<p>
s: Show unmanaged windows when frame is not selected
</p>
<p>
h: Hide unmanaged windows when frame is not selected
</p>
<p>
d: Set default behaviour to hide or not unmanaged windows when frame is not selected
</p>
<p>
w: Show unmanaged windows by default. This is overriden by functions above
</p>
<p>
i: Hide unmanaged windows by default. This is overriden by functions above
</p>
<hr>
<h3>
<a name="FRAME-MISCELLANEOUS-MENU"></a><a href="#FRAME-MENU">Frame-Miscellaneous-Menu</a>
</h3>
<p>
s: Show all frames info windows
</p>
<p>
a: Hide all frames info windows
</p>
<p>
h: Hide the current frame window
</p>
<p>
w: Show the current frame window
</p>
<p>
u: Renumber the current frame
</p>
<p>
x: Create a new frame for each window in frame
</p>
<p>
i: Absorb all frames subchildren in frame (explode frame opposite)
</p>
<hr>
<h3>
<a name="WINDOW-MENU"></a><a href="#MAIN">Window-Menu</a>
</h3>
<p>
i: Display information on the current window
</p>
<p>
t: Set the current window transparency
</p>
<p>
f: Force the current window to move in the frame (Useful only for unmanaged windows)
</p>
<p>
c: Force the current window to move in the center of the frame (Useful only for unmanaged windows)
</p>
<p>
m: Force to manage the current window by its parent frame
</p>
<p>
u: Force to not manage the current window by its parent frame
</p>
<p>
a: Adapt the current frame to the current window minimal size hints
</p>
<p>
w: Adapt the current frame to the current window minimal width hint
</p>
<p>
h: Adapt the current frame to the current window minimal height hint
</p>
<hr>
<h3>
<a name="SELECTION-MENU"></a><a href="#MAIN">Selection-Menu</a>
</h3>
<p>
x: Cut the current child to the selection
</p>
<p>
c: Copy the current child to the selection
</p>
<p>
v: Paste the selection in the current frame
</p>
<p>
p: Paste the selection in the current frame - Do not clear the selection after paste
</p>
<p>
Delete: Remove the current child from its parent frame
</p>
<p>
z: Clear the current selection
</p>
<hr>
<h3>
<a name="ACTION-BY-NAME-MENU"></a><a href="#MAIN">Action-By-Name-Menu</a>
</h3>
<p>
f: Focus a frame by name
</p>
<p>
o: Open a new frame in a named frame
</p>
<p>
d: Delete a frame by name
</p>
<p>
m: Move current child in a named frame
</p>
<p>
c: Copy current child in a named frame
</p>
<hr>
<h3>
<a name="ACTION-BY-NUMBER-MENU"></a><a href="#MAIN">Action-By-Number-Menu</a>
</h3>
<p>
f: Focus a frame by number
</p>
<p>
o: Open a new frame in a numbered frame
</p>
<p>
d: Delete a frame by number
</p>
<p>
m: Move current child in a numbered frame
</p>
<p>
c: Copy current child in a numbered frame
</p>
<hr>
<h3>
<a name="UTILITY-MENU"></a><a href="#MAIN">Utility-Menu</a>
</h3>
<p>
i: Identify a key
</p>
<p>
colon: Eval a lisp form from the query input
</p>
<p>
exclam: Run a program from the query input
</p>
<p>
o: <a href="#OTHER-WINDOW-MANAGER-MENU">< Other window manager menu ></a>
</p>
<hr>
<h3>
<a name="OTHER-WINDOW-MANAGER-MENU"></a><a href="#UTILITY-MENU">Other-Window-Manager-Menu</a>
</h3>
<p>
x: Run xterm
</p>
<p>
t: Run twm
</p>
<p>
i: Run icewm
</p>
<p>
g: Run Gnome
</p>
<p>
k: Run KDE
</p>
<p>
c: Run XFCE
</p>
<p>
l: Run LXDE
</p>
<p>
p: Prompt for an other window manager
</p>
<hr>
<h3>
<a name="CONFIGURATION-MENU"></a><a href="#MAIN">Configuration-Menu</a>
</h3>
<p>
a: <a href="#CONF-PLACEMENT">< Placement Group ></a>
</p>
<p>
b: <a href="#CONF-CORNER">< Corner Group ></a>
</p>
<p>
c: <a href="#CONF-HOOK">< Hook Group ></a>
</p>
<p>
d: <a href="#CONF-ROOT">< Root Group ></a>
</p>
<p>
e: <a href="#CONF-MAIN-MODE">< Main Mode Group ></a>
</p>
<p>
f: <a href="#CONF-FRAME-COLORS">< Frame Colors Group ></a>
</p>
<p>
g: <a href="#CONF-MISCELLANEOUS">< Miscellaneous Group ></a>
</p>
<p>
h: <a href="#CONF-SECOND-MODE">< Second Mode Group ></a>
</p>
<p>
i: <a href="#CONF-IDENTIFY-KEY">< Identify Key Group ></a>
</p>
<p>
j: <a href="#CONF-QUERY-STRING">< Query String Group ></a>
</p>
<p>
k: <a href="#CONF-CIRCULATE-MODE">< Circulate Mode Group ></a>
</p>
<p>
l: <a href="#CONF-EXPOSE-MODE">< Expose Mode Group ></a>
</p>
<p>
m: <a href="#CONF-INFO-MODE">< Info Mode Group ></a>
</p>
<p>
n: <a href="#CONF-MENU">< Menu Group ></a>
</p>
<p>
o: <a href="#CONF-NOTIFY-WINDOW">< Notify Window Group ></a>
</p>
<p>
p: <a href="#CONF-GIMP-LAYOUT">< Gimp Layout Group ></a>
</p>
<p>
F2: Save all configuration variables in clfswmrc
</p>
<p>
F3: Reset all configuration variables to their default values
</p>
<hr>
<h3>
<a name="CONF-PLACEMENT"></a><a href="#CONFIGURATION-MENU">Conf-Placement</a>
</h3>
<p>
a: Configure BANISH-POINTER-PLACEMENT
</p>
<p>
b: Configure SECOND-MODE-PLACEMENT
</p>
<p>
c: Configure INFO-MODE-PLACEMENT
</p>
<p>
d: Configure QUERY-MODE-PLACEMENT
</p>
<p>
e: Configure CIRCULATE-MODE-PLACEMENT
</p>
<p>
f: Configure EXPOSE-MODE-PLACEMENT
</p>
<p>
g: Configure EXPOSE-QUERY-PLACEMENT
</p>
<p>
h: Configure NOTIFY-WINDOW-PLACEMENT
</p>
<p>
i: Configure ASK-CLOSE/KILL-PLACEMENT
</p>
<p>
j: Configure UNMANAGED-WINDOW-PLACEMENT
</p>
<hr>
<h3>
<a name="CONF-CORNER"></a><a href="#CONFIGURATION-MENU">Conf-Corner</a>
</h3>
<p>
a: Configure CORNER-SIZE
</p>
<p>
b: Configure CORNER-MAIN-MODE-LEFT-BUTTON
</p>
<p>
c: Configure CORNER-MAIN-MODE-MIDDLE-BUTTON
</p>
<p>
d: Configure CORNER-MAIN-MODE-RIGHT-BUTTON
</p>
<p>
e: Configure CORNER-SECOND-MODE-LEFT-BUTTON
</p>
<p>
f: Configure CORNER-SECOND-MODE-MIDDLE-BUTTON
</p>
<p>
g: Configure CORNER-SECOND-MODE-RIGHT-BUTTON
</p>
<p>
h: Configure VIRTUAL-KEYBOARD-CMD
</p>
<p>
i: Configure CLFSWM-TERMINAL-NAME
</p>
<p>
j: Configure CLFSWM-TERMINAL-CMD
</p>
<p>
k: Configure CORNER-ERROR-MESSAGE-COLOR
</p>
<p>
l: Configure CORNER-ERROR-MESSAGE-DELAY
</p>
<p>
m: Configure CORNER-COMMAND-TRY-DELAY
</p>
<p>
n: Configure CORNER-COMMAND-TRY-NUMBER
</p>
<hr>
<h3>
<a name="CONF-HOOK"></a><a href="#CONFIGURATION-MENU">Conf-Hook</a>
</h3>
<p>
a: Configure BINDING-HOOK
</p>
<p>
b: Configure LOOP-HOOK
</p>
<p>
c: Configure MAIN-ENTRANCE-HOOK
</p>
<p>
d: Configure ROOT-SIZE-CHANGE-HOOK
</p>
<p>
e: Configure INIT-HOOK
</p>
<p>
f: Configure CLOSE-HOOK
</p>
<p>
g: Configure DEFAULT-NW-HOOK
</p>
<p>
h: Configure QUERY-KEY-PRESS-HOOK
</p>
<p>
i: Configure QUERY-BUTTON-PRESS-HOOK
</p>
<hr>
<h3>
<a name="CONF-ROOT"></a><a href="#CONFIGURATION-MENU">Conf-Root</a>
</h3>
<p>
a: Configure CREATE-FRAME-ON-ROOT
</p>
<p>
b: Configure HAVE-TO-SHOW-CURRENT-ROOT
</p>
<p>
c: Configure SHOW-CURRENT-ROOT-DELAY
</p>
<p>
d: Configure SHOW-CURRENT-ROOT-PLACEMENT
</p>
<p>
e: Configure SHOW-CURRENT-ROOT-MESSAGE
</p>
<hr>
<h3>
<a name="CONF-MAIN-MODE"></a><a href="#CONFIGURATION-MENU">Conf-Main-Mode</a>
</h3>
<p>
a: Configure COLOR-MOVE-WINDOW
</p>
<p>
b: Configure COLOR-SELECTED
</p>
<p>
c: Configure COLOR-UNSELECTED
</p>
<p>
d: Configure COLOR-MAYBE-SELECTED
</p>
<hr>
<h3>
<a name="CONF-FRAME-COLORS"></a><a href="#CONFIGURATION-MENU">Conf-Frame-Colors</a>
</h3>
<p>
a: Configure FRAME-BACKGROUND
</p>
<p>
b: Configure FRAME-FOREGROUND
</p>
<p>
c: Configure FRAME-FOREGROUND-ROOT
</p>
<p>
d: Configure FRAME-FOREGROUND-HIDDEN
</p>
<p>
e: Configure FRAME-TRANSPARENCY
</p>
<hr>
<h3>
<a name="CONF-MISCELLANEOUS"></a><a href="#CONFIGURATION-MENU">Conf-Miscellaneous</a>
</h3>
<p>
a: Configure HAVE-TO-COMPRESS-NOTIFY
</p>
<p>
b: Configure TRANSPARENT-BACKGROUND
</p>
<p>
c: Configure DEFAULT-TRANSPARENCY
</p>
<p>
d: Configure SHOW-ROOT-FRAME-P
</p>
<p>
e: Configure BORDER-SIZE
</p>
<p>
f: Configure LOOP-TIMEOUT
</p>
<p>
g: Configure DEFAULT-FONT-STRING
</p>
<p>
h: Configure DEFAULT-FRAME-DATA
</p>
<p>
i: Configure DEFAULT-MANAGED-TYPE
</p>
<p>
j: Configure DEFAULT-FOCUS-POLICY
</p>
<p>
k: Configure SHOW-HIDE-POLICY
</p>
<p>
l: Configure DEFAULT-MODIFIERS
</p>
<p>
m: Configure NEVER-MANAGED-WINDOW-LIST
</p>
<p>
n: Configure HIDE-UNMANAGED-WINDOW
</p>
<p>
o: Configure SNAP-SIZE
</p>
<p>
p: Configure SPATIAL-MOVE-DELAY-BEFORE
</p>
<p>
q: Configure SPATIAL-MOVE-DELAY-AFTER
</p>
<p>
r: Configure DEFAULT-WINDOW-WIDTH
</p>
<p>
s: Configure DEFAULT-WINDOW-HEIGHT
</p>
<hr>
<h3>
<a name="CONF-SECOND-MODE"></a><a href="#CONFIGURATION-MENU">Conf-Second-Mode</a>
</h3>
<p>
a: Configure SM-BORDER-COLOR
</p>
<p>
b: Configure SM-BACKGROUND-COLOR
</p>
<p>
c: Configure SM-FOREGROUND-COLOR
</p>
<p>
d: Configure SM-FONT-STRING
</p>
<p>
e: Configure SM-WIDTH
</p>
<p>
f: Configure SM-HEIGHT
</p>
<p>
g: Configure SM-TRANSPARENCY
</p>
<hr>
<h3>
<a name="CONF-IDENTIFY-KEY"></a><a href="#CONFIGURATION-MENU">Conf-Identify-Key</a>
</h3>
<p>
a: Configure IDENTIFY-FONT-STRING
</p>
<p>
b: Configure IDENTIFY-BACKGROUND
</p>
<p>
c: Configure IDENTIFY-FOREGROUND
</p>
<p>
d: Configure IDENTIFY-BORDER
</p>
<p>
e: Configure IDENTIFY-TRANSPARENCY
</p>
<hr>
<h3>
<a name="CONF-QUERY-STRING"></a><a href="#CONFIGURATION-MENU">Conf-Query-String</a>
</h3>
<p>
a: Configure QUERY-FONT-STRING
</p>
<p>
b: Configure QUERY-BACKGROUND
</p>
<p>
c: Configure QUERY-MESSAGE-COLOR
</p>
<p>
d: Configure QUERY-FOREGROUND
</p>
<p>
e: Configure QUERY-CURSOR-COLOR
</p>
<p>
f: Configure QUERY-PARENT-COLOR
</p>
<p>
g: Configure QUERY-PARENT-ERROR-COLOR
</p>
<p>
h: Configure QUERY-BORDER
</p>
<p>
i: Configure QUERY-TRANSPARENCY
</p>
<p>
j: Configure QUERY-MAX-COMPLET-LENGTH
</p>
<p>
k: Configure QUERY-MIN-COMPLET-CHAR
</p>
<hr>
<h3>
<a name="CONF-CIRCULATE-MODE"></a><a href="#CONFIGURATION-MENU">Conf-Circulate-Mode</a>
</h3>
<p>
a: Configure CIRCULATE-FONT-STRING
</p>
<p>
b: Configure CIRCULATE-BACKGROUND
</p>
<p>
c: Configure CIRCULATE-FOREGROUND
</p>
<p>
d: Configure CIRCULATE-BORDER
</p>
<p>
e: Configure CIRCULATE-WIDTH
</p>
<p>
f: Configure CIRCULATE-HEIGHT
</p>
<p>
g: Configure CIRCULATE-TRANSPARENCY
</p>
<p>
h: Configure CIRCULATE-TEXT-LIMITE
</p>
<hr>
<h3>
<a name="CONF-EXPOSE-MODE"></a><a href="#CONFIGURATION-MENU">Conf-Expose-Mode</a>
</h3>
<p>
a: Configure EXPOSE-FONT-STRING
</p>
<p>
b: Configure EXPOSE-BACKGROUND
</p>
<p>
c: Configure EXPOSE-FOREGROUND
</p>
<p>
d: Configure EXPOSE-FOREGROUND-LETTER
</p>
<p>
e: Configure EXPOSE-FOREGROUND-LETTER-NOK
</p>
<p>
f: Configure EXPOSE-BACKGROUND-LETTER-MATCH
</p>
<p>
g: Configure EXPOSE-BORDER
</p>
<p>
h: Configure EXPOSE-VALID-ON-KEY
</p>
<p>
i: Configure EXPOSE-SHOW-WINDOW-TITLE
</p>
<p>
j: Configure EXPOSE-TRANSPARENCY
</p>
<p>
k: Configure EXPOSE-DIRECT-SELECT
</p>
<hr>
<h3>
<a name="CONF-INFO-MODE"></a><a href="#CONFIGURATION-MENU">Conf-Info-Mode</a>
</h3>
<p>
a: Configure INFO-BACKGROUND
</p>
<p>
b: Configure INFO-FOREGROUND
</p>
<p>
c: Configure INFO-BORDER
</p>
<p>
d: Configure INFO-LINE-CURSOR
</p>
<p>
e: Configure INFO-SELECTED-BACKGROUND
</p>
<p>
f: Configure INFO-FONT-STRING
</p>
<p>
g: Configure INFO-TRANSPARENCY
</p>
<p>
h: Configure INFO-CLICK-TO-SELECT
</p>
<p>
i: Configure INFO-COLOR-TITLE
</p>
<p>
j: Configure INFO-COLOR-UNDERLINE
</p>
<p>
k: Configure INFO-COLOR-FIRST
</p>
<p>
l: Configure INFO-COLOR-SECOND
</p>
<hr>
<h3>
<a name="CONF-MENU"></a><a href="#CONFIGURATION-MENU">Conf-Menu</a>
</h3>
<p>
a: Configure XDG-SECTION-LIST
</p>
<p>
b: Configure MENU-COLOR-SUBMENU
</p>
<p>
c: Configure MENU-COLOR-COMMENT
</p>
<p>
d: Configure MENU-COLOR-KEY
</p>
<p>
e: Configure MENU-COLOR-MENU-KEY
</p>
<p>
f: Configure MENU-KEY-BOUND-COLOR
</p>
<hr>
<h3>
<a name="CONF-NOTIFY-WINDOW"></a><a href="#CONFIGURATION-MENU">Conf-Notify-Window</a>
</h3>
<p>
a: Configure NOTIFY-WINDOW-FONT-STRING
</p>
<p>
b: Configure NOTIFY-WINDOW-BACKGROUND
</p>
<p>
c: Configure NOTIFY-WINDOW-FOREGROUND
</p>
<p>
d: Configure NOTIFY-WINDOW-BORDER
</p>
<p>
e: Configure NOTIFY-WINDOW-DELAY
</p>
<p>
f: Configure NOTIFY-WINDOW-TRANSPARENCY
</p>
<hr>
<h3>
<a name="CONF-GIMP-LAYOUT"></a><a href="#CONFIGURATION-MENU">Conf-Gimp-Layout</a>
</h3>
<p>
a: Configure GIMP-LAYOUT-NOTIFY-WINDOW-DELAY
</p>
<hr>
<h3>
<a name="CLFSWM-MENU"></a><a href="#MAIN">Clfswm-Menu</a>
</h3>
<p>
r: Reset clfswm
</p>
<p>
l: Reload clfswm
</p>
<p>
x: Exit clfswm
</p>
<hr>
<p>
<small>
This documentation was produced with the CLFSWM auto-doc functions. To reproduce it, use the produce-menu-doc-html-in-file or
the produce-all-docs function from the Lisp REPL.
</small>
</p>
<p>
<small>
Something like this:<br>
LISP> (in-package :clfswm)<br>
CLFSWM> (produce-menu-doc-html-in-file "my-menu.html")<br>
or<br> CLFSWM> (produce-all-docs)
</small>
</p>
</body>
</html>
| 126,738 | Common Lisp | .l | 4,140 | 24.960145 | 878 | 0.622956 | spacefrogg/clfswm | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 939b494ca925cb85f679336d70c7e87d630963b220b2913d35238aaaa7bfe1b6 | 10,048 | [
-1
] |
10,079 | install.lisp | gpwwjr_LISA/install.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: install.lisp
;;; Description: Convenience interface for loading Lisa from scratch.
;;; $Id$
(in-package :cl-user)
(defvar *install-root* (make-pathname :directory (pathname-directory *load-truename*)))
(eval-when (:compile-toplevel :load-toplevel :execute)
(unless (find-package :asdf)
(load (merge-pathnames "misc/asdf" *install-root*))))
(push *install-root* asdf:*central-registry*)
(asdf:operate 'asdf:load-op :lisa :force t)
| 1,327 | Common Lisp | .lisp | 24 | 53.541667 | 87 | 0.749032 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 8f285b00266a7afb9e85b47a6910b2ea8f47695164797ffcf678624a1732e022 | 10,079 | [
-1
] |
10,080 | lisa-debugger.lisp | gpwwjr_LISA/src/debugger/lisa-debugger.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young ([email protected])
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: debugger.lisp
;;; Description: The LISA debugger.
;;; $Id: lisa-debugger.lisp,v 1.11 2007/09/07 21:34:37 youngde Exp $
(in-package "LISA")
(defvar *breakpoints* (make-hash-table))
(defvar *stepping* nil)
(defvar *read-eval-print*)
(defvar *suspended-rule*)
(defvar *tokens*)
(defmacro in-debugger-p ()
`(cl:assert (boundp '*suspended-rule*) nil
"The debugger must be running to use this function."))
#+LispWorks
(defmacro with-debugger-streams (&body body)
`(let ((*standard-input* *standard-input*)
(*standard-output* *standard-output*)
(*terminal-io* *terminal-io*))
(progn ,@body)))
#-LispWorks
(defmacro with-debugger-streams (&body body)
`(let ((*terminal-io* *terminal-io*)
(*standard-input* *terminal-io*)
(*standard-output* *terminal-io*))
(progn ,@body)))
(defun leave-debugger ()
(setf *stepping* nil))
(defun has-breakpoint-p (rule)
(gethash (rule-name rule) *breakpoints*))
(defun breakpoints ()
(format t "Current breakpoints:~%")
(loop for rule-name being the hash-value of *breakpoints*
do (format t " ~A~%" rule-name))
(values))
(defun breakpoint-operation (rule-name op)
(let ((rule (find-rule (inference-engine) rule-name)))
(cond ((null rule)
(format t "There's no rule by this name (~A)~%" rule-name))
(t
(funcall op (rule-name rule))))
rule-name))
(defun set-break (rule-name)
(breakpoint-operation
rule-name #'(lambda (rule-name)
(setf (gethash rule-name *breakpoints*)
rule-name)))
rule-name)
(defun clear-break (rule-name)
(breakpoint-operation
rule-name #'(lambda (rule-name)
(remhash rule-name *breakpoints*)))
rule-name)
(defun clear-breaks ()
(clrhash *breakpoints*)
nil)
(defun next ()
(in-debugger-p)
(setf *stepping* t)
(setf *read-eval-print* nil)
(values))
(defun resume ()
(in-debugger-p)
(setf *read-eval-print* nil)
(setf *stepping* nil)
(values))
(defun instance (fact)
(find-instance-of-fact fact))
(defun token (index)
(in-debugger-p)
(cl:assert (and (not (minusp index))
(< index (token-fact-count *tokens*)))
nil "The token index isn't valid.")
(let ((fact (token-find-fact *tokens* index)))
(cond ((typep fact 'fact)
fact)
(t
(format t "The index ~D references a non-fact object." index)
nil))))
(defun tokens (&key (verbose nil))
(in-debugger-p)
(format t "Token stack for ~A:~%" (rule-name (rule)))
(do* ((facts (token-make-fact-list *tokens* :debugp t) (rest facts))
(fact (first facts) (first facts))
(index 0 (incf index)))
((endp facts))
(when (typep fact 'fact)
(if verbose
(format t " [~D] ~S~%" index fact)
(format t " [~D] ~A, ~A~%"
index
(fact-symbolic-id fact)
(fact-name fact)))))
(values))
(defun bindings ()
(in-debugger-p)
(format t "Effective bindings for ~A:~%" (rule-name (rule)))
(dolist (binding (rule-binding-set (rule)))
(format t " ~A: ~S~%"
(binding-variable binding)
(if (pattern-binding-p binding)
(token-find-fact *tokens* (binding-address binding))
(get-slot-value
(token-find-fact *tokens* (binding-address binding))
(binding-slot-name binding)))))
(values))
(defun debugger-repl ()
(with-debugger-streams
(do ((*read-eval-print* t)
(count 0 (incf count)))
((not *read-eval-print*) count)
(handler-case
(progn
(format t "LISA-DEBUG[~D]: " count)
(force-output)
(let ((input (read-line)))
(when (> (length input) 0)
(print (eval (read-from-string input)))))
(terpri))
(error (e)
(cerror "Remain in the LISA debugger." e)
(unless (yes-or-no-p "Remain in the debugger? ")
(leave-debugger)
(setf *read-eval-print* nil)))))))
(defmethod fire-rule :around ((self rule) tokens)
(when (or *stepping*
(has-breakpoint-p self))
(let ((*active-rule* self)
(*suspended-rule* self)
(*tokens* tokens))
(format t "Stopping in rule ~S~%" (rule-name self))
(when *watching-bindings*
(bindings))
(debugger-repl)))
(call-next-method))
(defmethod run-engine :after ((self rete) &optional step)
(declare (ignore step))
(leave-debugger))
(defmethod forget-rule :before ((self rete) (rule-name symbol))
(clear-break rule-name))
(provide 'lisa-debugger)
| 5,590 | Common Lisp | .lisp | 153 | 30.424837 | 79 | 0.622585 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 9c4e51a6a4d3046dc296b60221c5b7e7b709f1a7e1c6b01cbc6ce58af2648823 | 10,080 | [
-1
] |
10,108 | pkgdecl.lisp | gpwwjr_LISA/src/packages/pkgdecl.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young ([email protected])
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: pkgdecl.lisp
;;; Description: Package declarations for LISA.
;;; $Id: pkgdecl.lisp,v 1.81 2007/09/08 14:48:59 youngde Exp $
(in-package "CL-USER")
;;; accommodate implementations whose CLOS is really PCL, like CMUCL...
(eval-when (:compile-toplevel :load-toplevel :execute)
(when (and (not (find-package 'clos))
(find-package 'pcl))
(rename-package (find-package 'pcl) 'pcl
`(clos ,@(package-nicknames 'pcl)))))
(eval-when (:compile-toplevel :load-toplevel :execute)
(defpackage "LISA"
(:use "COMMON-LISP")
(:export
"ASSERT"
"DEFAULT"
.
#1=(
"*SHOW-LISA-WARNINGS*"
"=>"
"ACTIVATION"
"ACTIVE-RULE"
"AGENDA"
"ALLOW-DUPLICATE-FACTS"
"ASSERT-INSTANCE"
"AUTO-FOCUS-P"
"BINDINGS"
"BREAKPOINTS"
"CLEAR"
"CLEAR-BREAK"
"CLEAR-BREAKS"
"CONSIDER-TAXONOMY"
"CONTEXT"
"CONTEXT-NAME"
"CONTEXTS"
"CURRENT-ENGINE"
"DEFCONTEXT"
"DEFFACTS"
"DEFIMPORT"
"DEFRULE"
"DEFTEMPLATE"
"DEPENDENCIES"
"DUPLICATE-FACT"
"ENGINE"
"EXISTS"
"FACT"
"FACT-ID"
"FACT-NAME"
"FACT-SLOT-TABLE"
"FACTS"
"FIND-CONTEXT"
"FIND-FACT-BY-ID"
"FIND-FACT-BY-NAME"
"FIND-RULE"
"FOCUS"
"FOCUS-STACK"
"GET-FACT-LIST"
"GET-SLOT-VALUE"
"HALT"
"IN-RULE-FIRING-P"
"INFERENCE-ENGINE"
"INITIAL-FACT"
"INSTANCE"
"LOGICAL"
"MAKE-INFERENCE-ENGINE"
"MARK-INSTANCE-AS-CHANGED"
"MODIFY"
"NEXT"
"PPFACT"
"REFOCUS"
"RESET"
"RESUME"
"RETE"
"RETE-NETWORK"
"RETRACT"
"RETRACT-INSTANCE"
"RETRIEVE"
"RULE"
"RULE-COMMENT"
"RULE-CONTEXT"
"RULE-DEFAULT-NAME"
"RULE-NAME"
"RULE-SALIENCE"
"RULE-SHORT-NAME"
"RULES"
"RUN"
"SET-BREAK"
"SHOW-NETWORK"
"SLOT"
"SLOT-VALUE-OF-INSTANCE"
"STANDARD-KB-CLASS"
"TEST"
"TOKEN"
"TOKENS"
"UNDEFCONTEXT"
"UNDEFRULE"
"UNWATCH"
"USE-DEFAULT-ENGINE"
"USE-FANCY-ASSERT"
"USE-LISA"
"WALK"
"WATCH"
"WATCHING"
"WITH-INFERENCE-ENGINE"
"WITH-SIMPLE-QUERY"))
(:shadow "ASSERT"))
(defpackage "LISA-USER"
(:use "COMMON-LISP")
(:shadowing-import-from "LISA" "ASSERT" "DEFAULT")
(:import-from "LISA" . #1#)))
(defpackage "LISA.REFLECT"
(:use "COMMON-LISP")
(:nicknames "REFLECT")
#+(or Allegro LispWorks)
(:import-from "CLOS"
"ENSURE-CLASS"
"CLASS-DIRECT-SUPERCLASSES"
"CLASS-FINALIZED-P"
"FINALIZE-INHERITANCE")
#+CMU
(:import-from "CLOS"
"CLASS-FINALIZED-P"
"FINALIZE-INHERITANCE")
#+:sbcl
(:import-from "SB-MOP"
"CLASS-FINALIZED-P"
"FINALIZE-INHERITANCE")
(:export
"CLASS-ALL-SUPERCLASSES"
"CLASS-FINALIZED-P"
"CLASS-SLOT-LIST"
"ENSURE-CLASS"
"FINALIZE-INHERITANCE"
"FIND-DIRECT-SUPERCLASSES"))
(defpackage "LISA.BELIEF"
(:use "COMMON-LISP")
(:nicknames "BELIEF")
(:export
"ADJUST-BELIEF"
"BELIEF->ENGLISH"
"BELIEF-FACTOR"
"FALSE-P"
"TRUE-P"
"UKNOWN-P"))
(defpackage "LISA.HEAP"
(:use "COMMON-LISP")
(:nicknames "HEAP")
(:export
"CREATE-HEAP"
"HEAP-CLEAR"
"HEAP-COUNT"
"HEAP-COLLECT"
"HEAP-EMPTY-P"
"HEAP-FIND"
"HEAP-INSERT"
"HEAP-PEEK"
"HEAP-REMOVE"))
(defpackage "LISA.UTILS"
(:use "COMMON-LISP")
(:nicknames "UTILS")
(:export
"COLLECT"
"COMPOSE"
"COMPOSE-ALL"
"COMPOSE-F"
"FIND-AFTER"
"FIND-BEFORE"
"FIND-IF-AFTER"
"FLATTEN"
"LSTHASH"
"MAP-IN"
"STRING-TOKENS"))
| 5,057 | Common Lisp | .lisp | 186 | 19.521505 | 79 | 0.562036 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | a20d5f0ef36b879f338983747d9272429b081180fe3947496773df8eabdc8b74 | 10,108 | [
-1
] |
10,109 | retrieve.lisp | gpwwjr_LISA/src/core/retrieve.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young ([email protected])
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: retrieve.lisp
;;; Description:
;;; $Id: retrieve.lisp,v 1.2 2007/09/07 21:32:05 youngde Exp $
(in-package "LISA")
(defvar *query-result* nil
"Holds the results of query firings.")
(defun run-query (query-rule)
"Runs a query (RULE instance), and returns both the value of *QUERY-RESULT*
and the query name itself."
(declare (ignorable query-rule))
(let ((*query-result* (list)))
(assert (query-fact))
(run)
*query-result*))
(defmacro defquery (name &body body)
"Defines a new query identified by the symbol NAME."
`(define-rule ,name ',body))
;;; Queries fired by RETRIEVE collect their results in the special variable
;;; *QUERY-RESULT*. As an example, one firing of this query,
;;;
;;; (retrieve (?x ?y)
;;; (?x (rocky (name ?name)))
;;; (?y (hobbit (name ?name))))
;;;
;;; will produce a result similar to,
;;;
;;; (((?X . #<ROCKY @ #x7147b70a>) (?Y . #<HOBBIT @ #x7147b722>)))
#+nil
(defmacro retrieve ((&rest varlist) &body body)
(flet ((make-query-binding (var)
`(cons ',var ,var)))
(let ((query-name (gensym))
(query (gensym)))
`(with-inference-engine
((make-query-engine (inference-engine)))
(let* ((,query-name (gensym))
(,query
(defquery ',query-name
(query-fact)
,@body
=>
(push (list ,@(mapcar #'make-query-binding varlist))
*query-result*))))
(run-query ,query))))))
(defmacro retrieve ((&rest varlist) &body body)
(flet ((make-query-binding (var)
`(cons ',var ,var)))
(let ((query-name (gensym))
(query (gensym)))
`(with-inference-engine
((make-query-engine (inference-engine)))
(let* ((,query-name (gensym))
(,query
(defquery ',query-name
(query-fact)
,@body
=>
(push (list ,@(mapcar #'(lambda (var)
var)
varlist))
*query-result*))))
(run-query ,query))))))
(defmacro with-simple-query ((var value) query &body body)
"For each variable/instance pair in a query result, invoke BODY with VAR
bound to the query variable and VALUE bound to the instance."
(let ((result (gensym)))
`(let ((,result ,query))
(dolist (match ,result)
(dolist (binding match)
(let ((,var (car binding))
(,value (cdr binding)))
,@body))))))
| 3,626 | Common Lisp | .lisp | 86 | 33.197674 | 79 | 0.573738 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | f0c4f2e09baa9d93fb1cebab9d7472409a5a25c094e54af47914d68df501570b | 10,109 | [
-1
] |
10,110 | rete.lisp | gpwwjr_LISA/src/core/rete.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young ([email protected])
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: rete.lisp
;;; Description: Class representing the inference engine itself.
;;; $Id: rete.lisp,v 1.3 2007/09/11 21:14:09 youngde Exp $
(in-package :lisa)
(defclass rete ()
((fact-table :initform (make-hash-table :test #'equalp)
:accessor rete-fact-table)
(fact-id-table :initform (make-hash-table)
:accessor fact-id-table)
(instance-table :initform (make-hash-table)
:reader rete-instance-table)
(rete-network :initform (make-rete-network)
:reader rete-network)
(next-fact-id :initform -1
:accessor rete-next-fact-id)
(autofacts :initform (list)
:accessor rete-autofacts)
(meta-data :initform (make-hash-table)
:reader rete-meta-data)
(dependency-table :initform (make-hash-table :test #'equal)
:accessor rete-dependency-table)
(contexts :initform (make-hash-table :test #'equal)
:reader rete-contexts)
(focus-stack :initform (list)
:accessor rete-focus-stack)
(halted :initform nil
:accessor rete-halted)
(firing-count :initform 0
:accessor rete-firing-count)))
(defmethod initialize-instance :after ((self rete) &rest initargs)
(declare (ignore initargs))
(register-new-context self (make-context :initial-context))
(reset-focus-stack self)
self)
;;; FACT-META-OBJECT represents data about facts. Every Lisa fact is backed by
;;; a CLOS instance that was either defined by the application or internally
;;; by Lisa (via DEFTEMPLATE).
(defstruct fact-meta-object
(class-name nil :type symbol)
(slot-list nil :type list)
(superclasses nil :type list))
(defun register-meta-object (rete key meta-object)
(setf (gethash key (rete-meta-data rete)) meta-object))
(defun find-meta-object (rete symbolic-name)
(gethash symbolic-name (rete-meta-data rete)))
(defun rete-fact-count (rete)
(hash-table-count (rete-fact-table rete)))
(defun find-rule (rete rule-name)
(with-rule-name-parts (context-name short-name long-name) rule-name
(find-rule-in-context (find-context rete context-name) long-name)))
(defun add-rule-to-network (rete rule patterns)
(flet ((load-facts (network)
(maphash #'(lambda (key fact)
(declare (ignore key))
(add-fact-to-network network fact))
(rete-fact-table rete))))
(when (find-rule rete (rule-name rule))
(forget-rule rete rule))
(if (zerop (rete-fact-count rete))
(compile-rule-into-network (rete-network rete) patterns rule)
(merge-rule-into-network
(rete-network rete) patterns rule :loader #'load-facts))
(add-rule-to-context (rule-context rule) rule)
rule))
(defmethod forget-rule ((self rete) (rule-name symbol))
(flet ((disable-activations (rule)
(mapc #'(lambda (activation)
(setf (activation-eligible activation) nil))
(find-all-activations
(context-strategy (rule-context rule)) rule))))
(let ((rule (find-rule self rule-name)))
(cl:assert (not (null rule)) nil
"The rule named ~S is not known to be defined." rule-name)
(remove-rule-from-network (rete-network self) rule)
(remove-rule-from-context (rule-context rule) rule)
(disable-activations rule)
rule)))
(defmethod forget-rule ((self rete) (rule rule))
(forget-rule self (rule-name rule)))
(defmethod forget-rule ((self rete) (rule-name string))
(forget-rule self (find-symbol rule-name)))
(defun remember-fact (rete fact)
(with-accessors ((fact-table rete-fact-table)
(id-table fact-id-table)) rete
(setf (gethash (hash-key fact) fact-table) fact)
(setf (gethash (fact-id fact) id-table) fact)))
(defun forget-fact (rete fact)
(with-accessors ((fact-table rete-fact-table)
(id-table fact-id-table)) rete
(remhash (hash-key fact) fact-table)
(remhash (fact-id fact) id-table)))
(defun find-fact-by-id (rete fact-id)
(gethash fact-id (fact-id-table rete)))
(defun find-fact-by-name (rete fact-name)
(gethash fact-name (rete-fact-table rete)))
(defun forget-all-facts (rete)
(clrhash (rete-fact-table rete))
(clrhash (fact-id-table rete)))
(defun get-fact-list (rete)
(delete-duplicates
(sort
(loop for fact being the hash-values of (rete-fact-table rete)
collect fact)
#'(lambda (f1 f2) (< (fact-id f1) (fact-id f2))))))
(defun duplicate-fact-p (rete fact)
(let ((f (gethash (hash-key fact) (rete-fact-table rete))))
(if (and f (equals f fact))
f
nil)))
(defmacro ensure-fact-is-unique (rete fact)
(let ((existing-fact (gensym)))
`(unless *allow-duplicate-facts*
(let ((,existing-fact
(gethash (hash-key ,fact) (rete-fact-table ,rete))))
(unless (or (null ,existing-fact)
(not (equals ,fact ,existing-fact)))
(error (make-condition 'duplicate-fact :existing-fact ,existing-fact)))))))
(defmacro with-unique-fact ((rete fact) &body body)
(let ((body-fn (gensym))
(existing-fact (gensym)))
`(flet ((,body-fn ()
,@body))
(if *allow-duplicate-facts*
(,body-fn)
(let ((,existing-fact (duplicate-fact-p ,rete ,fact)))
(if (not ,existing-fact)
(,body-fn)
(error (make-condition 'duplicate-fact
:existing-fact ,existing-fact))))))))
(defun next-fact-id (rete)
(incf (rete-next-fact-id rete)))
(defun add-autofact (rete deffact)
(pushnew deffact (rete-autofacts rete) :key #'deffacts-name))
(defun remove-autofacts (rete)
(setf (rete-autofacts rete) nil))
(defun assert-autofacts (rete)
(mapc #'(lambda (deffact)
(mapc #'(lambda (fact)
(assert-fact rete (make-fact-from-template fact)))
(deffacts-fact-list deffact)))
(rete-autofacts rete)))
(defmethod assert-fact-aux ((self rete) fact)
(with-truth-maintenance (self)
(setf (fact-id fact) (next-fact-id self))
(remember-fact self fact)
(trace-assert fact)
(add-fact-to-network (rete-network self) fact)
(when (fact-shadowsp fact)
(register-clos-instance self (find-instance-of-fact fact) fact)))
fact)
(defmethod adjust-belief (rete fact (belief-factor number))
(with-unique-fact (rete fact)
(setf (belief-factor fact) belief-factor)))
(defmethod adjust-belief (rete fact (belief-factor t))
(declare (ignore rete))
(when (in-rule-firing-p)
(let ((rule-belief (belief-factor (active-rule)))
(facts (token-make-fact-list *active-tokens*)))
(setf (belief-factor fact) (belief:adjust-belief facts rule-belief (belief-factor fact))))))
(defmethod assert-fact ((self rete) fact &key belief)
(let ((duplicate (duplicate-fact-p self fact)))
(cond (duplicate
(adjust-belief self duplicate belief))
(t
(adjust-belief self fact belief)
(assert-fact-aux self fact)))
(if duplicate duplicate fact)))
(defmethod retract-fact ((self rete) (fact fact))
(with-truth-maintenance (self)
(forget-fact self fact)
(trace-retract fact)
(remove-fact-from-network (rete-network self) fact)
(when (fact-shadowsp fact)
(forget-clos-instance self (find-instance-of-fact fact)))
fact))
(defmethod retract-fact ((self rete) (instance standard-object))
(let ((fact (find-fact-using-instance self instance)))
(cl:assert (not (null fact)) nil
"This CLOS instance is unknown to LISA: ~S" instance)
(retract-fact self fact)))
(defmethod retract-fact ((self rete) (fact-id integer))
(let ((fact (find-fact-by-id self fact-id)))
(and (not (null fact))
(retract-fact self fact))))
(defmethod modify-fact ((self rete) fact &rest slot-changes)
(retract-fact self fact)
(mapc #'(lambda (slot)
(set-slot-value fact (first slot) (second slot)))
slot-changes)
(assert-fact self fact)
fact)
(defun clear-contexts (rete)
(loop for context being the hash-values of (rete-contexts rete)
do (clear-activations context)))
(defun clear-focus-stack (rete)
(setf (rete-focus-stack rete) (list)))
(defun initial-context (rete)
(find-context rete :initial-context))
(defun reset-focus-stack (rete)
(setf (rete-focus-stack rete)
(list (initial-context rete))))
(defun set-initial-state (rete)
(forget-all-facts rete)
(clear-contexts rete)
(reset-focus-stack rete)
(setf (rete-next-fact-id rete) -1)
(setf (rete-firing-count rete) 0)
t)
(defmethod reset-engine ((self rete))
(reset-network (rete-network self))
(set-initial-state self)
(assert (initial-fact))
(assert-autofacts self)
t)
(defun get-rule-list (rete &optional (context-name nil))
(if (null context-name)
(loop for context being the hash-values of (rete-contexts rete)
append (context-rule-list context))
(context-rule-list (find-context rete context-name))))
(defun get-activation-list (rete &optional (context-name nil))
(if (not context-name)
(loop for context being the hash-values of (rete-contexts rete)
for activations = (context-activation-list context)
when activations
nconc activations)
(context-activation-list (find-context rete context-name))))
(defun find-fact-using-instance (rete instance)
(gethash instance (rete-instance-table rete)))
(defun register-clos-instance (rete instance fact)
(setf (gethash instance (rete-instance-table rete)) fact))
(defun forget-clos-instance (rete instance)
(remhash instance (rete-instance-table rete)))
(defun forget-clos-instances (rete)
(clrhash (rete-instance-table rete)))
(defmethod mark-clos-instance-as-changed ((self rete) instance
&optional (slot-id nil))
(let ((fact (find-fact-using-instance self instance))
(network (rete-network self)))
(cond ((null fact)
(warn "This instance is not known to Lisa: ~S." instance))
(t
(remove-fact-from-network network fact)
(synchronize-with-instance fact slot-id)
(add-fact-to-network network fact)))
instance))
(defun find-context (rete defined-name &optional (errorp t))
(let ((context
(gethash (make-context-name defined-name) (rete-contexts rete))))
(if (and (null context) errorp)
(error "There's no context named: ~A" defined-name)
context)))
(defun register-new-context (rete context)
(setf (gethash (context-name context) (rete-contexts rete)) context))
(defun forget-context (rete context-name)
(let ((context (find-context rete context-name)))
(dolist (rule (context-rule-list context))
(forget-rule rete rule))
(remhash context-name (rete-contexts rete))
context))
(defun current-context (rete)
(first (rete-focus-stack rete)))
(defun next-context (rete)
(with-accessors ((focus-stack rete-focus-stack)) rete
(pop focus-stack)
(setf *active-context* (first focus-stack))))
(defun starting-context (rete)
(first (rete-focus-stack rete)))
(defun push-context (rete context)
(push context (rete-focus-stack rete))
(setf *active-context* context))
(defun pop-context (rete)
(next-context rete))
(defun retrieve-contexts (rete)
(loop for context being the hash-values of (rete-contexts rete)
collect context))
(defmethod add-activation ((self rete) activation)
(let ((rule (activation-rule activation)))
(trace-enable-activation activation)
(add-activation (conflict-set rule) activation)
(when (auto-focus-p rule)
(push-context self (rule-context rule)))))
(defmethod disable-activation ((self rete) activation)
(when (eligible-p activation)
(trace-disable-activation activation)
(setf (activation-eligible activation) nil))
activation)
(defmethod run-engine ((self rete) &optional (step -1))
(with-context (starting-context self)
(setf (rete-halted self) nil)
(do ((count 0))
((or (= count step) (rete-halted self)) count)
(let ((activation
(next-activation (conflict-set (active-context)))))
(cond ((null activation)
(next-context self)
(when (null (active-context))
(reset-focus-stack self)
(halt-engine self)))
((eligible-p activation)
(incf (rete-firing-count self))
(fire-activation activation)
(incf count)))))))
(defun halt-engine (rete)
(setf (rete-halted rete) t))
(defun make-rete ()
(make-instance 'rete))
(defun make-inference-engine ()
(make-rete))
(defun copy-network (engine)
(let ((new-engine (make-inference-engine)))
(mapc #'(lambda (rule)
(copy-rule rule new-engine))
(get-rule-list engine))
new-engine))
(defun make-query-engine (source-rete)
(let* ((query-engine (make-inference-engine)))
(loop for fact being the hash-values of (rete-fact-table source-rete)
do (remember-fact query-engine fact))
query-engine))
| 14,093 | Common Lisp | .lisp | 333 | 36.168168 | 98 | 0.664791 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 9f58f2ebef7e0cc6aea199b5a3bf833c2c857b029d4d6a6b9d4345a0eed783db | 10,110 | [
-1
] |
10,114 | fact.lisp | gpwwjr_LISA/src/core/fact.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: fact.lisp
;;; Description:
;;; $Id: fact.lisp,v 1.2 2007/09/07 21:32:05 youngde Exp $
(in-package :lisa)
(defclass fact ()
((name :initarg :name
:reader fact-name)
(id :initform -1
:accessor fact-id)
(slot-table :reader fact-slot-table
:initform (make-hash-table :test #'equal))
(belief :initarg :belief
:initform nil
:accessor belief-factor)
(clos-instance :reader fact-clos-instance)
(shadows :initform nil
:reader fact-shadowsp)
(meta-data :reader fact-meta-data))
(:documentation
"This class represents all facts in the knowledge base."))
(defmethod equals ((fact-1 fact) (fact-2 fact))
(and (eq (fact-name fact-1) (fact-name fact-2))
(equalp (fact-slot-table fact-1) (fact-slot-table fact-2))))
(defmethod hash-key ((self fact))
(let ((key (list)))
(maphash #'(lambda (slot value)
(declare (ignore slot))
(push value key))
(fact-slot-table self))
(push (fact-name self) key)
key))
(defmethod slot-value-of-instance ((object t) slot-name)
(slot-value object slot-name))
(defmethod (setf slot-value-of-instance) (new-value (object t) slot-name)
(setf (slot-value object slot-name) new-value))
(defun fact-symbolic-id (fact)
(format nil "F-~D" (fact-id fact)))
(defun set-slot-value (fact slot-name value)
"Assigns a new value to a slot in a fact and its associated CLOS
instance. SLOT-NAME is a symbol; VALUE is the new value for the
slot."
(with-auto-notify (object (find-instance-of-fact fact))
(setf (slot-value-of-instance object slot-name) value)
(initialize-slot-value fact slot-name value)))
(defun initialize-slot-value (fact slot-name value)
"Sets the value of a slot in a fact's slot table. FACT is a FACT instance;
SLOT-NAME is a symbol; VALUE is the slot's new value."
(setf (gethash slot-name (fact-slot-table fact)) value)
fact)
(defun set-slot-from-instance (fact instance slot-name)
"Assigns to a slot the value from the corresponding slot in the fact's CLOS
instance. FACT is a FACT instance; META-FACT is a META-FACT instance;
INSTANCE is the fact's CLOS instance; SLOT-NAME is a symbol representing the
affected slot."
(initialize-slot-value
fact slot-name
(slot-value-of-instance instance slot-name)))
(defun get-slot-values (fact)
"Returns a list of slot name / value pairs for every slot in a fact. FACT is
a fact instance."
(let ((slots (list)))
(maphash #'(lambda (slot value)
(push (list slot value) slots))
(fact-slot-table fact))
slots))
(defmethod get-slot-value ((self fact) (slot-name symbol))
"Returns the value associated with a slot name. FACT is a FACT instance;
SLOT-NAME is a SLOT-NAME instance."
(gethash slot-name (fact-slot-table self)))
(defmethod get-slot-value ((self fact) (slot-name (eql :object)))
(fact-clos-instance self))
(defun find-instance-of-fact (fact)
"Retrieves the CLOS instance associated with a fact. FACT is a FACT
instance."
(fact-clos-instance fact))
;;; Corrected version courtesy of Aneil Mallavarapu...
(defun has-superclass (fact symbolic-name) ; fix converts symbolic-name to a class-object
(find (find-class symbolic-name) (get-superclasses (fact-meta-data fact))))
(defun synchronize-with-instance (fact &optional (effective-slot nil))
"Makes a fact's slot values and its CLOS instance's slot values match. If a
slot identifier is provided then only that slot is synchronized. FACT
is a FACT instance; EFFECTIVE-SLOT, if supplied, is a symbol representing
the CLOS instance's slot."
(let ((instance (find-instance-of-fact fact))
(meta (fact-meta-data fact)))
(flet ((synchronize-all-slots ()
(mapc #'(lambda (slot-name)
(set-slot-from-instance fact instance slot-name))
(get-slot-list meta)))
(synchronize-this-slot ()
(set-slot-from-instance fact instance effective-slot)))
(if (null effective-slot)
(synchronize-all-slots)
(synchronize-this-slot)))
fact))
(defun reconstruct-fact (fact)
`(,(fact-name fact) ,@(get-slot-values fact)))
(defmethod print-object ((self fact) strm)
(print-unreadable-object (self strm :type nil :identity t)
(format strm "~A ; id ~D" (fact-name self) (fact-id self))))
(defun fact (id)
(let ((facts (get-fact-list (inference-engine))))
(dolist (fact facts)
(if (= id (fact-id fact))
(return fact)))))
(defun ppfact (id)
(let ((fact (fact id)))
(format t "~S~%" fact)
(maphash #'(lambda (slot value)
(format t " - Slot: ~S, Value: ~S~%"
slot value))
(fact-slot-table fact))
(values)))
(defmethod initialize-instance :after ((self fact) &key (slots nil)
(instance nil))
"Initializes a FACT instance. SLOTS is a list of slot name / value pairs,
where (FIRST SLOTS) is a symbol and (SECOND SLOT) is the slot's
value. INSTANCE is the CLOS instance to be associated with this FACT; if
INSTANCE is NIL then FACT is associated with a template and a suitable
instance must be created; otherwise FACT is bound to a user-defined class."
(with-slots ((slot-table slot-table)
(meta-data meta-data)) self
(setf meta-data (find-meta-fact (fact-name self)))
(mapc #'(lambda (slot-name)
(setf (gethash slot-name slot-table) nil))
(get-slot-list meta-data))
(if (null instance)
(initialize-fact-from-template self slots meta-data)
(initialize-fact-from-instance self instance meta-data))
self))
(defun initialize-fact-from-template (fact slots meta-data)
"Initializes a template-bound FACT. An instance of the FACT's associated
class is created and the slots of both are synchronized from the SLOTS
list. FACT is a FACT instance; SLOTS is a list of symbol/value pairs."
(let ((instance
(make-instance (find-class (get-class-name meta-data) nil))))
(cl:assert (not (null instance)) nil
"No class was found corresponding to fact name ~S." (fact-name fact))
(setf (slot-value fact 'clos-instance) instance)
(mapc #'(lambda (slot-spec)
(let ((slot-name (first slot-spec))
(slot-value (second slot-spec)))
(set-slot-value fact slot-name slot-value)))
slots)
fact))
(defun initialize-fact-from-instance (fact instance meta-data)
"Initializes a fact associated with a user-created CLOS instance. The fact's
slot values are taken from the CLOS instance. FACT is a FACT instance;
INSTANCE is the CLOS instance associated with this fact."
(mapc #'(lambda (slot-name)
(set-slot-from-instance fact instance slot-name))
(get-slot-list meta-data))
(setf (slot-value fact 'clos-instance) instance)
(setf (slot-value fact 'shadows) t)
fact)
(defun make-fact (name &rest slots)
"The default constructor for class FACT. NAME is the symbolic fact name as
used in rules; SLOTS is a list of symbol/value pairs."
(make-instance 'fact :name name :slots slots))
(defun make-fact-from-instance (name clos-instance)
"A constructor for class FACT that creates an instance bound to a
user-defined CLOS instance. NAME is the symbolic fact name; CLOS-INSTANCE is
a user-supplied CLOS object."
(make-instance 'fact :name name :instance clos-instance))
(defun make-fact-from-template (fact)
"Creates a FACT instance using another FACT instance as a
template. Basically a clone operation useful for such things as asserting
DEFFACTS."
(apply #'make-fact
(fact-name fact)
(mapcar #'(lambda (slot-name)
(list slot-name (get-slot-value fact slot-name)))
(get-slot-list (fact-meta-data fact)))))
| 8,804 | Common Lisp | .lisp | 187 | 41.358289 | 89 | 0.682708 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 1ef269d4751480d9583ecc2e654c4d0434bda77f61740334973311abcb66999d | 10,114 | [
-1
] |
10,119 | language.lisp | gpwwjr_LISA/src/core/language.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: language.lisp
;;; Description: Code that implements the Lisa programming language.
;;;
;;; $Id: language.lisp,v 1.2 2007/09/07 21:32:05 youngde Exp $
(in-package :lisa)
(defmacro defrule (name (&key (salience 0) (context nil) (belief nil) (auto-focus nil)) &body body)
(let ((rule-name (gensym)))
`(let ((,rule-name ,@(if (consp name) `(,name) `(',name))))
(redefine-defrule ,rule-name
',body
:salience ,salience
:context ,context
:belief ,belief
:auto-focus ,auto-focus))))
(defun undefrule (rule-name)
(with-rule-name-parts (context short-name long-name) rule-name
(forget-rule (inference-engine) long-name)))
(defmacro deftemplate (name (&key) &body body)
(redefine-deftemplate name body))
(defmacro defcontext (context-name &optional (strategy nil))
`(unless (find-context (inference-engine) ,context-name nil)
(register-new-context (inference-engine)
(make-context ,context-name :strategy ,strategy))))
(defmacro undefcontext (context-name)
`(forget-context (inference-engine) ,context-name))
(defun focus-stack ()
(rete-focus-stack (inference-engine)))
(defun focus (&rest args)
(if (null args)
(current-context (inference-engine))
(dolist (context-name (reverse args) (focus-stack))
(push-context
(inference-engine)
(find-context (inference-engine) context-name)))))
(defun refocus ()
(pop-context (inference-engine)))
(defun contexts ()
(let ((contexts (retrieve-contexts (inference-engine))))
(dolist (context contexts)
(format t "~S~%" context))
(format t "For a total of ~D context~:P.~%" (length contexts))
(values)))
(defun dependencies ()
(maphash #'(lambda (dependent-fact dependencies)
(format *trace-output* "~S:~%" dependent-fact)
(format *trace-output* " ~S~%" dependencies))
(rete-dependency-table (inference-engine)))
(values))
(defun expand-slots (body)
(mapcar #'(lambda (pair)
(destructuring-bind (name value) pair
`(list (identity ',name)
(identity
,@(if (quotablep value)
`(',value)
`(,value))))))
body))
(defmacro assert ((name &body body) &key (belief nil))
(let ((fact (gensym))
(fact-object (gensym)))
`(let ((,fact-object
,@(if (or (consp name)
(variablep name))
`(,name)
`(',name))))
(if (typep ,fact-object 'standard-object)
(parse-and-insert-instance ,fact-object :belief ,belief)
(progn
(ensure-meta-data-exists ',name)
(let ((,fact (make-fact ',name ,@(expand-slots body))))
(when (and (in-rule-firing-p)
(logical-rule-p (active-rule)))
(bind-logical-dependencies ,fact))
(assert-fact (inference-engine) ,fact :belief ,belief)))))))
(defmacro deffacts (name (&key &allow-other-keys) &body body)
(parse-and-insert-deffacts name body))
(defun engine ()
(active-engine))
(defun rule ()
(active-rule))
(defun assert-instance (instance)
(parse-and-insert-instance instance))
(defun retract-instance (instance)
(parse-and-retract-instance instance (inference-engine)))
(defun facts ()
(let ((facts (get-fact-list (inference-engine))))
(dolist (fact facts)
(format t "~S~%" fact))
(format t "For a total of ~D fact~:P.~%" (length facts))
(values)))
(defun rules (&optional (context-name nil))
(let ((rules (get-rule-list (inference-engine) context-name)))
(dolist (rule rules)
(format t "~S~%" rule))
(format t "For a total of ~D rule~:P.~%" (length rules))
(values)))
(defun agenda (&optional (context-name nil))
(let ((activations
(get-activation-list (inference-engine) context-name)))
(dolist (activation activations)
(format t "~S~%" activation))
(format t "For a total of ~D activation~:P.~%" (length activations))
(values)))
(defun reset ()
(reset-engine (inference-engine)))
(defun clear ()
(clear-system-environment))
(defun run (&optional (contexts nil))
(unless (null contexts)
(apply #'focus contexts))
(run-engine (inference-engine)))
(defun walk (&optional (step 1))
(run-engine (inference-engine) step))
(defmethod retract ((fact-object fact))
(retract-fact (inference-engine) fact-object))
(defmethod retract ((fact-object number))
(retract-fact (inference-engine) fact-object))
(defmethod retract ((fact-object t))
(parse-and-retract-instance fact-object (inference-engine)))
(defmacro modify (fact &body body)
`(modify-fact (inference-engine) ,fact ,@(expand-slots body)))
(defun watch (event)
(watch-event event))
(defun unwatch (event)
(unwatch-event event))
(defun watching ()
(let ((watches (watches)))
(format *trace-output* "Watching ~A~%"
(if watches watches "nothing"))
(values)))
(defun halt ()
(halt-engine (inference-engine)))
(defun mark-instance-as-changed (instance &key (slot-id nil))
(mark-clos-instance-as-changed (inference-engine) instance slot-id))
| 6,199 | Common Lisp | .lisp | 148 | 35.459459 | 99 | 0.640552 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 53bb9f10722f863e36de308ba3e1bf5939f8c87069a19e02ba2752a5b0ead642 | 10,119 | [
-1
] |
10,120 | rule-parser.lisp | gpwwjr_LISA/src/core/rule-parser.lisp | ;;; This file is part of Lisa, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: rule-parser.lisp
;;; Description: The Lisa rule parser, completely rewritten for release 3.0.
;;;
;;; $Id: rule-parser.lisp,v 1.5 2007/09/17 22:42:39 youngde Exp $
(in-package :lisa)
(defconstant *rule-separator* '=>)
(defvar *binding-table*)
(defvar *current-defrule*)
(defvar *current-defrule-pattern-location*)
(defvar *in-logical-pattern-p* nil)
(defvar *special-initial-elements* '(not exists logical))
(defvar *conditional-elements-table*
'((exists . parse-exists-pattern)
(not . parse-not-pattern)
(test . parse-test-pattern)))
(defun extract-rule-headers (body)
(if (stringp (first body))
(values (first body) (rest body))
(values nil body)))
(defun fixup-runtime-bindings (patterns)
"Supports the parsing of embedded DEFRULE forms."
(labels ((fixup-bindings (part result)
(let* ((token (first part))
(new-token token))
(cond ((null part)
(return-from fixup-bindings (nreverse result)))
((and (variablep token)
(boundp token))
(setf new-token (symbol-value token)))
((consp token)
(setf new-token (fixup-bindings token nil))))
(fixup-bindings (rest part) (push new-token result)))))
(fixup-bindings patterns nil)))
(defun preprocess-left-side (lhs)
(when (or (null lhs)
(find (caar lhs) *special-initial-elements*))
(push (list 'initial-fact) lhs))
(if (active-rule)
(fixup-runtime-bindings lhs)
lhs))
(defun find-conditional-element-parser (symbol)
(let ((parser (assoc symbol *conditional-elements-table*)))
(if parser
(cdr parser)
'parse-generic-pattern)))
(defun logical-element-p (pattern)
(eq (first pattern) 'logical))
(defmacro with-slot-components ((slot-name slot-value constraint) form &body body)
`(progn
(unless (consp ,form)
(error 'slot-parsing-error :slot-name ',slot-name :location *current-defrule-pattern-location*))
(let ((,slot-name (first ,form))
(,slot-value (second ,form))
(,constraint (third ,form)))
,@body)))
(defun make-binding-set ()
(loop for binding being the hash-values of *binding-table*
collect binding))
(defun find-or-set-slot-binding (var slot-name location)
"Given a variable, either retrieve the binding object for it or create a new one."
(multiple-value-bind (binding existsp)
(gethash var *binding-table*)
(unless existsp
(setf binding
(setf (gethash var *binding-table*)
(make-binding var location slot-name))))
(values binding existsp)))
(defun find-slot-binding (var &key (errorp t))
"Given a variable, retrieve the binding object for it."
(let ((binding (gethash var *binding-table*)))
(when errorp
(cl:assert binding nil "Missing slot binding for variable ~A" var))
binding))
(defun set-pattern-binding (var location)
(cl:assert (not (gethash var *binding-table*)) nil "This is a duplicate pattern binding: ~A" var)
(setf (gethash var *binding-table*)
(make-binding var location :pattern)))
(defun collect-bindings (forms &key (errorp t))
(let ((bindings (list)))
(dolist (obj (utils:flatten forms))
(when (variablep obj)
(let ((binding (find-slot-binding obj :errorp errorp)))
(unless (null binding)
(push binding bindings)))))
(nreverse bindings)))
(defmacro with-rule-components (((doc-string lhs rhs) rule-form) &body body)
(let ((remains (gensym)))
`(let ((*binding-table* (make-hash-table)))
(multiple-value-bind (,doc-string ,remains)
(extract-rule-headers ,rule-form)
(multiple-value-bind (,lhs ,rhs)
(parse-rule-body ,remains)
,@body)))))
(defun collect-constraint-bindings (constraint)
(let ((bindings (list)))
(dolist (obj (utils:flatten constraint))
(when (variablep obj)
(pushnew (find-slot-binding obj) bindings :key #'first)))
bindings))
;;; the parsing code itself...
(defun parse-one-slot-constraint (var constraint-form)
"Parses a single slot constraint, eg. (slot-name ?var 1) or (slot-name ?var (equal ?var 1))"
(let ((head (first constraint-form))
(args (second constraint-form)))
(cond ((eq head 'not)
(values `(equal ,var ,@(if (symbolp args) `(',args) args))
`(,(find-slot-binding var)) t))
(t
(values constraint-form (collect-constraint-bindings constraint-form) nil)))))
(defun slot-value-is-variable-p (value)
"Is the slot value a Lisa variable?"
(variable-p value))
(defun slot-value-is-atom-p (value)
"Is the slot value a simple constraint?"
(and (atom value)
(not (slot-value-is-variable-p value))))
(defun slot-value-is-negated-atom-p (value)
"Is the slot value a simple negated constraint?"
(and (consp value)
(eq (first value) 'not)
(slot-value-is-atom-p (second value))))
(defun slot-value-is-negated-variable-p (value)
(and (consp value)
(eq (first value) 'not)
(variable-p (second value))))
(defun intra-pattern-bindings-p (bindings location)
"Is every variable in a pattern 'local'; i.e. does not reference a binding in a previous pattern?"
(every #'(lambda (b)
(= location (binding-address b)))
bindings))
(defun parse-one-slot (form location)
"Parses a single raw pattern slot"
(with-slot-components (slot-name slot-value constraint) form
(cond ((slot-value-is-atom-p slot-value)
;; eg. (slot-name "frodo")
(make-pattern-slot :name slot-name :value slot-value))
((slot-value-is-negated-variable-p slot-value)
;; eg. (slot-name (not ?value))
(let ((binding (find-or-set-slot-binding (second slot-value) slot-name location)))
(make-pattern-slot :name slot-name
:value (second slot-value)
:negated t
:slot-binding binding)))
((slot-value-is-negated-atom-p slot-value)
;; eg. (slot-name (not "frodo"))
(make-pattern-slot :name slot-name :value (second slot-value) :negated t))
((and (slot-value-is-variable-p slot-value)
(not constraint))
;; eg. (slot-name ?value)
(let ((binding (find-or-set-slot-binding slot-value slot-name location)))
(make-pattern-slot :name slot-name :value slot-value :slot-binding binding
:intra-pattern-bindings (intra-pattern-bindings-p (list binding) location))))
((and (slot-value-is-variable-p slot-value)
constraint)
;; eg. (slot-name ?value (equal ?value "frodo"))
(let ((binding (find-or-set-slot-binding slot-value slot-name location)))
(multiple-value-bind (constraint-form constraint-bindings negatedp)
(parse-one-slot-constraint slot-value constraint)
(make-pattern-slot :name slot-name :value slot-value :slot-binding binding
:negated negatedp
:constraint constraint-form
:constraint-bindings constraint-bindings
:intra-pattern-bindings
(intra-pattern-bindings-p (list* binding constraint-bindings) location)))))
(t (error 'rule-parsing-error :rule-name *current-defrule*
:location *current-defrule-pattern-location*
:text "malformed slot")))))
(defun parse-rule-body (body)
(let ((location 0)
(patterns (list)))
(labels ((parse-lhs (pattern-list)
(let ((pattern (first pattern-list))
(*current-defrule-pattern-location* location))
(unless (listp pattern)
(error 'rule-parsing-error
:text "pattern is not a list"
:rule-name *current-defrule*
:location *current-defrule-pattern-location*))
(cond ((null pattern-list)
(unless *in-logical-pattern-p*
(nreverse patterns)))
;; logical CEs are "special"; they don't have their own parser.
((logical-element-p pattern)
(let ((*in-logical-pattern-p* t))
(parse-lhs (rest pattern))))
(t
(push (funcall (find-conditional-element-parser (first pattern)) pattern
(1- (incf location)))
patterns)
(parse-lhs (rest pattern-list))))))
(parse-rhs (actions)
(make-rule-actions
:bindings (collect-bindings actions :errorp nil)
:actions actions)))
(multiple-value-bind (lhs remains)
(utils:find-before *rule-separator* body :test #'eq)
(unless remains
(error 'rule-parsing-error :text "missing rule separator"))
(values (parse-lhs (preprocess-left-side lhs))
(parse-rhs (utils:find-after *rule-separator* remains :test #'eq)))))))
;;; The conditional element parsers...
(defun parse-generic-pattern (pattern location &optional pattern-binding)
(let ((head (first pattern)))
(unless (symbolp head)
(error 'rule-parsing-error :rule-name *current-defrule*
:location *current-defrule-pattern-location*
:text "the head of a pattern must be a symbol"))
(cond ((variable-p head)
(set-pattern-binding head location)
(parse-generic-pattern (second pattern) location head))
(t
(let ((slots
(loop for slot-decl in (rest pattern) collect
(parse-one-slot slot-decl location))))
(make-parsed-pattern :type :generic
:pattern-binding pattern-binding
:slots slots
:binding-set (make-binding-set)
:logical *in-logical-pattern-p*
:address location
:class head))))))
(defun parse-test-pattern (pattern location)
(flet ((extract-test-pattern ()
(let ((form (rest pattern)))
(unless (and (listp form)
(= (length form) 1))
(error 'rule-parsing-error
:rule-name *current-defrule*
:location *current-defrule-pattern-location*
:text "TEST takes a single Lisp form as argument"))
form)))
(let* ((form (extract-test-pattern))
(bindings (collect-bindings form)))
(make-parsed-pattern :test-bindings bindings
:type :test
:slots form
:pattern-binding nil
:binding-set (make-binding-set)
:logical *in-logical-pattern-p*
:address location))))
(defun parse-exists-pattern (pattern location)
(let ((pattern (parse-generic-pattern (second pattern) location)))
(setf (parsed-pattern-type pattern) :existential)
pattern))
(defun parse-not-pattern (pattern location)
(let ((pattern (parse-generic-pattern (second pattern) location)))
(setf (parsed-pattern-type pattern) :negated)
pattern))
;;; High-level rule definition interfaces...
(defun define-rule (name body &key (salience 0) (context nil) (auto-focus nil) (belief nil))
(let ((*current-defrule* name))
(with-rule-components ((doc-string lhs rhs) body)
(make-rule name (inference-engine) lhs rhs
:doc-string doc-string
:salience salience
:context context
:belief belief
:auto-focus auto-focus))))
(defun redefine-defrule (name body &key (salience 0) (context nil) (belief nil) (auto-focus nil))
(define-rule name body :salience salience
:context context
:belief belief
:auto-focus auto-focus))
| 13,295 | Common Lisp | .lisp | 277 | 37.090253 | 109 | 0.596163 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | d664b82d6f5af4b9c5e396e2225d99c5a8312d21f4c8239751fdda20137e28a1 | 10,120 | [
-1
] |
10,122 | heap.lisp | gpwwjr_LISA/src/core/heap.lisp | ;;; -*- Lisp -*-
;;;
;;; $Header: /cvsroot/lisa/lisa/src/core/heap.lisp,v 1.4 2007/09/17 22:42:39 youngde Exp $
;;;
;;; Copyright (c) 2002, 2003 Gene Michael Stover.
;;;
;;; This library is free software; you can redistribute it
;;; and/or modify it under the terms of version 2.1 of the GNU
;;; Lesser General Public License as published by the Free
;;; Software Foundation.
;;;
;;; This library is distributed in the hope that it will be
;;; useful, but WITHOUT ANY WARRANTY; without even the implied
;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;;; PURPOSE. See the GNU General Public License for more
;;; details.
;;;
;;; You should have received a copy of the GNU General Public
;;; License along with this library; if not, write to the
;;; Free Software Foundation, Inc., 59 Temple Place, Suite 330,
;;; Boston, MA 02111-1307 USA
;;;
;;; Adapted for Lisa: 4/3/2006.
(in-package :lisa.heap)
(defstruct heap
less-fn
order
a
max-count)
(defun default-search-predicate (heap obj)
(declare (ignore heap) (ignore obj))
t)
(defun percolate-down (heap hole x)
"Private. Move the HOLE down until it's in a location suitable for X.
Return the new index of the hole."
(do ((a (heap-a heap))
(less (heap-less-fn heap))
(child (lesser-child heap hole) (lesser-child heap hole)))
((or (>= child (fill-pointer a)) (funcall less x (aref a child)))
hole)
(setf (aref a hole) (aref a child)
hole child)))
(defun percolate-up (heap hole x)
"Private. Moves the HOLE until it's in a location suitable for holding
X. Does not actually bind X to the HOLE. Returns the new
index of the HOLE. The hole itself percolates down; it's the X
that percolates up."
(let ((d (heap-order heap))
(a (heap-a heap))
(less (heap-less-fn heap)))
(setf (aref a 0) x)
(do ((i hole parent)
(parent (floor (/ hole d)) (floor (/ parent d))))
((not (funcall less x (aref a parent))) i)
(setf (aref a i) (aref a parent)))))
(defvar *heap* nil)
(defun heap-init (heap less-fn &key (order 2) (initial-contents nil))
"Initialize the indicated heap. If INITIAL-CONTENTS is a non-empty
list, the heap's contents are intiailized to the values in that
list; they are ordered according to LESS-FN. INITIAL-CONTENTS must
be a list or NIL."
(setf *heap* heap)
(setf (heap-less-fn heap) less-fn
(heap-order heap) order
(heap-a heap) (make-array 2 :initial-element nil
:adjustable t :fill-pointer 1)
(heap-max-count heap) 0)
(when initial-contents
(dolist (i initial-contents) (vector-push-extend i (heap-a heap)))
(loop for i from (floor (/ (length (heap-a heap)) order)) downto 1
do (let* ((tmp (aref (heap-a heap) i))
(hole (percolate-down heap i tmp)))
(setf (aref (heap-a heap) hole) tmp)))
(setf (heap-max-count heap) (length (heap-a heap))))
heap)
(defun create-heap (less-fn &key (order 2) (initial-contents nil))
(heap-init (make-heap) less-fn :order order
:initial-contents initial-contents))
(defun heap-clear (heap)
"Remove all elements from the heap, leaving it empty. Faster
(& more convenient) than calling HEAP-REMOVE until the heap is
empty."
(setf (fill-pointer (heap-a heap)) 1)
nil)
(defun heap-count (heap)
(1- (fill-pointer (heap-a heap))))
(defun heap-empty-p (heap)
"Returns non-NIL if & only if the heap contains no items."
(= (fill-pointer (heap-a heap)) 1))
(defun heap-insert (heap x)
"Insert a new element into the heap. Return the element (which probably
isn't very useful)."
(let ((a (heap-a heap)))
;; Append a hole for the new element.
(vector-push-extend nil a)
;; Move the hole from the end towards the front of the
;; queue until it is in the right position for the new
;; element.
(setf (aref a (percolate-up heap (1- (fill-pointer a)) x)) x)))
(defun heap-find-idx (heap fnp)
"Return the index of the element which satisfies the predicate FNP.
If there is no such element, return the fill pointer of HEAP's array A."
(do* ((a (heap-a heap))
(fp (fill-pointer a))
(i 1 (1+ i)))
((or (>= i fp) (funcall fnp heap (aref a i)))
i)))
(defun heap-remove (heap &optional (fn #'default-search-predicate))
"Remove the minimum (first) element in the heap & return it. It's
an error if the heap is already empty. (Should that be an error?)"
(let ((a (heap-a heap))
(i (heap-find-idx heap fn)))
(cond ((< i (fill-pointer a));; We found an element to remove.
(let ((x (aref a i))
(last-object (vector-pop a)))
(setf (aref a (percolate-down heap i last-object)) last-object)
x))
(t nil))));; Nothing to remove
(defun heap-find (heap &optional (fn #'default-search-predicate))
(let ((a (heap-a heap))
(i (heap-find-idx heap fn)))
(cond ((< i (fill-pointer a)) ; We found an element to remove.
(aref a i))
(t nil))))
#+nil
(defun heap-collect (heap &optional (fn #'default-search-predicate))
(if (heap-empty-p heap)
nil
(loop for obj across (heap-a heap)
when (funcall fn heap obj)
collect obj)))
(defun heap-collect (heap &optional (fn #'default-search-predicate))
(let ((vec (heap-a heap)))
(if (heap-empty-p heap)
nil
(loop for i from 1 below (fill-pointer vec)
with obj = (aref vec i)
when (funcall fn heap obj)
collect obj))))
(defun heap-peek (heap)
"Return the first element in the heap, but don't remove it. It'll
be an error if the heap is empty. (Should that be an error?)"
(aref (heap-a heap) 1))
(defun lesser-child (heap parent)
"Return the index of the lesser child. If there's one child,
return its index. If there are no children, return
(FILL-POINTER (HEAP-A HEAP))."
(let* ((a (heap-a heap))
(left (* parent (heap-order heap)))
(right (1+ left))
(fp (fill-pointer a)))
(cond ((>= left fp) fp)
((= right fp) left)
((funcall (heap-less-fn heap) (aref a left) (aref a right)) left)
(t right))))
(provide "heap")
;;; --- end of file ---
| 6,265 | Common Lisp | .lisp | 157 | 35.057325 | 90 | 0.641683 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | f218f67603f445eaebec329d9e5e0879cd3e49846ca2851acf1b82043e943070 | 10,122 | [
-1
] |
10,124 | fact-parser.lisp | gpwwjr_LISA/src/core/fact-parser.lisp | ;;; This file is part of Lisa, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: fact-parser.lisp
;;; Description:
;;;
;;; $Id: fact-parser.lisp,v 1.2 2007/09/07 21:32:05 youngde Exp $
(in-package :lisa)
(defun create-template-class-slots (class-name slot-list)
(labels ((determine-default (default-form)
(unless (and (consp default-form)
(eq (first default-form) 'default)
(= (length default-form) 2))
(error 'class-parsing-error :class-name class-name
:text "malformed DEFAULT keyword"))
(second default-form))
(build-one-slot (template)
(destructuring-bind (keyword slot-name &optional default)
template
(unless (eq keyword 'slot)
(error 'class-parsing-error :class-name class-name
:text (format nil "unrecognized keyword: ~A" keyword)))
`(,slot-name
:initarg ,(intern (symbol-name slot-name) 'keyword)
:initform
,(if (null default) nil (determine-default default))
:reader
,(intern (format nil "~S-~S" class-name slot-name))))))
(mapcar #'build-one-slot slot-list)))
(defun redefine-deftemplate (class-name body)
(let ((class (gensym)))
`(let ((,class
(defclass ,class-name (inference-engine-object)
,@(list (create-template-class-slots class-name body)))))
,class)))
(defun bind-logical-dependencies (fact)
(add-logical-dependency
(inference-engine) fact
(make-dependency-set (active-tokens) (rule-logical-marker (active-rule))))
fact)
(defun parse-and-insert-instance (instance &key (belief nil))
(ensure-meta-data-exists (class-name (class-of instance)))
(let ((fact
(make-fact-from-instance (class-name (class-of instance)) instance)))
(when (and (in-rule-firing-p)
(logical-rule-p (active-rule)))
(bind-logical-dependencies fact))
(assert-fact (inference-engine) fact :belief belief)))
(defun parse-and-retract-instance (instance engine)
(retract-fact engine instance))
(defun show-deffacts (deffact)
(format t "~S~%" deffact)
(values deffact))
(defun parse-and-insert-deffacts (name body)
(let ((deffacts (gensym)))
`(let ((,deffacts (list)))
(dolist (fact ',body)
(let ((head (first fact)))
(ensure-meta-data-exists head)
(push
(apply #'make-fact head (rest fact))
,deffacts)))
(add-autofact (inference-engine) (make-deffacts ',name (nreverse ,deffacts))))))
| 3,486 | Common Lisp | .lisp | 74 | 39.108108 | 87 | 0.638832 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 5d3b3007bea49b95e0bbf3464e53a34489d1af6b22e28f66247e316ace5bf24d | 10,124 | [
-1
] |
10,128 | watches.lisp | gpwwjr_LISA/src/core/watches.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young ([email protected])
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: watches.lisp
;;; Description:
;;; $Id: watches.lisp,v 1.2 2007/09/07 21:32:05 youngde Exp $
(in-package "LISA")
(defvar *assert-fact* nil)
(defvar *retract-fact* nil)
(defvar *enable-activation* nil)
(defvar *disable-activation* nil)
(defvar *fire-rule* nil)
(defvar *watching-bindings* nil)
(defvar *watches* nil)
(defun watch-activation-detail (activation direction)
(format *trace-output* "~A Activation: ~A : ~A~%"
direction
(rule-default-name (activation-rule activation))
(activation-fact-list activation))
(values))
(defun watch-enable-activation (activation)
(watch-activation-detail activation "==>"))
(defun watch-disable-activation (activation)
(watch-activation-detail activation "<=="))
(defun watch-rule-firing (activation)
(let ((rule (activation-rule activation)))
(format *trace-output* "FIRE ~D: ~A ~A~%"
(rete-firing-count (rule-engine rule))
(rule-default-name rule)
(activation-fact-list activation))
(values)))
(defun watch-fact-detail (fact direction)
(format *trace-output* "~A ~A ~S~%"
direction (fact-symbolic-id fact)
(reconstruct-fact fact))
(values))
(defun watch-assert (fact)
(watch-fact-detail fact "==>"))
(defun watch-retract (fact)
(watch-fact-detail fact "<=="))
(defun watch-event (event)
(ecase event
(:facts (setf *assert-fact* #'watch-assert)
(setf *retract-fact* #'watch-retract))
(:activations (setf *enable-activation* #'watch-enable-activation)
(setf *disable-activation* #'watch-disable-activation))
(:rules (setf *fire-rule* #'watch-rule-firing))
(:bindings (setf *watching-bindings* t))
(:all (watch-event :facts)
(watch-event :bindings)
(watch-event :activations)
(watch-event :rules)))
(unless (eq event :all)
(pushnew event *watches*))
event)
(defun unwatch-event (event)
(ecase event
(:facts (setf *assert-fact* nil)
(setf *retract-fact* nil))
(:activations (setf *enable-activation* nil)
(setf *disable-activation* nil))
(:bindings (setf *watching-bindings* nil))
(:rules (setf *fire-rule* nil))
(:all (unwatch-event :facts)
(unwatch-event :activations)
(unwatch-event :bindings)
(unwatch-event :rules)))
(unless (eq event :all)
(setf *watches*
(delete event *watches*)))
event)
(defun watches ()
*watches*)
(defmacro trace-assert (fact)
`(unless (null *assert-fact*)
(funcall *assert-fact* ,fact)))
(defmacro trace-retract (fact)
`(unless (null *retract-fact*)
(funcall *retract-fact* ,fact)))
(defmacro trace-enable-activation (activation)
`(unless (null *enable-activation*)
(funcall *enable-activation* ,activation)))
(defmacro trace-disable-activation (activation)
`(unless (null *disable-activation*)
(funcall *disable-activation* ,activation)))
(defmacro trace-firing (activation)
`(unless (null *fire-rule*)
(funcall *fire-rule* ,activation)))
| 3,965 | Common Lisp | .lisp | 99 | 35.434343 | 79 | 0.682279 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 07bbbf82da751adc4ec5909b10ed55d7220db18007123e9fecce7887f799550e | 10,128 | [
-1
] |
10,133 | reflect.lisp | gpwwjr_LISA/src/reflect/reflect.lisp | ;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young ([email protected])
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: reflect.lisp
;;; Description: Wrapper functions that provide the MOP functionality needed
;;; by LISA, hiding implementation-specific details.
;;; $Id: reflect.lisp,v 1.15 2007/09/08 14:48:59 youngde Exp $
(in-package "LISA.REFLECT")
;;; The code contained with the following MACROLET form courtesy of the PORT
;;; module, CLOCC project, http://clocc.sourceforge.net.
#+(or allegro clisp cmu cormanlisp lispworks lucid sbcl ccl)
;; we use `macrolet' for speed - so please be careful about double evaluations
;; and mapping (you cannot map or funcall a macro, you know)
(eval-when (:compile-toplevel :load-toplevel :execute)
(macrolet ((class-slots* (class)
#+allegro `(clos:class-slots ,class)
#+ccl `(ccl:class-slots ,class)
#+clisp `(clos:class-slots ,class)
#+cmu `(pcl::class-slots ,class)
#+cormanlisp `(cl:class-slots ,class)
#+lispworks `(hcl::class-slots ,class)
#+lucid `(clos:class-slots ,class)
#+sbcl `(sb-pcl::class-slots ,class))
(class-slots1 (obj)
`(class-slots*
(typecase ,obj
(class ,obj)
(symbol (find-class ,obj))
(t (class-of ,obj)))))
(slot-name (slot)
#+(and allegro (not (version>= 6))) `(clos::slotd-name ,slot)
#+(and allegro (version>= 6)) `(clos:slot-definition-name ,slot)
#+ccl `(ccl:slot-definition-name ,slot)
#+clisp `(clos:slot-definition-name ,slot)
#+cmu `(slot-value ,slot 'pcl::name)
#+cormanlisp `(getf ,slot :name)
#+lispworks `(hcl::slot-definition-name ,slot)
#+lucid `(clos:slot-definition-name ,slot)
#+sbcl `(slot-value ,slot 'sb-pcl::name))
(slot-initargs (slot)
#+(and allegro (not (version>= 6))) `(clos::slotd-initargs ,slot)
#+(and allegro (version>= 6))
`(clos:slot-definition-initargs ,slot)
#+ccl `(ccl:slot-definition-initargs ,slot)
#+clisp `(clos:slot-definition-initargs ,slot)
#+cmu `(slot-value ,slot 'pcl::initargs)
#+cormanlisp `(getf ,slot :initargs)
#+lispworks `(hcl::slot-definition-initargs ,slot)
#+lucid `(clos:slot-definition-initargs ,slot)
#+sbcl `(slot-value ,slot 'sb-pcl::initargs))
(slot-one-initarg (slot) `(car (slot-initargs ,slot)))
(slot-alloc (slot)
#+(and allegro (not (version>= 6)))
`(clos::slotd-allocation ,slot)
#+(and allegro (version>= 6))
`(clos:slot-definition-allocation ,slot)
#+ccl `(ccl:slot-definition-allocation ,slot)
#+clisp `(clos:slot-definition-allocation ,slot)
#+cmu `(pcl::slot-definition-allocation ,slot)
#+cormanlisp `(getf ,slot :allocation)
#+lispworks `(hcl::slot-definition-allocation ,slot)
#+lucid `(clos:slot-definition-allocation ,slot)
#+sbcl `(sb-pcl::slot-definition-allocation ,slot)))
(defun class-slot-list (class &optional (all t))
"Return the list of slots of a CLASS.
CLASS can be a symbol, a class object (as returned by `class-of')
or an instance of a class.
If the second optional argument ALL is non-NIL (default),
all slots are returned, otherwise only the slots with
:allocation type :instance are returned."
(unless (class-finalized-p class)
(finalize-inheritance class))
(mapcan (if all (utils:compose list slot-name)
(lambda (slot)
(when (eq (slot-alloc slot) :instance)
(list (slot-name slot)))))
(class-slots1 class)))
(defun class-slot-initargs (class &optional (all t))
"Return the list of initargs of a CLASS.
CLASS can be a symbol, a class object (as returned by `class-of')
or an instance of a class.
If the second optional argument ALL is non-NIL (default),
initargs for all slots are returned, otherwise only the slots with
:allocation type :instance are returned."
(mapcan (if all (utils:compose list slot-one-initarg)
(lambda (slot)
(when (eq (slot-alloc slot) :instance)
(list (slot-one-initarg slot)))))
(class-slots1 class)))))
#+(or clisp cmu)
(defun ensure-class (name &key (direct-superclasses '()))
(eval `(defclass ,name ,direct-superclasses ())))
#+clisp
(defun class-finalized-p (class)
(clos:class-finalized-p class))
#+ccl
(defun class-finalized-p (class)
(ccl:class-finalized-p class))
#+clisp
(defun finalize-inheritance (class)
(clos:finalize-inheritance class))
#+ccl
(defun finalize-inheritance (class)
(ccl:finalize-inheritance class))
(defun is-standard-classp (class)
(or (eq (class-name class) 'standard-object)
(eq (class-name class) t)))
(defun find-direct-superclasses (class)
#+:sbcl
(remove-if #'is-standard-classp (sb-mop:class-direct-superclasses class))
#-(or :sbcl :ccl)
(remove-if #'is-standard-classp (clos:class-direct-superclasses class))
#+ccl
(remove-if #'is-standard-classp (ccl:class-direct-superclasses class)))
(defun class-all-superclasses (class-or-symbol)
(labels ((find-superclasses (class-list superclass-list)
(let ((class (first class-list)))
(if (or (null class-list)
(is-standard-classp class))
superclass-list
(find-superclasses
(find-direct-superclasses class)
(find-superclasses
(rest class-list) (pushnew class superclass-list)))))))
(let ((class
(if (symbolp class-or-symbol)
(find-class class-or-symbol)
class-or-symbol)))
(nreverse (find-superclasses (find-direct-superclasses class) nil)))))
| 6,951 | Common Lisp | .lisp | 140 | 40.407143 | 80 | 0.6197 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 2a50ca0bd02894b1d7e20bbf7801d04c1d811def46378e4b79eed90f60e545f6 | 10,133 | [
-1
] |
10,140 | test-ce.lisp | gpwwjr_LISA/misc/test-ce.lisp |
(in-package :lisa-user)
(clear)
(defclass frodo ()
((name :initarg :name :initform nil :accessor name)))
(defrule frodo ()
(frodo (name ?name))
(test (equal ?name "frodo"))
=>
(format t "frodo fired; name is ~A~%" ?name))
(assert (frodo (name "frodo")))
(assert (frodo (name "bilbo")))
| 301 | Common Lisp | .lisp | 11 | 25 | 55 | 0.645614 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 97b5e9f1a68cb6a6816577f3bcefdeff02aa58b88ce4b185e6a130b69db6a0ed | 10,140 | [
-1
] |
10,142 | toh.lisp | gpwwjr_LISA/misc/toh.lisp | ;;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: LISA-USER; Base: 10. -*-
;;; Towers of Hanoi puzzle, recursive version, rev3 (goal-based)
;;; Written By: George Williams
;;; This version uses deftemplate instead of defclass, and templates
;;; allow use of deffacts, resulting in a cleaner syntax all around.
(in-package "LISA-USER")
;(lisa:consider-taxonomy) ; not helpful when using deftemplate
#| ---- useful code fragments to paste into the listener ----
(cl-user::lisa-app-setup)
(require 'lisa-debugger (lisa-system::lisa-debugger))
(progn (reset) (setq *ppfacts-count* 0))
(load "toh.lisp")
(clear-breaks)
(runtoh)
(next)
(resume)
(watch :bindings)
(pptohfacts)
|#
#|
These rules are started out as a version transliterated from the OPS5
(recursive) version in Rule-Based Programming by Kowalski and Levi. I've
modified it significantly to try to make up for the fact that the first
version never worked because it paid no attention to the size of the disks
being moved, and things happened out of order. And the startup magically
assumed that the disks were already in-place. :(
|#
(deftemplate peg ()
(slot is)
(slot has-disks))
(deftemplate disk ()
(slot size)
(slot peg))
;; ================================================================
#|
The goal/subgoal system that uses the goal class, the goal-related rules, and the
goal-related functions defined below is how I managed to control the sequencing
of the rules. It's probably not the right way to do things in a rule-based approach,
but it works. Also, this is a pretty general mechanism (sans the application-specific
arguments to the goals).
|#
(deftemplate goal ()
(slot is)
(slot arg1)
(slot arg2)
(slot arg3)
(slot arg4)
(slot status)
(slot subgoals)
(slot supergoal))
;; ----------------------------------------------------------------
(defun make-goal-of (supergoal goal-name &optional arg1 arg2 arg3 arg4)
(let* ((?goal-object (make-instance 'goal ;; ?subgoal-object is a CLOS object, not a fact instance
:is goal-name
:status 'active
:supergoal supergoal
:arg1 arg1
:arg2 arg2
:arg3 arg3
:arg4 arg4))
(?goal-instance (assert (?goal-object))))
?goal-instance))
(defun make-subgoal-of (supergoal goal-name arg1 arg2 arg3 arg4
&key (suspend-super t))
(let* ((?subgoal-instance (make-goal-of supergoal goal-name arg1 arg2 arg3 arg4)))
(when supergoal
(if suspend-super
(modify supergoal
(subgoals (append (get-slot-value supergoal 'subgoals)
(list ?subgoal-instance)))
(status suspended))
(modify supergoal
(subgoals (append (get-slot-value supergoal 'subgoals)
(list ?subgoal-instance))))))
?subgoal-instance))
(defun finish-subgoal (goal supergoal)
(modify supergoal
(subgoals (remove goal (get-slot-value supergoal 'subgoals))))
(let ((subgoals-of-super (get-slot-value supergoal 'subgoals)))
(if subgoals-of-super
(modify (first subgoals-of-super) (status active))
;; If there are not subgoals of the super, then it's
;; work is done and it should be retracted. But we must
;; also look at the super's supergoals, and retractï¿¿
;; them recursively if they are completed. This is
;; handled by changing the super's status to completed,
;; which is then handled by a rule that looks for
;; completed goals, retracts them, but also checks to
;; see if their super needs to be marked as completed,
;; which then causes the super's to be retracted
;; recursively.
(modify supergoal (status completed))))
(retract goal))
;; ================================================================
(defvar *ppfactsmode* nil)
;(setq *ppfactsmode* 'none)
;(setq *ppfactsmode* nil)
(setq *ppfactsmode* 'brief)
(defvar *ppfacts-count* 0)
(defun pptohfacts (&rest fmt-args)
"This function pretty-prints all the relavent facts in a useful format.
It has proved to be very useful for debugging."
(unless (eq *ppfactsmode* 'none)
(when fmt-args
(apply #'format (cons t fmt-args))) ; t is the default output stream
(unless (eq *ppfactsmode* 'brief)
(format t "================Begin PPTOHFACTS================ # ~a ~%" *ppfacts-count*))
(let ((facts (get-fact-list (inference-engine)))
;; the following 3 arrays are indexed by peg number
(peg-ids (make-array 3 :initial-element 0))
(disk-count (make-array 3 :initial-element 0))
(peg-has-disks (make-array 3)) ;; each entry is a list of disk instances (from the peg's has-disks slot), topmost first
(disk-list nil) ;; each element of disk-list is a list (<disk-fact-id> <disk-size>)
(goals nil) ;; a list of goal instances
)
;; collect information about all the facts in WM
(dolist (fact facts)
(let ((fact-name (fact-name fact))
(fact-id (fact-id fact))
(slot-table (fact-slot-table fact)))
(cond
((string= fact-name "PEG")
(let ((peg# (gethash 'is slot-table)))
(setf (aref peg-has-disks peg#)
(gethash 'has-disks slot-table))
(setf (aref disk-count peg#)
(length (aref peg-has-disks (gethash 'is slot-table))))
(setf (aref peg-ids peg#) fact-id)))
((string= fact-name "DISK")
(push (list fact-id (gethash 'size slot-table))
disk-list))
((string= fact-name "GOAL")
(push fact goals)))))
;; Summarize information about each of the disks
#| ; this was useful in early debugging, but didn't need it later
(format t "~%There are ~a disks on the disk-list:~%" (length disk-list))
(dolist (disk-entry (sort disk-list #'< :key #'second))
; each element of disk-list is a list of the form (<disk-fact-id> <disk-size>)
(let* ((disk-fact (fact (first disk-entry)))
(slot-table (fact-slot-table disk-fact)))
(format t " disk ~a [id ~a] is on peg# ~a~%"
(gethash 'size slot-table)
(fact-id disk-fact)
(gethash 'peg slot-table))))
(terpri)
|#
;; Summarize information about each of the pegs
(format t "Disks (top to bottom) on each Peg:~%")
(dotimes (peg# 3)
(if (> (aref disk-count peg#) 0)
(progn
(format t " Peg ~a[~a] has ~a disks:"
peg# (aref peg-ids peg#) (aref disk-count peg#))
(dolist (disk (aref peg-has-disks peg#))
(format t " ~a[~a]"
(get-slot-value disk 'size)
(fact-id disk)))
(terpri))
(format t " Peg ~a[~a] has no disks~%"
peg# (aref peg-ids peg#))))
(terpri)
(unless (eq *ppfactsmode* 'brief)
;; print info about all goals, including their subgoals
(if goals
(progn
(format t "There are ~a goals:~%" (length goals))
; sort the goals so that the active ones are printed first
; ordering will be: active or suspended
(setq goals (sort goals
#'(lambda (g1 g2)
(string-lessp (symbol-name (get-slot-value g1 'status))
(symbol-name (get-slot-value g2 'status))))))
(dolist (goal goals)
(let* ((slot-table (fact-slot-table goal))
(goal-is (gethash 'is slot-table)))
(format t " Goal is: ~a [id ~a], status: ~a~% args: ~a, ~a, ~a, ~a" ; note: no end-of-line
goal-is
(fact-id goal)
(gethash 'status slot-table)
(gethash 'arg1 slot-table)
(gethash 'arg2 slot-table)
(gethash 'arg3 slot-table)
(gethash 'arg4 slot-table))
(case goal-is
(move
(format t " (#disks, src, dst, size)~%"))
(move-stack
(format t " (stack-base-disk-size, dst-peg-num)~%"))
(move-1-disk
(format t " (src-peg-num, dst-peg-num)~%"))
(consolidate-substack
(format t " (base-disk-size, other-disk-size)~%"))
(otherwise (terpri)))
(if (gethash 'supergoal slot-table)
(let* ((supergoal (gethash 'supergoal slot-table))
(sg-slot-table (fact-slot-table supergoal)))
(format t " supergoal: ~a [id: ~a], status: ~a~%"
(gethash 'is sg-slot-table)
(fact-id supergoal)
(gethash 'status sg-slot-table)))
;(format t " supergoal: none~%")
)
(let ((subs (gethash 'subgoals slot-table)))
(if subs
(progn
(format t " subgoals:~%")
(dolist (sub subs)
(format t " ~a~%" sub)))
;(format t " subgoals: none~%")
)))))
(format t "There are no goals~%"))
)
)
(unless (eq *ppfactsmode* 'brief)
(format t "================End PPTOHFACTS================ # ~a ~%" *ppfacts-count*)
(incf *ppfacts-count*))
(values)))
;; ================================================================
;; These rules need to be defined after pptohfacts is defined. Otherwise,
;; they'd be grouped with the rest of the goal-related stuff above
(defrule retract-completed-goals ()
(?goal (goal (status completed)
(arg1 ?arg1) (arg2 ?arg2) (arg3 ?arg3) (arg4 ?arg4)
(supergoal ?supergoal)))
(?goal2 (goal (status ?status-of-super) (subgoals ?subgoals-of-super)))
(test (eq ?supergoal ?goal2))
=>
(when ?supergoal
(if (and ?subgoals-of-super
(eql ?status-of-super 'suspended))
(modify ?supergoal (status check-completion) (subgoals (rest ?subgoals-of-super)))
(modify ?supergoal (status completed))))
; (format t "}}} in retract-completed-goals - retracting goal ~%")
(retract ?goal)
(pptohfacts "** RETRACT-COMPLETED-GOALS after RHS~%"))
(defrule check-goal-completion ()
(?goal (goal (status check-completion)
(arg1 ?arg1) (arg2 ?arg2) (arg3 ?arg3) (arg4 ?arg4)
(subgoals ?subgoals) (supergoal ?supergoal)))
(?goal2 (goal (status ?status-of-super)
(subgoals ?subgoals-of-super)))
(test (eq ?supergoal ?goal2))
=>
(if ?subgoals
; since there are still subgoals, the goal has more work to do
(modify ?goal (status active))
; no subgoals, so it's done
(progn
(when ?supergoal
; clean up the linkage between the supergoal the goal (to be retracted)
(modify ?supergoal
(status check-completion)
(subgoals (rest ?subgoals-of-super))))
(retract ?goal)))
(pptohfacts "** CHECK-GOAL-COMPLETION after RHS~%"))
(defrule check-goal-completion-no-super ()
(?goal (goal (status check-completion)
(arg1 ?arg1) (arg2 ?arg2) (arg3 ?arg3) (arg4 ?arg4)
(subgoals ?subgoals) (supergoal nil)))
=>
(if ?subgoals
(modify ?goal (status active))
(retract ?goal))
(pptohfacts "** CHECK-GOAL-COMPLETION-NO-SUPER after RHS~%"))
;; ================================================================
#| The actual application....
To move n disks from one peg to another, do the following:
1. move the top n-1 disks to a third peg
2. move the remaining disk
3. move the n-1 disks from the third peg to the desired destination.
|#
;; This rule only plans the moves. The next rule performs the action.
(defrule move-many-disks ()
(?goal (goal (is move)
(arg1 ?ndisks (> ?ndisks 1)) (arg2 ?src) (arg3 ?dst) (arg4 ?size)
(status active)
(subgoals ?subgoals) (supergoal ?supergoal)))
(peg (is ?src))
(peg (is ?other))
(test (and (not (= ?other ?src))
(not (= ?other ?dst))))
=>
; (format t "}}} in move-many-disks - args = ~a, ~a, ~a, ~a~%" ?ndisks ?src ?dst ?size)
; (format t "}}} in move-many-disks (length ?subgoals) = ~a~%" (length ?subgoals))
(if ?subgoals
(progn ;; We've already been here, so activate first subgoal, and suspend self
;(format t "}}} in move-many-disks - activating first subgoal, suspending ?goal ~%")
(modify (first ?subgoals) (status active))
(modify ?goal (status suspended)))
(progn
;; It's the first time this goal has been activated, so farm out
;; work to subgoals
;;; has-disks of ?src is not a good way to determine if the job is done
;; in the planning stage it doesn't tell us anything, and in the
;; execution stage, it could be a false indicator because the goal could
;; have been intended to only move some of the disks
;;; this rule should only be invoked in the planning stage
;; subgoals should modify it's list of subgoals as they're completed,
;; and should retract this goal when the last one is completed
; (format t "}}} in move-many-disks - making 3 subgoals, suspending subgoals 2&3 ~%")
(make-subgoal-of ?goal 'move (- ?ndisks 1) ?src ?other nil)
; the first subgoal is active by default
(let ((?goal2 (make-subgoal-of ?goal 'move 1 ?src ?dst ?size))
(?goal3 (make-subgoal-of ?goal 'move (- ?ndisks 1) ?other ?dst nil)))
(modify ?goal2 (status suspended))
(modify ?goal3 (status suspended)))
;; once the subgoals have been completed and removed from the subgoals
;; list, the cleanup-move-goals rule will retract the goal
;;; note that this requires all move goals to have supergoals
))
(pptohfacts "** MOVE-MANY-DISKS after RHS~%")
)
;(set-break 'move-many-disks)
;; The action
(defrule move-1-disk () ; (:salience -1)
(?goal (goal (is move)
(arg1 1) (arg2 ?src) (arg3 ?dst) (arg4 ?size) ; arg1 is #disks
(status active) (supergoal ?supergoal) (subgoals ?subgoals)))
(?src-peg (peg (is ?src) (has-disks ?src-peg-has-disks)))
(?dst-peg (peg (is ?dst) (has-disks ?dst-peg-has-disks)))
(?3rd-peg (peg (is ?3rd) (has-disks ?3rd-peg-has-disks)))
;; assure src, dst, and third pegs are all different
(test (and (/= ?src ?dst)
(/= ?3rd ?src)
(/= ?3rd ?dst)))
=>
; (format t "}}} in move-1-disk - args = ~a, ~a, ~a, ~a~%" 1 ?src ?dst ?size)
; (format t "}}} in move-1-disk (length ?src-peg-has-disks) = ~a~%" (length ?src-peg-has-disks))
(if ?src-peg-has-disks
(let ((?final-dst nil) ; if this stays nil, then we can't move the disk
?final-dst-peg
?final-dst-peg-has-disks
(disk-size (get-slot-value (first ?src-peg-has-disks) 'size))
(dst-top-disk-size (when ?dst-peg-has-disks
(get-slot-value (first ?dst-peg-has-disks) 'size)))
(3rd-top-disk-size (when ?3rd-peg-has-disks
(get-slot-value (first ?3rd-peg-has-disks) 'size))))
; try to set ?final-dst & related
(cond
((or (null dst-top-disk-size)
(and dst-top-disk-size
(< disk-size dst-top-disk-size)))
(setq ?final-dst ?dst
?final-dst-peg ?dst-peg
?final-dst-peg-has-disks ?dst-peg-has-disks))
((or (null 3rd-top-disk-size)
(and 3rd-top-disk-size
(< disk-size 3rd-top-disk-size)))
(setq ?final-dst ?3rd
?final-dst-peg ?3rd-peg
?final-dst-peg-has-disks ?3rd-peg-has-disks)))
; (format t "}}} in move-1-disk ?final-dst = ~a~%" ?final-dst)
(if ?final-dst
(progn
(format t " Move disk ~a from peg ~a to peg ~a~%" disk-size ?src ?final-dst)
; (format t "}}} in move-1-disk ?goal = ~a~%" ?goal)
; (format t "}}} in move-1-disk ?supergoal = ~a~%" ?supergoal)
; modify the peg# of the disk to move
(modify (first ?src-peg-has-disks) (peg ?final-dst))
; remove the disk to move from src-peg
(modify ?src-peg (has-disks (rest ?src-peg-has-disks)))
; put the disk to move on top of the ?final-dst-peg
(modify ?final-dst-peg (has-disks (cons (first ?src-peg-has-disks) ?final-dst-peg-has-disks)))
; retract ?goal, after cleaning up the subgoals list of any
; supergoal(s), and activating whatever's next
(finish-subgoal ?goal ?supergoal))
;; we should never get here
(cl:assert nil () "in move-1-disk: *** CAN'T MOVE *** disk ~a from peg ~a to peg ~a~%" disk-size ?src ?final-dst)))
;; we should never get here
(cl:assert nil () "in move-1-disk: source peg ~a has no disks~%" ?src))
(pptohfacts "** MOVE-1-DISK after RHS~%")
)
;(set-break 'move-1-disk)
;; ================================================================
;; Finish
(defrule finish (:salience -10)
(goal (is finish))
=>
(format t " *** all done ***~%"))
;; Default rules to cleanup leftover facts
(defrule cleanup-disks (:salience -100)
(?fact (disk))
=>
(retract ?fact))
(defrule cleanup-pegs (:salience -100)
(?fact (peg))
=>
(retract ?fact))
(defrule cleanup-goals (:salience -100)
(?fact (goal))
=>
(retract ?fact))
;;; initial facts
(deffacts setup-toh-facts ()
(peg (is 0))
(peg (is 1))
(peg (is 2))
(disk (size 1) (peg 0))
(disk (size 2) (peg 0))
(disk (size 3) (peg 0))
(disk (size 4) (peg 0))
#|
(disk (size 5) (peg 0))
(disk (size 6) (peg 0))
(disk (size 7) (peg 0))
|#
(goal (is startup-part2) (status active)))
;;; startup rule...
(defrule startup-part1 ()
=>
;; create the goal to run startup-part2
(assert (goal (is startup-part2) (status active)))
)
(defrule startup-part2 ()
(?goal (goal (is startup-part2)))
(?peg0 (peg (is 0)))
(?disk1 (disk (size 1)))
(?disk2 (disk (size 2)))
(?disk3 (disk (size 3)))
(?disk4 (disk (size 4)))
#|
(?disk5 (disk (size 5)))
(?disk6 (disk (size 6)))
(?disk7 (disk (size 7)))
|#
=>
;(pptohfacts "** STARTUP-PART2 before RHS~%")
(retract ?goal) ; so we don't do this again
;; modify facts so bookkeeping is correct
; (modify ?peg0 (has-disks (list ?disk1 ?disk2 ?disk3 ?disk4 ?disk5 ?disk6 ?disk7)))
(modify ?peg0 (has-disks (list ?disk1 ?disk2 ?disk3 ?disk4)))
;; modify the goal to start things up
;; need to have a supergoal for all move goals
(let ((finish-goal (make-goal-of nil 'finish)))
; (assert ((make-goal-of finish-goal 'move 7 0 1))) ; (#disks, src, dst, size) typically, ndisks is 8
(assert ((make-goal-of finish-goal 'move 4 0 1))) ; (#disks, src, dst, size) typically, ndisks is 8
)
(let ((*ppfactsmode* 'brief))
(pptohfacts "** STARTUP-PART2 after RHS~%"))
)
(defun runtoh (&optional (ntimes 1))
(flet ((repeat-toh ()
(dotimes (i ntimes)
(format t "Starting run.~%")
(reset)
(run))))
(time (repeat-toh))))
| 19,973 | Common Lisp | .lisp | 447 | 35.55481 | 129 | 0.55656 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | b57639fd60967501f04ce4bc73461b5d7d705afdd2eb52d341a06bce6bcc8656 | 10,142 | [
-1
] |
10,150 | lisa.asd | gpwwjr_LISA/lisa.asd | ;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.
;;; Copyright (C) 2000 David E. Young
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Lesser General Public License for more details.
;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; File: lisa.asd
;;; Description: Lisa's ASDF system definition file. To use it, you must have asdf loaded; Lisa
;;; provides a copy in "lisa:misc;asdf.lisp".
;;; Assuming a loaded asdf, this is the easiest way to install Lisa:
;;; (push <lisa root directory> asdf:*central-registry*)
;;; (asdf:operate 'asdf:load-op :lisa)
;;; $Id: lisa.asd,v 1.7 2007/09/11 21:14:07 youngde Exp $
(in-package :cl-user)
(eval-when (:compile-toplevel :load-toplevel :execute)
(unless (find-package :lisa-system)
(defpackage "LISA-SYSTEM"
(:use "COMMON-LISP" "ASDF"))))
(in-package :lisa-system)
(defsystem lisa
:name "Lisa"
:author "David E. Young"
:maintainer "David E. Young"
:licence "LGPL"
:description "The Lisa expert system shell"
:components
((:module src
:components
((:module packages
:components
((:file "pkgdecl")))
(:module utils
:components
((:file "compose")
(:file "utils"))
:serial t)
(:module belief-systems
:components
((:file "belief")
(:file "certainty-factors"))
:serial t)
(:module reflect
:components
((:file "reflect")))
(:module core
:components
((:file "preamble")
(:file "conditions")
(:file "deffacts")
(:file "fact")
(:file "watches")
(:file "activation")
(:file "heap")
(:file "conflict-resolution-strategies")
(:file "context")
(:file "rule")
(:file "pattern")
(:file "rule-parser")
(:file "fact-parser")
(:file "language")
(:file "tms-support")
(:file "rete")
(:file "belief-interface")
(:file "meta")
(:file "binding")
(:file "token")
(:file "retrieve"))
:serial t)
(:module implementations
:components
((:file "workarounds")
#+:lispworks
(:file "lispworks-auto-notify")
#+:cmucl
(:file "cmucl-auto-notify")
#+:allegro
(:file "allegro-auto-notify"))
:serial t)
(:module rete
:pathname "rete/reference/"
:components
((:file "node-tests")
(:file "shared-node")
(:file "successor")
(:file "node-pair")
(:file "terminal-node")
(:file "node1")
(:file "join-node")
(:file "node2")
(:file "node2-not")
(:file "node2-test")
(:file "node2-exists")
(:file "rete-compiler")
(:file "tms")
(:file "network-ops")
(:file "network-crawler"))
:serial t)
(:module config
:components
((:file "config")
(:file "epilogue"))
:serial t))
:serial t)))
(defvar *lisa-root-pathname*
(make-pathname :directory
(pathname-directory *load-truename*)
:host (pathname-host *load-truename*)
:device (pathname-device *load-truename*)))
(defun make-lisa-path (relative-path)
(concatenate 'string (namestring *lisa-root-pathname*)
relative-path))
(setf (logical-pathname-translations "lisa")
`(("src;**;" ,(make-lisa-path "src/**/"))
("lib;**;*.*" ,(make-lisa-path "lib/**/"))
("config;*.*" ,(make-lisa-path "config/"))
("debugger;*.*" ,(make-lisa-path "src/debugger/"))
("contrib;**;" ,(make-lisa-path "contrib/**/"))))
(defun lisa-debugger ()
(translate-logical-pathname "lisa:debugger;lisa-debugger.lisp"))
;;; Sets up the environment so folks can use the non-portable form of REQUIRE
;;; with some implementations...
;;; e.g., (require 'lisa-debugger (lisa-system::lisa-debugger))
#+:allegro
(setf system:*require-search-list*
(append system:*require-search-list*
`(:newest ,(lisa-debugger))))
#+:clisp
(setf custom:*load-paths*
(append custom:*load-paths* `(,(lisa-debugger))))
#+:openmcl ; which also covers Clozure CL
(pushnew (pathname-directory (lisa-debugger)) ccl:*module-search-path* :test #'equal)
#+:lispworks
(let ((loadable-modules `(("lisa-debugger" . ,(lisa-debugger)))))
(lw:defadvice (require lisa-require :around)
(module-name &optional pathname)
(let ((lisa-module
(find module-name loadable-modules
:test #'string=
:key #'car)))
(if (null lisa-module)
(lw:call-next-advice module-name pathname)
(lw:call-next-advice module-name (cdr lisa-module))))))
| 6,629 | Common Lisp | .asd | 151 | 29.390728 | 95 | 0.493108 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 65eba08ae2b37bf3b03eb148931430963fe7773f8118f306b490092833cdc7fa | 10,150 | [
-1
] |
10,232 | auto-notify.html | gpwwjr_LISA/doc/auto-notify.html | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>LISA 2</title>
</head>
<body background="hierarchy-background.gif">
<h1>LISA 2.0</h1>
<h3>5 December, 2002</h3>
<h3>Auto Notification</h3>
<p>For Common Lisps with complete, or mostly complete, MOP implementations, LISA
| 434 | Common Lisp | .l | 12 | 34.916667 | 80 | 0.763723 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 9c8a776bd2f61e98579ef0a279e370478649c75796aa987eca2dd7d59b37f950 | 10,232 | [
-1
] |
10,233 | ref-guide.html | gpwwjr_LISA/doc/ref-guide.html | <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body background="hierarchy-background.gif">
<center>
<h2>The LISA Reference Guide</h2>
</center>
This guide describes in detail the programming interface to LISA. It is
<i>not</i>
a treatise on production-rule technology; readers are assumed to have a
working knowledge of rule-based systems and their development. This document
also avoids any detailed description of LISA's implementation of the Rete
algorithm; perhaps at some future date I'll make an attempt.
<center>
<h2>Abbreviated Table of Contents</h2>
</center>
<a href="#The Programming Language">The Programming Language</a>
<br><a href="#The Environment">The Environment</a>
<br><a href="#Contexts">Contexts</a>
<br><a href="#Dynamic Rule Definition">Dynamic Rule Definition</a>
<br><a href="#Queries">Queries</a>
<br><a href="#Conflict Resolution">Conflict Resolution</a>
<br><a href="#The LISA Debugger">The LISA Debugger</a>
<br><a href="auto-notify.html">Auto Notification</a>
<br><a href="#Getting Started">Getting Started</a>
<br><a href="#Things Yet to Do">Things Yet to Do</a>
<br><a href="#Supported Platforms">Supported Platforms</a>
<br>
<h3>I. <a NAME="The Programming Language"></a>The Programming Language</h3>
This section describes the publicly-available operators in the LISA language,
separated into various categories:
<blockquote><a href="#Fact-Related Operators">Fact-Related Operators</a>
<blockquote>Language elements dealing with facts.</blockquote>
<a href="#Rule-Related Operators">Rule-Related Operators</a>
<blockquote>Language elements dealing with rules.</blockquote>
<a href="#CLOS-Related Operators">CLOS-Related Operators</a>
<blockquote>Language elements dealing with CLOS instances.</blockquote>
<a href="#Engine-Related Operators">Engine-Related Operators</a>
<blockquote>Language elements dealing with operations on an inference engine.</blockquote>
<a href="#Environment-Related Operators">Environment-Related Operators</a>
<blockquote>Language elements dealing with the LISA environment.</blockquote>
<a href="#Debugging-Related Operators">Debugging-Related Operators</a>
<blockquote>Language elements useful during system development.</blockquote>
</blockquote>
<h4><a NAME="Fact-Related Operators"></a>Fact-Related Operators</h4>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(deftemplate <i>name</i> () (<i>slot-name*</i>))</td>
<td>Macro</td>
</tr>
</table>
<blockquote>Creates an internal LISA class identified by <i>name</i> that
can be instantiated as a fact within the knowledge base. The <i>slot-name</i>s
are analogous to class slots, but without any of the keyword arguments.
Templates are a convenient way of specifying concepts that don't need the
full support of CLOS, but frankly they're really only in place to ease the
transition from CLIPS and Jess. </blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(defimport <i>class-name</i>)</td>
<td>Macro</td>
</tr>
</table>
<blockquote>A convenience macro that imports the symbols associated with a class
into whatever LISA-related package the developer wishes. The symbols imported
reflect the name of the class name and all of its immediate slots. If
taxonomic reasoning is enabled, then the class's ancestors are imported as
well.</blockquote>
<table WIDTH="100%" >
<tr>
<td WIDTH="80%">(deffacts <i>deffact-name</i> (<i>key</i>*) <i>fact-list</i>*)</td>
<td>Macro</td>
</tr>
</table>
<blockquote>Registers a list of facts that will be automatically
inserted into the knowledge base upon each RESET. The
<i>deffact-name</i> is the symbolic name that will be attached to this
group of facts; <i>fact-list</i> is a list of fact specifiers. This only
works when the classes are defined using <tt>deftemplate</tt> instead of
CLOS <tt>defclass</tt>. The format of each fact specifier is identical
to that found in (the template-based version of) an ASSERT form, minus the
<i>assert</i> keyword. There are currently no supported keywords for
this macro.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(assert (<i>fact-specifier</i>))</td>
<td>Macro</td>
</tr>
</table>
<blockquote>Inserts a fact identified by <i>fact-specifier</i> into the
knowledge base. There are two forms of ASSERT; the first operates on
template-based facts, the other on CLOS instances. For templates, ASSERT takes
a symbol representing the name of the template, followed by a list of (<i>slot-name
value</i>) pairs:
<dl>
<dd>(assert (frodo (name frodo) (age 100))</dd>
</dl>
<p>If the template associated with a fact has not been declared prior to its
assertion, LISA will signal a continuable error.</p>
<p>For instances of user-defined classes, ASSERT takes a form that must
evaluate to a CLOS instance:</p>
<dl>
<dd>(assert ((make-instance 'frodo :name 'frodo :age 100)))</dd>
</dl>
<p>or:</p>
<dl>
<dd>(let ((?instance (make-instance 'frodo :name 'frodo)))</dd>
<dd> (assert (?instance)))</dd>
</dl>
<p>or:</p>
<dl>
<dd>(defun add-my-instance (frodo-object)<br>
(assert (#?frodo-object)))</dd>
</dl>
<p>This last example makes use of the #? reader macro, which LISA offers as a
user-customisable feature. It's simply a short-hand notation for <i>(identity
frodo-object)</i>.</p>
</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(retract <i>fact-or-instance</i>)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Removes a fact or instance from the knowledge base. In the case of a
template-based fact, <i>fact-or-instance</i> may be either a symbol
representing the name of the fact, or an integer mapping to the fact
identifier; for CLOS objects <i>fact-or-instance</i> must be an instance of
STANDARD-OBJECT.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(assert-instance <i>instance</i>)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Inserts a CLOS instance into the knowledge base.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(retract-instance <i>instance</i>)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Removes a CLOS instance from the knowledge base.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(modify <i>fact</i> (<i>slot-name value</i>)*)</td>
<td>Macro</td>
</tr>
</table>
<blockquote>Makes changes to the fact instance identified by <i>fact</i>.
Affected slots and their new values are specified by (<i>slot-name value</i>).
Note that <i>value</i> can be an arbitrary Lisp expression that will be
evaluated at execution time.</blockquote>
<h4><a NAME="Rule-Related Operators"></a>Rule-Related Operators</h4>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(defrule <i>name (key*) [doc-string] pattern*</i> => <i>action*</i>)</td>
<td NOSAVE>Macro</td>
</tr>
</table>
<blockquote>
<p>Creates a rule identified by <i>name</i> and compiles it into
the Rete network. <i>Name</i> is any Lisp form that evaluates to a symbol.
</p>
<p>If the optional documentation string <i>doc-string</i> is present, then it
is attached to the <i>name</i>. It is accessible using the following form:
<tt>(rule-comment <i>rule-instance</i>)</tt>. The function <tt>find-rule</tt>
can be used to find rule instances. Also, the debugger function <tt>rule</tt>
returns the instance representing the suspended activation (see section
VII. The LISA Debugger).
</p>
The keyword arguments modify the rule as follows:
<pre>:salience <i>integer</i></pre>
<blockquote>Assigns a priority to the rule that will affect the firing
order. The salience value is a small integer in the range (-250, 250).
By default, all rules have salience 0.</blockquote>
<pre>:context <i>name</i></pre>
<blockquote>Binds the rule to a context identified by the symbol <i>name</i>.
The context must have been previously defined, or LISA will signal an error.</blockquote>
<pre>:auto-focus <i>t</i></pre>
<blockquote>
<p>Identifies the rule as requiring "auto focus" behavior. This
means that whenever the rule is activated, its context will be made the
active context after the rule firing completes.</p>
</blockquote>
If the rule identified by <i>name</i> already exists in the Rete network
it is replaced by the new definition.
<h5>Patterns</h5>
Each rule consists of zero or more <i>pattern</i>s, or Conditional Elements
(CEs). Collectively these patterns are known as the rule's Left Hand Side
(LHS), and are the entities that participate in the pattern-matching process.
LISA currently defines three pattern types:
<pre>generic pattern</pre>
<blockquote>This pattern type matches against facts in the knowledge base.
The head of the pattern matches equivalently-named facts; the pattern body
is optionally composed of slot-names, values, variables and predicates.
The best way to understand these things is to look at some examples:
<pre>(simple-pattern)</pre>
<blockquote>The simplest type of pattern. This example will match any fact
of class <i>simple-pattern</i>.</blockquote>
<pre>(goal-is-to (action unlock))</pre>
<blockquote>This pattern matches facts of class <i>goal-is-to</i>. In addition,
it specifies that the slot named <i>action</i> must have as its value the
symbol <i>unlock</i>.</blockquote>
<pre>(thing (name ?chest) (on-top-of (not floor)))</pre>
<blockquote>A bit more interesting. Matches facts of class <i>thing</i>;
assuming this is the first appearance of the variable <i>?chest</i>, binds
it to the value of the slot <i>name</i>; specifies that the slot <i>on-top-of</i>
should not have as its value the symbol <i>floor</i>.</blockquote>
<pre>(?monkey (monkey (holding ?chest)))</pre>
<blockquote>Assuming the variable <i>?chest</i> was bound in a previous
pattern, matches facts of class <i>monkey</i> whose slot <i>holding</i>
has the same value as <i>?chest</i>. Additionally, if the pattern is successfully
matched, binds the fact object to the variable <i>?monkey</i>. The variable
<i>?monkey</i> is called a <i>pattern binding</i>.</blockquote>
<pre>(pump (flow-rate ?flow-rate (< ?flow-rate 25)))</pre>
<blockquote>More interesting still. This pattern matches facts of class
<i>pump</i>,
and binds the value of the slot <i>flow-rate</i> to the variable
<i>?flow-rate</i>.
In addition, there is a constraint on this slot declaring that the value
of <i>?flow-rate</i> must be less than 25. In general, constraints can
be arbitrary Lisp expressions that serve as predicates.</blockquote>
<pre>(fact-with-list (list '(1 2 three)))</pre>
<blockquote>Patterns can perform matching on lists as well as simpler data
types. Here, the slot <i>list</i> must have the value <i>'(1 2 three)</i>.
More complicated list analysis can be done using user-defined predicates.</blockquote>
</blockquote>
<pre>negated pattern</pre>
<blockquote>This pattern type is the complement of most variations of the
generic pattern. Negated patterns have the symbol <i>not</i> as their head,
and match if a fact satisfying the pattern is <i>not</i> found. For example:
<pre>(not (tank-level-warning (tank ?tank) (type low)))</pre>
Note that negated patterns are not allowed to have pattern bindings.</blockquote>
<pre>test pattern</pre>
<blockquote>The <i>test</i> conditional element allows one to evaluate
arbitrary Lisp code on the rule LHS; these Lisp forms serve as a predicate
that determines whether or not the pattern will match. For example, the
pattern
<pre>(test (and (high-p ?tank) (intact-p ?tank)))</pre>
will succeed if the AND form returns non-<i>nil</i>; i.e. the functions
HIGH-P and INTACT-P both return non-<i>nil</i> values.</blockquote>
<pre>or pattern</pre>
<blockquote>
<p>The OR pattern is documented here, but is no longer implemented. I don't know
when it was removed. At some future time, I may reimplement it.</p>
<p>An experimental implementation can be found in a fork of the original LISA implementation.
This experimental fork, developed by Jakub Higersberger (Ramarren), can be found here:
<tt>https://github.com/Ramarren/lisa</tt></p>
<p>The original LISA documentation of the OR pattern is here:</p>
<blockquote>
<p>The <i>or</i> conditional element collects any number of patterns into a
logical group, and matches if any of the patterns inside the <i>or</i>
match. If more than one of the sub-patterns matches, the <i>or</i> group
matches more than once. LISA implements a rule containing an <i>or</i> CE as
a collection of related rules, with each rule representing exactly one
branch. For example, given the following DEFRULE form:</p>
<dl>
<dd>(defrule frodo () </dd>
<dd> (frodo) </dd>
<dd> (or (bilbo) </dd>
<dd> (gandalf)) </dd>
<dd> (samwise)</dd>
<dd>=>)</dd>
</dl>
<p>LISA will generate two rules into the rete network, a primary rule and a
single sub-rule:</p>
<blockquote>
<pre>frodo: (frodo), (bilbo), (samwise)</pre>
<pre>frodo~1: (frodo), (gandalf), (samwise)</pre>
</blockquote>
<p>Notice that LISA separates the example DEFRULE into the primary rule <i>frodo</i>,
and a single sub-rule, <i>frodo~1</i>. LISA maintains the relationship
between a primary rule and its sub-rules; if a primary rule is removed,
every related sub-rule is also eliminated.</p>
</blockquote>
</blockquote>
<pre>logical pattern</pre>
<blockquote>
<p>The <i>logical</i> conditional element implements LISA's notion of truth
maintenance. Patterns appearing within a LOGICAL form in a rule are
conditionally bound to facts asserted from that rule's RHS. If during
inferencing one or more logical facts are retracted (or asserted in the case
of negated patterns), all facts bound to
those logical facts are retracted. Here's an example:</p>
<dl>
<dd>(defrule frodo ()</dd>
<dd> (logical </dd>
<dd> (bilbo) </dd>
<dd> (not (gandalf)))</dd>
<dt>
(frodo)</dt>
<dd>=></dd>
<dd>(assert (pippin)))</dd>
</dl>
<p>When rule FRODO fires, it asserts a PIPPIN fact that is dependent on the
existence of BILBO and the absence of GANDALF. If either BILBO is retracted or GANDALF
asserted, PIPPIN will be removed as a consequence.</p>
<p>A LOGICAL conditional element must be the first pattern in a rule.
Multiple LOGICAL forms within the same rule are allowed, but they must be
contiguous.</p>
<p><b>NB</b>: A rule beginning with the LOGICAL conditional element
implicitly matches the INITIAL-FACT; thus, in order for rules employing
truth maintenance to function correctly, a RESET must be always be performed
prior to any operation affecting working memory. LISA's behavior is
undefined otherwise.</p>
</blockquote>
<pre>exists pattern</pre>
<blockquote>
<p>The EXISTS conditional element performs an existential test on a pattern.
The pattern will match exactly once, even if there are many facts that might
satisfy it. For example, this rule:</p>
<dl>
<dd>
<p>(defrule frodo ()<br>
(exists (frodo (has-ring t)))<br>
=>)</p>
</dd>
</dl>
<p>will activate just once if there is at least one FRODO fact whose
HAS-RING slot has the value T.</p>
</blockquote>
<pre>The initial fact</pre>
<p>If a rule provides no conditional elements, then it is said to match the
<i>initial-fact</i>,
which is asserted as the result of a call to <i>reset</i>. Thus, the following
rule will always activate after each reset:</p>
<dl>
<dd>(defrule always-fires ()</dd>
<dd> =></dd>
<dd> (format t "always-fires fired!~%"))</dd>
</dl>
<pre>CLOS instances</pre>
<p>Every fact asserted into working memory is backed by a corresponding CLOS
instance. In the case of DEFTEMPLATEs, LISA creates an internal class mirroring
the template; user-defined class instances are simply bound to a fact during
assertions. Instances associated with facts are accessible on rule LHSs via the
:OBJECT special slot:
<dl>
<dd>(tank (name ?name) (:object ?tank-object))</dd>
</dl>
<p>Once bound, method and function calls can be made on this object from
the rule's LHS and RHS.
<dl><p>When reasoning over CLOS objects, LISA is capable of considering an
instance's object hierarchy during pattern matching. In other words, it
is possible to write rules that apply to many facts that share a common
ancestry. The following code fragment provides an example:
<br>
<dd>(defclass fundamental () ())</dd>
<dd>(defclass rocky (fundamental) ())</dd>
<dd>(defclass boris (fundamental) ())</dd>
<dt> </dt>
<dd>(defrule cleanup (:salience -100)</dd>
<dd> (?fact (fundamental))</dd>
<dd> =></dd>
<dd> (retract ?fact))</dd>
<dt> </dt>
<p>The rule <i>cleanup</i> will fire for every instance of <i>rocky</i>
and <i>boris</i> in the knowledge base, retracting each in turn. Note that
taxonomic reasoning is enabled by default. To disable the feature, evaluate (setf
(consider-taxonomy) nil).</dl>
</blockquote>
<blockquote>
<h5>Actions</h5>
Following any conditional elements are the rule's actions, if any. Collectively
known as the Right Hand Side (RHS), actions consist of arbitrary Lisp forms. All variables declared on the LHS are available, along with the special
operator <i>engine</i>, which evaluates to the rule's inference engine
object. Currently, each rule's RHS is given to the Lisp compiler during
rule compilation, and executes within a special lexical environment established
by LISA for each firing.</blockquote>
<table BORDER=0 WIDTH="100%" >
<tr>
<td WIDTH="80%">(undefrule <i>rule-name</i>)</td>
<td>Macro</td>
</tr>
</table>
<blockquote>Undefines, or removes, a rule from the Rete network. <i>Rule-name</i>
is a symbol representing the name of the rule. If <i>rule-name</i> is not
qualified with a context name (e.g. <i>context.rulename</i>), then the Initial
Context is assumed.</blockquote>
<table BORDER=0 WIDTH="100%" >
<tr>
<td WIDTH="80%">(find-rule <i>inference-engine rule-name</i>)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Finds and returns the rule instance of the rule named <i>rule-name</i>.
The <i>inference-engine</i> argument is the pertinent inference engine instance,
such as is returned by the form <tt>(inference-engine)</tt> (see Engine-Related
Operators, below).
</blockquote>
<h4><a NAME="CLOS-Related Operators"></a>CLOS-Related Operators</h4>
There are a few special features that LISA provides for keeping CLOS instances
synchronised with their corresponding facts in working memory. If an instance is
altered outside of LISA's control, then LISA must somehow be informed of the
change to maintain working memory consistency. The basic mechanism is manual
notification, in which an application explicitly invokes a special function to
initiate synchronisation. Users of the two commercial Lisps supported by LISA
also have the option of employing <a href="auto-notify.html">Auto Notification</a>,
an experimental feature that removes the burden of synchronisation from the
application.
<br>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(mark-instance-as-changed <i>instance </i>&key <i>slot-name</i>)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Notifies LISA that a change has been made to <i>instance</i>
outside of the knowledge-base (i.e. not via the <i>modify</i> operator),
and synchronizes the instance with its associated fact. <i>Slot-name</i> is
either the symbolic name of a slot belonging to <i>instance</i> that has
changed value, or NIL (the default), in which case all slots are synchronized.
An application <i>must</i> call this method whenever a slot change occurs
outside of LISA's control.</blockquote>
<h4><a NAME="Engine-Related Operators"></a>Engine-Related Operators</h4>
These operators provide an interface to instances of the inference engine
itself.
<p>
<table border="0" width="100%">
<tr>
<td width="80%">(inference-engine)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>Evaluates to the currently active instance of the inference engine.</p>
</blockquote>
</p>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(reset)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Re-initializes the knowledge base, removing
facts, clearing all context agendas, and asserting the <i>initial-fact</i>.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(clear)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Re-initializes the LISA environment, mostly by creating a
new instance of the default inference engine.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(run &optional <i>focus-list)</i></td>
<td>Function</td>
</tr>
</table>
<blockquote>Runs the inference engine, optionally pushing the context names on <i>focus-list</i>
onto the focus stack before doing so. Execution
will continue until either all agendas are exhausted or a rule calls (halt).</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(walk &optional <i>step</i>)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Runs the engine in <i>step</i> increments, single-stepping
by default. Here, "single-stepping" means "one rule at a time".</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(halt)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Halts the inference engine, even if the agendas
still have activations. Typically used only on rule RHSs.</blockquote>
<h4><a NAME="Environment-Related Operators"></a>Environment-Related Operators</h4>
<blockquote>These operators are used to manipulate and inspect the LISA
environment.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(with-inference-engine (<i>engine</i>) <i>forms</i>*)</td>
<td>Macro</td>
</tr>
</table>
<blockquote>Evaluates <i>forms</i> within the context of the inference
engine <i>engine</i>. Under most circumstances, use this macro in a multi-processing
environment to safely load a knowledge base into <i>engine</i>.</blockquote>
<table BORDER=0 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(make-inference-engine)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Creates an instance of LISA's default inference engine.</blockquote>
<table BORDER=0 WIDTH="100%" >
<tr>
<td WIDTH="80%">(rule)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Within the context of an executing rule, returns the CLOS object
representing that rule.</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(consider-taxonomy)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote><p>
Returns the current setting for taxonomic reasoning. Use (setf
(consider-taxonomy) <i>value</i>) to change the setting. The default (T) means
LISA considers class taxonomy during pattern matching.</p>
<p>Furthermore, David Young (author of LISA) said in email to the Lisa-users list on 2005-09-09 18:05:27:
<blockquote>
<ins>The setting of taxonomic reasoning is a
"one-time event" that must be done prior to the construction of the rete
net. This is because Lisa generates closures for many types of tests, and
these tests take into account the value of (consider-taxonomy) when they're
being constructed.</ins>
</blockquote>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(allow-duplicate-facts)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>Returns the current setting for duplicate fact checking. Use (setf
(allow-duplicate-facts) <i>value</i>) to change the setting. By default, LISA
allows duplicate facts to be asserted. If checking is enabled and an application
attempts to assert a duplicate fact, LISA signals a DUPLICATE-FACT error.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(use-fancy-assert)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote><p>
Returns the current setting for fancy assertions. If enabled (the default), the
#? reader macro is installed in the global readtable.</p>
</blockquote>
<h4><a NAME="Debugging-Related Operators"></a>Debugging-Related Operators</h4>
These operators are typically used interactively to inspect the state of
an inference engine. Some of these operators are only loosly defined and
need further work.
<br>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(facts)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Prints on <i>trace output</i> the contents of the active
inference engine's fact base.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(rules &optional <i>context-name</i>)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Prints on <i>trace output</i> the contents of the active
inference engine's rule base. By default, all rules and all contexts will be
printed. If <i>context-name</i> is provided, then only those rules in that
context are printed.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(agenda &optional <i>context-name</i>)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Prints on <i>trace output</i> the contents of the active
inference engine's agenda. By default, the agendas for all contexts will be
printed, unless <i>context-name</i> is supplied.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(watch <i>event</i>)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Asks LISA to report the occurrence of <i>event</i> to <i>trace output</i>.
<p>Currently, LISA allows monitoring of these events:
<pre>:facts</pre>
<blockquote>Triggers an event each time a fact is asserted or retracted.</blockquote>
<pre>:activations</pre>
<blockquote>Triggers an event each time a rule is added to or removed from
the agenda.</blockquote>
<pre>:rules</pre>
<blockquote>Triggers an event each time a rule is fired.</blockquote>
<pre>:bindings</pre>
<blockquote>Triggers an event each time a rule is fired, <i><b>and</b> when also stepping or a breakpoint is triggered</i>.
This will only display bindings when the debugger is about to enter it's interactive REPL loop.</blockquote>
<pre>:all</pre>
<blockquote>
<p>Watch all allowable events.</p>
</blockquote>
</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(unwatch <i>event</i>)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Disables the monitoring of <i>event</i>. See the documentation
for <i>watch</i> to see the allowable event types.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(watching)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Displays the list of events currently being monitored.</blockquote>
<h3>II. <a NAME="The Environment"></a>The Environment</h3>
For application developers, LISA makes available two different types of
environments. Package LISA-USER contains all of LISA's exported symbols, plus
those of COMMON-LISP. User-level work can safely be done in this package.
Alternatively, package LISA-LISP can be used with DEFPACKAGE forms to import a
LISA environment into user-defined packages:
<blockquote>
<p>(defpackage "FRODO"<br>
(:use "LISA-LISP"))</p>
</blockquote>
<p>As with LISA-USER, LISA-LISP exports all external symbols in the LISA and
COMMON-LISP packages. See the various examples provided in "lisa:misc;".</p>
<p>There are a few aspects of LISA that may be customised prior to building. The
file "lisa:src;config;config.lisp" contains a set of default
behaviors; feel free to edit this file to your liking.</p>
<h3>III. <a name="Contexts">Contexts</a></h3>
<p>LISA contexts are a way of partitioning a knowledge base into distinct groups of
rules. The mechanism is similar to modules in CLIPS and recent versions of Jess,
in that individual rule groups can be invoked "procedurally" without
resorting to the use of control facts to manipulate firing order. Contexts can
also serve as an organizational construct when working with larger knowledge
bases. Each context has its own agenda and conflict resolution strategy.</p>
<p>Each inference engine instance created in LISA contains a default context, named
"The Initial Context" (or INITIAL-CONTEXT). Unless arrangements are
made otherwise, all rules will reside in this context. The DEFCONTEXT
macro creates a new context; rules may then be loaded into the new context by
supplying the :CONTEXT keyword to DEFRULE. Contexts serve as a form of namespace
for rules; thus, it is legal for identically named rules to reside in different
contexts. Rules are distinctly identified by qualifying the rule name with the
context name; for example, rule <i>wizards.gandalf</i> is a rule named <i>gandalf</i>
that resides within the <i>wizards</i> context.</p>
<p>Activations in the Initial Context are always available for firing. Otherwise,
activations in other contexts will only fire if those contexts are explicitly
given control, via the FOCUS operator. Each inference engine maintains its own
focus stack; before a new context is given control, the active context is pushed
onto the focus stack. The REFOCUS operator may be used on a rule's RHS (or,
perhaps, interactively) to leave
the active context and return control to the previous context on the stack.
Control automatically returns to the previous context if the active context runs
out of activations. When all contexts have exhausted their activations, the
inference engine halts.</p>
<p>A rule can be tagged with the <i>auto-focus</i> attribute by supplying the
AUTO-FOCUS keyword to DEFRULE. If an auto-focus rule activates, that rule's
context is automatically pushed onto the focus stack and given control when the
rule completes its firing.</p>
<p>Note carefully that while the <i>rules</i> in a knowledge base may be
partitioned, there remains a <i>single working memory</i> per inference engine.
At any given time, all facts in a knowledge base are visible to all rules in
that knowledge base, regardless of context.</p>
<table border="0" width="100%">
<tr>
<td width="80%">(defcontext <i>context-name</i> &key <i>strategy</i>)</td>
<td width="20%">Macro</td>
</tr>
</table>
<blockquote>
<p>Creates a new context identified by <i>context-name</i>, which must be a
string designator. If <i>strategy</i> is non-NIL then it must be an object
implementing a suitable conflict resolution strategy.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(undefcontext <i>context-name</i>)</td>
<td width="20%">Macro</td>
</tr>
</table>
<blockquote>
<p>Destroys the context identified by <i>context-name</i>, which must be a
string designator. All rules bound to the context are removed from the Rete
network, along with their activations, if any.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(focus &rest <i>context-names</i>)</td>
<td width="20%">Macro</td>
</tr>
</table>
<blockquote>
<p>If <i>context-names</i> is non-NIL, it should be a collection of context names
that will be added to the focus stack. Contexts are pushed onto the focus stack
in right-to-left order. If no names are specified, then FOCUS
returns the active context object.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(refocus)</td>
<td width="20%">Macro</td>
</tr>
</table>
<blockquote>
<p>Activates the next available context.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(focus-stack)</td>
<td width="20%">Macro</td>
</tr>
</table>
<blockquote>
<p>Returns the inference engine's focus stack.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(contexts)</td>
<td width="20%">Macro</td>
</tr>
</table>
<blockquote>
<p>Returns a list of all the inference engine's defined contexts.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(with-context (<i>context</i> &body <i>body</i>)</td>
<td width="20%">Macro</td>
</tr>
</table>
<blockquote>
<p>Evaluates the forms contained in <i>body</i> within the context <i>context</i>.</p>
</blockquote>
<h3>IV. <a NAME="Dynamic Rule Definition"></a>Dynamic Rule Definition</h3>
In addition to statically declared rules, LISA supports the definition
of rules at runtime. That is, it is possible to create new rules from the
RHSs of existing rules as they fire. These <i>dynamically defined</i> rules
become immediately available to the inference engine for potential activation.
As a simple example, consider the following rule:<br>
<blockquote>(defrule rocky ()
<br> (rocky (name ?name))
<br> =>
<br> (defrule boris ()
<br> (boris (name ?name))
<br> =>
<br> (format t "Dynamic rule BORIS fired; NAME is ~S~%"
?name)))</blockquote>
When rule ROCKY fires, its RHS creates a dynamically defined rule named
BORIS. This new rule is inserted into the inference engine and immediately
becomes part of the Rete network. Variables bound on the LHS of ROCKY behave
as expected within the context of BORIS; this means that ?NAME in BORIS
is bound to the same object as that found in ROCKY<sup>*</sup>.
<p>Here's a more complicated example:
<blockquote>(defrule rocky ()
<br> (rocky (name ?name))
<br> =>
<br> (let ((dynamic-rule
<br> (defrule (gensym) ()
<br>
(boris (name ?name))
<br>
=>
<br>
(format t "Dynamic rule ~A fired; name is ~S~%" (get-name (rule)) ?name))))
<br> (format t "Rule ROCKY added dynamic rule ~A~%" (get-name
dynamic-rule))))</blockquote>
As before, rule ROCKY creates a dynamic rule when fired. However, this
time the new rule is given a unique name by evaluating the form (GENSYM);
either the name or the instance can then be remembered for use later. These
two rules also introduce functions in the LISA API for retrieving both
the currently executing rule and its name (RULE and GET-NAME, respectively).
<p><sup>*</sup> Actually, this isn't precisely true. Whenever LISA encounters
a dynamic rule during parsing it looks at all the rule's variables and
substitutes any bound values. Thus, in rule BORIS the variable ?NAME would
be replaced by the value of ?NAME as bound in rule ROCKY.
<h3>V. <a NAME="Queries"></a>Queries</h3>
As of LISA version 1.2, a simple query language is supported that allows
retrieval of facts from a knowledge base, either interactively via a Lisp
listener or programmatically. The query engine leverages the inferencing
component by transforming query expressions into rules and inserting them,
at runtime, into the Rete network. Each query is assigned a unique identifier
and cached upon first appearance; subsequent queries with semantically
equivalent bodies will find the cached instance and execute with substantially
improved performance, especially for larger knowledge bases. As an example,
consider the following two query forms:
<p> (retrieve (?x ?y)
<br> (?x (hobbit (name ?name)))
<br> (?y (ring-bearer (name ?name))))
<p> (retrieve (?h1 ?h2)
<br> (?h1 (hobbit (name ?hobbit-name)))
<br> (?h2 (ring-bearer (name ?hobbit-name))))
<p>The variables appearing in the first argument to RETRIEVE (e.g. '(?x
?y)) are used to establish bindings for each firing of the query; each
variable must also appear in the query body as an appropriate pattern binding.
Other than this requirement, query bodies are structurally identical to
rule bodies; anything that is legal in a rule LHS is legal in a query body.
Note that these two examples are semantically equivalent; although the
variable names are different, the patterns appear in the same order and
the relationships among variables are identical. Thus, firing either query
will yield the same set of fact bindings. LISA is able to recognize such
similarities in queries and implements a caching scheme that minimizes
unnecessary dynamic rule creation.
<p>RETRIEVE returns two values; a list of bindings for each query firing,
and the symbolic name assigned by LISA to the query instance. The second
value is probably only useful while developing/testing queries; using this
symbol one can ask LISA to forget about a query by removing it from the
cache and the Rete network. The binding list is the principal value of
interest. Since a query is really a rule, it can fire an arbitrary number
of times for each invocation. Each firing is represented as a list of CONS
cells. The CAR of each cell is one of the variables specified in the query's
binding list; its CDR is a fact bound to that variable that satisfies the
variable's associated pattern. For example, assuming that the first of
the above query examples fires twice during a certain invocation, RETRIEVE
would return something like:
<p> (((?X . <HOBBIT INSTANCE 1>) (?Y . <RING-BEARER INSTANCE 1>))
<br> ((?X . <HOBBIT INSTANCE 2>) (?Y . <RING-BEARER INSTANCE 2)))
<br> #:G7777
<p>As explained previously, the second value is the symbolic name LISA
assigned to the query when its rule instance was initially created. Most
of the time it will be ignored.
<p>As of release 1.3, LISA incorporates a unified view of template- and
CLOS-based facts; as a result queries now function for both types of facts. In
the former case, LISA creates a class modeled around the template. Class and
slot names are taken directly from the DEFTEMPLATE form; each slot is given a
reader method named according to DEFSTRUCT conventions (i.e. <i>class name-slot
name</i>). For example,
<blockquote>
<p>(deftemplate frodo ()<br>
(slot companion (default merry)))
</blockquote>
<p>Will yield the following class specification:
<blockquote>
<p>(defclass frodo (inference-engine-object)<br>
((companion :initform 'merry :initarg :companion :reader
frodo-companion)))
</blockquote>
<p>These functions and macros comprise the current interface to the query
engine:
<br>
<table COLS=2 WIDTH="100%" >
<tr>
<td WIDTH="80%">(retrieve (<i>variables</i>*) <i>patterns</i>*)</td>
<td>Macro</td>
</tr>
</table>
<blockquote>Initiates a query against the knowledge base. Variable bindings
for the query are found in <i>variables; patterns</i> consists of matching
forms that comprise the body of the query rule. RETRIEVE returns two values:
a list of CONS cells for each firing and the symbolic name LISA assigned
to the query when it was initially constructed. The CAR of each CONS cell
is one of the binding variables; the CDR is the CLOS instance bound to
that variable.</blockquote>
<table COLS=2 WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(forget-query <i>name</i>)</td>
<td>Function</td>
</tr>
</table>
<blockquote>Instructs LISA to forget about the query identified by the
symbol <i>name</i>. Doing so removes the query's rule instance from the
Rete network and the query itself from the cache. Useful only during query
development, probably.</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(with-simple-query ((<i>var value</i>) <i>query-form</i>
&body <i>body</i>))</td>
<td width="20%">Macro</td>
</tr>
</table>
<blockquote>
<p>Evaluates <i>query-form</i>. Then, iterates over the resulting list
structure, binding each variable and fact to <i>var</i> and <i>value</i>,
respectively, and evaluating <i>body</i>. This macro is useful if one is
interested in just the individual variable/fact pairs and doesn't care much
about the binding context that occurred during query firing.</p>
</blockquote>
<h3>VI. <a NAME="Conflict Resolution"></a>Conflict Resolution</h3>
Conflict Resolution (CR) is the mechanism LISA employs to determine the
order in which multiple activations will fire. Currently, LISA offers two
"built-in" strategies; <i>breadth-first</i> and <i>depth-first</i>. It
is possible to implement new CR algorithms by creating a class derived
from <i>lisa:strategy</i> and implementing a few generic functions; instances
of this new strategy can then be given to <i>make-inference-engine</i>.
<br>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(add-activation <i>strategy</i> <i>activation</i>)</td>
<td>Generic Function</td>
</tr>
</table>
<blockquote>Makes a new <i>activation</i> eligible for firing.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(find-activation <i>strategy</i> <i>rule</i> <i>token</i>)</td>
<td>Generic Function</td>
</tr>
</table>
<blockquote>Locates an activation associated with <i>rule</i> and <i>token</i>.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(next-activation <i>strategy</i>)</td>
<td>Generic Function</td>
</tr>
</table>
<blockquote>Returns the next eligible activation.</blockquote>
<table WIDTH="100%" NOSAVE >
<tr NOSAVE>
<td WIDTH="80%" NOSAVE>(list-activations <i>strategy</i>)</td>
<td>Generic Function</td>
</tr>
</table>
<blockquote>Returns a list of eligible activations.</blockquote>
Documentation for the CR interface is still fairly light. Look for improvements
in upcoming releases.
<h3>VII. <a name="The LISA Debugger">The LISA Debugger</a></h3>
<p>The LISA debugger is a simple monitoring and
inspection utility that may be used to "debug" production rules.
Although one cannot step through a rule pattern by pattern, breakpoints may be
set to trigger just before a rule fires. When a breakpoint is reached, one can
then interactively examine the token stack, display all pattern bindings and
their values, single-step into the next activation, etc.</p>
<p>By default, LISA builds without the debugger loaded to avoid a slight
performance drag on rule firings. To use the debugger, in the CL-USER package
evaluate the form <tt>(require 'lisa-debugger (lisa-system::lisa-debugger))</tt>.
If you're running Allegro Common Lisp, LISA understands how to hook into the
module search list; thus you may instead evaluate <tt>(require 'lisa-debugger)</tt>.</p>
<p>The functionality available via the LISA debugger may increase as user needs
dictate; here is the command set as of this writing:</p>
<table border="0" width="100%">
<tr>
<td width="80%">(set-break <i>rule-name</i>)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>
Sets a breakpoint in the rule identified by the symbol <i>rule-name.</i></p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(clear-break <i>rule-name</i>)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>Clears the breakpoint previously set on the rule identified by the symbol <i>rule-name</i>.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(clear-breaks)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>Removes all breakpoints.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">*break-on-subrules*</td>
<td width="20%">Special variable</td>
</tr>
</table>
<blockquote>
<p>Setting this variable to a non-NIL value will cause the debugger to manage
breakpoints for a primary rule and all of its subrules (see the section on the
<i>or</i> conditional element for an explanation of primary rules).</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(next)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>Fires the currently suspended rule, then single-steps into the next
activation, if there is one. If there isn't one, the debugger exits.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(resume)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>Resumes normal execution, until the next breakpoint is reached.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(tokens &key (<i>verbose nil</i>))</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p> Displays the token stack, which contains the facts that activated
this particular rule. If <i>verbose</i> is non-nil, then the fact instances
themselves are printed; otherwise, a shorthand notation is used.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(bindings)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>Displays the bindings (pattern variables) found on the rule's LHS, along
with their values.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(fact <i>fact-id</i>)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>Returns the fact instance associated with <i>fact-id</i>, a small integer
assigned to each fact by the inference engine.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(ppfact <i>fact-id</i>)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>Pretty-prints the fact instance associated with <i>fact-id</i>, including
it's slots and their values, though the slot values themselves are not pretty-printed.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(breakpoints)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>Displays all breakpoints.</p>
</blockquote>
<table border="0" width="100%">
<tr>
<td width="80%">(rule)</td>
<td width="20%">Function</td>
</tr>
</table>
<blockquote>
<p>Returns the rule instance representing the suspended activation.</p>
</blockquote>
<h3>VIII. <a NAME="Getting Started"></a>Getting Started</h3>
LISA requires the Portable Defsystem as maintained by the CLOCC project;
for your convenience, a copy is included in the distribution. Building
LISA should be straight-forward. First, either load
"lisa:lisa.system"
or change your working directory to the LISA root directory; then, evaluate (mk:compile-system
:lisa). Note that LISA uses logical pathnames in its defsystem, and translations that are suitable for a Linux
(or Cygwin/Windows) environment are
established there. They might work for you; perhaps not. Until
I figure out how to correctly place default translations you might have
to do some hand editing. Sorry.
<p>To build a knowledge base, write your production rules using the various
source examples (and this document) as your guide and load the file(s)
into Lisp. You can then change to the LISA-USER package and experiment.
Look for the examples in "lisa:misc;".
<p>A note to CLISP users. LISA requires that CLISP be run with full ANSI
support enabled. Also, the baseline version with which LISA has been tested
is 2.25.1. Earlier releases might work as well, but no guarantees.
<h3>IX. <a NAME="Things Yet to Do"></a>Things Yet to Do.</h3>
This section is a list (albeit incomplete) of features that would improve
LISA significantly.
<ol>
<li><i>Backward chaining</i>: Perhaps an implementation of Prolog's backchaining
algorithm that has concurrent access to working memory (i.e. along with Rete).<br>
</li>
<li><i>Certainty factors</i>: An experimental, undocumented implementation of certainty factors
has been added by David Young. See the text file <tt>CF-README.</tt></li>
</ol>
<h3><a NAME="Supported Platforms"></a>X. Supported Platforms.</h3>
LISA has been tested, and is known to run, on the following Common Lisp
implementations:
<ul>
<li>Allegro Common Lisp, versions 5.0.1 and 6.x, Linux and Windows 2000.</li>
<li>Xanalys LispWorks, versions 4.1.20 and 4.2, Linux and Windows 2000.</li>
<li>CLISP, version 2.27 and newer, Linux and Windows 2000.</li>
<li>CMUCL, version 18c, Linux.</li>
</ul>
</body>
</html>
| 48,808 | Common Lisp | .l | 1,083 | 43.111727 | 148 | 0.744954 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | c205af268746d15b8310678f62d610609c385a91b80dce52d7a7806aa012d566 | 10,233 | [
-1
] |
10,234 | index.html | gpwwjr_LISA/doc/index.html | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.2 (Linux)">
<META NAME="CREATED" CONTENT="20070908;14272300">
<META NAME="CHANGEDBY" CONTENT="David Young">
<META NAME="CHANGED" CONTENT="20070917;18503300">
<META NAME="ProgId" CONTENT="Word.Document">
<META NAME="Originator" CONTENT="Microsoft Word 9">
<META NAME="ProgId" CONTENT="Word.Document">
<META NAME="Originator" CONTENT="Microsoft Word 9">
<!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]-->
<STYLE TYPE="text/css">
<!--
TD P { color: #000000 }
P { color: #000000 }
H2 { color: #000000 }
H3 { color: #000000 }
A:link { color: #0000ef }
A:visited { color: #52188c }
-->
</STYLE>
</HEAD>
<BODY LANG="en-US" TEXT="#000000" LINK="#0000ef" VLINK="#52188c" BGCOLOR="#ffffff" BACKGROUND="hierarchy-background.gif" DIR="LTR">
<P>
</P>
<P>
</P>
<TABLE COLS=3 WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=2>
<TR>
<TD ROWSPAN=2 WIDTH=28%>
<P STYLE="text-decoration: none"><A NAME="_x0000_i10271"></A><A HREF="http://www.powmiaff.org/"><IMG SRC="powmia.jpg" NAME="graphics1" ALIGN=BOTTOM WIDTH=50 HEIGHT=85 BORDER=0></A></P>
</TD>
<TD ROWSPAN=2 WIDTH=100%>
<P> </P>
<P> </P>
</TD>
<TD WIDTH=29%>
<P ALIGN=RIGHT><A NAME="_x0000_i10261"></A><IMG SRC="http://sourceforge.net/sflogo.php?group_id=12453&type=1" NAME="graphics2" ALIGN=BOTTOM WIDTH=88 HEIGHT=31 BORDER=0></P>
</TD>
</TR>
<TR>
<TD WIDTH=29% VALIGN=TOP>
<P> </P>
</TD>
</TR>
</TABLE>
<H2 ALIGN=CENTER>The Lisa Project</H2>
<P>[This is old material from the original LISA distribution on SourceForge.
It does not contain any updates reflecting the current fork at
<A HREF="https://github.com/gpwwjr/LISA">https://github.com/gpwwjr/LISA</A>.]</p>
<P><BR>Welcome to the <A HREF="http://sourceforge.net/projects/lisa">Lisa</A>
project, a platform for the development of <B>L</B>isp-based
<B>I</B>ntelligent <B>S</B>oftware <B>A</B>gents. Lisa is a
production-rule system implemented in the Common Lisp Object System
(CLOS), and is heavily influenced by CLIPS and the Java Expert System
Shell (JESS). At its core is a reasoning engine based on an
object-oriented implementation of the Rete algorithm, a very
efficient mechanism for solving the difficult many-to-many matching
problem ("Rete: A Fast Algorithm for the Many Pattern/Many
Object Pattern Match Problem", Charles L. Forgy, Artificial
Intelligence 19(1982), 17-37.) Intrinsic to Lisa is the ability to
reason over CLOS objects without imposing special class hierarchy
requirements; thus it should be possible to easily augment existing
CLOS applications with reasoning capabilities. As Lisa is an
extension to Common Lisp, the full power of the Lisp environment is
always available. Lisa-enabled applications should run on any
ANSI-compliant Common Lisp platform.
</P>
<H3>Project Goals</H3>
<P>The Lisa project is driven by a number of important goals:
</P>
<UL TYPE=DISC>
<LI><P><I>Unrestricted availability</I>: The principal motivation
for beginning Lisa was the apparent dearth of lightweight, <I>current,
freely-available</I> toolkits for constructing Lisp-based
intelligent systems. There are a number of very fine commercial and
restricted-use products out there (see the links below), but these
systems do not necessarily address the needs of developers
attempting to introduce Lisp into their organizations. This is
exactly the position I found myself in prior to Lisa. I was leading
an applied research project that needed an expert system shell, and
if I'd had a modern implementation freely available for Lisp I might
have been able to successfully entrench Lisp within the
organization. So, I wrote Lisa.
</P>
<LI><P><I>Portability</I>: Vendor neutrality is a significant
project goal, not because I disapprove of commercial software but to
ensure Lisa is available on as many platforms as I can manage.. As
previously mentioned, Lisa is implemented in ANSI Common Lisp;
currently, all development is being done on Windows 2000 using
<A HREF="http://www.xanalys.com/">Xanalys</A>' LispWorks. Every
effort will be made to avoid the use of implementation-specific
functionality; in the cases where a non-ANSI feature must be used
(e.g. multiprocessing support), Lisa will attempt to support the
major Lisp implementations either through conditional evaluation or
the use of a common library such as <A HREF="http://clocc.sourceforge.net/">CLOCC</A>.
</P>
<LI><P><I>Familiarity</I>: Lisa's production-rule system has its
roots in CLIPS and JESS, making it readily familiar to developers
who've worked with either of these systems. Indeed, the CLIPS and
JESS languages both have their roots in Lisp.
</P>
<LI><P><I>Flexibility</I>: As previously mentioned, Lisa reasons
over CLOS objects without requiring changes to an application's
class hierarchy. In addition, the full power of Common Lisp is
available for use within productions; there is no dichotomy between
Lisa's programming language and her implementation.
</P>
<LI><P><I>Simplicity</I>: Along with portability, the project is
striving for simplicity and elegance at the functional, architecture
and source code levels. This doesn't mean Lisa should have limited
usefulness; rather, it should be possible for new developers to
easily understand the code layout and behavior. Unless performance
absolutely demands otherwise, clarity of design and implementation
will take precedence.
</P>
</UL>
<H3>Project People</H3>
<UL TYPE=DISC>
<LI><P><A HREF="mailto:[email protected]">David E. Young</A>:
Presently a knowledge engineer at a small startup in RTP, North
Carolina.
</P>
</UL>
<H3>Project Status</H3>
<P>Release 3.2 is the latest official release. The major addition
after version 2.1 is support for Certainty Factors (CF), as described
in Peter Norvig's <I>Paradigms of Artificial Intelligence
Programming</I>. There's also a simplified install facility based on
ASDF, and some major performance improvements.</P>
<P>The first production release for Lisa 2.0, a major rewrite of the
system, was available as of 9 December, 2002. The Rete algorithm was
re-implemented from scratch; new conditional elements were added;
contexts were introduced; and a production rule debugger made
available. There were also other features not listed here.
</P>
<P>Lisa had its first production release (Version 1.0) on 31 August,
2001 and is considered "stable" software; it should now be
possible to develop reasonably sophisticated knowledge bases for
"real systems". Lisa has successfully run adaptations of
the "monkey and bananas" (MAB) planning problem on all four
target Lisp platforms, and full reasoning capabilities are available
for CLOS objects in a multi-threaded environment. Release 1.1 offers
support for <I>dynamic rule definition</I>, the ability to create new
rules from existing rules at runtime; version 1.2 includes a new
query facility that allows interactive and programmatic retrieval of
CLOS instances from a knowledge base. For the most current
information on the project, including mailing lists, latest news and
available downloads, see the <A HREF="http://sourceforge.net/projects/lisa">official
project page</A>. If you prefer, you may contact the project staff
directly (see <I>Project People</I>).</P>
<H3>Supported Platforms</H3>
<P>Lisa is known to run on LispWorks, ACL, CLISP, CMUCL (19a), SBCL
and OpenMCL. I also know of an individual that has managed to get
Lisa running on Armed Bear Common Lisp, a testimony to the quality of
that member of the Common Lisp family.</P>
<H3>Documentation</H3>
<P>Currently, documentation for Lisa is a work-in-progress. However,
there is a beta-quality version of the <A HREF="ref-guide.html">Lisa</A>
<A HREF="ref-guide.html">Reference Guide</A> that should help you get
started. Also, you may see the source code for Lisa's two versions of
the MAB, <A HREF="http://lisa.sourceforge.net/mab.lisp">mab.lisp</A>
and <A HREF="http://lisa.sourceforge.net/mab-clos.lisp">mab-clos.lisp</A>
(a "CLOS-ified" version of the default MAB implementation).
</P>
<H3>License</H3>
<P>Lisa is currently released under the GNU Lesser General Public
License (LGPL), primarily because it seemed more versatile than the
GPL. However, some sources indicate that the LGPL might inhibit
commercial uses of Lisp applications like Lisa. I've no idea if this
is the case as I'm not a legal expert. So, if you're interested in
using Lisa commercially and decide the LGPL gets in the way, feel
free to contact me to discuss some other type of license arrangement.</P>
<H3>News</H3>
<P><I>8 September, 2007:</I> <SPAN STYLE="font-style: normal">Release
3.0. This is a major release that offers support for certainty
factors, big performance improvements, and some important bug fixes.</SPAN></P>
<P><I>21 February, 2006:</I> Release 2.4. This is a minor release
that makes Lisa compatible with CLISP 2.38.</P>
<P><I>5 April, 2005:</I> Release 2.3. This version fixes a serious
bug in Lisa’s join network; thanks to Andy Sloane for the patch.
There’s also a patch from Fred Gilham that enables auto-notify
support for CMUCL.</P>
<P><I>4 April, 2005: </I>Release 2.1 is out of beta and is the latest
stable release.</P>
<P><I>17 September, 2004</I>: Release 2.1 beta is available, with
support for Certainty Factors. Also, Lisa now unofficially once again
supports CMUCL. I've had reports that the PCL bugs were fixed as of
19a, and that Lisa is able to run the MAB on that platform.</P>
<P><I>9 June, 2004</I>: Lisa now uses ASDF as its default system
definition facility. The build and load procedure has also been
simplified to help new folks get up and running quickly. I also have
plans to write a tutorial that will be more useful than the reference
guide. Also, note that Lisa officially no longer supports CMUCL.
There's apparently a bug in PCL that prevents Lisa from running (or
perhaps compiling; I forget). This situation has existed for awhile
now, but I'm just getting around to announcing it.</P>
<P><I>6 June, 2004</I>: Release 2.0.7. Yet another bug-fix release
that corrects a problem reported by Aneil Mallavarapu. Lisa was
having difficulty keeping the agenda straight when rules were created
after facts had been asserted into working memory.</P>
<P><I>5 March, 2004</I>: Release 2.0.6. This is a bug-fix release
that addresses problems with a) Lisa's duplicate fact detection
mechanism; and b) the LOGICAL conditional element. Patches for both
issues were submitted by Aneil Mallavarapu.</P>
<P><I>1 November, 2003</I>: Release 2.0.5, a bug-fix release that
corrects problems with Lisa’s taxonomic reasoning system. Patches
submitted courtesy of Aneil Mallavarapu.</P>
<P><I>19 December, 2002</I>: Release 2.0.3, a bug-fix release
addressing a problem with queries.
</P>
<P><I>10 December, 2002</I>: Release 2.0.1, a bug-fix release for
2.0.</P>
<P><I>9 December, 2002</I>: The first production release for 2.0 is
available. Details are in the <A HREF="RELNOTES.html">release notes</A>.</P>
<P><I>25 November, 2002</I>: Beta 3 is available. Again, some major
enhancements, including Contexts, a new conditional element and
duplicate fact detection. Details are in the release notes.</P>
<P><I>18 November, 2002</I>: Beta 2 is available. Lots of changes and
enhancements in this version, including completion of Lisa's truth
maintenance system. See the <A HREF="RELNOTES.html">release notes</A>
for details.</P>
<P><I>6 November, 2002</I>: The first beta release for Lisa 2.0,
2.0b1. This version introduces a form of truth maintenance via the
LOGICAL conditional element. Details are in the reference guide in
the distribution.</P>
<P><I>4 November, 2002</I>: Alpha release 5 for Lisa 2.0 is now
available. This version introduces the OR conditional element, along
with some improvements to the debugger. Details are in the reference
guide in the distribution.</P>
<P><I>28 October, 2002</I>: Alpha release 4 for Lisa 2.0 is now
available. New to this version is the Lisa debugger, a simple,
interactive production rule monitoring/inspection facility. The
Reference Guide in the distribution has a chapter explaining how to
use it.</P>
<P>Additional items of interest can be found <A HREF="news.htm">here</A>.</P>
<H3>Related Links</H3>
<P>This section contains a small collection of topics related to Lisa
and its development environment. It will be updated periodically as
the need arises. NB: If your favorite Lisp/Environment/Tool was
omitted here it was done without prejudice; I simply haven't had time
to test Lisa with every mainstream Lisp implementation, or
investigate every knowledge representation system, or... you get the
idea. <BR> <BR>
</P>
<TABLE COLS=2 WIDTH=893 BORDER=0 CELLPADDING=0 CELLSPACING=2>
<TR>
<TD WIDTH=351>
<P><B>Free Common Lisp Implementations</B></P>
</TD>
<TD WIDTH=528>
<P><B>Commercial Common Lisp Implementations</B></P>
</TD>
</TR>
<TR>
<TD WIDTH=351>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.cons.org/cmucl">CMU
Common Lisp</A> (CMUCL)
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://clisp.cons.org/">CLISP</A>
</P>
<LI><P><A HREF="http://armedbear-j.sourceforge.net/">Armed Bear
Lisp</A> (ABL)
</P>
</UL>
</TD>
<TD WIDTH=528>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.lispworks.com/">LispWorks</A>:
Xanalys, Inc. My Lisp environment of choice. Reminds me of my
Symbolics days...
</P>
<LI><P><A HREF="http://www.franz.com/">Allegro Common Lisp</A>:
Franz, Inc.
</P>
</UL>
</TD>
</TR>
</TABLE>
<P><BR>
</P>
<TABLE COLS=2 WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=2>
<TR>
<TD>
<P><B>Lisp Development Environments and Libraries</B></P>
</TD>
<TD>
<P> </P>
</TD>
</TR>
<TR>
<TD>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.gnu.org/">Emacs</A>:
No comment necessary.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://ilisp.sourceforge.net/">ILisp</A>:
A nice, comprehensive Emacs Lisp package that integrates a number
of Lisp implementations.
</P>
<LI><P><A HREF="http://clocc.sourceforge.net/">CLOCC</A>: The
Common Lisp Open Code Collection.
</P>
</UL>
</TD>
<TD>
<P> </P>
</TD>
</TR>
</TABLE>
<P><BR>
</P>
<TABLE COLS=2 WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=2>
<TR>
<TD>
<P><B>Commercial and Restricted-Use Knowledge Systems</B></P>
</TD>
<TD>
<P><B>Freely-Available Knowledge Systems</B></P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.isi.edu/isd/LOOM/LOOM-HOME.html">Loom,
PowerLoom</A>: Semantic networks, ontologies.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.lispworks.com/">KnowledgeWorks</A>:
Production-rule system for LispWorks.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://herzberg.ca.sandia.gov/jess/">JESS</A>:
The Java Expert System Shell.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.ilog.com/">JRules</A>:
ILog's production-rule system for Java.
</P>
<LI><P><A HREF="http://www.haley.com/">Eclipse, Authorete</A>:
The Haley Enterprise's production rule suite.
</P>
</UL>
</TD>
<TD>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.ghgcorp.com/clips/CLIPS.html">CLIPS</A>:
A classic expert system tool.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.cis.upenn.edu/~screamer-tools/home.html">Screamer:</A>
Nondeterministic programming for Lisp.
</P>
<LI><P><A HREF="http://jlisa.sf.net/">JLisa</A>: A powerful
framework for building business rules accessible to Java.
</P>
</UL>
<P><BR> </P>
</TD>
</TR>
</TABLE>
<P><BR>
</P>
<TABLE COLS=2 WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=2>
<TR>
<TD>
<P><B>Useful References</B></P>
</TD>
<TD>
<P> </P>
</TD>
</TR>
<TR>
<TD>
<UL TYPE=DISC>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.lisp.org/HyperSpec/FrontMatter/index.html">Common
Lisp HyperSpec</A>: HTML version of the ANSI standard X3.226,
1994.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.alu.org/mop/index.html">The
CLOS MOP</A>: HTML version of the AMOP.
</P>
<LI><P STYLE="margin-bottom: 0in"><A HREF="http://www.alu.org/">ALU</A>:
The Association of Lisp Users.
</P>
<LI><P STYLE="margin-bottom: 0in"><I>Steele, Guy L. Jr.</I>:
<A HREF="http://www.amazon.com/exec/obidos/ASIN/1555580416/qid%3D984074327/107-1518177-7350946">Common
Lisp : The Language, Second Edition</A> (CLtL2).
</P>
<LI><P STYLE="margin-bottom: 0in"><I>Keene, Sonya E.</I>: <A HREF="http://www.amazon.com/exec/obidos/ASIN/0201175894/">Object
Oriented Programming in Common Lisp - A Programmer's Guide to the
Common Lisp Object System.</A>
</P>
<LI><P STYLE="margin-bottom: 0in"><I>Kiczales, Gregor et al</I>:
<A HREF="http://www.amazon.com/exec/obidos/ASIN/0262610744/">The
Art of the Metaobject Protocol.</A>
</P>
<LI><P STYLE="margin-bottom: 0in"><I>Graham, Paul</I>: <A HREF="http://www.amazon.com/exec/obidos/ASIN/0133708756/ref=sim_books/104-3504753-0375128">ANSI
Common Lisp</A>.
</P>
<LI><P><I>Graham, Paul</I>: <A HREF="http://www.amazon.com/exec/obidos/ASIN/0130305529/">On
Lisp</A>.
</P>
</UL>
</TD>
<TD>
<P> </P>
</TD>
</TR>
</TABLE>
<P><B>Credits</B>
</P>
<P>The background image for this web site was lifted, with
permission, from the Loom project home page.
</P>
</BODY>
</HTML> | 18,084 | Common Lisp | .l | 420 | 40.57619 | 187 | 0.728524 | gpwwjr/LISA | 10 | 4 | 2 | LGPL-2.1 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 149df4e0c0f1cd9fa0d9f824648f7f2bc4634ac1e975fb5d79869c140fb5b774 | 10,234 | [
-1
] |
10,249 | eventbus-test.lisp | noloop_eventbus/test/eventbus-test.lisp | (defpackage #:noloop.eventbus-test
(:use #:common-lisp
#:simplet)
(:nicknames #:eventbus-test)
(:import-from #:eventbus
#:make-eventbus
#:get-all-listeners-of-event
#:get-listener-count-of-event
#:once
#:on
#:off
#:emit
#:get-all-events-name
#:remove-all-listeners-of-event))
(in-package #:noloop.eventbus-test)
(defun test-get-all-listeners-of-event ()
(let* ((eventbus-instance (make-eventbus))
(fn (lambda ()))
(actual nil)
(expected (list (list fn t)))
(existent-p nil))
(setf (gethash :event-1 eventbus-instance) (list (list fn t)))
(multiple-value-bind (value present-p)
(get-all-listeners-of-event eventbus-instance :event-1)
(setf actual value)
(setf existent-p present-p))
(and (equal actual expected)
existent-p)))
(defun test-get-listener-count-of-event ()
(let ((eventbus-instance (make-eventbus))
(expected 1)
(actual nil))
(setf (gethash :event-1 eventbus-instance) (list (list (lambda ()) t)))
(setf actual (get-listener-count-of-event eventbus-instance :event-1))
(= expected actual)))
(defun test-once ()
(let ((eventbus-instance (make-eventbus))
(expected 1)
(actual nil))
(once eventbus-instance :event-once-1
(lambda ()
;; make something at emit this event.
))
(setf actual (get-listener-count-of-event eventbus-instance :event-once-1))
(= expected actual)))
(defun test-on ()
(let ((eventbus-instance (make-eventbus))
(expected 1)
(actual nil))
(on eventbus-instance :event-on-1
(lambda ()
;; make something at emit this event.
))
(setf actual (get-listener-count-of-event eventbus-instance :event-on-1))
(= expected actual)))
(defun test-off ()
(let ((eventbus-instance (make-eventbus))
(listener-fn-1 (lambda ()))
(expected 1)
(actual nil))
(once eventbus-instance :event-1 listener-fn-1)
(on eventbus-instance :event-1 (lambda ()))
(off eventbus-instance :event-1 listener-fn-1)
(setf actual (get-listener-count-of-event eventbus-instance :event-1))
(= expected actual)))
(defun test-off-remove-all-listeners-of-event ()
(let ((eventbus-instance (make-eventbus))
(listener-fn-1 (lambda ()))
(actual nil)
(existent-p t))
(once eventbus-instance :event-1 listener-fn-1)
(on eventbus-instance :event-1 listener-fn-1)
(off eventbus-instance :event-1 listener-fn-1)
(off eventbus-instance :event-1 listener-fn-1)
(multiple-value-bind (value present-p)
(get-all-listeners-of-event eventbus-instance :event-1)
(setf actual value)
(setf existent-p present-p))
(and (null actual)
(null existent-p))))
(defun test-emit-once-event ()
(let ((eventbus-instance (make-eventbus))
(x 0)
(expected 1))
(once eventbus-instance :event-1 (lambda () (incf x)))
(emit eventbus-instance :event-1)
(emit eventbus-instance :event-1)
(eql x expected)))
(defun test-emit-on-event ()
(let ((eventbus-instance (make-eventbus))
(x 0)
(expected 2))
(on eventbus-instance :event-1 (lambda () (incf x)))
(emit eventbus-instance :event-1)
(emit eventbus-instance :event-1)
(eql x expected)))
(defun test-emit-on-event-with-args ()
(let ((eventbus-instance (make-eventbus))
(x 0)
(expected 8))
(on eventbus-instance :event-1 (lambda (n z) (incf x (+ n z))))
(emit eventbus-instance :event-1 2 2)
(emit eventbus-instance :event-1 2 2)
(eql x expected)))
(defun test-add-listener-emit-once-event ()
(let ((eventbus-instance (make-eventbus))
(actual nil)
(expected :event-1))
(once eventbus-instance :add-listener
(lambda (event-name) (setf actual event-name)))
(on eventbus-instance :event-1 (lambda ()))
(eql actual expected)))
(defun test-add-listener-emit-on-event ()
(let ((eventbus-instance (make-eventbus))
(actual nil)
(expected :event-1))
(on eventbus-instance :add-listener
(lambda (event-name) (setf actual event-name)))
(on eventbus-instance :event-1 (lambda ()))
(eql actual expected)))
(defun test-remove-listener-emit-on-event ()
(let* ((eventbus-instance (make-eventbus))
(actual nil)
(expected :event-1)
(listener-fn
(lambda (event-name) (setf actual event-name))))
(on eventbus-instance :remove-listener listener-fn)
(off eventbus-instance :event-1 listener-fn)
(eql actual expected)))
(defun test-get-all-events-name ()
(let ((eventbus-instance (make-eventbus))
(actual nil)
(expected '(:remove-listener :event-once-1 :event-on-1)))
(on eventbus-instance :remove-listener (lambda ()))
(on eventbus-instance :event-once-1 (lambda ()))
(on eventbus-instance :event-on-1 (lambda ()))
(setf actual (get-all-events-name eventbus-instance))
(equal actual expected)))
(defun test-remove-all-listeners-of-event ()
(let ((eventbus-instance (make-eventbus))
(actual nil)
(expected 0))
(on eventbus-instance :event-1 (lambda ()))
(on eventbus-instance :event-1 (lambda ()))
(remove-all-listeners-of-event eventbus-instance :event-1)
(setf actual
(get-listener-count-of-event eventbus-instance :event-1))
(eql actual expected)))
(defun test-remove-all-listeners-of-event-with-event-name-remove-listener ()
(let ((eventbus-instance (make-eventbus))
(actual nil)
(expected 0)
(listener-fn
(lambda (event-name) event-name)))
(on eventbus-instance :remove-listener listener-fn)
(on eventbus-instance :remove-listener listener-fn)
(remove-all-listeners-of-event eventbus-instance :remove-listener)
(setf actual
(get-listener-count-of-event eventbus-instance :remove-listener))
(eql actual expected)))
(defun test-remove-all-listeners-of-event-with-event-name-add-listener ()
(let ((eventbus-instance (make-eventbus))
(actual nil)
(expected 0)
(listener-fn
(lambda (event-name) event-name)))
(on eventbus-instance :add-listener listener-fn)
(on eventbus-instance :add-listener listener-fn)
(remove-all-listeners-of-event eventbus-instance :add-listener)
(setf actual
(get-listener-count-of-event eventbus-instance :add-listener))
(eql actual expected)))
(suite "Suite eventbus"
(test "Test get-all-listeners-of-event" #'test-get-all-listeners-of-event)
(test "Test get-listener-count-of-event" #'test-get-listener-count-of-event)
(test "Test once" #'test-once)
(test "Test on" #'test-on)
(test "Test off" #'test-off)
(test "Test off-remove-all-listeners-of-event" #'test-off-remove-all-listeners-of-event)
(test "Test emit-once-event" #'test-emit-once-event)
(test "Test emit-on-event" #'test-emit-on-event)
(test "Test emit-on-event-with-args" #'test-emit-on-event-with-args)
(test "Test add-listener-emit-once-event" #'test-add-listener-emit-once-event)
(test "Test add-listener-emit-on-event" #'test-add-listener-emit-on-event)
(test "Test remove-listener-emit-on-event" #'test-remove-listener-emit-on-event)
(test "Test get-all-events-name" #'test-get-all-events-name)
(test "Test remove-all-listeners-of-event" #'test-remove-all-listeners-of-event)
(test "Test remove-all-listeners-of-event-with-event-name-remove-listener" #'test-remove-all-listeners-of-event-with-event-name-remove-listener)
(test "Test remove-all-listeners-of-event-with-event-name-add-listener" #'test-remove-all-listeners-of-event-with-event-name-add-listener))
| 7,925 | Common Lisp | .lisp | 189 | 35.116402 | 151 | 0.646975 | noloop/eventbus | 12 | 1 | 1 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | b775d3a71946b67e3ef0b545815db2e207f684635438634834e092201004559b | 10,249 | [
-1
] |
10,250 | package.lisp | noloop_eventbus/src/package.lisp | (defpackage #:noloop.eventbus
(:use #:common-lisp)
(:nicknames #:eventbus)
(:export #:make-eventbus
#:get-all-listeners-of-event
#:get-listener-count-of-event
#:once
#:on
#:off
#:emit
#:get-all-events-name
#:remove-all-listeners-of-event))
| 327 | Common Lisp | .lisp | 12 | 19 | 44 | 0.542857 | noloop/eventbus | 12 | 1 | 1 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 1c699c5797bd5be57d1b3b9c9db53a396da49d803eb5df77a29b1b372484c23e | 10,250 | [
-1
] |
10,251 | eventbus.lisp | noloop_eventbus/src/eventbus.lisp | (in-package #:noloop.eventbus)
(defun make-eventbus ()
"Return eventbus instance."
(make-hash-table :test 'eq))
(defun get-listener-count-of-event (eventbus event-name)
"Return length listeners of event. Return nil if event nonexistent."
(length (gethash event-name eventbus)))
(defun get-all-listeners-of-event (eventbus event-name)
"Return two values, the value: list of listeners of the event, and present-p: list is present."
(multiple-value-bind (value present-p)
(gethash event-name eventbus)
(values value present-p)))
(defun make-listener (listener-fn is-once)
"It returns a list, the first element being a listener function, and the following being a boolean saying if it is an once listener."
(list listener-fn is-once))
(defun once (eventbus event-name listener-fn)
"Add one listener to an event. The listener is removed when the event is emitted. The add-listener event is emitted before adding the new listener."
(when (gethash :add-listener eventbus)
(emit eventbus :add-listener event-name))
(setf (gethash event-name eventbus)
(push (make-listener listener-fn t) (gethash event-name eventbus)))
eventbus)
(defun on (eventbus event-name listener-fn)
"Add one listener to an event. The add-listener event is emitted before adding the new listener."
(when (gethash :add-listener eventbus)
(emit eventbus :add-listener event-name))
(setf (gethash event-name eventbus)
(push (make-listener listener-fn nil) (gethash event-name eventbus)))
eventbus)
(defun off (eventbus event-name listener-fn)
"Remove the first listener from the event listeners list."
(let ((listeners (gethash event-name eventbus)))
(setf (gethash event-name eventbus)
(delete-if #'(lambda (i)
(eq (car i) listener-fn))
listeners
:count 1))
(when (gethash :remove-listener eventbus)
(emit eventbus :remove-listener event-name))
(when (eq 0 (get-listener-count-of-event eventbus event-name))
(remhash event-name eventbus))
eventbus))
(defun emit (eventbus event-name &rest args)
"Emite an event by passing the arguments offered to the listener function. If the listener is once, then the listener is excluded from the list of listeners."
(let ((listeners (gethash event-name eventbus)))
(when listeners
(dolist (i listeners)
(let ((fn (car i)))
(when (cadr i)
(off eventbus event-name fn))
(apply fn args))))
eventbus))
(defun get-all-events-name (eventbus)
"Return one list with all name of events of the eventbus. The list returned includes add-listener and remove-listener."
(let ((keys '()))
(maphash
#'(lambda (key value)
(declare (ignore value))
(push key keys))
eventbus)
(nreverse keys)))
(defun remove-all-listeners-of-event (eventbus event-name)
"Removing all listeners from the event. Will be called the off function for each listener, so the remove-listener event is emitted correctly for each listener removed."
(let* ((listeners (gethash event-name eventbus))
(listener-fn (car (first listeners))))
(when listeners
(off eventbus event-name listener-fn)
(remove-all-listeners-of-event eventbus event-name))
eventbus))
| 3,352 | Common Lisp | .lisp | 69 | 42.637681 | 170 | 0.699572 | noloop/eventbus | 12 | 1 | 1 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 739cc50a1e7d854fe970555cb0291578c303d563f5a4a3d0da5f89ad9e526293 | 10,251 | [
-1
] |
10,252 | eventbus.asd | noloop_eventbus/eventbus.asd | ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
(defsystem :eventbus
:author "noloop <[email protected]>"
:maintainer "noloop <[email protected]>"
:license "GPLv3"
:version "0.1.0"
:homepage "https://github.com/noloop/eventbus"
:bug-tracker "https://github.com/noloop/eventbus/issues"
:source-control (:git "[email protected]:noloop/eventbus.git")
:description "An event bus in Common Lisp."
:components ((:module "src"
:components
((:file "package")
(:file "eventbus" :depends-on ("package")))))
:in-order-to ((test-op (test-op "eventbus/test"))))
(defsystem :eventbus/test
:author "noloop <[email protected]>"
:maintainer "noloop <[email protected]>"
:license "GPLv3"
:description "eventbus Test."
:depends-on (:eventbus :simplet)
:defsystem-depends-on (:simplet-asdf)
:components ((:module "test"
:components
((:test-file "eventbus-test"))))
:perform (test-op (op c) (symbol-call :simplet '#:run)))
| 1,022 | Common Lisp | .asd | 26 | 33.730769 | 62 | 0.638833 | noloop/eventbus | 12 | 1 | 1 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 79e09838ebfc5abd9c0be74f9265dd9cd312f6b241b31d9e4a0683abafe1d415 | 10,252 | [
-1
] |
10,271 | main.lisp | rajasegar_ccl-demo-raja/main.lisp | (in-package #:cl-user)
(defvar *acceptor* nil)
(defun initialize-application (&key port)
(when *acceptor*
(hunchentoot:stop *acceptor*))
(setf *acceptor*
(hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port port))))
| 243 | Common Lisp | .lisp | 7 | 31.857143 | 76 | 0.737069 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 04b123962131dcf8c1f5b2bad504e16402eac7c607ac33224e1c55da1e0f3cd3 | 10,271 | [
329761
] |
10,272 | config.lisp | rajasegar_ccl-demo-raja/config.lisp | (in-package :ccl-demo-raja)
;; Config drakma
(push (cons "application" "json") drakma:*text-content-types*)
(setf drakma:*header-stream* *standard-output*)
| 159 | Common Lisp | .lisp | 4 | 38 | 62 | 0.743421 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 7310540f28ab8f2dd50976d3eb520dd969e43fd4ff6cabdda703e59024770da1 | 10,272 | [
-1
] |
10,273 | people-show.lisp | rajasegar_ccl-demo-raja/views/people-show.lisp | (in-package :ccl-demo-raja)
;; People show page
(defun people-show-page ()
(let ((person (cl-json:decode-json-from-string
(drakma:http-request (concatenate 'string "https://swapi.dev/api/people/" (get-id-from-uri))
:method :get))))
(format t "~a~%" person)
(demo-page (:title "People - Star Wars" :active "/people")
(:div :class "grid"
(:div
:class "left-panel"
(search-box (:url "/people/search"))
(:ul
:id "search-results"
:class "list"
(loop for character in (rest (assoc :results *people*))
for i from 1 to 10
do (htm
(:li
(:a
:class (if (string= (get-id-from-uri) (write-to-string i)) "active" nil)
:href (concatenate 'string "/people/" (write-to-string i))
(str (cdr (assoc :name character)))))))))
(:div
:class "right-panel"
(if (assoc :name person)
(htm
(:h2 (get-prop (:name person)))
(:table
(:tr (:td "Height:") (:td (cl-who:str (format-height (cdr (assoc :height person))))))
(:tr (:td "Mass:") (:td (get-prop (:mass person))))
(:tr (:td "Hair Color:") (:td (get-prop (:hair--color person))))
(:tr (:td "Skin Color:") (:td (get-prop (:skin--color person))))
(:tr (:td "Eye Color:") (:td (get-prop (:eye--color person))))
(:tr (:td "Birth Year:") (:td (get-prop (:birth--year person))))
(:tr (:td "Gender:") (:td (get-prop (:gender person))))
(:tr (:td "Home world:") (:td (home-world (cdr (assoc :homeworld person)))))
(:tr (:td "Films:") (:td (get-films (cdr (assoc :films person)))))
(:tr (:td "Species:") (:td (get-species (cdr (assoc :species person)))))
(:tr (:td "Vehicles:") (:td (get-vehicles (cdr (assoc :vehicles person)))))
(:tr (:td "Starships:") (:td (get-starships (cdr (assoc :starships person)))))))
(htm (:h2 "Please select a character"))))))))
| 1,833 | Common Lisp | .lisp | 42 | 38.857143 | 99 | 0.5831 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | b8a7a34c4a04397cbb7fb214b6a734b8c82dabec15a82d54859dcfc9f4cf4ff2 | 10,273 | [
-1
] |
10,274 | vehicles.lisp | rajasegar_ccl-demo-raja/views/vehicles.lisp | (in-package :ccl-demo-raja)
;; Vehicles page
(defun vehicles-page ()
(setq *vehicles* (cl-json:decode-json-from-string
(drakma:http-request "https://swapi.dev/api/vehicles/"
:method :get)))
(demo-page (:title "Vehicles - Star Wars" :active "/vehicles")
(:div :class "grid"
(:div
:class "left-panel"
(search-box (:url "/vehicles/search"))
(list-component (rest (assoc :results *vehicles*)) "/vehicles/" :name))
(:div
:class "right-panel"
(:h2 "Please select a vehicle.")))))
| 524 | Common Lisp | .lisp | 15 | 30.6 | 75 | 0.644135 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | e986dd376396f67f967dea6ca6b4396f6b72ae5b0cdab3de7ba274f14369b013 | 10,274 | [
-1
] |
10,275 | films.lisp | rajasegar_ccl-demo-raja/views/films.lisp | (in-package :ccl-demo-raja)
;; Films page
(defun films-page ()
(setq *film-results* (cl-json:decode-json-from-string
(drakma:http-request "https://swapi.dev/api/films/"
:method :get)))
(demo-page (:title "Films - Star Wars" :active "/films")
(:div :class "grid"
(:div
:class "left-panel"
(list-component (rest (assoc :results *film-results*)) "/films/" :title))
(:div
:class "right-panel"
(:h2 "Please select a film.")))))
| 471 | Common Lisp | .lisp | 14 | 29.214286 | 77 | 0.625551 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | d2351ef0f0e8069d9d1cb80f1c9d9c29813b3b5261bffbbf731efa6be6b6e296 | 10,275 | [
-1
] |
10,276 | films-show.lisp | rajasegar_ccl-demo-raja/views/films-show.lisp | (in-package :ccl-demo-raja)
(setq *films* '(("https://swapi.dev/api/films/1/" . "https://m.media-amazon.com/images/M/MV5BYTRhNjcwNWQtMGJmMi00NmQyLWE2YzItODVmMTdjNWI0ZDA2XkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY999_SX666_AL_.jpg")
("https://swapi.dev/api/films/2/" . "https://m.media-amazon.com/images/M/MV5BMDAzM2M0Y2UtZjRmZi00MzVlLTg4MjEtOTE3NzU5ZDVlMTU5XkEyXkFqcGdeQXVyNDUyOTg3Njg@._V1_SY999_CR0,0,659,999_AL_.jpg")
("https://swapi.dev/api/films/3/" . "https://m.media-amazon.com/images/M/MV5BNTc4MTc3NTQ5OF5BMl5BanBnXkFtZTcwOTg0NjI4NA@@._V1_SY1000_SX750_AL_.jpg")
("https://swapi.dev/api/films/4/" . "https://m.media-amazon.com/images/M/MV5BNzVlY2MwMjktM2E4OS00Y2Y3LWE3ZjctYzhkZGM3YzA1ZWM2XkEyXkFqcGdeQXVyNzkwMjQ5NzM@._V1_.jpg")
("https://swapi.dev/api/films/5/" . "https://m.media-amazon.com/images/M/MV5BYmU1NDRjNDgtMzhiMi00NjZmLTg5NGItZDNiZjU5NTU4OTE0XkEyXkFqcGdeQXVyNzkwMjQ5NzM@._V1_SY1000_CR0,0,641,1000_AL_.jpg")
("https://swapi.dev/api/films/6/" . "https://m.media-amazon.com/images/M/MV5BOWZlMjFiYzgtMTUzNC00Y2IzLTk1NTMtZmNhMTczNTk0ODk1XkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY999_CR0,0,644,999_AL_.jpg")
("https://swapi.dev/api/films/7/" . "https://m.media-amazon.com/images/M/MV5BOTAzODEzNDAzMl5BMl5BanBnXkFtZTgwMDU1MTgzNzE@._V1_SY1000_CR0,0,677,1000_AL_.jpg")
("https://swapi.dev/api/films/8/" . "https://m.media-amazon.com/images/M/MV5BMjQ1MzcxNjg4N15BMl5BanBnXkFtZTgwNzgwMjY4MzI@._V1_SY1000_CR0,0,675,1000_AL_.jpg")))
;; Films show page
(defun films-show-page ()
(let ((film (cl-json:decode-json-from-string
(drakma:http-request (concatenate 'string "https://swapi.dev/api/films/" (get-id-from-uri))
:method :get))))
(format t "~a~%" film)
(demo-page (:title "Films - Star Wars" :active "/films")
(:div :class "grid"
(:div
:class "left-panel"
(list-component (rest (assoc :results *film-results*)) "/films/" :title))
(:div
:class "right-panel"
(if (assoc :title film)
(htm
(:h2 (get-prop (:title film)))
(:table
(:tr (:td "Episode:") (:td (get-prop (:episode--id film))))
(:tr (:td "Director:") (:td (get-prop (:director film))))
(:tr (:td "Producer:") (:td (get-prop (:producer film))))
(:tr (:td "Release Date:") (:td (get-prop (:release--date film)))))
(:p
(:img
:width "500"
:src (cdr (assoc (cdr (assoc :url film)) *films* :test #'string=)))))
(htm (:h2 "Please select a character"))))))))
| 2,410 | Common Lisp | .lisp | 35 | 64.685714 | 195 | 0.699029 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 82502a42abfabc23e8f82374ae6c97ce72337208fef46b468087bba62750ad6d | 10,276 | [
-1
] |
10,277 | layout.lisp | rajasegar_ccl-demo-raja/views/layout.lisp | (in-package :ccl-demo-raja)
(defmacro demo-page ((&key title active) &body body)
`(with-html-output-to-string
(*standard-output* nil :prologue t :indent t)
(:html :lang "en"
(:head
(:meta :charset "utf-8")
(:title, title)
(:link :href "/styles.css" :rel "stylesheet")
)
(:body
(:nav
(:ul
(nav-link (:url "/" :active ,active) "Star Wars")
(nav-link (:url "/people" :active ,active) "People")
(nav-link (:url "/planets" :active ,active) "Planets")
(nav-link (:url "/vehicles" :active ,active) "Vehicles")
(nav-link (:url "/starships" :active ,active) "Starships")
(nav-link (:url "/films" :active ,active) "Films")))
(:main ,@body)
(:script :src "https://unpkg.com/[email protected]")
(:script :src "https://unpkg.com/[email protected]")
))))
| 877 | Common Lisp | .lisp | 23 | 31.26087 | 66 | 0.56272 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | d8736c9b79ebee482798cbbd9286081d808f3724220302435b8f4502dea9ab2e | 10,277 | [
-1
] |
10,278 | starships-show.lisp | rajasegar_ccl-demo-raja/views/starships-show.lisp | (in-package :ccl-demo-raja)
;; Starships show page
(defun starships-show-page ()
(let ((starship (cl-json:decode-json-from-string
(drakma:http-request (concatenate 'string "https://swapi.dev/api/starships/" (get-id-from-uri))
:method :get))))
(format t "~a~%" starship)
(demo-page (:title "Starships - Star Wars" :active "/starships")
(:div :class "grid"
(:div
:class "left-panel"
(search-box (:url "/starships/search"))
(list-component (rest (assoc :results *starships*)) "/starships/" :name))
(:div
:class "right-panel"
(if (assoc :name starship)
(htm
(:h2 (get-prop (:name starship)))
(:table
(:tr (:td "Model:") (:td (get-prop (:model starship))))
(:tr (:td "Starship Class:") (:td (get-prop (:starship--class starship))))
(:tr (:td "Manufacturer:") (:td (get-prop (:manufacturer starship))))
(:tr (:td "Length:") (:td (get-prop (:length starship))))
(:tr (:td "Cost in credits:") (:td (format-number (cdr (assoc :cost--in--credits starship)))))
(:tr (:td "Crew:") (:td (get-prop (:crew starship))))
(:tr (:td "Passengers:") (:td (get-prop (:passengers starship))))
(:tr (:td "Max. Atmosphering Speed:") (:td (get-prop (:max--atmosphering--speed starship))))
(:tr (:td "Hyperdrive rating:") (:td (get-prop (:hyperdrive--rating starship))))
(:tr (:td "MGLT:") (:td (get-prop (:mglt starship))))
(:tr (:td "Cargo capacity:") (:td (format-number (cdr (assoc :cargo--capacity starship)))))
(:tr (:td "Consumables:") (:td (get-prop (:consumables starship))))
(:tr (:td "Films:") (:td (get-films (cdr (assoc :films starship)))))
(:tr (:td "Pilots:") (:td (get-residents (cdr (assoc :pilots starship)))))))
(htm (:h2 "Please select a starship"))))))))
| 1,765 | Common Lisp | .lisp | 34 | 47.5 | 102 | 0.610307 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 796da5254f90ebf4068e96d26372c7e614b97da9912fb731b6fbaac3e69ee8b2 | 10,278 | [
-1
] |
10,279 | vehicles-show.lisp | rajasegar_ccl-demo-raja/views/vehicles-show.lisp | (in-package :ccl-demo-raja)
;; Vehicles show page
(defun vehicles-show-page ()
(let ((vehicle (cl-json:decode-json-from-string
(drakma:http-request (concatenate 'string "https://swapi.dev/api/vehicles/" (get-id-from-uri))
:method :get))))
(format t "~a~%" vehicle)
(demo-page (:title "Vehicles - Star Wars" :active "/vehicles")
(:div :class "grid"
(:div
:class "left-panel"
(search-box (:url "/vehicles/search"))
(list-component (rest (assoc :results *vehicles*)) "/vehicles/" :name))
(:div
:class "right-panel"
(if (assoc :name vehicle)
(htm
(:h2 (get-prop (:name vehicle)))
(:table
(:tr (:td "Model:") (:td (get-prop (:model vehicle))))
(:tr (:td "Vehicle Class:") (:td (get-prop (:vehicle--class vehicle))))
(:tr (:td "Manufacturer:") (:td (get-prop (:manufacturer vehicle))))
(:tr (:td "Length:") (:td (get-prop (:length vehicle))))
(:tr (:td "Cost in credits:") (:td (format-number (cdr (assoc :cost--in--credits vehicle)))))
(:tr (:td "Crew:") (:td (get-prop (:crew vehicle))))
(:tr (:td "Passengers:") (:td (get-prop (:passengers vehicle))))
(:tr (:td "Max. Atmosphering Speed:") (:td (get-prop (:max--atmosphering--speed vehicle))))
(:tr (:td "Cargo capacity:") (:td (get-prop (:cargo--capacity vehicle))))
(:tr (:td "Consumables:") (:td (get-prop (:consumables vehicle))))
(:tr (:td "Films:") (:td (get-films (cdr (assoc :films vehicle)))))
(:tr (:td "Pilots:") (:td (get-people (cdr (assoc :pilots vehicle)))))))
(htm (:h2 "Please select a vehicle"))))))))
| 1,577 | Common Lisp | .lisp | 32 | 44.84375 | 101 | 0.602855 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 1859015336650d8fa006d572d48daeebb301406fbcbb5957592f9e9988e9e7ce | 10,279 | [
-1
] |
10,280 | planets-show.lisp | rajasegar_ccl-demo-raja/views/planets-show.lisp | (in-package :ccl-demo-raja)
;; Planets show page
(defun planets-show-page ()
(format t "ID: ~a~%" (get-id-from-uri))
(let ((planet (cl-json:decode-json-from-string
(drakma:http-request (concatenate 'string "https://swapi.dev/api/planets/" (get-id-from-uri))
:method :get))))
(demo-page (:title "Planets - Star Wars" :active "/planets")
(:div :class "grid"
(:div
:class "left-panel"
(search-box (:url "/planets/search"))
(:ul :id "search-results"
:class "list"
(loop for planet-item in (rest (assoc :results *planets*))
for i from 1 to 10
do (htm
(:li
(:a
:class (if (string= (get-id-from-uri) (write-to-string i)) "active" nil)
:href (concatenate 'string "/planets/" (write-to-string i))
(str (cdr (assoc :name planet-item)))))))))
(:div
:class "right-panel"
(if (assoc :name planet)
(htm
(:h2 (str (cdr (assoc :name planet))))
(:table
(:tr (:td "Diameter:") (:td (format-diameter (cdr (assoc :diameter planet)))))
(:tr (:td "Rotation Period:") (:td (str (cdr (assoc :rotation--period planet)))))
(:tr (:td "Orbital Period:") (:td (str (cdr (assoc :orbital--period planet)))))
(:tr (:td "Gravity:") (:td (str (cdr (assoc :gravity planet)))))
(:tr (:td "Population:") (:td (format-number (cdr (assoc :population planet)))))
(:tr (:td "Climate:") (:td (str (cdr (assoc :climate planet)))))
(:tr (:td "Terrain:") (:td (str (cdr (assoc :terrain planet)))))
(:tr (:td "Surface Water:") (:td (str (cdr (assoc :surface--water planet)))))
(:tr (:td "Residents:") (:td (get-people (cdr (assoc :residents planet)))))
(:tr (:td "Films:") (:td (get-films (cdr (assoc :films planet)))))))
(htm (:h2 "Please select a planet"))))))))
| 1,808 | Common Lisp | .lisp | 39 | 40.512821 | 96 | 0.579513 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | b4917d5f27d99c8bccbd7538e55bfef28d276b2fa2e6f398cb15baf814bdfb8d | 10,280 | [
-1
] |
10,281 | starships.lisp | rajasegar_ccl-demo-raja/views/starships.lisp | (in-package :ccl-demo-raja)
;; Starships page
(defun starships-page ()
(setq *starships* (cl-json:decode-json-from-string
(drakma:http-request "https://swapi.dev/api/starships/"
:method :get)))
(demo-page (:title "Starships - Star Wars" :active "/starships")
(:div :class "grid"
(:div
:class "left-panel"
(search-box (:url "/starships/search"))
(list-component (rest (assoc :results *starships*)) "/starships/" :name))
(:div
:class "right-panel"
(:h2 "Please select a starship.")))))
| 534 | Common Lisp | .lisp | 15 | 31.266667 | 77 | 0.651072 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 6213ce7ffec52e794b78ed96ba0dbebc472bdbfcf7f885d81db45c6f3117b6e0 | 10,281 | [
-1
] |
10,282 | planets.lisp | rajasegar_ccl-demo-raja/views/planets.lisp | (in-package :ccl-demo-raja)
;; Planets page
(defun planets-page ()
(setq *planets* (cl-json:decode-json-from-string
(drakma:http-request "https://swapi.dev/api/planets/"
:method :get)))
(demo-page (:title "Planets - Star Wars" :active "/planets")
(:div :class "grid"
(:div
:class "left-panel"
(search-box (:url "/planets/search"))
(list-component (rest (assoc :results *planets*)) "/planets/" :name))
(:div
:class "right-panel"
(:h2 "Please select a planet.")))))
| 514 | Common Lisp | .lisp | 15 | 29.933333 | 73 | 0.636917 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 46a25ecc7a000c2ea57fb5a3ce61d96c339662e79590c4598543b7076a4221d1 | 10,282 | [
-1
] |
10,283 | people.lisp | rajasegar_ccl-demo-raja/views/people.lisp | (in-package :ccl-demo-raja)
;; People page
(defun people-page ()
(setq *people* (cl-json:decode-json-from-string
(drakma:http-request "https://swapi.dev/api/people/"
:method :get)))
(demo-page (:title "People - Star Wars" :active "/people")
(:div :class "grid"
(:div
:class "left-panel"
(search-box (:url "/people/search"))
(:ul
:id "search-results"
:class "list"
(loop for character in (rest (assoc :results *people*))
for i from 1 to 10
do (htm
(:li
(:a
:href (concatenate 'string "/people/" (write-to-string i))
(str (cdr (assoc :name character)))))))))
(:div
:class "right-panel"
(:h2 "Please select a character")))))
| 720 | Common Lisp | .lisp | 24 | 24.916667 | 61 | 0.598846 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 18b1080e38bf8000e5b01785c2cded43a82193676753b8fb1920116c65d2dc5d | 10,283 | [
-1
] |
10,284 | home.lisp | rajasegar_ccl-demo-raja/views/home.lisp | (in-package :ccl-demo-raja)
;; Home page
(defun home-page ()
(demo-page (:title "Star Wars - Common Lisp demo" :active "/")
(:div :class "home-wrapper"
(:h1 "Star Wars demo app in Common Lisp")
(:p (:a :href "https://github.com/rajasegar/ccl-demo-raja" "Github Source code"))
(:p "Built with: ")
(:p (:a :href "https://lisp-lang.org" "Common Lisp"))
(:p (:a :href "https://htmx.org" "HTMX"))
(:p (:a :href "https://hyperscript.org" "hyperscript"))
(:p "Server: " (:a :href "https://edicl.github.io/hunchentoot/" "Hunchentoot"))
(:p "API: " (:a :href "https://swapi.dev" "SWAPI.dev"))
(:p (:img :src "lisp-logo120x80.png")))))
| 660 | Common Lisp | .lisp | 14 | 43.714286 | 84 | 0.607752 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 62fdf126f8c0cb64e3c485bb0b27979970fbd417c73177ebdc31e115fb852bc5 | 10,284 | [
-1
] |
10,285 | utils.lisp | rajasegar_ccl-demo-raja/src/utils.lisp | (in-package :ccl-demo-raja)
(defun get-id-from-uri ()
"Returns the ID from the URI request."
(car (cl-ppcre:all-matches-as-strings "[0-9]+" (request-uri *request*))))
(defmacro nav-link ((&key url active) &body body)
"Nav link component"
`(htm
(:li (:a :href ,url :class (if (string= ,active ,url) "active" nil) ,@body))))
(defmacro search-box ((&key url))
"Search box component"
`(htm
(:div
:class "search-wrapper"
(:label :for "search-box" "Search:")
(:div
:class "search-box"
(:input
:id "search-box"
:name "search"
:class "search-field"
:type "text"
:hx-post, url
:hx-trigger "keyup changed delay:500ms"
:hx-target "#search-results"
:hx-indicator ".htmx-indicator")))
(:div :id "loading-search" :class "htmx-indicator" "Loading...")))
(setq *films* '(("https://swapi.dev/api/films/1/" . "https://m.media-amazon.com/images/M/MV5BYTRhNjcwNWQtMGJmMi00NmQyLWE2YzItODVmMTdjNWI0ZDA2XkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY999_SX666_AL_.jpg")
("https://swapi.dev/api/films/2/" . "https://m.media-amazon.com/images/M/MV5BMDAzM2M0Y2UtZjRmZi00MzVlLTg4MjEtOTE3NzU5ZDVlMTU5XkEyXkFqcGdeQXVyNDUyOTg3Njg@._V1_SY999_CR0,0,659,999_AL_.jpg")
("https://swapi.dev/api/films/3/" . "https://m.media-amazon.com/images/M/MV5BNTc4MTc3NTQ5OF5BMl5BanBnXkFtZTcwOTg0NjI4NA@@._V1_SY1000_SX750_AL_.jpg")
("https://swapi.dev/api/films/4/" . "https://m.media-amazon.com/images/M/MV5BNzVlY2MwMjktM2E4OS00Y2Y3LWE3ZjctYzhkZGM3YzA1ZWM2XkEyXkFqcGdeQXVyNzkwMjQ5NzM@._V1_.jpg")
("https://swapi.dev/api/films/5/" . "https://m.media-amazon.com/images/M/MV5BYmU1NDRjNDgtMzhiMi00NjZmLTg5NGItZDNiZjU5NTU4OTE0XkEyXkFqcGdeQXVyNzkwMjQ5NzM@._V1_SY1000_CR0,0,641,1000_AL_.jpg")
("https://swapi.dev/api/films/6/" . "https://m.media-amazon.com/images/M/MV5BOWZlMjFiYzgtMTUzNC00Y2IzLTk1NTMtZmNhMTczNTk0ODk1XkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_SY999_CR0,0,644,999_AL_.jpg")
("https://swapi.dev/api/films/7/" . "https://m.media-amazon.com/images/M/MV5BOTAzODEzNDAzMl5BMl5BanBnXkFtZTgwMDU1MTgzNzE@._V1_SY1000_CR0,0,677,1000_AL_.jpg")
("https://swapi.dev/api/films/8/" . "https://m.media-amazon.com/images/M/MV5BMjQ1MzcxNjg4N15BMl5BanBnXkFtZTgwNzgwMjY4MzI@._V1_SY1000_CR0,0,675,1000_AL_.jpg")))
(defmacro get-films (films)
`(loop for film in ,films
do (htm
(:img :width "100" :style "margin:1em;" :src (cdr (assoc film *films* :test #'string=))))))
(defmacro get-prop ((key obj))
`(str (cdr (assoc ,key ,obj))))
(defun format-height (height)
(concatenate 'string height " cm (" (write-to-string (* (parse-integer height) 0.0328084)) " ft)"))
(defmacro format-diameter (diameter)
`(str
(concatenate 'string ,diameter " Kilometers (" (write-to-string (* (parse-integer ,diameter) 0.621371)) " Miles)")))
(defmacro format-number (n)
`(str (if (string= "unknown" ,n)
"unknown"
(concatenate 'string ,n " (" (format nil "~r" (parse-integer ,n)) ")"))))
(defmacro home-world (url)
`(htm (:a
:_ (concatenate 'string "on load fetch " ,url " as json put it.name into my.innerHTML")
:href (concatenate 'string "/planets/" (cl-ppcre:scan-to-strings "[0-9]+" ,url))
"Loading...")))
(defmacro get-vehicles (vehicles)
`(loop for url in ,vehicles
do (htm
(:p
(:a
:_ (concatenate 'string "on load fetch " url " as json put it.name into my.innerHTML")
:href (concatenate 'string "/vehicles/" (cl-ppcre:scan-to-strings "[0-9]+" url)) "Loading...")))))
(defmacro get-starships (starships)
`(loop for url in ,starships
do (htm
(:p
(:a
:_ (concatenate 'string "on load fetch " url " as json put it.name into my.innerHTML")
:href (concatenate 'string "/starships/" (cl-ppcre:scan-to-strings "[0-9]+" url)) "Loading...")))))
(defmacro get-species (species)
`(loop for url in ,species
do (htm
(:p
(:a
:_ (concatenate 'string "on load fetch " url " as json put it.name into my.innerHTML")
:href (concatenate 'string "/species/" (cl-ppcre:scan-to-strings "[0-9]+" url)) "Loading...")))))
(defmacro get-people (people)
`(loop for url in ,people
do (htm
(:p
(:a
:_ (concatenate 'string "on load fetch " url " as json put it.name into my.innerHTML")
:href (concatenate 'string "/people/" (cl-ppcre:scan-to-strings "[0-9]+" url)) "Loading...")))))
(defmacro list-component (items url name)
`(htm (:ul :id "search-results"
:class "list"
(loop for item in ,items
do
(let ((id (cl-ppcre:scan-to-strings "[0-9]+" (cdr (assoc :url item)))))
(htm
(:li
(:a
:class (if (string= (get-id-from-uri) id) "active" nil)
:href (concatenate 'string ,url id)
(str (cdr (assoc ,name item)))))))))))
| 4,720 | Common Lisp | .lisp | 94 | 45.680851 | 195 | 0.665148 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 4100c4db6824f281b4de43c6c89d5a9b70be1007619fc9535f89bdd13f629a4c | 10,285 | [
-1
] |
10,286 | controllers.lisp | rajasegar_ccl-demo-raja/src/controllers.lisp | (in-package :ccl-demo-raja)
;; Define hunchentoot dispatch table
(setq *dispatch-table*
(list
(create-regex-dispatcher "^/$" 'home-page)
(create-regex-dispatcher "^/planets$" 'planets-page)
(create-regex-dispatcher "^/planets/search$" 'planets-search)
(create-regex-dispatcher "^/planets/[0-9]+$" 'planets-show-page)
(create-regex-dispatcher "^/people$" 'people-page)
(create-regex-dispatcher "^/people/search$" 'people-search)
(create-regex-dispatcher "^/people/[0-9]+$" 'people-show-page)
(create-regex-dispatcher "^/vehicles$" 'vehicles-page)
(create-regex-dispatcher "^/vehicles/search$" 'vehicles-search)
(create-regex-dispatcher "^/vehicles/[0-9]+$" 'vehicles-show-page)
(create-regex-dispatcher "^/starships$" 'starships-page)
(create-regex-dispatcher "^/starships/search$" 'starships-search)
(create-regex-dispatcher "^/starships/[0-9]+$" 'starships-show-page)
(create-regex-dispatcher "^/films$" 'films-page)
(create-regex-dispatcher "^/films/search$" 'films-search)
(create-regex-dispatcher "^/films/[0-9]+$" 'films-show-page)
(create-static-file-dispatcher-and-handler "/styles.css" "static/styles.css")
(create-static-file-dispatcher-and-handler "/lisp-logo120x80.png" "static/lisp-logo120x80.png")))
(defun planets-search ()
(let ((search (parameter "search")))
(search-page search "planets")))
(defun people-search ()
(let ((search (parameter "search")))
(search-page search "people")))
(defun vehicles-search ()
(let ((search (parameter "search")))
(search-page search "vehicles")))
(defun starships-search ()
(let ((search (parameter "search")))
(search-page search "starships")))
(defun films-search ()
(let ((search (parameter "search")))
(search-page search "films")))
;; Search page
(defun search-page (query resource)
(setq *search-results* (cl-json:decode-json-from-string
(drakma:http-request (concatenate 'string "https://swapi.dev/api/" resource "/?search=" query)
:method :get)))
(format t "~a~%" *search-results*)
(cl-who:with-html-output-to-string (output nil :prologue nil)
(loop for p in (rest (assoc :results *search-results*))
do
(cl-who:htm (:li
(:a :href (concatenate 'string "/" resource "/" (cl-ppcre:scan-to-strings "[0-9]+" (cdr (assoc :url p))))
(cl-who:str (cdr (assoc :name p)))))))))
| 2,448 | Common Lisp | .lisp | 49 | 44.489796 | 111 | 0.660117 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 0c7f706476b620f45df8072b9e17531f53c67c6c5780806cd6902607b774332b | 10,286 | [
-1
] |
10,287 | ccl-demo-raja.asd | rajasegar_ccl-demo-raja/ccl-demo-raja.asd | (asdf:defsystem #:ccl-demo-raja
:description "Starwars api demo in Common Lisp"
:author "Rajasegar Chandran"
:license "GNU Lesser Public License 3.0"
:version "0.0.1"
:serial t
:depends-on (#:hunchentoot #:cl-who #:cl-json #:drakma #:cl-ppcre)
:components ((:file "package")
(:file "config")
(:file "main")
(:module :src
:serial t
:components ((:file "controllers")
(:file "utils")))
(:module :views
:serial t
:components ((:file "layout")
(:file "home")
(:file "people")
(:file "people-show")
(:file "planets")
(:file "planets-show")
(:file "vehicles")
(:file "vehicles-show")
(:file "starships")
(:file "starships-show")
(:file "films")
(:file "films-show")))))
| 822 | Common Lisp | .asd | 28 | 22.75 | 68 | 0.556675 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 8e5be4f7aec1653b9e2897bcb151393d3291a1b526aa182ba05cdc73b80b5652 | 10,287 | [
-1
] |
10,292 | .gitlab-ci.yml | rajasegar_ccl-demo-raja/.gitlab-ci.yml | image: debian
shellcheck:
script:
- ./bin/ci-shellcheck
compile:
script:
- ./bin/ci-compile | 103 | Common Lisp | .l | 7 | 12.142857 | 25 | 0.690722 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 6ab8190107e0d98eccb344e3295659a23e4f3dffb21ba025591432e60869d666 | 10,292 | [
-1
] |
10,296 | ci-compile | rajasegar_ccl-demo-raja/bin/ci-compile | #!/usr/bin/env bash
CL_IMPL=ccl-bin
apt-get update
apt-get install -y autoconf build-essential git libcurl4-openssl-dev
git clone -b release https://github.com/roswell/roswell.git
pushd roswell || exit
sh bootstrap
./configure --prefix ~/.local/
make
make install
export PATH=$PATH:~/.local/bin/
ros setup
ros install "$CL_IMPL"
ros use "$CL_IMPL"
popd || exit
ros run --asdf --eval '(load "heroku-compile.lisp") (initialize-application :port 5432)' --quit
| 461 | Common Lisp | .l | 16 | 27.5625 | 95 | 0.764172 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 329da218f503baca4145df320cf4137f69626521b02a2763134d4f363fe523fb | 10,296 | [
-1
] |
10,297 | ci-shellcheck | rajasegar_ccl-demo-raja/bin/ci-shellcheck | #!/bin/sh
set -e
apt-get update
apt-get install -y shellcheck
for subscript in bin/*; do
shellcheck "$subscript"
done
| 123 | Common Lisp | .l | 7 | 15.857143 | 29 | 0.769912 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 4a74b2dc1bb1c72e07b86b5295f5b505696951f1e406d35e855af774861f5809 | 10,297 | [
-1
] |
10,312 | styles.css | rajasegar_ccl-demo-raja/static/styles.css | @charset "UTF-8";
:root {
--color-primary: #011627;
--color-secondary: #8b8c8a;
--color-danger: #e71d36;
--color-warning: #ff9f1c;
--color-info: #2ec4b6;
--color-background: #182b3a;
--color-black: #171817;
--color-overlay: rgba(253, 255, 252, 0.8);
--color-ember: #e04e39;
--color-burnt-ember: #9b2918;
--color-ember-white: #fdfdfd;
--color-white: #fff;
}
* {
margin:0;
padding:0;
border: none;
}
body {
font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif;
background: var(--color-ember);
}
a {
color: var(--color-white);
text-decoration: none;
}
nav {
border-bottom: 10px solid var(--color-ember);
}
nav ul {
display:flex;
background: var(--color-burnt-ember);
align-items:start;
}
li {
list-style: none;
}
nav ul li {
height: 3em;
}
nav a, nav span {
padding: 1em;
line-height:3em;
}
nav a.active, nav a:hover {
background: var(--color-ember);
color: var(--color-white);
}
#main {
text-align: center;
color: white;
}
.list a {
cursor: pointer;
padding:0.5em 1em;
display: block;
}
.list a:hover {
background: var(--color-burnt-ember);
}
.list a.active {
background: var(--color-white);
color: var(--color-ember);
}
.grid {
display: grid;
grid-template-columns: 300px 1fr;
}
.left-panel {
}
.right-panel {
padding: 1em;
background: var(--color-white);
color: var(--color-ember);
/*height: 100vh;*/
}
.right-panel a {
color: var(--color-ember);
}
table td {
padding: .5em;
}
table tr td:nth-child(1) {
font-weight: bold;
color: var(--color-burnt-ember);
}
table tr::odd {
background: var(--color-burnt-ember);
}
table tr:even {
background: var(--color-ember);
}
table a {
text-decoration: underline;
cursor: pointer;
padding:.25em;
}
.loader {
display: flex;
justify-content: center;
align-items: center;
width: 100vh;
height: 100%;
}
.search-wrapper label {
margin-left: 1em;
color: white;
font-weight: bold;
}
.search-box {
display: grid;
grid-template-columns: 240px 42px;
}
.search-field {
padding: 1em;
width: 240px;
margin-left: 1em;
border-radius: .25em;
margin-bottom: 1em;
}
.clear-button {
float: right;
font-size: 1.5em;
height: 42px;
width: 42px;
border-radius: .25em;
cursor: pointer;
color: var(--color-burnt-ember);
}
#loading-search {
text-align: center;
font-weight: bold;
color: white;
}
.home-wrapper {
width: 100%;
text-align:center;
color: white;
}
.home-wrapper p {
margin: 1em;
}
.home-wrapper a {
text-decoration: underline;
}
| 2,608 | Common Lisp | .l | 147 | 15.088435 | 67 | 0.664609 | rajasegar/ccl-demo-raja | 18 | 1 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | ed4d4a692d7c71c7c68185c308b6f47102bf7f56e4414c551b12c73cf8ad0ec8 | 10,312 | [
-1
] |
10,327 | package.lisp | TheRiver_CL-HEAP/package.lisp | ;;; Copyright 2009-2010 Rudolph Neeser <[email protected]>
;;;
;;; This file is part of CL-HEAP
;;;
;;; CL-HEAP is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; CL-HEAP is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with CL-HEAP. If not, see <http://www.gnu.org/licenses/>.
;;;----------------------------------------------------------------
(defpackage #:cl-heap
(:use #:common-lisp)
(:export #:heap
#:binary-heap
#:fibonacci-heap
#:heap-key
#:heap-sorting-function
#:add-to-heap
#:add-all-to-heap
#:peep-at-heap
#:pop-heap
#:heap-size
#:empty-heap
#:is-empty-heap-p
#:merge-heaps
#:nmerge-heaps
#:decrease-key
#:delete-from-heap
#:binary-heap-extension-factor
#:priority-queue
#:empty-queue
#:queue-size
#:peep-at-queue
#:dequeue
#:enqueue
#:heap-error
#:key-error
#:fibonacci-test
#:binary-test
#:priority-queue-test)
(:documentation "An implementation of heap and priority queue data structures."))
| 1,504 | Common Lisp | .lisp | 48 | 27.666667 | 83 | 0.654219 | TheRiver/CL-HEAP | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 0a94e4d46c03d008b515765a8d945598a2590ba3cc85b162d40f8170dfe4340e | 10,327 | [
-1
] |
10,328 | binary-heap.lisp | TheRiver_CL-HEAP/binary-heap.lisp | ;;; Copyright 2009-2010 Rudolph Neeser <[email protected]>.
;;;
;;; This file is part of CL-HEAP
;;;
;;; CL-HEAP is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; CL-HEAP is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with CL-HEAP. If not, see <http://www.gnu.org/licenses/>.
;;;----------------------------------------------------------------
(in-package #:cl-heap)
;;;--------------------------------------------------------------------
(defclass binary-heap (heap)
((data :initform nil
:documentation "The heap's stored data.")
(extension-factor :initform 50
:accessor binary-heap-extension-factor
:documentation "The percentage at which the space
allocated for data in the heap should grow at
once that space has been exceeded."))
(:documentation "An implementation of a classic binary heap. This
uses the standard array-based implementation."))
(defmethod initialize-instance :after ((heap binary-heap) &key (size 50))
(with-slots (data) heap
(setf data (make-array size :adjustable t :fill-pointer 0))))
;;;--------------------------------------------------------------------
;;; Unexported functions
(declaim (inline children-positions))
(defun children-positions (position)
(declare (type integer position))
(check-type position (integer 0 *))
(values (1+ (* position 2))
(+ 2 (* position 2))))
(declaim (inline parent-position))
(defun parent-position (position)
(declare (type integer position))
(check-type position (integer 0 *))
(values (floor (/ (1- position) 2))))
(defgeneric percolate-down (heap position)
(:documentation "Used to move a value in the DATA array of a
BINARY-HEAP down the parent-child relationship hierarchy, and so
preserve heap-ordering.")
(:method ((heap binary-heap) (position integer))
(with-slots (data) heap
(labels ((choose-one (lhs rhs)
;; Of two nodes, returns the "least"
(cond
((>= rhs (length data))
lhs)
((compare-items heap
(aref data lhs)
(aref data rhs))
lhs)
(t
rhs))))
(multiple-value-bind (left-child right-child)
(children-positions position)
(when (and (< (children-positions position)
(length data))
(not
(and (compare-items heap
(aref data position)
(aref data left-child))
(or
(>= (1+ (children-positions position)) (length data))
(compare-items heap
(aref data position)
(aref data right-child))))))
(let ((chosen (choose-one left-child right-child)))
(rotatef (aref data position)
(aref data chosen))
(percolate-down heap chosen))))))))
(defgeneric percolate-up (heap position)
(:method ((heap binary-heap) (position integer))
(with-slots (data) heap
(cond
((and (/= position 0)
(not (compare-items heap
(aref data
(parent-position position))
(aref data position))))
(rotatef (aref data position)
(aref data (parent-position position)))
(percolate-up heap (parent-position position)))
(t
position)))))
;;;--------------------------------------------------------------------
;;; Exported functions
(defmethod heap-size ((heap binary-heap))
(length (slot-value heap 'data)))
(defmethod empty-heap ((heap binary-heap))
"Clears the heap. A constant time operation."
(with-slots (data) heap
(setf (fill-pointer data) 0))
heap)
(defmethod is-empty-heap-p ((heap binary-heap))
(with-slots (data) heap
(= (length data) 0)))
(defmethod peep-at-heap ((heap binary-heap))
"Returns the minimum object of the heap, without updating the
heap. This is an O(1) operation."
(with-slots (data) heap
(when (plusp (length data))
(aref data 0))))
(defmethod add-to-heap ((heap binary-heap) item)
"Inserts an item into a BINARY-HEAP. This is O(log(n)), n being the
number of items in the heap."
(with-slots (data
(factor extension-factor)) heap
(vector-push-extend item data (ceiling (* (/ factor 100) (array-total-size data))))
(values item (percolate-up heap (1- (length data))))))
(defmethod pop-heap ((heap binary-heap))
"Removes the minimum item from the heap. This is an O(log(n))
operation, where n is the number of items in the heap."
(with-slots (data) heap
(when (plusp (length data))
(let ((top (aref data 0)))
;; Place the last element into the root
(setf (aref data 0) (aref data (1- (length data))))
(decf (fill-pointer data))
(percolate-down heap 0)
top))))
(defmethod add-all-to-heap ((heap binary-heap) (items list))
"Adds all the items in the list into the BINARY-HEAP. This is a
O(n + log(n)) = O(n) operation. Returns the BINARY-HEAP."
(with-slots (data
(factor extension-factor)) heap
;; Add all items, which is linear time since no sorting occurs here.
(loop for item in items
do (vector-push-extend item data (ceiling (* (/ factor 100) (array-total-size data)))))
(loop for position from (parent-position (1- (length data))) downto 0
do (percolate-down heap position)))
heap)
(defmethod merge-heaps ((first binary-heap) (second binary-heap))
"Non-destructively merges two BINARY-HEAPs. This is an O(n + m +
log(n + m)) operation, n and m being the zies of the two heaps."
(unless (and (eq (heap-sorting-function first) (heap-sorting-function second))
(eq (heap-key first) (heap-key second)))
(error 'heap-error :message
"The two heaps do not using the same sorting function or key."))
(with-slots ((first-data data)) first
(with-slots ((second-data data)) second
(let* ((length (+ (length first-data) (length second-data)))
(result (make-instance 'binary-heap
:size length
:sort-fun (heap-sorting-function first)
:key (heap-key first))))
(with-slots (data) result
(setf (fill-pointer data) length
(subseq data 0 (length first-data)) first-data
(subseq data (length first-data)) second-data)
(when (plusp (length data))
(loop for position from (parent-position (1- (length data))) downto 0
do (percolate-down result position))))
result))))
(defmethod nmerge-heaps ((first binary-heap) (second binary-heap))
"Destructively merges two BINARY-HEAPs, and returns the
result. Where n and m are the sizes of each queue, this is an order
O(m + log(n + m) operation, unless an array resize is required, for
which it becomes O(n + m + log(n + m))."
(unless (and (eq (heap-sorting-function first) (heap-sorting-function second))
(eq (heap-key first) (heap-key second)))
(error 'heap-error
:message "The two heaps do not using the same sorting function or key."))
(with-slots ((first-data data)) first
(with-slots ((second-data data)) second
(let ((original-length (length first-data))
(length (+ (length first-data) (length second-data))))
(when (< (length first-data) length)
(adjust-array first-data length))
(setf (fill-pointer first-data) length
(subseq first-data 0 original-length) first-data
(subseq first-data original-length) second-data)
(when (plusp (length first-data))
(loop for position from (parent-position (1- (length first-data))) downto 0
do (percolate-down first position))))
first)))
(defmethod decrease-key ((heap binary-heap) (item-index integer) value)
"Deceases the key of the item pointed to by ITEM-INDEX. The index is
returned as the second value of ADD-TO-HEAP. The value of the item
at the index is changed to VALUE, which should be less than its old
value. This operation is O(log(n)), with n being the number of items
in the heap. Note that using a binary heap is not ideal for this
operation, since the item pointed to by any given index can be
changed by performing any heap operation. This function is provided
mostly for completeness."
(check-type item-index (integer 0 *))
(with-slots (data sort-fun key) heap
(unless (funcall sort-fun value (funcall key (aref data item-index)))
(error 'key-error
:message
(format nil
"The given value (~a) must be less than the current value (~a)."
value (funcall key (aref data item-index)))))
(cond
((not (eq (heap-key heap) #'identity))
(handler-case (funcall (heap-key heap)
(aref data item-index)
value)
(error (e)
(declare (ignore e))
(error 'key-error))))
(t
(setf (aref data item-index) value)))
(percolate-up heap item-index))
heap)
(defmethod delete-from-heap ((heap binary-heap) (item-index integer))
"Deltes an item from the heap. ITEM-INDEX is an index representing
the value to remove, and is the second value returned from
ADD-TO-HEAP. Note that running most HEAP functions can modify which
value is pointed to by ITEM-INDEX, so this function is given mostly
for completeness. Use a Fibonacci heap if this functionality is
important to you. This operation completes in O(log(n)) time, where
n is the number of items in the heap."
(check-type item-index (integer 0 *))
(with-slots (data) heap
(when (plusp (length data))
;; Place the last element into this position
(setf (aref data item-index) (aref data (1- (length data))))
(decf (fill-pointer data))
(percolate-down heap item-index)
heap)))
;;;-------------------------------------------------------------------- | 9,854 | Common Lisp | .lisp | 230 | 38.46087 | 94 | 0.662874 | TheRiver/CL-HEAP | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 5aaa761059670fe0534dc12bc423dcebd25ded724ecbb5fa2cd45cf656f6ed40 | 10,328 | [
-1
] |
10,329 | tests.lisp | TheRiver_CL-HEAP/tests.lisp | ;;; Copyright 2009-2010 Rudolph Neeser <[email protected]>
;;;
;;; This file is part of CL-HEAP
;;;
;;; CL-HEAP is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; CL-HEAP is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with CL-HEAP. If not, see <http://www.gnu.org/licenses/>.
;;;----------------------------------------------------------------
(in-package #:cl-heap)
;;;----------------------------------------------------------------
;;; Some general test functionss.
(defun test-merging (test-object heap-type)
(with-slots (heap) test-object
(let ((heap2 (make-instance heap-type)))
(add-all-to-heap heap2 '(4 1 5 3 6 2 7))
(add-all-to-heap heap '(11 9 12 8 10 13))
(let ((merged (merge-heaps heap heap2)))
;; Ensure that all three heaps still exist.
(loop for i from 1 to 13 do (xlunit:assert-equal i (pop-heap merged)))
(loop for i from 1 to 7 do (xlunit:assert-equal i (pop-heap heap2)))
(loop for i from 8 to 13 do (xlunit:assert-equal i (pop-heap heap)))))
(let ((max-heap (make-instance heap-type :sort-fun #'>))
(empty-heap (make-instance heap-type)))
;; Assert that a condition is thrown when the heaps differ in
;; key functions.
(add-all-to-heap max-heap '(5 6 7 8))
(add-all-to-heap heap '(1 2 3 4))
(xlunit:assert-condition 'heap-error (merge-heaps heap max-heap))
;; Ensure that nothing happens when merging empty heaps.
(merge-heaps heap empty-heap)
(merge-heaps empty-heap heap)
(merge-heaps empty-heap empty-heap))
;; Ensure that destructive merging works.
(let ((heap2 (make-instance heap-type)))
(add-all-to-heap heap2 '(4 1 5 3 6 2 7))
(empty-heap heap)
(add-all-to-heap heap '(11 9 12 8 10 13))
(let ((merged (nmerge-heaps heap heap2)))
;; Ensure that all three heaps still exist.
(loop for i from 1 to 13
do (xlunit:assert-equal i (pop-heap merged)))))))
(defun test-empty (test)
(with-slots (heap) test
(xlunit:assert-eql 0 (heap-size heap))
(add-to-heap heap 1)
(xlunit:assert-eql 1 (heap-size heap))
(empty-heap heap)
(xlunit:assert-eql 0 (heap-size heap))))
(defun test-adding (test)
(with-slots (heap) test
(xlunit:assert-eql 0 (heap-size heap))
(add-all-to-heap heap '(3 7 1 8 2 6 9 4 10 5))
(xlunit:assert-eql 10 (heap-size heap))
(xlunit:assert-eql 1 (peep-at-heap heap))
(xlunit:assert-eql 10 (heap-size heap))
(loop for i from 1 to 10
do (xlunit:assert-eql i (pop-heap heap)))))
;;;----------------------------------------------------------------
;;; This class just does some sanity testing with the priority
;;; queue. The priority queue is just a fibonacci heap, and so most of
;;; the testing will be done for that class.
(defclass priority-queue-test (xlunit:test-case)
(queue))
(defmethod xlunit:set-up ((test priority-queue-test))
(with-slots (queue) test
(setf queue (make-instance 'priority-queue))))
(defmethod xlunit:tear-down ((test priority-queue-test))
(with-slots (queue) test
(empty-queue queue)
(setf queue nil)))
;;;----------------------------------------------------------------
(xlunit:def-test-method order-test ((test priority-queue-test))
"A trivial test to just ensure some sanity with the priority queue."
(with-slots (queue) test
(enqueue queue 'test 15)
(enqueue queue 'this -5)
(enqueue queue 'a 10)
(enqueue queue 'is 5)
(xlunit:assert-equal (dequeue queue) 'this)
(xlunit:assert-equal (dequeue queue) 'is)
(xlunit:assert-equal (dequeue queue) 'a)
(xlunit:assert-equal (dequeue queue) 'test)))
;;;----------------------------------------------------------------
;;;----------------------------------------------------------------
(defclass fibonacci-test (xlunit:test-case)
(heap
node1
node2))
(defmethod xlunit:set-up ((test fibonacci-test))
(with-slots (heap node1 node2) test
(setf heap (make-instance 'fibonacci-heap))
(setf node1 (make-instance 'node :item 1))
(setf node2 (make-instance 'node :item 'a))
(concatenate-node-lists node1 (make-instance 'node :item 4))
(concatenate-node-lists node1 (make-instance 'node :item 3))
(concatenate-node-lists node1 (make-instance 'node :item 2))
(concatenate-node-lists node2 (make-instance 'node :item 'd))
(concatenate-node-lists node2 (make-instance 'node :item 'c))
(concatenate-node-lists node2 (make-instance 'node :item 'b))))
(defmethod xlunit:tear-down ((test fibonacci-test))
(with-slots (heap node1 node2) test
(empty-heap heap)
(setf heap nil
node1 nil
node2 nil)))
;;;----------------------------------------------------------------
(xlunit:def-test-method test-size ((test fibonacci-test))
"Ensures that the heap's size makes sense as items are added and
removed."
(with-slots (heap) test
(loop for i from 1 upto 1000
do
(add-to-heap heap (random 10000))
(xlunit:assert-equal (heap-size heap) i))
(pop-heap heap)
(xlunit:assert-equal (heap-size heap) 999)
(loop for i from 998 downto 0
do
(pop-heap heap)
(xlunit:assert-equal (heap-size heap) i))))
(xlunit:def-test-method test-node-lists ((test fibonacci-test))
"Ensures that the nodes in a heap act as circular lists."
(with-slots (node1 node2) test
(xlunit:assert-equal (node-item node1) 1)
(xlunit:assert-equal (node-item (node-next node1)) 2)
(xlunit:assert-equal (node-item (node-next (node-next node1))) 3)
(xlunit:assert-equal (node-item (node-next (node-next (node-next node1)))) 4)
(xlunit:assert-equal (node-item (node-next (node-next (node-next (node-next node1))))) 1)
(xlunit:assert-equal (node-item (node-last node1)) 4)
(xlunit:assert-equal (node-item (node-last (node-last node1))) 3)
(xlunit:assert-equal (node-item (node-last (node-last (node-last node1)))) 2)
(xlunit:assert-equal (node-item (node-last (node-last (node-last (node-last node1))))) 1)
(concatenate-node-lists node1 node2)
(loop
for answer in '(1 a b c d 2 3 4)
for actual = node1 then (node-next actual)
for i from 1 to 10
do
(xlunit:assert-equal answer (node-item actual)))
(xlunit:assert-equal 4 (node-item (node-last node1)))))
(xlunit:def-test-method test-node-deletes ((test fibonacci-test))
"Ensures that the nodes have things properly deleted."
(with-slots (node1) test
(let ((second (node-next node1)))
(delete-node second)
(do-each-node (n node1)
(xlunit:assert-not-eql n second))
(setf (node-child node1) (make-instance 'node :item 10)
(node-rank node1) 1
(node-parent (node-child node1)) node1)
(delete-node (node-child node1))
(xlunit:assert-equal 0 (node-rank node1)))))
(xlunit:def-test-method test-iteration ((test fibonacci-test))
"Ensures that a node list can be iterated through, while having items removed."
(with-slots (node1) test
(let ((items (list 1 2 3 4)))
(do-each-node (n node1)
(xlunit:assert-equal (pop items) (node-item n))
(delete-node n))
(xlunit:assert-true (null items)))))
(xlunit:def-test-method test-iteration-null ((test fibonacci-test))
"Ensures that we do not attempt to iterate on nil, which would give
an error."
(do-each-node (child nil)
nil))
(xlunit:def-test-method test-delete ((test fibonacci-test))
(with-slots (heap) test
(let ((keys (loop for i in '(0 1 3 2 4 5)
collect (second (multiple-value-list (add-to-heap heap i))))))
(pop-heap heap)
(pop keys)
;; test deleting the min.
(delete-from-heap heap (pop keys))
(xlunit:assert-equal (peep-at-heap heap) 2)
;; Delete the non-min item.
(delete-from-heap heap (pop keys))
(xlunit:assert-equal 2 (pop-heap heap))
(xlunit:assert-equal 4 (pop-heap heap))
(xlunit:assert-equal 5 (pop-heap heap)))))
(xlunit:def-test-method test-cascade ((test fibonacci-test))
"Ensures that cascading cuts occur as required. Builds up a tree and
goes through it, testing everything's rank. Then removes some items
and retests the ranks."
(with-slots (heap) test
(add-all-to-heap heap (loop for i from 1 upto 20 collect i))
(xlunit:assert-eql 1 (pop-heap heap))
(with-slots (root) heap
(xlunit:assert-equal (node-rank root) 0)
(xlunit:assert-equal (node-rank (node-next root)) 4)
(xlunit:assert-equal (node-rank (node-next (node-next root))) 1)
(delete-from-heap heap
(node-child (node-next (node-child (node-next root)))))
(delete-from-heap heap
(node-child (node-child
(node-next
(node-child (node-next root))))))
(delete-from-heap heap
(node-child (node-child (node-next (node-child (node-next root))))))
(xlunit:assert-equal (node-rank root) 0)
(xlunit:assert-equal (node-rank (node-next root)) 1)
(xlunit:assert-equal (node-rank (node-next (node-next root))) 0)
(xlunit:assert-equal (node-rank (node-next (node-next (node-next root)))) 0)
(xlunit:assert-equal (node-rank
(node-next (node-next (node-next (node-next root))))) 3)
(xlunit:assert-equal (node-rank
(node-next (node-next
(node-next (node-next (node-next root)))))) 1))))
(xlunit:def-test-method test-decrease-key ((test fibonacci-test))
(with-slots (heap) test
(let ((keys (loop for i in '(2 3 4 1 5 6)
collect (multiple-value-bind (val key) (add-to-heap heap i)
(declare (ignore val))
key))))
;; Check that decreasing a key in the root lists works.
(decrease-key heap (pop keys) 0)
(xlunit:assert-equal (pop-heap heap) 0)
;; Testing for when we have a parent
(decrease-key heap (pop keys) 0)
(xlunit:assert-equal (pop-heap heap) 0)
;; Test for errors
(xlunit:assert-condition 'key-error (decrease-key heap (pop keys) 5))
(xlunit:assert-equal (pop-heap heap) 1)
;; Test for when a non IDENTITY KEY is used.
(let ((heap (make-instance 'fibonacci-heap :key #'(lambda (item &optional val)
(if val
(setf (first item) val)
(first item))))))
(let ((keys (loop for i in (list (list 4 'a) (list 1 'b) (list 3 'c))
collect (multiple-value-bind (val key) (add-to-heap heap i)
(declare (ignore val))
key))))
(force-output)
(decrease-key heap (first keys) -1)
(xlunit:assert-equal (second (pop-heap heap)) 'a)))
;; Test that an error is thrown from decrease-key
(let* ((heap (make-instance 'fibonacci-heap :key #'first))
(key (second (multiple-value-list (add-to-heap heap '(1 a))))))
(xlunit:assert-condition 'key-error (decrease-key heap key 0))))))
(xlunit:def-test-method test-merge ((test fibonacci-test))
(test-merging test 'fibonacci-heap))
(xlunit:def-test-method test-adding ((test fibonacci-test))
(test-adding test))
(xlunit:def-test-method test-empty ((test fibonacci-test))
(test-empty test))
;;;----------------------------------------------------------------
;;;----------------------------------------------------------------
(defclass binary-test (xlunit:test-case)
(heap))
(defmethod xlunit:set-up ((test binary-test))
(with-slots (heap) test
(setf heap (make-instance 'binary-heap))))
(defmethod xlunit:tear-down ((test binary-test))
(with-slots (heap) test
(setf heap nil)))
;;;----------------------------------------------------------------
(xlunit:def-test-method test-positions ((test binary-test))
"Tests the functions which determine where in the array the children
and parents are."
;; This tests some parent sanity checks.
(xlunit:assert-eql 0 (parent-position 1))
(xlunit:assert-eql 0 (parent-position 2))
(xlunit:assert-eql 1 (parent-position 3))
;; Now we just check that the values of calculate child and parent positions agree.
(loop for i from 0 to 100
do (multiple-value-bind (left right)
(children-positions i)
(xlunit:assert-eql i (parent-position left))
(xlunit:assert-eql i (parent-position right)))))
(xlunit:def-test-method test-adding-popping ((test binary-test))
(test-adding test))
(xlunit:def-test-method test-empty ((test binary-test))
(test-empty test))
(xlunit:def-test-method test-merge ((test binary-test))
(test-merging test 'binary-heap))
(xlunit:def-test-method test-decrease-key ((test binary-test))
(with-slots (heap) test
(let* ((to-add '(1 2 3 4 5 6))
(keys (loop for i in to-add
collect (multiple-value-bind (val key) (add-to-heap heap i)
(declare (ignore val))
key))))
;; Check that decreasing a key in the root lists works.
(decrease-key heap (pop keys) -1)
(xlunit:assert-equal (pop-heap heap) -1)
;; Testing for when we have a parent
(empty-heap heap)
(add-all-to-heap heap to-add)
(decrease-key heap (pop keys) -1)
(xlunit:assert-equal (pop-heap heap) -1)
;; Test for errors
(empty-heap heap)
(add-all-to-heap heap to-add)
(xlunit:assert-condition 'key-error (decrease-key heap (pop keys) 5))
(xlunit:assert-equal (pop-heap heap) 1)
;; Test for when a non IDENTITY KEY is used.
(let* ((heap (make-instance 'binary-heap :key #'(lambda (item &optional val)
(if val
(setf (first item) val)
(first item))))))
(add-all-to-heap heap (list (list 2 'a) (list 1 'b) (list 3 'c)))
(xlunit:assert-equal (second (pop-heap heap)) 'b))
;; Test that an error is thrown from decrease-key
(let* ((heap (make-instance 'binary-heap :key #'first))
(key (second (multiple-value-list (add-to-heap heap '(1 a))))))
(xlunit:assert-condition 'key-error (decrease-key heap key 0))))))
(xlunit:def-test-method test-delete ((test binary-test))
(with-slots (heap) test
(add-all-to-heap heap '( 1 2 3 4 5 6))
(delete-from-heap heap 0)
(loop for i from 2 to 6 do (xlunit:assert-equal (pop-heap heap) i))))
;;;----------------------------------------------------------------
;;;----------------------------------------------------------------
| 14,537 | Common Lisp | .lisp | 321 | 40.548287 | 93 | 0.633352 | TheRiver/CL-HEAP | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 65784a3d335c4cbfdbe85d26ca498532ed2ad4e37b6320ba9a7827b788cb759c | 10,329 | [
-1
] |
10,330 | priority-queue.lisp | TheRiver_CL-HEAP/priority-queue.lisp | ;;; Copyright 2009-2010 Rudolph Neeser <[email protected]>
;;;
;;; This file is part of CL-HEAP
;;;
;;; CL-HEAP is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; CL-HEAP is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with CL-HEAP. If not, see <http://www.gnu.org/licenses/>.
;;;----------------------------------------------------------------
(in-package #:cl-heap)
;;;----------------------------------------------------------------
(defclass priority-queue ()
((heap))
(:documentation "A simple priority queue implementaiton, based on a
Fibonacci heap."))
(defmethod initialize-instance :after ((queue priority-queue) &key (sort-fun #'<))
(with-slots (heap) queue
(setf heap (make-instance 'fibonacci-heap :key #'first :sort-fun sort-fun))))
;;;----------------------------------------------------------------
(declaim (inline enqueue))
(defgeneric enqueue (queue item priority)
(:documentation "Adds an item with a given priority on to the
queue. Returns a list containing first the priority, then the
item. This is a constant time operation.")
(:method ((queue priority-queue) item priority)
(with-slots (heap) queue
(values (add-to-heap heap (list priority item))))))
(declaim (inline dequeue))
(defgeneric dequeue (queue)
(:documentation "Removes an element from the front of the queue and
returns it. This is an amortised O(log(n)) operation.")
(:method (queue)
(with-slots (heap) queue
(second (pop-heap heap)))))
(declaim (inline peep-at-queue))
(defgeneric peep-at-queue (queue)
(:documentation "Returns the element at the front of the queue,
without modifying the queue. This is a constant time operation.")
(:method ((queue priority-queue))
(with-slots (heap) queue
(second (peep-at-heap heap)))))
(declaim (inline empty-queue))
(defgeneric empty-queue (queue)
(:documentation "Removes all items from the queue. This is a constant time operation.")
(:method ((queue priority-queue))
(with-slots (heap) queue
(empty-heap heap))))
(declaim (inline queue-size))
(defgeneric queue-size (queue)
(:documentation "Returns the number of elements in the queue.")
(:method ((queue priority-queue))
(with-slots (heap) queue
(heap-size heap)))) | 2,721 | Common Lisp | .lisp | 61 | 41.901639 | 89 | 0.668302 | TheRiver/CL-HEAP | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | e6dc4638a3934c989777cffc28aba8a3ae88f967d5a2c92acca5f7b560f4f79b | 10,330 | [
-1
] |
10,331 | heap.lisp | TheRiver_CL-HEAP/heap.lisp | ;;; Copyright 2009-2010 Rudolph Neeser <[email protected]>.
;;; Copyright 2012 CL-HEAP (See AUTHORS file).
;;;
;;; This file is part of CL-HEAP
;;;
;;; CL-HEAP is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; CL-HEAP is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with CL-HEAP. If not, see <http://www.gnu.org/licenses/>.
;;;----------------------------------------------------------------
(in-package #:cl-heap)
;;;--------------------------------------------------------------------
;;; Some useful definitions: Through the use of SORT-FUN, each HEAP
;;; can be used as either a min or a max heap, or even as something
;;; abstract by defining an arbitrary total relation on the objects
;;; being inserted into the heap. For any relation R and two items x
;;; and y for which x R y is a true, we will call x the lesser of the
;;; two items.
;;; --------------------------------------------------------------------
(defclass heap ()
((sort-fun :initform #'<
:reader heap-sorting-function
:initarg :sort-fun
:documentation "The function used to apply an order to
elements in the heap.")
(key :initform #'identity
:reader heap-key
:initarg :key
:documentation "A function used to obtain the elements which
should be compared to give an order to the items in the
heap."))
(:documentation "The base type of the two HEAP implementations."))
;;;--------------------------------------------------------------------
;;; Exported functions.
(defgeneric heap-size (heap)
(:documentation "Returns the number of elements in the heap."))
(defgeneric add-to-heap (heap item)
(:documentation "Inserts an item into the given HEAP data
structure. Returns two values: first, the item added, and then an
index-key which can be used to identify the item for DECREASE-KEY
and DELETE-FROM-HEAP operations."))
(defgeneric add-all-to-heap (heap items)
(:documentation "Adds a list of items to a HEAP. This can typically
be done more efficiently than by using repeated calls to
ADD-TO-HEAP, since the heap order only needs to be reinstated after
all of the items have been inserted, rather than maintained through
each operation. Returns the heap object."))
(defgeneric peep-at-heap (heap)
(:documentation "Returns the heap's root, without modifying the
heap. Returns nil if the heap is empty."))
(defgeneric pop-heap (heap)
(:documentation "Removes the top element from the heap and returns
it."))
(defgeneric empty-heap (heap)
(:documentation "Removes all contents from the given heap. Returns the heap."))
(defgeneric is-empty-heap-p (heap)
(:documentation "Returns true iff the given heap is empty."))
(defgeneric merge-heaps (first second)
(:documentation "Returns a new heap that is the merged copy of those
given here. Can only merge heaps which use the same key and sorting
function. The two arguments are nt modified by this function."))
(defgeneric nmerge-heaps (first second)
(:documentation "Destructively updates the arguments to contain the
merge of both heaps, which is then returned. Can only merge heaps
which use the same key and sorting function."))
(defgeneric decrease-key (heap item-index value)
(:documentation "Decreases the value of the item represented by
ITEM-INDEX. ITEM-INDEX is the index returned by ADD-TO-HEAP for a
particular item. VALUE is the item's new value, and this must be
\"less\" than its old value. Returns the heap."))
(defgeneric delete-from-heap (heap item-index)
(:documentation "Removes the item from the heap represented by the
ITEM-INDEX. This index is returned as the second value of
ADD-TO-HEAP. Returns the heap."))
;;;--------------------------------------------------------------------
;;; Unexported functions
(defgeneric compare-items (heap parent child)
(:documentation "Compares two items, using the HEAP's SORT-FUN and
KEY functions.")
(:method ((heap heap) parent child)
(with-slots (sort-fun key) heap
(funcall sort-fun (funcall key parent) (funcall key child)))))
;;;--------------------------------------------------------------------
;;; Various implementation details
(defmethod print-object ((heap heap) stream)
(print-unreadable-object (heap stream :type t :identity t)
(format stream "Size: ~A" (heap-size heap))))
| 4,773 | Common Lisp | .lisp | 95 | 47.768421 | 81 | 0.680559 | TheRiver/CL-HEAP | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | fe2659fbb0dd088f7009562d66a9acd0b99779c4bb405cc866cb5f159e03a8f1 | 10,331 | [
-1
] |
10,332 | condition.lisp | TheRiver_CL-HEAP/condition.lisp | ;;; Copyright 2009-2010 Rudolph Neeser <[email protected]>.
;;;
;;; This file is part of CL-HEAP
;;;
;;; CL-HEAP is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; CL-HEAP is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with CL-HEAP. If not, see <http://www.gnu.org/licenses/>.
;;;----------------------------------------------------------------
(in-package #:cl-heap)
;;;----------------------------------------------------------------
(define-condition heap-error (error)
((message :initform "An error has occured while using this data structure."
:initarg :message
:reader heap-error-message))
(:documentation "The base condition type for all errors that should
generally be thrown in the CL-HEAP package.")
(:report (lambda (condition stream)
(format stream (heap-error-message condition)))))
(define-condition key-error (heap-error)
((message :initform "When using DECREASE-KEY, the HEAP-KEY function should always take two arguments."))) | 1,448 | Common Lisp | .lisp | 29 | 47.758621 | 107 | 0.669258 | TheRiver/CL-HEAP | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | b85c8f625539695291465976c5b6a0d28aab83730aa0d0fb6ae620ff092a0b88 | 10,332 | [
-1
] |
10,333 | fibonacci-heap.lisp | TheRiver_CL-HEAP/fibonacci-heap.lisp | ;;; Copyright 2009-2010 Rudolph Neeser <[email protected]>.
;;; Copyright 2012-2013 CL-HEAP (See AUTHORS file).
;;;
;;; This file is part of CL-HEAP
;;;
;;; CL-HEAP is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; CL-HEAP is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with CL-HEAP. If not, see <http://www.gnu.org/licenses/>.
;;;----------------------------------------------------------------
(in-package #:cl-heap)
;;;----------------------------------------------------------------
(defclass fibonacci-heap (heap)
((root :initform nil
:documentation "The minimum element in the tree.")
(count :initform 0
:documentation "The number of items in the heap."))
(:documentation "A heap made up of item-disjoint, heap-ordered
trees. Has some good time constraints on various heap operations."))
;;;----------------------------------------------------------------
(defclass node ()
((item :initform nil
:initarg :item
:accessor node-item)
(parent :initform nil
:accessor node-parent)
(child :initform nil
:accessor node-child)
(rank :initform 0
:accessor node-rank
:documentation "The number of children the node has.")
(marked :initform nil
:accessor node-marked-p
:documentation "Used to implement cascading cuts.")
(next :initform nil
:accessor node-next)
(last :initform nil
:accessor node-last))
(:documentation "A class used for storing data in a FIBONACCI-HEAP."))
(defmethod initialize-instance :after ((node node) &key)
(with-slots (next last) node
(setf next node
last node)))
(defmethod print-object ((node node) stream)
(print-unreadable-object (node stream :type t :identity t)
(format stream "Item: ~a" (slot-value node 'item))))
;;;----------------------------------------------------------------
;;; Unexported functions for handling nodes.
(defgeneric unmark-node (node)
(:method ((node node))
(setf (node-marked-p node) nil)))
(defgeneric mark-node (node)
(:method ((node node))
(setf (node-marked-p node) t)))
(defgeneric is-node-root-p (node)
(:method ((node node))
(null (node-parent node))))
(defgeneric concatenate-node-lists (lhs rhs)
(:method ((lhs node) (rhs null))
lhs)
(:method ((lhs null) (rhs node))
rhs)
(:method ((lhs node) (rhs node))
(psetf (node-next lhs) rhs
(node-last (node-next lhs)) (node-last rhs)
(node-last rhs) lhs
(node-next (node-last rhs)) (node-next lhs))
lhs))
(defgeneric delete-node (node)
(:documentation "Deletes this node from the linked list that it
represents, and returns the new list. Nulls the node's parent, and
resets its rank if appropriate.")
(:method ((node null))
nil)
(:method ((node node))
(with-slots (next last parent) node
(let ((result (when (not (eq next node))
next)))
(when result ; There was something to delete.
(psetf (node-last next) last
(node-next last) next
next node
last node))
(when parent ; Remove the item from any parents.
(decf (node-rank parent))
(when (eq (node-child parent) node)
(setf (node-child parent) result))
(setf parent nil))
result))))
(defmacro do-each-node ((symbol node) &body body)
(let ((node node)
(last (gensym))
(next (gensym)))
`(when ,node
(loop
with ,last = (node-last ,node)
for ,symbol = ,node then ,next
for ,next = (node-next ,node) then (node-next ,next)
while (not (eq ,symbol ,last))
do (progn
,@body)
finally (progn
,@body)))))
;;;--------------------
;;; Unexported functions
(defgeneric meld (one two)
(:documentation "Joins together two fibonacci heaps."))
;; This should not increase the heap's count of its items, since it's
;; used in areas such as linking, where this must not occur.
(defmethod meld ((heap fibonacci-heap) (item node))
"Adds a node to the heap."
(with-slots (root) heap
(cond
((null root)
(setf root item))
((compare-items heap (node-item root) (node-item item))
(setf root (concatenate-node-lists root item)))
(t
(setf root (concatenate-node-lists item root)))))
heap)
;; This should adjust the heap's count of its children, since it's use
;; only makes sense in places where more items are added.
(defmethod meld ((heap1 fibonacci-heap) (heap2 fibonacci-heap))
(with-slots ((heap1-root root)
(heap1-count count)) heap1
(with-slots ((heap2-root root)
(heap2-count count)) heap2
(setf heap1-root (concatenate-node-lists heap1-root heap2-root))
(unless (compare-items heap1 (node-item heap1-root) (node-item heap2-root))
(setf heap1-root heap2-root
heap1-count (+ heap1-count heap2-count))))))
(defgeneric link (heap node-one node-two)
(:documentation "Places node-two as a child of node-one if
node-one's item is smaller, or vice versa.")
(:method ((heap fibonacci-heap) (node-one node) (node-two node))
(with-slots ((one-child child)
(one-item item)
(one-rank rank)) node-one
(with-slots ((two-child child)
(two-item item)
(two-rank rank)) node-two
(cond
((compare-items heap one-item two-item)
(delete-node node-two)
(unless (is-node-root-p node-two)
(unmark-node node-two))
(setf one-child (concatenate-node-lists one-child node-two)
(node-parent node-two) node-one)
(incf one-rank)
node-one)
(t
(delete-node node-one)
(setf two-child (concatenate-node-lists two-child node-one)
(node-parent node-one) node-two)
(incf two-rank)
node-two))))))
(defgeneric cut-node (heap node)
(:documentation "Cuts a child from its parent and makes and places
it in the root list.")
(:method ((heap fibonacci-heap) (node node))
(let ((parent (node-parent node)))
(with-slots (root) heap
(delete-node node)
(concatenate-node-lists root node)
(cond
((and parent (not (is-node-root-p parent)) (node-marked-p parent))
(cut-node heap parent))
((and parent (not (is-node-root-p parent)))
(mark-node parent)
heap))))))
;;;----------------------------------------------------------------
;;; Exported Functions
(defmethod empty-heap ((heap fibonacci-heap))
"Clears all items from the heap. This is a constant time operation."
(with-slots (root count) heap
(setf root nil
count 0))
heap)
(defmethod is-empty-heap-p ((heap fibonacci-heap))
(unless (slot-value heap 'root)
t))
(defmethod heap-size ((heap fibonacci-heap))
(slot-value heap 'count))
(defmethod add-to-heap ((heap fibonacci-heap) item)
"Adds an item to a Fibonacci-heap. This is a constant time
operation. Returns the item added to the heap."
(let ((node (make-instance 'node :item item)))
(meld heap node)
(incf (slot-value heap 'count))
(values item node)))
(defmethod add-all-to-heap ((heap fibonacci-heap) (items list))
"Adds the following list of items into the heap. This is an O(n) operation."
(with-slots (count) heap
(loop for i in items
do (progn
(meld heap (make-instance 'node :item i))
(incf count))))
heap)
(defmethod peep-at-heap ((heap fibonacci-heap))
"See the heap's minimum value without modifying the heap. This is a
constant time operation."
(with-slots (root) heap
(when root
(node-item root))))
(defmethod pop-heap ((heap fibonacci-heap))
"Remove the minimum element in the tree. This has an amortised
running time of O(log(n)), where n is the number of items in the
heap."
(unless (is-empty-heap-p heap)
(let ((item (peep-at-heap heap)))
(with-slots (root count) heap
;; Delete the minimum.
(concatenate-node-lists root (node-child root))
(setf root (delete-node root))
(when root
(let ((ranks (make-array (1+ (ceiling (log count 2))) :initial-element nil))
(min nil))
;; Merge all trees of the same rank.
(labels ((sort-node (node)
(let ((position (node-rank node)))
(cond
((aref ranks position)
(let ((new (link heap node (aref ranks position))))
(setf (aref ranks position) nil)
(sort-node new)))
(t
(setf (aref ranks position) node))))))
(do-each-node (node root)
;; The newly added nodes should not have a parent
(setf (node-parent node) nil)
(delete-node node)
(sort-node node)))
(loop for tree across ranks
do (when (not (null tree))
(cond
((null min)
(setf min tree))
((compare-items heap
(node-item min)
(node-item tree))
(setf min (concatenate-node-lists min tree)))
(t
(setf min (concatenate-node-lists tree min))))))
(setf root min)))
(decf (slot-value heap 'count))
item))))
(defmethod nmerge-heaps ((first fibonacci-heap) (second fibonacci-heap))
"Destructively marges the two heaps. This is a constant time
operation."
(with-slots ((first-key key)
(first-fun sort-fun)) first
(with-slots ((second-key key)
(second-fun sort-fun)) second
(unless (and (eq first-key second-key)
(eq first-fun second-fun))
(error 'heap-error :message "These two heaps were constructed using different
access keys and sorting functions."))))
(meld first second)
first)
(defmethod merge-heaps ((first fibonacci-heap) (second fibonacci-heap))
"Returns the merge of the two given heaps. This operation runs in
O(n + m), where n and m are the number of items in each heap."
(with-slots ((first-root root)
(first-key key)
(first-fun sort-fun)) first
(with-slots ((second-root root)
(second-key key)
(second-fun sort-fun)) second
(unless (and (eq first-key second-key)
(eq first-fun second-fun))
(error 'heap-error :message "These two heaps were constructed using different
access keys and sorting functions."))
(let ((result (make-instance 'fibonacci-heap
:sort-fun first-fun
:key first-key)))
(labels ((add-from-level (node-list)
(when node-list
(do-each-node (node node-list)
(add-from-level (node-child node))
(add-to-heap result (node-item node))))))
(add-from-level first-root)
(add-from-level second-root))
result))))
;;; This method decreases the node's key, removes the node from the
;;; tree and adds it to the root list (unless this is of course where
;;; the node originally was.
(defmethod decrease-key ((heap fibonacci-heap) (item-index node) value)
"Changes the value of an item represented by the ITEM-INDEX to
VALUE. This index is returned as the second argument to
ADD-TO-HEAP. This is an amortised constant time operation."
(with-slots (key sort-fun) heap
(unless (funcall sort-fun value (funcall key (node-item item-index)))
(error 'key-error :message
(format nil "The given value (~a) must be less than the current value (~a)."
value (funcall key (node-item item-index)))))
(if (eq key #'identity)
(setf (node-item item-index) value)
(handler-case
(funcall key (node-item item-index) value)
(error (e)
(declare (ignore e))
(error 'key-error))))
(cond
;; A child of something. See if cascading cuts should occur.
((node-parent item-index)
(let ((parent (node-parent item-index)))
(delete-node item-index)
(meld heap item-index)
(when (not (is-node-root-p parent))
(if (node-marked-p parent)
(cut-node heap parent)
(mark-node parent)))))
(t ; In the list with the root.
(with-slots (root) heap
(unless (compare-items heap (node-item root) (node-item item-index))
(setf root item-index))))))
heap)
(defmethod delete-from-heap ((heap fibonacci-heap) (item-index node))
"Removes an item from the heap, as pointed to by item-index. This
operation is amortised O(1), unless the item removed is the minimum item, in
which case the operation is equivalent to a POP-HEAP."
(with-slots (root count) heap
(let ((parent (node-parent item-index)))
(cond
((eq root item-index)
(pop-heap heap))
(t
(do-each-node (child (node-child item-index))
(setf (node-parent child) nil))
;; Add children to root level.
(concatenate-node-lists root (node-child item-index))
(delete-node item-index)
(decf count)))
(when (and parent (not (is-node-root-p parent)))
(if (node-marked-p parent)
(cut-node heap parent)
(mark-node parent)))))
heap)
| 12,811 | Common Lisp | .lisp | 346 | 32.83237 | 82 | 0.658584 | TheRiver/CL-HEAP | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 937d50f183f8e87e9159dbbd198e94c0b8231cae45eecbe95943a50fd6046202 | 10,333 | [
-1
] |
10,334 | cl-heap.asd | TheRiver_CL-HEAP/cl-heap.asd | ;;; -*- Mode: Lisp; -*-
;;;
;;; Copyright 2009-2010, 2012-2013 Rudolph Neeser <[email protected]>
;;;
;;; This file is part of CL-HEAP
;;;
;;; CL-HEAP is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; CL-HEAP is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with CL-HEAP. If not, see <http://www.gnu.org/licenses/>.
;;;----------------------------------------------------------------
(defpackage #:cl-heap-asdf
(:use :common-lisp :asdf))
(in-package #:cl-heap-asdf)
(defsystem :cl-heap
:description "An implementation of heap and priority queue data structures."
:version "0.1.6"
:author "Rudy Neeser <[email protected]>"
:license "GPLv3"
:serial t
:components ((:file "package")
(:file "condition")
(:file "heap")
(:file "binary-heap")
(:file "fibonacci-heap")
(:file "priority-queue")))
| 1,314 | Common Lisp | .asd | 34 | 36.147059 | 80 | 0.66248 | TheRiver/CL-HEAP | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | a8e83a1e094aef87358014f751da5f168061a0459d8d722905a493f48715f550 | 10,334 | [
-1
] |
10,335 | cl-heap-tests.asd | TheRiver_CL-HEAP/cl-heap-tests.asd | ;;; -*- Mode: Lisp; -*-
;;;
;;; Copyright 2009-2010, 2012-2013 Rudolph Neeser <[email protected]>
;;;
;;; This file is part of CL-HEAP
;;;
;;; CL-HEAP is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; CL-HEAP is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with CL-HEAP. If not, see <http://www.gnu.org/licenses/>.
;;;----------------------------------------------------------------
(defpackage #:cl-heap-tests-asdf
(:use :common-lisp :asdf))
(in-package #:cl-heap-tests-asdf)
(defsystem :cl-heap-tests
:description "Tests for the CL-HEAP package, an implementation of
heap and priority queue data structures."
:version "0.1.6"
:author "Rudy Neeser <[email protected]>"
:license "GPLv3"
:depends-on (:xlunit :cl-heap)
:serial t
:components ((:file "tests")))
| 1,278 | Common Lisp | .asd | 31 | 38.806452 | 73 | 0.671233 | TheRiver/CL-HEAP | 18 | 3 | 2 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 63b491809a95425c045b91460d0028c824bc847d66d3fc6c6b8ef542e5dfebb0 | 10,335 | [
-1
] |
10,360 | package.lisp | VincentToups_parseltongue/package.lisp | ;;; Copyright 2012, Vincent Toups
;;; This program is distributed under the terms of the GNU Lesser
;;; General Public License (see license.txt).
;;;; package.lisp
(defpackage #:parseltongue
(:export
"NEXT"
"REST-OF"
"EMPTY?"
"BIND-FORM"
"PARSER-RETURN"
"PARSER-BIND"
"PARSER-PAIR"
"=ITEM"
"=>ITEMS"
"DEFPARSER"
"PARSER"
"=>STRING"
"=>EQUAL"
"=>EQ"
"=REST"
"=>REDUCE-CONCAT"
"PARSE/FIRST-RESULT"
"=>ITEMS->STRING"
"=>SATISFIES"
"=>OR"
"=>AND"
"=>MAYBE"
"=>MAYBE-ALTERNATIVE"
"=>ZERO-PLUS-MORE"
"=>ONE-PLUS-MORE")
(:use #:cl #:lisp-unit))
| 622 | Common Lisp | .lisp | 32 | 15.8125 | 66 | 0.603066 | VincentToups/parseltongue | 14 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 436d49dd5810059944f76f0dd032a7c52dd2a60b096a32081869752e242198d2 | 10,360 | [
-1
] |
10,361 | tests.lisp | VincentToups_parseltongue/tests.lisp | ;;; Copyright 2012, Vincent Toups
;;; This program is distributed under the terms of the GNU Lesser
;;; General Public License (see license.txt).
;;;; tests.lisp
(in-package #:parseltongue)
(define-test next
(assert-equal 5 (next '(5 10 15)))
(assert-equal "a" (next "abc")))
(define-test rest-of
(assert-equal '(10 15)
(rest-of '(5 10 15)))
(assert-equal "bc"
(rest-of "abc")))
(define-test empty?
(assert (empty? '()))
(assert (empty? ""))
(assert-equal nil
(empty? '(a b)))
(assert-equal nil
(empty? "abc")))
(define-test bind-form
(assert (bind-form? '(a <- x)))
(assert (not (bind-form? '(a b c))))
(assert (not (bind-form? '(a <- b c)))))
(define-test parser-return
(assert-equalp
(list (parser-pair 'a nil)
(parser-pair 'b nil))
(funcall (parser-return 'a 'b) nil)))
(define-test =item
(assert-equalp
(list (parser-pair "a" "bc"))
(=item "abc"))
(assert-equalp
'()
(=item "")))
(define-test =>items
(assert-equalp
(list (parser-pair '(a b c) '(d)))
(funcall (=>items 3) '(a b c d))))
(define-test =>satisfies
(assert-equalp
(list (parser-pair "a" "bc"))
(funcall
(=>satisfies
(lambda (arg)
(string= arg "a")))
"abc"))
(assert-equalp
(list)
(funcall
(=>satisfies
(lambda (arg)
(string= arg "a")))
"bbc")))
(define-test =>or
(assert-equalp
(list (parser-pair "a" "bc"))
(funcall (=>or
(=>string "a")
(=>string "b"))
"abc"))
(assert-equalp
(list (parser-pair "b" "bc"))
(funcall (=>or
(=>string "a")
(=>string "b"))
"bbc"))
(assert-equalp
(list)
(funcall (=>or
(=>string "a")
(=>string "b"))
"cbc")))
(define-test =>and
(assert-equalp
(list
(parser-pair "b" "c"))
(funcall
(=>and (=>string "a")
(=>string "b"))
"abc"))
(assert-equalp
(list
)
(funcall
(=>and (=>string "a")
(=>string "b"))
"acc"))
(assert-equalp
(list
)
(funcall
(=>and (=>string "a")
(=>string "b"))
"bbc")))
(define-test strcat
(assert-equalp
"abcdef"
(strcat "a" "b" "c" "d" "e" "f")))
(define-test =>maybe
(assert-equalp
(list (parser-pair "a" "bc"))
(funcall (=>maybe (=>string "a"))
"abc"))
(assert-equalp
(list (parser-pair nil "cbc"))
(funcall (=>maybe (=>string "a"))
"cbc")))
(define-test =>maybe-alternative
(assert-equalp
(list (parser-pair "a" "bc"))
(funcall (=>maybe-alternative (=>string "a") 'alt)
"abc"))
(assert-equalp
(list (parser-pair 'alt "cbc"))
(funcall (=>maybe-alternative (=>string "a") 'alt)
"cbc")))
(define-test =>zero-plus-more
(assert-equalp
(list (parser-pair
(list "a" "b" "b" "a") "rocks"))
(funcall
(=>zero-plus-more
(=>or (=>string "a")
(=>string "b")))
"abbarocks"))
(assert-equalp
(list (parser-pair
(list) "rocks"))
(funcall
(=>zero-plus-more
(=>or (=>string "a")
(=>string "b")))
"rocks"))
(assert-equalp
(list (parser-pair
(list "a" "b" "b") "rocks"))
(funcall
(=>zero-plus-more
(=>or (=>string "a")
(=>string "b")))
"abbrocks")))
(define-test =>one-plus-more
(assert-equalp
(list (parser-pair (list "a" "a" "a") "b"))
(funcall (=>one-plus-more (=>string "a"))
"aaab"))
(assert-equalp
nil
(funcall (=>one-plus-more (=>string "a"))
"bbbb")))
(run-tests :all)
| 3,378 | Common Lisp | .lisp | 153 | 18.418301 | 66 | 0.565367 | VincentToups/parseltongue | 14 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 902bcb79ea05dddbd443a1bc289ebd8fb008a8442a6a7c94a79b1d1f6ea43dba | 10,361 | [
-1
] |
10,362 | parseltongue.lisp | VincentToups_parseltongue/parseltongue.lisp | ;;; Copyright 2012, Vincent Toups
;;; This program is distributed under the terms of the GNU Lesser
;;; General Public License (see license.txt).
;;;; parseltongue.lisp
(in-package #:parseltongue)
(defmethod next ((list list))
(car list))
(defmethod rest-of ((list list))
(cdr list))
(defmethod next ((string string))
(subseq string 0 1))
(defmethod rest-of ((string string))
(subseq string 1))
(defmethod empty? ((list list))
(not list))
(defmethod empty? ((string string))
(= 0 (length string)))
(defmethod prefix (o (string string))
(concatenate 'string o string))
(defmethod prefix (o (list list))
(cons o list))
(defmethod empty-of ((list list)) '())
(defmethod empty-of ((string string)) "")
(defun bind-form? (form)
(if (listp form)
(let ((sigil (elt form 1)))
(if (and (eq sigil '<-)
(= 3 (length form)))
t
nil))
nil))
(defstruct parser-pair value input)
(defun parser-pair (value input)
(make-parser-pair :value value :input input))
(defun parser-bind (=p =>p)
(lambda (input)
(let ((rs (funcall =p input)))
(loop for r in rs append
(funcall
(funcall =>p (parser-pair-value r))
(parser-pair-input r))))))
(defun parser-return (&rest items)
(lambda (input)
(mapcar
(lambda (item)
(make-parser-pair :value item :input input))
items)))
(defun => (&rest items)
(apply #'parser-return items))
(defmacro parser (&rest forms)
`(labels ((m-return (&rest items) (apply #'parser-return items))
(=> (&rest items) (apply #'parser-return items)))
(parser-helper ,@forms)))
(defmacro parser-helper (&rest forms)
(labels ((bind-form? (form)
(if (listp form)
(let ((sigil (elt form 1)))
(if (and (eq sigil '<-)
(= 3 (length form)))
t
nil))
nil)))
(cond
((and (cdr forms)
(bind-form? (car forms)))
`(parser-bind ,(elt (car forms) 2)
(lambda (,(elt (car forms) 0))
(parser-helper ,@(cdr forms)))))
((cdr forms)
`(parser-bind ,(car forms)
(lambda (,(gensym))
(parser-helper ,@(cdr forms)))))
((not (cdr forms))
(car forms)))))
(eval-when (:compile-toplevel :load-toplevel :execute)
(defmacro defun/var (name arg-list &rest body)
`(progn
(defun ,name ,arg-list ,@body)
(defvar ,name #',name "A parser")
(setq ,name #',name))))
(defun/var =nil (input)
(declare (ignore input))
(list))
(defun/var =item (input)
(if (not (empty? input))
(list (make-parser-pair :value (next input)
:input (rest-of input)))
'()))
(defmacro named-let (name bindings &rest body)
`(labels ((,name ,(mapcar #'car bindings) ,@body))
(,name ,@(mapcar #'cadr bindings))))
(defun =>items (n)
(lambda (input)
(named-let recur
((acc '())
(n n)
(input input))
(if (or (<= n 0) (empty? input))
(list (parser-pair (reverse acc) input))
(recur (cons (next input) acc) (- n 1) (rest-of input))))))
(defun =>satisfies (fun)
(parser
(x <- =item)
(if (funcall fun x) (=> x) =nil)))
(defun =>or2 (=p1 =p2)
(lambda (input)
(let ((rs (funcall =p1 input)))
(if rs rs
(funcall =p2 input)))))
(defun =>or (&rest ps)
(reduce #'=>or2 ps))
(defun =>and2 (=p1 =p2)
(lambda (input)
(let* ((r1 (funcall =p1 input)))
(if r1
(funcall =p2 (parser-pair-input r1))
nil))))
(defun =>and (&rest ps)
(reduce #'=>and2 ps))
(defun parser-plus (&rest ps)
(apply #'=>and ps))
(defmacro defparser (name/args maybe-doc &rest body)
(cond
((symbolp name/args)
(let ((name name/args)
(input-name (gensym))
(body (if (stringp maybe-doc) body (cons maybe-doc body)))
(doc (if (stringp maybe-doc) maybe-doc "")))
`(progn
(declaim (function ,name))
(setq ,name
(parser ,@body))
(defun ,name (,input-name)
,doc
(funcall ,name ,input-name)))))
((listp name/args)
(let ((name (car name/args))
(args (cdr name/args))
(body (if (stringp maybe-doc) body (cons maybe-doc body)))
(doc (if (stringp maybe-doc) maybe-doc "")))
`(defun ,name ,args ,doc (parser ,@body))))))
(defparser (=>string s)
(items <- (=>items (length s)))
(let ((gs (apply #'strcat items)))
(if (equal s gs) (m-return gs)
=nil)))
(defparser (=>equal to)
(i <- =item)
(if (equal i to) (=> i) =nil))
(defparser (=>eq to)
(i <- =item)
(if (eq i to) (=> i) =nil))
(defun strcat (&rest s)
(reduce (lambda (a b) (concatenate 'string a b)) s))
(defparser (=>reduce-concat =p)
(r <- =p)
(=> (reduce #'strcat r)))
(defun/var =rest (input)
(list (make-parser-pair :value input :input input)))
(defun parse/first-result (=p input)
(car (car (funcall =p input))))
(defparser (=>items->string n)
(=>reduce-concat (=>items n)))
(defparser (=>list =p)
(r <- =p)
(=> (list r)))
(defun =>maybe (=p)
(lambda (input)
(let ((rs (funcall =p input)))
(if rs rs
(list (make-parser-pair :value nil :input input))))))
(defun =>maybe-alternative (=p alt)
(lambda (input)
(let ((rs (funcall =p input)))
(if rs rs
(list (make-parser-pair :value alt :input input))))))
(defun mapcar/deal (fun lst)
"Map FUN over LST. FUN returns a list of two items, the first
of which is a key the second of which is a value. The VALUES are
accumulated at the KEYS in an ALIST which is returned."
(named-let recur
((a '())
(lst lst))
(if (empty? lst)
(reverse-alist-keys a)
(let* ((result (funcall fun (car lst)))
(key (car result))
(val (cadr result)))
(recur (alist-cons a key val)
(cdr lst))))))
(defun alist-cons (a key val)
"CONS VAL onto the LIST held at KEY in the ALIST A."
(named-let recur
((a a)
(past '()))
(cond
((not a) (cons (cons key (list val)) past))
(t
(let* ((first (car a))
(lkey (car first))
(lval (cdr first)))
(if (equal lkey key)
(cons (cons lkey (cons val lval)) past)
(recur
(cdr a)
(cons first past))))))))
(defun alist (a key)
"Return the value at KEY or NIL."
(cond
((not a) nil)
(t
(let ((first (car a)))
(if (equal (car first) key)
(cdr first)
(alist (cdr a) key))))))
(defun reverse-alist-keys (a)
"Reverse the lists held at each key in A."
(loop for (k . v) in a collect
(cons k (reverse v))))
(defun zero-plus-more-step (substate parser)
"Apply PARSER to the CDR of substate. If it succeeds, cons the
result onto the list in the CAR of substate and indicate CONTINUE
for MAPCAR/DEAL. If PARSER on CDR of substate FAILS, then
reverse the CAR of SUBSTATE and return this value consed with the
last INPUT state."
(let* ((mrv (parser-pair-value substate))
(input (parser-pair-input substate))
(r (funcall parser input)))
(if r (list
:continue
(mapcar (lambda (subr)
(let ((r (parser-pair-value subr))
(rest (parser-pair-input subr)))
(parser-pair (cons r mrv) rest)))
r))
(list :terminate
(parser-pair (reverse mrv) input)))))
(defun =>zero-plus-more (p)
"Produce a parser which parses P zero or more times and monadically
returns the results in a list."
(lambda
(input)
(named-let recur
((terminals nil)
(continuers (funcall (=>list p) input)))
(if (empty? continuers)
(if (empty? terminals)
(list (parser-pair nil input))
terminals)
(let* ((split-tbl
(mapcar/deal
(lambda (c)
(zero-plus-more-step c p))
continuers))
(new-continuers (alist split-tbl :continue))
(new-terminals (alist split-tbl :terminate)))
(recur (append terminals new-terminals)
(reduce #'append new-continuers)))))))
(defparser (=>one-plus-more =p)
(r <- =p)
(rest <- (=>zero-plus-more =p))
(=> (cons r rest)))
| 7,688 | Common Lisp | .lisp | 262 | 25.538168 | 69 | 0.618162 | VincentToups/parseltongue | 14 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | b9ee848bd8148a3c0ef671a0aa67537407579b37c71c0b4c2d8247551473a60b | 10,362 | [
-1
] |
10,363 | parseltongue.asd | VincentToups_parseltongue/parseltongue.asd | ;;; Copyright 2012, Vincent Toups
;;; This program is distributed under the terms of the GNU Lesser
;;; General Public License (see license.txt).
;;;; parseltongue.asd
(asdf:defsystem #:parseltongue
:serial t
:version "0.0.1"
:author "Vincent Toups"
:maintainer "Vincent Toups"
:description "Parseltongue"
:long-description "A monadic parser combinator library with Haskell do-like notation."
:license "LGPL"
:depends-on (lisp-unit)
:components ((:file "package")
(:file "parseltongue")
(:file "tests")))
| 530 | Common Lisp | .asd | 16 | 30.5625 | 87 | 0.733333 | VincentToups/parseltongue | 14 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 144b7438291b041ee1339a3c2f1433b8b8f0ab73fc8e1dce59812a6d8946607a | 10,363 | [
-1
] |
10,383 | package.lisp | benkard_toilet/package.lisp | ;;; Toilet Lisp, a Common Lisp subset for the Étoilé runtime.
;;; Copyright (C) 2008 Matthias Andreas Benkard.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(in-package #:common-lisp)
(export '(make-package defpackage use-package find-package package packagep))
(defun ns-set-with-list (list)
(if list
(send-by-name (find-objc-class "NSSet")
"setWithArray:"
(send-by-name list "array"))
(send-by-name (find-objc-class "NSSet")
"set")))
(defun make-package (package-name &key nicknames use)
(let ((package nil)) ;FIXME: (find-package package-name)
(when package
(error "Package ˜A is already there" package-name))
(setq package
(send-by-name (find-objc-class "MLKPackage") "packageWithName:nicknames:"
(etypecase package-name
(symbol (symbol-name package-name))
(string package-name))
(ns-set-with-list nicknames)))
(use-package use package)
package))
(defun packagep (thing)
(send-by-name thing "isKindOfClass:" (find-package "MLKPackage")))
(deftype package ()
`(satisfies packagep))
(defun find-package (designator)
(etypecase designator
(package designator)
(symbol (find-package (symbol-name symbol)))
(string (send (find-objc-class "MLKPackage")
"findPackage:"
string))))
(defun use-package (use-list &optional package)
(unless package
(setq package *package*))
(typecase use-list
(list (dolist (p use-list)
(send package "usePackage:" (find-package p))))
(t (use-package (list use-list) package))))
(defmacro defpackage (package-name &body options)
(let ((documentation (cdr (assoc :documentation options)))
(use (cdr (assoc :use options)))
(nicknames (cdr (assoc :nicknames options)))
(shadow (cdr (assoc :shadow options)))
(shadowing-import-from (cdr (assoc :shadowing-import-from options)))
(import-from (cdr (assoc :import-from options)))
(export (cdr (assoc :export options)))
(intern (cdr (assoc :intern options)))
(size (cdr (assoc :size options)))
(name (etypecase package-name
(symbol (symbol-name package-name))
(string package-name))))
;; FIXME
`(progn (make-package ',package-name :use ',use))))
| 3,049 | Common Lisp | .lisp | 69 | 37.130435 | 83 | 0.648011 | benkard/toilet | 11 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 2e407bdefff55d1f675cb708f352a41a6eea71ba76946244181a38f33dead521 | 10,383 | [
-1
] |
10,384 | util.lisp | benkard_toilet/util.lisp | ;;; -*- mode: lisp; coding: utf-8 -*-
;;; Toilet Lisp, a Common Lisp subset for the Étoilé runtime.
;;; Copyright (C) 2008 Matthias Andreas Benkard.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(in-package #:common-lisp)
(export '(and or not let* list* case cond append reverse macroexpand
otherwise unless when eq boundp))
(setq t 't)
(setq nil ())
(%macroset '%defmacro
(%lambda args
(let ((form (car args)))
(let ((name (car (cdr form)))
(lambda-list-name (car (cdr (cdr form))))
(body (cdr (cdr (cdr form)))))
(list '%macroset
(list 'quote name)
(cons '%lambda
(cons lambda-list-name body)))))))
(%defmacro %defun args
(list '%fset
(list 'quote (car (cdr (car args))))
(cons '%lambda (cdr (cdr (car args))))))
(%defun list* args
(if (null (cdr args))
(car args)
(cons (car args)
(apply 'list* (cdr args)))))
(%defmacro let* args
(let ((form (car args)))
(let ((bindings (car (cdr form)))
(body (cdr (cdr form))))
(if (null bindings)
(list* 'let nil body)
(let ((first-binding (car bindings))
(rest (cdr bindings)))
(list 'let
(list first-binding)
(list* 'let* rest body)))))))
(%defmacro cond args
(let* ((form (car args))
(clauses (cdr form))
(clause (car clauses))
(rest (cdr clauses)))
(if (null clauses)
nil
(list 'if
(car clause)
(cons 'progn (cdr clause))
(cons 'cond rest)))))
(%defun not args
(if (null (car args)) t nil))
(%defun make-%defmacro*-body args
(let ((lambda-list (car args))
(lambda-list-name (car (cdr args)))
(body (car (cdr (cdr args)))))
(cond ((null lambda-list) body)
((not (listp lambda-list))
(list
(list* 'let
(list (list lambda-list lambda-list-name))
body)))
(t (let ((lambda-symbol (car lambda-list))
(rest-lambda-list (cdr lambda-list))
(rest-name (gensym)))
(list
(list* 'let
(list (list lambda-symbol
(list 'car lambda-list-name))
(list rest-name
(list 'cdr lambda-list-name)))
(make-%defmacro*-body (cdr lambda-list)
rest-name
body))))))))
(%defmacro %defmacro* args
(let* ((form (car args))
(real-args (cdr form)))
(let ((name (car real-args))
(lambda-list (car (cdr real-args)))
(body (cdr (cdr real-args)))
(macro-lambda-list-name (gensym))
(lambda-list-name (gensym)))
(list '%defmacro
name
macro-lambda-list-name
(list* 'let
(list (list lambda-list-name
(list 'cdr
(list 'car macro-lambda-list-name))))
(make-%defmacro*-body lambda-list lambda-list-name body))))))
(%defmacro %defun* args
(let* ((form (car args))
(real-args (cdr form)))
(let ((name (car real-args))
(lambda-list (car (cdr real-args)))
(body (cdr (cdr real-args)))
(lambda-list-name (gensym)))
(list* '%defun
name
lambda-list-name
(make-%defmacro*-body lambda-list lambda-list-name body)))))
(%defmacro* and expressions
(cond ((null expressions) t)
((null (cdr expressions)) (car expressions))
(t (list 'if
(car expressions)
(cons 'and (cdr expressions))
nil))))
(%defmacro* or expressions
(cond ((null expressions) nil)
((null (cdr expressions)) (car expressions))
(t (let ((expr-sym (gensym)))
(list 'let
(list (list expr-sym (car expressions)))
(list 'if
expr-sym
expr-sym
(cons 'or (cdr expressions))))))))
(%defun* %reverse-helper (list stack)
(if (null list)
stack
(%reverse-helper (cdr list) (cons (car list) stack))))
(%defun* reverse (list)
(%reverse-helper list nil))
(%defun* %append-helper (reversed-list1 list2)
(if (null reversed-list1)
list2
(%append-helper (cdr reversed-list1) (cons (car reversed-list1) list2))))
(%defun* %append-two-lists (list1 list2)
(%append-helper (reverse list1) list2))
(%defun* %append (lists)
(if (null (cdr lists))
(car lists)
(let ((first-list (car lists))
(second-list (car (cdr lists)))
(rest (cdr (cdr lists))))
(%append (list* (%append-two-lists first-list second-list) rest)))))
(%defun append lists
(%append lists))
(%defun* %zerop (integer)
(fixnum-eq integer 0))
(%defun* %= (int1 int2)
(send-by-name int1 "isEqual:" int2))
(%defun* %1- (integer)
(add integer -1))
(%defun* %1+ (integer)
(add integer 1))
(%defun* qq-expand (object level)
(if (not (consp object))
(list 'quote object)
(cond ((eq 'sys::unquote (car object))
(if (%= level 1)
(car (cdr object))
(list 'sys::unquote (qq-expand (car (cdr object)) (%1- level)))))
((eq 'sys::quasiquote (car object))
(if (%zerop level)
(qq-expand (car (cdr object)) (%1+ level))
(list 'sys::quasiquote (qq-expand (car (cdr object)) (%1+ level)))))
((and (consp (car object))
(eq 'sys::unquote-splicing (car (car object))))
(if (%= level 1)
(list 'append
(car (cdr (car object)))
(qq-expand (cdr object) level))
(list 'sys::unquote-splicing (qq-expand (car (cdr object))
(%1- level)))))
(t (list 'cons
(qq-expand (car object) level)
(qq-expand (cdr object) level))))))
(%defmacro sys::quasiquote form-and-env
(qq-expand (car form-and-env) 0))
(%defun* %member (item list)
(and list
(or (and (eq item (car list)) list)
(%member item (cdr list)))))
(%defmacro* case (object . clauses)
(let ((this-clause (car clauses))
(rest (cdr clauses))
(object-sym (gensym)))
(if (null clauses)
nil
(if (and (null rest)
(or (eq (car this-clause) t)
(eq (car this-clause) 'otherwise)))
`(progn ,@(cdr this-clause))
`(let ((,object-sym ,object))
(if ,(if (listp (car this-clause))
`(%member ,object-sym
(quote ,(car this-clause)))
`(eq ,object-sym
(quote ,(car this-clause))))
(progn ,@(cdr this-clause))
(case ,object-sym ,@rest)))))))
(%defun* list-eqp (list1 list2)
"Not really EQUALP (only works on trees of symbols)."
(if (and (consp list1) (consp list2))
(and (list-eqp (car list1) (car list2))
(list-eqp (cdr list1) (cdr list2)))
(eq list1 list2)))
(%defun* macroexpand (object . rest)
(let* ((env (if rest (car rest) nil))
(expansion-1 (macroexpand-1 object env))
(expansion-2 (macroexpand-1 expansion-1 env)))
(if (list-eqp expansion-1 expansion-2)
expansion-1
(macroexpand expansion-2))))
(%defmacro* unless (test . body)
`(if (not ,test) (progn ,@body) nil))
(%defmacro* when (test . body)
`(if ,test (progn ,@body) nil))
(%defmacro* %shadowing-export (symbol)
`(progn
(shadow ',symbol)
(unexport ',symbol (find-package :sys))
(unexport ',symbol (find-package :cl))
(export (intern (symbol-name ',symbol) (find-package :cl)))))
(%shadowing-export eq)
(%defun* eq (x y)
(sys::eq x y))
(%defun* boundp (symbol)
(send-by-name (send-by-name (find-objc-class "MLKDynamicContext")
"currentContext")
"boundp:"
symbol))
(unless (boundp '+nil+)
(setq +nil+ (gensym)))
(%defun* denullify (x)
(if (eq x +nil+)
nil
x))
(%defun* nullify (x)
(or x +nil+))
| 9,251 | Common Lisp | .lisp | 244 | 27.545082 | 85 | 0.519353 | benkard/toilet | 11 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 58a55a25f664dc749f78771db23cf4cd44f6a5136b386c349c2fc4b2b251461b | 10,384 | [
-1
] |
10,385 | evaluation.lisp | benkard_toilet/evaluation.lisp | ;;; -*- mode: lisp; coding: utf-8 -*-
;;; Toilet Lisp, a Common Lisp subset for the Étoilé runtime.
;;; Copyright (C) 2008 Matthias Andreas Benkard.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(in-package #:common-lisp)
(defmacro declaim (&rest declarations &environment env)
`(eval-when (:compile-toplevel :load-toplevel :execute)
(proclaim ,@(mapcar (lambda (x) `(quote ,x)) declarations))))
(defun proclaim (&rest declarations)
(let ((context (send-by-name (find-objc-class "MLKLexicalContext")
"globalContext")))
(dolist (x declarations)
(send-by-name context "addDeclaration:" x))))
| 1,264 | Common Lisp | .lisp | 25 | 47.28 | 73 | 0.709416 | benkard/toilet | 11 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 125be7a85b27f6e433d15ca7ab444b65610c4dee955bbe52b7225ccb6133c8b1 | 10,385 | [
-1
] |
10,386 | types.lisp | benkard_toilet/types.lisp | ;;; -*- mode: lisp; coding: utf-8 -*-
;;; Toilet Lisp, a Common Lisp subset for the Étoilé runtime.
;;; Copyright (C) 2008 Matthias Andreas Benkard.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(in-package #:common-lisp)
(export '(most-positive-fixnum most-negative-fixnum type-of typep
subtypep and or not satisfies symbol fixnum bignum real
complex float integer ratio rational number short-float
long-float single-float double-float null symbol list cons
standard-char base-char extended-char string vector bit-vector
array simple-array simple-vector simple-string
simple-bit-vector sequence two-way-stream stream echo-stream
broadcast-stream file-stream synonym-stream string-stream
concatenated-stream deftype typecase etypecase char= eql))
(setq *subtype-supertypes-dict*
(let ((relationship-alist
'((base-char . (character))
(bignum . (integer))
(bit-vector . (vector))
(broadcast-stream . (stream))
(complex . (number))
(concatenated-stream . (stream))
(cons . (list))
(double-float . (float))
(echo-stream . (stream))
(extended-char . (character))
(file-stream . (stream))
(fixnum . (integer))
(float . (real))
(integer . (rational))
(list . (sequence))
(long-float . (float))
(null . (list symbol))
(ratio . (rational))
(rational . (real))
(real . (number))
(short-float . (float))
(simple-array . (array))
(simple-bit-vector . (simple-array))
(simple-string . (simple-array))
(simple-vector . (simple-array))
(single-float . (float))
(standard-char . (base-char))
(string . (vector))
(string-stream . (stream))
(synonym-stream . (stream))
(two-way-stream . (stream))
(vector . (array sequence))))
(dict (send-by-name (find-objc-class "NSMutableDictionary")
"dictionary")))
(dolist (pair relationship-alist dict)
(send-by-name dict "setObject:forKey:" (cdr pair) (nullify (car pair))))))
(setq *type-expanders* (send-by-name (find-objc-class "NSMutableDictionary")
"dictionary"))
(%shadowing-export fixnump)
(defun fixnump (thing)
(sys::fixnump thing))
;; (setq most-positive-fixnum 32767)
;; (setq most-negative-fixnum -32768)
(defun type-of (thing)
(let ((primitive-type (primitive-type-of thing)))
(case primitive-type
((null symbol cons single-float double-float function package)
primitive-type)
(fixnum 'fixnum)
(integer 'bignum)
(base-char 'base-char) ;FIXME
(sys::lexical-context 'sys::lexical-context)
(sys::binding 'sys::binding)
(stream 'stream) ;FIXME
(sys::exception 'sys::exception)
(array 'array) ;FIXME
(otherwise t)))) ;FIXME: classes and struct types, DEFTYPE
(defun some1 (function list)
(and (not (null list))
(or (funcall function (first list))
(some1 function (rest list)))))
(defun every1 (function list)
(or (null list)
(and (funcall function (first list))
(every1 function (rest list)))))
(defmacro deftype (type-name lambda-list &body body)
`(send-by-name *type-expanders*
"setObject:forKey:"
(destructuring-lambda ,lambda-list ,@body)
',type-name))
(defun expand-type (type &optional env)
(let* ((expansion-1 (expand-type-1 type env))
(expansion-2 (expand-type-1 expansion-1 env)))
(if (list-eqp expansion-1 expansion-2)
expansion-1
(expand-type expansion-2))))
(defun expand-type-1 (type &optional environment)
(let ((expander (send-by-name *type-expanders*
"objectForKey:"
(if (listp type) (first type) type))))
(if expander
(apply expander (if (listp type) (rest type) nil))
type)))
(defun typep (thing typespec &optional environment)
;;FIXME: DEFTYPE
(let ((type (type-of thing))
(typespec (expand-type typespec environment)))
(cond ((eq typespec t) t)
((consp typespec)
(case (first typespec)
(and (every1 (lambda (x) (typep thing x environment)) (rest typespec)))
(or (some1 (lambda (x) (typep thing x environment)) (rest typespec)))
(not (not (typep thing (second typespec) environment)))
(satisfies (funcall (second typespec) thing))
(otherwise
(subtypep type typespec environment))))
(t (subtypep type typespec environment)))))
(defun subtypep (type1 type2 &optional environment)
(let ((type1 (expand-type type1 environment))
(type2 (expand-type type2 environment)))
(cond ((eq type2 t) t)
((eq type1 nil) t)
((consp type1)
(case (first type1)
(and (some1 (lambda (x) (subtypep x type2 environment)) (rest type1)))
(or (every1 (lambda (x) (subtypep x type2 environment)) (rest type1)))
(not (not (subtypep (second type1) type2 environment)))
(satisfies nil) ;FIXME?
(otherwise
;;FIXME!!
(subtypep (first type1) type2 environment))))
((consp type2)
(case (first type2)
(and (every1 (lambda (x) (subtypep type1 x environment)) (rest type2)))
(or (some1 (lambda (x) (subtypep type1 x environment)) (rest type2)))
(not nil) ;FIXME
(satisfies nil) ;FIXME?
(otherwise
;;FIXME?
(subtypep type1 (first type2) environment))))
(t (or (eq type1 type2)
(let ((supertypes (send-by-name *subtype-supertypes-dict*
"objectForKey:"
type1))) ;strictly, this should be (nullify type1),
;but type1 can't be NIL here
(some1 (lambda (x) (subtypep x type2 environment)) supertypes)))))))
(defun numberp (x)
(typep x 'number))
(defun characterp (x)
(typep x 'character))
(defmacro typecase (expression &body cases)
(when cases
(let ((tmp (gensym))
(this-case (first cases))
(rest (rest cases)))
(if (and (null rest)
(or (eq (car this-case) t)
(eq (car this-case) 'otherwise)))
`(progn ,@(cdr this-case))
`(let ((,tmp ,expression))
(if (typep ,tmp ',(car this-case))
(progn ,@(cdr this-case))
(typecase ,tmp ,@rest)))))))
(defmacro etypecase (expression &body cases)
;; FIXME: Incorrect.
`(typecase ,expression
,@cases
(otherwise (error "~A fell through ETYPECASE expression" expression))))
(defun char= (x y)
(send-by-name x "isEqual:" y))
(defun eql (x y)
(typecase x
(number (and (numberp y)
(= x y))
(character (and (characterp y)
(char= x y)))
(t (eq x y)))))
| 8,076 | Common Lisp | .lisp | 185 | 33.124324 | 101 | 0.571501 | benkard/toilet | 11 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 769b744c1b256846c4ebada57a2e07793709f0d03678077c46da8dd9dd801c95 | 10,386 | [
-1
] |
10,387 | list-functions-2.lisp | benkard_toilet/list-functions-2.lisp | ;;; -*- mode: lisp; coding: utf-8 -*-
;;; Toilet Lisp, a Common Lisp subset for the Étoilé runtime.
;;; Copyright (C) 2008 Matthias Andreas Benkard.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(in-package #:common-lisp)
(export '(copy-tree assoc assoc-if assoc-if-not rassoc rassoc-if
rassoc-if-not sublis nsublis mapcar mapcan mapcon acons
reverse nreverse maplist nthcdr last nth))
(defun copy-tree (tree)
(typecase tree
(cons (cons (copy-tree (car cons)) (copy-tree (cdr cons))))
(t tree)))
(defun assoc (item alist &key key test test-not)
(setq test (or test (if test-not
(complement test-not)
(function eql))))
(assoc-if (lambda (x) (funcall test x item))
alist
:key key))
(defun assoc-if (predicate alist &key key)
(setq key (or key (function identity)))
(cond ((endp alist) nil)
((funcall predicate (funcall key (caar alist)))
(car alist))
(t (assoc-if predicate (cdr alist) :key key))))
(defun assoc-if-not (predicate alist &key key)
(assoc-if (complement predicate) alist :key key))
(defun rassoc (item alist &key key test test-not)
(setq test (or test (if test-not
(complement test-not)
(function eql))))
(rassoc-if (lambda (x) (funcall test x item))
alist
:key key))
(defun rassoc-if (predicate alist &key key)
(setq key (or key (function identity))
(cond ((endp alist) nil)
((funcall predicate (funcall key (cdar alist)))
(car alist))
(t (assoc-if predicate (cdr alist) :key key)))))
(defun rassoc-if-not (predicate alist &key key)
(rassoc-if (complement predicate) alist :key key))
(defun sublis (alist tree &key key test test-not)
(let ((ass (assoc (funcall key tree) :test test :test-not test-not)))
(if ass
(cdr assoc)
(typecase tree
(cons
(cons (sublis alist (car tree) :key key :test test :test-not test-not)
(sublis alist (cdr tree) :key key :test test :test-not test-not)))
(t tree)))))
(defun nsublis (alist tree &key key test test-not)
(sublvs alist tree :key key :test test :test-not test-not))
(defun some1 (function list)
(and (not (null list))
(or (funcall function (first list))
(some1 function (rest list)))))
(defun every1 (function list)
(or (null list)
(and (funcall function (first list))
(every1 function (rest list)))))
(defun mapcar1 (function list)
(when list
(cons (funcall function (first list))
(mapcar1 function (rest list)))))
(defun mapcan1 (function list)
(%append (mapcar1 function list)))
(defun mapcar (function list &rest more-lists)
(let ((lists (list* list more-lists)))
(when (every1 'identity lists)
(cons (apply function (mapcar1 'car lists))
(apply 'mapcar (list* function (mapcar1 'cdr lists)))))))
(defun maplist (function list &rest more-lists)
(let ((lists (list* list more-lists)))
(when (every1 'identity lists)
(cons (apply function lists)
(apply 'maplist (list* function (mapcar1 'cdr lists)))))))
(defun mapcan (function list &rest more-lists)
(%append (apply 'mapcar (list* function list more-lists))))
(defun mapcon (function list &rest more-lists)
(%append (apply 'maplist (list* function list more-lists))))
(defun nreverse (list)
(reverse list))
(defun acons (indicator value alist)
(cons (cons indicator value) alist))
(defun list (&rest objects)
(if objects
(sys::cons (sys::car objects) (sys::cdr objects))
nil))
(defun dotted-length (list)
(if (consp list)
(1+ (dotted-length (cdr list)))
0))
(defun length (list)
(if list
(%1+ (length (cdr list)))
0))
(defun last (list &optional (n 1))
(let ((l (dotted-length list)))
(nthcdr (- l n))))
(defun nthcdr (n list)
(check-type n (integer 0))
(if (zerop n)
list
(nthcdr (1- n) (cdr list))))
(defun nth (n list)
(car (nthcdr n list)))
| 4,710 | Common Lisp | .lisp | 119 | 34.042017 | 83 | 0.645303 | benkard/toilet | 11 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 4a2098d53d612b0382a7c20bce8dd2c42bb4118b919689d9e9b9042483b19744 | 10,387 | [
-1
] |
10,388 | defun-1.lisp | benkard_toilet/defun-1.lisp | ;;; -*- mode: lisp; coding: utf-8 -*-
;;; Toilet Lisp, a Common Lisp subset for the Étoilé runtime.
;;; Copyright (C) 2008 Matthias Andreas Benkard.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(in-package #:common-lisp)
(export '(defmacro defun))
(%defun* make-defun-body (lambda-list body destructuring-p)
(let* ((lambda-sym (gensym))
(ddf (declarations-and-doc-and-forms body))
(decls (car ddf))
(docstring (cadr ddf))
(forms (caddr ddf)))
`(,lambda-sym
,@(when docstring (list docstring))
(d-b ,lambda-list nil nil ,lambda-sym
,@(if decls `((declare ,@decls)))
,@forms))))
(%defmacro* defun (name lambda-list . body)
`(%defun ,name
,@(make-defun-body lambda-list body nil)))
(%defun* make-defmacro-body (lambda-list body)
(let ((arg-sym (gensym))
(lambda-sym (gensym))
(whole-sym (gensym))
(env-sym (gensym)))
(let* ((ddf (declarations-and-doc-and-forms body))
(decls (car ddf))
(docstring (cadr ddf))
(forms (caddr ddf)))
`(,arg-sym
,@(when docstring (list docstring))
(let ((,whole-sym (first ,arg-sym))
(,lambda-sym (cdr (first ,arg-sym)))
(,env-sym (second ,arg-sym)))
(d-b ,lambda-list ,env-sym ,whole-sym ,lambda-sym
,@(if decls `((declare ,@decls)))
,@forms))))))
(%defmacro* defmacro (name lambda-list . body)
`(%defmacro ,name
,@(make-defmacro-body lambda-list body)))
(%defmacro* lambda (lambda-list . body)
`(%lambda
,@(make-defun-body lambda-list body nil)))
(%defmacro* destructuring-lambda (lambda-list . body)
`(%lambda
,@(make-defun-body lambda-list body t)))
(defun funcall (function &rest arguments)
(apply function arguments))
| 2,445 | Common Lisp | .lisp | 60 | 35.133333 | 73 | 0.63575 | benkard/toilet | 11 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 799d510078e50b9f725512c57a46514f1b19044228fad50b642a1c100d9f4699 | 10,388 | [
-1
] |
10,389 | array.lisp | benkard_toilet/array.lisp | ;;; -*- mode: lisp; coding: utf-8 -*-
;;; Toilet Lisp, a Common Lisp subset for the Étoilé runtime.
;;; Copyright (C) 2008 Matthias Andreas Benkard.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(in-package #:common-lisp)
(export '(aref row-major-aref))
(defun row-major-aref (array row-major-index)
(send-by-name array "idAtIndex:" row-major-index))
(defun (setf row-major-aref) (new-value array row-major-index)
(send-by-name array "replaceIdAtIndex:withId:" row-major-index new-value))
(defun array-dimensions (array)
(send-by-name (find-objc-class "MLKCons")
"listWithArray:"
(send-by-name array "dimensions")))
| 1,280 | Common Lisp | .lisp | 26 | 46.423077 | 76 | 0.720482 | benkard/toilet | 11 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 881c0586e78b2ba27a6c4b2e610a52d5ceef1c09fa967271ef7b6b9479eac29c | 10,389 | [
-1
] |
10,390 | control-flow.lisp | benkard_toilet/control-flow.lisp | ;;; -*- mode: lisp; coding: utf-8 -*-
;;; Toilet Lisp, a Common Lisp subset for the Étoilé runtime.
;;; Copyright (C) 2008 Matthias Andreas Benkard.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(in-package #:common-lisp)
(export '(identity constantly complement tagbody go block return-from
return defconstant prog prog* macrolet flet prog1 prog2 labels
multiple-value-bind multiple-value-list multiple-value-setq
multiple-value-prog1 values-list))
(defun identity (x)
x)
(defun constantly (c)
(lambda (x)
(declare (ignore x))
c))
(defun complement (function)
(lambda (x) (not (funcall function x))))
(defmacro labels ((&rest function-bindings) &body forms)
"Look, ma, I've defined LABELS in terms of FLET!"
`(flet ,(mapcar (lambda (x) `(,(first x) ())) function-bindings)
(%fsetq ,@(mapcan (lambda (x)
`(,(first x) (lambda ,(second x) ,@(rest (rest x)))))
function-bindings))
nil
,@forms))
(defmacro defconstant (name value &optional documentation)
`(setq ,name ,value))
(defmacro prog1 (form &body forms)
(let ((varsym (gensym)))
`(let ((,varsym ,form))
,@forms
,varsym)))
(defmacro prog2 (form1 form2 &body forms)
`(progn
,form1
(prog1 ,form2
,@forms)))
;; FIXME: Should be (EVAL-WHEN (:compile-toplevel) ...).
(unless (boundp '+block-mapping-sym+)
(defconstant +block-mapping-sym+ (gensym "BLOCK-NAME")))
(defmacro #.+block-mapping-sym+ () nil)
(defmacro block (block-name &body body)
(let ((catch-tag (gensym)))
`(macrolet ((,+block-mapping-sym+ ()
`(quote ,(acons ',block-name
',catch-tag
(,+block-mapping-sym+)))))
(catch ',catch-tag
,@body))))
(defmacro return-from (block-name &optional value &environment env)
`(throw ',(cdr (assoc block-name (cadr (macroexpand `(,+block-mapping-sym+)
env))
:test 'eq))
,value))
(defmacro return (&optional value)
`(return-from nil ,value))
;; FIXME: Should be (EVAL-WHEN (:compile-toplevel) ...).
(unless (boundp '+go-tag-function-mapping-sym+)
(defconstant +go-tag-function-mapping-sym+ (gensym "GO-FUNCTION"))
(defconstant +go-tag-catch-tag-mapping-sym+ (gensym "GO-CATCH-TAG")))
(defmacro #.+go-tag-function-mapping-sym+ () nil)
(defmacro #.+go-tag-catch-tag-mapping-sym+ () nil)
(defmacro go (tag &environment env)
`(throw ',(cdr (assoc tag (cadr (macroexpand `(,+go-tag-catch-tag-mapping-sym+)
env))
:test 'eq))
(function ,(cdr (assoc tag (cadr (macroexpand `(,+go-tag-function-mapping-sym+)
env))
:test 'eq)))))
(defmacro tagbody (&body body)
(let* (labels-and-catch-tags
labels-and-functions
(catch-tag (gensym "TAGBODY-CATCH-TAG"))
(block-name (gensym "TAGBODY-BLOCK-NAME"))
(return-value-sym (gensym "TAGBODY-RETURN-VALUE"))
(end-marker (gensym "TAGBODY-END"))
(sections
(mapcon (let (current-label
accumulated-clauses
current-function)
(lambda (clause-and-rest)
(let ((clause (car clause-and-rest))
(rest (cdr clause-and-rest)))
(cond
((atom clause)
(when current-function
(pushq (cons current-label current-function)
labels-and-functions)
(pushq (cons current-label catch-tag)
labels-and-catch-tags))
(let ((old-function current-function))
(setq current-label clause
current-function (gensym "TAGBODY-SECTION"))
(prog1
`((,old-function ()
;; Yes, we generate this even when
;; OLD-FUNCTION is NIL. In this
;; case, though, the LABELS form
;; never sees the definition. Grep
;; for (cddr (first sections)) below
;; in order to see how we make use of
;; the generated lambda form instead.
,@(nreverse accumulated-clauses)
#',current-function)
,@(when (endp rest)
`((,current-function ()
',end-marker))))
(setq accumulated-clauses nil))))
(t (pushq clause accumulated-clauses)
(if (endp rest)
(progn
(when current-function
(pushq (cons current-label current-function)
labels-and-functions)
(pushq (cons current-label catch-tag)
labels-and-catch-tags))
`((,current-function ()
,@(nreverse accumulated-clauses)
',end-marker)))
nil))))))
body)))
`(macrolet ((,+go-tag-catch-tag-mapping-sym+ ()
(list 'quote
(list* ,@(mapcar (lambda (x) (list 'quote x))
labels-and-catch-tags)
(,+go-tag-catch-tag-mapping-sym+))))
(,+go-tag-function-mapping-sym+ ()
(list 'quote
(list* ,@(mapcar (lambda (x) (list 'quote x))
labels-and-functions)
(,+go-tag-function-mapping-sym+)))))
(labels (,@(rest sections))
(block ,block-name
(let (,return-value-sym)
(%loop
(setq ,return-value-sym
(catch ',catch-tag
(if ,return-value-sym
(funcall ,return-value-sym)
(progn ,@(cddr (first sections))))))
(when (eq ,return-value-sym ',end-marker)
(return-from ,block-name nil)))))))))
(defmacro prog (bindings &body body)
;;FIXME: declarations
(let ((declarations nil)
(body body))
`(let ,bindings
,@declarations
(tagbody
,@body))))
(defmacro prog* (bindings &body body)
;;FIXME: declarations
(let ((declarations nil)
(body body))
`(let* ,bindings
,@declarations
(tagbody
,@body))))
(defmacro macrolet (bindings &body body)
`(%macrolet ,(mapcar (lambda (binding)
`(,(car binding)
,@(make-defmacro-body (cadr binding)
(cddr binding))))
bindings)
,@body))
(defmacro flet (bindings &body body)
`(%flet ,(mapcar (lambda (binding)
`(,(car binding)
,@(make-defun-body (cadr binding)
(cddr binding))))
bindings)
,@body))
(defmacro multiple-value-call (function-form &rest forms)
(let ((args `(mapcan 'identity (list ,@(mapcar (lambda (form) `(multiple-value-list ,form)))))))
`(apply ,function-form ,args)))
;;(defmacro multiple-value-list (expression)
;; `(multiple-value-call #'list ,expression))
(defmacro multiple-value-bind ((&rest vars) expression &body forms)
`(destructuring-bind ,vars (multiple-value-list ,expression)
,@forms))
(defmacro multiple-value-setq ((&rest vars) expression)
(let ((syms (mapcar (lambda (x) (gensym)) vars)))
`(destructuring-bind ,syms (multiple-value-list ,expression)
(setq ,@(mapcan #'list vars syms))
,(first syms))))
(defmacro multiple-value-prog1 (form &body forms)
(let ((varsym (gensym)))
`(let ((,varsym (multiple-value-list ,form)))
,@forms
(values-list ,varsym))))
(defun values-list (list)
(apply #'values list))
;; FIXME
(defmacro assert (form &optional places datum &rest args)
)
;; FIXME
(defmacro check-type (thing type &rest strings)
)
;; FIXME
(defmacro defsetf (&rest args)
)
;; FIXME
(defun get-setf-expansion (&rest args)
(values nil nil nil `(error "SETF not implemented") `(error "SETF not implemented")))
;; FIXME
(defmacro define-setf-expander (&rest args)
)
| 9,692 | Common Lisp | .lisp | 219 | 30.292237 | 98 | 0.511085 | benkard/toilet | 11 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 8d02f8af149779221953820a0c13446def5c639cb07a165b854e16d15a6bb2e3 | 10,390 | [
-1
] |
10,391 | reader.lisp | benkard_toilet/reader.lisp | ;;; -*- mode: lisp; coding: utf-8 -*-
;;; Toilet Lisp, a Common Lisp subset for the Étoilé runtime.
;;; Copyright (C) 2008 Matthias Andreas Benkard.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(in-package #:common-lisp)
(export '(read read-preserving-whitespace read-from-string))
(defun read (&optional stream eof-error-p eof-value recursive-p)
(send-by-name (find-objc-class "MLKReader")
"readFromStream:eofError:eofValue:recursive:preserveWhitespace:"
stream
eof-error-p ;FIXME: this isn't a BOOL
eof-value
recursive-p
nil)) ;FIXME: this neither
(defun read-preserving-whitespace (&optional stream eof-error-p eof-value recursive-p)
(send-by-name (find-objc-class "MLKReader")
"readFromStream:eofError:eofValue:recursive:preserveWhitespace:"
stream
eof-error-p ;FIXME: this isn't a BOOL
eof-value
recursive-p
t)) ;FIXME: this neither
(defun read-from-string (string &optional eof-error-p eof-value
&key start end preserve-whitespace)
(let ((stream (send-by-name (find-objc-class "MLKStringInputStream")
"streamWithString:"
string)))
(send-by-name (find-objc-class "MLKReader")
"readFromStream:eofError:eofValue:recursive:preserveWhitespace:"
stream
eof-error-p
eof-value
nil
preserve-whitespace)))
(defun set-dispatch-macro-character (char subchar function &optional readtable)
(unless readtable
(setq readtable *readtable*))
(let ((dispatcher (send-by-name readtable "macroFunctionForCharacter:" char)))
(send-by-name dispatcher "setMacroFunction:forCharacter:" function subchar)))
| 2,561 | Common Lisp | .lisp | 51 | 41.058824 | 86 | 0.640544 | benkard/toilet | 11 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:26:41 AM (Europe/Amsterdam) | 8131b42df88de911839cef3fa84a55a0576a1148b8d06a83456540e04be0e222 | 10,391 | [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.