source: git/Singular/feOpt.h @ b7b08c

spielwiese
Last change on this file since b7b08c was b7b08c, checked in by Olaf Bachmann <obachman@…>, 25 years ago
* us short exponent vectors in divisbility tests * AllocSizeOf * garbage collection * scanner/gmp: allow .0 and 1. input of reals git-svn-id: file:///usr/local/Singular/svn/trunk@3711 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.7 KB
Line 
1#ifndef FEOPTS_H
2#define FEOPTS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: feOpt.h,v 1.2 1999-10-14 14:27:03 obachman Exp $ */
7/*
8* ABSTRACT: Declarations for working with Options
9*/
10
11#include "mod2.h"
12#include "fegetopt.h"
13
14extern const char SHORT_OPTS_STRING[];
15#define LONG_OPTION_RETURN 13
16
17// specifies format of options
18extern struct fe_option feOptSpec[];
19
20#ifndef GENERATE_OPTION_INDEX
21
22// provides feOptIndex enum type for fast accesses to feOptSpec
23#if ! defined(GENTABLE) && ! defined(GENERATE_DEPEND)
24#ifdef ESINGULAR
25#include "feOptES.inc"
26#else
27#include "feOpt.inc"
28#endif
29#else
30typedef enum {FE_OPT_UNDEF}  feOptIndex;
31#endif
32
33inline void* feOptValue(feOptIndex opt)
34{
35  return feOptSpec[(int)opt].value;
36}
37inline int feOptValue(feOptIndex opt, char** val)
38{
39  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type == feOptString) 
40  {
41    *val = (char*) feOptSpec[(int)opt].value;
42    return TRUE;
43  }
44  *val = NULL;
45  return FALSE;
46}
47inline int feOptValue(feOptIndex opt, int* val)
48{
49  if (opt != FE_OPT_UNDEF && feOptSpec[(int)opt].type != feOptString) 
50  {
51    *val = (int) feOptSpec[(int)opt].value;
52    return TRUE;
53  }
54  *val = 0;
55  return FALSE;
56}
57 
58// maps name to otions
59feOptIndex feGetOptIndex(const char* name);
60feOptIndex feGetOptIndex(int optc);
61
62// Setting option values:
63// Return: NULL -- everything ok
64//         "error-string" on error
65
66// opt->type must be feOptInt or feOptBool
67char* feSetOptValue(feOptIndex opt, int optarg);
68// for opt->type != feOptString, optarg is converted
69// to an int
70char* feSetOptValue(feOptIndex opt, char* optarg);
71
72void fePrintOptValues();
73
74#endif // ! GENERATE_OPTION_INDEX
75
76#endif //  FEOPTS_H
Note: See TracBrowser for help on using the repository browser.