Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
394643fc
Commit
394643fc
authored
34 years ago
by
wlott
Browse files
Options
Downloads
Patches
Plain Diff
Changed to use make-structure to create structures directly instead of
structurifying vectors.
parent
79c92808
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
code/defstruct.lisp
+40
-24
40 additions, 24 deletions
code/defstruct.lisp
code/load.lisp
+2
-2
2 additions, 2 deletions
code/load.lisp
with
42 additions
and
26 deletions
code/defstruct.lisp
+
40
−
24
View file @
394643fc
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; **********************************************************************
;;; **********************************************************************
;;;
;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/defstruct.lisp,v 1.1
7
1990/1
1
/18
17:00:48
wlott Exp $
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/defstruct.lisp,v 1.1
8
1990/1
2
/18
20:39:06
wlott Exp $
;;;
;;;
;;; Defstruct structure definition package (Mark II).
;;; Defstruct structure definition package (Mark II).
;;; Written by Skef Wholey and Rob MacLachlan.
;;; Written by Skef Wholey and Rob MacLachlan.
...
@@ -15,18 +15,21 @@
...
@@ -15,18 +15,21 @@
(
in-package
'c
)
(
in-package
'c
)
(
export
'
(
lisp::defstruct
)
"LISP"
)
(
export
'
(
lisp::defstruct
)
"LISP"
)
(
export
'
(
structure-index
make-structure
structure-length
structure-ref
structure-set
))
;;;; Structure frobbing primitives.
;;;; Structure frobbing primitives.
;;; Note: STRUCTURIFY is defined in struct.lisp. It converts a simple-vector
(
defun
make-structure
(
length
)
;;; into a structure. It should go away when we have a real structure
"Allocate a new structure with LENGTH data slots."
;;; allocation primitive.
(
declare
(
type
index
length
))
(
make-structure
length
))
(
defun
structure-length
(
x
)
(
defun
structure-length
(
structure
)
"Return the number of slots used by the structure object X, including the
"Given a structure, return its length."
type slot."
(
declare
(
type
structure
structure
))
(
declare
(
type
structure
x
))
(
structure-length
structure
))
(
structure-length
x
))
(
defun
structure-ref
(
struct
index
)
(
defun
structure-ref
(
struct
index
)
"Return the value from the INDEXth slot of STRUCT. 0 corresponds to the
"Return the value from the INDEXth slot of STRUCT. 0 corresponds to the
...
@@ -411,16 +414,14 @@
...
@@ -411,16 +414,14 @@
(
error
"Structure for copier ~S is not a ~S:~% ~S"
(
error
"Structure for copier ~S is not a ~S:~% ~S"
(
dd-copier
info
)
(
dd-name
info
)
structure
))
(
dd-copier
info
)
(
dd-name
info
)
structure
))
(
let
((
len
(
dd-length
info
)))
(
let*
((
len
(
dd-length
info
))
(
declare
(
fixnum
len
))
(
res
(
make-structure
len
)))
(
do
((
i
1
(
1+
i
))
(
declare
(
type
structure-index
len
))
(
res
(
structurify
(
make-array
len
:element-type
t
))))
(
dotimes
(
i
len
)
((
=
i
len
)
(
declare
(
type
structure-index
i
))
(
setf
(
structure-ref
res
0
)
(
dd-name
info
))
res
)
(
declare
(
fixnum
i
))
(
setf
(
structure-ref
res
i
)
(
setf
(
structure-ref
res
i
)
(
structure-ref
structure
i
)))))))
(
structure-ref
structure
i
)))
res
))))
(
when
(
dd-doc
info
)
(
when
(
dd-doc
info
)
(
setf
(
documentation
(
dd-name
info
)
'type
)
(
dd-doc
info
))))
(
setf
(
documentation
(
dd-name
info
)
'type
)
(
dd-doc
info
))))
...
@@ -482,9 +483,16 @@
...
@@ -482,9 +483,16 @@
(
list
(
list
`
(
list
,@
initial-cruft
,@
names
))
`
(
list
,@
initial-cruft
,@
names
))
(
structure
(
structure
`
(
truly-the
,
(
dd-name
defstruct
)
(
let
((
temp
(
gensym
)))
(
structurify
`
(
let
((
,
temp
(
make-structure
,
(
dd-length
defstruct
))))
(
vector
,@
initial-cruft
,@
names
))))
(
declare
(
type
structure
,
temp
))
(
setf
(
structure-ref
,
temp
0
)
',
(
dd-name
defstruct
))
,@
(
mapcar
#'
(
lambda
(
slot
)
`
(
setf
(
structure-ref
,
temp
,
(
dsd-index
slot
))
,
(
dsd-name
slot
)))
slots
)
(
truly-the
,
(
dd-name
defstruct
)
,
temp
))))
(
vector
(
vector
`
(
vector
,@
initial-cruft
,@
names
))
`
(
vector
,@
initial-cruft
,@
names
))
(
t
(
t
...
@@ -577,8 +585,16 @@
...
@@ -577,8 +585,16 @@
(
list
(
list
`
(
list
,@
initial-cruft
,@
thing
))
`
(
list
,@
initial-cruft
,@
thing
))
(
structure
(
structure
`
(
truly-the
,
(
dd-name
defstruct
)
(
let
((
temp
(
gensym
)))
(
structurify
(
vector
,@
initial-cruft
,@
thing
))))
`
(
let
((
,
temp
(
make-structure
,
(
dd-length
defstruct
))))
(
declare
(
type
structure
,
temp
))
(
setf
(
structure-ref
,
temp
0
)
',
(
dd-name
defstruct
))
,@
(
mapcar
#'
(
lambda
(
slot
thing
)
`
(
setf
(
structure-ref
,
temp
,
(
dsd-index
slot
))
,
thing
))
slots
thing
)
`
(
truly-the
,
(
dd-name
defstruct
)
,
temp
))))
(
vector
(
vector
`
(
vector
,@
initial-cruft
,@
thing
))
`
(
vector
,@
initial-cruft
,@
thing
))
(
t
(
t
...
@@ -650,7 +666,7 @@
...
@@ -650,7 +666,7 @@
(
dd
(
info
type
defined-structure-info
type
)))
(
dd
(
info
type
defined-structure-info
type
)))
(
cond
(
*print-pretty*
(
cond
(
*print-pretty*
(
let
((
index
0
))
(
let
((
index
0
))
(
declare
(
type
index
index
))
(
declare
(
type
structure-
index
index
))
(
xp:pprint-logical-block
(
stream
(
cons
type
(
dd-slots
dd
))
(
xp:pprint-logical-block
(
stream
(
cons
type
(
dd-slots
dd
))
:prefix
"#S("
:prefix
"#S("
:suffix
")"
)
:suffix
")"
)
...
...
This diff is collapsed.
Click to expand it.
code/load.lisp
+
2
−
2
View file @
394643fc
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; **********************************************************************
;;; **********************************************************************
;;;
;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/load.lisp,v 1.2
0
1990/12/
01 11:27:25
wlott Exp $
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/load.lisp,v 1.2
1
1990/12/
18 20:40:33
wlott Exp $
;;;
;;;
;;; Loader for Spice Lisp.
;;; Loader for Spice Lisp.
;;; Written by Skef Wholey and Rob MacLachlan.
;;; Written by Skef Wholey and Rob MacLachlan.
...
@@ -475,7 +475,7 @@
...
@@ -475,7 +475,7 @@
(
clone-fop
(
fop-struct
48
)
(
clone-fop
(
fop-struct
48
)
(
fop-small-struct
49
)
(
fop-small-struct
49
)
(
let*
((
size
(
clone-arg
))
(
let*
((
size
(
clone-arg
))
(
res
(
c:
:
structur
ify
(
make-array
size
))))
(
res
(
c:
make-
structur
e
size
))))
(
declare
(
type
index
size
))
(
declare
(
type
index
size
))
(
do
((
n
(
1-
size
)
(
1-
n
)))
(
do
((
n
(
1-
size
)
(
1-
n
)))
((
minusp
n
))
((
minusp
n
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment