source: git/Singular/feOpt.h @ f24b9c

spielwiese
Last change on this file since f24b9c was 534bf9, checked in by Yue Ren <ren@…>, 11 years ago
chg: removed 'extern "C"' around declaration of feOptHelp and feGetOptValue proposed fix from Hans declaring functions as C functions caused some problems during the compilation on cygwin systems because certain object files expected them to be c++ functions unsure why they were declared as C functions to begin with
  • Property mode set to 100644
File size: 1.8 KB
Line 
1#ifndef FEOPTS_H
2#define FEOPTS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/*
7* ABSTRACT: Declarations for working with Options
8*/
9
10#include <Singular/fegetopt.h>
11
12#include <Singular/feOptTab.h>
13
14extern const char SHORT_OPTS_STRING[];
15
16/* specifies format of options */
17extern struct fe_option feOptSpec[];
18
19/* provides feOptIndex enum type for fast accesses to feOptSpec */
20#if ! defined(GENERATE_DEPEND)
21
22# ifdef ESINGULAR
23#  include <Singular/feOptES.inc>
24# elif defined(TSINGULAR)
25#  include <Singular/feOptTS.inc>
26# else
27#  include <Singular/feOpt.inc>
28# endif
29
30#else
31typedef enum {FE_OPT_UNDEF}  feOptIndex;
32#endif
33
34
35void feOptHelp(const char* name);
36
37void* feGetOptValue(feOptIndex opt);
38
39
40#ifdef __cplusplus
41
42inline void* feOptValue(feOptIndex opt)
43{
44  return feOptSpec[(int)opt].value;
45}
46inline int feOptValue(feOptIndex opt, char** val)
47{
48  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type == feOptString)
49  {
50    *val = (char*) feOptSpec[(int)opt].value;
51    return TRUE;
52  }
53  *val = NULL;
54  return FALSE;
55}
56inline int feOptValue(feOptIndex opt, int* val)
57{
58  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type != feOptString)
59  {
60    *val = (int) ((long)(feOptSpec[(int)opt].value));
61    return TRUE;
62  }
63  *val = 0;
64  return FALSE;
65}
66
67// maps name to otions
68feOptIndex feGetOptIndex(const char* name);
69feOptIndex feGetOptIndex(int optc);
70
71// Setting option values:
72// Return: NULL -- everything ok
73//         "error-string" on error
74
75// opt->type must be feOptInt or feOptBool
76const char* feSetOptValue(feOptIndex opt, int optarg);
77// for opt->type != feOptString, optarg is converted
78// to an int
79const char* feSetOptValue(feOptIndex opt, char* optarg);
80
81void fePrintOptValues();
82
83#endif /* __cplusplus */
84
85#endif /*  FEOPTS_H */
Note: See TracBrowser for help on using the repository browser.