-#define CCL_WRITE_STRING(len) do { \
- if (!destination) \
- { \
- ccl->status = CCL_STAT_INVALID_CMD; \
- goto ccl_error_handler; \
- } \
- else \
- for (i = 0; i < len; i++) \
- Dynarr_add(destination, \
- (XINT (ccl_prog[ic + (i / 3)]) \
- >> ((2 - (i % 3)) * 8)) & 0xFF); \
+#define CCL_WRITE_STRING(len) do { \
+ if (!destination) \
+ { \
+ ccl->status = CCL_STAT_INVALID_CMD; \
+ goto ccl_error_handler; \
+ } \
+ else \
+ { \
+ Bufbyte work[MAX_EMCHAR_LEN]; \
+ for (i = 0; i < len; i++) \
+ { \
+ int ch = (XINT (ccl_prog[ic + (i / 3)]) \
+ >> ((2 - (i % 3)) * 8)) & 0xFF; \
+ int bytes = \
+ ( ch < ( conversion_mode == CCL_MODE_ENCODING ? \
+ 256 : 128 ) ) ? \
+ simple_set_charptr_emchar (work, ch) : \
+ non_ascii_set_charptr_emchar (work, ch); \
+ Dynarr_add_many (destination, work, bytes); \
+ } \
+ } \