Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asdf-encodings
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
asdf
asdf-encodings
Commits
678ea981
Commit
678ea981
authored
12 years ago
by
Francois-Rene Rideau
Browse files
Options
Downloads
Patches
Plain Diff
Rename detect-encoding to detect-file-encoding to not clash with asdf.
Add more documentation. Move a variable around.
parent
db760ff8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
README
+23
-1
23 additions, 1 deletion
README
asdf-support.lisp
+4
-1
4 additions, 1 deletion
asdf-support.lisp
autodetect.lisp
+2
-2
2 additions, 2 deletions
autodetect.lisp
encodings.lisp
+0
-3
0 additions, 3 deletions
encodings.lisp
pkgdcl.lisp
+3
-2
3 additions, 2 deletions
pkgdcl.lisp
with
32 additions
and
9 deletions
README
+
23
−
1
View file @
678ea981
...
...
@@ -2,12 +2,13 @@ ASDF-ENCODINGS
This library allows you to use ASDF with Lisp source files
that use an encoding different from either ASCII or UTF-8.
It depends on ASDF 2.21 or later (actually 2.20.
7
or later).
It depends on ASDF 2.21 or later (actually 2.20.
18
or later).
TODO:
(1) actually support more implementations.
(2) Add a test suite.
(3) Test it.
(4) Add more corner cases.
==== Exported Functionality ====
...
...
@@ -30,3 +31,24 @@ function ENCODING-EXTERNAL-FORMAT (ENCODING &KEY (ON-ERROR *ON-UNSUPPORTED-ENCOD
the current implementation's CL:OPEN, CL:LOAD or CL:COMPILE-FILE functions.
If the encoding is not supported on this implementation, the ON-ERROR
argument, which is one of :ERROR, :WARN, NIL, specifies what to do.
variable *ON-UNSUPPORTED-ENCODING*
One of :error, :warn or nil,
specifies what to do when passed an unsupported encoding.
Defaults to :error.
function DETECT-FILE-ENCODING (PATHNAME)
This function takes a pathname designator,
and returns a portable encoding as detected by the file contents,
either an emacs-style -*- coding: foo -*- declaration,
or something deduced from the octet patterns in the file.
function NORMALIZE-ENCODING (ENCODING)
Given a portable encoding keyword, returns the normalized keyword
describing that encoding on the current implementations, if any,
or NIL if the encoding is not present on the implementation
(or not recognized by asdf-encodings).
function FIND-IMPLEMENTATION-ENCODING (ENCODING)
Given a normalized encoding keyword, returns
an external-format suitable for use on the current implementation, if any.
This diff is collapsed.
Click to expand it.
asdf-support.lisp
+
4
−
1
View file @
678ea981
...
...
@@ -2,6 +2,9 @@
(
in-package
:asdf-encodings
)
(
defvar
*on-unsupported-encoding*
:error
"One of :error, :warn or nil, specifies what to do when passed an unsupported encoding."
)
(
defun
encoding-external-format
(
encoding
&key
(
on-error
*on-unsupported-encoding*
))
(
or
(
and
(
eq
encoding
:default
)
:default
)
(
find-implementation-encoding
(
or
(
normalize-encoding
encoding
)
encoding
))
...
...
@@ -13,5 +16,5 @@
(
defun
register-asdf-encodings
()
(
setf
asdf:*encoding-external-format-hook*
'encoding-external-format
asdf:*encoding-detection-hook*
'detect-encoding
)
asdf:*encoding-detection-hook*
'detect-
file-
encoding
)
(
values
))
This diff is collapsed.
Click to expand it.
autodetect.lisp
+
2
−
2
View file @
678ea981
...
...
@@ -153,7 +153,7 @@
((
cdr
(
assoc
"encoding"
options
:test
'equalp
)))
((
cdr
(
assoc
"coding"
options
:test
'equalp
)))))))
;;; Examine the
'
file to determine the encoding.
;;; Examine the file to determine the encoding.
;;; In some cases the encoding can be determined
;;; from the coding of the file itself,
;;; otherwise it may be specified in a file options line
...
...
@@ -162,7 +162,7 @@
;;; but is valid UTF-8 using then UTF-8 specific characters
;;; then :utf-8 is returned, otherwise :latin1 is returned.
(
defun
detect-encoding
(
file
)
(
defun
detect-
file-
encoding
(
file
)
(
let
((
initial-encoding
nil
)
(
declared-encoding
nil
))
(
with-open-file
(
s
file
:element-type
'
(
unsigned-byte
8
)
...
...
This diff is collapsed.
Click to expand it.
encodings.lisp
+
0
−
3
View file @
678ea981
...
...
@@ -4,9 +4,6 @@
(
in-package
:asdf-encodings
)
(
defvar
*on-unsupported-encoding*
:error
"One of :error, :warn or nil, specifies what to do when passed an unsupported encoding."
)
(
defparameter
*encodings*
;; Define valid names for an encoding.
;; We prefer the main name in Wikipedia,
...
...
This diff is collapsed.
Click to expand it.
pkgdcl.lisp
+
3
−
2
View file @
678ea981
...
...
@@ -6,6 +6,7 @@
(
:use
:cl
)
(
:export
#:encoding-external-format
#:*on-unsupported-encoding*
#:detect-file-encoding
#:normalize-encoding
#:find-implementation-encoding
#:*on-unsupported-encoding*
))
#:find-implementation-encoding
))
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