summarylogtreecommitdiffstats
path: root/fix_config.patch
blob: bec246a7f2c90971da7eb4cbd532d9efede2b928 (plain)
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
diff -Naur -x .git easea.old/CMakeLists.txt easea.new/CMakeLists.txt
--- easea.old/CMakeLists.txt	2022-02-05 13:25:32.186148420 +0100
+++ easea.new/CMakeLists.txt	2022-02-05 13:55:35.508857292 +0100
@@ -6,8 +6,7 @@
 set(PROJECT_VER_MAJOR 2)
 set(PROJECT_VER_MINOR 20)
 set(PROJECT_VER_PATCH 0)
-#CONFIGURE_FILE(config.h.in libeasea/include/config.h)
-#INCLUDE_DIRECTORIES(${CMAKE_CURRENT_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/libeasea/include)
 
 message("-- PROJECT NAME: ${PROJECT_NAME}")
 message("-- PROJECT VERSION: ${PROJECT_VER}")
@@ -16,10 +15,9 @@
 
 SET(CMAKE_STATIC_LIBRARY_PREFIX="")
 INCLUDE_DIRECTORIES(${PROJECT_BINARY_BIN})
-INCLUDE_DIRECTORIES(libeasea/include cxxopts)
+INCLUDE_DIRECTORIES(libeasea/include)
 INCLUDE_DIRECTORIES(libeasna/include)
-
-set(OMP_NUM_THREADS 1)
+INCLUDE_DIRECTORIES(cxxopts)
 
 option(USE_OPENMP "If available, use OpenMP for parallelization." ON)
 
@@ -34,9 +32,6 @@
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
 endif ()
 
-CONFIGURE_FILE(config.h.in libeasea/include/config.h)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_DIR})
-
 SET(CMAKE_CONFIGURATION_TYPES "Release" CACHE STRING "" FORCE)
 
 # Creation of a static library for EASEA that will be linked to the main program easena
@@ -67,22 +62,22 @@
 FIND_PACKAGE(BISON)
 FLEX_TARGET( EaseaLexer 
         compiler/EaseaLex.l 
-        compiler/EaseaLex.cpp
+	${CMAKE_SOURCE_DIR}/compiler/EaseaLex.cpp
 )
 BISON_TARGET( EaseaParser
         compiler/EaseaParse.y 
-        compiler/EaseaParse.cpp 
+	${CMAKE_SOURCE_DIR}/compiler/EaseaParse.cpp 
         COMPILE_FLAGS -d
         DEFINES_FILE compiler/EaseaParse.hpp
 )
 FLEX_TARGET( NeuralLexer 
         compiler/NeuralLex.l 
-        compiler/NeuralLex.cpp
+        ${CMAKE_SOURCE_DIR}/compiler/NeuralLex.cpp
         DEFINES_FILE compiler/NeuralLex.h
 )
 BISON_TARGET( NeuralParser
         compiler/NeuralParse.y 
-        compiler/NeuralParse.cpp 
+        ${CMAKE_SOURCE_DIR}/compiler/NeuralParse.cpp 
         COMPILE_FLAGS -d
         DEFINES_FILE compiler/NeuralParse.hpp
 )
@@ -102,6 +97,8 @@
 SET_TARGET_PROPERTIES(easena PROPERTIES COMPILE_FLAGS "-std=c++14 -w -Wno-deprecated -Wno-write-strings -fmessage-length=0")
 TARGET_LINK_LIBRARIES(easena libeasea libeasna)
 ADD_CUSTOM_COMMAND(TARGET easena POST_BUILD 
+	COMMAND $(CMAKE_COMMAND) -E make_directory libeasna
+	COMMAND $(CMAKE_COMMAND) -E make_directory libeasea
         COMMAND $(CMAKE_COMMAND) -E copy libeasea.a libeasea/
         COMMAND $(CMAKE_COMMAND) -E copy libeasna.a libeasna/
 )
@@ -122,6 +119,8 @@
 
 ADD_SUBDIRECTORY(Test/xor_mnist)
 
+CONFIGURE_FILE(config.h.in libeasea/include/config.h)
+
 ## OUTDATED !
 ## IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
 ## INCLUDE(InstallRequiredSystemLibraries)
diff -Naur -x .git easea.old/Test/xor_mnist/main.cpp easea.new/Test/xor_mnist/main.cpp
--- easea.old/Test/xor_mnist/main.cpp	2022-02-05 13:25:32.186148420 +0100
+++ easea.new/Test/xor_mnist/main.cpp	2022-02-05 13:35:21.053789455 +0100
@@ -18,6 +18,7 @@
 #include <fstream>
 #include <sstream>
 #include <vector>
+#include <limits>
 
 #include "mnist/mnist_reader.hpp"
 
diff -Naur -x .git easea.old/compiler/Easea.h easea.new/compiler/Easea.h
--- easea.old/compiler/Easea.h	2022-02-05 13:25:32.186148420 +0100
+++ easea.new/compiler/Easea.h	2022-02-05 13:35:21.053789455 +0100
@@ -81,6 +81,31 @@
 extern unsigned iMAX_INIT_TREE_D,iMIN_INIT_TREE_D,iMAX_TREE_D,iNB_GPU,iPRG_BUF_SIZE,iMAX_TREE_DEPTH,iNO_FITNESS_CASES;
 
 // Prototypes
-extern int mystricmp(const char *, const char *);
+static inline char  mytolower(char c) {
+  return ((c>=65)&&(c<=90)) ? c+=32:c;
+}
+
+static inline int mystricmp(const char *string1, const char *string2){
+  int i;
+  for (i=0; string1[i]&&string2[i];i++){
+    if (mytolower(string1[i])<mytolower(string2[i])) return -(i+1);
+    if (mytolower(string1[i])>mytolower(string2[i])) return i+1;
+  }
+  if (string2[i]) return  -(i+1);
+  if (string1[i]) return  i+1;
+  return 0;
+}                                  
+
+static inline int isLetter(char c){ 
+  if (((c>=65)&&(c<=90))||((c>=97)&&(c<=122))) return 1;
+  if ((c==45)||(c==46)||(c==95)) return 1;
+  return 0;
+}
+
+static inline int isFigure(char c){ 
+  if ((c>=48)&&(c<=57)) return 1;
+  return 0;
+}
+
 
 #endif
diff -Naur -x .git easea.old/compiler/EaseaLex.l easea.new/compiler/EaseaLex.l
--- easea.old/compiler/EaseaLex.l	2022-02-05 13:25:32.186148420 +0100
+++ easea.new/compiler/EaseaLex.l	2022-02-05 13:35:21.053789455 +0100
@@ -2475,33 +2475,6 @@
 
 %%
 		       /////////////////////////////////////////////////////////////////////////////
-
-inline char  mytolower(char c) {
-  return ((c>=65)&&(c<=90)) ? c+=32:c;
-}
-
-inline int mystricmp(const char *string1, const char *string2){
-  int i;
-  for (i=0; string1[i]&&string2[i];i++){
-    if (mytolower(string1[i])<mytolower(string2[i])) return -(i+1);
-    if (mytolower(string1[i])>mytolower(string2[i])) return i+1;
-  }
-  if (string2[i]) return  -(i+1);
-  if (string1[i]) return  i+1;
-  return 0;
-}                                  
-
-inline int isLetter(char c){ 
-  if (((c>=65)&&(c<=90))||((c>=97)&&(c<=122))) return 1;
-  if ((c==45)||(c==46)||(c==95)) return 1;
-  return 0;
-}
-
-inline int isFigure(char c){ 
-  if ((c>=48)&&(c<=57)) return 1;
-  return 0;
-}
-
 /////////////////////////////////////////////////////////////////////////////
 // EASEALexer commands
 
diff -Naur -x .git easea.old/compiler/EaseaSym.cpp easea.new/compiler/EaseaSym.cpp
--- easea.old/compiler/EaseaSym.cpp	2022-02-05 13:25:32.186148420 +0100
+++ easea.new/compiler/EaseaSym.cpp	2022-02-05 13:35:21.053789455 +0100
@@ -42,19 +42,6 @@
 //   else pHead=new CListItem<T>(pCurrent,NewObject);
 //   }
 
-template <class T> CListItem<T> *CLList<T>::walkToNextItem()
-{
-	if (pNextItem==NULL) return NULL;
-	if (pNextItem==pHead)
-	{
-		pNextItem=pHead->pNext;
-		return pHead;
-	}
-	pCurrentObject=pNextItem;
-	pNextItem=pNextItem->pNext;
-	return pCurrentObject;
-}
-
 /////////////////////////////////////////////////////////////////////////////
 // symbol construction/destruction
 
diff -Naur -x .git easea.old/compiler/EaseaSym.h easea.new/compiler/EaseaSym.h
--- easea.old/compiler/EaseaSym.h	2022-02-05 13:25:32.186148420 +0100
+++ easea.new/compiler/EaseaSym.h	2022-02-05 13:35:21.053789455 +0100
@@ -67,6 +67,21 @@
   CListItem<T> *remove(T *p);
   };
 
+/* Need to be defined in Header !! */
+template <class T> CListItem<T> *CLList<T>::walkToNextItem()
+{
+	if (pNextItem==NULL) return NULL;
+	if (pNextItem==pHead)
+	{
+		pNextItem=pHead->pNext;
+		return pHead;
+	}
+	pCurrentObject=pNextItem;
+	pNextItem=pNextItem->pNext;
+	return pCurrentObject;
+}
+
+
  /////////////////////////////////////////////////////////////////////////////
 // Symbol
 
diff -Naur -x .git easea.old/config.h.in easea.new/config.h.in
--- easea.old/config.h.in	2022-02-05 13:24:40.355807186 +0100
+++ easea.new/config.h.in	2022-02-05 13:54:17.444992052 +0100
@@ -6,9 +6,6 @@
 #cmakedefine PROJECT_VER_MINOR @PROJECT_VER_MINOR@
 #cmakedefine PROJECT_VER_PATCH @PROJECT_VER_PATCH@
 
-#cmakedefine OMP_NUM_THREADS @OMP_NUM_THREADS@
-
-
 #cmakedefine USE_OPENMP
 
 #ifdef USE_OPENMP
diff -Naur -x .git easea.old/libeasea/include/third_party/cxxopts/cxxopts.hpp easea.new/libeasea/include/third_party/cxxopts/cxxopts.hpp
--- easea.old/libeasea/include/third_party/cxxopts/cxxopts.hpp	2022-02-05 13:25:32.186148420 +0100
+++ easea.new/libeasea/include/third_party/cxxopts/cxxopts.hpp	2022-02-05 13:35:21.053789455 +0100
@@ -37,6 +37,7 @@
 #include <unordered_map>
 #include <unordered_set>
 #include <vector>
+#include <limits>
 
 #ifdef __cpp_lib_optional
 #include <optional>