Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asdf
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
Container Registry
Model registry
Operate
Environments
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
Didier Verna
asdf
Commits
3022a31f
Commit
3022a31f
authored
9 years ago
by
Francois-Rene Rideau
Browse files
Options
Downloads
Patches
Plain Diff
uiop/utility: add standard-case-symbol-name and find-standard-case-symbol
parent
55faaf72
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
uiop/package.lisp
+1
-1
1 addition, 1 deletion
uiop/package.lisp
uiop/utility.lisp
+20
-1
20 additions, 1 deletion
uiop/utility.lisp
with
21 additions
and
2 deletions
uiop/package.lisp
+
1
−
1
View file @
3022a31f
...
...
@@ -37,7 +37,7 @@
(
t
nil
))))
(
defun
find-symbol*
(
name
package-designator
&optional
(
error
t
))
"Find a symbol in a package of given string'ified NAME;
unl
ess
CL:FIND-SYMBOL, work well with 'modern' case sensitive syntax
unl
ike
CL:FIND-SYMBOL, work well with 'modern' case sensitive syntax
by letting you supply a symbol or keyword for the name;
also works well when the package is not present.
If optional ERROR argument is NIL, return NIL instead of an error
...
...
This diff is collapsed.
Click to expand it.
uiop/utility.lisp
+
20
−
1
View file @
3022a31f
...
...
@@ -24,6 +24,7 @@
#:base-string-p
#:strings-common-element-type
#:reduce/strcat
#:strcat
;; strings
#:first-char
#:last-char
#:split-string
#:stripln
#:+cr+
#:+lf+
#:+crlf+
#:string-prefix-p
#:string-enclosed-p
#:string-suffix-p
#:standard-case-symbol-name
#:find-standard-case-symbol
#:coerce-class
;; CLOS
#:stamp<
#:stamps<
#:stamp*<
#:stamp<=
;; stamps
#:earlier-stamp
#:stamps-earliest
#:earliest-stamp
...
...
@@ -312,7 +313,7 @@ starting the separation from the end, e.g. when called with arguments
(
defun
string-enclosed-p
(
prefix
string
suffix
)
"Does STRING begin with PREFIX and end with SUFFIX?"
(
and
(
string-prefix-p
prefix
string
)
(
string-suffix-p
string
suffix
)))
)
(
string-suffix-p
string
suffix
)))
(
defvar
+cr+
(
coerce
#(
#\Return
)
'string
))
(
defvar
+lf+
(
coerce
#(
#\Linefeed
)
'string
))
...
...
@@ -330,6 +331,24 @@ the two results passed to STRCAT always reconstitute the original string"
(
return
(
values
(
subseq
x
0
(
-
(
length
x
)
(
length
end
)))
end
)))))
(
when
x
(
c
+crlf+
)
(
c
+lf+
)
(
c
+cr+
)
(
values
x
nil
)))))
(
defun
standard-case-symbol-name
(
name-designator
)
"Given a NAME-DESIGNATOR for a symbol, convert it to a string, using STRING-UPCASE on an ANSI CL
platform, or STRING on a so-called \"modern\" platform such as Allegro with modern syntax."
(
cond
;; Should we be doing something on CLISP?
#+
allegro
((
eq
excl:*current-case-mode*
:case-sensitive-lower
)
(
string
name-designator
))
(
t
(
string-upcase
name-designator
))))
(
defun
find-standard-case-symbol
(
name-designator
package-designator
&optional
(
error
t
))
"Find a symbol in a package the name of which is designated by NAME-DESIGNATOR;
NAME-DESIGNATOR and PACKAGE-DESIGNATOR will be converted to a string using STRING-DESIGNATOR on an
ANSI CL platform, or STRING on a so-called \"modern\" platform such as Allegro with modern syntax.
If optional ERROR argument is NIL, return NIL instead of an error when the symbol is not found."
(
find-symbol
(
standard-case-symbol-name
name-designator
)
(
etypecase
package-designator
((
or
package
null
)
package-designator
)
((
or
string
symbol
)))
error
)))
;;; stamps: a REAL or a boolean where NIL=-infinity, T=+infinity
(
eval-when
(
#-
lispworks
:compile-toplevel
:load-toplevel
:execute
)
...
...
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