58#define OSE_START_BUNDLE(B) { \
60 int32_t ose_stackops_reserved_o___ = \
61 ose_getLastBundleElemOffset(B); \
62 int32_t ose_stackops_reserved_bs___ = ose_readSize(B);
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___)); \
94 const char *
const v);
101 const char *
const s,
118 const char *
const blob);
120#ifdef OSE_PROVIDE_TYPE_SYMBOL
127#ifdef OSE_PROVIDE_TYPE_DOUBLE
134#ifdef OSE_PROVIDE_TYPE_INT8
141#ifdef OSE_PROVIDE_TYPE_UINT8
148#ifdef OSE_PROVIDE_TYPE_UINT32
155#ifdef OSE_PROVIDE_TYPE_INT64
162#ifdef OSE_PROVIDE_TYPE_UINT64
169#ifdef OSE_PROVIDE_TYPE_TIMETAG
176#ifdef OSE_PROVIDE_TYPE_TRUE
183#ifdef OSE_PROVIDE_TYPE_FALSE
190#ifdef OSE_PROVIDE_TYPE_NIL
197#ifdef OSE_PROVIDE_TYPE_INFINITUM
208#define OSE_MAXLINE 4096
229 const char *
const address,
232 const char *
const name);
264 const char *
const address,
303 const int32_t messageoffset);
388#ifdef OSE_PROVIDE_TYPE_SYMBOL
409#ifdef OSE_PROVIDE_TYPE_DOUBLE
421#ifdef OSE_PROVIDE_TYPE_INT8
433#ifdef OSE_PROVIDE_TYPE_UINT8
445#ifdef OSE_PROVIDE_TYPE_UINT32
457#ifdef OSE_PROVIDE_TYPE_INT16
469#ifdef OSE_PROVIDE_TYPE_UINT16
481#ifdef OSE_PROVIDE_TYPE_INT64
493#ifdef OSE_PROVIDE_TYPE_UINT64
505#ifdef OSE_PROVIDE_TYPE_TIMETAG
580#ifdef OSE_PROVIDE_TYPE_SYMBOL
594#ifdef OSE_PROVIDE_TYPE_DOUBLE
606#ifdef OSE_PROVIDE_TYPE_INT8
618#ifdef OSE_PROVIDE_TYPE_UINT8
630#ifdef OSE_PROVIDE_TYPE_UINT32
643#ifdef OSE_PROVIDE_TYPE_INT64
655#ifdef OSE_PROVIDE_TYPE_UINT64
668#ifdef OSE_PROVIDE_TYPE_TIMETAG
1513#ifdef OSE_CONF_VALIDATION_MEMO_BYTES
1514#define OSE_VMEMO_N 16
1529 } entry[OSE_VMEMO_N];
1530 char bytes[OSE_CONF_VALIDATION_MEMO_BYTES] __attribute__((aligned(4)));
1534void ose_blobToElemAtOffset(
ose_bundle B, int32_t offset);
1557 ose_fn *fn,
const char **canon);
1696#ifdef OSE_PROVIDE_TYPE_SYMBOL
1699#ifdef OSE_PROVIDE_TYPE_DOUBLE
1702#ifdef OSE_PROVIDE_TYPE_INT8
1705#ifdef OSE_PROVIDE_TYPE_UINT8
1708#ifdef OSE_PROVIDE_TYPE_INT16
1711#ifdef OSE_PROVIDE_TYPE_UINT16
1714#ifdef OSE_PROVIDE_TYPE_UINT32
1717#ifdef OSE_PROVIDE_TYPE_INT64
1720#ifdef OSE_PROVIDE_TYPE_UINT64
1723#ifdef OSE_PROVIDE_TYPE_TIMETAG
1726#ifdef OSE_PROVIDE_TYPE_TRUE
1729#ifdef OSE_PROVIDE_TYPE_FALSE
1732#ifdef OSE_PROVIDE_TYPE_NIL
1735#ifdef OSE_PROVIDE_TYPE_INFINITUM
1782void ose_decatenateBlobFromEnd_impl(
ose_bundle B, int32_t n);
1784void ose_decatenateBlobFromStart_impl(
ose_bundle B, int32_t n);
1786void ose_decatenateStringFromEnd_impl(
ose_bundle B, int32_t n);
1788void ose_decatenateStringFromStart_impl(
ose_bundle B, int32_t n);
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