source: git/Singular/feOpt.h @ 7fee876

fieker-DuValspielwiese
Last change on this file since 7fee876 was bd795d, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
improved build system in Singuar/: building of libparse and [TE]Singular ADD/CHG: distribute and install emacs/ (under $(datadir)/) CHG: moved fegetopt.{c,h} from kernel/ to Singular/ ADD: build and install Singular/[TE]Singular ADD: better Singular/libparse CHG: only build the static release and debug binaries Singular&Singularg by default!
  • 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/* $Id$ */
7/*
8* ABSTRACT: Declarations for working with Options
9*/
10
11#include <Singular/fegetopt.h>
12
13#include <Singular/feOptTab.h>
14
15extern const char SHORT_OPTS_STRING[];
16
17/* specifies format of options */
18extern struct fe_option feOptSpec[];
19
20/* provides feOptIndex enum type for fast accesses to feOptSpec */
21#if ! defined(GENERATE_DEPEND)
22
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
31#else
32typedef enum {FE_OPT_UNDEF}  feOptIndex;
33#endif
34
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40void feOptHelp(const char* name);
41
42void* feGetOptValue(feOptIndex opt);
43
44
45#ifdef __cplusplus
46}
47
48inline void* feOptValue(feOptIndex opt)
49{
50  return feOptSpec[(int)opt].value;
51}
52inline int feOptValue(feOptIndex opt, char** val)
53{
54  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type == feOptString)
55  {
56    *val = (char*) feOptSpec[(int)opt].value;
57    return TRUE;
58  }
59  *val = NULL;
60  return FALSE;
61}
62inline int feOptValue(feOptIndex opt, int* val)
63{
64  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type != feOptString)
65  {
66    *val = (int) ((long)(feOptSpec[(int)opt].value));
67    return TRUE;
68  }
69  *val = 0;
70  return FALSE;
71}
72
73// maps name to otions
74feOptIndex feGetOptIndex(const char* name);
75feOptIndex feGetOptIndex(int optc);
76
77// Setting option values:
78// Return: NULL -- everything ok
79//         "error-string" on error
80
81// opt->type must be feOptInt or feOptBool
82const char* feSetOptValue(feOptIndex opt, int optarg);
83// for opt->type != feOptString, optarg is converted
84// to an int
85const char* feSetOptValue(feOptIndex opt, char* optarg);
86
87void fePrintOptValues();
88
89#endif /* __cplusplus */
90
91#endif /*  FEOPTS_H */
Note: See TracBrowser for help on using the repository browser.