Rizin
unix-like reverse engineering framework and cli tools
length.h File Reference
#include <stdlib.h>
#include <stdbool.h>
#include "./point.h"
#include "tree_sitter/api.h"

Go to the source code of this file.

Classes

struct  Length
 

Functions

static bool length_is_undefined (Length length)
 
static Length length_min (Length len1, Length len2)
 
static Length length_add (Length len1, Length len2)
 
static Length length_sub (Length len1, Length len2)
 
static Length length_zero (void)
 

Variables

static const Length LENGTH_UNDEFINED = {0, {0, 1}}
 
static const Length LENGTH_MAX = {UINT32_MAX, {UINT32_MAX, UINT32_MAX}}
 

Function Documentation

◆ length_add()

static Length length_add ( Length  len1,
Length  len2 
)
inlinestatic

Definition at line 25 of file length.h.

25  {
26  Length result;
27  result.bytes = len1.bytes + len2.bytes;
28  result.extent = point_add(len1.extent, len2.extent);
29  return result;
30 }
static TSPoint point_add(TSPoint a, TSPoint b)
Definition: point.h:14
Definition: length.h:9
uint32_t bytes
Definition: length.h:10
TSPoint extent
Definition: length.h:11

References Length::bytes, Length::extent, and point_add().

Referenced by iterator_advance(), iterator_descend(), iterator_end_position(), iterator_start_position(), stack_node_new(), ts_node_child_iterator_next(), ts_subtree_edit(), ts_subtree_summarize_children(), ts_subtree_total_size(), and ts_tree_cursor_child_iterator_next().

◆ length_is_undefined()

static bool length_is_undefined ( Length  length)
inlinestatic

Definition at line 17 of file length.h.

17  {
18  return length.bytes == 0 && length.extent.column != 0;
19 }
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
Definition: sflib.h:133

References length.

Referenced by ts_lexer_finish().

◆ length_min()

static Length length_min ( Length  len1,
Length  len2 
)
inlinestatic

Definition at line 21 of file length.h.

21  {
22  return (len1.bytes < len2.bytes) ? len1 : len2;
23 }

References Length::bytes.

Referenced by ts_subtree_get_changed_ranges().

◆ length_sub()

static Length length_sub ( Length  len1,
Length  len2 
)
inlinestatic

Definition at line 32 of file length.h.

32  {
33  Length result;
34  result.bytes = len1.bytes - len2.bytes;
35  result.extent = point_sub(len1.extent, len2.extent);
36  return result;
37 }
static TSPoint point_sub(TSPoint a, TSPoint b)
Definition: point.h:21

References Length::bytes, Length::extent, and point_sub().

Referenced by parser__halt_parse(), parser__lex(), ts_parser__handle_error(), ts_parser__lex(), and ts_subtree_edit().

◆ length_zero()

Variable Documentation

◆ LENGTH_MAX

const Length LENGTH_MAX = {UINT32_MAX, {UINT32_MAX, UINT32_MAX}}
static

Definition at line 15 of file length.h.

Referenced by ts_range_array_get_changed_ranges().

◆ LENGTH_UNDEFINED

const Length LENGTH_UNDEFINED = {0, {0, 1}}
static

Definition at line 14 of file length.h.

Referenced by ts_lexer_start().