diff options
Diffstat (limited to 'src/coding.h')
-rw-r--r-- | src/coding.h | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/src/coding.h b/src/coding.h index 39f9d62462b..299c20d0a51 100644 --- a/src/coding.h +++ b/src/coding.h @@ -226,7 +226,7 @@ enum coding_attr_index hash_lookup (XHASH_TABLE (Vcoding_system_hash_table), \ coding_system_symbol, NULL) -/* Return 1 if CODING_SYSTEM_SYMBOL is a coding system. */ +/* Return true if CODING_SYSTEM_SYMBOL is a coding system. */ #define CODING_SYSTEM_P(coding_system_symbol) \ (CODING_SYSTEM_ID (coding_system_symbol) >= 0 \ @@ -240,7 +240,7 @@ enum coding_attr_index if (CODING_SYSTEM_ID (x) < 0 \ && NILP (Fcheck_coding_system (x))) \ wrong_type_argument (Qcoding_system_p, (x)); \ - } while (0) + } while (false) /* Check if X is a coding system or not. If it is, set SEPC to the @@ -256,7 +256,7 @@ enum coding_attr_index } \ if (NILP (spec)) \ wrong_type_argument (Qcoding_system_p, (x)); \ - } while (0) + } while (false) /* Check if X is a coding system or not. If it is, set ID to the @@ -273,7 +273,7 @@ enum coding_attr_index } \ if (id < 0) \ wrong_type_argument (Qcoding_system_p, (x)); \ - } while (0) + } while (false) /*** GENERAL section ***/ @@ -361,13 +361,13 @@ struct iso_2022_spec /* True temporarily only when graphic register 2 or 3 is invoked by single-shift while encoding. */ - unsigned single_shifting : 1; + bool_bf single_shifting : 1; /* True temporarily only when processing at beginning of line. */ - unsigned bol : 1; + bool_bf bol : 1; /* If true, we are now scanning embedded UTF-8 sequence. */ - unsigned embedded_utf_8 : 1; + bool_bf embedded_utf_8 : 1; /* The current composition. */ struct composition_status cmp_status; @@ -455,11 +455,11 @@ struct coding_system unsigned char *safe_charsets; /* The following two members specify how binary 8-bit code 128..255 - are represented in source and destination text respectively. 1 - means they are represented by 2-byte sequence, 0 means they are + are represented in source and destination text respectively. True + means they are represented by 2-byte sequence, false means they are represented by 1-byte as is (see the comment in character.h). */ - unsigned src_multibyte : 1; - unsigned dst_multibyte : 1; + bool_bf src_multibyte : 1; + bool_bf dst_multibyte : 1; /* How may heading bytes we can skip for decoding. This is set to -1 in setup_coding_system, and updated by detect_coding. So, @@ -510,14 +510,14 @@ struct coding_system /* True if the source of conversion is not in the member `charbuf', but at `src_object'. */ - unsigned chars_at_source : 1; + bool_bf chars_at_source : 1; /* Nonzero if the result of conversion is in `destination' buffer rather than in `dst_object'. */ - unsigned raw_destination : 1; + bool_bf raw_destination : 1; - /* Set to 1 if charbuf contains an annotation. */ - unsigned annotated : 1; + /* Set to true if charbuf contains an annotation. */ + bool_bf annotated : 1; unsigned char carryover[64]; int carryover_bytes; @@ -543,28 +543,29 @@ struct coding_system #define CODING_REQUIRE_DETECTION_MASK 0x1000 #define CODING_RESET_AT_BOL_MASK 0x2000 -/* Return 1 if the coding context CODING requires annotation +/* Return nonzero if the coding context CODING requires annotation handling. */ #define CODING_REQUIRE_ANNOTATION(coding) \ ((coding)->common_flags & CODING_ANNOTATION_MASK) -/* Return 1 if the coding context CODING prefers decoding into unibyte. */ +/* Return nonzero if the coding context CODING prefers decoding into + unibyte. */ #define CODING_FOR_UNIBYTE(coding) \ ((coding)->common_flags & CODING_FOR_UNIBYTE_MASK) -/* Return 1 if the coding context CODING requires specific code to be +/* Return nonzero if the coding context CODING requires specific code to be attached at the tail of converted text. */ #define CODING_REQUIRE_FLUSHING(coding) \ ((coding)->common_flags & CODING_REQUIRE_FLUSHING_MASK) -/* Return 1 if the coding context CODING requires code conversion on +/* Return nonzero if the coding context CODING requires code conversion on decoding. */ #define CODING_REQUIRE_DECODING(coding) \ ((coding)->dst_multibyte \ || (coding)->common_flags & CODING_REQUIRE_DECODING_MASK) -/* Return 1 if the coding context CODING requires code conversion on +/* Return nonzero if the coding context CODING requires code conversion on encoding. The non-multibyte part of the condition is to support encoding of unibyte strings/buffers generated by string-as-unibyte or @@ -575,12 +576,12 @@ struct coding_system || (coding)->mode & CODING_MODE_SELECTIVE_DISPLAY) -/* Return 1 if the coding context CODING requires some kind of code +/* Return nonzero if the coding context CODING requires some kind of code detection. */ #define CODING_REQUIRE_DETECTION(coding) \ ((coding)->common_flags & CODING_REQUIRE_DETECTION_MASK) -/* Return 1 if the coding context CODING requires code conversion on +/* Return nonzero if the coding context CODING requires code conversion on decoding or some kind of code detection. */ #define CODING_MAY_REQUIRE_DECODING(coding) \ (CODING_REQUIRE_DECODING (coding) \ @@ -604,7 +605,7 @@ struct coding_system (j1 = s1 * 2 - ((s1 >= 0xE0) ? 0x161 : 0xE1), \ j2 = s2 - ((s2 >= 0x7F) ? 0x20 : 0x1F)); \ (code) = (j1 << 8) | j2; \ - } while (0) + } while (false) #define SJIS_TO_JIS2(code) \ do { \ @@ -629,7 +630,7 @@ struct coding_system j2 = s2 - ((s2 >= 0x7F ? 0x20 : 0x1F)); \ } \ (code) = (j1 << 8) | j2; \ - } while (0) + } while (false) #define JIS_TO_SJIS(code) \ @@ -644,7 +645,7 @@ struct coding_system (s1 = j1 / 2 + ((j1 < 0x5F) ? 0x70 : 0xB0), \ s2 = j2 + 0x7E); \ (code) = (s1 << 8) | s2; \ - } while (0) + } while (false) #define JIS_TO_SJIS2(code) \ do { \ @@ -668,7 +669,7 @@ struct coding_system s2 = j2 + 0x7E; \ } \ (code) = (s1 << 8) | s2; \ - } while (0) + } while (false) /* Encode the file name NAME using the specified coding system for file names, if any. */ @@ -682,18 +683,18 @@ struct coding_system for system functions, if any. */ #define ENCODE_SYSTEM(str) \ (! NILP (Vlocale_coding_system) \ - ? code_convert_string_norecord (str, Vlocale_coding_system, 1) \ + ? code_convert_string_norecord (str, Vlocale_coding_system, true) \ : str) /* Decode the string STR using the specified coding system for system functions, if any. */ #define DECODE_SYSTEM(str) \ (! NILP (Vlocale_coding_system) \ - ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \ + ? code_convert_string_norecord (str, Vlocale_coding_system, false) \ : str) /* Note that this encodes utf-8, not utf-8-emacs, so it's not a no-op. */ -#define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, 1) +#define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, true) /* Extern declarations. */ extern Lisp_Object code_conversion_save (bool, bool); @@ -759,7 +760,7 @@ extern Lisp_Object from_unicode_buffer (const wchar_t* wstr); (coding)->src_chars = (coding)->src_bytes = (bytes); \ decode_coding_object ((coding), Qnil, 0, 0, (bytes), (bytes), \ (dst_object)); \ - } while (0) + } while (false) extern Lisp_Object preferred_coding_system (void); |