mathematical 1.5.12 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -30
- data/Rakefile +1 -0
- data/ext/mathematical/CMakeLists.txt +4 -1
- data/ext/mathematical/extconf.rb +4 -1
- data/ext/mathematical/lasem/NEWS +17 -0
- data/ext/mathematical/lasem/autogen.sh +5 -2
- data/ext/mathematical/lasem/configure.ac +3 -3
- data/ext/mathematical/lasem/po/cs.po +50 -18
- data/ext/mathematical/lasem/po/de.po +62 -26
- data/ext/mathematical/lasem/po/es.po +27 -18
- data/ext/mathematical/lasem/po/hu.po +50 -21
- data/ext/mathematical/lasem/po/id.po +49 -16
- data/ext/mathematical/lasem/po/lt.po +47 -18
- data/ext/mathematical/lasem/po/pl.po +53 -24
- data/ext/mathematical/lasem/po/pt_BR.po +70 -29
- data/ext/mathematical/lasem/po/sl.po +43 -29
- data/ext/mathematical/lasem/po/sr.po +67 -27
- data/ext/mathematical/lasem/po/sr@latin.po +67 -27
- data/ext/mathematical/lasem/po/sv.po +51 -18
- data/ext/mathematical/lasem/src/lasemrender.c +107 -14
- data/ext/mathematical/lasem/src/lsmitex.c +1 -0
- data/ext/mathematical/lasem/src/lsmsvgelement.c +0 -2
- data/ext/mathematical/lasem/src/lsmsvglength.c +2 -2
- data/ext/mathematical/lasem/src/lsmsvgmatrix.c +16 -0
- data/ext/mathematical/lasem/src/lsmsvgmatrix.h +2 -1
- data/ext/mathematical/lasem/src/lsmsvgsvgelement.c +8 -2
- data/ext/mathematical/lasem_overrides.c +3 -3
- data/ext/mathematical/lib/liblasem.dylib +0 -0
- data/ext/mathematical/lib/libmtex2MML.a +0 -0
- data/ext/mathematical/mathematical.c +1 -1
- data/ext/mathematical/mtex2MML/CMakeLists.txt +5 -0
- data/ext/mathematical/mtex2MML/README.md +3 -3
- data/ext/mathematical/mtex2MML/SUPPORTED.md +2 -0
- data/ext/mathematical/mtex2MML/appveyor.yml +15 -5
- data/ext/mathematical/mtex2MML/build/CMakeCache.txt +181 -116
- data/ext/mathematical/mtex2MML/build/CMakeFiles/3.6.1/CMakeCCompiler.cmake +67 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/3.6.1/CMakeCXXCompiler.cmake +68 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1 → 3.6.1}/CMakeDetermineCompilerABI_C.bin +0 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1 → 3.6.1}/CMakeDetermineCompilerABI_CXX.bin +0 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/3.6.1/CMakeSystem.cmake +15 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1 → 3.6.1}/CompilerIdC/CMakeCCompilerId.c +223 -55
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1/CompilerIdCXX → 3.6.1/CompilerIdC}/a.out +0 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1 → 3.6.1}/CompilerIdCXX/CMakeCXXCompilerId.cpp +202 -44
- data/ext/mathematical/mtex2MML/build/CMakeFiles/{2.8.10.1/CompilerIdC → 3.6.1/CompilerIdCXX}/a.out +0 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/CMakeDirectoryInformation.cmake +8 -8
- data/ext/mathematical/mtex2MML/build/CMakeFiles/CMakeOutput.log +405 -109
- data/ext/mathematical/mtex2MML/build/CMakeFiles/CMakeRuleHashes.txt +29 -29
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Continuous.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Continuous.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Continuous.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousBuild.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousBuild.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousBuild.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousConfigure.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousConfigure.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousConfigure.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousCoverage.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousCoverage.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousCoverage.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousMemCheck.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousMemCheck.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousMemCheck.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousStart.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousStart.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousStart.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousSubmit.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousSubmit.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousSubmit.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousTest.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousTest.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousTest.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousUpdate.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousUpdate.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ContinuousUpdate.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Experimental.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Experimental.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Experimental.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalBuild.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalBuild.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalBuild.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalConfigure.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalConfigure.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalConfigure.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalCoverage.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalCoverage.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalCoverage.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalMemCheck.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalMemCheck.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalMemCheck.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalStart.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalStart.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalStart.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalSubmit.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalSubmit.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalSubmit.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalTest.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalTest.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalTest.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalUpdate.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalUpdate.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/ExperimentalUpdate.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Makefile.cmake +68 -60
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Makefile2 +564 -522
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Nightly.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Nightly.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/Nightly.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyBuild.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyBuild.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyBuild.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyConfigure.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyConfigure.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyConfigure.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyCoverage.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyCoverage.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyCoverage.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemCheck.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemCheck.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemCheck.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemoryCheck.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemoryCheck.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyMemoryCheck.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyStart.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyStart.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyStart.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlySubmit.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlySubmit.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlySubmit.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyTest.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyTest.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyTest.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyUpdate.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyUpdate.dir/build.make +14 -7
- data/ext/mathematical/mtex2MML/build/CMakeFiles/NightlyUpdate.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/TargetDirectories.txt +28 -21
- data/ext/mathematical/mtex2MML/build/CMakeFiles/feature_tests.bin +0 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/feature_tests.c +34 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/feature_tests.cxx +405 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/format.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/format.dir/build.make +13 -6
- data/ext/mathematical/mtex2MML/build/CMakeFiles/format.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/DependInfo.cmake +16 -18
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/build.make +55 -42
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/flags.make +5 -3
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/link.txt +1 -1
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML.dir/progress.make +1 -0
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/C.includecache +115 -27
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/DependInfo.cmake +16 -18
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/build.make +54 -42
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/cmake_clean_target.cmake +1 -1
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/depend.internal +19 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/depend.make +18 -19
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/flags.make +5 -3
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/link.txt +2 -2
- data/ext/mathematical/mtex2MML/build/CMakeFiles/libmtex2MML_static.dir/progress.make +9 -8
- data/ext/mathematical/mtex2MML/build/CMakeFiles/memcheck.dir/DependInfo.cmake +4 -20
- data/ext/mathematical/mtex2MML/build/CMakeFiles/memcheck.dir/build.make +13 -6
- data/ext/mathematical/mtex2MML/build/CMakeFiles/memcheck.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/DependInfo.cmake +16 -18
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/build.make +60 -47
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/cmake_clean.cmake +4 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/flags.make +5 -3
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/link.txt +1 -1
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML.dir/progress.make +10 -9
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/DependInfo.cmake +17 -18
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/build.make +178 -124
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/cmake_clean.cmake +5 -4
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/flags.make +5 -3
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/link.txt +1 -1
- data/ext/mathematical/mtex2MML/build/CMakeFiles/mtex2MML_clar.dir/progress.make +27 -25
- data/ext/mathematical/mtex2MML/build/CMakeFiles/progress.marks +1 -1
- data/ext/mathematical/mtex2MML/build/CTestTestfile.cmake +2 -2
- data/ext/mathematical/mtex2MML/build/DartConfiguration.tcl +25 -7
- data/ext/mathematical/mtex2MML/build/Makefile +419 -307
- data/ext/mathematical/mtex2MML/build/cmake_install.cmake +32 -32
- data/ext/mathematical/mtex2MML/build/lexer.c +4317 -4379
- data/ext/mathematical/mtex2MML/build/libmtex2MML.a +0 -0
- data/ext/mathematical/mtex2MML/build/mtex2mml_export.h +12 -5
- data/ext/mathematical/mtex2MML/build/parser.c +5549 -5473
- data/ext/mathematical/mtex2MML/build/parser.h +499 -490
- data/ext/mathematical/mtex2MML/build/parser.output +93361 -92735
- data/ext/mathematical/mtex2MML/deps/strdup/package.json +2 -2
- data/ext/mathematical/mtex2MML/deps/strdup/strdup.c +2 -0
- data/ext/mathematical/mtex2MML/deps/strdup/strdup.h +2 -0
- data/ext/mathematical/mtex2MML/deps/uthash/package.json +2 -1
- data/ext/mathematical/mtex2MML/deps/uthash/utarray.h +42 -36
- data/ext/mathematical/mtex2MML/deps/uthash/uthash.h +334 -218
- data/ext/mathematical/mtex2MML/deps/uthash/utlist.h +282 -144
- data/ext/mathematical/mtex2MML/deps/uthash/utringbuffer.h +108 -0
- data/ext/mathematical/mtex2MML/deps/uthash/utstring.h +15 -10
- data/ext/mathematical/mtex2MML/script/bootstrap +6 -12
- data/ext/mathematical/mtex2MML/script/cibuild +47 -1
- data/ext/mathematical/mtex2MML/script/{release → tag} +1 -1
- data/ext/mathematical/mtex2MML/src/environment.c +73 -13
- data/ext/mathematical/mtex2MML/src/environment.h +1 -1
- data/ext/mathematical/mtex2MML/src/lexer.l +75 -53
- data/ext/mathematical/mtex2MML/src/main.c +65 -36
- data/ext/mathematical/mtex2MML/src/mtex2MML.h +5 -1
- data/ext/mathematical/mtex2MML/src/parser.y +67 -16
- data/ext/mathematical/mtex2MML/tests/basic.c +10 -0
- data/ext/mathematical/mtex2MML/tests/delimiters.c +95 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/layout/strut-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/cal-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/frak-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/mathcal-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/mathfrak-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/mathrm-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/mathscr-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/rm-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/scr-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/MathJax/LaTeXToMathML-out/mathvariant/textrm-1.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/array/strip_excess_whitespace_in_array_attributes.html +1 -1
- data/ext/mathematical/mtex2MML/tests/fixtures/basic/text_rendering.html +23 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/basic/text_rendering.txt +23 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/align.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/align.txt +3 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/alignat-1a.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/alignat-1a.txt +4 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/aligned_ex_spacing.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/aligned_ex_spacing.txt +4 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/basic_array.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/basic_array.txt +3 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/mixed_env.html +8 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/mixed_env.txt +11 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/performance/big_file.html +6 -6
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/gt.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/gt.txt +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/lt.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/lt.txt +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/textgreater.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/textgreater.txt +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/textless.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/symbols/textless.txt +1 -0
- data/ext/mathematical/mtex2MML/tests/symbols.c +69 -0
- data/lib/mathematical.rb +19 -1
- data/lib/mathematical/version.rb +1 -1
- data/mathematical.gemspec +2 -1
- data/test/mathematical/basic_test.rb +16 -3
- data/test/mathematical/fixtures/png/numeric_test_1.png +0 -0
- data/test/mathematical/fixtures/png/numeric_test_3.png +0 -0
- data/test/mathematical/fixtures/png/pmatrix.png +0 -0
- data/test/mathematical/maliciousness_test.rb +0 -1
- data/test/mathematical/multiples_test.rb +3 -0
- data/test/mathematical/png_test.rb +4 -1
- data/test/test_helper.rb +2 -0
- metadata +54 -18
- data/ext/mathematical/FindNewerRubies.cmake +0 -292
- data/ext/mathematical/mtex2MML/build.ps1 +0 -2
- data/ext/mathematical/mtex2MML/build/CMakeFiles/2.8.10.1/CMakeCCompiler.cmake +0 -55
- data/ext/mathematical/mtex2MML/build/CMakeFiles/2.8.10.1/CMakeCXXCompiler.cmake +0 -56
- data/ext/mathematical/mtex2MML/build/CMakeFiles/2.8.10.1/CMakeSystem.cmake +0 -15
- data/ext/mathematical/mtex2MML/src/y.output +0 -117655
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2007-
|
2
|
+
Copyright (c) 2007-2016, Troy D. Hanson http://troydhanson.github.com/uthash/
|
3
3
|
All rights reserved.
|
4
4
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
@@ -24,7 +24,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
24
|
#ifndef UTLIST_H
|
25
25
|
#define UTLIST_H
|
26
26
|
|
27
|
-
#define UTLIST_VERSION
|
27
|
+
#define UTLIST_VERSION 2.0.1
|
28
28
|
|
29
29
|
#include <assert.h>
|
30
30
|
|
@@ -68,11 +68,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
68
68
|
#define LDECLTYPE(x) decltype(x)
|
69
69
|
#else /* VS2008 or older (or VS2010 in C mode) */
|
70
70
|
#define NO_DECLTYPE
|
71
|
-
#define LDECLTYPE(x) char*
|
72
71
|
#endif
|
73
72
|
#elif defined(__ICCARM__)
|
74
73
|
#define NO_DECLTYPE
|
75
|
-
#define LDECLTYPE(x) char*
|
76
74
|
#else /* GNU, Sun and other compilers */
|
77
75
|
#define LDECLTYPE(x) __typeof(x)
|
78
76
|
#endif
|
@@ -81,6 +79,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
81
79
|
* namely, we always reassign our tmp variable to the list head if we need
|
82
80
|
* to dereference its prev/next pointers, and save/restore the real head.*/
|
83
81
|
#ifdef NO_DECLTYPE
|
82
|
+
#define IF_NO_DECLTYPE(x) x
|
83
|
+
#define LDECLTYPE(x) char*
|
84
84
|
#define _SV(elt,list) _tmp = (char*)(list); {char **_alias = (char**)&(list); *_alias = (elt); }
|
85
85
|
#define _NEXT(elt,list,next) ((char*)((list)->next))
|
86
86
|
#define _NEXTASGN(elt,list,to,next) { char **_alias = (char**)&((list)->next); *_alias=(char*)(to); }
|
@@ -89,6 +89,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
89
89
|
#define _RS(list) { char **_alias = (char**)&(list); *_alias=_tmp; }
|
90
90
|
#define _CASTASGN(a,b) { char **_alias = (char**)&(a); *_alias=(char*)(b); }
|
91
91
|
#else
|
92
|
+
#define IF_NO_DECLTYPE(x)
|
92
93
|
#define _SV(elt,list)
|
93
94
|
#define _NEXT(elt,list,next) ((elt)->next)
|
94
95
|
#define _NEXTASGN(elt,list,to,next) ((elt)->next)=(to)
|
@@ -111,13 +112,14 @@ do {
|
|
111
112
|
LDECLTYPE(list) _ls_q; \
|
112
113
|
LDECLTYPE(list) _ls_e; \
|
113
114
|
LDECLTYPE(list) _ls_tail; \
|
115
|
+
IF_NO_DECLTYPE(LDECLTYPE(list) _tmp;) \
|
114
116
|
int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping; \
|
115
117
|
if (list) { \
|
116
118
|
_ls_insize = 1; \
|
117
119
|
_ls_looping = 1; \
|
118
120
|
while (_ls_looping) { \
|
119
121
|
_CASTASGN(_ls_p,list); \
|
120
|
-
list = NULL;
|
122
|
+
(list) = NULL; \
|
121
123
|
_ls_tail = NULL; \
|
122
124
|
_ls_nmerges = 0; \
|
123
125
|
while (_ls_p) { \
|
@@ -174,13 +176,14 @@ do {
|
|
174
176
|
LDECLTYPE(list) _ls_q; \
|
175
177
|
LDECLTYPE(list) _ls_e; \
|
176
178
|
LDECLTYPE(list) _ls_tail; \
|
179
|
+
IF_NO_DECLTYPE(LDECLTYPE(list) _tmp;) \
|
177
180
|
int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping; \
|
178
181
|
if (list) { \
|
179
182
|
_ls_insize = 1; \
|
180
183
|
_ls_looping = 1; \
|
181
184
|
while (_ls_looping) { \
|
182
185
|
_CASTASGN(_ls_p,list); \
|
183
|
-
list = NULL;
|
186
|
+
(list) = NULL; \
|
184
187
|
_ls_tail = NULL; \
|
185
188
|
_ls_nmerges = 0; \
|
186
189
|
while (_ls_p) { \
|
@@ -193,11 +196,11 @@ do {
|
|
193
196
|
if (!_ls_q) break; \
|
194
197
|
} \
|
195
198
|
_ls_qsize = _ls_insize; \
|
196
|
-
while (_ls_psize > 0 || (_ls_qsize > 0 && _ls_q)) {
|
199
|
+
while ((_ls_psize > 0) || ((_ls_qsize > 0) && _ls_q)) { \
|
197
200
|
if (_ls_psize == 0) { \
|
198
201
|
_ls_e = _ls_q; _SV(_ls_q,list); _ls_q = \
|
199
202
|
_NEXT(_ls_q,list,next); _RS(list); _ls_qsize--; \
|
200
|
-
} else if (_ls_qsize == 0 || !_ls_q) {
|
203
|
+
} else if ((_ls_qsize == 0) || (!_ls_q)) { \
|
201
204
|
_ls_e = _ls_p; _SV(_ls_p,list); _ls_p = \
|
202
205
|
_NEXT(_ls_p,list,next); _RS(list); _ls_psize--; \
|
203
206
|
} else if (cmp(_ls_p,_ls_q) <= 0) { \
|
@@ -217,7 +220,7 @@ do {
|
|
217
220
|
} \
|
218
221
|
_ls_p = _ls_q; \
|
219
222
|
} \
|
220
|
-
_CASTASGN(list->prev, _ls_tail);
|
223
|
+
_CASTASGN((list)->prev, _ls_tail); \
|
221
224
|
_SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,NULL,next); _RS(list); \
|
222
225
|
if (_ls_nmerges <= 1) { \
|
223
226
|
_ls_looping=0; \
|
@@ -245,7 +248,7 @@ do {
|
|
245
248
|
while (_ls_looping) { \
|
246
249
|
_CASTASGN(_ls_p,list); \
|
247
250
|
_CASTASGN(_ls_oldhead,list); \
|
248
|
-
list = NULL;
|
251
|
+
(list) = NULL; \
|
249
252
|
_ls_tail = NULL; \
|
250
253
|
_ls_nmerges = 0; \
|
251
254
|
while (_ls_p) { \
|
@@ -292,7 +295,7 @@ do {
|
|
292
295
|
} \
|
293
296
|
_ls_p = _ls_q; \
|
294
297
|
} \
|
295
|
-
_CASTASGN(list->prev,_ls_tail);
|
298
|
+
_CASTASGN((list)->prev,_ls_tail); \
|
296
299
|
_CASTASGN(_tmp,list); \
|
297
300
|
_SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_tmp,next); _RS(list); \
|
298
301
|
if (_ls_nmerges <= 1) { \
|
@@ -311,8 +314,8 @@ do {
|
|
311
314
|
|
312
315
|
#define LL_PREPEND2(head,add,next) \
|
313
316
|
do { \
|
314
|
-
(add)->next = head;
|
315
|
-
head = add;
|
317
|
+
(add)->next = (head); \
|
318
|
+
(head) = (add); \
|
316
319
|
} while (0)
|
317
320
|
|
318
321
|
#define LL_CONCAT(head1,head2) \
|
@@ -322,7 +325,7 @@ do {
|
|
322
325
|
do { \
|
323
326
|
LDECLTYPE(head1) _tmp; \
|
324
327
|
if (head1) { \
|
325
|
-
_tmp = head1;
|
328
|
+
_tmp = (head1); \
|
326
329
|
while (_tmp->next) { _tmp = _tmp->next; } \
|
327
330
|
_tmp->next=(head2); \
|
328
331
|
} else { \
|
@@ -338,7 +341,7 @@ do {
|
|
338
341
|
LDECLTYPE(head) _tmp; \
|
339
342
|
(add)->next=NULL; \
|
340
343
|
if (head) { \
|
341
|
-
_tmp = head;
|
344
|
+
_tmp = (head); \
|
342
345
|
while (_tmp->next) { _tmp = _tmp->next; } \
|
343
346
|
_tmp->next=(add); \
|
344
347
|
} else { \
|
@@ -355,87 +358,36 @@ do {
|
|
355
358
|
if ((head) == (del)) { \
|
356
359
|
(head)=(head)->next; \
|
357
360
|
} else { \
|
358
|
-
_tmp = head;
|
361
|
+
_tmp = (head); \
|
359
362
|
while (_tmp->next && (_tmp->next != (del))) { \
|
360
363
|
_tmp = _tmp->next; \
|
361
364
|
} \
|
362
365
|
if (_tmp->next) { \
|
363
|
-
_tmp->next = (
|
364
|
-
} \
|
365
|
-
} \
|
366
|
-
} while (0)
|
367
|
-
|
368
|
-
/* Here are VS2008 replacements for LL_APPEND and LL_DELETE */
|
369
|
-
#define LL_APPEND_VS2008(head,add) \
|
370
|
-
LL_APPEND2_VS2008(head,add,next)
|
371
|
-
|
372
|
-
#define LL_APPEND2_VS2008(head,add,next) \
|
373
|
-
do { \
|
374
|
-
if (head) { \
|
375
|
-
(add)->next = head; /* use add->next as a temp variable */ \
|
376
|
-
while ((add)->next->next) { (add)->next = (add)->next->next; } \
|
377
|
-
(add)->next->next=(add); \
|
378
|
-
} else { \
|
379
|
-
(head)=(add); \
|
380
|
-
} \
|
381
|
-
(add)->next=NULL; \
|
382
|
-
} while (0)
|
383
|
-
|
384
|
-
#define LL_DELETE_VS2008(head,del) \
|
385
|
-
LL_DELETE2_VS2008(head,del,next)
|
386
|
-
|
387
|
-
#define LL_DELETE2_VS2008(head,del,next) \
|
388
|
-
do { \
|
389
|
-
if ((head) == (del)) { \
|
390
|
-
(head)=(head)->next; \
|
391
|
-
} else { \
|
392
|
-
char *_tmp = (char*)(head); \
|
393
|
-
while ((head)->next && ((head)->next != (del))) { \
|
394
|
-
head = (head)->next; \
|
395
|
-
} \
|
396
|
-
if ((head)->next) { \
|
397
|
-
(head)->next = ((del)->next); \
|
398
|
-
} \
|
399
|
-
{ \
|
400
|
-
char **_head_alias = (char**)&(head); \
|
401
|
-
*_head_alias = _tmp; \
|
366
|
+
_tmp->next = (del)->next; \
|
402
367
|
} \
|
403
368
|
} \
|
404
369
|
} while (0)
|
405
|
-
#ifdef NO_DECLTYPE
|
406
|
-
#undef LL_APPEND
|
407
|
-
#define LL_APPEND LL_APPEND_VS2008
|
408
|
-
#undef LL_DELETE
|
409
|
-
#define LL_DELETE LL_DELETE_VS2008
|
410
|
-
#undef LL_DELETE2
|
411
|
-
#define LL_DELETE2 LL_DELETE2_VS2008
|
412
|
-
#undef LL_APPEND2
|
413
|
-
#define LL_APPEND2 LL_APPEND2_VS2008
|
414
|
-
#undef LL_CONCAT /* no LL_CONCAT_VS2008 */
|
415
|
-
#undef DL_CONCAT /* no DL_CONCAT_VS2008 */
|
416
|
-
#endif
|
417
|
-
/* end VS2008 replacements */
|
418
370
|
|
419
371
|
#define LL_COUNT(head,el,counter) \
|
420
372
|
LL_COUNT2(head,el,counter,next) \
|
421
373
|
|
422
374
|
#define LL_COUNT2(head,el,counter,next) \
|
423
|
-
{
|
424
|
-
|
425
|
-
|
426
|
-
}
|
375
|
+
do { \
|
376
|
+
(counter) = 0; \
|
377
|
+
LL_FOREACH2(head,el,next) { ++(counter); } \
|
378
|
+
} while (0)
|
427
379
|
|
428
380
|
#define LL_FOREACH(head,el) \
|
429
381
|
LL_FOREACH2(head,el,next)
|
430
382
|
|
431
383
|
#define LL_FOREACH2(head,el,next) \
|
432
|
-
for(el=head;el;el=(el)->next)
|
384
|
+
for ((el) = (head); el; (el) = (el)->next)
|
433
385
|
|
434
386
|
#define LL_FOREACH_SAFE(head,el,tmp) \
|
435
387
|
LL_FOREACH_SAFE2(head,el,tmp,next)
|
436
388
|
|
437
389
|
#define LL_FOREACH_SAFE2(head,el,tmp,next) \
|
438
|
-
for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)
|
390
|
+
for ((el) = (head); (el) && ((tmp) = (el)->next, 1); (el) = (tmp))
|
439
391
|
|
440
392
|
#define LL_SEARCH_SCALAR(head,out,field,val) \
|
441
393
|
LL_SEARCH_SCALAR2(head,out,field,val,next)
|
@@ -445,7 +397,7 @@ do {
|
|
445
397
|
LL_FOREACH2(head,out,next) { \
|
446
398
|
if ((out)->field == (val)) break; \
|
447
399
|
} \
|
448
|
-
} while(0)
|
400
|
+
} while (0)
|
449
401
|
|
450
402
|
#define LL_SEARCH(head,out,elt,cmp) \
|
451
403
|
LL_SEARCH2(head,out,elt,cmp,next)
|
@@ -455,19 +407,19 @@ do {
|
|
455
407
|
LL_FOREACH2(head,out,next) { \
|
456
408
|
if ((cmp(out,elt))==0) break; \
|
457
409
|
} \
|
458
|
-
} while(0)
|
410
|
+
} while (0)
|
459
411
|
|
460
|
-
#define
|
412
|
+
#define LL_REPLACE_ELEM2(head, el, add, next) \
|
461
413
|
do { \
|
462
414
|
LDECLTYPE(head) _tmp; \
|
463
|
-
assert(head != NULL);
|
464
|
-
assert(el != NULL);
|
465
|
-
assert(add != NULL);
|
415
|
+
assert((head) != NULL); \
|
416
|
+
assert((el) != NULL); \
|
417
|
+
assert((add) != NULL); \
|
466
418
|
(add)->next = (el)->next; \
|
467
419
|
if ((head) == (el)) { \
|
468
420
|
(head) = (add); \
|
469
421
|
} else { \
|
470
|
-
_tmp = head;
|
422
|
+
_tmp = (head); \
|
471
423
|
while (_tmp->next && (_tmp->next != (el))) { \
|
472
424
|
_tmp = _tmp->next; \
|
473
425
|
} \
|
@@ -477,26 +429,141 @@ do {
|
|
477
429
|
} \
|
478
430
|
} while (0)
|
479
431
|
|
432
|
+
#define LL_REPLACE_ELEM(head, el, add) \
|
433
|
+
LL_REPLACE_ELEM2(head, el, add, next)
|
434
|
+
|
435
|
+
#define LL_PREPEND_ELEM2(head, el, add, next) \
|
436
|
+
do { \
|
437
|
+
if (el) { \
|
438
|
+
LDECLTYPE(head) _tmp; \
|
439
|
+
assert((head) != NULL); \
|
440
|
+
assert((add) != NULL); \
|
441
|
+
(add)->next = (el); \
|
442
|
+
if ((head) == (el)) { \
|
443
|
+
(head) = (add); \
|
444
|
+
} else { \
|
445
|
+
_tmp = (head); \
|
446
|
+
while (_tmp->next && (_tmp->next != (el))) { \
|
447
|
+
_tmp = _tmp->next; \
|
448
|
+
} \
|
449
|
+
if (_tmp->next) { \
|
450
|
+
_tmp->next = (add); \
|
451
|
+
} \
|
452
|
+
} \
|
453
|
+
} else { \
|
454
|
+
LL_APPEND2(head, add, next); \
|
455
|
+
} \
|
456
|
+
} while (0) \
|
457
|
+
|
480
458
|
#define LL_PREPEND_ELEM(head, el, add) \
|
459
|
+
LL_PREPEND_ELEM2(head, el, add, next)
|
460
|
+
|
461
|
+
#define LL_APPEND_ELEM2(head, el, add, next) \
|
481
462
|
do { \
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
if ((head) == (el)) { \
|
488
|
-
(head) = (add); \
|
463
|
+
if (el) { \
|
464
|
+
assert((head) != NULL); \
|
465
|
+
assert((add) != NULL); \
|
466
|
+
(add)->next = (el)->next; \
|
467
|
+
(el)->next = (add); \
|
489
468
|
} else { \
|
490
|
-
|
491
|
-
|
492
|
-
|
469
|
+
LL_PREPEND2(head, add, next); \
|
470
|
+
} \
|
471
|
+
} while (0) \
|
472
|
+
|
473
|
+
#define LL_APPEND_ELEM(head, el, add) \
|
474
|
+
LL_APPEND_ELEM2(head, el, add, next)
|
475
|
+
|
476
|
+
#ifdef NO_DECLTYPE
|
477
|
+
/* Here are VS2008 / NO_DECLTYPE replacements for a few functions */
|
478
|
+
|
479
|
+
#undef LL_CONCAT2
|
480
|
+
#define LL_CONCAT2(head1,head2,next) \
|
481
|
+
do { \
|
482
|
+
char *_tmp; \
|
483
|
+
if (head1) { \
|
484
|
+
_tmp = (char*)(head1); \
|
485
|
+
while ((head1)->next) { (head1) = (head1)->next; } \
|
486
|
+
(head1)->next = (head2); \
|
487
|
+
_RS(head1); \
|
488
|
+
} else { \
|
489
|
+
(head1)=(head2); \
|
493
490
|
} \
|
494
|
-
|
495
|
-
|
491
|
+
} while (0)
|
492
|
+
|
493
|
+
#undef LL_APPEND2
|
494
|
+
#define LL_APPEND2(head,add,next) \
|
495
|
+
do { \
|
496
|
+
if (head) { \
|
497
|
+
(add)->next = head; /* use add->next as a temp variable */ \
|
498
|
+
while ((add)->next->next) { (add)->next = (add)->next->next; } \
|
499
|
+
(add)->next->next=(add); \
|
500
|
+
} else { \
|
501
|
+
(head)=(add); \
|
502
|
+
} \
|
503
|
+
(add)->next=NULL; \
|
504
|
+
} while (0)
|
505
|
+
|
506
|
+
#undef LL_DELETE2
|
507
|
+
#define LL_DELETE2(head,del,next) \
|
508
|
+
do { \
|
509
|
+
if ((head) == (del)) { \
|
510
|
+
(head)=(head)->next; \
|
511
|
+
} else { \
|
512
|
+
char *_tmp = (char*)(head); \
|
513
|
+
while ((head)->next && ((head)->next != (del))) { \
|
514
|
+
(head) = (head)->next; \
|
515
|
+
} \
|
516
|
+
if ((head)->next) { \
|
517
|
+
(head)->next = ((del)->next); \
|
518
|
+
} \
|
519
|
+
_RS(head); \
|
520
|
+
} \
|
521
|
+
} while (0)
|
522
|
+
|
523
|
+
#undef LL_REPLACE_ELEM2
|
524
|
+
#define LL_REPLACE_ELEM2(head, el, add, next) \
|
525
|
+
do { \
|
526
|
+
assert((head) != NULL); \
|
527
|
+
assert((el) != NULL); \
|
528
|
+
assert((add) != NULL); \
|
529
|
+
if ((head) == (el)) { \
|
530
|
+
(head) = (add); \
|
531
|
+
} else { \
|
532
|
+
(add)->next = head; \
|
533
|
+
while ((add)->next->next && ((add)->next->next != (el))) { \
|
534
|
+
(add)->next = (add)->next->next; \
|
535
|
+
} \
|
536
|
+
if ((add)->next->next) { \
|
537
|
+
(add)->next->next = (add); \
|
538
|
+
} \
|
539
|
+
} \
|
540
|
+
(add)->next = (el)->next; \
|
541
|
+
} while (0)
|
542
|
+
|
543
|
+
#undef LL_PREPEND_ELEM2
|
544
|
+
#define LL_PREPEND_ELEM2(head, el, add, next) \
|
545
|
+
do { \
|
546
|
+
if (el) { \
|
547
|
+
assert((head) != NULL); \
|
548
|
+
assert((add) != NULL); \
|
549
|
+
if ((head) == (el)) { \
|
550
|
+
(head) = (add); \
|
551
|
+
} else { \
|
552
|
+
(add)->next = (head); \
|
553
|
+
while ((add)->next->next && ((add)->next->next != (el))) { \
|
554
|
+
(add)->next = (add)->next->next; \
|
555
|
+
} \
|
556
|
+
if ((add)->next->next) { \
|
557
|
+
(add)->next->next = (add); \
|
558
|
+
} \
|
559
|
+
} \
|
560
|
+
(add)->next = (el); \
|
561
|
+
} else { \
|
562
|
+
LL_APPEND2(head, add, next); \
|
496
563
|
} \
|
497
|
-
} \
|
498
564
|
} while (0) \
|
499
565
|
|
566
|
+
#endif /* NO_DECLTYPE */
|
500
567
|
|
501
568
|
/******************************************************************************
|
502
569
|
* doubly linked list macros (non-circular) *
|
@@ -506,7 +573,7 @@ do {
|
|
506
573
|
|
507
574
|
#define DL_PREPEND2(head,add,prev,next) \
|
508
575
|
do { \
|
509
|
-
(add)->next = head;
|
576
|
+
(add)->next = (head); \
|
510
577
|
if (head) { \
|
511
578
|
(add)->prev = (head)->prev; \
|
512
579
|
(head)->prev = (add); \
|
@@ -541,10 +608,10 @@ do {
|
|
541
608
|
LDECLTYPE(head1) _tmp; \
|
542
609
|
if (head2) { \
|
543
610
|
if (head1) { \
|
544
|
-
_tmp
|
611
|
+
_CASTASGN(_tmp, (head2)->prev); \
|
545
612
|
(head2)->prev = (head1)->prev; \
|
546
613
|
(head1)->prev->next = (head2); \
|
547
|
-
(head1)->prev
|
614
|
+
_CASTASGN((head1)->prev, _tmp); \
|
548
615
|
} else { \
|
549
616
|
(head1)=(head2); \
|
550
617
|
} \
|
@@ -576,23 +643,23 @@ do {
|
|
576
643
|
DL_COUNT2(head,el,counter,next) \
|
577
644
|
|
578
645
|
#define DL_COUNT2(head,el,counter,next) \
|
579
|
-
{
|
580
|
-
|
581
|
-
|
582
|
-
}
|
646
|
+
do { \
|
647
|
+
(counter) = 0; \
|
648
|
+
DL_FOREACH2(head,el,next) { ++(counter); } \
|
649
|
+
} while (0)
|
583
650
|
|
584
651
|
#define DL_FOREACH(head,el) \
|
585
652
|
DL_FOREACH2(head,el,next)
|
586
653
|
|
587
654
|
#define DL_FOREACH2(head,el,next) \
|
588
|
-
for(el=head;el;el=(el)->next)
|
655
|
+
for ((el) = (head); el; (el) = (el)->next)
|
589
656
|
|
590
657
|
/* this version is safe for deleting the elements during iteration */
|
591
658
|
#define DL_FOREACH_SAFE(head,el,tmp) \
|
592
659
|
DL_FOREACH_SAFE2(head,el,tmp,next)
|
593
660
|
|
594
661
|
#define DL_FOREACH_SAFE2(head,el,tmp,next) \
|
595
|
-
for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)
|
662
|
+
for ((el) = (head); (el) && ((tmp) = (el)->next, 1); (el) = (tmp))
|
596
663
|
|
597
664
|
/* these are identical to their singly-linked list counterparts */
|
598
665
|
#define DL_SEARCH_SCALAR LL_SEARCH_SCALAR
|
@@ -600,11 +667,11 @@ do {
|
|
600
667
|
#define DL_SEARCH_SCALAR2 LL_SEARCH_SCALAR2
|
601
668
|
#define DL_SEARCH2 LL_SEARCH2
|
602
669
|
|
603
|
-
#define
|
670
|
+
#define DL_REPLACE_ELEM2(head, el, add, prev, next) \
|
604
671
|
do { \
|
605
|
-
assert(head != NULL);
|
606
|
-
assert(el != NULL);
|
607
|
-
assert(add != NULL);
|
672
|
+
assert((head) != NULL); \
|
673
|
+
assert((el) != NULL); \
|
674
|
+
assert((add) != NULL); \
|
608
675
|
if ((head) == (el)) { \
|
609
676
|
(head) = (add); \
|
610
677
|
(add)->next = (el)->next; \
|
@@ -626,25 +693,71 @@ do {
|
|
626
693
|
} \
|
627
694
|
} while (0)
|
628
695
|
|
696
|
+
#define DL_REPLACE_ELEM(head, el, add) \
|
697
|
+
DL_REPLACE_ELEM2(head, el, add, prev, next)
|
698
|
+
|
699
|
+
#define DL_PREPEND_ELEM2(head, el, add, prev, next) \
|
700
|
+
do { \
|
701
|
+
if (el) { \
|
702
|
+
assert((head) != NULL); \
|
703
|
+
assert((add) != NULL); \
|
704
|
+
(add)->next = (el); \
|
705
|
+
(add)->prev = (el)->prev; \
|
706
|
+
(el)->prev = (add); \
|
707
|
+
if ((head) == (el)) { \
|
708
|
+
(head) = (add); \
|
709
|
+
} else { \
|
710
|
+
(add)->prev->next = (add); \
|
711
|
+
} \
|
712
|
+
} else { \
|
713
|
+
DL_APPEND2(head, add, prev, next); \
|
714
|
+
} \
|
715
|
+
} while (0) \
|
716
|
+
|
629
717
|
#define DL_PREPEND_ELEM(head, el, add) \
|
718
|
+
DL_PREPEND_ELEM2(head, el, add, prev, next)
|
719
|
+
|
720
|
+
#define DL_APPEND_ELEM2(head, el, add, prev, next) \
|
630
721
|
do { \
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
722
|
+
if (el) { \
|
723
|
+
assert((head) != NULL); \
|
724
|
+
assert((add) != NULL); \
|
725
|
+
(add)->next = (el)->next; \
|
726
|
+
(add)->prev = (el); \
|
727
|
+
(el)->next = (add); \
|
728
|
+
if ((add)->next) { \
|
729
|
+
(add)->next->prev = (add); \
|
730
|
+
} else { \
|
731
|
+
(head)->prev = (add); \
|
732
|
+
} \
|
639
733
|
} else { \
|
640
|
-
(add
|
734
|
+
DL_PREPEND2(head, add, prev, next); \
|
641
735
|
} \
|
642
736
|
} while (0) \
|
643
737
|
|
738
|
+
#define DL_APPEND_ELEM(head, el, add) \
|
739
|
+
DL_APPEND_ELEM2(head, el, add, prev, next)
|
644
740
|
|
645
741
|
/******************************************************************************
|
646
742
|
* circular doubly linked list macros *
|
647
743
|
*****************************************************************************/
|
744
|
+
#define CDL_APPEND(head,add) \
|
745
|
+
CDL_APPEND2(head,add,prev,next)
|
746
|
+
|
747
|
+
#define CDL_APPEND2(head,add,prev,next) \
|
748
|
+
do { \
|
749
|
+
if (head) { \
|
750
|
+
(add)->prev = (head)->prev; \
|
751
|
+
(add)->next = (head); \
|
752
|
+
(head)->prev = (add); \
|
753
|
+
(add)->prev->next = (add); \
|
754
|
+
} else { \
|
755
|
+
(add)->prev = (add); \
|
756
|
+
(add)->next = (add); \
|
757
|
+
(head) = (add); \
|
758
|
+
} \
|
759
|
+
} while (0)
|
760
|
+
|
648
761
|
#define CDL_PREPEND(head,add) \
|
649
762
|
CDL_PREPEND2(head,add,prev,next)
|
650
763
|
|
@@ -659,7 +772,7 @@ do {
|
|
659
772
|
(add)->prev = (add); \
|
660
773
|
(add)->next = (add); \
|
661
774
|
} \
|
662
|
-
(head)=(add);
|
775
|
+
(head) = (add); \
|
663
776
|
} while (0)
|
664
777
|
|
665
778
|
#define CDL_DELETE(head,del) \
|
@@ -667,8 +780,8 @@ do {
|
|
667
780
|
|
668
781
|
#define CDL_DELETE2(head,del,prev,next) \
|
669
782
|
do { \
|
670
|
-
if (
|
671
|
-
(head) =
|
783
|
+
if (((head)==(del)) && ((head)->next == (head))) { \
|
784
|
+
(head) = NULL; \
|
672
785
|
} else { \
|
673
786
|
(del)->next->prev = (del)->prev; \
|
674
787
|
(del)->prev->next = (del)->next; \
|
@@ -680,24 +793,24 @@ do {
|
|
680
793
|
CDL_COUNT2(head,el,counter,next) \
|
681
794
|
|
682
795
|
#define CDL_COUNT2(head, el, counter,next) \
|
683
|
-
{
|
684
|
-
|
685
|
-
|
686
|
-
}
|
796
|
+
do { \
|
797
|
+
(counter) = 0; \
|
798
|
+
CDL_FOREACH2(head,el,next) { ++(counter); } \
|
799
|
+
} while (0)
|
687
800
|
|
688
801
|
#define CDL_FOREACH(head,el) \
|
689
802
|
CDL_FOREACH2(head,el,next)
|
690
803
|
|
691
804
|
#define CDL_FOREACH2(head,el,next) \
|
692
|
-
for(el=head;el;el=((el)->next==head ?
|
805
|
+
for ((el)=(head);el;(el)=(((el)->next==(head)) ? NULL : (el)->next))
|
693
806
|
|
694
807
|
#define CDL_FOREACH_SAFE(head,el,tmp1,tmp2) \
|
695
808
|
CDL_FOREACH_SAFE2(head,el,tmp1,tmp2,prev,next)
|
696
809
|
|
697
810
|
#define CDL_FOREACH_SAFE2(head,el,tmp1,tmp2,prev,next) \
|
698
|
-
for((el)=(head), (
|
699
|
-
|
700
|
-
|
811
|
+
for ((el) = (head), (tmp1) = (head) ? (head)->prev : NULL; \
|
812
|
+
(el) && ((tmp2) = (el)->next, 1); \
|
813
|
+
(el) = ((el) == (tmp1) ? NULL : (tmp2)))
|
701
814
|
|
702
815
|
#define CDL_SEARCH_SCALAR(head,out,field,val) \
|
703
816
|
CDL_SEARCH_SCALAR2(head,out,field,val,next)
|
@@ -707,7 +820,7 @@ do {
|
|
707
820
|
CDL_FOREACH2(head,out,next) { \
|
708
821
|
if ((out)->field == (val)) break; \
|
709
822
|
} \
|
710
|
-
} while(0)
|
823
|
+
} while (0)
|
711
824
|
|
712
825
|
#define CDL_SEARCH(head,out,elt,cmp) \
|
713
826
|
CDL_SEARCH2(head,out,elt,cmp,next)
|
@@ -717,13 +830,13 @@ do {
|
|
717
830
|
CDL_FOREACH2(head,out,next) { \
|
718
831
|
if ((cmp(out,elt))==0) break; \
|
719
832
|
} \
|
720
|
-
} while(0)
|
833
|
+
} while (0)
|
721
834
|
|
722
|
-
#define
|
835
|
+
#define CDL_REPLACE_ELEM2(head, el, add, prev, next) \
|
723
836
|
do { \
|
724
|
-
assert(head != NULL);
|
725
|
-
assert(el != NULL);
|
726
|
-
assert(add != NULL);
|
837
|
+
assert((head) != NULL); \
|
838
|
+
assert((el) != NULL); \
|
839
|
+
assert((add) != NULL); \
|
727
840
|
if ((el)->next == (el)) { \
|
728
841
|
(add)->next = (add); \
|
729
842
|
(add)->prev = (add); \
|
@@ -739,19 +852,44 @@ do {
|
|
739
852
|
} \
|
740
853
|
} while (0)
|
741
854
|
|
855
|
+
#define CDL_REPLACE_ELEM(head, el, add) \
|
856
|
+
CDL_REPLACE_ELEM2(head, el, add, prev, next)
|
857
|
+
|
858
|
+
#define CDL_PREPEND_ELEM2(head, el, add, prev, next) \
|
859
|
+
do { \
|
860
|
+
if (el) { \
|
861
|
+
assert((head) != NULL); \
|
862
|
+
assert((add) != NULL); \
|
863
|
+
(add)->next = (el); \
|
864
|
+
(add)->prev = (el)->prev; \
|
865
|
+
(el)->prev = (add); \
|
866
|
+
(add)->prev->next = (add); \
|
867
|
+
if ((head) == (el)) { \
|
868
|
+
(head) = (add); \
|
869
|
+
} \
|
870
|
+
} else { \
|
871
|
+
CDL_APPEND2(head, add, prev, next); \
|
872
|
+
} \
|
873
|
+
} while (0)
|
874
|
+
|
742
875
|
#define CDL_PREPEND_ELEM(head, el, add) \
|
876
|
+
CDL_PREPEND_ELEM2(head, el, add, prev, next)
|
877
|
+
|
878
|
+
#define CDL_APPEND_ELEM2(head, el, add, prev, next) \
|
743
879
|
do { \
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
(head
|
880
|
+
if (el) { \
|
881
|
+
assert((head) != NULL); \
|
882
|
+
assert((add) != NULL); \
|
883
|
+
(add)->next = (el)->next; \
|
884
|
+
(add)->prev = (el); \
|
885
|
+
(el)->next = (add); \
|
886
|
+
(add)->next->prev = (add); \
|
887
|
+
} else { \
|
888
|
+
CDL_PREPEND2(head, add, prev, next); \
|
753
889
|
} \
|
754
|
-
} while (0)
|
890
|
+
} while (0)
|
755
891
|
|
756
|
-
#
|
892
|
+
#define CDL_APPEND_ELEM(head, el, add) \
|
893
|
+
CDL_APPEND_ELEM2(head, el, add, prev, next)
|
757
894
|
|
895
|
+
#endif /* UTLIST_H */
|