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
No related tags found
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 @@
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; 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
;;; Spice Lisp Reader
;;; Written by David Dill
;;; Written by David Dill
...
@@ -1229,25 +1229,23 @@
...
@@ -1229,25 +1229,23 @@
;;;; PARSE-INTEGER.
;;;; PARSE-INTEGER.
(
defun
parse-integer
(
string
&key
(
start
0
)
(
end
(
length
string
))
(
defun
parse-integer
(
string
&key
(
start
0
)
end
(
radix
10
)
junk-allowed
)
(
radix
10
)
junk-allowed
)
"Examine the substring of string delimited by start and end
"Examine the substring of string delimited by start and end
(default to the beginning and end of the string) It skips over
(default to the beginning and end of the string) It skips over
whitespace characters and then tries to parse an integer. The
whitespace characters and then tries to parse an integer. The
radix parameter must be between 2 and 36."
radix parameter must be between 2 and 36."
(
declare
(
fixnum
end
))
(
let*
((
end
(
or
end
(
length
string
)))
(
if
(
null
end
)
(
setq
end
(
length
string
)))
(
index
(
do
((
i
start
(
1+
i
)))
(
let
((
index
(
do
((
i
start
(
1+
i
)))
((
=
i
end
)
((
=
i
end
)
(
if
junk-allowed
(
if
junk-allowed
(
return-from
parse-integer
(
values
nil
end
))
(
return-from
parse-integer
(
values
nil
end
))
(
error
"No non-whitespace characters in number."
)))
(
error
"No non-whitespace characters in number."
)))
(
declare
(
fixnum
i
))
(
declare
(
fixnum
i
))
(
unless
(
whitespacep
(
char
string
i
))
(
return
i
))))
(
unless
(
whitespacep
(
char
string
i
))
(
return
i
))))
(
minusp
nil
)
(
minusp
nil
)
(
found-digit
nil
)
(
found-digit
nil
)
(
result
0
))
(
result
0
))
(
declare
(
fixnum
end
index
))
(
declare
(
fixnum
index
))
(
let
((
char
(
char
string
index
)))
(
let
((
char
(
char
string
index
)))
(
cond
((
char=
char
#\-
)
(
cond
((
char=
char
#\-
)
(
setq
minusp
t
)
(
setq
minusp
t
)
...
@@ -1255,23 +1253,23 @@
...
@@ -1255,23 +1253,23 @@
((
char=
char
#\+
)
((
char=
char
#\+
)
(
incf
index
))))
(
incf
index
))))
(
loop
(
loop
(
when
(
=
index
end
)
(
return
nil
))
(
when
(
=
index
end
)
(
return
nil
))
(
let*
((
char
(
char
string
index
))
(
let*
((
char
(
char
string
index
))
(
weight
(
digit-char-p
char
radix
)))
(
weight
(
digit-char-p
char
radix
)))
(
cond
(
weight
(
cond
(
weight
(
setq
result
(
+
weight
(
*
result
radix
))
(
setq
result
(
+
weight
(
*
result
radix
))
found-digit
t
))
found-digit
t
))
(
junk-allowed
(
return
nil
))
(
junk-allowed
(
return
nil
))
((
whitespacep
char
)
((
whitespacep
char
)
(
do
((
jndex
(
1+
index
)
(
1+
jndex
)))
(
do
((
jndex
(
1+
index
)
(
1+
jndex
)))
((
=
jndex
end
))
((
=
jndex
end
))
(
declare
(
fixnum
jndex
))
(
declare
(
fixnum
jndex
))
(
unless
(
whitespacep
(
char
string
jndex
))
(
unless
(
whitespacep
(
char
string
jndex
))
(
error
"There's junk in this string: ~S."
string
)))
(
error
"There's junk in this string: ~S."
string
)))
(
return
nil
))
(
return
nil
))
(
t
(
t
(
error
"There's junk in this string: ~S."
string
))))
(
error
"There's junk in this string: ~S."
string
))))
(
incf
index
))
(
incf
index
))
(
values
(
values
(
if
found-digit
(
if
found-digit
(
if
minusp
(
-
result
)
result
)
(
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