package xapi-stdext-encodings

  1. Overview
  2. Docs

Parameters

Signature

val width_required_for_ucs_value : int32 -> int

Given a valid UCS value, returns the canonical * number of bytes required to encode the value.

Decoding

val decode_header_byte : int -> int * int

Decodes a header byte, returning a tuple (v, w) where: * v = the (partial) value contained within the byte; and * w = the total width of the encoded character, in bytes.

val decode_continuation_byte : int -> int

Decodes a continuation byte, returning the * 6-bit-wide value contained within the byte.

val decode_character : string -> int -> int32 * int

Decodes a single character embedded within a string. Given a string * and an index into that string, returns a tuple (value, width) where: * value = the value of the character at the given index; and * width = the width of the character at the given index, in bytes. * Raises an appropriate error if the character is invalid.

Encoding

val encode_header_byte : int -> int32 -> int32

Encodes a header byte for the given parameters, where: * width = the total width of the encoded character, in bytes; * value = the most significant bits of the original UCS value.

val encode_continuation_byte : int32 -> int32 * int32

Encodes a continuation byte from the given UCS * remainder value, returning a tuple (b, r), where: * b = the continuation byte; * r = a new UCS remainder value.

val encode_character : int32 -> string

Encodes a single character value, returning a string containing * the character. Raises an error if the character value is invalid.