source: git/Singular/feOptGen.cc

spielwiese
Last change on this file was 117e00, checked in by Hans Schoenemann <hannes@…>, 6 years ago
removed unused system includes, math.h ->cmath for .cc files
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/*
5* ABSTRACT: Implementation of option business
6*/
7
8
9#include "kernel/mod2.h"
10
11#define FE_OPT_STRUCTURE
12
13#include "feOptGen.h"
14
15#include "fehelp.h"
16
17const char SHORT_OPTS_STRING[] = "bdhqstvxec:r:u:";
18
19//////////////////////////////////////////////////////////////
20//
21// Generation of feOptIndex
22//
23#include <stdio.h>
24#include <stdlib.h>
25int main()
26{
27  FILE* fd;
28#ifdef ESINGULAR
29  fd = fopen("feOptES.xx", "w");
30#elif defined(TSINGULAR)
31  fd = fopen("feOptTS.xx", "w");
32#else
33  fd = fopen("feOpt.xx", "w");
34#endif
35
36  if (fd == NULL) exit(1);
37
38  int i = 0;
39
40  fputs("typedef enum\n{\n", fd);
41
42  while (feOptSpec[i].name != NULL)
43  {
44    const char* name = feOptSpec[i].name;
45    fputs("FE_OPT_", fd);
46    while (*name != 0)
47    {
48      if (*name == '-')
49      {
50        putc('_', fd);
51      }
52      else if (*name >= 97 && *name <= 122)
53      {
54        putc(*name - 32, fd);
55      }
56      else
57      {
58        putc(*name, fd);
59      }
60      name++;
61    }
62    if (i == 0)
63    {
64      fputs("=0", fd);
65    }
66    i++;
67    fputs(",\n  ", fd);
68  }
69
70  fprintf(fd, "FE_OPT_UNDEF\n} feOptIndex;\n");
71  fclose(fd);
72#ifdef ESINGULAR
73  rename("feOptES.xx", "feOptES.inc");
74#elif defined(TSINGULAR)
75  rename("feOptTS.xx", "feOptTS.inc");
76#else
77  rename("feOpt.xx", "feOpt.inc");
78#endif
79  return(0);
80}
Note: See TracBrowser for help on using the repository browser.