;Merge ../../yap-6.3
This commit is contained in:
602
packages/CLPBN/YAP_CLPBN.cbp
Normal file
602
packages/CLPBN/YAP_CLPBN.cbp
Normal file
@@ -0,0 +1,602 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6"/>
|
||||
<Project>
|
||||
<Option title="YAP_CLPBN"/>
|
||||
<Option makefile_is_custom="1"/>
|
||||
<Option compiler="gcc"/>
|
||||
<Option virtualFolders="CMake Files\;CMake Files\cmake\;CMake Files\.git\;CMake Files\.git\refs\;CMake Files\.git\refs\heads\;CMake Files\os\;CMake Files\packages\;CMake Files\packages\python\;CMake Files\packages\python\swig\;CMake Files\packages\python\swig\yap4py\;CMake Files\packages\python\yap_kernel\;CMake Files\packages\myddas\;CMake Files\packages\myddas\sqlite3\;CMake Files\packages\myddas\mysql\;CMake Files\packages\myddas\odbc\;CMake Files\packages\myddas\postgres\;CMake Files\packages\myddas\pl\;CMake Files\packages\raptor\;CMake Files\packages\raptor\cmake\;CMake Files\packages\raptor\doc\;CMake Files\packages\xml\;CMake Files\packages\CLPBN\;CMake Files\packages\CLPBN\horus\;CMake Files\packages\cplint\;CMake Files\packages\gecode\;CMake Files\packages\real\;CMake Files\packages\jpl\;CMake Files\packages\bdd\;CMake Files\packages\ProbLog\;CMake Files\packages\swi-minisat2\;CMake Files\packages\swi-minisat2\C\;CMake Files\packages\clpqr\;CMake Files\OPTYap\;CMake Files\utf8proc\;CMake Files\library\;CMake Files\library\dialect\;CMake Files\library\dialect\swi\;CMake Files\library\dialect\swi\fli\;CMake Files\library\clp\;CMake Files\library\matlab\;CMake Files\library\matrix\;CMake Files\library\random\;CMake Files\library\regex\;CMake Files\library\rltree\;CMake Files\library\system\;CMake Files\library\tries\;CMake Files\library\ytest\;CMake Files\library\lammpi\;CMake Files\CXX\;CMake Files\H\;CMake Files\pl\;CMake Files\swi\;CMake Files\swi\library\;CMake Files\docs\;CMake Files\docs\source\;"/>
|
||||
<Build>
|
||||
<Target title="all">
|
||||
<Option working_dir="/home/vsc/github/yap-6.3/packages/CLPBN"/>
|
||||
<Option type="4"/>
|
||||
<MakeCommands>
|
||||
<Build command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/Makefile" VERBOSE=1 all"/>
|
||||
<CompileFile command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/Makefile" VERBOSE=1 "$file""/>
|
||||
<Clean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/Makefile" VERBOSE=1 clean"/>
|
||||
<DistClean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/Makefile" VERBOSE=1 clean"/>
|
||||
</MakeCommands>
|
||||
</Target>
|
||||
<Target title="horus">
|
||||
<Option output="/home/vsc/github/yap-6.3/packages/CLPBN/horus/libhorus.so" prefix_auto="0" extension_auto="0"/>
|
||||
<Option working_dir="/home/vsc/github/yap-6.3/packages/CLPBN/horus"/>
|
||||
<Option object_output="./"/>
|
||||
<Option type="3"/>
|
||||
<Option compiler="gcc"/>
|
||||
<Compiler>
|
||||
<Add option="-DDEPTH_LIMIT=1"/>
|
||||
<Add option="-DCOROUTINING=1"/>
|
||||
<Add option="-DRATIONAL_TREES=1"/>
|
||||
<Add option="-D_YAP_NOT_INSTALLED_=1"/>
|
||||
<Add option="-DHAVE_CONFIG_H=1"/>
|
||||
<Add option="-D_GNU_SOURCE"/>
|
||||
<Add option="-DDEBUG=1"/>
|
||||
<Add option="-DTHREADED_CODE=1"/>
|
||||
<Add option="-DLOW_LEVEL_TRACER=1"/>
|
||||
<Add option="-DUTF8PROC=1"/>
|
||||
<Add option="-DUSE_MYDDAS=1"/>
|
||||
<Add option="-DMYDDAS_SQLITE3=1"/>
|
||||
<Add option="-DTABLING=1"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3"/>
|
||||
<Add directory="/usr/include/x86_64-linux-gnu"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/utf8proc"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/myddas"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/myddas/sqlite3/src"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/H"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/H/generated"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/include"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/os"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/OPTYap"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/JIT/HPP"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/CLPBN/horus"/>
|
||||
</Compiler>
|
||||
<MakeCommands>
|
||||
<Build command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 horus"/>
|
||||
<CompileFile command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 "$file""/>
|
||||
<Clean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 clean"/>
|
||||
<DistClean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 clean"/>
|
||||
</MakeCommands>
|
||||
</Target>
|
||||
<Target title="horus/fast">
|
||||
<Option output="/home/vsc/github/yap-6.3/packages/CLPBN/horus/libhorus.so" prefix_auto="0" extension_auto="0"/>
|
||||
<Option working_dir="/home/vsc/github/yap-6.3/packages/CLPBN/horus"/>
|
||||
<Option object_output="./"/>
|
||||
<Option type="3"/>
|
||||
<Option compiler="gcc"/>
|
||||
<Compiler>
|
||||
<Add option="-DDEPTH_LIMIT=1"/>
|
||||
<Add option="-DCOROUTINING=1"/>
|
||||
<Add option="-DRATIONAL_TREES=1"/>
|
||||
<Add option="-D_YAP_NOT_INSTALLED_=1"/>
|
||||
<Add option="-DHAVE_CONFIG_H=1"/>
|
||||
<Add option="-D_GNU_SOURCE"/>
|
||||
<Add option="-DDEBUG=1"/>
|
||||
<Add option="-DTHREADED_CODE=1"/>
|
||||
<Add option="-DLOW_LEVEL_TRACER=1"/>
|
||||
<Add option="-DUTF8PROC=1"/>
|
||||
<Add option="-DUSE_MYDDAS=1"/>
|
||||
<Add option="-DMYDDAS_SQLITE3=1"/>
|
||||
<Add option="-DTABLING=1"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3"/>
|
||||
<Add directory="/usr/include/x86_64-linux-gnu"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/utf8proc"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/myddas"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/myddas/sqlite3/src"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/H"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/H/generated"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/include"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/os"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/OPTYap"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/JIT/HPP"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/CLPBN/horus"/>
|
||||
</Compiler>
|
||||
<MakeCommands>
|
||||
<Build command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 horus/fast"/>
|
||||
<CompileFile command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 "$file""/>
|
||||
<Clean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 clean"/>
|
||||
<DistClean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 clean"/>
|
||||
</MakeCommands>
|
||||
</Target>
|
||||
<Target title="HorusCli">
|
||||
<Option output="/home/vsc/github/yap-6.3/packages/CLPBN/horus/hcli" prefix_auto="0" extension_auto="0"/>
|
||||
<Option working_dir="/home/vsc/github/yap-6.3/packages/CLPBN/horus"/>
|
||||
<Option object_output="./"/>
|
||||
<Option type="1"/>
|
||||
<Option compiler="gcc"/>
|
||||
<Compiler>
|
||||
<Add option="-DDEPTH_LIMIT=1"/>
|
||||
<Add option="-DCOROUTINING=1"/>
|
||||
<Add option="-DRATIONAL_TREES=1"/>
|
||||
<Add option="-D_YAP_NOT_INSTALLED_=1"/>
|
||||
<Add option="-DHAVE_CONFIG_H=1"/>
|
||||
<Add option="-D_GNU_SOURCE"/>
|
||||
<Add option="-DDEBUG=1"/>
|
||||
<Add option="-DTHREADED_CODE=1"/>
|
||||
<Add option="-DLOW_LEVEL_TRACER=1"/>
|
||||
<Add option="-DUTF8PROC=1"/>
|
||||
<Add option="-DUSE_MYDDAS=1"/>
|
||||
<Add option="-DMYDDAS_SQLITE3=1"/>
|
||||
<Add option="-DTABLING=1"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3"/>
|
||||
<Add directory="/usr/include/x86_64-linux-gnu"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/utf8proc"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/myddas"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/myddas/sqlite3/src"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/H"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/H/generated"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/include"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/os"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/OPTYap"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/JIT/HPP"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/CLPBN/horus"/>
|
||||
</Compiler>
|
||||
<MakeCommands>
|
||||
<Build command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 HorusCli"/>
|
||||
<CompileFile command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 "$file""/>
|
||||
<Clean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 clean"/>
|
||||
<DistClean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 clean"/>
|
||||
</MakeCommands>
|
||||
</Target>
|
||||
<Target title="HorusCli/fast">
|
||||
<Option output="/home/vsc/github/yap-6.3/packages/CLPBN/horus/hcli" prefix_auto="0" extension_auto="0"/>
|
||||
<Option working_dir="/home/vsc/github/yap-6.3/packages/CLPBN/horus"/>
|
||||
<Option object_output="./"/>
|
||||
<Option type="1"/>
|
||||
<Option compiler="gcc"/>
|
||||
<Compiler>
|
||||
<Add option="-DDEPTH_LIMIT=1"/>
|
||||
<Add option="-DCOROUTINING=1"/>
|
||||
<Add option="-DRATIONAL_TREES=1"/>
|
||||
<Add option="-D_YAP_NOT_INSTALLED_=1"/>
|
||||
<Add option="-DHAVE_CONFIG_H=1"/>
|
||||
<Add option="-D_GNU_SOURCE"/>
|
||||
<Add option="-DDEBUG=1"/>
|
||||
<Add option="-DTHREADED_CODE=1"/>
|
||||
<Add option="-DLOW_LEVEL_TRACER=1"/>
|
||||
<Add option="-DUTF8PROC=1"/>
|
||||
<Add option="-DUSE_MYDDAS=1"/>
|
||||
<Add option="-DMYDDAS_SQLITE3=1"/>
|
||||
<Add option="-DTABLING=1"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3"/>
|
||||
<Add directory="/usr/include/x86_64-linux-gnu"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/utf8proc"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/myddas"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/myddas/sqlite3/src"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/H"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/H/generated"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/include"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/os"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/OPTYap"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/JIT/HPP"/>
|
||||
<Add directory="/home/vsc/github/yap-6.3/packages/CLPBN/horus"/>
|
||||
</Compiler>
|
||||
<MakeCommands>
|
||||
<Build command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 HorusCli/fast"/>
|
||||
<CompileFile command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 "$file""/>
|
||||
<Clean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 clean"/>
|
||||
<DistClean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/CLPBN/horus/Makefile" VERBOSE=1 clean"/>
|
||||
</MakeCommands>
|
||||
</Target>
|
||||
</Build>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/BayesBall.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/BayesBall.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/BayesBallGraph.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/BayesBallGraph.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/BeliefProp.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/BeliefProp.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/ConstraintTree.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/ConstraintTree.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/CountingBp.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/CountingBp.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/ElimGraph.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/ElimGraph.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Factor.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Factor.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/FactorGraph.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/FactorGraph.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/GenericFactor.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/GenericFactor.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/GroundSolver.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/GroundSolver.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Histogram.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Histogram.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/HorusCli.cpp">
|
||||
<Option target="HorusCli"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/HorusYap.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Indexer.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Indexer.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedBp.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedBp.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedKc.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedKc.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedOperations.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedOperations.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedUtils.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedUtils.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedVe.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedVe.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedWCNF.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/LiftedWCNF.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Parfactor.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Parfactor.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/ParfactorList.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/ParfactorList.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/ProbFormula.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/ProbFormula.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Util.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Util.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Var.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/Var.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/VarElim.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/VarElim.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/WeightedBp.cpp">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/WeightedBp.h">
|
||||
<Option target="horus"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/GitSHA1.c.in">
|
||||
<Option virtualFolder="CMake Files\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/Threads.cmake">
|
||||
<Option virtualFolder="CMake Files\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/YapTermConfig.h.cmake">
|
||||
<Option virtualFolder="CMake Files\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/config.h.cmake">
|
||||
<Option virtualFolder="CMake Files\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/CheckPrototypeExists.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/Config.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindCUDD.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindGMP.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindGecode.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindMySQL.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindODBC.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindPythonModule.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindR.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindReadline.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/GetGitRevisionDescription.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/GetGitRevisionDescription.cmake.in">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/MacroLogFeature.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/MacroOptionalAddSubdirectory.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/MacroOptionalFindPackage.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/PackageDocs.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/Sources.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/TestForHighBitCharacters.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/TestSTDC.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/UseSWIG.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/cudd.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/disallow.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/java.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/python.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/.git/HEAD">
|
||||
<Option virtualFolder="CMake Files\.git\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/.git/refs/heads/master">
|
||||
<Option virtualFolder="CMake Files\.git\refs\heads\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/os/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\os\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/os/YapIOConfig.h.cmake">
|
||||
<Option virtualFolder="CMake Files\os\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\python\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/swig/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\python\swig\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/swig/MANIFEST.in">
|
||||
<Option virtualFolder="CMake Files\packages\python\swig\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/swig/YAP4PY.md">
|
||||
<Option virtualFolder="CMake Files\packages\python\swig\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/swig/setup.py.in">
|
||||
<Option virtualFolder="CMake Files\packages\python\swig\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/swig/yap4py/__init__.py.in">
|
||||
<Option virtualFolder="CMake Files\packages\python\swig\yap4py\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/yap_kernel/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\python\yap_kernel\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/sqlite3/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\sqlite3\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/mysql/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\mysql\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/odbc/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\odbc\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/postgres/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\postgres\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/pl/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\pl\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/raptor/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\raptor\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/raptor/raptor_config.h.cmake">
|
||||
<Option virtualFolder="CMake Files\packages\raptor\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/raptor/cmake/FindRAPTOR.cmake">
|
||||
<Option virtualFolder="CMake Files\packages\raptor\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/raptor/doc/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\raptor\doc\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/xml/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\xml\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\CLPBN\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\CLPBN\horus\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/cplint/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\cplint\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/gecode/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\gecode\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/real/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\real\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/real/rconfig.h.cmake">
|
||||
<Option virtualFolder="CMake Files\packages\real\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/jpl/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\jpl\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/bdd/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\bdd\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/ProbLog/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\ProbLog\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/swi-minisat2/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\swi-minisat2\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/swi-minisat2/C/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\swi-minisat2\C\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/clpqr/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\clpqr\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/OPTYap/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\OPTYap\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/utf8proc/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\utf8proc\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/utf8proc/utils.cmake">
|
||||
<Option virtualFolder="CMake Files\utf8proc\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/dialect/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\dialect\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/dialect/swi/fli/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\dialect\swi\fli\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/clp/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\clp\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/matlab/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\matlab\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/matrix/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\matrix\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/random/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\random\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/regex/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\regex\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/rltree/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\rltree\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/system/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\system\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/system/sys_config.h.cmake">
|
||||
<Option virtualFolder="CMake Files\library\system\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/tries/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\tries\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/ytest/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\ytest\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/lammpi/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\lammpi\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/CXX/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\CXX\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/H/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\H\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/pl/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\pl\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/swi/library/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\swi\library\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/docs/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\docs\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/docs/Doxyfile.in">
|
||||
<Option virtualFolder="CMake Files\docs\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/docs/source/conf.py.in">
|
||||
<Option virtualFolder="CMake Files\docs\source\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/docs/source/index.rst">
|
||||
<Option virtualFolder="CMake Files\docs\source\"/>
|
||||
</Unit>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
@@ -287,7 +287,8 @@ Instead of probabilities every fact has a t( ) prefix. The t stands for tunable
|
||||
~~~~
|
||||
t(0.5)::heads(_).
|
||||
~~~~
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
/** @defgroup ProbLogPredicates ProbLog Predicates
|
||||
@ingroup ProbLog1
|
||||
@@ -300,7 +301,6 @@ In the description of the arguments of functors the following notation will be u
|
||||
+ a preceding minus sign will denote an "output argument"
|
||||
+ an argument with no preceding symbol can be used in both ways
|
||||
|
||||
@{
|
||||
|
||||
/**
|
||||
* @pred problog_max(+G, -Prob, -FactsUsed)
|
||||
@@ -344,7 +344,6 @@ This predicate returns the lower and upper bound of the probability of achieving
|
||||
This predicate returns the lower bound of the probability of achieving the goal G obtained by cutting the sld tree at the given probability for each branch.
|
||||
*/
|
||||
|
||||
%% @}
|
||||
|
||||
/**
|
||||
@defgroup ProbLogParameterLearning ProbLog Parameter Learning Predicates
|
||||
@@ -4188,3 +4187,4 @@ user:term_expansion(Term,ExpandedTerm) :-
|
||||
problog:term_expansion_intern(Term,Mod,ExpandedTerm).
|
||||
|
||||
%% @}
|
||||
|
||||
|
13131
packages/ProbLog/problog_examples/#x#
Normal file
13131
packages/ProbLog/problog_examples/#x#
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
||||
CMAKE_MINIMUM_REQUIRED ( VERSION 2.8 )
|
||||
|
||||
PROJECT ( YAP_BDD C )
|
||||
|
||||
|
286
packages/bdd/YAP_BDD.cbp
Normal file
286
packages/bdd/YAP_BDD.cbp
Normal file
@@ -0,0 +1,286 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6"/>
|
||||
<Project>
|
||||
<Option title="YAP_BDD"/>
|
||||
<Option makefile_is_custom="1"/>
|
||||
<Option compiler="gcc"/>
|
||||
<Option virtualFolders="CMake Files\;CMake Files\cmake\;CMake Files\.git\;CMake Files\.git\refs\;CMake Files\.git\refs\heads\;CMake Files\os\;CMake Files\packages\;CMake Files\packages\python\;CMake Files\packages\python\swig\;CMake Files\packages\python\swig\yap4py\;CMake Files\packages\python\yap_kernel\;CMake Files\packages\myddas\;CMake Files\packages\myddas\sqlite3\;CMake Files\packages\myddas\mysql\;CMake Files\packages\myddas\odbc\;CMake Files\packages\myddas\postgres\;CMake Files\packages\myddas\pl\;CMake Files\packages\raptor\;CMake Files\packages\raptor\cmake\;CMake Files\packages\raptor\doc\;CMake Files\packages\xml\;CMake Files\packages\CLPBN\;CMake Files\packages\CLPBN\horus\;CMake Files\packages\cplint\;CMake Files\packages\gecode\;CMake Files\packages\real\;CMake Files\packages\jpl\;CMake Files\packages\bdd\;CMake Files\packages\ProbLog\;CMake Files\packages\swi-minisat2\;CMake Files\packages\swi-minisat2\C\;CMake Files\packages\clpqr\;CMake Files\OPTYap\;CMake Files\utf8proc\;CMake Files\library\;CMake Files\library\dialect\;CMake Files\library\dialect\swi\;CMake Files\library\dialect\swi\fli\;CMake Files\library\clp\;CMake Files\library\matlab\;CMake Files\library\matrix\;CMake Files\library\random\;CMake Files\library\regex\;CMake Files\library\rltree\;CMake Files\library\system\;CMake Files\library\tries\;CMake Files\library\ytest\;CMake Files\library\lammpi\;CMake Files\CXX\;CMake Files\H\;CMake Files\pl\;CMake Files\swi\;CMake Files\swi\library\;CMake Files\docs\;CMake Files\docs\source\;"/>
|
||||
<Build>
|
||||
<Target title="all">
|
||||
<Option working_dir="/home/vsc/github/yap-6.3/packages/bdd"/>
|
||||
<Option type="4"/>
|
||||
<MakeCommands>
|
||||
<Build command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/bdd/Makefile" VERBOSE=1 all"/>
|
||||
<CompileFile command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/bdd/Makefile" VERBOSE=1 "$file""/>
|
||||
<Clean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/bdd/Makefile" VERBOSE=1 clean"/>
|
||||
<DistClean command="/usr/bin/make -f "/home/vsc/github/yap-6.3/packages/bdd/Makefile" VERBOSE=1 clean"/>
|
||||
</MakeCommands>
|
||||
</Target>
|
||||
</Build>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/GitSHA1.c.in">
|
||||
<Option virtualFolder="CMake Files\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/Threads.cmake">
|
||||
<Option virtualFolder="CMake Files\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/YapTermConfig.h.cmake">
|
||||
<Option virtualFolder="CMake Files\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/config.h.cmake">
|
||||
<Option virtualFolder="CMake Files\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/CheckPrototypeExists.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/Config.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindCUDD.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindGMP.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindGecode.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindMySQL.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindODBC.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindPythonModule.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindR.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/FindReadline.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/GetGitRevisionDescription.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/GetGitRevisionDescription.cmake.in">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/MacroLogFeature.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/MacroOptionalAddSubdirectory.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/MacroOptionalFindPackage.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/PackageDocs.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/Sources.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/TestForHighBitCharacters.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/TestSTDC.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/UseSWIG.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/cudd.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/disallow.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/java.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/cmake/python.cmake">
|
||||
<Option virtualFolder="CMake Files\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/.git/HEAD">
|
||||
<Option virtualFolder="CMake Files\.git\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/.git/refs/heads/master">
|
||||
<Option virtualFolder="CMake Files\.git\refs\heads\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/os/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\os\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/os/YapIOConfig.h.cmake">
|
||||
<Option virtualFolder="CMake Files\os\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\python\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/swig/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\python\swig\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/swig/MANIFEST.in">
|
||||
<Option virtualFolder="CMake Files\packages\python\swig\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/swig/YAP4PY.md">
|
||||
<Option virtualFolder="CMake Files\packages\python\swig\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/swig/setup.py.in">
|
||||
<Option virtualFolder="CMake Files\packages\python\swig\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/swig/yap4py/__init__.py.in">
|
||||
<Option virtualFolder="CMake Files\packages\python\swig\yap4py\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/python/yap_kernel/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\python\yap_kernel\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/sqlite3/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\sqlite3\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/mysql/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\mysql\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/odbc/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\odbc\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/postgres/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\postgres\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/myddas/pl/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\myddas\pl\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/raptor/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\raptor\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/raptor/raptor_config.h.cmake">
|
||||
<Option virtualFolder="CMake Files\packages\raptor\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/raptor/cmake/FindRAPTOR.cmake">
|
||||
<Option virtualFolder="CMake Files\packages\raptor\cmake\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/raptor/doc/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\raptor\doc\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/xml/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\xml\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\CLPBN\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/CLPBN/horus/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\CLPBN\horus\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/cplint/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\cplint\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/gecode/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\gecode\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/real/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\real\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/real/rconfig.h.cmake">
|
||||
<Option virtualFolder="CMake Files\packages\real\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/jpl/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\jpl\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/bdd/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\bdd\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/ProbLog/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\ProbLog\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/swi-minisat2/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\swi-minisat2\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/swi-minisat2/C/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\swi-minisat2\C\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/packages/clpqr/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\packages\clpqr\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/OPTYap/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\OPTYap\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/utf8proc/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\utf8proc\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/utf8proc/utils.cmake">
|
||||
<Option virtualFolder="CMake Files\utf8proc\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/dialect/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\dialect\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/dialect/swi/fli/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\dialect\swi\fli\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/clp/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\clp\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/matlab/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\matlab\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/matrix/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\matrix\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/random/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\random\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/regex/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\regex\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/rltree/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\rltree\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/system/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\system\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/system/sys_config.h.cmake">
|
||||
<Option virtualFolder="CMake Files\library\system\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/tries/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\tries\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/ytest/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\ytest\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/library/lammpi/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\library\lammpi\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/CXX/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\CXX\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/H/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\H\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/pl/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\pl\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/swi/library/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\swi\library\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/docs/CMakeLists.txt">
|
||||
<Option virtualFolder="CMake Files\docs\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/docs/Doxyfile.in">
|
||||
<Option virtualFolder="CMake Files\docs\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/docs/source/conf.py.in">
|
||||
<Option virtualFolder="CMake Files\docs\source\"/>
|
||||
</Unit>
|
||||
<Unit filename="/home/vsc/github/yap-6.3/docs/source/index.rst">
|
||||
<Option virtualFolder="CMake Files\docs\source\"/>
|
||||
</Unit>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
|
||||
@file bdd.yap
|
||||
@file bdd/bdd.yap
|
||||
|
||||
@defgroup BDDsPL Binary Decision Diagrams and Friends
|
||||
@ingroup BDDs
|
||||
|
@@ -200,7 +200,7 @@
|
||||
|
||||
int getRealNumber(char *c, double *number);
|
||||
int getIntNumber(char *c, int *number);
|
||||
inline int getPosNumber(char *c, int *number);
|
||||
//inline int getPosNumber(char *c, int *number);
|
||||
int IsRealNumber(char *c);
|
||||
int IsPosNumber(const char *c);
|
||||
int IsNumber(const char *c);
|
||||
|
@@ -188,12 +188,13 @@
|
||||
|
||||
//#include <stdio.h>
|
||||
//#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "simplecudd.h"
|
||||
#include "problogmath.h"
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
|
||||
#define VERSION "2.0.1"
|
||||
#define PROBLOGBDD_VERSION "2.0.1"
|
||||
|
||||
|
||||
#ifndef max
|
||||
@@ -1550,7 +1551,7 @@ int argtype(const char *arg) {
|
||||
}
|
||||
|
||||
void printhelp(int argc, char **arg) {
|
||||
fprintf(stderr, "\n\nProbLogBDD Tool Version: %s\n\n", VERSION);
|
||||
fprintf(stderr, "\n\nProbLogBDD Tool Version: %s\n\n", PROBLOGBDD_VERSION);
|
||||
fprintf(stderr, "SimpleCUDD library (www.cs.kuleuven.be/~theo/tools/simplecudd.html)\n");
|
||||
fprintf(stderr, "SimpleCUDD was developed at Katholieke Universiteit Leuven(www.kuleuven.be)\n");
|
||||
fprintf(stderr, "Copyright Katholieke Universiteit Leuven 2008\n");
|
||||
|
@@ -400,7 +400,7 @@ int simpleNamedBDDtoDot(DdManager *manager, namedvars varmap, DdNode *bdd,
|
||||
// Cudd_AutodynEnable(mana, CUDD_REORDER_EXACT);
|
||||
// Cudd_ReduceHeap(manager, CUDD_REORDER_SIFT, 1);
|
||||
|
||||
ret = Cudd_DumpDot(manager, 1, f, varmap.vars, NULL, fd);
|
||||
ret = Cudd_DumpDot(manager, 1, f, (const char *const *)varmap.vars, NULL, fd);
|
||||
fclose(fd);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -68,6 +68,15 @@
|
||||
%% * Added initialization directives for saved-states
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%% @file chr_runtime.pl
|
||||
%% @brief CHR runtime
|
||||
|
||||
%% @namespace locked
|
||||
%% @brief internal CHR space
|
||||
|
||||
%% @namespace error_locked
|
||||
%% @brief internal CHR space
|
||||
|
||||
%% @addtogroup CHR_Rule_Types Rule Types
|
||||
%% @ingroup CHR
|
||||
%
|
||||
|
@@ -29,6 +29,12 @@
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
%% @file chr_swi.pl
|
||||
%% @brief CHR SWI specific
|
||||
|
||||
%% @namespace check
|
||||
%% @brief internal space
|
||||
|
||||
%% SWI begin
|
||||
%% @addtogroup CHR chr
|
||||
%% @ingroup packages
|
||||
|
1
packages/gecode/6.0.0/gecode-version.txt
vendored
Normal file
1
packages/gecode/6.0.0/gecode-version.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
6.0.0
|
3613
packages/gecode/6.0.0/gecode_yap_auto_generated.yap
vendored
Normal file
3613
packages/gecode/6.0.0/gecode_yap_auto_generated.yap
vendored
Normal file
File diff suppressed because it is too large
Load Diff
28
packages/gecode/6.0.0/gecode_yap_cc_forward_auto_generated.icc
vendored
Normal file
28
packages/gecode/6.0.0/gecode_yap_cc_forward_auto_generated.icc
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// -*- c++ -*-
|
||||
//=============================================================================
|
||||
// Copyright (C) 2011 by Denys Duchier
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
// more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//=============================================================================
|
||||
|
||||
static RestartMode gecode_RestartMode_from_term(YAP_Term);
|
||||
static FloatRelType gecode_FloatRelType_from_term(YAP_Term);
|
||||
static ReifyMode gecode_ReifyMode_from_term(YAP_Term);
|
||||
static IntRelType gecode_IntRelType_from_term(YAP_Term);
|
||||
static BoolOpType gecode_BoolOpType_from_term(YAP_Term);
|
||||
static IntPropLevel gecode_IntPropLevel_from_term(YAP_Term);
|
||||
static TaskType gecode_TaskType_from_term(YAP_Term);
|
||||
static TraceEvent gecode_TraceEvent_from_term(YAP_Term);
|
||||
static SetRelType gecode_SetRelType_from_term(YAP_Term);
|
||||
static SetOpType gecode_SetOpType_from_term(YAP_Term);
|
5412
packages/gecode/6.0.0/gecode_yap_cc_impl_auto_generated.icc
vendored
Normal file
5412
packages/gecode/6.0.0/gecode_yap_cc_impl_auto_generated.icc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
681
packages/gecode/6.0.0/gecode_yap_cc_init_auto_generated.icc
vendored
Normal file
681
packages/gecode/6.0.0/gecode_yap_cc_init_auto_generated.icc
vendored
Normal file
@@ -0,0 +1,681 @@
|
||||
// -*- c++ -*-
|
||||
//=============================================================================
|
||||
// Copyright (C) 2011 by Denys Duchier
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
// more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//=============================================================================
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_NONE");
|
||||
gecode_RM_NONE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_CONSTANT");
|
||||
gecode_RM_CONSTANT = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_LINEAR");
|
||||
gecode_RM_LINEAR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_LUBY");
|
||||
gecode_RM_LUBY = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_GEOMETRIC");
|
||||
gecode_RM_GEOMETRIC = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_EQ");
|
||||
gecode_FRT_EQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_NQ");
|
||||
gecode_FRT_NQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_LQ");
|
||||
gecode_FRT_LQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_LE");
|
||||
gecode_FRT_LE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_GQ");
|
||||
gecode_FRT_GQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("FRT_GR");
|
||||
gecode_FRT_GR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_EQV");
|
||||
gecode_RM_EQV = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_IMP");
|
||||
gecode_RM_IMP = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("RM_PMI");
|
||||
gecode_RM_PMI = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_EQ");
|
||||
gecode_IRT_EQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_NQ");
|
||||
gecode_IRT_NQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_LQ");
|
||||
gecode_IRT_LQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_LE");
|
||||
gecode_IRT_LE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_GQ");
|
||||
gecode_IRT_GQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IRT_GR");
|
||||
gecode_IRT_GR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("BOT_AND");
|
||||
gecode_BOT_AND = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("BOT_OR");
|
||||
gecode_BOT_OR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("BOT_IMP");
|
||||
gecode_BOT_IMP = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("BOT_EQV");
|
||||
gecode_BOT_EQV = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("BOT_XOR");
|
||||
gecode_BOT_XOR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_DEF");
|
||||
gecode_IPL_DEF = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_VAL");
|
||||
gecode_IPL_VAL = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_BND");
|
||||
gecode_IPL_BND = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_DOM");
|
||||
gecode_IPL_DOM = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_SPEED");
|
||||
gecode_IPL_SPEED = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_MEMORY");
|
||||
gecode_IPL_MEMORY = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_BASIC");
|
||||
gecode_IPL_BASIC = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_ADVANCED");
|
||||
gecode_IPL_ADVANCED = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("IPL_BASIC_ADVANCED");
|
||||
gecode_IPL_BASIC_ADVANCED = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("TT_FIXP");
|
||||
gecode_TT_FIXP = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TT_FIXS");
|
||||
gecode_TT_FIXS = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TT_FIXE");
|
||||
gecode_TT_FIXE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_INIT");
|
||||
gecode_TE_INIT = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_PRUNE");
|
||||
gecode_TE_PRUNE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_FIX");
|
||||
gecode_TE_FIX = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_FAIL");
|
||||
gecode_TE_FAIL = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_DONE");
|
||||
gecode_TE_DONE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_PROPAGATE");
|
||||
gecode_TE_PROPAGATE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("TE_COMMIT");
|
||||
gecode_TE_COMMIT = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_EQ");
|
||||
gecode_SRT_EQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_NQ");
|
||||
gecode_SRT_NQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_SUB");
|
||||
gecode_SRT_SUB = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_SUP");
|
||||
gecode_SRT_SUP = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_DISJ");
|
||||
gecode_SRT_DISJ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_CMPL");
|
||||
gecode_SRT_CMPL = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_LQ");
|
||||
gecode_SRT_LQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_LE");
|
||||
gecode_SRT_LE = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_GQ");
|
||||
gecode_SRT_GQ = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SRT_GR");
|
||||
gecode_SRT_GR = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
{ YAP_Atom X= YAP_LookupAtom("SOT_UNION");
|
||||
gecode_SOT_UNION = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SOT_DUNION");
|
||||
gecode_SOT_DUNION = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SOT_INTER");
|
||||
gecode_SOT_INTER = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
{ YAP_Atom X= YAP_LookupAtom("SOT_MINUS");
|
||||
gecode_SOT_MINUS = YAP_MkAtomTerm(X);
|
||||
YAP_AtomGetHold(X); }
|
||||
|
||||
YAP_UserCPredicate("gecode_constraint_branch_1", gecode_constraint_branch_1, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_convex_2", gecode_constraint_convex_2, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_convex_3", gecode_constraint_convex_3, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_abs_4", gecode_constraint_abs_4, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_abs_5", gecode_constraint_abs_5, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_abs_6", gecode_constraint_abs_6, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_7", gecode_constraint_argmax_7, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_8", gecode_constraint_argmax_8, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_10", gecode_constraint_argmax_10, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_9", gecode_constraint_argmax_9, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_11", gecode_constraint_argmax_11, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_argmax_12", gecode_constraint_argmax_12, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_13", gecode_constraint_argmin_13, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_14", gecode_constraint_argmin_14, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_16", gecode_constraint_argmin_16, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_15", gecode_constraint_argmin_15, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_17", gecode_constraint_argmin_17, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_argmin_18", gecode_constraint_argmin_18, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_19", gecode_constraint_assign_19, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_21", gecode_constraint_assign_21, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_23", gecode_constraint_assign_23, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_25", gecode_constraint_assign_25, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_27", gecode_constraint_assign_27, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_30", gecode_constraint_assign_30, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_33", gecode_constraint_assign_33, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_36", gecode_constraint_assign_36, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_20", gecode_constraint_assign_20, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_22", gecode_constraint_assign_22, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_24", gecode_constraint_assign_24, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_26", gecode_constraint_assign_26, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_28", gecode_constraint_assign_28, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_31", gecode_constraint_assign_31, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_34", gecode_constraint_assign_34, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_37", gecode_constraint_assign_37, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_29", gecode_constraint_assign_29, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_32", gecode_constraint_assign_32, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_35", gecode_constraint_assign_35, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_assign_38", gecode_constraint_assign_38, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_binpacking_39", gecode_constraint_binpacking_39, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_binpacking_40", gecode_constraint_binpacking_40, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_41", gecode_constraint_branch_41, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_43", gecode_constraint_branch_43, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_45", gecode_constraint_branch_45, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_47", gecode_constraint_branch_47, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_42", gecode_constraint_branch_42, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_44", gecode_constraint_branch_44, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_46", gecode_constraint_branch_46, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_48", gecode_constraint_branch_48, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_49", gecode_constraint_branch_49, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_55", gecode_constraint_branch_55, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_61", gecode_constraint_branch_61, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_64", gecode_constraint_branch_64, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_67", gecode_constraint_branch_67, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_73", gecode_constraint_branch_73, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_79", gecode_constraint_branch_79, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_85", gecode_constraint_branch_85, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_50", gecode_constraint_branch_50, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_52", gecode_constraint_branch_52, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_56", gecode_constraint_branch_56, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_58", gecode_constraint_branch_58, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_62", gecode_constraint_branch_62, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_65", gecode_constraint_branch_65, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_68", gecode_constraint_branch_68, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_70", gecode_constraint_branch_70, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_74", gecode_constraint_branch_74, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_76", gecode_constraint_branch_76, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_80", gecode_constraint_branch_80, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_82", gecode_constraint_branch_82, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_86", gecode_constraint_branch_86, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_88", gecode_constraint_branch_88, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_51", gecode_constraint_branch_51, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_53", gecode_constraint_branch_53, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_57", gecode_constraint_branch_57, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_59", gecode_constraint_branch_59, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_63", gecode_constraint_branch_63, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_66", gecode_constraint_branch_66, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_69", gecode_constraint_branch_69, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_71", gecode_constraint_branch_71, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_75", gecode_constraint_branch_75, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_77", gecode_constraint_branch_77, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_81", gecode_constraint_branch_81, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_83", gecode_constraint_branch_83, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_87", gecode_constraint_branch_87, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_89", gecode_constraint_branch_89, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_54", gecode_constraint_branch_54, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_60", gecode_constraint_branch_60, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_72", gecode_constraint_branch_72, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_78", gecode_constraint_branch_78, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_84", gecode_constraint_branch_84, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_branch_90", gecode_constraint_branch_90, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cardinality_91", gecode_constraint_cardinality_91, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_cardinality_92", gecode_constraint_cardinality_92, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_93", gecode_constraint_channel_93, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_95", gecode_constraint_channel_95, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_96", gecode_constraint_channel_96, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_97", gecode_constraint_channel_97, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_100", gecode_constraint_channel_100, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_94", gecode_constraint_channel_94, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_98", gecode_constraint_channel_98, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_101", gecode_constraint_channel_101, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_99", gecode_constraint_channel_99, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_102", gecode_constraint_channel_102, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_channel_103", gecode_constraint_channel_103, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_104", gecode_constraint_circuit_104, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_115", gecode_constraint_circuit_115, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_105", gecode_constraint_circuit_105, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_106", gecode_constraint_circuit_106, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_108", gecode_constraint_circuit_108, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_107", gecode_constraint_circuit_107, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_109", gecode_constraint_circuit_109, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_110", gecode_constraint_circuit_110, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_111", gecode_constraint_circuit_111, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_112", gecode_constraint_circuit_112, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_113", gecode_constraint_circuit_113, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_circuit_114", gecode_constraint_circuit_114, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_clause_116", gecode_constraint_clause_116, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_clause_118", gecode_constraint_clause_118, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_clause_117", gecode_constraint_clause_117, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_clause_119", gecode_constraint_clause_119, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_120", gecode_constraint_count_120, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_122", gecode_constraint_count_122, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_124", gecode_constraint_count_124, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_126", gecode_constraint_count_126, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_128", gecode_constraint_count_128, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_130", gecode_constraint_count_130, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_133", gecode_constraint_count_133, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_137", gecode_constraint_count_137, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_141", gecode_constraint_count_141, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_142", gecode_constraint_count_142, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_144", gecode_constraint_count_144, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_count_121", gecode_constraint_count_121, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_123", gecode_constraint_count_123, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_125", gecode_constraint_count_125, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_127", gecode_constraint_count_127, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_129", gecode_constraint_count_129, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_131", gecode_constraint_count_131, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_143", gecode_constraint_count_143, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_145", gecode_constraint_count_145, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_count_132", gecode_constraint_count_132, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_count_135", gecode_constraint_count_135, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_count_136", gecode_constraint_count_136, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_count_139", gecode_constraint_count_139, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_count_140", gecode_constraint_count_140, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_count_134", gecode_constraint_count_134, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_count_138", gecode_constraint_count_138, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_146", gecode_constraint_cumulative_146, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_158", gecode_constraint_cumulative_158, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_147", gecode_constraint_cumulative_147, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_148", gecode_constraint_cumulative_148, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_150", gecode_constraint_cumulative_150, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_154", gecode_constraint_cumulative_154, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_159", gecode_constraint_cumulative_159, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_160", gecode_constraint_cumulative_160, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_162", gecode_constraint_cumulative_162, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_166", gecode_constraint_cumulative_166, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_149", gecode_constraint_cumulative_149, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_151", gecode_constraint_cumulative_151, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_152", gecode_constraint_cumulative_152, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_155", gecode_constraint_cumulative_155, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_156", gecode_constraint_cumulative_156, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_161", gecode_constraint_cumulative_161, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_163", gecode_constraint_cumulative_163, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_164", gecode_constraint_cumulative_164, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_167", gecode_constraint_cumulative_167, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_168", gecode_constraint_cumulative_168, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_153", gecode_constraint_cumulative_153, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_157", gecode_constraint_cumulative_157, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_165", gecode_constraint_cumulative_165, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulative_169", gecode_constraint_cumulative_169, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_170", gecode_constraint_cumulatives_170, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_172", gecode_constraint_cumulatives_172, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_174", gecode_constraint_cumulatives_174, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_176", gecode_constraint_cumulatives_176, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_178", gecode_constraint_cumulatives_178, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_180", gecode_constraint_cumulatives_180, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_182", gecode_constraint_cumulatives_182, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_184", gecode_constraint_cumulatives_184, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_171", gecode_constraint_cumulatives_171, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_173", gecode_constraint_cumulatives_173, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_175", gecode_constraint_cumulatives_175, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_177", gecode_constraint_cumulatives_177, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_179", gecode_constraint_cumulatives_179, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_181", gecode_constraint_cumulatives_181, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_183", gecode_constraint_cumulatives_183, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_cumulatives_185", gecode_constraint_cumulatives_185, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_186", gecode_constraint_distinct_186, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_188", gecode_constraint_distinct_188, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_191", gecode_constraint_distinct_191, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_192", gecode_constraint_distinct_192, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_187", gecode_constraint_distinct_187, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_189", gecode_constraint_distinct_189, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_193", gecode_constraint_distinct_193, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_distinct_190", gecode_constraint_distinct_190, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_div_194", gecode_constraint_div_194, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_div_195", gecode_constraint_div_195, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_div_196", gecode_constraint_div_196, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_divmod_197", gecode_constraint_divmod_197, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_divmod_198", gecode_constraint_divmod_198, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_199", gecode_constraint_dom_199, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_203", gecode_constraint_dom_203, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_205", gecode_constraint_dom_205, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_206", gecode_constraint_dom_206, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_208", gecode_constraint_dom_208, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_212", gecode_constraint_dom_212, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_226", gecode_constraint_dom_226, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_227", gecode_constraint_dom_227, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_230", gecode_constraint_dom_230, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_231", gecode_constraint_dom_231, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_232", gecode_constraint_dom_232, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_234", gecode_constraint_dom_234, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_236", gecode_constraint_dom_236, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_243", gecode_constraint_dom_243, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_200", gecode_constraint_dom_200, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_201", gecode_constraint_dom_201, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_204", gecode_constraint_dom_204, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_207", gecode_constraint_dom_207, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_209", gecode_constraint_dom_209, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_210", gecode_constraint_dom_210, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_213", gecode_constraint_dom_213, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_214", gecode_constraint_dom_214, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_216", gecode_constraint_dom_216, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_220", gecode_constraint_dom_220, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_222", gecode_constraint_dom_222, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_228", gecode_constraint_dom_228, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_229", gecode_constraint_dom_229, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_233", gecode_constraint_dom_233, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_235", gecode_constraint_dom_235, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_237", gecode_constraint_dom_237, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_238", gecode_constraint_dom_238, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_240", gecode_constraint_dom_240, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_241", gecode_constraint_dom_241, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_202", gecode_constraint_dom_202, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_211", gecode_constraint_dom_211, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_215", gecode_constraint_dom_215, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_217", gecode_constraint_dom_217, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_218", gecode_constraint_dom_218, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_221", gecode_constraint_dom_221, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_223", gecode_constraint_dom_223, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_224", gecode_constraint_dom_224, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_239", gecode_constraint_dom_239, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_242", gecode_constraint_dom_242, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_219", gecode_constraint_dom_219, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_dom_225", gecode_constraint_dom_225, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_element_244", gecode_constraint_element_244, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_246", gecode_constraint_element_246, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_248", gecode_constraint_element_248, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_254", gecode_constraint_element_254, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_256", gecode_constraint_element_256, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_260", gecode_constraint_element_260, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_262", gecode_constraint_element_262, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_element_245", gecode_constraint_element_245, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_247", gecode_constraint_element_247, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_249", gecode_constraint_element_249, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_255", gecode_constraint_element_255, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_257", gecode_constraint_element_257, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_261", gecode_constraint_element_261, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_263", gecode_constraint_element_263, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_element_250", gecode_constraint_element_250, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_element_252", gecode_constraint_element_252, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_element_258", gecode_constraint_element_258, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_element_264", gecode_constraint_element_264, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_element_251", gecode_constraint_element_251, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_element_253", gecode_constraint_element_253, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_element_259", gecode_constraint_element_259, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_element_265", gecode_constraint_element_265, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_266", gecode_constraint_extensional_266, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_268", gecode_constraint_extensional_268, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_270", gecode_constraint_extensional_270, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_272", gecode_constraint_extensional_272, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_267", gecode_constraint_extensional_267, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_269", gecode_constraint_extensional_269, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_271", gecode_constraint_extensional_271, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_extensional_273", gecode_constraint_extensional_273, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_274", gecode_constraint_ite_274, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_276", gecode_constraint_ite_276, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_277", gecode_constraint_ite_277, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_279", gecode_constraint_ite_279, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_275", gecode_constraint_ite_275, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_ite_278", gecode_constraint_ite_278, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_280", gecode_constraint_linear_280, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_284", gecode_constraint_linear_284, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_292", gecode_constraint_linear_292, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_294", gecode_constraint_linear_294, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_312", gecode_constraint_linear_312, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_316", gecode_constraint_linear_316, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_281", gecode_constraint_linear_281, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_282", gecode_constraint_linear_282, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_285", gecode_constraint_linear_285, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_286", gecode_constraint_linear_286, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_288", gecode_constraint_linear_288, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_290", gecode_constraint_linear_290, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_293", gecode_constraint_linear_293, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_295", gecode_constraint_linear_295, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_296", gecode_constraint_linear_296, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_300", gecode_constraint_linear_300, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_304", gecode_constraint_linear_304, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_308", gecode_constraint_linear_308, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_313", gecode_constraint_linear_313, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_314", gecode_constraint_linear_314, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_317", gecode_constraint_linear_317, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_318", gecode_constraint_linear_318, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_283", gecode_constraint_linear_283, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_287", gecode_constraint_linear_287, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_289", gecode_constraint_linear_289, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_291", gecode_constraint_linear_291, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_297", gecode_constraint_linear_297, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_298", gecode_constraint_linear_298, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_301", gecode_constraint_linear_301, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_302", gecode_constraint_linear_302, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_305", gecode_constraint_linear_305, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_306", gecode_constraint_linear_306, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_309", gecode_constraint_linear_309, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_310", gecode_constraint_linear_310, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_315", gecode_constraint_linear_315, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_319", gecode_constraint_linear_319, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_299", gecode_constraint_linear_299, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_303", gecode_constraint_linear_303, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_307", gecode_constraint_linear_307, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_linear_311", gecode_constraint_linear_311, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_max_320", gecode_constraint_max_320, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_max_321", gecode_constraint_max_321, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_max_325", gecode_constraint_max_325, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_max_322", gecode_constraint_max_322, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_max_323", gecode_constraint_max_323, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_max_324", gecode_constraint_max_324, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_member_326", gecode_constraint_member_326, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_member_330", gecode_constraint_member_330, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_member_327", gecode_constraint_member_327, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_member_328", gecode_constraint_member_328, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_member_331", gecode_constraint_member_331, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_member_332", gecode_constraint_member_332, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_member_329", gecode_constraint_member_329, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_member_333", gecode_constraint_member_333, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_min_334", gecode_constraint_min_334, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_min_335", gecode_constraint_min_335, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_min_339", gecode_constraint_min_339, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_min_336", gecode_constraint_min_336, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_min_337", gecode_constraint_min_337, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_min_338", gecode_constraint_min_338, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_mod_340", gecode_constraint_mod_340, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_mod_341", gecode_constraint_mod_341, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_mult_342", gecode_constraint_mult_342, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_mult_343", gecode_constraint_mult_343, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_mult_344", gecode_constraint_mult_344, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_345", gecode_constraint_nooverlap_345, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_346", gecode_constraint_nooverlap_346, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_347", gecode_constraint_nooverlap_347, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_348", gecode_constraint_nooverlap_348, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_349", gecode_constraint_nooverlap_349, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_350", gecode_constraint_nooverlap_350, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_351", gecode_constraint_nooverlap_351, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_nooverlap_352", gecode_constraint_nooverlap_352, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_nroot_353", gecode_constraint_nroot_353, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nroot_354", gecode_constraint_nroot_354, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nroot_355", gecode_constraint_nroot_355, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_356", gecode_constraint_nvalues_356, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_358", gecode_constraint_nvalues_358, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_360", gecode_constraint_nvalues_360, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_362", gecode_constraint_nvalues_362, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_357", gecode_constraint_nvalues_357, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_359", gecode_constraint_nvalues_359, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_361", gecode_constraint_nvalues_361, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_nvalues_363", gecode_constraint_nvalues_363, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_path_364", gecode_constraint_path_364, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_path_375", gecode_constraint_path_375, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_path_365", gecode_constraint_path_365, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_path_366", gecode_constraint_path_366, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_path_368", gecode_constraint_path_368, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_path_367", gecode_constraint_path_367, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_path_369", gecode_constraint_path_369, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_path_370", gecode_constraint_path_370, 8);
|
||||
YAP_UserCPredicate("gecode_constraint_path_371", gecode_constraint_path_371, 9);
|
||||
YAP_UserCPredicate("gecode_constraint_path_372", gecode_constraint_path_372, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_path_373", gecode_constraint_path_373, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_path_374", gecode_constraint_path_374, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_pow_376", gecode_constraint_pow_376, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_pow_377", gecode_constraint_pow_377, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_pow_378", gecode_constraint_pow_378, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_precede_379", gecode_constraint_precede_379, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_precede_380", gecode_constraint_precede_380, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_precede_381", gecode_constraint_precede_381, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_precede_382", gecode_constraint_precede_382, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_383", gecode_constraint_rel_383, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_385", gecode_constraint_rel_385, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_391", gecode_constraint_rel_391, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_395", gecode_constraint_rel_395, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_399", gecode_constraint_rel_399, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_401", gecode_constraint_rel_401, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_403", gecode_constraint_rel_403, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_407", gecode_constraint_rel_407, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_411", gecode_constraint_rel_411, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_413", gecode_constraint_rel_413, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_415", gecode_constraint_rel_415, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_417", gecode_constraint_rel_417, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_419", gecode_constraint_rel_419, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_422", gecode_constraint_rel_422, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_423", gecode_constraint_rel_423, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_425", gecode_constraint_rel_425, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_427", gecode_constraint_rel_427, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_429", gecode_constraint_rel_429, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_430", gecode_constraint_rel_430, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_431", gecode_constraint_rel_431, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_433", gecode_constraint_rel_433, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_436", gecode_constraint_rel_436, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_437", gecode_constraint_rel_437, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_439", gecode_constraint_rel_439, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_441", gecode_constraint_rel_441, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_443", gecode_constraint_rel_443, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_384", gecode_constraint_rel_384, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_386", gecode_constraint_rel_386, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_387", gecode_constraint_rel_387, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_389", gecode_constraint_rel_389, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_392", gecode_constraint_rel_392, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_393", gecode_constraint_rel_393, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_396", gecode_constraint_rel_396, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_397", gecode_constraint_rel_397, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_400", gecode_constraint_rel_400, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_402", gecode_constraint_rel_402, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_404", gecode_constraint_rel_404, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_405", gecode_constraint_rel_405, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_408", gecode_constraint_rel_408, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_409", gecode_constraint_rel_409, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_412", gecode_constraint_rel_412, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_414", gecode_constraint_rel_414, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_416", gecode_constraint_rel_416, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_418", gecode_constraint_rel_418, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_420", gecode_constraint_rel_420, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_424", gecode_constraint_rel_424, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_426", gecode_constraint_rel_426, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_428", gecode_constraint_rel_428, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_432", gecode_constraint_rel_432, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_434", gecode_constraint_rel_434, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_438", gecode_constraint_rel_438, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_440", gecode_constraint_rel_440, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_442", gecode_constraint_rel_442, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_444", gecode_constraint_rel_444, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_388", gecode_constraint_rel_388, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_390", gecode_constraint_rel_390, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_394", gecode_constraint_rel_394, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_398", gecode_constraint_rel_398, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_406", gecode_constraint_rel_406, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_410", gecode_constraint_rel_410, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_421", gecode_constraint_rel_421, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_rel_435", gecode_constraint_rel_435, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_relax_445", gecode_constraint_relax_445, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_sequence_446", gecode_constraint_sequence_446, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_sequence_448", gecode_constraint_sequence_448, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_sequence_447", gecode_constraint_sequence_447, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_sequence_449", gecode_constraint_sequence_449, 7);
|
||||
YAP_UserCPredicate("gecode_constraint_sorted_450", gecode_constraint_sorted_450, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_sorted_451", gecode_constraint_sorted_451, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_sorted_452", gecode_constraint_sorted_452, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_sorted_453", gecode_constraint_sorted_453, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_sqr_454", gecode_constraint_sqr_454, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_sqr_455", gecode_constraint_sqr_455, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_sqr_456", gecode_constraint_sqr_456, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_sqrt_457", gecode_constraint_sqrt_457, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_sqrt_458", gecode_constraint_sqrt_458, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_sqrt_459", gecode_constraint_sqrt_459, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_460", gecode_constraint_unary_460, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_461", gecode_constraint_unary_461, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_462", gecode_constraint_unary_462, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_464", gecode_constraint_unary_464, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_468", gecode_constraint_unary_468, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_463", gecode_constraint_unary_463, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_465", gecode_constraint_unary_465, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_466", gecode_constraint_unary_466, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_469", gecode_constraint_unary_469, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_470", gecode_constraint_unary_470, 5);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_467", gecode_constraint_unary_467, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_unary_471", gecode_constraint_unary_471, 6);
|
||||
YAP_UserCPredicate("gecode_constraint_unshare_472", gecode_constraint_unshare_472, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_unshare_474", gecode_constraint_unshare_474, 2);
|
||||
YAP_UserCPredicate("gecode_constraint_unshare_473", gecode_constraint_unshare_473, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_unshare_475", gecode_constraint_unshare_475, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_when_476", gecode_constraint_when_476, 3);
|
||||
YAP_UserCPredicate("gecode_constraint_when_477", gecode_constraint_when_477, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_when_478", gecode_constraint_when_478, 4);
|
||||
YAP_UserCPredicate("gecode_constraint_when_479", gecode_constraint_when_479, 5);
|
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
@defgroup Gecode_and_ClPbBFDbC Programming Finite Domain Constraints in YAP/Gecode
|
||||
@ingroup Gecode
|
||||
@defgroup Gecode5and+ClPbBFDbC Programming Finite Domain Constraints in YAP/Gecode
|
||||
@ingroup Gecode5
|
||||
@{
|
||||
|
||||
The gecode/clp(fd) interface is designed to use the GECODE functionality
|
||||
|
@@ -728,7 +728,7 @@ def gecode_version():
|
||||
os.remove(file_hh)
|
||||
os.remove(file_txt)
|
||||
else:
|
||||
version = "5.0.0"
|
||||
version = "6.0.0"
|
||||
GECODE_VERSION = version
|
||||
return version
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@
|
||||
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
%%=============================================================================
|
||||
|
||||
/** @defgroup Gecode Gecode Interface
|
||||
/** @addtogroup Gecode4 Gecode Interface
|
||||
|
||||
@ingroup packages
|
||||
@{
|
||||
@@ -27,8 +27,8 @@ Duchier, with recent work by Vítor Santos Costa to port it to version 4
|
||||
of gecode and to have an higher level interface,
|
||||
|
||||
|
||||
@defgroup The_Gecode_Interface The Gecode Interface
|
||||
@ingroup Gecode
|
||||
@addtogroup TheGecode4Interface The Gecode Interface
|
||||
@ingroup Gecode4
|
||||
@{
|
||||
|
||||
This text is due to Denys Duchier. The gecode interface requires
|
||||
|
@@ -16,7 +16,7 @@
|
||||
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
%%=============================================================================
|
||||
|
||||
/** @defgroup Gecode Gecode Interface
|
||||
/** @addtogroup Gecode4 Gecode 4 Interface
|
||||
|
||||
@ingroup packages
|
||||
@{
|
||||
|
@@ -20,7 +20,7 @@
|
||||
(+=)/2, op(500, xfx, '+=')]).
|
||||
|
||||
|
||||
/** @defgroup Gecode Gecode Interface
|
||||
/** @addtogroup Gecode5 Gecode 5 Interface
|
||||
|
||||
@ingroup packages
|
||||
@{
|
||||
@@ -1341,3 +1341,6 @@ keep_list_(_, X) :-
|
||||
(Space += maximize(X,Y)) :- !, maximize(Space,X,Y).
|
||||
|
||||
(Space += keep(X)) :- !, keep_(Space,X).
|
||||
|
||||
%! @}
|
||||
|
||||
|
433
packages/gecode/gecode6-common.icc
Normal file
433
packages/gecode/gecode6-common.icc
Normal file
@@ -0,0 +1,433 @@
|
||||
// -*- c++ -*-
|
||||
//=============================================================================
|
||||
// Copyright (C) 2011 by Denys Duchier
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
// more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//=============================================================================
|
||||
|
||||
#ifndef GECODE_COMMON
|
||||
#define GECODE_COMMON
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#define __i386__ 1
|
||||
#if __x86_64__
|
||||
#define _WIN64 1
|
||||
#define _AMD64_ 1
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "gecode/driver.hh"
|
||||
#include "gecode/int.hh"
|
||||
#include "gecode/set.hh"
|
||||
#include "gecode/search.hh"
|
||||
#include <vector>
|
||||
|
||||
namespace generic_gecode
|
||||
{
|
||||
using namespace std;
|
||||
using namespace Gecode;
|
||||
|
||||
// description of the optimization criterion
|
||||
struct Optimizing
|
||||
{
|
||||
enum What { OPT_NONE, OPT_INT, OPT_RATIO };
|
||||
enum How { OPT_MIN, OPT_MAX };
|
||||
int num;
|
||||
int den;
|
||||
What what;
|
||||
How how;
|
||||
Optimizing(): num(-1), den(-1), what(OPT_NONE), how(OPT_MAX) {}
|
||||
Optimizing(Optimizing& o)
|
||||
: num(o.num), den(o.den), what(o.what), how(o.how) {}
|
||||
void check_ok() const
|
||||
{ if (what!=OPT_NONE)
|
||||
throw Exception("gecode-python","too many optimization criteria"); }
|
||||
void maximize(int i)
|
||||
{ check_ok(); what = OPT_INT; how = OPT_MAX; num = i; };
|
||||
void maximize(int i,int j)
|
||||
{ check_ok(); what = OPT_RATIO; how = OPT_MAX; num = i; den = j; };
|
||||
void minimize(int i)
|
||||
{ check_ok(); what = OPT_INT; how = OPT_MIN; num = i; };
|
||||
void minimize(int i,int j)
|
||||
{ check_ok(); what = OPT_RATIO; how = OPT_MIN; num = i; den = j; };
|
||||
};
|
||||
|
||||
class GenericSpace;
|
||||
|
||||
struct GenericEngine
|
||||
{
|
||||
virtual GenericSpace* next(void)=0;
|
||||
virtual ~GenericEngine() {};
|
||||
};
|
||||
|
||||
struct GenericDFS: GenericEngine
|
||||
{
|
||||
DFS<GenericSpace> engine;
|
||||
GenericDFS(GenericSpace* s,Search::Options& opt) : engine(s,opt) {}
|
||||
virtual GenericSpace* next(void) { return engine.next(); }
|
||||
};
|
||||
|
||||
struct GenericRestartDFS: GenericEngine
|
||||
{
|
||||
RBS<GenericSpace,DFS> engine;
|
||||
GenericRestartDFS(GenericSpace* s,Search::Options& opt) : engine(s,opt) {}
|
||||
virtual GenericSpace* next(void) { return engine.next(); }
|
||||
};
|
||||
|
||||
struct GenericBAB: GenericEngine
|
||||
{
|
||||
BAB<GenericSpace> engine;
|
||||
GenericBAB(GenericSpace* s,Search::Options& opt) : engine(s,opt) {}
|
||||
virtual GenericSpace* next(void) { return engine.next(); }
|
||||
};
|
||||
|
||||
struct GenericRestartBAB: GenericEngine
|
||||
{
|
||||
RBS<GenericSpace,BAB> engine;
|
||||
GenericRestartBAB(GenericSpace* s,Search::Options& opt) : engine(s,opt) {}
|
||||
virtual GenericSpace* next(void) { return engine.next(); }
|
||||
};
|
||||
|
||||
#ifdef OLD
|
||||
struct GenericRestart: GenericEngine
|
||||
{
|
||||
Restart<GenericSpace> engine;
|
||||
GenericRestart(GenericSpace* s,Search::Options& opt): engine(s,opt) {}
|
||||
virtual GenericSpace* next(void) { return engine.next(); }
|
||||
};
|
||||
#endif
|
||||
|
||||
struct LoadingDock
|
||||
{
|
||||
vector<IntVar> ivars;
|
||||
vector<BoolVar> bvars;
|
||||
vector<FloatVar> fvars;
|
||||
vector<SetVar> svars;
|
||||
vector<int> ikeep;
|
||||
vector<int> bkeep;
|
||||
vector<int> fkeep;
|
||||
vector<int> skeep;
|
||||
|
||||
bool keeping_some() const
|
||||
{
|
||||
return (ikeep.size() != 0)
|
||||
|| (bkeep.size() != 0)
|
||||
|| (fkeep.size() != 0)
|
||||
|| (skeep.size() != 0);
|
||||
}
|
||||
|
||||
IntVar get_ivar(int i) const { return ivars[i]; }
|
||||
BoolVar get_bvar(int i) const { return bvars[i]; }
|
||||
FloatVar get_fvar(int i) const { return fvars[i]; }
|
||||
SetVar get_svar(int i) const { return svars[i]; }
|
||||
|
||||
int enter_ivar(const IntVar& v)
|
||||
{ ivars.push_back(v); return static_cast<int>(ivars.size()-1); }
|
||||
|
||||
int enter_bvar(const BoolVar& v)
|
||||
{ bvars.push_back(v); return static_cast<int>(bvars.size()-1); }
|
||||
|
||||
int enter_fvar(const FloatVar& v)
|
||||
{ fvars.push_back(v); return static_cast<int>(fvars.size()-1); }
|
||||
|
||||
int enter_svar(const SetVar& v)
|
||||
{ svars.push_back(v); return static_cast<int>(svars.size()-1); }
|
||||
|
||||
int keep_ivar(int i) { ikeep.push_back(i); return static_cast<int>(ikeep.size()-1); }
|
||||
int keep_bvar(int i) { bkeep.push_back(i); return static_cast<int>(bkeep.size()-1); }
|
||||
int keep_fvar(int i) { fkeep.push_back(i); return static_cast<int>(fkeep.size()-1); }
|
||||
int keep_svar(int i) { skeep.push_back(i); return static_cast<int>(skeep.size()-1); }
|
||||
|
||||
void freeze(Space& home,
|
||||
IntVarArray& iarr, BoolVarArray& barr, SetVarArray& sarr, FloatVarArray& farr,
|
||||
int& num, int& den)
|
||||
{
|
||||
if (keeping_some())
|
||||
{
|
||||
// make sure that optimization vars (if any) are kept
|
||||
if (num != -1)
|
||||
{
|
||||
const int _num(num);
|
||||
const int _den(den);
|
||||
int n = static_cast<int>(ikeep.size());
|
||||
bool num_found(false);
|
||||
bool den_found(false);
|
||||
for (;n--;)
|
||||
{
|
||||
const int idx(ikeep[n]);
|
||||
if (idx==_num)
|
||||
{ num_found=true; if (den_found) break; }
|
||||
if (idx==_den)
|
||||
{ den_found=true; if (num_found) break; }
|
||||
}
|
||||
if (!num_found)
|
||||
{ ikeep.push_back(_num);
|
||||
num=static_cast<int>(ikeep.size()-1); }
|
||||
if (_den != -1 && !den_found)
|
||||
{ ikeep.push_back(_den);
|
||||
den=static_cast<int>(ikeep.size()-1); }
|
||||
}
|
||||
{ int n = static_cast<int>(ikeep.size());
|
||||
iarr = IntVarArray(home, n);
|
||||
for (;n--;) iarr[n]=ivars[ikeep[n]]; }
|
||||
{ int n = static_cast<int>(bkeep.size());
|
||||
barr = BoolVarArray(home, n);
|
||||
for (;n--;) barr[n]=bvars[bkeep[n]]; }
|
||||
{ int n = static_cast<int>(skeep.size());
|
||||
sarr = SetVarArray(home, n);
|
||||
for (;n--;) sarr[n]=svars[skeep[n]]; }
|
||||
{ int n = static_cast<int>(fkeep.size());
|
||||
farr = FloatVarArray(home, n);
|
||||
for (;n--;) farr[n]=fvars[skeep[n]]; }
|
||||
}
|
||||
else
|
||||
{
|
||||
{ int n = static_cast<int>(ivars.size());
|
||||
iarr = IntVarArray(home, n);
|
||||
for (;n--;) iarr[n]=ivars[n]; }
|
||||
{ int n = static_cast<int>(bvars.size());
|
||||
barr = BoolVarArray(home, n);
|
||||
for (;n--;) barr[n]=bvars[n]; }
|
||||
{ int n = static_cast<int>(svars.size());
|
||||
sarr = SetVarArray(home, n);
|
||||
for (;n--;) sarr[n]=svars[n]; }
|
||||
{ int n = static_cast<int>(fvars.size());
|
||||
farr = FloatVarArray(home, n);
|
||||
for (;n--;) farr[n]=fvars[n]; }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class GenericSpace: public Space
|
||||
{
|
||||
Optimizing optim;
|
||||
IntVarArray ivars;
|
||||
BoolVarArray bvars;
|
||||
FloatVarArray fvars;
|
||||
SetVarArray svars;
|
||||
LoadingDock* dock;
|
||||
bool keeping_some; // iff only SOME of the vars are kept
|
||||
public:
|
||||
Space* space() { return this; }
|
||||
|
||||
Space* copy(bool share)
|
||||
{ freeze(); return new GenericSpace(share, *this); }
|
||||
|
||||
Space* copy(void) {return copy(false);}
|
||||
GenericSpace(bool share, GenericSpace& s)
|
||||
: Space( s), optim(s.optim), dock(NULL), keeping_some(s.keeping_some)
|
||||
{
|
||||
ivars.update(*this, s.ivars);
|
||||
bvars.update(*this, s.bvars);
|
||||
svars.update(*this, s.svars);
|
||||
fvars.update(*this, s.fvars);
|
||||
}
|
||||
|
||||
|
||||
GenericSpace() : dock(new LoadingDock()), keeping_some(false) {}
|
||||
~GenericSpace() { delete dock; }
|
||||
|
||||
// throw some C++ exception on behalf of glue code
|
||||
void kaboom(const char* s)
|
||||
{ throw Exception("gecode-python", s); }
|
||||
int ikaboom(const char* s)
|
||||
{ kaboom(s); return 0; }
|
||||
|
||||
// freeze the space before handing it off to a search engine
|
||||
void freeze()
|
||||
{
|
||||
if (dock)
|
||||
{
|
||||
keeping_some = dock->keeping_some();
|
||||
dock->freeze(*this, ivars, bvars, svars, fvars, optim.num, optim.den);
|
||||
delete dock;
|
||||
dock = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
IntVar get_ivar(int i) const { return (dock)?dock->get_ivar(i):ivars[i]; }
|
||||
BoolVar get_bvar(int i) const { return (dock)?dock->get_bvar(i):bvars[i]; }
|
||||
SetVar get_svar(int i) const { return (dock)?dock->get_svar(i):svars[i]; }
|
||||
FloatVar get_fvar(int i) const { return (dock)?dock->get_fvar(i):fvars[i]; }
|
||||
|
||||
int keep_ivar(int i)
|
||||
{
|
||||
if (dock) return dock->keep_ivar(i);
|
||||
else return ikaboom("too late to keep");
|
||||
}
|
||||
|
||||
int keep_bvar(int i)
|
||||
{
|
||||
if (dock) return dock->keep_bvar(i);
|
||||
else return ikaboom("too late to keep");
|
||||
}
|
||||
|
||||
int keep_svar(int i)
|
||||
{
|
||||
if (dock) return dock->keep_svar(i);
|
||||
else return ikaboom("too late to keep");
|
||||
}
|
||||
|
||||
int keep_fvar(int i)
|
||||
{
|
||||
if (dock) return dock->keep_fvar(i);
|
||||
else return ikaboom("too late to keep");
|
||||
}
|
||||
|
||||
bool frozen() const { return dock==NULL; }
|
||||
bool has_keepers() const { return keeping_some; }
|
||||
// when frozen and has_keepers: which is just has_keepers actually
|
||||
bool use_keep_index() const { return has_keepers(); }
|
||||
|
||||
GenericEngine* new_engine(bool restart, Search::Options& opt)
|
||||
{
|
||||
freeze();
|
||||
return (optim.what == Optimizing::OPT_NONE)
|
||||
? ( restart
|
||||
? static_cast<GenericEngine*>(new GenericRestartDFS(this,opt))
|
||||
: static_cast<GenericEngine*>(new GenericDFS(this,opt)) )
|
||||
: (restart
|
||||
? static_cast<GenericEngine*>(new GenericRestartBAB(this,opt))
|
||||
:
|
||||
static_cast<GenericEngine*>(new GenericBAB(this,opt)) );
|
||||
}
|
||||
|
||||
int _new_ivar(IntVar& v)
|
||||
{
|
||||
if (dock) return dock->enter_ivar(v);
|
||||
else return ikaboom("too late to create vars");
|
||||
}
|
||||
|
||||
int new_ivar(int lo, int hi)
|
||||
{
|
||||
IntVar v(*this, lo, hi);
|
||||
return _new_ivar(v);
|
||||
}
|
||||
|
||||
int new_ivar(IntSet& s)
|
||||
{
|
||||
IntVar v(*this, s);
|
||||
return _new_ivar(v);
|
||||
}
|
||||
|
||||
int _new_fvar(FloatVar& v)
|
||||
{
|
||||
if (dock) return dock->enter_fvar(v);
|
||||
else return ikaboom("too late to create vars");
|
||||
}
|
||||
|
||||
int new_fvar(double lo, double hi)
|
||||
{
|
||||
FloatVar v(*this, lo, hi);
|
||||
return _new_fvar(v);
|
||||
}
|
||||
|
||||
int _new_bvar(BoolVar& v)
|
||||
{
|
||||
if (dock) return dock->enter_bvar(v);
|
||||
else return ikaboom("too late to create vars");
|
||||
}
|
||||
|
||||
int new_bvar()
|
||||
{
|
||||
BoolVar v(*this, 0, 1);
|
||||
return _new_bvar(v);
|
||||
}
|
||||
|
||||
int _new_svar(SetVar& v)
|
||||
{
|
||||
if (dock) return dock->enter_svar(v);
|
||||
else return ikaboom("too late to create vars");
|
||||
}
|
||||
|
||||
int new_svar(int glbMin, int glbMax, int lubMin, int lubMax,
|
||||
unsigned int cardMin=0,
|
||||
unsigned int cardMax=Set::Limits::card)
|
||||
{
|
||||
SetVar v(*this, glbMin, glbMax, lubMin, lubMax, cardMin, cardMax);
|
||||
return _new_svar(v);
|
||||
}
|
||||
|
||||
int new_ssvar(int glbMin, int glbMax, IntSet lubMin, IntSet lubMax,
|
||||
unsigned int cardMin=0,
|
||||
unsigned int cardMax=Set::Limits::card)
|
||||
{
|
||||
SetVar v(*this, glbMin, glbMax, lubMin, lubMax, cardMin, cardMax);
|
||||
return _new_svar(v);
|
||||
}
|
||||
|
||||
int new_ssvar(IntSet glb, int lubMin, int lubMax,
|
||||
unsigned int cardMin=0,
|
||||
unsigned int cardMax=Set::Limits::card)
|
||||
{
|
||||
SetVar v(*this, glb, lubMin, lubMax, cardMin, cardMax);
|
||||
return _new_svar(v);
|
||||
}
|
||||
|
||||
int new_svar(int glbMin, int glbMax, IntSet lub,
|
||||
unsigned int cardMin=0,
|
||||
unsigned int cardMax=Set::Limits::card)
|
||||
{
|
||||
SetVar v(*this, glbMin, glbMax, lub, cardMin, cardMax);
|
||||
return _new_svar(v);
|
||||
}
|
||||
|
||||
int new_sssvar(IntSet glb, IntSet lub,
|
||||
unsigned int cardMin=0,
|
||||
unsigned int cardMax=Set::Limits::card)
|
||||
{
|
||||
SetVar v(*this, glb, lub, cardMin, cardMax);
|
||||
return _new_svar(v);
|
||||
}
|
||||
|
||||
void minimize(int i) { optim.minimize(i); }
|
||||
void minimize(int i, int j) { optim.minimize(i,j); }
|
||||
void maximize(int i) { optim.maximize(i); }
|
||||
void maximize(int i, int j) { optim.maximize(i,j); }
|
||||
|
||||
void constrain(const Space& s)
|
||||
{
|
||||
const GenericSpace& sol = static_cast<const GenericSpace&>(s);
|
||||
switch (optim.what)
|
||||
{
|
||||
case Optimizing::OPT_NONE:
|
||||
break;
|
||||
case Optimizing::OPT_INT:
|
||||
rel(*this, ivars[optim.num],
|
||||
((optim.how==Optimizing::OPT_MIN) ? IRT_LE : IRT_GR),
|
||||
sol.ivars[optim.num].val());
|
||||
break;
|
||||
case Optimizing::OPT_RATIO:
|
||||
{
|
||||
IntArgs c(2, sol.ivars[optim.den].val(),
|
||||
- sol.ivars[optim.num].val());
|
||||
IntVarArgs v(2);
|
||||
v[0] = ivars[optim.num];
|
||||
v[1] = ivars[optim.den];
|
||||
linear(*this, c, v,
|
||||
((optim.how==Optimizing::OPT_MIN) ? IRT_LE : IRT_GR), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef DISJUNCTOR
|
||||
#include "disjunctor.icc"
|
||||
#endif
|
||||
|
||||
#endif
|
7
packages/gecode/gecode6.yap
Normal file
7
packages/gecode/gecode6.yap
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
/* just for program analysis */
|
||||
|
||||
|
||||
|
||||
:- include(gecode6_yap_hand_written).
|
||||
:- include('6.0.0/gecode_yap_auto_generated').
|
2111
packages/gecode/gecode6_yap.cc
Normal file
2111
packages/gecode/gecode6_yap.cc
Normal file
File diff suppressed because it is too large
Load Diff
1345
packages/gecode/gecode6_yap_hand_written.yap
Normal file
1345
packages/gecode/gecode6_yap_hand_written.yap
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4470,7 +4470,7 @@ add_search_path(Path, Dir) :-
|
||||
% =CLASSPATH=, etc.
|
||||
|
||||
search_path_separator((;)) :-
|
||||
current_prolog_flag(windo/.... ,,,,,,,,,,,,,,,,,, :l'p[KIO)_"?ws, true), !.
|
||||
current_prolog_flag(windows, true), !.
|
||||
search_path_separator(:).
|
||||
|
||||
/*******************************
|
||||
@@ -4503,10 +4503,11 @@ location( java_root, _, Home) :-
|
||||
getenv( 'JAVA_HOME', Home ).
|
||||
location(java_root, _, JRE) :-
|
||||
% OS well-known
|
||||
member(Root, [ '/usr/lib',
|
||||
member(Root, [
|
||||
/System/Library/Frameworks/JavaVM.framework/Versions/A/JavaV '/usr/lib',
|
||||
'/usr/local/lib',
|
||||
'/opt/lib',
|
||||
'/Library/Java/JavaVirtual hines',
|
||||
'/Library/Java/JavaVirtualMachines',
|
||||
'/System/Library/Frameworks'
|
||||
]),
|
||||
exists_directory(Root),
|
||||
|
@@ -1,3 +1,4 @@
|
||||
set(CMAKE_MACOSX_RPATH 1)
|
||||
|
||||
add_lib(jplYap jpl.h jpl.c hacks.h)
|
||||
|
||||
|
@@ -1,12 +1,15 @@
|
||||
|
||||
## The MYDDAS Data-base interface {#myddas}
|
||||
@defgroup myddas The MYDDAS Data-base interface
|
||||
@ingroup packages
|
||||
|
||||
The MYDDAS database project was developed within a FCT project aiming at
|
||||
the development of a highly efficient deductive database system, based
|
||||
on the coupling of the MySQL relational database system with the YAP
|
||||
Prolog system. MYDDAS was later expanded to support the ODBC interface.
|
||||
The MYDDAS database project was developed within a FCT project
|
||||
aiming at the development of a highly efficient deductive database
|
||||
system, based on the coupling of the MySQL relational database
|
||||
system with the YAP Prolog system. MYDDAS was later expanded to
|
||||
support the ODBC interface, postgres and sqlite3.
|
||||
|
||||
### Requirements and Installation Guide {#Requirements_and_Installation_Guide}
|
||||
@defgroup Requirements_and_Installation_Guide Requirements and Installation Guide
|
||||
@ingroup myddas @{
|
||||
|
||||
Next, we describe how to usen of the YAP with the MYDDAS System. The
|
||||
use of this system is entirely depend of the MySQL development libraries
|
||||
@@ -38,7 +41,9 @@
|
||||
two different ways. As if we were on the MySQL Client Shell, and as if
|
||||
we were using Datalog.
|
||||
|
||||
### MYDDAS Architecture {#MYDDAS_Architecture}
|
||||
@}
|
||||
@defgroup MYDDAS_Architecture MYDDAS Architecture
|
||||
@ingroup myddas @{
|
||||
|
||||
The system includes four main blocks that are put together through the
|
||||
MYDDAS interface: the Yap Prolog compiler, the MySQL database system, an
|
||||
@@ -88,8 +93,9 @@
|
||||
WHERE A.Name = 'John Doe';
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
### View Level Interface {#View_Level_Interface}
|
||||
|
||||
@}
|
||||
@defgroup View_Level_Interface View Level Interface
|
||||
@ingroup myddas @{
|
||||
|
||||
@pred db view(+,+,+).
|
||||
@pred db view(+,+).
|
||||
@@ -179,7 +185,7 @@
|
||||
To know how to use db `view/3`, please refer to Draxler's Prolog to
|
||||
SQL Compiler Manual.
|
||||
|
||||
### Accessing Tables in Data Sources Using SQL {#Accessing_Tables_in_Data_Sources_Using_SQL}
|
||||
@defgroup Accessing_Tables_in_Data_Sources_Using_SQL Accessing Tables in Data Sources Using SQL
|
||||
|
||||
|
||||
@pred db_sql(+,+,?).
|
||||
@@ -203,9 +209,9 @@
|
||||
?- db_sql('SELECT * FROM phonebook',LA).
|
||||
LA = ['D','John Doe',123456789] ?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
### Insertion of Rows {#Insertion_of_Rows}
|
||||
|
||||
@}
|
||||
@defgroup Insertion_of_Rows Insertion of Rows
|
||||
@ingroup myddas @{
|
||||
@pred db_assert(+,+).
|
||||
@pred db_assert(+).
|
||||
|
||||
@@ -274,7 +280,7 @@
|
||||
yes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
### Types of Attributes {#Types_of_Attributes}
|
||||
@defgroup Types_of_Attributes Types of Attributes
|
||||
|
||||
|
||||
@pred db_get_attributes_types(+,+,?).
|
||||
@@ -298,7 +304,7 @@ otype for this predicate is the following:
|
||||
where <tt>Hello World</tt> is the name of the relation and <tt>myddas</tt> is the
|
||||
connection identifier.
|
||||
|
||||
### Number of Fields {#Number_of_Fields}
|
||||
@defgroup Number_of_Fields Number of Fields
|
||||
|
||||
|
||||
@pred db_number_of_fields(+,?).
|
||||
@@ -325,7 +331,7 @@ otype for this predicate is the following:
|
||||
where `Hello World` is the name of the
|
||||
relation and `myddas` is the connection identifier.
|
||||
|
||||
### Describing a Relation {#Describing_a_Relation}
|
||||
@defgroup Describing_a_Relation Describing a Relation
|
||||
|
||||
@pred db_datalog_describe(+,+).
|
||||
@pred db_datalog_describe(+).
|
||||
@@ -366,10 +372,10 @@ otype for this predicate is the following:
|
||||
Term = tableInfo('Letter',char(1),'YES','',null(2),'') ? ;
|
||||
no
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
### Enumeration Relations Describing_a_Relation Describing a Relation {#Enumerating_Relations}
|
||||
@defgroup Enumerating_Relations Enumeration Relations Describing_a_Relation Describing a Relation
|
||||
|
||||
|
||||
/@pred db_datalog_show_tables(+).
|
||||
@pred db_datalog_show_tables(+).
|
||||
@pred db_datalog_show_tables
|
||||
|
||||
|
||||
@@ -406,7 +412,8 @@ otype for this predicate is the following:
|
||||
no
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
### The MYDDAS MySQL Top Level {#The_MYDDAS_MySQL_Top_Level}
|
||||
@}
|
||||
@defgroup The_MYDDAS_MySQL_Top_Level The MYDDAS MySQL Top Level @ingroup myddas @{
|
||||
|
||||
@pred db_top_level(+,+,+,+,+).
|
||||
@pred db_top_level(+,+,+,+).
|
||||
@@ -456,9 +463,9 @@ otype for this predicate is the following:
|
||||
yes
|
||||
?-
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
### Other MYDDAS Properties {#Other_MYDDAS_Properties}
|
||||
|
||||
@}
|
||||
@defgroup Other_MYDDAS_Properties Other MYDDAS Properties
|
||||
@ingroup myddas @{
|
||||
@pred db_verbose(+).
|
||||
|
||||
|
||||
@@ -553,4 +560,7 @@ otype for this predicate is the following:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
You can see the available SQL Modes at the MySQL homepage at
|
||||
<http://www.mysql.org>.
|
||||
|
||||
|
||||
@]
|
||||
@}
|
||||
|
||||
|
@@ -99,6 +99,7 @@ static bool myddas_initialised;
|
||||
/* Initialize all of the MYDDAS global structures */
|
||||
static Int c_db_initialize_myddas(USES_REGS1) {
|
||||
if (!myddas_initialised) {
|
||||
myddas_initialised= true;
|
||||
init_myddas();
|
||||
}
|
||||
Yap_REGS.MYDDAS_GLOBAL_POINTER = myddas_init_initialize_myddas();
|
||||
@@ -680,9 +681,10 @@ void Yap_MYDDAS_delete_all_myddas_structs(void) {
|
||||
void init_myddas(void) {
|
||||
CACHE_REGS
|
||||
if (myddas_initialised)
|
||||
return;
|
||||
init_sqlite3();
|
||||
myddas_initialised = TRUE;
|
||||
return;
|
||||
#ifdef __ANDROID__
|
||||
init_sqlite3();
|
||||
#endif
|
||||
#if defined MYDDAS_ODBC
|
||||
Yap_InitBackMYDDAS_ODBCPreds();
|
||||
#endif
|
||||
@@ -710,6 +712,7 @@ void init_myddas(void) {
|
||||
Yap_MYDDAS_delete_all_myddas_structs();
|
||||
#endif
|
||||
c_db_initialize_myddas(PASS_REGS1);
|
||||
myddas_initialised = TRUE;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -732,4 +735,3 @@ int WINAPI win_myddas(HANDLE hinst, DWORD reason, LPVOID reserved) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -72,6 +72,7 @@ foreach (driver ${MYDDAS_DBMS})
|
||||
cpp_driver(MYDDAS_YAP ${driver} myddas_driver.ypp)
|
||||
endforeach ()
|
||||
|
||||
#list (APPEND MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/test.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
|
||||
add_to_group(MYDDAS_YAP pl_library )
|
||||
|
||||
add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP} )
|
||||
@@ -79,4 +80,3 @@ add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP} )
|
||||
install(FILES ${MYDDAS_YAP}
|
||||
DESTINATION ${libpl}
|
||||
)
|
||||
|
||||
|
@@ -243,8 +243,7 @@ db_open(odbc,Connection,ODBCEntry,User,Password) :-
|
||||
%% sqlite3
|
||||
db_open(sqlite3,Connection,File,User,Password) :-
|
||||
'$error_checks'(db_open(sqlite3,Connection,File,User,Password)),
|
||||
absolute_file_name(File,FullFile,[access(exist),file_errors(error),expand(true)]),
|
||||
c_sqlite3_connect(FullFile,User,Password,Con),
|
||||
c_sqlite3_connect(File,User,Password,Con),
|
||||
set_value(Connection,Con).
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
@@ -182,7 +182,7 @@ DBMS(show_databases)(Connection,database(Databases)) :-
|
||||
DBMS(result_set)(Mode),
|
||||
'$write_or_not'('SHOW DATABASES'),
|
||||
c_DBMS(query)('SHOW DATABASES',ResultSet,Conn,Mode,_),
|
||||
!,c_DBMS(row)(ResultSet,1,[Databases]).
|
||||
!,DBMS(row)(ResultSet,1,[Databases]).
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
|
@@ -174,6 +174,7 @@
|
||||
nonvar(Module).
|
||||
% Prevent the error of given an atom that has no value
|
||||
'$error_checks'(get_value(Connection,Con)) :- !,
|
||||
writeln(user_error,get_value(Connection,Con)),
|
||||
% This also prevents the case of giving the number of the connection
|
||||
% as an argument
|
||||
atom(Connection),
|
||||
@@ -181,11 +182,3 @@
|
||||
get_value(Connection,Value),
|
||||
Value \== [].
|
||||
|
||||
% Prevent the error of given an atom that has no value
|
||||
'$error_checks'(get_value(Conn,Connection)) :- !,
|
||||
% This also prevents the case of giving the number of the connection
|
||||
% as an argument
|
||||
atom(Conn),
|
||||
var(Connection),
|
||||
get_value(Conn,Value),
|
||||
Value \== [].
|
||||
|
@@ -393,14 +393,14 @@
|
||||
% Only for making the error tests in all of the calls to
|
||||
% get_value/2
|
||||
'$get_value'(Connection,Con) :-
|
||||
'$error_checks'(get_value(Connection,Con)),
|
||||
%'$error_checks'(get_value(Connection,Con)),
|
||||
get_value(Connection,Con).
|
||||
|
||||
|
||||
'$check_fields'([],[]).
|
||||
'$check_fields'(['$const$'(_)|TAtt],[_|TFields]):-
|
||||
'$check_fields'(TAtt,TFields).
|
||||
% um campo auto_incrementavel, <20> sempre parte da chave, e como <20> auto
|
||||
% um campo auto_incrementavel, <20> sempre parte da chave, e como <20> auto
|
||||
% pode-se dar valores NULOS
|
||||
'$check_fields'([att(_,Name)|TAtt],[property(Name,_,1,1)|TFields]):-!,
|
||||
'$check_fields'(TAtt,TFields).
|
||||
|
@@ -53,3 +53,6 @@ install(TARGETS sqlite4YAP
|
||||
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
# file (INSTALL chinook.db test.yap DESTINATION ${libpl})
|
||||
|
@@ -77,7 +77,6 @@ static Int c_sqlite3_get_database(USES_REGS1);
|
||||
static Int c_sqlite3_change_database(USES_REGS1);
|
||||
|
||||
static Int c_sqlite3_connect(USES_REGS1) {
|
||||
|
||||
Term arg_file = Deref(ARG1);
|
||||
Term arg_db = ARG4;
|
||||
|
||||
@@ -85,12 +84,14 @@ static Int c_sqlite3_connect(USES_REGS1) {
|
||||
sqlite3 *db;
|
||||
|
||||
const char *file = AtomName(AtomOfTerm(arg_file));
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "connect sqlite3 %s",file);
|
||||
|
||||
CALL_SQLITE(ARG1, open(file, &db));
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "connect sqlite3 %p",db);
|
||||
|
||||
if (!Yap_unify(arg_db, MkAddressTerm(db)))
|
||||
return FALSE;
|
||||
else {
|
||||
if (!Yap_unify(arg_db, MkAddressTerm(db))) {
|
||||
return false;
|
||||
} else {
|
||||
/* Criar um novo no na lista de ligacoes*/
|
||||
new = myddas_util_add_connection(db, NULL, API_SQLITE3);
|
||||
|
||||
@@ -98,9 +99,9 @@ static Int c_sqlite3_connect(USES_REGS1) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "ERROR: ** c_db_my_connect ** Error allocating memory\n");
|
||||
#endif
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,6 +277,7 @@ static Int c_sqlite3_number_of_fields(USES_REGS1) {
|
||||
const char *relation = AtomName(AtomOfTerm(arg_relation));
|
||||
sqlite3 *db = AddressOfTerm(arg_db);
|
||||
sqlite3_stmt *stmt;
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", " sqlite3 relation %s",relation);
|
||||
|
||||
char sql[256];
|
||||
|
||||
@@ -288,7 +290,11 @@ static Int c_sqlite3_number_of_fields(USES_REGS1) {
|
||||
|
||||
CALL_SQLITE(ARG1, finalize(stmt));
|
||||
|
||||
return Yap_unify(arg_fields, MkIntegerTerm(fields));
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", " sqlite3 fields %d",fields);
|
||||
|
||||
|
||||
|
||||
return Yap_unify(arg_fields, MkIntegerTerm(fields));
|
||||
}
|
||||
|
||||
/* db_get_attributes_types: RelName x connection -> TypesList */
|
||||
@@ -301,6 +307,7 @@ static Int c_sqlite3_get_attributes_types(USES_REGS1) {
|
||||
sqlite3 *db = (sqlite3 *)IntegerOfTerm(arg_db);
|
||||
char sql[256];
|
||||
int row;
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", " sqlite3 reelation %s get_attributes",relation);
|
||||
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
@@ -341,7 +348,8 @@ static Int c_sqlite3_get_attributes_types(USES_REGS1) {
|
||||
tm = "?";
|
||||
break;
|
||||
}
|
||||
list = Yap_MkNewPairTerm();
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", " sqlite3 attributes %s:%s ",sqlite3_column_name(stmt, row),tm);
|
||||
list = Yap_MkNewPairTerm();
|
||||
*tfp = list;
|
||||
RepPair(list)[0] = MkAtomTerm(Yap_LookupAtom(tm));
|
||||
tfp = RepPair(list) + 1;
|
||||
@@ -664,18 +672,16 @@ static void Yap_InitBackMYDDAS_SQLITE3Preds(void) {
|
||||
}
|
||||
|
||||
X_API void init_sqlite3(void) {
|
||||
// Yap_InitMYDDAS_SQLITE3Preds();
|
||||
// Yap_InitBackMYDDAS_SQLITE3Preds();
|
||||
Term cm = CurrentModule;
|
||||
CurrentModule = MkAtomTerm(Yap_LookupAtom("myddas_sqlite3"));
|
||||
|
||||
Yap_InitMYDDAS_SQLITE3Preds();
|
||||
|
||||
Yap_InitBackMYDDAS_SQLITE3Preds();
|
||||
|
||||
CurrentModule = cm;
|
||||
}
|
||||
|
||||
#if _ANDROID_
|
||||
//JNIEXPORT void JNICALL lib_yap_up_pt_init_sqlite(JNIEnv *env);
|
||||
|
||||
// JNIEXPORT void JNICALL lib_yap_up_pt_init_sqlite(JNIEnv *env) {
|
||||
// init_sqlite3();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
|
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.sqlite.app.customsqlite"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
|
||||
<activity android:name="CustomSqlite"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
@@ -1,17 +0,0 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked into Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
@@ -1,92 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="CustomSqlite" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
@@ -1,4 +0,0 @@
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(LOCAL_PATH)/sqlite/Android.mk
|
||||
|
@@ -1 +0,0 @@
|
||||
APP_STL:=stlport_static
|
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
#ifndef NATIVEHELPER_ALOGPRIV_H_
|
||||
#define NATIVEHELPER_ALOGPRIV_H_
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#ifndef LOG_NDEBUG
|
||||
#ifdef NDEBUG
|
||||
#define LOG_NDEBUG 1
|
||||
#else
|
||||
#define LOG_NDEBUG 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Basic log message macros intended to emulate the behavior of log/log.h
|
||||
* in system core. This should be dependent only on ndk exposed logging
|
||||
* functionality.
|
||||
*/
|
||||
|
||||
#ifndef ALOG
|
||||
#define ALOG(priority, tag, fmt...) \
|
||||
__android_log_print(ANDROID_##priority, tag, fmt)
|
||||
#endif
|
||||
|
||||
#ifndef ALOGV
|
||||
#if LOG_NDEBUG
|
||||
#define ALOGV(...) ((void)0)
|
||||
#else
|
||||
#define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ALOGD
|
||||
#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef ALOGI
|
||||
#define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef ALOGW
|
||||
#define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef ALOGE
|
||||
#define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Not quite the same as the core android LOG_FATAL_IF (which also
|
||||
** sends a SIGTRAP), but close enough.
|
||||
*/
|
||||
#define LOG_FATAL_IF(bCond, zErr) if( bCond ) ALOGE(zErr);
|
||||
|
||||
#endif
|
@@ -1,44 +0,0 @@
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# If using SEE, uncomment the following:
|
||||
# LOCAL_CFLAGS += -DSQLITE_HAS_CODEC
|
||||
|
||||
# This is important - it causes SQLite to use memory for temp files. Since
|
||||
# Android has no globally writable temp directory, if this is not defined the
|
||||
# application throws an exception when it tries to create a temp file.
|
||||
#
|
||||
LOCAL_CFLAGS += -DSQLITE_TEMP_STORE=3
|
||||
|
||||
LOCAL_CFLAGS += -DHAVE_CONFIG_H -DKHTML_NO_EXCEPTIONS -DGKWQ_NO_JAVA
|
||||
LOCAL_CFLAGS += -DNO_SUPPORT_JS_BINDING -DQT_NO_WHEELEVENT -DKHTML_NO_XBL
|
||||
LOCAL_CFLAGS += -U__APPLE__
|
||||
LOCAL_CFLAGS += -DHAVE_STRCHRNUL=0
|
||||
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-int-to-pointer-cast
|
||||
LOCAL_CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses
|
||||
LOCAL_CPPFLAGS += -Wno-conversion-null
|
||||
|
||||
|
||||
ifeq ($(TARGET_ARCH), arm)
|
||||
LOCAL_CFLAGS += -DPACKED="__attribute__ ((packed))"
|
||||
else
|
||||
LOCAL_CFLAGS += -DPACKED=""
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
android_database_SQLiteCommon.cpp \
|
||||
android_database_SQLiteConnection.cpp \
|
||||
android_database_SQLiteGlobal.cpp \
|
||||
android_database_SQLiteDebug.cpp \
|
||||
JNIHelp.cpp JniConstants.cpp
|
||||
|
||||
LOCAL_SRC_FILES += sqlite3.c
|
||||
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/nativehelper/
|
||||
|
||||
LOCAL_MODULE:= libsqliteX
|
||||
LOCAL_LDLIBS += -ldl -llog
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
@@ -1,341 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "JNIHelp"
|
||||
|
||||
#include "JniConstants.h"
|
||||
#include "JNIHelp.h"
|
||||
#include "ALog-priv.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* Equivalent to ScopedLocalRef, but for C_JNIEnv instead. (And slightly more powerful.)
|
||||
*/
|
||||
template<typename T>
|
||||
class scoped_local_ref {
|
||||
public:
|
||||
scoped_local_ref(C_JNIEnv* env, T localRef = NULL)
|
||||
: mEnv(env), mLocalRef(localRef)
|
||||
{
|
||||
}
|
||||
|
||||
~scoped_local_ref() {
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset(T localRef = NULL) {
|
||||
if (mLocalRef != NULL) {
|
||||
(*mEnv)->DeleteLocalRef(reinterpret_cast<JNIEnv*>(mEnv), mLocalRef);
|
||||
mLocalRef = localRef;
|
||||
}
|
||||
}
|
||||
|
||||
T get() const {
|
||||
return mLocalRef;
|
||||
}
|
||||
|
||||
private:
|
||||
C_JNIEnv* mEnv;
|
||||
T mLocalRef;
|
||||
|
||||
// Disallow copy and assignment.
|
||||
scoped_local_ref(const scoped_local_ref&);
|
||||
void operator=(const scoped_local_ref&);
|
||||
};
|
||||
|
||||
static jclass findClass(C_JNIEnv* env, const char* className) {
|
||||
JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
|
||||
return (*env)->FindClass(e, className);
|
||||
}
|
||||
|
||||
extern "C" int jniRegisterNativeMethods(C_JNIEnv* env, const char* className,
|
||||
const JNINativeMethod* gMethods, int numMethods)
|
||||
{
|
||||
JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
|
||||
|
||||
ALOGV("Registering %s's %d native methods...", className, numMethods);
|
||||
|
||||
scoped_local_ref<jclass> c(env, findClass(env, className));
|
||||
if (c.get() == NULL) {
|
||||
char* msg;
|
||||
asprintf(&msg, "Native registration unable to find class '%s'; aborting...", className);
|
||||
e->FatalError(msg);
|
||||
}
|
||||
|
||||
if ((*env)->RegisterNatives(e, c.get(), gMethods, numMethods) < 0) {
|
||||
char* msg;
|
||||
asprintf(&msg, "RegisterNatives failed for '%s'; aborting...", className);
|
||||
e->FatalError(msg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a human-readable summary of an exception object. The buffer will
|
||||
* be populated with the "binary" class name and, if present, the
|
||||
* exception message.
|
||||
*/
|
||||
static bool getExceptionSummary(C_JNIEnv* env, jthrowable exception, std::string& result) {
|
||||
JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
|
||||
|
||||
/* get the name of the exception's class */
|
||||
scoped_local_ref<jclass> exceptionClass(env, (*env)->GetObjectClass(e, exception)); // can't fail
|
||||
scoped_local_ref<jclass> classClass(env,
|
||||
(*env)->GetObjectClass(e, exceptionClass.get())); // java.lang.Class, can't fail
|
||||
jmethodID classGetNameMethod =
|
||||
(*env)->GetMethodID(e, classClass.get(), "getName", "()Ljava/lang/String;");
|
||||
scoped_local_ref<jstring> classNameStr(env,
|
||||
(jstring) (*env)->CallObjectMethod(e, exceptionClass.get(), classGetNameMethod));
|
||||
if (classNameStr.get() == NULL) {
|
||||
(*env)->ExceptionClear(e);
|
||||
result = "<error getting class name>";
|
||||
return false;
|
||||
}
|
||||
const char* classNameChars = (*env)->GetStringUTFChars(e, classNameStr.get(), NULL);
|
||||
if (classNameChars == NULL) {
|
||||
(*env)->ExceptionClear(e);
|
||||
result = "<error getting class name UTF-8>";
|
||||
return false;
|
||||
}
|
||||
result += classNameChars;
|
||||
(*env)->ReleaseStringUTFChars(e, classNameStr.get(), classNameChars);
|
||||
|
||||
/* if the exception has a detail message, get that */
|
||||
jmethodID getMessage =
|
||||
(*env)->GetMethodID(e, exceptionClass.get(), "getMessage", "()Ljava/lang/String;");
|
||||
scoped_local_ref<jstring> messageStr(env,
|
||||
(jstring) (*env)->CallObjectMethod(e, exception, getMessage));
|
||||
if (messageStr.get() == NULL) {
|
||||
return true;
|
||||
}
|
||||
|
||||
result += ": ";
|
||||
|
||||
const char* messageChars = (*env)->GetStringUTFChars(e, messageStr.get(), NULL);
|
||||
if (messageChars != NULL) {
|
||||
result += messageChars;
|
||||
(*env)->ReleaseStringUTFChars(e, messageStr.get(), messageChars);
|
||||
} else {
|
||||
result += "<error getting message>";
|
||||
(*env)->ExceptionClear(e); // clear OOM
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns an exception (with stack trace) as a string.
|
||||
*/
|
||||
static bool getStackTrace(C_JNIEnv* env, jthrowable exception, std::string& result) {
|
||||
JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
|
||||
|
||||
scoped_local_ref<jclass> stringWriterClass(env, findClass(env, "java/io/StringWriter"));
|
||||
if (stringWriterClass.get() == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
jmethodID stringWriterCtor = (*env)->GetMethodID(e, stringWriterClass.get(), "<init>", "()V");
|
||||
jmethodID stringWriterToStringMethod =
|
||||
(*env)->GetMethodID(e, stringWriterClass.get(), "toString", "()Ljava/lang/String;");
|
||||
|
||||
scoped_local_ref<jclass> printWriterClass(env, findClass(env, "java/io/PrintWriter"));
|
||||
if (printWriterClass.get() == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
jmethodID printWriterCtor =
|
||||
(*env)->GetMethodID(e, printWriterClass.get(), "<init>", "(Ljava/io/Writer;)V");
|
||||
|
||||
scoped_local_ref<jobject> stringWriter(env,
|
||||
(*env)->NewObject(e, stringWriterClass.get(), stringWriterCtor));
|
||||
if (stringWriter.get() == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
jobject printWriter =
|
||||
(*env)->NewObject(e, printWriterClass.get(), printWriterCtor, stringWriter.get());
|
||||
if (printWriter == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
scoped_local_ref<jclass> exceptionClass(env, (*env)->GetObjectClass(e, exception)); // can't fail
|
||||
jmethodID printStackTraceMethod =
|
||||
(*env)->GetMethodID(e, exceptionClass.get(), "printStackTrace", "(Ljava/io/PrintWriter;)V");
|
||||
(*env)->CallVoidMethod(e, exception, printStackTraceMethod, printWriter);
|
||||
|
||||
if ((*env)->ExceptionCheck(e)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
scoped_local_ref<jstring> messageStr(env,
|
||||
(jstring) (*env)->CallObjectMethod(e, stringWriter.get(), stringWriterToStringMethod));
|
||||
if (messageStr.get() == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* utfChars = (*env)->GetStringUTFChars(e, messageStr.get(), NULL);
|
||||
if (utfChars == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
result = utfChars;
|
||||
|
||||
(*env)->ReleaseStringUTFChars(e, messageStr.get(), utfChars);
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" int jniThrowException(C_JNIEnv* env, const char* className, const char* msg) {
|
||||
JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
|
||||
|
||||
if ((*env)->ExceptionCheck(e)) {
|
||||
/* TODO: consider creating the new exception with this as "cause" */
|
||||
scoped_local_ref<jthrowable> exception(env, (*env)->ExceptionOccurred(e));
|
||||
(*env)->ExceptionClear(e);
|
||||
|
||||
if (exception.get() != NULL) {
|
||||
std::string text;
|
||||
getExceptionSummary(env, exception.get(), text);
|
||||
ALOGW("Discarding pending exception (%s) to throw %s", text.c_str(), className);
|
||||
}
|
||||
}
|
||||
|
||||
scoped_local_ref<jclass> exceptionClass(env, findClass(env, className));
|
||||
if (exceptionClass.get() == NULL) {
|
||||
ALOGE("Unable to find exception class %s", className);
|
||||
/* ClassNotFoundException now pending */
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((*env)->ThrowNew(e, exceptionClass.get(), msg) != JNI_OK) {
|
||||
ALOGE("Failed throwing '%s' '%s'", className, msg);
|
||||
/* an exception, most likely OOM, will now be pending */
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int jniThrowExceptionFmt(C_JNIEnv* env, const char* className, const char* fmt, va_list args) {
|
||||
char msgBuf[512];
|
||||
vsnprintf(msgBuf, sizeof(msgBuf), fmt, args);
|
||||
return jniThrowException(env, className, msgBuf);
|
||||
}
|
||||
|
||||
int jniThrowNullPointerException(C_JNIEnv* env, const char* msg) {
|
||||
return jniThrowException(env, "java/lang/NullPointerException", msg);
|
||||
}
|
||||
|
||||
int jniThrowRuntimeException(C_JNIEnv* env, const char* msg) {
|
||||
return jniThrowException(env, "java/lang/RuntimeException", msg);
|
||||
}
|
||||
|
||||
int jniThrowIOException(C_JNIEnv* env, int errnum) {
|
||||
char buffer[80];
|
||||
const char* message = jniStrError(errnum, buffer, sizeof(buffer));
|
||||
return jniThrowException(env, "java/io/IOException", message);
|
||||
}
|
||||
|
||||
static std::string jniGetStackTrace(C_JNIEnv* env, jthrowable exception) {
|
||||
JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
|
||||
|
||||
scoped_local_ref<jthrowable> currentException(env, (*env)->ExceptionOccurred(e));
|
||||
if (exception == NULL) {
|
||||
exception = currentException.get();
|
||||
if (exception == NULL) {
|
||||
return "<no pending exception>";
|
||||
}
|
||||
}
|
||||
|
||||
if (currentException.get() != NULL) {
|
||||
(*env)->ExceptionClear(e);
|
||||
}
|
||||
|
||||
std::string trace;
|
||||
if (!getStackTrace(env, exception, trace)) {
|
||||
(*env)->ExceptionClear(e);
|
||||
getExceptionSummary(env, exception, trace);
|
||||
}
|
||||
|
||||
if (currentException.get() != NULL) {
|
||||
(*env)->Throw(e, currentException.get()); // rethrow
|
||||
}
|
||||
|
||||
return trace;
|
||||
}
|
||||
|
||||
void jniLogException(C_JNIEnv* env, int priority, const char* tag, jthrowable exception) {
|
||||
std::string trace(jniGetStackTrace(env, exception));
|
||||
__android_log_write(priority, tag, trace.c_str());
|
||||
}
|
||||
|
||||
const char* jniStrError(int errnum, char* buf, size_t buflen) {
|
||||
#if __GLIBC__
|
||||
// Note: glibc has a nonstandard strerror_r that returns char* rather than POSIX's int.
|
||||
// char *strerror_r(int errnum, char *buf, size_t n);
|
||||
return strerror_r(errnum, buf, buflen);
|
||||
#else
|
||||
char *rc = strerror_r(errnum, buf, buflen);
|
||||
if (rc != NULL) {
|
||||
// (POSIX only guarantees a value other than 0. The safest
|
||||
// way to implement this function is to use C++ and overload on the
|
||||
// type of strerror_r to accurately distinguish GNU from POSIX.)
|
||||
snprintf(buf, buflen, "errno %d", errnum);
|
||||
}
|
||||
return buf;
|
||||
#endif
|
||||
}
|
||||
|
||||
jobject jniCreateFileDescriptor(C_JNIEnv* env, int fd) {
|
||||
JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
|
||||
static jmethodID ctor = e->GetMethodID(JniConstants::fileDescriptorClass, "<init>", "()V");
|
||||
jobject fileDescriptor = (*env)->NewObject(e, JniConstants::fileDescriptorClass, ctor);
|
||||
// NOTE: NewObject ensures that an OutOfMemoryError will be seen by the Java
|
||||
// caller if the alloc fails, so we just return NULL when that happens.
|
||||
if (fileDescriptor != NULL) {
|
||||
jniSetFileDescriptorOfFD(env, fileDescriptor, fd);
|
||||
}
|
||||
return fileDescriptor;
|
||||
}
|
||||
|
||||
int jniGetFDFromFileDescriptor(C_JNIEnv* env, jobject fileDescriptor) {
|
||||
JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
|
||||
static jfieldID fid = e->GetFieldID(JniConstants::fileDescriptorClass, "descriptor", "I");
|
||||
if (fileDescriptor != NULL) {
|
||||
return (*env)->GetIntField(e, fileDescriptor, fid);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void jniSetFileDescriptorOfFD(C_JNIEnv* env, jobject fileDescriptor, int value) {
|
||||
JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
|
||||
static jfieldID fid = e->GetFieldID(JniConstants::fileDescriptorClass, "descriptor", "I");
|
||||
(*env)->SetIntField(e, fileDescriptor, fid, value);
|
||||
}
|
||||
|
||||
jobject jniGetReferent(C_JNIEnv* env, jobject ref) {
|
||||
JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
|
||||
static jmethodID get = e->GetMethodID(JniConstants::referenceClass, "get", "()Ljava/lang/Object;");
|
||||
return (*env)->CallObjectMethod(e, ref, get);
|
||||
}
|
||||
|
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "JniConstants"
|
||||
|
||||
#include "ALog-priv.h"
|
||||
#include "JniConstants.h"
|
||||
#include "ScopedLocalRef.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
jclass JniConstants::bidiRunClass;
|
||||
jclass JniConstants::bigDecimalClass;
|
||||
jclass JniConstants::booleanClass;
|
||||
jclass JniConstants::byteArrayClass;
|
||||
jclass JniConstants::byteClass;
|
||||
jclass JniConstants::calendarClass;
|
||||
jclass JniConstants::characterClass;
|
||||
jclass JniConstants::charsetICUClass;
|
||||
jclass JniConstants::constructorClass;
|
||||
jclass JniConstants::deflaterClass;
|
||||
jclass JniConstants::doubleClass;
|
||||
jclass JniConstants::errnoExceptionClass;
|
||||
jclass JniConstants::fieldClass;
|
||||
jclass JniConstants::fieldPositionIteratorClass;
|
||||
jclass JniConstants::fileDescriptorClass;
|
||||
jclass JniConstants::floatClass;
|
||||
jclass JniConstants::gaiExceptionClass;
|
||||
jclass JniConstants::inet6AddressClass;
|
||||
jclass JniConstants::inetAddressClass;
|
||||
jclass JniConstants::inetSocketAddressClass;
|
||||
jclass JniConstants::inetUnixAddressClass;
|
||||
jclass JniConstants::inflaterClass;
|
||||
jclass JniConstants::inputStreamClass;
|
||||
jclass JniConstants::integerClass;
|
||||
jclass JniConstants::localeDataClass;
|
||||
jclass JniConstants::longClass;
|
||||
jclass JniConstants::methodClass;
|
||||
jclass JniConstants::mutableIntClass;
|
||||
jclass JniConstants::mutableLongClass;
|
||||
jclass JniConstants::objectClass;
|
||||
jclass JniConstants::objectArrayClass;
|
||||
jclass JniConstants::outputStreamClass;
|
||||
jclass JniConstants::parsePositionClass;
|
||||
jclass JniConstants::patternSyntaxExceptionClass;
|
||||
jclass JniConstants::realToStringClass;
|
||||
jclass JniConstants::referenceClass;
|
||||
jclass JniConstants::shortClass;
|
||||
jclass JniConstants::socketClass;
|
||||
jclass JniConstants::socketImplClass;
|
||||
jclass JniConstants::stringClass;
|
||||
jclass JniConstants::structAddrinfoClass;
|
||||
jclass JniConstants::structFlockClass;
|
||||
jclass JniConstants::structGroupReqClass;
|
||||
jclass JniConstants::structLingerClass;
|
||||
jclass JniConstants::structPasswdClass;
|
||||
jclass JniConstants::structPollfdClass;
|
||||
jclass JniConstants::structStatClass;
|
||||
jclass JniConstants::structStatVfsClass;
|
||||
jclass JniConstants::structTimevalClass;
|
||||
jclass JniConstants::structUcredClass;
|
||||
jclass JniConstants::structUtsnameClass;
|
||||
|
||||
static jclass findClass(JNIEnv* env, const char* name) {
|
||||
ScopedLocalRef<jclass> localClass(env, env->FindClass(name));
|
||||
jclass result = reinterpret_cast<jclass>(env->NewGlobalRef(localClass.get()));
|
||||
if (result == NULL) {
|
||||
ALOGE("failed to find class '%s'", name);
|
||||
abort();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void JniConstants::init(JNIEnv* env) {
|
||||
bidiRunClass = findClass(env, "java/text/Bidi$Run");
|
||||
bigDecimalClass = findClass(env, "java/math/BigDecimal");
|
||||
booleanClass = findClass(env, "java/lang/Boolean");
|
||||
byteClass = findClass(env, "java/lang/Byte");
|
||||
byteArrayClass = findClass(env, "[B");
|
||||
calendarClass = findClass(env, "java/util/Calendar");
|
||||
characterClass = findClass(env, "java/lang/Character");
|
||||
charsetICUClass = findClass(env, "java/nio/charset/CharsetICU");
|
||||
constructorClass = findClass(env, "java/lang/reflect/Constructor");
|
||||
floatClass = findClass(env, "java/lang/Float");
|
||||
deflaterClass = findClass(env, "java/util/zip/Deflater");
|
||||
doubleClass = findClass(env, "java/lang/Double");
|
||||
errnoExceptionClass = findClass(env, "libcore/io/ErrnoException");
|
||||
fieldClass = findClass(env, "java/lang/reflect/Field");
|
||||
fieldPositionIteratorClass = findClass(env, "libcore/icu/NativeDecimalFormat$FieldPositionIterator");
|
||||
fileDescriptorClass = findClass(env, "java/io/FileDescriptor");
|
||||
gaiExceptionClass = findClass(env, "libcore/io/GaiException");
|
||||
inet6AddressClass = findClass(env, "java/net/Inet6Address");
|
||||
inetAddressClass = findClass(env, "java/net/InetAddress");
|
||||
inetSocketAddressClass = findClass(env, "java/net/InetSocketAddress");
|
||||
inetUnixAddressClass = findClass(env, "java/net/InetUnixAddress");
|
||||
inflaterClass = findClass(env, "java/util/zip/Inflater");
|
||||
inputStreamClass = findClass(env, "java/io/InputStream");
|
||||
integerClass = findClass(env, "java/lang/Integer");
|
||||
localeDataClass = findClass(env, "libcore/icu/LocaleData");
|
||||
longClass = findClass(env, "java/lang/Long");
|
||||
methodClass = findClass(env, "java/lang/reflect/Method");
|
||||
mutableIntClass = findClass(env, "libcore/util/MutableInt");
|
||||
mutableLongClass = findClass(env, "libcore/util/MutableLong");
|
||||
objectClass = findClass(env, "java/lang/Object");
|
||||
objectArrayClass = findClass(env, "[Ljava/lang/Object;");
|
||||
outputStreamClass = findClass(env, "java/io/OutputStream");
|
||||
parsePositionClass = findClass(env, "java/text/ParsePosition");
|
||||
patternSyntaxExceptionClass = findClass(env, "java/util/regex/PatternSyntaxException");
|
||||
realToStringClass = findClass(env, "java/lang/RealToString");
|
||||
referenceClass = findClass(env, "java/lang/ref/Reference");
|
||||
shortClass = findClass(env, "java/lang/Short");
|
||||
socketClass = findClass(env, "java/net/Socket");
|
||||
socketImplClass = findClass(env, "java/net/SocketImpl");
|
||||
stringClass = findClass(env, "java/lang/String");
|
||||
structAddrinfoClass = findClass(env, "libcore/io/StructAddrinfo");
|
||||
structFlockClass = findClass(env, "libcore/io/StructFlock");
|
||||
structGroupReqClass = findClass(env, "libcore/io/StructGroupReq");
|
||||
structLingerClass = findClass(env, "libcore/io/StructLinger");
|
||||
structPasswdClass = findClass(env, "libcore/io/StructPasswd");
|
||||
structPollfdClass = findClass(env, "libcore/io/StructPollfd");
|
||||
structStatClass = findClass(env, "libcore/io/StructStat");
|
||||
structStatVfsClass = findClass(env, "libcore/io/StructStatVfs");
|
||||
structTimevalClass = findClass(env, "libcore/io/StructTimeval");
|
||||
structUcredClass = findClass(env, "libcore/io/StructUcred");
|
||||
structUtsnameClass = findClass(env, "libcore/io/StructUtsname");
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
|
||||
All the files in this directory are copied from stock android. The following
|
||||
files:
|
||||
|
||||
JniConstants.cpp
|
||||
JNIHelp.cpp
|
||||
ALog-priv.h
|
||||
|
||||
are copied in from Android's libnativehelper module (altogether less than 1000
|
||||
lines of code). The remainder are from the core framework (directory
|
||||
/frameworks/base/core/jni).
|
||||
|
||||
Notes on changes:
|
||||
|
||||
The ashmem_XXX() interfaces are used for the various "xxxForBlobDescriptor()"
|
||||
API functions. The code in libcutils for this seems to be platform
|
||||
dependent - some platforms have kernel support, others have a user space
|
||||
implementation. So these functions are not supported for now.
|
||||
|
||||
The original SQLiteConnection.cpp uses AndroidRuntime::genJNIEnv() to obtain a
|
||||
pointer to the current threads environment. Changed to store a pointer to the
|
||||
process JavaVM (Android allows only one) as a global variable. Then retrieve
|
||||
the JNIEnv as needed using GetEnv().
|
||||
|
||||
Replaced uses of class String8 with std::string in SQLiteConnection.cpp and a
|
||||
few other places.
|
||||
|
||||
The stock Android code to populate CursorWindow containers with the results of
|
||||
a SELECT statement uses a C++ interface that is not available to NDK builds. So
|
||||
this code is rewritten to call the CursorWindow java interface via JNI methods.
|
||||
This is the largest source code change. See function
|
||||
nativeExecuteForCursorWindow() in file android_database_SQLiteConnection.cpp
|
||||
for details.
|
||||
|
||||
The "LOCALIZED" collation and some miscellaneous user-functions added by the
|
||||
sqlite3_android.cpp module are not included. A collation called LOCALIZED
|
||||
that is equivalent to BINARY is added instead to keep various things working.
|
||||
This should not cause serious problems - class SQLiteConnection always
|
||||
runs "REINDEX LOCALIZED" immediately after opening a connection.
|
||||
|
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
#include "android_database_SQLiteCommon.h"
|
||||
|
||||
namespace android {
|
||||
|
||||
/* throw a SQLiteException with a message appropriate for the error in handle */
|
||||
void throw_sqlite3_exception(JNIEnv* env, sqlite3* handle) {
|
||||
throw_sqlite3_exception(env, handle, NULL);
|
||||
}
|
||||
|
||||
/* throw a SQLiteException with the given message */
|
||||
void throw_sqlite3_exception(JNIEnv* env, const char* message) {
|
||||
throw_sqlite3_exception(env, NULL, message);
|
||||
}
|
||||
|
||||
/* throw a SQLiteException with a message appropriate for the error in handle
|
||||
concatenated with the given message
|
||||
*/
|
||||
void throw_sqlite3_exception(JNIEnv* env, sqlite3* handle, const char* message) {
|
||||
if (handle) {
|
||||
// get the error code and message from the SQLite connection
|
||||
// the error message may contain more information than the error code
|
||||
// because it is based on the extended error code rather than the simplified
|
||||
// error code that SQLite normally returns.
|
||||
throw_sqlite3_exception(env, sqlite3_extended_errcode(handle),
|
||||
sqlite3_errmsg(handle), message);
|
||||
} else {
|
||||
// we use SQLITE_OK so that a generic SQLiteException is thrown;
|
||||
// any code not specified in the switch statement below would do.
|
||||
throw_sqlite3_exception(env, SQLITE_OK, "unknown error", message);
|
||||
}
|
||||
}
|
||||
|
||||
/* throw a SQLiteException for a given error code
|
||||
* should only be used when the database connection is not available because the
|
||||
* error information will not be quite as rich */
|
||||
void throw_sqlite3_exception_errcode(JNIEnv* env, int errcode, const char* message) {
|
||||
throw_sqlite3_exception(env, errcode, "unknown error", message);
|
||||
}
|
||||
|
||||
/* throw a SQLiteException for a given error code, sqlite3message, and
|
||||
user message
|
||||
*/
|
||||
void throw_sqlite3_exception(JNIEnv* env, int errcode,
|
||||
const char* sqlite3Message, const char* message) {
|
||||
const char* exceptionClass;
|
||||
switch (errcode & 0xff) { /* mask off extended error code */
|
||||
case SQLITE_IOERR:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteDiskIOException";
|
||||
break;
|
||||
case SQLITE_CORRUPT:
|
||||
case SQLITE_NOTADB: // treat "unsupported file format" error as corruption also
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteDatabaseCorruptException";
|
||||
break;
|
||||
case SQLITE_CONSTRAINT:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteConstraintException";
|
||||
break;
|
||||
case SQLITE_ABORT:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteAbortException";
|
||||
break;
|
||||
case SQLITE_DONE:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteDoneException";
|
||||
sqlite3Message = NULL; // SQLite error message is irrelevant in this case
|
||||
break;
|
||||
case SQLITE_FULL:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteFullException";
|
||||
break;
|
||||
case SQLITE_MISUSE:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteMisuseException";
|
||||
break;
|
||||
case SQLITE_PERM:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteAccessPermException";
|
||||
break;
|
||||
case SQLITE_BUSY:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteDatabaseLockedException";
|
||||
break;
|
||||
case SQLITE_LOCKED:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteTableLockedException";
|
||||
break;
|
||||
case SQLITE_READONLY:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteReadOnlyDatabaseException";
|
||||
break;
|
||||
case SQLITE_CANTOPEN:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteCantOpenDatabaseException";
|
||||
break;
|
||||
case SQLITE_TOOBIG:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteBlobTooBigException";
|
||||
break;
|
||||
case SQLITE_RANGE:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteBindOrColumnIndexOutOfRangeException";
|
||||
break;
|
||||
case SQLITE_NOMEM:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteOutOfMemoryException";
|
||||
break;
|
||||
case SQLITE_MISMATCH:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteDatatypeMismatchException";
|
||||
break;
|
||||
case SQLITE_INTERRUPT:
|
||||
exceptionClass = "android/os/OperationCanceledException";
|
||||
break;
|
||||
default:
|
||||
exceptionClass = "org/sqlite/database/sqlite/SQLiteException";
|
||||
break;
|
||||
}
|
||||
|
||||
if (sqlite3Message) {
|
||||
char *zFullmsg = sqlite3_mprintf(
|
||||
"%s (code %d)%s%s", sqlite3Message, errcode,
|
||||
(message ? ": " : ""), (message ? message : "")
|
||||
);
|
||||
jniThrowException(env, exceptionClass, zFullmsg);
|
||||
sqlite3_free(zFullmsg);
|
||||
} else {
|
||||
jniThrowException(env, exceptionClass, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace android
|
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
#ifndef _ANDROID_DATABASE_SQLITE_COMMON_H
|
||||
#define _ANDROID_DATABASE_SQLITE_COMMON_H
|
||||
|
||||
#include <jni.h>
|
||||
#include <JNIHelp.h>
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
// Special log tags defined in SQLiteDebug.java.
|
||||
#define SQLITE_LOG_TAG "SQLiteLog"
|
||||
#define SQLITE_TRACE_TAG "SQLiteStatements"
|
||||
#define SQLITE_PROFILE_TAG "SQLiteTime"
|
||||
|
||||
namespace android {
|
||||
|
||||
/* throw a SQLiteException with a message appropriate for the error in handle */
|
||||
void throw_sqlite3_exception(JNIEnv* env, sqlite3* handle);
|
||||
|
||||
/* throw a SQLiteException with the given message */
|
||||
void throw_sqlite3_exception(JNIEnv* env, const char* message);
|
||||
|
||||
/* throw a SQLiteException with a message appropriate for the error in handle
|
||||
concatenated with the given message
|
||||
*/
|
||||
void throw_sqlite3_exception(JNIEnv* env, sqlite3* handle, const char* message);
|
||||
|
||||
/* throw a SQLiteException for a given error code */
|
||||
void throw_sqlite3_exception_errcode(JNIEnv* env, int errcode, const char* message);
|
||||
|
||||
void throw_sqlite3_exception(JNIEnv* env, int errcode,
|
||||
const char* sqlite3Message, const char* message);
|
||||
|
||||
}
|
||||
|
||||
#endif // _ANDROID_DATABASE_SQLITE_COMMON_H
|
File diff suppressed because it is too large
Load Diff
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "SQLiteDebug"
|
||||
|
||||
#include <jni.h>
|
||||
#include <JNIHelp.h>
|
||||
#include <ALog-priv.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
static struct {
|
||||
jfieldID memoryUsed;
|
||||
jfieldID pageCacheOverflow;
|
||||
jfieldID largestMemAlloc;
|
||||
} gSQLiteDebugPagerStatsClassInfo;
|
||||
|
||||
static void nativeGetPagerStats(JNIEnv *env, jobject clazz, jobject statsObj)
|
||||
{
|
||||
int memoryUsed;
|
||||
int pageCacheOverflow;
|
||||
int largestMemAlloc;
|
||||
int unused;
|
||||
|
||||
sqlite3_status(SQLITE_STATUS_MEMORY_USED, &memoryUsed, &unused, 0);
|
||||
sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &unused, &largestMemAlloc, 0);
|
||||
sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &pageCacheOverflow, &unused, 0);
|
||||
env->SetIntField(statsObj, gSQLiteDebugPagerStatsClassInfo.memoryUsed, memoryUsed);
|
||||
env->SetIntField(statsObj, gSQLiteDebugPagerStatsClassInfo.pageCacheOverflow,
|
||||
pageCacheOverflow);
|
||||
env->SetIntField(statsObj, gSQLiteDebugPagerStatsClassInfo.largestMemAlloc, largestMemAlloc);
|
||||
}
|
||||
|
||||
/*
|
||||
* JNI registration.
|
||||
*/
|
||||
|
||||
static JNINativeMethod gMethods[] =
|
||||
{
|
||||
{ "nativeGetPagerStats", "(Lorg/sqlite/database/sqlite/SQLiteDebug$PagerStats;)V",
|
||||
(void*) nativeGetPagerStats },
|
||||
};
|
||||
|
||||
#define FIND_CLASS(var, className) \
|
||||
var = env->FindClass(className); \
|
||||
LOG_FATAL_IF(! var, "Unable to find class " className);
|
||||
|
||||
#define GET_FIELD_ID(var, clazz, fieldName, fieldDescriptor) \
|
||||
var = env->GetFieldID(clazz, fieldName, fieldDescriptor); \
|
||||
LOG_FATAL_IF(! var, "Unable to find field " fieldName);
|
||||
|
||||
int register_android_database_SQLiteDebug(JNIEnv *env)
|
||||
{
|
||||
jclass clazz;
|
||||
FIND_CLASS(clazz, "org/sqlite/database/sqlite/SQLiteDebug$PagerStats");
|
||||
|
||||
GET_FIELD_ID(gSQLiteDebugPagerStatsClassInfo.memoryUsed, clazz,
|
||||
"memoryUsed", "I");
|
||||
GET_FIELD_ID(gSQLiteDebugPagerStatsClassInfo.largestMemAlloc, clazz,
|
||||
"largestMemAlloc", "I");
|
||||
GET_FIELD_ID(gSQLiteDebugPagerStatsClassInfo.pageCacheOverflow, clazz,
|
||||
"pageCacheOverflow", "I");
|
||||
|
||||
return jniRegisterNativeMethods(env, "org/sqlite/database/sqlite/SQLiteDebug",
|
||||
gMethods, NELEM(gMethods));
|
||||
}
|
||||
|
||||
} // namespace android
|
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "SQLiteGlobal"
|
||||
|
||||
#include <jni.h>
|
||||
#include <JNIHelp.h>
|
||||
#include "ALog-priv.h"
|
||||
|
||||
|
||||
#include <sqlite3.h>
|
||||
#if 0
|
||||
#include <sqlite3_android.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "android_database_SQLiteCommon.h"
|
||||
|
||||
namespace android {
|
||||
|
||||
// Limit heap to 8MB for now. This is 4 times the maximum cursor window
|
||||
// size, as has been used by the original code in SQLiteDatabase for
|
||||
// a long time.
|
||||
static const int SOFT_HEAP_LIMIT = 8 * 1024 * 1024;
|
||||
|
||||
|
||||
// Called each time a message is logged.
|
||||
static void sqliteLogCallback(void* data, int iErrCode, const char* zMsg) {
|
||||
bool verboseLog = !!data;
|
||||
if (iErrCode == 0 || iErrCode == SQLITE_CONSTRAINT || iErrCode == SQLITE_SCHEMA) {
|
||||
if (verboseLog) {
|
||||
ALOG(LOG_VERBOSE, SQLITE_LOG_TAG, "(%d) %s\n", iErrCode, zMsg);
|
||||
}
|
||||
} else {
|
||||
ALOG(LOG_ERROR, SQLITE_LOG_TAG, "(%d) %s\n", iErrCode, zMsg);
|
||||
}
|
||||
}
|
||||
|
||||
// Sets the global SQLite configuration.
|
||||
// This must be called before any other SQLite functions are called.
|
||||
static void sqliteInitialize() {
|
||||
// Enable multi-threaded mode. In this mode, SQLite is safe to use by multiple
|
||||
// threads as long as no two threads use the same database connection at the same
|
||||
// time (which we guarantee in the SQLite database wrappers).
|
||||
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
|
||||
|
||||
// Redirect SQLite log messages to the Android log.
|
||||
#if 0
|
||||
bool verboseLog = android_util_Log_isVerboseLogEnabled(SQLITE_LOG_TAG);
|
||||
#endif
|
||||
bool verboseLog = false;
|
||||
sqlite3_config(SQLITE_CONFIG_LOG, &sqliteLogCallback, verboseLog ? (void*)1 : NULL);
|
||||
|
||||
// The soft heap limit prevents the page cache allocations from growing
|
||||
// beyond the given limit, no matter what the max page cache sizes are
|
||||
// set to. The limit does not, as of 3.5.0, affect any other allocations.
|
||||
sqlite3_soft_heap_limit(SOFT_HEAP_LIMIT);
|
||||
|
||||
// Initialize SQLite.
|
||||
sqlite3_initialize();
|
||||
}
|
||||
|
||||
static jint nativeReleaseMemory(JNIEnv* env, jclass clazz) {
|
||||
return sqlite3_release_memory(SOFT_HEAP_LIMIT);
|
||||
}
|
||||
|
||||
static JNINativeMethod sMethods[] =
|
||||
{
|
||||
/* name, signature, funcPtr */
|
||||
{ "nativeReleaseMemory", "()I",
|
||||
(void*)nativeReleaseMemory },
|
||||
};
|
||||
|
||||
int register_android_database_SQLiteGlobal(JNIEnv *env)
|
||||
{
|
||||
sqliteInitialize();
|
||||
|
||||
return jniRegisterNativeMethods(env, "org/sqlite/database/sqlite/SQLiteGlobal",
|
||||
sMethods, NELEM(sMethods));
|
||||
}
|
||||
|
||||
} // namespace android
|
@@ -1,191 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* JNI helper functions.
|
||||
*
|
||||
* This file may be included by C or C++ code, which is trouble because jni.h
|
||||
* uses different typedefs for JNIEnv in each language.
|
||||
*
|
||||
* TODO: remove C support.
|
||||
*/
|
||||
#ifndef NATIVEHELPER_JNIHELP_H_
|
||||
#define NATIVEHELPER_JNIHELP_H_
|
||||
|
||||
#include "jni.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef NELEM
|
||||
# define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Register one or more native methods with a particular class.
|
||||
* "className" looks like "java/lang/String". Aborts on failure.
|
||||
* TODO: fix all callers and change the return type to void.
|
||||
*/
|
||||
int jniRegisterNativeMethods(C_JNIEnv* env, const char* className, const JNINativeMethod* gMethods, int numMethods);
|
||||
|
||||
/*
|
||||
* Throw an exception with the specified class and an optional message.
|
||||
*
|
||||
* The "className" argument will be passed directly to FindClass, which
|
||||
* takes strings with slashes (e.g. "java/lang/Object").
|
||||
*
|
||||
* If an exception is currently pending, we log a warning message and
|
||||
* clear it.
|
||||
*
|
||||
* Returns 0 on success, nonzero if something failed (e.g. the exception
|
||||
* class couldn't be found, so *an* exception will still be pending).
|
||||
*
|
||||
* Currently aborts the VM if it can't throw the exception.
|
||||
*/
|
||||
int jniThrowException(C_JNIEnv* env, const char* className, const char* msg);
|
||||
|
||||
/*
|
||||
* Throw a java.lang.NullPointerException, with an optional message.
|
||||
*/
|
||||
int jniThrowNullPointerException(C_JNIEnv* env, const char* msg);
|
||||
|
||||
/*
|
||||
* Throw a java.lang.RuntimeException, with an optional message.
|
||||
*/
|
||||
int jniThrowRuntimeException(C_JNIEnv* env, const char* msg);
|
||||
|
||||
/*
|
||||
* Throw a java.io.IOException, generating the message from errno.
|
||||
*/
|
||||
int jniThrowIOException(C_JNIEnv* env, int errnum);
|
||||
|
||||
/*
|
||||
* Return a pointer to a locale-dependent error string explaining errno
|
||||
* value 'errnum'. The returned pointer may or may not be equal to 'buf'.
|
||||
* This function is thread-safe (unlike strerror) and portable (unlike
|
||||
* strerror_r).
|
||||
*/
|
||||
const char* jniStrError(int errnum, char* buf, size_t buflen);
|
||||
|
||||
/*
|
||||
* Returns a new java.io.FileDescriptor for the given int fd.
|
||||
*/
|
||||
jobject jniCreateFileDescriptor(C_JNIEnv* env, int fd);
|
||||
|
||||
/*
|
||||
* Returns the int fd from a java.io.FileDescriptor.
|
||||
*/
|
||||
int jniGetFDFromFileDescriptor(C_JNIEnv* env, jobject fileDescriptor);
|
||||
|
||||
/*
|
||||
* Sets the int fd in a java.io.FileDescriptor.
|
||||
*/
|
||||
void jniSetFileDescriptorOfFD(C_JNIEnv* env, jobject fileDescriptor, int value);
|
||||
|
||||
/*
|
||||
* Returns the reference from a java.lang.ref.Reference.
|
||||
*/
|
||||
jobject jniGetReferent(C_JNIEnv* env, jobject ref);
|
||||
|
||||
/*
|
||||
* Log a message and an exception.
|
||||
* If exception is NULL, logs the current exception in the JNI environment.
|
||||
*/
|
||||
void jniLogException(C_JNIEnv* env, int priority, const char* tag, jthrowable exception);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* For C++ code, we provide inlines that map to the C functions. g++ always
|
||||
* inlines these, even on non-optimized builds.
|
||||
*/
|
||||
#if defined(__cplusplus)
|
||||
inline int jniRegisterNativeMethods(JNIEnv* env, const char* className, const JNINativeMethod* gMethods, int numMethods) {
|
||||
return jniRegisterNativeMethods(&env->functions, className, gMethods, numMethods);
|
||||
}
|
||||
|
||||
inline int jniThrowException(JNIEnv* env, const char* className, const char* msg) {
|
||||
return jniThrowException(&env->functions, className, msg);
|
||||
}
|
||||
|
||||
extern "C" int jniThrowExceptionFmt(C_JNIEnv* env, const char* className, const char* fmt, va_list args);
|
||||
|
||||
/*
|
||||
* Equivalent to jniThrowException but with a printf-like format string and
|
||||
* variable-length argument list. This is only available in C++.
|
||||
*/
|
||||
inline int jniThrowExceptionFmt(JNIEnv* env, const char* className, const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
return jniThrowExceptionFmt(&env->functions, className, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
inline int jniThrowNullPointerException(JNIEnv* env, const char* msg) {
|
||||
return jniThrowNullPointerException(&env->functions, msg);
|
||||
}
|
||||
|
||||
inline int jniThrowRuntimeException(JNIEnv* env, const char* msg) {
|
||||
return jniThrowRuntimeException(&env->functions, msg);
|
||||
}
|
||||
|
||||
inline int jniThrowIOException(JNIEnv* env, int errnum) {
|
||||
return jniThrowIOException(&env->functions, errnum);
|
||||
}
|
||||
|
||||
inline jobject jniCreateFileDescriptor(JNIEnv* env, int fd) {
|
||||
return jniCreateFileDescriptor(&env->functions, fd);
|
||||
}
|
||||
|
||||
inline int jniGetFDFromFileDescriptor(JNIEnv* env, jobject fileDescriptor) {
|
||||
return jniGetFDFromFileDescriptor(&env->functions, fileDescriptor);
|
||||
}
|
||||
|
||||
inline void jniSetFileDescriptorOfFD(JNIEnv* env, jobject fileDescriptor, int value) {
|
||||
jniSetFileDescriptorOfFD(&env->functions, fileDescriptor, value);
|
||||
}
|
||||
|
||||
inline jobject jniGetReferent(JNIEnv* env, jobject ref) {
|
||||
return jniGetReferent(&env->functions, ref);
|
||||
}
|
||||
|
||||
inline void jniLogException(JNIEnv* env, int priority, const char* tag, jthrowable exception = NULL) {
|
||||
jniLogException(&env->functions, priority, tag, exception);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TEMP_FAILURE_RETRY is defined by some, but not all, versions of
|
||||
* <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
|
||||
* not already defined, then define it here.
|
||||
*/
|
||||
#ifndef TEMP_FAILURE_RETRY
|
||||
/* Used to retry syscalls that can return EINTR. */
|
||||
#define TEMP_FAILURE_RETRY(exp) ({ \
|
||||
typeof (exp) _rc; \
|
||||
do { \
|
||||
_rc = (exp); \
|
||||
} while (_rc == -1 && errno == EINTR); \
|
||||
_rc; })
|
||||
#endif
|
||||
|
||||
#endif /* NATIVEHELPER_JNIHELP_H_ */
|
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef JNI_CONSTANTS_H_included
|
||||
#define JNI_CONSTANTS_H_included
|
||||
|
||||
#include "JNIHelp.h"
|
||||
|
||||
/**
|
||||
* A cache to avoid calling FindClass at runtime.
|
||||
*
|
||||
* Class lookup is relatively expensive (2.5us on passion-eng at the time of writing), so we do
|
||||
* all such lookups eagerly at startup. This means that code that never uses, say,
|
||||
* java.util.zip.Deflater still has to pay for the lookup, but it means that on a device the cost
|
||||
* is definitely paid during boot and amortized. A central cache also removes the temptation to
|
||||
* dynamically call FindClass rather than add a small cache to each file that needs one. Another
|
||||
* cost is that each class cached here requires a global reference, though in practice we save
|
||||
* enough by not having a global reference for each file that uses a class such as java.lang.String
|
||||
* which is used in several files.
|
||||
*
|
||||
* FindClass is still called in a couple of situations: when throwing exceptions, and in some of
|
||||
* the serialization code. The former is clearly not a performance case, and we're currently
|
||||
* assuming that neither is the latter.
|
||||
*
|
||||
* TODO: similar arguments hold for field and method IDs; we should cache them centrally too.
|
||||
*/
|
||||
struct JniConstants {
|
||||
static void init(JNIEnv* env);
|
||||
|
||||
static jclass bidiRunClass;
|
||||
static jclass bigDecimalClass;
|
||||
static jclass booleanClass;
|
||||
static jclass byteArrayClass;
|
||||
static jclass byteClass;
|
||||
static jclass calendarClass;
|
||||
static jclass characterClass;
|
||||
static jclass charsetICUClass;
|
||||
static jclass constructorClass;
|
||||
static jclass deflaterClass;
|
||||
static jclass doubleClass;
|
||||
static jclass errnoExceptionClass;
|
||||
static jclass fieldClass;
|
||||
static jclass fieldPositionIteratorClass;
|
||||
static jclass fileDescriptorClass;
|
||||
static jclass floatClass;
|
||||
static jclass gaiExceptionClass;
|
||||
static jclass inet6AddressClass;
|
||||
static jclass inetAddressClass;
|
||||
static jclass inetSocketAddressClass;
|
||||
static jclass inetUnixAddressClass;
|
||||
static jclass inflaterClass;
|
||||
static jclass inputStreamClass;
|
||||
static jclass integerClass;
|
||||
static jclass localeDataClass;
|
||||
static jclass longClass;
|
||||
static jclass methodClass;
|
||||
static jclass mutableIntClass;
|
||||
static jclass mutableLongClass;
|
||||
static jclass objectClass;
|
||||
static jclass objectArrayClass;
|
||||
static jclass outputStreamClass;
|
||||
static jclass parsePositionClass;
|
||||
static jclass patternSyntaxExceptionClass;
|
||||
static jclass realToStringClass;
|
||||
static jclass referenceClass;
|
||||
static jclass shortClass;
|
||||
static jclass socketClass;
|
||||
static jclass socketImplClass;
|
||||
static jclass stringClass;
|
||||
static jclass structAddrinfoClass;
|
||||
static jclass structFlockClass;
|
||||
static jclass structGroupReqClass;
|
||||
static jclass structLingerClass;
|
||||
static jclass structPasswdClass;
|
||||
static jclass structPollfdClass;
|
||||
static jclass structStatClass;
|
||||
static jclass structStatVfsClass;
|
||||
static jclass structTimevalClass;
|
||||
static jclass structUcredClass;
|
||||
static jclass structUtsnameClass;
|
||||
};
|
||||
|
||||
#define NATIVE_METHOD(className, functionName, signature) \
|
||||
{ #functionName, signature, reinterpret_cast<void*>(className ## _ ## functionName) }
|
||||
|
||||
#endif // JNI_CONSTANTS_H_included
|
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SCOPED_LOCAL_REF_H_included
|
||||
#define SCOPED_LOCAL_REF_H_included
|
||||
|
||||
#include "jni.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// A smart pointer that deletes a JNI local reference when it goes out of scope.
|
||||
template<typename T>
|
||||
class ScopedLocalRef {
|
||||
public:
|
||||
ScopedLocalRef(JNIEnv* env, T localRef) : mEnv(env), mLocalRef(localRef) {
|
||||
}
|
||||
|
||||
~ScopedLocalRef() {
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset(T ptr = NULL) {
|
||||
if (ptr != mLocalRef) {
|
||||
if (mLocalRef != NULL) {
|
||||
mEnv->DeleteLocalRef(mLocalRef);
|
||||
}
|
||||
mLocalRef = ptr;
|
||||
}
|
||||
}
|
||||
|
||||
T release() __attribute__((warn_unused_result)) {
|
||||
T localRef = mLocalRef;
|
||||
mLocalRef = NULL;
|
||||
return localRef;
|
||||
}
|
||||
|
||||
T get() const {
|
||||
return mLocalRef;
|
||||
}
|
||||
|
||||
private:
|
||||
JNIEnv* mEnv;
|
||||
T mLocalRef;
|
||||
|
||||
// Disallow copy and assignment.
|
||||
ScopedLocalRef(const ScopedLocalRef&);
|
||||
void operator=(const ScopedLocalRef&);
|
||||
};
|
||||
|
||||
#endif // SCOPED_LOCAL_REF_H_included
|
File diff suppressed because it is too large
Load Diff
@@ -1,10 +0,0 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must *NOT* be checked into Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
|
||||
# location of the SDK. This is only used by Ant
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
sdk.dir=/home/dan/adt-bundle-linux-x86-20131030/sdk/
|
@@ -1,20 +0,0 @@
|
||||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
@@ -1,14 +0,0 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
Binary file not shown.
Before Width: | Height: | Size: 9.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
@@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="CustomSqlite Tests"
|
||||
android:typeface="monospace"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Run the tests"
|
||||
android:onClick="run_the_tests"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_widget"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="<this text should be replaced by the test output>"
|
||||
android:typeface="monospace"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">CustomSqlite</string>
|
||||
</resources>
|
@@ -1,416 +0,0 @@
|
||||
|
||||
package org.sqlite.app.customsqlite;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
import java.lang.InterruptedException;
|
||||
|
||||
import org.sqlite.database.sqlite.SQLiteDatabase;
|
||||
import org.sqlite.database.sqlite.SQLiteStatement;
|
||||
import org.sqlite.database.sqlite.SQLiteDatabaseCorruptException;
|
||||
import org.sqlite.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.content.Context;
|
||||
|
||||
/*
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteStatement;
|
||||
*/
|
||||
|
||||
import org.sqlite.database.DatabaseErrorHandler;
|
||||
class DoNotDeleteErrorHandler implements DatabaseErrorHandler {
|
||||
private static final String TAG = "DoNotDeleteErrorHandler";
|
||||
public void onCorruption(SQLiteDatabase dbObj) {
|
||||
Log.e(TAG, "Corruption reported by sqlite on database: " + dbObj.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
public class CustomSqlite extends Activity
|
||||
{
|
||||
private TextView myTV; /* Text view widget */
|
||||
private int myNTest; /* Number of tests attempted */
|
||||
private int myNErr; /* Number of tests failed */
|
||||
|
||||
File DB_PATH;
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState){
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
myTV = (TextView)findViewById(R.id.tv_widget);
|
||||
}
|
||||
|
||||
public void report_version(){
|
||||
SQLiteDatabase db = null;
|
||||
SQLiteStatement st;
|
||||
String res;
|
||||
|
||||
db = SQLiteDatabase.openOrCreateDatabase(":memory:", null);
|
||||
st = db.compileStatement("SELECT sqlite_version()");
|
||||
res = st.simpleQueryForString();
|
||||
|
||||
myTV.append("SQLite version " + res + "\n\n");
|
||||
}
|
||||
|
||||
public void test_warning(String name, String warning){
|
||||
myTV.append("WARNING:" + name + ": " + warning + "\n");
|
||||
}
|
||||
|
||||
public void test_result(String name, String res, String expected){
|
||||
myTV.append(name + "... ");
|
||||
myNTest++;
|
||||
|
||||
if( res.equals(expected) ){
|
||||
myTV.append("ok\n");
|
||||
} else {
|
||||
myNErr++;
|
||||
myTV.append("FAILED\n");
|
||||
myTV.append(" res= \"" + res + "\"\n");
|
||||
myTV.append(" expected=\"" + expected + "\"\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Test if the database at DB_PATH is encrypted or not. The db
|
||||
** is assumed to be encrypted if the first 6 bytes are anything
|
||||
** other than "SQLite".
|
||||
**
|
||||
** If the test reveals that the db is encrypted, return the string
|
||||
** "encrypted". Otherwise, "unencrypted".
|
||||
*/
|
||||
public String db_is_encrypted() throws Exception {
|
||||
FileInputStream in = new FileInputStream(DB_PATH);
|
||||
|
||||
byte[] buffer = new byte[6];
|
||||
in.read(buffer, 0, 6);
|
||||
|
||||
String res = "encrypted";
|
||||
if( Arrays.equals(buffer, (new String("SQLite")).getBytes()) ){
|
||||
res = "unencrypted";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
** Test that a database connection may be accessed from a second thread.
|
||||
*/
|
||||
public void thread_test_1(){
|
||||
SQLiteDatabase.deleteDatabase(DB_PATH);
|
||||
final SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(DB_PATH, null);
|
||||
|
||||
String db_path2 = DB_PATH.toString() + "2";
|
||||
|
||||
db.execSQL("CREATE TABLE t1(x, y)");
|
||||
db.execSQL("INSERT INTO t1 VALUES (1, 2), (3, 4)");
|
||||
|
||||
Thread t = new Thread( new Runnable() {
|
||||
public void run() {
|
||||
SQLiteStatement st = db.compileStatement("SELECT sum(x+y) FROM t1");
|
||||
String res = st.simpleQueryForString();
|
||||
test_result("thread_test_1", res, "10");
|
||||
}
|
||||
});
|
||||
|
||||
t.start();
|
||||
try {
|
||||
t.join();
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Test that a database connection may be accessed from a second thread.
|
||||
*/
|
||||
public void thread_test_2(){
|
||||
SQLiteDatabase.deleteDatabase(DB_PATH);
|
||||
final SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(DB_PATH, null);
|
||||
|
||||
db.execSQL("CREATE TABLE t1(x, y)");
|
||||
db.execSQL("INSERT INTO t1 VALUES (1, 2), (3, 4)");
|
||||
|
||||
db.enableWriteAheadLogging();
|
||||
db.beginTransactionNonExclusive();
|
||||
db.execSQL("INSERT INTO t1 VALUES (5, 6)");
|
||||
|
||||
Thread t = new Thread( new Runnable() {
|
||||
public void run() {
|
||||
SQLiteStatement st = db.compileStatement("SELECT sum(x+y) FROM t1");
|
||||
String res = st.simpleQueryForString();
|
||||
}
|
||||
});
|
||||
|
||||
t.start();
|
||||
String res = "concurrent";
|
||||
|
||||
int i;
|
||||
for(i=0; i<20 && t.isAlive(); i++){
|
||||
try { Thread.sleep(100); } catch(InterruptedException e) {}
|
||||
}
|
||||
if( t.isAlive() ){ res = "blocked"; }
|
||||
|
||||
db.endTransaction();
|
||||
try { t.join(); } catch(InterruptedException e) {}
|
||||
if( SQLiteDatabase.hasCodec() ){
|
||||
test_result("thread_test_2", res, "blocked");
|
||||
} else {
|
||||
test_result("thread_test_2", res, "concurrent");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Use a Cursor to loop through the results of a SELECT query.
|
||||
*/
|
||||
public void csr_test_2() throws Exception {
|
||||
SQLiteDatabase.deleteDatabase(DB_PATH);
|
||||
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(DB_PATH, null);
|
||||
String res = "";
|
||||
String expect = "";
|
||||
int i;
|
||||
int nRow = 0;
|
||||
|
||||
db.execSQL("CREATE TABLE t1(x)");
|
||||
db.execSQL("BEGIN");
|
||||
for(i=0; i<1000; i++){
|
||||
db.execSQL("INSERT INTO t1 VALUES ('one'), ('two'), ('three')");
|
||||
expect += ".one.two.three";
|
||||
}
|
||||
db.execSQL("COMMIT");
|
||||
Cursor c = db.rawQuery("SELECT x FROM t1", null);
|
||||
if( c!=null ){
|
||||
boolean bRes;
|
||||
for(bRes=c.moveToFirst(); bRes; bRes=c.moveToNext()){
|
||||
String x = c.getString(0);
|
||||
res = res + "." + x;
|
||||
}
|
||||
}else{
|
||||
test_warning("csr_test_1", "c==NULL");
|
||||
}
|
||||
test_result("csr_test_2.1", res, expect);
|
||||
|
||||
db.execSQL("BEGIN");
|
||||
for(i=0; i<1000; i++){
|
||||
db.execSQL("INSERT INTO t1 VALUES (X'123456'), (X'789ABC'), (X'DEF012')");
|
||||
db.execSQL("INSERT INTO t1 VALUES (45), (46), (47)");
|
||||
db.execSQL("INSERT INTO t1 VALUES (8.1), (8.2), (8.3)");
|
||||
db.execSQL("INSERT INTO t1 VALUES (NULL), (NULL), (NULL)");
|
||||
}
|
||||
db.execSQL("COMMIT");
|
||||
|
||||
c = db.rawQuery("SELECT x FROM t1", null);
|
||||
if( c!=null ){
|
||||
boolean bRes;
|
||||
for(bRes=c.moveToFirst(); bRes; bRes=c.moveToNext()) nRow++;
|
||||
}else{
|
||||
test_warning("csr_test_1", "c==NULL");
|
||||
}
|
||||
test_result("csr_test_2.2", "" + nRow, "15000");
|
||||
|
||||
db.close();
|
||||
}
|
||||
|
||||
public String string_from_t1_x(SQLiteDatabase db){
|
||||
String res = "";
|
||||
|
||||
Cursor c = db.rawQuery("SELECT x FROM t1", null);
|
||||
boolean bRes;
|
||||
for(bRes=c.moveToFirst(); bRes; bRes=c.moveToNext()){
|
||||
String x = c.getString(0);
|
||||
res = res + "." + x;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public void csr_test_1() throws Exception {
|
||||
SQLiteDatabase.deleteDatabase(DB_PATH);
|
||||
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(DB_PATH, null);
|
||||
String res = "";
|
||||
|
||||
db.execSQL("CREATE TABLE t1(x)");
|
||||
db.execSQL("INSERT INTO t1 VALUES ('one'), ('two'), ('three')");
|
||||
|
||||
res = string_from_t1_x(db);
|
||||
test_result("csr_test_1.1", res, ".one.two.three");
|
||||
|
||||
db.close();
|
||||
test_result("csr_test_1.2", db_is_encrypted(), "unencrypted");
|
||||
}
|
||||
|
||||
public void stmt_jrnl_test_1() throws Exception {
|
||||
SQLiteDatabase.deleteDatabase(DB_PATH);
|
||||
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(DB_PATH, null);
|
||||
String res = "";
|
||||
|
||||
db.execSQL("CREATE TABLE t1(x, y UNIQUE)");
|
||||
db.execSQL("BEGIN");
|
||||
db.execSQL("INSERT INTO t1 VALUES(1, 1), (2, 2), (3, 3)");
|
||||
db.execSQL("UPDATE t1 SET y=y+3");
|
||||
db.execSQL("COMMIT");
|
||||
db.close();
|
||||
test_result("stmt_jrnl_test_1.1", "did not crash", "did not crash");
|
||||
}
|
||||
|
||||
|
||||
public void supp_char_test_1() throws Exception {
|
||||
SQLiteDatabase.deleteDatabase(DB_PATH);
|
||||
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(DB_PATH, null);
|
||||
String res = "";
|
||||
String smiley = new String( Character.toChars(0x10000) );
|
||||
|
||||
db.execSQL("CREATE TABLE t1(x)");
|
||||
db.execSQL("INSERT INTO t1 VALUES ('a" + smiley + "b')");
|
||||
|
||||
res = string_from_t1_x(db);
|
||||
|
||||
test_result("supp_char_test1." + smiley, res, ".a" + smiley + "b");
|
||||
|
||||
db.close();
|
||||
}
|
||||
|
||||
/*
|
||||
** If this is a SEE build, check that encrypted databases work.
|
||||
*/
|
||||
public void see_test_1() throws Exception {
|
||||
if( !SQLiteDatabase.hasCodec() ) return;
|
||||
|
||||
SQLiteDatabase.deleteDatabase(DB_PATH);
|
||||
String res = "";
|
||||
|
||||
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(DB_PATH, null);
|
||||
db.execSQL("PRAGMA key = 'secretkey'");
|
||||
|
||||
db.execSQL("CREATE TABLE t1(x)");
|
||||
db.execSQL("INSERT INTO t1 VALUES ('one'), ('two'), ('three')");
|
||||
|
||||
res = string_from_t1_x(db);
|
||||
test_result("see_test_1.1", res, ".one.two.three");
|
||||
db.close();
|
||||
|
||||
test_result("see_test_1.2", db_is_encrypted(), "encrypted");
|
||||
|
||||
db = SQLiteDatabase.openOrCreateDatabase(DB_PATH, null);
|
||||
db.execSQL("PRAGMA key = 'secretkey'");
|
||||
res = string_from_t1_x(db);
|
||||
test_result("see_test_1.3", res, ".one.two.three");
|
||||
db.close();
|
||||
|
||||
res = "unencrypted";
|
||||
try {
|
||||
db = SQLiteDatabase.openOrCreateDatabase(DB_PATH.getPath(), null);
|
||||
string_from_t1_x(db);
|
||||
} catch ( SQLiteDatabaseCorruptException e ){
|
||||
res = "encrypted";
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
test_result("see_test_1.4", res, "encrypted");
|
||||
|
||||
res = "unencrypted";
|
||||
try {
|
||||
db = SQLiteDatabase.openOrCreateDatabase(DB_PATH.getPath(), null);
|
||||
db.execSQL("PRAGMA key = 'otherkey'");
|
||||
string_from_t1_x(db);
|
||||
} catch ( SQLiteDatabaseCorruptException e ){
|
||||
res = "encrypted";
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
test_result("see_test_1.5", res, "encrypted");
|
||||
}
|
||||
|
||||
class MyHelper extends SQLiteOpenHelper {
|
||||
public MyHelper(Context ctx){
|
||||
super(ctx, DB_PATH.getPath(), null, 1);
|
||||
}
|
||||
public void onConfigure(SQLiteDatabase db){
|
||||
db.execSQL("PRAGMA key = 'secret'");
|
||||
}
|
||||
public void onCreate(SQLiteDatabase db){
|
||||
db.execSQL("CREATE TABLE t1(x)");
|
||||
}
|
||||
public void onUpgrade(SQLiteDatabase db, int iOld, int iNew){
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Check that SQLiteOpenHelper works.
|
||||
*/
|
||||
public void helper_test_1() throws Exception {
|
||||
/* SQLiteDatabase.deleteDatabase(DB_PATH); */
|
||||
|
||||
MyHelper helper = new MyHelper(this);
|
||||
SQLiteDatabase db = helper.getWritableDatabase();
|
||||
db.execSQL("INSERT INTO t1 VALUES ('x'), ('y'), ('z')");
|
||||
|
||||
String res = string_from_t1_x(db);
|
||||
test_result("helper.1", res, ".x.y.z");
|
||||
|
||||
helper.close();
|
||||
}
|
||||
|
||||
/*
|
||||
** If this is a SEE build, check that SQLiteOpenHelper still works.
|
||||
*/
|
||||
public void see_test_2() throws Exception {
|
||||
if( !SQLiteDatabase.hasCodec() ) return;
|
||||
SQLiteDatabase.deleteDatabase(DB_PATH);
|
||||
|
||||
MyHelper helper = new MyHelper(this);
|
||||
SQLiteDatabase db = helper.getWritableDatabase();
|
||||
db.execSQL("INSERT INTO t1 VALUES ('x'), ('y'), ('z')");
|
||||
|
||||
String res = string_from_t1_x(db);
|
||||
test_result("see_test_2.1", res, ".x.y.z");
|
||||
test_result("see_test_2.2", db_is_encrypted(), "encrypted");
|
||||
|
||||
helper.close();
|
||||
helper = new MyHelper(this);
|
||||
db = helper.getReadableDatabase();
|
||||
test_result("see_test_2.3", res, ".x.y.z");
|
||||
|
||||
db = helper.getWritableDatabase();
|
||||
test_result("see_test_2.4", res, ".x.y.z");
|
||||
|
||||
test_result("see_test_2.5", db_is_encrypted(), "encrypted");
|
||||
}
|
||||
|
||||
public void run_the_tests(View view){
|
||||
System.loadLibrary("sqliteX");
|
||||
DB_PATH = getApplicationContext().getDatabasePath("test.db");
|
||||
DB_PATH.getParentFile().mkdirs();
|
||||
|
||||
myTV.setText("");
|
||||
myNErr = 0;
|
||||
myNTest = 0;
|
||||
|
||||
try {
|
||||
report_version();
|
||||
helper_test_1();
|
||||
supp_char_test_1();
|
||||
csr_test_1();
|
||||
csr_test_2();
|
||||
thread_test_1();
|
||||
thread_test_2();
|
||||
see_test_1();
|
||||
see_test_2();
|
||||
stmt_jrnl_test_1();
|
||||
|
||||
myTV.append("\n" + myNErr + " errors from " + myNTest + " tests\n");
|
||||
} catch(Exception e) {
|
||||
myTV.append("Exception: " + e.toString() + "\n");
|
||||
myTV.append(android.util.Log.getStackTraceString(e) + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database;
|
||||
|
||||
import org.sqlite.database.sqlite.SQLiteDatabase;
|
||||
|
||||
/**
|
||||
* An interface to let the apps define the actions to take when the following errors are detected
|
||||
* database corruption
|
||||
*/
|
||||
public interface DatabaseErrorHandler {
|
||||
|
||||
/**
|
||||
* defines the method to be invoked when database corruption is detected.
|
||||
* @param dbObj the {@link SQLiteDatabase} object representing the database on which corruption
|
||||
* is detected.
|
||||
*/
|
||||
void onCorruption(SQLiteDatabase dbObj);
|
||||
}
|
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.sqlite.database.sqlite.SQLiteDatabase;
|
||||
import org.sqlite.database.sqlite.SQLiteException;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
/**
|
||||
* Default class used to define the actions to take when the database corruption is reported
|
||||
* by sqlite.
|
||||
* <p>
|
||||
* An application can specify an implementation of {@link DatabaseErrorHandler} on the
|
||||
* following:
|
||||
* <ul>
|
||||
* <li>{@link SQLiteDatabase#openOrCreateDatabase(String,
|
||||
* org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory, DatabaseErrorHandler)}</li>
|
||||
* <li>{@link SQLiteDatabase#openDatabase(String,
|
||||
* org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory, int, DatabaseErrorHandler)}</li>
|
||||
* </ul>
|
||||
* The specified {@link DatabaseErrorHandler} is used to handle database corruption errors, if they
|
||||
* occur.
|
||||
* <p>
|
||||
* If null is specified for DatabaeErrorHandler param in the above calls, then this class is used
|
||||
* as the default {@link DatabaseErrorHandler}.
|
||||
*/
|
||||
public final class DefaultDatabaseErrorHandler implements DatabaseErrorHandler {
|
||||
|
||||
private static final String TAG = "DefaultDatabaseErrorHandler";
|
||||
|
||||
/**
|
||||
* defines the default method to be invoked when database corruption is detected.
|
||||
* @param dbObj the {@link SQLiteDatabase} object representing the database on which corruption
|
||||
* is detected.
|
||||
*/
|
||||
public void onCorruption(SQLiteDatabase dbObj) {
|
||||
Log.e(TAG, "Corruption reported by sqlite on database: " + dbObj.getPath());
|
||||
|
||||
// If this is a SEE build, do not delete any database files.
|
||||
//
|
||||
if( SQLiteDatabase.hasCodec() ) return;
|
||||
|
||||
// is the corruption detected even before database could be 'opened'?
|
||||
if (!dbObj.isOpen()) {
|
||||
// database files are not even openable. delete this database file.
|
||||
// NOTE if the database has attached databases, then any of them could be corrupt.
|
||||
// and not deleting all of them could cause corrupted database file to remain and
|
||||
// make the application crash on database open operation. To avoid this problem,
|
||||
// the application should provide its own {@link DatabaseErrorHandler} impl class
|
||||
// to delete ALL files of the database (including the attached databases).
|
||||
deleteDatabaseFile(dbObj.getPath());
|
||||
return;
|
||||
}
|
||||
|
||||
List<Pair<String, String>> attachedDbs = null;
|
||||
try {
|
||||
// Close the database, which will cause subsequent operations to fail.
|
||||
// before that, get the attached database list first.
|
||||
try {
|
||||
attachedDbs = dbObj.getAttachedDbs();
|
||||
} catch (SQLiteException e) {
|
||||
/* ignore */
|
||||
}
|
||||
try {
|
||||
dbObj.close();
|
||||
} catch (SQLiteException e) {
|
||||
/* ignore */
|
||||
}
|
||||
} finally {
|
||||
// Delete all files of this corrupt database and/or attached databases
|
||||
if (attachedDbs != null) {
|
||||
for (Pair<String, String> p : attachedDbs) {
|
||||
deleteDatabaseFile(p.second);
|
||||
}
|
||||
} else {
|
||||
// attachedDbs = null is possible when the database is so corrupt that even
|
||||
// "PRAGMA database_list;" also fails. delete the main database file
|
||||
deleteDatabaseFile(dbObj.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteDatabaseFile(String fileName) {
|
||||
if (fileName.equalsIgnoreCase(":memory:") || fileName.trim().length() == 0) {
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "deleting the database file: " + fileName);
|
||||
try {
|
||||
SQLiteDatabase.deleteDatabase(new File(fileName));
|
||||
} catch (Exception e) {
|
||||
/* print warning and ignore exception */
|
||||
Log.w(TAG, "delete failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,176 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database;
|
||||
import android.database.Cursor;
|
||||
import android.database.CursorWindow;
|
||||
|
||||
/* import org.apache.commons.codec.binary.Hex; */
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.OperationApplicationException;
|
||||
import org.sqlite.database.sqlite.SQLiteAbortException;
|
||||
import org.sqlite.database.sqlite.SQLiteConstraintException;
|
||||
import org.sqlite.database.sqlite.SQLiteDatabase;
|
||||
import org.sqlite.database.sqlite.SQLiteDatabaseCorruptException;
|
||||
import org.sqlite.database.sqlite.SQLiteDiskIOException;
|
||||
import org.sqlite.database.sqlite.SQLiteException;
|
||||
import org.sqlite.database.sqlite.SQLiteFullException;
|
||||
import org.sqlite.database.sqlite.SQLiteProgram;
|
||||
import org.sqlite.database.sqlite.SQLiteStatement;
|
||||
import android.os.OperationCanceledException;
|
||||
import android.os.Parcel;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.PrintStream;
|
||||
import java.text.Collator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Static utility methods for dealing with databases and {@link Cursor}s.
|
||||
*/
|
||||
public class ExtraUtils {
|
||||
private static final String TAG = "ExtraUtils";
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
/** One of the values returned by {@link #getSqlStatementType(String)}. */
|
||||
public static final int STATEMENT_SELECT = 1;
|
||||
/** One of the values returned by {@link #getSqlStatementType(String)}. */
|
||||
public static final int STATEMENT_UPDATE = 2;
|
||||
/** One of the values returned by {@link #getSqlStatementType(String)}. */
|
||||
public static final int STATEMENT_ATTACH = 3;
|
||||
/** One of the values returned by {@link #getSqlStatementType(String)}. */
|
||||
public static final int STATEMENT_BEGIN = 4;
|
||||
/** One of the values returned by {@link #getSqlStatementType(String)}. */
|
||||
public static final int STATEMENT_COMMIT = 5;
|
||||
/** One of the values returned by {@link #getSqlStatementType(String)}. */
|
||||
public static final int STATEMENT_ABORT = 6;
|
||||
/** One of the values returned by {@link #getSqlStatementType(String)}. */
|
||||
public static final int STATEMENT_PRAGMA = 7;
|
||||
/** One of the values returned by {@link #getSqlStatementType(String)}. */
|
||||
public static final int STATEMENT_DDL = 8;
|
||||
/** One of the values returned by {@link #getSqlStatementType(String)}. */
|
||||
public static final int STATEMENT_UNPREPARED = 9;
|
||||
/** One of the values returned by {@link #getSqlStatementType(String)}. */
|
||||
public static final int STATEMENT_OTHER = 99;
|
||||
|
||||
/**
|
||||
* Returns column index of "_id" column, or -1 if not found.
|
||||
*/
|
||||
public static int findRowIdColumnIndex(String[] columnNames) {
|
||||
int length = columnNames.length;
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (columnNames[i].equals("_id")) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Picks a start position for {@link Cursor#fillWindow} such that the
|
||||
* window will contain the requested row and a useful range of rows
|
||||
* around it.
|
||||
*
|
||||
* When the data set is too large to fit in a cursor window, seeking the
|
||||
* cursor can become a very expensive operation since we have to run the
|
||||
* query again when we move outside the bounds of the current window.
|
||||
*
|
||||
* We try to choose a start position for the cursor window such that
|
||||
* 1/3 of the window's capacity is used to hold rows before the requested
|
||||
* position and 2/3 of the window's capacity is used to hold rows after the
|
||||
* requested position.
|
||||
*
|
||||
* @param cursorPosition The row index of the row we want to get.
|
||||
* @param cursorWindowCapacity The estimated number of rows that can fit in
|
||||
* a cursor window, or 0 if unknown.
|
||||
* @return The recommended start position, always less than or equal to
|
||||
* the requested row.
|
||||
* @hide
|
||||
*/
|
||||
public static int cursorPickFillWindowStartPosition(
|
||||
int cursorPosition, int cursorWindowCapacity) {
|
||||
return Math.max(cursorPosition - cursorWindowCapacity / 3, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns data type of the given object's value.
|
||||
*<p>
|
||||
* Returned values are
|
||||
* <ul>
|
||||
* <li>{@link Cursor#FIELD_TYPE_NULL}</li>
|
||||
* <li>{@link Cursor#FIELD_TYPE_INTEGER}</li>
|
||||
* <li>{@link Cursor#FIELD_TYPE_FLOAT}</li>
|
||||
* <li>{@link Cursor#FIELD_TYPE_STRING}</li>
|
||||
* <li>{@link Cursor#FIELD_TYPE_BLOB}</li>
|
||||
*</ul>
|
||||
*</p>
|
||||
*
|
||||
* @param obj the object whose value type is to be returned
|
||||
* @return object value type
|
||||
*/
|
||||
public static int getTypeOfObject(Object obj) {
|
||||
if (obj == null) {
|
||||
return Cursor.FIELD_TYPE_NULL;
|
||||
} else if (obj instanceof byte[]) {
|
||||
return Cursor.FIELD_TYPE_BLOB;
|
||||
} else if (obj instanceof Float || obj instanceof Double) {
|
||||
return Cursor.FIELD_TYPE_FLOAT;
|
||||
} else if (obj instanceof Long || obj instanceof Integer
|
||||
|| obj instanceof Short || obj instanceof Byte) {
|
||||
return Cursor.FIELD_TYPE_INTEGER;
|
||||
} else {
|
||||
return Cursor.FIELD_TYPE_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to run the query on the db and return the value in the
|
||||
* first column of the first row.
|
||||
*/
|
||||
public static long longForQuery(
|
||||
SQLiteDatabase db, String query, String[] selectionArgs
|
||||
) {
|
||||
SQLiteStatement prog = db.compileStatement(query);
|
||||
try {
|
||||
return longForQuery(prog, selectionArgs);
|
||||
} finally {
|
||||
prog.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to run the pre-compiled query and return the value in the
|
||||
* first column of the first row.
|
||||
*/
|
||||
public static long longForQuery(
|
||||
SQLiteStatement prog, String[] selectionArgs
|
||||
) {
|
||||
prog.bindAllArgsAsStrings(selectionArgs);
|
||||
return prog.simpleQueryForLong();
|
||||
}
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database;
|
||||
|
||||
/**
|
||||
* An exception that indicates there was an error with SQL parsing or execution.
|
||||
*/
|
||||
public class SQLException extends RuntimeException {
|
||||
public SQLException() {
|
||||
}
|
||||
|
||||
public SQLException(String error) {
|
||||
super(error);
|
||||
}
|
||||
|
||||
public SQLException(String error, Throwable cause) {
|
||||
super(error, cause);
|
||||
}
|
||||
}
|
@@ -1,235 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* CloseGuard is a mechanism for flagging implicit finalizer cleanup of
|
||||
* resources that should have been cleaned up by explicit close
|
||||
* methods (aka "explicit termination methods" in Effective Java).
|
||||
* <p>
|
||||
* A simple example: <pre> {@code
|
||||
* class Foo {
|
||||
*
|
||||
* private final CloseGuard guard = CloseGuard.get();
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* public Foo() {
|
||||
* ...;
|
||||
* guard.open("cleanup");
|
||||
* }
|
||||
*
|
||||
* public void cleanup() {
|
||||
* guard.close();
|
||||
* ...;
|
||||
* }
|
||||
*
|
||||
* protected void finalize() throws Throwable {
|
||||
* try {
|
||||
* if (guard != null) {
|
||||
* guard.warnIfOpen();
|
||||
* }
|
||||
* cleanup();
|
||||
* } finally {
|
||||
* super.finalize();
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* In usage where the resource to be explicitly cleaned up are
|
||||
* allocated after object construction, CloseGuard protection can
|
||||
* be deferred. For example: <pre> {@code
|
||||
* class Bar {
|
||||
*
|
||||
* private final CloseGuard guard = CloseGuard.get();
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* public Bar() {
|
||||
* ...;
|
||||
* }
|
||||
*
|
||||
* public void connect() {
|
||||
* ...;
|
||||
* guard.open("cleanup");
|
||||
* }
|
||||
*
|
||||
* public void cleanup() {
|
||||
* guard.close();
|
||||
* ...;
|
||||
* }
|
||||
*
|
||||
* protected void finalize() throws Throwable {
|
||||
* try {
|
||||
* if (guard != null) {
|
||||
* guard.warnIfOpen();
|
||||
* }
|
||||
* cleanup();
|
||||
* } finally {
|
||||
* super.finalize();
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* When used in a constructor calls to {@code open} should occur at
|
||||
* the end of the constructor since an exception that would cause
|
||||
* abrupt termination of the constructor will mean that the user will
|
||||
* not have a reference to the object to cleanup explicitly. When used
|
||||
* in a method, the call to {@code open} should occur just after
|
||||
* resource acquisition.
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* Note that the null check on {@code guard} in the finalizer is to
|
||||
* cover cases where a constructor throws an exception causing the
|
||||
* {@code guard} to be uninitialized.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class CloseGuard {
|
||||
|
||||
/**
|
||||
* Instance used when CloseGuard is disabled to avoid allocation.
|
||||
*/
|
||||
private static final CloseGuard NOOP = new CloseGuard();
|
||||
|
||||
/**
|
||||
* Enabled by default so we can catch issues early in VM startup.
|
||||
* Note, however, that Android disables this early in its startup,
|
||||
* but enables it with DropBoxing for system apps on debug builds.
|
||||
*/
|
||||
private static volatile boolean ENABLED = true;
|
||||
|
||||
/**
|
||||
* Hook for customizing how CloseGuard issues are reported.
|
||||
*/
|
||||
private static volatile Reporter REPORTER = new DefaultReporter();
|
||||
|
||||
/**
|
||||
* Returns a CloseGuard instance. If CloseGuard is enabled, {@code
|
||||
* #open(String)} can be used to set up the instance to warn on
|
||||
* failure to close. If CloseGuard is disabled, a non-null no-op
|
||||
* instance is returned.
|
||||
*/
|
||||
public static CloseGuard get() {
|
||||
if (!ENABLED) {
|
||||
return NOOP;
|
||||
}
|
||||
return new CloseGuard();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to enable or disable CloseGuard. Note that CloseGuard only
|
||||
* warns if it is enabled for both allocation and finalization.
|
||||
*/
|
||||
public static void setEnabled(boolean enabled) {
|
||||
ENABLED = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to replace default Reporter used to warn of CloseGuard
|
||||
* violations. Must be non-null.
|
||||
*/
|
||||
public static void setReporter(Reporter reporter) {
|
||||
if (reporter == null) {
|
||||
throw new NullPointerException("reporter == null");
|
||||
}
|
||||
REPORTER = reporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns non-null CloseGuard.Reporter.
|
||||
*/
|
||||
public static Reporter getReporter() {
|
||||
return REPORTER;
|
||||
}
|
||||
|
||||
private CloseGuard() {}
|
||||
|
||||
/**
|
||||
* If CloseGuard is enabled, {@code open} initializes the instance
|
||||
* with a warning that the caller should have explicitly called the
|
||||
* {@code closer} method instead of relying on finalization.
|
||||
*
|
||||
* @param closer non-null name of explicit termination method
|
||||
* @throws NullPointerException if closer is null, regardless of
|
||||
* whether or not CloseGuard is enabled
|
||||
*/
|
||||
public void open(String closer) {
|
||||
// always perform the check for valid API usage...
|
||||
if (closer == null) {
|
||||
throw new NullPointerException("closer == null");
|
||||
}
|
||||
// ...but avoid allocating an allocationSite if disabled
|
||||
if (this == NOOP || !ENABLED) {
|
||||
return;
|
||||
}
|
||||
String message = "Explicit termination method '" + closer + "' not called";
|
||||
allocationSite = new Throwable(message);
|
||||
}
|
||||
|
||||
private Throwable allocationSite;
|
||||
|
||||
/**
|
||||
* Marks this CloseGuard instance as closed to avoid warnings on
|
||||
* finalization.
|
||||
*/
|
||||
public void close() {
|
||||
allocationSite = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* If CloseGuard is enabled, logs a warning if the caller did not
|
||||
* properly cleanup by calling an explicit close method
|
||||
* before finalization. If CloseGuard is disabled, no action is
|
||||
* performed.
|
||||
*/
|
||||
public void warnIfOpen() {
|
||||
if (allocationSite == null || !ENABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
String message =
|
||||
("A resource was acquired at attached stack trace but never released. "
|
||||
+ "See java.io.Closeable for information on avoiding resource leaks.");
|
||||
|
||||
REPORTER.report(message, allocationSite);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface to allow customization of reporting behavior.
|
||||
*/
|
||||
public static interface Reporter {
|
||||
public void report (String message, Throwable allocationSite);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Reporter which reports CloseGuard violations to the log.
|
||||
*/
|
||||
private static final class DefaultReporter implements Reporter {
|
||||
@Override public void report (String message, Throwable allocationSite) {
|
||||
Log.w(message, allocationSite);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* An exception that indicates that garbage-collector is finalizing a database object
|
||||
* that is not explicitly closed
|
||||
* @hide
|
||||
*/
|
||||
public class DatabaseObjectNotClosedException extends RuntimeException {
|
||||
private static final String s = "Application did not close the cursor or database object " +
|
||||
"that was opened here";
|
||||
|
||||
public DatabaseObjectNotClosedException() {
|
||||
super(s);
|
||||
}
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* An exception that indicates that the SQLite program was aborted.
|
||||
* This can happen either through a call to ABORT in a trigger,
|
||||
* or as the result of using the ABORT conflict clause.
|
||||
*/
|
||||
public class SQLiteAbortException extends SQLiteException {
|
||||
public SQLiteAbortException() {}
|
||||
|
||||
public SQLiteAbortException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* This exception class is used when sqlite can't access the database file
|
||||
* due to lack of permissions on the file.
|
||||
*/
|
||||
public class SQLiteAccessPermException extends SQLiteException {
|
||||
public SQLiteAccessPermException() {}
|
||||
|
||||
public SQLiteAccessPermException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* Thrown if the the bind or column parameter index is out of range
|
||||
*/
|
||||
public class SQLiteBindOrColumnIndexOutOfRangeException extends SQLiteException {
|
||||
public SQLiteBindOrColumnIndexOutOfRangeException() {}
|
||||
|
||||
public SQLiteBindOrColumnIndexOutOfRangeException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
public class SQLiteBlobTooBigException extends SQLiteException {
|
||||
public SQLiteBlobTooBigException() {}
|
||||
|
||||
public SQLiteBlobTooBigException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
public class SQLiteCantOpenDatabaseException extends SQLiteException {
|
||||
public SQLiteCantOpenDatabaseException() {}
|
||||
|
||||
public SQLiteCantOpenDatabaseException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
/**
|
||||
* An object created from a SQLiteDatabase that can be closed.
|
||||
*
|
||||
* This class implements a primitive reference counting scheme for database objects.
|
||||
*/
|
||||
public abstract class SQLiteClosable implements Closeable {
|
||||
private int mReferenceCount = 1;
|
||||
|
||||
/**
|
||||
* Called when the last reference to the object was released by
|
||||
* a call to {@link #releaseReference()} or {@link #close()}.
|
||||
*/
|
||||
protected abstract void onAllReferencesReleased();
|
||||
|
||||
/**
|
||||
* Called when the last reference to the object was released by
|
||||
* a call to {@link #releaseReferenceFromContainer()}.
|
||||
*
|
||||
* @deprecated Do not use.
|
||||
*/
|
||||
@Deprecated
|
||||
protected void onAllReferencesReleasedFromContainer() {
|
||||
onAllReferencesReleased();
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquires a reference to the object.
|
||||
*
|
||||
* @throws IllegalStateException if the last reference to the object has already
|
||||
* been released.
|
||||
*/
|
||||
public void acquireReference() {
|
||||
synchronized(this) {
|
||||
if (mReferenceCount <= 0) {
|
||||
throw new IllegalStateException(
|
||||
"attempt to re-open an already-closed object: " + this);
|
||||
}
|
||||
mReferenceCount++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases a reference to the object, closing the object if the last reference
|
||||
* was released.
|
||||
*
|
||||
* @see #onAllReferencesReleased()
|
||||
*/
|
||||
public void releaseReference() {
|
||||
boolean refCountIsZero = false;
|
||||
synchronized(this) {
|
||||
refCountIsZero = --mReferenceCount == 0;
|
||||
}
|
||||
if (refCountIsZero) {
|
||||
onAllReferencesReleased();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases a reference to the object that was owned by the container of the object,
|
||||
* closing the object if the last reference was released.
|
||||
*
|
||||
* @see #onAllReferencesReleasedFromContainer()
|
||||
* @deprecated Do not use.
|
||||
*/
|
||||
@Deprecated
|
||||
public void releaseReferenceFromContainer() {
|
||||
boolean refCountIsZero = false;
|
||||
synchronized(this) {
|
||||
refCountIsZero = --mReferenceCount == 0;
|
||||
}
|
||||
if (refCountIsZero) {
|
||||
onAllReferencesReleasedFromContainer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases a reference to the object, closing the object if the last reference
|
||||
* was released.
|
||||
*
|
||||
* Calling this method is equivalent to calling {@link #releaseReference}.
|
||||
*
|
||||
* @see #releaseReference()
|
||||
* @see #onAllReferencesReleased()
|
||||
*/
|
||||
public void close() {
|
||||
releaseReference();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* An exception that indicates that an integrity constraint was violated.
|
||||
*/
|
||||
public class SQLiteConstraintException extends SQLiteException {
|
||||
public SQLiteConstraintException() {}
|
||||
|
||||
public SQLiteConstraintException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,318 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
import org.sqlite.database.ExtraUtils;
|
||||
|
||||
import android.database.AbstractWindowedCursor;
|
||||
import android.database.CursorWindow;
|
||||
|
||||
import android.os.StrictMode;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A Cursor implementation that exposes results from a query on a
|
||||
* {@link SQLiteDatabase}.
|
||||
*
|
||||
* SQLiteCursor is not internally synchronized so code using a SQLiteCursor from multiple
|
||||
* threads should perform its own synchronization when using the SQLiteCursor.
|
||||
*/
|
||||
public class SQLiteCursor extends AbstractWindowedCursor {
|
||||
static final String TAG = "SQLiteCursor";
|
||||
static final int NO_COUNT = -1;
|
||||
|
||||
/** The name of the table to edit */
|
||||
private final String mEditTable;
|
||||
|
||||
/** The names of the columns in the rows */
|
||||
private final String[] mColumns;
|
||||
|
||||
/** The query object for the cursor */
|
||||
private final SQLiteQuery mQuery;
|
||||
|
||||
/** The compiled query this cursor came from */
|
||||
private final SQLiteCursorDriver mDriver;
|
||||
|
||||
/** The number of rows in the cursor */
|
||||
private int mCount = NO_COUNT;
|
||||
|
||||
/** The number of rows that can fit in the cursor window, 0 if unknown */
|
||||
private int mCursorWindowCapacity;
|
||||
|
||||
/** A mapping of column names to column indices, to speed up lookups */
|
||||
private Map<String, Integer> mColumnNameMap;
|
||||
|
||||
/** Used to find out where a cursor was allocated in case it never got released. */
|
||||
private final Throwable mStackTrace;
|
||||
|
||||
/**
|
||||
* Execute a query and provide access to its result set through a Cursor
|
||||
* interface. For a query such as: {@code SELECT name, birth, phone FROM
|
||||
* myTable WHERE ... LIMIT 1,20 ORDER BY...} the column names (name, birth,
|
||||
* phone) would be in the projection argument and everything from
|
||||
* {@code FROM} onward would be in the params argument.
|
||||
*
|
||||
* @param db a reference to a Database object that is already constructed
|
||||
* and opened. This param is not used any longer
|
||||
* @param editTable the name of the table used for this query
|
||||
* @param query the rest of the query terms
|
||||
* cursor is finalized
|
||||
* @deprecated use {@link #SQLiteCursor(SQLiteCursorDriver, String, SQLiteQuery)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public SQLiteCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
|
||||
String editTable, SQLiteQuery query) {
|
||||
this(driver, editTable, query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a query and provide access to its result set through a Cursor
|
||||
* interface. For a query such as: {@code SELECT name, birth, phone FROM
|
||||
* myTable WHERE ... LIMIT 1,20 ORDER BY...} the column names (name, birth,
|
||||
* phone) would be in the projection argument and everything from
|
||||
* {@code FROM} onward would be in the params argument.
|
||||
*
|
||||
* @param editTable the name of the table used for this query
|
||||
* @param query the {@link SQLiteQuery} object associated with this cursor object.
|
||||
*/
|
||||
public SQLiteCursor(SQLiteCursorDriver driver, String editTable, SQLiteQuery query) {
|
||||
if (query == null) {
|
||||
throw new IllegalArgumentException("query object cannot be null");
|
||||
}
|
||||
if (/* StrictMode.vmSqliteObjectLeaksEnabled() */ false ) {
|
||||
mStackTrace = new DatabaseObjectNotClosedException().fillInStackTrace();
|
||||
} else {
|
||||
mStackTrace = null;
|
||||
}
|
||||
mDriver = driver;
|
||||
mEditTable = editTable;
|
||||
mColumnNameMap = null;
|
||||
mQuery = query;
|
||||
|
||||
mColumns = query.getColumnNames();
|
||||
//mRowIdColumnIndex = ExtraUtils.findRowIdColumnIndex(mColumns);
|
||||
|
||||
// try {
|
||||
// Field field = AbstractCursor.class.getDeclaredField("mRowIdColumnIndex");
|
||||
// field.setInt(this, ExtraUtils.findRowIdColumnIndex(mColumns));
|
||||
// } catch (NoSuchFieldException nfe) {
|
||||
// ;//loaded in system with api level 23 or later
|
||||
// } catch (IllegalAccessException e) {
|
||||
// ;//iae
|
||||
// } catch (IllegalArgumentException e) {
|
||||
// ;//iae
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the database that this cursor is associated with.
|
||||
* @return the SQLiteDatabase that this cursor is associated with.
|
||||
*/
|
||||
public SQLiteDatabase getDatabase() {
|
||||
return mQuery.getDatabase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMove(int oldPosition, int newPosition) {
|
||||
// Make sure the row at newPosition is present in the window
|
||||
if (mWindow == null || newPosition < mWindow.getStartPosition() ||
|
||||
newPosition >= (mWindow.getStartPosition() + mWindow.getNumRows())) {
|
||||
fillWindow(newPosition);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
if (mCount == NO_COUNT) {
|
||||
fillWindow(0);
|
||||
}
|
||||
return mCount;
|
||||
}
|
||||
|
||||
/*
|
||||
** The AbstractWindowClass contains protected methods clearOrCreateWindow() and
|
||||
** closeWindow(), which are used by the android.database.sqlite.* version of this
|
||||
** class. But, since they are marked with "@hide", the following replacement
|
||||
** versions are required.
|
||||
*/
|
||||
private void awc_clearOrCreateWindow(String name){
|
||||
CursorWindow win = getWindow();
|
||||
if( win==null ){
|
||||
win = new CursorWindow(name);
|
||||
setWindow(win);
|
||||
}else{
|
||||
win.clear();
|
||||
}
|
||||
}
|
||||
private void awc_closeWindow(){
|
||||
setWindow(null);
|
||||
}
|
||||
|
||||
private void fillWindow(int requiredPos) {
|
||||
awc_clearOrCreateWindow(getDatabase().getPath());
|
||||
|
||||
try {
|
||||
if (mCount == NO_COUNT) {
|
||||
int startPos = ExtraUtils.cursorPickFillWindowStartPosition(requiredPos, 0);
|
||||
mCount = mQuery.fillWindow(mWindow, startPos, requiredPos, true);
|
||||
mCursorWindowCapacity = mWindow.getNumRows();
|
||||
if (Log.isLoggable(TAG, Log.DEBUG)) {
|
||||
Log.d(TAG, "received count(*) from native_fill_window: " + mCount);
|
||||
}
|
||||
} else {
|
||||
int startPos = ExtraUtils.cursorPickFillWindowStartPosition(requiredPos,
|
||||
mCursorWindowCapacity);
|
||||
mQuery.fillWindow(mWindow, startPos, requiredPos, false);
|
||||
}
|
||||
} catch (RuntimeException ex) {
|
||||
// Close the cursor window if the query failed and therefore will
|
||||
// not produce any results. This helps to avoid accidentally leaking
|
||||
// the cursor window if the client does not correctly handle exceptions
|
||||
// and fails to close the cursor.
|
||||
awc_closeWindow();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnIndex(String columnName) {
|
||||
// Create mColumnNameMap on demand
|
||||
if (mColumnNameMap == null) {
|
||||
String[] columns = mColumns;
|
||||
int columnCount = columns.length;
|
||||
HashMap<String, Integer> map = new HashMap<String, Integer>(columnCount, 1);
|
||||
for (int i = 0; i < columnCount; i++) {
|
||||
map.put(columns[i], i);
|
||||
}
|
||||
mColumnNameMap = map;
|
||||
}
|
||||
|
||||
// Hack according to bug 903852
|
||||
final int periodIndex = columnName.lastIndexOf('.');
|
||||
if (periodIndex != -1) {
|
||||
Exception e = new Exception();
|
||||
Log.e(TAG, "requesting column name with table name -- " + columnName, e);
|
||||
columnName = columnName.substring(periodIndex + 1);
|
||||
}
|
||||
|
||||
Integer i = mColumnNameMap.get(columnName);
|
||||
if (i != null) {
|
||||
return i.intValue();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getColumnNames() {
|
||||
return mColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
super.deactivate();
|
||||
mDriver.cursorDeactivated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
super.close();
|
||||
synchronized (this) {
|
||||
mQuery.close();
|
||||
mDriver.cursorClosed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requery() {
|
||||
if (isClosed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
if (!mQuery.getDatabase().isOpen()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mWindow != null) {
|
||||
mWindow.clear();
|
||||
}
|
||||
mPos = -1;
|
||||
mCount = NO_COUNT;
|
||||
|
||||
mDriver.cursorRequeried(this);
|
||||
}
|
||||
|
||||
try {
|
||||
return super.requery();
|
||||
} catch (IllegalStateException e) {
|
||||
// for backwards compatibility, just return false
|
||||
Log.w(TAG, "requery() failed " + e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindow(CursorWindow window) {
|
||||
super.setWindow(window);
|
||||
mCount = NO_COUNT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the selection arguments. The new values take effect after a call to requery().
|
||||
*/
|
||||
public void setSelectionArguments(String[] selectionArgs) {
|
||||
mDriver.setBindArguments(selectionArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the native resources, if they haven't been released yet.
|
||||
*/
|
||||
@Override
|
||||
protected void finalize() {
|
||||
try {
|
||||
// if the cursor hasn't been closed yet, close it first
|
||||
if (mWindow != null) {
|
||||
/*
|
||||
if (mStackTrace != null) {
|
||||
String sql = mQuery.getSql();
|
||||
int len = sql.length();
|
||||
StrictMode.onSqliteObjectLeaked(
|
||||
"Finalizing a Cursor that has not been deactivated or closed. " +
|
||||
"database = " + mQuery.getDatabase().getLabel() +
|
||||
", table = " + mEditTable +
|
||||
", query = " + sql.substring(0, (len > 1000) ? 1000 : len),
|
||||
mStackTrace);
|
||||
}
|
||||
*/
|
||||
close();
|
||||
}
|
||||
} finally {
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
import android.database.Cursor;
|
||||
import org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||
|
||||
/**
|
||||
* A driver for SQLiteCursors that is used to create them and gets notified
|
||||
* by the cursors it creates on significant events in their lifetimes.
|
||||
*/
|
||||
public interface SQLiteCursorDriver {
|
||||
/**
|
||||
* Executes the query returning a Cursor over the result set.
|
||||
*
|
||||
* @param factory The CursorFactory to use when creating the Cursors, or
|
||||
* null if standard SQLiteCursors should be returned.
|
||||
* @return a Cursor over the result set
|
||||
*/
|
||||
Cursor query(CursorFactory factory, String[] bindArgs);
|
||||
|
||||
/**
|
||||
* Called by a SQLiteCursor when it is released.
|
||||
*/
|
||||
void cursorDeactivated();
|
||||
|
||||
/**
|
||||
* Called by a SQLiteCursor when it is requeried.
|
||||
*/
|
||||
void cursorRequeried(Cursor cursor);
|
||||
|
||||
/**
|
||||
* Called by a SQLiteCursor when it it closed to destroy this object as well.
|
||||
*/
|
||||
void cursorClosed();
|
||||
|
||||
/**
|
||||
* Set new bind arguments. These will take effect in cursorRequeried().
|
||||
* @param bindArgs the new arguments
|
||||
*/
|
||||
public void setBindArguments(String[] bindArgs);
|
||||
}
|
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* Describes a custom SQL function.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class SQLiteCustomFunction {
|
||||
public final String name;
|
||||
public final int numArgs;
|
||||
public final SQLiteDatabase.CustomFunction callback;
|
||||
|
||||
/**
|
||||
* Create custom function.
|
||||
*
|
||||
* @param name The name of the sqlite3 function.
|
||||
* @param numArgs The number of arguments for the function, or -1 to
|
||||
* support any number of arguments.
|
||||
* @param callback The callback to invoke when the function is executed.
|
||||
*/
|
||||
public SQLiteCustomFunction(String name, int numArgs,
|
||||
SQLiteDatabase.CustomFunction callback) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("name must not be null.");
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
this.numArgs = numArgs;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
// Called from native.
|
||||
@SuppressWarnings("unused")
|
||||
private void dispatchCallback(String[] args) {
|
||||
callback.callback(args);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,169 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Describes how to configure a database.
|
||||
* <p>
|
||||
* The purpose of this object is to keep track of all of the little
|
||||
* configuration settings that are applied to a database after it
|
||||
* is opened so that they can be applied to all connections in the
|
||||
* connection pool uniformly.
|
||||
* </p><p>
|
||||
* Each connection maintains its own copy of this object so it can
|
||||
* keep track of which settings have already been applied.
|
||||
* </p>
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class SQLiteDatabaseConfiguration {
|
||||
// The pattern we use to strip email addresses from database paths
|
||||
// when constructing a label to use in log messages.
|
||||
private static final Pattern EMAIL_IN_DB_PATTERN =
|
||||
Pattern.compile("[\\w\\.\\-]+@[\\w\\.\\-]+");
|
||||
|
||||
/**
|
||||
* Special path used by in-memory databases.
|
||||
*/
|
||||
public static final String MEMORY_DB_PATH = ":memory:";
|
||||
|
||||
/**
|
||||
* The database path.
|
||||
*/
|
||||
public final String path;
|
||||
|
||||
/**
|
||||
* The label to use to describe the database when it appears in logs.
|
||||
* This is derived from the path but is stripped to remove PII.
|
||||
*/
|
||||
public final String label;
|
||||
|
||||
/**
|
||||
* The flags used to open the database.
|
||||
*/
|
||||
public int openFlags;
|
||||
|
||||
/**
|
||||
* The maximum size of the prepared statement cache for each database connection.
|
||||
* Must be non-negative.
|
||||
*
|
||||
* Default is 25.
|
||||
*/
|
||||
public int maxSqlCacheSize;
|
||||
|
||||
/**
|
||||
* The database locale.
|
||||
*
|
||||
* Default is the value returned by {@link Locale#getDefault()}.
|
||||
*/
|
||||
public Locale locale;
|
||||
|
||||
/**
|
||||
* True if foreign key constraints are enabled.
|
||||
*
|
||||
* Default is false.
|
||||
*/
|
||||
public boolean foreignKeyConstraintsEnabled;
|
||||
|
||||
/**
|
||||
* The custom functions to register.
|
||||
*/
|
||||
public final ArrayList<SQLiteCustomFunction> customFunctions =
|
||||
new ArrayList<SQLiteCustomFunction>();
|
||||
|
||||
/**
|
||||
* Creates a database configuration with the required parameters for opening a
|
||||
* database and default values for all other parameters.
|
||||
*
|
||||
* @param path The database path.
|
||||
* @param openFlags Open flags for the database, such as {@link SQLiteDatabase#OPEN_READWRITE}.
|
||||
*/
|
||||
public SQLiteDatabaseConfiguration(String path, int openFlags) {
|
||||
if (path == null) {
|
||||
throw new IllegalArgumentException("path must not be null.");
|
||||
}
|
||||
|
||||
this.path = path;
|
||||
label = stripPathForLogs(path);
|
||||
this.openFlags = openFlags;
|
||||
|
||||
// Set default values for optional parameters.
|
||||
maxSqlCacheSize = 25;
|
||||
locale = Locale.getDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a database configuration as a copy of another configuration.
|
||||
*
|
||||
* @param other The other configuration.
|
||||
*/
|
||||
public SQLiteDatabaseConfiguration(SQLiteDatabaseConfiguration other) {
|
||||
if (other == null) {
|
||||
throw new IllegalArgumentException("other must not be null.");
|
||||
}
|
||||
|
||||
this.path = other.path;
|
||||
this.label = other.label;
|
||||
updateParametersFrom(other);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the non-immutable parameters of this configuration object
|
||||
* from the other configuration object.
|
||||
*
|
||||
* @param other The object from which to copy the parameters.
|
||||
*/
|
||||
public void updateParametersFrom(SQLiteDatabaseConfiguration other) {
|
||||
if (other == null) {
|
||||
throw new IllegalArgumentException("other must not be null.");
|
||||
}
|
||||
if (!path.equals(other.path)) {
|
||||
throw new IllegalArgumentException("other configuration must refer to "
|
||||
+ "the same database.");
|
||||
}
|
||||
|
||||
openFlags = other.openFlags;
|
||||
maxSqlCacheSize = other.maxSqlCacheSize;
|
||||
locale = other.locale;
|
||||
foreignKeyConstraintsEnabled = other.foreignKeyConstraintsEnabled;
|
||||
customFunctions.clear();
|
||||
customFunctions.addAll(other.customFunctions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the database is in-memory.
|
||||
* @return True if the database is in-memory.
|
||||
*/
|
||||
public boolean isInMemoryDb() {
|
||||
return path.equalsIgnoreCase(MEMORY_DB_PATH);
|
||||
}
|
||||
|
||||
private static String stripPathForLogs(String path) {
|
||||
if (path.indexOf('@') == -1) {
|
||||
return path;
|
||||
}
|
||||
return EMAIL_IN_DB_PATTERN.matcher(path).replaceAll("XX@YY");
|
||||
}
|
||||
}
|
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* An exception that indicates that the SQLite database file is corrupt.
|
||||
*/
|
||||
public class SQLiteDatabaseCorruptException extends SQLiteException {
|
||||
public SQLiteDatabaseCorruptException() {}
|
||||
|
||||
public SQLiteDatabaseCorruptException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* Thrown if the database engine was unable to acquire the
|
||||
* database locks it needs to do its job. If the statement is a [COMMIT]
|
||||
* or occurs outside of an explicit transaction, then you can retry the
|
||||
* statement. If the statement is not a [COMMIT] and occurs within a
|
||||
* explicit transaction then you should rollback the transaction before
|
||||
* continuing.
|
||||
*/
|
||||
public class SQLiteDatabaseLockedException extends SQLiteException {
|
||||
public SQLiteDatabaseLockedException() {}
|
||||
|
||||
public SQLiteDatabaseLockedException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
public class SQLiteDatatypeMismatchException extends SQLiteException {
|
||||
public SQLiteDatatypeMismatchException() {}
|
||||
|
||||
public SQLiteDatatypeMismatchException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,176 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.os.Build;
|
||||
/* import android.os.SystemProperties; */
|
||||
import android.util.Log;
|
||||
import android.util.Printer;
|
||||
|
||||
/**
|
||||
* Provides debugging info about all SQLite databases running in the current process.
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
public final class SQLiteDebug {
|
||||
private static native void nativeGetPagerStats(PagerStats stats);
|
||||
|
||||
/**
|
||||
* Controls the printing of informational SQL log messages.
|
||||
*
|
||||
* Enable using "adb shell setprop log.tag.SQLiteLog VERBOSE".
|
||||
*/
|
||||
public static final boolean DEBUG_SQL_LOG =
|
||||
Log.isLoggable("SQLiteLog", Log.VERBOSE);
|
||||
|
||||
/**
|
||||
* Controls the printing of SQL statements as they are executed.
|
||||
*
|
||||
* Enable using "adb shell setprop log.tag.SQLiteStatements VERBOSE".
|
||||
*/
|
||||
public static final boolean DEBUG_SQL_STATEMENTS =
|
||||
Log.isLoggable("SQLiteStatements", Log.VERBOSE);
|
||||
|
||||
/**
|
||||
* Controls the printing of wall-clock time taken to execute SQL statements
|
||||
* as they are executed.
|
||||
*
|
||||
* Enable using "adb shell setprop log.tag.SQLiteTime VERBOSE".
|
||||
*/
|
||||
public static final boolean DEBUG_SQL_TIME =
|
||||
Log.isLoggable("SQLiteTime", Log.VERBOSE);
|
||||
|
||||
/**
|
||||
* True to enable database performance testing instrumentation.
|
||||
* @hide
|
||||
*/
|
||||
public static final boolean DEBUG_LOG_SLOW_QUERIES = false;
|
||||
|
||||
private SQLiteDebug() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a query should be logged.
|
||||
*
|
||||
* Reads the "db.log.slow_query_threshold" system property, which can be changed
|
||||
* by the user at any time. If the value is zero, then all queries will
|
||||
* be considered slow. If the value does not exist or is negative, then no queries will
|
||||
* be considered slow.
|
||||
*
|
||||
* This value can be changed dynamically while the system is running.
|
||||
* For example, "adb shell setprop db.log.slow_query_threshold 200" will
|
||||
* log all queries that take 200ms or longer to run.
|
||||
* @hide
|
||||
*/
|
||||
public static final boolean shouldLogSlowQuery(long elapsedTimeMillis) {
|
||||
int slowQueryMillis = 10000;
|
||||
return slowQueryMillis >= 0 && elapsedTimeMillis >= slowQueryMillis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains statistics about the active pagers in the current process.
|
||||
*
|
||||
* @see #nativeGetPagerStats(PagerStats)
|
||||
*/
|
||||
public static class PagerStats {
|
||||
/** the current amount of memory checked out by sqlite using sqlite3_malloc().
|
||||
* documented at http://www.sqlite.org/c3ref/c_status_malloc_size.html
|
||||
*/
|
||||
public int memoryUsed;
|
||||
|
||||
/** the number of bytes of page cache allocation which could not be sattisfied by the
|
||||
* SQLITE_CONFIG_PAGECACHE buffer and where forced to overflow to sqlite3_malloc().
|
||||
* The returned value includes allocations that overflowed because they where too large
|
||||
* (they were larger than the "sz" parameter to SQLITE_CONFIG_PAGECACHE) and allocations
|
||||
* that overflowed because no space was left in the page cache.
|
||||
* documented at http://www.sqlite.org/c3ref/c_status_malloc_size.html
|
||||
*/
|
||||
public int pageCacheOverflow;
|
||||
|
||||
/** records the largest memory allocation request handed to sqlite3.
|
||||
* documented at http://www.sqlite.org/c3ref/c_status_malloc_size.html
|
||||
*/
|
||||
public int largestMemAlloc;
|
||||
|
||||
/** a list of {@link DbStats} - one for each main database opened by the applications
|
||||
* running on the android device
|
||||
*/
|
||||
public ArrayList<DbStats> dbStats;
|
||||
}
|
||||
|
||||
/**
|
||||
* contains statistics about a database
|
||||
*/
|
||||
public static class DbStats {
|
||||
/** name of the database */
|
||||
public String dbName;
|
||||
|
||||
/** the page size for the database */
|
||||
public long pageSize;
|
||||
|
||||
/** the database size */
|
||||
public long dbSize;
|
||||
|
||||
/** documented here http://www.sqlite.org/c3ref/c_dbstatus_lookaside_used.html */
|
||||
public int lookaside;
|
||||
|
||||
/** statement cache stats: hits/misses/cachesize */
|
||||
public String cache;
|
||||
|
||||
public DbStats(String dbName, long pageCount, long pageSize, int lookaside,
|
||||
int hits, int misses, int cachesize) {
|
||||
this.dbName = dbName;
|
||||
this.pageSize = pageSize / 1024;
|
||||
dbSize = (pageCount * pageSize) / 1024;
|
||||
this.lookaside = lookaside;
|
||||
this.cache = hits + "/" + misses + "/" + cachesize;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return all pager and database stats for the current process.
|
||||
* @return {@link PagerStats}
|
||||
*/
|
||||
public static PagerStats getDatabaseInfo() {
|
||||
PagerStats stats = new PagerStats();
|
||||
nativeGetPagerStats(stats);
|
||||
stats.dbStats = SQLiteDatabase.getDbStats();
|
||||
return stats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps detailed information about all databases used by the process.
|
||||
* @param printer The printer for dumping database state.
|
||||
* @param args Command-line arguments supplied to dumpsys dbinfo
|
||||
*/
|
||||
public static void dump(Printer printer, String[] args) {
|
||||
boolean verbose = false;
|
||||
for (String arg : args) {
|
||||
if (arg.equals("-v")) {
|
||||
verbose = true;
|
||||
}
|
||||
}
|
||||
|
||||
SQLiteDatabase.dumpAll(printer, verbose);
|
||||
}
|
||||
}
|
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
import android.database.Cursor;
|
||||
import org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||
import android.os.CancellationSignal;
|
||||
|
||||
/**
|
||||
* A cursor driver that uses the given query directly.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class SQLiteDirectCursorDriver implements SQLiteCursorDriver {
|
||||
private final SQLiteDatabase mDatabase;
|
||||
private final String mEditTable;
|
||||
private final String mSql;
|
||||
private final CancellationSignal mCancellationSignal;
|
||||
private SQLiteQuery mQuery;
|
||||
|
||||
public SQLiteDirectCursorDriver(SQLiteDatabase db, String sql, String editTable,
|
||||
CancellationSignal cancellationSignal) {
|
||||
mDatabase = db;
|
||||
mEditTable = editTable;
|
||||
mSql = sql;
|
||||
mCancellationSignal = cancellationSignal;
|
||||
}
|
||||
|
||||
public Cursor query(CursorFactory factory, String[] selectionArgs) {
|
||||
final SQLiteQuery query = new SQLiteQuery(mDatabase, mSql, mCancellationSignal);
|
||||
final Cursor cursor;
|
||||
try {
|
||||
query.bindAllArgsAsStrings(selectionArgs);
|
||||
|
||||
if (factory == null) {
|
||||
cursor = new SQLiteCursor(this, mEditTable, query);
|
||||
} else {
|
||||
cursor = factory.newCursor(mDatabase, this, mEditTable, query);
|
||||
}
|
||||
} catch (RuntimeException ex) {
|
||||
query.close();
|
||||
throw ex;
|
||||
}
|
||||
|
||||
mQuery = query;
|
||||
return cursor;
|
||||
}
|
||||
|
||||
public void cursorClosed() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void setBindArguments(String[] bindArgs) {
|
||||
mQuery.bindAllArgsAsStrings(bindArgs);
|
||||
}
|
||||
|
||||
public void cursorDeactivated() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void cursorRequeried(Cursor cursor) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SQLiteDirectCursorDriver: " + mSql;
|
||||
}
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* An exception that indicates that an IO error occured while accessing the
|
||||
* SQLite database file.
|
||||
*/
|
||||
public class SQLiteDiskIOException extends SQLiteException {
|
||||
public SQLiteDiskIOException() {}
|
||||
|
||||
public SQLiteDiskIOException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* An exception that indicates that the SQLite program is done.
|
||||
* Thrown when an operation that expects a row (such as {@link
|
||||
* SQLiteStatement#simpleQueryForString} or {@link
|
||||
* SQLiteStatement#simpleQueryForLong}) does not get one.
|
||||
*/
|
||||
public class SQLiteDoneException extends SQLiteException {
|
||||
public SQLiteDoneException() {}
|
||||
|
||||
public SQLiteDoneException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
import org.sqlite.database.SQLException;
|
||||
|
||||
/**
|
||||
* A SQLite exception that indicates there was an error with SQL parsing or execution.
|
||||
*/
|
||||
public class SQLiteException extends SQLException {
|
||||
public SQLiteException() {
|
||||
}
|
||||
|
||||
public SQLiteException(String error) {
|
||||
super(error);
|
||||
}
|
||||
|
||||
public SQLiteException(String error, Throwable cause) {
|
||||
super(error, cause);
|
||||
}
|
||||
}
|
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* An exception that indicates that the SQLite database is full.
|
||||
*/
|
||||
public class SQLiteFullException extends SQLiteException {
|
||||
public SQLiteFullException() {}
|
||||
|
||||
public SQLiteFullException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.os.StatFs;
|
||||
/* import android.os.SystemProperties; */
|
||||
|
||||
/**
|
||||
* Provides access to SQLite functions that affect all database connection,
|
||||
* such as memory management.
|
||||
*
|
||||
* The native code associated with SQLiteGlobal is also sets global configuration options
|
||||
* using sqlite3_config() then calls sqlite3_initialize() to ensure that the SQLite
|
||||
* library is properly initialized exactly once before any other framework or application
|
||||
* code has a chance to run.
|
||||
*
|
||||
* Verbose SQLite logging is enabled if the "log.tag.SQLiteLog" property is set to "V".
|
||||
* (per {@link SQLiteDebug#DEBUG_SQL_LOG}).
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class SQLiteGlobal {
|
||||
private static final String TAG = "SQLiteGlobal";
|
||||
|
||||
private static final Object sLock = new Object();
|
||||
private static int sDefaultPageSize;
|
||||
|
||||
private static native int nativeReleaseMemory();
|
||||
|
||||
private SQLiteGlobal() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to release memory by pruning the SQLite page cache and other
|
||||
* internal data structures.
|
||||
*
|
||||
* @return The number of bytes that were freed.
|
||||
*/
|
||||
public static int releaseMemory() {
|
||||
return nativeReleaseMemory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default page size to use when creating a database.
|
||||
*/
|
||||
public static int getDefaultPageSize() {
|
||||
synchronized (sLock) {
|
||||
if (sDefaultPageSize == 0) {
|
||||
sDefaultPageSize = new StatFs("/data").getBlockSize();
|
||||
}
|
||||
return 1024;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default journal mode when WAL is not in use.
|
||||
*/
|
||||
public static String getDefaultJournalMode() {
|
||||
return "delete";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the journal size limit in bytes.
|
||||
*/
|
||||
public static int getJournalSizeLimit() {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default database synchronization mode when WAL is not in use.
|
||||
*/
|
||||
public static String getDefaultSyncMode() {
|
||||
return "normal";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the database synchronization mode when in WAL mode.
|
||||
*/
|
||||
public static String getWALSyncMode() {
|
||||
return "normal";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the WAL auto-checkpoint integer in database pages.
|
||||
*/
|
||||
public static int getWALAutoCheckpoint() {
|
||||
int value = 1000;
|
||||
return Math.max(1, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the connection pool size when in WAL mode.
|
||||
*/
|
||||
public static int getWALConnectionPoolSize() {
|
||||
int value = 10;
|
||||
return Math.max(2, value);
|
||||
}
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
/**
|
||||
* This error can occur if the application creates a SQLiteStatement object and allows multiple
|
||||
* threads in the application use it at the same time.
|
||||
* Sqlite returns this error if bind and execute methods on this object occur at the same time
|
||||
* from multiple threads, like so:
|
||||
* thread # 1: in execute() method of the SQLiteStatement object
|
||||
* while thread # 2: is in bind..() on the same object.
|
||||
*</p>
|
||||
* FIX this by NEVER sharing the same SQLiteStatement object between threads.
|
||||
* Create a local instance of the SQLiteStatement whenever it is needed, use it and close it ASAP.
|
||||
* NEVER make it globally available.
|
||||
*/
|
||||
public class SQLiteMisuseException extends SQLiteException {
|
||||
public SQLiteMisuseException() {}
|
||||
|
||||
public SQLiteMisuseException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,383 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
import android.content.Context;
|
||||
import org.sqlite.database.DatabaseErrorHandler;
|
||||
import org.sqlite.database.DefaultDatabaseErrorHandler;
|
||||
import org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* A helper class to manage database creation and version management.
|
||||
*
|
||||
* <p>You create a subclass implementing {@link #onCreate}, {@link #onUpgrade} and
|
||||
* optionally {@link #onOpen}, and this class takes care of opening the database
|
||||
* if it exists, creating it if it does not, and upgrading it as necessary.
|
||||
* Transactions are used to make sure the database is always in a sensible state.
|
||||
*
|
||||
* <p>This class makes it easy for {@link android.content.ContentProvider}
|
||||
* implementations to defer opening and upgrading the database until first use,
|
||||
* to avoid blocking application startup with long-running database upgrades.
|
||||
*
|
||||
* <p>For an example, see the NotePadProvider class in the NotePad sample application,
|
||||
* in the <em>samples/</em> directory of the SDK.</p>
|
||||
*
|
||||
* <p class="note"><strong>Note:</strong> this class assumes
|
||||
* monotonically increasing version numbers for upgrades.</p>
|
||||
*/
|
||||
public abstract class SQLiteOpenHelper {
|
||||
private static final String TAG = SQLiteOpenHelper.class.getSimpleName();
|
||||
|
||||
// When true, getReadableDatabase returns a read-only database if it is just being opened.
|
||||
// The database handle is reopened in read/write mode when getWritableDatabase is called.
|
||||
// We leave this behavior disabled in production because it is inefficient and breaks
|
||||
// many applications. For debugging purposes it can be useful to turn on strict
|
||||
// read-only semantics to catch applications that call getReadableDatabase when they really
|
||||
// wanted getWritableDatabase.
|
||||
private static final boolean DEBUG_STRICT_READONLY = false;
|
||||
|
||||
private final Context mContext;
|
||||
private final String mName;
|
||||
private final CursorFactory mFactory;
|
||||
private final int mNewVersion;
|
||||
|
||||
private SQLiteDatabase mDatabase;
|
||||
private boolean mIsInitializing;
|
||||
private boolean mEnableWriteAheadLogging;
|
||||
private final DatabaseErrorHandler mErrorHandler;
|
||||
|
||||
/**
|
||||
* Create a helper object to create, open, and/or manage a database.
|
||||
* This method always returns very quickly. The database is not actually
|
||||
* created or opened until one of {@link #getWritableDatabase} or
|
||||
* {@link #getReadableDatabase} is called.
|
||||
*
|
||||
* @param context to use to open or create the database
|
||||
* @param name of the database file, or null for an in-memory database
|
||||
* @param factory to use for creating cursor objects, or null for the default
|
||||
* @param version number of the database (starting at 1); if the database is older,
|
||||
* {@link #onUpgrade} will be used to upgrade the database; if the database is
|
||||
* newer, {@link #onDowngrade} will be used to downgrade the database
|
||||
*/
|
||||
public SQLiteOpenHelper(Context context, String name, CursorFactory factory, int version) {
|
||||
this(context, name, factory, version, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a helper object to create, open, and/or manage a database.
|
||||
* The database is not actually created or opened until one of
|
||||
* {@link #getWritableDatabase} or {@link #getReadableDatabase} is called.
|
||||
*
|
||||
* <p>Accepts input param: a concrete instance of {@link DatabaseErrorHandler} to be
|
||||
* used to handle corruption when sqlite reports database corruption.</p>
|
||||
*
|
||||
* @param context to use to open or create the database
|
||||
* @param name of the database file, or null for an in-memory database
|
||||
* @param factory to use for creating cursor objects, or null for the default
|
||||
* @param version number of the database (starting at 1); if the database is older,
|
||||
* {@link #onUpgrade} will be used to upgrade the database; if the database is
|
||||
* newer, {@link #onDowngrade} will be used to downgrade the database
|
||||
* @param errorHandler the {@link DatabaseErrorHandler} to be used when sqlite reports database
|
||||
* corruption, or null to use the default error handler.
|
||||
*/
|
||||
public SQLiteOpenHelper(Context context, String name, CursorFactory factory, int version,
|
||||
DatabaseErrorHandler errorHandler) {
|
||||
if (version < 1) throw new IllegalArgumentException("Version must be >= 1, was " + version);
|
||||
|
||||
mContext = context;
|
||||
mName = name;
|
||||
mFactory = factory;
|
||||
mNewVersion = version;
|
||||
mErrorHandler = errorHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the SQLite database being opened, as given to
|
||||
* the constructor.
|
||||
*/
|
||||
public String getDatabaseName() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the use of write-ahead logging for the database.
|
||||
*
|
||||
* Write-ahead logging cannot be used with read-only databases so the value of
|
||||
* this flag is ignored if the database is opened read-only.
|
||||
*
|
||||
* @param enabled True if write-ahead logging should be enabled, false if it
|
||||
* should be disabled.
|
||||
*
|
||||
* @see SQLiteDatabase#enableWriteAheadLogging()
|
||||
*/
|
||||
public void setWriteAheadLoggingEnabled(boolean enabled) {
|
||||
synchronized (this) {
|
||||
if (mEnableWriteAheadLogging != enabled) {
|
||||
if (mDatabase != null && mDatabase.isOpen() && !mDatabase.isReadOnly()) {
|
||||
if (enabled) {
|
||||
mDatabase.enableWriteAheadLogging();
|
||||
} else {
|
||||
mDatabase.disableWriteAheadLogging();
|
||||
}
|
||||
}
|
||||
mEnableWriteAheadLogging = enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and/or open a database that will be used for reading and writing.
|
||||
* The first time this is called, the database will be opened and
|
||||
* {@link #onCreate}, {@link #onUpgrade} and/or {@link #onOpen} will be
|
||||
* called.
|
||||
*
|
||||
* <p>Once opened successfully, the database is cached, so you can
|
||||
* call this method every time you need to write to the database.
|
||||
* (Make sure to call {@link #close} when you no longer need the database.)
|
||||
* Errors such as bad permissions or a full disk may cause this method
|
||||
* to fail, but future attempts may succeed if the problem is fixed.</p>
|
||||
*
|
||||
* <p class="caution">Database upgrade may take a long time, you
|
||||
* should not call this method from the application main thread, including
|
||||
* from {@link android.content.ContentProvider#onCreate ContentProvider.onCreate()}.
|
||||
*
|
||||
* @throws SQLiteException if the database cannot be opened for writing
|
||||
* @return a read/write database object valid until {@link #close} is called
|
||||
*/
|
||||
public SQLiteDatabase getWritableDatabase() {
|
||||
synchronized (this) {
|
||||
return getDatabaseLocked(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and/or open a database. This will be the same object returned by
|
||||
* {@link #getWritableDatabase} unless some problem, such as a full disk,
|
||||
* requires the database to be opened read-only. In that case, a read-only
|
||||
* database object will be returned. If the problem is fixed, a future call
|
||||
* to {@link #getWritableDatabase} may succeed, in which case the read-only
|
||||
* database object will be closed and the read/write object will be returned
|
||||
* in the future.
|
||||
*
|
||||
* <p class="caution">Like {@link #getWritableDatabase}, this method may
|
||||
* take a long time to return, so you should not call it from the
|
||||
* application main thread, including from
|
||||
* {@link android.content.ContentProvider#onCreate ContentProvider.onCreate()}.
|
||||
*
|
||||
* @throws SQLiteException if the database cannot be opened
|
||||
* @return a database object valid until {@link #getWritableDatabase}
|
||||
* or {@link #close} is called.
|
||||
*/
|
||||
public SQLiteDatabase getReadableDatabase() {
|
||||
synchronized (this) {
|
||||
return getDatabaseLocked(false);
|
||||
}
|
||||
}
|
||||
|
||||
private SQLiteDatabase getDatabaseLocked(boolean writable) {
|
||||
if (mDatabase != null) {
|
||||
if (!mDatabase.isOpen()) {
|
||||
// Darn! The user closed the database by calling mDatabase.close().
|
||||
mDatabase = null;
|
||||
} else if (!writable || !mDatabase.isReadOnly()) {
|
||||
// The database is already open for business.
|
||||
return mDatabase;
|
||||
}
|
||||
}
|
||||
|
||||
if (mIsInitializing) {
|
||||
throw new IllegalStateException("getDatabase called recursively");
|
||||
}
|
||||
|
||||
SQLiteDatabase db = mDatabase;
|
||||
try {
|
||||
mIsInitializing = true;
|
||||
|
||||
if (db != null) {
|
||||
if (writable && db.isReadOnly()) {
|
||||
db.reopenReadWrite();
|
||||
}
|
||||
} else if (mName == null) {
|
||||
db = SQLiteDatabase.create(null);
|
||||
} else {
|
||||
try {
|
||||
if (DEBUG_STRICT_READONLY && !writable) {
|
||||
final String path = mContext.getDatabasePath(mName).getPath();
|
||||
db = SQLiteDatabase.openDatabase(path, mFactory,
|
||||
SQLiteDatabase.OPEN_READONLY, mErrorHandler);
|
||||
} else {
|
||||
db = SQLiteDatabase.openOrCreateDatabase(
|
||||
mName, mFactory, mErrorHandler
|
||||
);
|
||||
}
|
||||
} catch (SQLiteException ex) {
|
||||
if (writable) {
|
||||
throw ex;
|
||||
}
|
||||
Log.e(TAG, "Couldn't open " + mName
|
||||
+ " for writing (will try read-only):", ex);
|
||||
final String path = mContext.getDatabasePath(mName).getPath();
|
||||
db = SQLiteDatabase.openDatabase(path, mFactory,
|
||||
SQLiteDatabase.OPEN_READONLY, mErrorHandler);
|
||||
}
|
||||
}
|
||||
|
||||
onConfigure(db);
|
||||
|
||||
final int version = db.getVersion();
|
||||
if (version != mNewVersion) {
|
||||
if (db.isReadOnly()) {
|
||||
throw new SQLiteException("Can't upgrade read-only database from version " +
|
||||
db.getVersion() + " to " + mNewVersion + ": " + mName);
|
||||
}
|
||||
|
||||
db.beginTransaction();
|
||||
try {
|
||||
if (version == 0) {
|
||||
onCreate(db);
|
||||
} else {
|
||||
if (version > mNewVersion) {
|
||||
onDowngrade(db, version, mNewVersion);
|
||||
} else {
|
||||
onUpgrade(db, version, mNewVersion);
|
||||
}
|
||||
}
|
||||
db.setVersion(mNewVersion);
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
onOpen(db);
|
||||
|
||||
if (db.isReadOnly()) {
|
||||
Log.w(TAG, "Opened " + mName + " in read-only mode");
|
||||
}
|
||||
|
||||
mDatabase = db;
|
||||
return db;
|
||||
} finally {
|
||||
mIsInitializing = false;
|
||||
if (db != null && db != mDatabase) {
|
||||
db.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close any open database object.
|
||||
*/
|
||||
public synchronized void close() {
|
||||
if (mIsInitializing) throw new IllegalStateException("Closed during initialization");
|
||||
|
||||
if (mDatabase != null && mDatabase.isOpen()) {
|
||||
mDatabase.close();
|
||||
mDatabase = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the database connection is being configured, to enable features
|
||||
* such as write-ahead logging or foreign key support.
|
||||
* <p>
|
||||
* This method is called before {@link #onCreate}, {@link #onUpgrade},
|
||||
* {@link #onDowngrade}, or {@link #onOpen} are called. It should not modify
|
||||
* the database except to configure the database connection as required.
|
||||
* </p><p>
|
||||
* This method should only call methods that configure the parameters of the
|
||||
* database connection, such as {@link SQLiteDatabase#enableWriteAheadLogging}
|
||||
* {@link SQLiteDatabase#setForeignKeyConstraintsEnabled},
|
||||
* {@link SQLiteDatabase#setLocale}, {@link SQLiteDatabase#setMaximumSize},
|
||||
* or executing PRAGMA statements.
|
||||
* </p>
|
||||
*
|
||||
* @param db The database.
|
||||
*/
|
||||
public void onConfigure(SQLiteDatabase db) {}
|
||||
|
||||
/**
|
||||
* Called when the database is created for the first time. This is where the
|
||||
* creation of tables and the initial population of the tables should happen.
|
||||
*
|
||||
* @param db The database.
|
||||
*/
|
||||
public abstract void onCreate(SQLiteDatabase db);
|
||||
|
||||
/**
|
||||
* Called when the database needs to be upgraded. The implementation
|
||||
* should use this method to drop tables, add tables, or do anything else it
|
||||
* needs to upgrade to the new schema version.
|
||||
*
|
||||
* <p>
|
||||
* The SQLite ALTER TABLE documentation can be found
|
||||
* <a href="http://sqlite.org/lang_altertable.html">here</a>. If you add new columns
|
||||
* you can use ALTER TABLE to insert them into a live table. If you rename or remove columns
|
||||
* you can use ALTER TABLE to rename the old table, then create the new table and then
|
||||
* populate the new table with the contents of the old table.
|
||||
* </p><p>
|
||||
* This method executes within a transaction. If an exception is thrown, all changes
|
||||
* will automatically be rolled back.
|
||||
* </p>
|
||||
*
|
||||
* @param db The database.
|
||||
* @param oldVersion The old database version.
|
||||
* @param newVersion The new database version.
|
||||
*/
|
||||
public abstract void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion);
|
||||
|
||||
/**
|
||||
* Called when the database needs to be downgraded. This is strictly similar to
|
||||
* {@link #onUpgrade} method, but is called whenever current version is newer than requested one.
|
||||
* However, this method is not abstract, so it is not mandatory for a customer to
|
||||
* implement it. If not overridden, default implementation will reject downgrade and
|
||||
* throws SQLiteException
|
||||
*
|
||||
* <p>
|
||||
* This method executes within a transaction. If an exception is thrown, all changes
|
||||
* will automatically be rolled back.
|
||||
* </p>
|
||||
*
|
||||
* @param db The database.
|
||||
* @param oldVersion The old database version.
|
||||
* @param newVersion The new database version.
|
||||
*/
|
||||
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
throw new SQLiteException("Can't downgrade database from version " +
|
||||
oldVersion + " to " + newVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the database has been opened. The implementation
|
||||
* should check {@link SQLiteDatabase#isReadOnly} before updating the
|
||||
* database.
|
||||
* <p>
|
||||
* This method is called after the database connection has been configured
|
||||
* and after the database schema has been created, upgraded or downgraded as necessary.
|
||||
* If the database connection must be configured in some way before the schema
|
||||
* is created, upgraded, or downgraded, do it in {@link #onConfigure} instead.
|
||||
* </p>
|
||||
*
|
||||
* @param db The database.
|
||||
*/
|
||||
public void onOpen(SQLiteDatabase db) {}
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
public class SQLiteOutOfMemoryException extends SQLiteException {
|
||||
public SQLiteOutOfMemoryException() {}
|
||||
|
||||
public SQLiteOutOfMemoryException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,222 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
** Modified to support SQLite extensions by the SQLite developers:
|
||||
** sqlite-dev@sqlite.org.
|
||||
*/
|
||||
|
||||
package org.sqlite.database.sqlite;
|
||||
|
||||
import android.database.DatabaseUtils;
|
||||
import android.os.CancellationSignal;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* A base class for compiled SQLite programs.
|
||||
* <p>
|
||||
* This class is not thread-safe.
|
||||
* </p>
|
||||
*/
|
||||
public abstract class SQLiteProgram extends SQLiteClosable {
|
||||
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||
|
||||
private final SQLiteDatabase mDatabase;
|
||||
private final String mSql;
|
||||
private final boolean mReadOnly;
|
||||
private final String[] mColumnNames;
|
||||
private final int mNumParameters;
|
||||
private final Object[] mBindArgs;
|
||||
|
||||
SQLiteProgram(SQLiteDatabase db, String sql, Object[] bindArgs,
|
||||
CancellationSignal cancellationSignalForPrepare) {
|
||||
mDatabase = db;
|
||||
mSql = sql.trim();
|
||||
|
||||
int n = DatabaseUtils.getSqlStatementType(mSql);
|
||||
switch (n) {
|
||||
case DatabaseUtils.STATEMENT_BEGIN:
|
||||
case DatabaseUtils.STATEMENT_COMMIT:
|
||||
case DatabaseUtils.STATEMENT_ABORT:
|
||||
mReadOnly = false;
|
||||
mColumnNames = EMPTY_STRING_ARRAY;
|
||||
mNumParameters = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
boolean assumeReadOnly = (n == DatabaseUtils.STATEMENT_SELECT);
|
||||
SQLiteStatementInfo info = new SQLiteStatementInfo();
|
||||
db.getThreadSession().prepare(mSql,
|
||||
db.getThreadDefaultConnectionFlags(assumeReadOnly),
|
||||
cancellationSignalForPrepare, info);
|
||||
mReadOnly = info.readOnly;
|
||||
mColumnNames = info.columnNames;
|
||||
mNumParameters = info.numParameters;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bindArgs != null && bindArgs.length > mNumParameters) {
|
||||
throw new IllegalArgumentException("Too many bind arguments. "
|
||||
+ bindArgs.length + " arguments were provided but the statement needs "
|
||||
+ mNumParameters + " arguments.");
|
||||
}
|
||||
|
||||
if (mNumParameters != 0) {
|
||||
mBindArgs = new Object[mNumParameters];
|
||||
if (bindArgs != null) {
|
||||
System.arraycopy(bindArgs, 0, mBindArgs, 0, bindArgs.length);
|
||||
}
|
||||
} else {
|
||||
mBindArgs = null;
|
||||
}
|
||||
}
|
||||
|
||||
final SQLiteDatabase getDatabase() {
|
||||
return mDatabase;
|
||||
}
|
||||
|
||||
final String getSql() {
|
||||
return mSql;
|
||||
}
|
||||
|
||||
final Object[] getBindArgs() {
|
||||
return mBindArgs;
|
||||
}
|
||||
|
||||
final String[] getColumnNames() {
|
||||
return mColumnNames;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
protected final SQLiteSession getSession() {
|
||||
return mDatabase.getThreadSession();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
protected final int getConnectionFlags() {
|
||||
return mDatabase.getThreadDefaultConnectionFlags(mReadOnly);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
protected final void onCorruption() {
|
||||
mDatabase.onCorruption();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented.
|
||||
* @deprecated This method is deprecated and must not be used.
|
||||
*/
|
||||
@Deprecated
|
||||
public final int getUniqueId() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind a NULL value to this statement. The value remains bound until
|
||||
* {@link #clearBindings} is called.
|
||||
*
|
||||
* @param index The 1-based index to the parameter to bind null to
|
||||
*/
|
||||
public void bindNull(int index) {
|
||||
bind(index, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind a long value to this statement. The value remains bound until
|
||||
* {@link #clearBindings} is called.
|
||||
*addToBindArgs
|
||||
* @param index The 1-based index to the parameter to bind
|
||||
* @param value The value to bind
|
||||
*/
|
||||
public void bindLong(int index, long value) {
|
||||
bind(index, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind a double value to this statement. The value remains bound until
|
||||
* {@link #clearBindings} is called.
|
||||
*
|
||||
* @param index The 1-based index to the parameter to bind
|
||||
* @param value The value to bind
|
||||
*/
|
||||
public void bindDouble(int index, double value) {
|
||||
bind(index, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind a String value to this statement. The value remains bound until
|
||||
* {@link #clearBindings} is called.
|
||||
*
|
||||
* @param index The 1-based index to the parameter to bind
|
||||
* @param value The value to bind, must not be null
|
||||
*/
|
||||
public void bindString(int index, String value) {
|
||||
if (value == null) {
|
||||
throw new IllegalArgumentException("the bind value at index " + index + " is null");
|
||||
}
|
||||
bind(index, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind a byte array value to this statement. The value remains bound until
|
||||
* {@link #clearBindings} is called.
|
||||
*
|
||||
* @param index The 1-based index to the parameter to bind
|
||||
* @param value The value to bind, must not be null
|
||||
*/
|
||||
public void bindBlob(int index, byte[] value) {
|
||||
if (value == null) {
|
||||
throw new IllegalArgumentException("the bind value at index " + index + " is null");
|
||||
}
|
||||
bind(index, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all existing bindings. Unset bindings are treated as NULL.
|
||||
*/
|
||||
public void clearBindings() {
|
||||
if (mBindArgs != null) {
|
||||
Arrays.fill(mBindArgs, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an array of String bindArgs, this method binds all of them in one single call.
|
||||
*
|
||||
* @param bindArgs the String array of bind args, none of which must be null.
|
||||
*/
|
||||
public void bindAllArgsAsStrings(String[] bindArgs) {
|
||||
if (bindArgs != null) {
|
||||
for (int i = bindArgs.length; i != 0; i--) {
|
||||
bindString(i, bindArgs[i - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAllReferencesReleased() {
|
||||
clearBindings();
|
||||
}
|
||||
|
||||
private void bind(int index, Object value) {
|
||||
if (index < 1 || index > mNumParameters) {
|
||||
throw new IllegalArgumentException("Cannot bind argument at index "
|
||||
+ index + " because the index is out of range. "
|
||||
+ "The statement has " + mNumParameters + " parameters.");
|
||||
}
|
||||
mBindArgs[index - 1] = value;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user