2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 A PyrSymbol is a unique string that resides in a global hash table.
38 long index
; // index in row table or primitive table
39 struct PyrClass
*classobj
; // pointer to class with this name.
40 char *source
; // source code for sym_Filename; used only during compilation.
42 struct classdep
*classdep
;
56 // following function lifted from liblo: http://sourceforge.net/projects/liblo/
58 /* Open SoundControl kit in C++ */
59 /* Copyright (C) 2002-2004 libOSC++ contributors. See AUTHORS */
61 /* This library is free software; you can redistribute it and/or */
62 /* modify it under the terms of the GNU Lesser General Public */
63 /* License as published by the Free Software Foundation; either */
64 /* version 2.1 of the License, or (at your option) any later version. */
66 /* This library is distributed in the hope that it will be useful, */
67 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
68 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
69 /* Lesser General Public License for more details. */
71 /* You should have received a copy of the GNU Lesser General Public */
72 /* License along with this library; if not, write to the Free Software */
73 /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
75 /* For questions regarding this program contact */
76 /* Daniel Holth <dholth@fastmail.fm> or visit */
77 /* http://wiretap.stetson.edu/ */
79 /* In the sprit of the public domain, my modifications to this file are also */
80 /* dedicated to the public domain. Daniel Holth, Oct. 2004 */
84 * 2004-10-29 Import, convert to C++, begin OSC syntax changes. -dwh
85 * OSC syntax changes are now working, needs more testing.
89 // Original header and syntax:
92 * robust glob pattern matcher
93 * ozan s. yigit/dec 1994
97 * * matches zero or more characters
98 * ? matches any single character
99 * [set] matches any character in the set
100 * [^set] matches any character NOT in the set
101 * where a set is a group of characters or ranges. a range
102 * is written as two characters seperated with a hyphen: a-z denotes
103 * all characters between a to z inclusive.
104 * [-set] set matches a literal hypen and any character in the set
105 * []set] matches a literal close bracket and any character in the set
107 * char matches itself except where char is '*' or '?' or '['
108 * \char matches char, including any pattern character
111 * a*c ac abc abbc ...
112 * a?c acc abc aXc ...
113 * a[a-z]c aac abc acc ...
114 * a[-a-z]c a-c aac abc ...
117 * Revision 1.1 2004/11/19 23:00:57 theno23
118 * Added lo_send_timestamped
120 * Revision 1.3 1995/09/14 23:24:23 oz
121 * removed boring test/main code.
123 * Revision 1.2 94/12/11 10:38:15 oz
124 * cset code fixed. it is now robust and interprets all
125 * variations of cset [i think] correctly, including [z-a] etc.
127 * Revision 1.1 94/12/08 12:45:23 oz
133 #define lo_NEGATE '!'
143 inline int lo_pattern_match(const char *str
, const char *p
)
150 if (!*str
&& *p
!= '*')
156 while (*p
== '*' && *p
!= '/')
162 // if (*p != '?' && *p != '[' && *p != '\\')
163 if (*p
!= '?' && *p
!= '[' && *p
!= '{')
164 while (*str
&& *p
!= *str
)
168 if (lo_pattern_match(str
, p
))
179 * set specification is inclusive, that is [a-z] is a, z and
180 * everything in between. this means [z-a] may be interpreted
181 * as a set that contains z, a and nothing in between.
193 while (!match
&& (c
= *p
++)) {
196 if (*p
== '-') { /* c-c */
200 if (*str
== c
|| *str
== *p
||
201 (*str
> c
&& *str
< *p
))
208 } else { /* cc or c] */
222 * if there is a match, skip past the cset and continue on
224 while (*p
&& *p
!= ']')
226 if (!*p
++) /* oops! */
231 * {astring,bstring,cstring}
235 // *p is now first character in the {brace list}
236 const char *place
= str
; // to backtrack
237 const char *remainder
= p
; // to forwardtrack
239 // find the end of the brace list
240 while (*remainder
&& *remainder
!= '}')
242 if (!*remainder
++) /* oops! */
249 if (lo_pattern_match(str
, remainder
)) {
252 // backtrack on test string
259 } else if (c
== '}') {
260 // continue normal pattern matching
263 str
--; // str is incremented again below
265 } else if (c
== *str
) {
267 if (!*str
&& *remainder
)
269 } else { // skip to next comma
271 while (*p
!= ',' && *p
!= '}' && *p
)
275 else if (*p
== '}') {
285 /* Not part of OSC pattern matching