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