diff --git a/CMakeLists.txt b/CMakeLists.txt index 061cb25..8a86ab0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ set (Morfeusz_VERSION_MINOR 1) set (CMAKE_BUILD_TYPE "Release") set (CMAKE_CXX_FLAGS "-std=c++98 -Wall -pedantic -Wcast-align -Wextra -Wmissing-noreturn -Wconversion -Wcast-qual -Wcast-align") -set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") +# set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") enable_testing() @@ -39,29 +39,31 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # copy jmorfeusz to java source tree add_custom_target (copy-jmorfeusz-libs ALL - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}jmorfeusz${CMAKE_JAVA_LIBRARY_SUFFIX} ${PROJECT_SOURCE_DIR}/jmorfeusz/src/main/native - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}morfeusz${CMAKE_SHARED_LIBRARY_SUFFIX} ${PROJECT_SOURCE_DIR}/jmorfeusz/src/main/native + COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/morfeusz/java/${CMAKE_SHARED_LIBRARY_PREFIX}jmorfeusz${CMAKE_JAVA_LIBRARY_SUFFIX} ${PROJECT_SOURCE_DIR}/jmorfeusz/src/main/native + # COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/morfeusz/${CMAKE_SHARED_LIBRARY_PREFIX}morfeusz${CMAKE_SHARED_LIBRARY_SUFFIX} ${PROJECT_SOURCE_DIR}/jmorfeusz/src/main/native DEPENDS ${JMORFEUSZ}) # build jmorfeusz # add_custom_command(TARGET all POST_BUILD mvn package -PotherOutputDir -DoutputDir=${PROJECT_BINARY_DIR}/jmorfeusz/target WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/jmorfeusz) add_custom_target ( jmorfeusz-maven-package ALL - COMMAND mvn package -PotherOutputDir -DoutputDir=${PROJECT_BINARY_DIR}/jmorfeusz + COMMAND mvn package -PotherOutputDir -DoutputDir=${PROJECT_BINARY_DIR}/jmorfeusz -DskipTests=true DEPENDS copy-jmorfeusz-libs WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/jmorfeusz) ########## PYTHON ########## -# find out library suffix (CMAKE_JAVA_LIBRARY_SUFFIX) +# find out library suffix if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set (CMAKE_PYTHON_LIBRARY_SUFFIX ".so") +elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set (CMAKE_PYTHON_LIBRARY_SUFFIX ".pyd") else (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set (CMAKE_PYTHON_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # copy python->c++ bindings add_custom_target (copy-pymorfeusz-libs ALL - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${PYMORFEUSZ}${CMAKE_PYTHON_LIBRARY_SUFFIX} ${PROJECT_BINARY_DIR}/pymorfeusz + COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/morfeusz/python/${PYMORFEUSZ}${CMAKE_PYTHON_LIBRARY_SUFFIX} ${PROJECT_BINARY_DIR}/pymorfeusz DEPENDS ${PYMORFEUSZ}) add_custom_target (copy-pymorfeusz-wrapper ALL COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/morfeusz/python/morfeusz.py ${PROJECT_BINARY_DIR}/pymorfeusz diff --git a/README b/README index a5d727a..80eab79 100644 --- a/README +++ b/README @@ -4,9 +4,11 @@ sudo apt-get install g++-multilib g++-mingw-w64 For Java and Python bindings: -sudo apt-get install swig default-jdk +sudo apt-get install swig default-jdk python +************* Mac OS X +************* ## install xcode (using apple store) @@ -29,3 +31,23 @@ brew install make # Must say everything is okay ("your system is ready to brew"): brew doctor +************* +Windows +************* + +Install MinGW and make sure it is included in Path system variable (when installed at C:\MinGW then C:\MinGW\bin must be in the Path variable). +Install CMake. +Download SWIG. Unpack the .zip contents somewhere (for example C:\swigwin-VERSION) +Add the unpacked SWIG directory to the Path variable. +Install latest Java JDK. +Go to morfeusz sources root. +mkdir build +cd build +cmake + +CROSS COMPILE +------------- + +Make your own CMake from sources using this patch: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=19b7a54d +(or use version > 3.0) +Add Java and Python libraries to the Toolchain file. Copy python27.dll from C:\Windows\System32 to some shared libs directory. \ No newline at end of file diff --git a/cmake-2.8.12.1-patch.diff b/cmake-2.8.12.1-patch.diff new file mode 100644 index 0000000..3b42bb1 --- /dev/null +++ b/cmake-2.8.12.1-patch.diff @@ -0,0 +1,26 @@ +diff -ru cmake-2.8.12.1-orig/Modules/FindSWIG.cmake cmake-2.8.12.1/Modules/FindSWIG.cmake +--- cmake-2.8.12.1-orig/Modules/FindSWIG.cmake 2013-11-05 20:07:22.000000000 +0100 ++++ cmake-2.8.12.1/Modules/FindSWIG.cmake 2013-12-24 23:11:51.561312112 +0100 +@@ -45,7 +45,7 @@ + string(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output}) + # force the path to be computed each time in case SWIG_EXECUTABLE has changed. + set(SWIG_DIR SWIG_DIR-NOTFOUND) +- find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output}) ++ find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output} NO_CMAKE_FIND_ROOT_PATH) + if(SWIG_DIR) + set(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake) + execute_process(COMMAND ${SWIG_EXECUTABLE} -version +diff -ru cmake-2.8.12.1-orig/Modules/Platform/Darwin.cmake cmake-2.8.12.1/Modules/Platform/Darwin.cmake +--- cmake-2.8.12.1-orig/Modules/Platform/Darwin.cmake 2013-11-05 20:07:22.000000000 +0100 ++++ cmake-2.8.12.1/Modules/Platform/Darwin.cmake 2013-12-25 11:16:54.998070493 +0100 +@@ -341,7 +341,9 @@ + list(APPEND _apps_paths "${_apps}") + endif() + endforeach() +-list(REMOVE_DUPLICATES _apps_paths) ++if(_apps_paths) ++ list(REMOVE_DUPLICATES _apps_paths) ++endif() + set(CMAKE_SYSTEM_APPBUNDLE_PATH + ${_apps_paths}) + unset(_apps_paths) diff --git a/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/InterpsVector.java b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/InterpsVector.java new file mode 100644 index 0000000..bbc7c26 --- /dev/null +++ b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/InterpsVector.java @@ -0,0 +1,74 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.4 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package pl.waw.ipipan.morfeusz; + +public class InterpsVector { + private long swigCPtr; + protected boolean swigCMemOwn; + + public InterpsVector(long cPtr, boolean cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + public static long getCPtr(InterpsVector obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } + + protected void finalize() { + delete(); + } + + public synchronized void delete() { + if (swigCPtr != 0) { + if (swigCMemOwn) { + swigCMemOwn = false; + MorfeuszWrapperJNI.delete_InterpsVector(swigCPtr); + } + swigCPtr = 0; + } + } + + public InterpsVector() { + this(MorfeuszWrapperJNI.new_InterpsVector(), true); + } + + public long size() { + return MorfeuszWrapperJNI.InterpsVector_size(swigCPtr, this); + } + + public long capacity() { + return MorfeuszWrapperJNI.InterpsVector_capacity(swigCPtr, this); + } + + public void reserve(long n) { + MorfeuszWrapperJNI.InterpsVector_reserve(swigCPtr, this, n); + } + + public boolean isEmpty() { + return MorfeuszWrapperJNI.InterpsVector_isEmpty(swigCPtr, this); + } + + public void clear() { + MorfeuszWrapperJNI.InterpsVector_clear(swigCPtr, this); + } + + public void add(MorphInterpretation x) { + MorfeuszWrapperJNI.InterpsVector_add(swigCPtr, this, MorphInterpretation.getCPtr(x), x); + } + + public MorphInterpretation get(int i) { + return new MorphInterpretation(MorfeuszWrapperJNI.InterpsVector_get(swigCPtr, this, i), false); + } + + public void set(int i, MorphInterpretation val) { + MorfeuszWrapperJNI.InterpsVector_set(swigCPtr, this, i, MorphInterpretation.getCPtr(val), val); + } + +} diff --git a/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/Morfeusz.java b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/Morfeusz.java new file mode 100644 index 0000000..ba07239 --- /dev/null +++ b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/Morfeusz.java @@ -0,0 +1,58 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.4 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package pl.waw.ipipan.morfeusz; + +public class Morfeusz { + private long swigCPtr; + protected boolean swigCMemOwn; + + public Morfeusz(long cPtr, boolean cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + public static long getCPtr(Morfeusz obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } + + protected void finalize() { + delete(); + } + + public synchronized void delete() { + if (swigCPtr != 0) { + if (swigCMemOwn) { + swigCMemOwn = false; + MorfeuszWrapperJNI.delete_Morfeusz(swigCPtr); + } + swigCPtr = 0; + } + } + + public Morfeusz() { + this(MorfeuszWrapperJNI.new_Morfeusz__SWIG_0(), true); + } + + public Morfeusz(String filename) { + this(MorfeuszWrapperJNI.new_Morfeusz__SWIG_1(filename), true); + } + + public ResultsIterator analyze(String text) { + return new ResultsIterator(MorfeuszWrapperJNI.Morfeusz_analyze__SWIG_0(swigCPtr, this, text), true); + } + + public void analyze(String text, InterpsVector result) { + MorfeuszWrapperJNI.Morfeusz_analyze__SWIG_1(swigCPtr, this, text, InterpsVector.getCPtr(result), result); + } + + public void setEncoding(MorfeuszCharset encoding) { + MorfeuszWrapperJNI.Morfeusz_setEncoding(swigCPtr, this, encoding.swigValue()); + } + +} diff --git a/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszCharset.java b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszCharset.java new file mode 100644 index 0000000..41d3f3a --- /dev/null +++ b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszCharset.java @@ -0,0 +1,54 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.4 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package pl.waw.ipipan.morfeusz; + +public enum MorfeuszCharset { + UTF8, + ISO8859_2, + CP1250, + CP852; + + public final int swigValue() { + return swigValue; + } + + public static MorfeuszCharset swigToEnum(int swigValue) { + MorfeuszCharset[] swigValues = MorfeuszCharset.class.getEnumConstants(); + if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) + return swigValues[swigValue]; + for (MorfeuszCharset swigEnum : swigValues) + if (swigEnum.swigValue == swigValue) + return swigEnum; + throw new IllegalArgumentException("No enum " + MorfeuszCharset.class + " with value " + swigValue); + } + + @SuppressWarnings("unused") + private MorfeuszCharset() { + this.swigValue = SwigNext.next++; + } + + @SuppressWarnings("unused") + private MorfeuszCharset(int swigValue) { + this.swigValue = swigValue; + SwigNext.next = swigValue+1; + } + + @SuppressWarnings("unused") + private MorfeuszCharset(MorfeuszCharset swigEnum) { + this.swigValue = swigEnum.swigValue; + SwigNext.next = this.swigValue+1; + } + + private final int swigValue; + + private static class SwigNext { + private static int next = 0; + } +} + diff --git a/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszException.java b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszException.java new file mode 100644 index 0000000..69fdc03 --- /dev/null +++ b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszException.java @@ -0,0 +1,46 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.4 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package pl.waw.ipipan.morfeusz; + +public class MorfeuszException { + private long swigCPtr; + protected boolean swigCMemOwn; + + public MorfeuszException(long cPtr, boolean cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + public static long getCPtr(MorfeuszException obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } + + protected void finalize() { + delete(); + } + + public synchronized void delete() { + if (swigCPtr != 0) { + if (swigCMemOwn) { + swigCMemOwn = false; + MorfeuszWrapperJNI.delete_MorfeuszException(swigCPtr); + } + swigCPtr = 0; + } + } + + public MorfeuszException(String what) { + this(MorfeuszWrapperJNI.new_MorfeuszException(what), true); + } + + public String what() { + return MorfeuszWrapperJNI.MorfeuszException_what(swigCPtr, this); + } + +} diff --git a/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszWrapper.java b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszWrapper.java new file mode 100644 index 0000000..5456702 --- /dev/null +++ b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszWrapper.java @@ -0,0 +1,16 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.4 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package pl.waw.ipipan.morfeusz; + +public class MorfeuszWrapper { + public static MorfeuszCharset getDEFAULT_MORFEUSZ_CHARSET() { + return MorfeuszCharset.swigToEnum(MorfeuszWrapperJNI.DEFAULT_MORFEUSZ_CHARSET_get()); + } + +} diff --git a/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszWrapperJNI.java b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszWrapperJNI.java new file mode 100644 index 0000000..350eb38 --- /dev/null +++ b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszWrapperJNI.java @@ -0,0 +1,49 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.4 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package pl.waw.ipipan.morfeusz; + +public class MorfeuszWrapperJNI { + + static { + System.loadLibrary("jmorfeusz"); + } + + public final static native long new_MorfeuszException(String jarg1); + public final static native void delete_MorfeuszException(long jarg1); + public final static native String MorfeuszException_what(long jarg1, MorfeuszException jarg1_); + public final static native long new_Morfeusz__SWIG_0(); + public final static native long new_Morfeusz__SWIG_1(String jarg1); + public final static native void delete_Morfeusz(long jarg1); + public final static native long Morfeusz_analyze__SWIG_0(long jarg1, Morfeusz jarg1_, String jarg2); + public final static native void Morfeusz_analyze__SWIG_1(long jarg1, Morfeusz jarg1_, String jarg2, long jarg3, InterpsVector jarg3_); + public final static native void Morfeusz_setEncoding(long jarg1, Morfeusz jarg1_, int jarg2); + public final static native long ResultsIterator_getNext(long jarg1, ResultsIterator jarg1_); + public final static native boolean ResultsIterator_hasNext(long jarg1, ResultsIterator jarg1_); + public final static native void delete_ResultsIterator(long jarg1); + public final static native int MorphInterpretation_getStartNode(long jarg1, MorphInterpretation jarg1_); + public final static native int MorphInterpretation_getEndNode(long jarg1, MorphInterpretation jarg1_); + public final static native String MorphInterpretation_getOrth(long jarg1, MorphInterpretation jarg1_); + public final static native String MorphInterpretation_getLemma(long jarg1, MorphInterpretation jarg1_); + public final static native int MorphInterpretation_getTagnum(long jarg1, MorphInterpretation jarg1_); + public final static native int MorphInterpretation_getNamenum(long jarg1, MorphInterpretation jarg1_); + public final static native String MorphInterpretation_getTag(long jarg1, MorphInterpretation jarg1_); + public final static native String MorphInterpretation_getName(long jarg1, MorphInterpretation jarg1_); + public final static native void delete_MorphInterpretation(long jarg1); + public final static native int DEFAULT_MORFEUSZ_CHARSET_get(); + public final static native long new_InterpsVector(); + public final static native long InterpsVector_size(long jarg1, InterpsVector jarg1_); + public final static native long InterpsVector_capacity(long jarg1, InterpsVector jarg1_); + public final static native void InterpsVector_reserve(long jarg1, InterpsVector jarg1_, long jarg2); + public final static native boolean InterpsVector_isEmpty(long jarg1, InterpsVector jarg1_); + public final static native void InterpsVector_clear(long jarg1, InterpsVector jarg1_); + public final static native void InterpsVector_add(long jarg1, InterpsVector jarg1_, long jarg2, MorphInterpretation jarg2_); + public final static native long InterpsVector_get(long jarg1, InterpsVector jarg1_, int jarg2); + public final static native void InterpsVector_set(long jarg1, InterpsVector jarg1_, int jarg2, long jarg3, MorphInterpretation jarg3_); + public final static native void delete_InterpsVector(long jarg1); +} diff --git a/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorphInterpretation.java b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorphInterpretation.java new file mode 100644 index 0000000..8d7f63d --- /dev/null +++ b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorphInterpretation.java @@ -0,0 +1,70 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.4 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package pl.waw.ipipan.morfeusz; + +public class MorphInterpretation { + private long swigCPtr; + protected boolean swigCMemOwn; + + public MorphInterpretation(long cPtr, boolean cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + public static long getCPtr(MorphInterpretation obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } + + protected void finalize() { + delete(); + } + + public synchronized void delete() { + if (swigCPtr != 0) { + if (swigCMemOwn) { + swigCMemOwn = false; + MorfeuszWrapperJNI.delete_MorphInterpretation(swigCPtr); + } + swigCPtr = 0; + } + } + + public int getStartNode() { + return MorfeuszWrapperJNI.MorphInterpretation_getStartNode(swigCPtr, this); + } + + public int getEndNode() { + return MorfeuszWrapperJNI.MorphInterpretation_getEndNode(swigCPtr, this); + } + + public String getOrth() { + return MorfeuszWrapperJNI.MorphInterpretation_getOrth(swigCPtr, this); + } + + public String getLemma() { + return MorfeuszWrapperJNI.MorphInterpretation_getLemma(swigCPtr, this); + } + + public int getTagnum() { + return MorfeuszWrapperJNI.MorphInterpretation_getTagnum(swigCPtr, this); + } + + public int getNamenum() { + return MorfeuszWrapperJNI.MorphInterpretation_getNamenum(swigCPtr, this); + } + + public String getTag() { + return MorfeuszWrapperJNI.MorphInterpretation_getTag(swigCPtr, this); + } + + public String getName() { + return MorfeuszWrapperJNI.MorphInterpretation_getName(swigCPtr, this); + } + +} diff --git a/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/ResultsIterator.java b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/ResultsIterator.java new file mode 100644 index 0000000..8834db5 --- /dev/null +++ b/jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/ResultsIterator.java @@ -0,0 +1,46 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.4 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package pl.waw.ipipan.morfeusz; + +public class ResultsIterator { + private long swigCPtr; + protected boolean swigCMemOwn; + + public ResultsIterator(long cPtr, boolean cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + public static long getCPtr(ResultsIterator obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } + + protected void finalize() { + delete(); + } + + public synchronized void delete() { + if (swigCPtr != 0) { + if (swigCMemOwn) { + swigCMemOwn = false; + MorfeuszWrapperJNI.delete_ResultsIterator(swigCPtr); + } + swigCPtr = 0; + } + } + + public MorphInterpretation getNext() { + return new MorphInterpretation(MorfeuszWrapperJNI.ResultsIterator_getNext(swigCPtr, this), true); + } + + public boolean hasNext() { + return MorfeuszWrapperJNI.ResultsIterator_hasNext(swigCPtr, this); + } + +} diff --git a/jmorfeusz/src/main/native/libjmorfeusz.dll b/jmorfeusz/src/main/native/libjmorfeusz.dll new file mode 100755 index 0000000..6538b2d --- /dev/null +++ b/jmorfeusz/src/main/native/libjmorfeusz.dll diff --git a/jmorfeusz/src/main/native/libjmorfeusz.jnilib b/jmorfeusz/src/main/native/libjmorfeusz.jnilib new file mode 100755 index 0000000..1b4ddd4 --- /dev/null +++ b/jmorfeusz/src/main/native/libjmorfeusz.jnilib diff --git a/jmorfeusz/src/main/native/libjmorfeusz.so b/jmorfeusz/src/main/native/libjmorfeusz.so index 9cf5e97..6717f0b 100755 --- a/jmorfeusz/src/main/native/libjmorfeusz.so +++ b/jmorfeusz/src/main/native/libjmorfeusz.so diff --git a/jmorfeusz/src/main/native/libmorfeusz.so b/jmorfeusz/src/main/native/libmorfeusz.so index 140bf64..7488338 100644 --- a/jmorfeusz/src/main/native/libmorfeusz.so +++ b/jmorfeusz/src/main/native/libmorfeusz.so diff --git a/morfeusz/Toolchain-darwin32.cmake b/morfeusz/Toolchain-darwin32.cmake index 61cf1b0..b459627 100644 --- a/morfeusz/Toolchain-darwin32.cmake +++ b/morfeusz/Toolchain-darwin32.cmake @@ -1,16 +1,15 @@ SET(CMAKE_SYSTEM_NAME Darwin) -SET(CMAKE_SYSTEM_VERSION 1) -SET(CMAKE_C_COMPILER /home/mlenart/usr/i686-apple-darwin11/bin/i686-apple-darwin11-gcc-4.6) -SET(CMAKE_CXX_COMPILER /home/mlenart/usr/i686-apple-darwin11/bin/i686-apple-darwin11-g++-4.6) -#SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) +SET(CMAKE_SYSTEM_VERSION 9) +SET(CMAKE_C_COMPILER /mnt/storage/usr/i686-apple-darwin9/i686-apple-darwin9-gcc) +SET(CMAKE_CXX_COMPILER /mnt/storage/usr/i686-apple-darwin9/i686-apple-darwin9-g++) # here is the target environment located -SET(CMAKE_FIND_ROOT_PATH /home/mlenart/usr/i686-apple-darwin11:/home/mlenart/usr/i686-apple-darwin11/lib/gcc/i686-apple-darwin11/4.6.4 ) +SET(CMAKE_FIND_ROOT_PATH /mnt/storage/usr/i686-apple-darwin9) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search # programs in the host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/morfeusz/Toolchain-darwin64.cmake b/morfeusz/Toolchain-darwin64.cmake new file mode 100644 index 0000000..b889c53 --- /dev/null +++ b/morfeusz/Toolchain-darwin64.cmake @@ -0,0 +1,19 @@ + +SET(CMAKE_SYSTEM_NAME Darwin) +set (CMAKE_SYSTEM_VERSION 1) +set (CMAKE_C_COMPILER /usr/x86_64-apple-darwin9/bin/x86_64-apple-darwin9-gcc) +set (CMAKE_CXX_COMPILER /usr/x86_64-apple-darwin9/bin/x86_64-apple-darwin9-g++) + +# here is the target environment located +set (CMAKE_FIND_ROOT_PATH /usr/x86_64-apple-darwin9 /mnt/storage/JavaVM.framework) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +set (JAVA_JVM_LIBRARY /mnt/storage/JavaVM.framework) +set (JAVA_AWT_LIBRARY /mnt/storage/JavaVM.framework) +set (JAVA_INCLUDE_PATH /mnt/storage/JavaVM.framework/Headers) diff --git a/morfeusz/Toolchain-win64.cmake b/morfeusz/Toolchain-win64.cmake index 435bf39..08db4e6 100644 --- a/morfeusz/Toolchain-win64.cmake +++ b/morfeusz/Toolchain-win64.cmake @@ -6,11 +6,11 @@ SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) # here is the target environment located -SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 ) +SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 /home/lennyn/opt/windupa/Java/jdk1.7.0_45 /opt/windupa/Java/jre7 /home/lennyn/opt/windupa/Python27 /home/lennyn/opt/swig) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search # programs in the host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/morfeusz/charset/CaseConverter.cpp b/morfeusz/charset/CaseConverter.cpp index 2a640d9..740915d 100644 --- a/morfeusz/charset/CaseConverter.cpp +++ b/morfeusz/charset/CaseConverter.cpp @@ -25,12 +25,14 @@ CaseConverter::CaseConverter() extToTitlecaseMap(initializeExtCaseMap(EXT_TO_TITLECASE_TABLE, EXT_TO_TITLECASE_TABLE_SIZE)) { } -static uint32_t getFromTables(const uint32_t* table, unsigned int tableSize, const map<uint32_t, uint32_t>& extMap, uint32_t codepoint) { +static uint32_t getFromTables(const uint32_t* table, unsigned int tableSize, const map<uint32_t, uint32_t>& extMap, const uint32_t codepoint) { if (codepoint < tableSize) { return table[codepoint]; } else if (extMap.count(codepoint) != 0) { - return extMap.at(codepoint); + map<uint32_t, uint32_t>::const_iterator it; + it = extMap.find(codepoint); + return it->second; } else { return codepoint; diff --git a/morfeusz/java/CMakeLists.txt b/morfeusz/java/CMakeLists.txt index 727e7d2..82a4422 100644 --- a/morfeusz/java/CMakeLists.txt +++ b/morfeusz/java/CMakeLists.txt @@ -20,4 +20,4 @@ SWIG_LINK_LIBRARIES(jmorfeusz libmorfeusz) set (CMAKE_SHARED_LINKER_FLAGS "") set (CMAKE_EXE_LINKER_FLAGS "") -set (CMAKE_CXX_FLAGS "-std=c++0x") +set (CMAKE_CXX_FLAGS "-O2") diff --git a/morfeusz/python/CMakeLists.txt b/morfeusz/python/CMakeLists.txt index 8385983..e53a7a4 100644 --- a/morfeusz/python/CMakeLists.txt +++ b/morfeusz/python/CMakeLists.txt @@ -17,6 +17,10 @@ SWIG_ADD_MODULE(morfeusz python ../morfeusz.i) SWIG_LINK_LIBRARIES(morfeusz ${PYTHON_LIBRARIES}) SWIG_LINK_LIBRARIES(morfeusz libmorfeusz) -set (CMAKE_SHARED_LINKER_FLAGS "") -set (CMAKE_EXE_LINKER_FLAGS "") -set (CMAKE_CXX_FLAGS "-std=c++0x") +#set (CMAKE_SHARED_LINKER_FLAGS "") +#set (CMAKE_EXE_LINKER_FLAGS "") +if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set (CMAKE_CXX_FLAGS "-D MS_WIN64 -O2") +else () + set (CMAKE_CXX_FLAGS "-O2") +endif () \ No newline at end of file diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 3852e91..92bcfc5 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -22,6 +22,7 @@ <in>MorphDeserializer.cpp</in> <in>MorphInterpretation.cpp</in> <in>Tagset.cpp</in> + <in>Toolchain-darwin64.cmake</in> <in>const.cpp</in> <in>main.cpp</in> <in>test_recognize_dict.cpp</in> @@ -245,6 +246,8 @@ </undefinedList> </ccTool> </item> + <item path="morfeusz/Toolchain-darwin64.cmake" ex="false" tool="3" flavor2="0"> + </item> <item path="morfeusz/charset/CaseConverter.cpp" ex="false" tool="1" flavor2="4"> <ccTool> </ccTool>