Loading...
Searching...
No Matches
feOpt.h
Go to the documentation of this file.
#ifndef FEOPTS_H
#define FEOPTS_H
/****************************************
* Computer Algebra System SINGULAR *
****************************************/
/*
* ABSTRACT: Declarations for working with Options
*/
#include "resources/fegetopt.h"
#include "Singular/feOptTab.h"
extern const char SHORT_OPTS_STRING[];
/* specifies format of options */
EXTERN_VAR struct fe_option feOptSpec[];
/* provides feOptIndex enum type for fast accesses to feOptSpec */
#if ! defined(GENERATE_DEPEND)
# ifdef ESINGULAR
# include "Singular/feOptES.inc"
# elif defined(TSINGULAR)
# include "Singular/feOptTS.inc"
# else
# include "Singular/feOpt.inc"
# endif
#else
typedef enum {FE_OPT_UNDEF} feOptIndex;
#endif
void feOptHelp(const char* name);
void feOptDumpVersionTuple(void);
#ifdef __cplusplus
static inline void* feOptValue(feOptIndex opt)
{
return feOptSpec[(int)opt].value;
}
inline int feOptValue(feOptIndex opt, char** val)
{
if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type == feOptString)
{
*val = (char*) feOptSpec[(int)opt].value;
return TRUE;
}
*val = NULL;
return FALSE;
}
inline int feOptValue(feOptIndex opt, int* val)
{
if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type != feOptString)
{
*val = (int) ((long)(feOptSpec[(int)opt].value));
return TRUE;
}
*val = 0;
return FALSE;
}
// maps name to options
feOptIndex feGetOptIndex(const char* name);
feOptIndex feGetOptIndex(int optc);
// Setting option values:
// Return: NULL -- everything ok
// "error-string" on error
// opt->type must be feOptInt or feOptBool
const char* feSetOptValue(feOptIndex opt, int optarg);
// for opt->type != feOptString, optarg is converted
// to an int
const char* feSetOptValue(feOptIndex opt, char* optarg);
void fePrintOptValues();
#endif /* __cplusplus */
#endif /* FEOPTS_H */
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
name
char name(const Variable &v)
Definition factory.h:189
feOptIndex
feOptIndex
Definition feOptGen.h:15
FE_OPT_UNDEF
@ FE_OPT_UNDEF
Definition feOptGen.h:15
feOptTab.h
SHORT_OPTS_STRING
const char SHORT_OPTS_STRING[]
Definition feOpt.cc:29
feOptValue
static void * feOptValue(feOptIndex opt)
Definition feOpt.h:40
feSetOptValue
const char * feSetOptValue(feOptIndex opt, int optarg)
Definition feOpt.cc:188
fePrintOptValues
void fePrintOptValues()
Definition feOpt.cc:344
feGetOptIndex
feOptIndex feGetOptIndex(const char *name)
Definition feOpt.cc:104
feOptSpec
EXTERN_VAR struct fe_option feOptSpec[]
Definition feOpt.h:17
feOptDumpVersionTuple
void feOptDumpVersionTuple(void)
Definition feOpt.cc:430
feOptHelp
void feOptHelp(const char *name)
Definition feOpt.cc:379
fegetopt.h
feOptString
@ feOptString
Definition fegetopt.h:77
fe_option::val
int val
Definition fegetopt.h:88
fe_option::type
feOptType type
Definition fegetopt.h:92
fe_option::value
void * value
Definition fegetopt.h:93
fe_option
Definition fegetopt.h:79
EXTERN_VAR
#define EXTERN_VAR
Definition globaldefs.h:6
NULL
#define NULL
Definition omList.c:12