yyast/leaf.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdint.h>
#include <math.h>
#include <limits.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
#include <arpa/inet.h>
#include <yyast/leaf.h>
#include <yyast/count.h>
#include <yyast/utils.h>
#include <yyast/error.h>

Go to the source code of this file.

Data Structures

union  translate_t

Defines

#define _GNU_SOURCE

Functions

ya_t ya_literal (const char *restrict name, ya_type_t type, const void *restrict buf, size_t buf_size)
 Create an literal node.
ya_t ya_binary_float (const char *restrict name, const char *restrict buf, size_t buf_size __attribute__((unused)), int base __attribute__((unused)), int nr_bits __attribute__((unused)))
ya_t ya_integer (const char *restrict name, ya_type_t type, const char *restrict buf, size_t buf_size, int base)
 Create literal from an integer literal string.
ya_t ya_text (const char *restrict name, const char *restrict buf, size_t buf_size)
 Create text literal node for a string literal.
ya_t ya_leaf (const char *restrict name)
 Leaf node, does not contain data or children.
ya_t ya_null (void)
 Null node, unused child entry.
ya_t ya_positive_integer (const char *restrict name, const char *restrict buf, size_t buf_size, int base)
 Create literal from an positive integer literal string.
ya_t ya_negative_integer (const char *restrict name, const char *restrict buf, size_t buf_size, int base)
 Create literal from an negative integer literal string.


Define Documentation

#define _GNU_SOURCE

Definition at line 25 of file leaf.c.


Function Documentation

ya_t ya_binary_float ( const char *restrict  name,
const char *restrict  buf,
size_t buf_size   __attribute__(unused),
int base   __attribute__(unused),
int nr_bits   __attribute__(unused) 
)

Definition at line 75 of file leaf.c.

References translate_t::d, translate_t::u, ya_error(), ya_literal(), and YA_NODE_TYPE_BINARY_FLOAT.

ya_t ya_integer ( const char *restrict  name,
ya_type_t  type,
const char *restrict  buf,
size_t  buf_size,
int  base 
)

Create literal from an integer literal string.

The RFC 4648 is used as a guide for encoding integers.

  • Base 0, has no alphabet, it always yields zero.
  • Base 1-31 and 33-36, These bases are encoded following an extended Base-16
  • Base 32, Base-32 is encoding
  • Base 37-64 These bases are encoded following Base-64

Parameters:
name name of the node.
type type of node, should be either YA_NODE_TYPE_POSITIVE_INTEGER or YA_NODE_TYPE_NEGATIVE_INTEGER.
buf Literal as string.
buf_size String size.
base The base of the literal. 0-64
Returns:
The decoded literal.

Definition at line 97 of file leaf.c.

References ya_error(), and ya_literal().

Referenced by ya_negative_integer(), and ya_positive_integer().

ya_t ya_leaf ( const char *restrict  name  ) 

Leaf node, does not contain data or children.

Definition at line 162 of file leaf.c.

References ya_literal(), and YA_NODE_TYPE_LEAF.

ya_t ya_literal ( const char *restrict  name,
ya_type_t  type,
const void *restrict  buf,
size_t  buf_size 
)

Create an literal node.

Parameters:
name name of the node.
type type of leaf node.
buf The memory which needs to be copied.
buf_size The amount of memory to be copied.

Definition at line 42 of file leaf.c.

References ya_position_s::column, ya_node_s::data, ya_position_s::file, ya_position_s::line, ya_node_s::name, ya_t::node, ya_t::position, ya_node_s::position, ya_node_s::size, ya_t::size, ya_t::type, ya_node_s::type, and ya_previous_position.

Referenced by ya_binary_float(), ya_integer(), ya_leaf(), ya_null(), and ya_text().

ya_t ya_negative_integer ( const char *restrict  name,
const char *restrict  buf,
size_t  buf_size,
int  base 
)

Create literal from an negative integer literal string.

The RFC 4648 is used as a guide for encoding integers. The integer literal should be passed without the base prefix (0x) or suffix (h). The integer literal should be passed without the negative sign (-).

  • Base 0, has no alphabet, it always yields zero.
  • Base 1-31 and 33-36, These bases are encoded following an extended Base-16
  • Base 32, Base-32 is encoding
  • Base 37-64 These bases are encoded following Base-64

Parameters:
name name of the node.
buf Literal as string.
buf_size String size.
base The base of the literal. 0-64
Returns:
The decoded literal.

Definition at line 177 of file leaf.c.

References ya_integer(), and YA_NODE_TYPE_NEGATIVE_INTEGER.

ya_t ya_null ( void   ) 

Null node, unused child entry.

Definition at line 167 of file leaf.c.

References ya_literal(), and YA_NODE_TYPE_NULL.

ya_t ya_positive_integer ( const char *restrict  name,
const char *restrict  buf,
size_t  buf_size,
int  base 
)

Create literal from an positive integer literal string.

The RFC 4648 is used as a guide for encoding integers. The integer literal should be passed without the base prefix (0x) or suffix (h).

  • Base 0, has no alphabet, it always yields zero.
  • Base 1-31 and 33-36, These bases are encoded following an extended Base-16
  • Base 32, Base-32 is encoding
  • Base 37-64 These bases are encoded following Base-64

Parameters:
name name of the node.
buf Literal as string.
buf_size String size.
base The base of the literal. 0-64
Returns:
The decoded literal.

Definition at line 172 of file leaf.c.

References ya_integer(), and YA_NODE_TYPE_POSITIVE_INTEGER.

ya_t ya_text ( const char *restrict  name,
const char *restrict  buf,
size_t  buf_size 
)

Create text literal node for a string literal.

Parameters:
name name of the node.
buf Literal as string.
buf_size String size.
Returns:
The decoded literal.

Definition at line 157 of file leaf.c.

References ya_literal(), and YA_NODE_TYPE_TEXT.

Referenced by ya_get_filenames().


Generated for yyast-1.0.1 by doxygen 1.5.6