Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gendl
gendl
Commits
8650f5fc
Commit
8650f5fc
authored
Dec 16, 2022
by
Dave Cooper
Browse files
allow indent depth for print-variables
parent
a2ef07ab
Pipeline
#7622
failed with stages
in 69 minutes and 25 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
base/source/package.lisp
View file @
8650f5fc
...
...
@@ -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
...
...
base/source/utilities.lisp
View file @
8650f5fc
...
...
@@ -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.
...
...
regression/geom-base/source/box-matrix.lisp
View file @
8650f5fc
#+
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
)))))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment