LMMS
Loading...
Searching...
No Matches
rtosc.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 Mark McCurry
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
29
30#ifndef RTOSC_H
31#define RTOSC_H
32#include <stdarg.h>
33#include <stdint.h>
34#include <stddef.h>
35#include <stdbool.h>
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41typedef struct {
45
46typedef union {
47 int32_t i; //i,c,r
48 char T; //I,T,F,N
49 float f; //f
50 double d; //d
51 int64_t h; //h
52 uint64_t t; //t
53 uint8_t m[4];//m
54 const char *s; //s,S
57
83size_t rtosc_message(char *buffer,
84 size_t len,
85 const char *address,
86 const char *arguments,
87 ...);
88
92size_t rtosc_vmessage(char *buffer,
93 size_t len,
94 const char *address,
95 const char *arguments,
96 va_list va);
97
101size_t rtosc_amessage(char *buffer,
102 size_t len,
103 const char *address,
104 const char *arguments,
105 const rtosc_arg_t *args);
106
113unsigned rtosc_narguments(const char *msg);
114
120char rtosc_type(const char *msg, unsigned i);
121
122typedef struct {
123 const char *type_pos;
126
127typedef struct {
128 char type;
131
132typedef struct
133{
137
145 size_t lsize, size_t rsize,
146 const rtosc_cmp_options* opt);
147
162 size_t lsize, size_t rsize,
163 const rtosc_cmp_options* opt);
164
166typedef struct { va_list a; } rtosc_va_list_t;
167
176void rtosc_v2args(rtosc_arg_t* args, size_t nargs,
177 const char* arg_str, rtosc_va_list_t* ap);
178
183void rtosc_v2argvals(rtosc_arg_val_t* args, size_t nargs,
184 const char* arg_str, va_list ap);
185
190void rtosc_2argvals(rtosc_arg_val_t* args, size_t nargs,
191 const char* arg_str, ...);
192
199
206
213
220rtosc_arg_t rtosc_argument(const char *msg, unsigned i);
221
227size_t rtosc_message_length(const char *msg, size_t len);
228
229typedef struct {
230 char *data;
231 size_t len;
232} ring_t;
233
242
243
249bool rtosc_valid_message_p(const char *msg, size_t len);
250
255const char *rtosc_argument_string(const char *msg);
256
267size_t rtosc_bundle(char *buffer, size_t len, uint64_t tt, int elms, ...);
268
276size_t rtosc_bundle_elements(const char *msg, size_t len);
277
285const char *rtosc_bundle_fetch(const char *msg, unsigned i);
286
294size_t rtosc_bundle_size(const char *msg, unsigned i);
295
302int rtosc_bundle_p(const char *msg);
303
307uint64_t rtosc_bundle_timetag(const char *msg);
308
309
322bool rtosc_match(const char *pattern,
323 const char *msg, const char** path_end);
324
325
334const char *rtosc_match_path(const char *pattern,
335 const char *msg, const char** path_end);
336
337#ifdef __cplusplus
338};
339#endif
340#endif
register unsigned i
Definition inflate.c:1575
int int32_t
Definition mid.cpp:97
unsigned char uint8_t
Definition mid.cpp:98
const char * msg
Definition missing_descriptor.c:20
size_t rtosc_message_length(const char *msg, size_t len)
Definition rtosc.c:848
const char * rtosc_bundle_fetch(const char *msg, unsigned i)
Definition rtosc.c:972
void rtosc_v2args(rtosc_arg_t *args, size_t nargs, const char *arg_str, rtosc_va_list_t *ap)
Definition rtosc.c:418
size_t rtosc_bundle(char *buffer, size_t len, uint64_t tt, int elms,...)
Definition rtosc.c:931
unsigned rtosc_narguments(const char *msg)
Definition rtosc.c:19
size_t rtosc_amessage(char *buffer, size_t len, const char *address, const char *arguments, const rtosc_arg_t *args)
Definition rtosc.c:515
size_t rtosc_message_ring_length(ring_t *ring)
Definition rtosc.c:762
const char * rtosc_argument_string(const char *msg)
Definition rtosc.c:11
size_t rtosc_message(char *buffer, size_t len, const char *address, const char *arguments,...)
Definition rtosc.c:161
rtosc_arg_itr_t rtosc_itr_begin(const char *msg)
Definition rtosc.c:700
size_t rtosc_vmessage(char *buffer, size_t len, const char *address, const char *arguments, va_list va)
Definition rtosc.c:497
rtosc_arg_t rtosc_argument(const char *msg, unsigned i)
Definition rtosc.c:732
int rtosc_arg_vals_eq(rtosc_arg_val_t *lhs, rtosc_arg_val_t *rhs, size_t lsize, size_t rsize, const rtosc_cmp_options *opt)
Definition rtosc.c:237
size_t rtosc_bundle_size(const char *msg, unsigned i)
Definition rtosc.c:984
char rtosc_type(const char *msg, unsigned i)
Definition rtosc.c:67
size_t rtosc_bundle_elements(const char *msg, size_t len)
Definition rtosc.c:957
bool rtosc_match(const char *pattern, const char *msg, const char **path_end)
Definition dispatch.c:132
void rtosc_v2argvals(rtosc_arg_val_t *args, size_t nargs, const char *arg_str, va_list ap)
Definition rtosc.c:478
int rtosc_itr_end(rtosc_arg_itr_t itr)
Definition rtosc.c:727
int rtosc_arg_vals_cmp(rtosc_arg_val_t *lhs, rtosc_arg_val_t *rhs, size_t lsize, size_t rsize, const rtosc_cmp_options *opt)
Definition rtosc.c:311
rtosc_arg_val_t rtosc_itr_next(rtosc_arg_itr_t *itr)
Definition rtosc.c:709
uint64_t rtosc_bundle_timetag(const char *msg)
Definition rtosc.c:1002
void rtosc_2argvals(rtosc_arg_val_t *args, size_t nargs, const char *arg_str,...)
Definition rtosc.c:489
int rtosc_bundle_p(const char *msg)
Definition rtosc.c:997
const char * rtosc_match_path(const char *pattern, const char *msg, const char **path_end)
Definition dispatch.c:70
bool rtosc_valid_message_p(const char *msg, size_t len)
Definition rtosc.c:854
Definition rtosc.h:229
char * data
Definition rtosc.h:230
size_t len
Definition rtosc.h:231
Definition rtosc.h:122
const uint8_t * value_pos
Definition rtosc.h:124
const char * type_pos
Definition rtosc.h:123
Definition rtosc.h:127
rtosc_arg_t val
Definition rtosc.h:129
char type
Definition rtosc.h:128
Definition rtosc.h:41
uint8_t * data
Definition rtosc.h:43
int32_t len
Definition rtosc.h:42
Definition rtosc.h:133
double float_tolerance
< tolerance to when two floats or doubles are equal
Definition rtosc.h:135
va_list container, required for passing va_list as pointers to functions
Definition rtosc.h:166
va_list a
Definition rtosc.h:166
Definition rtosc.h:46
int32_t i
Definition rtosc.h:47
rtosc_blob_t b
Definition rtosc.h:55
float f
Definition rtosc.h:49
char T
Definition rtosc.h:48
uint64_t t
Definition rtosc.h:52
uint8_t m[4]
Definition rtosc.h:53
const char * s
Definition rtosc.h:54
int64_t h
Definition rtosc.h:51
double d
Definition rtosc.h:50
int * pattern
Definition match.c:126