summaryrefslogtreecommitdiff
path: root/include/ruby/internal/encoding/encoding.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ruby/internal/encoding/encoding.h')
-rw-r--r--include/ruby/internal/encoding/encoding.h31
1 files changed, 23 insertions, 8 deletions
diff --git a/include/ruby/internal/encoding/encoding.h b/include/ruby/internal/encoding/encoding.h
index dc3e0151f0..9208d27ecf 100644
--- a/include/ruby/internal/encoding/encoding.h
+++ b/include/ruby/internal/encoding/encoding.h
@@ -139,6 +139,23 @@ RBIMPL_ATTR_NOALIAS()
int rb_char_to_option_kcode(int c, int *option, int *kcode);
/**
+ * Creates a new encoding, using the passed one as a template.
+ *
+ * @param[in] name Name of the creating encoding.
+ * @param[in] src Template.
+ * @exception rb_eArgError Duplicated or malformed `name`.
+ * @return Replicated new encoding's index.
+ * @post Encoding named `name` is created as a copy of `src`, whose index
+ * is the return value.
+ *
+ * @internal
+ *
+ * `name` can be `NULL`, but that just raises an exception. OTOH it seems no
+ * sanity check is done against `src`...?
+ */
+int rb_enc_replicate(const char *name, rb_encoding *src);
+
+/**
* Creates a new "dummy" encoding. Roughly speaking, an encoding is dummy when
* it is stateful. Notable example of dummy encoding are those defined in
* ISO/IEC 2022
@@ -358,8 +375,8 @@ rb_encoding *rb_enc_check(VALUE str1,VALUE str2);
VALUE rb_enc_associate_index(VALUE obj, int encindex);
/**
- * Identical to rb_enc_associate_index(), except it takes an encoding itself
- * instead of its index.
+ * Identical to rb_enc_associate(), except it takes an encoding itself instead
+ * of its index.
*
* @param[out] obj Object in question.
* @param[in] enc An encoding.
@@ -626,12 +643,10 @@ rb_enc_code_to_mbclen(int c, rb_encoding *enc)
* Identical to rb_enc_uint_chr(), except it writes back to the passed buffer
* instead of allocating one.
*
- * @param[in] c Code point.
- * @param[out] buf Return buffer.
- * @param[in] enc Target encoding scheme.
- * @retval <= 0 `c` is invalid in `enc`.
- * @return otherwise Number of bytes written to `buf`.
- * @post `c` is encoded according to `enc`, then written to `buf`.
+ * @param[in] c Code point.
+ * @param[out] buf Return buffer.
+ * @param[in] enc Target encoding scheme.
+ * @post `c` is encoded according to `enc`, then written to `buf`.
*
* @internal
*