Commit eb5dfb2b6330d666fab2c939efae4bfcd6ae7a0e

Authored by David Mayerich
1 parent abdb93f5

fixed linux compatibility issues

@@ -157,7 +157,7 @@ public: @@ -157,7 +157,7 @@ public:
157 return false; 157 return false;
158 } 158 }
159 159
160 - file.seekg(n * sizeof(T) + header, std::ios::beg); //point to the certain pixel 160 + file.seekg(n * sizeof(T) + binary<T>::header, std::ios::beg); //point to the certain pixel
161 for (unsigned i = 0; i < Z(); i++) 161 for (unsigned i = 0; i < Z(); i++)
162 { 162 {
163 file.read((char *)(p + i), sizeof(T)); 163 file.read((char *)(p + i), sizeof(T));
@@ -793,7 +793,7 @@ public: @@ -793,7 +793,7 @@ public:
793 if(mask[xy] != 0) P++; 793 if(mask[xy] != 0) P++;
794 } 794 }
795 } 795 }
796 - 796 +
797 T* band_image = (T*) malloc( XY * sizeof(T)); //allocate space for a single band 797 T* band_image = (T*) malloc( XY * sizeof(T)); //allocate space for a single band
798 798
799 unsigned long long i; //pixel index into the sifted array 799 unsigned long long i; //pixel index into the sifted array
@@ -808,7 +808,7 @@ public: @@ -808,7 +808,7 @@ public:
808 } 808 }
809 } 809 }
810 } 810 }
811 - 811 +
812 return true; 812 return true;
813 } 813 }
814 814
stim/parser/arguments.h
@@ -357,9 +357,9 @@ namespace stim{ @@ -357,9 +357,9 @@ namespace stim{
357 if(si != -1 && a == sections[si].index) 357 if(si != -1 && a == sections[si].index)
358 { 358 {
359 if(ansi) 359 if(ansi)
360 - ss<<std::endl<<std::left<<std::setfill('=')<<std::setw(col_width)<<std::string("w(col_width)<<std::string("\033[1;31m") + sections[si].name<<"\033[0m"<<std::endl;33[1;31m") + sections[si].name<<"w(col_width)<<std::string("\033[1;31m") + sections[si].name<<"\033[0m"<<std::endl;33[0m"<<std::endl; 360 + ss<<std::endl<<std::left<<std::setw(col_width)<<std::string("w(col_width)<<std::string("\033[1;31m") + sections[si].name<<"\033[0m"<<std::endl;33[1;31m") + sections[si].name<<"w(col_width)<<std::string("\033[1;31m") + sections[si].name<<"\033[0m"<<std::endl;33[0m"<<std::endl;
361 else 361 else
362 - ss<<std::endl<<std::left<<std::setfill('=')<<std::setw(col_width)<<sections[si].name<<std::endl; 362 + ss<<std::endl<<std::left<<std::setw(col_width)<<sections[si].name<<std::endl;
363 si++; 363 si++;
364 if(si == (int)sections.size()) si = -1; 364 if(si == (int)sections.size()) si = -1;
365 } 365 }
stim/parser/filename.h
@@ -69,7 +69,7 @@ protected: @@ -69,7 +69,7 @@ protected:
69 loc = unix_div(loc); 69 loc = unix_div(loc);
70 70
71 //determine the drive (if Windows) 71 //determine the drive (if Windows)
72 - drive = ""; 72 + drive = "";
73 #ifdef _WIN32 73 #ifdef _WIN32
74 //if the second character is a colon, the character right before it is the drive 74 //if the second character is a colon, the character right before it is the drive
75 if(loc[1] == ':'){ 75 if(loc[1] == ':'){
@@ -153,7 +153,7 @@ public: @@ -153,7 +153,7 @@ public:
153 } 153 }
154 154
155 //***************************************************************************************************************** 155 //*****************************************************************************************************************
156 - // output is the directory and the prefix and the extension of the files, which are looking for in that directory. 156 + // output is the directory and the prefix and the extension of the files, which are looking for in that directory.
157 std::string dir_fname(){ 157 std::string dir_fname(){
158 std::stringstream ss; 158 std::stringstream ss;
159 159
@@ -166,7 +166,7 @@ public: @@ -166,7 +166,7 @@ public:
166 ss<<STIM_FILENAME_DIV; 166 ss<<STIM_FILENAME_DIV;
167 } 167 }
168 168
169 - 169 +
170 for(unsigned int d = 0; d < path.size(); d++) 170 for(unsigned int d = 0; d < path.size(); d++)
171 ss<<path[d]<<STIM_FILENAME_DIV; 171 ss<<path[d]<<STIM_FILENAME_DIV;
172 ss<<get_name(); 172 ss<<get_name();
@@ -174,7 +174,7 @@ public: @@ -174,7 +174,7 @@ public:
174 return ss.str(); 174 return ss.str();
175 175
176 } 176 }
177 - 177 +
178 // output is the directory and the name of the file which are found in that given directory 178 // output is the directory and the name of the file which are found in that given directory
179 std::string f_name(std::string file_name){ 179 std::string f_name(std::string file_name){
180 std::stringstream ss; 180 std::stringstream ss;
@@ -201,10 +201,10 @@ public: @@ -201,10 +201,10 @@ public:
201 201
202 } 202 }
203 203
204 - 204 + std::vector<stim::filename> get_list(){
205 #ifdef _WIN32 205 #ifdef _WIN32
206 //get a list of files matching the current template 206 //get a list of files matching the current template
207 - std::vector<stim::filename> get_list(){ 207 +
208 208
209 //stim::filename file_path; 209 //stim::filename file_path;
210 stim::filename filepath(dir_fname()); 210 stim::filename filepath(dir_fname());
@@ -212,12 +212,12 @@ public: @@ -212,12 +212,12 @@ public:
212 HANDLE hFind = INVALID_HANDLE_VALUE; 212 HANDLE hFind = INVALID_HANDLE_VALUE;
213 WIN32_FIND_DATAA FindFileData; 213 WIN32_FIND_DATAA FindFileData;
214 std::vector<stim::filename> file_list; 214 std::vector<stim::filename> file_list;
215 - 215 +
216 hFind = FindFirstFileA((filepath.str().c_str()), &FindFileData); 216 hFind = FindFirstFileA((filepath.str().c_str()), &FindFileData);
217 217
218 if (hFind == INVALID_HANDLE_VALUE) { 218 if (hFind == INVALID_HANDLE_VALUE) {
219 printf ("Invalid file handle. Error is %u.\n", GetLastError()); 219 printf ("Invalid file handle. Error is %u.\n", GetLastError());
220 - } 220 + }
221 else { 221 else {
222 std::string file_name = FindFileData.cFileName; //get the file name 222 std::string file_name = FindFileData.cFileName; //get the file name
223 std::string file_path = dir(); 223 std::string file_path = dir();
@@ -233,9 +233,11 @@ public: @@ -233,9 +233,11 @@ public:
233 FindClose(hFind); 233 FindClose(hFind);
234 } 234 }
235 return file_list; 235 return file_list;
236 -  
237 - } 236 +#else
  237 + std::cout<<"File lists aren't currently supported on Unix/Linux systems."<<std::endl;
  238 + exit(1);
238 #endif 239 #endif
  240 + }
239 //************************************************************************************************** 241 //**************************************************************************************************
240 242
241 //gets the current working directory 243 //gets the current working directory