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
b6cdc8cf
Commit
b6cdc8cf
authored
34 years ago
by
wlott
Browse files
Options
Downloads
Patches
Plain Diff
Fixed bogus fixnum declaration in parse-integer.
parent
de841ba5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/reader.lisp
+31
-33
31 additions, 33 deletions
code/reader.lisp
with
31 additions
and
33 deletions
code/reader.lisp
+
31
−
33
View file @
b6cdc8cf
...
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; **********************************************************************
;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/reader.lisp,v 1.
3
1990/0
8/24 18:12:38
wlott Exp $
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/reader.lisp,v 1.
4
1990/0
9/06 19:38:45
wlott Exp $
;;;
;;; Spice Lisp Reader
;;; Written by David Dill
...
...
@@ -1229,25 +1229,23 @@
;;;; PARSE-INTEGER.
(
defun
parse-integer
(
string
&key
(
start
0
)
(
end
(
length
string
))
(
radix
10
)
junk-allowed
)
(
defun
parse-integer
(
string
&key
(
start
0
)
end
(
radix
10
)
junk-allowed
)
"Examine the substring of string delimited by start and end
(default to the beginning and end of the string) It skips over
whitespace characters and then tries to parse an integer. The
radix parameter must be between 2 and 36."
(
declare
(
fixnum
end
))
(
if
(
null
end
)
(
setq
end
(
length
string
)))
(
let
((
index
(
do
((
i
start
(
1+
i
)))
((
=
i
end
)
(
if
junk-allowed
(
return-from
parse-integer
(
values
nil
end
))
(
error
"No non-whitespace characters in number."
)))
(
declare
(
fixnum
i
))
(
unless
(
whitespacep
(
char
string
i
))
(
return
i
))))
(
minusp
nil
)
(
found-digit
nil
)
(
result
0
))
(
declare
(
fixnum
index
))
(
let*
((
end
(
or
end
(
length
string
)))
(
index
(
do
((
i
start
(
1+
i
)))
((
=
i
end
)
(
if
junk-allowed
(
return-from
parse-integer
(
values
nil
end
))
(
error
"No non-whitespace characters in number."
)))
(
declare
(
fixnum
i
))
(
unless
(
whitespacep
(
char
string
i
))
(
return
i
))))
(
minusp
nil
)
(
found-digit
nil
)
(
result
0
))
(
declare
(
fixnum
end
index
))
(
let
((
char
(
char
string
index
)))
(
cond
((
char=
char
#\-
)
(
setq
minusp
t
)
...
...
@@ -1255,23 +1253,23 @@
((
char=
char
#\+
)
(
incf
index
))))
(
loop
(
when
(
=
index
end
)
(
return
nil
))
(
let*
((
char
(
char
string
index
))
(
weight
(
digit-char-p
char
radix
)))
(
cond
(
weight
(
setq
result
(
+
weight
(
*
result
radix
))
found-digit
t
))
(
junk-allowed
(
return
nil
))
((
whitespacep
char
)
(
do
((
jndex
(
1+
index
)
(
1+
jndex
)))
((
=
jndex
end
))
(
declare
(
fixnum
jndex
))
(
unless
(
whitespacep
(
char
string
jndex
))
(
error
"There's junk in this string: ~S."
string
)))
(
return
nil
))
(
t
(
error
"There's junk in this string: ~S."
string
))))
(
incf
index
))
(
when
(
=
index
end
)
(
return
nil
))
(
let*
((
char
(
char
string
index
))
(
weight
(
digit-char-p
char
radix
)))
(
cond
(
weight
(
setq
result
(
+
weight
(
*
result
radix
))
found-digit
t
))
(
junk-allowed
(
return
nil
))
((
whitespacep
char
)
(
do
((
jndex
(
1+
index
)
(
1+
jndex
)))
((
=
jndex
end
))
(
declare
(
fixnum
jndex
))
(
unless
(
whitespacep
(
char
string
jndex
))
(
error
"There's junk in this string: ~S."
string
)))
(
return
nil
))
(
t
(
error
"There's junk in this string: ~S."
string
))))
(
incf
index
))
(
values
(
if
found-digit
(
if
minusp
(
-
result
)
result
)
...
...
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