Nodes that match signed or unsigned integers.
More...
|
| struct ec_node * | ec_node_int (const char *id, int64_t min, int64_t max, unsigned int base) |
| |
| int | ec_node_int_getval (const struct ec_node *node, const char *str, int64_t *result) |
| |
| struct ec_node * | ec_node_uint (const char *id, uint64_t min, uint64_t max, unsigned int base) |
| |
| int | ec_node_uint_getval (const struct ec_node *node, const char *str, uint64_t *result) |
| |
Nodes that match signed or unsigned integers.
Configuration Schema
schema int {
int64 min {
description "The minimum valid value (included).";
}
int64 max {
description "The maximum valid value (included).";
}
uint64 base {
description "The base to use. If unset or 0, try to guess.";
}
}
Configuration Schema
schema uint {
uint64 min {
description "The minimum valid value (included).";
}
uint64 max {
description "The maximum valid value (included).";
}
uint64 base {
description "The base to use. If unset or 0, try to guess.";
}
}
◆ ec_node_int()
| struct ec_node * ec_node_int |
( |
const char * | id, |
|
|
int64_t | min, |
|
|
int64_t | max, |
|
|
unsigned int | base ) |
Create a signed integer node.
- Parameters
-
| id | The node identifier. |
| min | The minimum valid value (included). |
| max | The maximum valid value (included). |
| base | The base to use for parsing. If 0, try to guess from prefix. |
- Returns
- The node, or NULL on error (errno is set).
- Examples
- readline/main.c, and simple-editline/main.c.
◆ ec_node_int_getval()
| int ec_node_int_getval |
( |
const struct ec_node * | node, |
|
|
const char * | str, |
|
|
int64_t * | result ) |
Get the value of a parsed signed integer.
- Parameters
-
| node | The integer node. |
| str | The string to parse. |
| result | Pointer where the result will be stored on success. |
- Returns
- 0 on success, -1 on error (errno is set).
◆ ec_node_uint()
| struct ec_node * ec_node_uint |
( |
const char * | id, |
|
|
uint64_t | min, |
|
|
uint64_t | max, |
|
|
unsigned int | base ) |
Create an unsigned integer node.
- Parameters
-
| id | The node identifier. |
| min | The minimum valid value (included). |
| max | The maximum valid value (included). |
| base | The base to use for parsing. If 0, try to guess from prefix. |
- Returns
- The node, or NULL on error (errno is set).
◆ ec_node_uint_getval()
| int ec_node_uint_getval |
( |
const struct ec_node * | node, |
|
|
const char * | str, |
|
|
uint64_t * | result ) |
Get the value of a parsed unsigned integer.
- Parameters
-
| node | The unsigned integer node. |
| str | The string to parse. |
| result | Pointer where the result will be stored on success. |
- Returns
- 0 on success, -1 on error (errno is set).