/[emacs]/emacs/src/coding.c
ViewVC logotype

Diff of /emacs/src/coding.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.235 by rms, Mon Dec 17 14:05:07 2001 UTC revision 1.236 by sds, Mon Dec 17 15:21:06 2001 UTC
# Line 60  Boston, MA 02111-1307, USA.  */ Line 60  Boston, MA 02111-1307, USA.  */
60    all variants of ISO2022.  Details are described in section 3.    all variants of ISO2022.  Details are described in section 3.
61    
62    2. SJIS (or Shift-JIS or MS-Kanji-Code)    2. SJIS (or Shift-JIS or MS-Kanji-Code)
63      
64    A coding system to encode character sets: ASCII, JISX0201, and    A coding system to encode character sets: ASCII, JISX0201, and
65    JISX0208.  Widely used for PC's in Japan.  Details are described in    JISX0208.  Widely used for PC's in Japan.  Details are described in
66    section 4.    section 4.
# Line 503  coding_safe_chars (coding) Line 503  coding_safe_chars (coding)
503       struct coding_system *coding;       struct coding_system *coding;
504  {  {
505    Lisp_Object coding_spec, plist, safe_chars;    Lisp_Object coding_spec, plist, safe_chars;
506      
507    coding_spec = Fget (coding->symbol, Qcoding_system);    coding_spec = Fget (coding->symbol, Qcoding_system);
508    plist = XVECTOR (coding_spec)->contents[3];    plist = XVECTOR (coding_spec)->contents[3];
509    safe_chars = Fplist_get (XVECTOR (coding_spec)->contents[3], Qsafe_chars);    safe_chars = Fplist_get (XVECTOR (coding_spec)->contents[3], Qsafe_chars);
# Line 889  decode_composition_emacs_mule (coding, s Line 889  decode_composition_emacs_mule (coding, s
889        CODING_ADD_COMPOSITION_START (coding, coding->produced_char, method);        CODING_ADD_COMPOSITION_START (coding, coding->produced_char, method);
890        for (i = 0; i < ncomponent; i++)        for (i = 0; i < ncomponent; i++)
891          CODING_ADD_COMPOSITION_COMPONENT (coding, component[i]);          CODING_ADD_COMPOSITION_COMPONENT (coding, component[i]);
892        CODING_ADD_COMPOSITION_END (coding, coding->produced_char + nchars);          CODING_ADD_COMPOSITION_END (coding, coding->produced_char + nchars);
893        if (buf < bufp)        if (buf < bufp)
894          {          {
895            unsigned char *p = buf;            unsigned char *p = buf;
# Line 1055  decode_coding_emacs_mule (coding, source Line 1055  decode_coding_emacs_mule (coding, source
1055          coding->cmp_data_start = 0;                                     \          coding->cmp_data_start = 0;                                     \
1056        }                                                                 \        }                                                                 \
1057    } while (0)    } while (0)
1058      
1059    
1060  static void encode_eol P_ ((struct coding_system *, unsigned char *,  static void encode_eol P_ ((struct coding_system *, unsigned char *,
1061                              unsigned char *, int, int));                              unsigned char *, int, int));
# Line 1433  detect_coding_iso2022 (src, src_end, mul Line 1433  detect_coding_iso2022 (src, src_end, mul
1433                mask_found |= CODING_CATEGORY_MASK_ISO_SHIFT;                mask_found |= CODING_CATEGORY_MASK_ISO_SHIFT;
1434              }              }
1435            break;            break;
1436              
1437          case ISO_CODE_SI:          case ISO_CODE_SI:
1438            if (inhibit_iso_escape_detection)            if (inhibit_iso_escape_detection)
1439              break;              break;
# Line 1665  coding_allocate_composition_data (coding Line 1665  coding_allocate_composition_data (coding
1665    
1666  #define DECODE_COMPOSITION_END(c1)                                      \  #define DECODE_COMPOSITION_END(c1)                                      \
1667    do {                                                                  \    do {                                                                  \
1668      if (! COMPOSING (coding))                                           \      if (! COMPOSING_P (coding))                                         \
1669        {                                                                 \        {                                                                 \
1670          *dst++ = ISO_CODE_ESC;                                          \          *dst++ = ISO_CODE_ESC;                                          \
1671          *dst++ = c1;                                                    \          *dst++ = c1;                                                    \
# Line 2439  encode_designation_at_bol (coding, trans Line 2439  encode_designation_at_bol (coding, trans
2439        ONE_MORE_CHAR (c);        ONE_MORE_CHAR (c);
2440        if (c == '\n')        if (c == '\n')
2441          break;          break;
2442          
2443        charset = CHAR_CHARSET (c);        charset = CHAR_CHARSET (c);
2444        reg = CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset);        reg = CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset);
2445        if (reg != CODING_SPEC_ISO_NO_REQUESTED_DESIGNATION && r[reg] < 0)        if (reg != CODING_SPEC_ISO_NO_REQUESTED_DESIGNATION && r[reg] < 0)
# Line 2609  encode_coding_iso2022 (coding, source, d Line 2609  encode_coding_iso2022 (coding, source, d
2609                  *dst++ = ISO_CODE_CR;                  *dst++ = ISO_CODE_CR;
2610                CODING_SPEC_ISO_BOL (coding) = 1;                CODING_SPEC_ISO_BOL (coding) = 1;
2611              }              }
2612            else            else
2613              {              {
2614                if (coding->flags & CODING_FLAG_ISO_RESET_AT_CNTL)                if (coding->flags & CODING_FLAG_ISO_RESET_AT_CNTL)
2615                  ENCODE_RESET_PLANE_AND_REGISTER;                  ENCODE_RESET_PLANE_AND_REGISTER;
# Line 3032  encode_coding_sjis_big5 (coding, source, Line 3032  encode_coding_sjis_big5 (coding, source,
3032    
3033        src_base = src;        src_base = src;
3034        ONE_MORE_CHAR (c);        ONE_MORE_CHAR (c);
3035          
3036        /* Now encode the character C.  */        /* Now encode the character C.  */
3037        if (SINGLE_BYTE_CHAR_P (c))        if (SINGLE_BYTE_CHAR_P (c))
3038          {          {
# Line 3357  encode_eol (coding, source, destination, Line 3357  encode_eol (coding, source, destination,
3357    
3358          If the value is nil, graphic register N is never used on          If the value is nil, graphic register N is never used on
3359          encoding.          encoding.
3360      
3361     sub-element[N] where N is 4 through 11: to be set in `coding->flags'     sub-element[N] where N is 4 through 11: to be set in `coding->flags'
3362          Each value takes t or nil.  See the section ISO2022 of          Each value takes t or nil.  See the section ISO2022 of
3363          `coding.h' for more information.          `coding.h' for more information.
# Line 3481  setup_coding_system (coding_system, codi Line 3481  setup_coding_system (coding_system, codi
3481      }      }
3482    else    else
3483      goto label_invalid_coding_system;      goto label_invalid_coding_system;
3484      
3485    /* If the coding system has non-nil `composition' property, enable    /* If the coding system has non-nil `composition' property, enable
3486       composition handling.  */       composition handling.  */
3487    val = Fplist_get (plist, Qcomposition);    val = Fplist_get (plist, Qcomposition);
# Line 3621  setup_coding_system (coding_system, codi Line 3621  setup_coding_system (coding_system, codi
3621                }                }
3622              else              else
3623                CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = -1;                CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = -1;
3624                
3625              CODING_SPEC_ISO_DESIGNATION (coding, i)              CODING_SPEC_ISO_DESIGNATION (coding, i)
3626                = CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i);                = CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i);
3627            }            }
# Line 3994  detect_coding_mask (source, src_bytes, p Line 3994  detect_coding_mask (source, src_bytes, p
3994                    | CODING_CATEGORY_MASK_UTF_16_LE);                    | CODING_CATEGORY_MASK_UTF_16_LE);
3995    
3996            /* Or, if C is a special latin extra code,            /* Or, if C is a special latin extra code,
3997               or is an ISO2022 specific control code of C1 (SS2 or SS3),               or is an ISO2022 specific control code of C1 (SS2 or SS3),
3998               or is an ISO2022 control-sequence-introducer (CSI),               or is an ISO2022 control-sequence-introducer (CSI),
3999               we should also consider the possibility of ISO2022 codings.  */               we should also consider the possibility of ISO2022 codings.  */
4000            if ((VECTORP (Vlatin_extra_code_table)            if ((VECTORP (Vlatin_extra_code_table)
# Line 5101  shrink_encoding_region (beg, end, coding Line 5101  shrink_encoding_region (beg, end, coding
5101          break;          break;
5102        if (coding->flags & CODING_FLAG_ISO_DESIGNATE_AT_BOL)        if (coding->flags & CODING_FLAG_ISO_DESIGNATE_AT_BOL)
5103          {          {
5104            unsigned char *bol = begp;            unsigned char *bol = begp;
5105            while (begp < endp && *begp < 0x80)            while (begp < endp && *begp < 0x80)
5106              {              {
5107                begp++;                begp++;
# Line 5599  code_convert_region (from, from_byte, to Line 5599  code_convert_region (from, from_byte, to
5599              coding->symbol = XVECTOR (eol_type)->contents[CODING_EOL_LF];              coding->symbol = XVECTOR (eol_type)->contents[CODING_EOL_LF];
5600            else            else
5601              coding->symbol = saved_coding_symbol;              coding->symbol = saved_coding_symbol;
5602              
5603            continue;            continue;
5604          }          }
5605        if (len_byte <= 0)        if (len_byte <= 0)
# Line 5617  code_convert_region (from, from_byte, to Line 5617  code_convert_region (from, from_byte, to
5617            if (multibyte_p)            if (multibyte_p)
5618              {              {
5619                unsigned char *start = dst;                unsigned char *start = dst;
5620                  
5621                inserted += len_byte;                inserted += len_byte;
5622                while (len_byte--)                while (len_byte--)
5623                  {                  {
# Line 5700  code_convert_region (from, from_byte, to Line 5700  code_convert_region (from, from_byte, to
5700        inserted_byte = str_to_multibyte (GPT_ADDR, GAP_SIZE, inserted_byte);        inserted_byte = str_to_multibyte (GPT_ADDR, GAP_SIZE, inserted_byte);
5701      }      }
5702    
5703    /* If we shrank the conversion area, adjust it now.  */    /* If we shrank the conversion area, adjust it now.  */
5704    if (total_skip > 0)    if (total_skip > 0)
5705      {      {
5706        if (tail_skip > 0)        if (tail_skip > 0)
# Line 5942  decode_coding_string (str, coding, nocop Line 5942  decode_coding_string (str, coding, nocop
5942                  }                  }
5943                produced += num_eol;                produced += num_eol;
5944                produced_char += num_eol;                produced_char += num_eol;
5945              }              }
5946            /* Suppress eol-format conversion in the further conversion.  */            /* Suppress eol-format conversion in the further conversion.  */
5947            coding->eol_type = CODING_EOL_LF;            coding->eol_type = CODING_EOL_LF;
5948    
# Line 6212  detect_coding_system (src, src_bytes, hi Line 6212  detect_coding_system (src, src_bytes, hi
6212          }          }
6213      }      }
6214    return (highest ? XCAR (val) : val);    return (highest ? XCAR (val) : val);
6215  }    }
6216    
6217  DEFUN ("detect-coding-region", Fdetect_coding_region, Sdetect_coding_region,  DEFUN ("detect-coding-region", Fdetect_coding_region, Sdetect_coding_region,
6218         2, 3, 0,         2, 3, 0,
# Line 6408  DEFUN ("find-coding-systems-region-inter Line 6408  DEFUN ("find-coding-systems-region-inter
6408        for (p = p1; p < p1end && ASCII_BYTE_P (*p); p++);        for (p = p1; p < p1end && ASCII_BYTE_P (*p); p++);
6409        if (p == p1end)        if (p == p1end)
6410          {          {
6411            for (p = p2; p < p2end && ASCII_BYTE_P (*p); p++);                  for (p = p2; p < p2end && ASCII_BYTE_P (*p); p++);
6412            if (p == p2end)            if (p == p2end)
6413              return Qt;              return Qt;
6414          }          }
# Line 6940  init_coding_once () Line 6940  init_coding_once ()
6940  {  {
6941    int i;    int i;
6942    
6943    /* Emacs' internal format specific initialize routine.  */    /* Emacs' internal format specific initialize routine.  */
6944    for (i = 0; i <= 0x20; i++)    for (i = 0; i <= 0x20; i++)
6945      emacs_code_class[i] = EMACS_control_code;      emacs_code_class[i] = EMACS_control_code;
6946    emacs_code_class[0x0A] = EMACS_linefeed_code;    emacs_code_class[0x0A] = EMACS_linefeed_code;

Legend:
Removed from v.1.235  
changed lines
  Added in v.1.236

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26