source: git/Singular/feOpt.h @ 167a15

fieker-DuValspielwiese
Last change on this file since 167a15 was 3ad58c2, checked in by Hans Schoenemann <hannes@…>, 2 years ago
moved Singular/fegetopt.* -> resources/fegetopt.*
  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[e9fe05]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
[3ad58c2]10#include "resources/fegetopt.h"
[e28fc4]11
[fb1675]12#include "Singular/feOptTab.h"
[e9fe05]13
14extern const char SHORT_OPTS_STRING[];
15
16/* specifies format of options */
[a3f0fea]17EXTERN_VAR struct fe_option feOptSpec[];
[e9fe05]18
19/* provides feOptIndex enum type for fast accesses to feOptSpec */
[79c035]20#if ! defined(GENERATE_DEPEND)
[e8a9f3]21
22# ifdef ESINGULAR
[fb1675]23#  include "Singular/feOptES.inc"
[e8a9f3]24# elif defined(TSINGULAR)
[fb1675]25#  include "Singular/feOptTS.inc"
[e8a9f3]26# else
[fb1675]27#  include "Singular/feOpt.inc"
[e8a9f3]28# endif
29
[e9fe05]30#else
31typedef enum {FE_OPT_UNDEF}  feOptIndex;
32#endif
33
[bd795d]34
35void feOptHelp(const char* name);
[ba6841]36void feOptDumpVersionTuple(void);
[bd795d]37
[e9fe05]38#ifdef __cplusplus
39
[fc2f76]40static inline void* feOptValue(feOptIndex opt)
[e9fe05]41{
42  return feOptSpec[(int)opt].value;
43}
44inline int feOptValue(feOptIndex opt, char** val)
45{
46  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type == feOptString)
47  {
48    *val = (char*) feOptSpec[(int)opt].value;
49    return TRUE;
50  }
51  *val = NULL;
52  return FALSE;
53}
54inline int feOptValue(feOptIndex opt, int* val)
55{
56  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type != feOptString)
57  {
58    *val = (int) ((long)(feOptSpec[(int)opt].value));
59    return TRUE;
60  }
61  *val = 0;
62  return FALSE;
63}
64
65// maps name to otions
66feOptIndex feGetOptIndex(const char* name);
67feOptIndex feGetOptIndex(int optc);
68
69// Setting option values:
70// Return: NULL -- everything ok
71//         "error-string" on error
72
73// opt->type must be feOptInt or feOptBool
[0ec43a]74const char* feSetOptValue(feOptIndex opt, int optarg);
[e9fe05]75// for opt->type != feOptString, optarg is converted
76// to an int
[0ec43a]77const char* feSetOptValue(feOptIndex opt, char* optarg);
[e9fe05]78
79void fePrintOptValues();
80
81#endif /* __cplusplus */
82
83#endif /*  FEOPTS_H */
Note: See TracBrowser for help on using the repository browser.