diff options
| author | Richard M. Stallman | 1998-02-02 01:06:29 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-02-02 01:06:29 +0000 |
| commit | 6a7df83b34b52efc1e40e6854e4368f76afcc7d1 (patch) | |
| tree | 4ff98731d27251b42623dc38bb782a3a96c6bad6 /src | |
| parent | 6d4752042a7e93529e8d166c146d5ef53e71f2d6 (diff) | |
| download | emacs-6a7df83b34b52efc1e40e6854e4368f76afcc7d1.tar.gz emacs-6a7df83b34b52efc1e40e6854e4368f76afcc7d1.zip | |
(concat): Handle bool-vectors correctly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 64 |
1 files changed, 34 insertions, 30 deletions
| @@ -557,43 +557,47 @@ concat (nargs, args, target_type, last_special) | |||
| 557 | if (NILP (this)) break; | 557 | if (NILP (this)) break; |
| 558 | if (CONSP (this)) | 558 | if (CONSP (this)) |
| 559 | elt = XCONS (this)->car, this = XCONS (this)->cdr; | 559 | elt = XCONS (this)->car, this = XCONS (this)->cdr; |
| 560 | else | 560 | else if (thisindex >= thisleni) |
| 561 | break; | ||
| 562 | else if (STRINGP (this)) | ||
| 561 | { | 563 | { |
| 562 | if (thisindex >= thisleni) break; | 564 | if (STRING_MULTIBYTE (this)) |
| 563 | if (STRINGP (this)) | ||
| 564 | { | 565 | { |
| 565 | if (STRING_MULTIBYTE (this)) | 566 | int c; |
| 566 | { | 567 | FETCH_STRING_CHAR_ADVANCE (c, this, |
| 567 | int c; | 568 | thisindex, |
| 568 | FETCH_STRING_CHAR_ADVANCE (c, this, | 569 | thisindex_byte); |
| 569 | thisindex, | 570 | XSETFASTINT (elt, c); |
| 570 | thisindex_byte); | ||
| 571 | XSETFASTINT (elt, c); | ||
| 572 | } | ||
| 573 | else | ||
| 574 | { | ||
| 575 | unsigned char c; | ||
| 576 | XSETFASTINT (elt, XSTRING (this)->data[thisindex++]); | ||
| 577 | if (some_multibyte) | ||
| 578 | XSETINT (elt, | ||
| 579 | unibyte_char_to_multibyte (XINT (elt))); | ||
| 580 | } | ||
| 581 | } | 571 | } |
| 582 | else if (BOOL_VECTOR_P (this)) | 572 | else |
| 583 | { | 573 | { |
| 584 | int size_in_chars | 574 | unsigned char c; |
| 585 | = ((XBOOL_VECTOR (this)->size + BITS_PER_CHAR - 1) | 575 | XSETFASTINT (elt, XSTRING (this)->data[thisindex++]); |
| 586 | / BITS_PER_CHAR); | 576 | if (some_multibyte && XINT (elt) >= 0200 |
| 587 | int byte; | 577 | && XINT (elt) < 0400) |
| 588 | byte = XBOOL_VECTOR (val)->data[thisindex / BITS_PER_CHAR]; | 578 | { |
| 589 | if (byte & (1 << (thisindex % BITS_PER_CHAR))) | 579 | c = XINT (elt); |
| 590 | elt = Qt; | 580 | if (nonascii_insert_offset > 0) |
| 591 | else | 581 | c += nonascii_insert_offset; |
| 592 | elt = Qnil; | 582 | else |
| 583 | c += DEFAULT_NONASCII_INSERT_OFFSET; | ||
| 584 | |||
| 585 | XSETINT (elt, c); | ||
| 586 | } | ||
| 593 | } | 587 | } |
| 588 | } | ||
| 589 | else if (BOOL_VECTOR_P (this)) | ||
| 590 | { | ||
| 591 | int byte; | ||
| 592 | byte = XBOOL_VECTOR (this)->data[thisindex / BITS_PER_CHAR]; | ||
| 593 | if (byte & (1 << (thisindex % BITS_PER_CHAR))) | ||
| 594 | elt = Qt; | ||
| 594 | else | 595 | else |
| 595 | elt = XVECTOR (this)->contents[thisindex++]; | 596 | elt = Qnil; |
| 597 | thisindex++; | ||
| 596 | } | 598 | } |
| 599 | else | ||
| 600 | elt = XVECTOR (this)->contents[thisindex++]; | ||
| 597 | 601 | ||
| 598 | /* Store this element into the result. */ | 602 | /* Store this element into the result. */ |
| 599 | if (toindex < 0) | 603 | if (toindex < 0) |