forked from Conedy/Conedy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconedy.cpp
162 lines (121 loc) · 2.74 KB
/
conedy.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#include "Parser.h"
#include <stdio.h>
#include "commandLineArguments.h"
#include "fullNetworkWithNodes.h"
#include "node.h"
#include "Scanner.h"
#include <fstream>
//#include "fullNetwork.h"
#if OPENGL
#include "glNetwork.h"
#endif
network *netCheat = 0;
void *pt2FunctionForGlutWrapper;
istream* Scanner::source;
void printDefines ()
{
cout <<"#";
#if CONDOR
cout << "CONDOR " ;
#endif
#if LDOUBLE
cout << "LDOUBLE ";
#elif DOUBLE
cout << "DOUBLE ";
#elif FLOAT
cout << "FLOAT ";
#endif
#if NOGSL
cout << "NOGSL ";
#endif
#if CALENDARQUEUE
cout << "CALENDARQUEUE ";
#endif
#if DEBUG
cout << "DEBUG ";
#endif
cout << endl;
}
int main ( int argc,char **argv )
{
Parser theParser;
#if CONDOR
uniqueNumber::initialize();
#if RECOMPILE
if (!system ("recompileConedy condor.recompile 2> /dev/null "))
{
cout << "Mission accomplished. You can restart your script now." << endl;
exit (1);
}
#endif
#elif RECOMPILE
if (!system ("recompileConedy conedy.recompile 2> /dev/null "))
{
cout << "Mission accomplished. You can restart your script now." << endl;
exit (1);
}
#endif
gslNoise::initialise(); // initialize random numbers
printDefines(); // print some CFLAGS present during compilation to standard out
commandLineArguments::initialize(argc, argv); // save command line arguments as static members of commandLineArguments for global access.
registerStandards(); // register standard values for all node parameters
vectorForInstruction::registerStandardValues();
// initialize all standard values for node parameters to the interpreter
params<baseType>::initialise ( &command::declare );
params<vector <baseType> >::initialise (&command::declare);
params< string >::initialise (&command::declare);
// interpret .conedyrc in the user's home directory
stringstream ss;
ss << getenv("HOME")<< "/.conedyrc";
ifstream *in = new ifstream (ss.str().c_str());
if (in->is_open())
{
try
{
Scanner::source = in;
Parser theParser;
theParser.parse();
#if CONDOR
vectorForInstruction::writeCondorSkript();
#endif
}
catch ( const char *c )
{
cerr << "Error:" << c << endl;
exit ( 1 );
}
}
// interpret either the data from a file or from standard in
string fileName;
Scanner::source = &cin;
if ( argc >= 2)
{
fileName = argv[1];
if (fileName != "stdin")
{
ifstream *is = new ifstream();
is->open ( fileName.c_str() );
if ( !is->is_open() )
{
cerr << "Error opening file";
exit ( 1 );
}
Scanner::source = is;
}
}
try
{
Parser theParser;
theParser.parse();
#if CONDOR
vectorForInstruction::writeCondorSkript();
#endif
}
catch ( const char *c )
{
cerr << "Error:" << c << endl;
exit ( 1 );
}
command::finalize();
return 0;
};