libsigrok  0.2.0
sigrok hardware access and backend library
 All Data Structures Files Functions Variables Typedefs Enumerator Macros Groups Pages
Macros | Functions
strutil.c File Reference

Helper functions for handling or converting libsigrok-related strings. More...

#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "libsigrok.h"
#include "libsigrok-internal.h"
+ Include dependency graph for strutil.c:

Go to the source code of this file.

Macros

#define LOG_PREFIX   "strutil: "
 
#define sr_log(l, s, args...)   sr_log(l, LOG_PREFIX s, ## args)
 
#define sr_spew(s, args...)   sr_spew(LOG_PREFIX s, ## args)
 
#define sr_dbg(s, args...)   sr_dbg(LOG_PREFIX s, ## args)
 
#define sr_info(s, args...)   sr_info(LOG_PREFIX s, ## args)
 
#define sr_warn(s, args...)   sr_warn(LOG_PREFIX s, ## args)
 
#define sr_err(s, args...)   sr_err(LOG_PREFIX s, ## args)
 

Functions

char * sr_si_string_u64 (uint64_t x, const char *unit)
 Convert a numeric value value to its "natural" string representation. More...
 
char * sr_samplerate_string (uint64_t samplerate)
 Convert a numeric samplerate value to its "natural" string representation. More...
 
char * sr_period_string (uint64_t frequency)
 Convert a numeric frequency value to the "natural" string representation of its period. More...
 
char * sr_voltage_string (uint64_t v_p, uint64_t v_q)
 Convert a numeric voltage value to the "natural" string representation of its voltage value. More...
 
char ** sr_parse_triggerstring (const struct sr_dev_inst *sdi, const char *triggerstring)
 Parse a trigger specification string. More...
 
int sr_parse_sizestring (const char *sizestring, uint64_t *size)
 Convert a "natural" string representation of a size value to uint64_t. More...
 
uint64_t sr_parse_timestring (const char *timestring)
 Convert a "natural" string representation of a time value to an uint64_t value in milliseconds. More...
 
gboolean sr_parse_boolstring (const char *boolstr)
 
int sr_parse_period (const char *periodstr, uint64_t *p, uint64_t *q)
 
int sr_parse_voltage (const char *voltstr, uint64_t *p, uint64_t *q)
 

Detailed Description

Helper functions for handling or converting libsigrok-related strings.

Definition in file strutil.c.

Macro Definition Documentation

#define LOG_PREFIX   "strutil: "

Definition at line 28 of file strutil.c.

#define sr_dbg (   s,
  args... 
)    sr_dbg(LOG_PREFIX s, ## args)

Definition at line 31 of file strutil.c.

#define sr_err (   s,
  args... 
)    sr_err(LOG_PREFIX s, ## args)
#define sr_info (   s,
  args... 
)    sr_info(LOG_PREFIX s, ## args)

Definition at line 32 of file strutil.c.

#define sr_log (   l,
  s,
  args... 
)    sr_log(l, LOG_PREFIX s, ## args)

Definition at line 29 of file strutil.c.

#define sr_spew (   s,
  args... 
)    sr_spew(LOG_PREFIX s, ## args)

Definition at line 30 of file strutil.c.

#define sr_warn (   s,
  args... 
)    sr_warn(LOG_PREFIX s, ## args)

Definition at line 33 of file strutil.c.