libsigrok  unreleased development snapshot
sigrok hardware access and backend library
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.

Functions

SR_PRIV int sr_atod_ascii_digits (const char *str, double *ret, int *digits)
 Convert text to a floating point value, and get its precision. More...
 
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...
 
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)
 
char ** sr_parse_probe_names (const char *spec, const char **dflt_names, size_t dflt_count, size_t max_count, size_t *ret_count)
 Parse a probe names specification, allocate a string vector. More...
 
void sr_free_probe_names (char **names)
 Release previously allocated probe names (string vector). More...
 
char * sr_text_trim_spaces (char *s)
 Trim leading and trailing whitespace off text. More...
 
char * sr_text_next_line (char *s, size_t l, char **next, size_t *taken)
 Check for another complete text line, trim, return consumed char count. More...
 
char * sr_text_next_word (char *s, char **next)
 Isolates another space separated word in a text line. More...
 
int sr_next_power_of_two (size_t value, size_t *bits, size_t *power)
 Get the number of necessary bits to hold a given value. More...
 

Detailed Description

Helper functions for handling or converting libsigrok-related strings.

Definition in file strutil.c.

Variable Documentation

const char** expands

Definition at line 1408 of file strutil.c.

const char* name