source: git/Singular/feOpt.h @ 31bf3a

fieker-DuValspielwiese
Last change on this file since 31bf3a was a3bc95e, checked in by Hans Schönemann <hannes@…>, 23 years ago
*hannes: namespaces ->ns git-svn-id: file:///usr/local/Singular/svn/trunk@5651 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[c06a32]1#ifndef FEOPTS_H
2#define FEOPTS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
[a3bc95e]6/* $Id: feOpt.h,v 1.7 2001-10-09 16:35:58 Singular Exp $ */
[c06a32]7/*
8* ABSTRACT: Declarations for working with Options
9*/
10
11#include "fegetopt.h"
12
13extern const char SHORT_OPTS_STRING[];
[a3bc95e]14#define LONG_OPTION_RETURN 13
[c06a32]15
[2272c33]16/* specifies format of options */
[c06a32]17extern struct fe_option feOptSpec[];
18
19#ifndef GENERATE_OPTION_INDEX
20
[2272c33]21/* provides feOptIndex enum type for fast accesses to feOptSpec */
[b7b08c]22#if ! defined(GENTABLE) && ! defined(GENERATE_DEPEND)
[c06a32]23#ifdef ESINGULAR
24#include "feOptES.inc"
[ef0124]25#elif defined(TSINGULAR)
26#include "feOptTS.inc"
[c06a32]27#else
28#include "feOpt.inc"
29#endif
30#else
31typedef enum {FE_OPT_UNDEF}  feOptIndex;
32#endif
33
[2272c33]34#ifdef __cplusplus
35extern "C" {
36#endif
37
38void* feGetOptValue(feOptIndex opt);
[a3bc95e]39
[2272c33]40
41#ifdef __cplusplus
42}
43
[c06a32]44inline void* feOptValue(feOptIndex opt)
45{
46  return feOptSpec[(int)opt].value;
47}
48inline int feOptValue(feOptIndex opt, char** val)
49{
[a3bc95e]50  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type == feOptString)
[c06a32]51  {
52    *val = (char*) feOptSpec[(int)opt].value;
53    return TRUE;
54  }
55  *val = NULL;
56  return FALSE;
57}
58inline int feOptValue(feOptIndex opt, int* val)
59{
[a3bc95e]60  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type != feOptString)
[c06a32]61  {
62    *val = (int) feOptSpec[(int)opt].value;
63    return TRUE;
64  }
65  *val = 0;
66  return FALSE;
67}
[a3bc95e]68
[c06a32]69// maps name to otions
70feOptIndex feGetOptIndex(const char* name);
71feOptIndex feGetOptIndex(int optc);
72
73// Setting option values:
74// Return: NULL -- everything ok
75//         "error-string" on error
76
77// opt->type must be feOptInt or feOptBool
78char* feSetOptValue(feOptIndex opt, int optarg);
79// for opt->type != feOptString, optarg is converted
80// to an int
81char* feSetOptValue(feOptIndex opt, char* optarg);
82
83void fePrintOptValues();
84
[2272c33]85#endif /* __cplusplus */
86
87#endif /* ! GENERATE_OPTION_INDEX */
[c06a32]88
[2272c33]89#endif /*  FEOPTS_H */
Note: See TracBrowser for help on using the repository browser.