Commit 8650f5fc authored by Dave Cooper's avatar Dave Cooper
Browse files

allow indent depth for print-variables

parent a2ef07ab
Pipeline #7622 failed with stages
in 69 minutes and 25 seconds
......@@ -236,6 +236,7 @@ If you are interested in this effort we would love to hear from you at open-sour
#:print-hash
#:print-messages
#:print-variables
#:with-trace
#:quantification
#:query-collect
#:query-license-server
......
......@@ -75,19 +75,27 @@ Optionally a different test than #'eql can be specified with the :test keyword a
(remove-plist-keys (remove-plist-key plist (first keys)) (rest keys)))))
(defparameter *depth* nil)
(defmacro print-variables (&rest vars)
"[Macro] Void. Prints the specified variables and current values to standard output.
:arguments (vars \"unquoted symbols (&rest argument)\")"
`(let (*print-readably*)
(format *trace-output*
,(with-output-to-string(ss)
(write-string "~&" ss)
(mapcar #'(lambda(var)
(format ss "~&~a = ~~s~%" var)) vars)
(write-string "~%" ss))
,@vars)))
(let ((report (format nil
,(with-output-to-string(ss)
(mapcar #'(lambda(var) (format ss "~&~a = ~~s~%" var)) vars)
(write-string "~%" ss))
,@vars)))
(let ((spaces (make-string (twice (or *depth* 0)) :initial-element #\space)))
(let ((lines (glisp:split-regexp "\\n" report)))
(let ((report (with-output-to-string (ss)
(format ss "~%")
(mapcar #'(lambda(line) (format ss "~a~a~%" spaces line)) lines))))
(format *trace-output* "~a" report)))))))
(defmacro with-trace ((&key (depth *depth*)) &rest vars)
`(let ((*depth* ,depth))(print-variables ,@vars)))
(defmacro print-messages (&rest messages)
"[Macro] Void. Prints the specified GDL object messages (i.e. slots) and their current values to standard output.
......
#+nil
(define-object box-matrix (base-object)
:input-slots
((rows 50)
(columns 50))
:objects
((box-container :type 'box-container
:box-length 10
:box-width 10
:box-height 1
:pass-down (rows columns))
(box-solid-container :type 'box-solid-container
:box-length 10
:box-width 10
:box-height 1
:pass-down (rows columns))
(planar-surface-container :type 'planar-surface-container
:box-length 10
:box-width 10
:box-height 1
:pass-down (rows columns))
))
#+nil
(define-object planar-surface-container (base-object)
:input-slots (box-length box-width box-height rows columns)
:computed-slots ((width (* (the box-width) (the columns)))
(length (* (the box-length) (the rows))))
:objects
((planes :type 'planar-surface
:p00 (translate (the-child center)
:left (half (the-child width))
:front (half (the-child length)))
:p01 (translate (the-child p00)
:right (the-child width))
:p10 (translate (the-child p01)
:rear (the-child length))
:p11 (translate (the-child p10)
:left (the-child width))
:length (the box-length)
:width (the box-width)
:height (the box-height)
:sequence (:matrix :longitudinal (the rows)
:lateral (the columns)))))
(in-package :gdl-user)
(define-object box-container-sample (box-container)
......@@ -79,18 +27,4 @@
:lateral (the columns)))))
#+nil
(define-object box-solid-container (base-object)
:input-slots (box-length box-width box-height rows columns)
:computed-slots ((width (* (the box-width) (the columns)))
(length (* (the box-length) (the rows))))
:objects
((boxes :type 'box-solid
:length (the box-length)
:width (the box-width)
:height (the box-height)
:sequence (:matrix :longitudinal (the rows)
:lateral (the columns)))))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment