modded version CNMAT/OSC https://github.com/CNMAT/OSC
Fork of osc-cnmat by
OSCMatch.h@1:18009e3041ea, 2014-05-16 (annotated)
- Committer:
- aspeteRakete
- Date:
- Fri May 16 22:10:49 2014 +0000
- Revision:
- 1:18009e3041ea
OSCMessage Portiert: ::send(Print &p) derzeit auskommentiert.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aspeteRakete | 1:18009e3041ea | 1 | /* |
aspeteRakete | 1:18009e3041ea | 2 | Written by John MacCallum, The Center for New Music and Audio Technologies, |
aspeteRakete | 1:18009e3041ea | 3 | University of California, Berkeley. Copyright (c) 2009, The Regents of |
aspeteRakete | 1:18009e3041ea | 4 | the University of California (Regents). |
aspeteRakete | 1:18009e3041ea | 5 | Permission to use, copy, modify, distribute, and distribute modified versions |
aspeteRakete | 1:18009e3041ea | 6 | of this software and its documentation without fee and without a signed |
aspeteRakete | 1:18009e3041ea | 7 | licensing agreement, is hereby granted, provided that the above copyright |
aspeteRakete | 1:18009e3041ea | 8 | notice, this paragraph and the following two paragraphs appear in all copies, |
aspeteRakete | 1:18009e3041ea | 9 | modifications, and distributions. |
aspeteRakete | 1:18009e3041ea | 10 | |
aspeteRakete | 1:18009e3041ea | 11 | IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, |
aspeteRakete | 1:18009e3041ea | 12 | SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING |
aspeteRakete | 1:18009e3041ea | 13 | OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS |
aspeteRakete | 1:18009e3041ea | 14 | BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
aspeteRakete | 1:18009e3041ea | 15 | |
aspeteRakete | 1:18009e3041ea | 16 | REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
aspeteRakete | 1:18009e3041ea | 17 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
aspeteRakete | 1:18009e3041ea | 18 | PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED |
aspeteRakete | 1:18009e3041ea | 19 | HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE |
aspeteRakete | 1:18009e3041ea | 20 | MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
aspeteRakete | 1:18009e3041ea | 21 | */ |
aspeteRakete | 1:18009e3041ea | 22 | |
aspeteRakete | 1:18009e3041ea | 23 | #ifndef __OSC_MATCH_H__ |
aspeteRakete | 1:18009e3041ea | 24 | #define __OSC_MATCH_H__ |
aspeteRakete | 1:18009e3041ea | 25 | |
aspeteRakete | 1:18009e3041ea | 26 | #ifdef __cplusplus |
aspeteRakete | 1:18009e3041ea | 27 | extern "C" { |
aspeteRakete | 1:18009e3041ea | 28 | #endif |
aspeteRakete | 1:18009e3041ea | 29 | |
aspeteRakete | 1:18009e3041ea | 30 | /** |
aspeteRakete | 1:18009e3041ea | 31 | * Switch this off to disable matching against a pattern with 2 stars |
aspeteRakete | 1:18009e3041ea | 32 | */ |
aspeteRakete | 1:18009e3041ea | 33 | //#define OSC_MATCH_ENABLE_2STARS 1 |
aspeteRakete | 1:18009e3041ea | 34 | /** |
aspeteRakete | 1:18009e3041ea | 35 | * Switch this off to disable matching against a pattern with more than 2 stars which will |
aspeteRakete | 1:18009e3041ea | 36 | * be done recursively. |
aspeteRakete | 1:18009e3041ea | 37 | */ |
aspeteRakete | 1:18009e3041ea | 38 | //#define OSC_MATCH_ENABLE_NSTARS 1 |
aspeteRakete | 1:18009e3041ea | 39 | |
aspeteRakete | 1:18009e3041ea | 40 | /** |
aspeteRakete | 1:18009e3041ea | 41 | * Return code for osc_match() that indicates that the entire address was successfully matched |
aspeteRakete | 1:18009e3041ea | 42 | */ |
aspeteRakete | 1:18009e3041ea | 43 | #define OSC_MATCH_ADDRESS_COMPLETE 1 |
aspeteRakete | 1:18009e3041ea | 44 | |
aspeteRakete | 1:18009e3041ea | 45 | /** |
aspeteRakete | 1:18009e3041ea | 46 | * Return code for osc_match() that indicates that the entire pattern was successfully matched |
aspeteRakete | 1:18009e3041ea | 47 | */ |
aspeteRakete | 1:18009e3041ea | 48 | #define OSC_MATCH_PATTERN_COMPLETE 2 |
aspeteRakete | 1:18009e3041ea | 49 | /* |
aspeteRakete | 1:18009e3041ea | 50 | typedef struct _osc_callback { |
aspeteRakete | 1:18009e3041ea | 51 | const char* address; // Address |
aspeteRakete | 1:18009e3041ea | 52 | struct _osc_callback *child; // RAM |
aspeteRakete | 1:18009e3041ea | 53 | struct _osc_callback *sibling; // RAM |
aspeteRakete | 1:18009e3041ea | 54 | struct _osc_callback *parent; // RAM |
aspeteRakete | 1:18009e3041ea | 55 | int callback; // ROM |
aspeteRakete | 1:18009e3041ea | 56 | } osc_callback; |
aspeteRakete | 1:18009e3041ea | 57 | */ |
aspeteRakete | 1:18009e3041ea | 58 | |
aspeteRakete | 1:18009e3041ea | 59 | /** |
aspeteRakete | 1:18009e3041ea | 60 | * Match a pattern against an address. In the case of a partial match, pattern_offset |
aspeteRakete | 1:18009e3041ea | 61 | * and address_offset will contain the number of bytes into their respective strings |
aspeteRakete | 1:18009e3041ea | 62 | * where the match failed. |
aspeteRakete | 1:18009e3041ea | 63 | * |
aspeteRakete | 1:18009e3041ea | 64 | * @param pattern The pattern to match |
aspeteRakete | 1:18009e3041ea | 65 | * @param address The address to match |
aspeteRakete | 1:18009e3041ea | 66 | * @param pattern_offset The number of bytes into the pattern that were matched successfully |
aspeteRakete | 1:18009e3041ea | 67 | * @param address_offset The number of bytes into the address that were matched successfully |
aspeteRakete | 1:18009e3041ea | 68 | * @return 0 if the match failed altogether, or an or'd combination of OSC_MATCH_ADDRESS_COMPLETE and |
aspeteRakete | 1:18009e3041ea | 69 | * OSC_MATCH_PATTERN_COMPLETE. |
aspeteRakete | 1:18009e3041ea | 70 | */ |
aspeteRakete | 1:18009e3041ea | 71 | int osc_match(const char *pattern, const char *address, int *pattern_offset, int *address_offset); |
aspeteRakete | 1:18009e3041ea | 72 | |
aspeteRakete | 1:18009e3041ea | 73 | #ifdef __cplusplus |
aspeteRakete | 1:18009e3041ea | 74 | } |
aspeteRakete | 1:18009e3041ea | 75 | #endif |
aspeteRakete | 1:18009e3041ea | 76 | |
aspeteRakete | 1:18009e3041ea | 77 | #endif // __OSC_MATCH_H__ |