LMMS
Loading...
Searching...
No Matches
pretty-format.h File Reference
#include <rtosc/rtosc.h>

Go to the source code of this file.

Classes

struct  rtosc_print_options

Functions

size_t rtosc_print_arg_val (const rtosc_arg_val_t *arg, char *buffer, size_t buffersize, const rtosc_print_options *opt, int *cols_used)
size_t rtosc_print_arg_vals (const rtosc_arg_val_t *args, size_t n, char *buffer, size_t bs, const rtosc_print_options *opt, int cols_used)
size_t rtosc_print_message (const char *address, const rtosc_arg_val_t *args, size_t n, char *buffer, size_t bs, const rtosc_print_options *opt, int cols_used)
const char * rtosc_skip_next_printed_arg (const char *src)
int rtosc_count_printed_arg_vals (const char *src)
int rtosc_count_printed_arg_vals_of_msg (const char *msg)
size_t rtosc_scan_arg_val (const char *src, rtosc_arg_val_t *arg, char *buffer_for_strings, size_t *bufsize)
size_t rtosc_scan_arg_vals (const char *src, rtosc_arg_val_t *args, size_t n, char *buffer_for_strings, size_t bufsize)
size_t rtosc_scan_message (const char *src, char *address, size_t adrsize, rtosc_arg_val_t *args, size_t n, char *buffer_for_strings, size_t bufsize)

Function Documentation

◆ rtosc_count_printed_arg_vals()

int rtosc_count_printed_arg_vals ( const char * src)

Count arguments that would be scanned and do a complete syntax check

This function should be run before rtosc_scan_arg_vals() in order to know the number of argument values. Also, rtosc_scan_arg_vals() does no complete syntax check.

Parameters
srcThe string to scan from
Returns
The number of arguments that can be scanned (>=0), or if the nth arg (range 1...) can not be scanned, -n

◆ rtosc_count_printed_arg_vals_of_msg()

int rtosc_count_printed_arg_vals_of_msg ( const char * msg)

Count arguments of a message that would be scanned and do a complete syntax check

Parameters
msgThe message to scan from
Returns
-1 if the address could not be scanned, INT_MIN if the whole string is whitespace, otherwise
See also
rtosc_count_printed_arg_vals

◆ rtosc_print_arg_val()

size_t rtosc_print_arg_val ( const rtosc_arg_val_t * arg,
char * buffer,
size_t buffersize,
const rtosc_print_options * opt,
int * cols_used )

Pretty-print rtosct_arg_val_t structure into buffer

Parameters
argPointer to the structure that shall be printed
bufferThe buffer to write to
buffersizeThe maximum size to write to, includin a trailing 0 byte
optPrinter options, NULL for default options
cols_usedHow many columns have been used for writing in this line (will be updated by this function)
Returns
The number of bytes written, excluding the null byte

◆ rtosc_print_arg_vals()

size_t rtosc_print_arg_vals ( const rtosc_arg_val_t * args,
size_t n,
char * buffer,
size_t bs,
const rtosc_print_options * opt,
int cols_used )

Pretty-print rtosct_arg_val_t array into buffer

See also
rtosc_print_message
Warning
in case of possible line breaks (almost always), buffer[-1] must be accessible and be whitespace (since it can be converted to a newline)

◆ rtosc_print_message()

size_t rtosc_print_message ( const char * address,
const rtosc_arg_val_t * args,
size_t n,
char * buffer,
size_t bs,
const rtosc_print_options * opt,
int cols_used )

Pretty-print OSC message into string buffer

A newline will be appended.

Parameters
addressOSC pattern to send message to
argsThe array to print
nNumber of args from the array that should be printed
bufferThe buffer to write to
bsThe maximum size to write to, includin a trailing 0 byte
optPrinter options, NULL for default options
cols_usedHow many columns have been used for writing in this line
Returns
The number of bytes written, excluding the null byte

◆ rtosc_scan_arg_val()

size_t rtosc_scan_arg_val ( const char * src,
rtosc_arg_val_t * arg,
char * buffer_for_strings,
size_t * bufsize )

Scan one argument value from a string

This function does no complete syntaxcheck. Call rtosc_count_printed_arg_vals() before.

Parameters
srcThe string
argPointer to where to store the argument value; must be allocated
buffer_for_stringsA buffer with enough space for scanned strings and blobs
bufsizeSize of buffer_for_strings , will be shrinked to the bufferbytes left after the scan
Returns
The number of bytes scanned

◆ rtosc_scan_arg_vals()

size_t rtosc_scan_arg_vals ( const char * src,
rtosc_arg_val_t * args,
size_t n,
char * buffer_for_strings,
size_t bufsize )

Scan a fixed number of argument values from a string

This function does no complete syntaxcheck. Call rtosc_count_printed_arg_vals() before. This will also give you the n parameter.

See also
rtosc_scan_message

◆ rtosc_scan_message()

size_t rtosc_scan_message ( const char * src,
char * address,
size_t adrsize,
rtosc_arg_val_t * args,
size_t n,
char * buffer_for_strings,
size_t bufsize )

Scan an OSC message from a string

This function does no complete syntaxcheck. Call rtosc_count_printed_arg_vals() before. This will also give you the n parameter. Preceding and trailing whitespace will be consumed.

Parameters
srcThe string
addressA buffer where the port address will be written
adrsizeSize of buffer address
argsPointer to an array of argument values; the output will be written here
nThe amount of argument values to scan
buffer_for_stringsA buffer with enough space for scanned strings and blobs
bufsizeSize of buffer_for_strings
Returns
The number of bytes scanned

◆ rtosc_skip_next_printed_arg()

const char * rtosc_skip_next_printed_arg ( const char * src)

Skip characters from a string until one argument value would have been scanned

Parameters
srcThe string
Returns
The first character after that argument value