/usr/include/csound/cfgvar.h is in libcsound64-dev 1:5.17.6~dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | /*
cfgvar.h:
Copyright (C) 2005 Istvan Varga
This file is part of Csound.
The Csound Library is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Csound 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with Csound; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
*/
#ifndef CSOUND_CFGVAR_H
#define CSOUND_CFGVAR_H
#ifdef __cplusplus
extern "C" {
#endif
/* generic header structure */
typedef struct csCfgVariableHead_s {
union csCfgVariable_u *nxt; /* pointer to next structure in chain */
unsigned char *name; /* name of the variable */
void *p; /* pointer to value */
int type; /* type (e.g. CSOUNDCFG_INTEGER) */
int flags; /* bitwise OR of flags */
unsigned char *shortDesc; /* short description (NULL if none) */
unsigned char *longDesc; /* long description (NULL if none) */
} csCfgVariableHead_t;
/* int type */
typedef struct csCfgVariableInt_s {
union csCfgVariable_u *nxt; /* pointer to next structure in chain */
unsigned char *name; /* name of the variable */
int *p; /* pointer to value */
int type; /* type (CSOUNDCFG_INTEGER) */
int flags; /* bitwise OR of flags */
unsigned char *shortDesc; /* short description (NULL if none) */
unsigned char *longDesc; /* long description (NULL if none) */
int min; /* minimum allowed value */
int max; /* maximum allowed value */
} csCfgVariableInt_t;
/* boolean type (int with a value of 0 or 1) */
typedef struct csCfgVariableBoolean_s {
union csCfgVariable_u *nxt; /* pointer to next structure in chain */
unsigned char *name; /* name of the variable */
int *p; /* pointer to value */
int type; /* type (CSOUNDCFG_BOOLEAN) */
int flags; /* bitwise OR of flags */
unsigned char *shortDesc; /* short description (NULL if none) */
unsigned char *longDesc; /* long description (NULL if none) */
} csCfgVariableBoolean_t;
/* float type */
typedef struct csCfgVariableFloat_s {
union csCfgVariable_u *nxt; /* pointer to next structure in chain */
unsigned char *name; /* name of the variable */
float *p; /* pointer to value */
int type; /* type (CSOUNDCFG_FLOAT) */
int flags; /* bitwise OR of flags */
unsigned char *shortDesc; /* short description (NULL if none) */
unsigned char *longDesc; /* long description (NULL if none) */
float min; /* minimum allowed value */
float max; /* maximum allowed value */
} csCfgVariableFloat_t;
/* double type */
typedef struct csCfgVariableDouble_s {
union csCfgVariable_u *nxt; /* pointer to next structure in chain */
unsigned char *name; /* name of the variable */
double *p; /* pointer to value */
int type; /* type (CSOUNDCFG_DOUBLE) */
int flags; /* bitwise OR of flags */
unsigned char *shortDesc; /* short description (NULL if none) */
unsigned char *longDesc; /* long description (NULL if none) */
double min; /* minimum allowed value */
double max; /* maximum allowed value */
} csCfgVariableDouble_t;
/* MYFLT (float or double) type */
typedef struct csCfgVariableMYFLT_s {
union csCfgVariable_u *nxt; /* pointer to next structure in chain */
unsigned char *name; /* name of the variable */
MYFLT *p; /* pointer to value */
int type; /* type (CSOUNDCFG_MYFLT) */
int flags; /* bitwise OR of flags */
unsigned char *shortDesc; /* short description (NULL if none) */
unsigned char *longDesc; /* long description (NULL if none) */
MYFLT min; /* minimum allowed value */
MYFLT max; /* maximum allowed value */
} csCfgVariableMYFLT_t;
/* string type */
typedef struct csCfgVariableString_s {
union csCfgVariable_u *nxt; /* pointer to next structure in chain */
unsigned char *name; /* name of the variable */
char *p; /* value: array of 'maxlen' chars */
int type; /* type (CSOUNDCFG_STRING) */
int flags; /* bitwise OR of flags */
unsigned char *shortDesc; /* short description (NULL if none) */
unsigned char *longDesc; /* long description (NULL if none) */
int maxlen; /* maximum length + 1 */
} csCfgVariableString_t;
/* union of all variable types */
typedef union csCfgVariable_u {
csCfgVariableHead_t h;
csCfgVariableInt_t i;
csCfgVariableBoolean_t b;
csCfgVariableFloat_t f;
csCfgVariableDouble_t d;
csCfgVariableMYFLT_t m;
csCfgVariableString_t s;
} csCfgVariable_t;
/* types */
#define CSOUNDCFG_INTEGER 1
#define CSOUNDCFG_BOOLEAN 2
#define CSOUNDCFG_FLOAT 3
#define CSOUNDCFG_DOUBLE 4
#define CSOUNDCFG_MYFLT 5
#define CSOUNDCFG_STRING 6
/* flags */
#define CSOUNDCFG_POWOFTWO 0x00000001
/* error codes */
#define CSOUNDCFG_SUCCESS 0
#define CSOUNDCFG_INVALID_NAME -1
#define CSOUNDCFG_INVALID_TYPE -2
#define CSOUNDCFG_INVALID_FLAG -3
#define CSOUNDCFG_NULL_POINTER -4
#define CSOUNDCFG_TOO_HIGH -5
#define CSOUNDCFG_TOO_LOW -6
#define CSOUNDCFG_NOT_POWOFTWO -7
#define CSOUNDCFG_INVALID_BOOLEAN -8
#define CSOUNDCFG_MEMORY -9
#define CSOUNDCFG_STRING_LENGTH -10
#define CSOUNDCFG_LASTERROR -10
/* -------- interface functions -------- */
/* This pragma must come before all public function declarations */
#if (defined(macintosh) && defined(__MWERKS__))
# pragma export on
#endif
/**
* Create global configuration variable with the specified parameters.
* This function should be called by the host application only.
* name: name of the variable (may contain letters, digits, and _)
* p: pointer to variable
* type: type of variable, determines how 'p' is interpreted
* CSOUNDCFG_INTEGER: int*
* CSOUNDCFG_BOOLEAN: int* (value may be 0 or 1)
* CSOUNDCFG_FLOAT: float*
* CSOUNDCFG_DOUBLE: double*
* CSOUNDCFG_MYFLT: MYFLT*
* CSOUNDCFG_STRING: char* (should have enough space)
* flags: bitwise OR of flag values, currently only CSOUNDCFG_POWOFTWO
* is available, which requests CSOUNDCFG_INTEGER values to be
* power of two
* min: for CSOUNDCFG_INTEGER, CSOUNDCFG_FLOAT, CSOUNDCFG_DOUBLE, and
* CSOUNDCFG_MYFLT, a pointer to a variable of the type selected
* by 'type' that specifies the minimum allowed value.
* If 'min' is NULL, there is no minimum value.
* max: similar to 'min', except it sets the maximum allowed value.
* For CSOUNDCFG_STRING, it is a pointer to an int variable
* that defines the maximum length of the string (including the
* null character at the end) in bytes. This value is limited
* to the range 8 to 16384, and if max is NULL, it defaults to 256.
* shortDesc: a short description of the variable (may be NULL or an empty
* string if a description is not available)
* longDesc: a long description of the variable (may be NULL or an empty
* string if a description is not available)
* Return value is CSOUNDCFG_SUCCESS, or one of the following error codes:
* CSOUNDCFG_INVALID_NAME
* the specified name is invalid or is already in use
* CSOUNDCFG_MEMORY
* a memory allocation failure occured
* CSOUNDCFG_NULL_POINTER
* the 'p' pointer was NULL
* CSOUNDCFG_INVALID_TYPE
* CSOUNDCFG_INVALID_FLAG
* an invalid variable type was specified, or the flags value
* had unknown bits set
*/
#if 0
PUBLIC int
csoundCreateGlobalConfigurationVariable(const char *name,
void *p, int type, int flags,
void *min, void *max,
const char *shortDesc,
const char *longDesc);
#endif
/**
* This function is similar to csoundCreateGlobalConfigurationVariable(),
* except it creates a configuration variable specific to Csound instance
* 'csound', and is suitable for calling from the Csound library
* (in csoundPreCompile()) or plugins (in csoundModuleCreate()).
* The other parameters and return value are the same as in the case of
* csoundCreateGlobalConfigurationVariable().
*/
PUBLIC int
csoundCreateConfigurationVariable(CSOUND *csound, const char *name,
void *p, int type, int flags,
void *min, void *max,
const char *shortDesc,
const char *longDesc);
/**
* Copy a global configuration variable to a Csound instance.
* This function is experimental and may be subject to changes in
* future releases of the Csound library.
*/
#if 0
PUBLIC int csoundCopyGlobalConfigurationVariable(CSOUND *csound,
const char *name, void *p);
#endif
/**
* Copy all global configuration variables to the specified Csound instance.
* This function is experimental and may be subject to changes in
* future releases of the Csound library.
*/
#if 0
PUBLIC int csoundCopyGlobalConfigurationVariables(CSOUND *csound);
#endif
/**
* Set the value of a global configuration variable; should be called by the
* host application only.
* 'value' is a pointer of the same type as the 'p' pointer that was passed
* to csoundCreateGlobalConfigurationVariable(), depending on the type of
* the variable (integer, float, etc.).
* Return value is CSOUNDCFG_SUCCESS in case of success, or one of the
* following error codes:
* CSOUNDCFG_INVALID_NAME
* no configuration variable was found with the specified name
* CSOUNDCFG_NULL_POINTER
* the 'value' pointer was NULL
* CSOUNDCFG_TOO_LOW
* CSOUNDCFG_TOO_HIGH
* CSOUNDCFG_NOT_POWOFTWO
* CSOUNDCFG_INVALID_BOOLEAN
* CSOUNDCFG_STRING_LENGTH
* the specified value was invalid in some way
*/
#if 0
PUBLIC int csoundSetGlobalConfigurationVariable(const char *name,
void *value);
#endif
/**
* Set the value of a configuration variable of Csound instance 'csound'.
* The 'name' and 'value' parameters, and return value are the same as
* in the case of csoundSetGlobalConfigurationVariable().
*/
PUBLIC int csoundSetConfigurationVariable(CSOUND *csound, const char *name,
void *value);
/**
* Set the value of a global configuration variable, by parsing a string;
* should be called by the host application only.
* For boolean variables, any of the strings "0", "no", "off", and "false"
* will set the value to 0, and any of "1", "yes", "on", and "true" means a
* value of 1.
* Return value is CSOUNDCFG_SUCCESS in case of success, or one of the
* following error codes:
* CSOUNDCFG_INVALID_NAME
* no configuration variable was found with the specified name
* CSOUNDCFG_NULL_POINTER
* the 'value' pointer was NULL
* CSOUNDCFG_TOO_LOW
* CSOUNDCFG_TOO_HIGH
* CSOUNDCFG_NOT_POWOFTWO
* CSOUNDCFG_INVALID_BOOLEAN
* CSOUNDCFG_STRING_LENGTH
* the specified value was invalid in some way
*/
#if 0
PUBLIC int csoundParseGlobalConfigurationVariable(const char *name,
const char *value);
#endif
/**
* Set the value of a configuration variable of Csound instance 'csound',
* by parsing a string.
* The 'name' and 'value' parameters, and return value are the same as
* in the case of csoundParseGlobalConfigurationVariable().
*/
PUBLIC int csoundParseConfigurationVariable(CSOUND *csound, const char *name,
const char *value);
/**
* Return pointer to the global configuration variable with the specified
* name.
* The return value may be NULL if the variable is not found in the database.
*/
#if 0
PUBLIC csCfgVariable_t
*csoundQueryGlobalConfigurationVariable(const char *name);
#endif
/**
* Return pointer to the configuration variable of Csound instace 'csound'
* with the specified name.
* The return value may be NULL if the variable is not found in the database.
*/
PUBLIC csCfgVariable_t
*csoundQueryConfigurationVariable(CSOUND *csound, const char *name);
/**
* Create an alphabetically sorted list of all global configuration variables.
* Returns a pointer to a NULL terminated array of configuration variable
* pointers, or NULL on error.
* The caller is responsible for freeing the returned list with
* csoundDeleteCfgVarList(), however, the variable pointers in the list
* should not be freed.
*/
#if 0
PUBLIC csCfgVariable_t **csoundListGlobalConfigurationVariables(void);
#endif
/**
* Create an alphabetically sorted list of all configuration variables
* of Csound instance 'csound'.
* Returns a pointer to a NULL terminated array of configuration variable
* pointers, or NULL on error.
* The caller is responsible for freeing the returned list with
* csoundDeleteCfgVarList(), however, the variable pointers in the list
* should not be freed.
*/
PUBLIC csCfgVariable_t **csoundListConfigurationVariables(CSOUND *csound);
/**
* Release a configuration variable list previously returned
* by csoundListGlobalConfigurationVariables() or
* csoundListConfigurationVariables().
*/
PUBLIC void csoundDeleteCfgVarList(csCfgVariable_t **lst);
/**
* Remove the global configuration variable with the specified name
* from the database. Should be called by the host application only,
* and never by the Csound library or plugins.
* Return value is CSOUNDCFG_SUCCESS in case of success, or
* CSOUNDCFG_INVALID_NAME if the variable was not found.
*/
#if 0
PUBLIC int csoundDeleteGlobalConfigurationVariable(const char *name);
#endif
/**
* Remove the configuration variable of Csound instance 'csound' with the
* specified name from the database. Plugins need not call this, as all
* configuration variables are automatically deleted by csoundReset().
* Return value is CSOUNDCFG_SUCCESS in case of success, or
* CSOUNDCFG_INVALID_NAME if the variable was not found.
*/
PUBLIC int csoundDeleteConfigurationVariable(CSOUND *csound,
const char *name);
/**
* Remove all global configuration variables and free database.
* Should be called by the host application only, and never by the
* Csound library or plugins.
* Return value is CSOUNDCFG_SUCCESS in case of success.
*/
#if 0
PUBLIC int csoundDeleteAllGlobalConfigurationVariables(void);
#endif
/**
* Returns pointer to an error string constant for the specified
* CSOUNDCFG error code. The string is not translated.
*/
PUBLIC const char *csoundCfgErrorCodeToString(int errcode);
/* This pragma must come after all public function declarations */
#if (defined(macintosh) && defined(__MWERKS__))
# pragma export off
#endif
#ifdef __cplusplus
}
#endif
#endif /* CSOUND_CFGVAR_H */
|