static MVMuint32 run_decode(MVMThreadContext *tc, MVMDecodeStream *ds, const MVMint32 *stopper_chars, MVMDecodeStreamSeparators *sep_spec, MVMint32 eof) { MVMDecodeStreamChars *prev_chars_tail = ds->chars_tail; MVMuint32 reached_stopper; switch (ds->encoding) { case MVM_encoding_type_utf8: reached_stopper = MVM_string_utf8_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_ascii: reached_stopper = MVM_string_ascii_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_latin1: reached_stopper = MVM_string_latin1_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_windows1252: reached_stopper = MVM_string_windows1252_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_utf8_c8: reached_stopper = MVM_string_utf8_c8_decodestream(tc, ds, stopper_chars, sep_spec, eof); break; default: MVM_exception_throw_adhoc(tc, "Streaming decode NYI for encoding %d", (int)ds->encoding); } if (ds->chars_tail == prev_chars_tail) return RUN_DECODE_NOTHING_DECODED; else if (reached_stopper) return RUN_DECODE_STOPPER_REACHED; else return RUN_DECODE_STOPPER_NOT_REACHED; }
static MVMuint32 run_decode(MVMThreadContext *tc, MVMDecodeStream *ds, const MVMint32 *stopper_chars, MVMDecodeStreamSeparators *sep_spec, MVMint32 eof) { MVMDecodeStreamChars *prev_chars_tail = ds->chars_tail; MVMuint32 reached_stopper; switch (ds->encoding) { case MVM_encoding_type_utf8: reached_stopper = MVM_string_utf8_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_ascii: reached_stopper = MVM_string_ascii_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_latin1: reached_stopper = MVM_string_latin1_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_windows1252: reached_stopper = MVM_string_windows1252_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_windows1251: reached_stopper = MVM_string_windows1251_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_shiftjis: reached_stopper = MVM_string_shiftjis_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_utf8_c8: reached_stopper = MVM_string_utf8_c8_decodestream(tc, ds, stopper_chars, sep_spec, eof); break; case MVM_encoding_type_utf16: reached_stopper = MVM_string_utf16_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_utf16be: reached_stopper = MVM_string_utf16be_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_utf16le: reached_stopper = MVM_string_utf16le_decodestream(tc, ds, stopper_chars, sep_spec); break; default: if (ds->encoding < MVM_encoding_type_MIN || MVM_encoding_type_MAX < ds->encoding) MVM_exception_throw_adhoc(tc, "invalid encoding type flag: %"PRIi32, ds->encoding); else MVM_exception_throw_adhoc(tc, "Streaming decode not yet implemented for %s encoding", MVM_string_encoding_cname(tc, ds->encoding)); } if (ds->chars_tail == prev_chars_tail) return RUN_DECODE_NOTHING_DECODED; else if (reached_stopper) return RUN_DECODE_STOPPER_REACHED; else return RUN_DECODE_STOPPER_NOT_REACHED; }
/* Does a decode run, selected by encoding. */ static run_decode(MVMThreadContext *tc, MVMDecodeStream *ds, MVMint32 *stopper_chars, MVMint32 *stopper_sep) { switch (ds->encoding) { case MVM_encoding_type_utf8: MVM_string_utf8_decodestream(tc, ds, stopper_chars, stopper_sep); break; case MVM_encoding_type_ascii: MVM_string_ascii_decodestream(tc, ds, stopper_chars, stopper_sep); break; case MVM_encoding_type_latin1: MVM_string_latin1_decodestream(tc, ds, stopper_chars, stopper_sep); break; default: MVM_exception_throw_adhoc(tc, "Streaming decode NYI for encoding %d", (int)ds->encoding); } }
/* Does a decode run, selected by encoding. Returns non-zero if we actually * decoded more chars. */ static MVMint32 run_decode(MVMThreadContext *tc, MVMDecodeStream *ds, const MVMint32 *stopper_chars, MVMDecodeStreamSeparators *sep_spec) { MVMDecodeStreamChars *prev_chars_tail = ds->chars_tail; switch (ds->encoding) { case MVM_encoding_type_utf8: MVM_string_utf8_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_ascii: MVM_string_ascii_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_latin1: MVM_string_latin1_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_windows1252: MVM_string_windows1252_decodestream(tc, ds, stopper_chars, sep_spec); break; case MVM_encoding_type_utf8_c8: MVM_string_utf8_c8_decodestream(tc, ds, stopper_chars, sep_spec); break; default: MVM_exception_throw_adhoc(tc, "Streaming decode NYI for encoding %d", (int)ds->encoding); } return ds->chars_tail != prev_chars_tail; }