My Project
Loading...
Searching...
No Matches
feOptGen.cc
Go to the documentation of this file.
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}
int i
Definition: cfEzgcd.cc:132
const char SHORT_OPTS_STRING[]
Definition: feOptGen.cc:17
int main()
Definition: feOptGen.cc:25
EXTERN_VAR struct fe_option feOptSpec[]
Definition: feOpt.h:17
char * name
Definition: fegetopt.h:83
#define NULL
Definition: omList.c:12
int status int fd
Definition: si_signals.h:59
int name
New type name for int.
Definition: templateForC.h:21