Mercurial > mxe-octave
view src/of-dicom-1-fixes.patch @ 4653:00e61c4a5657
fixes for package build errors due to API changes
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 09 Apr 2018 12:12:44 -0400 |
parents | f45182733409 |
children |
line wrap: on
line source
diff -r c6fc977bc48a src/Makefile.in --- a/src/Makefile.in Thu Feb 23 08:34:52 2017 +0100 +++ b/src/Makefile.in Tue May 16 08:25:04 2017 -0400 @@ -4,6 +4,8 @@ GDCM_CPPFLAGS = @GDCM_CXXFLAGS@ GDCM_LIBS = @GDCM_LIBS@ +OCTAVE_DEFS = -DHAVE_OCTAVE_LOAD_PATH=@HAVE_OCTAVE_LOAD_PATH@ + need_dict = dicominfo.oct dicomwrite.oct dicomlookup.oct test_files = dicominfo.cpp dicomdict.cpp dicomread.cpp dicomlookup.cpp isdicom.cpp dicomuid.oct @@ -11,13 +13,13 @@ all: $(need_dict) dicomdict.oct dicomread.oct _gendicomdict.oct isdicom.oct dicomuid.oct %.o: %.cpp - $(MKOCTFILE) $(GDCM_CPPFLAGS) -c $< + $(MKOCTFILE) $(OCTAVE_DEFS) $(GDCM_CPPFLAGS) -c $< $(need_dict): %.oct: %.cpp dicomdict.o - $(MKOCTFILE) $(GDCM_CPPFLAGS) $(GDCM_LIBS) $^ + $(MKOCTFILE) $(OCTAVE_DEFS) $(GDCM_CPPFLAGS) $(GDCM_LIBS) $^ %.oct: %.cpp - $(MKOCTFILE) $(GDCM_CPPFLAGS) $(GDCM_LIBS) $< + $(MKOCTFILE) $(OCTAVE_DEFS) $(GDCM_CPPFLAGS) $(GDCM_LIBS) $< clean: $(RM) *.o *.oct *~ diff -r c6fc977bc48a src/configure.ac --- a/src/configure.ac Thu Feb 23 08:34:52 2017 +0100 +++ b/src/configure.ac Tue May 16 08:25:04 2017 -0400 @@ -6,9 +6,48 @@ AC_PROG_SED +AC_PATH_PROG([MKOCTFILE], [mkoctfile]) +if test -z "$MKOCTFILE"; then + AC_MSG_ERROR([*** 'mkoctfile' not found.]) +fi + AC_PROG_CXX AC_LANG(C++) +## octave API tests +save_CXX="$CXX" +save_CXXFLAGS="$CXXFLAGS" +CXX=`${MKOCTFILE} -p CXX` +CXXFLAGS="$CXXFLAGS -I`$MKOCTFILE -p OCTINCLUDEDIR`" + +# need to use interpreter->get_load_path in dev version of octave, +# prior to that methods of load_path were static +AC_CACHE_CHECK( + [interpreter get_load_path], + [octave_cv_interpreter_get_load_path], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #include <oct.h> + #include <octave.h> + #include <interpreter.h> + #include <load-path.h> + ], + [ + octave::load_path &p = octave::interpreter::the_interpreter ()->get_load_path (); + ])], + [octave_cv_interpreter_get_load_path=yes], + [octave_cv_interpreter_get_load_path=no]) + ]) +if test "$octave_cv_interpreter_get_load_path" = "yes" ; then + HAVE_OCTAVE_LOAD_PATH=1 +else + HAVE_OCTAVE_LOAD_PATH=0 +fi +AC_SUBST(HAVE_OCTAVE_LOAD_PATH) + +CC=$save_CXX +CXXFLAGS=$save_CXXFLAGS + dnl dnl GDCM headers are in a version specific path. They use CMake and dnl provide a project.cmake config file which has the correct flags to diff -r c6fc977bc48a src/dicomdict.cpp --- a/src/dicomdict.cpp Thu Feb 23 08:34:52 2017 +0100 +++ b/src/dicomdict.cpp Tue May 16 08:25:04 2017 -0400 @@ -25,6 +25,8 @@ */ #include "octave/oct.h" +#include "octave/octave.h" +#include "octave/interpreter.h" #include "octave/load-path.h" #include "gdcmDict.h" @@ -263,13 +265,20 @@ } // find dic if it is anywhere in the search path (same path as for m-files etc) + std::string resolved_filename(filename); #ifndef NOT_OCT - const std::string resolved_filename=load_path::find_file(std::string(filename)) ; +#if HAVE_OCTAVE_LOAD_PATH == 1 + octave::interpreter *interp = octave::interpreter::the_interpreter (); + if (interp) { + octave::load_path& lp = interp->get_load_path (); + resolved_filename = lp.find_file (std::string (filename)); + } + else + warning ("load_dicom_dict: interpreter context missing"); #else - // for debugging: if not running in octave, find_file always returns "" - // so we just use the original filename - const std::string resolved_filename(filename); -#endif + resolved_filename=load_path::find_file(std::string(filename)); +#endif // HAVE_OCTAVE_LOAD_PATH +#endif // NOT_OCT std::ifstream fin(resolved_filename.c_str()); if (!fin) { diff -uNr a/src/dicomwrite.cpp b/src/dicomwrite.cpp --- a/src/dicomwrite.cpp 2017-02-23 01:28:24.157669038 -0500 +++ b/src/dicomwrite.cpp 2018-04-09 14:40:14.224292229 -0400 @@ -139,7 +139,7 @@ } void struct2metadata(gdcm::ImageWriter *w, gdcm::File *file, const octave_value & ov, bool trial, int sequenceDepth) { - if(!ov.is_map()){ + if(!ov.isstruct()){ error(QUOTED(OCT_FN_NAME)": 3rd arg should be struct holding metadata. it is %s",ov.type_name().c_str()); throw std::exception() ; } @@ -297,7 +297,7 @@ if (trial) octave_stdout << '[' << buf << ']' << std::endl; de->SetByteValue( buf, gdcm::VL((uint32_t)strlen(buf)) ); } else if ( entry.GetVR() & gdcm::VR::SQ) { // sequence - if (!ov->is_map()) { + if (!ov->isstruct()) { warning(QUOTED(OCT_FN_NAME)": dicomdict gives VR of SQ for %s, octave value is %s", keyword.c_str(), ov->class_name().c_str()); } octave_stdout << std::endl; diff -uNr a/src/isdicom.cpp b/src/isdicom.cpp --- a/src/isdicom.cpp 2017-02-23 01:28:24.157669038 -0500 +++ b/src/isdicom.cpp 2018-04-09 14:39:33.322200138 -0400 @@ -32,7 +32,7 @@ reader.SetFileName (filename.c_str ()); // gdcm::Reader.Read() will return false if the file does not exists but // also prints to stderr so we check it first. - return file_stat (filename).exists () && reader.Read (); + return octave::sys::file_stat (filename).exists () && reader.Read (); } DEFUN_DLD (isdicom, args, ,