source: git/Singular/feOpt.h @ 599326

spielwiese
Last change on this file since 599326 was 599326, checked in by Kai Krüger <krueger@…>, 14 years ago
Anne, Kai, Frank: - changes to #include "..." statements to allow cleaner build structure - affected directories: omalloc, kernel, Singular - not yet done: IntergerProgramming git-svn-id: file:///usr/local/Singular/svn/trunk@13032 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.9 KB
Line 
1#ifndef FEOPTS_H
2#define FEOPTS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id$ */
7/*
8* ABSTRACT: Declarations for working with Options
9*/
10
11#include <kernel/fegetopt.h>
12
13extern const char SHORT_OPTS_STRING[];
14#define LONG_OPTION_RETURN 13
15
16/* specifies format of options */
17extern struct fe_option feOptSpec[];
18
19#ifndef GENERATE_OPTION_INDEX
20
21/* provides feOptIndex enum type for fast accesses to feOptSpec */
22#if ! defined(GENTABLE) && ! defined(GENERATE_DEPEND)
23#ifdef ESINGULAR
24#include <Singular/feOptES.inc>
25#elif defined(TSINGULAR)
26#include <Singular/feOptTS.inc>
27#else
28#include <Singular/feOpt.inc>
29#endif
30#else
31typedef enum {FE_OPT_UNDEF}  feOptIndex;
32#endif
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38void* feGetOptValue(feOptIndex opt);
39
40
41#ifdef __cplusplus
42}
43
44inline void* feOptValue(feOptIndex opt)
45{
46  return feOptSpec[(int)opt].value;
47}
48inline int feOptValue(feOptIndex opt, char** val)
49{
50  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type == feOptString)
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{
60  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type != feOptString)
61  {
62    *val = (int) ((long)(feOptSpec[(int)opt].value));
63    return TRUE;
64  }
65  *val = 0;
66  return FALSE;
67}
68
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
78const char* feSetOptValue(feOptIndex opt, int optarg);
79// for opt->type != feOptString, optarg is converted
80// to an int
81const char* feSetOptValue(feOptIndex opt, char* optarg);
82
83void fePrintOptValues();
84
85#endif /* __cplusplus */
86
87#endif /* ! GENERATE_OPTION_INDEX */
88
89#endif /*  FEOPTS_H */
Note: See TracBrowser for help on using the repository browser.