Loading...
Searching...
No Matches
feOpt.h File Reference
`#include "resources/fegetopt.h"`
`#include "Singular/feOptTab.h"`
`#include "Singular/feOpt.inc"`

Go to the source code of this file.

## Functions

void | feOptHelp (const char *name)
void | feOptDumpVersionTuple (void)
static void * | feOptValue (feOptIndex opt)
int | feOptValue (feOptIndex opt, char **val)
int | feOptValue (feOptIndex opt, int *val)
feOptIndex | feGetOptIndex (const char *name)
feOptIndex | feGetOptIndex (int optc)
const char * | feSetOptValue (feOptIndex opt, int optarg)
const char * | feSetOptValue (feOptIndex opt, char *optarg)
void | fePrintOptValues ()

## Variables

const char | SHORT_OPTS_STRING []
EXTERN_VAR struct fe_option | feOptSpec []

## Function Documentation

## feGetOptIndex() [1/2]

feOptIndex feGetOptIndex | ( | const char * | name | ) |

Definition at line 104 of file feOpt.cc.

{
int opt = 0;
while (opt != (int) FE_OPT_UNDEF)
{
if (strcmp(feOptSpec[opt].name, name) == 0)
return (feOptIndex) opt;
opt = opt + 1;
}
return FE_OPT_UNDEF;
}
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
feOptSpec
EXTERN_VAR struct fe_option feOptSpec[]
Definition feOpt.h:17

## feGetOptIndex() [2/2]

feOptIndex feGetOptIndex | ( | int | optc | ) |

Definition at line 117 of file feOpt.cc.

{
int opt = 0;
if (optc == LONG_OPTION_RETURN) return FE_OPT_UNDEF;
while (opt != (int) FE_OPT_UNDEF)
{
if (feOptSpec[opt].val == optc)
return (feOptIndex) opt;
opt = opt + 1;
}
return FE_OPT_UNDEF;
}
LONG_OPTION_RETURN
#define LONG_OPTION_RETURN
Definition feOptTab.h:4

## feOptDumpVersionTuple()

void feOptDumpVersionTuple | ( | void |  | ) |

Definition at line 430 of file feOpt.cc.

{
printf("%s\n",VERSION);
}
VERSION
#define VERSION
Definition factoryconf.h:277

## feOptHelp()

void feOptHelp | ( | const char * | name | ) |

Definition at line 379 of file feOpt.cc.

{
int i = 0;
char tmp[60];
#if defined(ESINGULAR)
printf("ESingular starts up Singular within emacs;\n");
#elif defined(TSINGULAR)
printf("TSingular starts up Singular within a terminal window;\n");
#endif
printf("Singular is a Computer Algebra System (CAS) for Polynomial Computations.\n");
printf("Usage: %s [options] [file1 [file2 ...]]\n", name);
printf("Options:\n");
while (feOptSpec[i].name != 0)
{
if (feOptSpec[i].help != NULL
#ifdef SING_NDEBUG
&& *(feOptSpec[i].help) != '/'
#endif
)
{
if (feOptSpec[i].has_arg > 0)
{
if (feOptSpec[i].has_arg > 1)
snprintf(tmp,60, "%s[=%s]", feOptSpec[i].name, feOptSpec[i].arg_name);
else
snprintf(tmp,60, "%s=%s", feOptSpec[i].name, feOptSpec[i].arg_name);
printf(" %c%c --%-20s %s\n",
(feOptSpec[i].val != LONG_OPTION_RETURN ? '-' : ' '),
(feOptSpec[i].val != LONG_OPTION_RETURN ? feOptSpec[i].val : ' '),
tmp,
feOptSpec[i].help);
}
else
{
printf(" %c%c --%-20s %s\n",
(feOptSpec[i].val != LONG_OPTION_RETURN ? '-' : ' '),
(feOptSpec[i].val != LONG_OPTION_RETURN ? feOptSpec[i].val : ' '),
feOptSpec[i].name,
feOptSpec[i].help);
}
}
i++;
}
printf("\nFor more information, type `help;' from within Singular or visit\n");
printf("https://www.singular.uni-kl.de or consult the\n");
printf("Singular manual (available as on-line info or html manual).\n");
}
i
int i
Definition cfEzgcd.cc:132
SING_NDEBUG
#define SING_NDEBUG
Definition factoryconf.h:257
help
#define help
Definition libparse.cc:1230
NULL
#define NULL
Definition omList.c:12

## feOptValue() [1/3]

void * feOptValue | ( | feOptIndex | opt | ) |

inline static

Definition at line 40 of file feOpt.h.

{
return feOptSpec[(int)opt].value;
}

## feOptValue() [2/3]

int feOptValue | ( | feOptIndex | opt,
|  | char ** | val )

inline

Definition at line 44 of file feOpt.h.

{
if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type == feOptString)
{
*val = (char*) feOptSpec[(int)opt].value;
return TRUE;
}
*val = NULL;
return FALSE;
}
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
feOptString
@ feOptString
Definition fegetopt.h:77

## feOptValue() [3/3]

int feOptValue | ( | feOptIndex | opt,
|  | int * | val )

inline

Definition at line 54 of file feOpt.h.

{
if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type != feOptString)
{
*val = (int) ((long)(feOptSpec[(int)opt].value));
return TRUE;
}
*val = 0;
return FALSE;
}

## fePrintOptValues()

void fePrintOptValues | ( |  | ) |

Definition at line 344 of file feOpt.cc.

{
int i = 0;
while (feOptSpec[i].name != 0)
{
if (feOptSpec[i].help != NULL && feOptSpec[i].type != feOptUntyped
#ifndef SING_NDEBUG
&& *(feOptSpec[i].help) != '/'
#endif
)
{
if (feOptSpec[i].type == feOptString)
{
if (feOptSpec[i].value == NULL)
{
Print("// --%-15s\n", feOptSpec[i].name);
}
else
{
Print("// --%-15s \"%s\"\n", feOptSpec[i].name, (char*) feOptSpec[i].value);
}
}
else
{
Print("// --%-15s %d\n", feOptSpec[i].name, (int)(long)feOptSpec[i].value);
}
}
i++;
}
}
Print
#define Print
Definition emacs.cc:80
feOptUntyped
@ feOptUntyped
Definition fegetopt.h:77

## feSetOptValue() [1/2]

const char * feSetOptValue | ( | feOptIndex | opt,
|  | char * | optarg )

Definition at line 154 of file feOpt.cc.

{
if (opt == FE_OPT_UNDEF) return "option undefined";
if (feOptSpec[opt].type != feOptUntyped)
{
if (feOptSpec[opt].type != feOptString)
{
if (optarg != NULL)
{
errno = 0;
feOptSpec[opt].value = (void*) strtol(optarg, NULL, 10);
if (errno) return "invalid integer argument";
}
else
{
feOptSpec[opt].value = (void*) 0;
}
}
else
{
assume(feOptSpec[opt].type == feOptString);
if (feOptSpec[opt].set && feOptSpec[opt].value != NULL)
omFree(feOptSpec[opt].value);
if (optarg != NULL)
feOptSpec[opt].value = omStrDup(optarg);
else
feOptSpec[opt].value = NULL;
feOptSpec[opt].set = 1;
}
}
return feOptAction(opt);
}
feOptAction
static const char * feOptAction(feOptIndex opt)
Definition feOpt.cc:202
assume
#define assume(x)
Definition mod2.h:389
omStrDup
#define omStrDup(s)
Definition omAllocDecl.h:263
omFree
#define omFree(addr)
Definition omAllocDecl.h:261

## feSetOptValue() [2/2]

const char * feSetOptValue | ( | feOptIndex | opt,
|  | int | optarg )

Definition at line 188 of file feOpt.cc.

{
if (opt == FE_OPT_UNDEF) return "option undefined";
if (feOptSpec[opt].type != feOptUntyped)
{
if (feOptSpec[opt].type == feOptString)
return "option value needs to be an integer";
feOptSpec[opt].value = (void*)(long) optarg;
}
return feOptAction(opt);
}

## Variable Documentation

## feOptSpec

EXTERN_VAR struct fe_option feOptSpec[]

Definition at line 17 of file feOpt.h.

## SHORT_OPTS_STRING

const char SHORT_OPTS_STRING[]

extern

Definition at line 29 of file feOpt.cc.