A new variable EXT:*DEFAULT-EXTERNAL-FORMAT* implements the actual encoding used with :DEFAULT

This commit is contained in:
Juan Jose Garcia Ripoll 2010-03-28 22:24:55 +02:00
parent 36e0122ae9
commit 1bb8d0c80d
4 changed files with 24 additions and 9 deletions

View file

@ -64,6 +64,12 @@ ECL 10.3.2:
up to date documentation now lives in a separate source repository,
as explained in http://ecls.sourceforge.net/download.html
- The encoding :DEFAULT implies looking up in the special variable
EXT:*DEFAULT-EXTERNAL-FORMAT* the actual value of the encoding, which may be
a known one, or :pass-through.
- LOAD now accepts the keyword argument :EXTERNAL-FORMAT
ECL 10.3.1:
===========

View file

@ -1441,7 +1441,7 @@ si_make_string_output_stream_from_string(cl_object s)
STRING_OUTPUT_STRING(strm) = s;
STRING_OUTPUT_COLUMN(strm) = 0;
#if !defined(ECL_UNICODE)
strm->stream.format = @':default';
strm->stream.format = @':pass-through';
strm->stream.flags = ECL_STREAM_DEFAULT_FORMAT;
strm->stream.byte_size = 8;
#else
@ -1629,7 +1629,7 @@ ecl_make_string_input_stream(cl_object strng, cl_index istart, cl_index iend)
STRING_INPUT_POSITION(strm) = istart;
STRING_INPUT_LIMIT(strm) = iend;
#if !defined(ECL_UNICODE)
strm->stream.format = @':default';
strm->stream.format = @':pass-through';
strm->stream.flags = ECL_STREAM_DEFAULT_FORMAT;
strm->stream.byte_size = 8;
#else
@ -2011,7 +2011,7 @@ const struct ecl_file_ops broadcast_ops = {
}
x = alloc_stream();
if (Null(streams)) {
x->stream.format = @':default';
x->stream.format = @':pass-through';
} else {
x->stream.format = cl_stream_external_format(ECL_CONS_CAR(streams));
}
@ -2344,7 +2344,7 @@ const struct ecl_file_ops concatenated_ops = {
}
x = alloc_stream();
if (Null(streams)) {
x->stream.format = @':default';
x->stream.format = @':pass-through';
} else {
x->stream.format = cl_stream_external_format(ECL_CONS_CAR(streams));
}
@ -2942,7 +2942,7 @@ parse_external_format(cl_object stream, cl_object format, int flags)
if (format == @':BIG-ENDIAN') {
return flags & ~ECL_STREAM_LITTLE_ENDIAN;
}
if (format == @':default' || format == Ct) {
if (format == @':pass-through' || format == Ct) {
return flags | ECL_STREAM_DEFAULT_FORMAT;
}
#ifdef ECL_UNICODE
@ -3003,6 +3003,9 @@ set_stream_elt_type(cl_object stream, cl_fixnum byte_size, int flags,
flags &= ~ECL_STREAM_SIGNED_BYTES;
t = @'unsigned-byte';
}
if (external_format == @':default') {
external_format = ecl_symbol_value(@'ext::*default-external-format*');
}
flags = parse_external_format(stream, external_format, flags);
stream->stream.ops->read_char = eformat_read_char;
stream->stream.ops->write_char = eformat_write_char;
@ -3092,7 +3095,7 @@ set_stream_elt_type(cl_object stream, cl_fixnum byte_size, int flags,
case ECL_STREAM_DEFAULT_FORMAT:
IO_STREAM_ELT_TYPE(stream) = @'base-char';
byte_size = 8;
stream->stream.format = @':default';
stream->stream.format = @':pass-through';
stream->stream.encoder = passthrough_encoder;
stream->stream.decoder = passthrough_decoder;
break;
@ -4601,7 +4604,7 @@ ecl_open_stream(cl_object fn, enum ecl_smmode smm, cl_object if_exists,
(element_type @'base-char')
(if_exists Cnil iesp)
(if_does_not_exist Cnil idnesp)
(external_format @':default')
(external_format @':default')
(cstream Ct)
&aux strm)
enum ecl_smmode smm;

View file

@ -1131,7 +1131,7 @@ cl_symbols[] = {
{SYS_ "INTERPRETER-STACK", SI_ORDINARY, si_interpreter_stack, -1, OBJNULL},
{SYS_ "LINK-FROM", SI_ORDINARY, NULL, -1, OBJNULL},
{SYS_ "LINK-TO", SI_ORDINARY, NULL, -1, OBJNULL},
{SYS_ "LOAD-SOURCE", SI_ORDINARY, si_load_source, 3, OBJNULL},
{SYS_ "LOAD-SOURCE", SI_ORDINARY, si_load_source, 4, OBJNULL},
{SYS_ "LOGICAL-PATHNAME-P", SI_ORDINARY, si_logical_pathname_p, 1, OBJNULL},
{SYS_ "MACRO", SI_ORDINARY, NULL, -1, OBJNULL},
{SYS_ "MAKE-LAMBDA", SI_ORDINARY, si_make_lambda, 2, OBJNULL},
@ -1632,7 +1632,7 @@ cl_symbols[] = {
{SYS_ "*ALIEN-DECLARATIONS*", SI_SPECIAL, NULL, -1, Cnil},
#ifdef ENABLE_DLOPEN
{SYS_ "LOAD-BINARY", SI_ORDINARY, si_load_binary, 3, OBJNULL},
{SYS_ "LOAD-BINARY", SI_ORDINARY, si_load_binary, 4, OBJNULL},
#endif
{SYS_ "*CODE-WALKER*", SI_SPECIAL, NULL, -1, OBJNULL},
@ -1884,5 +1884,8 @@ cl_symbols[] = {
{SYS_ "SIGNAL-SERVICING", SI_ORDINARY, NULL, -1, Cnil},
{EXT_ "*DEFAULT-EXTERNAL-FORMAT*", EXT_SPECIAL, NULL, -1, Ct},
{KEY_ "PASS-THROUGH", KEYWORD, NULL, -1, OBJNULL},
/* Tag for end of list */
{NULL, CL_ORDINARY, NULL, -1, OBJNULL}};

View file

@ -1884,5 +1884,8 @@ cl_symbols[] = {
{SYS_ "SIGNAL-SERVICING",NULL},
{EXT_ "*DEFAULT-EXTERNAL-FORMAT*",NULL},
{KEY_ "C-LOCALE",NULL},
/* Tag for end of list */
{NULL,NULL}};