Ruby: include/ruby/internal/encoding/ctype.h File Reference

Ruby 3.4.1p0 (2024-12-25 revision 48d4efcb85000e1ebae42004e963b5d0cedddcf2)

Functions
ctype.h File Reference

Routines to query chacater types. More...

`#include "ruby/onigmo.h"`
`#include "ruby/internal/attr/const.h"`
`#include "ruby/internal/dllexport.h"`
`#include "ruby/internal/encoding/encoding.h"`
`#include "ruby/internal/value.h"`

Go to the source code of this file.

## Functions
static bool | rb_enc_is_newline (const char *p, const char *e, rb_encoding *enc)
| Queries if the passed pointer points to a newline character.
static bool | rb_enc_isctype (OnigCodePoint c, OnigCtype t, rb_encoding *enc)
| Queries if the passed code point is of passed character type in the passed encoding.
static bool | rb_enc_isascii (OnigCodePoint c, rb_encoding *enc)
| Identical to rb_isascii(), except it additionally takes an encoding.
static bool | rb_enc_isalpha (OnigCodePoint c, rb_encoding *enc)
| Identical to rb_isalpha(), except it additionally takes an encoding.
static bool | rb_enc_islower (OnigCodePoint c, rb_encoding *enc)
| Identical to rb_islower(), except it additionally takes an encoding.
static bool | rb_enc_isupper (OnigCodePoint c, rb_encoding *enc)
| Identical to rb_isupper(), except it additionally takes an encoding.
static bool | rb_enc_iscntrl (OnigCodePoint c, rb_encoding *enc)
| Identical to rb_iscntrl(), except it additionally takes an encoding.
static bool | rb_enc_ispunct (OnigCodePoint c, rb_encoding *enc)
| Identical to rb_ispunct(), except it additionally takes an encoding.
static bool | rb_enc_isalnum (OnigCodePoint c, rb_encoding *enc)
| Identical to rb_isalnum(), except it additionally takes an encoding.
static bool | rb_enc_isprint (OnigCodePoint c, rb_encoding *enc)
| Identical to rb_isprint(), except it additionally takes an encoding.
static bool | rb_enc_isspace (OnigCodePoint c, rb_encoding *enc)
| Identical to rb_isspace(), except it additionally takes an encoding.
static bool | rb_enc_isdigit (OnigCodePoint c, rb_encoding *enc)
| Identical to rb_isdigit(), except it additionally takes an encoding.
int | rb_enc_toupper (int c, rb_encoding *enc)
| Identical to rb_toupper(), except it additionally takes an encoding.
int | rb_enc_tolower (int c, rb_encoding *enc)
| Identical to rb_tolower(), except it additionally takes an encoding.

## Detailed Description

Routines to query chacater types.

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

Warning
  Symbols prefixed with either `RBIMPL` or `rbimpl` are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.

Note
  To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance `__VA_ARGS__` is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file ctype.h.

## Function Documentation

## ◆ rb_enc_is_newline()

static bool rb_enc_is_newline | ( | const char * | p,
|  | const char * | e,
|  | rb_encoding * | enc )
| inlinestatic

Queries if the passed pointer points to a newline character.

What is a newline and what is not depends on the passed encoding.

Parameters

  [in] | p | Pointer to a possibly-middle of a character.
  [in] | end | End of the string.
  [in] | enc | Encoding.

Return values

  false | It isn't.
  true | It is.

Definition at line 43 of file ctype.h.

Referenced by rb_enc_is_newline().

## ◆ rb_enc_isalnum()

static bool rb_enc_isalnum | ( | OnigCodePoint | c,
|  | rb_encoding * | enc )
| inlinestatic

Identical to rb_isalnum(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Return values

  true | `enc` classifies `c` as "ANUM".
  false | Otherwise.

Definition at line 166 of file ctype.h.

## ◆ rb_enc_isalpha()

static bool rb_enc_isalpha | ( | OnigCodePoint | c,
|  | rb_encoding * | enc )
| inlinestatic

Identical to rb_isalpha(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Return values

  true | `enc` classifies `c` as "ALPHA".
  false | Otherwise.

Definition at line 96 of file ctype.h.

## ◆ rb_enc_isascii()

static bool rb_enc_isascii | ( | OnigCodePoint | c,
|  | rb_encoding * | enc )
| inlinestatic

Identical to rb_isascii(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Return values

  false | `c` is out of range of ASCII character set in `enc`.
  true | Otherwise.

Definition at line 82 of file ctype.h.

## ◆ rb_enc_iscntrl()

static bool rb_enc_iscntrl | ( | OnigCodePoint | c,
|  | rb_encoding * | enc )
| inlinestatic

Identical to rb_iscntrl(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Return values

  true | `enc` classifies `c` as "CNTRL".
  false | Otherwise.

Definition at line 138 of file ctype.h.

## ◆ rb_enc_isctype()

static bool rb_enc_isctype | ( | OnigCodePoint | c,
|  | OnigCtype | t,
|  | rb_encoding * | enc )
| inlinestatic

Queries if the passed code point is of passed character type in the passed encoding.

The "character type" here is a set of macros defined in onigmo.h, like `ONIGENC_CTYPE_PUNCT`.

Parameters

  [in] | c | An `OnigCodePoint` value.
  [in] | t | An `OnigCtype` value.
  [in] | enc | A `rb_encoding*` value.

Return values

  true | `c` is of `t` in `enc`.
  false | Otherwise.

Definition at line 63 of file ctype.h.

## ◆ rb_enc_isdigit()

static bool rb_enc_isdigit | ( | OnigCodePoint | c,
|  | rb_encoding * | enc )
| inlinestatic

Identical to rb_isdigit(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Return values

  true | `enc` classifies `c` as "DIGIT".
  false | Otherwise.

Definition at line 208 of file ctype.h.

## ◆ rb_enc_islower()

static bool rb_enc_islower | ( | OnigCodePoint | c,
|  | rb_encoding * | enc )
| inlinestatic

Identical to rb_islower(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Return values

  true | `enc` classifies `c` as "LOWER".
  false | Otherwise.

Definition at line 110 of file ctype.h.

## ◆ rb_enc_isprint()

static bool rb_enc_isprint | ( | OnigCodePoint | c,
|  | rb_encoding * | enc )
| inlinestatic

Identical to rb_isprint(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Return values

  true | `enc` classifies `c` as "PRINT".
  false | Otherwise.

Definition at line 180 of file ctype.h.

Referenced by rb_str_format(), and rb_str_inspect().

## ◆ rb_enc_ispunct()

static bool rb_enc_ispunct | ( | OnigCodePoint | c,
|  | rb_encoding * | enc )
| inlinestatic

Identical to rb_ispunct(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Return values

  true | `enc` classifies `c` as "PUNCT".
  false | Otherwise.

Definition at line 152 of file ctype.h.

## ◆ rb_enc_isspace()

static bool rb_enc_isspace | ( | OnigCodePoint | c,
|  | rb_encoding * | enc )
| inlinestatic

Identical to rb_isspace(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Return values

  true | `enc` classifies `c` as "PRINT".
  false | Otherwise.

Definition at line 194 of file ctype.h.

## ◆ rb_enc_isupper()

static bool rb_enc_isupper | ( | OnigCodePoint | c,
|  | rb_encoding * | enc )
| inlinestatic

Identical to rb_isupper(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Return values

  true | `enc` classifies `c` as "UPPER".
  false | Otherwise.

Definition at line 124 of file ctype.h.

## ◆ rb_enc_tolower()

int rb_enc_tolower | ( | int | c,
|  | rb_encoding * | enc )

Identical to rb_tolower(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Returns
  `c`'s (Ruby's definition of) lower case counterpart.

Definition at line 1257 of file encoding.c.

## ◆ rb_enc_toupper()

int rb_enc_toupper | ( | int | c,
|  | rb_encoding * | enc )

Identical to rb_toupper(), except it additionally takes an encoding.

Parameters

  [in] | c | A code point.
  [in] | enc | An encoding.

Returns
  `c`'s (Ruby's definition of) upper case counterpart.

Definition at line 1251 of file encoding.c.