Debian Codegraph @

faudiostream/architecture/faust/misc.h

raw symbols SCIP
1 /************************************************************************
2 ************************************************************************
3 FAUST Architecture File
4 Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale
5 ---------------------------------------------------------------------
6 This Architecture section is free software; you can redistribute it
7 and/or modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 3 of
9 the License, or (at your option) any later version.
10
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.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; If not, see <http://www.gnu.org/licenses/>.
18
19 ************************************************************************
20 ************************************************************************/
21
22 #ifndef __misc__
23 #define __misc__
24
25 #include <map>
26 #include <string.h>
27 #include <stdlib.h>
28
29 #include "faust/gui/meta.h"
30
31 struct XXXX_Meta : std::map<const char*, const char*>
32 {
33 void declare(const char* key, const char* value) { (*this)[key]=value; }
34 };
35
36 struct MY_Meta : Meta, std::map<const char*, const char*>
37 {
38 void declare(const char* key, const char* value) { (*this)[key]=value; }
39 };
40
41 inline int lsr(int x, int n) { return int(((unsigned int)x) >> n); }
42 inline int int2pow2(int x) { int r=0; while ((1<<r)<x) r++; return r; }
43
44 long lopt(char *argv[], const char *name, long def)
45 {
46 int i;
47 for (i = 0; argv[i]; i++) if (!strcmp(argv[i], name)) return atoi(argv[i+1]);
48 return def;
49 }
50
51 char* lopts(char *argv[], const char *name, char* def)
52 {
53 int i;
54 for (i = 0; argv[i]; i++) if (!strcmp(argv[i], name)) return argv[i+1];
55 return def;
56 }
57 #endif
58