source: git/Singular/feOptGen.cc @ a04a05

spielwiese
Last change on this file since a04a05 was 6ce030f, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
removal of the $Id$ svn tag from everywhere NOTE: the git SHA1 may be used instead (only on special places) NOTE: the libraries Singular/LIB/*.lib still contain the marker due to our current use of svn
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/*
5* ABSTRACT: Implementation of option buisness
6*/
7
8#include <string.h>
9#include <stdlib.h>
10
11#include "config.h"
12#include <kernel/mod2.h>
13
14#define FE_OPT_STRUCTURE
15
16#include "feOptGen.h"
17
18#include "fehelp.h"
19
20const char SHORT_OPTS_STRING[] = "bdhqstvxec:r:u:";
21
22//////////////////////////////////////////////////////////////
23//
24// Generation of feOptIndex
25//
26#include <stdio.h>
27#include <unistd.h>
28#include <stdlib.h>
29int main()
30{
31  FILE* fd;
32#ifdef ESINGULAR
33  fd = fopen("feOptES.xx", "w");
34#elif defined(TSINGULAR)
35  fd = fopen("feOptTS.xx", "w");
36#else
37  fd = fopen("feOpt.xx", "w");
38#endif
39
40  if (fd == NULL) exit(1);
41
42  int i = 0;
43
44  fputs("typedef enum\n{\n", fd);
45
46  while (feOptSpec[i].name != NULL)
47  {
48    const char* name = feOptSpec[i].name;
49    fputs("FE_OPT_", fd);
50    while (*name != 0)
51    {
52      if (*name == '-')
53      {
54        putc('_', fd);
55      }
56      else if (*name >= 97 && *name <= 122)
57      {
58        putc(*name - 32, fd);
59      }
60      else
61      {
62        putc(*name, fd);
63      }
64      name++;
65    }
66    if (i == 0)
67    {
68      fputs("=0", fd);
69    }
70    i++;
71    fputs(",\n  ", fd);
72  }
73
74  fprintf(fd, "FE_OPT_UNDEF\n} feOptIndex;\n");
75  fclose(fd);
76#ifdef ESINGULAR
77  rename("feOptES.xx", "feOptES.inc");
78#elif defined(TSINGULAR)
79  rename("feOptTS.xx", "feOptTS.inc");
80#else
81  rename("feOpt.xx", "feOpt.inc");
82#endif
83  return(0);
84}
Note: See TracBrowser for help on using the repository browser.