picofuse

Data Structures | Macros | Typedefs | Enumerations
env.h File Reference

Environment information. More...

#include "io.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for env.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sys_env_arg_flag_t
 Describes a single command-line argument flag. More...
 

Macros

#define SYS_ENV_ARG_CAPACITY   16
 Maximum number of positional (non-flag) command-line arguments sys_env_arg_parse() can record.
 

Typedefs

typedef void(* sys_env_signal_callback_t) (sys_env_signal_t signal)
 Callback function type for handling environment signals. More...
 
typedef struct sys_env_arg_flag_t sys_env_arg_flag_t
 Describes a single command-line argument flag. More...
 
typedef struct sys_env_arg_t sys_env_arg_t
 The result of a successful sys_env_arg_parse() call. More...
 

Enumerations

enum  sys_env_signal_t { sys_env_signal_none = 0, sys_env_signal_term = 1u, sys_env_signal_int = 2u, sys_env_signal_quit = 4u }
 Environment signal types. More...
 
enum  sys_env_arg_type_t {
  sys_env_arg_type_bool = 1, sys_env_arg_type_string = 2, sys_env_arg_type_int = 3, sys_env_arg_type_uint = 4,
  sys_env_arg_type_float = 5
}
 Argument flag value types. More...
 

Functions

Methods
bool sys_env_signalhandler (sys_env_signal_t mask, sys_env_signal_callback_t callback)
 Set a handler for environment signals. More...
 
const char * sys_env_serial (void)
 Return a unique identifier for the current environment. More...
 
const char * sys_env_name (void)
 Return the name of the current environment. More...
 
const char * sys_env_system (void)
 Return the system identifier for the current environment. More...
 
const char * sys_env_version (void)
 Return the version of the current environment. More...
 
void sys_env_set_args (int argc, char *argv[])
 Replace the argc/argv that sys_env_arg_parse() reads. More...
 
sys_env_arg_tsys_env_arg_parse (sys_env_arg_flag_t *flags)
 Parse the process's command-line arguments against a set of flags. More...
 
size_t sys_env_arg_count (sys_env_arg_t *args)
 Return the number of positional arguments. More...
 
const char * sys_env_arg_string (sys_env_arg_t *args, size_t index)
 Return the value of a positional argument by index. More...
 
bool sys_env_arg_usage (sys_env_arg_flag_t *flags, sys_iostream_t *stream)
 Print the usage information for the command-line flags. More...
 
bool sys_env_arg_parse_bool (sys_env_arg_t *args, const char *name, bool *value)
 Look up a parsed flag's value as a boolean. More...
 
bool sys_env_arg_parse_int32 (sys_env_arg_t *args, const char *name, int32_t *value)
 Look up a parsed flag's value as a 32-bit signed integer. More...
 
bool sys_env_arg_parse_uint32 (sys_env_arg_t *args, const char *name, uint32_t *value)
 Look up a parsed flag's value as a 32-bit unsigned integer. More...
 
bool sys_env_arg_parse_int64 (sys_env_arg_t *args, const char *name, int64_t *value)
 Look up a parsed flag's value as a 64-bit signed integer. More...
 
bool sys_env_arg_parse_uint64 (sys_env_arg_t *args, const char *name, uint64_t *value)
 Look up a parsed flag's value as a 64-bit unsigned integer. More...
 
bool sys_env_arg_parse_float32 (sys_env_arg_t *args, const char *name, float *value)
 Look up a parsed flag's value as a 32-bit single-precision floating-point number. More...
 
bool sys_env_arg_parse_float64 (sys_env_arg_t *args, const char *name, double *value)
 Look up a parsed flag's value as a 64-bit double-precision floating-point number. More...
 
size_t sys_env_arg_parse_string (sys_env_arg_t *args, const char *name, char *value, size_t cap)
 Look up a parsed flag's value as a string. More...
 

Detailed Description

Environment information.

Definition in file env.h.