Mercurial > hg > xemacs-beta
comparison src/mule-ccl.c @ 418:e804706bfb8c r21-2-17
Import from CVS: tag r21-2-17
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:23:13 +0200 |
parents | da8ed4261e83 |
children | 95016f13131a |
comparison
equal
deleted
inserted
replaced
417:43a18b32d56e | 418:e804706bfb8c |
---|---|
445 goto ccl_error_handler; \ | 445 goto ccl_error_handler; \ |
446 } \ | 446 } \ |
447 else \ | 447 else \ |
448 { \ | 448 { \ |
449 Bufbyte work[MAX_EMCHAR_LEN]; \ | 449 Bufbyte work[MAX_EMCHAR_LEN]; \ |
450 int len = ( ch < 256 ) ? \ | 450 int len = ( ch < ( conversion_mode == CCL_MODE_ENCODING ? \ |
451 256 : 128 ) ) ? \ | |
451 simple_set_charptr_emchar (work, ch) : \ | 452 simple_set_charptr_emchar (work, ch) : \ |
452 non_ascii_set_charptr_emchar (work, ch); \ | 453 non_ascii_set_charptr_emchar (work, ch); \ |
453 Dynarr_add_many (destination, work, len); \ | 454 Dynarr_add_many (destination, work, len); \ |
454 } \ | 455 } \ |
455 } while (0) | 456 } while (0) |
515 Lisp_Object *ccl_prog; /* Pointer to an array of CCL code. */ | 516 Lisp_Object *ccl_prog; /* Pointer to an array of CCL code. */ |
516 int ic; /* Instruction Counter. */ | 517 int ic; /* Instruction Counter. */ |
517 }; | 518 }; |
518 | 519 |
519 int | 520 int |
520 ccl_driver (struct ccl_program *ccl, CONST unsigned char *source, unsigned_char_dynarr *destination, int src_bytes, int *consumed) | 521 ccl_driver (struct ccl_program *ccl, CONST unsigned char *source, unsigned_char_dynarr *destination, int src_bytes, int *consumed, int conversion_mode) |
521 { | 522 { |
522 int *reg = ccl->reg; | 523 int *reg = ccl->reg; |
523 int ic = ccl->ic; | 524 int ic = ccl->ic; |
524 int code = -1; /* init to illegal value, */ | 525 int code = -1; /* init to illegal value, */ |
525 int field1, field2; | 526 int field1, field2; |
976 ccl.reg[i] = (INTP (XVECTOR_DATA (reg)[i]) | 977 ccl.reg[i] = (INTP (XVECTOR_DATA (reg)[i]) |
977 ? XINT (XVECTOR_DATA (reg)[i]) | 978 ? XINT (XVECTOR_DATA (reg)[i]) |
978 : 0); | 979 : 0); |
979 | 980 |
980 ccl_driver (&ccl, (CONST unsigned char *)0, (unsigned_char_dynarr *)0, | 981 ccl_driver (&ccl, (CONST unsigned char *)0, (unsigned_char_dynarr *)0, |
981 0, (int *)0); | 982 0, (int *)0, CCL_MODE_ENCODING); |
982 QUIT; | 983 QUIT; |
983 if (ccl.status != CCL_STAT_SUCCESS) | 984 if (ccl.status != CCL_STAT_SUCCESS) |
984 error ("Error in CCL program at %dth code", ccl.ic); | 985 error ("Error in CCL program at %dth code", ccl.ic); |
985 | 986 |
986 for (i = 0; i < 8; i++) | 987 for (i = 0; i < 8; i++) |
1033 ccl.ic = i; | 1034 ccl.ic = i; |
1034 } | 1035 } |
1035 outbuf = Dynarr_new (unsigned_char); | 1036 outbuf = Dynarr_new (unsigned_char); |
1036 ccl.last_block = NILP (contin); | 1037 ccl.last_block = NILP (contin); |
1037 produced = ccl_driver (&ccl, XSTRING_DATA (str), outbuf, | 1038 produced = ccl_driver (&ccl, XSTRING_DATA (str), outbuf, |
1038 XSTRING_LENGTH (str), (int *)0); | 1039 XSTRING_LENGTH (str), (int *)0, CCL_MODE_ENCODING); |
1039 for (i = 0; i < 8; i++) | 1040 for (i = 0; i < 8; i++) |
1040 XVECTOR_DATA (status)[i] = make_int(ccl.reg[i]); | 1041 XVECTOR_DATA (status)[i] = make_int(ccl.reg[i]); |
1041 XSETINT (XVECTOR_DATA (status)[8], ccl.ic); | 1042 XSETINT (XVECTOR_DATA (status)[8], ccl.ic); |
1042 UNGCPRO; | 1043 UNGCPRO; |
1043 | 1044 |