asoma.dev · the C reference for libose
libose
the C library every o.se host is built on
Loading...
Searching...
No Matches
ose_stackops.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2019-23 John MacCallum Permission is hereby
3 granted, free of charge, to any person obtaining a copy of this
4 software and associated documentation files (the "Software"), to
5 deal in the Software without restriction, including without
6 limitation the rights to use, copy, modify, merge, publish,
7 distribute, sublicense, and/or sell copies of the Software, and
8 to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be
12 included in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 OTHER DEALINGS IN THE SOFTWARE.
22*/
23
44#ifndef OSE_STACKOPS_H
45#define OSE_STACKOPS_H
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51#include "ose.h"
52#include "ose_util.h"
53#include "ose_errno.h"
54
58#define OSE_START_BUNDLE(B) { \
59 ose_pushBundle(B); \
60 int32_t ose_stackops_reserved_o___ = \
61 ose_getLastBundleElemOffset(B); \
62 int32_t ose_stackops_reserved_bs___ = ose_readSize(B);
63
67#define OSE_END_BUNDLE(B) \
68 int32_t ose_stackops_reserved_nbs___ = ose_readSize(B); \
69 ose_writeInt32(B, ose_stackops_reserved_o___, \
70 OSE_BUNDLE_HEADER_LEN + \
71 (ose_stackops_reserved_nbs___ - \
72 ose_stackops_reserved_bs___)); \
73}
74
83void ose_pushInt32(ose_bundle B, int32_t v);
84
88void ose_pushFloat(ose_bundle B, float v);
89
94 const char * const v);
95
96void ose_pushStringBelowAtOffset(ose_bundle B,
97 const int32_t offset,
98 const char * const s,
99 const int32_t slen);
100void ose_pushStringBelow(ose_bundle B,
101 const char * const s,
102 const int32_t slen);
103
117 int32_t size,
118 const char * const blob);
119
120#ifdef OSE_PROVIDE_TYPE_SYMBOL
124void ose_pushSymbol(ose_bundle B, const char * const v);
125#endif
126
127#ifdef OSE_PROVIDE_TYPE_DOUBLE
131void ose_pushDouble(ose_bundle B, double v);
132#endif
133
134#ifdef OSE_PROVIDE_TYPE_INT8
138void ose_pushInt8(ose_bundle B, int8_t v);
139#endif
140
141#ifdef OSE_PROVIDE_TYPE_UINT8
145void ose_pushUInt8(ose_bundle B, uint8_t v);
146#endif
147
148#ifdef OSE_PROVIDE_TYPE_UINT32
152void ose_pushUInt32(ose_bundle B, uint32_t v);
153#endif
154
155#ifdef OSE_PROVIDE_TYPE_INT64
159void ose_pushInt64(ose_bundle B, int64_t v);
160#endif
161
162#ifdef OSE_PROVIDE_TYPE_UINT64
166void ose_pushUInt64(ose_bundle B, uint64_t v);
167#endif
168
169#ifdef OSE_PROVIDE_TYPE_TIMETAG
173void ose_pushTimetag(ose_bundle B, uint32_t sec, uint32_t fsec);
174#endif
175
176#ifdef OSE_PROVIDE_TYPE_TRUE
181#endif
182
183#ifdef OSE_PROVIDE_TYPE_FALSE
188#endif
189
190#ifdef OSE_PROVIDE_TYPE_NIL
195#endif
196
197#ifdef OSE_PROVIDE_TYPE_INFINITUM
202#endif
203
208#define OSE_MAXLINE 4096
209
217void ose_pushAlignedPtr(ose_bundle B, const void *v, const char * const name);
218
229 const char * const address,
230 int32_t addresslen,
231 ose_fn fn,
232 const char * const name);
233
249void ose_pushLines(ose_bundle B, const char * const src);
250
262#ifndef SWIGCSHARP
264 const char * const address,
265 int32_t addresslen,
266 int32_t n,
267 ...);
268#endif
269
// C to OSC
271
287char *ose_peekAddress(const ose_bundle B);
288
303 const int32_t messageoffset);
304
318
331char ose_peekType(const ose_bundle B);
332
341int32_t ose_peekInt32(ose_constbundle B);
342
351float ose_peekFloat(ose_constbundle B);
352
369char *ose_peekString(ose_constbundle B);
370
386char *ose_peekBlob(ose_constbundle B);
387
388#ifdef OSE_PROVIDE_TYPE_SYMBOL
406char *ose_peekSymbol(const ose_bundle B);
407#endif
408
409#ifdef OSE_PROVIDE_TYPE_DOUBLE
418double ose_peekDouble(const ose_bundle B);
419#endif
420
421#ifdef OSE_PROVIDE_TYPE_INT8
430int8_t ose_peekInt8(const ose_bundle B);
431#endif
432
433#ifdef OSE_PROVIDE_TYPE_UINT8
442uint8_t ose_peekUInt8(const ose_bundle B);
443#endif
444
445#ifdef OSE_PROVIDE_TYPE_UINT32
454uint32_t ose_peekUInt32(const ose_bundle B);
455#endif
456
457#ifdef OSE_PROVIDE_TYPE_INT16
466int16_t ose_peekInt16(const ose_bundle B);
467#endif
468
469#ifdef OSE_PROVIDE_TYPE_UINT16
478uint16_t ose_peekUInt16(const ose_bundle B);
479#endif
480
481#ifdef OSE_PROVIDE_TYPE_INT64
490int64_t ose_peekInt64(const ose_bundle B);
491#endif
492
493#ifdef OSE_PROVIDE_TYPE_UINT64
502uint64_t ose_peekUInt64(const ose_bundle B);
503#endif
504
505#ifdef OSE_PROVIDE_TYPE_TIMETAG
515#endif
516
528const void *ose_peekAlignedPtr(ose_bundle B);
529
538int32_t ose_popInt32(ose_bundle B);
539
549
565int32_t ose_popString(ose_bundle B, char *buf);
566
578int32_t ose_popBlob(ose_bundle B, char *buf);
579
580#ifdef OSE_PROVIDE_TYPE_SYMBOL
591int32_t ose_popSymbol(ose_bundle B, char *buf);
592#endif
593
594#ifdef OSE_PROVIDE_TYPE_DOUBLE
604#endif
605
606#ifdef OSE_PROVIDE_TYPE_INT8
615int8_t ose_popInt8(ose_bundle B);
616#endif
617
618#ifdef OSE_PROVIDE_TYPE_UINT8
627uint8_t ose_popUInt8(ose_bundle B);
628#endif
629
630#ifdef OSE_PROVIDE_TYPE_UINT32
640uint32_t ose_popUInt32(ose_bundle B);
641#endif
642
643#ifdef OSE_PROVIDE_TYPE_INT64
652int64_t ose_popInt64(ose_bundle B);
653#endif
654
655#ifdef OSE_PROVIDE_TYPE_UINT64
665uint64_t ose_popUInt64(ose_bundle B);
666#endif
667
668#ifdef OSE_PROVIDE_TYPE_TIMETAG
678#endif
679
// OSC to C
681
692void ose_drop(ose_bundle B);
693
700
706void ose_dup(ose_bundle B);
707
713void ose_2dup(ose_bundle B);
714
715void ose_nip_impl(ose_bundle B,
716 int32_t onm1,
717 int32_t snm1,
718 int32_t on,
719 int32_t sn);
720
726void ose_nip(ose_bundle B);
727
733void ose_rot(ose_bundle B);
734
740void ose_rrot(ose_bundle B);
741
747void ose_over(ose_bundle B);
748
756
780void ose_pick(ose_bundle B);
781
806void ose_roll(ose_bundle B);
807
817
831
897
958
964void ose_swap(ose_bundle B);
965
972
978void ose_tuck(ose_bundle B);
979
// Stack Operations
981
991
1013
1035
1039void ose_clear(ose_bundle B);
1040
1055void ose_popAtOffset(ose_bundle B, int32_t o);
1056
1071void ose_pop(ose_bundle B);
1072
1090void ose_popAll(ose_bundle B);
1091
1110
1129
1149
1156
1175void ose_push(ose_bundle B);
1176
1194
1212
1223
1236void ose_unpack(ose_bundle B);
1237
1252
// Grouping / Ungrouping
1254
1269
1281
1296
1311
1325
1340
1356
1371
1384
1398
1407
1412
1423
1432
1441
1450
// Queries
1452
1458void ose_setTypetagAtOffset_impl(ose_bundle B,
1459 char typetag,
1460 int32_t offset);
1461
1487void ose_setTypetag_impl(ose_bundle B, char typetag);
1488
1512
1513#ifdef OSE_CONF_VALIDATION_MEMO_BYTES
1514#define OSE_VMEMO_N 16
1522struct ose_vmemo
1523{
1524 int32_t used;
1525 int32_t count;
1526 struct
1527 {
1528 int32_t off, len;
1529 } entry[OSE_VMEMO_N];
1530 char bytes[OSE_CONF_VALIDATION_MEMO_BYTES] __attribute__((aligned(4)));
1531};
1532#endif
1533
1534void ose_blobToElemAtOffset(ose_bundle B, int32_t offset);
1535
1556typedef int (*ose_resolveNameFn)(void *ctx, const char *name,
1557 ose_fn *fn, const char **canon);
1558
1583
1590int32_t ose_countPointers(ose_bundle B, int32_t *live, int32_t *byname);
1591
1610 ose_resolveNameFn resolve,
1611 void *ctx,
1612 int32_t *stayed);
1613
1614void ose_blobToElem(ose_bundle B);
1615
1628void ose_blobToType_impl(ose_bundle B, char typetag);
1629
1643
1644void ose_toType(ose_bundle B);
1645
1660
1675
1684
1692void ose_toBlob(ose_bundle B);
1693
1694
1695void ose_appendByte(ose_bundle B);
1696#ifdef OSE_PROVIDE_TYPE_SYMBOL
1697void ose_toSymbol(ose_bundle B);
1698#endif
1699#ifdef OSE_PROVIDE_TYPE_DOUBLE
1700void ose_toDouble(ose_bundle B);
1701#endif
1702#ifdef OSE_PROVIDE_TYPE_INT8
1703void ose_toInt8(ose_bundle B);
1704#endif
1705#ifdef OSE_PROVIDE_TYPE_UINT8
1706void ose_toUInt8(ose_bundle B);
1707#endif
1708#ifdef OSE_PROVIDE_TYPE_INT16
1709void ose_toInt16(ose_bundle B);
1710#endif
1711#ifdef OSE_PROVIDE_TYPE_UINT16
1712void ose_toUInt16(ose_bundle B);
1713#endif
1714#ifdef OSE_PROVIDE_TYPE_UINT32
1715void ose_toUInt32(ose_bundle B);
1716#endif
1717#ifdef OSE_PROVIDE_TYPE_INT64
1718void ose_toInt64(ose_bundle B);
1719#endif
1720#ifdef OSE_PROVIDE_TYPE_UINT64
1721void ose_toUInt64(ose_bundle B);
1722#endif
1723#ifdef OSE_PROVIDE_TYPE_TIMETAG
1724void ose_toTimetag(ose_bundle B);
1725#endif
1726#ifdef OSE_PROVIDE_TYPE_TRUE
1727void ose_toTrue(ose_bundle B);
1728#endif
1729#ifdef OSE_PROVIDE_TYPE_FALSE
1730void ose_toFalse(ose_bundle B);
1731#endif
1732#ifdef OSE_PROVIDE_TYPE_NIL
1733void ose_toNil(ose_bundle B);
1734#endif
1735#ifdef OSE_PROVIDE_TYPE_INFINITUM
1736void ose_toInfinitum(ose_bundle B);
1737#endif
1738
1750
1763
1772
1781
1782void ose_decatenateBlobFromEnd_impl(ose_bundle B, int32_t n);
1783void ose_decatenateBlobFromEnd(ose_bundle B);
1784void ose_decatenateBlobFromStart_impl(ose_bundle B, int32_t n);
1785void ose_decatenateBlobFromStart(ose_bundle B);
1786void ose_decatenateStringFromEnd_impl(ose_bundle B, int32_t n);
1787void ose_decatenateStringFromEnd(ose_bundle B);
1788void ose_decatenateStringFromStart_impl(ose_bundle B, int32_t n);
1789void ose_decatenateStringFromStart(ose_bundle B);
1790
1797
1806
1828void ose_splitStringFromEnd(ose_bundle B);
1829void ose_splitStringFromStart(ose_bundle B);
1830void ose_swap4Bytes(ose_bundle B);
1831void ose_swap8Bytes(ose_bundle B);
1832void ose_swapNBytes(ose_bundle B);
1833void ose_trimStringEnd(ose_bundle B);
1834void ose_trimStringStart(ose_bundle B);
1835
// Operations on Bundle Elements and Items
1837
1857void ose_match(ose_bundle B);
1858
1885void ose_pmatch(ose_bundle B);
1886void ose_replace(ose_bundle B);
1887void ose_assign(ose_bundle B);
1888void ose_lookup(ose_bundle B);
1890
1912void ose_route1(ose_bundle B);
1913
1941
1963
1990
2012void ose_gather(ose_bundle B);
2013
2031void ose_nth(ose_bundle B);
2032
// Matching, Selecting, Routing, and Assignment
2034
2053
2058
// Element and Item Creation
2060
2077void ose_add(ose_bundle B);
2078
2090void ose_sub(ose_bundle B);
2091
2103void ose_mul(ose_bundle B);
2104
2116void ose_div(ose_bundle B);
2117
2129void ose_mod(ose_bundle B);
2130
2142void ose_pow(ose_bundle B);
2143
2152void ose_neg(ose_bundle B);
2153
2165void ose_eql(ose_bundle B);
2166
2179void ose_neq(ose_bundle B);
2180
2192void ose_lte(ose_bundle B);
2193void ose_gt(ose_bundle B);
2194void ose_gte(ose_bundle B);
2195void ose_min(ose_bundle B);
2196void ose_max(ose_bundle B);
2197void ose_abs(ose_bundle B);
2198void ose_not(ose_bundle B);
2199
2211void ose_lt(ose_bundle B);
2212
2224void ose_and(ose_bundle B);
2225
2237void ose_or(ose_bundle B);
2238
// Arithmetic
2240
2241enum ose_errno ose_getLastBundleElem(ose_bundle B,
2242 int32_t *n,
2243 int32_t *offsetn,
2244 int32_t *sizen);
2245
2246enum ose_errno ose_getLastTwoBundleElems(ose_bundle B,
2247 int32_t *n,
2248 int32_t *offsetnm1,
2249 int32_t *sizenm1,
2250 int32_t *offsetn,
2251 int32_t *sizen);
2252
2253enum ose_errno ose_getLastThreeBundleElems(ose_bundle B,
2254 int32_t *n,
2255 int32_t *offsetnm2,
2256 int32_t *sizenm2,
2257 int32_t *offsetnm1,
2258 int32_t *sizenm1,
2259 int32_t *offsetn,
2260 int32_t *sizen);
2261
2262enum ose_errno ose_getLastFourBundleElems(ose_bundle B,
2263 int32_t *n,
2264 int32_t *offsetnm3,
2265 int32_t *sizenm3,
2266 int32_t *offsetnm2,
2267 int32_t *sizenm2,
2268 int32_t *offsetnm1,
2269 int32_t *sizenm1,
2270 int32_t *offsetn,
2271 int32_t *sizen);
2272
2273#ifdef __cplusplus
2274}
2275#endif
2276
2277#endif
provides global definitions and types
void(* ose_fn)(ose_bundle)
Function pointer for the basic OSE function that operates on a bundle.
Definition ose.h:435
Status codes for context bundles.
ose_errno
Definition ose_errno.h:37
void ose_mod(ose_bundle B)
Take the number in the last message modulo the number in the second to last message.
Definition ose_stackops.c:9860
void ose_drop(ose_bundle B)
Drop the last element.
Definition ose_stackops.c:1490
void ose_unpack(ose_bundle B)
Unpack the last element.
Definition ose_stackops.c:3892
void ose_swapStringToAddress(ose_bundle B)
Exchange the last string of a message with the address.
Definition ose_stackops.c:7127
void ose_lengthItem(ose_bundle B)
Get the length in bytes of the last item of the last element, excluding NULL-padding.
Definition ose_stackops.c:4349
void ose_getAddresses(ose_bundle B)
Get the address(es) of the last element of the bundle.
Definition ose_stackops.c:4582
void ose_select1(ose_bundle B)
Select messages in a bundle with patterns that match an address.
Definition ose_stackops.c:8003
void ose_pushUInt32(ose_bundle B, uint32_t v)
Append a message containing an unsigned 32-bit int.
Definition ose_stackops.c:379
void ose_toType(ose_bundle B)
Definition ose_stackops.c:5458
void ose_rollPMatch(ose_bundle B)
Move the first element whose address pattern matches the string at the end to the end — ose_rollPMatc...
Definition ose_stackops.c:2155
float ose_popFloat(ose_bundle B)
Get the last float and remove it from the bundle.
Definition ose_stackops.c:1012
int32_t ose_pickPMatch_impl(ose_bundle B)
Definition ose_stackops.c:1932
void ose_blobToType(ose_bundle B)
Convert a blob to a different type.
Definition ose_stackops.c:5450
int32_t ose_rollMatch_impl(ose_bundle B)
Move the first element whose address matches the string at the end of the bundle to the end.
Definition ose_stackops.c:2101
void ose_pushUInt64(ose_bundle B, uint64_t v)
Append a message containing an unsigned 64-bit int.
Definition ose_stackops.c:399
void ose_setTypetag_impl(ose_bundle B, char typetag)
Set the typetag of the last item of the last message.
Definition ose_stackops.c:4808
void ose_blobToType_impl(ose_bundle B, char typetag)
Convert a blob to a different type.
Definition ose_stackops.c:5411
void ose_sub(ose_bundle B)
Subtract the number in the second to last message from the number in the last message.
Definition ose_stackops.c:9496
void ose_nip(ose_bundle B)
Drop the second to last element.
Definition ose_stackops.c:1590
void ose_unpackDrop(ose_bundle B)
Unpack the last element and drop it.
Definition ose_stackops.c:4157
void ose_div(ose_bundle B)
Divide the number in the second to last message by the number in the last message.
Definition ose_stackops.c:9767
struct ose_timetag ose_popTimetag(ose_bundle B)
Get the last timetag and remove it from the bundle.
Definition ose_stackops.c:1164
void ose_sizesItems(ose_bundle B)
Get the sizes of all items of the last element as a list, including NULL-padding.
Definition ose_stackops.c:4532
void ose_sizeElem(ose_bundle B)
Get the size of the last element in bytes, including NULL-padding, and excluding the size field.
Definition ose_stackops.c:4419
void ose_concatenateBlobs(ose_bundle B)
Concatenate two blobs.
Definition ose_stackops.c:6883
void ose_pushTimetag(ose_bundle B, uint32_t sec, uint32_t fsec)
Append a message containing a timetag.
Definition ose_stackops.c:422
void ose_sizeItem(ose_bundle B)
Get the size of the last item of the last element, including NULL-padding.
Definition ose_stackops.c:4451
void ose_swap(ose_bundle B)
Swap the last two elements.
Definition ose_stackops.c:2307
uint8_t ose_peekUInt8(const ose_bundle B)
Get the last uint8_t without removing it.
Definition ose_stackops.c:903
void ose_sizesElems(ose_bundle B)
Get the sizes of all elements as a list, including NULL-padding.
Definition ose_stackops.c:4498
void ose_2swap(ose_bundle B)
Swap elements the last two elements with the previous two.
Definition ose_stackops.c:1425
char * ose_peekString(ose_bundle B)
Get a pointer to the last string without removing it.
Definition ose_stackops.c:855
void ose_pow(ose_bundle B)
Raise the number in the last message to the power of the number in the second to last message.
Definition ose_stackops.c:10102
void ose_selectWithDelegation(ose_bundle B)
Route all messages in a bundle with patterns that match one or more addresses.
Definition ose_stackops.c:8285
void ose_elemIsBundle(ose_bundle B)
Determine whether the last element is a bundle.
Definition ose_stackops.c:4659
void ose_concatenateStrings(ose_bundle B)
Concatenate two strings.
Definition ose_stackops.c:6965
void ose_route1(ose_bundle B)
Route messages in a bundle with patterns that match an address.
Definition ose_stackops.c:7922
void ose_pushNil(ose_bundle B)
Append message containing NIL to B.
Definition ose_stackops.c:507
uint16_t ose_peekUInt16(const ose_bundle B)
Peek at the uint16 value of the last element.
Definition ose_stackops.c:938
void ose_push(ose_bundle B)
Push the last element of the bundle onto the element below it.
Definition ose_stackops.c:3362
void ose_over(ose_bundle B)
Copy the second from the last item over the last.
Definition ose_stackops.c:1724
void ose_plookup(ose_bundle B)
Definition ose_stackops.c:9274
void ose_max(ose_bundle B)
Definition ose_stackops.c:10647
int(* ose_resolveNameFn)(void *ctx, const char *name, ose_fn *fn, const char **canon)
Convert a blob to a bundle element.
Definition ose_stackops.h:1556
void ose_eql(ose_bundle B)
Compare the numbers in the last two messages for equality.
Definition ose_stackops.c:10354
void ose_pushAlignedPtr(ose_bundle B, const void *v, const char *const name)
Push a pointer as a value, with its name.
Definition ose_stackops.c:578
void ose_getTimetag(ose_bundle B)
Get the bundle's timetag.
Definition ose_stackops.c:1228
void ose_match(ose_bundle B)
Compare two strings.
Definition ose_stackops.c:7786
char * ose_peekSymbol(const ose_bundle B)
Get a pointer to the last symbol stored in the last message.
Definition ose_stackops.c:872
void ose_pushUInt8(ose_bundle B, uint8_t v)
Append a message containing an uint8_t.
Definition ose_stackops.c:369
int32_t ose_popInt32(ose_bundle B)
Get the last int and remove it from the bundle.
Definition ose_stackops.c:994
void ose_pickPMatch(ose_bundle B)
Copy the first element whose address pattern matches the string at the end to the end — ose_pickPMatc...
Definition ose_stackops.c:1952
float ose_peekFloat(ose_bundle B)
Get the value of the last float stored in the last message.
Definition ose_stackops.c:845
void ose_neq(ose_bundle B)
Compare the numbers in the last two messages for non equality.
Definition ose_stackops.c:10362
void ose_routeWithDelegation(ose_bundle B)
Route all messages in a bundle with patterns that match one or more addresses.
Definition ose_stackops.c:8121
uint8_t ose_popUInt8(ose_bundle B)
Get the last uint8_t and remove it from the bundle.
Definition ose_stackops.c:1116
void ose_pushSymbol(ose_bundle B, const char *const v)
Append a message containing a symbol.
Definition ose_stackops.c:306
void ose_elemToBlob(ose_bundle B)
Convert the last element into a blob.
Definition ose_stackops.c:7395
void ose_roll(ose_bundle B)
Move an element at an index to the end.
Definition ose_stackops.c:1977
void ose_pushInfinitum(ose_bundle B)
Append a message containing an infinitum.
Definition ose_stackops.c:517
void ose_bundleAll(ose_bundle B)
Collect all bundle elements into a single bundle.
Definition ose_stackops.c:2383
void ose_2drop(ose_bundle B)
Drop the last two elements.
Definition ose_stackops.c:1270
char ose_peekMessageArgType(const ose_bundle B)
Get the type of the last item of the last element.
Definition ose_stackops.c:771
uint64_t ose_popUInt64(ose_bundle B)
Get the last unsigned 64-bit int and remove it from the bundle.
Definition ose_stackops.c:1152
int32_t ose_popBlob(ose_bundle B, char *buf)
Get the last blob and remove it from the bundle.
Definition ose_stackops.c:1054
void ose_pick(ose_bundle B)
Copy an element at an index to the end.
Definition ose_stackops.c:1808
void ose_gte(ose_bundle B)
Definition ose_stackops.c:11012
void ose_decatenateElemFromEnd(ose_bundle B)
Split an element in two.
Definition ose_stackops.c:3740
void ose_itemToBlob(ose_bundle B)
Convert the last item of the last element into a blob.
Definition ose_stackops.c:7451
uint64_t ose_peekUInt64(const ose_bundle B)
Get the last unsigned int without removing it.
Definition ose_stackops.c:958
void ose_reverse(ose_bundle B)
Reverse the items of the last element of the bundle.
Definition ose_stackops.c:3216
void ose_abs(ose_bundle B)
Definition ose_stackops.c:10738
void ose_pushInt32(ose_bundle B, int32_t v)
Append a message containing a 32-bit signed int.
Definition ose_stackops.c:138
void ose_pushString(ose_bundle B, const char *const v)
Append a message containing a string.
Definition ose_stackops.c:192
void ose_neg(ose_bundle B)
Flip the sign of the number in the last message of the bundle.
Definition ose_stackops.c:10206
void ose_pop(ose_bundle B)
Pop the last item off the last element and push it onto the end of the bundle as a new element.
Definition ose_stackops.c:2820
int32_t ose_popString(ose_bundle B, char *buf)
Get the last string and remove it from the bundle.
Definition ose_stackops.c:1032
void ose_rrot(ose_bundle B)
Move the last element to the third from the end.
Definition ose_stackops.c:1662
void ose_nth(ose_bundle B)
Copy the nth item of an element.
Definition ose_stackops.c:8697
void ose_countElems(ose_bundle B)
Get the number of elements.
Definition ose_stackops.c:4212
void ose_popAllDrop(ose_bundle B)
Pop each item off the last element of the bundle, and drop the empty element.
Definition ose_stackops.c:3045
void ose_gt(ose_bundle B)
Definition ose_stackops.c:10921
void ose_lengthsItems(ose_bundle B)
Get the lengths in bytes of all items of the last element as a list, excluding NULL-padding.
Definition ose_stackops.c:4400
void ose_popAllDropBundle(ose_bundle B)
Pop each item off the last element of the bundle, drop the empty element, and bundle all new elements...
Definition ose_stackops.c:3188
void ose_pushFalse(ose_bundle B)
Append message containing false to B.
Definition ose_stackops.c:497
struct ose_timetag ose_peekTimetag(const ose_bundle B)
Get the last timetag without removing it.
Definition ose_stackops.c:968
void ose_makeBlob(ose_bundle B)
Create an empty blob of a given size.
Definition ose_stackops.c:9300
void ose_or(ose_bundle B)
Test whether at least one of the numbers in the last two messages is non-zero.
Definition ose_stackops.c:11228
int64_t ose_popInt64(ose_bundle B)
Get the last 64-bit int and remove it from the bundle.
Definition ose_stackops.c:1140
void ose_clear(ose_bundle B)
Clear all elements.
Definition ose_stackops.c:2659
void ose_joinStrings(ose_bundle B)
Join two strings with a separator (string) between them.
Definition ose_stackops.c:7553
void ose_decatenateElemFromStart(ose_bundle B)
Split an element in two.
Definition ose_stackops.c:3699
void ose_pushDouble(ose_bundle B, double v)
Append a message containing a double.
Definition ose_stackops.c:348
void ose_concatenateElems(ose_bundle B)
Concatenate the last two elements.
Definition ose_stackops.c:3811
void ose_bundleFromTop(ose_bundle B)
Collect elements at the end of the bundle together.
Definition ose_stackops.c:2562
void ose_typeof0(ose_bundle B)
Get the type signature of the last element of the bundle with no recursion.
Definition ose_stackops.c:4672
void ose_pushMessage(ose_bundle B, const char *const address, int32_t addresslen, int32_t n,...)
Append a message.
Definition ose_stackops.c:628
void ose_rot(ose_bundle B)
Move the third to last element to the end.
Definition ose_stackops.c:2208
double ose_popDouble(ose_bundle B)
Get the last double and remove it from the bundle.
Definition ose_stackops.c:1092
void ose_popAtOffset(ose_bundle B, int32_t o)
Remove the element at a known offset, which must be the last one.
Definition ose_stackops.c:2677
uint32_t ose_peekUInt32(const ose_bundle B)
Get the last unsigned 32-bit int without removing it.
Definition ose_stackops.c:913
double ose_peekDouble(const ose_bundle B)
Get the last double without removing it.
Definition ose_stackops.c:882
void ose_mul(ose_bundle B)
Multiply the number in the last message by the number in the previous message.
Definition ose_stackops.c:9617
void ose_pushBlob(ose_bundle B, int32_t size, const char *const blob)
Append a message containing a blob.
Definition ose_stackops.c:243
void ose_and(ose_bundle B)
Test whether the numbers in the last two messages are both non-zero.
Definition ose_stackops.c:11193
const void * ose_peekAlignedPtr(ose_bundle B)
Get the last aligned pointer without removing it.
Definition ose_stackops.c:981
void ose_setTypetag(ose_bundle B)
Set the typetag of the last item of the last message.
Definition ose_stackops.c:4838
void ose_countItems(ose_bundle B)
Get the number of items in the last element.
Definition ose_stackops.c:4284
int32_t ose_rearmPointers(ose_bundle B, ose_resolveNameFn resolve, void *ctx, int32_t *stayed)
Resolve every 'P' in the top element through resolve, and write each one it resolves as a 'p'.
Definition ose_stackops.c:5358
void ose_bundleFromBottom(ose_bundle B)
Collect elements at the start of the bundle together.
Definition ose_stackops.c:2459
void ose_toInt32(ose_bundle B)
Cast a value to a 32-bit integer.
Definition ose_stackops.c:5629
void ose_toString(ose_bundle B)
Cast a value to a string.
Definition ose_stackops.c:6029
void ose_pushTrue(ose_bundle B)
Append message containing true to B.
Definition ose_stackops.c:487
void ose_lt(ose_bundle B)
Test whether the number in the last message is less than to the number in the second to last message.
Definition ose_stackops.c:10465
int32_t ose_countPointers(ose_bundle B, int32_t *live, int32_t *byname)
Count the pointers in the top element without changing it: live the 'p's, byname the 'P's....
Definition ose_stackops.c:5327
void ose_pushInt64(ose_bundle B, int64_t v)
Append a message containing a signed 64-bit int.
Definition ose_stackops.c:389
void ose_pushFloat(ose_bundle B, float v)
Append a message containing a float.
Definition ose_stackops.c:146
void ose_rollBottom(ose_bundle B)
Move the first element to the end.
Definition ose_stackops.c:2013
void ose_2over(ose_bundle B)
Copy the second to last pair of elements over the last pair.
Definition ose_stackops.c:1369
char ose_peekType(const ose_bundle B)
Get the type of the last element.
Definition ose_stackops.c:793
void ose_setTimetag(ose_bundle B)
Set the bundle's timetag.
Definition ose_stackops.c:1191
int8_t ose_popInt8(ose_bundle B)
Get the last char and remove it from the bundle.
Definition ose_stackops.c:1104
void ose_pushBundle(ose_bundle B)
Create an empty bundle.
Definition ose_stackops.c:9329
void ose_typeof1(ose_bundle B)
Get the type signature of the last element of the bundle with one level of recursion.
Definition ose_stackops.c:4706
void ose_pushLines(ose_bundle B, const char *const src)
Push each line of src as a string.
Definition ose_stackops.c:526
void ose_gather(ose_bundle B)
Gather messages from a bundle that match one or more strings.
Definition ose_stackops.c:8502
uint32_t ose_popUInt32(ose_bundle B)
Get the last unsigned 32-bit int and remove it from the bundle.
Definition ose_stackops.c:1128
void ose_pmatch(ose_bundle B)
Compare two strings using pattern matching.
Definition ose_stackops.c:7860
void ose_toBlob(ose_bundle B)
Cast a value to a blob.
Definition ose_stackops.c:6037
char * ose_peekAddress(const ose_bundle B)
Get the address of the last element.
Definition ose_stackops.c:682
void ose_add(ose_bundle B)
Add the number in the last message to the number in the previous message.
Definition ose_stackops.c:9392
void ose_popAll(ose_bundle B)
Pop each item off the last element of the bundle.
Definition ose_stackops.c:2976
int32_t ose_disarmPointers(ose_bundle B)
Write every pointer in the top element as its name.
Definition ose_stackops.c:5352
void ose_typeof2(ose_bundle B)
Get the type signature of the last element of the bundle with two levels of recursion.
Definition ose_stackops.c:4740
void ose_moveStringToAddress(ose_bundle B)
Move the last string of a message to the address.
Definition ose_stackops.c:7154
void ose_not(ose_bundle B)
Definition ose_stackops.c:10827
char * ose_peekBlob(ose_bundle B)
Get a pointer to the last blob without removing it.
Definition ose_stackops.c:863
int16_t ose_peekInt16(const ose_bundle B)
Peek at the int16 value of the last element.
Definition ose_stackops.c:931
void ose_rollMatch(ose_bundle B)
Move the first element whose address equals the string at the end to the end — ose_rollMatch_impl,...
Definition ose_stackops.c:2123
int32_t ose_rollPMatch_impl(ose_bundle B)
Definition ose_stackops.c:2136
int8_t ose_peekInt8(const ose_bundle B)
Get the last signed char without removing it.
Definition ose_stackops.c:893
int64_t ose_peekInt64(const ose_bundle B)
Get the last 64-bit int without removing it.
Definition ose_stackops.c:948
int32_t ose_pickMatch_impl(ose_bundle B)
COPY the first element whose address matches the string at the end of the bundle to the end.
Definition ose_stackops.c:1902
void ose_pushInt8(ose_bundle B, int8_t v)
Append a message containing a signed char.
Definition ose_stackops.c:359
void ose_pickBottom(ose_bundle B)
Copy the first element to the end.
Definition ose_stackops.c:1832
int32_t ose_peekInt32(ose_bundle B)
Get the value of the last int stored in the last message.
Definition ose_stackops.c:837
void ose_pickMatch(ose_bundle B)
COPY the first element whose address equals the string at the end to the end — ose_pickMatch_impl,...
Definition ose_stackops.c:1919
void ose_dup(ose_bundle B)
Duplicate the last element.
Definition ose_stackops.c:1541
void ose_toFloat(ose_bundle B)
Cast a value to a 32-bit float.
Definition ose_stackops.c:5637
char ose_peekMessageArgTypeAtOffset(const ose_bundle B, const int32_t messageoffset)
Get the type of the last item of the last element, where the offset of the last element is given.
Definition ose_stackops.c:694
void ose_tuck(ose_bundle B)
Copy the last element to the third from last position.
Definition ose_stackops.c:2343
int32_t ose_popSymbol(ose_bundle B, char *buf)
Get the last symbol and remove it from the bundle.
Definition ose_stackops.c:1078
void ose_getTypetags(ose_bundle B)
Get the typetags of the last element.
Definition ose_stackops.c:7266
void ose_2dup(ose_bundle B)
Duplicate the last two elements.
Definition ose_stackops.c:1315
void ose_lte(ose_bundle B)
Test whether the number in the last message is less than or equal to the number in the second to last...
Definition ose_stackops.c:10374
void ose_min(ose_bundle B)
Definition ose_stackops.c:10556
void ose_pushFnMessage(ose_bundle B, const char *const address, int32_t addresslen, ose_fn fn, const char *const name)
Push a message binding fn under address, named name.
Definition ose_stackops.c:592
void ose_popAllBundle(ose_bundle B)
Pop each item off the last element of the bundle, and bundle them together.
Definition ose_stackops.c:3116
#define B(...)
Instantiate a top-level OSC bundle.
Definition ose_test_ctosc.h:339
contains basic utilities for reading, writing, and querying an OSC bundle
Definition ose.h:400
Convenience struct for OSC/NTP timetags.
Definition ose.h:446