Ruby: ext/strscan/strscan.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Data Structures | Macros | Functions
strscan.c File Reference
`#include "ruby/ruby.h"`
`#include "ruby/re.h"`
`#include "ruby/encoding.h"`
`#include <stdbool.h>`

Go to the source code of this file.

## Data Structures
struct | strscanner

## Macros
#define | STRSCAN_VERSION "3.0.1"
#define | FLAG_MATCHED (1 << 0)
#define | MATCHED_P(s) ((s)->flags & FLAG_MATCHED)
#define | MATCHED(s) (s)->flags |= FLAG_MATCHED
#define | CLEAR_MATCH_STATUS(s) (s)->flags &= ~FLAG_MATCHED
#define | S_PBEG(s) (RSTRING_PTR((s)->str))
#define | S_LEN(s) (RSTRING_LEN((s)->str))
#define | S_PEND(s) (S_PBEG(s) + S_LEN(s))
#define | CURPTR(s) (S_PBEG(s) + (s)->curr)
#define | S_RESTLEN(s) (S_LEN(s) - (s)->curr)
#define | EOS_P(s) ((s)->curr >= RSTRING_LEN(p->str))
#define | GET_SCANNER(obj, var)
#define | INSPECT_LENGTH 5

## Functions
void | Init_strscan (void)

## Macro Definition Documentation

## ◆ CLEAR_MATCH_STATUS

#define CLEAR_MATCH_STATUS | ( |  | s | ) | (s)->flags &= ~FLAG_MATCHED

Definition at line 60 of file strscan.c.

## ◆ CURPTR

#define CURPTR | ( |  | s | ) | (S_PBEG(s) + (s)->curr)

Definition at line 65 of file strscan.c.

## ◆ EOS_P

#define EOS_P | ( |  | s | ) | ((s)->curr >= RSTRING_LEN(p->str))

Definition at line 68 of file strscan.c.

## ◆ FLAG_MATCHED

#define FLAG_MATCHED (1 << 0)

Definition at line 39 of file strscan.c.

## ◆ GET_SCANNER

#define GET_SCANNER | ( |  | obj,
|  |  | var
| ) |  |

Value:
do {\
(var) = check_strscan(obj);\
if (NIL_P((var)->str)) rb_raise(rb_eArgError, "uninitialized StringScanner object");\
} while (0)
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
rb_raise
void rb_raise(VALUE exc, const char *fmt,...)
Definition: error.c:2917
rb_eArgError
VALUE rb_eArgError
Definition: error.c:1058
NIL_P
#define NIL_P
Definition: special_consts.h:46

Definition at line 70 of file strscan.c.

## ◆ INSPECT_LENGTH

#define INSPECT_LENGTH 5

Definition at line 1362 of file strscan.c.

## ◆ MATCHED

#define MATCHED | ( |  | s | ) | (s)->flags |= FLAG_MATCHED

Definition at line 59 of file strscan.c.

## ◆ MATCHED_P

#define MATCHED_P | ( |  | s | ) | ((s)->flags & FLAG_MATCHED)

Definition at line 58 of file strscan.c.

## ◆ S_LEN

#define S_LEN | ( |  | s | ) | (RSTRING_LEN((s)->str))

Definition at line 63 of file strscan.c.

## ◆ S_PBEG

#define S_PBEG | ( |  | s | ) | (RSTRING_PTR((s)->str))

Definition at line 62 of file strscan.c.

## ◆ S_PEND

#define S_PEND | ( |  | s | ) | (S_PBEG(s) + S_LEN(s))

Definition at line 64 of file strscan.c.

## ◆ S_RESTLEN

#define S_RESTLEN | ( |  | s | ) | (S_LEN(s) - (s)->curr)

Definition at line 66 of file strscan.c.

## ◆ STRSCAN_VERSION

#define STRSCAN_VERSION "3.0.1"

Definition at line 25 of file strscan.c.

## Function Documentation

## ◆ Init_strscan()

void Init_strscan | ( | void |  | ) |

Definition at line 1569 of file strscan.c.

References rb_alias(), rb_cObject, rb_const_defined(), rb_const_set(), rb_define_alloc_func(), rb_define_class(), rb_define_class_under(), rb_define_method, rb_define_private_method, rb_define_singleton_method, rb_eStandardError, rb_ext_ractor_safe(), rb_intern(), rb_obj_freeze(), rb_str_new2, and STRSCAN_VERSION.