YAC 3.21.0
Yet Another Coupler
Loading...
Searching...
No Matches
param_bool.c File Reference
#include "param_bool.h"
#include "param_internal.h"
#include "utils_common.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <limits.h>
Include dependency graph for param_bool.c:

Go to the source code of this file.

Data Structures

struct  yac_param_bool
 

Enumerations

enum  { BOOL_TABLE_SIZE = sizeof(bool_table) / sizeof(bool_table[0]) }
 

Functions

static enum yac_param_type yac_param_bool_get_type (const struct yac_param *param)
 
static int yac_param_bool_is_default (const struct yac_param *param)
 
static const char * yac_param_bool_get_name (const struct yac_param *param)
 
static int yac_param_bool_set_scalar (struct yac_param *param, const char *value_str)
 
static int yac_param_bool_get_scalar (const struct yac_param *param, char *buf, size_t buflen)
 
static int yac_param_bool_get_scalar_kind (const struct yac_param *param, enum yac_param_scalar_kind *scalar_kind)
 
static int yac_param_bool_set_scalar_int (struct yac_param *param, int value)
 
static int yac_param_bool_get_scalar_int (const struct yac_param *param, int *value)
 
static void yac_param_bool_delete (struct yac_param *param)
 
struct yac_param * yac_param_bool_new (const char *name, int *value_ptr, int default_value, int has_default, int is_defined)
 Create a bool parameter (backed by int)
 

Variables

static const struct yac_name_type_pair bool_table []
 
static const struct yac_param_vtable yac_param_bool_vtable
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BOOL_TABLE_SIZE 

Definition at line 27 of file param_bool.c.

Function Documentation

◆ yac_param_bool_delete()

static void yac_param_bool_delete ( struct yac_param * param)
static

Definition at line 132 of file param_bool.c.

◆ yac_param_bool_get_name()

static const char * yac_param_bool_get_name ( const struct yac_param * param)
static

Definition at line 53 of file param_bool.c.

◆ yac_param_bool_get_scalar()

static int yac_param_bool_get_scalar ( const struct yac_param * param,
char * buf,
size_t buflen )
static

Definition at line 78 of file param_bool.c.

Here is the call graph for this function:

◆ yac_param_bool_get_scalar_int()

static int yac_param_bool_get_scalar_int ( const struct yac_param * param,
int * value )
static

Definition at line 119 of file param_bool.c.

◆ yac_param_bool_get_scalar_kind()

static int yac_param_bool_get_scalar_kind ( const struct yac_param * param,
enum yac_param_scalar_kind * scalar_kind )
static

Definition at line 100 of file param_bool.c.

◆ yac_param_bool_get_type()

static enum yac_param_type yac_param_bool_get_type ( const struct yac_param * param)
static

Definition at line 39 of file param_bool.c.

◆ yac_param_bool_is_default()

static int yac_param_bool_is_default ( const struct yac_param * param)
static

Definition at line 45 of file param_bool.c.

◆ yac_param_bool_new()

struct yac_param * yac_param_bool_new ( const char * name,
int * value_ptr,
int default_value,
int has_default,
int is_defined )

Create a bool parameter (backed by int)

Parameters
nameName of the parameter (copied internally, may be NULL for unnamed)
value_ptrPointer to the int value (0 = false, 1 = true)
default_valueDefault value (0 or 1, ignored if has_default is false)
has_defaultIf true, parameter has a default value; if false, value is undefined until set
is_definedIf true, initial value is considered defined (0 or 1); if false, initial value is considered undefined and user must set it before getting
Returns
Pointer to new parameter handle

Definition at line 159 of file param_bool.c.

Here is the caller graph for this function:

◆ yac_param_bool_set_scalar()

static int yac_param_bool_set_scalar ( struct yac_param * param,
const char * value_str )
static

Definition at line 60 of file param_bool.c.

Here is the call graph for this function:

◆ yac_param_bool_set_scalar_int()

static int yac_param_bool_set_scalar_int ( struct yac_param * param,
int value )
static

Definition at line 109 of file param_bool.c.

Variable Documentation

◆ bool_table

const struct yac_name_type_pair bool_table[]
static
Initial value:
= {
{"false", 0},
{"False", 0},
{"FALSE", 0},
{"no", 0},
{"NO", 0},
{"0", 0},
{"true", 1},
{"True", 1},
{"TRUE", 1},
{"yes", 1},
{"YES", 1},
{"1", 1},
}

Definition at line 13 of file param_bool.c.

◆ yac_param_bool_vtable

const struct yac_param_vtable yac_param_bool_vtable
static
Initial value:
= {
.get_sub_count = NULL,
.get_sub_by_name = NULL,
.get_sub_by_index = NULL,
.append = NULL,
.get_scalar_kind = yac_param_bool_get_scalar_kind,
.set_scalar_int = yac_param_bool_set_scalar_int,
.set_scalar_dble = NULL,
.get_scalar_int = yac_param_bool_get_scalar_int,
.get_scalar_dble = NULL
}
static int yac_param_bool_set_scalar(struct yac_param *param, const char *value_str)
Definition param_bool.c:60
static void yac_param_bool_delete(struct yac_param *param)
Definition param_bool.c:132
static int yac_param_bool_set_scalar_int(struct yac_param *param, int value)
Definition param_bool.c:109
static const char * yac_param_bool_get_name(const struct yac_param *param)
Definition param_bool.c:53
static int yac_param_bool_get_scalar_kind(const struct yac_param *param, enum yac_param_scalar_kind *scalar_kind)
Definition param_bool.c:100
static int yac_param_bool_get_scalar_int(const struct yac_param *param, int *value)
Definition param_bool.c:119
static enum yac_param_type yac_param_bool_get_type(const struct yac_param *param)
Definition param_bool.c:39
static int yac_param_bool_is_default(const struct yac_param *param)
Definition param_bool.c:45
static int yac_param_bool_get_scalar(const struct yac_param *param, char *buf, size_t buflen)
Definition param_bool.c:78

Definition at line 141 of file param_bool.c.