libsigrok  0.5.2
sigrok hardware access and backend library
Macros | Functions
strutil.c File Reference

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

#include <config.h>
#include <ctype.h>
#include <locale.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"
+ Include dependency graph for strutil.c:

Go to the source code of this file.

Macros

#define _XOPEN_SOURCE   700
 

Functions

int sr_sprintf_ascii (char *buf, const char *format,...)
 Compose a string with a format string in the buffer pointed to by buf. More...
 
int sr_vsprintf_ascii (char *buf, const char *format, va_list args)
 Compose a string with a format string in the buffer pointed to by buf. More...
 
int sr_snprintf_ascii (char *buf, size_t buf_size, const char *format,...)
 Composes a string with a format string (like printf) in the buffer pointed by buf (taking buf_size as the maximum buffer capacity to fill). More...
 
int sr_vsnprintf_ascii (char *buf, size_t buf_size, const char *format, va_list args)
 Composes a string with a format string (like printf) in the buffer pointed by buf (taking buf_size as the maximum buffer capacity to fill). More...
 
SR_PRIV GString * sr_hexdump_new (const uint8_t *data, const size_t len)
 Convert a sequence of bytes to its textual representation ("hex dump"). More...
 
SR_PRIV void sr_hexdump_free (GString *s)
 Free a hex dump text that was created by sr_hexdump_new(). More...
 
int sr_parse_rational (const char *str, struct sr_rational *ret)
 Convert a string representation of a numeric value to a sr_rational. More...
 
char * sr_si_string_u64 (uint64_t x, const char *unit)
 Convert a numeric value value to its "natural" string representation in SI units. 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 v_p, uint64_t v_q)
 Convert a numeric period value to the "natural" string representation of its period value. 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...
 
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 _XOPEN_SOURCE   700

Definition at line 21 of file strutil.c.