source: git/Singular/feOptGen.cc @ aee346d

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