Index: shogun/classifier/KNN.cpp =================================================================== --- shogun/classifier/KNN.cpp (revision 9330) +++ shogun/classifier/KNN.cpp (working copy) @@ -114,12 +114,20 @@ int32_t* train_lab=SG_MALLOC(int32_t, train_labels.vlen); SG_INFO( "%d test examples\n", num_lab); +#ifndef WIN32 CSignal::clear_cancel(); - +#endif //WIN32 + ///histogram of classes and returned output float64_t* classes=SG_MALLOC(float64_t, num_classes); - for (int32_t i=0; iIteration(); nit = nit+1; - } while (!optimal() && !(CSignal::cancel_computations())); + } while (!optimal() && +#ifndef WIN32 + !(CSignal::cancel_computations()) +#else + 1 +#endif //WIN32 + ); /* End of the problem resolution loop */ /***************************************************************************/ Index: shogun/classifier/svm/LaRank.cpp =================================================================== --- shogun/classifier/svm/LaRank.cpp (revision 9330) +++ shogun/classifier/svm/LaRank.cpp (working copy) @@ -608,7 +608,9 @@ ASSERT(kernel); ASSERT(labels && labels->get_num_labels()); +#ifndef WIN32 CSignal::clear_cancel(); +#endif //WIN32 if (data) { @@ -629,7 +631,13 @@ float64_t gap = DBL_MAX; SG_INFO("Training on %d examples\n", nb_train); - while (gap > C1 && (!CSignal::cancel_computations())) // stopping criteria + while (gap > C1 && +#ifndef WIN32 + (!CSignal::cancel_computations()) +#else + 1 +#endif //WIN32 + ) // stopping criteria { float64_t tr_err = 0; int32_t ind = step; Index: shogun/classifier/svm/OnlineSVMSGD.cpp =================================================================== --- shogun/classifier/svm/OnlineSVMSGD.cpp (revision 9330) +++ shogun/classifier/svm/OnlineSVMSGD.cpp (working copy) @@ -100,15 +100,23 @@ if (features->is_seekable()) features->reset_stream(); +#ifndef WIN32 CSignal::clear_cancel(); - +#endif //WIN32 + ELossType loss_type = loss->get_loss_type(); bool is_log_loss = false; if ((loss_type == L_LOGLOSS) || (loss_type == L_LOGLOSSMARGIN)) is_log_loss = true; int32_t vec_count; - for(int32_t e=0; eget_loss_type(); bool is_log_loss = false; if ((loss_type == L_LOGLOSS) || (loss_type == L_LOGLOSSMARGIN)) is_log_loss = true; - for(int32_t e=0; emax_train_time > 0 && start_time.cur_time_diff() > Q->max_train_time) break; Index: shogun/classifier/svm/SVMSGD.cpp =================================================================== --- shogun/classifier/svm/SVMSGD.cpp (revision 9330) +++ shogun/classifier/svm/SVMSGD.cpp (working copy) @@ -110,14 +110,22 @@ calibrate(); SG_INFO("Training on %d vectors\n", num_vec); +#ifndef WIN32 CSignal::clear_cancel(); +#endif ELossType loss_type = loss->get_loss_type(); bool is_log_loss = false; if ((loss_type == L_LOGLOSS) || (loss_type == L_LOGLOSSMARGIN)) is_log_loss = true; - for(int32_t e=0; erandom_weights) { for (vw_size_t j = 0; j < length/num_threads; j++) - weight_vectors[i][j] = /* BAW !!! drand48() */ - 0.5; + weight_vectors[i][j] = double( rand() ) / double( RAND_MAX ) - 0.5; } if (env->initial_weight != 0.) Index: shogun/distributions/HMM.cpp =================================================================== --- shogun/distributions/HMM.cpp (revision 9330) +++ shogun/distributions/HMM.cpp (working copy) @@ -5545,7 +5545,11 @@ float64_t prob_train=CMath::ALMOST_NEG_INFTY; iteration_count=iterations; - while (!converged(prob, prob_train) && (!CSignal::cancel_computations())) + while (!converged(prob, prob_train) +#ifndef WIN32 + && (!CSignal::cancel_computations()) +#endif //WIN32 + ) { CMath::swap(working, estimate); prob=prob_train; Index: shogun/features/DotFeatures.cpp =================================================================== --- shogun/features/DotFeatures.cpp (revision 9330) +++ shogun/features/DotFeatures.cpp (working copy) @@ -75,8 +75,10 @@ int32_t num_threads=parallel->get_num_threads(); ASSERT(num_threads>0); +#ifndef WIN32 CSignal::clear_cancel(); - +#endif //WIN32 + #ifdef HAVE_PTHREAD if (num_threads < 2) { @@ -153,8 +155,10 @@ int32_t num_threads=parallel->get_num_threads(); ASSERT(num_threads>0); +#ifndef WIN32 CSignal::clear_cancel(); - +#endif //WIN32 + #ifdef HAVE_PTHREAD if (num_threads < 2) { @@ -240,7 +244,7 @@ if (sub_index) { #ifdef WIN32 - for (int32_t i=start; iget_num_threads(); ASSERT(num_threads>0); +#ifndef WIN32 CSignal::clear_cancel(); - +#endif //WIN32 + if (dim != w_dim) SG_ERROR("Dimensions don't match, vec_len=%d, w_dim=%d\n", dim, w_dim); @@ -292,8 +294,10 @@ int32_t num_threads=parallel->get_num_threads(); ASSERT(num_threads>0); +#ifndef WIN32 CSignal::clear_cancel(); - +#endif //WIN32 + if (dim != w_dim) SG_ERROR("Dimensions don't match, vec_len=%d, w_dim=%d\n", dim, w_dim); Index: shogun/features/StringFeatures.cpp =================================================================== --- shogun/features/StringFeatures.cpp (revision 9330) +++ shogun/features/StringFeatures.cpp (working copy) @@ -766,6 +766,7 @@ template bool CStringFeatures::load_from_directory(char* dirname) { +#ifndef WIN32 remove_subset(); struct dirent **namelist; @@ -831,6 +832,9 @@ return true; } } +#else + SG_ERROR("StringFeatures::load_from_directory not implemented on WIN32\n"); +#endif //WIN32 return false; } Index: shogun/io/AsciiFile.cpp =================================================================== --- shogun/io/AsciiFile.cpp (revision 9330) +++ shogun/io/AsciiFile.cpp (working copy) @@ -1077,12 +1077,12 @@ #else ssize_t CAsciiFile::getdelim(char **lineptr, size_t *n, char delimiter, FILE *stream) { - return ::getdelim(lineptr, n, delimiter, stream); + return getdelim(lineptr, n, delimiter, stream); } ssize_t CAsciiFile::getline(char **lineptr, size_t *n, FILE *stream) { - return ::getline(lineptr, n, stream); + return getline(lineptr, n, stream); } #endif Index: shogun/io/IOBuffer.cpp =================================================================== --- shogun/io/IOBuffer.cpp (revision 9330) +++ shogun/io/IOBuffer.cpp (working copy) @@ -16,6 +16,18 @@ #include #include +#ifdef WIN32 +#ifdef __MINGW32__ + +#include + int fsync (int fd) + { + return (FlushFileBuffers ((HANDLE) _get_osfhandle (fd))) ? 0 : -1; + } + + #endif +#endif //WIN32 + using namespace shogun; CIOBuffer::CIOBuffer() Index: shogun/io/MemoryMappedFile.h =================================================================== --- shogun/io/MemoryMappedFile.h (revision 9330) +++ shogun/io/MemoryMappedFile.h (working copy) @@ -11,16 +11,23 @@ #ifndef __MEMORYMAPPEDFILE_H__ #define __MEMORYMAPPEDFILE_H__ +#ifdef WIN32 +#warning "MemoryMappedFile not implemented for WIN32" +#endif //WIN32 + #include #include #include #include + +#ifndef WIN32 #include #include #include #include #include +#endif //WIN32 namespace shogun { @@ -66,7 +73,7 @@ int open_flags; int mmap_prot; int mmap_flags; - +#ifndef WIN32 if (rw=='w') { open_flags=O_RDWR | O_CREAT; @@ -82,6 +89,7 @@ else SG_ERROR("Unknown flags\n"); + fd = open(fname, open_flags, S_IRWXU | S_IRWXG | S_IRWXO); if (fd == -1) SG_ERROR("Error opening file\n"); @@ -101,11 +109,15 @@ address = mmap(NULL, length, mmap_prot, mmap_flags, fd, 0); if (address == MAP_FAILED) SG_ERROR("Error mapping file"); +#else + SG_ERROR("MemoryMappedFile not implemented on WIN32\n"); +#endif //WIN32 } /** destructor */ virtual ~CMemoryMappedFile() { +#ifndef WIN32 munmap(address, length); if (rw=='w' && last_written_byte && ftruncate(fd, last_written_byte) == -1) @@ -114,6 +126,7 @@ SG_ERROR("Error Truncating file to %ld bytes\n", last_written_byte); } close(fd); +#endif //WIN32 } /** get the mapping address @@ -276,4 +289,6 @@ uint64_t last_written_byte; }; } + + #endif Index: shogun/io/SerializableAsciiReader00.cpp =================================================================== --- shogun/io/SerializableAsciiReader00.cpp (revision 9330) +++ shogun/io/SerializableAsciiReader00.cpp (working copy) @@ -10,6 +10,24 @@ #include +#ifdef WIN32 + +// workaround for missing declarations in inttypes.h +#ifndef SCNd8 + #define SCNd8 "hhd" +#endif +#ifndef SCNu8 + #define SCNu8 "hhu" +#endif +#ifndef SCNi8 + #define SCNi8 "hhi" +#endif +#ifndef SCNo8 + #define SCNo8 "hho" +#endif + +#endif // WIN32 + using namespace shogun; SerializableAsciiReader00::SerializableAsciiReader00( Index: shogun/io/SimpleFile.h =================================================================== --- shogun/io/SimpleFile.h (revision 9330) +++ shogun/io/SimpleFile.h (working copy) @@ -16,7 +16,9 @@ #include #include +#ifndef WIN32 #include +#endif //WIN32 namespace shogun { Index: shogun/kernel/Kernel.h =================================================================== --- shogun/kernel/Kernel.h (revision 9330) +++ shogun/kernel/Kernel.h (working copy) @@ -857,10 +857,11 @@ if (total%100 == 0) k->SG_PROGRESS(total, total_start, total_end); - +#ifndef WIN32 if (CSignal::cancel_computations()) break; - } +#endif //WIN32 + } } } Index: shogun/kernel/WeightedDegreePositionStringKernel.cpp =================================================================== --- shogun/kernel/WeightedDegreePositionStringKernel.cpp (revision 9330) +++ shogun/kernel/WeightedDegreePositionStringKernel.cpp (working copy) @@ -1281,8 +1281,14 @@ else { +#ifndef WIN32 CSignal::clear_cancel(); - for (int32_t j=0; j #define NUMTRAPPEDSIGS 2 +#endif //WIN32 namespace shogun { @@ -46,11 +47,15 @@ */ class CSignal : public CSGObject { +// keep stub of CSignal for inclusion in class_list +#ifndef WIN32 + public: + /** default constructor */ CSignal(); virtual ~CSignal(); - + /** handler * * @param signal signal number @@ -94,9 +99,11 @@ return cancel_computation; } +#endif // WIN32 /** @return object name */ inline virtual const char* get_name() const { return "Signal"; } +#ifndef WIN32 protected: /** signals; handling external lib */ static int signals[NUMTRAPPEDSIGS]; @@ -112,7 +119,8 @@ /** if shogun should return ASAP */ static bool cancel_immediately; +#endif // WIN32 }; -#endif // WIN32 } + #endif // __SIGNAL__H_ Index: shogun/lib/v_array.h =================================================================== --- shogun/lib/v_array.h (revision 9330) +++ shogun/lib/v_array.h (working copy) @@ -190,8 +190,12 @@ size_t old_length = end_array-begin; begin = SG_REALLOC(T, begin, length); if (old_length < length) +#ifndef WIN32 bzero(begin + old_length, (length - old_length)*sizeof(T)); - +#else + memset(begin + old_length, 0, (length - old_length)*sizeof(T)); +#endif + end = begin; end_array = begin + length; } Index: shogun/machine/KernelMachine.cpp =================================================================== --- shogun/machine/KernelMachine.cpp (revision 9330) +++ shogun/machine/KernelMachine.cpp (working copy) @@ -94,8 +94,10 @@ lab=new CLabels(num_vectors); SG_DEBUG( "computing output on %d test examples\n", num_vectors); +#ifndef WIN32 CSignal::clear_cancel(); - +#endif //WIN32 + if (io->get_show_progress()) io->enable_progress(); else Index: shogun/mathematics/Math.cpp =================================================================== --- shogun/mathematics/Math.cpp (revision 9330) +++ shogun/mathematics/Math.cpp (working copy) @@ -250,7 +250,11 @@ for (int32_t i=0; i<3*2; i++) { log_denom+=CMath::lgammal((floatmax_t) table.matrix[i]+1); +#ifndef WIN32 log_denomf+=gamma(table.matrix[i]+1); +#else + log_denomf+=tgamma(table.matrix[i]+1); +#endif } floatmax_t prob_table_log=log_nom - log_denom; Index: shogun/ui/GUIClassifier.h =================================================================== --- shogun/ui/GUIClassifier.h (revision 9330) +++ shogun/ui/GUIClassifier.h (working copy) @@ -16,6 +16,11 @@ #include #include +#ifdef interface +#warning "macro interface is defined - undefining" +#undef interface +#endif + namespace shogun { class CSGInterface; Index: shogun/ui/GUIDistance.h =================================================================== --- shogun/ui/GUIDistance.h (revision 9330) +++ shogun/ui/GUIDistance.h (working copy) @@ -17,6 +17,11 @@ #include #include +#ifdef interface +#warning "macro interface is defined - undefining" +#undef interface +#endif + namespace shogun { class CSGInterface; Index: shogun/ui/GUIFeatures.h =================================================================== --- shogun/ui/GUIFeatures.h (revision 9330) +++ shogun/ui/GUIFeatures.h (working copy) @@ -28,6 +28,11 @@ #include #include +#ifdef interface +#warning "macro interface is defined - undefining" +#undef interface +#endif + namespace shogun { class CSGInterface; Index: shogun/ui/GUIHMM.h =================================================================== --- shogun/ui/GUIHMM.h (revision 9330) +++ shogun/ui/GUIHMM.h (working copy) @@ -17,6 +17,11 @@ #include #include +#ifdef interface +#warning "macro interface is defined - undefining" +#undef interface +#endif + namespace shogun { class CSGInterface; Index: shogun/ui/GUILabels.h =================================================================== --- shogun/ui/GUILabels.h (revision 9330) +++ shogun/ui/GUILabels.h (working copy) @@ -16,6 +16,11 @@ #include #include +#ifdef interface +#warning "macro interface is defined - undefining" +#undef interface +#endif + namespace shogun { class CSGInterface; Index: shogun/ui/GUIMath.h =================================================================== --- shogun/ui/GUIMath.h (revision 9330) +++ shogun/ui/GUIMath.h (working copy) @@ -14,6 +14,11 @@ #include #include +#ifdef interface +#warning "macro interface is defined - undefining" +#undef interface +#endif + namespace shogun { class CSGInterface; Index: shogun/ui/GUIPreprocessor.h =================================================================== --- shogun/ui/GUIPreprocessor.h (revision 9330) +++ shogun/ui/GUIPreprocessor.h (working copy) @@ -17,6 +17,11 @@ #include #include +#ifdef interface +#warning "macro interface is defined - undefining" +#undef interface +#endif + namespace shogun { class CSGInterface;