aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2001-01-24 06:53:23 +0000
committerKenichi Handa2001-01-24 06:53:23 +0000
commit0ee1088b3e5bcc537f29ad5c060cb45c61ef46df (patch)
tree12d9e945bab20f4ecd89bbf47b2d13336067312d /src
parent96531b20faae5d937d929a6378d7584f0ca21711 (diff)
downloademacs-0ee1088b3e5bcc537f29ad5c060cb45c61ef46df.tar.gz
emacs-0ee1088b3e5bcc537f29ad5c060cb45c61ef46df.zip
(CCL_CALL_FOR_MAP_INSTRUCTION): Use "if (1)..." not "do {...".
(CCL_SUCCESS, CCL_SUSPEND, CCL_INVALID_CMD): Likewise. (ccl_driver) <CCL_ReadMultibyteChar2>: Remove unnecessay "do" statement.
Diffstat (limited to 'src')
-rw-r--r--src/ccl.c197
1 files changed, 101 insertions, 96 deletions
diff --git a/src/ccl.c b/src/ccl.c
index bb780221848..de50374f9f8 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -614,7 +614,8 @@ static int stack_idx_of_map_multiple;
614 } while (0) 614 } while (0)
615 615
616#define CCL_CALL_FOR_MAP_INSTRUCTION(symbol, ret_ic) \ 616#define CCL_CALL_FOR_MAP_INSTRUCTION(symbol, ret_ic) \
617 do { \ 617if (1) \
618 { \
618 struct ccl_program called_ccl; \ 619 struct ccl_program called_ccl; \
619 if (stack_idx >= 256 \ 620 if (stack_idx >= 256 \
620 || (setup_ccl_program (&called_ccl, (symbol)) != 0)) \ 621 || (setup_ccl_program (&called_ccl, (symbol)) != 0)) \
@@ -632,7 +633,8 @@ static int stack_idx_of_map_multiple;
632 ccl_prog = called_ccl.prog; \ 633 ccl_prog = called_ccl.prog; \
633 ic = CCL_HEADER_MAIN; \ 634 ic = CCL_HEADER_MAIN; \
634 goto ccl_repeat; \ 635 goto ccl_repeat; \
635 } while (0) 636 } \
637else
636 638
637#define CCL_MapSingle 0x12 /* Map by single code conversion map 639#define CCL_MapSingle 0x12 /* Map by single code conversion map
638 1:ExtendedCOMMNDXXXRRRrrrXXXXX 640 1:ExtendedCOMMNDXXXRRRrrrXXXXX
@@ -672,29 +674,35 @@ static int stack_idx_of_map_multiple;
672 r[7] = LOWER_BYTE (SJIS (Y, Z) */ 674 r[7] = LOWER_BYTE (SJIS (Y, Z) */
673 675
674/* Terminate CCL program successfully. */ 676/* Terminate CCL program successfully. */
675#define CCL_SUCCESS \ 677#define CCL_SUCCESS \
676 do { \ 678if (1) \
679 { \
677 ccl->status = CCL_STAT_SUCCESS; \ 680 ccl->status = CCL_STAT_SUCCESS; \
678 goto ccl_finish; \ 681 goto ccl_finish; \
679 } while (0) 682 } \
683else
680 684
681/* Suspend CCL program because of reading from empty input buffer or 685/* Suspend CCL program because of reading from empty input buffer or
682 writing to full output buffer. When this program is resumed, the 686 writing to full output buffer. When this program is resumed, the
683 same I/O command is executed. */ 687 same I/O command is executed. */
684#define CCL_SUSPEND(stat) \ 688#define CCL_SUSPEND(stat) \
685 do { \ 689if (1) \
690 { \
686 ic--; \ 691 ic--; \
687 ccl->status = stat; \ 692 ccl->status = stat; \
688 goto ccl_finish; \ 693 goto ccl_finish; \
689 } while (0) 694 } \
695else
690 696
691/* Terminate CCL program because of invalid command. Should not occur 697/* Terminate CCL program because of invalid command. Should not occur
692 in the normal case. */ 698 in the normal case. */
693#define CCL_INVALID_CMD \ 699#define CCL_INVALID_CMD \
694 do { \ 700if (1) \
701 { \
695 ccl->status = CCL_STAT_INVALID_CMD; \ 702 ccl->status = CCL_STAT_INVALID_CMD; \
696 goto ccl_error_handler; \ 703 goto ccl_error_handler; \
697 } while (0) 704 } \
705else
698 706
699/* Encode one character CH to multibyte form and write to the current 707/* Encode one character CH to multibyte form and write to the current
700 output buffer. If CH is less than 256, CH is written as is. */ 708 output buffer. If CH is less than 256, CH is written as is. */
@@ -1213,93 +1221,90 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
1213 if (!src) 1221 if (!src)
1214 CCL_INVALID_CMD; 1222 CCL_INVALID_CMD;
1215 1223
1216 do { 1224 if (src >= src_end)
1217 if (src >= src_end) 1225 {
1218 { 1226 src++;
1219 src++; 1227 goto ccl_read_multibyte_character_suspend;
1220 goto ccl_read_multibyte_character_suspend; 1228 }
1221 }
1222 1229
1223 i = *src++; 1230 i = *src++;
1224 if (i == '\n' && ccl->eol_type != CODING_EOL_LF) 1231 if (i == '\n' && ccl->eol_type != CODING_EOL_LF)
1225 { 1232 {
1226 /* We are encoding. */ 1233 /* We are encoding. */
1227 if (ccl->eol_type == CODING_EOL_CRLF) 1234 if (ccl->eol_type == CODING_EOL_CRLF)
1228 { 1235 {
1229 if (ccl->cr_consumed) 1236 if (ccl->cr_consumed)
1230 ccl->cr_consumed = 0; 1237 ccl->cr_consumed = 0;
1231 else 1238 else
1232 { 1239 {
1233 ccl->cr_consumed = 1; 1240 ccl->cr_consumed = 1;
1234 i = '\r'; 1241 i = '\r';
1235 src--; 1242 src--;
1236 } 1243 }
1237 } 1244 }
1238 else 1245 else
1239 i = '\r'; 1246 i = '\r';
1240 reg[rrr] = i; 1247 reg[rrr] = i;
1241 reg[RRR] = CHARSET_ASCII; 1248 reg[RRR] = CHARSET_ASCII;
1242 } 1249 }
1243 else if (i < 0x80) 1250 else if (i < 0x80)
1244 { 1251 {
1245 /* ASCII */ 1252 /* ASCII */
1246 reg[rrr] = i; 1253 reg[rrr] = i;
1247 reg[RRR] = CHARSET_ASCII; 1254 reg[RRR] = CHARSET_ASCII;
1248 } 1255 }
1249 else if (i <= MAX_CHARSET_OFFICIAL_DIMENSION1) 1256 else if (i <= MAX_CHARSET_OFFICIAL_DIMENSION1)
1250 { 1257 {
1251 if (src >= src_end) 1258 if (src >= src_end)
1252 goto ccl_read_multibyte_character_suspend; 1259 goto ccl_read_multibyte_character_suspend;
1253 reg[RRR] = i; 1260 reg[RRR] = i;
1254 reg[rrr] = (*src++ & 0x7F); 1261 reg[rrr] = (*src++ & 0x7F);
1255 } 1262 }
1256 else if (i <= MAX_CHARSET_OFFICIAL_DIMENSION2) 1263 else if (i <= MAX_CHARSET_OFFICIAL_DIMENSION2)
1257 { 1264 {
1258 if ((src + 1) >= src_end) 1265 if ((src + 1) >= src_end)
1259 goto ccl_read_multibyte_character_suspend; 1266 goto ccl_read_multibyte_character_suspend;
1260 reg[RRR] = i; 1267 reg[RRR] = i;
1261 i = (*src++ & 0x7F); 1268 i = (*src++ & 0x7F);
1262 reg[rrr] = ((i << 7) | (*src & 0x7F)); 1269 reg[rrr] = ((i << 7) | (*src & 0x7F));
1263 src++; 1270 src++;
1264 } 1271 }
1265 else if ((i == LEADING_CODE_PRIVATE_11) 1272 else if ((i == LEADING_CODE_PRIVATE_11)
1266 || (i == LEADING_CODE_PRIVATE_12)) 1273 || (i == LEADING_CODE_PRIVATE_12))
1267 { 1274 {
1268 if ((src + 1) >= src_end) 1275 if ((src + 1) >= src_end)
1269 goto ccl_read_multibyte_character_suspend; 1276 goto ccl_read_multibyte_character_suspend;
1270 reg[RRR] = *src++; 1277 reg[RRR] = *src++;
1271 reg[rrr] = (*src++ & 0x7F); 1278 reg[rrr] = (*src++ & 0x7F);
1272 } 1279 }
1273 else if ((i == LEADING_CODE_PRIVATE_21) 1280 else if ((i == LEADING_CODE_PRIVATE_21)
1274 || (i == LEADING_CODE_PRIVATE_22)) 1281 || (i == LEADING_CODE_PRIVATE_22))
1275 { 1282 {
1276 if ((src + 2) >= src_end) 1283 if ((src + 2) >= src_end)
1277 goto ccl_read_multibyte_character_suspend; 1284 goto ccl_read_multibyte_character_suspend;
1278 reg[RRR] = *src++; 1285 reg[RRR] = *src++;
1279 i = (*src++ & 0x7F); 1286 i = (*src++ & 0x7F);
1280 reg[rrr] = ((i << 7) | (*src & 0x7F)); 1287 reg[rrr] = ((i << 7) | (*src & 0x7F));
1281 src++; 1288 src++;
1282 } 1289 }
1283 else if (i == LEADING_CODE_8_BIT_CONTROL) 1290 else if (i == LEADING_CODE_8_BIT_CONTROL)
1284 { 1291 {
1285 if (src >= src_end) 1292 if (src >= src_end)
1286 goto ccl_read_multibyte_character_suspend; 1293 goto ccl_read_multibyte_character_suspend;
1287 reg[RRR] = CHARSET_8_BIT_CONTROL; 1294 reg[RRR] = CHARSET_8_BIT_CONTROL;
1288 reg[rrr] = (*src++ - 0x20); 1295 reg[rrr] = (*src++ - 0x20);
1289 } 1296 }
1290 else if (i >= 0xA0) 1297 else if (i >= 0xA0)
1291 { 1298 {
1292 reg[RRR] = CHARSET_8_BIT_GRAPHIC; 1299 reg[RRR] = CHARSET_8_BIT_GRAPHIC;
1293 reg[rrr] = i; 1300 reg[rrr] = i;
1294 } 1301 }
1295 else 1302 else
1296 { 1303 {
1297 /* INVALID CODE. Return a single byte character. */ 1304 /* INVALID CODE. Return a single byte character. */
1298 reg[RRR] = CHARSET_ASCII; 1305 reg[RRR] = CHARSET_ASCII;
1299 reg[rrr] = i; 1306 reg[rrr] = i;
1300 } 1307 }
1301 break;
1302 } while (1);
1303 break; 1308 break;
1304 1309
1305 ccl_read_multibyte_character_suspend: 1310 ccl_read_multibyte_character_suspend: