Iconvex.CodecSupport.EBCDICStateful (iconvex v0.1.1)

Copy Markdown View Source

Shared native engine for mixed-width EBCDIC SI/SO table codecs.

The table entry may be pinned to an OTP application with Iconvex.CodecSupport.table_entry/2 or resolved through a feature package's provider route with Iconvex.CodecSupport.provider_entry/1.

Summary

Functions

Decodes a complete SI/SO EBCDIC byte sequence.

Decodes while discarding invalid or incomplete encoded units.

Decodes directly to UTF-8 without materializing an intermediate codepoint list.

Encodes codepoints and emits only the required shifts, including a final SI.

Encodes while discarding unrepresentable input codepoints.

Validates UTF-8 and encodes it while preserving global first-error ordering.

Encodes with a codepoint replacement callback.

Types

entry()

@type entry() :: Iconvex.CodecSupport.entry()

Functions

decode(entry, input)

@spec decode(entry(), binary()) :: {:ok, [integer()]} | tuple()

Decodes a complete SI/SO EBCDIC byte sequence.

decode_discard(entry, input)

@spec decode_discard(entry(), binary()) :: {:ok, [integer()]}

Decodes while discarding invalid or incomplete encoded units.

decode_to_utf8(entry, input)

@spec decode_to_utf8(entry(), binary()) :: {:ok, binary()} | tuple()

Decodes directly to UTF-8 without materializing an intermediate codepoint list.

encode(entry, codepoints)

@spec encode(entry(), [integer()]) :: {:ok, binary()} | tuple()

Encodes codepoints and emits only the required shifts, including a final SI.

encode_discard(entry, codepoints)

@spec encode_discard(entry(), [integer()]) :: {:ok, binary()}

Encodes while discarding unrepresentable input codepoints.

encode_from_utf8(entry, input)

@spec encode_from_utf8(entry(), binary()) :: {:ok, binary()} | tuple()

Validates UTF-8 and encodes it while preserving global first-error ordering.

encode_substitute(entry, codepoints, replacer)

@spec encode_substitute(entry(), [integer()], (integer() -> [integer()])) ::
  {:ok, binary()} | tuple()

Encodes with a codepoint replacement callback.