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
36,978
file-ordering.isc
lisp-mirror_gendl/documentation/tutorial/source/file-ordering.isc
;; ;; Copyright 2002, 2009, 2012 Genworks International ;; ;; This source file is part of the General-purpose Declarative ;; Language project (GDL). ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; ("package" "parameters" "introduction" "installation" "basic-operation" "upgrade-notes" "understanding-common-lisp" "understanding-gendl" "advanced-common-lisp" "advanced-gendl" "tasty-environment" "gendl-geometry" "custom-user-interfaces" "bibliography")
1,119
Common Lisp
.l
23
46.782609
94
0.756387
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
3b26fb58cea6d3cbcf36abec447a9408d1dbf9e9b42442999865c82e72c71691
36,978
[ -1 ]
36,985
understanding-gendl.gdl
lisp-mirror_gendl/documentation/tutorial/source/understanding-gendl.gdl
;; ;; Copyright 2002, 2009, 2012 Genworks International ;; ;; This source file is part of the General-purpose Declarative ;; Language project (GDL). ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; (in-package :gendl-doc) (defparameter *understanding-gendl* `((:chapter :title "Understanding GDL --- Core GDL Syntax") (:p "Now that you have a basic familiarity with Common Lisp syntax (or, more accurately, the " (:emph "absence") " of syntax), we will move directly into the Genworks GDL framework. By using GDL you can formulate most of your engineering and computing problems in a natural way, without becoming involved in the complexity of the Common Lisp Object System (CLOS).") (:p "As discussed in the previous chapter, GDL is based on and is a superset of ANSI Common Lisp. Because ANSI CL is unencumbered and is an open standard, with several commercial and free implementations, it is a good wager that applications written in it will continue to be usable for the balance of this century, and beyond. Many commercial products have a shelf life only until a new product comes along. Being based in ANSI Common Lisp ensures GDL's permanence.") (:p "[The GDL product is a commercially available KBE system with Proprietary licensing. The Gendl Project is an open-source Common Lisp library which contains the core language kernel of GDL, and is licensed under the terms of the Affero Gnu Public License. The core GDL language is a proposed standard for a vendor-neutral KBE language.]") ((:section :title "Defining a Working Package") (:p "In Common Lisp, " (:emph "packages") " are a mechanism to separate symbols into namespaces. Using packages it is possible to avoid ``naming'' conflicts in large projects. Consider this analogy: in the United States, telephone numbers are preceded by a three-digit area code and then consist of a seven-digit number. The same seven-digit number can occur in two or more separate area codes, without causing a conflict.") (:p "The macro " (:texttt "gdl:define-package") " is used to set up a new working package in GDL.") (:p " ") (:p "Example:" (:verbatim "(gdl:define-package :yoyodyne)") " will establish a new package (i.e. ``area code'') called " (:texttt ":yoyodyne") " which has all the GDL operators available.") (:p "The " (:texttt ":gdl-user") " package is an empty, pre-defined package for your use if you do not wish to make a new package just for scratch work.") (:p "For real projects it is recommended that you make and work in your own GDL package, defined as above with " (:texttt "gdl:define-package") ".") (:p (:emph "A Note for advanced users:") " Packages defined with " (:texttt "gdl:define-package") " will implicitly " (:emph "use") " the " (:texttt ":gdl") " package and the " (:texttt ":common-lisp") " package, so you will have access to all exported symbols in these packages without prefixing them with their package name. You may extend this behavior, by calling " (:texttt "gdl:define-package") " and adding additional packages to use with " (:texttt "(:use ...)") ". For example, if you want to work in a package with access to GDL operators, Common Lisp operators, and symbols from the " (:texttt ":cl-json") " package " (:footnote "CL-JSON is a free third-party library for handling JSON format, a common data format used for Internet applications.") ", you could set it up as follows:" (:verbatim " (ql:quickload :cl-json) (gdl:define-package :yoyodyne (:use :cl-json))") "The first form ensures that the cl-json code module is actually fetched and loaded. The second form defines a package with the " (:texttt ":cl-json") " operators available to it.")) ((:section :title "Define-Object") (:index "objects!defining") (:emph (:indexed "Define-object")) " is the basic macro for defining objects in GDL. An object definition maps directly into a Lisp (CLOS) class definition. The " (:texttt "define-object") " macro takes three basic arguments:" ((:list :style :itemize) (:item "a " (:emph "name") ", which is a symbol;") (:item "a " (:emph (:indexed "mixin-list")) ", which is a list of symbols naming other objects from which the current object will inherit characteristics;") (:item "a " (:emph (:indexed "specification-plist")) ", which is spliced in (i.e.\\ doesn't have its own surrounding parentheses) after the mixin-list, and describes the object model by specifying properties of the object (messages, contained objects, etc.) The specification-plist typically makes up the bulk of the object definition.")) " Here are descriptions of the most common keywords making up the specification-plist:" ((:list :style :description) ((:item :word (:indexed "input-slots")) "specify information to be passed into the object instance when it is created.") ((:item :word (:indexed "computed-slots")) "are actually cached methods, with expressions to compute and return a value.") ((:item :word (:indexed "objects")) "specify other instances to be ``contained'' within this instance.") ((:item :word (:indexed "functions")) "are (uncached) functions ``of'' the object, i.e.\\ they operate just as normal CL functions, and accept arguments just like normal CL functions, with the added feature that you can also use " (:emph "the") " referencing, to refer to messages or reference chains which are available to the current object.")) "Figure " (:ref "fig:object-hello") " shows a simple example, which contains two input-slots, " (:texttt "first-name") " and " (:texttt "last-name") ", and a single computed-slot, " (:texttt "greeting") "." ((:boxed-figure :caption "Example of Simple Object Definition" :label "fig:object-hello") (:verbatim " (define-object hello () :input-slots (first-name last-name) :computed-slots ((greeting (format nil \"Hello, ~a ~a!!\" (the first-name) (the last-name))))) ")) "A GDL Object is analogous in some ways to a CL " (:texttt "defun") ", where the input-slots are like arguments to the function, and the computed-slots are like return-values. But seen another way, each slot in a GDL object serves as function in its own right. The referencing macro " (:texttt (:indexed "the")) " shadows CL's " (:texttt "the") " (which is a seldom-used type declaration operator). " (:texttt "The") " in GDL is a macro which is used to reference the value of other messages within the same object or within contained objects. In the above example, we are using " (:texttt "the") " to refer to the values of the messages (input-slots) named " (:texttt "first-name") " and " (:texttt "last-name") ". Note that messages used with " (:texttt "the") " are given as symbols. These symbols are unaffected by the current Lisp " (:texttt "*package*") ", so they can be specified either as plain unquoted symbols or as keyword symbols (i.e.\\ preceded by a colon), and the " (:texttt "the") " macro will process them appropriately.") ((:section :title "Making Instances and Sending Messages") "Once we have defined an object, such as the example above, we can use the constructor function " (:texttt (:indexed "make-object")) " in order to create an " (:emph "instance") " of it. " (:emph "Instance") ", in this context, means a single occurence of the object with tangible values assigned to its input-slots. By way of analogy: an " (:emph "object definition") " is like a blueprint for a house; an " (:emph "instance") " is like an actual house. The " (:texttt "make-object") " function is very similar to the CLOS " (:texttt (:indexed "make-instance")) " function. Here we create an instance of " (:texttt "hello") " with specified values for " (:texttt "first-name") " and " (:texttt "last-name") " (the required input-slots), and assign this instance as the value of the symbol " (:texttt "my-instance") ":" (:verbatim " GDL-USER(16): (setq my-instance (make-object 'hello :first-name \"John\" :last-name \"Doe\")) #<HELLO @ #x218f39c2>") "Note that keyword symbols are used to ``tag'' the input values. And the return-value of " (:emph "make-object") " is an instance of class " (:texttt "hello") ". Now that we have an instance, we can use the operator " (:texttt (:indexed "the-object")) " to send messages to this instance:" (:verbatim " GDL-USER(17): (the-object my-instance greeting) \"Hello, John Doe!!\"") (:texttt "The-object") " is similar to " (:texttt "the") ", but as its first argument it takes an expression which evaluates to an object instance. " (:texttt "The") ", by contrast, assumes that the object instance is the lexical variable " (:texttt (:indexed "self")) ", which is automatically set within the lexical context of a " (:texttt "define-object") ". Like " (:texttt "the") ", " (:texttt "the-object") " evaluates all but the first of its arguments as package-immune symbols, so although keyword symbols may be used, this is not a requirement, and plain, unquoted symbols will work just fine. For convenience, you can also set " (:texttt "self") " manually at the CL Command Prompt, and use " (:texttt "the") " instead of " (:texttt "the-object") " for referencing:" (:verbatim " GDL-USER(18): (setq self (make-object 'hello :first-name \"John\" :last-name \"Doe\")) #<HELLO @ #x218f406a> GDL-USER(19): (the greeting) \"Hello, John Doe!!\"") "In actual fact, " (:texttt "(the ...)") " simply expands into " (:texttt "(the-object self ...)") ".") ((:section :title "Objects") (:index "objects") (:index "containment!object") (:index "objects!child") (:index "objects!contained") "The " (:texttt ":objects") " keyword specifies a list of ``contained'' instances, where each instance is considered to be a ``child'' object of the current object. Each child object is of a specified type, which itself must be defined with " (:texttt "define-object") " before the child object can be instantiated. Inputs to each instance are specified as a plist of keywords and value expressions, spliced in after the object's name and type specification. These inputs must match the inputs protocol (i.e.\\ the input-slots) of the object being instantiated. Figure " (:ref "fig:object-city") " shows an example of an object which contains some child objects." ((:boxed-figure :caption "Object Containing Child Objects" :label "fig:object-city") (:verbatim " (define-object city () :computed-slots ((total-water-usage (+ (the hotel water-usage) (the bank water-usage)))) :objects ((hotel :type 'hotel :size :large) (bank :type 'bank :size :medium))) ")) "In this example, " (:texttt "hotel") " and " (:texttt "bank") " are presumed to be already (or soon to be) defined as objects themselves, which each answer the " (:texttt "water-usage") " message. The " (:emph (:indexed "reference chains")) ":" (:verbatim "(the hotel water-usage)") " and " (:verbatim "(the bank water-usage)") " provide the mechanism to access messages within the child object instances. These child objects become instantiated " (:emph "on demand") ", which means that the first time these instances, or any of their messages, are referenced, the actual instance will be created " (:emph "and") " cached for future reference.") ((:boxed-figure :caption "Sample Data and Object Definition to Contain U.S. Presidents" :label "fig:object-presidents-container") (:verbatim " (defparameter *presidents-data* '((:name \"Carter\" :term 1976) (:name \"Reagan\" :term 1980) (:name \"Bush\" :term 1988) (:name \"Clinton\" :term 1992))) (define-object presidents-container () :input-slots ((data *presidents-data*)) :objects ((presidents :type 'president :sequence (:size (length (the data))) :name (getf (nth (the-child index) (the data)) :name) :term (getf (nth (the-child index) (the data)) :term)))) ")) ((:section :title "Sequences of Objects and Input-slots with a Default Expression") "Objects may be " (:emph "sequenced") (:index "Objects!sequenced") (:index "sequences") (:index "object sequences") ", to specify, in effect, an array or list of object instances. The most common type of sequence is called a " (:emph "fixed size") " sequence. See Figure " (:ref "fig:object-presidents-container") " for an example of an object which contains a sequenced set of instances representing successive U.S. presidents. Each member of the sequenced set is fed inputs from a list of plists, which simulates a relational database table (essentially a ``list of rows''). Note the following from this example:" ((:list :style :itemize) (:item "In order to sequence an object, the input keyword " (:texttt ":sequence") " is added, with a list consisting of the keyword " (:texttt (:indexed ":size")) " followed by an expression which must evaluate to a number.") (:item "In the input-slots, " (:texttt "data") " is specified together with a default expression. Used this way, input-slots function as a hybrid of computed-slots and input-slots, allowing a " (:emph "default expression") " as with computed-slots, but allowing a value to be passed in on instantiation or from the parent, as with an input-slot which has no default expression. A passed-in value will override the default expression."))) ((:section :title "Summary") "This chapter has provided an introduction to the core GDL syntax. As with any language, practice (that is, usage) makes perfect. The chapters that follow will cover more specialized aspects of the GDL language, introducing additional Common Lisp concepts as they are required along the way.")))
16,029
Common Lisp
.l
370
36.659459
106
0.651508
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
60496b8b353da1863c8d8b611d83cc61b8eb9b7fcc11582b79080f58823ebf91
36,985
[ -1 ]
36,989
advanced-gendl.gdl
lisp-mirror_gendl/documentation/tutorial/source/advanced-gendl.gdl
;; ;; Copyright 2002, 2009, 2012 Genworks International ;; ;; This source file is part of the General-purpose Declarative ;; Language project (GDL). ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; (in-package :gendl-doc) (defparameter *advanced-gendl* `((:chapter :title "Advanced GDL") ))
951
Common Lisp
.l
24
38
70
0.751082
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
c28a51fb0b288e1ff8580068c4ad2c3b4fbdbf3e1f8757a76b97cadbcc216af3
36,989
[ -1 ]
36,994
gwl-usage.txt
lisp-mirror_gendl/documentation/historical/doc/gwl-usage.txt
;; ;; Copyright 2002, 2009 Genworks International ;; ;; This source file is part of the General-purpose Declarative ;; Language project (GDL). ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; Basic GWL Overview and Syntax ============================= This file contains basic information and usage instructions for the Generative Web Language System (GWL), as it ships with General-purpose Declarative Language (GDL). 1 Testing your Installation =========================== After you have installed according to install.htm: o Make sure you have started AllegroServe with: (net.aserve:start :port 9000) (you may choose any free port in place of 9000) o In your web browser, go to: http://<hostname>:<port>/demos/robot e.g. http://localhost:9000/demos/robot You should see a page with a simple robot assembly made from boxes. If the robot shows up as well as the orange graphical "compass" below the graphics viewport, your installation is likely working correctly. If you are interested you can see the code for this test part in <gdl-home>/gwl-samples/source/robot.lisp 2 Syntax ============ The following describes the syntax which is specific to GWL as distinct from the underlying host language (i.e. GDL) In general, the full capabilities of the host language remain available under GWL. Please see Common Lisp and/or GDL documentation as appropriate. 2.1 GWL:Define-Package ====================== The macro Gwl:Define-Package is used to set up a new working package in Gwl. To see exactly what it is doing, try a macroexpand-1 on a call to Gwl:Define-Package. Example: (Gwl:define-package :Gwl-user) The :Gwl-user package is an empty, pre-defined package for your use if you do not wish to make a new package just for scratch work. For real projects it is recommended that you make and work in your own Gwl package. 3 Basic Usage ============= Every gdl object whose instances are to be presented as a web page in an application must: 1. Mix in base-html-sheet or a subclass thereof; 2. define a :function called Write-HTML-Sheet The Write-HTML-Sheet function is a normal HTML synthesis function which should make use of the htmlgen "html" macro. It does not need to take any arguments. Please see the htmlgen documentation (in <gdl-home>/doc/aserve/) with the AllegroServe distribution for full details on the use of htmlgen. Example: (define-object president (base-html-sheet) :input-slots ((name "Carter") (term 1976)) :functions ((write-html-sheet () (html (:html (:head (:title (format nil "Info on President: ~a" (the name)))) (:body (:table (:tr (:td "Name") (:td "Term")) (:tr (:td (:princ (the name))) (:td (:princ (the term))))))))))) Access this part with the URL: http://<host>:<port>/make?part=gwl-user::president Once a page has been defined with its Write-HTML-Sheet function, a user may instantiate it by visiting the pre-defined search URL ``make'' and specifying the symbol for the part type after the question mark, for example: http://mie.genworks.com:9000/make?part=gwl-user::president (Note you would not need the double-colon if "president" were exported from "gwl-user" package). The above URL would display the resultant HTML from running its Write-HTML-Sheet function with default toplevel inputs. Presentation of a form for toplevel inputs is not yet implemented in Gwl. 4 Page Linking ============== Creating hypertext links to other pages in the page hierarchy is generally accomplished with the built-in method :Write-Self-Link. This method, when called on a particular page instance, will write a hypertext link referring to that page instance. The hypertext link is made up from the unique root-path of the target part, as well as an instance-id, which identifies the particular root-level instance which is the ``root'' of the relevant page hierarchy. While this may in some cases correspond to one "user" or session, in general there can be a many-to-many relationship between user sessions and root-level instances. In the current implementation there is no direct support for multiple users sharing the same instance. Currently nothing prevents multiple users from multiple web browsers from visiting the same instance; however there is not yet any automatic concurrency control for multiple users modifying the underlying parts, so for an interactive application with fillout-forms, the underlying parts could get into an inconsistent state. Example: (define-object presidents-container (base-html-sheet) :input-slots ((data '((:last-name "Carter" :term 1976) (:last-name "Clinton" :term 1992)))) :objects ((presidents :type 'president-display :sequence (:size (length (the data))) :last-name (getf (nth (the-child index) (the data)) :last-name) :term (getf (nth (the-child index) (the data)) :term))) :functions ((write-html-sheet () (html (:html (:head (:title "Links to Presidents")) (:body (:h1 "Links to the Presidents") (:ol (dolist (president (list-elements (the presidents))) (html (:li (the-object president (write-self-link)))))))))))) (define-object president-display (base-html-sheet) :input-slots (last-name term) :computed-slots ((strings-for-display (the last-name))) :functions ((write-html-sheet () (html (:html (:head (:title (:princ (the last-name)))) (:body (:h1 (:princ (the last-name))) "Term: " (:princ (the term)) (:p (the (write-back-link))))))))) Access this part with the URL: http://<host>:<port>/make?part=gwl-user::presidents-container The write-html-sheet function in presidents-container will write an enumerated list, where each item in the list will be a hypertext link leading to the respective President's actual page instance. The label text to be displayed for the link will default to the strings-for-display of the given President object, which defaults to the page name and index number. This default can be overridden as necessary. Note the use of the write-back-link function in presidents-display. This will generate a link back to the return-object of the object, which defaults to the object's parent. 5 Form Handling =============== ******************* NOTE: This section is outdated. The forms interface for GWL has been upgraded with the base-form-control object. Please see the reference documentation in the GWL package for base-form-control for detailed instructions on its use. This section will be updated to reflect the new practices. ******************* Forms are generated using the gwl macro with-html-form. You wrap this macro around the HTMLgen code which creates the contents of the form: (with-html-form () ;; the body of your form goes here ) This macro generates code similar to the following (do not be concerned if you do not understand the meaning of the following code): ((:form :method :post :action "/answer") ;; ;; Some internal GWL code goes here automatically ;; ;; the body of your form goes here ) The above code-snippet would be included in a Write-HTML-Sheet function of a page definition. By default, the same object which generates the form will also respond to the form, and is also the object which will have its settable slots modified based on form fields (i.e. html "inputs") of the same name. You can override the default by specifying a "bashee" and/or "respondent" as slots in the requestor object (i.e. the object which is generating the form), for example: :computed-slots ((respondent (the some-other-object)) (bashee (the yet-another-object))) Any :settable :computed-slots in the bashee object (which, again, defaults to the "requestor," i.e. the same object which is generating the form) may be specified as :input values in the form. Their types will be inferred automatically and converted appropriately. If a type on a slot is variable, it is best to make its default be a string, then have your application read from the string (with the "read-safe-string" function). Note that only those input values which have actually changed (according to equalp) will be set into the corresponding :computed-slot. Ones which remain the same will be left alone (to avoid unnecessary dependency updating in the model). Any :input values in the form which are not :settable :computed-slots in the object will be collected and returned as part of the special query-plist message when the response page's write-html-sheet method is invoked, where query-plist is a plist containing keywords representing the form field names, and values which will be strings representing the submitted values. (define-object hello-form (base-html-sheet) :computed-slots ((username "Jack" :settable)) :functions ((write-html-sheet () (html (:html (:head (:title "Sample Form")) (:body (:p "Hello there, " (:princ (the username)) "!") (:p (with-html-form () ((:input :type :text :name :username :value (the username))) ((:input :type :submit :name :submit :value " Change Name! ")))))))))) Access this part with the URL: http://<host>:<port>/make?part=gwl-user::hello-form 6 Including Graphics ==================== The techniques for displaying graphics with GWL is not completely finalized, but the folowing example is how to do it for now. Note the use of the view-object :hidden-object, and the write-geometry method: (define-object box-display (base-html-sheet) :computed-slots ((length 10 :settable) (width 10 :settable) (height 10 :settable)) :objects ((box :type 'box)) ;; :length, :width, :height are descendant. :hidden-objects ((view-object :type 'graphics-preferences :object (the box) ;; can also be a list :main-sheet self :width 500 :height 500 ;; image pixel resolution ;;(the :view) defaults to :trimetric. :projection-vector (getf *standard-views* (the view)))) :functions ((write-html-sheet () (html (:html (:head (:title "Box Display")) ((:body :bgcolor (gethash :quartz *color-table*)) (:center (:h2 "Box Display")) ((with-html-form () (:table (:tr (:td "Length:") (:td ((:input :type :text :name :length :size 5 :value (the length))))) (:tr (:td "Height:") (:td ((:input :type :text :name :height :size 5 :value (the height))))) (:tr (:td "Width:") (:td ((:input :type :text :name :width :size 5 :value (the width)))))) (:p ((:input :type :submit :name :submit :value " OK ")))) (:p (the (write-geometry)))))))))) Access this part with the URL: http://<host>:<port>/make?part=gwl-user::box-display 7 Publishing URLs for GWL Objects ================================= You can publish a URL for a given part, to avoid having to type the "make?" expression in the URL, using the AllegroServe publish function, as per the following example: (publish :path "/demos/bus" :function #'(lambda(req ent) (gwl-make-object req ent "bus:assembly"))) 8 Sample Applications ===================== We distribute three sample applications, in the <gdl-home>/gwl-samples/ directory: robot.lisp (the simple test part described above) ledger (a small application for keeping track of accounts and transactions) bus (a basic North American school bus model)
12,257
Common Lisp
.l
289
38.82699
81
0.719017
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
df9c3a61a6040f16d37f8d161e9bb49b25a7e1c05eba2410196dc70b502374a8
36,994
[ -1 ]
36,995
utilities.txt
lisp-mirror_gendl/documentation/historical/doc/utilities.txt
;; ;; Copyright 2002, 2009 Genworks International ;; ;; This source file is part of the General-purpose Declarative ;; Language project (GDL). ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; Utility Functions, Macros, and Types Defined in GDL ==================================================== NOTE: These are also included in the reference documentation available from a running GDL session at http://localhost:<port>/yadd (defun 3d-distance (point-1 point-2) "Return a number which is the three-dimensional distance from point-1 to point-2") (defun 3d-vector-to-array (vector) "Returns a Lisp array of numbers from a 3d-vector.") ;; ;; NOTE: matrix:add-matrix is also available, from the CMU repository. ;; it works similarly to this function. ;; (defun add-matrices (&rest matrices) "Adds together matrices of similar rank.") (defun add-vectors (&rest vectors) "Return a new vector, the result of addition") (defun alignment (axis1 vector1 &optional axis2 vector2 axis3 vector3) "Returns a transformation matrix corresponding to the given axes and vectors. Axis3 and vector3 should be given only if you want the transformation matrix to have a left-handed coordinate system -- otherwise vector3 will default to the cross of vector1 and vector2 (in the appropriate order).") (defun alist2plist (alist) "Returns a plist converted from an assoc-list") (defun always (arg) "Always returns T.") (defun angle-between-vectors (vector-1 vector-2 &optional reference-vector &key (epsilon *zero-epsilon*) -ve) "Returns smallest positive angle between vector-1 and vector-2, if reference-vector is nil. If non-nil, reference-vector indicates the direction of positive rotation. If -ve is non-nil, true negative angles will be returned. Epsilon is used to check for angles close to zero or 2pi.") (defun angle-between-vectors-d (vector-1 vector-2 &optional reference-vector -ve) "return the angle (in degrees) between the two vectors, in degrees. If no reference-vector given, return smallest possible angle. If direction vector is given, return according to right-hand rule. If \"-ve\" is given, return negative number for angle if it really is negative according to right-hand rule.") (defun array-to-3d-vector (array) "Returns a 3d-vector from a 3-by-1 Lisp array of numbers.") (defun coincident-point? (point-1 point-2 &key (tolerance *zero-epsilon*)) "Returns t if the distance between point-1 and point-2 is less than epsilon. The default epsilon is *zero-epsilon*.") ;; ;;NOTE: create-obliqueness currently computes absolute obliqueness - ;; computation relative to self's parent is not yet implemented.") ;; (defun create-obliqueness (v1 name-v1 v2 name-v2 self) "Compute absolute transformation matrix. v1 and v2 are vectors, name-v1 and name-v2 are direction keywords such as :front, :right, etc. v1 and v2 should be normal to each other.") (defun cross-vectors (vector-1 vector-2) "Compute the cross-product of vector-1 and vector-2, a new vector.") (defun degree (degrees &optional (minutes 0) (seconds 0)) "Converts degrees to radians") (defun dot-vectors (vector-1 vector-2) "Compute the dot-product of vector-1 and vector-2, a number.") (defun ensure-list (possible-list) "Returns a list from possible-list") (defun flatten (list) "Returns a flat list with all nesting (and all NIL values) removed.") (defun get-x (point) "Returns X component of point or vector") (defun get-y (point) "Returns Y component of point or vector") (defun get-z (point) "Returns Z component of point or vector") (defun half (num) "Divides number by two.") (defun index-filter (function list) "Returns items from list for whose indices function is true.") (defun inter-circle-circle (center-1 radius-1 center-2 radius-2 positive-angle? &key (tolerance *zero-epsilon*)) "Returns one of two points of intersection between two circles, or NIL if there is no intersection.") (defun inter-circle-sphere (circle-center circle-radius circle-plane-normal sphere-center sphere-radius positive-angle? &key (tolerance *zero-epsilon*)) "Returns one of two points of intersection between circle and sphere, or NIL if there is no intersection.") (defun inter-line-plane (p-line u-line p-plane u-plane) "Return single point of intersection between line and plane or NIL if no intersections. p-line is a point on the line, u-line is direction vector of the line, p-plane is a point on the plane, and u-plane is normal vector to the plane.") (defun inter-line-sphere (p-line u-line center radius side-vector) "Takes point on the line (p-line), direction vector of line (u-line), center of sphere (center), radius of sphere (radius), and a side-selection vector (side-vector) to decide between two possible intersections, and return either a point or NIL.") (defun lastcar (list) "Returns last element of list.") (defun length-vector (vector) "Returns the vector's magnitude.") (defun list-of-numbers (num1 num2 &optional (increment 1)) "Returns a list of numbers starting from num2 going to num2 incremented by increment.") (defun make-keyword (string) "Converts string or symbol into a keyword symbol.") (defmacro make-vector (x y z) "Return a 3D vector of double-floats.") (defmacro make-point (x y z) "Return a 3D vector of double-floats (points are identical with vectors).") (defun make-transform (list-of-lists) "Converts a list of lists into a tranformation matrix.") (defun mapsend (object-list message) "Sends message, which should evaluate to a keyword, to each object in object-list, and returns a new list with each resultant value.") (defun maptree (node function &optional (accept? #'always) (prune? #'never) (get-children :children)) "Returns the list resulting from applying function to each object in a defpart tree starting from node, accepting only those which pass the accept? function, stopping tree recursion at those which pass the prune? function, and using the get-children message to compute the children of a given object.") (defun matrix*vector (matrix vector) "Multiplies matrix by vector with compatible rank.") ;; ;; From Paul Graham ANSI Common Lisp ;; (defun most (function list) "return member of list which returns max when function applied. As second value return actual max value (return-value of function)") ;; ;; NOTE: matrix:multiply-matrix is also available, from the CMU repository. ;; it works similarly to this function. ;; (defun multiply-matrices (matrix-1 matrix-2) "Multiplies one matrix by another of compatible rank.") (defun near-to? (number near-to &optional (tolerance *zero-epsilon*)) "Predicate to test if number is within tolerance of near-to. The default tolerance is *zero-epsilon*.") (defun near-zero? (number &optional (tolerance *zero-epsilon*)) "Returns T if number is within tolerance of zero.") (defun never (arg) "Always returns NIL.") (defun number-format (number &optional decimal-places) "Returns string representing number rounded to specified number of decimal places.") (defun number-round (number &optional decimal-places) "Returns double-float of number rounded to specified number of decimal places.") (defun orthogonal-component (vector reference-vector) "Returns the vector closest to reference-vector which is normal to vector.") (deftype part-name-symbol () "(typep <object> part-name-symbol) will return true for objects which are symbols naming a defpart.") (defun plist2pairs (plist) "Return a list of lists, each a pair, from a plist") (defun plist-keys (plist) "Return list of the keywords from a plist.") (defun plist-values (plist) "Return list of the values from a plist.") (defmacro print-variables (&rest vars) "Print variable name and value as with prin1, and newline.") (defun projected-vector (vector plane-normal) "Returns new vector representing vector projected onto plane of plane-normal.") (defun proj-point-on-line (3d-point line-point vector) "Returns a 3D-Point. Drops a point onto a line. 3D-point is a global point. Line-point is a point on the line. Vector is a unit vector in the direction of the line.") (defun pythagorize (&rest numbers) "Number. Returns the square root of the sum of the squares of <i>numbers</i>.") (defun radians-to-degrees (radians) "convert radians to degrees") (defun read-safe-string (string) "Returns result of reading values from string without risk of Lisp evaluating anything (e.g. with ``#.'' directive).") (defun replace-substring (string old new) "Returns new string, replacing all occurences of old with new in string") (defun remove-plist-key (plist key) "Return a new plist with specified key and its value removed.") (defun reverse-vector (vector) "Returns the reverse-direction vector.") (defmacro roll (axis angle &rest other-axes-and-angles) "Returns a transformation matrix based on rotation about axis by some angle. Axis is specified symbolically from the following list: [:lateral :longitudinal :vertical]. Angle is specified in radians. Any number of axis-angle pairs can be specified. NOTE: this macro must be called from within the context of a defpart since it relies on the part's local orientation.") (defun rotate-point (point center normal &key (arc-length nil) (angle nil)) "Returns a coordinate rotated about a center in the plane defined by the normal vector. The rotation can be either defined by an arc length or an angle (specified in radians). A second value is also returned. This is the angle of rotation.") (defun rotate-point-d (point center normal &key (arc-length nil) (angle nil)) "Returns a coordinate rotated about a center in the plane defined by the normal vector. The rotation can be either defined by an arc length or an angle (specified in degrees). A second value is also returned. This is the angle of rotation.") (defun rotate-vector (vector angle normal) "Rotates vector, which is a global vector, around normal, which is a vector normal around which to rotate, by an amount of rotation specified by angle, which is given in radians.") (defun rotate-vector-d (vector degrees normal) "Same as rotate-vector, but takes the angle in degrees.") (defun rotation (vector angle) "Returns a transformation matrix based on a rotation of some <i>angle</i>, specified in radians, about an arbitrary <i>vector</i>.") (defun safe-sort (list &rest args) "Same as sort, but does not modify list given as argument.") (defun same-direction-vectors? (vector-1 vector-2 &key (tolerance *zero-epsilon*)) "Predicate to test if angle between two vectors is within tolerance of zero.") (defun scalar*matrix (scalar matrix) "Multiplies the scalar number by the matrix and returns a new matrix.") (defun scalar*vector (scalar vector) "Multiplies the scalar number by the vector and returns a new vector.") (defmacro send (object message) "Send message, which should be a keyword symbol, to object. Unlike the-object, this does not handle reference chains.") (defun split (string &optional (split-chars (list #\space #\newline #\return #\tab))) "Returns a list of strings, the result of splitting string by any of the split-chars.") (defun string-append (&rest args) "Returns concatenated string from args, each of which should be a string") (defun subtract-vectors (&rest vectors) "Return a new vector, the result of subtraction") (defun transform-and-translate-point (vector transform trans-vector) "3D-Point. Returns the product of vector, which is a row vector, and transform, which is a 3x3 rotation matrix, translated by trans-vector.") (defun transform-numeric-point (vector transform) "3D-Point. Returns the product of vector, which is a row vector, and transform, which is a 3x3 rotation matrix.") (defmacro translate (origin &rest offsets) "Translate a point within a defpart instance by any number of directions and distances. Directions can be :up, :down, :left, :right, :front, :rear. Distances should be numbers. example: (translate (the :point) :up 2 :right 3) NOTE: this macro must be called within the context of a defpart since it relies on the part's local orientation.") (defun translate-along-vector (point vector distance) "Return a new point which is the point translated along the vector by the specified distance") (defun transpose-matrix (matrix) "Transpose rows and columns of matrix.") (defun twice (num) "Multiplies number by two.") (defun undefpart (part) "Clears most definitions associated with part, which should be a (quoted) symbol.") (defun unitize-vector (vector) "Returns the normalized unit vector") (defun zero-vector? (vector) "Returns T if vector has zero magnitude.") (defun ^2 (x) "return number squared")
13,540
Common Lisp
.l
258
49.934109
112
0.759259
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
c17964eb15b4b2d88b6db0573e56d8165b3779af68d9464c56e152d408d3af19
36,995
[ -1 ]
36,996
index.xml
lisp-mirror_gendl/documentation/historical/doc/index.xml
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="/static/xsl/clixdoc.xsl" ?> <clix:documentation xmlns='http://www.w3.org/1999/xhtml' xmlns:clix='http://bknr.net/clixdoc'> <clix:title>GDL/GWL 1.5 Documentation </clix:title> <clix:short-description> How to use General-purpose Declarative Language to do "KBE" as well as web applications to deploy those models. </clix:short-description> <h2><center>GDL/GWL 1.5 Documentation</center></h2> <center> <i>interim update for gdl1578</i> </center> <clix:chapter name="contents" title="Contents"></clix:chapter> <clix:contents></clix:contents> <blockquote> <clix:chapter name="abstract" title="Becoming an effective GDL developer"> <p> Becoming effective with GDL consists of three (3) basic skills: <ol> <li> Editing text and managing files with Gnu Emacs (yes, other editors will work, but Emacs provides special support and only Emacs is supported by Genworks); </li> <li> Very basic Common Lisp programming; </li> <li> Writing Object Definitions in GDL itself, using the define-object macro. </li> </ol> </p> <p> Beyond this, if you want to create nice Web applications with GDL, it helps to know something about HTML and server-based computing. But these concepts can be picked up over time and are not necessary to get started or to make simple applications or 3D geometric objects. </p> </clix:chapter> </blockquote> <clix:chapter name="install" title="Basic Installation"> <p> To download the software and retrieve license keys: <ol> <li> Visit the following URL: <pre> http://www.genworks.com/dl </pre> </li> <li> Enter your email address. If you don't have an email address on file with Genworks, send email to licensing -at- genworks -dot- com </li> <li> Read and accept the applicable license agreement and click the checkbox </li> <li> Click the link to download the .zip or .exe install file, and start the download to a known location on your computer. </li> <li> Click the "Retrieve License Key" link, to have your license key file(s) emailed to you. </li> </ol> <p> GDL is currently distributed for all the platforms as a self-contained "zip" file which does not requiring official administrator installation, or an install executable ("exe") file. To install the downloaded software, you can either: <ul> <li>unzip the "zip" file to a known location</li> or <li>run the installer executable (exe) file and follow the prompts</li> </ul> After the GDL application directory is in place (typically in "c:/Program Files" on Windows, or "/usr/local/" on Linux), you have to copy your license file into that GDL application directory. The license file was obtained via email in a previous step, and should be named either "devel.lic" for Enterprise or Student editions, or "gdl.lic" for Professional/Trial versions. Now you can start the GDL development environment by running the included "run-gdl.bat" startup script (Windows) or "run-gdl" script (Linux/Mac). </p> NOTE on Windows, the Start Menu item which gets installed by the Windows installation is not the usual way to start GDL (it will start it without Emacs, which is not what you normally want). This will be updated in a future release, but to start GDL with emacs, you should simply navigate to the GDL installation directory and run the batch file: <pre> run-gdl.bat </pre> This will start Emacs and should give you the welcome screen with instructions for starting GDL itself within Emacs. </p> </clix:chapter> <clix:chapter name="emacs" title="Getting Started with Emacs"> <i>(Note -- a license key file is not required in order to get started with Emacs) </i> <p> Start Emacs with the GDL environment with the "run-gdl.bat" script (Windows) or the "run-gdl" shell-script (Linux). Emacs should come up with instructions for: <ol> <li> doing the Emacs tutorial, </li> <li> starting the GDL process, and </li> <li> special keychord shortcuts for working with GDL </li> </ol> </p> </clix:chapter> <clix:chapter name="cl" title="Getting Started with Common Lisp"> The following resources should provide sufficient CL background to start with GDL: <ul> <li> <a href="blt.pdf"> Basic Lisp Techniques</a> (Chapters 1, 2, 3)</li> <li> <a href="http://www.genworks.com/training-g101"> Online CL Training Slides</a> <i>(designed to be used with lecture)</i></li> <li><a href="http://www.norvig.com/luv-slides.ps"> Norvig and Pitman Lisp Style Guide </a></li> <li> <a href="http://www.franz.com/support/documentation/current/ansicl/ansicl.htm"> Full ANSI Common Lisp Specification</a> <i>(for later reference)</i></li> </ul> </clix:chapter> <clix:chapter name="gdl-start" title="Getting Started with GDL Itself"> <ul> <li><a href="gdl-tutorial.pdf">GDL Tutorial</a> <i>A Tutorial for GDL. This tutorial is somewhat outdated and we hope to have it revised relatively soon, but it still gives a decent overview of the fundamentals.</i></li> <li> <a href="http://www.genworks.com/training-g102"> Online GDL Training Slides</a> <i>(designed to be used with lecture)</i></li> </ul> </clix:chapter> <clix:chapter name="gdl-reference" title="Reference Documentation for GDL Objects, Operators, and Parameters"> <ul> <li><a href="http://www.genworks.com/downloads/customer-documentation/reference/index.html">GDL Reference</a> <i>This is where you will spend 95% of your time after you are familiar with the basics. This documentation is auto-generated from GDL when we do the builds, so it gets updated with every new patch release. We are also working on a context-sensitive interface to this documentation from the live Emacs editing session. For now you have to refer to the Web version, and look up the object, message, or operator you want to know about.</i></li> </ul> </clix:chapter> <clix:chapter name="other-doc" title="Other Documentation and Reference"> Currently, some of these files are in PDF format, some of the files are plaintext, and some are linked HTML. <ul> <li><a href="bootstrap.txt">Managing Projects</a> <i>Utilities for compiling and loading your GDL codebases.</i> </li> <li><a href="usage.txt">GDL Usage</a> <i>Concise GDL Language Specification.</i></li> <li><a href="gwl-usage.txt">GWL Usage</a> <i>Concise syntax guide to Web User Interface layer -- currently being updated for new GDL Ajax features</i></li> <li><a href="ta2.html">Testing and Tracking Utility (Ta2)</a> <i>Overview of GDL's graphical development testing and inspection utility -- this will soon be replaced with a functionally equivalent, but CSS-styled, upgrade, name yet to be determined.</i></li> <li><a href="make-gdl-app.txt">Generating Runtime Applications</a> <i>Generating runtime GDL and GDL/GWL applications (this is under construction, to be released with 1577 Enterprise)</i></li> <li><a href="output-formats.txt">Output Formats and Lenses</a> <i>Creating output from GDL objects in various formats.</i></li> <li><a href="drawing.txt">GDL Drawing Package</a> <i>Creating Engineering Drawings with Dimensions and Annotations, as well as Typeset Text Blocks</i></li> <li><a href="reserved.txt">Reserved Symbols</a> <i>A listing of certain symbols you should avoid using as message names in your own apps, to avoid clashes with pre-defined GDL/GWL message names.</i></li> <li><a href="translators.txt">Conversion Tools</a> <i>Conversion tools for object-oriented code in legacy Lisp-based and KBE formats.</i></li> </ul> </clix:chapter> <clix:chapter name="support" title="Customer Support"> <p> <b>Evaluation and Student Licensees are not entitled to support directly from Genworks.</b> -- Please register for the <a href="http://groups.google.com/group/genworks">Genworks Google Group</a> then post your questions there. </p> <p> For commercial licensees, Genworks Customer support is usually available on U.S. business days from 9am to 5pm Michigan time (Eastern Standard Time, same as New York). Support for all included components of GDL/GWL is provided by Genworks as your single point of contact. Our VAR agreements with vendors such as Franz Inc. and SMS stipulate that Genworks' customers contact only Genworks for support, and not e.g. Franz Inc. or SMS directly. As necessary Genworks will follow up with our vendors for second-level support on Allegro CL, SMLib, etc. </p> <p> Genworks Technical Support can be reached at: <ul> <li>[email protected]</li> <li>+1 248-330-2979</li> (telephone for emergencies only, please). </ul></p> </clix:chapter> <clix:chapter name="copyright-legal" title="Copyright/Legal Notice"> <small><i> All information contained in this documentation set is copyright (c) 2009, Genworks International, and is intended exclusively for use in operating a properly licensed installation of the Genworks GDL/GWL product. It may not be redistributed or otherwise used for any other purpose. </i></small> </clix:chapter> </clix:documentation>
8,978
Common Lisp
.l
206
41.830097
196
0.768396
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
a4149020aec96cb604446988f0ff4d593fe3ff8c93031f5b239ac19618c3dc4f
36,996
[ -1 ]
36,997
ta2.html
lisp-mirror_gendl/documentation/historical/doc/ta2.html
<html> <head><title>Ta2 Introduction</title></head> <body> <h2><center> Ta2 Introduction </center></h2> <i>Note: Ta2 is currently being redesigned with a jQuery and CSS styled front-end, and the name may change. The basic functionality will remain the same.</i> <pre> Testing and Tracking Utility (Ta2) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- You can bring up any object in GDL, which mixes at least base-object into its root-level part, by visiting the URL: http://&lt;host&gt;:&lt;port&gt;/ta2 e.g. http://localhost:9000/ta2 Then enter your object's package::name (or package:name if exported). Ta2 follows the "select-and-match" paradigm -- you first "select" a mode of operation with one of the buttons, then "match" that mode to any object in the tree or inspector by clicking. Here is a rundown of the common buttons. They have tooltips which will pop up when you hover the mouse over them. The ones with "..." mean you first select the button to go into that "mode," then select one or more objects either in the tree or in the inspector to apply the selected action. The ones with "!" do an immediate action. I... Inspect (make the inspector show the selected object). DL... Draw Leaves in graphics viewport (replacing any existing). DN... Draw Node in graphics viewport (replacing any existing). AL... Add Leaves in graphics viewport. AL*... Add Leaves individually (so they can be deleted individually). DL... (duplicate label, needs renaming) Delete Leaves. AN... Add Node in graphics viewport. UN... Update selected node to reflect any compiled code changes. B... Break on selected object. UI... visit UI (if there is a main-sheet or write-html-sheet). UH... visit UI in place of graphics viewport frame. SR... Set Root of tree to selected object. UR! Up Root one level in the tree. RR! Reset Root to true root in the tree. CL! clear the graphics and color/line thickness settings. F! toggle Frames on and off (default is on). U! Update from current node down to reflect any compiled code changes. UF! Update from the root node down to reflect any compiled code changes. Notes: o The toplevel of any object tree instantiated in Ta2 has to mix in at least base-object. o You can directly start a Ta2 session by visiting the "/ta2" uri in your web browser, then specifying either an object name prepended with package name and single or double colon, e.g: gwl-user::robot-assembly or by specifying a Lisp expression which will evaluate to an object instance. o The Break command (either from Ta2 or from the developer links in a normal UI) automatically sets toplevel self to the broken-upon object in the Lisp console window. It no longer actually "breaks" the webserver thread! </pre> </body> </html>
2,957
Common Lisp
.l
56
47.892857
107
0.706843
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
8e9d8e02efbfe76639ec56d834ed382eecfaae49dc716f4439c0c67b598aa0f1
36,997
[ -1 ]
36,998
translators.txt
lisp-mirror_gendl/documentation/historical/doc/translators.txt
;; ;; Copyright 2002, 2009 Genworks International ;; ;; This source file is part of the General-purpose Declarative ;; Language project (GDL). ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; Conversion Tools for Code in Legacy Formats =========================================== GDL provides a limited set of tools for converting legacy code into the GDL native syntax. Currently the tools provide some capability for converting code in the icad-style defpart format. While these tools can help in migrating legacy code, it is recommended that you consider doing new development in the GDL native syntax (described in the file "usage.txt" and in the reference documentation), because this syntax will be better supported by Genworks into the future and is intended as a more general-purpose syntax for all types of applications, not necessarily just CAD-centric ones. This document provides a rough description of the mapping done by the conversion tools; it is by no means exhaustive, and you should still inspect the converted results (using the "convert-defparts" function for example), to ensure that the generated GDL-native code is in fact doing what you intended. Please understand that there are many subtle differences in going from icad, a very large and complex Flavors-based object system, to GDL, a relatively new and simple, small, CLOS-based system. Legacy icad-style code will require testing and vetting, and may require some rewriting, to ensure that it is functioning properly with the GDL compiler and runtime system. 1 Loading the conversion tools ============================== Load the conversion tools using the "require" facility as follows: (require :defpart) If you are licensed for the conversion tools, this will load without errors (currently, all licensed GDL seats are licensed for the conversion tools). 2 Converting code as a one-time process ======================================= You can convert files from the legacy icad-style syntax to GDL-native syntax with the "convert-defparts" function. This function takes either a filename or a directory containing source files, and will convert all defparts, defwriters, and defcompanions to the closest available GDL analogs. Each defpart, defwriter, and defcompanion will be placed in its own output file in the system temporary directory, in a subdirectory named for the package, as follows: /tmp/<package>/<entity-name>.lisp For companions, the filename will be constructed from both the "writer" name and the "object" name making up the companion. 3 Converting code on the fly ============================ You can also keep your legacy code in the legacy format, and the conversion tools will convert it on the fly as part of the compilation process. This is not recommended as a long-term strategy, however, unless you have a requirement to continue using your code both in the legacy icad environment as well as in the GDL environment. Appendix A: GDL Object Hierarchy ================================ For a normal GDL object, the class hierarchy is as follows: T ..Standard-Class ...Vanilla-Mixin ....<local object type> T and Standard-Class are built-in CLOS classes. Vanilla-Mixin is a base GDL type which provides many of the foundational messages for a GDL object. See the reference documentation on vanilla-mixin for details. (note: the name for the GDL "vanilla-mixin" is inspired by the old Steve's Ice Cream in Ann Arbor, MI, and is not connected with "vanilla-mixin" from the Flavors object system). Base-object is mixed into most of the geometric primitives, and you can mix it into your own parts. It provides the basic messages for the reference box sizes, position, and orientation, as well as other standard spatial messages. See the reference documentation for base-object for details. Appendix B: Mapping from defpart to define-object ================================================= Object Definition Sections ========================== defpart -> define-object Note that in all the examples below, message names can be normal symbols, they need not be keyword symbols (although there is no harm in using keywords). The symbol must be literally present at compile time; if you want to evaluate a message name at runtime, you can use the "evaluate" special symbol as in icad. In this case you should stick with keyword symbols: (setq key :length) (the (evaluate key)) == (the length) :inputs -> :input-slots (without default values): ... :input-slots (length width height) ... :optional-inputs -> :input-slots (with default values): Note that each input-slot is within its own set of parentheses, unlike icad optional-inputs which are expressed in plist format: ... :input-slots ((length 10) (width 20) (height (+ (the length) (the width)))) ... :modifiable-inputs, :modifiable-optional-inputs -> In GDL, these are the same as :input-slots described above, with the addition of the :settable modifier for :modifiable-optional-inputs. Required inputs are by defaultt "settable" (i.e. modifiable) and the :settable modifier is not required or added by the translator. :attributes -> :computed-slots Note that each computed-slot is within its own set of parentheses, unlike icad attributes which are expressed in plist format: :computed-slots ((length 10) (width (twice (the length)))) Note also that message names can be normal symbols, they need not be keyword symbols (although there is no harm in using keywords). :modifiable-attributes -> :computed-slots with the :settable modifier keyword: :computed-slots ((length 10 :settable) (width (twice (the length)) :settable)) :parts -> :objects :pseudo-parts -> :hidden-objects The :type of an object or hidden-object _must_ evaluate to a symbol. This means you have to quote it even if it is a literal symbol: :objects ((mybox :type 'box ...)) Special keywords Within a Part Specification: ============================================= :type (:series <num>) -> :type (:size <num>) ... :quantify (:series <num>) -> :sequence (:size <num>) ... :quantify (:variable <list>) -> :sequence (:indices <list>) ... :with-attributes -> :pass-down Positioning and Orienting ========================= There are _no_ special positioning or orienting keywords such as :on-top, :in-front, :postion-about, etc. In GDL you position and orient using :center and :orientation as inputs to the object or as messages defined within the object. See the reference documentation on base-object for more information on this. UPDATE: Based on a customer request, the translator has been supplemented to to handle some of the symbolic :position and :orientation semantics from icad. Currently this feature is not documented and handles only a subset of the keywords. Please contact us if you would like more information on this feature. :methods -> :functions Messages which take arguments are called "functions" in GDL, since they are more similar to Common Lisp functions than CLOS methods in that the arguments to a GDL function cannot be specialized as one would expect with a normal CLOS defmethod. Note however that since GDL is CLOS-based, you are free to define normal CLOS defmethods using GDL object types as argument discriminators, as well as mix in standard CLOS classes with your GDL objects and vice-versa (this ability to mix CLOS classes with GDL objects is true in theory, at the time of this writing however it may need some testing and vetting in real use). As with other message names, the names for :functions can be normal literal unquoted symbols or keyword symbols. The need not be keyword symbols. NOTE: GDL's define-object also supports a :methods section, which contains true CLOS-style methods which can have their arguments specialized in the same manner as normal CLOS methods. This feature is not yet documented so please contact us if you would like more information on it. :spec-attributes, :layout -> Not supported. Consider using the GWL web-based application server system as an alternative to legacy PUI code. Contact us if you require conversion support. :trials -> Not supported. If you are a supported customer, please do not hesitate to contact Genworks for information on several alternative approaches to searching and optimizing. Appendix C: defcompanion, defwriter =================================== In GDL the macros define-view and define-format provide some roughly comparable functionality. Please see the reference documentation for each of these macros for details.
9,625
Common Lisp
.l
191
46.732984
70
0.733326
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
a4dadfae9599a180ff8afa4a422f65ee5de8515fcde14a1253d18df767bd1423
36,998
[ -1 ]
36,999
make-gdl-app.txt
lisp-mirror_gendl/documentation/historical/doc/make-gdl-app.txt
Instructions for Generating a Runtime GDL or GDL/GWL Application ======================================================= Please see the YADD Reference Documentation for make-gdl-app in the GDL package.
231
Common Lisp
.l
5
39.4
68
0.542601
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
fea047efc49fad33010f85c90e423710814508554ad71b90e30f798be50b87d3
36,999
[ -1 ]
37,001
examples.gif
lisp-mirror_gendl/documentation/historical/doc/training-slides/g102/images/examples.gif
GIF89a™&ÚˇˇˇˇfÄÄÄÄÄÄ!˘ !˛' Imported from GIF image: examples.gif,™&@˛HDDDÑB!ÑB!AAAAAAAAÅ@ Å@ Å@ Å@ Å@ Å@ Å@ Å@  @Ä @Ä @Ä @˛Ä @Ä @Ä@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @ÄÄ @Ä @Ä @ @Ä @Ä @ÄÄIJ@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@ @Ä @Ä @@Ä @Ä @Ä @Ä @Ä @ @Ä˛Ä @@Ä@Ä @Ä  @Ä @Ä  @Ä @Ä @Ä @@ÄÄ@IJ @ @@Ä @Ä  @Ä @Ä Ä @Ä Ä  @ @Ä Ä Ä Ä @Ä @Ä ˛@Ä@Ä @Ä @Ä @@Ä@@Ä @Ä @@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä Ä @Ä @Ä @Ä ˛@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä ˛@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @ @Ä @Ä @Ä ˛@Ä @Ä@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@             ˛  @@@@                @@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@DDDÑ ÑB!AAAAAAAAÅ@ Å@ Å@ Å@ Å@ Å@Å@˛@Ä @Ä @Ä @ÄÄ @Ä @Ä @Ä@Ä@Ä @Ä @Ä @ÄÄ @Ä@IJ @Ä@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@ @Ä Ä @Ä @Ä  @ÄIJ Ä @@@@Ä Ä  @@@Ä  @Ä @Ä Ä @Ä @Ä @Ä Ä @˛@@@Ä  @Ä Ä @  ÄÄ @Ä  @Ä @Ä  @Ä   Ä ˛ @Ä @Ä @ @Ä @@Ä Ä @@Ä @Ä@Ä @Ä @@@@@Ä Ä@˛Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @@Ä  Ä @ÄÄ @Ä @Ä @Ä @Ä @Ä @@Ä @Ä ˛@Ä @Ä @Ä @Ä @Ä @Ä @Ä @ @Ä @Ä  @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä@Ä @Ä @Ä @Ä ˛@Ä @Ä @Ä @Ä @Ä @Ä @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@8@@@@@@@@@@@@@@@@@@ ;
8,828
Common Lisp
.l
1
8,828
8,828
0.036701
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
087df139ad167868fbbe87d2f2395bcec3701ac135bc3c4c19a4af1a2edf8eae
37,001
[ -1 ]
37,002
see-also.gif
lisp-mirror_gendl/documentation/historical/doc/training-slides/g102/images/see-also.gif
GIF89a™&ÚˇˇˇˇfÄÄÄÄÄÄ!˘ !˛' Imported from GIF image: see-also.gif,™&@˛HDDDÑB!ÑB!AAAAAAAAÅ@ Å@ Å@ Å@ Å@ Å@ Å@ Å@ @Ä @Ä@˛Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @ @Ä @Ä @Ä @IJ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@ Ä Ä Ä Ä Ä Ä@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@ @Ä Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @IJ Ä @ÄÄ @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @ @Ä Ä @ÄÄ @ÄÄ @˛@ÄÄ @@@Ä @Ä @Ä @Ä @Ä @ @ @@Ä@Ä @ÄÄ @@IJ @@ @ @Ä @Ä @Ä @Ä ÄÄ @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä ˛@Ä @Ä @Ä @Ä @Ä @Ä @Ä @@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä ˛@Ä @Ä @Ä @Ä @Ä @Ä@Ä @Ä @Ä @Ä @Ä @Ä @@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä ˛@Ä @Ä@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@           @  @@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@DÑB!ÑB!AAAAAAAAÅ@ Å@  Å@ Å@ Å@ Å@ ˛ @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä@Ä @Ä @Ä @Ä@Ä @Ä @IJ@Ä @Ä @Ä @Ä @Ä@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@ @Ä @Ä Ä @Ä @IJ @@Ä @ÄÄ @ @Ä@Ä Ä @ @Ä @Ä @Ä @Ä @Ä @Ä   ÄÄÄ @@IJ @ÄÄ @@Ä  @ @@Ä @Ä @Ä @Ä @Ä @Ä @  ÄÄ @ÄÄ @Ä  ˛@@Ä@@ @@Ä @Ä @Ä @Ä @Ä @@Ä @ÄÄ  @Ä @ @Ä@Ä ˛Ä @@@@Ä @Ä @Ä @Ä @Ä @Ä Ä@Ä @@ÄÄ @Ä @Ä @@Ä @IJ @ @@@Ä @Ä @Ä @Ä Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä@Ä @@ ˛ @@Ä  @Ä @Ä @Ä @Ä @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@8@@@@@@@@@@@@@@@@@@ ;
8,828
Common Lisp
.l
1
8,828
8,828
0.037494
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
651b9e53999c62afee35ee0364f626de377f93e6a5b7ce0b055fffe989637116
37,002
[ -1 ]
37,003
optional-inputs.gif
lisp-mirror_gendl/documentation/historical/doc/training-slides/g102/images/optional-inputs.gif
GIF89a&Úˇˇˇˇfææææææ!˘ !˛. Imported from XPM image: optional-inputs.xpm,&@˛HDDDÑB!ÑB!AAAAAAÅ@ Å@ Å@ Å@ Å@ Å@ Å@ Å@  @Ä @Ä @Ä @˛Ä @Ä @Ä @ @Ä @Ä@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @ @Ä @Ä @Ä @Ä @Ä @Ä @Ä @IJ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛ Ä Ä Ä Ä Ä Ä Ä Ä@ Ä@@@@@Ä Ä @ @@Ä@Ä  @˛ @Ä@@Ä @Ä @Ä @Ä @Ä Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @IJ @Ä @Ä @Ä @Ä @Ä @ÄÄ @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä@Ä @IJ @Ä @Ä@Ä @Ä Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @@Ä @Ä @ÄÄ @Ä @Ä @Ä @Ä @Ä @Ä ˛@Ä @Ä @Ä @Ä @Ä @Ä @Ä @@Ä @Ä   @@Ä @Ä Ä @ @Ä@Ä @IJ@@Ä @Ä @ÄÄ @ @Ä Ä @@ @@Ä @@Ä @Ä@Ä @Ä  ˛ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@                                     ˛  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@B!ÑAA@AAAÅ@ @ Å@@Å@  Ş @Ä @Ä @ÄÄÄ  @Ä@Ä @Ä @Ä @Ä@Ä@Ä @Ä @ÄÄ Ä@Ä @Ä@IJ  @Ä @Ä Ä Ä Ä Ä Ä Ä Ä Ä ÄÄ Ä ÄÄ Ä Ä Ä Ä Ä Ä@@@@ Ä Ä Ä Ä Ä IJ Ä Ä Ä Ä @@@@ Ä@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Ä @Ä @Ä @Ä @Ä Ä @IJ @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @ÄÄ @Ä @Ä @IJ @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä@Ä @Ä @Ä @Ä Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä ˛@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @˛ @Ä @Ä @Ä @@Ä @@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @@Ä @Ä @Ä @Ä ˛@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @ÄÄ @Ä @Ä @Ä@Ä @Ä Ä @Ä @Ä @Ä ˛@Ä @Ä @Ä @Ä @Ä@Ä@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@DÑB!AAA@Å@ Å@ Å@ Å@Ä@ ÅÅ@ ˛ÄÄ  @Ä @Ä @ÄÄ @Ä @Ä @Ä @ÄÄ @Ä @@Ä @IJ @Ä  @ @ @ÄÄ @ @Ä@@@@@@@@@@@@@@@@@@@˛@@@@@Ä Ä Ä Ä Ä Ä Ä Ä Ä Ä Ä Ä Ä Ä Ä Ä Ä@@@@@@ ÄÄ @@˛@@ Ä Ä@@@@@@@@@@@  Ä Ä Ä Ä Ä Ä Ä Ä Ä Ä Ä Ä ÄÄ @Ä Ä @˛@Ä@@@Ä  @Ä @ÄÄ @@@Ä @Ä @@ @ÄÄ @Ä  @ÄÄ @Ä ˛@Ä Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä@Ä ˛@Ä Ä @Ä @Ä @Ä @@@Ä  @@Ä @Ä @Ä @ @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä ˛@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä Ä @Ä @Ä @Ä @Ä Ä @Ä @Ä @Ä @Ä @Ä @Ä ˛@Ä @Ä @Ä@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @˛@Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä @Ä@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@˛@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@‘@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ê;
14,856
Common Lisp
.l
1
14,856
14,856
0.038234
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
fdd79c4e8271499dc2a333ae388c77512583e85b0c4afcf7e9c4696f17b1a66d
37,003
[ -1 ]
37,071
wing-drawing-with-typeset-block.pdf
lisp-mirror_gendl/documentation/training/g102/images/wing-drawing-with-typeset-block.pdf
%PDF-1.4 1 0 obj << /Type /Catalog /Pages 3 0 R >> endobj 2 0 obj << /Creator (cl-pdf 2.03f0 - ) /CreationDate (D:20110530205510) >> endobj 3 0 obj << /Type /Pages /Count 1 /Kids [ 5 0 R ] >> endobj 4 0 obj endobj 5 0 obj << /Type /Page /Parent 3 0 R /MediaBox [ 0 0 594.72 841.68 ] /Resources << /XObject << >> /ProcSet [ /PDF /Text ] /ExtGState << >> /Font << /CLF141 8 0 R /CLF140 7 0 R >> >> /Annots [ ] /Rotate 0 /Contents 6 0 R >> endobj 6 0 obj << /Length 48307 >> stream q 1.000 1.000 1.000 RG 1.000 1.000 1.000 rg 0.000 0.000 m 594.720 0.000 l 594.720 841.680 l 0.000 841.680 l 0.000 0.000 l B Q 1.0 0.0 0.0 1.0 297.360 420.840 cm q q 1.000 0.000 0.000 1.000 0.0 0.0 cm -297.360 0.000 297.360 420.840 re W n q 1.0 0.0 0.0 1.0 0.000 0.000 cm q 1.0 0.0 0.0 1.0 -148.680 210.420 cm q 1.0 0.0 0.0 1.0 0.000 0.000 cm q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg S Q Q q 0.459 0.0 0.0 0.459 0.0 0.0 cm q 1.0 0.0 0.0 1.0 -136.533 41.553 cm 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg q 1.0 0.0 0.0 1.0 0.000 0.000 cm q 1.0 0.0 0.0 1.0 6.000 -11.000 cm q 1.000 w 0.000 G -0.500 0.500 185.000 -35.000 re S Q BT 2.000 -27.000 Td /CLF140 25.00 Tf 100.000 Tz [ (Area) -4800 ] TJ ET Q q 1.0 0.0 0.0 1.0 191.000 -11.000 cm q 1.000 w 0.000 G -0.500 0.500 180.000 -35.000 re S Q BT 2.000 -27.000 Td /CLF140 25.00 Tf 100.000 Tz [ (21547.820) -1600 ] TJ ET Q q 1.0 0.0 0.0 1.0 6.000 -46.000 cm q 1.000 w 0.000 G -0.500 0.500 185.000 -65.000 re S Q BT 2.000 -27.000 Td /CLF140 25.00 Tf 100.000 Tz [ (Region) -600 (0) -2400 ] TJ ET BT 2.000 -57.000 Td /CLF140 25.00 Tf 100.000 Tz [ (Volume) -3600 ] TJ ET Q q 1.0 0.0 0.0 1.0 191.000 -46.000 cm q 1.000 w 0.000 G -0.500 0.500 180.000 -65.000 re S Q BT 2.000 -27.000 Td /CLF140 25.00 Tf 100.000 Tz [ (1844.818) -2200 ] TJ ET Q q 1.0 0.0 0.0 1.0 6.000 -111.000 cm q 1.000 w 0.000 G -0.500 0.500 185.000 -65.000 re S Q BT 2.000 -27.000 Td /CLF140 25.00 Tf 100.000 Tz [ (Region) -600 (1) -2400 ] TJ ET BT 2.000 -57.000 Td /CLF140 25.00 Tf 100.000 Tz [ (Volume) -3600 ] TJ ET Q q 1.0 0.0 0.0 1.0 191.000 -111.000 cm q 1.000 w 0.000 G -0.500 0.500 180.000 -65.000 re S Q BT 2.000 -27.000 Td /CLF140 25.00 Tf 100.000 Tz [ (3006.005) -2200 ] TJ ET Q Q BT ET Q Q Q Q Q q 1.000 0.000 0.000 1.000 0.0 0.0 cm -297.360 -420.840 297.360 420.840 re W S q 1.0 0.0 0.0 1.0 0.000 0.000 cm q 1.0 0.0 0.0 1.0 -148.680 -210.420 cm q 1.0 0.0 0.0 1.0 -33.096 -219.040 cm q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -0.406 21.904 m -5.679 21.904 l -0.406 416.176 m -5.679 416.176 l S Q q 2.000 w 0.000 0.502 0.000 RG 0.000 0.000 0.000 rg 14.728 21.904 m 14.728 21.904 l 41.239 21.904 m 41.239 21.904 l 41.239 31.291 m 41.239 31.291 l 41.239 106.391 m 41.239 106.391 l 41.239 181.490 m 41.239 181.490 l 41.239 256.590 m 41.239 256.590 l 41.239 331.689 m 41.239 331.689 l 41.239 406.788 m 41.239 406.788 l 41.239 416.176 m 41.239 416.176 l 41.239 21.904 m 41.239 21.904 l 14.728 416.176 m 14.728 416.176 l 41.239 416.176 m 41.239 416.176 l 0.000 21.904 m 7.793 21.904 15.613 21.904 23.472 21.904 c 28.272 21.904 33.090 21.904 37.925 21.904 c 39.028 21.904 40.134 21.904 41.239 21.904 c 40.049 21.904 38.859 21.904 37.671 21.904 c 31.394 21.904 25.145 21.904 18.924 21.904 c 12.594 21.904 6.288 21.904 0.000 21.904 c 0.000 87.616 0.000 153.328 0.000 219.040 c 0.000 284.752 0.000 350.464 0.000 416.176 c 0.000 21.904 m 0.000 87.616 0.000 153.328 0.000 219.040 c 0.000 284.752 0.000 350.464 0.000 416.176 c 0.000 62.583 m 18.346 62.583 31.405 62.583 41.239 62.583 c 0.000 125.166 m 18.346 125.166 31.405 125.166 41.239 125.166 c 0.000 187.748 m 18.346 187.748 31.405 187.748 41.239 187.748 c 0.000 250.331 m 18.346 250.331 31.405 250.331 41.239 250.331 c 0.000 312.914 m 18.346 312.914 31.405 312.914 41.239 312.914 c 0.000 375.497 m 18.346 375.497 31.405 375.497 41.239 375.497 c 0.000 416.176 m 7.793 416.176 15.613 416.176 23.472 416.176 c 28.272 416.176 33.090 416.176 37.925 416.176 c 39.028 416.176 40.134 416.176 41.239 416.176 c 41.239 284.752 41.239 153.328 41.239 21.904 c 40.134 21.904 39.028 21.904 37.925 21.904 c 33.090 21.904 28.272 21.904 23.472 21.904 c 15.613 21.904 7.793 21.904 0.000 21.904 c 0.000 87.616 0.000 153.328 0.000 219.040 c 0.000 284.752 0.000 350.464 0.000 416.176 c 0.000 21.904 m 0.000 87.616 0.000 153.328 0.000 219.040 c 0.000 284.752 0.000 350.464 0.000 416.176 c 0.000 21.904 m 0.000 87.616 0.000 153.328 0.000 219.040 c 0.000 284.752 0.000 350.464 0.000 416.176 c 41.239 62.583 m 31.405 62.583 18.346 62.583 0.000 62.583 c 41.239 125.166 m 31.405 125.166 18.346 125.166 0.000 125.166 c 41.239 187.748 m 31.405 187.748 18.346 187.748 0.000 187.748 c 41.239 250.331 m 31.405 250.331 18.346 250.331 0.000 250.331 c 41.239 312.914 m 31.405 312.914 18.346 312.914 0.000 312.914 c 41.239 375.497 m 31.405 375.497 18.346 375.497 0.000 375.497 c 41.239 416.176 m 40.049 416.176 38.859 416.176 37.671 416.176 c 31.394 416.176 25.145 416.176 18.924 416.176 c 12.594 416.176 6.288 416.176 0.000 416.176 c 0.000 350.464 0.000 284.752 0.000 219.040 c 0.000 153.328 0.000 87.616 0.000 21.904 c 6.288 21.904 12.594 21.904 18.924 21.904 c 25.145 21.904 31.394 21.904 37.671 21.904 c 38.859 21.904 40.049 21.904 41.239 21.904 c 41.239 153.328 41.239 284.752 41.239 416.176 c 41.239 284.752 41.239 153.328 41.239 21.904 c 41.239 153.328 41.239 284.752 41.239 416.176 c 40.049 416.176 38.859 416.176 37.671 416.176 c 31.394 416.176 25.145 416.176 18.924 416.176 c 12.594 416.176 6.288 416.176 0.000 416.176 c 7.793 416.176 15.613 416.176 23.472 416.176 c 28.272 416.176 33.090 416.176 37.925 416.176 c 39.028 416.176 40.134 416.176 41.239 416.176 c S Q q 2.000 w 1.000 0.000 0.000 RG 0.000 0.000 0.000 rg 73.641 21.904 m 73.641 21.904 l 44.185 21.904 m 44.185 21.904 l 41.239 21.904 m 41.239 21.904 l 41.239 31.291 m 41.239 31.291 l 41.239 106.391 m 41.239 106.391 l 41.239 181.490 m 41.239 181.490 l 41.239 256.590 m 41.239 256.590 l 41.239 331.689 m 41.239 331.689 l 41.239 406.788 m 41.239 406.788 l 41.239 416.176 m 41.239 416.176 l 41.239 21.904 m 41.239 21.904 l 73.641 416.176 m 73.641 416.176 l 44.185 416.176 m 44.185 416.176 l 41.239 416.176 m 41.239 416.176 l 41.239 21.904 m 45.152 21.904 49.084 21.904 53.013 21.904 c 56.253 21.904 59.500 21.904 62.723 21.904 c 65.970 21.904 69.210 21.904 72.392 21.904 c 74.625 21.904 76.860 21.904 78.941 21.904 c 79.867 21.904 80.792 21.904 81.538 21.904 c 81.740 21.904 81.930 21.904 82.087 21.904 c 82.244 21.904 82.371 21.904 82.434 21.904 c 82.494 21.904 82.490 21.904 82.426 21.904 c 82.363 21.904 82.246 21.904 82.103 21.904 c 81.642 21.904 80.931 21.904 80.221 21.904 c 79.143 21.904 77.970 21.904 76.787 21.904 c 74.128 21.904 71.358 21.904 68.585 21.904 c 64.463 21.904 60.281 21.904 56.103 21.904 c 51.147 21.904 46.175 21.904 41.239 21.904 c 46.776 21.904 m 46.776 87.616 46.776 153.328 46.776 219.040 c 46.776 284.752 46.776 350.464 46.776 416.176 c 69.174 21.904 m 69.174 87.616 69.174 153.328 69.174 219.040 c 69.174 284.752 69.174 350.464 69.174 416.176 c 80.881 21.904 m 80.881 87.616 80.881 153.328 80.881 219.040 c 80.881 284.752 80.881 350.464 80.881 416.176 c 80.881 21.904 m 80.881 87.616 80.881 153.328 80.881 219.040 c 80.881 284.752 80.881 350.464 80.881 416.176 c 69.174 21.904 m 69.174 87.616 69.174 153.328 69.174 219.040 c 69.174 284.752 69.174 350.464 69.174 416.176 c 46.776 21.904 m 46.776 87.616 46.776 153.328 46.776 219.040 c 46.776 284.752 46.776 350.464 46.776 416.176 c 41.239 62.583 m 52.061 62.583 58.976 62.583 64.732 62.583 c 75.717 62.583 82.478 62.583 82.478 62.583 c 82.478 62.583 75.717 62.583 64.732 62.583 c 58.976 62.583 52.061 62.583 41.239 62.583 c 41.239 125.166 m 52.061 125.166 58.976 125.166 64.732 125.166 c 75.717 125.166 82.478 125.166 82.478 125.166 c 82.478 125.166 75.717 125.166 64.732 125.166 c 58.976 125.166 52.061 125.166 41.239 125.166 c 41.239 187.748 m 52.061 187.748 58.976 187.748 64.732 187.748 c 75.717 187.748 82.478 187.748 82.478 187.748 c 82.478 187.748 75.717 187.748 64.732 187.748 c 58.976 187.748 52.061 187.748 41.239 187.748 c 41.239 250.331 m 52.061 250.331 58.976 250.331 64.732 250.331 c 75.717 250.331 82.478 250.331 82.478 250.331 c 82.478 250.331 75.717 250.331 64.732 250.331 c 58.976 250.331 52.061 250.331 41.239 250.331 c 41.239 312.914 m 52.061 312.914 58.976 312.914 64.732 312.914 c 75.717 312.914 82.478 312.914 82.478 312.914 c 82.478 312.914 75.717 312.914 64.732 312.914 c 58.976 312.914 52.061 312.914 41.239 312.914 c 41.239 375.497 m 52.061 375.497 58.976 375.497 64.732 375.497 c 75.717 375.497 82.478 375.497 82.478 375.497 c 82.478 375.497 75.717 375.497 64.732 375.497 c 58.976 375.497 52.061 375.497 41.239 375.497 c 41.239 416.176 m 45.152 416.176 49.084 416.176 53.013 416.176 c 56.253 416.176 59.500 416.176 62.723 416.176 c 65.970 416.176 69.210 416.176 72.392 416.176 c 74.625 416.176 76.860 416.176 78.941 416.176 c 79.867 416.176 80.792 416.176 81.538 416.176 c 81.740 416.176 81.930 416.176 82.087 416.176 c 82.244 416.176 82.371 416.176 82.434 416.176 c 82.494 416.176 82.490 416.176 82.426 416.176 c 82.363 416.176 82.246 416.176 82.103 416.176 c 81.642 416.176 80.931 416.176 80.221 416.176 c 79.143 416.176 77.970 416.176 76.787 416.176 c 74.128 416.176 71.358 416.176 68.585 416.176 c 64.463 416.176 60.281 416.176 56.103 416.176 c 51.147 416.176 46.175 416.176 41.239 416.176 c 41.239 284.752 41.239 153.328 41.239 21.904 c 46.175 21.904 51.147 21.904 56.103 21.904 c 60.281 21.904 64.463 21.904 68.585 21.904 c 71.358 21.904 74.128 21.904 76.787 21.904 c 77.970 21.904 79.143 21.904 80.221 21.904 c 80.931 21.904 81.642 21.904 82.103 21.904 c 82.246 21.904 82.363 21.904 82.426 21.904 c 82.490 21.904 82.494 21.904 82.434 21.904 c 82.371 21.904 82.244 21.904 82.087 21.904 c 81.930 21.904 81.740 21.904 81.538 21.904 c 80.792 21.904 79.867 21.904 78.941 21.904 c 76.860 21.904 74.625 21.904 72.392 21.904 c 69.210 21.904 65.970 21.904 62.723 21.904 c 59.500 21.904 56.253 21.904 53.013 21.904 c 49.084 21.904 45.152 21.904 41.239 21.904 c 41.239 153.328 41.239 284.752 41.239 416.176 c 41.239 284.752 41.239 153.328 41.239 21.904 c 41.239 153.328 41.239 284.752 41.239 416.176 c 45.152 416.176 49.084 416.176 53.013 416.176 c 56.253 416.176 59.500 416.176 62.723 416.176 c 65.970 416.176 69.210 416.176 72.392 416.176 c 74.625 416.176 76.860 416.176 78.941 416.176 c 79.867 416.176 80.792 416.176 81.538 416.176 c 81.740 416.176 81.930 416.176 82.087 416.176 c 82.244 416.176 82.371 416.176 82.434 416.176 c 82.494 416.176 82.490 416.176 82.426 416.176 c 82.363 416.176 82.246 416.176 82.103 416.176 c 81.642 416.176 80.931 416.176 80.221 416.176 c 79.143 416.176 77.970 416.176 76.787 416.176 c 74.128 416.176 71.358 416.176 68.585 416.176 c 64.463 416.176 60.281 416.176 56.103 416.176 c 51.147 416.176 46.175 416.176 41.239 416.176 c S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -0.406 21.904 m -5.679 21.904 l S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -0.406 416.176 m -5.679 416.176 l S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg S Q Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -37.558 -197.136 m -37.558 -7.301 l S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -37.558 4.868 m -37.558 197.136 l S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -37.558 -197.136 m -39.079 -191.051 l -37.558 -193.080 l -36.036 -191.051 l -37.558 -197.136 l B Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -37.558 197.136 m -36.036 191.051 l -37.558 193.080 l -39.079 191.051 l -37.558 197.136 l B Q q 1.0 0.0 0.0 1.0 -49.398 -3.042 cm 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg BT /CLF141 6.08 Tf 100.000 Tz (97.2) Tj ET Q Q Q Q q 1.000 0.000 0.000 1.000 0.0 0.0 cm 0.000 0.000 297.360 420.840 re W S q 1.0 0.0 0.0 1.0 0.000 0.000 cm q 1.0 0.0 0.0 1.0 148.680 210.420 cm q 1.0 0.0 0.0 1.0 -120.122 -19.643 cm q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -11.299 -37.813 m 22.195 -31.921 l -11.299 -30.146 m 22.195 -24.253 l -11.299 -22.478 m 22.195 -16.585 l -11.299 -14.810 m 22.195 -8.917 l -11.299 -7.142 m 22.195 -1.249 l -11.299 0.526 m 22.195 6.418 l -11.299 8.193 m 22.195 14.086 l -11.299 15.861 m 22.195 21.754 l -11.299 -37.813 m -11.299 15.861 l 22.195 -1.396 m 22.195 21.754 l 22.195 21.754 m -11.299 15.861 l -11.299 15.861 m -11.299 -37.813 l -11.299 -37.813 m 22.195 -31.921 l 22.195 -31.921 m 22.195 -8.771 l 22.195 -8.771 m 22.195 -1.396 l 22.195 -31.921 m 223.161 3.437 l 22.195 -24.253 m 223.161 11.105 l 22.195 -16.585 m 223.161 18.772 l 22.195 -8.917 m 223.161 26.440 l 26.980 -31.079 m 26.980 -7.929 l 65.259 -24.344 m 65.259 -1.194 l 103.538 -17.609 m 103.538 5.540 l 141.817 -10.875 m 141.817 12.275 l 180.097 -4.140 m 180.097 19.010 l 218.376 2.595 m 218.376 25.744 l 223.161 3.437 m 223.161 26.586 l 22.195 -8.771 m 22.195 -31.921 l 22.195 -31.921 m 223.161 3.437 l 38.740 -71.566 m -16.411 -36.328 l 38.740 -55.591 m -16.411 -20.353 l 38.740 -39.616 m 22.195 -29.045 l 22.195 -29.045 m -16.411 -4.379 l 38.740 -23.642 m 22.195 -13.071 l 22.195 -13.071 m -16.411 11.596 l 38.740 -7.667 m 22.195 2.904 l 22.195 2.904 m -16.411 27.571 l 38.740 8.307 m 22.195 18.879 l 22.195 18.879 m -16.411 43.545 l 38.740 24.282 m -16.411 59.520 l 38.740 40.256 m -16.411 75.494 l 38.740 -71.566 m 38.740 40.256 l 30.862 -66.532 m 30.862 -13.421 l 30.862 -7.823 m 30.862 45.290 l 22.983 -61.498 m 22.983 -9.410 l 22.983 -1.764 m 22.983 50.324 l 15.104 -56.464 m 15.104 -2.138 l 15.104 1.034 m 15.104 55.358 l 7.225 -51.430 m 7.225 60.392 l -0.653 -46.396 m -0.653 65.426 l -8.532 -41.362 m -8.532 70.460 l -16.411 -36.328 m -16.411 75.494 l 38.740 40.256 m 38.740 -71.566 l 38.740 -71.566 m -16.411 -36.328 l -16.411 -36.328 m -16.411 75.494 l -16.411 75.494 m 38.740 40.256 l 30.862 -13.421 m 30.862 -7.823 l 22.983 -9.410 m 22.983 -1.764 l 22.195 -8.771 m 22.195 -1.396 l 15.104 -2.138 m 15.104 1.034 l 22.195 -1.396 m 22.195 -8.771 l 26.980 -7.929 m 26.980 -0.554 l 65.259 -1.194 m 65.259 6.181 l 103.538 5.540 m 103.538 12.916 l 141.817 12.275 m 141.817 19.650 l 180.097 19.010 m 180.097 26.385 l 218.376 25.744 m 218.376 33.120 l 223.161 26.586 m 223.161 33.962 l 22.195 -1.396 m 22.195 -8.771 l 22.195 -1.249 m 223.161 34.108 l 22.195 6.418 m 223.161 41.776 l 22.195 14.086 m 223.161 49.443 l 22.195 21.754 m 223.161 57.111 l 26.980 -0.554 m 26.980 22.596 l 65.259 6.181 m 65.259 29.331 l 103.538 12.916 m 103.538 36.065 l 141.817 19.650 m 141.817 42.800 l 180.097 26.385 m 180.097 49.535 l 218.376 33.120 m 218.376 56.269 l 223.161 33.962 m 223.161 57.111 l 223.161 57.111 m 22.195 21.754 l 22.195 21.754 m 22.195 -1.396 l 223.161 3.437 m 256.655 9.330 l 223.161 11.105 m 256.655 16.997 l 223.161 18.772 m 256.655 24.665 l 223.161 26.440 m 256.655 32.333 l 223.161 34.108 m 256.655 40.001 l 223.161 41.776 m 256.655 47.669 l 223.161 49.443 m 256.655 55.336 l 223.161 57.111 m 256.655 63.004 l 256.655 9.330 m 256.655 63.004 l 223.161 57.111 m 223.161 33.962 l 223.161 33.962 m 223.161 26.586 l 223.161 26.586 m 223.161 3.437 l 223.161 3.437 m 256.655 9.330 l 256.655 9.330 m 256.655 63.004 l 256.655 63.004 m 223.161 57.111 l 239.706 -36.208 m 184.555 -0.970 l 239.706 -20.234 m 184.555 15.004 l 239.706 -4.259 m 223.161 6.312 l 223.161 6.312 m 184.555 30.979 l 239.706 11.715 m 223.161 22.287 l 223.161 22.287 m 184.555 46.953 l 239.706 27.690 m 223.161 38.261 l 223.161 38.261 m 184.555 62.928 l 239.706 43.664 m 223.161 54.236 l 223.161 54.236 m 184.555 78.902 l 239.706 59.639 m 184.555 94.877 l 239.706 75.614 m 184.555 110.851 l 239.706 -36.208 m 239.706 75.614 l 231.827 -31.174 m 231.827 21.937 l 231.827 27.535 m 231.827 80.647 l 223.949 -26.140 m 223.949 25.948 l 223.949 33.593 m 223.949 85.681 l 216.070 -21.106 m 216.070 33.219 l 216.070 36.391 m 216.070 90.715 l 208.191 -16.072 m 208.191 95.749 l 200.312 -11.038 m 200.312 100.783 l 192.434 -6.004 m 192.434 105.817 l 184.555 -0.970 m 184.555 110.851 l 239.706 75.614 m 239.706 -36.208 l 239.706 -36.208 m 184.555 -0.970 l 184.555 -0.970 m 184.555 110.851 l 184.555 110.851 m 239.706 75.614 l 216.070 33.219 m 216.070 36.391 l 223.161 33.962 m 223.161 26.586 l 231.827 21.937 m 231.827 27.535 l 223.949 25.948 m 223.949 33.593 l 223.161 26.586 m 223.161 33.962 l 212.131 37.322 m 215.852 37.976 219.574 38.631 223.295 39.286 c 212.131 37.322 m 215.852 37.976 219.574 38.631 223.295 39.286 c 228.202 38.245 231.695 37.111 234.326 35.926 c 223.161 33.962 m 222.865 34.095 222.569 34.223 222.274 34.345 c 220.981 34.882 219.693 35.329 218.409 35.724 c 216.307 36.370 214.215 36.880 212.131 37.322 c 215.852 37.976 219.574 38.631 223.295 39.286 c 228.202 38.245 231.695 37.111 234.326 35.926 c 230.604 35.271 226.882 34.616 223.161 33.962 c 212.131 37.322 m 215.852 37.976 219.574 38.631 223.295 39.286 c 212.131 37.322 m 215.852 37.976 219.574 38.631 223.295 39.286 c 234.326 28.551 m 231.695 30.727 228.202 34.056 223.295 39.286 c 212.131 37.322 m 213.812 35.529 215.499 33.776 217.192 32.092 c 218.856 30.438 220.527 28.846 222.206 27.394 c 222.524 27.119 222.843 26.850 223.161 26.586 c 226.882 27.241 230.604 27.896 234.326 28.551 c 231.695 30.727 228.202 34.056 223.295 39.286 c 219.574 38.631 215.852 37.976 212.131 37.322 c 224.642 33.244 m 228.363 33.899 232.085 34.554 235.806 35.209 c 230.633 28.809 m 234.354 29.464 238.076 30.119 241.797 30.774 c 233.764 24.739 m 237.486 25.394 241.207 26.049 244.929 26.703 c 233.764 22.259 m 237.486 22.914 241.207 23.569 244.929 24.224 c 230.633 22.191 m 234.354 22.846 238.076 23.500 241.797 24.155 c 224.642 25.411 m 228.363 26.066 232.085 26.721 235.806 27.376 c 234.326 35.926 m 237.220 34.622 239.070 33.258 240.609 31.890 c 243.548 29.279 245.356 26.657 245.356 25.191 c 245.356 23.724 243.548 23.413 240.609 24.557 c 239.070 25.157 237.220 26.156 234.326 28.551 c 223.161 26.586 m 224.481 25.494 225.811 24.500 227.136 23.720 c 228.254 23.063 229.373 22.566 230.475 22.236 c 231.217 22.015 231.958 21.862 232.669 21.905 c 232.985 21.925 233.299 21.980 233.587 22.141 c 233.777 22.247 233.967 22.397 234.091 22.689 c 234.129 22.780 234.160 22.888 234.177 23.011 c 234.194 23.139 234.195 23.290 234.179 23.440 c 234.162 23.597 234.128 23.757 234.086 23.907 c 234.044 24.058 233.994 24.203 233.939 24.340 c 233.740 24.845 233.493 25.272 233.245 25.662 c 232.688 26.536 232.091 27.252 231.493 27.910 c 230.642 28.846 229.775 29.658 228.907 30.391 c 228.045 31.118 227.177 31.748 226.310 32.291 c 225.259 32.949 224.207 33.490 223.161 33.962 c 226.882 34.616 230.604 35.271 234.326 35.926 c 237.220 34.622 239.070 33.258 240.609 31.890 c 243.548 29.279 245.356 26.657 245.356 25.191 c 245.356 23.724 243.548 23.413 240.609 24.557 c 239.070 25.157 237.220 26.156 234.326 28.551 c 230.604 27.896 226.882 27.241 223.161 26.586 c 22.195 -8.771 m 18.473 -9.426 14.752 -10.081 11.030 -10.735 c 14.752 -10.081 18.473 -9.426 22.195 -8.771 c 22.195 -1.396 m 18.473 -2.050 14.752 -2.705 11.030 -3.360 c 14.752 -2.705 18.473 -2.050 22.195 -1.396 c 223.161 26.586 m 156.172 14.800 89.184 3.015 22.195 -8.771 c 12.511 -4.077 m 16.233 -3.423 19.954 -2.768 23.676 -2.113 c 18.502 -8.512 m 22.224 -7.857 25.945 -7.203 29.667 -6.548 c 21.633 -12.582 m 25.355 -11.928 29.077 -11.273 32.798 -10.618 c 21.633 -15.062 m 25.355 -14.407 29.077 -13.753 32.798 -13.098 c 18.502 -15.131 m 22.224 -14.476 25.945 -13.821 29.667 -13.167 c 12.511 -11.910 m 16.233 -11.255 19.954 -10.601 23.676 -9.946 c 11.030 -3.360 m 13.925 -4.664 15.774 -6.028 17.314 -7.396 c 20.252 -10.007 22.060 -12.629 22.060 -14.095 c 22.060 -15.562 20.252 -15.873 17.314 -14.729 c 15.774 -14.129 13.925 -13.130 11.030 -10.735 c 22.195 -1.396 m 23.242 -1.867 24.293 -2.408 25.344 -3.067 c 26.211 -3.610 27.079 -4.239 27.941 -4.966 c 28.810 -5.699 29.677 -6.511 30.527 -7.448 c 31.125 -8.105 31.723 -8.821 32.279 -9.696 c 32.527 -10.085 32.774 -10.513 32.974 -11.017 c 33.028 -11.154 33.079 -11.299 33.121 -11.450 c 33.163 -11.600 33.197 -11.761 33.213 -11.917 c 33.229 -12.067 33.229 -12.218 33.211 -12.346 c 33.195 -12.470 33.163 -12.578 33.125 -12.668 c 33.002 -12.960 32.811 -13.110 32.621 -13.216 c 32.333 -13.377 32.019 -13.433 31.703 -13.452 c 30.992 -13.495 30.251 -13.342 29.509 -13.121 c 28.407 -12.792 27.288 -12.294 26.171 -11.637 c 24.845 -10.857 23.515 -9.864 22.195 -8.771 c 18.473 -9.426 14.752 -10.081 11.030 -10.735 c 13.925 -13.130 15.774 -14.129 17.314 -14.729 c 20.252 -15.873 22.060 -15.562 22.060 -14.095 c 22.060 -12.629 20.252 -10.007 17.314 -7.396 c 15.774 -6.028 13.925 -4.664 11.030 -3.360 c 14.752 -2.705 18.473 -2.050 22.195 -1.396 c 0.000 0.000 m 3.722 0.655 7.443 1.310 11.165 1.964 c 0.000 0.000 m 3.722 0.655 7.443 1.310 11.165 1.964 c 11.030 -10.735 m 8.400 -8.559 4.907 -5.230 0.000 0.000 c 22.195 -8.771 m 21.877 -8.508 21.558 -8.238 21.241 -7.963 c 19.562 -6.511 17.890 -4.920 16.226 -3.265 c 14.533 -1.582 12.847 0.172 11.165 1.964 c 7.443 1.310 3.722 0.655 0.000 0.000 c 4.907 -5.230 8.400 -8.559 11.030 -10.735 c 14.752 -10.081 18.473 -9.426 22.195 -8.771 c 0.000 0.000 m 3.722 0.655 7.443 1.310 11.165 1.964 c 0.000 0.000 m 3.722 0.655 7.443 1.310 11.165 1.964 c 0.000 0.000 m 4.907 -1.041 8.400 -2.175 11.030 -3.360 c 11.165 1.964 m 13.249 1.522 15.341 1.013 17.443 0.366 c 18.727 -0.028 20.015 -0.475 21.309 -1.012 c 21.604 -1.135 21.899 -1.262 22.195 -1.396 c 18.473 -2.050 14.752 -2.705 11.030 -3.360 c 8.400 -2.175 4.907 -1.041 0.000 0.000 c 3.722 0.655 7.443 1.310 11.165 1.964 c 22.195 -1.396 m 21.899 -1.262 21.604 -1.135 21.309 -1.012 c 20.015 -0.475 18.727 -0.028 17.443 0.366 c 15.341 1.013 13.249 1.522 11.165 1.964 c 12.847 0.172 14.533 -1.582 16.226 -3.265 c 17.890 -4.920 19.562 -6.511 21.241 -7.963 c 21.558 -8.238 21.877 -8.508 22.195 -8.771 c 23.515 -9.864 24.845 -10.857 26.171 -11.637 c 27.288 -12.294 28.407 -12.792 29.509 -13.121 c 30.251 -13.342 30.992 -13.495 31.703 -13.452 c 32.019 -13.433 32.333 -13.377 32.621 -13.216 c 32.811 -13.110 33.002 -12.960 33.125 -12.668 c 33.163 -12.578 33.195 -12.470 33.211 -12.346 c 33.229 -12.218 33.229 -12.067 33.213 -11.917 c 33.197 -11.761 33.163 -11.600 33.121 -11.450 c 33.079 -11.299 33.028 -11.154 32.974 -11.017 c 32.774 -10.513 32.527 -10.085 32.279 -9.696 c 31.723 -8.821 31.125 -8.105 30.527 -7.448 c 29.677 -6.511 28.810 -5.699 27.941 -4.966 c 27.079 -4.239 26.211 -3.610 25.344 -3.067 c 24.293 -2.408 23.242 -1.867 22.195 -1.396 c 23.242 -1.867 24.293 -2.408 25.344 -3.067 c 26.211 -3.610 27.079 -4.239 27.941 -4.966 c 28.810 -5.699 29.677 -6.511 30.527 -7.448 c 31.125 -8.105 31.723 -8.821 32.279 -9.696 c 32.527 -10.085 32.774 -10.513 32.974 -11.017 c 33.028 -11.154 33.079 -11.299 33.121 -11.450 c 33.163 -11.600 33.197 -11.761 33.213 -11.917 c 33.229 -12.067 33.229 -12.218 33.211 -12.346 c 33.195 -12.470 33.163 -12.578 33.125 -12.668 c 33.002 -12.960 32.811 -13.110 32.621 -13.216 c 32.333 -13.377 32.019 -13.433 31.703 -13.452 c 30.992 -13.495 30.251 -13.342 29.509 -13.121 c 28.407 -12.792 27.288 -12.294 26.171 -11.637 c 24.845 -10.857 23.515 -9.864 22.195 -8.771 c 11.165 1.964 m 13.249 1.522 15.341 1.013 17.443 0.366 c 18.727 -0.028 20.015 -0.475 21.309 -1.012 c 21.604 -1.135 21.899 -1.262 22.195 -1.396 c 22.195 -8.771 m 21.877 -8.508 21.558 -8.238 21.241 -7.963 c 19.562 -6.511 17.890 -4.920 16.226 -3.265 c 14.533 -1.582 12.847 0.172 11.165 1.964 c 44.659 7.857 78.153 13.750 111.648 19.643 c 145.142 25.536 178.636 31.429 212.131 37.322 c 11.165 1.964 m 44.659 7.857 78.153 13.750 111.648 19.643 c 145.142 25.536 178.636 31.429 212.131 37.322 c 31.899 5.612 m 36.806 4.572 40.299 3.437 42.930 2.252 c 63.799 11.225 m 68.706 10.184 72.199 9.049 74.829 7.865 c 95.698 16.837 m 100.605 15.796 104.098 14.662 106.728 13.477 c 127.597 22.449 m 132.504 21.408 135.997 20.274 138.628 19.089 c 159.497 28.061 m 164.404 27.021 167.897 25.886 170.527 24.701 c 191.396 33.674 m 196.303 32.633 199.796 31.498 202.426 30.314 c 212.131 37.322 m 214.215 36.880 216.307 36.370 218.409 35.724 c 219.693 35.329 220.981 34.882 222.274 34.345 c 222.569 34.223 222.865 34.095 223.161 33.962 c 156.172 22.176 89.184 10.390 22.195 -1.396 c 21.899 -1.262 21.604 -1.135 21.309 -1.012 c 20.015 -0.475 18.727 -0.028 17.443 0.366 c 15.341 1.013 13.249 1.522 11.165 1.964 c 44.659 7.857 78.153 13.750 111.648 19.643 c 145.142 25.536 178.636 31.429 212.131 37.322 c 11.165 1.964 m 44.659 7.857 78.153 13.750 111.648 19.643 c 145.142 25.536 178.636 31.429 212.131 37.322 c 11.165 1.964 m 44.659 7.857 78.153 13.750 111.648 19.643 c 145.142 25.536 178.636 31.429 212.131 37.322 c 42.930 -5.123 m 40.299 -2.947 36.806 0.382 31.899 5.612 c 74.829 0.489 m 72.199 2.666 68.706 5.995 63.799 11.225 c 106.728 6.101 m 104.098 8.278 100.605 11.607 95.698 16.837 c 138.628 11.714 m 135.997 13.890 132.504 17.219 127.597 22.449 c 170.527 17.326 m 167.897 19.502 164.404 22.832 159.497 28.061 c 202.426 22.938 m 199.796 25.115 196.303 28.444 191.396 33.674 c 223.161 26.586 m 222.843 26.850 222.524 27.119 222.206 27.394 c 220.527 28.846 218.856 30.438 217.192 32.092 c 215.499 33.776 213.812 35.529 212.131 37.322 c 178.636 31.429 145.142 25.536 111.648 19.643 c 78.153 13.750 44.659 7.857 11.165 1.964 c 12.847 0.172 14.533 -1.582 16.226 -3.265 c 17.890 -4.920 19.562 -6.511 21.241 -7.963 c 21.558 -8.238 21.877 -8.508 22.195 -8.771 c 89.184 3.015 156.172 14.800 223.161 26.586 c 23.676 -2.113 m 57.170 3.780 90.664 9.673 124.159 15.566 c 157.653 21.458 191.147 27.351 224.642 33.244 c 29.667 -6.548 m 63.161 -0.655 96.655 5.238 130.150 11.131 c 163.644 17.024 197.138 22.916 230.633 28.809 c 32.798 -10.618 m 66.293 -4.725 99.787 1.168 133.281 7.061 c 166.775 12.953 200.270 18.846 233.764 24.739 c 32.798 -13.098 m 66.293 -7.205 99.787 -1.312 133.281 4.581 c 166.775 10.474 200.270 16.366 233.764 22.259 c 29.667 -13.167 m 63.161 -7.274 96.655 -1.381 130.150 4.512 c 163.644 10.405 197.138 16.298 230.633 22.191 c 23.676 -9.946 m 57.170 -4.053 90.664 1.840 124.159 7.733 c 157.653 13.626 191.147 19.519 224.642 25.411 c 42.930 2.252 m 45.824 0.949 47.674 -0.416 49.213 -1.784 c 52.152 -4.395 53.960 -7.016 53.960 -8.483 c 53.960 -9.949 52.152 -10.261 49.213 -9.116 c 47.674 -8.517 45.824 -7.518 42.930 -5.123 c 74.829 7.865 m 77.723 6.561 79.573 5.196 81.113 3.828 c 84.051 1.218 85.859 -1.404 85.859 -2.871 c 85.859 -4.337 84.051 -4.648 81.113 -3.504 c 79.573 -2.905 77.723 -1.906 74.829 0.489 c 106.728 13.477 m 109.623 12.173 111.472 10.808 113.012 9.441 c 115.950 6.830 117.758 4.208 117.758 2.742 c 117.758 1.275 115.950 0.964 113.012 2.108 c 111.472 2.708 109.623 3.706 106.728 6.101 c 138.628 19.089 m 141.522 17.785 143.372 16.421 144.911 15.053 c 147.850 12.442 149.658 9.820 149.658 8.354 c 149.658 6.887 147.850 6.576 144.911 7.720 c 143.372 8.320 141.522 9.319 138.628 11.714 c 170.527 24.701 m 173.421 23.398 175.271 22.033 176.810 20.665 c 179.749 18.055 181.557 15.433 181.557 13.966 c 181.557 12.500 179.749 12.188 176.810 13.333 c 175.271 13.932 173.421 14.931 170.527 17.326 c 202.426 30.314 m 205.321 29.010 207.170 27.645 208.710 26.277 c 211.648 23.667 213.456 21.045 213.456 19.578 c 213.456 18.112 211.648 17.801 208.710 18.945 c 207.170 19.544 205.321 20.543 202.426 22.938 c 223.161 33.962 m 224.207 33.490 225.259 32.949 226.310 32.291 c 227.177 31.748 228.045 31.118 228.907 30.391 c 229.775 29.658 230.642 28.846 231.493 27.910 c 232.091 27.252 232.688 26.536 233.245 25.662 c 233.493 25.272 233.740 24.845 233.939 24.340 c 233.994 24.203 234.044 24.058 234.086 23.907 c 234.128 23.757 234.162 23.597 234.179 23.440 c 234.195 23.290 234.194 23.139 234.177 23.011 c 234.160 22.888 234.129 22.780 234.091 22.689 c 233.967 22.397 233.777 22.247 233.587 22.141 c 233.299 21.980 232.985 21.925 232.669 21.905 c 231.958 21.862 231.217 22.015 230.475 22.236 c 229.373 22.566 228.254 23.063 227.136 23.720 c 225.811 24.500 224.481 25.494 223.161 26.586 c 156.172 14.800 89.184 3.015 22.195 -8.771 c 23.515 -9.864 24.845 -10.857 26.171 -11.637 c 27.288 -12.294 28.407 -12.792 29.509 -13.121 c 30.251 -13.342 30.992 -13.495 31.703 -13.452 c 32.019 -13.433 32.333 -13.377 32.621 -13.216 c 32.811 -13.110 33.002 -12.960 33.125 -12.668 c 33.163 -12.578 33.195 -12.470 33.211 -12.346 c 33.229 -12.218 33.229 -12.067 33.213 -11.917 c 33.197 -11.761 33.163 -11.600 33.121 -11.450 c 33.079 -11.299 33.028 -11.154 32.974 -11.017 c 32.774 -10.513 32.527 -10.085 32.279 -9.696 c 31.723 -8.821 31.125 -8.105 30.527 -7.448 c 29.677 -6.511 28.810 -5.699 27.941 -4.966 c 27.079 -4.239 26.211 -3.610 25.344 -3.067 c 24.293 -2.408 23.242 -1.867 22.195 -1.396 c 89.184 10.390 156.172 22.176 223.161 33.962 c 156.172 22.176 89.184 10.390 22.195 -1.396 c 22.195 -8.771 m 89.184 3.015 156.172 14.800 223.161 26.586 c 22.195 -1.396 m 89.184 10.390 156.172 22.176 223.161 33.962 c 226.882 34.616 230.604 35.271 234.326 35.926 c 230.604 35.271 226.882 34.616 223.161 33.962 c 223.161 26.586 m 226.882 27.241 230.604 27.896 234.326 28.551 c 230.604 27.896 226.882 27.241 223.161 26.586 c 223.161 33.962 m 222.865 34.095 222.569 34.223 222.274 34.345 c 220.981 34.882 219.693 35.329 218.409 35.724 c 216.307 36.370 214.215 36.880 212.131 37.322 c 213.812 35.529 215.499 33.776 217.192 32.092 c 218.856 30.438 220.527 28.846 222.206 27.394 c 222.524 27.119 222.843 26.850 223.161 26.586 c 224.481 25.494 225.811 24.500 227.136 23.720 c 228.254 23.063 229.373 22.566 230.475 22.236 c 231.217 22.015 231.958 21.862 232.669 21.905 c 232.985 21.925 233.299 21.980 233.587 22.141 c 233.777 22.247 233.967 22.397 234.091 22.689 c 234.129 22.780 234.160 22.888 234.177 23.011 c 234.194 23.139 234.195 23.290 234.179 23.440 c 234.162 23.597 234.128 23.757 234.086 23.907 c 234.044 24.058 233.994 24.203 233.939 24.340 c 233.740 24.845 233.493 25.272 233.245 25.662 c 232.688 26.536 232.091 27.252 231.493 27.910 c 230.642 28.846 229.775 29.658 228.907 30.391 c 228.045 31.118 227.177 31.748 226.310 32.291 c 225.259 32.949 224.207 33.490 223.161 33.962 c 223.161 26.586 m 222.843 26.850 222.524 27.119 222.206 27.394 c 220.527 28.846 218.856 30.438 217.192 32.092 c 215.499 33.776 213.812 35.529 212.131 37.322 c 214.215 36.880 216.307 36.370 218.409 35.724 c 219.693 35.329 220.981 34.882 222.274 34.345 c 222.569 34.223 222.865 34.095 223.161 33.962 c 224.207 33.490 225.259 32.949 226.310 32.291 c 227.177 31.748 228.045 31.118 228.907 30.391 c 229.775 29.658 230.642 28.846 231.493 27.910 c 232.091 27.252 232.688 26.536 233.245 25.662 c 233.493 25.272 233.740 24.845 233.939 24.340 c 233.994 24.203 234.044 24.058 234.086 23.907 c 234.128 23.757 234.162 23.597 234.179 23.440 c 234.195 23.290 234.194 23.139 234.177 23.011 c 234.160 22.888 234.129 22.780 234.091 22.689 c 233.967 22.397 233.777 22.247 233.587 22.141 c 233.299 21.980 232.985 21.925 232.669 21.905 c 231.958 21.862 231.217 22.015 230.475 22.236 c 229.373 22.566 228.254 23.063 227.136 23.720 c 225.811 24.500 224.481 25.494 223.161 26.586 c S Q Q Q Q Q q 1.000 0.000 0.000 1.000 0.0 0.0 cm -297.360 -420.840 297.360 420.840 re W S q 1.0 0.0 0.0 1.0 0.000 0.000 cm q 1.0 0.0 0.0 1.0 -148.680 -210.420 cm q 1.0 0.0 0.0 1.0 -33.096 -219.040 cm q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -0.406 21.904 m -5.679 21.904 l -0.406 416.176 m -5.679 416.176 l S Q q 2.000 w 0.000 0.502 0.000 RG 0.000 0.000 0.000 rg 14.728 21.904 m 14.728 21.904 l 41.239 21.904 m 41.239 21.904 l 41.239 31.291 m 41.239 31.291 l 41.239 106.391 m 41.239 106.391 l 41.239 181.490 m 41.239 181.490 l 41.239 256.590 m 41.239 256.590 l 41.239 331.689 m 41.239 331.689 l 41.239 406.788 m 41.239 406.788 l 41.239 416.176 m 41.239 416.176 l 41.239 21.904 m 41.239 21.904 l 14.728 416.176 m 14.728 416.176 l 41.239 416.176 m 41.239 416.176 l 0.000 21.904 m 7.793 21.904 15.613 21.904 23.472 21.904 c 28.272 21.904 33.090 21.904 37.925 21.904 c 39.028 21.904 40.134 21.904 41.239 21.904 c 40.049 21.904 38.859 21.904 37.671 21.904 c 31.394 21.904 25.145 21.904 18.924 21.904 c 12.594 21.904 6.288 21.904 0.000 21.904 c 0.000 87.616 0.000 153.328 0.000 219.040 c 0.000 284.752 0.000 350.464 0.000 416.176 c 0.000 21.904 m 0.000 87.616 0.000 153.328 0.000 219.040 c 0.000 284.752 0.000 350.464 0.000 416.176 c 0.000 62.583 m 18.346 62.583 31.405 62.583 41.239 62.583 c 0.000 125.166 m 18.346 125.166 31.405 125.166 41.239 125.166 c 0.000 187.748 m 18.346 187.748 31.405 187.748 41.239 187.748 c 0.000 250.331 m 18.346 250.331 31.405 250.331 41.239 250.331 c 0.000 312.914 m 18.346 312.914 31.405 312.914 41.239 312.914 c 0.000 375.497 m 18.346 375.497 31.405 375.497 41.239 375.497 c 0.000 416.176 m 7.793 416.176 15.613 416.176 23.472 416.176 c 28.272 416.176 33.090 416.176 37.925 416.176 c 39.028 416.176 40.134 416.176 41.239 416.176 c 41.239 284.752 41.239 153.328 41.239 21.904 c 40.134 21.904 39.028 21.904 37.925 21.904 c 33.090 21.904 28.272 21.904 23.472 21.904 c 15.613 21.904 7.793 21.904 0.000 21.904 c 0.000 87.616 0.000 153.328 0.000 219.040 c 0.000 284.752 0.000 350.464 0.000 416.176 c 0.000 21.904 m 0.000 87.616 0.000 153.328 0.000 219.040 c 0.000 284.752 0.000 350.464 0.000 416.176 c 0.000 21.904 m 0.000 87.616 0.000 153.328 0.000 219.040 c 0.000 284.752 0.000 350.464 0.000 416.176 c 41.239 62.583 m 31.405 62.583 18.346 62.583 0.000 62.583 c 41.239 125.166 m 31.405 125.166 18.346 125.166 0.000 125.166 c 41.239 187.748 m 31.405 187.748 18.346 187.748 0.000 187.748 c 41.239 250.331 m 31.405 250.331 18.346 250.331 0.000 250.331 c 41.239 312.914 m 31.405 312.914 18.346 312.914 0.000 312.914 c 41.239 375.497 m 31.405 375.497 18.346 375.497 0.000 375.497 c 41.239 416.176 m 40.049 416.176 38.859 416.176 37.671 416.176 c 31.394 416.176 25.145 416.176 18.924 416.176 c 12.594 416.176 6.288 416.176 0.000 416.176 c 0.000 350.464 0.000 284.752 0.000 219.040 c 0.000 153.328 0.000 87.616 0.000 21.904 c 6.288 21.904 12.594 21.904 18.924 21.904 c 25.145 21.904 31.394 21.904 37.671 21.904 c 38.859 21.904 40.049 21.904 41.239 21.904 c 41.239 153.328 41.239 284.752 41.239 416.176 c 41.239 284.752 41.239 153.328 41.239 21.904 c 41.239 153.328 41.239 284.752 41.239 416.176 c 40.049 416.176 38.859 416.176 37.671 416.176 c 31.394 416.176 25.145 416.176 18.924 416.176 c 12.594 416.176 6.288 416.176 0.000 416.176 c 7.793 416.176 15.613 416.176 23.472 416.176 c 28.272 416.176 33.090 416.176 37.925 416.176 c 39.028 416.176 40.134 416.176 41.239 416.176 c S Q q 2.000 w 1.000 0.000 0.000 RG 0.000 0.000 0.000 rg 73.641 21.904 m 73.641 21.904 l 44.185 21.904 m 44.185 21.904 l 41.239 21.904 m 41.239 21.904 l 41.239 31.291 m 41.239 31.291 l 41.239 106.391 m 41.239 106.391 l 41.239 181.490 m 41.239 181.490 l 41.239 256.590 m 41.239 256.590 l 41.239 331.689 m 41.239 331.689 l 41.239 406.788 m 41.239 406.788 l 41.239 416.176 m 41.239 416.176 l 41.239 21.904 m 41.239 21.904 l 73.641 416.176 m 73.641 416.176 l 44.185 416.176 m 44.185 416.176 l 41.239 416.176 m 41.239 416.176 l 41.239 21.904 m 45.152 21.904 49.084 21.904 53.013 21.904 c 56.253 21.904 59.500 21.904 62.723 21.904 c 65.970 21.904 69.210 21.904 72.392 21.904 c 74.625 21.904 76.860 21.904 78.941 21.904 c 79.867 21.904 80.792 21.904 81.538 21.904 c 81.740 21.904 81.930 21.904 82.087 21.904 c 82.244 21.904 82.371 21.904 82.434 21.904 c 82.494 21.904 82.490 21.904 82.426 21.904 c 82.363 21.904 82.246 21.904 82.103 21.904 c 81.642 21.904 80.931 21.904 80.221 21.904 c 79.143 21.904 77.970 21.904 76.787 21.904 c 74.128 21.904 71.358 21.904 68.585 21.904 c 64.463 21.904 60.281 21.904 56.103 21.904 c 51.147 21.904 46.175 21.904 41.239 21.904 c 46.776 21.904 m 46.776 87.616 46.776 153.328 46.776 219.040 c 46.776 284.752 46.776 350.464 46.776 416.176 c 69.174 21.904 m 69.174 87.616 69.174 153.328 69.174 219.040 c 69.174 284.752 69.174 350.464 69.174 416.176 c 80.881 21.904 m 80.881 87.616 80.881 153.328 80.881 219.040 c 80.881 284.752 80.881 350.464 80.881 416.176 c 80.881 21.904 m 80.881 87.616 80.881 153.328 80.881 219.040 c 80.881 284.752 80.881 350.464 80.881 416.176 c 69.174 21.904 m 69.174 87.616 69.174 153.328 69.174 219.040 c 69.174 284.752 69.174 350.464 69.174 416.176 c 46.776 21.904 m 46.776 87.616 46.776 153.328 46.776 219.040 c 46.776 284.752 46.776 350.464 46.776 416.176 c 41.239 62.583 m 52.061 62.583 58.976 62.583 64.732 62.583 c 75.717 62.583 82.478 62.583 82.478 62.583 c 82.478 62.583 75.717 62.583 64.732 62.583 c 58.976 62.583 52.061 62.583 41.239 62.583 c 41.239 125.166 m 52.061 125.166 58.976 125.166 64.732 125.166 c 75.717 125.166 82.478 125.166 82.478 125.166 c 82.478 125.166 75.717 125.166 64.732 125.166 c 58.976 125.166 52.061 125.166 41.239 125.166 c 41.239 187.748 m 52.061 187.748 58.976 187.748 64.732 187.748 c 75.717 187.748 82.478 187.748 82.478 187.748 c 82.478 187.748 75.717 187.748 64.732 187.748 c 58.976 187.748 52.061 187.748 41.239 187.748 c 41.239 250.331 m 52.061 250.331 58.976 250.331 64.732 250.331 c 75.717 250.331 82.478 250.331 82.478 250.331 c 82.478 250.331 75.717 250.331 64.732 250.331 c 58.976 250.331 52.061 250.331 41.239 250.331 c 41.239 312.914 m 52.061 312.914 58.976 312.914 64.732 312.914 c 75.717 312.914 82.478 312.914 82.478 312.914 c 82.478 312.914 75.717 312.914 64.732 312.914 c 58.976 312.914 52.061 312.914 41.239 312.914 c 41.239 375.497 m 52.061 375.497 58.976 375.497 64.732 375.497 c 75.717 375.497 82.478 375.497 82.478 375.497 c 82.478 375.497 75.717 375.497 64.732 375.497 c 58.976 375.497 52.061 375.497 41.239 375.497 c 41.239 416.176 m 45.152 416.176 49.084 416.176 53.013 416.176 c 56.253 416.176 59.500 416.176 62.723 416.176 c 65.970 416.176 69.210 416.176 72.392 416.176 c 74.625 416.176 76.860 416.176 78.941 416.176 c 79.867 416.176 80.792 416.176 81.538 416.176 c 81.740 416.176 81.930 416.176 82.087 416.176 c 82.244 416.176 82.371 416.176 82.434 416.176 c 82.494 416.176 82.490 416.176 82.426 416.176 c 82.363 416.176 82.246 416.176 82.103 416.176 c 81.642 416.176 80.931 416.176 80.221 416.176 c 79.143 416.176 77.970 416.176 76.787 416.176 c 74.128 416.176 71.358 416.176 68.585 416.176 c 64.463 416.176 60.281 416.176 56.103 416.176 c 51.147 416.176 46.175 416.176 41.239 416.176 c 41.239 284.752 41.239 153.328 41.239 21.904 c 46.175 21.904 51.147 21.904 56.103 21.904 c 60.281 21.904 64.463 21.904 68.585 21.904 c 71.358 21.904 74.128 21.904 76.787 21.904 c 77.970 21.904 79.143 21.904 80.221 21.904 c 80.931 21.904 81.642 21.904 82.103 21.904 c 82.246 21.904 82.363 21.904 82.426 21.904 c 82.490 21.904 82.494 21.904 82.434 21.904 c 82.371 21.904 82.244 21.904 82.087 21.904 c 81.930 21.904 81.740 21.904 81.538 21.904 c 80.792 21.904 79.867 21.904 78.941 21.904 c 76.860 21.904 74.625 21.904 72.392 21.904 c 69.210 21.904 65.970 21.904 62.723 21.904 c 59.500 21.904 56.253 21.904 53.013 21.904 c 49.084 21.904 45.152 21.904 41.239 21.904 c 41.239 153.328 41.239 284.752 41.239 416.176 c 41.239 284.752 41.239 153.328 41.239 21.904 c 41.239 153.328 41.239 284.752 41.239 416.176 c 45.152 416.176 49.084 416.176 53.013 416.176 c 56.253 416.176 59.500 416.176 62.723 416.176 c 65.970 416.176 69.210 416.176 72.392 416.176 c 74.625 416.176 76.860 416.176 78.941 416.176 c 79.867 416.176 80.792 416.176 81.538 416.176 c 81.740 416.176 81.930 416.176 82.087 416.176 c 82.244 416.176 82.371 416.176 82.434 416.176 c 82.494 416.176 82.490 416.176 82.426 416.176 c 82.363 416.176 82.246 416.176 82.103 416.176 c 81.642 416.176 80.931 416.176 80.221 416.176 c 79.143 416.176 77.970 416.176 76.787 416.176 c 74.128 416.176 71.358 416.176 68.585 416.176 c 64.463 416.176 60.281 416.176 56.103 416.176 c 51.147 416.176 46.175 416.176 41.239 416.176 c S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -0.406 21.904 m -5.679 21.904 l S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -0.406 416.176 m -5.679 416.176 l S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg S Q Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -37.558 -197.136 m -37.558 -7.301 l S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -37.558 4.868 m -37.558 197.136 l S Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -37.558 -197.136 m -39.079 -191.051 l -37.558 -193.080 l -36.036 -191.051 l -37.558 -197.136 l B Q q 0.500 w 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg -37.558 197.136 m -36.036 191.051 l -37.558 193.080 l -39.079 191.051 l -37.558 197.136 l B Q q 1.0 0.0 0.0 1.0 -49.398 -3.042 cm 0.000 0.000 0.000 RG 0.000 0.000 0.000 rg BT /CLF141 6.08 Tf 100.000 Tz (97.2) Tj ET Q Q Q Q q 1.000 0.000 0.000 1.000 0.0 0.0 cm 0.000 -420.840 297.360 420.840 re W S q 1.0 0.0 0.0 1.0 0.000 0.000 cm q 1.0 0.0 0.0 1.0 148.680 -210.420 cm q 1.0 0.0 0.0 1.0 -150.202 -14.586 cm q 2.000 w 0.000 0.502 0.000 RG 0.000 0.000 0.000 rg 18.493 -2.618 m 18.493 1.266 l 27.174 -1.709 m 27.174 -10.739 l 33.033 -9.708 m 33.033 -0.678 l 79.900 -1.462 m 79.900 7.568 l 126.766 6.783 m 126.766 15.813 l 173.633 15.029 m 173.633 24.059 l 220.500 23.274 m 220.500 32.305 l 267.367 31.520 m 267.367 40.550 l 273.225 32.551 m 273.225 41.581 l 27.174 -1.709 m 27.174 -10.739 l 264.544 40.671 m 264.544 44.555 l 273.225 41.581 m 273.225 32.551 l 13.670 2.405 m 16.221 1.864 18.782 1.240 21.356 0.449 c 22.928 -0.035 24.506 -0.581 26.089 -1.239 c 26.450 -1.389 26.812 -1.546 27.174 -1.709 c 27.174 -10.739 m 26.785 -10.416 26.395 -10.086 26.006 -9.750 c 23.950 -7.972 21.904 -6.023 19.867 -3.997 c 17.794 -1.936 15.729 0.210 13.670 2.405 c 54.678 9.620 95.687 16.835 136.695 24.050 c 177.704 31.265 218.712 38.480 259.721 45.694 c 13.670 2.405 m 54.678 9.620 95.687 16.835 136.695 24.050 c 177.704 31.265 218.712 38.480 259.721 45.694 c 39.056 6.871 m 45.064 5.597 49.340 4.208 52.561 2.758 c 78.111 13.743 m 84.119 12.469 88.396 11.080 91.616 9.629 c 117.167 20.614 m 123.175 19.340 127.452 17.951 130.672 16.500 c 156.223 27.485 m 162.231 26.211 166.507 24.822 169.728 23.372 c 195.279 34.357 m 201.287 33.083 205.563 31.694 208.784 30.243 c 234.334 41.228 m 240.342 39.954 244.619 38.565 247.839 37.114 c 259.721 45.694 m 262.273 45.153 264.834 44.530 267.407 43.738 c 268.979 43.255 270.557 42.708 272.140 42.050 c 272.501 41.900 272.864 41.744 273.225 41.581 c 191.208 27.151 109.191 12.721 27.174 -1.709 c 26.812 -1.546 26.450 -1.389 26.089 -1.239 c 24.506 -0.581 22.928 -0.035 21.356 0.449 c 18.782 1.240 16.221 1.864 13.670 2.405 c 54.678 9.620 95.687 16.835 136.695 24.050 c 177.704 31.265 218.712 38.480 259.721 45.694 c 13.670 2.405 m 54.678 9.620 95.687 16.835 136.695 24.050 c 177.704 31.265 218.712 38.480 259.721 45.694 c 13.670 2.405 m 54.678 9.620 95.687 16.835 136.695 24.050 c 177.704 31.265 218.712 38.480 259.721 45.694 c 52.561 -6.272 m 49.340 -3.608 45.064 0.468 39.056 6.871 c 91.616 0.599 m 88.396 3.264 84.119 7.340 78.111 13.743 c 130.672 7.470 m 127.452 10.135 123.175 14.211 117.167 20.614 c 169.728 14.342 m 166.507 17.006 162.231 21.082 156.223 27.485 c 208.784 21.213 m 205.563 23.878 201.287 27.954 195.279 34.357 c 247.839 28.084 m 244.619 30.749 240.342 34.825 234.334 41.228 c 273.225 32.551 m 272.836 32.873 272.446 33.204 272.057 33.540 c 270.001 35.318 267.955 37.266 265.918 39.292 c 263.845 41.353 261.780 43.500 259.721 45.694 c 218.712 38.480 177.704 31.265 136.695 24.050 c 95.687 16.835 54.678 9.620 13.670 2.405 c 15.729 0.210 17.794 -1.936 19.867 -3.997 c 21.904 -6.023 23.950 -7.972 26.006 -9.750 c 26.395 -10.086 26.785 -10.416 27.174 -10.739 c 109.191 3.691 191.208 18.121 273.225 32.551 c 273.225 41.581 m 191.208 27.151 109.191 12.721 27.174 -1.709 c 27.174 -10.739 m 109.191 3.691 191.208 18.121 273.225 32.551 c 272.836 32.873 272.446 33.204 272.057 33.540 c 270.001 35.318 267.955 37.266 265.918 39.292 c 263.845 41.353 261.780 43.500 259.721 45.694 c 262.273 45.153 264.834 44.530 267.407 43.738 c 268.979 43.255 270.557 42.708 272.140 42.050 c 272.501 41.900 272.864 41.744 273.225 41.581 c S Q q 2.000 w 1.000 0.000 0.000 RG 0.000 0.000 0.000 rg 37.785 -16.432 m 37.785 -9.577 l 28.139 -11.520 m 28.139 -2.160 l 27.174 -10.739 m 27.174 -1.709 l 33.033 -9.708 m 33.033 -0.678 l 79.900 -1.462 m 79.900 7.568 l 126.766 6.783 m 126.766 15.813 l 173.633 15.029 m 173.633 24.059 l 220.500 23.274 m 220.500 32.305 l 267.367 31.520 m 267.367 40.550 l 273.225 32.551 m 273.225 41.581 l 27.174 -1.709 m 27.174 -10.739 l 283.836 26.858 m 283.836 33.712 l 274.190 31.769 m 274.190 41.130 l 273.225 32.551 m 273.225 41.581 l 27.174 -1.709 m 28.456 -2.286 29.743 -2.948 31.030 -3.755 c 32.091 -4.420 33.154 -5.190 34.210 -6.081 c 35.273 -6.978 36.334 -7.972 37.376 -9.119 c 38.108 -9.924 38.839 -10.800 39.521 -11.871 c 39.824 -12.348 40.127 -12.871 40.371 -13.489 c 40.438 -13.657 40.500 -13.834 40.551 -14.019 c 40.602 -14.202 40.644 -14.399 40.665 -14.591 c 40.684 -14.774 40.683 -14.959 40.662 -15.115 c 40.642 -15.267 40.603 -15.399 40.556 -15.510 c 40.405 -15.868 40.172 -16.051 39.940 -16.181 c 39.587 -16.378 39.203 -16.446 38.815 -16.470 c 37.945 -16.522 37.038 -16.335 36.130 -16.064 c 34.780 -15.661 33.410 -15.052 32.042 -14.247 c 30.419 -13.293 28.791 -12.076 27.174 -10.739 c 28.987 -2.587 m 69.996 4.628 111.004 11.843 152.013 19.058 c 193.021 26.273 234.030 33.487 275.039 40.702 c 36.322 -8.017 m 77.331 -0.802 118.339 6.413 159.348 13.628 c 200.356 20.843 241.365 28.058 282.373 35.272 c 40.156 -13.000 m 81.165 -5.785 122.173 1.430 163.182 8.644 c 204.190 15.859 245.199 23.074 286.207 30.289 c 40.156 -16.036 m 81.165 -8.821 122.173 -1.607 163.182 5.608 c 204.190 12.823 245.199 20.038 286.207 27.253 c 36.322 -16.120 m 77.331 -8.905 118.339 -1.691 159.348 5.524 c 200.356 12.739 241.365 19.954 282.373 27.169 c 28.987 -12.177 m 69.996 -4.962 111.004 2.253 152.013 9.468 c 193.021 16.682 234.030 23.897 275.039 31.112 c 52.561 2.758 m 56.104 1.161 58.369 -0.509 60.254 -2.184 c 63.851 -5.380 66.065 -8.590 66.065 -10.386 c 66.065 -12.182 63.851 -12.562 60.254 -11.162 c 58.369 -10.428 56.104 -9.205 52.561 -6.272 c 91.616 9.629 m 95.160 8.033 97.425 6.362 99.310 4.687 c 102.907 1.491 105.121 -1.719 105.121 -3.515 c 105.121 -5.310 102.907 -5.691 99.310 -4.290 c 97.425 -3.556 95.160 -2.333 91.616 0.599 c 130.672 16.500 m 134.216 14.904 136.481 13.233 138.365 11.559 c 141.963 8.362 144.177 5.152 144.177 3.357 c 144.177 1.561 141.963 1.180 138.365 2.581 c 136.481 3.315 134.216 4.538 130.672 7.470 c 169.728 23.372 m 173.272 21.775 175.536 20.105 177.421 18.430 c 181.019 15.234 183.233 12.024 183.233 10.228 c 183.233 8.433 181.019 8.052 177.421 9.452 c 175.536 10.186 173.272 11.409 169.728 14.342 c 208.784 30.243 m 212.327 28.647 214.592 26.976 216.477 25.301 c 220.074 22.105 222.288 18.895 222.288 17.099 c 222.288 15.304 220.074 14.923 216.477 16.324 c 214.592 17.058 212.327 18.281 208.784 21.213 c 247.839 37.114 m 251.383 35.518 253.648 33.847 255.533 32.173 c 259.130 28.976 261.344 25.766 261.344 23.971 c 261.344 22.175 259.130 21.794 255.533 23.195 c 253.648 23.929 251.383 25.152 247.839 28.084 c 273.225 41.581 m 274.507 41.004 275.794 40.341 277.081 39.535 c 278.142 38.870 279.205 38.100 280.261 37.209 c 281.324 36.312 282.385 35.318 283.427 34.171 c 284.159 33.366 284.890 32.490 285.572 31.419 c 285.875 30.942 286.178 30.419 286.422 29.801 c 286.489 29.633 286.551 29.455 286.602 29.271 c 286.654 29.087 286.695 28.890 286.716 28.699 c 286.735 28.515 286.734 28.331 286.713 28.174 c 286.693 28.022 286.654 27.890 286.608 27.779 c 286.457 27.422 286.224 27.238 285.991 27.108 c 285.638 26.912 285.254 26.843 284.866 26.820 c 283.996 26.767 283.089 26.954 282.181 27.225 c 280.831 27.628 279.461 28.238 278.093 29.042 c 276.470 29.996 274.842 31.213 273.225 32.551 c 191.208 18.121 109.191 3.691 27.174 -10.739 c 28.791 -12.076 30.419 -13.293 32.042 -14.247 c 33.410 -15.052 34.780 -15.661 36.130 -16.064 c 37.038 -16.335 37.945 -16.522 38.815 -16.470 c 39.203 -16.446 39.587 -16.378 39.940 -16.181 c 40.172 -16.051 40.405 -15.868 40.556 -15.510 c 40.603 -15.399 40.642 -15.267 40.662 -15.115 c 40.683 -14.959 40.684 -14.774 40.665 -14.591 c 40.644 -14.399 40.602 -14.202 40.551 -14.019 c 40.500 -13.834 40.438 -13.657 40.371 -13.489 c 40.127 -12.871 39.824 -12.348 39.521 -11.871 c 38.839 -10.800 38.108 -9.924 37.376 -9.119 c 36.334 -7.972 35.273 -6.978 34.210 -6.081 c 33.154 -5.190 32.091 -4.420 31.030 -3.755 c 29.743 -2.948 28.456 -2.286 27.174 -1.709 c 109.191 12.721 191.208 27.151 273.225 41.581 c 191.208 27.151 109.191 12.721 27.174 -1.709 c 27.174 -10.739 m 109.191 3.691 191.208 18.121 273.225 32.551 c 273.225 41.581 m 274.507 41.004 275.794 40.341 277.081 39.535 c 278.142 38.870 279.205 38.100 280.261 37.209 c 281.324 36.312 282.385 35.318 283.427 34.171 c 284.159 33.366 284.890 32.490 285.572 31.419 c 285.875 30.942 286.178 30.419 286.422 29.801 c 286.489 29.633 286.551 29.455 286.602 29.271 c 286.654 29.087 286.695 28.890 286.716 28.699 c 286.735 28.515 286.734 28.331 286.713 28.174 c 286.693 28.022 286.654 27.890 286.608 27.779 c 286.457 27.422 286.224 27.238 285.991 27.108 c 285.638 26.912 285.254 26.843 284.866 26.820 c 283.996 26.767 283.089 26.954 282.181 27.225 c 280.831 27.628 279.461 28.238 278.093 29.042 c 276.470 29.996 274.842 31.213 273.225 32.551 c S Q Q Q Q Q Q endstream endobj 7 0 obj << /Type /Font /Subtype /Type1 /BaseFont /Courier /Encoding /WinAnsiEncoding >> endobj 8 0 obj << /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj xref 0 9 0000000000 65535 f 0000000009 00000 n 0000000059 00000 n 0000000142 00000 n 0000000202 00000 n 0000000217 00000 n 0000000458 00000 n 0000048819 00000 n 0000048915 00000 n trailer << /Size 9 /Root 1 0 R/Info 2 0 R >> startxref 49013 %%EOF
49,269
Common Lisp
.l
1,817
26.0776
46
0.715324
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
7e995754de9eac6038fbea3a2e2d23f47e00fdacd8a5ac3e367d0df62d4ec9da
37,071
[ -1 ]
37,116
copy.html
lisp-mirror_gendl/documentation/training/legacy/gdl/cover/copy.html
<html> <body> <p><center><h1> Using Knowledge Base Techniques in Web Applications </h1></center></p> <p><center><h2><i>A GDL/GWL Tutorial for the 2002 International Lisp Conference</i></h2></center></p> <br><br> <p><center><img src="cover.png"></center></p> <p><center>Copyright &copy; 2002, Genworks&reg; International, http://www.genworks.com</center></p> </body></html>
373
Common Lisp
.l
8
45.625
101
0.70137
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
4cba525488c727510d110d94c3bd99ae3abc4174e89ff86a8bdb9ad4a14eb97a
37,116
[ -1 ]
37,117
tutorial.ilg
lisp-mirror_gendl/documentation/training/legacy/gdl/pdf/tutorial.ilg
This is makeindex, version 2.15 [TeX Live 2009] (kpathsea + Thai support). Scanning input file tutorial.idx....done (84 entries accepted, 0 rejected). Sorting entries....done (568 comparisons). Generating output file tutorial.ind....done (153 lines written, 0 warnings). Output written in tutorial.ind. Transcript written in tutorial.ilg.
339
Common Lisp
.l
6
55.5
76
0.780781
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
0171f2332b2e74e6b054d46d571e14bb287e4887c487b440fb98e11270d2d5fc
37,117
[ -1 ]
37,118
tutorial.idx
lisp-mirror_gendl/documentation/training/legacy/gdl/pdf/tutorial.idx
\indexentry{AI}{1} \indexentry{Ignorance-based Engineering}{1} \indexentry{Knowledge Base System}{1} \indexentry{Caching}{1} \indexentry{Dependency tracking}{1} \indexentry{Common Lisp}{1} \indexentry{Basic Lisp Techniques}{1} \indexentry{compiled language!benefits of}{2} \indexentry{macros!code-expanding}{2} \indexentry{declarative}{2} \indexentry{object-orientation!message-passing}{2} \indexentry{object-orientation!generic-function}{2} \indexentry{objects!defining}{5} \indexentry{Define-object}{5} \indexentry{mixin-list}{5} \indexentry{specification-plist}{5} \indexentry{input-slots}{5} \indexentry{computed-slots}{5} \indexentry{objects}{5} \indexentry{functions}{5} \indexentry{the}{5} \indexentry{make-object}{6} \indexentry{make-instance}{6} \indexentry{the-object}{6} \indexentry{self}{6} \indexentry{objects}{7} \indexentry{containment!object}{7} \indexentry{objects!child}{7} \indexentry{objects!contained}{7} \indexentry{reference chains}{7} \indexentry{Objects!sequenced}{9} \indexentry{sequences}{9} \indexentry{object sequences}{9} \indexentry{:size}{9} \indexentry{web user interface!creating}{11} \indexentry{HTTP}{11} \indexentry{HTML}{11} \indexentry{AllegroServe}{11} \indexentry{htmlgen}{11} \indexentry{base-html-sheet}{12} \indexentry{write-html-sheet}{12} \indexentry{instance-id}{12} \indexentry{gwl:*max-id-value*}{12} \indexentry{write-back-link}{13} \indexentry{return-object}{13} \indexentry{form handling}{13} \indexentry{read-safe-string}{16} \indexentry{publishing!of GWL URIs}{16} \indexentry{gwl-make-object}{16} \indexentry{application-mixin}{18} \indexentry{ui-display-list-objects}{18} \indexentry{Paul Graham}{19} \indexentry{sequence}{20} \indexentry{:indices}{20} \indexentry{:size}{20} \indexentry{recomputation!on-demand}{21} \indexentry{spreadsheet!KB as distinct from}{21} \indexentry{time!using to understand KB dynamics}{24} \indexentry{mainstream apps!KB technology useful for}{29} \indexentry{requirements!ever-expanding}{29} \indexentry{objects!primitive!geometric}{33} \indexentry{application-mixin}{33} \indexentry{view}{33} \indexentry{model-inputs}{33} \indexentry{:respondant}{33} \indexentry{:bashee}{33} \indexentry{base-html-sheet}{33} \indexentry{:center}{37} \indexentry{:orientation}{37} \indexentry{face-normal-vector}{37} \indexentry{alignment}{37} \indexentry{development mode}{37} \indexentry{gwl:*developing?*}{37} \indexentry{TaTu}{37} \indexentry{node-mixin}{45} \indexentry{application-mixin}{45} \indexentry{ui-display-list-objects}{45} \indexentry{gwl-rule-object}{45} \indexentry{rules!diagnostic}{49} \indexentry{rules!generative}{49} \indexentry{rules!violating}{49} \indexentry{rules!model!tight integration with}{49} \indexentry{rules}{49} \indexentry{dependency management}{49}
2,759
Common Lisp
.l
84
31.845238
57
0.799626
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
6182d99900f950e8a7dbcac5c37663ff269fb8b7aa9463e9b3dd41eddd995dbd
37,118
[ -1 ]
37,119
tutorial.toc
lisp-mirror_gendl/documentation/training/legacy/gdl/pdf/tutorial.toc
\contentsline {chapter}{\numberline {1}Introduction}{1} \contentsline {section}{\numberline {1.1}Knowledge Base Concepts According to Genworks}{1} \contentsline {section}{\numberline {1.2}Goals for this Tutorial}{1} \contentsline {section}{\numberline {1.3}What is GDL/GWL?}{2} \contentsline {section}{\numberline {1.4}Why GDL (what is GDL good for?)}{2} \contentsline {section}{\numberline {1.5}What GDL is not}{3} \contentsline {chapter}{\numberline {2}GDL Syntax}{5} \contentsline {section}{\numberline {2.1}Define-Object}{5} \contentsline {section}{\numberline {2.2}Making Instances and Sending Messages}{6} \contentsline {section}{\numberline {2.3}Objects}{7} \contentsline {section}{\numberline {2.4}Sequences of Objects and Input-slots with a Default Expression}{9} \contentsline {section}{\numberline {2.5}Summary}{9} \contentsline {chapter}{\numberline {3}GWL Syntax}{11} \contentsline {section}{\numberline {3.1}Testing your GWL Installation}{11} \contentsline {section}{\numberline {3.2}GWL:Define-Package}{12} \contentsline {section}{\numberline {3.3}Basic Usage}{12} \contentsline {section}{\numberline {3.4}Page Linking}{12} \contentsline {section}{\numberline {3.5}Form Handling}{13} \contentsline {section}{\numberline {3.6}Publishing URIs for GWL Objects}{16} \contentsline {section}{\numberline {3.7}Higher-level Apps and Graphics}{18} \contentsline {chapter}{\numberline {4}Example 1: Personal Ledger}{19} \contentsline {section}{\numberline {4.1}Main Ledger Object}{19} \contentsline {section}{\numberline {4.2}Objects for Accounts and Transactions}{23} \contentsline {section}{\numberline {4.3}Using the Main Ledger Object}{23} \contentsline {section}{\numberline {4.4}Making a Web Interface with GWL}{24} \contentsline {section}{\numberline {4.5}Summary}{29} \contentsline {chapter}{\numberline {5}Example 2: Simplified Android Robot}{33} \contentsline {section}{\numberline {5.1}Main UI Sheet for the Robot}{33} \contentsline {section}{\numberline {5.2}Robot Geometry}{37} \contentsline {section}{\numberline {5.3}Using the App}{37} \contentsline {chapter}{\numberline {6}Example 3: School Bus}{45} \contentsline {section}{\numberline {6.1}Toplevel Assembly}{45} \contentsline {section}{\numberline {6.2}Interior of School Bus}{45} \contentsline {section}{\numberline {6.3}Causing a Rule Violation}{54}
2,326
Common Lisp
.l
34
67.411765
107
0.766579
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
75e310a86ed876aeeb9e09ef6f91822209b56a7b72dbf504329bd79050fde894
37,119
[ -1 ]
37,120
tutorial.tex
lisp-mirror_gendl/documentation/training/legacy/gdl/pdf/tutorial.tex
\documentclass [11pt]{book} \author {David J. Cooper, Jr.} \textwidth 6.5in \topmargin 0in \textheight 8.5in \oddsidemargin 0in \evensidemargin 0in \pdfimageresolution 135 \title {Genworks GDL Tutorial} \usepackage [dvips]{graphicx} \usepackage [usenames, dvipsnames]{color} \usepackage {makeidx} \newsavebox {\boxedverb} \makeindex \begin{document} \frontmatter \maketitle \footnotetext{Copyright \copyright{} 2002, Genworks International. Duplication, by any means, in whole or in part, requires written consent from Genworks International.} \tableofcontents \mainmatter \chapter{Introduction} \label{chap:introduction} \section{Knowledge Base Concepts According to Genworks} \label{sec:knowledgebaseconceptsaccordingtogenworks} You may have an idea from college or from textbooks that Knowledge Base Systems, or Knowledge \emph{Based} Systems, are a broad or fuzzy set of concepts somehow related to \index{AI}AI which ``do not translate into anything practical.'' Or you may have heard jabs at the pretentious-sounding name, Knowledge-based Engineering as in: ``you mean as opposed to \index{Ignorance-based Engineering}Ignorance-based Engineering?'' To the contrary, we hope you will agree that our concept of a KB system is simple and practical, and in this tutorial our goal is to make you comfortable and excited about the ideas we have implemented in our flagship system, GDL/GWL. Our definition of a \emph{\index{Knowledge Base System}Knowledge Base System} is an object-oriented programming environment which implements the features of \emph{\index{Caching}Caching} and \emph{\index{Dependency tracking}Dependency tracking}. Caching means that once the KB has computed something, it might not need to repeat that computation if the same question is asked again. Dependency tracking is the flip side of that coin --- it ensures that if a cached result is \emph{stale}, the result will be recomputed the next time it is \emph{demanded}, so as to give a fresh result. \section{Goals for this Tutorial} \label{sec:goalsforthistutorial} This manual is designed as a companion to a live two-hour GDL/GWL tutorial, but you may also be reading it on your own. In either case, the basic goals are: \begin{itemize} \item Get you excited about using GDL/GWL \item Enable you to judge whether GDL/GWL is an appropriate tool for a given job \item Arm you with the ability to argue the case for using GDL/GWL when appropriate \item Prepare you to begin maintaining and authoring GDL/GWL applications, or porting apps from similar KB systems into GDL/GWL. \end{itemize} This tutorial assumes a basic familiarity with the \index{Common Lisp}Common Lisp programming language. If you are new to Common Lisp: congratulations! You have just discovered an exciting and powerful new tool. Many resources are available to get you started in CL --- for starters, we recommend \underline{\index{Basic Lisp Techniques}Basic Lisp Techniques}\footnote{ \underline{BLT} is available at \texttt{http://www.franz.com/resources/educational\_resources/cooper.book.pdf}}, which was prepared by the author of this tutorial. Most of the Common Lisp used in this tutorial is covered in the first few chapters of \underline{Basic Lisp Techniques}, and there you will also find pointers to more exhaustive CL tutorials and reference material. \section{What is GDL/GWL?} \label{sec:whatisgdl/gwl?} GDL is an acronym for the General-purpose Declarative Language. GWL is an acronym for the Generative Web Language. GWL ships along with GDL in a layered, modular fashion. For the remainder of this tutorial, we will sometimes refer only to GDL, and this should usually be taken to mean the bundled package which includes GWL. GDL is a superset of ANSI Common Lisp, and consists mainly of automatic code-expanding extensions to Common Lisp implemented in the form of macros. When you write, let's say, 20 lines in GDL, you might be writing the equivalent of 200 lines of Common Lisp. Of course, since GDL is a superset of Common Lisp, you still have the full power of the CL language at your fingertips whenever you are working in GDL. \index{compiled language!benefits of}\index{macros!code-expanding}Since GDL expands into CL, everything you write in GDL will be compiled ``down to the metal'' to machine code with all the optimizations and safety that the tested-and-true CL compiler provides. This is an important distinction as contrasted to some other so-called KB systems on the market, which are really nothing more than interpreted scripting languages which often fall over with a ``thud'' when pushed to compute something more demanding than simple parameter-passing. GDL can also be considered a \emph{\index{declarative}declarative} language. When you put together a GDL application, you write and think mainly in terms of objects and their properties, and how they depend on one another in a direct sense. You do not have to track in your mind explicitly how one object or property will ``call'' another object or propery, in what order this will happen, etc. Those details are taken care of for you automatically by the language. Because GDL is object-oriented, you have all the features you would normally expect from an object-oriented language, such as \begin{itemize} \item Separation between the \emph{definition} of an object and an \emph{instance} of an object \item High levels of data abstraction \item The ability for one object to ``inherit'' from others \item The ability to ``use'' an object without concern for its ``under-the-hood'' implementation \end{itemize} \index{object-orientation!message-passing}\index{object-orientation!generic-function}GDL supports the ``message-passing'' paradigm of object orientation, with some extensions. Since full-blown ANSI CLOS (Common Lisp Object System) is always available as well, the Generic Function paradigm is supported as well. Do not be concerned at this point if you are not fully aware of the differences between these two paradigms\footnote{See Paul Graham's \underline{ANSI Common Lisp}, page 192, for an excellent discussion of the Two Models of Object-oriented Programming.}. \section{Why GDL (what is GDL good for?)} \label{sec:whygdl(whatisgdlgoodfor?)} \begin{itemize} \item Organizing and interrelating large amounts of information in ways not possible or not practical using conventional languages or conventional relational database technology alone; \item Evaluating many design or engineering alternatives and performing various kinds of optimizations within specified design spaces; \item Capturing the procedures and rules used to solve repetitive tasks in engineering and other fields; \item Applying rules to achieve intermediate and final outputs, which may include virtual models of wireframe, surface, and solid geometric objects. \end{itemize} \section{What GDL is not} \label{sec:whatgdlisnot} \begin{itemize} \item A CAD system (although it may operate on and/or generate geometric entities); \item A drawing program (although it may operate on and/or generate geometric entities); \item An Artificial Intelligence system (although it is an excellent environment for developing capabilities which could be considered as such); \item An Expert System Shell (although one could be easily embedded within it). \end{itemize} Without further ado, then, let's turn the page and get started with some hands-on GDL... \chapter{GDL Syntax} \label{chap:gdlsyntax} \section{Define-Object} \label{sec:define-object} \index{objects!defining}\emph{\index{Define-object}Define-object} is the basic macro for defining objects in GDL. An object definition maps directly into a Lisp (CLOS) class definition. The \texttt{define-object} macro takes three basic arguments: \begin{itemize} \item a \emph{name}, which is a symbol; \item a \emph{\index{mixin-list}mixin-list}, which is a list of symbols naming other objects from which the current object will inherit characteristics; \item a \emph{\index{specification-plist}specification-plist}, which is spliced in (i.e.\ doesn't have its own surrounding parentheses) after the mixin-list, and describes the object model by specifying properties of the object (messages, contained objects, etc.) The specification-plist typically makes up the bulk of the object definition. \end{itemize} Here are descriptions of the most common keywords making up the specification-plist: \begin{description} \item [\index{input-slots}input-slots] specify information to be passed into the object instance when it is created. \item [\index{computed-slots}computed-slots] are really cached methods, with expressions to compute and return a value. \item [\index{objects}objects] specify other instances to be ``contained'' within this instance. \item [\index{functions}functions] are (uncached) functions ``of'' the object, i.e.\ they are actually methods which discriminate on their first argument, which is the object instance upon which they are operating. GDL functions can also take other non-specialized arguments, just like a normal CL function. \end{description} Figure \ref{fig:object-hello} shows a simple example, which contains two input-slots, \texttt{first-name} and \texttt{last-name}, and a single computed-slot, \texttt{greeting}. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object hello () :input-slots (first-name last-name) :computed-slots ((greeting (format nil "Hello, ~a ~a!!" (the first-name) (the last-name))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Example of Simple Object Definition} \label{fig:object-hello} \end{figure} As you can see, a GDL Object is analogous in some ways to a \texttt{defun}, where the input-slots are like arguments to the function, and the computed-slots are like return-values. But seen another way, each attribute in a GDL object is like a function in its own right. The referencing macro \texttt{\index{the}the} shadows CL's \texttt{the} (which is a seldom-used type declaration operator). \texttt{The} in GDL is a macro which is used to reference the value of other messages within the same object or within contained objects. In the above example, we are using \texttt{the} to refer to the values of the messages (input-slots) named \texttt{first-name} and \texttt{last-name}. Note that messages used with \texttt{the} are given as symbols. These symbols are unaffected by the current Lisp \texttt{*package*}, so they can be specified either as plain unquoted symbols or as keyword symbols (i.e.\ preceded by a colon), and the \texttt{the} macro will process them appropriately. \section{Making Instances and Sending Messages} \label{sec:makinginstancesandsendingmessages} Once we have defined an object such as the example above, we can use the constructor function \texttt{\index{make-object}make-object} in order to create an \emph{instance} of it. This function is very similar to the CLOS \texttt{\index{make-instance}make-instance} function. Here we create an instance of \texttt{hello} with specified values for \texttt{first-name} and \texttt{last-name} (the required input-slots), and assign this instance as the value of the symbol \texttt{my-instance}: \begin{verbatim} GDL-USER(16): (setq my-instance (make-object 'hello :first-name "John" :last-name "Doe")) #<HELLO @ #x218f39c2> \end{verbatim}As you can see, keyword symbols are used to ``tag'' the input values, and the return value is an instance of class \texttt{hello}. Now that we have an instance, we can use the macro \texttt{\index{the-object}the-object} to send messages to this instance: \begin{verbatim} GDL-USER(17): (the-object my-instance greeting) "Hello, John Doe!!" \end{verbatim}\texttt{The-object} is similar to \texttt{the}, but as its first argument it takes an expression which evaluates to an object instance. \texttt{The}, by contrast, assumes that the object instance is the lexical variable \texttt{\index{self}self}, which is automatically set within the lexical context of a \texttt{define-object}. Like \texttt{the}, \texttt{the-object} evaluates all but the first of its arguments as package-immune symbols, so although keyword symbols may be used, this is not a requirement, and plain, unquoted symbols will work just fine. For convenience, you can also set \texttt{self} manually at the CL Command Prompt, and use \texttt{the} instead of \texttt{the-object} for referencing: \begin{verbatim} GDL-USER(18): (setq self (make-object 'hello :first-name "John" :last-name "Doe")) #<HELLO @ #x218f406a> GDL-USER(19): (the greeting) "Hello, John Doe!!" \end{verbatim}In actual fact, \texttt{(the ...)} simply expands into \texttt{(the-object self ...)}. \section{Objects} \label{sec:objects} \index{objects}\index{containment!object}\index{objects!child}\index{objects!contained}The \texttt{:objects} keyword specifies a list of ``contained'' instances, where each instance is considered to be a ``child'' object of the current object. Each child object is of a specified type, which itself must be defined with \texttt{define-object} before the child object can be instantiated. Inputs to each instance are specified as a plist of keywords and value expressions, spliced in after the object's name and type specification. These inputs must match the inputs protocol (i.e.\ the input-slots) of the object being instantiated. Figure \ref{fig:object-city} shows an example of an object which contains some child objects. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object city () :computed-slots ((total-water-usage (+ (the hotel water-usage) (the bank water-usage)))) :objects ((hotel :type 'hotel :size :large) (bank :type 'bank :size :medium))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Object Containing Child Objects} \label{fig:object-city} \end{figure} In this example, \texttt{hotel} and \texttt{bank} are presumed to be already (or soon to be) defined as objects themselves, which each answer the \texttt{water-usage} message. The \emph{\index{reference chains}reference chains}: \begin{verbatim}(the hotel water-usage) \end{verbatim} and \begin{verbatim}(the bank water-usage) \end{verbatim} provide the mechanism to access messages within the child object instances. These child objects become instantiated \emph{on demand}, meaning that the first time these instances or any of their messages are referenced, the actual instance will be created \emph{and} cached for future reference. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (defparameter *presidents-data* '((:name "Carter" :term 1976) (:name "Reagan" :term 1980) (:name "Bush" :term 1988) (:name "Clinton" :term 1992))) (define-object presidents-container () :input-slots ((data *presidents-data*)) :objects ((presidents :type 'president :sequence (:size (length (the data))) :name (getf (nth (the-child index) (the data)) :name) :term (getf (nth (the-child index) (the data)) :term)))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Sample Data and Object Definition to Contain U.S. Presidents} \label{fig:object-presidents-container} \end{figure} \section{Sequences of Objects and Input-slots with a Default Expression} \label{sec:sequencesofobjectsandinput-slotswithadefaultexpression} Objects may be \emph{sequenced}\index{Objects!sequenced}\index{sequences}\index{object sequences}, to specify, in effect, an array or list of object instances. The most common type of sequence is called a \emph{fixed size} sequence. See Figure \ref{fig:object-presidents-container} for an example of an object which contains a sequenced set of instances representing U.S. presidents. Each member of the sequenced set is fed inputs from a list of plists, which simulates a relational database table (essentially a ``list of rows''). Note the following from this example: \begin{itemize} \item In order to sequence an object, the input keyword \texttt{:sequence} is added, with a list consisting of the keyword \texttt{\index{:size}:size} followed by an expression which must evaluate to a number. \item In the input-slots, \texttt{data} is specified together with a default expression. Used this way, input-slots function as a hybrid of computed-slots and input-slots, allowing a \emph{default expression} as with computed-slots, but allowing a value to be passed in on instantiation or from the parent, as with an input-slot which has no default expression. A passed-in value will override the default expression. \end{itemize} \section{Summary} \label{sec:summary} This GDL syntax overview has been kept purposely brief, covering the fundamentals of the language in a dense manner. On one hand, it is not meant to be a comprehensive language reference; on the other hand, do not be concerned if you are still unsure about some of the terminology. The upcoming examples will revisit and further expand many of the topics covered here, and at some point a coherent picture should begin to emerge. At that point it will be like riding a bicycle, and there will be no going back. \chapter{GWL Syntax} \label{chap:gwlsyntax} \index{web user interface!creating}\index{HTTP}\index{HTML}GWL (Generative Web Language) consists essentially of a set of mixins and a few functions which provide a convenient mechanism to present KB objects defined in GDL through a standard HTTP/HTML web user interface. GWL ships as a standard component of the commercial GDL product, and is available on the GDL Trial Edition CD as well. GWL is designed to operate in conjunction with AllegroServe\index{AllegroServe}\index{htmlgen}\footnote{AllegroServe is an open-source webserver from Franz Inc, available at http://opensource.franz.com} and its companion HTML generating facility, htmlgen. This chapter describes basic GWL usage and syntax. It assumes familiarity with the underlying base language, GDL, covered in the previous chapter. \section{Testing your GWL Installation} \label{sec:testingyourgwlinstallation} After you have installed according to \texttt{install.htm}: \begin{enumerate} \item Make sure you have started AllegroServe with: \begin{verbatim}(net.aserve:start :port 9000) \end{verbatim}(or any port of your choice) \item In any standard web browser, go to: \begin{verbatim}http://<hostname>:<port>/demos/robot \end{verbatim}e.g.: \begin{verbatim}http://localhost:9000/demos/robot \end{verbatim} \end{enumerate} You should see a page with a simple robot assembly made from boxes. If the robot shows up as well as the orange graphical "compass" below the graphics viewport, your installation is likely working correctly. \section{GWL:Define-Package} \label{sec:gwl:define-package} The macro \texttt{gwl:define-package} is provided for setting up new working GWL packages. Example: \begin{verbatim}(gwl:define-package :gwl-user) \end{verbatim}The \texttt{:gwl-user} package is an empty, pre-defined package for your use if you do not wish to make a new package just for scratch work. For real projects it is recommended that you make and work in your own GWL package. \section{Basic Usage} \label{sec:basicusage} To present a GDL object instance as a web page requires two simple steps: \begin{enumerate} \item mix in \texttt{\index{base-html-sheet}base-html-sheet} or a subclass thereof \item define a function in the object called \texttt{\index{write-html-sheet}write-html-sheet} \end{enumerate} The \texttt{write-html-sheet} function should typically make use of the htmlgen \texttt{html} macro. It does not need to take any arguments. Please see the htmlgen documentation (at \texttt{http://opensource.franz.com}, with the AllegroServe distribution, or in \texttt{<gdl-home>/doc/aserve/}) for full details on the use of htmlgen. The code for a simple example object with its \texttt{write-html-sheet} presentation function is shown in Figure \ref{code:basic-usage}. This example contains two optional input slots with values for Name and Term of a president, and creates a simple HTML table displaying this information. As outlined above, in order to make an instance and display this object through a web browser, you would visit the URI: \begin{verbatim}http://<host>:<port>/make?object=gwl-user::president \end{verbatim} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object president (base-html-sheet) :input-slots ((name "Carter") (term 1976)) :functions ((write-html-sheet () (html (:html (:head (:title (format nil "Info on President: ~a" (the name)))) (:body (:table (:tr (:td "Name") (:td "Term")) (:tr (:td (:princ (the name))) (:td (:princ (the term))))))))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Basic Usage} \label{code:basic-usage} \end{figure} \section{Page Linking} \label{sec:pagelinking} Creating hypertext links to other pages in the page hierarchy is usually accomplished with the built-in GDL function of \texttt{base-html-sheet} called \texttt{write-self-link}. This GDL function, when called on a particular page instance, will write a hypertext link referring to that page instance. These hypertext links are published by AllegroServe ``on the fly'' (as a side-effect of being demanded), and are made up from the unique root-path of the target object, as well as an \index{instance-id}instance-id which identifies the particular object instance which is the ``root'' of the relevant page hierarchy. This is necessary because GWL maintains a table of root-level instances. Each root-level instance will usually correspond to one "user" or session. However, in general, there can be a many-to-many relationship between user sessions and root-level instances. The instance-id is generated randomly. On a publicly-accessible website, the maximum instance-id should be set to a very large number to decrease the likelihood of a malicious visitor being able to ``guess'' the instance-id of another user. The maximum is set with the parameter \texttt{\index{gwl:*max-id-value*}gwl:*max-id-value*}. Figures \ref{code:page-linking} and \ref{code:link-target} show the code for making a page with a list of links to pages representing individual U.S. presidents, resulting in a web page which should resemble Figure \ref{fig:presidents-container}. Note the call to the \texttt{write-self-link} function inside the \texttt{dolist} in Figure \ref{code:page-linking}. This results in an HTML list item being generated with a hyperlink for each ``president'' child object. Note also the use of the \texttt{\index{write-back-link}write-back-link} function in \texttt{presidents-display}. This will generate a link back to the \texttt{\index{return-object}return-object} of the object, which defaults to the object's \texttt{parent}. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object presidents-container (base-html-sheet) :input-slots ((data '((:last-name "Carter" :term 1976) (:last-name "Clinton" :term 1992)))) :objects ((presidents :type 'president-display :sequence (:size (length (the data))) :last-name (getf (nth (the-child index) (the data)) :last-name) :term (getf (nth (the-child index) (the data)) :term))) :functions ((write-html-sheet () (html (:html (:head (:title "Links to Presidents")) (:body (:h1 "Links to the Presidents") (:ol (dolist (president (list-elements (the presidents))) (html (:li (the-object president (write-self-link)))))))))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Making a List of Links} \label{code:page-linking} \end{figure} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object president-display (base-html-sheet) :input-slots (last-name term) :computed-slots ((strings-for-display (the last-name))) :functions ((write-html-sheet () (html (:html (:head (:title (:princ (the last-name)))) (:body (:h1 (:princ (the last-name))) "Term: " (:princ (the term)) (:p (the (write-back-link))))))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Link Target} \label{code:link-target} \end{figure} \begin{figure} \begin{center} \includegraphics{../images/presidents-container.png} \end{center} \caption{Presidents Container Page with Links} \label{fig:presidents-container} \end{figure} \section{Form Handling} \label{sec:formhandling} \index{form handling}Forms are generated using the GWL macro\texttt{with-html-form}. You wrap this macro around the HTMLgen code which creates the contents of the form: \begin{verbatim} (with-html-form () ;; the body of your form goes here ) \end{verbatim}The above code snippet would be included in a \texttt{write-html-sheet}function of a page definition. By default, the same object which generates the form will also respond to the form, and is also the object which will have its settable slots modified based on form fields (i.e. html ``inputs'') of the same name. You can override the default by specifying a \texttt{bashee} and/or \texttt{respondent}as slots in the requestor object (i.e. the object which is generating the form), for example: \begin{verbatim} :computed-slots ((respondent (the some-other-object)) (bashee (the yet-another-object))) \end{verbatim}Any \texttt{:settable} computed-slots in the object may be specified as input values (i.e.\ with \texttt{:input} tags) in the form. GWL will automatically infer their types and do appropriate conversion. If the type of a slot can vary, it is best to make its default be a string, then have your application read from the string (with the \texttt{\index{read-safe-string}read-safe-string} function). Note that only those input values which have actually changed (according to \texttt{equalp} ) will be set into the corresponding computed-slot upon form submission. Ones which remain the same will be left alone (to avoid unnecessary dependency updating in the model). Any \texttt{:input} values in the form whose name does not match one of the \texttt{:settable} computed-slots in the object will still be collected, but rather than being set into its own named slot, it will be returned as part of the special \texttt{query-plist} message when the response page's \texttt{write-html-sheet} method is invoked. \texttt{Query-plist} is a plist containing keywords representing the form field names, and values which will be strings representing the submitted values. If you want to do additional processing, the following functions are provided for \texttt{base-html-sheet}: \begin{description} \item [before-set!] This is invoked before the ``bashee'' is modified with any new form values. \item [after-set!] This is invoked after the ``bashee'' is modified with any new form values. \item [before-present!] This is invoked after the ``bashee'' is modified with any new form values, but before the page content is returned to the web client. \item [after-present!] This is invoked after the page content is returned to the web client. \end{description} By default, these functions are empty, but you can override them to do whatever extra processing you wish. Figure \ref{code:hello-form} shows an object which both generates and responds to a simple form, with the corresponding web page shown in Figure \ref{fig:hello-form}. The form allows the user to type a name to override the default ``Jack,'' and reflects the submitted name in the form page upon response. To instantiate this object in a web browser, you would visit the URI: \begin{verbatim}http://<host>:<port>/make?object=gwl-user::hello-form \end{verbatim} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object hello-form (base-html-sheet) :computed-slots ((username "Jack" :settable)) :functions ((write-html-sheet () (html (:html (:head (:title "Sample Form")) (:body (:p "Hello there, " (:princ (the username)) "!") (:p (with-html-form () ((:input :type :text :name :username :value (the username))) ((:input :type :submit :name :submit :value " Change Name! ")))))))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Hello Form} \label{code:hello-form} \end{figure} \begin{figure} \begin{center} \includegraphics{../images/hello-form.png} \end{center} \caption{Hello Form} \label{fig:hello-form} \end{figure} \section{Publishing URIs for GWL Objects} \label{sec:publishingurisforgwlobjects} \index{publishing!of GWL URIs}You can publish a URI for a given object, to avoid having to type the ``make?'' expression, using the AllegroServe \texttt{publish} function and the GWL \texttt{\index{gwl-make-object}gwl-make-object} function, as per the following example: \begin{verbatim} (publish :path "/demos/bus" :function #'(lambda(req ent) (gwl-make-object req ent "bus:assembly"))) \end{verbatim}In this example, the ``bus'' object would now be instantiated simply by visiting the URI: \begin{verbatim}http://<host>:<port>/bus \end{verbatim} \section{Higher-level Apps and Graphics} \label{sec:higher-levelappsandgraphics} GDL/GWL also has the ability to generate and display standard wireframe geometric entities. The complete list of currently available primitive geometric objects is available in the GDL documentation set. Currently the only documented way to display geometry in a GWL application is by using the higher-level mixin \texttt{\index{application-mixin}application-mixin}. Two complete examples of the use of this mixin, the Robot and the School Bus, are given in Chapters \ref{chap:example2:simplifiedandroidrobot} and \ref{chap:example3:schoolbus}. Here we will just touch on the basics of how to use this mixin. \begin{enumerate} \item Instead of \texttt{base-html-sheet}, mix in \texttt{application-mixin} into the object definition you wish to publish via the web. \item Collect the objects whose leaves you wish to display as geometry in a computed-slot named\texttt{\index{ui-display-list-objects}ui-display-list-objects}. \end{enumerate} Following the above steps will result in a page with a default user interface which will display your graphics in the center. This page, and each of its components, are highly customizable, and we will look at some of the available customizations in the examples in Chapters \ref{chap:example2:simplifiedandroidrobot} and \ref{chap:example3:schoolbus}. \chapter{Example 1: Personal Ledger} \label{chap:example1:personalledger} In this chapter we will describe a simple personal accounting ledger application. First we will build the core objects necessary to keep track of accounts and transactions; then we will layer a web user interface on top of these objects to allow for convenient end-user access. I have chosen to build this application in base GDL/GWL, without the use of any database\footnote{\index{Paul Graham}Paul Graham is fond of reminding us that ``the filesystem is already a database.''} or other general-purpose mixins. Clearly, one could greatly reduce the amount of code required for an application like this by using ``utility'' mixins for tasks such as database or filesystem access and standard GUI templates. While it certainly does not implement the most efficient accounting/ledger algorithms possible, this application will give us a small taste of the power of the caching and dependency-tracking features of a KB system. \section{Main Ledger Object} \label{sec:mainledgerobject} The full source for the Ledger application is available in the GDL application directory under the \texttt{gwl-samples} directory. We include partial hardcopy in this tutorial, but if you wish to try running the example yourself you should use the code from the CD rather than trying to type it in from this hardcopy (also, some changes may have occured since the preparation of this tutorial). The ledger application needs write access to files under the \texttt{gwl-samples/ledger/data/} directory, so you may need to open up permissions on these files, or copy the entire \texttt{ledger/} directory to a location where you have write access, such as your home directory. Figure \ref{code:ledger-input-computed} shows the input-slots and computed-slots of our main object, named conventionally ``assembly'' (in the \texttt{:ledger} Lisp package). The two inputs each default to a file holding the beginning data set for Accounts and Transactions respectively. Figure \ref{data:ledger-data} shows a sampling of the first few lines from typical data files. These data files are given the ``lisp'' extension simply so that they will come up in Lisp-mode in Emacs for ease of hand-editing -- they are not meant to be compiled as Lisp program source code. The \texttt{account-data} and \texttt{transaction-data} computed-slots read and hold the contents of these data files for use in initializing the actual \texttt{accounts} and \texttt{transactions} object sequences, which the ledger application will use. The \texttt{account-indices} and \texttt{transaction-indices} collect up the unique indices from the individual acounts and transactions, used to compute the ``next'' index when adding a new ``record.'' The \texttt{net-worth} and \texttt{profit} slots compute the sums of Asset/Liability accounts and Income/Expense accounts, respectively (the sign on \texttt{profit} is reversed to make Income items appear positive and Expense items appear negative). Finally, the \texttt{balances-hash-table} slot is a hash table keyed on the account indices, computing the current balance of each account. This value is passed into the actual account objects for later use. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} ("Index" "Name" "Description" "Account Number" "Account Type" "Account Class" "Beginning Balance") (0 "DFCU" "Dearborn Federal Credit Union" "999-6969-999" "Checking" "Asset/Liability" 25000) (1 "Waterhouse" "Waterhouse Taxable" "555-7979-555" "Savings" "Asset/Liability" 12500) ... ("Index" "From Account" "To Account" "Date" "Amount" "Payee") (0 0 1 3243976597 1000 "djc") (1 0 1 3243976772 1500 "djc") ... \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Contents of Account and Transaction Data Files} \label{data:ledger-data} \end{figure} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \small{} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Input-Slots and Computed-Slots of Ledger} \label{code:ledger-input-computed} \end{figure} Figure \ref{fig:genacc2-subobjects} shows the two sub-objects contained within the ledger assembly object. Each of these is specified as a \texttt{\index{sequence}sequence}, based on the initial data read from the data files. Because these sequences are specified by a list of \texttt{\index{:indices}:indices}, rather than by a fixed \texttt{\index{:size}:size}, they can be programmatically modified by inserting and deleting sequence elements. In this example, such insertions or deletions would be analogous to row operations on a relational database table. Note that the \texttt{current-balance} is accessed from the \texttt{balances-hash-table}, a computed-slot listed in Figure \ref{code:ledger-input-computed}. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \small{ \begin{verbatim} ... :objects ((accounts :type 'account :sequence (:indices (mapcar #'first (rest (the account-data)))) :data (nth (the-child index) (rest (the account-data))) :current-balance (gethash (the-child index) (the balances-hash-table)) :headings (first (the account-data))) (transactions :type 'transaction :sequence (:indices (mapcar #'first (rest (the transaction-data)))) :data (nth (the-child index) (rest (the transaction-data))) :headings (first (the transaction-data)))) ... \end{verbatim}} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Sub-Objects of Ledger} \label{fig:genacc2-subobjects} \end{figure} The final segment of our main ledger object is listed in Figure \ref{fig:genacc2-functions}. Here, we specify some functions on the ledger object which accept arguments and perform some side-effect on the object. Note that GDL \texttt{:functions} are distinguished from \texttt{:computed-slots} by two main characteristics: \begin{enumerate} \item They can accept arguments, a ``lambda list,'' as with a normal CL function. \item Their return-values are not cached or dependency-tracked. Their bodies are evaluated every time they are referenced (called). \end{enumerate} The \texttt{add-transaction!} function adds a new transaction element to the \texttt{transactions} object sequence, and immediately calls the \texttt{save-transactions!} function to update the transactions data file\footnote{In a more robust application, the in-memory insertion and the updating of the external file should be done as an indivisible unit with ``unwind'' capability, to ensure that either the whole thing succeeds or the whole thing fails.}. The most important thing to note here is that when a new transaction is added using the \texttt{add-transaction!} function, any other message (e.g. computed-slot, object, etc.) which in any way depends upon the \texttt{transactions}\index{recomputation!on-demand} sequence of objects will now automatically recompute and return a fresh value the next time it is demanded. For example, the \texttt{profit} and \texttt{net-worth} messages will now return updated values the next time they are demanded. But the recomputation of a message will happen if and only if the message is actually demanded. In a very large object tree, for example, thousands of messages in hundreds of objects might depend on a certain value. When that value is changed, however, the system \underline{does not} incur the computational overhead of updating all these thousands of dependent items at that time. Perhaps only a few dozen of these thousands of dependent items will ever be accessed. Only those few dozen will need to be computed. This is one of the obvious distinctions between a conventional ``spreadsheet'' application and a knowledge base application --- a spreadsheet is generally not scalable to very large problems or models, because changing a value forces the user to wait for an all-or-nothing update of the entire sheet.\index{spreadsheet!KB as distinct from} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \small{ \begin{verbatim} ... :functions ((add-transaction! (&key from-account to-account date amount payee) (when (or (not (member from-account (the account-indices))) (not (member to-account (the account-indices))) (not (numberp amount)) (not (stringp payee)) (not (ignore-errors (decode-universal-time date)))) (error "One or more invalid arguments given to add-transaction!")) (let ((new-index (1+ (if (null (the transaction-indices)) 0 (apply #'max (the transaction-indices)))))) (the transactions (insert! new-index)) (the (transactions new-index) (set-slot! :data (list new-index from-account to-account date amount payee)))) (the save-transactions!)) (save-transactions! () (with-open-file (out (the transaction-data-file) :direction :output :if-exists :supersede :if-does-not-exist :create) (print (first (the transaction-data)) out) (dolist (transaction (list-elements (the transactions))) (print (the-object transaction data) out)))) ;; ... Similarly for add-account! and save-accounts! ))) \end{verbatim}} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Functions of Ledger} \label{fig:genacc2-functions} \end{figure} \section{Objects for Accounts and Transactions} \label{sec:objectsforaccountsandtransactions} Figure \ref{fig:genacc2-accountandtransaction} shows the object definitions for \texttt{account} and \texttt{transaction}. These are simple objects which essentially receive some inputs and make them available as messages. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object account (base-object) :input-slots (data headings current-balance) :computed-slots ((name (second (the data))) (description (third (the data))) (account-number (fourth (the data))) (account-type (fifth (the data))) (account-class (sixth (the data))) (beginning-balance (seventh (the data))))) (define-object transaction (base-object) :input-slots (data headings) :computed-slots ((from-account (second (the data))) (to-account (third (the data))) (date (fourth (the data))) (amount (fifth (the data))) (payee (sixth (the data))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Account and Transaction Object Definitions} \label{fig:genacc2-accountandtransaction} \end{figure} \section{Using the Main Ledger Object} \label{sec:usingthemainledgerobject} We can use the ledger object we have put together so far by typing commands at the Common Lisp prompt. First, we will make an instance of a ledger object, conveniently setting this instance to the variable \texttt{self}: \begin{verbatim} LEDGER(10): (setq self (make-object 'assembly)) #<ASSEMBLY @ #x7367516a> \end{verbatim}Now we can use ``the'' referencing to call various messages in this instance: \begin{verbatim} LEDGER(11): (the profit) 140 LEDGER(12): (the net-worth) 37640 LEDGER(13): (the balances-hash-table) #<EQL hash-table with 7 entries @ #x7367fc1a> LEDGER(14): (the (accounts 0) current-balance) 28140 LEDGER(15): \end{verbatim}Now we will add a transaction, and confirm that it affects our \texttt{profit} and \texttt{net-worth}: \begin{verbatim} LEDGER(15): (the (add-transaction! :from-account 0 :to-account 4 :date (get-universal-time) :amount 250 :payee "djc")) NIL LEDGER(16): (the profit) -110 LEDGER(17): (the net-worth) 37390 LEDGER(18): \end{verbatim}If we had wrapped the CL \index{time!using to understand KB dynamics}\texttt{time} macro around for example the call to the \texttt{profit}, we would have been able to see that indeed it was recomputed the second time we called it, since something it depends upon had been modified. If we call it again immediately, without having changed anything, \texttt{time} would show us that it returns virtually instantaneously without causing any substantial work to be done, since its value is now cached and the cache is still fresh. \section{Making a Web Interface with GWL} \label{sec:makingawebinterfacewithgwl} Now that we have built and tested our main ledger ``engine,'' let's make it more accessible to casual users by layering a web user interface on it. One way to do this is to create a new toplevel object which \emph{contains} the ledger engine, and specifies an assembly of objects to represent the web pages in our interface. Figure \ref{code:ledger-html-top} shows the definition of the top level, or ``home page,'' of our web application. It contains the actual ledger assembly, or ``engine,'' as well as child objects, which represent sub-pages in our website, corresponding to an account listing, a transaction listing, a form for adding a transaction, and a form for adding an account. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object html-assembly (base-html-sheet) :computed-slots ((accounts-ht (let ((ht (make-hash-table))) (dolist (account (list-elements (the ledger accounts)) ht) (setf (gethash (the-object account index) ht) account))))) :objects ((ledger :type 'assembly) (view-accounts :type 'view-accounts :account-sequence (the ledger accounts)) (view-transactions :type 'view-transactions :transaction-sequence (the ledger transactions) :pass-down (accounts-ht)) (add-transaction :type 'add-transaction :main-sheet self :pass-down (accounts-ht)) (add-account :type 'add-account :main-sheet self)) ... \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Slots and Object for Web Interface} \label{code:ledger-html-top} \end{figure} Our toplevel user interface sheet also contains a \texttt{write-html-sheet} presentation function, shown in Figure \ref{code:ledger-html-bottom}. This presentation function also serves as a response function to the forms for adding accounts and transactions -- for this reason, it contains two blocks of code, before the actual html page generation, which take care of actually processing any added transaction or account. The form values for these will show up as plist values in the \texttt{query-plist} slot, since they are not specified as named slots in the objects which generate the forms (the transaction form is shown in Figure \ref{code:add-transactions-sheet}, and the accounts form is not listed here but is similar). \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \small{ \begin{verbatim} :functions ((write-html-sheet () (let ((plist (the add-transaction query-plist))) (when plist (the ledger (add-transaction! :from-account (read-safe-string (getf plist :from-account)) :to-account (read-safe-string (getf plist :to-account)) :date (iso-to-universal (getf plist :date)) :amount (read-safe-string (getf plist :amount)) :payee (getf plist :payee)))) (the add-transaction (:set-slot! :query-plist nil))) (let ((plist (the add-account query-plist))) (when plist (the ledger (add-account! :name (getf plist :name) :description (getf plist :description) :account-number (getf plist :account-number) :account-type (getf plist :account-type) :account-class (getf plist :account-class) :beginning-balance (read-safe-string (getf plist :beginning-balance))))) (the add-account (:set-slot! :query-plist nil))) (html (:html (:head (:title "Personal Ledger")) (:body (:h2 (:center "Personal Ledger")) (:p (:table (:tr (:td "Net Worth:") ((:td :align :right) (:b (:tt ((:font :color (gethash (if (minusp (the ledger net-worth)) :red :green-lime) *color-table*)) (:princ (number-format (the ledger net-worth) 2))))))) (:tr (:td "Profit/Loss:") ((:td :align :right) (:b (:tt ((:font :color (gethash (if (minusp (the ledger profit)) :red :green-lime) *color-table*)) (:princ (number-format (the ledger profit) 2))))))))) (:p (:ul (:li (the view-accounts (write-self-link :display-string "View Accounts"))) (:li (the view-transactions (write-self-link :display-string "View Transactions"))) (:li (the add-transaction (write-self-link :display-string "Add Transaction"))) (:li (the add-account (write-self-link :display-string "Add Account"))))))))))) \end{verbatim}} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Output Function for Web Interface} \label{code:ledger-html-bottom} \end{figure} \begin{figure} \begin{center} \includegraphics{../images/ledger-main.png} \end{center} \caption{Main Screen of Ledger} \label{fig:ledger-main} \end{figure} \begin{figure} \begin{center} \includegraphics{../images/transaction-listing.png} \end{center} \caption{Transaction Listing Sheet} \label{fig:transaction-listing} \end{figure} Figure \ref{code:view-transactions-sheet} defines an object which takes two inputs and computes two simple slots, but most of all it defines a presentation method to generate an html table listing all transactions entered to date. An example is seen in Figure \ref{fig:transaction-listing}. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object view-transactions (base-html-sheet) :input-slots (transaction-sequence accounts-sequence) :computed-slots ((transactions (list-elements (the transaction-sequence))) (headings (the-object (first (the transactions)) headings))) :functions ((write-html-sheet () (html (:html (:head (:title "Transaction Listing")) (:body (:h2 (:center "Transaction Listing")) (:p (the (:write-back-link))) (:p ((:table :bgcolor :black) ((:tr :bgcolor :yellow) (dolist (heading (rest (the headings))) (html (:th (:princ heading))))) (dolist (transaction (the transactions)) (html ((:tr :bgcolor (gethash :grey-light-very *color-table*)) (dolist (slot (list :from-account :to-account :date :amount :payee )) (let* ((raw-value (the-object transaction (evaluate slot))) (value (case slot ((:from-account :to-account) (the :accounts-sequence (get-member raw-value) :name)) (:date (iso-date raw-value)) (:amount (number-format raw-value 2)) (otherwise raw-value)))) (html ((:td :align (case slot (:amount :right) (otherwise :left))) (case slot (:amount (html (:tt (format *html-stream* "$~$" value)))) (otherwise (html (:princ value))))))))))))) (:p (the (:write-back-link))))))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Sheet for Transaction Listing} \label{code:view-transactions-sheet} \end{figure} Figure \ref{code:add-transactions-sheet} defines a presentation function to create a fillout-form for adding a transaction, and Figure \ref{fig:add-transaction} shows a sample rendition of this form. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \small{ \begin{verbatim} (define-object add-transaction (base-html-sheet) :input-slots (accounts-sequence main-sheet) :computed-slots ((respondent (the main-sheet))) :functions ((write-html-sheet () (html (:html (:head (:title "Add Transaction")) (:body (:h2 (:center "Add Transaction")) (:p (the (:write-back-link))) (with-html-form (:p ((:table :bgcolor :black) (:tr ((:td :bgcolor :yellow) "From Account") ((:td :bgcolor (gethash :green-spring *color-table*)) ((:select :name :from-account) (mapcar #'(lambda(account) (html ((:option :value (the-object account index)) (:princ (the-object account name))))) (list-elements (the accounts-sequence)))))) (:tr ((:td :bgcolor :yellow) "To Account") ((:td :bgcolor (gethash :green-spring *color-table*)) ((:select :name :to-account) (mapcar #'(lambda(account) (html ((:option :value (the-object account index)) (:princ (the-object account name))))) (list-elements (the accounts-sequence)))))) (:tr ((:td :bgcolor :yellow) "Date") ((:td :bgcolor (gethash :green-spring *color-table*)) ((:input :type :text :name :date :size 12 :value (iso-date (get-universal-time)))))) (:tr ((:td :bgcolor :yellow) "Amount") ((:td :bgcolor (gethash :green-spring *color-table*)) ((:input :name :amount :type :text :size 15)))) (:tr ((:td :bgcolor :yellow) "Payee") ((:td :bgcolor (gethash :green-spring *color-table*)) ((:input :name :payee :type :text :size 30)))))) (:p ((:input :type :submit :name :add-transaction :value " Add! ")))))))))) \end{verbatim}} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Form for Adding a Transaction} \label{code:add-transactions-sheet} \end{figure} \begin{figure} \begin{center} \includegraphics{../images/add-transaction.png} \end{center} \caption{Form for Adding a Transaction} \label{fig:add-transaction} \end{figure} \section{Summary} \label{sec:summary} Please note that we have built this ledger using only core GDL/GWL, for illustrative purposes. Several parts of the app have been written from scratch, which otherwise could be handled by using simple utilities or libraries for things such as filesystem/database access and user interface templates. \index{mainstream apps!KB technology useful for}\index{requirements!ever-expanding}The main point of this example is to show that KB technology can be useful even for applications which might be considered ``simple'' or ``mainstream'' --- even the simplest of applications tend to grow ever-changing and ever-expanding requirements, and it pays in the end to use a development environment which can absorb these requirements gracefully and with ease. \chapter{Example 2: Simplified Android Robot} \label{chap:example2:simplifiedandroidrobot} This chapter describes and shows the complete code for a Simplified Android Robot\footnote{The ``Simplified Android Robot'' is a traditional example used for pedagogical purposes in computer graphics, and as far as we know it has its origins in \underline{Computer Graphics: Principles and Practice} by Foley, Feiner, and Van Dam.}\index{objects!primitive!geometric} implemented in GDL/GWL. Here we introduce the use of geometric primitive objects, as well as the use of the higher-level \texttt{\index{application-mixin}application-mixin} first introduced in Chapter \ref{chap:gwlsyntax}. We also introduce the concept of the \emph{\index{view}view}, which allows separation of presentation functions (e.g. for HTML output) from the core object definition. \section{Main UI Sheet for the Robot} \label{sec:mainuisheetfortherobot} Figure \ref{code:robot-toplevel} defines the toplevel user interface sheet for the robot. It specifies several \texttt{:settable} computed-slots which the user will end up being able to set through an HTML form. It also specifies the \texttt{robot} child object, whose leaves contain the actual geometry (boxes in this case) of the robot. Figure \ref{code:robot-model-inputs} shows the definition of a \emph{view} which is defined for the \texttt{html-format} output format, and the \texttt{robot-assembly} GDL object. Rather than being associated with a single type as with normal GDL objects, views are associated with \emph{two} types -- an output format and a normal GDL object type. The \texttt{:output-functions} defined within the view will therefore be associated with the \emph{combination} of the given output-format and the given GDL object type. In this case, we are specifying the \texttt{\index{model-inputs}model-inputs} \texttt{:output-function} to be applied to the combination of the \texttt{html-format} output-format and the \texttt{robot-assembly} GDL object type. The \texttt{application-mixin} contains a default (essentially blank) \texttt{model-inputs} function, and here we are overriding it to do something specific, namely to display html input fields for the slots in our \texttt{robot-assembly} which we wish the user to be able to alter through a form. By default, the \texttt{application-mixin} will display the output from the \texttt{model-inputs} function in the upper-right area of the user interface sheet, as seen in Figure \ref{fig:robot}. These input fields are automatically contained inside an appropriate HTML form entity - when using \texttt{application-mixin}, there is no need for application-level code to generate the HTML form tag or the \texttt{\index{:respondant}:respondant} or \texttt{\index{:bashee}:bashee} hidden fields described in Chapter \ref{chap:gwlsyntax} with plain \texttt{\index{base-html-sheet}base-html-sheet}. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object robot-assembly (application-mixin) :computed-slots ((width 5 :settable) (length 2 :settable) (height 10 :settable) (head-angle 0 :settable) (body-angle 0 :settable) (arm-angle-right 0 :settable) (arm-angle-left 0 :settable) (pincer-distance-right (to-single-float (number-round (* .15 3/5 (the width)) 3)) :settable) (pincer-distance-left (to-single-float (number-round (* .15 3/5 (the width)) 3)) :settable) (image-format (the view-object image-format)) (strings-for-display "Robot Assembly") (ui-display-list-objects (the robot))) :objects ((robot :type 'robot :pass-down (:head-angle :body-angle :arm-angle-right :arm-angle-left :pincer-distance-right :pincer-distance-left)))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{UI Sheet for Robot} \label{code:robot-toplevel} \end{figure} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \small{ \begin{verbatim} (define-view (html-format robot-assembly)() :output-functions ((model-inputs () (html ((:table :cellpadding 0) (:tr ((:td :colspan 2) (:b "Dimensions:"))) (dolist (slot (list :width :length :height)) (html (:tr ((:td :bgcolor :yellow) (:princ (string-capitalize slot))) (:td ((:input :type :string :name slot :size 5 :value (format nil "~a" (the (evaluate slot))))))))) (:tr ((:td :colspan 2) :br)) (:tr ((:td :colspan 2) (:b "Angles:"))) (dolist (angle '(("Head" :head-angle)("Body" :body-angle) ("Left Arm" :arm-angle-left) ("Right Arm" :arm-angle-right))) (html (:tr ((:td :bgcolor :yellow) (:princ (first angle))) (:td ((:input :type :string :name (second angle) :size 5 :value (format nil "~a" (the (evaluate (second angle)))))))))) (:tr ((:td :colspan 2) :br)) (:tr ((:td :colspan 2) (:b "Grip Opening:"))) (dolist (side (list :left :right)) (html (:tr ((:td :bgcolor :yellow) (:princ (string-capitalize side))) (:td ((:input :type :string :name (format nil "pincer-distance-~a" side) :size 5 :value (the (evaluate (make-keyword (format nil "pincer-distance-~a" side)))))))))) (:tr ((:td :colspan 2) :br)) (:tr ((:td :colspan 2 :align :center) ((:input :type :submit :value " OK " :name :refresh))))))))) \end{verbatim}} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Inputs Section for UI Sheet} \label{code:robot-model-inputs} \end{figure} \begin{figure} \begin{center} \includegraphics{../images/robot.png} \end{center} \caption{Default Robot} \label{fig:robot} \end{figure} \section{Robot Geometry} \label{sec:robotgeometry} The actual robot is made up of two child objects, its \texttt{base} and its \texttt{body}, as shown in Figure \ref{code:robot-geometry-toplevel}. Figure \ref{code:robot-body} shows the definition of the body, and \ref{code:robot-base} shows the definition of the base. The body is made up of a torso (a box), a head (a box), and two arms, whose definition is shown in Figure \ref{code:robot-arm}. The \texttt{:settable} :computed-slots from the toplevel UI sheet come into the \texttt{robot} as input-slots. These serve as parameters for the rest of the robot hierarchy. The positioning and orientation of each child object are specified by passing \texttt{\index{:center}:center} and \texttt{\index{:orientation}:orientation} into the child part: \begin{description} \item [:center] is given as a 3D point, and causes the child object to treat this point as its center. \item [:orientation] is given as a 3-by-3 rotational transformation matrix, and causes the child object to adjust its six \texttt{\index{face-normal-vector}face-normal-vector}s accordingly. As with this example, this transformation matrix is usually created using the \texttt{\index{alignment}alignment} function, which allows you to align up to three faces of the child object with up to three given vectors. The first vector will be taken exactly, and the second and third vectors will be taken for their orthogonal components to the previous ones. \end{description} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \small{ \begin{verbatim} (define-object robot (base-object) :input-slots (head-angle body-angle arm-angle-right arm-angle-left pincer-distance-right pincer-distance-left) :computed-slots ((display-controls (list :color :green-lime))) :objects ((base :type 'robot-base :height (* (the :height) 0.4) :width (* (the :width) 0.2) :length (* (the :length) 0.2) :center (translate (the :center) :down (* (the :height) 0.3))) (body :type 'robot-body :height (* (the :height) 0.6) :center (translate (the :center) :up (* (the :height) 0.2)) :orientation (alignment :right (rotate-vector-d (the (:face-normal-vector :right)) (the :body-angle) (the (:face-normal-vector :top)))) :pass-down (:head-angle :arm-angle-right :arm-angle-left :pincer-distance-left :pincer-distance-right)))) \end{verbatim}} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Toplevel of Robot Geometry} \label{code:robot-geometry-toplevel} \end{figure} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \small{ \begin{verbatim} (define-object robot-body (base-object) :input-slots (head-angle arm-angle-left arm-angle-right pincer-distance-left pincer-distance-right (shoulder-height (* (the :torso :height) 0.1))) :computed-slots ((display-controls (list :color :blue-steel-light))) :objects ((torso :type 'box :height (* (the :height) 0.85) :width (* (the :width) 0.7) :center (translate (the :center) :down (- (half (the :height)) (half (the-child :height))))) (head :type 'box :display-controls (list :color :magenta) :height (- (the :height) (the :torso :height)) :width (* (the :width) 0.25) :length (half (the :length)) :center (translate (the :center) :up (- (half (the :height)) (half (the-child :height)))) :orientation (alignment :right (rotate-vector-d (the (:face-normal-vector :right)) (the :head-angle) (the (:face-normal-vector :top))))) (arms :type 'robot-arm :sequence (:size 2) :side (ecase (the-child :index) (0 :left) (1 :right)) :width (half (- (the :width) (the :torso :width))) :length (/ (the :length) 3) :height (- (the :torso :height) (twice (the :shoulder-height))) :center (translate-along-vector (the-child :shoulder-point) (the-child (:face-normal-vector :bottom)) (half (the-child :height))) :orientation (alignment :bottom (rotate-vector-d (the (:face-normal-vector :bottom)) (the-child :angle) (the (:face-normal-vector :left))) :right (the (:face-normal-vector :right))) :shoulder-point (translate (the :torso (:edge-center :top (the-child :side))) (the-child :side) (half (the-child :width)) :down (the :shoulder-height)) :angle (ecase (the-child :side) (:left (the :arm-angle-left)) (:right (the :arm-angle-right))) :pincer-distance (ecase (the-child :side) (:left (the :pincer-distance-left)) (:right (the :pincer-distance-right)))))) \end{verbatim}} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Robot Body} \label{code:robot-body} \end{figure} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object robot-arm (base-object) :input-slots (side shoulder-point angle pincer-distance) :computed-slots ((display-controls (list :color :blue))) :objects ((arm :type 'box) (thumb :type 'box :display-controls (list :color :red) :width (the :hand :width) :height (the :hand :height) :length (the :hand :length) :center (translate (the :hand :center) (the :side) (the :pincer-distance))) (hand :type 'box :display-controls (list :color :green) :center (translate (the :center) :down (+ (half (the :height)) (half (the-child :height))) (the :side) (- (- (half (the :width)) (half (the-child :width))))) :height (* (the :height) 0.15) :width (* (the :width) 0.2) :length (half (the :length))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Robot Arm} \label{code:robot-arm} \end{figure} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object robot-base (base-object) :objects ((leg :type 'box :height (* 0.9 (the :height)) :center (translate (the :center) :up (- (half (the :height)) (half (the-child :height))))) (foot :type 'box :height (* 0.1 (the :height)) :width (twice (twice (the :width))) :length (twice (twice (twice (the :length)))) :center (translate (the :center) :down (- (half (the :height)) (half (the-child :height))))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Robot Base} \label{code:robot-base} \end{figure} \section{Using the App} \label{sec:usingtheapp} Figures \ref{fig:robot-front} and \ref{fig:robot-swing} show some examples of a user having interacted with the application, resulting in a specified standard 3D view of the robot or the robot's body parts rotated to specified angles. Note also the extra hyperlinks at the upper-left in Figure \ref{fig:robot-front}, which are a result of the GDL/GWL session being in \emph{\index{development mode}development mode}. Development mode can be entered as follows:\index{gwl:*developing?*} \begin{verbatim}(setq gwl:*developing?* t) \end{verbatim}The three standard links provided by development mode are as follows: \begin{description} \item [Update!] will essentially re-instantiate the object hierarchy from the current object downward, taking into account any new or altered definitions you have compiled since the objects were last demanded. However, any \texttt{:settable} slots which have been altered will retain their values to the extent feasible. \item [Full Update!] will perform and Update all the way from the root object. \item [Break] will cause a Common Lisp break level to be entered, with the parameter \texttt{self} set to the object instance corresponding to the current web page. \item [\index{TaTu}TaTu] will respond with the development view of the object, as described in the file \texttt{tatu.txt}. \end{description} \begin{figure} \begin{center} \includegraphics{../images/robot-front.png} \end{center} \caption{Front View of Robot} \label{fig:robot-front} \end{figure} \begin{figure} \begin{center} \includegraphics{../images/robot-swing.png} \end{center} \caption{Robot with some non-Default Angles} \label{fig:robot-swing} \end{figure} \chapter{Example 3: School Bus} \label{chap:example3:schoolbus} In this chapter we leave you with another example of a geometric GDL/GWL application, heavy on code examples, with a bit of explanation sprinkled in between. This School Bus example introduces the use of the \texttt{\index{node-mixin}node-mixin} primitive object, which is similar to \texttt{\index{application-mixin}application-mixin} which we met in the last chapter. But \texttt{node-mixin} is used to \emph{contain} other instances of either \texttt{node-mixin} or \texttt{application-mixin}, and automatically collects up any \texttt{\index{ui-display-list-objects}ui-display-list-objects} or rule objects (i.e.\ objects of type \texttt{\index{gwl-rule-object}gwl-rule-object}) from its descendants. \section{Toplevel Assembly} \label{sec:toplevelassembly} Figure \ref{code:school-bus} defines the toplevel assembly consisting of a chassis, body, and interior. The toplevel mixes in \texttt{node-mixin}, and the chassis, body, and interior each mix in \texttt{application-mixin}. This results in a high-level user-visible hierarchy, shown as the ``Assembly Tree'' in the lower-left of Figure \ref{fig:school-bus}. Note that there is no need to specify a \texttt{ui-display-list-objects} slot in the \texttt{assembly}. This is because \texttt{node-mixin} automatically defines this slot, which appends together the \texttt{ui-display-list-objects} from any child objects of appropriate types. Three toplevel \texttt{:settable} computed-slots are also specified, affecting the overall dimensions of the vehicle. Figure \ref{code:school-bus-model-inputs} defines the \texttt{model-inputs} for the toplevel, corresponding to the three \texttt{:settable} computed-slots in the \texttt{assembly}. The complete code for the School Bus example is provided on the GDL (and Trial Edition) CD; in this tutorial we provide only the major portion of the interior. The chassis and body are defined similarly, although the chassis in particular contains several interesting examples, which are beyond the scope of this tutorial, of solving somewhat ``heavier'' engineering problems with GDL/GWL. \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object assembly (node-mixin) :computed-slots ((frame-datum (let ((datum (read-safe-string (string-append "(" (the frame-datum-m) ")")))) (translate (the center) :right (first datum) :rear (second datum) :top (third datum)))) (strings-for-display "School Bus") (wheelbase 300 :settable) (track 96 :settable) (height 80 :settable) (frame-datum-m "2000 500 0" :settable)) :objects ((chassis :type 'chassis :pass-down (:wheelbase :track) :datum (the frame-datum) :height 20) (body :type 'body :pass-down (:wheelbase :track) :frame-width (the chassis frame-width) :frame-overhang (- (the-child front-overhang) (the chassis front-overhang)) :firewall-base (translate (the frame-datum) :up (half (the chassis frame-height)) :right (- (the-child cab-width) (the-child frame-overhang)))) (interior :type 'interior :firewall-base (the body firewall-base) :width (- (the body width) (the body cab-width)) :length (the body length) :height (the body height)))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Toplevel Assembly for School Bus} \label{code:school-bus} \end{figure} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-view (html-format assembly) nil :output-functions ((model-inputs nil (html (:p (:table (:tr ((:td :bgcolor :yellow) "Wheelbase") (:td ((:input :type :text :size 5 :name :wheelbase :value (the :wheelbase))))) (:tr ((:td :bgcolor :yellow) "Track") (:td ((:input :type :text :size 5 :name :track :value (the :track))))) (:tr ((:td :bgcolor :yellow) "Height") (:td ((:input :type :text :size 5 :name :height :value (the :height))))))) (:p ((:input :type :submit :name :submit :value " OK "))))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{HTML format View of Model Inputs for School Bus Toplevel} \label{code:school-bus-model-inputs} \end{figure} \begin{figure} \begin{center} \includegraphics{../images/school-bus.png} \end{center} \caption{Toplevel Sheet of School Bus App} \label{fig:school-bus} \end{figure} \section{Interior of School Bus} \label{sec:interiorofschoolbus} Figures \ref{code:school-bus-interior} and \ref{code:school-bus-seating-section} define the major components making up the interior of the bus, which for our current purposes consists of the bench seats and a few rules regarding their spacing. In particular, Figure \ref{code:school-bus-seating-section} defines the \texttt{seating-section} which contains the two actual columns of bench seats. This object also contains two \emph{rule objects} which compute certain key pieces of information: \begin{description} \item [inter-seat-spacing-computation] computes the exact spacing from the front of one seat to the front of the next, given the available cabin width (i.e.\ coach length), the maximumm allowed recline angle of the seat backs, and the number of rows to be fit into the bus. (The actual seat dimensions are taken from defaults in the seat object definition, not listed here). This spacing value is crucial for two reasons: first, this value is used in order to generate the actual geometric objects that you see in the graphical output. Second, this value is used in the \texttt{inter-seat-clearance-check} to compare with the overall length of one seat, to compute how much is left over to be considered ``legroom.'' \index{rules!diagnostic}\index{rules!generative}\index{rules!violating}\index{rules!model!tight integration with}\index{rules} \item [inter-seat-clearance-check] is a purely diagnostic rule which uses values from the spacing computation rule in order to compute the effective ``legroom'' between seats. This legroom is compared with the rule's specified \texttt{value} (in this case representing the allowed minimum value), to determine whether the rule has violated its condition or not. \end{description} It is typical in a KB model to have this kind of tight integration between ``rules'' and the model itself --- when an input to the model is changed, any rules and other objects which directly or indirectly depend on that input will automatically re-evaluate themselves. Rules and objects which are not affected by a given change will avoid the computational work of re-evaluating themselves. Maintaining this kind of dependency management in a traditional procedural language environment becomes extremely burdensome on the application developer. In a KB environment, however, this dependency management ``just happens'' as a matter of course.\index{dependency management} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object interior (application-mixin) :input-slots (firewall-base length width height) :computed-slots ((ui-display-list-objects (the :sections)) (number-of-rows 10 :settable) (reclined-angle 20 :settable) (max-reclined-angle 30 :settable) (minimum-inter-seat-clearance 7 :settable)) :objects ((sections :type 'seating-section :body-reference-points (list :left (translate (the :firewall-base) :front (half (the :length)) :right (the :width)) :right (translate (the :firewall-base) :rear (half (the :length)) :right (the :width))) :usable-cabin-width (the :width) :pass-down (:number-of-rows :reclined-angle :max-reclined-angle :minimum-inter-seat-clearance)))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Interior Assembly Component School Bus} \label{code:school-bus-interior} \end{figure} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-view (html-format interior) nil :output-functions ((model-inputs nil (html (:p (:table (:tr ((:td :bgcolor :yellow) "Rows") (:td ((:input :type :text :size 5 :name :number-of-rows :value (the :number-of-rows))))) (:tr ((:td :bgcolor :yellow) "Seat Recline") (:td ((:input :type :text :size 5 :name :reclined-angle :value (the :reclined-angle))))) (:tr ((:td :bgcolor :yellow) "Max Recline") (:td ((:input :type :text :size 5 :name :max-reclined-angle :value (the :max-reclined-angle))))) (:tr ((:td :bgcolor :yellow) "Req'd Clearance") (:td ((:input :type :text :size 5 :name :minimum-inter-seat-clearance :value (the :minimum-inter-seat-clearance))))))) (:p ((:input :type :submit :name :submit :value " OK "))))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{HTML Format Model Inputs of School Bus Interior} \label{code:school-bus-interior-model-inputs} \end{figure} \begin{figure} \begin{center} \includegraphics{../images/school-bus-interior.png} \end{center} \caption{Interior of School Bus} \label{fig:school-bus-interior} \end{figure} \begin{figure} \begin{lrbox}{\boxedverb} \begin{minipage}{\linewidth} \begin{verbatim} (define-object seating-section (base-object) :input-slots (fare-class usable-cabin-width body-reference-points max-reclined-angle number-of-rows minimum-inter-seat-clearance) :objects ((inter-seat-spacing-computation :type 'inter-seat-spacing :pass-down (:max-reclined-angle :usable-cabin-width :number-of-rows)) (inter-seat-clearance-check :type 'inter-seat-clearance-check :inter-seat-spacing (the inter-seat-spacing-computation result) :clearance-extent-typical (the inter-seat-spacing-computation clearance-extent-typical) :value (the minimum-inter-seat-clearance)) (sides :type 'seating-side :fare-class (the fare-class) :sequence (:size 2) :side (ecase (the-child index) (0 :left) (1 :right)) :display-controls (list :color :green) :body-reference-point (getf (the body-reference-points) (the-child side)) :pass-down (:number-of-rows :reclined-angle) :inter-seat-spacing (the inter-seat-spacing-computation result) :x-max-typical (the inter-seat-spacing-computation x-max-typical) :x-vector (the (face-normal-vector :right))))) \end{verbatim} \end{minipage} \end{lrbox} \fbox{\usebox{\boxedverb}} \caption{Object Definition for Seating Columns} \label{code:school-bus-seating-section} \end{figure} \begin{figure} \begin{center} \includegraphics{../images/school-bus-interior-front.png} \end{center} \caption{Front View of School Bus Interior} \label{fig:school-bus-interior-front} \end{figure} \newpage \section{Causing a Rule Violation} \label{sec:causingaruleviolation} Figure \ref{fig:school-bus-violated} shows the state of the interior after a user has changed the number of seating rows to eleven, from the default ten. The user has also changed the displayed recline angle of the seat backs to match the maximum allowed value (30 degrees). In this state, the seats have redistributed themselves so that they still are spaced evenly in the available length of the coach. However, this has caused a violation in the legroom, defined as the horizontal distance from the rear-center of one seat back to the front of the seat bottom aft of it. The allowed value for this legroom (``Req'd Clearance'') is 7, and the current legroom value (as computed by the rule object) is now less than this. Therefore we have a violation, and the link to the rule shows up in the ``Violations'' section of the user interface. For a typical example such as this School Bus, one can imagine dozens or hundreds of other rules. Many such rules can be computed based on information we already have in our model, and others will result in the model being augmented incrementally with new information as needed. The main point is that we now have a stable, user-friendly, and readily scalable framework in which to represent and grow our ``knowledge.'' \begin{figure} \begin{center} \includegraphics{../images/school-bus-interior-violated.png} \end{center} \caption{Interior of School Bus with 11 Rows (Legroom Violation)} \label{fig:school-bus-violated} \end{figure} \backmatter \printindex \end{document}
85,567
Common Lisp
.l
1,734
43.033449
500
0.700663
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
a7d5eac8b53178c540476d80d9666cc58b46fed757c5e44cc66b0349a7cabc92
37,120
[ -1 ]
37,121
tutorial.ind
lisp-mirror_gendl/documentation/training/legacy/gdl/pdf/tutorial.ind
\begin{theindex} \item :bashee, 33 \item :center, 37 \item :indices, 20 \item :orientation, 37 \item :respondant, 33 \item :size, 9, 20 \indexspace \item AI, 1 \item alignment, 37 \item AllegroServe, 11 \item application-mixin, 18, 33, 45 \indexspace \item base-html-sheet, 12, 33 \item Basic Lisp Techniques, 1 \indexspace \item Caching, 1 \item Common Lisp, 1 \item compiled language \subitem benefits of, 2 \item computed-slots, 5 \item containment \subitem object, 7 \indexspace \item declarative, 2 \item Define-object, 5 \item dependency management, 49 \item Dependency tracking, 1 \item development mode, 37 \indexspace \item face-normal-vector, 37 \item form handling, 13 \item functions, 5 \indexspace \item gwl-make-object, 16 \item gwl-rule-object, 45 \item gwl:*developing?*, 37 \item gwl:*max-id-value*, 12 \indexspace \item HTML, 11 \item htmlgen, 11 \item HTTP, 11 \indexspace \item Ignorance-based Engineering, 1 \item input-slots, 5 \item instance-id, 12 \indexspace \item Knowledge Base System, 1 \indexspace \item macros \subitem code-expanding, 2 \item mainstream apps \subitem KB technology useful for, 29 \item make-instance, 6 \item make-object, 6 \item mixin-list, 5 \item model-inputs, 33 \indexspace \item node-mixin, 45 \indexspace \item object sequences, 9 \item object-orientation \subitem generic-function, 2 \subitem message-passing, 2 \item Objects \subitem sequenced, 9 \item objects, 5, 7 \subitem child, 7 \subitem contained, 7 \subitem defining, 5 \subitem primitive \subsubitem geometric, 33 \indexspace \item Paul Graham, 19 \item publishing \subitem of GWL URIs, 16 \indexspace \item read-safe-string, 16 \item recomputation \subitem on-demand, 21 \item reference chains, 7 \item requirements \subitem ever-expanding, 29 \item return-object, 13 \item rules, 49 \subitem diagnostic, 49 \subitem generative, 49 \subitem model \subsubitem tight integration with, 49 \subitem violating, 49 \indexspace \item self, 6 \item sequence, 20 \item sequences, 9 \item specification-plist, 5 \item spreadsheet \subitem KB as distinct from, 21 \indexspace \item TaTu, 37 \item the, 5 \item the-object, 6 \item time \subitem using to understand KB dynamics, 24 \indexspace \item ui-display-list-objects, 18, 45 \indexspace \item view, 33 \indexspace \item web user interface \subitem creating, 11 \item write-back-link, 13 \item write-html-sheet, 12 \end{theindex}
2,701
Common Lisp
.l
113
20.141593
48
0.712323
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
a6454f29e4b71bfb5260ab56316a459fdc07eed4c9fdc410ee0e27066f6c72a2
37,121
[ -1 ]
37,122
tutorial.aux
lisp-mirror_gendl/documentation/training/legacy/gdl/pdf/tutorial.aux
\relax \@writefile{toc}{\contentsline {chapter}{\numberline {1}Introduction}{1}} \@writefile{lof}{\addvspace {10\p@ }} \@writefile{lot}{\addvspace {10\p@ }} \newlabel{chap:introduction}{{1}{1}} \@writefile{toc}{\contentsline {section}{\numberline {1.1}Knowledge Base Concepts According to Genworks}{1}} \newlabel{sec:knowledgebaseconceptsaccordingtogenworks}{{1.1}{1}} \@writefile{toc}{\contentsline {section}{\numberline {1.2}Goals for this Tutorial}{1}} \newlabel{sec:goalsforthistutorial}{{1.2}{1}} \@writefile{toc}{\contentsline {section}{\numberline {1.3}What is GDL/GWL?}{2}} \newlabel{sec:whatisgdl/gwl?}{{1.3}{2}} \@writefile{toc}{\contentsline {section}{\numberline {1.4}Why GDL (what is GDL good for?)}{2}} \newlabel{sec:whygdl(whatisgdlgoodfor?)}{{1.4}{2}} \@writefile{toc}{\contentsline {section}{\numberline {1.5}What GDL is not}{3}} \newlabel{sec:whatgdlisnot}{{1.5}{3}} \@writefile{toc}{\contentsline {chapter}{\numberline {2}GDL Syntax}{5}} \@writefile{lof}{\addvspace {10\p@ }} \@writefile{lot}{\addvspace {10\p@ }} \newlabel{chap:gdlsyntax}{{2}{5}} \@writefile{toc}{\contentsline {section}{\numberline {2.1}Define-Object}{5}} \newlabel{sec:define-object}{{2.1}{5}} \@writefile{lof}{\contentsline {figure}{\numberline {2.1}{\ignorespaces Example of Simple Object Definition}}{6}} \newlabel{fig:object-hello}{{2.1}{6}} \@writefile{toc}{\contentsline {section}{\numberline {2.2}Making Instances and Sending Messages}{6}} \newlabel{sec:makinginstancesandsendingmessages}{{2.2}{6}} \@writefile{lof}{\contentsline {figure}{\numberline {2.2}{\ignorespaces Object Containing Child Objects}}{7}} \newlabel{fig:object-city}{{2.2}{7}} \@writefile{toc}{\contentsline {section}{\numberline {2.3}Objects}{7}} \newlabel{sec:objects}{{2.3}{7}} \@writefile{lof}{\contentsline {figure}{\numberline {2.3}{\ignorespaces Sample Data and Object Definition to Contain U.S. Presidents}}{8}} \newlabel{fig:object-presidents-container}{{2.3}{8}} \@writefile{toc}{\contentsline {section}{\numberline {2.4}Sequences of Objects and Input-slots with a Default Expression}{9}} \newlabel{sec:sequencesofobjectsandinput-slotswithadefaultexpression}{{2.4}{9}} \@writefile{toc}{\contentsline {section}{\numberline {2.5}Summary}{9}} \newlabel{sec:summary}{{2.5}{9}} \@writefile{toc}{\contentsline {chapter}{\numberline {3}GWL Syntax}{11}} \@writefile{lof}{\addvspace {10\p@ }} \@writefile{lot}{\addvspace {10\p@ }} \newlabel{chap:gwlsyntax}{{3}{11}} \@writefile{toc}{\contentsline {section}{\numberline {3.1}Testing your GWL Installation}{11}} \newlabel{sec:testingyourgwlinstallation}{{3.1}{11}} \@writefile{toc}{\contentsline {section}{\numberline {3.2}GWL:Define-Package}{12}} \newlabel{sec:gwl:define-package}{{3.2}{12}} \@writefile{toc}{\contentsline {section}{\numberline {3.3}Basic Usage}{12}} \newlabel{sec:basicusage}{{3.3}{12}} \@writefile{toc}{\contentsline {section}{\numberline {3.4}Page Linking}{12}} \newlabel{sec:pagelinking}{{3.4}{12}} \@writefile{lof}{\contentsline {figure}{\numberline {3.1}{\ignorespaces Basic Usage}}{13}} \newlabel{code:basic-usage}{{3.1}{13}} \@writefile{toc}{\contentsline {section}{\numberline {3.5}Form Handling}{13}} \newlabel{sec:formhandling}{{3.5}{13}} \@writefile{lof}{\contentsline {figure}{\numberline {3.2}{\ignorespaces Making a List of Links}}{14}} \newlabel{code:page-linking}{{3.2}{14}} \@writefile{lof}{\contentsline {figure}{\numberline {3.3}{\ignorespaces Link Target}}{15}} \newlabel{code:link-target}{{3.3}{15}} \@writefile{lof}{\contentsline {figure}{\numberline {3.4}{\ignorespaces Presidents Container Page with Links}}{15}} \newlabel{fig:presidents-container}{{3.4}{15}} \@writefile{toc}{\contentsline {section}{\numberline {3.6}Publishing URIs for GWL Objects}{16}} \newlabel{sec:publishingurisforgwlobjects}{{3.6}{16}} \@writefile{lof}{\contentsline {figure}{\numberline {3.5}{\ignorespaces Hello Form}}{17}} \newlabel{code:hello-form}{{3.5}{17}} \@writefile{lof}{\contentsline {figure}{\numberline {3.6}{\ignorespaces Hello Form}}{17}} \newlabel{fig:hello-form}{{3.6}{17}} \@writefile{toc}{\contentsline {section}{\numberline {3.7}Higher-level Apps and Graphics}{18}} \newlabel{sec:higher-levelappsandgraphics}{{3.7}{18}} \@writefile{toc}{\contentsline {chapter}{\numberline {4}Example 1: Personal Ledger}{19}} \@writefile{lof}{\addvspace {10\p@ }} \@writefile{lot}{\addvspace {10\p@ }} \newlabel{chap:example1:personalledger}{{4}{19}} \@writefile{toc}{\contentsline {section}{\numberline {4.1}Main Ledger Object}{19}} \newlabel{sec:mainledgerobject}{{4.1}{19}} \@writefile{lof}{\contentsline {figure}{\numberline {4.1}{\ignorespaces Contents of Account and Transaction Data Files}}{20}} \newlabel{data:ledger-data}{{4.1}{20}} \@writefile{lof}{\contentsline {figure}{\numberline {4.2}{\ignorespaces Input-Slots and Computed-Slots of Ledger}}{20}} \newlabel{code:ledger-input-computed}{{4.2}{20}} \@writefile{lof}{\contentsline {figure}{\numberline {4.3}{\ignorespaces Sub-Objects of Ledger}}{21}} \newlabel{fig:genacc2-subobjects}{{4.3}{21}} \@writefile{lof}{\contentsline {figure}{\numberline {4.4}{\ignorespaces Functions of Ledger}}{22}} \newlabel{fig:genacc2-functions}{{4.4}{22}} \@writefile{lof}{\contentsline {figure}{\numberline {4.5}{\ignorespaces Account and Transaction Object Definitions}}{23}} \newlabel{fig:genacc2-accountandtransaction}{{4.5}{23}} \@writefile{toc}{\contentsline {section}{\numberline {4.2}Objects for Accounts and Transactions}{23}} \newlabel{sec:objectsforaccountsandtransactions}{{4.2}{23}} \@writefile{toc}{\contentsline {section}{\numberline {4.3}Using the Main Ledger Object}{23}} \newlabel{sec:usingthemainledgerobject}{{4.3}{23}} \@writefile{toc}{\contentsline {section}{\numberline {4.4}Making a Web Interface with GWL}{24}} \newlabel{sec:makingawebinterfacewithgwl}{{4.4}{24}} \@writefile{lof}{\contentsline {figure}{\numberline {4.6}{\ignorespaces Slots and Object for Web Interface}}{25}} \newlabel{code:ledger-html-top}{{4.6}{25}} \@writefile{lof}{\contentsline {figure}{\numberline {4.7}{\ignorespaces Output Function for Web Interface}}{26}} \newlabel{code:ledger-html-bottom}{{4.7}{26}} \@writefile{lof}{\contentsline {figure}{\numberline {4.8}{\ignorespaces Main Screen of Ledger}}{27}} \newlabel{fig:ledger-main}{{4.8}{27}} \@writefile{lof}{\contentsline {figure}{\numberline {4.9}{\ignorespaces Transaction Listing Sheet}}{27}} \newlabel{fig:transaction-listing}{{4.9}{27}} \@writefile{lof}{\contentsline {figure}{\numberline {4.10}{\ignorespaces Sheet for Transaction Listing}}{28}} \newlabel{code:view-transactions-sheet}{{4.10}{28}} \@writefile{toc}{\contentsline {section}{\numberline {4.5}Summary}{29}} \newlabel{sec:summary}{{4.5}{29}} \@writefile{lof}{\contentsline {figure}{\numberline {4.11}{\ignorespaces Form for Adding a Transaction}}{30}} \newlabel{code:add-transactions-sheet}{{4.11}{30}} \@writefile{lof}{\contentsline {figure}{\numberline {4.12}{\ignorespaces Form for Adding a Transaction}}{31}} \newlabel{fig:add-transaction}{{4.12}{31}} \@writefile{toc}{\contentsline {chapter}{\numberline {5}Example 2: Simplified Android Robot}{33}} \@writefile{lof}{\addvspace {10\p@ }} \@writefile{lot}{\addvspace {10\p@ }} \newlabel{chap:example2:simplifiedandroidrobot}{{5}{33}} \@writefile{toc}{\contentsline {section}{\numberline {5.1}Main UI Sheet for the Robot}{33}} \newlabel{sec:mainuisheetfortherobot}{{5.1}{33}} \@writefile{lof}{\contentsline {figure}{\numberline {5.1}{\ignorespaces UI Sheet for Robot}}{34}} \newlabel{code:robot-toplevel}{{5.1}{34}} \@writefile{lof}{\contentsline {figure}{\numberline {5.2}{\ignorespaces Inputs Section for UI Sheet}}{35}} \newlabel{code:robot-model-inputs}{{5.2}{35}} \@writefile{lof}{\contentsline {figure}{\numberline {5.3}{\ignorespaces Default Robot}}{36}} \newlabel{fig:robot}{{5.3}{36}} \@writefile{toc}{\contentsline {section}{\numberline {5.2}Robot Geometry}{37}} \newlabel{sec:robotgeometry}{{5.2}{37}} \@writefile{toc}{\contentsline {section}{\numberline {5.3}Using the App}{37}} \newlabel{sec:usingtheapp}{{5.3}{37}} \@writefile{lof}{\contentsline {figure}{\numberline {5.4}{\ignorespaces Toplevel of Robot Geometry}}{38}} \newlabel{code:robot-geometry-toplevel}{{5.4}{38}} \@writefile{lof}{\contentsline {figure}{\numberline {5.5}{\ignorespaces Robot Body}}{39}} \newlabel{code:robot-body}{{5.5}{39}} \@writefile{lof}{\contentsline {figure}{\numberline {5.6}{\ignorespaces Robot Arm}}{40}} \newlabel{code:robot-arm}{{5.6}{40}} \@writefile{lof}{\contentsline {figure}{\numberline {5.7}{\ignorespaces Robot Base}}{41}} \newlabel{code:robot-base}{{5.7}{41}} \@writefile{lof}{\contentsline {figure}{\numberline {5.8}{\ignorespaces Front View of Robot}}{42}} \newlabel{fig:robot-front}{{5.8}{42}} \@writefile{lof}{\contentsline {figure}{\numberline {5.9}{\ignorespaces Robot with some non-Default Angles}}{43}} \newlabel{fig:robot-swing}{{5.9}{43}} \@writefile{toc}{\contentsline {chapter}{\numberline {6}Example 3: School Bus}{45}} \@writefile{lof}{\addvspace {10\p@ }} \@writefile{lot}{\addvspace {10\p@ }} \newlabel{chap:example3:schoolbus}{{6}{45}} \@writefile{toc}{\contentsline {section}{\numberline {6.1}Toplevel Assembly}{45}} \newlabel{sec:toplevelassembly}{{6.1}{45}} \@writefile{toc}{\contentsline {section}{\numberline {6.2}Interior of School Bus}{45}} \newlabel{sec:interiorofschoolbus}{{6.2}{45}} \@writefile{lof}{\contentsline {figure}{\numberline {6.1}{\ignorespaces Toplevel Assembly for School Bus}}{46}} \newlabel{code:school-bus}{{6.1}{46}} \@writefile{lof}{\contentsline {figure}{\numberline {6.2}{\ignorespaces HTML format View of Model Inputs for School Bus Toplevel}}{47}} \newlabel{code:school-bus-model-inputs}{{6.2}{47}} \@writefile{lof}{\contentsline {figure}{\numberline {6.3}{\ignorespaces Toplevel Sheet of School Bus App}}{48}} \newlabel{fig:school-bus}{{6.3}{48}} \@writefile{lof}{\contentsline {figure}{\numberline {6.4}{\ignorespaces Interior Assembly Component School Bus}}{50}} \newlabel{code:school-bus-interior}{{6.4}{50}} \@writefile{lof}{\contentsline {figure}{\numberline {6.5}{\ignorespaces HTML Format Model Inputs of School Bus Interior}}{51}} \newlabel{code:school-bus-interior-model-inputs}{{6.5}{51}} \@writefile{lof}{\contentsline {figure}{\numberline {6.6}{\ignorespaces Interior of School Bus}}{52}} \newlabel{fig:school-bus-interior}{{6.6}{52}} \@writefile{lof}{\contentsline {figure}{\numberline {6.7}{\ignorespaces Object Definition for Seating Columns}}{53}} \newlabel{code:school-bus-seating-section}{{6.7}{53}} \@writefile{lof}{\contentsline {figure}{\numberline {6.8}{\ignorespaces Front View of School Bus Interior}}{54}} \newlabel{fig:school-bus-interior-front}{{6.8}{54}} \@writefile{toc}{\contentsline {section}{\numberline {6.3}Causing a Rule Violation}{54}} \newlabel{sec:causingaruleviolation}{{6.3}{54}} \@writefile{lof}{\contentsline {figure}{\numberline {6.9}{\ignorespaces Interior of School Bus with 11 Rows (Legroom Violation)}}{55}} \newlabel{fig:school-bus-violated}{{6.9}{55}}
10,911
Common Lisp
.l
159
67.616352
138
0.738653
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
54debe86bd4c8b799762e79a5e3a34ce9964d07206289d0186e1c854d01ad328
37,122
[ -1 ]
37,123
tutorial.log
lisp-mirror_gendl/documentation/training/legacy/gdl/pdf/tutorial.log
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=pdflatex 2011.11.28) 7 OCT 2012 21:55 entering extended mode %&-line parsing enabled. **tutorial.tex (./tutorial.tex LaTeX2e <2009/09/24> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, ibycus, monogreek, greek, ancientgreek, loaded. (/usr/share/texmf-texlive/tex/latex/base/book.cls Document Class: book 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/bk11.clo File: bk11.clo 2007/10/19 v1.4h Standard LaTeX file (size option) ) \c@part=\count79 \c@chapter=\count80 \c@section=\count81 \c@subsection=\count82 \c@subsubsection=\count83 \c@paragraph=\count84 \c@subparagraph=\count85 \c@figure=\count86 \c@table=\count87 \abovecaptionskip=\skip41 \belowcaptionskip=\skip42 \bibindent=\dimen102 ) (/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR) (/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty Package: keyval 1999/03/16 v1.13 key=value parser (DPC) \KV@toks@=\toks14 ) (/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) (/usr/share/texmf-texlive/tex/latex/graphics/trig.sty Package: trig 1999/03/16 v1.09 sin cos tan (DPC) ) (/etc/texmf/tex/latex/config/graphics.cfg File: graphics.cfg 2009/08/28 v1.8 graphics configuration of TeX Live ) Package graphics Info: Driver file: dvips.def on input line 91. (/usr/share/texmf-texlive/tex/latex/graphics/dvips.def File: dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR) )) \Gin@req@height=\dimen103 \Gin@req@width=\dimen104 ) (/usr/share/texmf-texlive/tex/latex/graphics/color.sty Package: color 2005/11/14 v1.0j Standard LaTeX Color (DPC) (/etc/texmf/tex/latex/config/color.cfg File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive ) Package color Info: Driver file: pdftex.def on input line 130. (/usr/share/texmf-texlive/tex/latex/pdftex-def/pdftex.def File: pdftex.def 2010/03/12 v0.04p Graphics/color for pdfTeX \Gread@gobject=\count88 ) (/usr/share/texmf-texlive/tex/latex/graphics/dvipsnam.def File: dvipsnam.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR) )) (/usr/share/texmf-texlive/tex/latex/base/makeidx.sty Package: makeidx 2000/03/29 v1.0m Standard LaTeX package ) \boxedverb=\box26 \@indexfile=\write3 \openout3 = `tutorial.idx'. Writing index file tutorial.idx (./tutorial.aux LaTeX Warning: Label `sec:summary' multiply defined. ) \openout1 = `tutorial.aux'. LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 31. LaTeX Font Info: ... okay on input line 31. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 31. LaTeX Font Info: ... okay on input line 31. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 31. LaTeX Font Info: ... okay on input line 31. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 31. LaTeX Font Info: ... okay on input line 31. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 31. LaTeX Font Info: ... okay on input line 31. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 31. LaTeX Font Info: ... okay on input line 31. (/usr/share/texmf-texlive/tex/context/base/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] \scratchcounter=\count89 \scratchdimen=\dimen105 \scratchbox=\box27 \nofMPsegments=\count90 \nofMParguments=\count91 \everyMPshowfont=\toks15 \MPscratchCnt=\count92 \MPscratchDim=\dimen106 \MPnumerator=\count93 \everyMPtoPDFconversion=\toks16 ) LaTeX Font Info: External font `cmex10' loaded for size (Font) <12> on input line 39. LaTeX Font Info: External font `cmex10' loaded for size (Font) <8> on input line 39. LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line 39. [1 {/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] LaTeX Font Info: External font `cmex10' loaded for size (Font) <9> on input line 44. LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line 44. LaTeX Font Info: Try loading font information for OMS+cmr on input line 44. (/usr/share/texmf-texlive/tex/latex/base/omscmr.fd File: omscmr.fd 1999/05/25 v2.5h Standard LaTeX font definitions ) LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <9> not available (Font) Font shape `OMS/cmsy/m/n' tried instead on input line 44. [2 ] (./tutorial.toc LaTeX Font Info: External font `cmex10' loaded for size (Font) <10.95> on input line 2. [3 ]) \tf@toc=\write4 \openout4 = `tutorial.toc'. [4] Chapter 1. LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10.95> not available (Font) Font shape `OMS/cmsy/m/n' tried instead on input line 83. Overfull \vbox (0.57935pt too high) has occurred while \output is active [] [1 ] [2] [3] [4 ] Chapter 2. Overfull \hbox (6.79999pt too wide) in paragraph at lines 272--273 [][] [] [5] [6] Overfull \hbox (6.79999pt too wide) in paragraph at lines 358--359 [][] [] Overfull \hbox (6.79999pt too wide) in paragraph at lines 408--409 [][] [] [7] [8] [9] [10 ] Chapter 3. [11] Overfull \hbox (6.79999pt too wide) in paragraph at lines 569--570 [][] [] [12] Overfull \hbox (6.79999pt too wide) in paragraph at lines 647--648 [][] [] Overfull \hbox (6.79999pt too wide) in paragraph at lines 683--684 [][] [] <../images/presidents-container.png, id=66, 304.60466pt x 178.80133pt> File: ../images/presidents-container.png Graphic file (type png) <use ../images/presidents-container.png> [13] [14] [15 <../images/presidents-co ntainer.png (PNG copy)>] Overfull \hbox (7.8441pt too wide) in paragraph at lines 747--749 []\OT1/cmr/m/n/10.95 If you want to do ad-di-tional pro-cess-ing, the fol-low-i ng func-tions are pro-vided for \OT1/cmtt/m/n/10.95 base-html-sheet\OT1/cmr/m/n /10.95 : [] Overfull \hbox (6.79999pt too wide) in paragraph at lines 808--809 [][] [] <../images/hello-form.png, id=77, 309.42267pt x 117.77333pt> File: ../images/hello-form.png Graphic file (type png) <use ../images/hello-form.png> [16] [17 <../images/hello-form.png (PNG copy)>] Overfull \hbox (115.21747pt too wide) in paragraph at lines 862--863 []\OT1/cmr/m/n/10.95 Collect the ob-jects whose leaves you wish to dis-play as ge-om-e-try in a computed-slot named[]\OT1/cmtt/m/n/10.95 ui-display-list-objec ts\OT1/cmr/m/n/10.95 . [] [18] Chapter 4. Overfull \hbox (6.79999pt too wide) in paragraph at lines 941--942 [][] [] [19 ] Overfull \hbox (6.79999pt too wide) in paragraph at lines 1001--1002 [][] [] [20] Overfull \hbox (6.79999pt too wide) in paragraph at lines 1086--1087 [][] [] Overfull \hbox (6.79999pt too wide) in paragraph at lines 1135--1136 [][] [] Underfull \vbox (badness 10000) has occurred while \output is active [] [21] [22] [23] Overfull \hbox (6.79999pt too wide) in paragraph at lines 1234--1235 [][] [] Overfull \hbox (6.79999pt too wide) in paragraph at lines 1313--1314 [][] [] LaTeX Warning: Float too large for page by 37.23831pt on input line 1319. <../images/ledger-main.png, id=103, 254.28334pt x 180.94267pt> File: ../images/ledger-main.png Graphic file (type png) <use ../images/ledger-main.png> <../images/transaction-listing.png, id=104, 222.69867pt x 210.386pt> File: ../images/transaction-listing.png Graphic file (type png) <use ../images/transaction-listing.png> Overfull \hbox (6.79999pt too wide) in paragraph at lines 1403--1404 [][] [] LaTeX Warning: Float too large for page by 38.8386pt on input line 1409. Overfull \hbox (6.79999pt too wide) in paragraph at lines 1474--1475 [][] [] LaTeX Warning: Float too large for page by 13.23831pt on input line 1480. [24] [25] [26] [27 <../images/ledger-main.png (PNG copy)> <../images/transactio n-listing.png (PNG copy)>] [28] <../images/add-transaction.png, id=121, 250.00067pt x 191.114pt> File: ../images/add-transaction.png Graphic file (type png) <use ../images/add-transaction.png> [29] [30] [31 <../images/add-transaction.pn g (PNG copy)>] [32 ] Chapter 5. Overfull \hbox (6.79999pt too wide) in paragraph at lines 1585--1586 [][] [] Overfull \hbox (6.79999pt too wide) in paragraph at lines 1647--1648 [][] [] <../images/robot.png, id=134, 463.59866pt x 441.11467pt> File: ../images/robot.png Graphic file (type png) <use ../images/robot.png> [33] [34] [35] [36 <../images/robot.png (PNG copy)>] Overfull \hbox (6.79999pt too wide) in paragraph at lines 1742--1743 [][] [] Overfull \hbox (6.79999pt too wide) in paragraph at lines 1811--1812 [][] [] LaTeX Warning: Float too large for page by 25.23831pt on input line 1817. Overfull \hbox (6.79999pt too wide) in paragraph at lines 1861--1862 [][] [] Overfull \hbox (6.79999pt too wide) in paragraph at lines 1895--1896 [][] [] <../images/robot-front.png, id=148, 431.47867pt x 411.136pt> File: ../images/robot-front.png Graphic file (type png) <use ../images/robot-front.png> <../images/robot-swing.png, id=149, 342.61333pt x 321.73534pt> File: ../images/robot-swing.png Graphic file (type png) <use ../images/robot-swing.png> [37] [38] [39] [40] [41] [42 <../images/robot-f ront.png (PNG copy)>] [43 <../images/robot-swing.png (PNG copy)>] [44 ] Chapter 6. Overfull \hbox (30.4733pt too wide) in paragraph at lines 1975--1978 []\OT1/cmr/m/n/10.95 The toplevel mixes in \OT1/cmtt/m/n/10.95 node-mixin\OT1/c mr/m/n/10.95 , and the chas-sis, body, and in-te-rior each mix in \OT1/cmtt/m/n /10.95 application-mixin\OT1/cmr/m/n/10.95 . [] Overfull \hbox (6.79999pt too wide) in paragraph at lines 2036--2037 [][] [] Overfull \hbox (6.79999pt too wide) in paragraph at lines 2075--2076 [][] [] <../images/school-bus.png, id=175, 464.66933pt x 438.438pt> File: ../images/school-bus.png Graphic file (type png) <use ../images/school-bus.png> [45] [46] [47] [48 <../images/school-bus.png (PN G copy)>] Overfull \hbox (6.79999pt too wide) in paragraph at lines 2181--2182 [][] [] Overfull \hbox (6.79999pt too wide) in paragraph at lines 2233--2234 [][] [] <../images/school-bus-interior.png, id=189, 461.99266pt x 440.044pt> File: ../images/school-bus-interior.png Graphic file (type png) <use ../images/school-bus-interior.png> Overfull \hbox (6.79999pt too wide) in paragraph at lines 2297--2298 [][] [] <../images/school-bus-interior-front.png, id=190, 420.772pt x 197.538pt> File: ../images/school-bus-interior-front.png Graphic file (type png) <use ../images/school-bus-interior-front.png> [49] [50] [51] [52 <../images/sch ool-bus-interior.png (PNG copy)>] [53] <../images/school-bus-interior-violated.png, id=207, 420.23666pt x 197.00267pt> File: ../images/school-bus-interior-violated.png Graphic file (type png) <use ../images/school-bus-interior-violated.png> [54 <../images/school-bus-inte rior-front.png (PNG copy)>] [55 <../images/school-bus-interior-violated.png (PN G copy)>] [56 ] (./tutorial.ind [57 ] [58 ]) (./tutorial.aux) LaTeX Warning: There were multiply-defined labels. ) Here is how much of TeX's memory you used: 1415 strings out of 494985 20566 string characters out of 1181033 115729 words of memory out of 3000000 4605 multiletter control sequences out of 15000+50000 11830 words of font info for 42 fonts, out of 3000000 for 9000 73 hyphenation exceptions out of 8191 25i,8n,21p,534b,307s stack positions out of 5000i,500n,10000p,200000b,50000s </usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/sha re/texmf-texlive/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texmf-te xlive/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texmf-texlive/fonts/ type1/public/amsfonts/cm/cmr12.pfb></usr/share/texmf-texlive/fonts/type1/public /amsfonts/cm/cmr17.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm /cmr6.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmr8.pfb></u sr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texm f-texlive/fonts/type1/public/amsfonts/cm/cmsl10.pfb></usr/share/texmf-texlive/f onts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/texmf-texlive/fonts/type1/ public/amsfonts/cm/cmsy9.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfo nts/cm/cmti10.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmtt 10.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmtt9.pfb> Output written on tutorial.pdf (62 pages, 551237 bytes). PDF statistics: 270 PDF objects out of 1000 (max. 8388607) 0 named destinations out of 1000 (max. 500000) 61 words of extra memory for PDF output out of 10000 (max. 10000000)
12,743
Common Lisp
.l
321
38.146417
111
0.736547
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
c161b1eb89ea7291e695dfb08034ed25d13bf836e4b263910abe17ec169edcc7
37,123
[ -1 ]
37,124
file-ordering.isc
lisp-mirror_gendl/documentation/training/legacy/gdl/source/file-ordering.isc
;; ;; Copyright 2002, 2009, 2012 Genworks International ;; ;; This source file is part of the General-purpose Declarative ;; Language project (GDL). ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; ("package" "introduction" "gdl-syntax" "gwl-syntax" "example-1" "example-2" "example-3")
935
Common Lisp
.l
21
43.380952
88
0.75575
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
8740241e69ff33c7fd4ca30e63de1dc58571c537d6ad808da6cf19e7ecce5b30
37,124
[ -1 ]
37,149
capitals.sexp
lisp-mirror_gendl/documentation/training/g101/exercises/source/capitals.sexp
(:michigan "lansing" :ohio "columbus" :washington "olympia" :colorado "denver" :utah "salt lake city")
103
Common Lisp
.l
1
102
102
0.72549
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
cfcf8ff7de1d9bb9b1d57331b540707e589be21526411028fd507922e62fccb2
37,149
[ -1 ]
37,165
ui-primi-plane.gdl
lisp-mirror_gendl/documentation/training/g102-tud/examples/source/ui-primi-plane.gdl
;; ;; Copyright 2012 Genworks International ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; (eval-when (:compile-toplevel :load-toplevel :execute) (gwl:define-package :examples-ui)) (in-package :examples-ui) (define-object primi-plane-ui (base-ajax-sheet) :computed-slots ((use-jquery? t) (main-sheet-body (with-cl-who-string () (:table (:tr (:td (str (the main-area main-div))) (:td (str (the viewport main-div)))))))) :hidden-objects ((plane :type 'gdl-user::primi-plane :wing-dihedral (the wing-dihedral value) :tail-configuration (the tail-configuration value))) :objects ((main-area :type 'sheet-section :inner-html (with-cl-who-string () (when gwl:*developing?* (str (the development-links))) (:h2 "x3dom demo") (:fieldset (str (the wing-dihedral html-string)) (str (the tail-configuration html-string))))) (viewport :type 'base-ajax-graphics-sheet :display-list-object-roots (list (the plane)) :width 800 :length 600 :zoom-factor-renderer 1.8 :inner-html (with-cl-who-string () (the-child write-embedded-x3dom-world)) :image-format-default :x3dom) (tail-configuration :type 'menu-form-control :size 1 :prompt "Tail Configuration" :default (the plane data tail-configuration) :onchange (string-append (the (gdl-sjax-call :form-controls (list (the-child)))) "location.reload(true);") :choice-plist (list :fuselage-mounted "Fuselage Mounted" :cruciform "Cruciform" :t-tail "T-Tail")) (wing-dihedral :type 'text-form-control :domain :number :default (the plane data wing-dihedral) :onchange (string-append (the (gdl-sjax-call :form-controls (list (the-child)))) "location.reload(true);" ) :prompt "Wing Dihedral Angle") )) (publish-gwl-app "/ppu" 'primi-plane-ui)
2,622
Common Lisp
.l
63
35.714286
70
0.671406
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
f0d5d8c7c220a5410f20e3302899c3e104baa51e2127f2785f37fbb887d7b7a7
37,165
[ -1 ]
37,168
primi-plane.gdl
lisp-mirror_gendl/documentation/training/g102-tud/examples/source/primi-plane.gdl
;; ;; Copyright 2012 Genworks International and the Delft University of ;; Technology ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; (in-package :gdl-user) (setq surf:*tess-max-3d-edge-factor* 0.2) (setq surf:*tess-max-angle-degrees* 12) (defparameter *data-folder* (make-pathname :name nil :type nil :defaults (merge-pathnames "../../data/" #+allegro excl:*source-pathname* #+lispworks dspec:*source-pathname* ;; in future: (glisp:source-pathname) ))) (define-object primi-plane (base-object) :input-slots ((data-folder *data-folder*) (aircraft-data-file (merge-pathnames "aircraft-1.dat" (the data-folder))) (points-data-file (merge-pathnames "NACA_0012.dat" (the data-folder))) (wing-dihedral (the data wing-dihedral)) (tail-configuration (the data tail-configuration))) :computed-slots ((use-local-box? nil)) :objects ((wing-assy :type 'box-wings :c-root (the data wing-c-root) :c-tip (the data wing-c-tip) :span (the data wing-span) :root-center (translate (the center) :down (- (the fuselage radius) (half (the-child thickness))) :front (* 1/6 (the fuselage length))) :thickness (the data wing-thickness) :dihedral (the wing-dihedral) :canonical-profile (the canonical-profile) :display-controls (list :color :green)) (tail-assy :type 'box-tail :configuration (the tail-configuration) :c-root (the data tail-c-root) :c-tip (the data tail-c-tip) :span (the data tail-span) :fuselage-radius (the fuselage radius) :root-center-nominal (translate (the center) :down (- (the fuselage radius) (the-child thickness)) :rear (- (half (the fuselage length)) (the-child c-root))) :fin-root-center (translate (the-child root-center-nominal) :up (- (twice (the fuselage radius)) (twice (the-child thickness)))) :thickness (the data tail-thickness) :dihedral (the data tail-dihedral) :fin-span (the data fin-span) :fin-thickness (the data fin-thickness) :fin-c-root (the data fin-c-root) :fin-c-tip (the data fin-c-tip) :display-controls (list :color :blue) ) (fuselage :type 'cylinder-fuselage :d (the data fuselage-diameter) :l (the data fuselage-length) :cross-section-percents (the data fuselage-cross-section-percents) :display-controls (list :color :red) )) :hidden-objects ((data :type 'aircraft-data :hidden? t :parameters (with-open-file (in (the aircraft-data-file)) (read in)) :points-data (with-open-file (in (the points-data-file)) (read in))) (canonical-profile :type 'profile-curve :hidden? t :points-data (the data points-data)) (approximated-profile :type 'approximated-curve :curve-in (the canonical-profile) :tolerance 0.01 ;;:tolerance 0.001 ))) (define-object aircraft-data () :input-slots (wing-span wing-thickness wing-dihedral wing-c-root wing-c-tip Tmax rho C-of-F fuselage-diameter fuselage-length fuselage-cross-section-percents tail-c-root tail-c-tip tail-span tail-thickness tail-dihedral tail-configuration points-data )) (define-object profile-curve (fitted-curve) :input-slots (points-data) :computed-slots ((data-name (string-append (first (the points-data)) (second (the points-data)))) (point-coordinates (rest (rest (the points-data)))) (x-coords (plist-keys (the point-coordinates))) (y-coords (plist-values (the point-coordinates))) (max-x (most 'get-x (the points))) (min-x (least 'get-x (the points))) (max-y (most 'get-y (the points))) (min-y (least 'get-y (the points))) (chord (- (get-x (the max-x)) (get-x (the min-x)))) (max-thickness (- (get-y (the max-y)) (get-y (the min-y)))) (points (mapcar #'(lambda(x y) (make-point x y 0)) (the x-coords) (the y-coords))))) (define-object cylinder-fuselage (cylinder) :input-slots (d l cross-section-percents) :computed-slots ((radius (half (the d))) (length (the l)) (section-offset-percentages (plist-keys (the cross-section-percents))) (section-centers (let ((nose-point (translate (the center) :front (half (the length))))) (mapcar #'(lambda (percentage) (translate nose-point :rear (* 1/100 percentage (the length)))) (the section-offset-percentages)))) (section-diameter-percentages (plist-values (the cross-section-percents))) (section-radii (mapcar #'(lambda (percentage) (* 1/100 percentage (the radius))) (the section-diameter-percentages)))) :hidden-objects ((regioned :type 'regioned-solid :display-controls (list :transparency 0.5) :brep (the merged)) (interior :type 'cabin-interior :display-controls (list :color :black) :width (twice (the radius))) (section-curves :type 'arc-curve :sequence (:size (length (the section-centers))) :center (nth (the-child index) (the section-centers)) :radius (nth (the-child index) (the section-radii)) :orientation (alignment :top (the (face-normal-vector :front)))) (floor-plane :type 'rectangular-surface :display-controls (list :color :black) :width (* (the radius) 4) :length (* (the length) 3/2)) (merged :type 'merged-solid :brep (the loft brep) :other-brep (the floor-plane brep) :make-manifold? t)) :objects ((loft :type 'lofted-surface :end-caps-on-brep? t :curves (list-elements (the section-curves))))) (define-object cabin-interior (base-object) :computed-slots ((nose-point (translate (the center) :front (- (half (the length)) (* 1/10 (the length)))))) :objects ((seat-rows :type 'seat-row :sequence (:size (floor (/ (* 8/10 (the length)) 2))) :length 1 :height 1 :width (* .8 (the width)) :center (translate (the nose-point) :rear (* (twice (the-child length)) (the-child index)) :up (half (the-child height)))))) (define-object seat-row (base-object) :objects ((seats :type 'box :width 0.5 :sequence (:matrix :lateral 5 :longitudinal 1)))) (define-object box-wings (base-object) :input-slots (root-center span c-root c-tip thickness dihedral canonical-profile) :computed-slots ((use-local-box? nil)) :objects ((wings :type 'box-wing :sequence (:size 2) :root-point (the root-center) :side (ecase (the-child index) (0 :right) (1 :left)) :span (the span) :c-root (the c-root) :c-tip (the c-tip) :thickness (the thickness) :canonical-profile (the canonical-profile) ;; ;; Left wing will get a left-handed coordinate system and be a mirror of the right. ;; :orientation (let* ((hinge (the (face-normal-vector (ecase (the-child side) (:right :front) (:left :rear))))) (right (rotate-vector-d (the (face-normal-vector (the-child side))) (the dihedral) hinge))) (alignment :right right :top (cross-vectors hinge right) :front (the (face-normal-vector :front))))))) (define-object box-tail (box-wings) :input-slots (configuration root-center-nominal fin-root-center fin-span fin-thickness fin-c-root fin-c-tip fuselage-radius) :computed-slots ((root-center (ecase (the configuration) (:fuselage-mounted (the root-center-nominal)) (:cruciform (translate (the root-center-nominal) :up (+ (twice (the fuselage radius)) (half (the fin-span)) (- (twice (the thickness))) ))) (:t-tail (translate (the root-center-nominal) :up (+ (twice (the fuselage radius)) (the fin-span) (- (twice (the thickness))))))))) :objects ((fin :type 'box-wing :root-point (the fin-root-center) :span (the fin-span) :c-root (the fin-c-root) :c-tip (ecase (the configuration) (:fuselage-mounted (the fin-c-tip)) ((:cruciform :t-tail) (the fin-c-root))) :thickness (the fin-thickness) :orientation (alignment :right (the (face-normal-vector :top)) :top (the (face-normal-vector :left)))))) (define-object box-wing (box) :input-slots (root-point side span c-root c-tip thickness canonical-profile) :computed-slots ((use-local-box? nil) (width (the span)) (length (the c-root)) (height (the thickness)) (center (translate-along-vector (the root-point) (the (face-normal-vector :right)) (half (the width)) ))) :objects ((box :type 'box :hidden? t :display-controls (list :color :orange :transparency 0.7)) (root-profile :type 'boxed-curve :curve-in (the canonical-profile) :orientation (alignment :top (the (face-normal-vector :right)) :rear (the (face-normal-vector :top)) :right (the (face-normal-vector :rear))) :scale-y (/ (the thickness) (the canonical-profile max-thickness)) :scale-x (/ (the c-root) (the canonical-profile chord)) :center (the (edge-center :left :front)) :hidden? t ) (tip-profile :type 'boxed-curve :curve-in (the canonical-profile) :orientation (alignment :top (the (face-normal-vector :right)) :rear (the (face-normal-vector :top)) :right (the (face-normal-vector :rear))) :scale-y (/ (the thickness) (the canonical-profile max-thickness)) :scale-x (/ (the c-tip) (the canonical-profile chord)) :center (translate (the (edge-center :right :front)) :rear (- (the length) (the c-tip))) :hidden? t ) (loft :type 'lofted-surface :end-caps-on-brep? t :curves (list (the root-profile) (the tip-profile)))))
10,585
Common Lisp
.l
261
34.180077
93
0.645041
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
62ae0d4054db4f11010ca73768dee5f31ef67adb5188871a2a4569f3747f5be9
37,168
[ -1 ]
37,175
file-ordering.isc
lisp-mirror_gendl/documentation/training/slide-show/source/file-ordering.isc
;; ;; Copyright 2002-2011, 2012 Genworks International ;; ;; This source file is part of the General-purpose Declarative ;; Language project (GDL). ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; ("package")
859
Common Lisp
.l
21
39.666667
70
0.759857
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
0e554610c850e3179329f852d2aa6f6f6fb9d6c3755d9f08f4fcf76a1cba2e0e
37,175
[ -1 ]
37,178
fleet.csv
lisp-mirror_gendl/demos/bus/data/fleet.csv
;; ;; Copyright 2002, 2009 Genworks International and Genworks BV ;; ;; This source file is part of the General-purpose Declarative ;; Language project (GDL). ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; 300,10,"yes" 300,3,"no" 400,7,"no" 300,30,"yes" 200,3,"no" 500,9,"no" 750,7,"no"
967
Common Lisp
.l
27
33.592593
71
0.729211
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
9c80ce527a34fa78c9e820b7282cbac4143b5441e5bd1fce38a650ba4d820e43
37,178
[ -1 ]
37,179
file-ordering.isc
lisp-mirror_gendl/demos/bus/source/file-ordering.isc
;; ;; Copyright 2002, 2009 Genworks International and Genworks BV ;; ;; This source file is part of the General-purpose Declarative ;; Language project (GDL). ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; ("package" "assembly" "body" "chassis" "interior" "rule-ackermann")
948
Common Lisp
.l
21
42.857143
71
0.740541
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
c472b674238d65a80229c13da8343451dcf30d919933c3f3bdce71cf4d982b18
37,179
[ -1 ]
37,212
4bar.gdl
lisp-mirror_gendl/demos/4bar/source/4bar.gdl
(gwl:define-package :4-bar (:export #:assembly #:dd)) (in-package :4-bar) (define-object dd (base-ajax-sheet base-object) :computed-slots ((use-raphael? t) (main-sheet-body (with-cl-who-string () (str (the development-links)) (str (the main-area main-div)) (str (the drop-coord-section main-div)))) (dropped-x-y (defaulting (the main-area dropped-x-y))) (input-link-angle-d nil :settable) ) :objects ((assembly :type 'assembly :input-link-angle-d (or (the input-link-angle-d) (if (the dropped-x-y) (angle-between-vectors-d (the (face-normal-vector :right)) (subtract-vectors (the dropped-x-y) (the assembly ground-2)) (the (face-normal-vector :top))) 90)))) :hidden-objects ((drop-coord-section :type 'sheet-section :js-to-eval :parse :inner-html (with-cl-who-string () (str (defaulting (the main-area dropped-x-y))) (str (the input-link-angle-d)))) (main-area :type 'base-ajax-graphics-sheet :respondent self :vector-graphics-onclick? nil :length 500 :width 500 :image-format-default :raphael :view-direction-default :top :display-list-object-roots (list (the assembly))))) (define-object assembly (base-object) :input-slots ((ground-link-length 15 :settable) (grounded-link-1-length 8 :settable) (grounded-link-2-length 5 :settable) (coupler-link-length 15 :settable) (coupler-angle-1-d 30 :settable) (coupler-length-1 10 :settable) (input-link-index 1 :settable) (input-link-angle-d 90 :settable) (angle-increment 10 :settable)) :computed-slots ((input-link-angle (degree (the input-link-angle-d))) (coupler-angle-1 (degree (the coupler-angle-1-d))) (ground-1 (translate (the center) :left (half (the ground-link-length)))) (ground-2 (translate (the center) :right (half (the ground-link-length)))) (follower-link-circle (the (grounded-link-circles (- 1 (the input-link-index))))) (follower-link-ends (mapcar #'(lambda(flag) (inter-circle-sphere (the input-link-circle center) (the input-link-circle radius) (the input-link-circle (face-normal-vector :top)) (the follower-link-circle center) (the follower-link-circle radius) flag)) (list t nil))) (follower-link-angles (mapcar #'(lambda(point) (angle-between-vectors (the follower-link-circle (face-normal-vector :right)) (subtract-vectors point (the follower-link-circle center)) (the follower-link-circle (face-normal-vector :top)))) (the follower-link-ends))) (follower-link-angle (apply #'min (the follower-link-angles))) (follower-link-end (if (near-to? (first (the follower-link-angles)) (the follower-link-angle)) (first (the follower-link-ends)) (second (the follower-link-ends)))) (links (list (the ground-link) (the (grounded-links 0)) (the (grounded-links 1)) (the coupler-link))) (sorted-links (safe-sort (the links) #'< :key #'(lambda(link) (the-object link length)))) (shortest-link (first (the sorted-links))) (longest-link (lastcar (the sorted-links))) (p-link (second (the sorted-links))) (q-link (third (the sorted-links))) (crank-rocker? (and (eql (the grashof-classification) :type-1) (or (eql (the shortest-link) (the (grounded-links 0))) (eql (the shortest-link) (the (grounded-links 1)))))) (double-crank? (eql (the shortest-link) (the ground-link))) (double-rocker? (eql (the shortest-link) (the coupler-link))) (grashof-classification (cond ((< (+ (the shortest-link length) (the longest-link length)) (+ (the p-link length) (the q-link length))) :type-1) ((> (+ (the shortest-link length) (the longest-link length)) (+ (the p-link length) (the q-link length))) :type-2) (t :neutral)))) :hidden-objects ((scratch :type 'assembly :pass-down (angle-increment ground-link-length grounded-link-1-length grounded-link-2-length coupler-link-length coupler-angle-1-d coupler-length-1 input-link-index input-link-angle-d))) :objects ( (follower-link-sphere :type 'sphere :center (the follower-link-circle center) :radius (the follower-link-circle radius)) (input-link-circle :type 'circle :radius (the coupler-link-length) :center (the (grounded-links (the input-link-index)) end)) (grounded-link-circles :type 'circle :sequence (:size 2) :radius (ecase (the-child index) (0 (the grounded-link-1-length)) (1 (the grounded-link-2-length))) :center (ecase (the-child index) (0 (the ground-1)) (1 (the ground-2)))) (ground-link :type 'c-cylinder :radius 0.3 :start (the ground-1) :end (the ground-2) :display-controls (list :line-thickness 2)) (pivot-1 :type 'cylinder :center (the ground-link start) :radius (the ground-link radius) :length 0.5 :display-controls (list :line-thickness 3) :orientation (alignment :front (the (face-normal-vector :top)))) (pivot-2 :type 'cylinder :center (the ground-link end) :radius (the ground-link radius) :length 0.5 :display-controls (list :line-thickness 3) :orientation (alignment :front (the (face-normal-vector :top)))) (grounded-links :type 'c-cylinder :radius (the ground-link radius) :sequence (:size 2) :display-controls (list :color (ecase (the-child index) (0 :red) (1 :green)) :line-thickness 2 :drag-controls (ecase (the-child index) (1 :drag-and-drop) ;;(1 :drop) (0 nil))) :circle (the (grounded-link-circles (the-child index))) :pseudo-inputs (circle) :start (the-child circle center) :end (rotate-point (the-child circle start) (the-child circle center) (the (face-normal-vector :top)) :angle (if (= (the input-link-index) (the-child index)) (the input-link-angle) (the follower-link-angle)))) (coupler-link :type 'coupler-link :display-controls (list :line-thickness 2 :color :blue :fill-color :blue) :pass-down (coupler-angle-1 coupler-length-1) :start (the (grounded-links 0) end) :end (the (grounded-links 1) end))) :functions ((animate (&key (start-angle-d 0) (end-angle-d 360) (increment (the angle-increment)) (write-pdfs? t)) (let* ((current-angle (the input-link-angle-d)) (angles (list-of-numbers start-angle-d end-angle-d increment)) (count -1) data) (dolist (angle angles) (the (set-slot! :input-link-angle-d angle)) (print-variables angle) (incf count) (with-error-handling () (push (the coupler-link datum) data)) (when write-pdfs? (let ((filename (format nil "/tmp/4bar-~2,,,'[email protected]" count))) (with-format (pdf filename :page-width (* 5 72) :page-length (* 5 72)) (write-the view-object cad-output))))) (the (set-slot! :input-link-angle-d current-angle)) (nreverse data))))) (define-object coupler-link (global-polyline) :input-slots (start end coupler-angle-1 coupler-length-1) :computed-slots ((datum (the edge-1 end)) (direction-vector (subtract-vectors (the end) (the start))) (vertex-list (list (the start) (the end) (the edge-1 end) (the start)))) :hidden-objects ((baseline :type 'line :pass-down (start end)) (edge-1 :type 'line :pass-down (start) :end (rotate-point (translate-along-vector (the start) (the direction-vector) (the coupler-length-1)) (the start) (the (face-normal-vector :top)) :angle (the coupler-angle-1))) (edge-2 :type 'line :start (the edge-1 end) :pass-down (end)))) #+nil (define-object coupler-link (line outline-specialization-mixin) :input-slots (coupler-angle-1 coupler-length-1) :computed-slots ((datum (the edge-1 end))) :hidden-objects ((baseline :type 'line :pass-down (start end)) (edge-1 :type 'line :pass-down (start) :end (rotate-point (translate-along-vector (the start) (the direction-vector) (the coupler-length-1)) (the start) (the (face-normal-vector :top)) :angle (the coupler-angle-1))) (edge-2 :type 'line :start (the edge-1 end) :pass-down (end)))) (publish-gwl-app "/4bar" '4-bar:dd)
8,679
Common Lisp
.l
209
34.291866
96
0.637812
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
fde1c49ddae6d04f91e7f3e20320919c1b22e4f2a7cc5e05f64e541eadd022a6
37,212
[ -1 ]
37,213
bus.gdl
lisp-mirror_gendl/demos/4bar/source/bus.gdl
(gwl:define-package :4-bar (:export #:assembly #:dd)) (in-package :4-bar) (define-object bus (base-ajax-sheet base-object) :computed-slots ((use-raphael? t) (main-sheet-body (with-cl-who-string () (str (the development-links)) (str (the main-area main-div)) (str (the drop-coord-section main-div)))) (dropped-x-y (defaulting (the main-area dropped-x-y)))) :objects ((assembly :type 'bus:assembly :turn-angle (if (the dropped-x-y) (angle-between-vectors-d (the (face-normal-vector :right)) (subtract-vectors (the dropped-x-y) (the assembly chassis (knuckles 1) center)) (the (face-normal-vector :top))) 0))) :hidden-objects ((drop-coord-section :type 'sheet-section :js-to-eval :parse :inner-html (with-cl-who-string () (str (defaulting (the main-area dropped-x-y))) (str (the assembly turn-angle)))) (main-area :type 'base-ajax-graphics-sheet :respondent self :vector-graphics-onclick? nil :length 500 :width 500 ;;:projection-vector (getf *standard-views* :top) :display-list-object-roots (list (the assembly chassis))))) (publish-gwl-app "/bus" '4-bar::bus)
1,318
Common Lisp
.l
30
34.333333
68
0.603339
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
71800634d0754cfc4a699305071a16ebd3a27966e2f32afa4653ed124f0d17e2
37,213
[ -1 ]
37,214
file-ordering.isc
lisp-mirror_gendl/demos/robot/source/file-ordering.isc
;; ;; Copyright 2002, 2009 Genworks International and Genworks BV ;; ;; This source file is part of the General-purpose Declarative ;; Language project (GDL). ;; ;; This source file contains free software: you can redistribute it ;; and/or modify it under the terms of the GNU Affero General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; ;; This source file 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 ;; Affero General Public License for more details. ;; ;; You should have received a copy of the GNU Affero General Public ;; License along with this source file. If not, see ;; <http://www.gnu.org/licenses/>. ;; ("package")
892
Common Lisp
.l
21
40.190476
71
0.742232
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
d6509e4faf997a70a1260cee9fe41bb302d050bfd0600ff96de777056e2fe593
37,214
[ -1 ]
37,236
any-resize-event.js
lisp-mirror_gendl/gwl/static/3rdpty/resize/any-resize-event.js
/*! LegoMushroom @legomushroom http://legomushroom.com MIT License 2014 */ (function() { var Main; Main = (function() { function Main(o) { this.o = o != null ? o : {}; if (window.isAnyResizeEventInited) { return; } this.vars(); this.redefineProto(); } Main.prototype.vars = function() { window.isAnyResizeEventInited = true; this.allowedProtos = [HTMLDivElement, HTMLFormElement, HTMLLinkElement, HTMLBodyElement, HTMLParagraphElement, HTMLFieldSetElement, HTMLLegendElement, HTMLLabelElement, HTMLButtonElement, HTMLUListElement, HTMLOListElement, HTMLLIElement, HTMLHeadingElement, HTMLQuoteElement, HTMLPreElement, HTMLBRElement, HTMLFontElement, HTMLHRElement, HTMLModElement, HTMLParamElement, HTMLMapElement, HTMLTableElement, HTMLTableCaptionElement, HTMLImageElement, HTMLTableCellElement, HTMLSelectElement, HTMLInputElement, HTMLTextAreaElement, HTMLAnchorElement, HTMLObjectElement, HTMLTableColElement, HTMLTableSectionElement, HTMLTableRowElement]; return this.timerElements = { img: 1, textarea: 1, input: 1, embed: 1, object: 1, svg: 1, canvas: 1, tr: 1, tbody: 1, thead: 1, tfoot: 1, a: 1, select: 1, option: 1, optgroup: 1, dl: 1, dt: 1, br: 1, basefont: 1, font: 1, col: 1, iframe: 1 }; }; Main.prototype.redefineProto = function() { var i, it, proto, t; it = this; return t = (function() { var _i, _len, _ref, _results; _ref = this.allowedProtos; _results = []; for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { proto = _ref[i]; if (proto.prototype == null) { continue; } _results.push((function(proto) { var listener, remover; listener = proto.prototype.addEventListener || proto.prototype.attachEvent; (function(listener) { var wrappedListener; wrappedListener = function() { var option; if (this !== window || this !== document) { option = arguments[0] === 'onresize' && !this.isAnyResizeEventInited; option && it.handleResize({ args: arguments, that: this }); } return listener.apply(this, arguments); }; if (proto.prototype.addEventListener) { return proto.prototype.addEventListener = wrappedListener; } else if (proto.prototype.attachEvent) { return proto.prototype.attachEvent = wrappedListener; } })(listener); remover = proto.prototype.removeEventListener || proto.prototype.detachEvent; return (function(remover) { var wrappedRemover; wrappedRemover = function() { this.isAnyResizeEventInited = false; this.iframe && this.removeChild(this.iframe); return remover.apply(this, arguments); }; if (proto.prototype.removeEventListener) { return proto.prototype.removeEventListener = wrappedRemover; } else if (proto.prototype.detachEvent) { return proto.prototype.detachEvent = wrappedListener; } })(remover); })(proto)); } return _results; }).call(this); }; Main.prototype.handleResize = function(args) { var computedStyle, el, iframe, isEmpty, isStatic, _ref; el = args.that; if (!this.timerElements[el.tagName.toLowerCase()]) { iframe = document.createElement('iframe'); el.appendChild(iframe); iframe.style.width = '100%'; iframe.style.height = '100%'; iframe.style.position = 'absolute'; iframe.style.zIndex = -999; iframe.style.opacity = 0; iframe.style.top = 0; iframe.style.left = 0; computedStyle = window.getComputedStyle ? getComputedStyle(el) : el.currentStyle; isStatic = computedStyle.position === 'static' && el.style.position === ''; isEmpty = computedStyle.position === '' && el.style.position === ''; if (isStatic || isEmpty) { el.style.position = 'relative'; } if ((_ref = iframe.contentWindow) != null) { _ref.onresize = (function(_this) { return function(e) { return _this.dispatchEvent(el); }; })(this); } el.iframe = iframe; } else { this.initTimer(el); } return el.isAnyResizeEventInited = true; }; Main.prototype.initTimer = function(el) { var height, width; width = 0; height = 0; return this.interval = setInterval((function(_this) { return function() { var newHeight, newWidth; newWidth = el.offsetWidth; newHeight = el.offsetHeight; if (newWidth !== width || newHeight !== height) { _this.dispatchEvent(el); width = newWidth; return height = newHeight; } }; })(this), this.o.interval || 62.5); }; Main.prototype.dispatchEvent = function(el) { var e; if (document.createEvent) { e = document.createEvent('HTMLEvents'); e.initEvent('onresize', false, false); return el.dispatchEvent(e); } else if (document.createEventObject) { e = document.createEventObject(); return el.fireEvent('onresize', e); } else { return false; } }; Main.prototype.destroy = function() { var i, it, proto, _i, _len, _ref, _results; clearInterval(this.interval); this.interval = null; window.isAnyResizeEventInited = false; it = this; _ref = this.allowedProtos; _results = []; for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { proto = _ref[i]; if (proto.prototype == null) { continue; } _results.push((function(proto) { var listener; listener = proto.prototype.addEventListener || proto.prototype.attachEvent; if (proto.prototype.addEventListener) { proto.prototype.addEventListener = Element.prototype.addEventListener; } else if (proto.prototype.attachEvent) { proto.prototype.attachEvent = Element.prototype.attachEvent; } if (proto.prototype.removeEventListener) { return proto.prototype.removeEventListener = Element.prototype.removeEventListener; } else if (proto.prototype.detachEvent) { return proto.prototype.detachEvent = Element.prototype.detachEvent; } })(proto)); } return _results; }; return Main; })(); if ((typeof define === "function") && define.amd) { define("any-resize-event", [], function() { return new Main; }); } else if ((typeof module === "object") && (typeof module.exports === "object")) { module.exports = new Main; } else { if (typeof window !== "undefined" && window !== null) { window.AnyResizeEvent = Main; } if (typeof window !== "undefined" && window !== null) { window.anyResizeEvent = new Main; } } }).call(this);
7,526
Common Lisp
.ny
205
27.282927
642
0.575397
lisp-mirror/gendl
0
0
0
AGPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
bb4e74f04e1cda525d7474341ecae35cc6e052c63270d16c74a80e4ccf2c589e
37,236
[ -1 ]
37,238
package.lisp
nibbula_deblarg/package.lisp
;;; ;;; package.lisp - Deblarg package definition ;;; (defpackage :deblarg (:documentation "A crappy half-assed debugger for your enjoyment and frustration. But at least you can type things using RL.") (:use :cl :dlib :char-util :table :dlib-misc :table-print :keymap :terminal :terminal-ansi :terminal-table :rl :collections :ochar :fatchar :fatchar-io :tiny-repl #+sbcl :sb-introspect :reader-ext :source-path) (:export #:deblargger #:deblargger-current-frame #:deblargger-saved-frame #:deblargger-condition #:deblargger-term #:deblargger-visual-mode #:deblargger-visual-term #:*deblarg* #:*debug-term* #:*deblargger-entry-hook* #:deblarg #:*default-interceptor* #:toggle #:active-p #:activate #:deactivate #:with-debugger-io #:debugger-backtrace #:debugger-wacktrace #:invoke-command )) (in-package :deblarg) ;; End
902
Common Lisp
.lisp
34
23.088235
78
0.704388
nibbula/deblarg
0
0
0
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
0546b9c3c23f156778633cb98bf514afec2629f5e1dcd028502e480b58d08717
37,238
[ -1 ]
37,239
deblarg-sbcl.lisp
nibbula_deblarg/deblarg-sbcl.lisp
;;; ;;; deblarg-sbcl.lisp - SBCL specific debugger pieces. ;;; (in-package :deblarg) ;; (declaim ;; (optimize (speed 0) (safety 3) (debug 3) (space 0) (compilation-speed 0))) ;; Temporarily set the feature if the implementation supports breakpoints. #+sbcl (eval-when (:compile-toplevel) (d-add-feature :tdb-has-breakpoints)) (defclass sbcl-deblargger (deblargger) () (:documentation "Deblargger for SBCL.")) (defmethod initialize-instance :after ((o sbcl-deblargger) &rest initargs &key &allow-other-keys) "Initialize a sbcl-deblargger." (declare (ignore initargs)) (when (or (not (slot-boundp o 'saved-frame)) (not (slot-value o 'saved-frame))) (setf (slot-value o 'saved-frame) (debugger-internal-frame))) (when (or (not (slot-boundp o 'current-frame)) (not (slot-value o 'current-frame))) (setf (slot-value o 'current-frame) (slot-value o 'saved-frame)))) (eval-when (:compile-toplevel :load-toplevel :execute) (setf *deblargger-implementation-class* 'sbcl-deblargger)) (defun frame-value (frame var) "Return the value of ‘var’ from ‘frame’ or #:|<Unavailable>|. If ‘var’ isn't a debugger variable, just return it." (let ((result (cond ((sb-di::debug-var-p var) (handler-case (sb-di::debug-var-value var frame) (condition () '#:|<Unavailable>|))) (t var)))) #| It seems a very strange situation can happen here. Is this an sbcl bug? (and (eq (type-of result) 'cl:function) (not (eq 'cl:function (typecase result (cl:function 'cl:function) (t 't)))))) |# (cond ((typep result 'condition) '#:|-condition-|) (t result)))) (defun print-frame (f &optional (stream *debug-io*)) "Print a frame." (labels ((print-lambda-list (f arg-list) (loop :for v :in arg-list :do (cond ((sb-di::debug-var-p v) ;;(sb-di::debug-var-symbol v) (let ((vv (frame-value f v))) (when (not (or (eql vv '#:|<Unavailable>|) (typep vv 'condition))) (write-char #\space stream) (display-value vv stream)))) ((and (listp v) (eql (car v) :rest)) (format stream " &rest") (print-lambda-list f (cdr v))))))) (let* ((loc (sb-di:frame-code-location f)) (dbg-fun (sb-di:code-location-debug-fun loc)) (name (sb-di:debug-fun-name dbg-fun))) (format stream "(") (if (symbolp name) (let ((pkg (symbol-package name))) (if (not (eql (find-package :cl) pkg)) (format stream "~(~a~)::" (package-name pkg))))) (format stream "~(~a~)" name) (if (sb-di::debug-fun-%lambda-list dbg-fun) (print-lambda-list f (sb-di::debug-fun-lambda-list dbg-fun)) (princ " <unavailable>" stream)) (format stream ")")))) (defun sbcl-start-frame () ;; introduced sometime after 1.0.57 (let ((sym (find-symbol "BACKTRACE-START-FRAME" :sb-debug))) (if sym (funcall sym :debugger-frame) (sb-di:top-frame)))) (defmethod debugger-backtrace ((d sbcl-deblargger) n) "Output a list of execution stack contexts. Try to limit it to the innermost N contexts, if we can." ;; (or *saved-frame* (sb-di:top-frame)) (loop ;; @@@ It might be nice to do this, but then the counts are all off. ;; :with f = (sbcl-start-frame) ;; :with f = *current-frame* ;; :with f = (sb-di:top-frame) :with f = (debugger-saved-frame d) :and i = 0 :do ;; (format *debug-io* "~3d " (sb-di:frame-number f)) ;; (print-frame f) ;; (terpri *debug-io*) ;; (print-span `((:fg-yellow ,(format nil "~3d" (sb-di:frame-number f))) " ")) ;; (print-frame f *debug-term*) ;; (terpri *debug-term*) (with-simple-restart (skip-printing-frame "Skip printing deblarg frame ~d" i) (print-stack-line (cons (sb-di:frame-number f) (with-output-to-fat-string (str) (print-frame f str))))) (setf f (sb-di:frame-down f)) (incf i) :until (or (not f) (and n (>= i n))))) (defmethod debugger-backtrace-lines ((d sbcl-deblargger) n) (loop ;;; :with f = *saved-frame* #| (sbcl-start-frame) |# :with f = (if *deblarg* ;; so we can be called from outside the debugger (debugger-current-frame *deblarg*) ;; (debugger-internal-frame) (debugger-saved-frame d) ) :for i :from 1 :to n :collect (cons (sb-di:frame-number f) (with-output-to-string (str) (print-frame f str))) :do (setf f (sb-di:frame-down f)) :while f)) (defmethod debugger-eval-in-frame ((d sbcl-deblargger) form n) (let ((frame (frame-number-or-current n))) (funcall (the function (sb-di:preprocess-for-eval form (sb-di:frame-code-location frame))) frame))) #|#+sbcl (defun stream-source-position (code-location stream) (let* ((cloc (sb-debug::maybe-block-start-location code-location)) (tlf-number (sb-di::code-location-toplevel-form-offset cloc)) (form-number (sb-di::code-location-form-number cloc))) (multiple-value-bind (tlf pos-map) (read-source-form tlf-number stream) (let* ((path-table (sb-di::form-number-translations tlf 0)) (path (cond ((<= (length path-table) form-number) (warn "inconsistent form-number-translations") (list 0)) (t (reverse (cdr (aref path-table form-number))))))) (source-path-source-position path tlf pos-map))))) #+sbcl (defun code-location-has-debug-block-info-p (code-location) (handler-case (progn (sb-di:code-location-debug-block code-location) t) (sb-di:no-debug-blocks () nil))) (defun fallback-source-location (code-location) ) (defun source-file-source-location (code-location) ) |# #| #+sbcl (defun debugger-source (frame-number) (when (not frame-number) (setf frame-number 0)) (let ((frame (frame-number frame-number)) (loc (sb-di::frame-code-location frame)) (src (sb-di::code-location-debug-source loc)) (filename (sb-c::debug-source-namestring src))) (if filename (if (code-location-has-debug-block-info-p code-location) (source-file-source-location code-location) (fallback-source-location code-location)) (prin1-to-string (sb-debug::code-location-source-form loc 100))))) |# #| (with-open-file (str filename) (file-position str pos) (loop :for i :from 1 :to 10 :collect (read-line str nil nil) ;;(format nil "~s~%" (sb-di:debug-fun-start-location dbg-fun)) )))) |# (defmethod debugger-source-path ((d sbcl-deblargger) frame) #| (let* ((fun (sb-di:code-location-debug-fun (sb-di:frame-code-location frame))) (src (and fun (sb-introspect:find-definition-source (symbol-function (sb-di:debug-fun-name fun)))))) (if src (definition-source-pathname src) ":Unknown"))) |# (let* ((loc (sb-di:frame-code-location frame)) (src (sb-di::code-location-debug-source loc))) (sb-c::debug-source-namestring src))) ;;; Return the number of the form corresponding to CODE-LOCATION. The ;;; form number is derived by a walking the subforms of a top level ;;; form in depth-first order. ;;; (defun code-location-form-number (code-location) (defun get-loc-subform-pos (loc stream) "Return the file position of the subform." (let ((form-number (sb-di::code-location-form-number loc)) (form-offset (sb-di::code-location-toplevel-form-offset loc))) (multiple-value-bind (top-level-form position-map) (read-source-form form-offset stream) (let* ((path-table (sb-di::form-number-translations top-level-form 0)) (path (cond ((<= (length path-table) form-number) (warn "inconsistent form-number-translations") (list 0)) (t (reverse (cdr (aref path-table form-number))))))) (format t "path ~s~%" path) (source-path-source-position path top-level-form position-map))))) (defmacro compiled-debug-function-form-number (fun) (let ((sym (or (find-symbol "COMPILED-DEBUG-FUN-TLF-NUMBER" :sb-c) ; older name (find-symbol "COMPILED-DEBUG-FUN-FORM-NUMBER" :sb-c)))) `(,sym ,fun))) (defun get-loc-form-offset (loc) (if (sb-di::code-location-unknown-p loc) ;; on some version before 1.4.2 it was: ;;(sb-c::compiled-debug-fun-tlf-number (compiled-debug-function-form-number (sb-di::compiled-debug-fun-compiler-debug-fun (sb-di::compiled-code-location-debug-fun loc))) (sb-di:code-location-toplevel-form-offset loc))) (defun get-snippet-pos (stream loc) "Return the character offset position in STREAM of the source location LOC." (let ((form-offset (get-loc-form-offset loc)) start-pos form) (let ((*read-suppress* t) (eof (cons nil nil))) (loop :with i = 0 :while (and (<= i form-offset) (not (eq eof (setf start-pos (file-position stream) form (safe-clean-read stream nil eof))))) :do (incf i))) (values start-pos form))) (defun highlight (string start end) "Highlight the region from START to END in STRING and return it." (let ((result (or (and (typep string 'fat-string) string) (string-to-fat-string string)))) (loop :for i :from start :below end :do ;; (pushnew :standout (fatchar-attrs (oaref result i))) (setf (fatchar-fg (oaref result i)) :red) ) result)) (defmethod debugger-source ((d sbcl-deblargger) frame &optional (source-height 10)) (let* ((loc (sb-di:frame-code-location frame)) ;;(fun (and loc (sb-di:code-location-debug-fun loc))) ;;(src (and fun (sb-introspect:find-definition-source ;; (symbol-function ;; (sb-di:debug-fun-name fun))))) ;;(path (definition-source-pathname src)) ;;(offset (definition-source-character-offset src)) ;; (src2 (sb-di::code-location-debug-source loc)) ;;(form-num (sb-di::code-location-form-number loc)) ;;(form-offset (sb-di::code-location-toplevel-form-offset loc)) ;; (sb-di::code-location-source-form loc context??) ;; (sb-di::get-toplevel-form loc) (path2 (sb-c::debug-source-namestring src2)) offset start end lines (i 0) first-line) ;;; (if src2 (with-open-file (stream path2) (setf offset (get-snippet-pos stream loc)) (format t "snippet-pos ~s~%" offset) (file-position stream 0) ;; @@@ we should avoid re-reading it (setf (values start end) (get-loc-subform-pos loc stream)) (format t "snippet subform pos ~s ~s~%" start end) (file-position stream offset) (loop :with line :and file-pos = offset :and line-end :while (and (setf line (read-line stream nil nil)) (or (< i source-height) (< file-pos end))) :do (setf line-end (+ file-pos (1+ (olength line)))) (when (<= start file-pos line-end) (setf line (highlight line ;;(format nil "~6d: ~a" file-pos line) (max 0 (- start file-pos)) (clamp (- (min end line-end) file-pos) 0 (olength line)))) (when (not first-line) (setf first-line i))) (incf file-pos (1+ (olength line))) (when (> file-pos start) (incf i) (push line lines))) (setf lines (nreverse lines)) (subseq lines first-line (min (length lines) (max 0 (- i source-height))))))) (defmethod debugger-show-source ((d sbcl-deblargger) n) (let ((frame (cond ((numberp n) (frame-number n)) (t (debugger-current-frame d))))) ;;(format t "~s~%" (debugger-source frame)))) (loop :for s :in (debugger-source d frame) :do (format t "~a~%" s)))) (defun frame-number (n) "Return the internal frame object given a frame number." (let ((result (loop :with f = (debugger-saved-frame *deblarg*) ; (sb-di:top-frame) :for fn :from 0 :below n :do (setf f (sb-di:frame-down f)) :finally (return f)))) (assert (= (sb-di:frame-number result) (+ (sb-di:frame-number (debugger-saved-frame *deblarg*)) n))) result)) (defun frame-number-or-current (&optional (n (debugger-current-frame *deblarg*))) "Return the frame numbered N, or the current frame, or the top frame." (cond ((numberp n) (frame-number n)) ((sb-di:frame-p n) n) (t (frame-number 0)))) (defmethod debugger-show-locals ((d sbcl-deblargger) n) (if n (format *debug-io* "Locals for frame ~s:~%" n) (format *debug-io* "Locals for current frame:~%")) (let* ((cur (frame-number-or-current n)) (fun (sb-di:frame-debug-fun cur))) (if (sb-di:debug-var-info-available fun) (let* ((*print-readably* nil) (loc (sb-di:frame-code-location cur))) (loop :for v :in (sb-di:ambiguous-debug-vars fun "") :do (when (eq (sb-di:debug-var-validity v loc) :valid) (format *debug-io* "~S~:[#~W~;~*~] = " (sb-di:debug-var-symbol v) (zerop (sb-di:debug-var-id v)) (sb-di:debug-var-id v)) (display-value (frame-value cur v) *debug-io*) (terpri *debug-io*))))))) (defmethod debugger-old-backtrace ((d sbcl-deblargger) n) "Output a list of execution stack contexts. Try to limit it to the innermost N contexts, if we can." #+sbcl (let ((bt-func (if (< *lisp-version-number* 10300) (intern "BACKTRACE" :sb-debug) (intern "PRINT-BACKTRACE" :sb-debug)))) (if (< *lisp-version-number* 10300) (if n (funcall bt-func n) (funcall bt-func))) (if n (funcall bt-func :count n) (funcall bt-func))) ;; #+sbcl (sbcl-wacktrace) ) ;; (declaim (inline debugger-internal-frame)) (defun debugger-internal-frame () (or sb-debug::*stack-top-hint* (sb-di::top-frame))) (defmethod debugger-up-frame ((d sbcl-deblargger) &optional (count 1)) (declare (ignore count)) (with-slots (current-frame) d (let ((next (sb-di:frame-up current-frame))) (if next (setf current-frame next))))) (defmethod debugger-down-frame ((d sbcl-deblargger) &optional (count 1)) (declare (ignore count)) (with-slots (current-frame) d (let ((next (sb-di:frame-down current-frame))) (if next (setf current-frame next))))) (defmethod debugger-set-frame ((d sbcl-deblargger) frame) (with-slots (current-frame) d (cond ((or (not frame) (and (numberp frame) (= frame 0))) (sb-di:top-frame)) ((numberp frame) (setf current-frame (frame-number frame))) ((sb-di:frame-p frame) (setf current-frame frame)) (t (format *debug-io* "No such frame ~s~%" frame))))) (defmethod debugger-top-frame ((d sbcl-deblargger) count) (declare (ignore count)) (with-slots (current-frame saved-frame) d (setf current-frame saved-frame))) ;; Stepping (progn ;; (defvar *step-form* nil) ;; (defvar *step-args* nil) (defun stepper (c) "Thing to set the stepper hook to." ;; (setf *step-form* (sb-ext::step-condition-form c) ;; *step-args* (sb-ext::step-condition-args c)) (format *debug-io* "-- SteppeR --~%") ;; Handle special stepping conditions: (typecase c (sb-ext:step-values-condition (format *debug-io* "Form: ~s~%Result: ~s~%" (slot-value c 'sb-kernel::form) (slot-value c 'sb-kernel::result)) (finish-output *debug-io*) (return-from stepper))) (finish-output *debug-io*) (let ((sb-debug::*stack-top-hint* (sb-di::find-stepped-frame)) (sb-ext::*stepper-hook* nil)) (invoke-debugger c)))) (defmethod activate-stepper ((d (eql 'sbcl-deblargger)) &key quietly) "Activate the setpper." (setf sb-ext::*stepper-hook* 'stepper) (when (not quietly) (format *debug-io* "Activating the DEBLARG stepper.~%"))) ;; Breakpoints (defvar *breakpoints* '() "List of known breakpoints.") (defun breaker (frame obj) "Function called when a breakpoint is hit." (declare (ignore obj)) (format *debug-io* "You gots breaked!~%") ;; (invoke-debugger (make-condition ;; 'simple-condition ;; :format-control "Breakpoint")) (deblarg (make-condition 'simple-condition :format-control "Breakpoint") nil frame)) (defun set-func-breakpoint (fun) (if (sb-di:fun-debug-fun fun) (let ((bp (sb-di:make-breakpoint #'breaker (sb-di:fun-debug-fun fun) :kind :fun-start))) (if bp (progn (push bp *breakpoints*) (sb-di:activate-breakpoint bp)) (format *debug-io* "Can't make no breakpoint fer ~s~%" fun))) (format *debug-io* "Ain't no debug fun fer ~s~%" fun))) (defun find-breakpoint (n) (nth (1- n) *breakpoints*)) (defun activate-breakpoint (n) (let ((bp (find-breakpoint n))) (if bp (sb-di:activate-breakpoint bp) (format *debug-io* "No such breakpoint ~a~%" n)))) (defun deactivate-breakpoint (n) (let ((bp (find-breakpoint n))) (if bp (sb-di:deactivate-breakpoint bp) (format *debug-io* "No such breakpoint ~a~%" n)))) (defun toggle-breakpoint (n) (let ((bp (find-breakpoint n))) (if bp (if (sb-di:breakpoint-active-p bp) (sb-di:deactivate-breakpoint bp) (sb-di:activate-breakpoint bp)) (format *debug-io* "No such breakpoint ~a~%" n)))) (defun delete-breakpoint (n) (let ((bp (find-breakpoint n))) (if bp (sb-di:deactivate-breakpoint bp) (format *debug-io* "No such breakpoint ~a~%" n)))) (defun list-breakpoints () (let ((rows (loop :for b :in *breakpoints* :and i = 1 :then (1+ i) :collect (list i (sb-di:breakpoint-active-p b) (sb-di:breakpoint-kind b) (sb-di:breakpoint-what b) (sb-di:breakpoint-info b))))) (nice-print-table rows '("#" "Act" "Kind" "What" "Info") :stream *debug-io*))) (defmethod debugger-hook ((d (eql 'sbcl-deblargger))) sb-ext:*invoke-debugger-hook*) (defmethod debugger-set-hook ((d (eql 'sbcl-deblargger)) function) (setf sb-ext:*invoke-debugger-hook* function)) ;; EOF
17,832
Common Lisp
.lisp
469
32.837953
83
0.632285
nibbula/deblarg
0
0
0
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
8411e8112f28f2608588886d3dbb96ad80b8ea8af6d32dbec0a2b3ab3a33f7c2
37,239
[ -1 ]
37,240
deblarg-others.lisp
nibbula_deblarg/deblarg-others.lisp
;;; ;;; deblarg-others.lisp - Implementation specific parts for all other ;;; implementations that aren't in a separate file. ;;; (in-package :deblarg) (defclass other-deblargger (deblargger) () (:documentation "Deblargger for other implementations.")) (eval-when (:compile-toplevel :load-toplevel :execute) (setf *deblargger-implementation-class* 'other-deblargger)) ;; As you may know, this is quite implementation specific. (defmethod debugger-backtrace ((d other-deblargger) n) "Output a list of execution stack contexts. Try to limit it to the innermost N contexts, if we can." #+cmu (if n (debug:backtrace n) (debug:backtrace)) #+lispworks (dbg:output-backtrace :full) #+abcl (loop :with i = 0 :for f :in (sys:backtrace) :do (format *debug-io* "~(~3d ~a~)~%" i (sys:frame-to-string f)) (incf i) :while (or (null n) (and (numberp n) (< i n)))) #+excl (top-level.debug:zoom *debug-io* :count n) #-(or cmu clisp lispworks ecl abcl excl) (debugger-sorry "backtrace")) (declaim (inline debugger-internal-frame)) (defun debugger-internal-frame () ;; We don't want to be sorry here, so just be wrong. #-(or sbcl ccl) nil) (defmethod activate-stepper ((d other-deblargger) &key quietly) "Activate the setpper." (declare (ignore quietly)) (values)) (defmethod debugger-hook ((d (eql 'other-deblargger))) *debugger-hook*) (defmethod debugger-set-hook ((d (eql 'other-deblargger)) function) (setf *debugger-hook* function)) ;; EOF
1,510
Common Lisp
.lisp
38
37.105263
78
0.701299
nibbula/deblarg
0
0
0
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
52b8e5e738dca4958ea3598b08df140403e5c12c7005aa85d4d7b82563708748
37,240
[ -1 ]
37,241
base.lisp
nibbula_deblarg/base.lisp
;;; ;;; base.lisp - Things that need to be defined before the system specific code. ;;; (in-package :deblarg) ;; (declaim ;; (optimize (speed 0) (safety 3) (debug 3) (space 0) (compilation-speed 0))) (defstruct thread "Per thread state." repeat-condition repeat-restart) (defclass deblargger () ((current-frame :initarg :current-frame :accessor debugger-current-frame :initform nil :documentation "The which the debugger is looking at.") (saved-frame :initarg :saved-frame :accessor debugger-saved-frame :initform nil :documentation "The frame which the debugger was entered from.") (condition :initarg :condition :accessor debugger-condition :initform nil :type (or condition null) :documentation "The condition which got us in here.") (string-limit :initarg :string-limit :accessor debugger-string-limit :initform 500 :documentation "Limit on the length of strings printed in things like stack traces. Should be an integer or NIL for unlimited.") (term :initarg :term :accessor debugger-term :type terminal :documentation "The terminal for debugger I/O.") (visual-mode :initarg :visual-mode :accessor debugger-visual-mode :initform nil :type boolean :documentation "True if we are in visual mode.") (visual-term :initarg :visual-term :accessor debugger-visual-term :initform nil :type (or terminal null) :documentation "The terminal for visual mode.")) (:documentation "I don't debug much, but when I do, I deblarg.")) (defvar *deblarg* nil "The current debugger instance.") (defvar *thread* nil "Per thread state.") (defvar *deblargger-implementation-class* nil "The class name for the implementation type.") (defun debugger-sorry (x) "What to say when we can't do something." (format *debug-io* "~%Sorry, don't know how to ~a on ~a. ~ Snarf some slime!~%" x (lisp-implementation-type))) (defun make-deblargger (&rest args) "Make a deblargger instance of the appropriate implentation type and return it. ‘args’ are given as arguments to make-instance." (apply #'make-instance *deblargger-implementation-class* args)) (defmacro def-debug (name (&rest args) doc-string &key no-object quiet) "Defines a debugger generic function along with a macro that calls that generic function with ‘*deblarg*' as it's first arg. If ‘no-object’ is true, the first arg is eql specialized by ‘*deblargger-implementation-class*’. If ‘quiet’ is true, the default method doesn't apologize." (let ((dd-name (symbolify (s+ "DD-" name))) (generic-name (symbolify (s+ "DEBUGGER-" name))) (whole-arg (gensym "DEF-DEBUG-WHOLE-ARG")) (ignorables (lambda-list-vars args :all-p t)) (first-arg (if no-object '*deblargger-implementation-class* '*deblarg*))) `(progn (defgeneric ,generic-name (tt ,@args) (:documentation ,doc-string) (:method (d ,@args) (declare (ignore d) (ignorable ,@ignorables)) ;; A default apology. ,@(unless quiet `((debugger-sorry ',generic-name))))) (defmacro ,dd-name (&whole ,whole-arg ,@args) (declare (ignorable ,@ignorables)) ,doc-string (append (list ',generic-name ',first-arg) (cdr ,whole-arg)))))) ;; (defvar *interceptor-condition* nil ;; "The condition that happened.") ;; @@@ Do we really need this separate here? Could we just use *terminal* ;; in with-new-terminal? (defvar *debug-term* nil "*debug-io* as a terminal.") (defvar *dont-use-a-new-term* nil "Prevent the debugger from opening a new terminal.") (defmacro with-new-debugger-io ((d) &body body) "Evaluate BODY with a new *terminal* redirected to *debug-io*." (with-unique-names (thunk) `(flet ((,thunk () ,@body)) (if *dont-use-a-new-term* (progn (setf (debugger-term ,d) *terminal*) (,thunk)) (let ((fd (nos:stream-system-handle *debug-io*)) device-name) (when fd (setf device-name (nos:file-handle-terminal-name fd))) (if device-name ;; @@@ Could we just use *terminal*? (with-new-terminal ((platform-default-terminal-type) *debug-term* :device-name device-name :output-stream (make-broadcast-stream *debug-io*)) (setf (debugger-term ,d) *debug-term*) (,thunk)) (with-new-terminal ((platform-default-terminal-type) *debug-term* :output-stream (make-broadcast-stream *debug-io*)) (setf (debugger-term ,d) *debug-term*) (,thunk)))))))) (defmacro with-debugger-io ((d) &body body) "Evaluate BODY with *debug-term* set up, either existing or new." (with-unique-names (thunk) `(flet ((,thunk () ,@body)) (if *debug-term* (,thunk) (with-new-debugger-io (,d) (,thunk)))))) ;; @@@ Figure out some way to make these respect *debug-io*, even when not ;; in the debugger. (defun debugger-print-string (string) (let ((term (or (and *deblarg* (debugger-term *deblarg*)) *terminal*))) (typecase string (string (princ string term)) (fatchar-string (render-fatchar-string string :terminal term)) (fat-string (render-fat-string string :terminal term))))) (defun print-span (span) ;; This doesn't work since some implementations wrap our terminal stream ;; with something else before it gets to print-object. ;;(princ (span-to-fat-string span) *terminal*) (render-fatchar-string (span-to-fatchar-string span) :terminal (if *deblarg* (debugger-term *deblarg*) terminal:*terminal*))) (defun display-value (v stream) "Display V in a way which hopefully won't mess up the display. Also errors are indicated instead of being signaled." (handler-case (typecase v ;; Make strings with weird characters not screw up the display. (string (prin1 (with-output-to-string (str) (let ((i 0)) (loop :for c :across v :while (< i (debugger-string-limit *deblarg*)) :do (displayable-char c :stream str :all-control t :show-meta nil) (incf i)) (when (< i (length v)) (write-string "..." str)))) stream)) (t (prin1 v stream))) (error (c) (declare (ignore c)) (return-from display-value (format stream "<<Error printing a ~a>>" (type-of v)))))) (defvar *debugger-stack-marks* nil "An alist of (frame-number . marker-description) for displaying marks when printing the stack.") (defmacro with-frame-mark ((mark) &body body) "Evaluate the body putting the frame mark ‘mark’ at the current frame." `(let ((*debugger-stack-marks* (acons (debugger-internal-frame) ,mark *debugger-stack-marks*))) ,@body)) (defun frame-mark (frame) "Return the frame mark for ‘frame’ or NIL if there isn't one." (dbugf :dbg "yo ~s~%" frame) (cdr (assoc frame *debugger-stack-marks* :test #'equal))) (defun output-term () "Return the terminal we should output to." (or (and *deblarg* (debugger-term *deblarg*)) *terminal*)) (defun maybe-print-frame-mark (frame width) (let* ((mark (frame-mark frame)) (term (output-term)) (width (or width (terminal-window-columns term)))) ;; Don't complain if it's not a known type. Errors in the debugger are ;; annoying, and this isn't that important. (typecase mark (null) ((or string fat-string) (terminal-write-line term mark)) (character (terminal-format term "~v{~a~:*~}" (1- width) '(#\─))) (keyword ;; assume it's a color or attribute keyword (terminal-write-span term `(,mark ,(format nil "~v{~a~:*~}" (1- width) '(#\─))))) (cons ;; assume it's a span (terminal-write-span term mark))))) (defun print-stack-line (line &key width) "Print a stack LINE, which is a cons of (line-numbner . string)." (destructuring-bind (num . str) line ;; (maybe-print-frame-mark num width) (print-span `((:fg-yellow ,(format nil "~3d" num) " "))) (debugger-print-string (if width (osubseq str 0 (min (olength str) (- width 4))) str)) ;;(terpri *terminal*) (terminal-write-char (output-term) #\newline))) ;; End
8,084
Common Lisp
.lisp
205
34.84878
81
0.672632
nibbula/deblarg
0
0
0
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
b7f3f669c956dd736339e2e60b664996dd582f33bfe54bc02a7657cddb91df7d
37,241
[ -1 ]
37,242
deblarg.lisp
nibbula_deblarg/deblarg.lisp
;;; ;;; deblarg.lisp - Debugger. ;;; (in-package :deblarg) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Implementation specifc methods ;; ;; For line mode: (def-debug backtrace (n) "Output a list of execution stack contexts. Try to limit it to the innermost N contexts, if we can.") (def-debug old-backtrace (n) "An old style backtrace in case the normal one doesn't work for you.") (def-debug show-source (n) "Show the source for frame N.") (def-debug show-locals (n) "Show the local variables for frame N.") (def-debug eval-in-frame (n form) "Return the result of evaluating FORM in frame N.") (def-debug up-frame (&optional count) "Move the current frame up by ‘count’ which defaults to 1.") (def-debug down-frame (&optional count) "Move the current frame down by ‘count’ which defaults to 1.") (def-debug set-frame (frame) "Set the current frame to ‘frame’.") (def-debug top-frame (count) "Set the current frame to the top frame.") (def-debug hook () "Return the current debugger hook." :no-object t) (def-debug set-hook (symbol) "Set the debugger hook to the function named by ‘symbol’." :no-object t) ;; For visual mode: (def-debug source (frame &optional source-height) "Return up to ‘source-height’ lines of source code for ‘frame’ if we can.") (def-debug source-path (frame) "Return the name of the source file for ‘frame’ if we can.") (def-debug backtrace-lines (n) "Return ‘n’ lines of backtrace from the current frame.") (def-debug activate-stepper (&key quietly) "Activate the stepper." :no-object t :quiet t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Implementation independent functions ;; ;; Visual mode (defconstant +box_drawings_light_horizontal+ (code-char #x2500)) ; ─ (defconstant +box_drawings_light_vertical_and_left+ (code-char #x2524)) ; ┤ (defconstant +box_drawings_light_vertical_and_right+ (code-char #x251c)) ; ├ (defun horizontal-line (tt &optional note) (terminal-color tt :blue :default) (if note (progn (terminal-write-string tt (s+ +box_drawings_light_horizontal+ +box_drawings_light_horizontal+ +box_drawings_light_vertical_and_left+)) (terminal-color tt :white :black) (terminal-write-string tt (s+ " " note " ")) (terminal-color tt :blue :default) (terminal-write-char tt +box_drawings_light_vertical_and_right+) (terminal-format tt "~v,,,va" (- (terminal-window-columns tt) (length (s+ note)) 6) +box_drawings_light_horizontal+ +box_drawings_light_horizontal+) (terminal-color tt :default :default) (terminal-write-char tt #\newline)) ;; no note, just a line (progn (terminal-color tt :blue :default) (terminal-format tt "~v,,,va~%" (1- (terminal-window-columns tt)) +box_drawings_light_horizontal+ +box_drawings_light_horizontal+) (terminal-color tt :default :default)))) (defun sanitize-line (line) (when line (if (> (olength line) 0) ;; (apply #'s+ (map 'list #'char-util:displayable-char line)) (with-output-to-fat-string (stream) (let (dc new-c) (flet ((print-char-with-effects-from (c ec) (setf new-c (make-fatchar :c c)) (copy-fatchar-effects ec new-c) (princ new-c stream))) (omapn (lambda (c) (typecase c (fatchar (setf dc (char-util:displayable-char (osimplify c))) (if (and (characterp dc) (ochar= dc c)) (princ c stream) (typecase dc (character (print-char-with-effects-from dc c)) (string (omapn (_ (print-char-with-effects-from _ c)) dc))))) (t (princ (char-util:displayable-char c) stream)))) (if (typep line 'fat-string) (fat-string-string line) line) )))) ;; (apply #'fs+ (map 'list #'char-util:displayable-char line)) line))) (defun visual () (with-slots (visual-term current-frame) *deblarg* (let ((tt visual-term)) (terminal-get-size tt) (with-saved-cursor (tt) (let* ((source-height (truncate (/ (terminal-window-rows tt) 3))) (stack-height (min 10 source-height)) (command-height (- (terminal-window-rows tt) (+ stack-height source-height 2))) (command-top (- (terminal-window-rows tt) (1- command-height))) (src (or ;; (ignore-errors ;; (dd-source current-frame source-height)) (handler-case (dd-source current-frame source-height) (condition (c) (list (format nil "~w" c)))) '("Unavailable."))) (path (or (ignore-errors (dd-source-path current-frame)) '("Unknown"))) (stack (or (ignore-errors (dd-backtrace-lines stack-height)) '("????")))) ;; Source area ;;(terminal-clear tt) (terminal-move-to tt (+ source-height stack-height 2) 0) (terminal-erase-above tt) (terminal-home tt) (loop :with line :and sp = src :for i :from 0 :below source-height :do (setf line (car sp)) (if line (progn (setf line (sanitize-line line)) ;;(terminal-format tt "~a~%" (terminal-write-line tt (osubseq line 0 (min (- (terminal-window-columns tt) 2) (olength line)))) (setf sp (cdr sp))) (terminal-format tt "~~~%"))) (horizontal-line tt path) ;; Stack area (loop :with line :and sp = stack :for i :from 0 :below stack-height :do (setf line (car sp)) (if line (progn (print-stack-line line :width (terminal-window-columns tt)) (setf sp (cdr sp))) (terminal-format tt "~~~%"))) (horizontal-line tt) ;; Command area (terminal-set-scrolling-region tt command-top (1- (terminal-window-rows tt))) (terminal-move-to tt (1- (terminal-window-rows tt)) 0) (terminal-finish-output tt)))))) (defvar *fake-term* nil "Workaround for problems with crunch.") (defun start-visual () (with-slots (visual-mode visual-term term) *deblarg* (cond (visual-mode ;; (when (not visual-term) ;; (setf visual-term (make-instance 'terminal-ansi)) ;; (terminal-start visual-term)) ;;(setf visual-term *terminal*) (setf visual-term term) (let ((tt visual-term)) (terminal-get-size tt) (terminal-move-to tt (1- (terminal-window-rows tt)) 0) (terminal-finish-output tt))) ;; @@@ temporary workaround ;; ((typep *terminal* 'terminal-crunch:terminal-crunch) ;; (setf *fake-term* *terminal* ;; *terminal* (make-instance 'terminal-ansi))) ))) (defun reset-visual () (with-slots (visual-term) *deblarg* (cond (visual-term (let ((tt visual-term)) (terminal-set-scrolling-region tt nil nil) (terminal-move-to tt (1- (terminal-window-rows tt)) 0) (terminal-finish-output tt) #| (terminal-end tt) |#) (setf visual-term nil)) ;; @@@ temporary workaround ;; (*fake-term* ;; (terminal-done *terminal*) ;; (setf *terminal* *fake-term* ;; *fake-term* nil)) ))) (defun debugger-up-frame-command (&optional foo) (declare (ignore foo)) (dd-up-frame) (visual)) (defun debugger-down-frame-command (&optional foo) (declare (ignore foo)) (dd-down-frame) (visual)) (defun list-restarts (rs) (with-slots (term) *deblarg* (print-span '((:underline "Restarts") " are:" #\newline)) (loop :with i = 0 :for r :in rs :do ;; (format *debug-term* "~&") (print-span `((:fg-cyan ,(princ-to-string i)) ": ")) (when (not (ignore-errors (progn (format term "~s ~a~%" (restart-name r) r) t))) (format term "Error printing restart ") (print-unreadable-object (r term :type t :identity t) (format term "~a" (restart-name r))) (terpri term)) (incf i)))) (defun debugger-prompt (e p) (declare (ignore e)) (when (debugger-visual-mode *deblarg*) (visual)) (let ((string (format nil "Debug ~d~a" *repl-level* p))) (format t "~a" string) t)) ;;; @@@ I actually want to take defcommand out of lish and make it be generic. ;;; And then also the command completion from lish to generic completion. ;;; Then we can define debugger commands nicely with completion and the whole ;;; shebang. (defstruct debugger-command name aliases) (defparameter *debugger-commands* (make-hash-table :test #'equalp) "Table of debugger commands.") (defparameter *debugger-command-list* nil "List of debugger commands.") (defun debugger-command-list () (or *debugger-command-list* (setf *debugger-command-list* (remove-duplicates (loop :for v :being :the :hash-values :of *debugger-commands* :collect v) :test #'equalp)))) (eval-when (:compile-toplevel :load-toplevel :execute) (defun command-name (symbol) "Return the name of the function for the command named by ‘symbol’." (symbolify (s+ #\_ symbol) :package :deblarg))) (defmacro define-debugger-command (name aliases &body body) `(progn (defun ,(command-name name) (repl-state restarts) (declare (ignorable repl-state restarts)) ,@body) (loop :for a :in ',aliases :do (setf (gethash a *debugger-commands*) (make-debugger-command :name ',name :aliases ',aliases))))) (defun define-debugger-alias (alias command) "Make ALIAS be another way to invoke COMMAND. COMMAND must already be a debugger command." (let ((cmd (get-command command))) (if (not cmd) (format *debug-io* "I can't make an alias to a non-existent command ~s." command) (progn (push alias (debugger-command-aliases cmd)) (setf (gethash alias *debugger-commands*) cmd))))) (defun get-command (keyword) (gethash keyword *debugger-commands*)) (defun debugger-help () (with-slots (term condition) *deblarg* (terminal-format term "Debugger help:~%") (output-table (make-table-from (nconc (loop :for c :in (debugger-command-list) :collect (list (span-to-fat-string `(:cyan ,(loop :for a :in (debugger-command-aliases c) :collect (s+ (prin1-to-string a) #\space)))) (span-to-fat-string `(:white ,(documentation (command-name (debugger-command-name c)) 'function))))) `(,(mapcar #'span-to-fat-string '((:fg-cyan "number") (:fg-white "Invoke that number restart (from the :r list)."))) ,(mapcar #'span-to-fat-string '((:fg-cyan "...") (:fg-white "Or just type a some lisp code.")))))) (make-instance 'terminal-table:terminal-table-renderer) term :print-titles nil :trailing-spaces nil) (list-restarts (cdr (compute-restarts condition))))) (defun debugger-snargle (arg) "Magic command just for me." (error "Pizza ~s ~s." arg (type-of arg))) (defun toggle-visual-mode (repl-state) (declare (ignore repl-state)) (with-slots (visual-mode) *deblarg* (setf visual-mode (not visual-mode)) (if visual-mode (start-visual) (reset-visual)))) (defun restart-number (n restarts) "Return the restart number N in RESTARTS or NIL if it's not in RESTARTS." (when (and restarts (>= n 0) (< n (length restarts))) (nth n restarts))) (defun clear-auto-restart (&key (report-p t)) "Turn off automatic restarts." (with-slots (repeat-restart repeat-condition) *thread* (setf repeat-restart nil repeat-condition nil) (when report-p (format *debug-io* "Stopping automatic restarts.~%")))) (defun do-restart (r restarts &key keep-p) "Invoke restart named R from the list of RESTARTS. If KEEP-P is true, keep the current automatic restarts set, otherwise clear them." (format *debug-io* "~:(~a~).~%" r) ;; This is like find-restart, but omits the most recent abort ;; which is this debugger's. (let ((borty (find r restarts :key #'restart-name))) (if (not borty) (format *debug-io* "Can't find an ~a restart!~%" r) (progn (when (not keep-p) (clear-auto-restart :report-p nil)) (invoke-restart-interactively borty))))) (defun restart-until (r restarts) "Repeatedly invoke a restart until we get a different condition." (with-slots (condition) *deblarg* (with-slots (repeat-condition repeat-restart) *thread* (let ((real-restart (or (restart-number r restarts) (find r restarts :key #'restart-name)))) (if (not real-restart) (format *debug-io* "Can't find an '~a' restart!~%" r) (progn (setf repeat-condition condition repeat-restart (restart-name real-restart)) (do-restart repeat-restart restarts :keep-p t))))))) (defmacro define-commands (var) `(progn ,@(loop :for c :across (symbol-value var) :collect `(define-debugger-command ,(first c) ,(second c) ,@(cddr c))))) (defun eval-print (vals) (format *debug-io* "~&~{~s~^ ;~%~}~%" vals)) (eval-when (:compile-toplevel :load-toplevel :execute) (defparameter *base-commands* #((backtrace (:b) "Backtrace stack." (print-span '((:underline "Backtrace") #\: #\newline)) (dd-backtrace (read-arg repl-state))) (wacktrace (:w) "Wacktrace." (print-span '((:underline "Backtrace") #\: #\newline)) (dd-backtrace (read-arg repl-state))) (old-backtrace (:ob) "Old backtrace." (dd-old-backtrace (read-arg repl-state))) (restarts (:r) "Show restarts." (list-restarts restarts)) (source (:src) "Show source for a frame N, which defaults to the current frame." (dd-show-source (read-arg repl-state))) (locals (:l) "Show local variables for frame N, which defaults to the current frame." (dd-show-locals (read-arg repl-state))) (snargle (:z) "Snargle" (debugger-snargle (read-arg repl-state))) (visual (:v) "Toggle visual mode." (toggle-visual-mode (read-arg repl-state))) (up-frame (:u) "Up a frame." (dd-up-frame (read-arg repl-state))) (down-frame (:d) "Down a frame." (dd-down-frame (read-arg repl-state))) (set-frame (:f) "Set the frame." (dd-set-frame (read-arg repl-state))) (top (:t) "Go to the top frame." (dd-top-frame (read-arg repl-state))) (eval-in (:ev) "Evaluate in frame N." (eval-print (multiple-value-list (let ((arg2 (read-arg repl-state)) (arg1 (read-arg repl-state))) (dd-eval-in-frame arg1 arg2))))) (error (:e) "Show the error again." (print-condition (debugger-condition *deblarg*))) (describe (:ee) "Describe the condition." (describe (debugger-condition *deblarg*))) (abort (:a :abort :pop) "Abort to top level." (do-restart 'abort restarts)) (continue (:c) "Invoke continue restart." (do-restart 'continue restarts)) (restart-until (:ru) "Invoke restart until you get a different error." (restart-until (read-arg repl-state) restarts)) (auto-restart-clear (:arc) "Clear the automatic restart." (clear-auto-restart)) ;; (next (:n) (dd-next)) ;; (step (:s) (dd-step)) ;; (out (:o) (dd-out)) (alias (:ali :alias) "Define a alias command." (defalias (read-arg repl-state) (read-arg repl-state))) (help (:h :help) "Show this help." (debugger-help)) (quit (:q :quit) "Quit the whatever." (when (y-or-n-p "Really quit? ") (format *debug-io* "We quit.~%") (finish-output) (dlib:exit-system)))))) (define-commands *base-commands*) #+tdb-has-breakpoints (progn (eval-when (:compile-toplevel :load-toplevel :execute) (defparameter *breakpoint-commands* #((list-breakpoints (:lb :lbp :list) "List breakpointss." (list-breakpoints)) (set-breakpoint (:sb :sbp :set) "Set breakpoints on function." (set-func-breakpoint (eval (read-arg repl-state)))) (toggle-breakpoint (:tb :tbp :toggle) "Toggle breakpoints." (toggle-breakpoint (read-arg repl-state)) t) (activate-breakpoint (:ab :abp :activate) "Activate breakpoints." (activate-breakpoint (read-arg repl-state)) t) (deactivate-breakpoint (:db :dbp :deactivate) "Deactivate breakpoints." (deactivate-breakpoint (read-arg repl-state)) t) (delete-breakpoint (:xb :xbp :delete) "Delete breakpoints." (delete-breakpoint (read-arg repl-state)))))) (define-commands *breakpoint-commands*)) (defun invoke-command (s &rest args) "Invoke the debugger command ‘s’ with arguments ‘args’." (let ((state (tiny-repl::make-repl-state :more (join-by-string args " ")))) (funcall (command-name (string-upcase s)) state nil))) ;; Remember we have to return non-NIL if we want to tell the REPL that we ;; handled it. (defun debugger-interceptor (value repl-state) "Handle special debugger commands, which are usually keywords." (let ((restarts (cdr (compute-restarts (debugger-condition *deblarg*))))) (cond ;; We use keywords as commands, just in case you have a variable or some ;; other symbol clash. I dunno. I 'spose we could use regular symbols, ;; and have a "print" command. ((typep value 'keyword) (let ((ks (string value)) n) ;; :r<n> restart keywords - to be compatible with CLisp (if (and (> (length ks) 1) (equal (aref ks 0) #\R) (setf n (parse-integer ks :start 1 :junk-allowed t))) ;; (invoke-restart-interactively (nth n (compute-restarts))))) ;; (format t "[Invoking restart ~d (~a)]~%" n (nth n restarts)) (invoke-restart-interactively (nth n restarts)) (let ((cmd (get-command value))) (when cmd (funcall (command-name (debugger-command-name cmd)) repl-state restarts))))) t) ;; symbols that aren't keywords ((typep value 'symbol) (let ((sym (command-name value))) (if (fboundp sym) (progn (funcall sym repl-state restarts) t) nil))) ;; Numbers invoke that numbered restart. ((typep value 'integer) (let ((r (restart-number value restarts))) (if r (invoke-restart-interactively r) (format *debug-io* "~a is not a valid restart number.~%" value))) t) (t nil)))) (defun try-to-reset-terminal () "Try to reset the terminal to a sane state so when we get in error in some program that messes with the terminal, we can still type at the debugger." (when (and *terminal* (typep *terminal* 'terminal:terminal)) (setf (terminal-input-mode *terminal*) :char) (setf (terminal-input-mode *terminal*) :line) (terminal-reset *terminal*))) ;; @@@ This hackishly knows too much about RL. (defun debugger-redraw (e) (with-slots (visual-term) *deblarg* (if visual-term (progn (terminal-clear visual-term) (terminal-beginning-of-line visual-term) (terminal-erase-to-eol visual-term) (setf (rl:screen-col e) 0) (debugger-prompt rl:*line-editor* "> ") (terminal-finish-output visual-term)) (rl::redraw-command e)) nil)) (defvar *debugger-keymap* nil "Keymap for the debugger.") (defvar *debugger-escape-keymap* nil "Escape key Keymap for the debugger.") (defun setup-keymap () (setf *debugger-keymap* (copy-keymap rl:*normal-keymap* :name '*debugger-keymap*)) (loop :for key :in (keys-bound-to 'rl::redraw-command rl:*normal-keymap*) :do (define-key *debugger-keymap* key 'debugger-redraw)) (define-key *debugger-keymap* (meta-char #\i) 'debugger-up-frame-command) (define-key *debugger-keymap* (meta-char #\o) 'debugger-down-frame-command) (setf *debugger-escape-keymap* ;; (add-keymap rl::*escape-raw-keymap* ;; (build-escape-map *debugger-keymap*))) (build-escape-map *debugger-keymap*)) (define-key *debugger-keymap* #\escape '*debugger-escape-keymap*)) (defun print-condition (c) (with-slots (term) *deblarg* (when (not (ignore-errors (print-span `((:fg-white "Condition: ") (:fg-red (:underline ,(prin1-to-string (type-of c))) #\newline ,(princ-to-string c) #\newline))) t)) (format term "Error printing condition ") (print-unreadable-object (c term :type t :identity t)) (terpri term) (describe c)))) (eval-when (:compile-toplevel :load-toplevel :execute) (defmacro with-deblargger ((frame condition) &body body) `(let ((*deblarg* (make-deblargger :condition ,condition :saved-frame ,frame))) (when (not *thread*) ;; @@@ This isn't really thread local yet. (setf *thread* (make-thread))) (when (not *debugger-keymap*) (setup-keymap)) (with-new-debugger-io (*deblarg*) ,@body)))) (defvar *deblargger-entry-hook* nil "Customize something that happens when you enter the debugger.") (defun deblarg (c hook &optional frame) "Entry point for the debugger, used as the debugger hook." (declare (ignore hook)) ;@@@ wrong (with-deblargger (frame c) (with-slots (condition) *deblarg* (with-slots (repeat-condition repeat-restart) *thread* (when repeat-restart (if (typep condition (type-of repeat-condition)) (do-restart repeat-restart (compute-restarts c) :keep-p t) (clear-auto-restart))))) ;; (progn ;; (setf repeat-restart nil ;; repeat-condition nil) ;; (format *debug-io* "Stopping automatic restarts.~%")))))) (unwind-protect (progn ;;(try-to-reset-curses) (try-to-reset-terminal) (start-visual) (when (> *repl-level* 20) (format t "Something has probably gone wrong, so I'm breaking.~%") ;; Abort assumes a restart is active, which may not be the case. ;; But break seems to work. (break)) (format *debug-io* "Entering the debugger.~a~%" (if (= (random 4) 1) (s+ " Blarg" (if (zerop (random 2)) #\. #\!)) "")) (run-hooks *deblargger-entry-hook*) (with-standard-io-syntax ;; Reset reader vars to sane values: ;; [probably uneeded since we use with-standard-io-syntax] (let ((*read-suppress* nil) (*read-base* 10) (*read-eval* t) ;; printer vars (*print-readably* nil) (*print-length* 50) ; something reasonable? (*print-pretty* nil) (*print-circle* nil)) (print-condition c) (list-restarts (compute-restarts c)) (terminal-finish-output (debugger-term *deblarg*)) (tiny-repl :interceptor #'debugger-interceptor :prompt-func #'debugger-prompt :keymap *debugger-keymap* :output *debug-io* :debug t :terminal (debugger-term *deblarg*) :no-announce t)))) ;;; (Format *debug-io* "Exiting the debugger level ~d~%" *repl-level*) (reset-visual)))) (defun in-emacs-p () "Return true if we're being run under Emacs, like probably in SLIME." (nos:env "EMACS")) (defvar *saved-debugger-hook* nil "The old value of *debugger-hook*, so we can restore it.") (defun activate (&key quietly #| full |#) (when (and (not (in-emacs-p)) (not (active-p))) (when (not quietly) (format *debug-io* "Activating the DEBLARGger.~%")) (dd-set-hook 'deblarg) (dd-activate-stepper :quietly quietly))) (defun deactivate (&key quietly #| full |#) (when (and (not (in-emacs-p)) (active-p)) (when (not quietly) (format *debug-io* "Deactivating the DEBLARGger.~%")) (dd-set-hook *saved-debugger-hook*))) (defun toggle () "Toggle the debugger on and off." (when (not (in-emacs-p)) (if (eq (dd-hook) 'deblarg) (dd-set-hook *saved-debugger-hook*) (progn (setf *saved-debugger-hook* (dd-hook)) (dd-set-hook 'deblarg))))) (defun active-p () "Return true if the debugger is set to activate." (eq (dd-hook) 'deblarg)) ;; Remove temporary features #+tbd-has-breakpoints (d-remove-feature :tdb-has-breakpoints) ;; EOF
23,480
Common Lisp
.lisp
610
33.745902
79
0.646242
nibbula/deblarg
0
0
0
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
18dbce099e45d885021e913fa67ea288f856b3db882ae8420918c3a9e9224ee7
37,242
[ -1 ]
37,243
deblarg-clisp.lisp
nibbula_deblarg/deblarg-clisp.lisp
;;; ;;; deblarg-clisp.lisp - CLisp specific parts of the debugger. ;;; (in-package :deblarg) (defconstant +all-stack-elements+ 1) (defconstant +all-frames+ 2) (defconstant +only-lexical-frames+ 3) (defconstant +only-eval-and-apply-frames+ 4) (defconstant +only-apply-frames+ 5) (defclass clisp-deblargger (deblargger) () (:documentation "Deblargger for CLisp.")) (eval-when (:compile-toplevel :load-toplevel :execute) (setf *deblargger-implementation-class* 'clisp-deblargger)) (defun frame-description (frame) (let* ((*print-length* 4) (result (with-output-to-string (str) (sys::describe-frame str frame)))) (subseq result 0 (or (position #\newline result) (length result))))) (defvar *frame-prefixes* '(("\\[[0-9]\\+\\] frame binding variables" bind-var) ("<1> #<compiled-function" compiled-fun) ("<1> #<system-function" sys-fun) ("<1> #<special-operator" special-op) ("EVAL frame" eval) ("APPLY frame" apply) ("\\[[0-9]\\+\\] compiled tagbody frame" compiled-tagbody) ("\\[[0-9]\\+\\] compiled block frame" compiled-block) ("block frame" block) ("nested block frame" block) ("tagbody frame" tagbody) ("nested tagbody frame" tagbody) ("catch frame" catch) ("handler frame" handler) ("unwind-protect frame" unwind-protect) ("driver frame" driver) ("\\[[0-9]\\+\\] frame binding environments" bind-env) ("CALLBACK frame" callback) ("- " stack-value) ("<1> " fun) ("<2> " 2nd-frame) )) (defun frame-type (frame desc) (declare (ignore frame)) ;; @@@ (loop :for prefix :in *frame-prefixes* :when (ppcre:scan (s+ "(?i)" (car prefix)) desc) :do (return (cadr prefix)))) (defun totally-fucking-boring-frame-p (frame desc) (member (frame-type frame desc) '(stack-value bind-var bind-env compiled-tagbody compiled-block))) (defmethod debugger-backtrace ((d clisp-deblargger) n) (loop :with frame = (sys::the-frame) :and i = 0 :and desc :and last :unless (totally-fucking-boring-frame-p frame (setf desc (frame-description frame))) :do (incf i) (print-span `((:fg-yellow ,(format nil "~3a" i)) ,(format nil "~(~a~)~%" desc))) :while (and (not (eq last (setf frame (sys::frame-up 1 frame ;; +all-stack-elements+ +only-eval-and-apply-frames+ )))) (or (null n) (< i n))) :do (setf last frame))) ;; Or perhaps ;; (system::print-backtrace :mode 4) ; @@@ pick different modes? (defmethod debugger-old-backtrace ((d clisp-deblargger) n) "Output a list of execution stack contexts. Try to limit it to the innermost N contexts, if we can." (declare (ignore n)) (catch 'debug (system::debug-backtrace "4"))) (declaim (inline debugger-internal-frame)) (defun debugger-internal-frame () ;; We don't want to be sorry here, so just be wrong. nil) (defmethod debugger-hook ((d (eql 'clisp-deblargger))) *debugger-hook* ;;sys::*break-driver* ) (defmethod debugger-set-hook ((d (eql 'clisp-deblargger)) function) (setf *debugger-hook* function sys::*break-driver* function)) ;; End
3,108
Common Lisp
.lisp
87
31.83908
72
0.658017
nibbula/deblarg
0
0
0
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
4cc07be7f12f76dc236baa93340f31713077c609d946de71b8fc13151ba46490
37,243
[ -1 ]
37,244
deblarg-ecl.lisp
nibbula_deblarg/deblarg-ecl.lisp
;;; ;;; deblarg-ecl.lisp - Embedded Common Lisp specific parts of the debugger. ;;; (in-package :deblarg) (defclass ecl-deblargger (deblargger) () (:documentation "Deblargger for ECL.")) (eval-when (:compile-toplevel :load-toplevel :execute) (setf *deblargger-implementation-class* 'ecl-deblargger)) (defparameter *stack-base* 0) (defun env-assoc (arg env) (loop :for a :in env :when (and (consp a) (equal (prin1-to-string (car a)) (prin1-to-string arg))) :return (cdr a))) (defun ecl-args (func frame) "Return a list of (ARG-NAME-STRING . VALUE) for each argument of FUNC in stack frame number FRAME." (let* ((ff (or (and (symbolp func) (fboundp func) (fdefinition func)) (and (functionp func) func))) (ll (ignore-errors (si::function-lambda-list func))) (env (when ll (si::decode-ihs-env (si::ihs-env frame))))) (loop :with arg :for a :in ll :do ;; (setf arg (assoc (prin1-to-string a) env :test #'equal)) (setf arg (env-assoc a env)) :when arg :collect arg))) ;; @@@ This isn't really good yet. (defun print-frame (frame &optional (stream *debug-io*)) (let* ((func (si::ihs-fun frame)) (funcp (or (functionp func) (and (symbolp func) (fboundp func)))) (args (when funcp (ecl-args func frame)))) (if funcp (progn (format stream "(~(~s~)" func) (loop :for a :in args :do (format stream " ~s" (cdr a))) (format stream ")")) (format stream "~s" func)))) (defmethod debugger-backtrace ((d ecl-deblargger) n) (loop :with top = (if n (min n (si::ihs-top)) (si::ihs-top)) :for frame :from top :above 1 :and i = 0 :then (1+ i) :do (with-simple-restart (skip-printing-frame "Skip printing deblarg frame ~d" i) (print-stack-line (cons i (with-output-to-fat-string (str) (print-frame frame str))))))) (defmethod debugger-old-backtrace ((d ecl-deblargger) n) ;; (loop :for i :from 0 :below (min (si::ihs-top) n) ;; :do (format *debug-io* "~a ~a~%" (si::ihs-fun i) #|(ecl-args i)|#)) (let* ((top (if n (min n (si::ihs-top)) (si::ihs-top))) (stack (reverse (loop :for i :from 1 :below top :collect (si::ihs-fun i))))) (loop :for s :in stack :and i = 0 :then (1+ i) :do (format *debug-io* "~3d: ~w~%" i s)))) (declaim (inline debugger-internal-frame)) (defun debugger-internal-frame () ;; We don't want to be sorry here, so just be wrong. #-(or sbcl ccl) nil) (defmethod debugger-hook ((d (eql 'ecl-deblargger))) ;; *debugger-hook* ext:*invoke-debugger-hook*) (defmethod debugger-set-hook ((d (eql 'ecl-deblargger)) function) (setf ext:*invoke-debugger-hook* function)) ;; EOF
2,672
Common Lisp
.lisp
70
34.242857
75
0.634222
nibbula/deblarg
0
0
0
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
964782031e397d4d556e6bb4b45890be18fd56f1546580c6d19009ab3e291f24
37,244
[ -1 ]
37,245
deblarg.asd
nibbula_deblarg/deblarg.asd
;;; -*- Lisp -*- ;;; deblarg.asd -- System definition for deblarg ;;; (defsystem deblarg :name "deblarg" :description "Command line Lisp debugger." :version "0.2.0" :author "Nibby Nebbulous <nibbula -(. @ .)- uucp!gmail.com>" :license "GPL-3.0-only" :source-control :git :long-description "The “Dynamic Environment Belated Lisp Activation Record Grappler”. This exists because I wanted command line editing in the debugger from my REPL. It does afford one that modicum of efficacy, but scant else. Another smidgeon of utility is a uniform interface between platforms. Otherwise, it is quite lacking of features." :depends-on (:dlib :char-util :keymap :dlib-misc :table-print :opsys :terminal :terminal-ansi :terminal-crunch :terminal-table :rl :collections :ochar :fatchar :fatchar-io :tiny-repl :reader-ext :source-path #+sbcl :sb-introspect) :components ((:file "package") (:file "base" :depends-on ("package")) (:file "deblarg" :depends-on ("base" "package")) (:module "impl" :pathname "" :depends-on ("package" "base" "deblarg") :components ((:file "deblarg-sbcl" :if-feature :sbcl) (:file "deblarg-ccl" :if-feature :ccl) (:file "deblarg-ecl" :if-feature :ecl) (:file "deblarg-clisp" :if-feature :clisp) (:file "deblarg-others" :if-feature (:not (:or :sbcl :ccl :ecl :clisp)))))))
1,499
Common Lisp
.asd
35
37.742857
78
0.631687
nibbula/deblarg
0
0
0
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
c02f5705da373a5d5630fcb6f2335f39f192aac03474a601e3ec6842c7bcb4e1
37,245
[ -1 ]
37,246
source-path.asd
nibbula_deblarg/source-path.asd
;;; -*- Lisp -*- ;;; source-path.asd - System definition for source-path ;;; (defsystem source-path :name "source-path" :description "Source paths" :version "0.1.0" :author "Nibby Nebbulous <nibbula -(. @ .)- uucp!gmail.com>" :license "GPL-3.0-only" :source-control :git :long-description "Source paths, for CMU derived Lisps." :depends-on (:reader-ext) :components ((:file "source-path")))
496
Common Lisp
.asd
14
31.5
76
0.557173
nibbula/deblarg
0
0
0
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
4d511f1517318705b5e80ca27fdae0754bfcf8fdaa18372c3eff21ed058a7e41
37,246
[ -1 ]
37,273
text-style-mixins.lisp
open-rsx_rsb-tools-cl/test/formatting/text-style-mixins.lisp
;;;; text-style--mixins.lisp --- Unit tests for the text style mixin classes. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) ;;; `separator-mixin' ;; Mock formatter class (defclass mock-style-separator (separator-mixin) () (:documentation "Unit tests for the `separator-mixin' formatting style class.")) (defmethod format-event ((event event) (style mock-style-separator) (stream stream) &key &allow-other-keys) (princ #\* stream)) (deftestsuite separator-mixin-root (formatting-root) () (:documentation "Unit tests for the `separator-mixin' class.")) (addtest (separator-mixin-root :documentation "Test constructing `separator-mixin' instances.") construction (ensure-cases (args expected) '(((:separator 5) :error) ((:separator (:hrule #\-)) :error) ((:separator (:rule)) :error) ((:separator "bla") nil) ((:separator ("a" #\-)) nil) ((:separator (:rule #\=)) nil)) (when (eq expected :error) (ensure-condition 'error (apply #'make-instance 'separator-mixin args))))) (addtest (separator-mixin-root :documentation "Test some simple cases of formatting events using methods on `format-event' for `separator-mixin'.") smoke (ensure-style-cases (mock-style-separator) `((:separator nil) (,(make-event "/a" "b") ,(make-event "/c" "d")) "\\*\\*") `((:separator (:rule #\-)) (,(make-event "/a" "b") ,(make-event "/c" "d")) "--------------------------------------------------------------------------------\\*--------------------------------------------------------------------------------\\*") `((:separator "&&&") (,(make-event "/a" "b") ,(make-event "/c" "d")) "&&&\\*&&&\\*"))) ;;; `max-lines-mixin' ;; Mock formatter class (defclass mock-style-max-lines (max-lines-mixin) ()) (defmethod format-event ((event t) (style mock-style-max-lines) (target t) &key) (pprint-logical-block (target (list event)) (dotimes (i 3) (format target "~D~%" i)))) (deftestsuite max-lines-mixin-root (formatting-root) () (:documentation "Test suite for the `max-lines-mixin' mixin class.")) (addtest (max-lines-mixin-root :documentation "Test constructing `max-lines-mixin' instances.") construction (ensure-cases (initargs) '(() (:max-lines nil) (:max-lines 10)) (apply #'make-instance 'max-lines-mixin initargs))) (addtest (max-lines-mixin-root :documentation "Test some simple cases of formatting events using methods on `format-event' for `max-lines-mixin'.") smoke (ensure-style-cases (mock-style-max-lines) `((:max-lines nil) (,(make-event "/a" "b")) "0 1 2") `((:max-lines 2) (,(make-event "/a" "b")) "0 1 .."))) ;;; `width-specification-mixin' (deftestsuite width-specification-mixin-root (formatting-root) () (:documentation "Test suite for the `width-specification-mixin' mixin class.")) (addtest (width-specification-mixin-root :documentation "Test constructing `width-specification-mixin' instances.") construction (ensure-cases (initargs expected) '(;; Some invalid initarg combinations. (() missing-required-initarg) ((:priority 3) missing-required-initarg) ((:width 1 :widths 2) incompatible-initargs) ((:width 2 :widths (:range 5)) incompatible-initargs) ;; Invalid width specifications. ((:widths :foo) type-error) ((:widths (1 :foo)) type-error) ((:widths (:range 2 1)) type-error) ;; These are valid. ((:width 0) t) ((:width 1) t) ((:widths (1)) t) ((:widths (1 2)) t) ((:widths (:range 1)) t) ((:widths (:range 1 2)) t) ((:widths ((:range 1))) t) ((:widths ((:range 1 2))) t) ((:width 1 :widths 1) t) ((:width 5 :widths (:range 2)) t)) (flet ((do-it () (apply #'make-instance 'width-specification-mixin initargs))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (incompatible-initargs (ensure-condition incompatible-initargs (do-it))) (type-error (ensure-condition type-error (do-it))) (t (do-it)))))) ;;; `width-mixin' (deftestsuite width-mixin-root (formatting-root) () (:documentation "Test suite for the `width-mixin' mixin class.")) (addtest (width-mixin-root :documentation "Test method on `format-event' for `width-mixin'.") format-event (ensure-style-cases (mock-column) '(;; No data => no output () () "") ;; short data => aligned padding '((:width 8 :alignment :right) ("foo" "bar") " foo bar") ;; short data => aligned padding '((:width 8 :alignment :left) ("foo" "bar") "foo bar ") ;; long data => aligned truncation '((:width 2 :alignment :right) ("foo" "bar") "…o…r") ;; long data => aligned truncation '((:width 2 :alignment :left) ("foo" "bar") "f…b…"))) (addtest (width-mixin-root :documentation "Test method on `format-header' for `width-mixin'.") format-header (ensure-style-cases (mock-column :formatter :format-header) '(;; No data => no output () () "") ;; short data => aligned padding '((:width 8 :alignment :right) ("foo" "bar") "My mock…My mock…") ;; short data => aligned padding '((:width 8 :alignment :left) ("foo" "bar") "My mock…My mock…") ;; long data => aligned truncation '((:width 2 :alignment :right) ("foo" "bar") "M…M…") ;; long data => aligned truncation '((:width 2 :alignment :left) ("foo" "bar") "M…M…"))) ;;; `columns-mixin' (deftestsuite columns-mixin-root (formatting-root) () (:documentation "Test suite for the `columns-mixin' mixin class.")) (addtest (columns-mixin-root :documentation "Test construction of the `columns-mixin' class.") construction (ensure-cases (args expected) '(;; Invalid constructions ((:columns (5)) :error) ((:columns (())) :error) ((:columns (:no-such-column-class)) :error) ;; These are ok (() nil) ((:columns ()) nil) ((:separator "=") nil) ((:columns (:mock)) (mock-column)) ((:columns ((:mock :width 2))) (mock-column))) (if (eq expected :error) (ensure-condition 'error (apply #'make-instance 'columns-mixin args)) (let ((instance (apply #'make-instance 'columns-mixin args))) (ensure-same (map 'list #'class-of (style-columns instance)) (map 'list #'find-class expected) :test #'equal))))) (addtest (columns-mixin-root :documentation "Test the method on `format-event' for `columns-mixin' which should format events according to the column specification of the style.") format-event (ensure-style-cases (columns-mixin) ;; no columns, no events => no output '(() () "") ;; events, but no columns => no output '(() ("/foo/bar") "") ;; single column => separator should not be printed '((:columns ((:mock :width 16 :alignment :left)) :separator "!") ("/foo/bar/") "/foo/bar/ ") ;; two columns => separator should be printed '((:columns ((:mock :width 16 :alignment :right) (:mock :width 8 :alignment :left)) :separator "!") ("/foo/bar/") " /foo/bar/!/foo/ba…"))) (addtest (columns-mixin-root :documentation "Test the method on `format-header' for `columns-mixin' which should format headers according to the column specification of the style.") format-header (ensure-style-cases (columns-mixin :formatter :format-header) ;; no columns, no events => no output '(() () "") ;; events, but no columns => no output '(() ("/foo/bar") "") ;; single column => separator should not be printed '((:columns ((:mock :width 16 :alignment :left)) :separator "!") ("/foo/bar/") "My mock header ") ;; two columns => separator should be printed '((:columns ((:mock :width 16 :alignment :right) (:mock :width 8 :alignment :left)) :separator "!") ("/foo/bar/") "My mock header !My mock…"))) ;; Local Variables: ;; coding: utf-8 ;; End:
9,333
Common Lisp
.lisp
264
28.284091
175
0.539695
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
d88b916ac7ef4151f01d98d059dee46f709389c73e31b50aafec860bb7e1f101
37,273
[ -1 ]
37,274
protocol.lisp
open-rsx_rsb-tools-cl/test/formatting/protocol.lisp
;;;; protocol.lisp --- Unit tests for the protocol of the formatting module. ;;;; ;;;; Copyright (C) 2014 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) (deftestsuite formatting-protocol-root (formatting-root) () (:documentation "Test suite for the protocol of the formatting module.")) (addtest (formatting-protocol-root :documentation "Smoke test for the `make-style' generic function.") make-style/smoke (ensure-cases (args expected) `(;; Non-existent style. ((:no-such-style) style-creation-error) (((:no-such-style)) style-creation-error) (((:no-such-style :baz 2)) style-creation-error) ((:no-such-style :bar 1) style-creation-error) (((:no-such-style) :bar 1) style-creation-error) (((:no-such-style :baz 2) :bar 1) style-creation-error) ;; Cannot add initargs to already constructed instance. ((,(make-style :compact) :foo 1) style-creation-error) ;; These are OK. ((:compact) t) (((:compact)) t) (((:compact :header-frequency 2)) t) ((:compact :header-frequency 2) t) (((:compact) :header-frequency 2) t) (((:compact :count 0) :header-frequency 2) t)) (let+ (((&flet do-it () (apply #'make-style args)))) (ecase expected (style-creation-error (ensure-condition style-creation-error (do-it))) ((t) (do-it))))))
1,703
Common Lisp
.lisp
37
39.432432
76
0.542771
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
eef739574432ad4f124a759e0415bd215194a57fcd7d3499a5314cacd6af5361
37,274
[ -1 ]
37,275
style-columns.lisp
open-rsx_rsb-tools-cl/test/formatting/style-columns.lisp
;;;; style-columns.lisp --- Unit tests for the columns formatting style. ;;;; ;;;; Copyright (C) 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) (deftestsuite style-columns-root (formatting-root) () (:documentation "Unit tests for the `style-columns' formatting style class.")) (addtest (style-columns-root :documentation "Test some simple cases of formatting events using methods on `format-event' for `style-columns'.") smoke (let ((*print-right-margin* 80)) (ensure-style-cases (style-columns) '(() () "") `((:header-frequency nil :columns ((:scope :width 10))) (,(make-event "/foo" "bar")) "/foo/ ") `((:header-frequency nil :columns ((:scope :width 10) (:data :width 10))) (,(make-event "/foo" "bar")) "/foo/ │\"bar\" ") `((:header-frequency 1 :columns ((:scope :width 10) :newline)) (,(make-event "/foo" "bar")) "Scope /foo/ ")))) ;; Local Variables: ;; coding: utf-8 ;; End:
1,123
Common Lisp
.lisp
34
27.558824
79
0.590194
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
67dc7c8b1aefa22cefdbef7b300d4b0c40782c9eb2020d77d127fb882d37e995
37,275
[ -1 ]
37,276
style-detailed.lisp
open-rsx_rsb-tools-cl/test/formatting/style-detailed.lisp
;;;; style-detailed.lisp --- Unit tests for the detailed formatting style. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) (deftestsuite style-detailed-root (formatting-root) () (:documentation "Unit tests for the `style-detailed' formatting style class.")) (addtest (style-detailed-root :documentation "Test some simple cases of formatting events using methods on `format-event' for `style-detailed'.") smoke (ensure-style-cases (style-detailed) '(() () "") `(() (,(make-event "/foo" "bar")) ,(format nil " ~80,,,VA Event Scope /foo/ Id <none> Sequence number <none> Origin <none> Method <none> Timestamps create .* send <none> receive <none> deliver <none> Payload: STRING, 3 characters \"bar\"" (if *output-unicode?* #\─ #\-) "")) `(() (,(make-event "/foo/bar/baz" 1 :fez "whoop")) ,(format nil " ~80,,,VA Event Scope /foo/bar/baz/ Id <none> Sequence number <none> Origin <none> Method <none> Timestamps create .* send <none> receive <none> deliver <none> Meta-Data FEZ \"whoop\" Payload: .* 1" (if *output-unicode?* #\─ #\-) "")) `(() (,(make-event "/foo/bar/baz" (nibbles:octet-vector 1 2 255))) ,(format nil " ~80,,,VA Event Scope /foo/bar/baz/ Id <none> Sequence number <none> Origin <none> Method <none> Timestamps create .* send <none> receive <none> deliver <none> Payload: .*, 3 octets 0 01 02 FF ... *" (if *output-unicode?* #\─ #\-) ""))))
1,862
Common Lisp
.lisp
75
20.826667
74
0.547042
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
dae9be9041299b9fa83dd9f58bbd605ae4db3b928a05ef68cd3033dd80b8a6d7
37,276
[ -1 ]
37,277
style-json.lisp
open-rsx_rsb-tools-cl/test/formatting/style-json.lisp
;;;; style-json.lisp --- Unit tests for the JSON formatting style. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) (deftestsuite style-json-root (formatting-root) () (:documentation "Unit tests for the `style-json' formatting style class.")) (defun make-vector-of-octet-vectors () (map 'vector #'nibbles:octet-vector (iota 3))) (defclass vector-of-octet-vectors-slot () ((vector-of-octet-vectors :initarg :vector-of-octet-vectors :type (array nibbles:octet-vector (*)) :initform (make-vector-of-octet-vectors)))) (addtest (style-json-root :documentation "Test some simple cases of formatting events using methods on `format-event' for `style-json'.") smoke (ensure-style-cases (style-json) ;; Some payloads. `(() (,(make-event "/foo" "bar")) ,(format nil "{\"scope\":\"\\\\/foo\\\\/\",\"metaData\":{},~ \"timestamp\":{\"create\":\"[^\"]+\"},\"cause\":\\[],~ \"data\":\"bar\"}")) `(() (,(make-event "/foo" 1)) ,(format nil "{\"scope\":\"\\\\/foo\\\\/\",\"metaData\":{},~ \"timestamp\":{\"create\":\"[^\"]+\"},\"cause\":\\[],~ \"data\":1}")) `(() (,(make-event "/foo" (make-instance 'rsb.protocol:notification))) ,(format nil "{\"scope\":\"\\\\/foo\\\\/\",\"metaData\":{},~ \"timestamp\":{\"create\":\"[^\"]+\"},\"cause\":\\[],~ \"data\":{\"scope\":\\[],\"method\":\\[],\"wireSchema\":\\[],~ \"data\":\\[],\"eventId\":{\"senderId\":\\[],\"sequenceNumber\":0},~ \"causes\":\\[],\"metaData\":{\"createTime\":0,\"sendTime\":0,~ \"receiveTime\":0,\"deliverTime\":0,\"userTimes\":\\[],~ \"userInfos\":\\[]}}}")) `(() (,(make-event "/foo" (make-instance 'vector-of-octet-vectors-slot))) ,(format nil "{\"scope\":\"\\\\/foo\\\\/\",\"metaData\":{},~ \"timestamp\":{\"create\":\"[^\"]+\"},\"cause\":\\[],~ \"data\":{\"vectorOfOctetVectors\":\\[\\[0],\\[1],\\[2]]}}")) ;; Meta-data `(() (,(make-event "/foo" 1 :method :|method|)) ,(format nil "{\"scope\":\"\\\\/foo\\\\/\",\"method\":\"method\",\"metaData\":{},~ \"timestamp\":{\"create\":\"[^\"]+\"},\"cause\":\\[],~ \"data\":1}")) `(() (,(make-event "/foo" 1 :foo "bar")) ,(format nil "{\"scope\":\"\\\\/foo\\\\/\",\"metaData\":{\"foo\":\"bar\"},~ \"timestamp\":{\"create\":\"[^\"]+\"},\"cause\":\\[],~ \"data\":1}")) `(() (,(make-event "/foo" 1 :timestamps `(:baz ,(local-time:now)))) ,(format nil "{\"scope\":\"\\\\/foo\\\\/\",\"metaData\":{},~ \"timestamp\":{\"create\":\"[^\"]+\",\"baz\":\"[^\"]+\"},~ \"cause\":\\[],~ \"data\":1}")) `(() (,(make-event "/foo" 1 :causes `(,(cons (uuid:make-null-uuid) 0)))) ,(format nil "{\"scope\":\"\\\\/foo\\\\/\",\"metaData\":{},~ \"timestamp\":{\"create\":\"[^\"]+\"},~ \"cause\":\\[\"2583F0ED-4C6A-59D3-A061-AD9AF50616C6\"],~ \"data\":1}"))))
3,442
Common Lisp
.lisp
70
38.085714
89
0.432224
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
c671055dc5539dc89122cf2fb0159e2027f12ea683678d5c7dcb9ac6ea9b754d
37,277
[ -1 ]
37,278
mock-column.lisp
open-rsx_rsb-tools-cl/test/formatting/mock-column.lisp
;;;; mock-column.lisp --- A mock column class for tests. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) (defclass mock-column (width-mixin) ()) (service-provider:register-provider/class 'rsb.formatting::column :mock :class 'mock-column) (defmethod format-header ((thing mock-column) (target t)) (format target "My mock header")) (defmethod format-event ((event t) (style mock-column) (target t) &key &allow-other-keys) (format target "~A" event))
668
Common Lisp
.lisp
18
29.833333
61
0.609302
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
9e8a1281fbacb0a3cfb43434bd972e725e04f022d0eb840dfd638d43fd7f07a2
37,278
[ -1 ]
37,279
style-multiple-files.lisp
open-rsx_rsb-tools-cl/test/formatting/style-multiple-files.lisp
;;;; style-multiple-files.lisp --- Unit tests for the multiple file style. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) (deftestsuite style-multiple-files-root (formatting-root) () (:documentation "Unit tests for the `style-multiple-files' formatting style class.")) (addtest (style-multiple-files-root :documentation "Test constructing instances of the `style-multiple-files' formatting style class.") construct (ensure-cases (initargs &optional expected) '(;; Some invalid cases. (() missing-required-initarg) ((:filename-template "${count}") missing-required-initarg) ((:filename-style :detailed) missing-required-initarg) ((:event-style :detailed) missing-required-initarg) ((:filename-template "${count}" :filename-style :detailed :event-style :detailed) incompatible-initargs) ;; These are OK. ((:filename-template "${count}" :event-style :detailed)) ((:filename-style :detailed :event-style :detailed))) (flet ((do-it () (apply #'make-instance 'style-multiple-files initargs))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (incompatible-initargs (ensure-condition incompatible-initargs (do-it))) (t (do-it))))))
1,611
Common Lisp
.lisp
40
32.325
74
0.605499
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
5a2b95ccae33dc7c84baa7806196b06588d1bc09295f2bf7d5c77b62721d6f7a
37,279
[ -1 ]
37,280
dynamic-width.lisp
open-rsx_rsb-tools-cl/test/formatting/dynamic-width.lisp
;;;; dynamic-width.lisp --- Unit test for the width computation code. ;;;; ;;;; Copyright (C) 2014 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) (deftestsuite dynamic-width-root (formatting-root) () (:documentation "Unit tests for the `optimize-widths' function.")) (addtest (dynamic-width-root :documentation "Smoke test for the `optimize-widths' function.") optimize-widths/smoke (ensure-cases ((width specs priorities &optional separator) expected) '(;; Some illegal cases. ((0 (1) ()) error) ((0 () (1)) error) ;; These are OK. ((0 () ()) :empty) ((50 () ()) t) ((0 ((:range 5 10)) (3)) :empty) ((50 ((:range 5 10)) (3)) t) ((9 ((:range 5 10)) (3)) :full) ((0 ((:range 5 10) (:range 3 6)) (3 5)) :empty) ((50 ((:range 5 10) (:range 3 6)) (3 5)) t) ((12 ((:range 5 10) (:range 3 6)) (3 5)) :full) ((0 (5 ((:range 3 4) 7)) (3 5)) :empty) ((50 (5 ((:range 3 4) 7)) (3 5)) t) ((9 (5 ((:range 3 4) 7)) (3 5)) :full) ((12 (5 ((:range 3 4) 7)) (3 5)) :full)) (let+ (((&flet do-it () (let+ (((&values result score) (apply #'optimize-widths width specs priorities (when separator `(:separator-length ,(length separator)))))) (values result (reduce #'+ result) score))))) (ecase expected (error (ensure-condition error (do-it))) ((:empty :full t) (let+ (((&values result sum score) (do-it))) (ensure-same (length result) (length specs) :test #'=) (ecase expected (:empty (ensure-same sum 0 :test #'=) (ensure-same score 0 :test #'=)) (:full (ensure-same sum width :test #'=) (ensure (plusp score))) ((t) (ensure (<= sum width)) (ensure (typep score 'non-negative-integer))))))))))
2,342
Common Lisp
.lisp
54
33.185185
75
0.444932
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
e6d5608903c8c5d86856146d1b166da6b9eac2fc7ff17981fe898786365f54a5
37,280
[ -1 ]
37,281
orders-of-magnitude.lisp
open-rsx_rsb-tools-cl/test/formatting/orders-of-magnitude.lisp
;;;; orders-of-magnitude.lisp --- Unit test for orders of magnitude functions. ;;;; ;;;; Copyright (C) 2015 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) (deftestsuite orders-of-magnitude-root (formatting-root) () (:documentation "Unit tests for the \"orders of magnitude\" functions.")) (macrolet ((define-print-human-readable-test ((test-name function-name) &rest cases) (let ((documentation (format nil "Smoke test for the `~(~A~)' function." function-name))) `(addtest (orders-of-magnitude-root :documentation ,documentation) ,test-name (ensure-cases (number expected-1 expected-2 expected-3 expected-4) '(,@cases) (let+ (((&flet do-it (colon? at? expected) (let ((result (with-output-to-string (stream) (,function-name stream number colon? at?)))) (ensure-same result expected :test #'string=))))) (do-it nil nil expected-1) (do-it nil t expected-2) (do-it t nil expected-3) (do-it t t expected-4))))))) (define-print-human-readable-test (print-human-readable-order-of-magnitude/smoke print-human-readable-order-of-magnitude) ;; Not a suitable input ("foo" " foo" " foo" " foo" " foo") ;; Special cases (0 " 0 " " 0 " " 0 " " 0 ") (0.0 " 0 " " 0 " " 0 " " 0 ") (-0.0 " 0 " " 0 " " 0 " " 0 ") (1 " 1 " " 1 " "+ 1 " "+ 1 ") (-1 " 1 " " 1 " "- 1 " "- 1 ") ;; Rounding (-0.6 "600m" "600 milli" "-600m" "-600 milli") (-0.5 "500m" "500 milli" "-500m" "-500 milli") (-0.4 "400m" "400 milli" "-400m" "-400 milli") ( 0.4 "400m" "400 milli" "+400m" "+400 milli") ( 0.5 "500m" "500 milli" "+500m" "+500 milli") ( 0.6 "600m" "600 milli" "+600m" "+600 milli") ;; Corner cases (9 " 9 " " 9 " "+ 9 " "+ 9 ") (-9 " 9 " " 9 " "- 9 " "- 9 ") (9.001 "9.0 " "9.0 " "+9.0 " "+9.0 ") (10 " 10 " " 10 " "+ 10 " "+ 10 ") (999 "999 " "999 " "+999 " "+999 ") (1000 " 1K" " 1 kilo" "+ 1K" "+ 1 kilo") (10000000/1001299 " 10 " " 10 " "+ 10 " "+ 10 ")) (define-print-human-readable-test (print-human-readable-count/smoke print-human-readable-count) ;; Not a suitable input ("foo" " foo" " foo" " foo" " foo") ;; Special cases (0 " 0 " " 0 " " 0 " " 0 ") (0.0 " 0 " " 0 " " 0 " " 0 ") (-0.0 " 0 " " 0 " " 0 " " 0 ") (1 " 1 " " 1 " "+ 1 " "+ 1 ") (-1 " 1 " " 1 " "- 1 " "- 1 ") ;; Rounding (-0.6 "0.6 " "0.6 " "-0.6 " "-0.6 ") (-0.5 "0.5 " "0.5 " "-0.5 " "-0.5 ") (-0.4 "0.4 " "0.4 " "-0.4 " "-0.4 ") ( 0.4 "0.4 " "0.4 " "+0.4 " "+0.4 ") ( 0.5 "0.5 " "0.5 " "+0.5 " "+0.5 ") ( 0.6 "0.6 " "0.6 " "+0.6 " "+0.6 ") ;; Corner cases (9 " 9 " " 9 " "+ 9 " "+ 9 ") (-9 " 9 " " 9 " "- 9 " "- 9 ") (9.001 "9.0 " "9.0 " "+9.0 " "+9.0 ") (10 " 10 " " 10 " "+ 10 " "+ 10 ") (999 "999 " "999 " "+999 " "+999 ") (1000 " 1K" " 1 kilo" "+ 1K" "+ 1 kilo") (10000000/1001299 " 10 " " 10 " "+ 10 " "+ 10 ")) (define-print-human-readable-test (print-human-readable-size/smoke print-human-readable-size) ;; Not a suitable input ("foo" " foo" " foo" " foo" " foo") ;; Special cases (0 " 0 B" " 0 Bytes" " 0 B" " 0 Bytes") (0.0 " 0 B" " 0 Bytes" " 0 B" " 0 Bytes") (-0.0 " 0 B" " 0 Bytes" " 0 B" " 0 Bytes") (1 " 1 B" " 1 Byte" "+ 1 B" "+ 1 Byte") (-1 " 1 B" " 1 Byte" "- 1 B" "- 1 Byte") ;; Rounding (-0.6 "0.6 B" "0.6 Bytes" "-0.6 B" "-0.6 Bytes") (-0.5 "0.5 B" "0.5 Bytes" "-0.5 B" "-0.5 Bytes") (-0.4 "0.4 B" "0.4 Bytes" "-0.4 B" "-0.4 Bytes") ( 0.4 "0.4 B" "0.4 Bytes" "+0.4 B" "+0.4 Bytes") ( 0.5 "0.5 B" "0.5 Bytes" "+0.5 B" "+0.5 Bytes") ( 0.6 "0.6 B" "0.6 Bytes" "+0.6 B" "+0.6 Bytes") ;; Corner cases (9 " 9 B" " 9 Bytes" "+ 9 B" "+ 9 Bytes") (-9 " 9 B" " 9 Bytes" "- 9 B" "- 9 Bytes") (9.001 "9.0 B" "9.0 Bytes" "+9.0 B" "+9.0 Bytes") (10 " 10 B" " 10 Bytes" "+ 10 B" "+ 10 Bytes") (999 "999 B" "999 Bytes" "+999 B" "+999 Bytes") (1000 " 1KB" " 1 kiloByte" "+ 1KB" "+ 1 kiloByte") (10000000/1001299 " 10 B" " 10 Bytes" "+ 10 B" "+ 10 Bytes")) (define-print-human-readable-test (print-human-readable-duration/smoke print-human-readable-duration) ;; Not a suitable input ("foo" " foo" " foo" " foo" " foo") ;; Special cases (0 " 0 s" " 0 seconds" " 0 s" " 0 seconds") (0.0 " 0 s" " 0 seconds" " 0 s" " 0 seconds") (-0.0 " 0 s" " 0 seconds" " 0 s" " 0 seconds") (1 " 1 s" " 1 second" "+ 1 s" "+ 1 second") (-1 " 1 s" " 1 second" "- 1 s" "- 1 second") ;; Rounding (-0.6001 "600ms" "600 milliseconds" "-600ms" "-600 milliseconds") (-0.4999 "500ms" "500 milliseconds" "-500ms" "-500 milliseconds") (-0.4 "400ms" "400 milliseconds" "-400ms" "-400 milliseconds") ( 0.4 "400ms" "400 milliseconds" "+400ms" "+400 milliseconds") ( 0.5 "500ms" "500 milliseconds" "+500ms" "+500 milliseconds") ( 0.6 "600ms" "600 milliseconds" "+600ms" "+600 milliseconds") ;; Corner cases (9 " 9 s" " 9 seconds" "+ 9 s" "+ 9 seconds") (-9 " 9 s" " 9 seconds" "- 9 s" "- 9 seconds") (9.001 "9.0 s" "9.0 seconds" "+9.0 s" "+9.0 seconds") (10 " 10 s" " 10 seconds" "+ 10 s" "+ 10 seconds") (999 " 17 m" " 17 minutes" "+ 17 m" "+ 17 minutes") (1000 " 17 m" " 17 minutes" "+ 17 m" "+ 17 minutes") (10000000/1001299 " 10 s" " 10 seconds" "+ 10 s" "+ 10 seconds")))
7,073
Common Lisp
.lisp
128
48.578125
79
0.385181
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
855b3dca0f1513af83d65cff321497fb8b50be423c6db67534cf0727c4bb3a51
37,281
[ -1 ]
37,282
style-meta-data.lisp
open-rsx_rsb-tools-cl/test/formatting/style-meta-data.lisp
;;;; style-meta-data.lisp --- Unit tests for the meta-data formatting style. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) (deftestsuite style-meta-data-root (formatting-root) () (:documentation "Unit tests for the `style-meta-data' formatting style class.")) (addtest (style-meta-data-root :documentation "Test some simple cases of formatting events using methods on `format-event' for `style-meta-data'.") smoke (ensure-style-cases (style-meta-data) '(() () "") `(() (,(make-event "/foo" "bar")) ,(format nil " ~80,,,VA Event Scope /foo/ Id <none> Sequence number <none> Origin <none> Method <none> Timestamps create .* send <none> receive <none> deliver <none>" (if *output-unicode?* #\─ #\-) "")) `(() (,(make-event "/foo/bar/baz" 1 :fez "whoop")) ,(format nil " ~80,,,VA Event Scope /foo/bar/baz/ Id <none> Sequence number <none> Origin <none> Method <none> Timestamps create .* send <none> receive <none> deliver <none> Meta-Data FEZ \"whoop\"" (if *output-unicode?* #\─ #\-) "")) `(() (,(let ((event (make-event "/foo/bar/baz" 1))) (setf (timestamp event :foo) (local-time:now)) event)) ,(format nil " ~80,,,VA Event Scope /foo/bar/baz/ Id <none> Sequence number <none> Origin <none> Method <none> Timestamps create .* send <none> receive <none> deliver <none> \\*foo .*" (if *output-unicode?* #\─ #\-) ""))))
1,803
Common Lisp
.lisp
72
20.680556
76
0.548312
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
6cc6113419011ce985304fc38978e5715054dacb196b91fe6107cd9f467cb82b
37,282
[ -1 ]
37,283
style-mixins.lisp
open-rsx_rsb-tools-cl/test/formatting/style-mixins.lisp
;;;; delegating-mixin.lisp --- Tests for the delegating-mixin mixin class. ;;;; ;;;; Copyright (C) 2011, 2013, 2014 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) ;;; `delegating-mixin' (deftestsuite delegating-mixin-root (formatting-root) () (:documentation "Test suite for the `delegating-mixin' mixin class.")) (addtest (delegating-mixin-root :documentation "Test method on `format-event' for `delegating-mixin' mixin class.") format-event (ensure-style-cases (delegating-mixin) ;; No data => no output '(() () "") ;; Unconditionally dispatch to a single sub-style `((:sub-styles ((,(constantly t) . ,(make-instance 'mock-column :width 8)))) ("foo" "bar") " foo bar") ;; No matching sub-style is not an error `((:sub-styles ((,#'stringp . ,(make-instance 'mock-column :width 4)))) ("foo" 5 t) " foo") ;; Two sub-styles `((:sub-styles ((,#'oddp . ,(make-instance 'mock-column :width 8 :alignment :left)) (,#'evenp . ,(make-instance 'mock-column :width 8 :alignment :right)))) (1 2 3 4) "1 23 4"))) ;;; `activity-based-sub-style-pruning-mixin' (deftestsuite activity-based-sub-style-pruning-mixin-root (formatting-root) () (:documentation "Unit tests for the `activity-based-sub-style-pruning-mixin' class.")) (addtest (activity-based-sub-style-pruning-mixin-root :documentation "Test constructing `activity-based-sub-style-pruning-mixin' instances") construct (ensure-cases (initargs expected) `(;; Some invalid cases ((:prune-after 5 :prune-predicate ,#'identity) incompatible-initargs) ;; These should be ok (() t) ((:prune-after 5) t) ((:prune-predicate ,#'identity) t) ((:prune-predicate nil) t)) (let+ (((&flet do-it () (apply #'make-instance 'activity-based-sub-style-pruning-mixin initargs)))) (case expected (incompatible-initargs (ensure-condition 'incompatible-initargs (do-it))) (t (do-it)))))) ;;; `temporal-bounds-mixin' (deftestsuite temporal-bounds-mixin-root (formatting-root) () (:documentation "Unit tests for the `temporal-bounds-mixin' class.")) (addtest (temporal-bounds-mixin-root :documentation "Test constructing `temporal-bounds-mixin' instances.") construct (ensure-cases (initargs expected-bounds &optional now expected-bounds/expanded) '(;; Some invalid cases. ((:lower-bound "now") type-error) ((:lower-bound :now :upper-bound :now) type-error) ((:lower-bound (+ :now 2) :upper-bound :now) type-error) ;; These should be ok (() ((- :now 20) :now) 0 (-20000000000 0))) (let+ (((&flet do-it () (apply #'make-instance 'temporal-bounds-mixin initargs)))) (case expected-bounds (type-error (ensure-condition 'type-error (do-it))) (t (let ((thing (do-it))) (ensure-same expected-bounds (bounds thing) :test #'equal) (ensure-same expected-bounds/expanded (bounds/expanded thing now) :test #'equal)))))))
3,775
Common Lisp
.lisp
91
32.21978
92
0.539574
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
68ef16846d8340f04cb7c8a9557d3cece20c4d921836aa807d90fa350f13508b
37,283
[ -1 ]
37,284
style-compact.lisp
open-rsx_rsb-tools-cl/test/formatting/style-compact.lisp
;;;; style-compact.lisp --- Unit tests for the compact formatting style. ;;;; ;;;; Copyright (C) 2011, 2012, 2013, 2014, 2015 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) (deftestsuite style-compact-root (formatting-root) () (:documentation "Unit tests for the `style-compact' formatting style class.")) (addtest (style-compact-root :documentation "Test some simple cases of formatting events using methods on `format-event' for `style-compact'.") smoke (let ((*print-right-margin* 80)) (ensure-style-cases (event-style-compact) '(() () "") `((:header-frequency nil) (,(make-event "/foo" "bar")) ".*│EVENTID…│<nomethod>│/foo/ │\"bar\" │WIRE-SC…│ 3 B|ORIGIN?. ") `((:header-frequency nil) (,(make-event "/foo" "bar") ,(make-event "/fez" "whoop")) ".*│EVENTID…│<nomethod>│/foo/ │\"bar\" │WIRE-SC…│ 3 B|ORIGIN?. .*│EVENTID…│<nomethod>│/fez/ │\"whoop\" │WIRE-SC…│ 5 B|ORIGIN?. "))) (let ((*print-right-margin* 128)) (ensure-style-cases (event-style-compact) '(() () "") `((:header-frequency nil) (,(make-event "/foo" "bar")) ".*│EVENTID…│<nomethod>│/foo/ │\"bar\" │WIRE-SCHEMA\\? │ 3 B│ORIGIN\\? │ NIL ") `((:header-frequency nil) (,(make-event "/foo" "bar") ,(make-event "/fez" "whoop")) ".*│EVENTID…│<nomethod>│/foo/ │\"bar\" │WIRE-SCHEMA\\? │ 3 B│ORIGIN\\? │ NIL .*│EVENTID…│<nomethod>│/fez/ │\"whoop\" │WIRE-SCHEMA\\? │ 5 B│ORIGIN\\? │ NIL ")))) ;; Local Variables: ;; coding: utf-8 ;; End:
1,917
Common Lisp
.lisp
46
34.26087
130
0.525568
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
6a1824c160a23c90b325d37a4c99c72d76da89d6a947b204cf3b07d30e0fce7b
37,284
[ -1 ]
37,285
style-programmable.lisp
open-rsx_rsb-tools-cl/test/formatting/style-programmable.lisp
;;;; style-programmable.lisp --- Unit tests for the programmable formatting style. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.test) ;;; Test suite for `style-programmable' class (deftestsuite style-programmable-root (formatting-root) () (:documentation "Unit tests for the `style-programmable' formatting style class.")) (addtest (style-programmable-root :documentation "Test constructing `style-programmable' instances.") construct (ensure-cases (args expected) '(;; Missing required initargs. (() error) ((:bindings nil) error) ;; Invalid initarg types. ((:bindings 5) error) ;; Invalid initarg values. ((:code (no-such-variable)) error) ((:code (data) :bindings nil) error) ;; Produces a warning. ((:code ((no-such-function))) ((no-such-function))) ;; These are OK. ((:code ()) ()) ((:code (data)) (data)) ((:code (skip-event)) (skip-event))) (if (eq expected 'error) (ensure-condition error (apply #'make-instance 'style-programmable args)) (let ((style (apply #'make-instance 'style-programmable args))) (ensure-same (style-code style) expected :test #'equal))))) (addtest (style-programmable-root :documentation "Test some simple cases of formatting events using methods on `format-event' for `style-programmable'.") smoke (ensure-style-cases (style-programmable) ;; These are OK. '((:code nil) () "") `((:code nil) (,*simple-event*) "") `((:code ((princ data stream))) (,*simple-event*) "bar") `((:code ((princ scope stream) (princ " " stream) (princ data stream) (princ " " stream) (princ method stream) (terpri stream))) ,*simple-events* "/foo/ bar NIL /baz/ fez NIL ") `((:code ((princ count stream) (terpri stream))) ,*simple-events* "0 1 ") ;; These should result in errors at "format time". `((:code ((error "intentional error"))) (,*simple-event*) :error))) ;;; Test suite for `style-programmable/script' class (deftestsuite style-programmable/script-root (formatting-root) () (:documentation "Unit tests for the `style-programmable/script' formatting style class.")) (addtest (style-programmable/script-root :documentation "Test constructing `style-programmable/script' instances.") construct (ensure-cases (args expected) `(;; Missing initargs. (() error) ((:bindings nil) error) ;; Invalid combination of initargs. ((:script "data" :code (data)) error) ;; Invalid initarg types. ((:script 5) error) ((:bindings 5) error) ;; Invalid initarg values. ((:script "reader:error") format-code-error) ((:script "no-such-variable") format-code-error) ((:script "data" :bindings nil) format-code-error) ((:script #P"no-such-file-i-hope") format-code-error) ;; Produces warning. ((:script "(no-such-function)") ((rsb.formatting::no-such-function))) ;; These are OK. ((:script "data") (data)) ((:script ,(make-string-input-stream "data")) (data))) (case expected (error (ensure-condition error (apply #'make-instance 'style-programmable/script args))) (format-code-error (ensure-condition format-code-error (apply #'make-instance 'style-programmable/script args))) (t (let ((style (apply #'make-instance 'style-programmable/script args))) (ensure-same (style-script style) expected :test #'equal)))))) (addtest (style-programmable/script-root :documentation "Test some simple cases of formatting events using methods on `format-event' for `style-programmable/script'.") smoke (ensure-style-cases (style-programmable/script) ;; These are OK. '((:script "") () "") `((:script "") (,*simple-event*) "") `((:script "(princ data stream)") (,*simple-event*) "bar") `((:script "(princ scope stream) (princ \" \" stream) (princ data stream) (terpri stream)") ,*simple-events* "/foo/ bar /baz/ fez ") ;; These should result in errors at "format time". `((:script "(error \"intentional error\")") (,*simple-event*) :error))) ;;; Test suite for `style-programmable/template' class (deftestsuite style-programmable/template-root (formatting-root) () (:documentation "Unit tests for the `style-programmable/template' formatting style class.")) (addtest (style-programmable/template-root :documentation "Test constructing `style-programmable/template' instances.") construct (ensure-cases (args expected) `(;; Missing initargs. (() error) ((:bindings nil) error) ;; Invalid combination of initargs. ((:template "${data}" :code (data)) error) ;; Invalid initarg types. ((:template 5) error) ((:bindings 5) error) ;; Invalid initarg values. ((:template "${") format-code-error) ((:template "${reader:error}") format-code-error) ((:template "${no-such-variable}") format-code-error) ((:template "${data}" :bindings nil) format-code-error) ((:template #P"no-such-file-i-hope") format-code-error) ;; Produces a warning. ((:template "${(no-such-function)}") "${(no-such-function)}") ;; These are OK. ((:template "literal") "literal") ((:template "${data}") "${data}") ((:template ,(make-string-input-stream "${data}")) "${data}")) (case expected (error (ensure-condition error (apply #'make-instance 'style-programmable/template args))) (format-code-error (ensure-condition format-code-error (apply #'make-instance 'style-programmable/template args))) (t (let ((style (apply #'make-instance 'style-programmable/template args))) (ensure-same (style-template style) expected :test #'string=)))))) (addtest (style-programmable/template-root :documentation "Test some simple cases of formatting events using methods on `format-event' for `style-programmable/template'.") smoke (ensure-style-cases (style-programmable/template) ;; These are OK. '((:template "") () "") `((:template "") (,*simple-event*) "") `((:template "${data}") (,*simple-event*) "bar") `((:template "${scope} ${data}\\n") ,*simple-events* "/foo/ bar /baz/ fez ") `((:template "${count}") ,*simple-events* "01") ;; These should result in errors at "format time". `((:template "${(error \"intentional error\")}") (,*simple-event*) :error)))
7,677
Common Lisp
.lisp
194
32.025773
95
0.553867
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
6fa9bb8aa240e7cbe2727b78e871e07f70655f684e61fd6bb32f81b70b41b50f
37,285
[ -1 ]
37,286
package.lisp
open-rsx_rsb-tools-cl/test/formatting/introspection/package.lisp
;;;; package.lisp --- Package definition for unit tests of the formatting.introspection module. ;;;; ;;;; Copyright (C) 2015 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:defpackage #:rsb.formatting.introspection.test (:use #:cl #:alexandria #:let-plus #:more-conditions #:lift #:rsb #:rsb.formatting) (:export #:formatting.introspection-root) (:documentation "This package contains unit tests for the formatting module.")) (cl:in-package #:rsb.formatting.introspection.test) (deftestsuite rsb.formatting.introspection-root (formatting-root) () (:documentation "Root unit test suite for the formatting.introspection module."))
711
Common Lisp
.lisp
23
27.913043
95
0.734604
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
d949c4ebe5d96ca717b22a002a78e5aab31b2f4e12902f51b3f938a063100352
37,286
[ -1 ]
37,287
json.lisp
open-rsx_rsb-tools-cl/test/formatting/introspection/json.lisp
;;;; json.lisp --- Unit tests for the JSON-serialization of introspection data. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting.introspection.test) (define-constant +configuration-only-inprocess+ '(((:transport :inprocess :enabled) . "1") ((:transport :socket :enabled) . "0") ((:transport :spread :enabled) . "0") ((:introspection :enabled) . "1")) :test #'equal) (deftestsuite rsb.formatting.introspection.json-root (rsb.formatting.introspection-root) () (:documentation "Unit tests for the JSON-serialization of introspection data.")) (addtest (rsb.formatting.introspection.json-root :documentation "Smoke test for the JSON-serialization of introspection data.") smoke (let ((*configuration* +configuration-only-inprocess+)) (with-participants ((introspection :remote-introspection rsb.introspection:+introspection-scope+ :receiver-uris '("/")) (nil :listener "/")) (let ((style (make-style :json :database (rsb.introspection::introspection-database introspection) :service 'rsb.formatting.introspection::style))) (json:decode-json-from-string (with-output-to-string (stream) (rsb.introspection:with-database-lock (introspection) (format-event :dummy style stream))))))))
1,617
Common Lisp
.lisp
36
35.055556
79
0.603426
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
5e6e585b1cc18b496b4c8ddef74f583859507a3af613150ab27229395bb0f6d9
37,287
[ -1 ]
37,288
package.lisp
open-rsx_rsb-tools-cl/test/common/package.lisp
;;;; package.lisp --- Package definition for unit tests of the rsb-tools-common system. ;;;; ;;;; Copyright (C) 2012, 2013, 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:defpackage #:rsb.tools.common.test (:use #:cl #:alexandria #:let-plus #:lift #:rsb.tools.common) (:export #:common-root) (:documentation "This package contains unit tests for the rsb-tools-common system")) (cl:in-package #:rsb.tools.common.test) (deftestsuite common-root () () (:timeout 20) (:documentation "Root unit test suite for the rsb-tools-common system."))
627
Common Lisp
.lisp
22
25.590909
87
0.69616
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
f778c438e300973a10afb969efb701b12c724f4763b960f268aea6e7cda02835
37,288
[ -1 ]
37,289
event.lisp
open-rsx_rsb-tools-cl/test/common/event.lisp
;;;; event.lisp --- Unit tests for parsing events and payloads. ;;;; ;;;; Copyright (C) 2014, 2015, 2016, 2018 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.common.test) (deftestsuite common-event-root (common-root) () (:documentation "Test suite for event and payload parsing functions.")) (addtest (common-event-root :documentation "Smoke test for the `parse-payload-spec' function") parse-payload-spec/smoke (let+ ((pathname (asdf:system-relative-pathname :rsb-tools-common #P"test/data/simple.protocol-buffer-text")) (a-file (format nil "~S" pathname)) (a-utf-8-file (format nil "~S:utf-8" pathname)) (a-binary-file (format nil "~S:binary" pathname)) (a-pb-payload "pb:.rsb.protocol.Notification:{data:\"foo\"}") ((&flet pb-file (namestring) (format nil "pb:.rsb.protocol.Notification:~A" namestring)))) (ensure-cases (input expected-payload) `( ;; Some invalid cases ("(" error) ("/(" error) ("/()" error) ("pb:.foo.Bar:#P\"foo\":binary" error) ("pb:.foo.Bar:-:binary" error) ("1 \"foo\"" error) ;; Different payload types. ("" ,rsb.converter:+no-value+) ("false" nil) ("true" t) ("/bar" ,(rsb:make-scope "/bar")) (,a-file ,(read-file-into-string pathname)) (,a-utf-8-file ,(read-file-into-string pathname)) (,a-binary-file ,(read-file-into-byte-vector pathname)) (,a-pb-payload rsb.protocol:notification) (,(pb-file a-file) rsb.protocol:notification) (,(pb-file a-utf-8-file) rsb.protocol:notification) ("1" 1) (".1" .1d0) ("\"bar\"" "bar")) (let+ (((&flet do-it () (parse-payload-spec input))) ((&flet scope=-or-equalp (left right) (or (and (typep left 'rsb:scope) (typep right 'rsb:scope) (rsb:scope= left right)) (equalp left right))))) (case expected-payload (error (ensure-condition 'error (do-it))) (rsb.protocol:notification (ensure (typep (do-it) 'rsb.protocol:notification))) (t (ensure-same (do-it) expected-payload :test #'scope=-or-equalp))))))) (addtest (common-event-root :documentation "Smoke test for the `parse-call-spec' function.") parse-call-spec/smoke (ensure-cases (input expected-uri &optional expected-method expected-arg) `(;; Some invalid cases ("" call-specificiation-error) ("/" call-specificiation-error) ("(" call-specificiation-error) ("()" call-specificiation-error) ("/(" call-specificiation-error) ("/()" call-specificiation-error) ;; These are OK. ("/foo()" ,(rsb:make-scope "/") "foo" ,rsb.converter:+no-value+) ("/foo/bar()" ,(rsb:make-scope "/foo") "bar" ,rsb.converter:+no-value+) ("/foo/bar/baz()" ,(rsb:make-scope "/foo/bar") "baz" ,rsb.converter:+no-value+) ("socket:/foo()" ,(puri:uri "socket:") "foo" ,rsb.converter:+no-value+) ("socket:/foo/bar()" ,(puri:uri "socket:/foo") "bar" ,rsb.converter:+no-value+) ("socket:/foo/bar/baz()" ,(puri:uri "socket:/foo/bar") "baz" ,rsb.converter:+no-value+) ("socket://foo/bar/baz()" ,(puri:uri "socket://foo/bar") "baz" ,rsb.converter:+no-value+) ("socket://1.2.3.4/bar/baz()" ,(puri:uri "socket://1.2.3.4/bar") "baz" ,rsb.converter:+no-value+) #+later ("socket://[::]/bar/baz()" ,(puri:uri "socket://[::]/bar") "baz" ,rsb.converter:+no-value+) ("/?server=1/foo()" ,(puri:uri "/?server=1") "foo" ,rsb.converter:+no-value+) ("/foo?server=1/bar()" ,(puri:uri "/foo?server=1") "bar" ,rsb.converter:+no-value+) ("/foo/bar?server=1/baz()" ,(puri:uri "/foo/bar?server=1") "baz" ,rsb.converter:+no-value+) ;; Different payload types. ("/foo()" ,(rsb:make-scope "/") "foo" ,rsb.converter:+no-value+) ("/foo(false)" ,(rsb:make-scope "/") "foo" nil) ("/foo(true)" ,(rsb:make-scope "/") "foo" t) ("/foo(/bar)" ,(rsb:make-scope "/") "foo" ,(rsb:make-scope "/bar")) ("/foo(1)" ,(rsb:make-scope "/") "foo" 1) ("/foo(.1)" ,(rsb:make-scope "/") "foo" .1d0) ("/foo(\"bar\")" ,(rsb:make-scope "/") "foo" "bar")) (let+ (((&flet do-it () (parse-call-spec input))) ((&flet scope=-or-uri=-or-equalp (left right) (or (and (typep left 'rsb:scope) (typep right 'rsb:scope) (rsb:scope= left right)) (and (typep left 'puri:uri) (typep right 'puri:uri) (puri:uri= left right)) (equalp left right))))) (case expected-uri (call-specificiation-error (ensure-condition 'call-specification-error (do-it))) (t (let+ (((&values server-uri method arg) (do-it))) (ensure-same server-uri expected-uri :test #'scope=-or-uri=-or-equalp) (ensure-same method expected-method :test #'string=) (ensure-same arg expected-arg :test #'scope=-or-uri=-or-equalp)))))))
6,310
Common Lisp
.lisp
108
48.12963
113
0.464868
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
f935bdce621a71d9ead915221bcfb6e9316e71c65c8a789cd4893b6cba4eb081
37,289
[ -1 ]
37,290
error-handling.lisp
open-rsx_rsb-tools-cl/test/common/error-handling.lisp
;;;; error-handling.lisp --- Unit tests for error handling functions. ;;;; ;;;; Copyright (C) 2012, 2013, 2014, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.common.test) (define-condition foo-error (error) () (:documentation "Mock condition class for error handling tests.")) (deftestsuite error-handling-root (common-root) () (:documentation "Test suite for error-handling functions.")) (addtest (error-handling-root :documentation "Smoke test for `abort', `abort/signal', `continue/verbose' and `continue' error policies in combination with `maybe-relay-to-thread' and `with-error-policy'.") policies/smoke (ensure-cases (error/signal policy abort?/expected error?/expected result/expected) `(;; Test all policies for the case in which an error condition ;; is signaled from the *worker* thread. (:worker ,#'abort t nil :none) (:worker ,#'abort/signal t t :none) (:worker ,#'continue/verbose nil nil :return/main) (:worker ,#'continue nil nil :return/main) ;; Test all policies for the case in which an error condition ;; is signaled from the *main* thread. (:main ,#'abort t nil :none) (:main ,#'abort/signal t t :none) (:main ,#'continue/verbose nil nil :continue/main) (:main ,#'continue nil nil :continue/main) ;; Test all policies for the case in which no conditions are ;; signaled. (nil ,#'abort nil nil :return/main) (nil ,#'abort/signal nil nil :return/main) (nil ,#'continue/verbose nil nil :return/main) (nil ,#'continue nil nil :return/main)) (let+ ((policy/relay (maybe-relay-to-thread policy)) (abort? t) (result :none) ;; Mock client code which install a `continue' restart and ;; signals an error, if requested. ((&flet client-code (which result/normal result/continue) (restart-case (if (eq error/signal which) (error 'foo-error) result/normal) (continue (&optional condition) (declare (ignore condition)) result/continue)))) ;; Mock of the typical structure of a worker thread: ;; application of error policy, continue restart and ;; "client code". ((&flet spawn-worker-thread () (bt:make-thread (lambda () (handler-bind ((error policy/relay)) (client-code :worker :return/worker :continue/worker)))))) ;; Mock of the typical structure of a main thread: ;; `with-error-policy' and spawning of worker threads. ((&flet do-it () (with-error-policy (policy/relay) ;; Spawn worker thread and give it time to run, ;; signal, interrupt us, etc. (ignore-errors (bt:join-thread (spawn-worker-thread))) (prog1 (client-code :main :return/main :continue/main) (setf abort? nil)))))) ;; Execute, expecting a condition, abort and a particular ;; result. (cond ;; Expect main thread to be abort with `simple-error' ;; "Aborted.". ((and abort?/expected (not error?/expected)) (ensure-condition 'simple-error (do-it))) ;; Expect main thread to signal `foo-error'. ((and abort?/expected error?/expected) (ensure-condition 'foo-error (do-it))) ;; Expect main thread to return normally. (t (setf result (do-it)))) (ensure-same abort? abort?/expected) (ensure-same result result/expected))))
3,940
Common Lisp
.lisp
84
36.797619
85
0.573655
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
ae3040a0ff28f5103f8aa29283d7a1111268c231fae265f63b0f252e5d62a8f7
37,290
[ -1 ]
37,291
idl-loading.lisp
open-rsx_rsb-tools-cl/test/common/idl-loading.lisp
;;;; idl-loading.lisp --- Unit tests for IDL loading functionality. ;;;; ;;;; Copyright (C) 2016, 2018 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.common.test) (deftestsuite common-idl-loading-root (common-root) () (:documentation "Test suite for IDL loading functionality.")) (addtest (common-idl-loading-root :documentation "Smoke test for the `find-and-load-idl' function.") find-and-load-idl/smoke (ensure-condition error (find-and-load-idl ".some.Name" :proto)) (let* ((data-directory (asdf:system-relative-pathname :rsb-tools-common/test "test/data/")) (pbf:*proto-load-path* (list data-directory))) (find-and-load-idl ".test.Simple" :proto)))
808
Common Lisp
.lisp
20
35
70
0.659004
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
3721bb0e3934f1437ac16cfbcbf873d8e8749247ca10ed90dd9b0559b02345e0
37,291
[ -1 ]
37,292
protocol-buffer-payload.lisp
open-rsx_rsb-tools-cl/test/common/protocol-buffer-payload.lisp
;;;; protocol-buffer-payload.lisp --- Unit tests for protocol buffer payloads. ;;;; ;;;; Copyright (C) 2015, 2016, 2017 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.common.test) (deftestsuite protocol-buffer-payload-root (common-root) () (:documentation "Test suite for error-handling functions.")) (addtest (protocol-buffer-payload-root :documentation "Smoke test for building protocol protocol buffer messages.") build/smoke (ensure-cases (input &optional (expected t)) '(;; Some invalid cases. ("{no_such_field:1}" error) ("{scope: {}}" error) ("{scope: [\"foo\",\"bar\"]}" error) ;; These are OK. ("{}") ("{meta_data: {}}") ("{data: \"\\000\\000\"}")) (let+ (((&flet do-it () (rsb.tools.common::build-protocol-buffer-message (pb:find-descriptor ".rsb.protocol.Notification") input)))) (case expected (error (ensure-condition 'error (do-it))) (t (do-it))))))
1,116
Common Lisp
.lisp
30
30.733333
78
0.580019
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
37a671e59d02acade7e859863ac00cea6d50cf6b98fa12d1a585197cd680a49e
37,292
[ -1 ]
37,293
package.lisp
open-rsx_rsb-tools-cl/test/commands/package.lisp
;;;; package.lisp --- Package definition for unit tests of the commands module. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:defpackage #:rsb.tools.commands.test (:use #:cl #:alexandria #:let-plus #:more-conditions #:lift #:rsb.tools.commands) (:export #:call-with-asynchronously-executing-command #:with-asynchronously-executing-command) (:export #:commands-root) (:documentation "This package contains unit tests for the commands module.")) (cl:in-package #:rsb.tools.commands.test) (deftestsuite commands-root () () (:timeout 20) (:documentation "Root unit test suite for the commands module.")) (defvar *safe-configuration* '(((:introspection :enabled) . "0") ((:transport :inprocess :enabled) . "1") ((:transport :socket :enabled) . "0"))) (defvar *introspection-configuration* '(((:introspection :enabled) . "1") ((:transport :inprocess :enabled) . "1") ((:transport :socket :enabled) . "0"))) (defun call-with-asynchronously-executing-command (thunk command &key bindings error-policy) (let+ ((error) ((&flet thread-thunk () (progv (mapcar #'car bindings) (mapcar #'cdr bindings) (handler-case (restart-case (handler-bind ((error (lambda (condition) (when error-policy (funcall error-policy condition))))) (command-execute command :error-policy error-policy)) (abort ())) (error (condition) (setf error condition)))))) (thread (bt:make-thread #'thread-thunk))) (prog1 (unwind-protect (funcall thunk) (when (bt:thread-alive-p thread) (bt:interrupt-thread thread #'abort)) (ignore-errors (bt:join-thread thread))) (when error (error error))))) (defmacro with-asynchronously-executing-command ((command &key bindings (error-policy nil error-policy-supplied?)) &body body) `(call-with-asynchronously-executing-command (lambda () ,@body) ,command :bindings (list ,@(mapcar (lambda+ ((var value)) `(cons ',var ,value)) bindings)) ,@(when error-policy-supplied? `(:error-policy ,error-policy))))
2,647
Common Lisp
.lisp
71
27.028169
79
0.551872
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
9e89c3defede5469e32f6f656c85a56321a085da5fef06eaa74a84dd2c4791cf
37,293
[ -1 ]
37,294
server.lisp
open-rsx_rsb-tools-cl/test/commands/server.lisp
;;;; server.lisp --- Tests for the server command class. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.commands.test) (deftestsuite server-root (commands-root) () (:documentation "Test suite for the `server' command.")) (addtest (server-root :documentation "Test construction of the `server' command.") construction (ensure-cases (initargs &optional expected) `(;; Some invalid cases. (() missing-required-initarg) ; :uris is missing ((:uris (,(puri:uri "socket:?server=0")))) ; server mode ((:uris ("socket:?server=0"))) ; likewise ;; These are Ok. ((:uris (,(puri:uri "/")))) ((:uris (,(rsb:make-scope "/")))) ((:uris ("/")))) (let+ (((&flet do-it () (apply #'make-command :server initargs)))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (t (ensure (typep (princ-to-string (do-it)) 'string))))))) (defvar *port-promise*) (defun note-port (port) (lparallel:fulfill *port-promise* port)) (defvar *port-and-portfile-configuration* '(((:transport :socket :enabled) . t) ((:transport :socket :port) . 0) ((:transport :socket :portfile) . "call:rsb.tools.commands.test::note-port"))) (addtest (server-root :documentation "Smoke test for the `server' command.") smoke (let+ (((&flet obtain-url (promise) (when-let ((port (lparallel:force promise))) (format nil "socket://localhost:~D/?server=0" port)))) ((&flet+ test ((uris configuration &optional expected)) (let* ((command (make-command :server :uris uris)) (error nil) (promise (lparallel:promise)) (thread (bt:make-thread (lambda () (restart-case (handler-bind ((warning (lambda (condition) (muffle-warning))) (error (lambda (condition) (setf error condition) (lparallel:fulfill promise) (abort)))) (let ((rsb:*configuration* configuration) (*port-promise* promise)) (command-execute command))) (abort ())))))) ;; Make sure communication works. (unwind-protect (let ((rsb:*configuration* *safe-configuration*) (url (obtain-url promise))) (when url (rsb:with-participants ((informer :informer url) (reader :reader url)) (rsb:send informer 1) (ensure-same (rsb:event-data (rsb:receive reader)) 1)))) (ignore-errors (bt:interrupt-thread thread #'abort)) (ignore-errors (bt:join-thread thread))) ;; Check for errors. (case expected (error (ensure-condition error (when error (error error)))) (t (when error (error error)))))))) (mapc #'test `(;; Scopes (("/") ,*port-and-portfile-configuration*) ((,(rsb:make-scope "/")) ,*port-and-portfile-configuration*) (("/ignored") ,*port-and-portfile-configuration*) ((,(rsb:make-scope "/ignored")) ,*port-and-portfile-configuration*) (("/") ,*safe-configuration* error) ; inprocess instead of socket transport ((,(rsb:make-scope "/")) ,*safe-configuration* error) ;; URIs (("socket://localhost:0?portfile=call:rsb.tools.commands.test::note-port") ,*safe-configuration*) (("socket://localhost:0/ignored?portfile=call:rsb.tools.commands.test::note-port") ,*safe-configuration*) (("inprocess:") ,*safe-configuration* error) ; wrong transport (("socket://localhost:0/?server=0") ,*safe-configuration* error) ; server=0 (("socket://localhost:0/?server=auto") ,*safe-configuration* error))))) ; server=auto
4,686
Common Lisp
.lisp
109
29.220183
89
0.493307
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
b52d6dac91706f3ac0415a489c3da1c88ffe0c7193bdd6ba465ea3691bf2e5ac
37,294
[ -1 ]
37,295
introspect.lisp
open-rsx_rsb-tools-cl/test/commands/introspect.lisp
;;;; introspect.lisp --- Tests for the introspect command class. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.commands.test) (deftestsuite introspect-root (commands-root) () (:documentation "Test suite for the `introspect' command.")) (addtest (introspect-root :documentation "Test construction of the `introspect' command.") construction (ensure-cases (initargs &optional expected) `(;; Some invalid cases. (() missing-required-initarg) ; :uris,:style[-spec] are missing ((:uris (,(puri:uri "/"))) missing-required-initarg) ; :style[-spec] is missing ;; These are Ok. ((:uris (,(puri:uri "/")) :style-spec "object-tree")) ((:uris (,(puri:uri "/")) :style ,(rsb.formatting:make-style :object-tree :service 'rsb.formatting.introspection::style))) ((:uris (,(puri:uri "/")) :style-spec "object-tree" :stream ,*standard-output*)) ((:uris (,(puri:uri "/")) :style-spec "object-tree" :stream-spec :error-output)) ((:uris (,(puri:uri "/")) :style-spec "object-tree :stateful? nil"))) (let+ (((&flet do-it () (apply #'make-command :introspect initargs)))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (t (ensure (typep (princ-to-string (do-it)) 'string))))))) (addtest (introspect-root :documentation "Smoke test for the `introspect' command.") smoke (let* ((configuration *introspection-configuration*) (stream (make-string-output-stream)) (command (make-command :introspect :uris '("/") :style-spec "monitor/events" :stream stream))) (with-asynchronously-executing-command (command :bindings ((rsb:*configuration* configuration))) (sleep 1) ; TODO racy (let ((rsb:*configuration* configuration)) (rsb:with-participant (nil :listener "/rsbtest/tools/commands/introspect/listener")))) (ensure (not (emptyp (get-output-stream-string stream))))))
2,469
Common Lisp
.lisp
56
34.571429
100
0.553015
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
693c3fce91786a6fd7c00244acdf50a58917dbf6d4f624fc84dbbde8ee6c4e29
37,295
[ -1 ]
37,296
logger.lisp
open-rsx_rsb-tools-cl/test/commands/logger.lisp
;;;; logger.lisp --- Tests for the logger command class. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.commands.test) (deftestsuite logger-root (commands-root) () (:documentation "Test suite for the `logger' command.")) (addtest (logger-root :documentation "Test construction of the `logger' command.") construction (ensure-cases (initargs &optional expected) `(;; Some invalid cases. (() missing-required-initarg) ; :uris is missing ((:uris (,(puri:uri "/"))) missing-required-initarg) ; :style or :style-spec is missing ((:style-spec "detailed") missing-required-initarg) ; :uris is missing ;; These are Ok. ((:uris (,(puri:uri "/")) :style-spec "detailed")) ((:uris (,(rsb:make-scope "/")) :style-spec "detailed")) ((:uris ("/") :style-spec "detailed")) ((:uris (,(puri:uri "/")) :style ,(rsb.formatting:make-style :detailed))) ((:uris (,(puri:uri "/")) :style-spec "detailed" :max-queued-events 100)) ((:uris (,(puri:uri "/")) :style-spec "detailed" :filters (,(rsb.filter:filter :scope :scope "/")))) ((:uris (,(puri:uri "/")) :style-spec "detailed" :stream ,*error-output*)) ((:uris (,(puri:uri "/")) :style-spec "detailed" :stream-spec :error-output)) ((:uris (,(puri:uri "/")) :style-spec "detailed" :while ,(lambda (count event) (declare (ignore count event)))))) (let+ (((&flet do-it () (apply #'make-command :logger initargs)))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (t (ensure (typep (princ-to-string (do-it)) 'string))))))) (addtest (logger-root :documentation "Smoke test of the `logger' command class.") smoke (let* ((scope "/rsbtest/tools/commands/logger") (configuration *safe-configuration*)) (ensure-cases (initargs events expected &key (expected-event-count (length events))) `(;; Terminate after receiving and logging a single event on ;; expected scope. ((:uris (,(puri:uri scope)) :style-spec (:programmable/template :template "${sequence-number} ${data}\\n")) (,(rsb:make-event scope 1)) ,(format nil "0 1~%")) ;; Terminate after receiving but filtering one event and ;; receiving and logging a second. ((:uris (,(puri:uri scope)) :filters (,(rsb.filter:filter :method :method nil)) :style-spec (:programmable/template :template "${sequence-number} ${data}\\n")) (,(rsb:make-event scope 1) ,(rsb:make-event scope 2 :method :unexpected)) ,(format nil "0 1~%") :expected-event-count 1) ;; Continue after an error. ((:uris (,(puri:uri scope)) :style-spec (:programmable/template :template ,(format nil "${(when (eql data 1) ~ (error \"intentional error\"))} ~ ${sequence-number} ${data}\\n"))) (,(rsb:make-event scope 1) ,(rsb:make-event scope 2)) ,(format nil "NIL 1 2~%"))) (let* ((output (make-string-output-stream)) (while (lambda (i event) (declare (ignore event)) (< i expected-event-count))) (command (apply #'make-command :logger (append initargs `(:stream ,output :while ,while))))) (with-asynchronously-executing-command (command :bindings ((rsb:*configuration* configuration)) :error-policy #'continue) (sleep 1) ; TODO racy (let ((rsb:*configuration* configuration)) (rsb:with-participant (i :informer scope) (mapc (curry #'rsb:send i) events))) (sleep 1)) ; TODO racy (ensure-same (get-output-stream-string output) expected :test #'string=)))))
4,763
Common Lisp
.lisp
102
34.627451
101
0.489142
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
5d09bb63d7b8cba1a52fa0753d9bc94016b1967afb6238cf899a90743577239e
37,296
[ -1 ]
37,297
call.lisp
open-rsx_rsb-tools-cl/test/commands/call.lisp
;;;; call.lisp --- Tests for the call command class. ;;;; ;;;; Copyright (C) 2015 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.commands.test) (deftestsuite call-root (commands-root) () (:documentation "Test suite for the `call' command.")) (addtest (call-root :documentation "Test construction of the `call' command.") construction (ensure-cases (initargs &optional expected) `(;; Some invalid cases with missing initargs. (() missing-required-initarg) ; :destination is missing ((:destination "/") missing-required-initarg) ; :method is missing ((:destination "/" :method "foo") missing-required-initarg) ; :payload[-spec] is missing ((:destination "/" :method "foo" :payload nil) missing-required-initarg) ; :style[-spec] is missing ;; Some invalid cases with incompatible initargs. ((:destination "/" :call-spec "socket:/foo/bar(true)" :style-spec "detailed") incompatible-initargs) ((:destination "/" :method "foo" :payload nil :style-spec "detailed" :timeout 1 :no-wait? t) incompatible-initargs) ;; These are Ok. ((:destination ,(puri:uri "/") :method "foo" :payload nil :style-spec "detailed")) ((:destination ,(rsb:make-scope "/") :method "foo" :payload nil :style-spec "detailed")) ((:destination "/" :method "foo" :payload nil :style-spec "detailed")) ((:call-spec "socket:/foo/bar(true)" :style-spec "detailed")) ((:call-spec "socket:/foo/bar(true)" :style-spec "detailed" :timeout 1)) ((:call-spec "socket:/foo/bar(true)" :style-spec "detailed" :no-wait? t))) (let+ (((&flet do-it () (apply #'make-command :call initargs)))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (incompatible-initargs (ensure-condition incompatible-initargs (do-it))) (t (ensure (typep (princ-to-string (do-it)) 'string)))))))
2,604
Common Lisp
.lisp
66
28.681818
101
0.506519
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
5f8d79b57644b8f7781960b143ac32e22630b00bb5efd031571778c3e2f0c485
37,297
[ -1 ]
37,298
send.lisp
open-rsx_rsb-tools-cl/test/commands/send.lisp
;;;; send.lisp --- Tests for the send command class. ;;;; ;;;; Copyright (C) 2015, 2017 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.commands.test) (deftestsuite send-root (commands-root) () (:documentation "Test suite for the `send' command.")) (addtest (send-root :documentation "Test construction of the `send' command.") construction (ensure-cases (initargs &optional expected) `(;; Some invalid cases with missing initargs. (() missing-required-initarg) ; :destination is missing ((:destination "/") missing-required-initarg) ; :payload[-spec] is missing ;; These are Ok. ((:destination ,(puri:uri "/") :payload nil)) ((:destination ,(rsb:make-scope "/") :payload nil)) ((:destination "/" :payload nil)) ((:destination ,(rsb:make-scope "/") :payload-spec "true")) ((:destination "/" :payload nil :method nil)) ((:destination "/" :payload nil :method "request"))) (let+ (((&flet do-it () (apply #'make-command :send initargs)))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (t (ensure (typep (princ-to-string (do-it)) 'string)))))))
1,323
Common Lisp
.lisp
31
36.548387
82
0.615863
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
6d84fceb4ed7dcdeb93485f2fe9ca46de9b7c4e9b1318ed12871a3c50207a9f3
37,298
[ -1 ]
37,299
info.lisp
open-rsx_rsb-tools-cl/test/commands/info.lisp
;;;; info.lisp --- Tests for the info command class. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.commands.test) (deftestsuite info-root (commands-root) () (:documentation "Test suite for the `info' command.")) (addtest (info-root :documentation "Test construction of the `info' command.") construction (ensure-cases (initargs &optional expected) `(;; These are Ok. ((:version? t)) ((:configuration? t)) ((:transports? t)) ((:converters? t)) ((:filters? t)) ((:transforms? t)) ((:event-processing? t)) ((:participants? t)) ((:stream ,*standard-output*)) ((:stream-spec :error-output))) (let+ (((&flet do-it () (apply #'make-command :info initargs)))) (ensure (typep (princ-to-string (do-it)) 'string)))))
994
Common Lisp
.lisp
28
29.785714
68
0.556712
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
01ef17278f72f06220ad4c4eb1142d51d5dca7a2908f1b8c5a2743ad9a47d95f
37,299
[ -1 ]
37,300
redump.lisp
open-rsx_rsb-tools-cl/test/commands/redump.lisp
;;;; redump.lisp --- Tests for the redump command class. ;;;; ;;;; Copyright (C) 2015 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.commands.test) (deftestsuite redump-root (commands-root) () (:documentation "Test suite for the `redump' command.")) (addtest (redump-root :documentation "Test construction of the `redump' command.") construction (ensure-cases (initargs &optional expected) `(;; Some invalid cases. (() missing-required-initarg) ; :output-file is missing ;; These are Ok. ((:output-file ,#P"foo")) ((:output-file ,#P"foo" :static? t)) ((:output-file ,#P"foo" :compression 8))) (let+ (((&flet do-it () (apply #'make-command :redump initargs)))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (t (ensure (typep (princ-to-string (do-it)) 'string)))))))
1,029
Common Lisp
.lisp
27
32.407407
92
0.608434
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
4cc06cfc55d1fe85171f7cc102520e3d67a773d36021e3bfe470bddfbd357ac0
37,300
[ -1 ]
37,301
mixins.lisp
open-rsx_rsb-tools-cl/test/commands/mixins.lisp
;;;; mixins.lisp --- Tests for command mixin classes. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.commands.test) (deftestsuite style-mixin-root (commands-root) () (:documentation "Test suite for the `style-mixin' command mixin class.")) (addtest (style-mixin-root :documentation "Test construction of the `style-mixin' command mixin class.") construction (ensure-cases (initargs &optional expected) `(;; Invalid case with missing required initargs. (() missing-required-initarg) ;; Some invalid cases with incompatible initargs. ((:style :a :style-spec :b) incompatible-initargs) ((:style :a :style-service :b) incompatible-initargs) ((:style :a :style-spec :b :style-service :c) incompatible-initargs) ;; This is OK. ((:style :a))) (let+ (((&flet do-it () (apply #'make-instance 'style-mixin initargs)))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (incompatible-initargs (ensure-condition incompatible-initargs (do-it))) (t (ensure (typep (princ-to-string (do-it)) 'string))))))) (deftestsuite output-stream-mixin-root (commands-root) () (:documentation "Test suite for the `output-stream-mixin' command mixin class.")) (addtest (output-stream-mixin-root :documentation "Test construction of the `output-stream-mixin' command mixin class.") construction (ensure-cases (initargs &optional expected) `(;; Some invalid cases with incompatible initargs. ((:stream ,*standard-output* :stream-spec :error-output) incompatible-initargs) ;; These are Ok. ((:stream ,*standard-output*)) ((:stream-spec :error-output))) (let+ (((&flet do-it () (apply #'make-instance 'output-stream-mixin initargs)))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (incompatible-initargs (ensure-condition incompatible-initargs (do-it))) (t (ensure (typep (princ-to-string (do-it)) 'string)))))))
2,414
Common Lisp
.lisp
59
33.779661
79
0.614663
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
b602d0c2e8299e81cbaa9805d3cb69f1e379e8a29e21a093587afd47fb577bba
37,301
[ -1 ]
37,302
command.lisp
open-rsx_rsb-tools-cl/test/commands/bridge/command.lisp
;;;; command.lisp --- Tests for the bridge command class. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.commands.bridge.test) (deftestsuite commands-bridge-command-root (commands-bridge-root) () (:documentation "Test suite for the `bridge' command.")) (defun caused-by-forwarding-cycle-error? (condition) (typep (cause condition) 'forwarding-cycle-error)) (deftype caused-by-forwarding-cycle-error () `(and specification-error (satisfies caused-by-forwarding-cycle-error?))) (addtest (commands-bridge-command-root :documentation "Test construction of the `bridge' command.") construction (ensure-cases (initargs &optional expected) `(;; Some invalid cases. (() missing-required-initarg) ; spec is missing ((:spec "") specification-error) ; specification syntax error ((:spec "socket: -> socket:") caused-by-forwarding-cycle-error) ; unidirectional, cycle ((:spec "socket: <-> socket:") caused-by-forwarding-cycle-error) ; bidirectional, cycle ((:spec "socket:/foo -> socket:/foo/bar") caused-by-forwarding-cycle-error) ; unidirectional, maybe cycle ((:spec "socket:/foo <-> socket:/foo/bar") caused-by-forwarding-cycle-error) ; bidirectional, maybe cycle ;; These are Ok. ((:spec "socket:/foo-> socket:/bar") t) ((:spec "socket:/foo ->socket:/bar") t) ((:spec "socket:/foo -> socket:/bar") t) ((:spec "socket:/foo -> socket:/bar") t) ((:spec "socket:/foo <-> socket:/bar") t) ((:spec "socket:/ -> spread:/") t) ((:spec "socket: -> /drop-payload/ spread:") t) ((:spec "socket:/ <-> spread:/") t) ((:spec "/foo -> /bar; /baz -> /fez") t) ((:spec "/foo -> /bar ;/baz -> /fez") t) ((:spec "/foo -> /bar ; /baz -> /fez") t) ((:spec "/foo -> /bar ; /baz -> /fez") t) ((:spec "/a -> /b" :max-queued-events 10) t)) (let+ (((&flet do-it () (apply #'make-command :bridge initargs)))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (specification-error (ensure-condition specification-error (do-it))) (caused-by-forwarding-cycle-error (ensure-condition caused-by-forwarding-cycle-error (do-it))) (t (ensure (typep (princ-to-string (do-it)) 'string))))))) (addtest (commands-bridge-command-root :documentation "Smoke test for the `bridge' command.") smoke (let+ (((&flet test (spec informer-url scope data listener-url expected-scope expected-data expected-converter-calls) (let* ((converter (rsb.converter:make-converter :call-tracking :next (rsb:default-converters))) (rsb:*configuration* *safe-configuration*) (command (make-command :bridge :spec spec)) (received (lparallel.queue:make-queue))) (with-asynchronously-executing-command (command :bindings ((rsb:*configuration* *safe-configuration*) (rsb::*default-converters* `((t . ,converter))))) (rsb:with-participants ((informer :informer informer-url) (listener :listener listener-url :handlers (list (rcurry #'lparallel.queue:push-queue received)))) (sleep 1) ; TODO racy (rsb:send informer (rsb:make-event scope data)) (loop :while (lparallel.queue:queue-empty-p received)))) ;; Check converter calls. (ensure-same (rsb.converter.test:converter-calls converter) (sublis `((:converter . ,converter)) expected-converter-calls) :test #'equal) ;; Check forwarded event. (ensure-same (lparallel.queue:queue-count received) 1) (let ((event (lparallel.queue:pop-queue received))) (ensure-same (rsb:event-scope event) expected-scope :test #'rsb:scope=) (ensure-same (rsb:event-data event) expected-data) (ensure-same (length (rsb:timestamp-alist event)) 5)))))) (test "socket:/foo -> socket:/bar" "socket:/foo" "/foo/baz" 1 "socket:/bar" "/bar/baz" 1 ()) (test "socket:/foo -> /drop-payload/ socket:/bar" "socket:/foo" "/foo/baz" 1 "socket:/bar" "/bar/baz" rsb.converter:+no-value+ `((rsb.converter:domain->wire :converter ,rsb.transform:+dropped-payload+)))))
5,154
Common Lisp
.lisp
98
40.77551
116
0.534907
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
547e4878849bc6ab22fb8591fd8585b8150f79660d5de1b7c5085d24f27d1f15
37,302
[ -1 ]
37,303
package.lisp
open-rsx_rsb-tools-cl/test/commands/bridge/package.lisp
;;;; package.lisp --- Package definition for unit tests of the tools.commands.bridge module. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:defpackage #:rsb.tools.commands.bridge.test (:use #:cl #:alexandria #:let-plus #:more-conditions #:lift #:rsb.tools.commands #:rsb.tools.commands.bridge) (:import-from #:rsb.tools.commands.test #:commands-root #:*safe-configuration* #:with-asynchronously-executing-command) (:export #:commands-bridge-root) (:documentation "This package contains unit tests for the commands.bridge module.")) (cl:in-package #:rsb.tools.commands.bridge.test) (deftestsuite commands-bridge-root (commands-root) () (:documentation "Root unit test suite for the tools.commands.bridge module."))
851
Common Lisp
.lisp
28
27.071429
92
0.719557
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
dc06ac2ebe77de6bc0981c7f4605b114a8336910bcb7fdfe2438870fac6327d8
37,303
[ -1 ]
37,304
command.lisp
open-rsx_rsb-tools-cl/test/commands/web/command.lisp
;;;; command.lisp --- Tests for the web command class. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.commands.web.test) (deftestsuite commands-web-command-root (commands-web-root) () (:documentation "Test suite for the `web' command.")) (addtest (commands-web-command-root :documentation "Test construction of the `web' command.") construction (ensure-cases (initargs &optional expected) `(;; Some invalid cases. (() missing-required-initarg) ; :uris is missing ;; These are Ok. ((:uris (,(puri:uri "/")))) ((:uris (,(puri:uri "/")) :address nil)) ((:uris (,(puri:uri "/")) :address "0.0.0.0")) ((:uris (,(puri:uri "/")) :port 4567)) ((:uris (,(puri:uri "/")) :document-root #"static/")) ((:uris (,(puri:uri "/")) :document-root nil)) ((:uris (,(puri:uri "/")) :response-timeout 1.0))) (let+ (((&flet do-it () (apply #'make-command :web initargs)))) (case expected (missing-required-initarg (ensure-condition missing-required-initarg (do-it))) (t (ensure (typep (princ-to-string (do-it)) 'string))))))) (defmacro with-command-endpoint (&body body) `(let* ((port (usocket:with-socket-listener (socket "localhost" 0) (usocket:get-local-port socket))) ; TODO racy (configuration *introspection-configuration*) (command (make-command :web :uris '("/") :port port))) (with-asynchronously-executing-command (command :bindings ((rsb:*configuration* configuration))) (let+ (((&flet request (path accept &key (method :get) query-parameters (expected-code '(integer 200 (300)))) (let+ ((uri (puri:copy-uri (puri:uri "http://localhost") :port port :path path :query query-parameters)) ((&values body code headers) (drakma:http-request uri :accept accept))) (ensure (typep code expected-code) :report "~@<For request ~A ~A?~A accept ~A, ~ expected code ~D, but got ~D, ~S~@:>" :arguments (method path query-parameters accept expected-code code (sb-ext:octets-to-string body))) body))) ((&flet request/json (path &rest args &key &allow-other-keys) (json:decode-json-from-source (flexi-streams:make-flexi-stream (flexi-streams:make-in-memory-input-stream (apply #'request path "application/json" args))))))) (sleep 1) ; TODO racy (let ((rsb:*configuration* configuration)) (rsb:with-participant (nil :listener "/rsbtest/tools/commands/web/listener"))) (sleep 1) ; TODO racy ,@body)))) (addtest (commands-web-command-root :documentation "Smoke test for introspection/snapshot endpoint of the `web' command.") introspection-snapshot/smoke (with-command-endpoint (let ((endpoint "/api/introspection/snapshot")) ;; Invalid requests. (request endpoint "application/xml" :expected-code '(eql 415)) ;; Valid requests. (request endpoint "text/html") (request/json endpoint)))) (addtest (commands-web-command-root :documentation "Smoke test for the introspection/search endpoint of the `web' command.") introspection-search/smoke (with-command-endpoint (let ((endpoint "/api/introspection/search")) ;; Invalid requests. (request endpoint "application/xml" :expected-code '(eql 415)) (request/json endpoint :expected-code '(eql 400)) (request/json endpoint :query-parameters "query= " :expected-code '(eql 400)) (request/json endpoint :query-parameters "query=///" :expected-code '(eql 400)) (request/json endpoint :query-parameters "query=/&start=-1" :expected-code '(eql 400)) (request/json endpoint :query-parameters "query=/nomatch&start=1" :expected-code '(eql 400)) (request/json endpoint :query-parameters "query=/&limit=0" :expected-code '(eql 400)) (request/json endpoint :query-parameters "query=count(//*)&start=1" :expected-code '(eql 400)) ;; Valid requests. (request endpoint "text/html") (request/json endpoint :query-parameters "query=foo") (request/json endpoint :query-parameters "query=foo bar") (request/json endpoint :query-parameters "query=listener") (request/json endpoint :query-parameters "query=listener&start=0") (request/json endpoint :query-parameters "query=listener&limit=1") (request/json endpoint :query-parameters "query=count(//*)") (request/json endpoint :query-parameters "query=count(//*)&start=0") (request/json endpoint :query-parameters "query=//*") (request/json endpoint :query-parameters "query=//*&start=1") (request/json endpoint :query-parameters "query=//*&limit=1") (request/json endpoint :query-parameters "query=//@*") (request/json endpoint :query-parameters "query=//@*&start=1") (request/json endpoint :query-parameters "query=//@*&limit=1"))))
6,117
Common Lisp
.lisp
128
35.257813
77
0.537366
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
07b69756210b39eaca4876da1df8b9fb84537cfd3b61994806cc360e7ac83c3a
37,304
[ -1 ]
37,305
package.lisp
open-rsx_rsb-tools-cl/test/commands/web/package.lisp
;;;; package.lisp --- Package definition for unit tests of the tools.commands.web module. ;;;; ;;;; Copyright (C) 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:defpackage #:rsb.tools.commands.web.test (:use #:cl #:alexandria #:let-plus #:more-conditions #:lift #:rsb.tools.commands #:rsb.tools.commands.web) (:import-from #:rsb.tools.commands.test #:*introspection-configuration* #:with-asynchronously-executing-command) (:export #:commands-web-root) (:documentation "This package contains unit tests for the commands.web module.")) (cl:in-package #:rsb.tools.commands.web.test) (deftestsuite commands-web-root () () (:documentation "Root unit test suite for the tools.commands.web module."))
799
Common Lisp
.lisp
26
27.538462
89
0.71466
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
f28564318512206ab6ecc2286d532f11a2c0d3709d4c0027d5538a17685ab7bc
37,305
[ -1 ]
37,306
protocol.lisp
open-rsx_rsb-tools-cl/test/stats/protocol.lisp
;;;; protocol.lisp --- Unit tests for the protocol of the stats module. ;;;; ;;;; Copyright (C) 2014 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.stats.test) (deftestsuite formatting-protocol-root (stats-root) () (:documentation "Test suite for the protocol of the stats module.")) (addtest (formatting-protocol-root :documentation "Smoke test for the `make-quantity' generic function.") make-quantity/smoke (ensure-cases (args expected) `(;; Non-existent quantity. ((:no-such-quantity) quantity-creation-error) (((:no-such-quantity)) quantity-creation-error) (((:no-such-quantity :baz 2)) quantity-creation-error) ((:no-such-quantity :bar 1) quantity-creation-error) (((:no-such-quantity) :bar 1) quantity-creation-error) (((:no-such-quantity :baz 2) :bar 1) quantity-creation-error) ;; Cannot add initargs to already constructed instance. ((,(make-quantity :rate) :foo 1) quantity-creation-error) ;; These are OK. ((:rate) t) (((:rate)) t) (((:rate :format "~,5F")) t) ((:rate :format "~,5F") t) (((:rate) :format "~,5F") t) (((:rate :name "") :format "~,5F") t)) (let+ (((&flet do-it () (apply #'make-quantity args)))) (ecase expected (quantity-creation-error (ensure-condition quantity-creation-error (do-it))) ((t) (do-it))))))
1,653
Common Lisp
.lisp
37
37.837838
71
0.550311
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
f0445d91efbb1df822e6a451c9f9568e06985b823f9b586c2ef40372255a064a
37,306
[ -1 ]
37,307
quantities.lisp
open-rsx_rsb-tools-cl/test/stats/quantities.lisp
;;;; quantities.lisp --- Unit tests for quantity classes. ;;;; ;;;; Copyright (C) 2011, 2012, 2013, 2014 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.stats.test) (defmacro define-simple-quantity-suite ((name &key (reset? t)) &body cases) "Define a test suite for the quantity class designated by NAME. Use CASES as body of `ensure-quantity-cases' in a test case for the `update!' and `format-value' methods." (let ((class-name (class-name (service-provider:provider-class (service-provider:find-provider 'rsb.stats::quantity name)))) (suite-name (symbolicate name "-ROOT"))) `(progn (deftestsuite ,suite-name (stats-root) () (:documentation ,(format nil "Test suite for the `~(~A~)' quantity class." class-name))) (addtest (,suite-name :documentation ,(format nil "Test methods on `update!' and ~ `format-value' for the `~(~A~)' ~ quantity class." class-name)) update!-and-format-value (let+ (((&flet event (&optional (scope "/foo") (data "bar")) (make-event scope data)))) (ensure-quantity-cases (,class-name :reset? ,reset?) (progn ,@cases))))))) (define-simple-quantity-suite (:count) `((() () "^0$") (() (,(event)) "^1$") (() (,(event)) "^1$"))) (define-simple-quantity-suite (:count/all-time :reset? nil) `((() () "^0$") (() (,(event)) "^1$") (() (,(event)) "^1$"))) (define-simple-quantity-suite (:rate) `((() () "^0\\.000$") (() (,(event)) "^[0-9]+\\.[0-9]+$"))) (define-simple-quantity-suite (:period-time) `((() () "^N/A ± N/A$") (() (,(event)) "^N/A ± N/A$") (() (,(event) ,(progn (sleep .001) (event))) "^0\\.[0-9][0-9][0-9] ± [0-9]\\.[0-9][0-9][0-9]$"))) (define-simple-quantity-suite (:throughput) `((() () "^0\\.000$") (() (,(event)) "^[0-9]+\\.[0-9]+$"))) (define-simple-quantity-suite (:size) `((() () "^N/A ± N/A") (() (,(event "/foo" "bar")) "^3\\.000 ± 0\\.000$"))) (define-simple-quantity-suite (:size/log) `((() () "^N/A$") (() (,(event "/foo" "bar")) "^4: 1$"))) (define-simple-quantity-suite (:size/all-time :reset? nil) `((() () "^0$") (() (,(event "/foo" "bar")) "^3$"))) (define-simple-quantity-suite (:scope) `((() () "^N/A$") (() (,(event "/foo")) "^/foo/: 1$") (() (,(event "/foo") ,(event "/bar") ,(event "/bar")) "^/bar/: 2, /foo/: 1$"))) (define-simple-quantity-suite (:method) (let+ (((&flet event (method) (make-event "/foo" "baz" :method method)))) `((() () "^N/A$") (() (,(event :a)) "^A: 1$") (() (,(event :a) ,(event :b) ,(event :b)) "^B: 2, A: 1$")))) (define-simple-quantity-suite (:origin) (let+ ((id1 (uuid:make-v4-uuid)) (id2 (uuid:make-v4-uuid)) ((&flet from (origin) (let ((event (make-event "/foo" "baz"))) (setf (event-origin event) origin) event)))) `((() () "^N/A$") (() (,(from id1)) ,(format nil "^~A: 1$" id1)) (() (,(from id1) ,(from id2) ,(from id2)) ,(format nil "^~A: 2, ~A: 1$" id2 id1))))) (define-simple-quantity-suite (:wire-schema) (let+ (((&flet event (wire-schema) (make-event "/foo" "baz" :rsb.transport.wire-schema wire-schema)))) `((() () "^N/A$") (() (,(event "a")) "^a: 1$") (() (,(event "a") ,(event "b") ,(event "b")) "^b: 2, a: 1$")))) (define-simple-quantity-suite (:type) `((() () "^N/A$") (() (,(make-event "/foo" 1)) "^BIT: 1$"))) (define-simple-quantity-suite (:meta-data-moments) (let+ (((&flet event (&rest args &key &allow-other-keys) (apply #'make-event "/foo" "baz" args)))) `(;; missing required initarg :key (() () error) ;; cannot compute moment on meta-data keys ((:key :keys) () error) ;; some key ((:key :foo) () "^N/A ± N/A$") ((:key :foo) (,(event :foo "1")) "^1\\.000 ± 0\\.000$") ((:key :foo) (,(event :foo "1") ,(event :bar "2") ,(event :foo "3") ,(event :foo "4")) "^2\\.667 ± 1\\.247$") ;; values ((:key :values) () "^N/A ± N/A$") ((:key :values) (,(event :foo "1")) "^1\\.000 ± 0\\.000$") ((:key :values) (,(event :foo "1") ,(event :bar "2") ,(event :foo "3") ,(event :foo "4")) "^2\\.500 ± 1\\.118$")))) (define-simple-quantity-suite (:latency) (let+ (((&flet args (&optional from to) `(,@(when from `(:from ,from)) ,@(when to `(:to ,to)))))) `(;; missing :from and :to initargs (() () error) (,(args :create) () error) (,(args nil :create) () error) ;; valid cases (,(args :create :create) () "^N/A ± N/A$") (,(args :create :create) (,(make-event "/foo" "baz")) "^[0-9]\\.[0-9]{3} ± [0-9]\\.[0-9]{3}$")))) (define-simple-quantity-suite (:expected) `(;; missing :target and :expected initargs (() () error) ((:target :does-not-matter) () error) ((:expected :does-not-matter) () error) ;; valid cases ((:target :count :expected 0) () "^0$") ((:target :count :expected 1) () "^!1: 0$") ((:target :count :expected 1) (,(event)) "^1$") ((:target :count :expected (:type (eql 0))) () "^0$") ((:target :count :expected (:type (eql 1))) () "^not a \\(EQL 1\\): 0$") ((:target :count :expected (:type (eql 1))) (,(event)) "^1$"))) ;; Local Variables: ;; coding: utf-8 ;; End:
6,675
Common Lisp
.lisp
134
41.895522
103
0.411096
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
480413d08b82bb0c44b03351a05c01c455fc405506c119b57de2b3b30f8a8994
37,307
[ -1 ]
37,308
package.lisp
open-rsx_rsb-tools-cl/main/package.lisp
;;;; package.lisp --- Package definition for the main rsb tools program. ;;;; ;;;; Copyright (C) 2011, 2013, 2014, 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:defpackage #:rsb.tools.main (:use #:cl #:alexandria #:let-plus #:net.didierverna.clon #:rsb.tools.commands) (:export #:main) (:documentation "Package definition for the main rsb tools program."))
438
Common Lisp
.lisp
16
24.375
72
0.683453
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
28edacfe4d5ad9b00d11749f2af63c43478e31310c2e3aeb35b937d25c8a1d28
37,308
[ -1 ]
37,309
package.lisp
open-rsx_rsb-tools-cl/info/package.lisp
;;;; package.lisp --- Package definition for the info utility. ;;;; ;;;; Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:defpackage #:rsb.tools.info (:use #:cl #:alexandria #:let-plus #:rsb #:rsb.tools.common #:rsb.formatting #:rsb.tools.commands #:net.didierverna.clon) (:export #:main) (:documentation "Main package of the `cl-rsb-tools-info' system."))
483
Common Lisp
.lisp
19
22.210526
66
0.665939
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
551ea638087d9af49608a144595d02f3c0b057dab54b4781d678bc3a568b4258
37,309
[ -1 ]
37,310
main.lisp
open-rsx_rsb-tools-cl/info/main.lisp
;;;; main.lisp --- Entry point of the info tool. ;;;; ;;;; Copyright (C) 2011-2019 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.info) (defun update-synopsis (&key (show :default)) "Create and return a commandline option tree." (make-synopsis ;; Basic usage and specific options. :item (make-text :contents "Describe the RSB system.") :item (make-common-options :show show) ;; :item (defgroup (:header "Display Options") (flag :long-name "verbose" :short-name "b" :description "Display all available information.") (flag :long-name "configuration" :short-name "f" :description "Display information regarding the default configuration?") (flag :long-name "transports" :short-name "c" :description "Display information regarding available transport implementations?") (flag :long-name "converters" :short-name "v" :description "Display information regarding available converters?") (flag :long-name "filters" :short-name "i" :description "Display information regarding available filters?") (flag :long-name "transforms" :short-name "t" :description "Display information regarding available event transformations?") (flag :long-name "event-processing" :short-name "e" :description "Display information regarding available event processing strategies?") (flag :long-name "participants" :short-name "p" :description "Display information regarding available participant kinds?")) ;; Append RSB options. :item (make-options :show? (or (eq show t) (and (listp show) (member :rsb show)))))) (defun main (program-pathname args) "Entry point function of the cl-rsb-tools-info system." (update-synopsis) (setf *configuration* (options-from-default-sources)) (process-commandline-options :commandline (list* (concatenate 'string (namestring program-pathname) " info") args) :version (rsb-tools-info-system:version/list :commit? t) :update-synopsis #'update-synopsis :return (lambda () (return-from main))) (enable-swank-on-signal) (let+ ((stream *standard-output*) (verbose? (getopt :long-name "verbose")) ((&flet make-initarg (name) (let* ((string (string-downcase name)) (long-name (subseq string 0 (1- (length string))))) (when (getopt :long-name long-name) (list name t))))) (command (apply #'make-command :info (append (when verbose? '(:all? t)) (mapcan #'make-initarg '(:version? :configuration? :transports? :converters? :filters? :transforms? :event-processing? :participants?)))))) (with-print-limits (stream) (with-logged-warnings (command-execute command)))))
3,643
Common Lisp
.lisp
81
30.666667
91
0.523609
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
6477a69fe42491076f5f9cc1e62d14089490c13f7a7b255b1dba137311f28fb3
37,310
[ -1 ]
37,311
package.lisp
open-rsx_rsb-tools-cl/bridge/package.lisp
;;;; package.lisp --- Package definition for rsb-bridge module. ;;;; ;;;; Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:defpackage #:rsb.tools.bridge (:use #:cl #:alexandria #:iterate #:let-plus #:more-conditions #:rsb #:rsb.tools.common #:rsb.tools.commands #:net.didierverna.clon) (:export #:main) (:documentation "Main package of the `cl-rsb-tools-bridge' system."))
502
Common Lisp
.lisp
20
21.85
66
0.668067
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
b8d38db2bc899a7eb6aab1a49203028ec0242286b8598b262e3eb1c38dd1fbb9
37,311
[ -1 ]
37,312
main.lisp
open-rsx_rsb-tools-cl/bridge/main.lisp
;;;; main.lisp --- Entry point of the bridge tool. ;;;; ;;;; Copyright (C) 2011-2019 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.bridge) (defun update-synopsis (&key (show :default) (program-name "rsb bridge")) "Create and return a commandline option tree." (make-synopsis ;; Basic usage and specific options. :postfix "[SIMPLE-FORWARDING-SPECIFICATION]" :item (make-text :contents (make-help-string :show show)) :item (make-common-options :show show) :item (make-error-handling-options :show show) :item (defgroup (:header "Bridge Options" :hidden (not (show-help-for? '(:bridge :filters) :default t :show show))) (lispobj :long-name "max-queued-events" :typespec '(or null positive-integer) :default-value 2000 :argument-name "NUMBER-OF-EVENTS" :description "The maximum number of events which may be queued for processing at any given time. Note that choosing a large value can require a large amount of memory.")) :item (make-idl-options) ;; Append RSB options. :item (make-options :show? (show-help-for? :rsb :show show)) ;; Append examples. :item (defgroup (:header "Examples") (make-text :contents (make-examples-string :program-name program-name))))) (defun main (program-pathname args) "Entry point function of the cl-rsb-tools-bridge system." (let ((program-name (concatenate 'string (namestring program-pathname) " bridge"))) (update-synopsis :program-name program-name) (setf *configuration* (options-from-default-sources)) (process-commandline-options :commandline (list* program-name args) :version (rsb-tools-bridge-system:version/list :commit? t) :update-synopsis (curry #'update-synopsis :program-name program-name) :return (lambda () (return-from main))) (enable-swank-on-signal)) (let* ((error-policy (maybe-relay-to-thread (process-error-handling-options))) (spec (first (remainder))) (max-queued-events (getopt :long-name "max-queued-events"))) (rsb.formatting:with-print-limits (*standard-output*) ;; Check bridge specification options. (unless spec (error "~@<Supply a bridge specification as remainder of the ~ commandline.~@:>")) (with-logged-warnings (with-error-policy (error-policy) ;; Load IDLs as specified on the commandline. (process-idl-options :purpose '(:deserializer :packed-size :serializer)) (let* ((spec (rsb.tools.commands.bridge:parse-spec spec)) (command (make-command :bridge :spec spec :max-queued-events max-queued-events))) (with-interactive-interrupt-exit () (command-execute command :error-policy error-policy))))))))
3,400
Common Lisp
.lisp
66
38.833333
180
0.564303
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
81c614df3d1267f86c7a8902bae7db1e1268f52e49048af75090b721e6374f75
37,312
[ -1 ]
37,313
help.lisp
open-rsx_rsb-tools-cl/bridge/help.lisp
;;;; help.lisp --- Help text generation for the bridge program. ;;;; ;;;; Copyright (C) 2011, 2012, 2013, 2014, 2015 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.tools.bridge) (defun make-help-string (&key (show :default)) (with-output-to-string (stream) (format stream "Forward events receivable in one part of an RSB ~ system to another part of the system.~@ ~@ Simple forwarding specifications describe from and ~ to which buses / scopes events should be forwarded ~ and can be constructed according to the following ~ grammar:~@ ~@ ~2@Tbridge-specification: ~ forwarding-specification (\";\" forwarding-specification)*~@ ~2@Tforwarding-specification: ~ unidirectional-forwarding-specification ~ | bidirectional-forwarding-specification~@ ~2@Tunidirectional-forwarding-specification: ~ (input-specification)+ ~ \"->\" ~ (filter)* transform? ~ (output-specification)+~@ ~2@Tbidirectional-forwarding-specification: ~ (input-specification)+ ~ \"<->\" ~ (output-specification)+~@ ~2@Tfilter: \"|\" FILTER-SPEC \"|\"~@ ~2@Ttransform: \"/\" TRANSFORM-SPEC \"/\"~@ ~2@Tinput-specification: URI~@ ~2@Toutput-specification: URI~@ ~@ * Unidirectional forwarding, described by the ~ unidirectional-forwarding-specification ~ production, consists in forwarding events from ~ bus / scope(s) described by the ~ input-specifications on the left hand side of ~ the -> to the bus / scope(s) described by the ~ output-specification on the right hand side. ~ ~@ * Bidirectional forwarding, described by the ~ bidirectional-forwarding-specification ~ production, is like unidirectional forwarding ~ but also forwards events from the right hand ~ side to the left hand side. As a consequence, ~ filters are not supported.~@ ~@ ") (with-abbreviation (stream :uri show) (format stream "URIs are of the form~@ ~@ ~2@T") (print-uri-help stream)))) (defun make-examples-string (&key (program-name "rsb bridge")) "Make and return a string containing usage examples of the program." (format nil "~2@T~A 'spread:/from -> spread:/to'~@ ~@ In the above example, the ~:*~A command is used to ~ establish unidirectional forwarding from scope /from to ~ scope /to within the bus designated by spread:.~@ ~@ Note the use of single quotes (') to prevent the shell ~ from breaking up the forwarding specification into ~ multiple arguments because of the whitespace in it.~@ ~@ ~2@T~:*~A 'socket://remotehost/ <-> socket://localhost/'~@ ~@ In the above example, the ~:*~A command is used to ~ establish bidirectional forwarding affecting all events ~ between remotehost and localhost.~@ ~@ Note the use of single quotes (') to prevent the shell ~ from breaking up the forwarding specification into ~ multiple arguments because of the whitespace in it." program-name))
4,086
Common Lisp
.lisp
80
33.8625
82
0.511117
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
7f2cfd0525a3a4523ec1dbe2e9a49f49b2b44d2c40838177150355fb55a6bc73
37,313
[ -1 ]
37,314
event-style-discard.lisp
open-rsx_rsb-tools-cl/src/formatting/event-style-discard.lisp
;;;; event-style-discard.lisp --- A style that ignores all events. ;;;; ;;;; Copyright (C) 2011, 2013, 2014, 2015 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) (defclass style-discard () () (:documentation "Ignore all events.")) (service-provider:register-provider/class 'style :discard :class 'style-discard) (defmethod format-event ((event t) (style style-discard) (stream t) &key) (values))
500
Common Lisp
.lisp
15
29.733333
67
0.677755
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
dd009ce5fea2bf350ded2cb2b085a09169693792504fef82eaf4cfc0c2548d27
37,314
[ -1 ]
37,315
text-style-mixins.lisp
open-rsx_rsb-tools-cl/src/formatting/text-style-mixins.lisp
;;;; text-style-mixins.lisp --- Mixin classes for textual formatting style classes. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) ;;; `periodic-printing-mixin' (defclass periodic-printing-mixin () ((stream :type (or null stream) :accessor style-%stream :initform nil :documentation "Stores the stream that should be used for periodic printing.") (pretty-state :type list :accessor style-%pretty-state :documentation "Stores the pretty-printer state that should be used for periodic printing.") (executor :accessor style-%executor :documentation "Stores the timer used to trigger periodic printing.") (lock :reader style-%lock :initform (bt:make-recursive-lock "Periodic printing lock") :documentation "Stores a lock that protects timer-triggered accesses to the style object against `format-event'-triggered accesses.")) (:default-initargs :print-interval 1) (:documentation "This mixin class is intended to be mixed into formatting classes that produce output periodically instead of being triggered by the arrival of events. When `format-event' is called, an :around method prevents output-producing methods from running. Instead, these method are run a timer-driven way.")) (defmethod initialize-instance :after ((instance periodic-printing-mixin) &key print-interval) (let+ (((&flet output (style) (when-let ((stream (style-%stream style))) (let+ (((*print-right-margin* *print-miser-width*) (style-%pretty-state style))) (ignore-some-conditions (stream-error) (format-event :trigger style stream))))))) (setf (style-%executor instance) (make-instance 'timed-executor/weak :interval print-interval :function #'output :args (list instance))))) (defmethod style-print-interval ((style periodic-printing-mixin)) (executor-interval (style-%executor style))) (defmethod (setf style-print-interval) :before ((new-value t) (style periodic-printing-mixin)) ;; Validate NEW-VALUE to prevent bad timer scheduling. (check-type new-value print-interval)) (defmethod (setf style-print-interval) ((new-value t) (style periodic-printing-mixin)) (setf (executor-interval (style-%executor style)) new-value)) (defmethod collects? ((style periodic-printing-mixin)) t) (defmethod format-event :around ((event t) (style periodic-printing-mixin) (stream t) &key) ;; Protect against concurrent access to STYLE and store STREAM for ;; use in timer-driven output. (bt:with-recursive-lock-held ((style-%lock style)) (unless (eq event :trigger) (setf (style-%stream style) stream (style-%pretty-state style) (list *print-right-margin* *print-miser-width*))) (call-next-method))) ;;; `output-buffering-mixin' (defclass output-buffering-mixin () () (:documentation "This mixin class provides buffering of output. This can be useful when lots of output has to be produced and written. This can, for example, reduce flickering.")) (defmethod format-event :around ((event (eql :trigger)) (style output-buffering-mixin) (stream t) &rest args &key) (write-string (with-output-to-string (stream) (apply #'call-next-method event style stream args)) stream) (force-output stream)) ;;; `header-printing-mixin' (defclass header-printing-mixin (counting-mixin) ((header-frequency :initarg :header-frequency :type (or null positive-integer) :accessor style-header-frequency :initform 22 :documentation "Stores the number of output cycles after which a header should be printed or nil in case a header is never printed.")) (:documentation "This class is intended to be mixed into formatting style classes that periodically print a header of some kind into their regular stream of output.")) (defmethod format-event :before ((event t) (style header-printing-mixin) (stream t) &key) (let+ (((&structure-r/o style- header-frequency) style)) (when (and header-frequency (zerop (mod (style-count style) header-frequency))) (format-header style stream)))) ;;; `separator-mixin' (defclass separator-mixin () ((separator :type separator-spec :accessor style-separator :initform #\Newline :documentation "The character or pattern by means of which items should be separated in the output.")) (:documentation "This class is intended to be mixed into style classes that should print separators between output items.")) (defmethod shared-initialize :after ((instance separator-mixin) (slot-names t) &key (separator nil separator-supplied?)) (when separator-supplied? (setf (style-separator instance) separator))) (defmethod (setf style-separator) :before ((new-value t) (style separator-mixin)) (check-type new-value separator-spec "a valid separator specification")) (defmethod format-event :before ((event t) (style separator-mixin) (stream t) &key) ;; Print a separator before each event. (print-separator (style-separator style) stream (or *print-right-margin* 80))) ;; Utility functions (defun %separator-width (spec &key (max-columns 0)) (etypecase spec (null 0) (character 1) (string (length spec)) (rule-spec max-columns) ((eql :clear) 0) (list (reduce #'+ spec :key (rcurry #'%separator-width max-columns))))) (defun print-separator (spec stream max-columns) "Print a separator according to SPEC onto STREAM." (etypecase spec (null) ((or character string) (princ spec stream)) (rule-spec (princ (make-string max-columns :initial-element (second spec)) stream)) ((eql :clear) (format stream "~C~A~C~A" #\Escape "[1;1f" #\Escape "[J")) (list (map nil (rcurry #'print-separator stream max-columns) spec)))) ;;; `max-lines-mixin' (defclass max-lines-mixin () ((max-lines :initarg :max-lines :type (or null non-negative-integer) :reader style-max-lines :initform nil :documentation "Nil, indicating no limitation, or the maximum number of lines the style should produce for a single event.")) (:documentation "This class is indented to be mixed into style classes which allow restricting the amount of output to a given number of lines.")) (defmethod format-event :around ((event t) (style max-lines-mixin) (target t) &key) (let ((*print-lines* (style-max-lines style))) (call-next-method))) ;;; `width-specification-mixin' (defclass width-specification-mixin () ((widths :initarg :widths :type width-specification :accessor column-widths :documentation "Stores a `width-specification' for the column.") (priority :initarg :priority :type positive-real :accessor column-priority :documentation "Stores a real specifying the importance of this column in comparison to other columns. Larger priorities indicate more important columns.")) (:default-initargs :priority 3) (:documentation "This class is intended to be mixed into column classes for which a width should be automatically computed based on a specification of possible widths.")) (defmethod (setf column-widths) :before ((new-value t) (style width-specification-mixin)) (check-type new-value width-specification)) (defmethod shared-initialize :before ((instance width-specification-mixin) (slot-names t) &key (widths nil widths-supplied?) (width nil width-supplied?)) (unless (or widths-supplied? width-supplied?) (missing-required-initarg 'width-specification-mixin :widths-xor-width)) (when (and widths-supplied? width-supplied?) (check-type widths (satisfies width-specification?)) (unless (compatible-with-width-specification? width widths) (incompatible-initargs 'width-specification-mixin :widths widths :width width)))) (defmethod shared-initialize :after ((instance width-specification-mixin) (slot-names t) &key (widths nil widths-supplied?) (width nil width-supplied?)) (cond (width-supplied? (setf (column-widths instance) width)) (widths-supplied? (setf (column-widths instance) widths)))) ;;; `width-mixin' (defclass width-mixin () ((width :initarg :width :type (or null non-negative-integer) :accessor column-width :initform nil :documentation "Stores the maximum acceptable output width for the formatter instance.") (alignment :initarg :alignment :type (member :left :right) :accessor column-alignment :initform :right :documentation "Stores the alignment that should be employed by the formatter instance.")) (:documentation "This class is intended to be mixed into formatting classes that should produce output of a fixed width.")) (defmethod format-header :around ((column width-mixin) (stream t)) (call-with-width-limit stream (column-width column) :left (lambda (stream) (call-next-method column stream)))) (defmethod format-event :around ((event t) (style width-mixin) (stream t) &key) (call-with-width-limit stream (column-width style) (column-alignment style) (lambda (stream) (call-next-method event style stream)))) (defmethod print-object ((object width-mixin) stream) (print-unreadable-object (object stream :type t :identity t) (format stream "~:[<no width>~;~:*~D~] ~A" (column-width object) (column-alignment object)))) ;; Utility functions (defun call-with-width-limit (stream limit align thunk) "Call THUNK with a single argument that is a stream. Format things printed to the stream by THUNK on STREAM ensuring a width limit LIMIT and alignment according to ALIGN. ALIGN can be :left or :right." (let+ ((value (with-output-to-string (stream) (funcall thunk stream))) (length (length value)) ((&flet ellipsis () (if *output-unicode?* #\… #\.)))) (cond ;; No room at all - print nothing. ((zerop limit)) ;; Only room for a single character - print ellipsis if we have ;; any output. ((< limit 1 length) (format stream "~C" (ellipsis))) ;; Not enough room - print value and ellipsis. ((< limit length) (ecase align (:left (format stream "~A~C" (subseq value 0 (- limit 1)) (ellipsis))) (:right (format stream "~C~A" (ellipsis) (subseq value (1+ (- length limit))))))) ;; Enough room - pad value. (t (ecase align (:left (format stream "~VA" limit value)) (:right (format stream "~V@A" limit value))))))) (defmacro with-width-limit ((stream-var limit align) &body body) "Execute BODY with a STREAM-VAR bound to a stream. Format things sprinted to the value of STREAM-VAR in BODY on the previous value of STREAM-VAR ensuring a width limit LIMIT and alignment according to ALIGN. ALIGN can be :left or :right." `(call-with-width-limit ,stream-var ,limit ,align (lambda (,stream-var) ,@body))) ;;; `columns-mixin' (defclass columns-mixin () ((columns :type list :accessor style-columns :accessor style-%columns ; does not process column specs :initform '() :documentation "Stores the list of columns of which the formatting style is composed.") (separator :initarg :separator :type string :accessor style-separator :initform (if *output-unicode?* "│" "|") :documentation "Stores a separator string that is printed between the output produced by adjacent columns.")) (:documentation "This mixin class is intended to be mixed into formatting styles that produce column-based output. When combined with `header-printing-mixin', column names are used to produce header lines. When setting columns via the :columns initarg or \(setf style-columns\), a list of either column instances or column specifications can be used. A column specification is either a keyword designating a class in the column class family or a list of the form (CLASS KEY1 VALUE1 KEY2 VALUE2 ...) consisting of the keyword CLASS and initargs for the column class designated by CLASS.")) (defmethod shared-initialize :after ((instance columns-mixin) (slot-names t) &key (columns nil columns-supplied?)) ;; Interpret column specs in COLUMNS, if it has been supplied. (when columns-supplied? (setf (style-columns instance) columns))) (defmethod (setf style-columns) :around ((new-value list) (style columns-mixin)) ;; Interpret each element of NEW-VALUE as a column instance or a ;; specification for creating a column instance. (call-next-method (mapcar #'make-column new-value) style)) (defmethod rsb.ep:access? ((processor columns-mixin) (part t) (mode t)) (rsb.ep:access? (style-columns processor) part mode)) (defmethod format-header ((style columns-mixin) (stream t)) (let+ (((&structure-r/o style- columns separator) style) (produced-output?)) (iter (for column in columns) (when (column-produces-output? column) (when produced-output? (format stream separator)) (format-header column stream) (setf produced-output? t))) (when produced-output? (terpri stream)))) (defmethod format-event ((event t) (style columns-mixin) (stream t) &key) (let+ (((&structure-r/o style- columns separator) style) (produced-output?)) (iter (for column in columns) (if (column-produces-output? column) (progn (when produced-output? (format stream separator)) (format-event event column stream) (setf produced-output? t)) (format-event event column stream))))) (defmethod print-object ((object columns-mixin) stream) (print-unreadable-object (object stream :type t :identity t) (format stream "(~D)" (length (style-columns object))))) ;;; `widths-caching-mixin' (defclass widths-caching-mixin () ((width-cache :type vector :accessor style-width-cache :initform (make-array 1000 :initial-element nil :adjustable t) :documentation "Stores results of width computations indexed by target width.") (previous-width :type (or null non-negative-integer) :accessor style-%previous-width :initform nil)) (:documentation "This class is intended to be mixed into classes which perform column width computations. It add caching of computation results for repeated widths.")) (defmethod style-compute-column-widths ((style widths-caching-mixin) (columns sequence) (width integer) &key separator-width) (declare (ignore separator-width)) (let+ (((&structure-r/o style- width-cache %previous-width) style) ((&flet ensure-cached-widths (width) (unless (< width (length width-cache)) (adjust-array width-cache (1+ width) :initial-element nil)) (or (aref width-cache width) (setf (aref width-cache width) (call-next-method)))))) (multiple-value-prog1 (values (ensure-cached-widths width) (equal %previous-width width)) (setf %previous-width width)))) ;; Local Variables: ;; coding: utf-8 ;; End:
18,675
Common Lisp
.lisp
411
33.223844
84
0.57471
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
adc1dbadd2f0884d74d1e949de37e97b3780d9013788f9e202976765a5d7a770
37,315
[ -1 ]
37,316
payload-generic.lisp
open-rsx_rsb-tools-cl/src/formatting/payload-generic.lisp
;;;; payload.lisp --- Formatting methods for different kinds of event payloads. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) ;;; `payload-style-generic/pretty' (defclass payload-style-generic/pretty () () (:documentation "Generic formatting for arbitrary payloads.")) (service-provider:register-provider/class 'style :payload-generic/pretty :class 'payload-style-generic/pretty) (defmethod format-payload :around ((payload t) (style payload-style-generic/pretty) (stream t) &rest args &key) (pprint-logical-block (stream (list payload)) (apply #'call-next-method payload style stream args))) (defmethod format-payload ((payload t) (style payload-style-generic/pretty) (stream t) &key) ;; Default behavior is to print PAYLOAD using the Lisp pretty ;; printer. (princ payload stream)) (defmethod format-payload ((payload vector) (style payload-style-generic/pretty) (stream t) &key) ;; Format PAYLOAD in form of a hexdump if it is an octet-vector. (if (typep payload 'octet-vector) (let+ ((length (length payload)) ((&values &ign &ign end) (utilities.binary-dump:binary-dump payload :end nil ; ignore *print-length* :lines (when *print-lines* (max 0 (1- *print-lines*))) :stream stream :base 16 :offset-base 16))) (unless (= end length) (format stream "~@:_[~:D octet~:P omitted]" (- length end)))) (call-next-method))) (defmethod format-payload ((payload string) (style payload-style-generic/pretty) (stream t) &key) ;; Format PAYLOAD as a multi-line string, trying to honor ;; `*print-lines*' and `*print-length*' constraints. (format-string stream payload)) (defmethod format-payload ((payload scope) (style payload-style-generic/pretty) (stream t) &key) (write-string (scope-string payload) stream)) (defmethod format-payload ((payload standard-object) (style payload-style-generic/pretty) (stream t) &key) ;; Recursively format the slot values of PAYLOAD. (format-instance stream payload)) ;;; `payload-style-generic/raw' (defclass payload-style-generic/raw () () (:documentation "Raw formatting for binary payloads.")) (service-provider:register-provider/class 'style :payload-generic/raw :class 'payload-style-generic/raw) (defmethod format-payload ((payload simple-array) (style payload-style-generic/raw) (stream t) &key) (write-sequence payload stream))
3,239
Common Lisp
.lisp
75
31.146667
79
0.556825
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
549dc85d7ab0b3d75b89fceb0c05db6bffa5141abe0b462c012315e3b05c8534
37,316
[ -1 ]
37,317
package.lisp
open-rsx_rsb-tools-cl/src/formatting/package.lisp
;;;; package.lisp --- Package definition for the formatting module. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:defpackage #:rsb.formatting (:use #:cl #:alexandria #:let-plus #:iterate #:more-conditions #:nibbles #:rsb) ;; Types (:export #:timestamp/unix/nsec #:time-spec #:bounds-spec #:bounds #:rule-spec #:separator-spec #:width-specification #:width-specification? #:compatible-with-width-specification? #:print-interval #:dimension-spec/short #:dimension-spec/full #:dimension-spec #:template-designator #:script-designator) ;; Conditions (:export #:style-creation-error #:style-creation-error-specification #:format-code-error ; condition class and function #:format-code-error-code #:simple-format-code-error #:format-code-read-error) ;; Variables (:export #:*output-unicode?*) ;; Event formatting protocol (:export #:format-event #:format-payload) ;; Formatting style class family (:export #:make-style) ;; Collecting protocol (:export #:collects?) ;; Delegation protocol (:export #:style-sub-styles #:sub-style-for #:delegate #:make-sub-style-entry) ;; Sub-style sorting protocol (:export #:style-sub-styles/sorted) ;; Sub-style pruning protocol (:export #:style-prune-predicate ; also setf #:prune-sub-styles) ;; Data consistency protocol (:export #:descriptor-for-target #:make-descriptor #:compatible-descriptors? #:incompatible-descriptors) ;; Temporal bounds protocol (:export #:lower-bound #:upper-bound #:bounds #:bounds/expanded #:range/expanded) ;; Header protocol (:export #:format-header) ;; Separator protocol (:export #:style-separator #:style-separator-width) ;; Column protocol (:export #:value< #:column< #:column-name #:column-width #:column-produces-output?) ;; Column construction (:export #:make-column) ;; Column widths protocol (:export #:style-dynamic-width-columns #:style-compute-column-widths #:style-assign-column-widths) ;; Width computation (:export #:optimize-widths) ;; `width-specification-mixin' mixin class (:export #:width-specification-mixin #:column-widths #:column-priority) ;; `width-mixin' mixin class (:export #:width-mixin #:column-alignment #:call-width-width-limit #:with-width-limit) ;; `counting-mixin' mixin class (:export #:couting-mixin #:style-count) ;; `activity-tacking-mixin' mixin class (:export #:activity-tracking-mixin #:style-last-activity) ;; `header-printing-mixin' mixin class (:export #:header-printing-mixin #:style-header-frequency) ;; `basic-column' class (:export #:basic-column) ;; `column-constant' class (:export #:oclumn-constant #:column-value #:column-formatter) ;; `columns-mixin' mixin class (:export #:columns-mixin #:style-columns) ;; `periodic-printing-mixin' mixin class (:export #:periodic-printing-mixin #:style-print-interval) ;; `delegating-mixin' mixin class (:export #:delegating-mixin) ;; `sub-style-grouping-mixin' mixin class (:export #:sub-style-grouping-mixin #:style-key #:style-test) ;; `sub-style-sorting-mixin' (:export #:sub-style-sorting-mixin #:style-sort-predicate #:style-sort-key) ;; `sub-style-pruning-mixin' and ;; `activity-based-sub-style-pruning-mixin' (:export #:sub-style-pruning-mixin #:activity-based-sub-style-pruning-mixin) ;; `separator-mixin' mixin class (:export #:separator-mixin) ;; `max-lines-mixin' mixin class (:export #:max-lines-mixin #:style-max-lines) ;; `image-output-mixin' mixin class (:export #:image-output-mixin #:style-width #:style-height #:normalize-dimension-spec #:apply-dimension-spec) ;; `data-consistency-mixin' mixin class (:export #:data-consistency-mixin) ;; `timestamp-mixin' mixin class (:export #:timestamp-mixin #:style-timestamp) ;; `temporal-bounds-mixin' mixin class (:export #:temporal-bounds-mixin) ;; `payload-style-mixin' mixin class (:export #:payload-style-mixin #:style-payload-style) ;; `output-forcing-mixin' mixin class (:export #:output-forcing-mixin) ;; `style-meta-data' style class (:export #:style-meta-data #:style-routing-info? #:style-timestamps? #:style-user-items? #:style-causes?) ;; `style-detailed' style class (:export #:style-detailed) ;; `event-style-compact' style class (:export #:event-style-compact) ;; `style-statistics' style class (:export #:style-statistics) ;; Default variable names provided by programmable styles (:export #:sequence-number #:id #:scope #:origin #:data #:create #:create-unix #:create-unix-nsec #:send #:send-unix #:send-unix-nsec #:receive #:receive-unix #:receive-unix-nsec #:deliver #:deliver-unix #:deliver-unix-nsec #:causes/event-id #:causes/uuid #:skip-event) ;; `style-programmable' style class (:export #:style-programmable #:style-code #:style-bindings #:compile-code) ;; `style-programmable/script' style class (:export #:style-programmable/script #:style-script) ;; `style-programmable/template' style class (:export #:style-programmable/template #:style-template) ;; `style-multiple-files' (:export #:style-multiple-files #:style-filename-style #:style-event-style) ;; `style-image/png' style class (:export #:style-image/png) ;; `style-audio-stream' style class (:export #:style-audio-stream) ;; `style-audio-stream/raw' style class (:export #:style-audio-stream/raw) ;; `style-audio-stream/wav' style class (:export #:style-audio-stream/wav) ;; `style-json' style class (:export #:style-json) ;; Order of magnitude functions (:export #:print-human-readable-value #:print-human-readable-order-of-magnitude #:print-human-readable-count #:print-human-readable-size #:print-human-readable-duration) ;; Formatting functions (:export #:format-string) ;; Stream-related functions (:export #:stream-line-width #:with-print-limits #:call-with-print-limits) ;; Help text generation (:export #:make-style-help-string) (:documentation "This package contains formatting functions for RSB events and event payloads."))
6,599
Common Lisp
.lisp
276
20.054348
67
0.686567
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
cdfddad590ea560127e0dc491ccffb6c8111f18eb2eb4addd2aed35c472281ee
37,317
[ -1 ]
37,318
protocol.lisp
open-rsx_rsb-tools-cl/src/formatting/protocol.lisp
;;;; protocol.lisp --- Protocol for formatting of RSB events. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) ;;; Event formatting protocol (defgeneric format-event (event style stream &key &allow-other-keys) (:documentation "Format EVENT onto STREAM using a style designated by STYLE. MAX-LINES controls specifies the maximum number of lines the produced output is allowed to take up. MAX-COLUMNS limits the number of columns individual output lines are allowed to take up.")) (defgeneric format-payload (data style stream &key &allow-other-keys) (:documentation "Format the event payload DATA onto STREAM using a formatting style designated by STYLE. MAX-LINES controls specifies the maximum number of lines the produced output is allowed to take up. MAX-COLUMNS limits the number of columns individual output lines are allowed to take up.")) ;;; Formatting style class family (service-provider:define-service style (:documentation "This class family consists of event formatting style classes. Each class implements a particular style of formatting received events onto a given stream by specializing `format-event'.")) (defgeneric make-style (spec &rest args) (:documentation "Make and return a style instance according to SPEC. SPEC can either be a keyword, designating a style class, a list of the form (CLASS KEY1 VALUE1 KEY2 VALUE2 ...) designating a style class and specifying initargs, or a style instance.")) (define-condition-translating-method make-style (spec &rest args) ((error style-creation-error) :specification (append (ensure-list spec) (remove-from-plist args :service)))) (defmethod make-style ((spec symbol) &rest args &key (service 'style)) (apply #'service-provider:make-provider service spec (remove-from-plist args :service))) (defmethod make-style ((spec cons) &rest args) (check-type spec (cons keyword list) "a keyword followed by initargs") (if args (apply #'make-style (first spec) (append args (rest spec))) (apply #'make-style spec))) (defmethod make-style ((spec standard-object) &rest args) (when args (apply #'incompatible-arguments :spec spec args)) spec) ;;; Collecting protocol (defgeneric collects? (thing) (:documentation "Return non-nil if THING collects data from events and only produces output for explicit trigger events.")) ;; Default behavior (defmethod collects? ((thing t)) nil) ;;; Delegation protocol (defgeneric sub-style-for (style event) (:documentation "Return a sub-style object of STYLE or a sequence of such style objects for formatting EVENT. nil indicates that EVENT should not be processed in any sub-style.")) (defgeneric delegate (event style stream) (:documentation "Delegate processing of EVENT on STREAM by STYLE to a sub-style.")) (defgeneric make-sub-style-entry (style value) (:documentation "Create and return a list of the form (PREDICATE SUB-STYLE) where PREDICATE is a function of one parameter, a thing to be formatted, which decides whether the sub-style SUB-STYLE of STYLE is suitable for formatting the object. Return nil when no sub-style entry should be created for VALUE. VALUE depends on how STYLE organizes its sub-styles. See `sub-style-for' and `delegate'.")) ;;; Sub-style sorting protocol (defgeneric style-sub-styles/sorted (style &key predicate key) (:documentation "Return a list of style object which are sub-styles of STYLE, sorted according to PREDICATE and KEY.")) ;;; Sub-style pruning protocol (defgeneric style-prune-predicate (style) (:documentation "Return the prune predicate of STYLE. Either nil or a function accepting a sub-style object and returning true if the sub-style should be pruned.")) (defgeneric (setf style-prune-predicate) (new-value style) (:documentation "Set prune predicate of STYLE to NEW-VALUE. NEW-VALUE is either nil or a function accepting a sub-style object and returning true if the sub-style should be pruned.")) (defgeneric prune-sub-styles (style) (:documentation "Remove sub-styles satisfying the prune predicate of STYLE (if any) from STYLE.")) ;;; Data consistency protocol (defgeneric descriptor-for-target (style target) (:documentation "Return a descriptor of acceptable output send to TARGET by STYLE. The returned descriptor can be any object returned by a method for STYLE on `make-descriptor' that works with specialized methods for STYLE on `compatible-descriptors?' and `incompatible-descriptors'.")) (defgeneric (setf descriptor-for-target) (new-value style target) (:documentation "Install NEW-VALUE as an descriptor of acceptable output send to TARGET by STYLE. NEW-VALUE can be any object returned by a method for STYLE on `make-descriptor' that works with specialized methods for STYLE on `compatible-descriptors?' and `incompatible-descriptors'.")) (defgeneric make-descriptor (style data target) (:documentation "Return a descriptor of acceptable output send to TARGET by STYLE. The descriptor can be derived from DATA when future output has to be compatible to DATA in some sense. The returned descriptor has to work with methods on `compatible-descriptors?' and `incompatible-descriptors' specialized for STYLE.")) (defgeneric compatible-descriptors? (style descriptor-1 descriptor-2) (:documentation "Return non-nil if DESCRIPTOR-1 and DESCRIPTOR-2 are compatible for the kind of output performed by STYLE. Return nil otherwise.")) (defgeneric incompatible-descriptors (style descriptor-1 descriptor-2) (:documentation "Signal an error which indicates that DESCRIPTOR-1 and DESCRIPTOR-2 are not compatible for the kind of output performed by STYLE.")) ;;; Temporal bounds protocol (defgeneric lower-bound (thing) (:documentation "Return the lower temporal bound of THING. See type `time-spec'.")) (defgeneric (setf lower-bound) (new-value thing) (:documentation "Set the lower temporal bound of THING to NEW-VALUE. See type `time-spec'.")) (defgeneric upper-bound (thing) (:documentation "Return the upper temporal bound of THING. See type `time-spec'.")) (defgeneric (setf upper-bound) (new-value thing) (:documentation "Set the upper temporal bound of THING to NEW-VALUE. See type `time-spec'.")) (defgeneric bounds (thing) (:documentation "Return the temporal bounds of THING. See type `bounds-spec'.")) (defgeneric (setf bounds) (new-value thing) (:documentation "Set the temporal bounds of THING to NEW-VALUE. See type `bounds-spec'.")) (defgeneric bounds/expanded (thing &optional now) (:documentation "Return a list of the form (LOWER UPPER) containing the temporal bounds of THING as `timestamp/unix/nsec' relative to NOW. NOW can be a `local-time:timestamp', a `timestamp/unix/nsec' or nil, in which case the current time is used.")) (defgeneric range/expanded (thing) (:documentation "Return the difference between the upper and lower temporal bound of THING in nanoseconds.")) ;;; Header printing protocol (defgeneric format-header (thing target) (:documentation "Format a header for THING into TARGET.")) ;;; Separator protocol (defgeneric style-separator-width (style) (:documentation "Return the width of the separator printed by STYLE in characters.")) ;; Default behavior (declaim (ftype function %separator-width)) (defmethod style-separator-width ((style t)) (%separator-width (style-separator style))) ;;; Column protocol (defgeneric value< (left right) (:documentation "Return true if value LEFT should be sorted before value RIGHT.")) (defgeneric column< (left right) (:documentation "Return true if column LEFT should be sorted before column RIGHT.")) (defgeneric column-name (column) (:documentation "Return the name of COLUMN.")) (defgeneric column-width (column) (:documentation "Return the width in characters of COLUMN.")) (defgeneric column-produces-output? (column) (:documentation "Return non-nil if COLUMN produces output when asked to format something. This can be nil for example the width of COLUMN has been set to zero or if COLUMN is actually a pseudo-column producing things like linebreaks.")) ;; Default behavior (defmethod value< ((left real) (right real)) (< left right)) (defmethod value< ((left symbol) (right symbol)) (string< left right)) (defmethod value< ((left string) (right string)) (string< left right)) (defmethod value< ((left scope) (right scope)) (value< (scope-string left) (scope-string right))) (defmethod value< ((left uuid:uuid) (right uuid:uuid)) (value< (princ-to-string left) (princ-to-string right))) (defmethod value< ((left t) (right t)) (let+ (((&flet value? (thing) (typep thing '(not (or null (eql :n/a))))))) (cond ((and (value? left) (not (value? right)))) ((and (not (value? left)) (value? right)) nil)))) (defmethod column-produces-output? ((column t)) "Default implementation assumes that COLUMN produces output if its width is positive." (plusp (column-width column))) ;;; Column class family (service-provider:define-service column (:documentation "Providers can be used in column-based formatting styles. Column classes have to implement the column protocol consisting of: + `column-name' + `column-width' + [`column-produces-output?' default implementation available] + `format-event'")) (defun make-column (spec) "Make and return a column instance according to SPEC. SPEC can either be a keyword, designating a column class, a list of the form (CLASS KEY1 VALUE1 KEY2 VALUE2 ...) designating a column class and specifying initargs, or a column instance." (etypecase spec (keyword (service-provider:make-provider 'column spec)) (list (apply #'service-provider:make-provider 'column spec)) (standard-object spec))) ;;; Dynamic column width protocol (defgeneric style-dynamic-width-columns (style) (:documentation "Return a list of the columns of STYLE the width of which should be dynamically adjusted.")) (defgeneric style-compute-column-widths (style columns width &key separator-width) (:documentation "Compute and return a sequence of widths that distributes the available WIDTH among the COLUMNS of STYLE. If supplied, SEPARATOR-WIDTH is the width of a separator string printed between columns.")) (defgeneric style-assign-column-widths (style columns widths) (:documentation "Assign the sequence of widths WIDTHS to the COLUMNS of STYLE.")) ;; Default behavior (defmethod style-dynamic-width-columns ((style t)) (let+ (((&flet width-spec? (column) (compute-applicable-methods #'column-widths (list column))))) (remove-if-not #'width-spec? (style-columns style)))) (defmethod style-compute-column-widths ((style t) (columns sequence) (width integer) &key (separator-width 0)) (let ((specs (map 'list #'column-widths columns)) (priorities (map 'list #'column-priority columns))) (optimize-widths width specs priorities :separator-width separator-width))) (defmethod style-assign-column-widths ((style t) (columns sequence) (widths sequence)) (map nil (lambda (column width) (setf (column-width column) width)) columns widths))
12,064
Common Lisp
.lisp
279
37.978495
73
0.71409
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
b76ec25a7801dff36ff0bca444d00981cf8c7c6b24a35ff19e1cf3ffcdd56e55
37,318
[ -1 ]
37,319
event-style-detailed.lisp
open-rsx_rsb-tools-cl/src/formatting/event-style-detailed.lisp
;;;; event-style-detailed.lisp --- Detailed event formatting style class. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) (defclass style-detailed (meta-data-mixin payload-style-mixin separator-mixin max-lines-mixin output-forcing-mixin) () (:default-initargs :payload-style :payload-generic/pretty :separator `(#\Newline (:rule ,(if *output-unicode?* #\─ #\-)) #\Newline) :max-lines 200) (:documentation "Format each event on multiple lines with as many details as possible.")) (service-provider:register-provider/class 'style :detailed :class 'style-detailed) (defmethod format-event ((event event) (style style-detailed) (stream t) &key) (pprint-logical-block (stream (list event)) ;; Meta-data. (call-next-method) ;; Payload. (when (or (not *print-lines*) (> *print-lines* 13)) (let+ ((data (event-data event)) ((&values type length unit) (event-payload-description event)) (*print-lines* (when *print-lines* (max 0 (- *print-lines* 11))))) (format stream "~@:_~ Payload: ~A~:[~*~;, ~:*~:D ~(~A~)~2:*~P~*~]~ ~@:_~2@T" (typecase type ((and symbol (not keyword)) (with-standard-io-syntax (prin1-to-string type))) (t type)) length unit) (pprint-logical-block (stream (list data)) (format-payload data (style-payload-style style) stream))))))
1,861
Common Lisp
.lisp
47
27.808511
75
0.516307
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
a2a720342667621a366638bd93063ae6e0778406d16391ac2b922c7c33f10b72
37,319
[ -1 ]
37,320
types.lisp
open-rsx_rsb-tools-cl/src/formatting/types.lisp
;;;; types.lisp --- Types used in the formatting module. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) ;;; Time-related types (deftype timestamp/unix/nsec () "Time in nanoseconds since UNIX epoch." 'non-negative-integer) ;; Time specs (deftype time-spec/variable () "Time specifications which refer to variables." '(member :now :newest)) (deftype time-spec/operator () "Operators which can occur in time specifications." '(member + - * / mod)) (deftype time-spec () "Time specification expressions allowing constants, variables and operators." '(or time-spec/variable real (cons time-spec/operator (cons (satisfies time-spec-p) (cons (satisfies time-spec-p) null))))) (defun time-spec-p (thing) "Return non-nil, if THING is of type `time-spec'." (typep thing 'time-spec)) ;; Bounds and bound specs (deftype bounds-spec () "A list of the form (LOWER-BOUND UPPER-BOUND) where LOWER-BOUND and UPPER-BOUND are `time-spec's." '(cons time-spec (cons time-spec null))) (defun boundsp (thing) "Return non-nil if THING is of type `bounds'." (and (typep thing '(cons timestamp/unix/nsec (cons timestamp/unix/nsec null))) (< (first thing) (second thing)))) (deftype bounds () "A list of the form (LOWER-BOUND UPPER-BOUND) where LOWER-BOUND and UPPER-BOUND are of type `timestamp/unix/nsec' and LOWER-BOUND represents and earlier time than UPPER-BOUND." '(satisfies boundsp)) ;;; (deftype rule-spec () "A rule specification of the form (:RULE CHARACTER)." '(cons (eql :rule) (cons character null))) (deftype separator-spec () "This type consists of several possible separator specifications." `(or null character string rule-spec (eql :clear) (cons (not keyword) list))) ;;; Width specification (defun width-specification? (thing) (labels ((rec (thing) (typecase thing (non-negative-integer t) ((cons (eql :range) (cons non-negative-integer (or null (cons positive-integer null)))) (let+ (((&ign lower &optional upper) thing)) (or (not upper) (<= lower upper)))) (cons (every #'rec thing))))) (rec thing))) (defun compatible-with-width-specification? (value specification) (labels ((check (specification) (typecase specification (non-negative-integer (= value specification)) ((cons (eql :range)) (let+ (((&ign lower &optional upper) specification)) (and (>= value lower) (or (not upper) (<= value upper))))) (cons (some #'check specification))))) (check specification))) (deftype width-specification () "Specification or list of specifications of the form POSITIVE-INTEGER | (:range MIN [MAX]) where MIN and MAX, if both supplied are positive integers such that MIN <= MAX." '(satisfies width-specification?)) ;;; Periodic printing (deftype print-interval () "Print interval specifications." '(or null positive-real)) ;;; Image-related types. (deftype dimension-spec/short () "Short specification of an image dimension." '(or positive-integer positive-real (eql t))) (deftype dimension-spec/full () "Full specification of an image dimension." '(or (cons (eql :px) (cons positive-integer null)) (cons (eql :%) (cons positive-real null)) (eql t))) (deftype dimension-spec () "Either short or full specification of an image dimension." '(or dimension-spec/short dimension-spec/full)) ;;; (deftype template-designator () "A thing that can be converted into a formatting template." '(or string stream pathname)) (deftype script-designator () "A thing that can be converted into a formatting script." '(or list string stream pathname))
4,200
Common Lisp
.lisp
116
29.37931
70
0.63284
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
c8c3e7244d5b9f2e6dc78bdaf5cb24d43cf75528cbd14f69ce1c27be91bbeb65
37,320
[ -1 ]
37,321
event-style-statistics.lisp
open-rsx_rsb-tools-cl/src/formatting/event-style-statistics.lisp
;;;; event-style-statistics.lisp --- Column-oriented formatting of statistics. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) ;;; Class `statistics-columns-mixin' (defclass statistics-columns-mixin (columns-mixin) () (:documentation "This class is intended to be mixed into formatting classes that present the values of statistical quantities in a column-based manner.")) (defmethod collects? ((style statistics-columns-mixin)) t) (defmethod format-event :around ((event t) (style statistics-columns-mixin) (stream t) &key) ;; Update quantities. (if (eq event :trigger) (call-next-method) (map nil (lambda (column) (when (collects? column) (format-event event column stream))) (style-columns style)))) ;;; Class `style-statistics' (defclass style-statistics (periodic-printing-mixin statistics-columns-mixin widths-caching-mixin header-printing-mixin) () (:default-initargs :default-columns '(:now :rate :throughput :latency :scope/40 :type/40 :size :origin/40 :newline)) (:documentation "This formatting style computes a number of configurable statistical quantities from received events collected over a configurable period of time and prints the computed values in a tabular manner.")) (service-provider:register-provider/class 'style :statistics :class 'style-statistics) (defmethod shared-initialize :around ((instance style-statistics) (slot-names t) &rest args &key (default-columns nil default-columns-supplied?) (columns default-columns columns-supplied?)) (if (or columns-supplied? default-columns-supplied?) (apply #'call-next-method instance slot-names (list* :columns (mapcar #'expand-column-spec columns) (remove-from-plist args :columns :default-columns))) (call-next-method))) (defmethod format-event :before ((event (eql :trigger)) (style style-statistics) (stream t) &key (width (or *print-right-margin* 80))) (let+ (((&structure-r/o style- dynamic-width-columns separator-width) style) ((&values widths cached?) (style-compute-column-widths style dynamic-width-columns width :separator-width separator-width))) (unless cached? (style-assign-column-widths style dynamic-width-columns widths))))
2,855
Common Lisp
.lisp
64
33.984375
78
0.608055
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
e12df6dd883c88246ce91fd8647c6fd87c05202bf5bf48f8a982f31b40e8e65b
37,321
[ -1 ]
37,322
quantity-column.lisp
open-rsx_rsb-tools-cl/src/formatting/quantity-column.lisp
;;;; quantity-column.lisp --- ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) (defclass quantity-column (width-specification-mixin width-mixin) ((quantity :accessor column-quantity :documentation "Stores the underlying quantity instances printed by this column.")) (:default-initargs :quantity (missing-required-initarg 'quantity-column :quantity)) (:documentation "Instances of this class use an associated quantity instance to provide a name and the printed value.")) (service-provider:register-provider/class 'column :quantity :class 'quantity-column) (defmethod shared-initialize :after ((instance quantity-column) (slot-names t) &key quantity) (when quantity (setf (column-quantity instance) (rsb.stats:make-quantity quantity)))) (defmethod column< ((left quantity-column) (right quantity-column)) (value< (rsb.stats:quantity-value (column-quantity left)) (rsb.stats:quantity-value (column-quantity right)))) (defmethod column-name ((column quantity-column)) (rsb.stats:quantity-name (column-quantity column))) (defmethod collects? ((column quantity-column)) t) (defmethod rsb.ep:access? ((processor quantity-column) (part t) (mode t)) (rsb.ep:access? (column-quantity processor) part mode)) (defmethod format-header ((column quantity-column) (stream t)) (format stream "~@(~A~)~@[ [~A]~]" (column-name column) nil)) (defmethod format-event :around ((event t) (style quantity-column) (stream t) &key) (if (eq event :trigger) (call-next-method) (rsb.stats:update! (column-quantity style) event))) (defmethod format-event ((event t) (style quantity-column) (stream t) &key) (error "Should not get called")) (defmethod format-event ((event (eql :trigger)) (style quantity-column) (stream t) &key) (let+ (((&accessors-r/o (quantity column-quantity)) style)) (rsb.stats:format-value quantity stream) (rsb.stats:reset! quantity))) (defmethod print-object ((object quantity-column) stream) (print-unreadable-object (object stream :type t :identity t) (format stream "~A = " (column-name object)) (rsb.stats:format-value (column-quantity object) stream)))
2,769
Common Lisp
.lisp
62
34
74
0.595026
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
fa600f54cd46214e35c2ab0fd7f19bee0e315442065940a29b602723d7392f58
37,322
[ -1 ]
37,323
event-style-json.lisp
open-rsx_rsb-tools-cl/src/formatting/event-style-json.lisp
;;;; event-style-json.lisp --- Formatting things as JSON data. ;;;; ;;;; Copyright (C) 2012, 2014, 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) ;;; Basic infrastructure (deftype pass-through-value () "Values that can directly be converted into native JSON values." '(or real string octet-vector boolean)) (deftype stringify-value () "Values that have to be turned into strings for JSON conversion." '(or (and symbol (not boolean)) event-id scope cons pathname uuid:uuid local-time:timestamp puri:uri)) (declaim (inline maybe-stringify-value prepare-initarg-value-for-json)) (defun maybe-stringify-value (value) (typecase value ((and symbol (not boolean)) (symbol-name value)) (event-id (locally (declare (notinline maybe-stringify-value)) (maybe-stringify-value (event-id->uuid value)))) (scope (scope-string value)) ((or cons pathname uuid:uuid local-time:timestamp puri:uri) (princ-to-string value)))) (defun prepare-initarg-value-for-json (value) (or (maybe-stringify-value value) value)) (defun make-json-peek-function (&optional next) (declare (type (or null function) next)) (lambda (builder relation relation-args node) (typecase node (pass-through-value (values node 'architecture.builder-protocol.json:raw)) (stringify-value (values (maybe-stringify-value node) 'architecture.builder-protocol.json:raw)) (t (if next (funcall next builder relation relation-args node) t))))) (defun make-json-serializer (&key (symbol-transform (architecture.builder-protocol.json:default-symbol-transform)) (key-transform (lambda (thing) (typecase thing (string thing) (symbol (funcall symbol-transform thing)) (t (maybe-stringify-value thing))))) kind-transform peek-function) (let+ (((&flet initarg-transform (key value) (values (funcall symbol-transform key) (prepare-initarg-value-for-json value))))) (architecture.builder-protocol.json:make-serializer :kind-transform kind-transform :initarg-transform #'initarg-transform :relation-transform key-transform :member-transform key-transform :peek-function peek-function))) ;;; `style-json' (defclass style-json (separator-mixin) ((builder :initarg :builder :reader style-builder :initform t :documentation "Stores the builder that should be used to serialize events and payloads to JSON.") (event-serializer :accessor style-%event-serializer :documentation "Stores the serializer that should be used for events.") (payload-serializer :accessor style-%payload-serializer :documentation "Stores the serializer that should be used for payloads.")) (:default-initargs :separator nil :event-peek-function (make-json-peek-function (rsb.builder:universal-builder-for-event-data)) :payload-peek-function (make-json-peek-function)) (:documentation "Format events and payloads as JSON.")) (service-provider:register-provider/class 'style :json :class 'style-json) (defmethod shared-initialize :after ((instance style-json) (slot-names t) &key (event-peek-function nil event-peek-function-supplied?) (payload-peek-function nil payload-peek-function-supplied?)) (when event-peek-function-supplied? (setf (style-%event-serializer instance) (make-json-serializer :peek-function event-peek-function))) (when payload-peek-function-supplied? (setf (style-%payload-serializer instance) (make-json-serializer :peek-function payload-peek-function)))) (defmethod rsb.ep:access? ((processor style-json) (part t) (mode (eql :read))) t) (defmethod format-event ((thing t) (style style-json) (stream t) &key) (let+ (((&structure-r/o style- builder %event-serializer) style)) (architecture.builder-protocol:with-unbuilder (builder builder) (architecture.builder-protocol.json:serialize-using-serializer builder thing stream %event-serializer)))) (defmethod format-payload ((thing t) (style style-json) (stream t) &key) (let+ (((&structure-r/o style- builder %payload-serializer) style)) (architecture.builder-protocol:with-unbuilder (builder builder) (architecture.builder-protocol.json:serialize-using-serializer builder thing stream %payload-serializer))))
5,132
Common Lisp
.lisp
121
33.07438
85
0.626026
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
9307bbfc4d47f8a43e007b8b4ddc5f3d71f267ec61e8ee706502d0985378ad11
37,323
[ -1 ]
37,324
event-style-compact.lisp
open-rsx_rsb-tools-cl/src/formatting/event-style-compact.lisp
;;;; event-style-compact.lisp --- Compact event formatting style class. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) ;;; Class `event-style-compact-line' (defclass event-style-compact-line (columns-mixin widths-caching-mixin) ()) ;;; Class `event-style-compact' (defun default-compact-sub-styles () (let+ (((&flet+ make-sub-style ((predicate . spec)) (cons predicate (make-instance 'event-style-compact-line :columns spec)))) (dummy '(:constant :name "" :value "" :width 0))) (mapcar (lambda+ ((predicate . column-specs)) (make-sub-style (cons predicate (mapcar #'expand-column-spec column-specs)))) `((,#'request-event? . (:receive :id :call ,dummy ,dummy :wire-schema :data-size :origin :sequence-number :newline)) (,#'reply-event? . (:receive :call-id :result ,dummy ,dummy :wire-schema :data-size :origin :sequence-number :newline)) (,(constantly t) . (:receive :id :method :scope :data :wire-schema :data-size :origin :sequence-number :newline)))))) (defclass event-style-compact (delegating-mixin header-printing-mixin) () (:default-initargs :sub-styles (default-compact-sub-styles)) (:documentation "This formatting style prints several properties of received events on a single line. Some events are formatted specially according to their role in a communication pattern.")) (service-provider:register-provider/class 'style :compact :class 'event-style-compact) (defmethod sub-style-for ((style event-style-compact) (event t)) ;; Return a singleton list containing the sub-style of STYLE whose ;; predicate succeeds on EVENT. (ensure-list (cdr (find-if (rcurry #'funcall event) (style-sub-styles style) :key #'car)))) (defmethod format-header ((style event-style-compact) (stream t)) ;; Use header of the last sub-style which is the most generic one. (format-header (cdr (lastcar (style-sub-styles style))) stream)) (defmethod format-event :before ((event t) (style event-style-compact) (stream t) &key (width (or *print-right-margin* 80))) (let+ (((&structure-r/o style- sub-styles) style) ((&flet do-sub-style (sub-style) (let+ ((columns (style-dynamic-width-columns sub-style)) (separator (style-separator-width sub-style)) ((&values widths cached?) (style-compute-column-widths sub-style columns width :separator-width separator))) (unless cached? (style-assign-column-widths sub-style columns widths)) (values columns widths cached?)))) ;; Compute widths for final sub-style which is the most ;; generic one. ((&values columns widths cached?) (do-sub-style (cdr (lastcar sub-styles)))) ((&flet do-subordinate-sub-style (sub-style) (map nil (lambda (column1 column2 width) (when (type= (type-of column1) (type-of column2)) (setf (column-widths column1) width))) (style-dynamic-width-columns sub-style) columns widths) (do-sub-style sub-style)))) ;; Assign column widths computed for final sub-style to shared ;; columns of other sub-styles. Then optimize remaining ("free") ;; column widths in these sub-styles. (unless cached? (mapc (compose #'do-subordinate-sub-style #'cdr) (butlast sub-styles)))))
4,312
Common Lisp
.lisp
85
35.835294
84
0.540432
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
cfb13f0e4d66baa32e1ea605c2cb62965ddbdb32aab9088e52fb25e3e4266126
37,324
[ -1 ]
37,325
timeline.lisp
open-rsx_rsb-tools-cl/src/formatting/timeline.lisp
;;;; timeline.lisp --- Render a timeline view of received events. ;;;; ;;;; Copyright (C) 2012-2017 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) ;;; Cache cell (defstruct (%cell (:constructor %make-cell (lower upper)) (:copier nil)) "The lower and upper slots indicate the temporal range of the cell. The count and max-size slots accumulate the respective quantity for events associated to the cell. The glyph slot is either nil if the cell has not been rendered yet or the rendered character for the cell." (lower 0 :type timestamp/unix/nsec :read-only t) (upper 0 :type timestamp/unix/nsec :read-only t) (count 0 :type non-negative-integer) (max-size 0 :type non-negative-integer) (glyph nil :type (or null character))) (defun cell-glyph (cell) (declare (type %cell cell)) (or (%cell-glyph cell) (setf (%cell-glyph cell) (let+ (((&structure-r/o %cell- count max-size) cell)) (glyph-for-data count max-size))))) (defun cell-%update (cell events &key (start 0) (end (length events))) (declare (type %cell cell) (type sequence events)) (let+ (((&structure %cell- count max-size glyph) cell) (new-count (- end start)) (new-size (reduce #'max events :key #'cdr :initial-value 0 :start start :end end))) (declare (type non-negative-integer new-count new-size)) (incf count new-count) (maxf max-size new-size) (setf glyph nil))) (defun glyph-for-data (count size) (declare (type non-negative-integer count size)) (macrolet ((size-glyphs (small medium large) `(cond ((<= 0 size 1024) ,small) ((< 1024 size 65536) ,medium) (t ,large)))) (if *output-unicode?* (cond ((zerop count) #\Space) ((= count 1) (size-glyphs #\· #\▪ #\◾)) ((= count 2) (size-glyphs #\╌ #\╍ #\╍)) ((= count 3) (size-glyphs #\┄ #\⋯ #\┅)) (t (size-glyphs #\─ #\━ #\▬))) (cond ((zerop count) #\Space) ((= count 1) (size-glyphs #\. #\o #\O)) ((= count 2) (size-glyphs #\. #\o #\O)) ((= count 3) (size-glyphs #\- #\- #\=)) (t (size-glyphs #\- #\- #\=)))))) ;;; `timeline' class (defclass timeline (temporal-bounds-mixin timestamp-mixin width-specification-mixin width-mixin) ((tic-distance :initarg :tic-distance :type positive-integer :accessor style-tic-distance :initform 12 :documentation "The distance in characters between tics in the header line.") (events :type list :accessor style-%events :initform '() :documentation "Stores a list of events which have not been rendered yet. The list has to be sorted according to decreasing timestamps.") (cache :type (or null (cons %cell t)) :accessor style-%cache :initform nil :documentation "Stores information regarding previously rendered cells. See `%timeline-cache-cell'.")) (:default-initargs :upper-bound '(+ :now 1) :widths '(:range 16)) (:documentation "Instances of this column class render a timeline view in which received events appear as dots. A corresponding header with time tics can also be produced.")) (service-provider:register-provider/class 'column :timeline :class 'timeline) (defmethod column< ((left timeline) (right timeline)) (let+ (((&flet earliest-event (timeline) (position-if #'plusp (style-%cache timeline) :key #'%cell-count)))) (value< (earliest-event left) (earliest-event right)))) (defmethod collects? ((style timeline)) t) (macrolet ((define-access?-method (part) `(defmethod rsb.ep:access? ((processor timeline) (part (eql ,part)) (mode (eql :read))) t))) (define-access?-method :data) ; only if rsb.transport.payload-size meta-data item is not available (define-access?-method :meta-data) (define-access?-method :timestamp)) (defmethod format-header ((style timeline) (target t)) (let+ (((&accessors-r/o ((&values (lower upper) now) bounds/expanded) (width column-width) (tic-distance style-tic-distance)) style) (tic-distance* (min tic-distance (1- width))) (delta (/ (- upper lower) (1- (/ width tic-distance*))))) (iter (for i :from (- upper now) :downto (- lower now) :by delta) (format target "~V@<~C~[ now~:;~:*~:/rsb.formatting:print-human-readable-duration/~]~>" tic-distance* (if *output-unicode?* #\↓ #\v) (round i 1000000000))))) (defmethod format-event ((event (eql :trigger)) (style timeline) (target t) &key) ;; Return early if the style is effectively disabled. (when (zerop (column-width style)) (return-from format-event)) ;; Add new cells to the cache as necessary and fill them. (adjust-cache! style) (fill-cache! style) ;; Copy cached characters into the output vector and write it out in ;; a single batch operation. (let+ (((&accessors-r/o (width column-width) (cache style-%cache)) style) (output (make-string width))) (declare (type list cache)) (map-into output #'cell-glyph cache) (write-string output target))) ;; This method is necessary to satisfy the constraint that a primary ;; method has to exist but it should not actually get called. (defmethod format-event ((event t) (style timeline) (target t) &key) (error "Should not get called")) (defmethod format-event :around ((event t) (style timeline) (target t) &key) ;; Collect non-trigger events into STYLE's buffer. Pass through ;; trigger events. (if (eq event :trigger) (call-next-method) (let+ (((&structure style- timestamp (events %events)) style) (entry (cons (funcall (the function timestamp) event) (rsb.stats:event-size/power-of-2 event 0)))) (setf events (merge 'list (list entry) events #'> :key #'car))))) (defmethod adjust-cache! ((style timeline)) (let+ (((&accessors-r/o ((lower-bound upper-bound) bounds/expanded) (width column-width)) style) ((&accessors (cache style-%cache)) style) (delta (floor (- upper-bound lower-bound) width)) (cache-upper (or (when-let ((first (first cache))) (%cell-upper first)) lower-bound))) ;; Create new cells at the head of the cache. (iter (for upper :from (+ cache-upper delta) :to upper-bound :by delta) (for lower previous upper :initially cache-upper) (push (%make-cell lower upper) cache)) ;; Add and drop cells at the tail of the cache. (iter (repeat width) (for tail :first cache :then (cdr tail)) (when (null (cdr tail)) (let ((cell (%make-cell 0 0))) (setf (%cell-glyph cell) #\Space) (setf (cdr tail) (cons cell nil)))) (finally (setf (cdr tail) nil))))) (defmethod fill-cache! ((style timeline)) (let+ (((&structure-r/o style- (events %events) (cache %cache)) style)) ;; Iterate over bins of the form [LOWER, UPPER] for all ;; not-yet-populated cache cells. (iter outer (generate events/rest on events) (generate event next (first (next events/rest))) (for cells on cache) (for cell next (first cells)) (while cell) ;; Advance to first event that is in the first bin. (when (first-iteration-p) (next event) (iter (until (<= (car event) (%cell-upper cell))) (in outer (next event)))) ;; Collect all events for the bin [LOWER, UPPER]. (let+ (((&structure-r/o %cell- lower upper) cell)) (iter (with events/bin = events/rest) (with (the non-negative-fixnum count) = 0) (while (<= lower (car event) upper)) (incf count) (in outer (next event)) (finally-protected (cell-%update cell events/bin :end count))))) ;; Drop events. (setf (style-%events style) '()))) ;; Local Variables: ;; coding: utf-8 ;; End:
9,491
Common Lisp
.lisp
214
33.280374
100
0.534859
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
edda9f5d509c92d16ea87db02b75751e91684de0bacf594a1efbf350f5a3af23
37,325
[ -1 ]
37,326
help.lisp
open-rsx_rsb-tools-cl/src/formatting/help.lisp
;;;; help.lisp --- Help text generation for formatting options. ;;;; ;;;; Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) (defun make-style-service-help-string (&key (service 'style) initarg-blacklist) (with-output-to-string (stream) (format stream "The following formatting styles are currently ~ available:~@ ~@ ") (let* ((providers (service-provider:service-providers service)) (classes (mapcar (lambda (provider) (list (service-provider:provider-name provider) (service-provider:provider-class provider))) providers))) (rsb.tools.common:print-classes-help-string classes stream :initarg-blacklist initarg-blacklist)))) (defun make-style-help-string (&key (show :default)) "Return a help string that explains how to specify a formatting style and its parameters." (with-output-to-string (stream) (format stream "Specify a formatting style that should be used to ~ print events. SPEC has to be of the form~@ ~@ ~2@TKIND KEY1 VALUE1 KEY2 VALUE2 ...~@ ~@ where keys and values are optional and depend on ~ KIND. Examples (note that the single quotes have ~ to be included only when used within a shell):~@ ~@ ~2@T--style detailed~@ ~2@T--style compact~@ ~2@T--style 'compact :separator \"|\"'~@ ~2@T--style 'columns :columns (:now (:scope :width 12) :id :newline)'~@ ~2@T\(see extended help, enable with ~ --help-for=columns, for an explanation of ~ the :columns argument\)~@ ~@ ") (rsb.tools.common:with-abbreviation (stream '(:styles :columns :quantities) show) (write-string (make-style-service-help-string :initarg-blacklist '(:stream :pretty-state :quantities :count :sub-styles :test :key :sort-predicate :sort-key :code :builder :event-peek-function :payload-peek-function)) stream) (format stream "~%~%") (rsb.tools.common:with-abbreviation (stream :columns show) (format stream "In column-based formatting styles, columns can ~ be selected and configured using the :columns ~ argument and a syntax of the form~@ ~@ ~2@T:columns (COLSPEC1 COLSPEC2 ...)~@ ~@ where~@ ~@ ~2@TCOLSPEC ::= KIND | (KIND KEY1 VALUE1 KEY2 ~ VALUE2 ...)~@ ~@ The following columns are available:~@ ~@ ") (rsb.tools.common:print-classes-help-string (mapcar (lambda (provider) (list (service-provider:provider-name provider) (service-provider:provider-class provider))) (service-provider:service-providers 'column)) stream)) (when-let* ((package (find-package :rsb.stats)) (symbol (find-symbol "QUANTITY" :rsb.stats)) (providers (service-provider:service-providers symbol)) (classes (mapcar (lambda (provider) (list (service-provider:provider-name provider) (service-provider:provider-class provider))) providers))) (format stream "~%~%") (rsb.tools.common:with-abbreviation (stream :quantities show) (format stream "In the statistics style, statistical ~ quantities are used in columns. These ~ columns can be configured using the :columns ~ argument and a syntax of the form~@ ~@ ~2@T:columns (COLSPEC1 COLSPEC2 ...)~@ ~@ where~@ ~@ ~2@TCOLSPEC ::= (:quantity :quantity ~ QUANTITYSPEC KEY1 VALUE1 KEY2 VALUE2 ...)~@ ~2@TQUANTITYSPEC ::= KIND | (KIND KEY1 VALUE1 ~ KEY2 VALUE2 ...)~@ ~@ The following quantities are available:~@ ~@ ") (rsb.tools.common:print-classes-help-string classes stream :initarg-blacklist '(:extractor :reduce-by :start-time :values)))))))
5,433
Common Lisp
.lisp
110
29.754545
91
0.460786
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
7bff00d85199835a85b15b5cd489329dd442c3c1a9dfad4551ba790a0c45447d
37,326
[ -1 ]
37,327
format-functions.lisp
open-rsx_rsb-tools-cl/src/formatting/format-functions.lisp
;;;; format-functions.lisp --- RSB-specific formatting functions. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) ;;; Utility functions (declaim (inline length-exhausted? columns-exhausted? lines-exhausted?)) (defun length-exhausted? (count) (and *print-length* (>= count *print-length*))) (defun columns-exhausted? (column) (and *print-right-margin* (>= column *print-right-margin*))) (defun lines-exhausted? (line) (and *print-lines* (>= line *print-lines*))) ;;; Print functions (defun format-string (stream value &optional colon? at?) "Format the string VALUE onto STREAM." (declare (ignore colon? at?)) (format stream "\"") (iter (for c in-vector value :with-index size) (with line = 1) (with column = 2) ;; Terminate? (when (or (lines-exhausted? (1- line)) (and (lines-exhausted? line) (columns-exhausted? (+ column 3 (- 1)))) (length-exhausted? size)) (format stream "...") (terminate)) ;; Print character. (cond ((or (eq c #\Newline) (columns-exhausted? column)) (unless (eq c #\Newline) (format stream "\\")) (fresh-line stream) (incf line) (setf column 1)) (t (write-char c stream) (incf column)))) (format stream "\""))
1,505
Common Lisp
.lisp
41
29.585366
72
0.57732
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
cc2c1962410445caec9776283b646f8db6ae2560cad70cceef0b8cc43c97ace8
37,327
[ -1 ]
37,328
payload-image-png.lisp
open-rsx_rsb-tools-cl/src/formatting/payload-image-png.lisp
;;;; style-image-png.lisp --- Format event payloads as PNG images. ;;;; ;;;; Copyright (C) 2012-2019 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) (defclass style-image/png (image-output-mixin) () (:documentation "This formatting style output image data in PNG format for event payloads consisting of image data.")) (service-provider:register-provider/class 'style :image/png :class 'style-image/png) (deftype %image-index () '(unsigned-byte 24)) (defmethod format-payload ((data rst.vision:image) (style style-image/png) (stream stream) &key (width (style-width style)) (height (style-height style))) (check-type width dimension-spec/full) (check-type height dimension-spec/full) (let+ (((&accessors-r/o (in-color rst.vision:image-color-mode) (in-depth rst.vision:image-depth) (in-width rst.vision:image-width) (in-height rst.vision:image-height) (in-pixels rst.vision:image-data)) data) ;; Compute output width, output height and scaling factors ;; based on input width, input height and requested width and ;; height. ((&values out-width scale-x) (apply-dimension-spec/integer-factor in-width width)) ((&values out-height scale-y) (apply-dimension-spec/integer-factor in-height height)) ;; Create the output PNG object. (png (make-instance 'zpng:streamed-png :color-type (ecase in-color (:color-grayscale :grayscale) (:color-rgba :truecolor-alpha) ((:color-rgb :color-bgr :color-yuv422) :truecolor)) :width out-width :height out-height)) (row (zpng:row-data png))) (declare (type %image-index scale-x scale-y in-width out-width out-height) (type nibbles:simple-octet-vector in-pixels row) (dynamic-extent row)) (zpng:start-png png stream) (fill row 255) ;; Transfer and convert pixels. Scaling factors implement ;; requested resizing. (macrolet ((define-decoders ((pixel-format-form depth-form) &body body) (once-only (pixel-format-form depth-form) (let+ (((&flet+ define-decoder (((pixel-format depth bytes-per-pixel &optional (units-per-row 'out-width)) &rest body)) `((and (eq ,pixel-format ,pixel-format-form) (eq ,depth ,depth-form)) (locally (declare #.rsb:+optimization-fast+unsafe+) (let ((row-fixup (- (* ,bytes-per-pixel in-width) (* ,bytes-per-pixel scale-x ,units-per-row)))) (iter outer (repeat out-height) ,@body (zpng:write-row row png) (incf from-offset row-fixup) (unless (= 1 scale-y) (incf from-offset (* ,bytes-per-pixel in-width (1- scale-y))))))))))) `(cond ,@(mapcar #'define-decoder body) (t (error "~@<Unsupported pixel-format (~S) and ~ depth (~S) combination.~@:>" ,pixel-format-form ,depth-form))))))) (define-decoders (in-color in-depth) ((:color-grayscale :depth-8u 1) (generate (the fixnum from-offset) :from 0 :by scale-x) (iter (for (the fixnum to-offset) :from 0 :below out-width) (in outer (next from-offset)) (setf (aref row to-offset) (aref in-pixels from-offset)))) ((:color-grayscale :depth-16u 1) (generate (the fixnum from-offset) :from 0 :by (* 2 scale-x)) (iter (for (the fixnum to-offset) :from 0 :below out-width) (in outer (next from-offset)) (setf (aref row to-offset) (aref in-pixels (1+ from-offset))))) ((:color-grayscale :depth-32f 1) (generate (the fixnum from-offset) :from 0 :by (* 4 scale-x)) (iter (for (the fixnum to-offset) :from 0 :below out-width) (in outer (next from-offset)) (setf (aref row to-offset) (truncate (the (single-float 0f0 1f0) (nibbles:ieee-single-ref/le in-pixels from-offset)) #.(float 1/255 1f0))))) ((:color-rgba :depth-8u 4) (generate (the fixnum from-offset) :from 0 :by (* 4 scale-x)) (iter (for (the fixnum to-offset) :from 0 :below (* 4 out-width) :by 4) (in outer (next from-offset)) (replace row in-pixels :start1 to-offset :end1 (+ to-offset 4) :start2 from-offset :end2 (+ from-offset 4)))) ((:color-rgb :depth-8u 3) (generate (the fixnum from-offset) :from 0 :by (* 3 scale-x)) (iter (for (the fixnum to-offset) :from 0 :below (* 3 out-width) :by 3) (in outer (next from-offset)) (replace row in-pixels :start1 to-offset :end1 (+ to-offset 3) :start2 from-offset :end2 (+ from-offset 3)))) ((:color-bgr :depth-8u 3) (generate (the fixnum from-offset) :from 0 :by (* 3 scale-x)) (iter (for (the fixnum to-offset) :from 0 :below (* 3 out-width) :by 3) (in outer (next from-offset)) (setf (aref row (+ to-offset 0)) (aref in-pixels (+ from-offset 2)) (aref row (+ to-offset 1)) (aref in-pixels (+ from-offset 1)) (aref row (+ to-offset 2)) (aref in-pixels (+ from-offset 0))))) ((:color-yuv422 :depth-8u 2 (* 2 (ceiling out-width 2))) (generate (the fixnum from-offset) :from 0 :by (* 4 scale-x)) (iter (for (the fixnum to-offset) :from 0 :below (* 3 out-width) :by 6) (in outer (next from-offset)) (%yuv422->rgb in-pixels from-offset row to-offset))))) (zpng:finish-png png) (force-output stream) (values)))
7,033
Common Lisp
.lisp
131
35.633588
93
0.485544
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
57ce7ebc7e2e6e5dc140229aa4daedc8a30fea9c4ee3a15bb107f16878e6ebcb
37,328
[ -1 ]
37,329
event-style-payload.lisp
open-rsx_rsb-tools-cl/src/formatting/event-style-payload.lisp
;;;; event-style-payload.lisp --- Formatting style that only processes the payload. ;;;; ;;;; Copyright (C) 2011-2016 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> (cl:in-package #:rsb.formatting) (defclass style-payload (separator-mixin max-lines-mixin output-forcing-mixin payload-style-mixin) () (:default-initargs :payload-style :payload-generic/pretty) (:documentation "Only format the payload of each event, but not the meta-data.")) (service-provider:register-provider/class 'style :payload :class 'style-payload)
646
Common Lisp
.lisp
17
31.647059
83
0.666134
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
465fa684ba41ac27a0c9b5b4a282370a40438937cfb04edeb009800059a5262b
37,329
[ -1 ]
37,330
rst-forward.lisp
open-rsx_rsb-tools-cl/src/formatting/rst-forward.lisp
;;;; rst-forward.lisp --- Forward definitions of RST types to avoid dependency. ;;;; ;;;; Copyright (C) 2012-2017 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> ;;; rst.vision Types (cl:eval-when (:compile-toplevel :load-toplevel :execute) (cl:unless (cl:find-package '#:rst.vision) (cl:defpackage #:rst.vision (:export #:image #:image-color-mode #:image-depth #:image-width #:image-height #:image-data)))) (cl:in-package #:rst.vision) (cl:unless (cl:find-class 'image cl:nil) (cl:defclass image () ((color-mode :reader image-color-mode) (depth :reader image-depth) (width :reader image-width) (height :reader image-height) (data :reader image-data)))) ;;; rst.audition Types (cl:eval-when (:compile-toplevel :load-toplevel :execute) (cl:unless (cl:find-package '#:rst.audition) (cl:defpackage #:rst.audition (:export #:sound-chunk #:sound-chunk-channels #:sound-chunk-rate #:sound-chunk-sample-type #:sound-chunk-data)))) (cl:in-package #:rst.audition) (cl:unless (cl:find-class 'sound-chunk cl:nil) (cl:defclass sound-chunk () ((channels :reader sound-chunk-channels) (rate :reader sound-chunk-rate) (sample-type :reader sound-chunk-sample-type) (data :reader sound-chunk-data))))
1,409
Common Lisp
.lisp
41
29.560976
79
0.642647
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
6b9ab3d97700d6bb1b839e5129d20738a578191f12943f80bce3e2dc1cd0e728
37,330
[ -1 ]
37,331
dynamic-width.lisp
open-rsx_rsb-tools-cl/src/formatting/dynamic-width.lisp
;;;; dynamic-width.lisp --- Tools for dynamic width columns. ;;;; ;;;; Copyright (C) 2012, 2013, 2014, 2015 Jan Moringen ;;;; ;;;; Author: Jan Moringen <[email protected]> ;;;; The code in this file implements a probabilistic optimization ;;;; algorithm for column widths based on simulated annealing. ;;;; ;;;; The algorithm accepts an available total width, allowed widths ;;;; for all columns in form of lists of integers or integer ranges ;;;; and priorities for all columns. A width for each column is chosen ;;;; such that an overall "score" based on respective column widths ;;;; and priorities is maximized. ;;;; ;;;; Columns can be hidden if the available width is not sufficient to ;;;; include all columns and separator strings between columns can be ;;;; taken into account. ;;;; ;;;; The optimization algorithm operates probabilistically but with a ;;;; fixed random seed resulting in potential random fluctuations ;;;; between results for different inputs but identical results for ;;;; repeated runs with a fixed input. (cl:in-package #:rsb.formatting) ;;; Generator for width specifications (defun make-widths (spec max) (labels ((rec (spec) (etypecase spec (integer (list spec)) ((cons (eql :range)) (iter (for i :from (second spec) :to (or (third spec) max)) (collect i))) (cons (mapcan #'rec spec))))) (coerce (or (rec spec) '(0)) 'vector))) ;;; Sampling utilities (declaim (inline random-but-not)) (defun random-but-not (max exception &optional (random-state *random-state*)) (do ((value (random max random-state) (random max random-state))) ((/= value exception) value))) (declaim (inline random-elt-between)) (defun random-elt-between (range min max &optional (random-state *random-state*)) (declare (type simple-vector range)) (let* ((position-min (or (position min range :test #'<=) 0)) (position-max (or (position max range :test #'<) (length range))) (count (- position-max position-min)) (offset (if (zerop count) 0 (random count random-state)))) (elt range (+ position-min offset)))) ;;; Simulated annealing algorithm (define-constant +optimize-widths-score-table+ (iter (for i :from 0 :to 1000) (collect (if (zerop i) 0 (ceiling (* 100000 (sqrt (1+ i))))) :result-type simple-vector)) :test #'equalp) (define-constant +optimize-widths-random-state+ #-sbcl (make-random-state) #+sbcl (sb-ext:seed-random-state 0) :test #'equalp) (defun %optimize-widths (width specs priorities separator-width) (let+ ((random-state (make-random-state +optimize-widths-random-state+)) (priorities (coerce priorities 'simple-vector)) (max-priority (reduce #'max priorities)) ((&flet unweighted-score (width) (declare (type fixnum width)) (if (< width (length +optimize-widths-score-table+)) (svref +optimize-widths-score-table+ width) (values (ceiling (* 100000 (sqrt (1+ width)))))))) ;; Collect available widths and initial widths of columns, ;; number of columns, initial score and width of separators. ((&values values widths count score separator-sum) (iter (for i :from 0) (for spec :in specs) (for priority :in-vector priorities) (let* ((values (make-widths spec width)) (min (first-elt values))) (summing min :into sum) (cond ((< (+ separator-sum sum) width) (collect values :into values* :result-type vector) (collect min :into widths :result-type vector) (summing 1 :into count) (summing (* priority (unweighted-score min)) :into score) (unless (or (first-iteration-p) (equalp #(0) values)) (summing separator-width :into separator-sum))) (t (when (<= i 2) (summing 1 :into count)) (let ((values (if (<= i 2) #(0) #()))) (collect values :into values* :result-type vector) (collect 0 :into widths :result-type vector))))) (finally (return (values values* widths count score separator-sum))))) (unused (- width (reduce #'+ widths) separator-sum)) ;; Available Monte Carlo moves. ((&flet move-1 (a old-a b old-b total) (declare (ignore old-a old-b)) (let* ((new-a (random-elt-between (aref values a) 0 total random-state)) (new-b (random-elt-between (aref values b) 0 (- total new-a) random-state))) (values new-a new-b)))) ((&flet move-2 (a old-a b old-b total) (declare (ignore total)) (let+ ((aux (if (zerop (random 2 random-state)) 1 -1)) ((&flet new-value (index old-value) (let ((array (aref values index))) (svref array (clamp (+ (position old-value array :test #'=) aux) 0 (1- (length array))))))) (new-a (new-value a old-a)) (new-b (new-value b old-b))) (values new-a new-b)))) ((&flet move-3 (a old-a b old-b total) (declare (ignore b total)) (let ((array (aref values a)) (aux (if (zerop (random 2 random-state)) 1 -1))) (values (svref array (clamp (+ (position old-a array :test #'=) aux) 0 (1- (length array)))) old-b))))) (declare (type (simple-vector) widths) (type (simple-array (simple-array fixnum (*)) (*)) values)) ;; Simulated annealing with moves move-{1,2,3} for 10000 ;; iterations. (loop :for temperature :of-type single-float = 100000.0f0 :then (* temperature .997f0) :for i :from 1 :below 10000 :do (let+ ((a (random count random-state)) (b (random-but-not count a random-state)) (old-a (svref widths a)) (old-b (svref widths b)) (total (+ old-a old-b unused)) (move (cond ((< (random 10 random-state) 3) #'move-2) ((zerop (random 2 random-state)) #'move-1) (t #'move-3))) ((&values new-a new-b) (funcall move a old-a b old-b total)) (new-unused (+ unused old-a (- new-a) old-b (- new-b))) (change (+ (* (- (unweighted-score new-a) (unweighted-score old-a)) (svref priorities a)) (* (- (unweighted-score new-b) (unweighted-score old-b)) (svref priorities b)) (* (1+ max-priority) 100000 (- (min 0 new-unused) (min 0 unused))))) (change* (float (/ change temperature) 1.0f0))) (when (or (> change* (log 1)) (> (exp change*) (random 1.0f0 random-state))) (setf (svref widths a) new-a (svref widths b) new-b unused new-unused score (+ score change))))) (values widths score))) (defun optimize-widths (width specs priorities &key (separator-width 0)) (unless (length= specs priorities) (error "~@<Widths and priorities have to sequences of equal ~ length (widths: ~D, priorities: ~D)~@:>" (length specs) (length priorities))) (let+ ((length (length specs)) (difference (- 2 length)) (fill (when (plusp difference) (make-list difference :initial-element 0))) (specs (append specs fill)) (priorities (append priorities fill)) ((&values widths score) (%optimize-widths width specs priorities separator-width))) (values (if (plusp difference) (subseq widths 0 length) widths) score)))
8,623
Common Lisp
.lisp
172
37.273256
90
0.530039
open-rsx/rsb-tools-cl
0
0
4
GPL-3.0
9/19/2024, 11:44:17 AM (Europe/Amsterdam)
3ca73f5b6edaaaf9bcfe7582acd106cd90e0fd50cc34c3d459763d33240f7b2a
37,331
[ -1 ]